@hamak/ui-shell 0.5.1

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 (143) hide show
  1. package/README.md +414 -0
  2. package/dist/api/api/IFeatureManager.d.ts +56 -0
  3. package/dist/api/api/IFeatureManager.d.ts.map +1 -0
  4. package/dist/api/api/IFeatureManager.js +5 -0
  5. package/dist/api/api/ILayoutManager.d.ts +40 -0
  6. package/dist/api/api/ILayoutManager.d.ts.map +1 -0
  7. package/dist/api/api/ILayoutManager.js +5 -0
  8. package/dist/api/api/IRouter.d.ts +40 -0
  9. package/dist/api/api/IRouter.d.ts.map +1 -0
  10. package/dist/api/api/IRouter.js +5 -0
  11. package/dist/api/api/IShell.d.ts +55 -0
  12. package/dist/api/api/IShell.d.ts.map +1 -0
  13. package/dist/api/api/IShell.js +5 -0
  14. package/dist/api/api/IThemeManager.d.ts +36 -0
  15. package/dist/api/api/IThemeManager.d.ts.map +1 -0
  16. package/dist/api/api/IThemeManager.js +5 -0
  17. package/dist/api/api/index.d.ts +10 -0
  18. package/dist/api/api/index.d.ts.map +1 -0
  19. package/dist/api/api/index.js +9 -0
  20. package/dist/api/index.d.ts +11 -0
  21. package/dist/api/index.d.ts.map +1 -0
  22. package/dist/api/index.js +13 -0
  23. package/dist/api/tokens/index.d.ts +6 -0
  24. package/dist/api/tokens/index.d.ts.map +1 -0
  25. package/dist/api/tokens/index.js +5 -0
  26. package/dist/api/tokens/service-tokens.d.ts +57 -0
  27. package/dist/api/tokens/service-tokens.d.ts.map +1 -0
  28. package/dist/api/tokens/service-tokens.js +56 -0
  29. package/dist/api/types/event-types.d.ts +14 -0
  30. package/dist/api/types/event-types.d.ts.map +1 -0
  31. package/dist/api/types/event-types.js +5 -0
  32. package/dist/api/types/feature-types.d.ts +26 -0
  33. package/dist/api/types/feature-types.d.ts.map +1 -0
  34. package/dist/api/types/feature-types.js +26 -0
  35. package/dist/api/types/index.d.ts +11 -0
  36. package/dist/api/types/index.d.ts.map +1 -0
  37. package/dist/api/types/index.js +10 -0
  38. package/dist/api/types/layout-types.d.ts +29 -0
  39. package/dist/api/types/layout-types.d.ts.map +1 -0
  40. package/dist/api/types/layout-types.js +5 -0
  41. package/dist/api/types/route-types.d.ts +22 -0
  42. package/dist/api/types/route-types.d.ts.map +1 -0
  43. package/dist/api/types/route-types.js +5 -0
  44. package/dist/api/types/shell-context.d.ts +34 -0
  45. package/dist/api/types/shell-context.d.ts.map +1 -0
  46. package/dist/api/types/shell-context.js +5 -0
  47. package/dist/api/types/theme-types.d.ts +13 -0
  48. package/dist/api/types/theme-types.d.ts.map +1 -0
  49. package/dist/api/types/theme-types.js +5 -0
  50. package/dist/impl/core/DefaultFeatureManager.d.ts +24 -0
  51. package/dist/impl/core/DefaultFeatureManager.d.ts.map +1 -0
  52. package/dist/impl/core/DefaultFeatureManager.js +90 -0
  53. package/dist/impl/core/DefaultLayoutManager.d.ts +19 -0
  54. package/dist/impl/core/DefaultLayoutManager.d.ts.map +1 -0
  55. package/dist/impl/core/DefaultLayoutManager.js +71 -0
  56. package/dist/impl/core/DefaultRouter.d.ts +30 -0
  57. package/dist/impl/core/DefaultRouter.d.ts.map +1 -0
  58. package/dist/impl/core/DefaultRouter.js +136 -0
  59. package/dist/impl/core/DefaultShell.d.ts +30 -0
  60. package/dist/impl/core/DefaultShell.d.ts.map +1 -0
  61. package/dist/impl/core/DefaultShell.js +187 -0
  62. package/dist/impl/core/DefaultThemeManager.d.ts +27 -0
  63. package/dist/impl/core/DefaultThemeManager.d.ts.map +1 -0
  64. package/dist/impl/core/DefaultThemeManager.js +101 -0
  65. package/dist/impl/core/index.d.ts +10 -0
  66. package/dist/impl/core/index.d.ts.map +1 -0
  67. package/dist/impl/core/index.js +9 -0
  68. package/dist/impl/index.d.ts +21 -0
  69. package/dist/impl/index.d.ts.map +1 -0
  70. package/dist/impl/index.js +41 -0
  71. package/dist/impl/plugin/ShellPluginFactory.d.ts +11 -0
  72. package/dist/impl/plugin/ShellPluginFactory.d.ts.map +1 -0
  73. package/dist/impl/plugin/ShellPluginFactory.js +73 -0
  74. package/dist/impl/plugin/index.d.ts +6 -0
  75. package/dist/impl/plugin/index.d.ts.map +1 -0
  76. package/dist/impl/plugin/index.js +5 -0
  77. package/dist/impl/providers/CSSVariablesThemeProvider.d.ts +16 -0
  78. package/dist/impl/providers/CSSVariablesThemeProvider.d.ts.map +1 -0
  79. package/dist/impl/providers/CSSVariablesThemeProvider.js +64 -0
  80. package/dist/impl/providers/HashRouterStrategy.d.ts +20 -0
  81. package/dist/impl/providers/HashRouterStrategy.d.ts.map +1 -0
  82. package/dist/impl/providers/HashRouterStrategy.js +67 -0
  83. package/dist/impl/providers/HistoryRouterStrategy.d.ts +21 -0
  84. package/dist/impl/providers/HistoryRouterStrategy.d.ts.map +1 -0
  85. package/dist/impl/providers/HistoryRouterStrategy.js +79 -0
  86. package/dist/impl/providers/LocalStorageProvider.d.ts +13 -0
  87. package/dist/impl/providers/LocalStorageProvider.d.ts.map +1 -0
  88. package/dist/impl/providers/LocalStorageProvider.js +50 -0
  89. package/dist/impl/providers/MemoryStorageProvider.d.ts +14 -0
  90. package/dist/impl/providers/MemoryStorageProvider.d.ts.map +1 -0
  91. package/dist/impl/providers/MemoryStorageProvider.js +29 -0
  92. package/dist/impl/providers/index.d.ts +10 -0
  93. package/dist/impl/providers/index.d.ts.map +1 -0
  94. package/dist/impl/providers/index.js +9 -0
  95. package/dist/impl/utils/index.d.ts +6 -0
  96. package/dist/impl/utils/index.d.ts.map +1 -0
  97. package/dist/impl/utils/index.js +5 -0
  98. package/dist/impl/utils/viewport-utils.d.ts +16 -0
  99. package/dist/impl/utils/viewport-utils.d.ts.map +1 -0
  100. package/dist/impl/utils/viewport-utils.js +52 -0
  101. package/dist/index.d.ts +11 -0
  102. package/dist/index.d.ts.map +1 -0
  103. package/dist/index.js +11 -0
  104. package/dist/spi/guards/NavigationGuard.d.ts +18 -0
  105. package/dist/spi/guards/NavigationGuard.d.ts.map +1 -0
  106. package/dist/spi/guards/NavigationGuard.js +5 -0
  107. package/dist/spi/guards/index.d.ts +6 -0
  108. package/dist/spi/guards/index.d.ts.map +1 -0
  109. package/dist/spi/guards/index.js +5 -0
  110. package/dist/spi/hooks/ShellHooks.d.ts +40 -0
  111. package/dist/spi/hooks/ShellHooks.d.ts.map +1 -0
  112. package/dist/spi/hooks/ShellHooks.js +5 -0
  113. package/dist/spi/hooks/index.d.ts +6 -0
  114. package/dist/spi/hooks/index.d.ts.map +1 -0
  115. package/dist/spi/hooks/index.js +5 -0
  116. package/dist/spi/index.d.ts +18 -0
  117. package/dist/spi/index.d.ts.map +1 -0
  118. package/dist/spi/index.js +22 -0
  119. package/dist/spi/providers/IRouterStrategy.d.ts +35 -0
  120. package/dist/spi/providers/IRouterStrategy.d.ts.map +1 -0
  121. package/dist/spi/providers/IRouterStrategy.js +5 -0
  122. package/dist/spi/providers/IStorageProvider.d.ts +27 -0
  123. package/dist/spi/providers/IStorageProvider.d.ts.map +1 -0
  124. package/dist/spi/providers/IStorageProvider.js +5 -0
  125. package/dist/spi/providers/ITemplateProvider.d.ts +36 -0
  126. package/dist/spi/providers/ITemplateProvider.d.ts.map +1 -0
  127. package/dist/spi/providers/ITemplateProvider.js +5 -0
  128. package/dist/spi/providers/IThemeProvider.d.ts +24 -0
  129. package/dist/spi/providers/IThemeProvider.d.ts.map +1 -0
  130. package/dist/spi/providers/IThemeProvider.js +5 -0
  131. package/dist/spi/providers/index.d.ts +9 -0
  132. package/dist/spi/providers/index.d.ts.map +1 -0
  133. package/dist/spi/providers/index.js +8 -0
  134. package/dist/spi/slots/LayoutSlotProvider.d.ts +31 -0
  135. package/dist/spi/slots/LayoutSlotProvider.d.ts.map +1 -0
  136. package/dist/spi/slots/LayoutSlotProvider.js +5 -0
  137. package/dist/spi/slots/TemplateSlot.d.ts +34 -0
  138. package/dist/spi/slots/TemplateSlot.d.ts.map +1 -0
  139. package/dist/spi/slots/TemplateSlot.js +5 -0
  140. package/dist/spi/slots/index.d.ts +7 -0
  141. package/dist/spi/slots/index.d.ts.map +1 -0
  142. package/dist/spi/slots/index.js +6 -0
  143. package/package.json +67 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * UI Shell Implementation
3
+ * Concrete implementations of UI Shell interfaces
4
+ *
5
+ * This module provides default implementations that can be used directly
6
+ * or extended for custom behavior.
7
+ */
8
+ // Re-export API and SPI types
9
+ export * from '../api';
10
+ export * from '../spi';
11
+ // Export core implementations
12
+ export * from './core';
13
+ // Export providers
14
+ export * from './providers';
15
+ // Export utilities
16
+ export * from './utils';
17
+ // Export plugin integration
18
+ export * from './plugin';
19
+ // Factory functions
20
+ import { DefaultShell } from './core/DefaultShell';
21
+ import { DefaultLayoutManager } from './core/DefaultLayoutManager';
22
+ export function createShell(config) {
23
+ return new DefaultShell(config);
24
+ }
25
+ export function createLayoutManager() {
26
+ return new DefaultLayoutManager();
27
+ }
28
+ // Singleton pattern support
29
+ let globalShell = null;
30
+ export function getShell(config) {
31
+ if (!globalShell) {
32
+ globalShell = createShell(config);
33
+ }
34
+ return globalShell;
35
+ }
36
+ export function resetShell() {
37
+ if (globalShell) {
38
+ globalShell.destroy();
39
+ globalShell = null;
40
+ }
41
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shell Plugin Factory
3
+ * Creates microkernel plugin for UI Shell integration
4
+ */
5
+ import type { PluginModule } from '@hamak/microkernel-spi';
6
+ import type { ActivateContext } from '@hamak/microkernel-api';
7
+ import type { ShellConfig } from '../../api';
8
+ import { DefaultShell } from '../core/DefaultShell';
9
+ export declare function createShellPlugin(config?: ShellConfig): PluginModule;
10
+ export declare function getShellFromContext(ctx: ActivateContext): DefaultShell;
11
+ //# sourceMappingURL=ShellPluginFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShellPluginFactory.d.ts","sourceRoot":"","sources":["../../../src/impl/plugin/ShellPluginFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,YAAY,CAyEpE;AAGD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,YAAY,CAEtE"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Shell Plugin Factory
3
+ * Creates microkernel plugin for UI Shell integration
4
+ */
5
+ import { SHELL_TOKEN, THEME_MANAGER_TOKEN, FEATURE_MANAGER_TOKEN, LAYOUT_MANAGER_TOKEN, ShellCommands, ShellEvents, } from '../../api';
6
+ import { DefaultShell } from '../core/DefaultShell';
7
+ import { DefaultLayoutManager } from '../core/DefaultLayoutManager';
8
+ export function createShellPlugin(config) {
9
+ let shell;
10
+ let layoutManager;
11
+ return {
12
+ initialize(ctx) {
13
+ shell = new DefaultShell(config);
14
+ layoutManager = new DefaultLayoutManager();
15
+ // Provide shell services
16
+ ctx.provide({ provide: SHELL_TOKEN, useValue: shell });
17
+ ctx.provide({ provide: THEME_MANAGER_TOKEN, useValue: shell.getThemeManager() });
18
+ ctx.provide({ provide: FEATURE_MANAGER_TOKEN, useValue: shell.getFeatureManager() });
19
+ ctx.provide({ provide: LAYOUT_MANAGER_TOKEN, useValue: layoutManager });
20
+ // Register commands
21
+ ctx.commands.register(ShellCommands.SET_THEME, (mode) => {
22
+ shell.getThemeManager().setTheme(mode);
23
+ });
24
+ ctx.commands.register(ShellCommands.TOGGLE_THEME, () => {
25
+ shell.getThemeManager().toggleTheme();
26
+ });
27
+ ctx.commands.register(ShellCommands.ENABLE_FEATURE, (key) => {
28
+ shell.getFeatureManager().enable(key);
29
+ });
30
+ ctx.commands.register(ShellCommands.DISABLE_FEATURE, (key) => {
31
+ shell.getFeatureManager().disable(key);
32
+ });
33
+ ctx.commands.register(ShellCommands.TOGGLE_FEATURE, (key) => {
34
+ shell.getFeatureManager().toggle(key);
35
+ });
36
+ ctx.commands.register(ShellCommands.NAVIGATE, (path) => {
37
+ const router = shell.getRouter();
38
+ if (!router) {
39
+ console.warn('Router not initialized');
40
+ return;
41
+ }
42
+ return router.push(path);
43
+ });
44
+ ctx.commands.register(ShellCommands.NAVIGATE_BACK, () => {
45
+ const router = shell.getRouter();
46
+ if (!router) {
47
+ console.warn('Router not initialized');
48
+ return;
49
+ }
50
+ router.back();
51
+ });
52
+ // Forward shell events to microkernel hooks
53
+ shell.on('shell:ready', () => ctx.hooks.emit(ShellEvents.READY, {}));
54
+ shell.on('theme:changed', (event) => ctx.hooks.emit(ShellEvents.THEME_CHANGED, event.payload));
55
+ shell.on('feature:toggled', (event) => ctx.hooks.emit(ShellEvents.FEATURE_TOGGLED, event.payload));
56
+ shell.on('route:changed', (event) => ctx.hooks.emit(ShellEvents.ROUTE_CHANGED, event.payload));
57
+ shell.on('viewport:resized', (event) => ctx.hooks.emit(ShellEvents.VIEWPORT_RESIZED, event.payload));
58
+ },
59
+ async activate(ctx) {
60
+ await shell.initialize();
61
+ const shellContext = shell.getContext();
62
+ ctx.hooks.emit('shell:activated', { context: shellContext });
63
+ },
64
+ deactivate() {
65
+ shell.destroy();
66
+ layoutManager.destroy();
67
+ },
68
+ };
69
+ }
70
+ // Helper functions
71
+ export function getShellFromContext(ctx) {
72
+ return ctx.resolve(SHELL_TOKEN);
73
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Plugin Integration
3
+ * Export plugin factory and helpers
4
+ */
5
+ export * from './ShellPluginFactory';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/impl/plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Plugin Integration
3
+ * Export plugin factory and helpers
4
+ */
5
+ export * from './ShellPluginFactory';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * CSS Variables Theme Provider
3
+ * Implements theming using CSS custom properties
4
+ */
5
+ import type { IThemeProvider } from '../../spi';
6
+ import type { ThemeMode, ThemeConfig } from '../../api';
7
+ export declare class CSSVariablesThemeProvider implements IThemeProvider {
8
+ private mediaQuery?;
9
+ private listeners;
10
+ applyTheme(mode: ThemeMode, config: ThemeConfig): void;
11
+ getSystemPreference(): 'light' | 'dark';
12
+ onSystemThemeChange(callback: (theme: 'light' | 'dark') => void): () => void;
13
+ destroy(): void;
14
+ private handleMediaQueryChange;
15
+ }
16
+ //# sourceMappingURL=CSSVariablesThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CSSVariablesThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/impl/providers/CSSVariablesThemeProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExD,qBAAa,yBAA0B,YAAW,cAAc;IAC9D,OAAO,CAAC,UAAU,CAAC,CAAiB;IACpC,OAAO,CAAC,SAAS,CAAqD;IAEtE,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAgBtD,mBAAmB,IAAI,OAAO,GAAG,MAAM;IAKvC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAiB5E,OAAO,IAAI,IAAI;IAKf,OAAO,CAAC,sBAAsB,CAG5B;CACH"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * CSS Variables Theme Provider
3
+ * Implements theming using CSS custom properties
4
+ */
5
+ export class CSSVariablesThemeProvider {
6
+ constructor() {
7
+ Object.defineProperty(this, "mediaQuery", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: void 0
12
+ });
13
+ Object.defineProperty(this, "listeners", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: new Set()
18
+ });
19
+ Object.defineProperty(this, "handleMediaQueryChange", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: () => {
24
+ const theme = this.getSystemPreference();
25
+ this.listeners.forEach(listener => listener(theme));
26
+ }
27
+ });
28
+ }
29
+ applyTheme(mode, config) {
30
+ if (typeof document === 'undefined')
31
+ return;
32
+ const resolved = mode === 'system' ? this.getSystemPreference() : mode;
33
+ document.documentElement.setAttribute('data-theme', resolved);
34
+ document.documentElement.style.colorScheme = resolved;
35
+ // Apply custom CSS variables
36
+ if (config.cssVariables) {
37
+ Object.entries(config.cssVariables).forEach(([key, value]) => {
38
+ document.documentElement.style.setProperty(key, value);
39
+ });
40
+ }
41
+ }
42
+ getSystemPreference() {
43
+ if (typeof window === 'undefined')
44
+ return 'light';
45
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
46
+ }
47
+ onSystemThemeChange(callback) {
48
+ if (typeof window === 'undefined') {
49
+ return () => { };
50
+ }
51
+ this.listeners.add(callback);
52
+ if (!this.mediaQuery) {
53
+ this.mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
54
+ this.mediaQuery.addEventListener('change', this.handleMediaQueryChange);
55
+ }
56
+ return () => {
57
+ this.listeners.delete(callback);
58
+ };
59
+ }
60
+ destroy() {
61
+ this.mediaQuery?.removeEventListener('change', this.handleMediaQueryChange);
62
+ this.listeners.clear();
63
+ }
64
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Hash Router Strategy
3
+ * Uses URL hash for routing
4
+ */
5
+ import type { IRouterStrategy } from '../../spi';
6
+ export declare class HashRouterStrategy implements IRouterStrategy {
7
+ private listeners;
8
+ constructor();
9
+ push(path: string): void;
10
+ replace(path: string): void;
11
+ back(): void;
12
+ forward(): void;
13
+ getCurrentPath(): string;
14
+ listen(callback: (path: string) => void): () => void;
15
+ destroy(): void;
16
+ private setupListener;
17
+ private handleHashChange;
18
+ private notifyListeners;
19
+ }
20
+ //# sourceMappingURL=HashRouterStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HashRouterStrategy.d.ts","sourceRoot":"","sources":["../../../src/impl/providers/HashRouterStrategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,qBAAa,kBAAmB,YAAW,eAAe;IACxD,OAAO,CAAC,SAAS,CAA0C;;IAM3D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMxB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM3B,IAAI,IAAI,IAAI;IAMZ,OAAO,IAAI,IAAI;IAMf,cAAc,IAAI,MAAM;IAMxB,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAKpD,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,gBAAgB,CAGtB;IAEF,OAAO,CAAC,eAAe;CAGxB"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Hash Router Strategy
3
+ * Uses URL hash for routing
4
+ */
5
+ export class HashRouterStrategy {
6
+ constructor() {
7
+ Object.defineProperty(this, "listeners", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: new Set()
12
+ });
13
+ Object.defineProperty(this, "handleHashChange", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: () => {
18
+ const path = this.getCurrentPath();
19
+ this.notifyListeners(path);
20
+ }
21
+ });
22
+ this.setupListener();
23
+ }
24
+ push(path) {
25
+ if (typeof window === 'undefined')
26
+ return;
27
+ window.location.hash = path;
28
+ }
29
+ replace(path) {
30
+ if (typeof window === 'undefined')
31
+ return;
32
+ window.location.replace(`#${path}`);
33
+ }
34
+ back() {
35
+ if (typeof window !== 'undefined') {
36
+ window.history.back();
37
+ }
38
+ }
39
+ forward() {
40
+ if (typeof window !== 'undefined') {
41
+ window.history.forward();
42
+ }
43
+ }
44
+ getCurrentPath() {
45
+ if (typeof window === 'undefined')
46
+ return '/';
47
+ return window.location.hash.slice(1) || '/';
48
+ }
49
+ listen(callback) {
50
+ this.listeners.add(callback);
51
+ return () => this.listeners.delete(callback);
52
+ }
53
+ destroy() {
54
+ if (typeof window !== 'undefined') {
55
+ window.removeEventListener('hashchange', this.handleHashChange);
56
+ }
57
+ this.listeners.clear();
58
+ }
59
+ setupListener() {
60
+ if (typeof window !== 'undefined') {
61
+ window.addEventListener('hashchange', this.handleHashChange);
62
+ }
63
+ }
64
+ notifyListeners(path) {
65
+ this.listeners.forEach(listener => listener(path));
66
+ }
67
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * History Router Strategy
3
+ * Uses browser History API for routing
4
+ */
5
+ import type { IRouterStrategy } from '../../spi';
6
+ export declare class HistoryRouterStrategy implements IRouterStrategy {
7
+ private base;
8
+ private listeners;
9
+ constructor(base?: string);
10
+ push(path: string): void;
11
+ replace(path: string): void;
12
+ back(): void;
13
+ forward(): void;
14
+ getCurrentPath(): string;
15
+ listen(callback: (path: string) => void): () => void;
16
+ destroy(): void;
17
+ private setupListener;
18
+ private handlePopState;
19
+ private notifyListeners;
20
+ }
21
+ //# sourceMappingURL=HistoryRouterStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HistoryRouterStrategy.d.ts","sourceRoot":"","sources":["../../../src/impl/providers/HistoryRouterStrategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,qBAAa,qBAAsB,YAAW,eAAe;IAC3D,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,SAAS,CAA0C;gBAE/C,IAAI,GAAE,MAAY;IAK9B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQxB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ3B,IAAI,IAAI,IAAI;IAMZ,OAAO,IAAI,IAAI;IAMf,cAAc,IAAI,MAAM;IAOxB,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAKpD,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,cAAc,CAGpB;IAEF,OAAO,CAAC,eAAe;CAGxB"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * History Router Strategy
3
+ * Uses browser History API for routing
4
+ */
5
+ export class HistoryRouterStrategy {
6
+ constructor(base = '/') {
7
+ Object.defineProperty(this, "base", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: void 0
12
+ });
13
+ Object.defineProperty(this, "listeners", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: new Set()
18
+ });
19
+ Object.defineProperty(this, "handlePopState", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: () => {
24
+ const path = this.getCurrentPath();
25
+ this.notifyListeners(path);
26
+ }
27
+ });
28
+ this.base = base;
29
+ this.setupListener();
30
+ }
31
+ push(path) {
32
+ if (typeof window === 'undefined')
33
+ return;
34
+ const fullPath = this.base + path;
35
+ window.history.pushState({}, '', fullPath);
36
+ this.notifyListeners(path);
37
+ }
38
+ replace(path) {
39
+ if (typeof window === 'undefined')
40
+ return;
41
+ const fullPath = this.base + path;
42
+ window.history.replaceState({}, '', fullPath);
43
+ this.notifyListeners(path);
44
+ }
45
+ back() {
46
+ if (typeof window !== 'undefined') {
47
+ window.history.back();
48
+ }
49
+ }
50
+ forward() {
51
+ if (typeof window !== 'undefined') {
52
+ window.history.forward();
53
+ }
54
+ }
55
+ getCurrentPath() {
56
+ if (typeof window === 'undefined')
57
+ return '/';
58
+ const path = window.location.pathname;
59
+ return path.startsWith(this.base) ? path.slice(this.base.length) : path;
60
+ }
61
+ listen(callback) {
62
+ this.listeners.add(callback);
63
+ return () => this.listeners.delete(callback);
64
+ }
65
+ destroy() {
66
+ if (typeof window !== 'undefined') {
67
+ window.removeEventListener('popstate', this.handlePopState);
68
+ }
69
+ this.listeners.clear();
70
+ }
71
+ setupListener() {
72
+ if (typeof window !== 'undefined') {
73
+ window.addEventListener('popstate', this.handlePopState);
74
+ }
75
+ }
76
+ notifyListeners(path) {
77
+ this.listeners.forEach(listener => listener(path));
78
+ }
79
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * LocalStorage Provider
3
+ * Implementation using browser localStorage
4
+ */
5
+ import type { IStorageProvider } from '../../spi';
6
+ export declare class LocalStorageProvider implements IStorageProvider {
7
+ getItem(key: string): string | null;
8
+ setItem(key: string, value: string): void;
9
+ removeItem(key: string): void;
10
+ clear(): void;
11
+ isAvailable(): boolean;
12
+ }
13
+ //# sourceMappingURL=LocalStorageProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalStorageProvider.d.ts","sourceRoot":"","sources":["../../../src/impl/providers/LocalStorageProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAWnC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAU7B,KAAK,IAAI,IAAI;IAUb,WAAW,IAAI,OAAO;CAGvB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * LocalStorage Provider
3
+ * Implementation using browser localStorage
4
+ */
5
+ export class LocalStorageProvider {
6
+ getItem(key) {
7
+ if (!this.isAvailable())
8
+ return null;
9
+ try {
10
+ return localStorage.getItem(key);
11
+ }
12
+ catch (e) {
13
+ console.warn('Failed to get item from localStorage:', e);
14
+ return null;
15
+ }
16
+ }
17
+ setItem(key, value) {
18
+ if (!this.isAvailable())
19
+ return;
20
+ try {
21
+ localStorage.setItem(key, value);
22
+ }
23
+ catch (e) {
24
+ console.warn('Failed to set item in localStorage:', e);
25
+ }
26
+ }
27
+ removeItem(key) {
28
+ if (!this.isAvailable())
29
+ return;
30
+ try {
31
+ localStorage.removeItem(key);
32
+ }
33
+ catch (e) {
34
+ console.warn('Failed to remove item from localStorage:', e);
35
+ }
36
+ }
37
+ clear() {
38
+ if (!this.isAvailable())
39
+ return;
40
+ try {
41
+ localStorage.clear();
42
+ }
43
+ catch (e) {
44
+ console.warn('Failed to clear localStorage:', e);
45
+ }
46
+ }
47
+ isAvailable() {
48
+ return typeof localStorage !== 'undefined';
49
+ }
50
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Memory Storage Provider
3
+ * In-memory storage for SSR or testing
4
+ */
5
+ import type { IStorageProvider } from '../../spi';
6
+ export declare class MemoryStorageProvider implements IStorageProvider {
7
+ private storage;
8
+ getItem(key: string): string | null;
9
+ setItem(key: string, value: string): void;
10
+ removeItem(key: string): void;
11
+ clear(): void;
12
+ isAvailable(): boolean;
13
+ }
14
+ //# sourceMappingURL=MemoryStorageProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MemoryStorageProvider.d.ts","sourceRoot":"","sources":["../../../src/impl/providers/MemoryStorageProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,OAAO,CAAC,OAAO,CAAkC;IAEjD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAInC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,KAAK,IAAI,IAAI;IAIb,WAAW,IAAI,OAAO;CAGvB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Memory Storage Provider
3
+ * In-memory storage for SSR or testing
4
+ */
5
+ export class MemoryStorageProvider {
6
+ constructor() {
7
+ Object.defineProperty(this, "storage", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: new Map()
12
+ });
13
+ }
14
+ getItem(key) {
15
+ return this.storage.get(key) || null;
16
+ }
17
+ setItem(key, value) {
18
+ this.storage.set(key, value);
19
+ }
20
+ removeItem(key) {
21
+ this.storage.delete(key);
22
+ }
23
+ clear() {
24
+ this.storage.clear();
25
+ }
26
+ isAvailable() {
27
+ return true;
28
+ }
29
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Providers
3
+ * Export all provider implementations
4
+ */
5
+ export * from './LocalStorageProvider';
6
+ export * from './MemoryStorageProvider';
7
+ export * from './CSSVariablesThemeProvider';
8
+ export * from './HistoryRouterStrategy';
9
+ export * from './HashRouterStrategy';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/impl/providers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Providers
3
+ * Export all provider implementations
4
+ */
5
+ export * from './LocalStorageProvider';
6
+ export * from './MemoryStorageProvider';
7
+ export * from './CSSVariablesThemeProvider';
8
+ export * from './HistoryRouterStrategy';
9
+ export * from './HashRouterStrategy';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Utilities
3
+ * Export all utility classes
4
+ */
5
+ export * from './viewport-utils';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/impl/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utilities
3
+ * Export all utility classes
4
+ */
5
+ export * from './viewport-utils';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Viewport Utilities
3
+ */
4
+ import type { BreakpointName, Breakpoint } from '../../api';
5
+ export declare const BREAKPOINTS: Record<BreakpointName, Breakpoint>;
6
+ export declare class ViewportUtils {
7
+ static getCurrentBreakpoint(): BreakpointName;
8
+ static matchesBreakpoint(breakpoint: BreakpointName): boolean;
9
+ static isMinBreakpoint(breakpoint: BreakpointName): boolean;
10
+ static getDimensions(): {
11
+ width: number;
12
+ height: number;
13
+ };
14
+ static isTouchDevice(): boolean;
15
+ }
16
+ //# sourceMappingURL=viewport-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport-utils.d.ts","sourceRoot":"","sources":["../../../src/impl/utils/viewport-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,UAAU,CAO1D,CAAC;AAEF,qBAAa,aAAa;IACxB,MAAM,CAAC,oBAAoB,IAAI,cAAc;IAc7C,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAS7D,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAS3D,MAAM,CAAC,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAWzD,MAAM,CAAC,aAAa,IAAI,OAAO;CAIhC"}