@sixbell-telco/sdk 1.1.0 → 1.2.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 (41) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +600 -166
  3. package/_index.css +34 -4
  4. package/components/badge/src/badge.component.d.ts +0 -4
  5. package/components/dialog/dialog-actions/dialog-actions.component.d.ts +8 -0
  6. package/components/dialog/dialog-content/dialog-content.component.d.ts +5 -0
  7. package/components/dialog/dialog-sub-title/dialog-sub-title.component.d.ts +5 -0
  8. package/components/dialog/dialog-title/dialog-title.component.d.ts +5 -0
  9. package/components/{modal → dialog}/index.d.ts +1 -1
  10. package/components/dialog/public-api.d.ts +5 -0
  11. package/components/dialog/src/dialog.component.d.ts +132 -0
  12. package/directives/auto-focus/src/autofocus.directive.d.ts +3 -3
  13. package/fesm2022/sixbell-telco-sdk-components-badge.mjs +1 -1
  14. package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
  15. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +305 -0
  16. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -0
  17. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +3 -0
  18. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
  19. package/fesm2022/sixbell-telco-sdk-components-toast.mjs +2 -2
  20. package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
  21. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +3 -3
  22. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
  23. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +221 -65
  24. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
  25. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +211 -62
  26. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  27. package/package.json +13 -13
  28. package/sixbell-telco-sdk-1.2.0.tgz +0 -0
  29. package/utils/theme/README.md +185 -0
  30. package/utils/theme/src/theme.service.d.ts +168 -17
  31. package/utils/translation/README.md +274 -0
  32. package/utils/translation/public-api.d.ts +4 -0
  33. package/utils/translation/src/translation.service.d.ts +134 -49
  34. package/components/modal/modal-actions/modal-actions.component.d.ts +0 -8
  35. package/components/modal/modal-content/modal-content.component.d.ts +0 -5
  36. package/components/modal/modal-title/modal-title.component.d.ts +0 -5
  37. package/components/modal/public-api.d.ts +0 -4
  38. package/components/modal/src/modal.component.d.ts +0 -102
  39. package/fesm2022/sixbell-telco-sdk-components-modal.mjs +0 -202
  40. package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +0 -1
  41. package/sixbell-telco-sdk-1.1.0.tgz +0 -0
@@ -1,82 +1,171 @@
1
1
  import { DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { signal, computed, Inject, Injectable } from '@angular/core';
3
+ import { InjectionToken, inject, signal, computed, Inject, Optional, Injectable, provideAppInitializer } from '@angular/core';
4
+ import { TranslationService } from '@sixbell-telco/sdk/utils/translation';
4
5
 
6
+ // Default base theme - always available unless excluded
7
+ const DEFAULT_BASE_THEME = 'sixbell_telco';
8
+ const DEFAULT_THEMES = [DEFAULT_BASE_THEME];
9
+ const DEFAULT_THEME_CODES = [DEFAULT_BASE_THEME];
10
+ // Injection tokens for dependency injection
11
+ const THEME_CONFIG_TOKEN = new InjectionToken('Theme Configuration');
12
+ // LocalStorage keys
13
+ const THEME_SELECTED_THEME_KEY = 'selectedTheme';
14
+ const THEME_SELECTED_SCHEME_KEY = 'selectedScheme';
5
15
  class ThemeService {
6
16
  rendererFactory;
7
17
  document;
18
+ themeConfig;
19
+ translationService = inject(TranslationService);
8
20
  renderer;
9
- // Fixed schemes - cannot be changed
10
- fixedSchemes = ['system', 'light', 'dark'];
11
- // Default configuration - can be overridden
21
+ initialized = false;
22
+ // Default configuration - can be overridden by provider
12
23
  config = {
13
- availableThemes: ['vivid_elegance'],
14
- defaultTheme: 'vivid_elegance',
15
- defaultScheme: 'dark',
24
+ availableThemes: [DEFAULT_BASE_THEME],
25
+ defaultTheme: DEFAULT_BASE_THEME,
26
+ defaultScheme: 'system',
16
27
  };
17
28
  // Reactive signals
18
29
  selectedTheme = signal(this.config.defaultTheme);
19
30
  selectedScheme = signal(this.config.defaultScheme);
20
- // Computed final theme
21
- finalTheme = computed(() => {
22
- const theme = this.selectedTheme();
31
+ /**
32
+ * Get the actual resolved scheme ('light' or 'dark') regardless of user selection.
33
+ * This is useful for conditional rendering where you need to know the actual
34
+ * light/dark state, even when the user has selected 'system' preference.
35
+ */
36
+ resolvedScheme = computed(() => {
23
37
  const scheme = this.selectedScheme();
24
38
  if (scheme === 'system') {
25
- // Use browser preference
39
+ // Resolve system preference to actual light/dark
26
40
  const prefersDark = typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
27
- return `${theme}_${prefersDark ? 'dark' : 'light'}`;
41
+ return prefersDark ? 'dark' : 'light';
28
42
  }
29
- return `${theme}_${scheme}`;
43
+ return scheme; // Return 'light' or 'dark' directly
30
44
  });
31
- constructor(rendererFactory, document) {
45
+ /**
46
+ * Convenient computed signal that returns true when the current resolved scheme is 'dark'.
47
+ */
48
+ isDarkTheme = computed(() => this.resolvedScheme() === 'dark');
49
+ // Computed final theme
50
+ finalTheme = computed(() => {
51
+ const theme = this.selectedTheme();
52
+ const resolvedScheme = this.resolvedScheme();
53
+ return `${theme}__${resolvedScheme}`;
54
+ });
55
+ constructor(rendererFactory, document, themeConfig) {
32
56
  this.rendererFactory = rendererFactory;
33
57
  this.document = document;
58
+ this.themeConfig = themeConfig;
34
59
  this.renderer = this.rendererFactory.createRenderer(null, null);
60
+ // Configure with provided config or defaults
61
+ if (themeConfig) {
62
+ this.configure(themeConfig);
63
+ }
64
+ else {
65
+ // Initialize with defaults immediately
66
+ this.initializeFromStorage();
67
+ this.applyTheme();
68
+ this.initialized = true;
69
+ }
35
70
  }
36
71
  /**
37
- * Initialize the theme service with custom configuration
72
+ * Configure and initialize the theme service (used by provider)
38
73
  */
39
- configure(config) {
40
- this.config = { ...this.config, ...config };
74
+ configure(config = {}) {
75
+ // Start with default base theme (sixbell_telco)
76
+ let availableThemes = [DEFAULT_BASE_THEME];
77
+ // Handle additional themes
78
+ if (config.additionalThemes) {
79
+ availableThemes = [DEFAULT_BASE_THEME, ...config.additionalThemes];
80
+ }
81
+ // Apply theme exclusions if specified
82
+ if (config.excludeThemes) {
83
+ const excludeThemeNames = config.excludeThemes;
84
+ availableThemes = availableThemes.filter((theme) => !excludeThemeNames.includes(theme));
85
+ }
86
+ // Remove duplicates
87
+ availableThemes = [...new Set(availableThemes)];
88
+ // Determine default theme
89
+ const defaultTheme = config.defaultTheme || (availableThemes.includes(DEFAULT_BASE_THEME) ? DEFAULT_BASE_THEME : availableThemes[0]);
90
+ // Update configuration
91
+ this.config = {
92
+ availableThemes,
93
+ defaultTheme,
94
+ defaultScheme: config.defaultScheme || this.config.defaultScheme,
95
+ };
96
+ // Validate defaultTheme is in available themes
97
+ if (!this.config.availableThemes.includes(this.config.defaultTheme)) {
98
+ console.warn(`ThemeService: defaultTheme '${this.config.defaultTheme}' not in availableThemes, using '${this.config.availableThemes[0] || DEFAULT_BASE_THEME}'`);
99
+ this.config.defaultTheme = this.config.availableThemes[0] || DEFAULT_BASE_THEME;
100
+ }
101
+ // Update signal defaults
41
102
  this.selectedTheme.set(this.config.defaultTheme);
42
103
  this.selectedScheme.set(this.config.defaultScheme);
104
+ // Initialize from storage (will override defaults if values exist)
105
+ this.initializeFromStorage();
106
+ this.applyTheme();
107
+ this.initialized = true;
43
108
  }
44
109
  /**
45
110
  * Initialize theme from localStorage and apply it immediately
46
- * Call this as early as possible in your app
47
111
  */
48
- initializeTheme() {
49
- // Load from localStorage
50
- const savedTheme = localStorage.getItem('selectedTheme') || this.config.defaultTheme;
51
- const savedScheme = localStorage.getItem('selectedScheme') || this.config.defaultScheme;
52
- // Update signals with type safety
53
- this.selectedTheme.set(savedTheme);
54
- this.selectedScheme.set(savedScheme);
55
- // Apply theme immediately
56
- this.applyTheme();
112
+ initializeFromStorage() {
113
+ // Safety checks for browser environment
114
+ if (typeof window === 'undefined' || typeof localStorage === 'undefined') {
115
+ console.warn('ThemeService: Browser environment not available, using defaults');
116
+ return;
117
+ }
118
+ try {
119
+ // Get saved theme or use default
120
+ const savedTheme = localStorage.getItem(THEME_SELECTED_THEME_KEY);
121
+ const currentTheme = savedTheme && this.config.availableThemes.includes(savedTheme) ? savedTheme : this.config.defaultTheme;
122
+ // Get saved scheme or use default
123
+ const savedScheme = localStorage.getItem(THEME_SELECTED_SCHEME_KEY);
124
+ const currentScheme = savedScheme && ['system', 'light', 'dark'].includes(savedScheme) ? savedScheme : this.config.defaultScheme;
125
+ // Update signals
126
+ this.selectedTheme.set(currentTheme);
127
+ this.selectedScheme.set(currentScheme);
128
+ }
129
+ catch (error) {
130
+ console.error('ThemeService: Failed to initialize from storage:', error);
131
+ }
57
132
  }
58
133
  /**
59
134
  * Apply the current theme to the document
60
135
  */
61
136
  applyTheme() {
62
- const theme = this.finalTheme();
63
- this.renderer.setAttribute(this.document.body, 'data-theme', theme);
137
+ const finalTheme = this.finalTheme();
138
+ // Set the theme attribute on the body
139
+ this.renderer.setAttribute(this.document.body, 'data-theme', finalTheme);
140
+ // Persist to localStorage
141
+ if (typeof localStorage !== 'undefined') {
142
+ localStorage.setItem(THEME_SELECTED_THEME_KEY, this.selectedTheme());
143
+ localStorage.setItem(THEME_SELECTED_SCHEME_KEY, this.selectedScheme());
144
+ }
64
145
  }
65
146
  /**
66
- * Update theme and persist to localStorage
147
+ * Set the current theme
67
148
  */
68
- updateTheme(theme) {
69
- this.selectedTheme.set(theme);
70
- localStorage.setItem('selectedTheme', theme);
71
- this.applyTheme();
149
+ setTheme(theme) {
150
+ if (theme && this.config.availableThemes.includes(theme)) {
151
+ this.selectedTheme.set(theme);
152
+ this.applyTheme();
153
+ }
154
+ else {
155
+ console.warn(`ThemeService: Theme '${theme}' not available, using default '${this.config.defaultTheme}'`);
156
+ }
72
157
  }
73
158
  /**
74
- * Update scheme and persist to localStorage
159
+ * Set the current color scheme
75
160
  */
76
- updateScheme(scheme) {
77
- this.selectedScheme.set(scheme);
78
- localStorage.setItem('selectedScheme', scheme);
79
- this.applyTheme();
161
+ setScheme(scheme) {
162
+ if (scheme && ['system', 'light', 'dark'].includes(scheme)) {
163
+ this.selectedScheme.set(scheme);
164
+ this.applyTheme();
165
+ }
166
+ else {
167
+ console.warn(`ThemeService: Scheme '${scheme}' not valid, using default '${this.config.defaultScheme}'`);
168
+ }
80
169
  }
81
170
  /**
82
171
  * Get available themes
@@ -88,37 +177,52 @@ class ThemeService {
88
177
  * Get available schemes
89
178
  */
90
179
  getAvailableSchemes() {
91
- return this.fixedSchemes;
180
+ return ['system', 'light', 'dark'];
92
181
  }
93
182
  /**
94
- * Initialize theme before Angular boots
95
- * This should be called in main.ts before bootstrapApplication
183
+ * Get default theme
96
184
  */
97
- static init(config) {
98
- const defaultConfig = {
99
- availableThemes: ['vivid_elegance'],
100
- defaultTheme: 'vivid_elegance',
101
- defaultScheme: 'dark',
102
- };
103
- const finalConfig = { ...defaultConfig, ...config };
104
- // Get saved preferences or use defaults
105
- const savedTheme = localStorage.getItem('selectedTheme') || finalConfig.defaultTheme;
106
- const savedScheme = localStorage.getItem('selectedScheme') || finalConfig.defaultScheme;
107
- let finalTheme;
108
- if (savedScheme === 'system') {
109
- // Use browser preference
110
- const prefersDark = typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
111
- finalTheme = savedTheme + '_' + (prefersDark ? 'dark' : 'light');
112
- }
113
- else {
114
- finalTheme = savedTheme + '_' + savedScheme;
185
+ getDefaultTheme() {
186
+ return this.config.defaultTheme;
187
+ }
188
+ /**
189
+ * Get default scheme
190
+ */
191
+ getDefaultScheme() {
192
+ return this.config.defaultScheme;
193
+ }
194
+ /**
195
+ * Get localized scheme name by code using translations
196
+ * This automatically returns the localized name based on the current language
197
+ */
198
+ getLocalizedSchemeName(scheme) {
199
+ const translationKey = `sdk.theme.schemes.${scheme}`;
200
+ const translatedName = this.translationService.instant(translationKey);
201
+ if (translatedName && translatedName !== translationKey) {
202
+ return translatedName;
115
203
  }
116
- // Set theme immediately on body element
117
- if (typeof document !== 'undefined') {
118
- document.body.setAttribute('data-theme', finalTheme);
204
+ return scheme.charAt(0).toUpperCase() + scheme.slice(1);
205
+ }
206
+ /**
207
+ * Get localized theme name by code using translations
208
+ * This automatically returns the localized name based on the current language
209
+ */
210
+ getLocalizedThemeName(theme) {
211
+ const translationKey = `sdk.theme.themes.${theme}`;
212
+ const translatedName = this.translationService.instant(translationKey);
213
+ if (translatedName && translatedName !== translationKey) {
214
+ return translatedName;
119
215
  }
216
+ return theme.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase());
120
217
  }
121
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ThemeService, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
218
+ /**
219
+ * Force initialization method for MFE environments
220
+ */
221
+ init() {
222
+ // This method just ensures the service is instantiated and initialized
223
+ this.getAvailableThemes(); // Trigger any lazy initialization
224
+ }
225
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ThemeService, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }, { token: THEME_CONFIG_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
122
226
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ThemeService, providedIn: 'root' });
123
227
  }
124
228
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ThemeService, decorators: [{
@@ -129,11 +233,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImpor
129
233
  }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: Document, decorators: [{
130
234
  type: Inject,
131
235
  args: [DOCUMENT]
236
+ }] }, { type: undefined, decorators: [{
237
+ type: Inject,
238
+ args: [THEME_CONFIG_TOKEN]
239
+ }, {
240
+ type: Optional
132
241
  }] }] });
242
+ /**
243
+ * Provider function for theme configuration in Angular applications
244
+ * This provides the theme configuration through dependency injection
245
+ *
246
+ * @param config Optional theme configuration
247
+ * @returns Provider array that configures theme service
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * // app.config.ts
252
+ * import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
253
+ *
254
+ * export const appConfig: ApplicationConfig = {
255
+ * providers: [
256
+ * provideRouter(routes),
257
+ *
258
+ * // Basic usage - sixbell_telco always available
259
+ * provideTheme({
260
+ * defaultScheme: 'light',
261
+ * defaultTheme: 'sixbell_telco' // IntelliSense: 'sixbell_telco'
262
+ * }),
263
+ *
264
+ * // With additional themes
265
+ * provideTheme({
266
+ * additionalThemes: ['wom', 'custom'] as const,
267
+ * defaultTheme: 'custom', // IntelliSense: 'sixbell_telco' | string
268
+ * excludeThemes: ['wom'] as const, // IntelliSense: 'sixbell_telco' | string
269
+ * defaultScheme: 'system'
270
+ * }),
271
+ *
272
+ * // ... other providers
273
+ * ],
274
+ * };
275
+ * ```
276
+ */
277
+ // Single overload that provides IntelliSense for all cases
278
+ function provideTheme(config) {
279
+ return [
280
+ {
281
+ provide: THEME_CONFIG_TOKEN,
282
+ // Pass through original object so literal tuple types survive for IDE IntelliSense
283
+ useValue: (config || {}),
284
+ },
285
+ // Automatically initialize theme service for MFE compatibility
286
+ provideAppInitializer(() => inject(ThemeService).init()),
287
+ ];
288
+ }
133
289
 
134
290
  /**
135
291
  * Generated bundle index. Do not edit.
136
292
  */
137
293
 
138
- export { ThemeService };
294
+ export { DEFAULT_BASE_THEME, DEFAULT_THEMES, DEFAULT_THEME_CODES, THEME_CONFIG_TOKEN, ThemeService, provideTheme };
139
295
  //# sourceMappingURL=sixbell-telco-sdk-utils-theme.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sixbell-telco-sdk-utils-theme.mjs","sources":["../../../projects/sdk/utils/theme/src/theme.service.ts","../../../projects/sdk/utils/theme/sixbell-telco-sdk-utils-theme.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { computed, Inject, Injectable, Renderer2, RendererFactory2, signal } from '@angular/core';\n\nexport type ThemeScheme = 'system' | 'light' | 'dark';\n\nexport interface ThemeConfig {\n\tavailableThemes?: string[];\n\tdefaultTheme?: string;\n\tdefaultScheme?: ThemeScheme;\n}\n\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class ThemeService {\n\tprivate readonly renderer: Renderer2;\n\n\t// Fixed schemes - cannot be changed\n\tprivate readonly fixedSchemes = ['system', 'light', 'dark'] as const;\n\n\t// Default configuration - can be overridden\n\tprivate config: Required<ThemeConfig> = {\n\t\tavailableThemes: ['vivid_elegance'],\n\t\tdefaultTheme: 'vivid_elegance',\n\t\tdefaultScheme: 'dark',\n\t};\n\n\t// Reactive signals\n\tpublic selectedTheme = signal<string>(this.config.defaultTheme);\n\tpublic selectedScheme = signal<ThemeScheme>(this.config.defaultScheme);\n\n\t// Computed final theme\n\tpublic finalTheme = computed(() => {\n\t\tconst theme = this.selectedTheme();\n\t\tconst scheme = this.selectedScheme();\n\n\t\tif (scheme === 'system') {\n\t\t\t// Use browser preference\n\t\t\tconst prefersDark = typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;\n\t\t\treturn `${theme}_${prefersDark ? 'dark' : 'light'}`;\n\t\t}\n\n\t\treturn `${theme}_${scheme}`;\n\t});\n\n\tconstructor(\n\t\tprivate readonly rendererFactory: RendererFactory2,\n\t\t@Inject(DOCUMENT) private readonly document: Document,\n\t) {\n\t\tthis.renderer = this.rendererFactory.createRenderer(null, null);\n\t}\n\n\t/**\n\t * Initialize the theme service with custom configuration\n\t */\n\tpublic configure(config: Partial<ThemeConfig>): void {\n\t\tthis.config = { ...this.config, ...config };\n\t\tthis.selectedTheme.set(this.config.defaultTheme);\n\t\tthis.selectedScheme.set(this.config.defaultScheme);\n\t}\n\n\t/**\n\t * Initialize theme from localStorage and apply it immediately\n\t * Call this as early as possible in your app\n\t */\n\tpublic initializeTheme(): void {\n\t\t// Load from localStorage\n\t\tconst savedTheme = localStorage.getItem('selectedTheme') || this.config.defaultTheme;\n\t\tconst savedScheme = localStorage.getItem('selectedScheme') || this.config.defaultScheme;\n\n\t\t// Update signals with type safety\n\t\tthis.selectedTheme.set(savedTheme);\n\t\tthis.selectedScheme.set(savedScheme as ThemeScheme);\n\n\t\t// Apply theme immediately\n\t\tthis.applyTheme();\n\t}\n\n\t/**\n\t * Apply the current theme to the document\n\t */\n\tprivate applyTheme(): void {\n\t\tconst theme = this.finalTheme();\n\t\tthis.renderer.setAttribute(this.document.body, 'data-theme', theme);\n\t}\n\n\t/**\n\t * Update theme and persist to localStorage\n\t */\n\tpublic updateTheme(theme: string): void {\n\t\tthis.selectedTheme.set(theme);\n\t\tlocalStorage.setItem('selectedTheme', theme);\n\t\tthis.applyTheme();\n\t}\n\n\t/**\n\t * Update scheme and persist to localStorage\n\t */\n\tpublic updateScheme(scheme: ThemeScheme): void {\n\t\tthis.selectedScheme.set(scheme);\n\t\tlocalStorage.setItem('selectedScheme', scheme);\n\t\tthis.applyTheme();\n\t}\n\n\t/**\n\t * Get available themes\n\t */\n\tpublic getAvailableThemes(): string[] {\n\t\treturn this.config.availableThemes;\n\t}\n\n\t/**\n\t * Get available schemes\n\t */\n\tpublic getAvailableSchemes(): readonly ThemeScheme[] {\n\t\treturn this.fixedSchemes;\n\t}\n\n\t/**\n\t * Initialize theme before Angular boots\n\t * This should be called in main.ts before bootstrapApplication\n\t */\n\tpublic static init(config?: ThemeConfig): void {\n\t\tconst defaultConfig: Required<ThemeConfig> = {\n\t\t\tavailableThemes: ['vivid_elegance'],\n\t\t\tdefaultTheme: 'vivid_elegance',\n\t\t\tdefaultScheme: 'dark',\n\t\t};\n\n\t\tconst finalConfig = { ...defaultConfig, ...config };\n\n\t\t// Get saved preferences or use defaults\n\t\tconst savedTheme = localStorage.getItem('selectedTheme') || finalConfig.defaultTheme;\n\t\tconst savedScheme = localStorage.getItem('selectedScheme') || finalConfig.defaultScheme;\n\n\t\tlet finalTheme: string;\n\n\t\tif (savedScheme === 'system') {\n\t\t\t// Use browser preference\n\t\t\tconst prefersDark = typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;\n\t\t\tfinalTheme = savedTheme + '_' + (prefersDark ? 'dark' : 'light');\n\t\t} else {\n\t\t\tfinalTheme = savedTheme + '_' + savedScheme;\n\t\t}\n\n\t\t// Set theme immediately on body element\n\t\tif (typeof document !== 'undefined') {\n\t\t\tdocument.body.setAttribute('data-theme', finalTheme);\n\t\t}\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAca,YAAY,CAAA;AAgCN,IAAA,eAAA;AACkB,IAAA,QAAA;AAhCnB,IAAA,QAAQ;;IAGR,YAAY,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAU;;AAG5D,IAAA,MAAM,GAA0B;QACvC,eAAe,EAAE,CAAC,gBAAgB,CAAC;AACnC,QAAA,YAAY,EAAE,gBAAgB;AAC9B,QAAA,aAAa,EAAE,MAAM;KACrB;;IAGM,aAAa,GAAG,MAAM,CAAS,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IACxD,cAAc,GAAG,MAAM,CAAc,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;;AAG/D,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAK;AACjC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE;AAClC,QAAA,MAAM,MAAM,GAAG,IAAI,CA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cesContent":["import { DOCUMENT } from '@angular/common';\nimport {\n\tcomputed,\n\tEnvironmentProviders,\n\tInject,\n\tinject,\n\tInjectable,\n\tInjectionToken,\n\tOptional,\n\tprovideAppInitializer,\n\tProvider,\n\tRenderer2,\n\tRendererFactory2,\n\tsignal,\n} from '@angular/core';\nimport { TranslationService } from '@sixbell-telco/sdk/utils/translation';\n\nexport type ThemeScheme = 'system' | 'light' | 'dark';\nexport type ResolvedThemeScheme = 'light' | 'dark';\n\n// Default base theme - always available unless excluded\nexport const DEFAULT_BASE_THEME = 'sixbell_telco';\nexport const DEFAULT_THEMES = [DEFAULT_BASE_THEME] as const;\nexport const DEFAULT_THEME_CODES = [DEFAULT_BASE_THEME] as const;\nexport type DefaultThemeCode = (typeof DEFAULT_THEME_CODES)[number];\n\n// Helper type to extract theme codes from additional themes arrays\ntype ExtractThemeCode<T> = T extends readonly (infer U)[] ? U : never;\n\n/**\n * Base theme configuration interface without additional themes\n * Provides IntelliSense for the default base theme (sixbell_telco)\n */\nexport interface ThemeConfigWithoutAdditionalThemes {\n\t/**\n\t * Default theme code (base theme: sixbell_telco)\n\t * @example 'sixbell_telco'\n\t */\n\tdefaultTheme?: DefaultThemeCode;\n\t/**\n\t * Themes to exclude from the available set (base theme: sixbell_telco)\n\t * @example ['sixbell_telco'] to exclude the default theme\n\t */\n\texcludeThemes?: readonly DefaultThemeCode[];\n\t/**\n\t * Default color scheme preference\n\t * @example 'system' | 'light' | 'dark'\n\t */\n\tdefaultScheme?: ThemeScheme;\n}\n\n/**\n * Theme configuration interface with additional themes providing IntelliSense\n */\nexport interface ThemeConfigWithAdditionalThemes<T extends readonly string[]> {\n\t/**\n\t * Additional themes to make available beyond the default base theme (sixbell_telco)\n\t * When you add themes here, they become available in defaultTheme and excludeThemes\n\t * @example ['custom', 'dark_mode', 'high_contrast']\n\t */\n\tadditionalThemes: T;\n\t/**\n\t * Default theme code\n\t * IntelliSense includes: base theme (sixbell_telco) + any additionalThemes you specified above\n\t * @example 'sixbell_telco'\n\t */\n\tdefaultTheme?: DefaultThemeCode | ExtractThemeCode<T>;\n\t/**\n\t * Themes to exclude from the available set\n\t * IntelliSense includes: base theme (sixbell_telco) + any additionalThemes you specified above\n\t * @example ['sixbell_telco'] to exclude the default theme\n\t */\n\texcludeThemes?: readonly (DefaultThemeCode | ExtractThemeCode<T>)[];\n\t/**\n\t * Default color scheme preference\n\t * @example 'system' | 'light' | 'dark'\n\t */\n\tdefaultScheme?: ThemeScheme;\n}\n\n/**\n * Main theme configuration interface (generic version)\n * Always provides IntelliSense for at least the base theme (sixbell_telco)\n */\nexport interface ThemeConfig {\n\t/**\n\t * Additional themes to make available beyond the default base theme (sixbell_telco)\n\t * When you add themes here, they become available in defaultTheme and excludeThemes\n\t * @example ['custom', 'dark_mode', 'high_contrast']\n\t */\n\tadditionalThemes?: readonly string[];\n\t/**\n\t * Default theme code\n\t * Always includes base theme (sixbell_telco), plus any additionalThemes you specify\n\t * @example 'sixbell_telco'\n\t */\n\tdefaultTheme?: string;\n\t/**\n\t * Themes to exclude from the available set\n\t * Always includes base theme (sixbell_telco), plus any additionalThemes you specify\n\t * @example ['sixbell_telco'] to exclude the default theme\n\t */\n\texcludeThemes?: readonly string[];\n\t/**\n\t * Default color scheme preference\n\t * @example 'system' | 'light' | 'dark'\n\t */\n\tdefaultScheme?: ThemeScheme;\n}\n\n// Injection tokens for dependency injection\nexport const THEME_CONFIG_TOKEN = new InjectionToken<ThemeConfig>('Theme Configuration');\n\n// LocalStorage keys\nconst THEME_SELECTED_THEME_KEY = 'selectedTheme';\nconst THEME_SELECTED_SCHEME_KEY = 'selectedScheme';\n\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class ThemeService {\n\tpublic readonly translationService = inject(TranslationService);\n\tprivate readonly renderer: Renderer2;\n\tprivate initialized = false;\n\n\t// Default configuration - can be overridden by provider\n\tprivate config: {\n\t\tavailableThemes: string[];\n\t\tdefaultTheme: string;\n\t\tdefaultScheme: ThemeScheme;\n\t} = {\n\t\tavailableThemes: [DEFAULT_BASE_THEME],\n\t\tdefaultTheme: DEFAULT_BASE_THEME,\n\t\tdefaultScheme: 'system',\n\t};\n\n\t// Reactive signals\n\tpublic selectedTheme = signal<string>(this.config.defaultTheme);\n\tpublic selectedScheme = signal<ThemeScheme>(this.config.defaultScheme);\n\n\t/**\n\t * Get the actual resolved scheme ('light' or 'dark') regardless of user selection.\n\t * This is useful for conditional rendering where you need to know the actual\n\t * light/dark state, even when the user has selected 'system' preference.\n\t */\n\tpublic resolvedScheme = computed(() => {\n\t\tconst scheme = this.selectedScheme();\n\n\t\tif (scheme === 'system') {\n\t\t\t// Resolve system preference to actual light/dark\n\t\t\tconst prefersDark = typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;\n\t\t\treturn prefersDark ? 'dark' : 'light';\n\t\t}\n\n\t\treturn scheme; // Return 'light' or 'dark' directly\n\t});\n\n\t/**\n\t * Convenient computed signal that returns true when the current resolved scheme is 'dark'.\n\t */\n\tpublic isDarkTheme = computed(() => this.resolvedScheme() === 'dark');\n\n\t// Computed final theme\n\tpublic finalTheme = computed(() => {\n\t\tconst theme = this.selectedTheme();\n\t\tconst resolvedScheme = this.resolvedScheme();\n\t\treturn `${theme}__${resolvedScheme}`;\n\t});\n\n\tconstructor(\n\t\tprivate readonly rendererFactory: RendererFactory2,\n\t\t@Inject(DOCUMENT) private readonly document: Document,\n\t\t@Inject(THEME_CONFIG_TOKEN) @Optional() private readonly themeConfig?: ThemeConfig,\n\t) {\n\t\tthis.renderer = this.rendererFactory.createRenderer(null, null);\n\n\t\t// Configure with provided config or defaults\n\t\tif (themeConfig) {\n\t\t\tthis.configure(themeConfig);\n\t\t} else {\n\t\t\t// Initialize with defaults immediately\n\t\t\tthis.initializeFromStorage();\n\t\t\tthis.applyTheme();\n\t\t\tthis.initialized = true;\n\t\t}\n\t}\n\n\t/**\n\t * Configure and initialize the theme service (used by provider)\n\t */\n\tpublic configure(config: ThemeConfig = {}): void {\n\t\t// Start with default base theme (sixbell_telco)\n\t\tlet availableThemes = [DEFAULT_BASE_THEME];\n\n\t\t// Handle additional themes\n\t\tif (config.additionalThemes) {\n\t\t\tavailableThemes = [DEFAULT_BASE_THEME, ...config.additionalThemes];\n\t\t}\n\n\t\t// Apply theme exclusions if specified\n\t\tif (config.excludeThemes) {\n\t\t\tconst excludeThemeNames = config.excludeThemes;\n\t\t\tavailableThemes = availableThemes.filter((theme) => !excludeThemeNames.includes(theme));\n\t\t}\n\n\t\t// Remove duplicates\n\t\tavailableThemes = [...new Set(availableThemes)];\n\n\t\t// Determine default theme\n\t\tconst defaultTheme = config.defaultTheme || (availableThemes.includes(DEFAULT_BASE_THEME) ? DEFAULT_BASE_THEME : availableThemes[0]);\n\n\t\t// Update configuration\n\t\tthis.config = {\n\t\t\tavailableThemes,\n\t\t\tdefaultTheme,\n\t\t\tdefaultScheme: config.defaultScheme || this.config.defaultScheme,\n\t\t};\n\n\t\t// Validate defaultTheme is in available themes\n\t\tif (!this.config.availableThemes.includes(this.config.defaultTheme)) {\n\t\t\tconsole.warn(\n\t\t\t\t`ThemeService: defaultTheme '${this.config.defaultTheme}' not in availableThemes, using '${this.config.availableThemes[0] || DEFAULT_BASE_THEME}'`,\n\t\t\t);\n\t\t\tthis.config.defaultTheme = this.config.availableThemes[0] || DEFAULT_BASE_THEME;\n\t\t}\n\n\t\t// Update signal defaults\n\t\tthis.selectedTheme.set(this.config.defaultTheme);\n\t\tthis.selectedScheme.set(this.config.defaultScheme);\n\n\t\t// Initialize from storage (will override defaults if values exist)\n\t\tthis.initializeFromStorage();\n\t\tthis.applyTheme();\n\t\tthis.initialized = true;\n\t}\n\n\t/**\n\t * Initialize theme from localStorage and apply it immediately\n\t */\n\tprivate initializeFromStorage(): void {\n\t\t// Safety checks for browser environment\n\t\tif (typeof window === 'undefined' || typeof localStorage === 'undefined') {\n\t\t\tconsole.warn('ThemeService: Browser environment not available, using defaults');\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Get saved theme or use default\n\t\t\tconst savedTheme = localStorage.getItem(THEME_SELECTED_THEME_KEY);\n\t\t\tconst currentTheme = savedTheme && this.config.availableThemes.includes(savedTheme) ? savedTheme : this.config.defaultTheme;\n\n\t\t\t// Get saved scheme or use default\n\t\t\tconst savedScheme = localStorage.getItem(THEME_SELECTED_SCHEME_KEY) as ThemeScheme;\n\t\t\tconst currentScheme = savedScheme && ['system', 'light', 'dark'].includes(savedScheme) ? savedScheme : this.config.defaultScheme;\n\n\t\t\t// Update signals\n\t\t\tthis.selectedTheme.set(currentTheme);\n\t\t\tthis.selectedScheme.set(currentScheme);\n\t\t} catch (error) {\n\t\t\tconsole.error('ThemeService: Failed to initialize from storage:', error);\n\t\t}\n\t}\n\n\t/**\n\t * Apply the current theme to the document\n\t */\n\tprivate applyTheme(): void {\n\t\tconst finalTheme = this.finalTheme();\n\n\t\t// Set the theme attribute on the body\n\t\tthis.renderer.setAttribute(this.document.body, 'data-theme', finalTheme);\n\n\t\t// Persist to localStorage\n\t\tif (typeof localStorage !== 'undefined') {\n\t\t\tlocalStorage.setItem(THEME_SELECTED_THEME_KEY, this.selectedTheme());\n\t\t\tlocalStorage.setItem(THEME_SELECTED_SCHEME_KEY, this.selectedScheme());\n\t\t}\n\t}\n\n\t/**\n\t * Set the current theme\n\t */\n\tsetTheme(theme: string): void {\n\t\tif (theme && this.config.availableThemes.includes(theme)) {\n\t\t\tthis.selectedTheme.set(theme);\n\t\t\tthis.applyTheme();\n\t\t} else {\n\t\t\tconsole.warn(`ThemeService: Theme '${theme}' not available, using default '${this.config.defaultTheme}'`);\n\t\t}\n\t}\n\n\t/**\n\t * Set the current color scheme\n\t */\n\tsetScheme(scheme: ThemeScheme): void {\n\t\tif (scheme && ['system', 'light', 'dark'].includes(scheme)) {\n\t\t\tthis.selectedScheme.set(scheme);\n\t\t\tthis.applyTheme();\n\t\t} else {\n\t\t\tconsole.warn(`ThemeService: Scheme '${scheme}' not valid, using default '${this.config.defaultScheme}'`);\n\t\t}\n\t}\n\n\t/**\n\t * Get available themes\n\t */\n\tgetAvailableThemes(): string[] {\n\t\treturn this.config.availableThemes;\n\t}\n\n\t/**\n\t * Get available schemes\n\t */\n\tgetAvailableSchemes(): ThemeScheme[] {\n\t\treturn ['system', 'light', 'dark'];\n\t}\n\n\t/**\n\t * Get default theme\n\t */\n\tgetDefaultTheme(): string {\n\t\treturn this.config.defaultTheme;\n\t}\n\n\t/**\n\t * Get default scheme\n\t */\n\tgetDefaultScheme(): ThemeScheme {\n\t\treturn this.config.defaultScheme;\n\t}\n\n\t/**\n\t * Get localized scheme name by code using translations\n\t * This automatically returns the localized name based on the current language\n\t */\n\tgetLocalizedSchemeName(scheme: string): string {\n\t\tconst translationKey = `sdk.theme.schemes.${scheme}`;\n\t\tconst translatedName = this.translationService.instant(translationKey);\n\n\t\tif (translatedName && translatedName !== translationKey) {\n\t\t\treturn translatedName;\n\t\t}\n\n\t\treturn scheme.charAt(0).toUpperCase() + scheme.slice(1);\n\t}\n\n\t/**\n\t * Get localized theme name by code using translations\n\t * This automatically returns the localized name based on the current language\n\t */\n\tgetLocalizedThemeName(theme: string): string {\n\t\tconst translationKey = `sdk.theme.themes.${theme}`;\n\t\tconst translatedName = this.translationService.instant(translationKey);\n\n\t\tif (translatedName && translatedName !== translationKey) {\n\t\t\treturn translatedName;\n\t\t}\n\n\t\treturn theme.replace(/_/g, ' ').replace(/\\b\\w/g, (l) => l.toUpperCase());\n\t}\n\n\t/**\n\t * Force initialization method for MFE environments\n\t */\n\tpublic init(): void {\n\t\t// This method just ensures the service is instantiated and initialized\n\t\tthis.getAvailableThemes(); // Trigger any lazy initialization\n\t}\n}\n\n// --- IntelliSense Friendly Config Types ---\n// We keep the original specialized interfaces and add a helper union that preserves literal types.\ntype ThemeConfigInput<T extends readonly string[] = readonly string[]> = ThemeConfigWithoutAdditionalThemes | ThemeConfigWithAdditionalThemes<T>;\n\n/**\n * Provider function for theme configuration in Angular applications\n * This provides the theme configuration through dependency injection\n *\n * @param config Optional theme configuration\n * @returns Provider array that configures theme service\n *\n * @example\n * ```typescript\n * // app.config.ts\n * import { provideTheme } from '@sixbell-telco/sdk/utils/theme';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideRouter(routes),\n *\n * // Basic usage - sixbell_telco always available\n * provideTheme({\n * defaultScheme: 'light',\n * defaultTheme: 'sixbell_telco' // IntelliSense: 'sixbell_telco'\n * }),\n *\n * // With additional themes\n * provideTheme({\n * additionalThemes: ['wom', 'custom'] as const,\n * defaultTheme: 'custom', // IntelliSense: 'sixbell_telco' | string\n * excludeThemes: ['wom'] as const, // IntelliSense: 'sixbell_telco' | string\n * defaultScheme: 'system'\n * }),\n *\n * // ... other providers\n * ],\n * };\n * ```\n */\n// Single overload that provides IntelliSense for all cases\nexport function provideTheme<const T extends readonly string[] = []>(config?: {\n\tadditionalThemes?: T;\n\tdefaultTheme?: T extends readonly [string, ...string[]] ? DefaultThemeCode | ExtractThemeCode<T> : DefaultThemeCode;\n\texcludeThemes?: T extends readonly [string, ...string[]] ? readonly (DefaultThemeCode | ExtractThemeCode<T>)[] : readonly DefaultThemeCode[];\n\tdefaultScheme?: ThemeScheme;\n}): (Provider | EnvironmentProviders)[] {\n\treturn [\n\t\t{\n\t\t\tprovide: THEME_CONFIG_TOKEN,\n\t\t\t// Pass through original object so literal tuple types survive for IDE IntelliSense\n\t\t\tuseValue: (config || {}) as ThemeConfig,\n\t\t},\n\t\t// Automatically initialize theme service for MFE compatibility\n\t\tprovideAppInitializer(() => inject(ThemeService).init()),\n\t];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAoBA;AACO,MAAM,kBAAkB,GAAG;AACrB,MAAA,cAAc,GAAG,CAAC,kBAAkB;AACpC,MAAA,mBAAmB,GAAG,CAAC,kBAAkB;AAuFtD;MACa,kBAAkB,GAAG,IAAI,cAAc,CAAc,qBAAqB;AAEvF;AACA,MAA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