@hamak/ui-shell-spi 0.1.0

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.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +1 -0
  2. package/dist/guards/NavigationGuard.d.ts +18 -0
  3. package/dist/guards/NavigationGuard.d.ts.map +1 -0
  4. package/dist/guards/NavigationGuard.js +5 -0
  5. package/dist/guards/index.d.ts +6 -0
  6. package/dist/guards/index.d.ts.map +1 -0
  7. package/dist/guards/index.js +5 -0
  8. package/dist/hooks/ShellHooks.d.ts +40 -0
  9. package/dist/hooks/ShellHooks.d.ts.map +1 -0
  10. package/dist/hooks/ShellHooks.js +5 -0
  11. package/dist/hooks/index.d.ts +6 -0
  12. package/dist/hooks/index.d.ts.map +1 -0
  13. package/dist/hooks/index.js +5 -0
  14. package/dist/index.d.ts +18 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +21 -0
  17. package/dist/providers/IRouterStrategy.d.ts +35 -0
  18. package/dist/providers/IRouterStrategy.d.ts.map +1 -0
  19. package/dist/providers/IRouterStrategy.js +5 -0
  20. package/dist/providers/IStorageProvider.d.ts +27 -0
  21. package/dist/providers/IStorageProvider.d.ts.map +1 -0
  22. package/dist/providers/IStorageProvider.js +5 -0
  23. package/dist/providers/ITemplateProvider.d.ts +36 -0
  24. package/dist/providers/ITemplateProvider.d.ts.map +1 -0
  25. package/dist/providers/ITemplateProvider.js +5 -0
  26. package/dist/providers/IThemeProvider.d.ts +24 -0
  27. package/dist/providers/IThemeProvider.d.ts.map +1 -0
  28. package/dist/providers/IThemeProvider.js +5 -0
  29. package/dist/providers/index.d.ts +9 -0
  30. package/dist/providers/index.d.ts.map +1 -0
  31. package/dist/providers/index.js +8 -0
  32. package/dist/slots/LayoutSlotProvider.d.ts +31 -0
  33. package/dist/slots/LayoutSlotProvider.d.ts.map +1 -0
  34. package/dist/slots/LayoutSlotProvider.js +5 -0
  35. package/dist/slots/TemplateSlot.d.ts +34 -0
  36. package/dist/slots/TemplateSlot.d.ts.map +1 -0
  37. package/dist/slots/TemplateSlot.js +5 -0
  38. package/dist/slots/index.d.ts +7 -0
  39. package/dist/slots/index.d.ts.map +1 -0
  40. package/dist/slots/index.js +6 -0
  41. package/package.json +34 -0
  42. package/src/guards/NavigationGuard.ts +26 -0
  43. package/src/guards/index.ts +6 -0
  44. package/src/hooks/ShellHooks.ts +48 -0
  45. package/src/hooks/index.ts +6 -0
  46. package/src/index.ts +26 -0
  47. package/src/providers/IRouterStrategy.ts +41 -0
  48. package/src/providers/IStorageProvider.ts +31 -0
  49. package/src/providers/ITemplateProvider.ts +41 -0
  50. package/src/providers/IThemeProvider.ts +28 -0
  51. package/src/providers/index.ts +9 -0
  52. package/src/slots/LayoutSlotProvider.ts +37 -0
  53. package/src/slots/TemplateSlot.ts +40 -0
  54. package/src/slots/index.ts +7 -0
  55. package/tsconfig.json +20 -0
@@ -0,0 +1 @@
1
+ $ tsc -p tsconfig.json
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Navigation Guard
3
+ * Interface for route navigation guards
4
+ */
5
+ import type { RouteConfig } from '@amk/ui-shell-api';
6
+ export type NavigationGuard = (to: RouteConfig, from: RouteConfig | null) => boolean | Promise<boolean>;
7
+ export interface NavigationGuardContext {
8
+ /** Route being navigated to */
9
+ to: RouteConfig;
10
+ /** Route being navigated from */
11
+ from: RouteConfig | null;
12
+ /** Abort navigation */
13
+ abort: () => void;
14
+ /** Redirect to another route */
15
+ redirect: (path: string) => void;
16
+ }
17
+ export type AdvancedNavigationGuard = (context: NavigationGuardContext) => void | Promise<void>;
18
+ //# sourceMappingURL=NavigationGuard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationGuard.d.ts","sourceRoot":"","sources":["../../src/guards/NavigationGuard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,CAC5B,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,WAAW,GAAG,IAAI,KACrB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,MAAM,WAAW,sBAAsB;IACrC,+BAA+B;IAC/B,EAAE,EAAE,WAAW,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,uBAAuB;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,gCAAgC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,OAAO,EAAE,sBAAsB,KAC5B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Navigation Guard
3
+ * Interface for route navigation guards
4
+ */
5
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Guards
3
+ * Export all guard interfaces
4
+ */
5
+ export * from './NavigationGuard';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Guards
3
+ * Export all guard interfaces
4
+ */
5
+ export * from './NavigationGuard';
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Shell Hooks
3
+ * Lifecycle hooks for shell customization
4
+ */
5
+ import type { ShellConfig, ShellContext } from '@amk/ui-shell-api';
6
+ export interface ShellLifecycleHooks {
7
+ /**
8
+ * Called before shell initialization
9
+ */
10
+ beforeInit?(config: ShellConfig): void | Promise<void>;
11
+ /**
12
+ * Called after shell initialization
13
+ */
14
+ afterInit?(context: ShellContext): void | Promise<void>;
15
+ /**
16
+ * Called before theme change
17
+ */
18
+ beforeThemeChange?(oldTheme: string, newTheme: string): boolean | Promise<boolean>;
19
+ /**
20
+ * Called after theme change
21
+ */
22
+ afterThemeChange?(theme: string): void | Promise<void>;
23
+ /**
24
+ * Called before feature toggle
25
+ */
26
+ beforeFeatureToggle?(key: string, oldValue: any, newValue: any): boolean | Promise<boolean>;
27
+ /**
28
+ * Called after feature toggle
29
+ */
30
+ afterFeatureToggle?(key: string, value: any): void | Promise<void>;
31
+ /**
32
+ * Called before shell destroy
33
+ */
34
+ beforeDestroy?(): void | Promise<void>;
35
+ /**
36
+ * Called after shell destroy
37
+ */
38
+ afterDestroy?(): void | Promise<void>;
39
+ }
40
+ //# sourceMappingURL=ShellHooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShellHooks.d.ts","sourceRoot":"","sources":["../../src/hooks/ShellHooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD;;OAEG;IACH,SAAS,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;OAEG;IACH,iBAAiB,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnF;;OAEG;IACH,gBAAgB,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD;;OAEG;IACH,mBAAmB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5F;;OAEG;IACH,kBAAkB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE;;OAEG;IACH,aAAa,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,YAAY,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shell Hooks
3
+ * Lifecycle hooks for shell customization
4
+ */
5
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hooks
3
+ * Export all hook interfaces
4
+ */
5
+ export * from './ShellHooks';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hooks
3
+ * Export all hook interfaces
4
+ */
5
+ export * from './ShellHooks';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * UI Shell SPI (Service Provider Interface)
3
+ * Extension points and provider interfaces for UI Shell customization
4
+ *
5
+ * Implement these interfaces to customize shell behavior:
6
+ * - Storage providers (localStorage, cookies, etc.)
7
+ * - Theme providers (CSS vars, styled-components, etc.)
8
+ * - Router strategies (history, hash, memory)
9
+ * - Layout templates
10
+ * - Navigation guards
11
+ * - Lifecycle hooks
12
+ */
13
+ export declare const version = "0.1.0";
14
+ export * from './providers';
15
+ export * from './guards';
16
+ export * from './hooks';
17
+ export * from './slots';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,cAAc,aAAa,CAAC;AAG5B,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * UI Shell SPI (Service Provider Interface)
3
+ * Extension points and provider interfaces for UI Shell customization
4
+ *
5
+ * Implement these interfaces to customize shell behavior:
6
+ * - Storage providers (localStorage, cookies, etc.)
7
+ * - Theme providers (CSS vars, styled-components, etc.)
8
+ * - Router strategies (history, hash, memory)
9
+ * - Layout templates
10
+ * - Navigation guards
11
+ * - Lifecycle hooks
12
+ */
13
+ export const version = '0.1.0';
14
+ // Export all providers
15
+ export * from './providers';
16
+ // Export all guards
17
+ export * from './guards';
18
+ // Export all hooks
19
+ export * from './hooks';
20
+ // Export all slots
21
+ export * from './slots';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Router Strategy Interface
3
+ * Abstraction for routing strategies (history, hash, memory)
4
+ */
5
+ export interface IRouterStrategy {
6
+ /**
7
+ * Push a new entry to the history stack
8
+ */
9
+ push(path: string): void;
10
+ /**
11
+ * Replace the current entry in the history stack
12
+ */
13
+ replace(path: string): void;
14
+ /**
15
+ * Go back in history
16
+ */
17
+ back(): void;
18
+ /**
19
+ * Go forward in history
20
+ */
21
+ forward(): void;
22
+ /**
23
+ * Get the current path
24
+ */
25
+ getCurrentPath(): string;
26
+ /**
27
+ * Listen for navigation changes
28
+ */
29
+ listen(callback: (path: string) => void): () => void;
30
+ /**
31
+ * Clean up resources
32
+ */
33
+ destroy(): void;
34
+ }
35
+ //# sourceMappingURL=IRouterStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRouterStrategy.d.ts","sourceRoot":"","sources":["../../src/providers/IRouterStrategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;OAEG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAErD;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Router Strategy Interface
3
+ * Abstraction for routing strategies (history, hash, memory)
4
+ */
5
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Storage Provider Interface
3
+ * Abstraction for storage mechanisms (localStorage, sessionStorage, cookies, etc.)
4
+ */
5
+ export interface IStorageProvider {
6
+ /**
7
+ * Get an item from storage
8
+ */
9
+ getItem(key: string): string | null;
10
+ /**
11
+ * Set an item in storage
12
+ */
13
+ setItem(key: string, value: string): void;
14
+ /**
15
+ * Remove an item from storage
16
+ */
17
+ removeItem(key: string): void;
18
+ /**
19
+ * Clear all items from storage
20
+ */
21
+ clear?(): void;
22
+ /**
23
+ * Check if storage is available
24
+ */
25
+ isAvailable(): boolean;
26
+ }
27
+ //# sourceMappingURL=IStorageProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IStorageProvider.d.ts","sourceRoot":"","sources":["../../src/providers/IStorageProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,IAAI,IAAI,CAAC;IAEf;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;CACxB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Storage Provider Interface
3
+ * Abstraction for storage mechanisms (localStorage, sessionStorage, cookies, etc.)
4
+ */
5
+ export {};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Template Provider Interface
3
+ * Extension point for custom layout templates
4
+ */
5
+ import type { LayoutSlot } from '@amk/ui-shell-api';
6
+ export interface TemplateOptions {
7
+ /** Template name/identifier */
8
+ name: string;
9
+ /** Template metadata */
10
+ meta?: Record<string, any>;
11
+ /** Responsive breakpoints configuration */
12
+ responsive?: {
13
+ mobile?: Record<string, any>;
14
+ tablet?: Record<string, any>;
15
+ desktop?: Record<string, any>;
16
+ };
17
+ }
18
+ export interface ITemplateProvider {
19
+ /**
20
+ * Get template name
21
+ */
22
+ getName(): string;
23
+ /**
24
+ * Get available slot areas for this template
25
+ */
26
+ getSlotAreas(): string[];
27
+ /**
28
+ * Render a slot area
29
+ */
30
+ renderSlot(area: string, slots: LayoutSlot[]): any;
31
+ /**
32
+ * Get template configuration
33
+ */
34
+ getConfig(): TemplateOptions;
35
+ }
36
+ //# sourceMappingURL=ITemplateProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITemplateProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ITemplateProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,2CAA2C;IAC3C,UAAU,CAAC,EAAE;QACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,IAAI,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;IAEnD;;OAEG;IACH,SAAS,IAAI,eAAe,CAAC;CAC9B"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Template Provider Interface
3
+ * Extension point for custom layout templates
4
+ */
5
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Theme Provider Interface
3
+ * Abstraction for theme application strategies (CSS variables, styled-components, etc.)
4
+ */
5
+ import type { ThemeMode, ThemeConfig } from '@amk/ui-shell-api';
6
+ export interface IThemeProvider {
7
+ /**
8
+ * Apply theme to the UI
9
+ */
10
+ applyTheme(mode: ThemeMode, config: ThemeConfig): void;
11
+ /**
12
+ * Get system theme preference
13
+ */
14
+ getSystemPreference(): 'light' | 'dark';
15
+ /**
16
+ * Listen for system theme changes
17
+ */
18
+ onSystemThemeChange(callback: (theme: 'light' | 'dark') => void): () => void;
19
+ /**
20
+ * Clean up resources
21
+ */
22
+ destroy(): void;
23
+ }
24
+ //# sourceMappingURL=IThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IThemeProvider.d.ts","sourceRoot":"","sources":["../../src/providers/IThemeProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEvD;;OAEG;IACH,mBAAmB,IAAI,OAAO,GAAG,MAAM,CAAC;IAExC;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAE7E;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Theme Provider Interface
3
+ * Abstraction for theme application strategies (CSS variables, styled-components, etc.)
4
+ */
5
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Providers
3
+ * Export all provider interfaces
4
+ */
5
+ export * from './IStorageProvider';
6
+ export * from './IThemeProvider';
7
+ export * from './IRouterStrategy';
8
+ export * from './ITemplateProvider';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Providers
3
+ * Export all provider interfaces
4
+ */
5
+ export * from './IStorageProvider';
6
+ export * from './IThemeProvider';
7
+ export * from './IRouterStrategy';
8
+ export * from './ITemplateProvider';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Layout Slot Provider
3
+ * Interface for dynamic layout slot registration
4
+ */
5
+ export interface AreaOptions {
6
+ /** Area name */
7
+ name: string;
8
+ /** Display order */
9
+ order?: number;
10
+ /** Area metadata */
11
+ meta?: Record<string, any>;
12
+ }
13
+ export interface ILayoutSlotProvider {
14
+ /**
15
+ * Register a new layout area dynamically
16
+ */
17
+ registerArea(name: string, options?: AreaOptions): () => void;
18
+ /**
19
+ * Unregister a layout area
20
+ */
21
+ unregisterArea(name: string): void;
22
+ /**
23
+ * Get all registered areas
24
+ */
25
+ getRegisteredAreas(): string[];
26
+ /**
27
+ * Check if an area is registered
28
+ */
29
+ isAreaRegistered(name: string): boolean;
30
+ }
31
+ //# sourceMappingURL=LayoutSlotProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutSlotProvider.d.ts","sourceRoot":"","sources":["../../src/slots/LayoutSlotProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,WAAW;IAC1B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC;IAE9D;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,kBAAkB,IAAI,MAAM,EAAE,CAAC;IAE/B;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Layout Slot Provider
3
+ * Interface for dynamic layout slot registration
4
+ */
5
+ export {};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Template Slot
3
+ * Extension point for template customization
4
+ */
5
+ import type { LayoutSlot } from '@amk/ui-shell-api';
6
+ export interface TemplateSlotRenderer {
7
+ /**
8
+ * Render function for slot content
9
+ */
10
+ render(slot: LayoutSlot): any;
11
+ /**
12
+ * Check if this renderer can handle the slot
13
+ */
14
+ canRender(slot: LayoutSlot): boolean;
15
+ /**
16
+ * Renderer priority (higher = rendered first)
17
+ */
18
+ priority?: number;
19
+ }
20
+ export interface TemplateSlotExtension {
21
+ /**
22
+ * Register a custom slot renderer
23
+ */
24
+ registerRenderer(renderer: TemplateSlotRenderer): () => void;
25
+ /**
26
+ * Get all registered renderers
27
+ */
28
+ getRenderers(): TemplateSlotRenderer[];
29
+ /**
30
+ * Find appropriate renderer for a slot
31
+ */
32
+ findRenderer(slot: LayoutSlot): TemplateSlotRenderer | null;
33
+ }
34
+ //# sourceMappingURL=TemplateSlot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateSlot.d.ts","sourceRoot":"","sources":["../../src/slots/TemplateSlot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,GAAG,CAAC;IAE9B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IAE7D;;OAEG;IACH,YAAY,IAAI,oBAAoB,EAAE,CAAC;IAEvC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,oBAAoB,GAAG,IAAI,CAAC;CAC7D"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Template Slot
3
+ * Extension point for template customization
4
+ */
5
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Slots
3
+ * Export all slot interfaces
4
+ */
5
+ export * from './LayoutSlotProvider';
6
+ export * from './TemplateSlot';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slots/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Slots
3
+ * Export all slot interfaces
4
+ */
5
+ export * from './LayoutSlotProvider';
6
+ export * from './TemplateSlot';
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@hamak/ui-shell-spi",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "UI Shell SPI - Service Provider Interfaces for UI shell",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "sideEffects": false,
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/amah/app-framework.git",
13
+ "directory": "packages/ui-shell/ui-shell-spi"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "clean": "rm -rf dist"
21
+ },
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ }
27
+ },
28
+ "dependencies": {
29
+ "@hamak/ui-shell-api": "0.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "~5.4.0"
33
+ }
34
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Navigation Guard
3
+ * Interface for route navigation guards
4
+ */
5
+
6
+ import type { RouteConfig } from '@amk/ui-shell-api';
7
+
8
+ export type NavigationGuard = (
9
+ to: RouteConfig,
10
+ from: RouteConfig | null
11
+ ) => boolean | Promise<boolean>;
12
+
13
+ export interface NavigationGuardContext {
14
+ /** Route being navigated to */
15
+ to: RouteConfig;
16
+ /** Route being navigated from */
17
+ from: RouteConfig | null;
18
+ /** Abort navigation */
19
+ abort: () => void;
20
+ /** Redirect to another route */
21
+ redirect: (path: string) => void;
22
+ }
23
+
24
+ export type AdvancedNavigationGuard = (
25
+ context: NavigationGuardContext
26
+ ) => void | Promise<void>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Guards
3
+ * Export all guard interfaces
4
+ */
5
+
6
+ export * from './NavigationGuard';
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Shell Hooks
3
+ * Lifecycle hooks for shell customization
4
+ */
5
+
6
+ import type { ShellConfig, ShellContext } from '@amk/ui-shell-api';
7
+
8
+ export interface ShellLifecycleHooks {
9
+ /**
10
+ * Called before shell initialization
11
+ */
12
+ beforeInit?(config: ShellConfig): void | Promise<void>;
13
+
14
+ /**
15
+ * Called after shell initialization
16
+ */
17
+ afterInit?(context: ShellContext): void | Promise<void>;
18
+
19
+ /**
20
+ * Called before theme change
21
+ */
22
+ beforeThemeChange?(oldTheme: string, newTheme: string): boolean | Promise<boolean>;
23
+
24
+ /**
25
+ * Called after theme change
26
+ */
27
+ afterThemeChange?(theme: string): void | Promise<void>;
28
+
29
+ /**
30
+ * Called before feature toggle
31
+ */
32
+ beforeFeatureToggle?(key: string, oldValue: any, newValue: any): boolean | Promise<boolean>;
33
+
34
+ /**
35
+ * Called after feature toggle
36
+ */
37
+ afterFeatureToggle?(key: string, value: any): void | Promise<void>;
38
+
39
+ /**
40
+ * Called before shell destroy
41
+ */
42
+ beforeDestroy?(): void | Promise<void>;
43
+
44
+ /**
45
+ * Called after shell destroy
46
+ */
47
+ afterDestroy?(): void | Promise<void>;
48
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hooks
3
+ * Export all hook interfaces
4
+ */
5
+
6
+ export * from './ShellHooks';
package/src/index.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * UI Shell SPI (Service Provider Interface)
3
+ * Extension points and provider interfaces for UI Shell customization
4
+ *
5
+ * Implement these interfaces to customize shell behavior:
6
+ * - Storage providers (localStorage, cookies, etc.)
7
+ * - Theme providers (CSS vars, styled-components, etc.)
8
+ * - Router strategies (history, hash, memory)
9
+ * - Layout templates
10
+ * - Navigation guards
11
+ * - Lifecycle hooks
12
+ */
13
+
14
+ export const version = '0.1.0';
15
+
16
+ // Export all providers
17
+ export * from './providers';
18
+
19
+ // Export all guards
20
+ export * from './guards';
21
+
22
+ // Export all hooks
23
+ export * from './hooks';
24
+
25
+ // Export all slots
26
+ export * from './slots';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Router Strategy Interface
3
+ * Abstraction for routing strategies (history, hash, memory)
4
+ */
5
+
6
+ export interface IRouterStrategy {
7
+ /**
8
+ * Push a new entry to the history stack
9
+ */
10
+ push(path: string): void;
11
+
12
+ /**
13
+ * Replace the current entry in the history stack
14
+ */
15
+ replace(path: string): void;
16
+
17
+ /**
18
+ * Go back in history
19
+ */
20
+ back(): void;
21
+
22
+ /**
23
+ * Go forward in history
24
+ */
25
+ forward(): void;
26
+
27
+ /**
28
+ * Get the current path
29
+ */
30
+ getCurrentPath(): string;
31
+
32
+ /**
33
+ * Listen for navigation changes
34
+ */
35
+ listen(callback: (path: string) => void): () => void;
36
+
37
+ /**
38
+ * Clean up resources
39
+ */
40
+ destroy(): void;
41
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Storage Provider Interface
3
+ * Abstraction for storage mechanisms (localStorage, sessionStorage, cookies, etc.)
4
+ */
5
+
6
+ export interface IStorageProvider {
7
+ /**
8
+ * Get an item from storage
9
+ */
10
+ getItem(key: string): string | null;
11
+
12
+ /**
13
+ * Set an item in storage
14
+ */
15
+ setItem(key: string, value: string): void;
16
+
17
+ /**
18
+ * Remove an item from storage
19
+ */
20
+ removeItem(key: string): void;
21
+
22
+ /**
23
+ * Clear all items from storage
24
+ */
25
+ clear?(): void;
26
+
27
+ /**
28
+ * Check if storage is available
29
+ */
30
+ isAvailable(): boolean;
31
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Template Provider Interface
3
+ * Extension point for custom layout templates
4
+ */
5
+
6
+ import type { LayoutSlot } from '@amk/ui-shell-api';
7
+
8
+ export interface TemplateOptions {
9
+ /** Template name/identifier */
10
+ name: string;
11
+ /** Template metadata */
12
+ meta?: Record<string, any>;
13
+ /** Responsive breakpoints configuration */
14
+ responsive?: {
15
+ mobile?: Record<string, any>;
16
+ tablet?: Record<string, any>;
17
+ desktop?: Record<string, any>;
18
+ };
19
+ }
20
+
21
+ export interface ITemplateProvider {
22
+ /**
23
+ * Get template name
24
+ */
25
+ getName(): string;
26
+
27
+ /**
28
+ * Get available slot areas for this template
29
+ */
30
+ getSlotAreas(): string[];
31
+
32
+ /**
33
+ * Render a slot area
34
+ */
35
+ renderSlot(area: string, slots: LayoutSlot[]): any;
36
+
37
+ /**
38
+ * Get template configuration
39
+ */
40
+ getConfig(): TemplateOptions;
41
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Theme Provider Interface
3
+ * Abstraction for theme application strategies (CSS variables, styled-components, etc.)
4
+ */
5
+
6
+ import type { ThemeMode, ThemeConfig } from '@amk/ui-shell-api';
7
+
8
+ export interface IThemeProvider {
9
+ /**
10
+ * Apply theme to the UI
11
+ */
12
+ applyTheme(mode: ThemeMode, config: ThemeConfig): void;
13
+
14
+ /**
15
+ * Get system theme preference
16
+ */
17
+ getSystemPreference(): 'light' | 'dark';
18
+
19
+ /**
20
+ * Listen for system theme changes
21
+ */
22
+ onSystemThemeChange(callback: (theme: 'light' | 'dark') => void): () => void;
23
+
24
+ /**
25
+ * Clean up resources
26
+ */
27
+ destroy(): void;
28
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Providers
3
+ * Export all provider interfaces
4
+ */
5
+
6
+ export * from './IStorageProvider';
7
+ export * from './IThemeProvider';
8
+ export * from './IRouterStrategy';
9
+ export * from './ITemplateProvider';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Layout Slot Provider
3
+ * Interface for dynamic layout slot registration
4
+ */
5
+
6
+ import type { LayoutSlot, LayoutArea } from '@amk/ui-shell-api';
7
+
8
+ export interface AreaOptions {
9
+ /** Area name */
10
+ name: string;
11
+ /** Display order */
12
+ order?: number;
13
+ /** Area metadata */
14
+ meta?: Record<string, any>;
15
+ }
16
+
17
+ export interface ILayoutSlotProvider {
18
+ /**
19
+ * Register a new layout area dynamically
20
+ */
21
+ registerArea(name: string, options?: AreaOptions): () => void;
22
+
23
+ /**
24
+ * Unregister a layout area
25
+ */
26
+ unregisterArea(name: string): void;
27
+
28
+ /**
29
+ * Get all registered areas
30
+ */
31
+ getRegisteredAreas(): string[];
32
+
33
+ /**
34
+ * Check if an area is registered
35
+ */
36
+ isAreaRegistered(name: string): boolean;
37
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Template Slot
3
+ * Extension point for template customization
4
+ */
5
+
6
+ import type { LayoutSlot } from '@amk/ui-shell-api';
7
+
8
+ export interface TemplateSlotRenderer {
9
+ /**
10
+ * Render function for slot content
11
+ */
12
+ render(slot: LayoutSlot): any;
13
+
14
+ /**
15
+ * Check if this renderer can handle the slot
16
+ */
17
+ canRender(slot: LayoutSlot): boolean;
18
+
19
+ /**
20
+ * Renderer priority (higher = rendered first)
21
+ */
22
+ priority?: number;
23
+ }
24
+
25
+ export interface TemplateSlotExtension {
26
+ /**
27
+ * Register a custom slot renderer
28
+ */
29
+ registerRenderer(renderer: TemplateSlotRenderer): () => void;
30
+
31
+ /**
32
+ * Get all registered renderers
33
+ */
34
+ getRenderers(): TemplateSlotRenderer[];
35
+
36
+ /**
37
+ * Find appropriate renderer for a slot
38
+ */
39
+ findRenderer(slot: LayoutSlot): TemplateSlotRenderer | null;
40
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Slots
3
+ * Export all slot interfaces
4
+ */
5
+
6
+ export * from './LayoutSlotProvider';
7
+ export * from './TemplateSlot';
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "outDir": "dist",
9
+ "rootDir": "src",
10
+ "strict": true,
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "moduleResolution": "bundler",
15
+ "resolveJsonModule": true,
16
+ "allowSyntheticDefaultImports": true
17
+ },
18
+ "include": ["src/**/*"],
19
+ "exclude": ["node_modules", "dist"]
20
+ }