@sixbell-telco/sdk 1.5.0 → 2.0.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 (131) hide show
  1. package/CHANGELOG.md +223 -710
  2. package/README.md +307 -282
  3. package/_index.css +29 -3
  4. package/components/audio-player/audio-timeline/audio-timeline.component.d.ts +1 -1
  5. package/components/audio-player/services/audio.service.d.ts +14 -14
  6. package/components/countdown/src/countdown.component.d.ts +1 -1
  7. package/components/dropdown/dropdown-chevron/dropdown-chevron.component.d.ts +6 -1
  8. package/components/dropdown/dropdown-content/dropdown-content.component.d.ts +1 -1
  9. package/components/dropdown/dropdown-item/dropdown-item.component.d.ts +6 -1
  10. package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +7 -1
  11. package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +7 -1
  12. package/components/dropdown/dropdown-trigger/dropdown-trigger.component.d.ts +30 -0
  13. package/components/dropdown/public-api.d.ts +0 -1
  14. package/components/dropdown/src/dropdown.component.d.ts +31 -7
  15. package/components/dropdown-menu/src/dropdown-menu-content/dropdown-menu-content.component.d.ts +2 -3
  16. package/components/dual-list/src/dual-list.component.d.ts +2 -1
  17. package/components/file-upload/file-dropzone/file-dropzone.component.d.ts +7 -7
  18. package/components/file-upload/file-uploader/file-uploader.component.d.ts +7 -7
  19. package/components/forms/combobox/src/combobox.component.d.ts +24 -0
  20. package/components/forms/input/src/input.component.d.ts +11 -1
  21. package/components/forms/select/src/select.component.d.ts +24 -0
  22. package/components/forms/textarea/src/textarea.component.d.ts +10 -10
  23. package/components/link/src/link.component.d.ts +0 -3
  24. package/components/tab/directives/tab-content/tab-content.directive.d.ts +3 -3
  25. package/components/tab/directives/tab-header/tab-header.directive.d.ts +2 -2
  26. package/components/wizard/services/wizard.service.d.ts +5 -5
  27. package/directives/auto-focus/public-api.d.ts +1 -1
  28. package/directives/auto-focus/src/{autofocus.directive.d.ts → auto-focus.directive.d.ts} +5 -7
  29. package/directives/only-numbers/public-api.d.ts +6 -1
  30. package/directives/only-numbers/src/only-numbers.directive.d.ts +37 -0
  31. package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs +7 -5
  32. package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs.map +1 -1
  33. package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +1 -1
  34. package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
  35. package/fesm2022/sixbell-telco-sdk-components-badge.mjs +2 -2
  36. package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
  37. package/fesm2022/sixbell-telco-sdk-components-countdown.mjs.map +1 -1
  38. package/fesm2022/sixbell-telco-sdk-components-data-table.mjs +2 -2
  39. package/fesm2022/sixbell-telco-sdk-components-data-table.mjs.map +1 -1
  40. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs +0 -4
  41. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs.map +1 -1
  42. package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +472 -341
  43. package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
  44. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +8 -7
  45. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
  46. package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs +6 -4
  47. package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs.map +1 -1
  48. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +58 -2
  49. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
  50. package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs +2 -0
  51. package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs.map +1 -1
  52. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +15 -5
  53. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
  54. package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +54 -4
  55. package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
  56. package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +19 -8
  57. package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
  58. package/fesm2022/sixbell-telco-sdk-components-link.mjs +2 -7
  59. package/fesm2022/sixbell-telco-sdk-components-link.mjs.map +1 -1
  60. package/fesm2022/sixbell-telco-sdk-components-overlay.mjs +2 -2
  61. package/fesm2022/sixbell-telco-sdk-components-overlay.mjs.map +1 -1
  62. package/fesm2022/sixbell-telco-sdk-components-tab.mjs.map +1 -1
  63. package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
  64. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +14 -31
  65. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
  66. package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs +42 -8
  67. package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs.map +1 -1
  68. package/fesm2022/sixbell-telco-sdk-utils-date.mjs +1 -1
  69. package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -1
  70. package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs +1 -1
  71. package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs.map +1 -1
  72. package/fesm2022/sixbell-telco-sdk-utils-runtime-config.mjs +339 -0
  73. package/fesm2022/sixbell-telco-sdk-utils-runtime-config.mjs.map +1 -0
  74. package/fesm2022/sixbell-telco-sdk-utils-sync.mjs +1 -1
  75. package/fesm2022/sixbell-telco-sdk-utils-sync.mjs.map +1 -1
  76. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +1053 -716
  77. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
  78. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +345 -257
  79. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  80. package/package.json +73 -72
  81. package/utils/runtime-config/README.md +235 -0
  82. package/utils/{resource-loader → runtime-config}/index.d.ts +1 -1
  83. package/utils/runtime-config/public-api.d.ts +5 -0
  84. package/utils/runtime-config/src/http-client.d.ts +11 -0
  85. package/utils/runtime-config/src/runtime-config-loader.d.ts +23 -0
  86. package/utils/runtime-config/src/runtime-config-store.d.ts +11 -0
  87. package/utils/runtime-config/src/runtime-update-adapter.d.ts +15 -0
  88. package/utils/runtime-config/src/types.d.ts +66 -0
  89. package/utils/theme/README.md +324 -986
  90. package/utils/theme/public-api.d.ts +4 -4
  91. package/utils/theme/src/constants.d.ts +6 -12
  92. package/utils/theme/src/models/theme.d.ts +46 -173
  93. package/utils/theme/src/providers/theme.provider.d.ts +0 -10
  94. package/utils/theme/src/providers/theme.provider.types.d.ts +16 -15
  95. package/utils/theme/src/theme-assets/theme-assets.service.d.ts +16 -12
  96. package/utils/theme/src/theme-dom/theme-dom.service.d.ts +8 -0
  97. package/utils/theme/src/theme.service.d.ts +24 -27
  98. package/utils/theme/src/utils/utils.d.ts +2 -10
  99. package/utils/translation/README.md +170 -1390
  100. package/utils/translation/public-api.d.ts +3 -3
  101. package/utils/translation/src/constants.d.ts +7 -9
  102. package/utils/translation/src/models/translation.d.ts +9 -10
  103. package/utils/translation/src/providers/translation.provider.d.ts +17 -28
  104. package/utils/translation/src/providers/translation.provider.types.d.ts +13 -6
  105. package/utils/translation/src/translation.service.d.ts +37 -9
  106. package/components/dropdown/src/services/dropdown.service.d.ts +0 -22
  107. package/directives/only-numbers/src/just-numbers.directive.d.ts +0 -9
  108. package/fesm2022/sixbell-telco-sdk-utils-resource-loader.mjs +0 -1222
  109. package/fesm2022/sixbell-telco-sdk-utils-resource-loader.mjs.map +0 -1
  110. package/utils/resource-loader/README.md +0 -460
  111. package/utils/resource-loader/public-api.d.ts +0 -1
  112. package/utils/resource-loader/src/cache/index.d.ts +0 -2
  113. package/utils/resource-loader/src/cache/layers/factory.d.ts +0 -38
  114. package/utils/resource-loader/src/cache/layers/index.d.ts +0 -3
  115. package/utils/resource-loader/src/cache/layers/indexed-db-cache.d.ts +0 -118
  116. package/utils/resource-loader/src/cache/layers/local-storage-cache.d.ts +0 -86
  117. package/utils/resource-loader/src/cache/layers/memory-cache.d.ts +0 -76
  118. package/utils/resource-loader/src/cache/types.d.ts +0 -107
  119. package/utils/resource-loader/src/config/index.d.ts +0 -1
  120. package/utils/resource-loader/src/config/load-config.d.ts +0 -32
  121. package/utils/resource-loader/src/constants.d.ts +0 -38
  122. package/utils/resource-loader/src/http/index.d.ts +0 -1
  123. package/utils/resource-loader/src/http/retryable-client.d.ts +0 -43
  124. package/utils/resource-loader/src/index.d.ts +0 -1
  125. package/utils/resource-loader/src/resource-loader.d.ts +0 -67
  126. package/utils/resource-loader/src/types.d.ts +0 -152
  127. package/utils/resource-loader/src/utils/cache-validator.d.ts +0 -72
  128. package/utils/resource-loader/src/utils/helpers.d.ts +0 -15
  129. package/utils/resource-loader/src/utils/index.d.ts +0 -2
  130. package/utils/theme/src/providers/constants.d.ts +0 -7
  131. package/utils/translation/src/providers/constants.d.ts +0 -11
@@ -1,9 +1,9 @@
1
- export * from './src/constants';
2
- export * from './src/models/theme';
3
- export * from './src/providers/theme.provider';
1
+ export { DEFAULT_BASE_THEME, DEFAULT_SCHEME, FALLBACK_RUNTIME_THEME_CONFIG, THEME_SCHEMA_VERSION, VALID_SCHEMES } from './src/constants';
2
+ export type { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, RuntimeThemeConfigFile, ThemeAsset, ThemeAssets, ThemeScheme, ThemeStyleDefinition, ThemeVariants, } from './src/models/theme';
3
+ export { provideRuntimeTheme } from './src/providers/theme.provider';
4
4
  export { ThemeAssetsService } from './src/theme-assets/theme-assets.service';
5
5
  export { ThemeDomService } from './src/theme-dom/theme-dom.service';
6
6
  export { ThemeSchemeService } from './src/theme-scheme/theme-scheme.service';
7
7
  export { ThemeStorageService } from './src/theme-storage/theme-storage.service';
8
8
  export { ThemeService } from './src/theme.service';
9
- export * from './src/utils/utils';
9
+ export { buildThemeIdentifier, formatSchemeName, formatThemeName, hasLocalStorage, isThemeAvailable, isValidScheme, parseThemeIdentifier, resolveDefaultTheme, supportsMediaQuery, validateThemeConfig, } from './src/utils/utils';
@@ -2,8 +2,7 @@
2
2
  * Theme Constants and Injection Tokens
3
3
  * Centralized configuration values and DI tokens following Single Responsibility Principle
4
4
  */
5
- import { InjectionToken } from '@angular/core';
6
- import { RuntimeThemeConfig, ThemeConfig } from './models/theme';
5
+ import { RuntimeThemeConfig } from './models/theme';
7
6
  /**
8
7
  * Default base theme - always available unless explicitly excluded
9
8
  * This is the foundational theme that comes with the SDK
@@ -46,6 +45,11 @@ export declare const THEME_SCHEME_SEPARATOR: "__";
46
45
  * Default theme scheme preference
47
46
  */
48
47
  export declare const DEFAULT_SCHEME: "system";
48
+ /**
49
+ * Schema version for runtime theme configuration payloads.
50
+ * Bump this when the JSON structure changes in a breaking way.
51
+ */
52
+ export declare const THEME_SCHEMA_VERSION: "2";
49
53
  /**
50
54
  * All valid scheme values
51
55
  */
@@ -62,13 +66,3 @@ export declare const DARK_THEME_CLASS: "dark";
62
66
  * Media query for detecting system dark mode preference
63
67
  */
64
68
  export declare const DARK_MODE_MEDIA_QUERY: "(prefers-color-scheme: dark)";
65
- /**
66
- * Injection token for theme configuration
67
- * Used to provide static theme configuration at bootstrap
68
- */
69
- export declare const THEME_CONFIG_TOKEN: InjectionToken<ThemeConfig>;
70
- /**
71
- * Injection token for runtime theme configuration
72
- * Used to provide dynamic runtime theme configuration loaded from JSON file
73
- */
74
- export declare const RUNTIME_THEME_CONFIG_TOKEN: InjectionToken<RuntimeThemeConfig>;
@@ -7,6 +7,18 @@ export type ThemeScheme = 'system' | 'light' | 'dark';
7
7
  * Used for actual rendering decisions where system preference has been resolved
8
8
  */
9
9
  export type ResolvedThemeScheme = 'light' | 'dark';
10
+ export interface RuntimeThemeConfigFile {
11
+ meta: {
12
+ name?: string;
13
+ updatedAt?: string;
14
+ hash: string;
15
+ schemaVersion: string;
16
+ };
17
+ themes: string[];
18
+ defaultTheme?: string;
19
+ defaultScheme?: ThemeScheme;
20
+ excludeThemes?: string[];
21
+ }
10
22
  /**
11
23
  * Font face style options
12
24
  */
@@ -31,48 +43,22 @@ export interface ThemeAsset {
31
43
  dark?: string;
32
44
  }
33
45
  /**
34
- * Asset definitions for a theme
35
- * Contains all images, logos, banners, and illustrations used across the app
46
+ * Asset definition for a theme
47
+ * Contains a single asset with light/dark variants
36
48
  */
37
- export interface ThemeAssets {
38
- /**
39
- * Logo(s) for the application or brand
40
- * Can be a single asset or an object with multiple named logos
41
- * @example
42
- * Single: { light: '/assets/logo_light.svg', dark: '/assets/logo_dark.svg' }
43
- * Multiple: { main: {...}, secondary: {...} }
44
- */
45
- logo?: ThemeAsset | Record<string, ThemeAsset>;
46
- /**
47
- * Navigation bar or header related images
48
- * @example { light: '/assets/navbar_bg_light.svg', dark: '/assets/navbar_bg_dark.svg' }
49
- */
50
- navbar?: ThemeAsset | Record<string, ThemeAsset>;
51
- /**
52
- * Banner images used across the application
53
- * @example { hero: {...}, section: {...} }
54
- */
55
- banners?: Record<string, ThemeAsset>;
49
+ export interface AssetDefinition {
56
50
  /**
57
- * Illustrations for empty states, errors, etc.
58
- * @example { empty: {...}, error: {...}, notFound: {...} }
51
+ * Unique asset name (dot-notation allowed)
52
+ * @example "logo" or "banners.hero"
59
53
  */
60
- illustrations?: Record<string, ThemeAsset>;
61
- /**
62
- * Icons (can be used for animated or scheme-specific icons)
63
- * @example { success: {...}, warning: {...} }
64
- */
65
- icons?: Record<string, ThemeAsset>;
66
- /**
67
- * Background images for different sections
68
- * @example { header: {...}, footer: {...} }
69
- */
70
- backgrounds?: Record<string, ThemeAsset>;
71
- /**
72
- * Any other custom assets
73
- */
74
- [key: string]: ThemeAsset | Record<string, ThemeAsset> | undefined;
54
+ name: string;
55
+ light?: string;
56
+ dark?: string;
75
57
  }
58
+ /**
59
+ * Asset definitions for a theme
60
+ */
61
+ export type ThemeAssets = AssetDefinition[];
76
62
  /**
77
63
  * Font definition for runtime configuration
78
64
  * Defines font family and font-face declarations
@@ -83,11 +69,6 @@ export interface FontDefinition {
83
69
  * @example "Poppins"
84
70
  */
85
71
  family: string;
86
- /**
87
- * Font display name
88
- * @example "Poppins Sans-Serif"
89
- */
90
- displayName?: string;
91
72
  /**
92
73
  * Font faces (font-weight variants)
93
74
  */
@@ -116,27 +97,25 @@ export interface FontFaceDefinition {
116
97
  * Defines all CSS custom properties for a specific theme variant
117
98
  */
118
99
  export interface ThemeStyleDefinition {
119
- /**
120
- * Theme display name for UI
121
- * @example "Sixbell Telco Light"
122
- */
123
- displayName?: string;
124
- /**
125
- * DaisyUI theme name (matches name in @plugin "daisyui/theme")
126
- * @example "sixbell_telco__light"
127
- */
128
- daisyuiName: string;
129
100
  /**
130
101
  * Prefers dark mode for system scheme detection
131
- * @example true for dark themes
102
+ * Derived in code: light = false, dark = true
132
103
  */
133
104
  prefersDark?: boolean;
134
105
  /**
135
- * CSS custom properties (variables) for this theme variant
136
- * Maps CSS variable names to their values
137
- * @example { "--color-primary": "oklch(...)", "--color-base-100": "oklch(...)" }
106
+ * CSS custom properties (variables) grouped by category
138
107
  */
139
- variables: Record<string, string>;
108
+ variables: ThemeVariablesByCategory;
109
+ }
110
+ /**
111
+ * Theme variables grouped by category
112
+ */
113
+ export interface ThemeVariablesByCategory {
114
+ colors: Record<string, string>;
115
+ radius: Record<string, string>;
116
+ sizes: Record<string, string>;
117
+ effects: Record<string, string>;
118
+ others: Record<string, string>;
140
119
  }
141
120
  /**
142
121
  * Theme variants container
@@ -152,121 +131,15 @@ export interface ThemeVariants {
152
131
  * Includes all CSS variables, fonts, and theme definitions
153
132
  */
154
133
  export interface RuntimeThemeConfig {
155
- /**
156
- * Global CSS custom properties applied to all themes
157
- * @example { "--border-radius": "0.25rem" }
158
- */
159
- globalVariables?: Record<string, string>;
160
- /**
161
- * Font definitions to load at runtime
162
- * @example [{ family: "Poppins", faces: [...] }]
163
- */
164
- fonts?: FontDefinition[];
165
- /**
166
- * Theme definitions mapped by theme code
167
- * Each theme should have light and dark variants
168
- * @example { "sixbell_telco": { "light": {...}, "dark": {...} } }
169
- */
170
- themes: Record<string, ThemeVariants>;
171
- /**
172
- * Assets (images, logos, banners) for each theme
173
- * Supports scheme-based variants and custom assets
174
- * @example {
175
- * "sixbell_telco": { logo: {...}, illustrations: {...} },
176
- * "wom": { logo: {...}, illustrations: {...} }
177
- * }
178
- */
179
- assets?: Record<string, ThemeAssets>;
180
- /**
181
- * List of all available theme codes (OPTIONAL - auto-derived from themes keys)
182
- * If not provided, will be automatically extracted from the `themes` object keys
183
- * @example ["sixbell_telco", "wom", "custom_dark"]
184
- * @deprecated Prefer omitting this and letting it be auto-derived from themes keys
185
- */
186
- availableThemes?: string[];
187
- /**
188
- * Default theme to use on first load (OPTIONAL - defaults to first available theme)
189
- * If not provided, the first theme in availableThemes will be used
190
- * User's saved preference in localStorage takes precedence
191
- * @example "sixbell_telco"
192
- */
193
- defaultTheme?: string;
194
- /**
195
- * Default color scheme preference (OPTIONAL - defaults to 'system')
196
- * User's saved preference in localStorage takes precedence
197
- * @example "system" | "light" | "dark"
198
- */
199
- defaultScheme?: ThemeScheme;
200
- /**
201
- * Themes to exclude from the available set (optional)
202
- * @example ["custom_dark"]
203
- */
204
- excludeThemes?: string[];
205
- }
206
- /**
207
- * Static theme configuration (compile-time)
208
- * Base interface without additional themes
209
- */
210
- export interface ThemeConfigWithoutAdditionalThemes {
211
- /**
212
- * Default theme code (base theme: sixbell_telco)
213
- * @example 'sixbell_telco'
214
- */
215
- defaultTheme?: string;
216
- /**
217
- * Themes to exclude from the available set
218
- * @example ['sixbell_telco'] to exclude the default theme
219
- */
220
- excludeThemes?: readonly string[];
221
- /**
222
- * Default color scheme preference
223
- * @example 'system' | 'light' | 'dark'
224
- */
225
- defaultScheme?: ThemeScheme;
226
- }
227
- /**
228
- * Static theme configuration (compile-time)
229
- * Interface with additional themes providing IntelliSense
230
- */
231
- export interface ThemeConfigWithAdditionalThemes<T extends readonly string[]> {
232
- /**
233
- * Additional themes to make available beyond the default base theme (sixbell_telco)
234
- */
235
- additionalThemes: T;
236
- /**
237
- * Default theme code
238
- */
239
- defaultTheme?: string;
240
- /**
241
- * Themes to exclude from the available set
242
- */
243
- excludeThemes?: readonly string[];
244
- /**
245
- * Default color scheme preference
246
- */
247
- defaultScheme?: ThemeScheme;
248
- }
249
- /**
250
- * Main theme configuration interface
251
- * Generic configuration supporting both static and runtime configurations
252
- */
253
- export interface ThemeConfig {
254
- /**
255
- * Additional themes to make available beyond the default base theme
256
- */
257
- additionalThemes?: readonly string[];
258
- /**
259
- * Default theme code
260
- */
261
- defaultTheme?: string;
262
- /**
263
- * Themes to exclude from the available set
264
- */
265
- excludeThemes?: readonly string[];
266
- /**
267
- * Default color scheme preference
268
- */
269
- defaultScheme?: ThemeScheme;
134
+ meta: {
135
+ name: string;
136
+ updatedAt?: string;
137
+ hash: string;
138
+ schemaVersion: string;
139
+ };
140
+ fonts: FontDefinition[];
141
+ themes: ThemeVariants;
142
+ assets: ThemeAssets;
270
143
  }
271
144
  /**
272
145
  * Internal theme state configuration
@@ -1,13 +1,3 @@
1
1
  import { EnvironmentProviders } from '@angular/core';
2
- import { ThemeScheme } from '../models/theme';
3
2
  import { RuntimeThemeProviderOptions } from './theme.provider.types';
4
- /**
5
- * @deprecated Use provideRuntimeTheme instead.
6
- */
7
- export declare function provideTheme<const T extends readonly string[] = []>(config?: {
8
- additionalThemes?: T;
9
- defaultTheme?: string;
10
- excludeThemes?: T extends readonly [string, ...string[]] ? readonly string[] : readonly string[];
11
- defaultScheme?: ThemeScheme;
12
- }): EnvironmentProviders;
13
3
  export declare function provideRuntimeTheme(configPath: string, options?: RuntimeThemeProviderOptions): EnvironmentProviders;
@@ -1,29 +1,30 @@
1
- import { ResourceLoader, ResourceLoaderRequestOptions } from '@sixbell-telco/sdk/utils/resource-loader';
2
- import { RuntimeThemeConfig } from '../theme.service';
1
+ import { RuntimeUpdateEvent } from '@sixbell-telco/sdk/utils/runtime-config';
2
+ import type { Observable } from 'rxjs';
3
3
  /**
4
4
  * Configuration options for the runtime theme provider.
5
5
  *
6
- * @property loader - Custom loader instance (optional; uses default if not provided)
7
- * @property loaderOptions - Loader configuration options (cache TTL, retries, storage, etc.)
8
- * By default, `freshOnNavigation: true` (ResourceLoader default: always fetch fresh with
9
- * fallback to cache). This ensures themes are always up-to-date and prevents stale data issues.
10
- * Set `freshOnNavigation: false` in loaderOptions to disable and use aggressive caching (rare cases).
6
+ * @property appId - Optional namespace to avoid cache collisions across MFEs
7
+ * @property sse - Optional SSE config for runtime update checks (disabled by default)
8
+ * @property updateStream - Optional Observable for runtime update checks (disabled by default)
11
9
  *
12
10
  * @example
13
11
  * ```typescript
14
- * // Default mode: Always fetch fresh theme with fallback to cache on error
12
+ * // Basic usage
15
13
  * provideRuntimeTheme('assets/themes/config.json')
16
14
  *
17
- * // Aggressive caching mode: Use cached data, only refetch if cache is stale
15
+ * // SSE updates (optional)
18
16
  * provideRuntimeTheme('assets/themes/config.json', {
19
- * loaderOptions: {
20
- * freshOnNavigation: false, // Use cache first (rare, only for high-latency cases)
21
- * retries: 3,
22
- * },
17
+ * sse: { url: '/api/updates' }
23
18
  * })
24
19
  * ```
25
20
  */
26
21
  export interface RuntimeThemeProviderOptions {
27
- loader?: ResourceLoader;
28
- loaderOptions?: ResourceLoaderRequestOptions<RuntimeThemeConfig>;
22
+ appId?: string;
23
+ sse?: {
24
+ url: string;
25
+ withCredentials?: boolean;
26
+ eventType?: string;
27
+ transform?: (event: MessageEvent) => RuntimeUpdateEvent | null;
28
+ };
29
+ updateStream?: Observable<RuntimeUpdateEvent>;
29
30
  }
@@ -6,12 +6,13 @@ export declare class ThemeAssetsService {
6
6
  * Used to look up asset definitions for the active theme
7
7
  */
8
8
  private config;
9
+ private themeConfigs;
9
10
  /**
10
11
  * Layer 1: In-memory cache of resolved assets
11
12
  * Maps "themeName:assetKey" to CachedAsset for fast retrieval
12
13
  * Cleared when setConfig() is called to force re-resolution from new config
13
14
  */
14
- private assetCache;
15
+ private assetCacheByTheme;
15
16
  /**
16
17
  * Layer 2: Last working config storage (memory-based)
17
18
  * Stores the most recent RuntimeThemeConfig that successfully resolved assets
@@ -45,17 +46,18 @@ export declare class ThemeAssetsService {
45
46
  * @param config - Runtime configuration containing asset definitions
46
47
  */
47
48
  setConfig(config: RuntimeThemeConfig): void;
49
+ setThemeConfig(themeName: string, config: RuntimeThemeConfig): void;
48
50
  /**
49
51
  * Internal: Check if config has any PARTIAL/BROKEN assets
50
52
  * Returns true if ANY asset is incomplete (missing light or dark variant)
51
53
  *
52
54
  * A partial asset is invalid:
53
- * - logo: { light: "..." } ← missing dark
54
- * - logo: { dark: "..." } ← missing light
55
- * - logo: {} ← missing both
55
+ * - { name: "logo", light: "..." } ← missing dark
56
+ * - { name: "logo", dark: "..." } ← missing light
57
+ * - { name: "logo" } ← missing both
56
58
  *
57
59
  * Complete removals are OK:
58
- * - {} ← no assets at all (intentional)
60
+ * - [] ← no assets at all (intentional)
59
61
  * - theme: {} ← theme removed (intentional)
60
62
  *
61
63
  * @private
@@ -64,15 +66,13 @@ export declare class ThemeAssetsService {
64
66
  */
65
67
  private hasPartialAssets;
66
68
  /**
67
- * Internal: Check if a theme/asset object has ANY problematic assets
69
+ * Internal: Check if a theme asset list has ANY problematic assets
68
70
  * Problematic assets are:
69
- * - Partial assets: { light: "..." } or { dark: "..." } (missing variant)
70
- * - Empty asset objects: { "logo": {} } (asset key exists but has no variants)
71
- * - Broken nested assets at any level
71
+ * - Partial assets: missing light or dark variant
72
+ * - Empty assets: no variants at all
72
73
  *
73
74
  * NOT problematic:
74
- * - Completely empty themes: {} (all assets intentionally removed - OK to accept)
75
- * - Missing themes (not in config at all)
75
+ * - Completely empty list: [] (all assets intentionally removed - OK to accept)
76
76
  *
77
77
  * @private
78
78
  * @param obj - Theme's asset object to check
@@ -192,7 +192,8 @@ export declare class ThemeAssetsService {
192
192
  * assetsService.clearCache();
193
193
  * assetsService.setConfig(currentConfig);
194
194
  */
195
- clearCache(): void;
195
+ clearCache(themeName?: string): void;
196
+ prefetchAssets(themeName: string): Promise<void>;
196
197
  /**
197
198
  * Internal: Type guard to validate ThemeAsset structure
198
199
  * Requires BOTH light and dark variants to be present
@@ -209,6 +210,9 @@ export declare class ThemeAssetsService {
209
210
  * @returns True if object is a valid ThemeAsset (has BOTH light and dark)
210
211
  */
211
212
  private isThemeAsset;
213
+ private collectAssetUrls;
214
+ private findAsset;
215
+ private cacheAsset;
212
216
  static ɵfac: i0.ɵɵFactoryDeclaration<ThemeAssetsService, never>;
213
217
  static ɵprov: i0.ɵɵInjectableDeclaration<ThemeAssetsService>;
214
218
  }
@@ -28,6 +28,12 @@ export declare class ThemeDomService {
28
28
  * @param themes - Theme definitions with variants
29
29
  */
30
30
  injectThemeStyles(themes: Record<string, ThemeVariants>): void;
31
+ /**
32
+ * Injects CSS variables for a single theme only
33
+ * @param themeName - Theme key
34
+ * @param variants - Theme variants to inject
35
+ */
36
+ injectSingleThemeStyles(themeName: string, variants: ThemeVariants): void;
31
37
  /**
32
38
  * Sets the active theme on the document body
33
39
  * Uses data-theme attribute for CSS theme targeting
@@ -82,6 +88,8 @@ export declare class ThemeDomService {
82
88
  * @param content - CSS content to inject
83
89
  */
84
90
  private appendStyleToHead;
91
+ private flattenVariables;
92
+ private replaceThemeStyle;
85
93
  static ɵfac: i0.ɵɵFactoryDeclaration<ThemeDomService, never>;
86
94
  static ɵprov: i0.ɵɵInjectableDeclaration<ThemeDomService>;
87
95
  }
@@ -1,33 +1,36 @@
1
- import { ResourceLoader, ResourceLoaderRequestOptions } from '@sixbell-telco/sdk/utils/resource-loader';
2
- import { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, ThemeConfig, ThemeConfigWithAdditionalThemes, ThemeConfigWithoutAdditionalThemes, ThemeScheme, ThemeStyleDefinition } from './models/theme';
1
+ import { RuntimeConfigLoader, RuntimeConfigLoadResult, RuntimeUpdateEvent } from '@sixbell-telco/sdk/utils/runtime-config';
2
+ import { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, RuntimeThemeConfigFile, ThemeScheme, ThemeStateConfig, ThemeStyleDefinition, ThemeVariablesByCategory } from './models/theme';
3
3
  import * as i0 from "@angular/core";
4
- export { DEFAULT_BASE_THEME, FALLBACK_RUNTIME_THEME_CONFIG, RUNTIME_THEME_CONFIG_TOKEN, THEME_CONFIG_TOKEN } from './constants';
5
- export type { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, ThemeConfig, ThemeConfigWithAdditionalThemes, ThemeConfigWithoutAdditionalThemes, ThemeScheme, ThemeStyleDefinition, };
4
+ export { DEFAULT_BASE_THEME, FALLBACK_RUNTIME_THEME_CONFIG } from './constants';
5
+ export type { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, RuntimeThemeConfigFile, ThemeScheme, ThemeStyleDefinition, ThemeVariablesByCategory, };
6
6
  export declare class ThemeService {
7
- private readonly themeConfig?;
8
- private readonly runtimeThemeConfig?;
9
7
  private readonly translationService;
10
8
  private readonly domService;
11
9
  private readonly storageService;
12
10
  private readonly schemeResolver;
13
11
  private readonly assetsService;
14
- private readonly router;
15
12
  private readonly logger;
16
- private runtimeConfigPath?;
17
- private runtimeLoader?;
18
- private runtimeLoaderOptions?;
19
- private navigationSubscription?;
20
- private skipFirstNavigation;
21
13
  private isUsingFallbackConfig;
14
+ private runtimeHash;
15
+ private runtimeLoader?;
16
+ private runtimeThemes;
17
+ private runtimeEventHashes;
18
+ private pendingUpdatedThemes;
19
+ private appliedThemeNames;
20
+ private refreshHandler?;
21
+ readonly updateAvailable: import("@angular/core").WritableSignal<boolean>;
22
+ readonly lastRefreshFailed: import("@angular/core").WritableSignal<boolean>;
22
23
  private config;
23
24
  readonly selectedTheme: import("@angular/core").WritableSignal<string>;
24
25
  readonly selectedScheme: import("@angular/core").WritableSignal<ThemeScheme>;
25
26
  readonly resolvedScheme: import("@angular/core").Signal<ResolvedThemeScheme>;
26
27
  readonly isDarkTheme: import("@angular/core").Signal<boolean>;
27
28
  readonly finalTheme: import("@angular/core").Signal<string>;
28
- constructor(themeConfig?: ThemeConfig | undefined, runtimeThemeConfig?: RuntimeThemeConfig | undefined);
29
- configure(config?: ThemeConfig): void;
30
- configureRuntime(config: RuntimeThemeConfig): void;
29
+ constructor();
30
+ configureRuntime(config: RuntimeThemeConfig, themeName: string, options?: {
31
+ blocking?: boolean;
32
+ }): Promise<void>;
33
+ applyRuntimeConfig(config: ThemeStateConfig, source: RuntimeConfigLoadResult<RuntimeThemeConfigFile>['source']): void;
31
34
  setTheme(theme: string): void;
32
35
  setScheme(scheme: ThemeScheme): void;
33
36
  getAvailableThemes(): string[];
@@ -43,18 +46,12 @@ export declare class ThemeService {
43
46
  * Called by provideRuntimeTheme.
44
47
  * @internal
45
48
  */
46
- setRuntimeLoader(configPath: string, loader: ResourceLoader, loaderOptions?: ResourceLoaderRequestOptions<RuntimeThemeConfig>): void;
47
- /**
48
- * Internal method to configure runtime theme with config source information.
49
- * @internal
50
- */
51
- configureRuntimeWithSource(config: RuntimeThemeConfig, source: 'network' | 'cache' | 'fallback'): void;
52
- /**
53
- * Manually reload the runtime theme configuration from the configured path.
54
- * Useful for hot-reload scenarios or programmatic refresh.
55
- */
56
- reloadRuntimeConfig(): Promise<void>;
49
+ setRuntimeLoader(loader: RuntimeConfigLoader<RuntimeThemeConfigFile>, hash?: string): void;
50
+ checkForThemeUpdates(loader: RuntimeConfigLoader<RuntimeThemeConfigFile>, event?: RuntimeUpdateEvent): Promise<void>;
51
+ refreshTheme(loader?: RuntimeConfigLoader<RuntimeThemeConfigFile>): Promise<void>;
57
52
  init(): void;
58
- static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, [{ optional: true; }, { optional: true; }]>;
53
+ setRefreshHandler(handler: (themes: string[]) => Promise<void>): void;
54
+ private waitForFonts;
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
59
56
  static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
60
57
  }
@@ -2,13 +2,14 @@
2
2
  * Theme Utility Functions
3
3
  * Pure, side-effect-free utilities for theme logic
4
4
  */
5
+ import { VALID_SCHEMES } from '../constants';
5
6
  import { ThemeStateConfig } from '../models/theme';
6
7
  /**
7
8
  * Validates that a given value is a valid theme scheme
8
9
  * @param value - The value to validate
9
10
  * @returns True if the value is a valid scheme ('system', 'light', or 'dark')
10
11
  */
11
- export declare function isValidScheme(value: unknown): boolean;
12
+ export declare function isValidScheme(value: unknown): value is (typeof VALID_SCHEMES)[number];
12
13
  /**
13
14
  * Builds the final theme identifier by combining theme name and scheme
14
15
  * @param themeName - The name of the theme
@@ -25,15 +26,6 @@ export declare function parseThemeIdentifier(identifier: string): {
25
26
  themeName: string;
26
27
  scheme: string;
27
28
  };
28
- /**
29
- * Builds the list of available themes from configuration
30
- * Starts with default base theme, adds additional themes, and filters exclusions
31
- * Removes duplicates and returns sorted list
32
- * @param additionalThemes - Additional themes to include
33
- * @param excludeThemes - Themes to exclude
34
- * @returns Deduplicated list of available themes
35
- */
36
- export declare function buildAvailableThemes(additionalThemes?: readonly string[], excludeThemes?: readonly string[]): string[];
37
29
  /**
38
30
  * Determines the effective default theme from configuration
39
31
  * Ensures the default theme is in the available themes list