rspace-online/website/shell.ts

32 lines
1.1 KiB
TypeScript

/**
* Shell entry point — loaded on every page.
*
* Registers the three header web components:
* <rstack-app-switcher>
* <rstack-space-switcher>
* <rstack-identity>
*/
import { RStackIdentity } from "../shared/components/rstack-identity";
import { RStackAppSwitcher } from "../shared/components/rstack-app-switcher";
import { RStackSpaceSwitcher } from "../shared/components/rstack-space-switcher";
import { RStackTabBar } from "../shared/components/rstack-tab-bar";
import { RStackMi } from "../shared/components/rstack-mi";
import { rspaceNavUrl } from "../shared/url-helpers";
// Expose URL helper globally (used by shell inline scripts + components)
(window as any).__rspaceNavUrl = rspaceNavUrl;
// Register all header components
RStackIdentity.define();
RStackAppSwitcher.define();
RStackSpaceSwitcher.define();
RStackTabBar.define();
RStackMi.define();
// Reload space list when user signs in/out (to show/hide private spaces)
document.addEventListener("auth-change", () => {
const spaceSwitcher = document.querySelector("rstack-space-switcher") as any;
spaceSwitcher?.reload?.();
});