hubg-app-shell 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppShell.d.ts +18 -4
- package/dist/components/AppShell.d.ts.map +1 -1
- package/dist/components/Header.d.ts +20 -1
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/ModuleHost.d.ts +5 -2
- package/dist/components/ModuleHost.d.ts.map +1 -1
- package/dist/components/ShellErrorBoundary.d.ts +6 -6
- package/dist/components/ShellErrorBoundary.d.ts.map +1 -1
- package/dist/components/SideNavigation.d.ts +0 -2
- package/dist/components/SideNavigation.d.ts.map +1 -1
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/context/ShellContext.d.ts +3 -6
- package/dist/context/ShellContext.d.ts.map +1 -1
- package/dist/events/EventBus.d.ts +9 -4
- package/dist/events/EventBus.d.ts.map +1 -1
- package/dist/index.cjs.js +1658 -1167
- package/dist/index.cjs.js.map +23 -15
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1774 -1279
- package/dist/index.es.js.map +23 -15
- package/dist/platform/createPlatformAPI.d.ts +9 -4
- package/dist/platform/createPlatformAPI.d.ts.map +1 -1
- package/dist/registry/ModuleRegistry.d.ts +8 -3
- package/dist/registry/ModuleRegistry.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/context.d.ts +7 -3
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/module.d.ts +9 -7
- package/dist/types/module.d.ts.map +1 -1
- package/dist/types/navigation.d.ts +13 -21
- package/dist/types/navigation.d.ts.map +1 -1
- package/dist/utils/getInitials.d.ts +3 -0
- package/dist/utils/getInitials.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -8,14 +8,28 @@ export interface AppShellProps {
|
|
|
8
8
|
navigationConfig: NavigationConfig;
|
|
9
9
|
/** Content rendered inside the main area. The host app owns routing. */
|
|
10
10
|
children?: React.ReactNode;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* The currently active route. Kept in sync: changes to this prop update
|
|
13
|
+
* the shell's active-route state without remounting.
|
|
14
|
+
*/
|
|
12
15
|
activeRoute?: string;
|
|
13
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Called when the user clicks a nav item.
|
|
18
|
+
*
|
|
19
|
+
* When provided, the shell assumes the host app's router manages history
|
|
20
|
+
* and does NOT call `window.history.pushState`.
|
|
21
|
+
* When omitted, the shell manages history itself.
|
|
22
|
+
*/
|
|
14
23
|
onNavigate?: (path: string) => void;
|
|
15
24
|
/** Background color for the tenant logo tile in the sidebar. */
|
|
16
25
|
tenantBrandColor?: string;
|
|
17
|
-
/** Items pinned at the bottom of the sidebar (e.g. Hub Settings
|
|
26
|
+
/** Items pinned at the bottom of the sidebar (e.g. Hub Settings). */
|
|
18
27
|
footerNavItems?: NavItem[];
|
|
28
|
+
/**
|
|
29
|
+
* Called when an unhandled error is caught by the top-level error boundary.
|
|
30
|
+
* Use to wire up Sentry, Datadog RUM, or any other telemetry sink.
|
|
31
|
+
*/
|
|
32
|
+
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
19
33
|
}
|
|
20
|
-
export declare function AppShell(props: AppShellProps): React.JSX.Element;
|
|
34
|
+
export declare function AppShell({ onError, ...props }: AppShellProps): React.JSX.Element;
|
|
21
35
|
//# sourceMappingURL=AppShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/components/AppShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/components/AppShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAIxE,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,OAAO,EAAE,aAAa,CAAC;IACvB,0CAA0C;IAC1C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;CACzD;AAqJD,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAY5D"}
|
|
@@ -5,9 +5,28 @@ export interface HeaderProps {
|
|
|
5
5
|
tenant: TenantContext;
|
|
6
6
|
/**
|
|
7
7
|
* Extra controls injected between the utility icons and the user avatar.
|
|
8
|
-
*
|
|
8
|
+
* Used for app-specific buttons (notifications badge, feedback widget, etc.).
|
|
9
9
|
*/
|
|
10
10
|
rightSlot?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* URL for the "Settings" menu item. Defaults to "/settings/profile".
|
|
13
|
+
* Override this for apps with a different profile settings route.
|
|
14
|
+
*/
|
|
15
|
+
settingsHref?: string;
|
|
16
|
+
/**
|
|
17
|
+
* URL for the "Log out" action. Defaults to "/member/logout".
|
|
18
|
+
*/
|
|
19
|
+
logoutHref?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the "Members online" icon is clicked.
|
|
22
|
+
* Omit to hide the button (stub buttons are an accessibility anti-pattern).
|
|
23
|
+
*/
|
|
24
|
+
onMembersOnlineClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
25
|
+
/**
|
|
26
|
+
* Called when the "Notifications" icon is clicked.
|
|
27
|
+
* Omit to hide the button.
|
|
28
|
+
*/
|
|
29
|
+
onNotificationsClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
11
30
|
}
|
|
12
31
|
export declare const Header: React.NamedExoticComponent<HeaderProps>;
|
|
13
32
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAkHtE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClE;;;OAGG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,MAAM,yCAkDjB,CAAC"}
|
|
@@ -2,12 +2,15 @@ import type { ApplicationModule } from "../types/module.js";
|
|
|
2
2
|
import type { ModuleContext } from "../types/context.js";
|
|
3
3
|
import type { PlatformAPI } from "../types/platform.js";
|
|
4
4
|
export interface ModuleHostProps {
|
|
5
|
-
/** Resolved module implementation.
|
|
5
|
+
/** Resolved module implementation. Pass null while loading. */
|
|
6
6
|
module: ApplicationModule | null;
|
|
7
7
|
moduleId: string;
|
|
8
8
|
context: ModuleContext;
|
|
9
9
|
platform: PlatformAPI;
|
|
10
10
|
className?: string;
|
|
11
|
+
/** Called when an error is caught by the surrounding error boundary. */
|
|
12
|
+
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
import type React from "react";
|
|
15
|
+
export declare function ModuleHost({ module, moduleId, context, platform, className, onError, }: ModuleHostProps): React.JSX.Element;
|
|
13
16
|
//# sourceMappingURL=ModuleHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleHost.d.ts","sourceRoot":"","sources":["../../src/components/ModuleHost.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModuleHost.d.ts","sourceRoot":"","sources":["../../src/components/ModuleHost.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAwC,MAAM,oBAAoB,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA0HxD,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;CACzD;AAGD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,eAAe,qBA8CjB"}
|
|
@@ -5,21 +5,21 @@ interface ErrorBoundaryState {
|
|
|
5
5
|
}
|
|
6
6
|
interface ShellErrorBoundaryProps {
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
/** Called when an error is caught —
|
|
8
|
+
/** Called when an error is caught — wire up Sentry, Datadog RUM, etc. */
|
|
9
9
|
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
10
|
-
/** Custom fallback
|
|
10
|
+
/** Custom fallback UI. Receives the error and a retry callback. */
|
|
11
11
|
fallback?: (error: Error, retry: () => void) => React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* React class-based error boundary
|
|
15
|
-
* A
|
|
16
|
-
* as an isolated error state
|
|
14
|
+
* React class-based error boundary that isolates a module slot or the
|
|
15
|
+
* entire shell. A crash inside the tree is caught here, logged, and shown
|
|
16
|
+
* as an isolated error state so the rest of the application stays alive.
|
|
17
17
|
*/
|
|
18
18
|
export declare class ShellErrorBoundary extends React.Component<ShellErrorBoundaryProps, ErrorBoundaryState> {
|
|
19
19
|
constructor(props: ShellErrorBoundaryProps);
|
|
20
20
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
21
21
|
componentDidCatch(error: Error, info: React.ErrorInfo): void;
|
|
22
|
-
private handleRetry;
|
|
22
|
+
private readonly handleRetry;
|
|
23
23
|
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ShellErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"ShellErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ShellErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yEAAyE;IACzE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxD,mEAAmE;IACnE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CACjE;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CACrD,uBAAuB,EACvB,kBAAkB,CACnB;gBACa,KAAK,EAAE,uBAAuB;IAK1C,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB;IAIjE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAM5D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAE1B;IAEF,MAAM;CAWP"}
|
|
@@ -6,9 +6,7 @@ export interface SideNavigationProps {
|
|
|
6
6
|
permissions: string[];
|
|
7
7
|
onNavigate: (route: string) => void;
|
|
8
8
|
tenant: TenantContext;
|
|
9
|
-
/** Background color for the tenant logo tile */
|
|
10
9
|
tenantBrandColor?: string;
|
|
11
|
-
/** Items pinned at the bottom (e.g. Hub Settings, Help, Shortcuts) */
|
|
12
10
|
footerNavItems?: NavItem[];
|
|
13
11
|
}
|
|
14
12
|
export declare const SideNavigation: React.NamedExoticComponent<SideNavigationProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../src/components/SideNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../src/components/SideNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAmRzD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,iDAqGzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/components/ui/accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAIhE,QAAA,MAAM,SAAS,8JAA0B,CAAC;AAE1C,QAAA,MAAM,aAAa,iKAKjB,CAAC;AAGH,QAAA,MAAM,gBAAgB;kBAGJ,OAAO;
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/components/ui/accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAIhE,QAAA,MAAM,SAAS,8JAA0B,CAAC;AAE1C,QAAA,MAAM,aAAa,iKAKjB,CAAC;AAGH,QAAA,MAAM,gBAAgB;kBAGJ,OAAO;2CAyBvB,CAAC;AAGH,QAAA,MAAM,gBAAgB,oKAWpB,CAAC;AAGH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;8EAkCnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;8EAkCnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,uFAaX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
interface ShellContextValue {
|
|
2
|
+
export interface ShellContextValue {
|
|
3
3
|
/** Whether the side navigation is collapsed to icon-only mode. */
|
|
4
4
|
navCollapsed: boolean;
|
|
5
|
-
setNavCollapsed:
|
|
6
|
-
/** Title shown in the header, set by the shell when a nav item activates. */
|
|
7
|
-
pageTitle: string | undefined;
|
|
8
|
-
setPageTitle: (title: string | undefined) => void;
|
|
5
|
+
setNavCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
|
|
9
6
|
/** The currently active route, owned by the shell. */
|
|
10
7
|
activeRoute: string;
|
|
11
|
-
setActiveRoute:
|
|
8
|
+
setActiveRoute: React.Dispatch<React.SetStateAction<string>>;
|
|
12
9
|
}
|
|
13
10
|
export declare function useShell(): ShellContextValue;
|
|
14
11
|
interface ShellProviderProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellContext.d.ts","sourceRoot":"","sources":["../../src/context/ShellContext.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ShellContext.d.ts","sourceRoot":"","sources":["../../src/context/ShellContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E,MAAM,WAAW,iBAAiB;IAChC,kEAAkE;IAClE,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAC9D;AAID,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,kBAAkB,qBAW3E"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { EventHandler, PlatformEvent } from "../types/platform.js";
|
|
2
2
|
/**
|
|
3
3
|
* Lightweight pub/sub bus shared across the shell and all mounted modules.
|
|
4
|
-
* Modules
|
|
5
|
-
* publish and subscribe,
|
|
4
|
+
* Modules interact through a scoped view created by `createPlatformAPI` —
|
|
5
|
+
* they can only publish and subscribe, not clear or inspect the bus.
|
|
6
6
|
*/
|
|
7
7
|
export declare class EventBus {
|
|
8
8
|
private readonly handlers;
|
|
9
|
+
/** Optional telemetry hook for handler errors. */
|
|
10
|
+
onHandlerError?: (error: unknown, event: PlatformEvent) => void;
|
|
9
11
|
publish(event: PlatformEvent): void;
|
|
10
12
|
subscribe(eventType: string, handler: EventHandler): () => void;
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Remove all handlers registered by a specific module.
|
|
15
|
+
* Call this when a module is unmounted to prevent orphaned subscribers.
|
|
16
|
+
*/
|
|
17
|
+
clearModule(handlers: Set<() => void>): void;
|
|
12
18
|
publishContextUpdate(field: string, value: unknown): void;
|
|
13
|
-
/** Publish a theme-change event. */
|
|
14
19
|
publishThemeUpdate(payload: unknown): void;
|
|
15
20
|
}
|
|
16
21
|
//# sourceMappingURL=EventBus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["../../src/events/EventBus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;GAIG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;
|
|
1
|
+
{"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["../../src/events/EventBus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;GAIG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IACjE,kDAAkD;IAClD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAEhE,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAcnC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,IAAI;IAa/D;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAM5C,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIzD,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAG3C"}
|