@sixbell-telco/sdk 1.4.0 → 1.5.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 (63) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +410 -472
  3. package/fesm2022/sixbell-telco-sdk-utils-logger.mjs +578 -0
  4. package/fesm2022/sixbell-telco-sdk-utils-logger.mjs.map +1 -0
  5. package/fesm2022/sixbell-telco-sdk-utils-resource-loader.mjs +1222 -0
  6. package/fesm2022/sixbell-telco-sdk-utils-resource-loader.mjs.map +1 -0
  7. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +1434 -180
  8. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
  9. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +734 -182
  10. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  11. package/package.json +64 -56
  12. package/utils/logger/README.md +539 -0
  13. package/utils/logger/index.d.ts +5 -0
  14. package/utils/logger/public-api.d.ts +3 -0
  15. package/utils/logger/src/constants.d.ts +15 -0
  16. package/utils/logger/src/logger.service.d.ts +123 -0
  17. package/utils/logger/src/models/logger.d.ts +25 -0
  18. package/utils/logger/src/providers/logger.provider.d.ts +3 -0
  19. package/utils/resource-loader/README.md +460 -0
  20. package/utils/resource-loader/index.d.ts +5 -0
  21. package/utils/resource-loader/public-api.d.ts +1 -0
  22. package/utils/resource-loader/src/cache/index.d.ts +2 -0
  23. package/utils/resource-loader/src/cache/layers/factory.d.ts +38 -0
  24. package/utils/resource-loader/src/cache/layers/index.d.ts +3 -0
  25. package/utils/resource-loader/src/cache/layers/indexed-db-cache.d.ts +118 -0
  26. package/utils/resource-loader/src/cache/layers/local-storage-cache.d.ts +86 -0
  27. package/utils/resource-loader/src/cache/layers/memory-cache.d.ts +76 -0
  28. package/utils/resource-loader/src/cache/types.d.ts +107 -0
  29. package/utils/resource-loader/src/config/index.d.ts +1 -0
  30. package/utils/resource-loader/src/config/load-config.d.ts +32 -0
  31. package/utils/resource-loader/src/constants.d.ts +38 -0
  32. package/utils/resource-loader/src/http/index.d.ts +1 -0
  33. package/utils/resource-loader/src/http/retryable-client.d.ts +43 -0
  34. package/utils/resource-loader/src/index.d.ts +1 -0
  35. package/utils/resource-loader/src/resource-loader.d.ts +67 -0
  36. package/utils/resource-loader/src/types.d.ts +152 -0
  37. package/utils/resource-loader/src/utils/cache-validator.d.ts +72 -0
  38. package/utils/resource-loader/src/utils/helpers.d.ts +15 -0
  39. package/utils/resource-loader/src/utils/index.d.ts +2 -0
  40. package/utils/theme/README.md +1054 -109
  41. package/utils/theme/public-api.d.ts +9 -1
  42. package/utils/theme/src/constants.d.ts +74 -0
  43. package/utils/theme/src/models/theme.d.ts +288 -0
  44. package/utils/theme/src/providers/constants.d.ts +7 -0
  45. package/utils/theme/src/providers/theme.provider.d.ts +13 -0
  46. package/utils/theme/src/providers/theme.provider.types.d.ts +29 -0
  47. package/utils/theme/src/theme-assets/theme-assets.service.d.ts +214 -0
  48. package/utils/theme/src/theme-assets/theme-assets.types.d.ts +10 -0
  49. package/utils/theme/src/theme-dom/theme-dom.service.d.ts +87 -0
  50. package/utils/theme/src/theme-scheme/theme-scheme.service.d.ts +44 -0
  51. package/utils/theme/src/theme-storage/theme-storage.service.d.ts +47 -0
  52. package/utils/theme/src/theme.service.d.ts +40 -186
  53. package/utils/theme/src/utils/utils.d.ts +86 -0
  54. package/utils/translation/README.md +1414 -176
  55. package/utils/translation/public-api.d.ts +6 -0
  56. package/utils/translation/src/constants.d.ts +52 -0
  57. package/utils/translation/src/models/translation.d.ts +59 -0
  58. package/utils/translation/src/providers/constants.d.ts +11 -0
  59. package/utils/translation/src/providers/translation.provider.d.ts +73 -0
  60. package/utils/translation/src/providers/translation.provider.types.d.ts +26 -0
  61. package/utils/translation/src/translation-dom/translation-dom.service.d.ts +26 -0
  62. package/utils/translation/src/translation-storage/translation-storage.service.d.ts +34 -0
  63. package/utils/translation/src/translation.service.d.ts +19 -166
package/README.md CHANGED
@@ -63,10 +63,12 @@ Happy coding!
63
63
 
64
64
  ### Services
65
65
 
66
- | Service | Description | Documentation |
67
- | ------------------- | ---------------------------------------------------------------------------- | ------------------------------------- |
68
- | Translation Service | Internationalization service with ngx-translate integration and IntelliSense | [README](utils/translation/README.md) |
69
- | Theme Service | Theme management with reactive signals and automatic persistence | [README](utils/theme/README.md) |
66
+ | Service | Description | Documentation |
67
+ | ------------------- | -------------------------------------------------------------------------------- | ----------------------------------------- |
68
+ | Logger Service | Comprehensive logging with theme-aware styling, IndexedDB persistence | [README](utils/logger/README.md) |
69
+ | Theme Service | Runtime theme management with multi-tenant support and automatic persistence | [README](utils/theme/README.md) |
70
+ | Translation Service | Runtime i18n with ngx-translate integration, multi-language support, persistence | [README](utils/translation/README.md) |
71
+ | Resource Loader | Intelligent resource loading with multi-layer caching and fallback support | [README](utils/resource-loader/README.md) |
70
72
 
71
73
  ## Setup
72
74
 
@@ -161,64 +163,160 @@ With these settings, VSCode will provide class autocompletion for the library's
161
163
 
162
164
  ## Services Configuration
163
165
 
164
- ### Translation Service Setup
166
+ Configure all services using runtime providers in your `app.config.ts`. This approach loads configuration from JSON files at runtime, eliminating the need to recompile when updating themes or languages.
167
+
168
+ ### Logger Service Setup
165
169
 
166
- The Translation Service provides internationalization with TypeScript IntelliSense support. Configure it in your `app.config.ts`:
170
+ Configure logging with different levels for development and production:
167
171
 
168
172
  ```typescript
169
- // app.config.ts
170
- import { provideTranslation } from '@sixbell-telco/sdk/utils/translation';
173
+ import { provideLogger } from '@sixbell-telco/sdk/utils/logger';
171
174
 
172
175
  export const appConfig: ApplicationConfig = {
173
176
  providers: [
174
- provideHttpClient(),
175
- provideTranslation({
176
- // Optional: Add additional languages beyond en, es, pt
177
- additionalLanguages: [
178
- { code: 'de', name: 'Deutsch' },
179
- { code: 'fr', name: 'Français' },
180
- { code: 'it', name: 'Italiano' },
181
- ],
182
- defaultLang: 'es', // IntelliSense: 'en' | 'es' | 'pt' | 'de' | 'fr' | 'it'
183
- excludeLanguages: ['pt'], // Optional: exclude default languages (or any other)
184
- translationPaths: ['/assets/i18n/', '/assets/i18n/sdk/'], // By default looks in '/assets/i18n/'
177
+ provideLogger({
178
+ enableLogging: true,
179
+ logLevel: isDevMode() ? 'debug' : 'warn', // trace | debug | info | warn | error | fatal
180
+ showTimestamp: true,
181
+ persistToIndexedDB: true, // Persistent storage for debugging
182
+ silentMode: !isDevMode(),
185
183
  }),
186
184
  ],
187
185
  };
188
186
  ```
189
187
 
188
+ ### Translation Service Setup
189
+
190
+ The Translation Service loads language configuration from a runtime JSON file:
191
+
192
+ ```typescript
193
+ import { provideRuntimeTranslation } from '@sixbell-telco/sdk/utils/translation';
194
+
195
+ export const appConfig: ApplicationConfig = {
196
+ providers: [provideRuntimeTranslation('/assets/translation/translation.json')],
197
+ };
198
+ ```
199
+
200
+ The `translation.json` file defines available languages and their translation paths:
201
+
202
+ ```json
203
+ {
204
+ "defaultLanguage": "es",
205
+ "translationPaths": {
206
+ "en": "/assets/i18n/en.json",
207
+ "es": "/assets/i18n/es.json",
208
+ "pt": "/assets/i18n/pt.json"
209
+ }
210
+ }
211
+ ```
212
+
190
213
  ### Theme Service Setup
191
214
 
192
- The Theme Service provides reactive theme management. Configure it in your `app.config.ts`:
215
+ The Theme Service loads theme configuration from a runtime JSON file:
193
216
 
194
217
  ```typescript
195
- // app.config.ts
196
- import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
218
+ import { provideRuntimeTheme } from '@sixbell-telco/sdk/utils/theme';
197
219
 
198
220
  export const appConfig: ApplicationConfig = {
199
- providers: [
200
- provideTheme({
201
- defaultScheme: 'system', // 'system' | 'light' | 'dark'
202
- defaultTheme: 'sixbell_telco', // IntelliSense: 'sixbell_telco' | custom
203
- // Optional: Add additional themes
204
- additionalThemes: ['custom'],
205
- // Optional: Exclude default themes (or any other)
206
- excludeThemes: [],
207
- }),
208
- ],
221
+ providers: [provideRuntimeTheme('/assets/themes/themes.json')],
209
222
  };
210
223
  ```
211
224
 
225
+ The `themes.json` file defines available themes and their variants:
226
+
227
+ ```json
228
+ {
229
+ "fonts": [
230
+ {
231
+ "family": "Poppins",
232
+ "displayName": "Poppins Sans-Serif",
233
+ "faces": [
234
+ {
235
+ "weight": 400,
236
+ "style": "normal",
237
+ "src": "./assets/fonts/Poppins-Regular.ttf"
238
+ },
239
+ {
240
+ "weight": 700,
241
+ "style": "normal",
242
+ "src": "./assets/fonts/Poppins-Bold.ttf"
243
+ }
244
+ ]
245
+ }
246
+ ],
247
+ "themes": {
248
+ "sixbell_telco": {
249
+ "light": {
250
+ "displayName": "Sixbell Telco Light",
251
+ "daisyuiName": "sixbell_telco__light",
252
+ "prefersDark": false,
253
+ "variables": {
254
+ "--color-primary": "oklch(65.64% 0.1155 219.3)",
255
+ "--color-secondary": "oklch(86.57% 0.0064 255.48)"
256
+ }
257
+ },
258
+ "dark": {
259
+ "displayName": "Sixbell Telco Dark",
260
+ "daisyuiName": "sixbell_telco__dark",
261
+ "prefersDark": true,
262
+ "variables": {
263
+ "--color-primary": "oklch(65.64% 0.1155 219.3)",
264
+ "--color-secondary": "oklch(48.72% 0.0161 276.78)"
265
+ }
266
+ }
267
+ },
268
+ "custom_theme": {
269
+ "light": {
270
+ "displayName": "Custom Theme Light",
271
+ "daisyuiName": "custom__light",
272
+ "prefersDark": false,
273
+ "variables": {
274
+ "--color-primary": "oklch(70% 0.15 220)",
275
+ "--color-secondary": "oklch(80% 0.1 210)"
276
+ }
277
+ },
278
+ "dark": {
279
+ "displayName": "Custom Theme Dark",
280
+ "daisyuiName": "custom__dark",
281
+ "prefersDark": true,
282
+ "variables": {
283
+ "--color-primary": "oklch(60% 0.12 220)",
284
+ "--color-secondary": "oklch(50% 0.08 210)"
285
+ }
286
+ }
287
+ }
288
+ },
289
+ "assets": {
290
+ "sixbell_telco": {
291
+ "logo": {
292
+ "light": "/assets/logos/sixbell-logo-light.svg",
293
+ "dark": "/assets/logos/sixbell-logo-dark.svg"
294
+ }
295
+ },
296
+ "custom_theme": {
297
+ "logo": {
298
+ "light": "/assets/logos/custom-logo-light.svg",
299
+ "dark": "/assets/logos/custom-logo-dark.svg"
300
+ }
301
+ }
302
+ },
303
+ "defaultTheme": "sixbell_telco",
304
+ "defaultScheme": "system",
305
+ "excludeThemes": []
306
+ }
307
+ ```
308
+
212
309
  ### Complete Configuration Example
213
310
 
214
311
  ```typescript
215
312
  // app.config.ts
216
313
  import { DialogModule } from '@angular/cdk/dialog';
217
- import { ApplicationConfig, importProvidersFrom } from '@angular/core';
314
+ import { ApplicationConfig, importProvidersFrom, isDevMode } from '@angular/core';
218
315
  import { provideRouter } from '@angular/router';
219
316
  import { provideHttpClient } from '@angular/common/http';
220
- import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
221
- import { provideTranslation } from '@sixbell-telco/sdk/utils/translation';
317
+ import { provideLogger } from '@sixbell-telco/sdk/utils/logger';
318
+ import { provideRuntimeTheme } from '@sixbell-telco/sdk/utils/theme';
319
+ import { provideRuntimeTranslation } from '@sixbell-telco/sdk/utils/translation';
222
320
  import { routes } from './app.routes';
223
321
 
224
322
  export const appConfig: ApplicationConfig = {
@@ -227,341 +325,196 @@ export const appConfig: ApplicationConfig = {
227
325
  provideHttpClient(),
228
326
  // CDK Dialog providers (required for dialog component)
229
327
  importProvidersFrom(DialogModule),
230
- // Translation configuration
231
- provideTranslation({
232
- additionalLanguages: [
233
- { code: 'de', name: 'Deutsch' },
234
- { code: 'fr', name: 'Français' },
235
- ],
236
- defaultLang: 'es',
237
- excludeLanguages: ['pt'],
238
- translationPaths: ['/assets/i18n/', '/assets/i18n/sdk/'],
239
- }),
240
- // Theme configuration
241
- provideTheme({
242
- defaultScheme: 'system',
243
- additionalThemes: ['custom'],
244
- excludeThemes: ['custom'],
245
- defaultTheme: 'custom',
328
+ // Logger service - configure logging levels and storage
329
+ provideLogger({
330
+ enableLogging: true,
331
+ logLevel: isDevMode() ? 'debug' : 'warn',
332
+ showTimestamp: true,
333
+ persistToIndexedDB: true,
334
+ silentMode: !isDevMode(),
246
335
  }),
336
+ // Translation service - loads languages from runtime JSON
337
+ provideRuntimeTranslation('/assets/translation/translation.json'),
338
+ // Theme service - loads themes from runtime JSON
339
+ provideRuntimeTheme('/assets/themes/themes.json'),
247
340
  ],
248
341
  };
249
342
  ```
250
343
 
251
- ## Adding Custom Themes
344
+ **Key Benefits of Runtime Configuration:**
252
345
 
253
- To add a custom theme to your application, you need to:
346
+ - **No Recompilation**: Update themes and languages without rebuilding your application
347
+ - **Multi-Tenant Support**: Easily switch themes and language sets per deployment environment
348
+ - **Caching Strategy**: ResourceLoader intelligently caches configurations (IndexedDB → localStorage → memory)
349
+ - **Hot Updates**: Changes to `themes.json` and `translation.json` take effect immediately
350
+ - **Persistent Preferences**: User language and theme preferences are stored and restored automatically
254
351
 
255
- ### 1. Create CSS Theme Definitions
352
+ ## Adding Custom Themes
256
353
 
257
- Add your custom theme CSS variables to your global stylesheet. Each theme needs both light and dark variants:
354
+ Themes are managed through a runtime configuration file (`themes.json`) with CSS variables and font definitions. This approach allows for:
258
355
 
259
- ```css
260
- /* Example: Adding a "custom" theme */
261
- @plugin "daisyui/theme" {
262
- name: 'sixbell_telco__light';
263
- default: true;
264
- prefersdark: false;
265
- color-scheme: light;
266
-
267
- /* Daisy UI Colors */
268
- --color-base-100: oklch(96.65% 0.0045 258.32);
269
- --color-base-200: oklch(100% 0 0);
270
- --color-base-300: oklch(92.88% 0.0126 255.51);
271
- --color-base-content: oklch(13.49% 0.0024 286.07);
272
- --color-primary: oklch(65.64% 0.1155 219.3);
273
- --color-primary-content: oklch(100% 0 0);
274
- --color-secondary: oklch(86.57% 0.0064 255.48);
275
- --color-secondary-content: oklch(13.49% 0.0024 286.07);
276
- --color-accent: oklch(70.45% 0.1926 39.23);
277
- --color-accent-content: oklch(13.49% 0.0024 286.07);
278
- --color-neutral: oklch(92.08% 0.0063 255.48);
279
- --color-neutral-content: oklch(13.49% 0.0024 286.07);
280
- --color-info: oklch(55.86% 0.1907 256);
281
- --color-info-content: oklch(100% 0 0);
282
- --color-success: oklch(73.79% 0.2409 140.89);
283
- --color-success-content: oklch(36.22% 0.1147 140.02);
284
- --color-warning: oklch(85.44% 0.1839 108.37);
285
- --color-warning-content: oklch(46.41% 0.0998 109);
286
- --color-error: oklch(65.92% 0.2275 29.05);
287
- --color-error-content: oklch(25.91% 0.0904 29.25);
288
-
289
- /* Daisy UI Properties */
290
- /* border radius */
291
- --radius-selector: 0.5rem; /* For small sized components like checkbox, toggle, badge, etc. */
292
- --radius-field: 0.25rem; /* For medium sized components like button, input, select, tab, etc. */
293
- --radius-box: 0.5rem; /* For large sized components like card, modal, alert, etc. */
294
-
295
- /* base sizes */
296
- --size-selector: 0.25rem;
297
- --size-field: 0.25rem;
298
-
299
- /* border size */
300
- --border: 1px;
301
-
302
- /* effects */
303
- --depth: 0;
304
- --noise: 0;
305
-
306
- /* Custom Colors */
307
- --color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
308
- --color-primary-light: color-mix(in oklch, var(--color-primary) 60%, #fff 40%);
309
- --color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
310
- --color-primary-gradient-content: oklch(100% 0 0);
311
- --color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
312
- --color-secondary-gradient-content: oklch(13.49% 0.0024 286.07);
313
- --color-tertiary-gradient: color-mix(in oklch, var(--color-tertiary) 60%, #121212);
314
- --color-tertiary-gradient-content: oklch(13.49% 0.0024 286.07);
315
- --color-accent-gradient: color-mix(in oklch, var(--color-accent) 60%, #121212);
316
- --color-accent-gradient-content: oklch(100% 0 0);
317
- --color-tertiary: oklch(72.52% 0 0);
318
- --color-tertiary-content: oklch(13.49% 0.0024 286.07);
319
- --color-neutral-secondary: oklch(73.97% 0.0115 280.4);
320
- --color-neutral-secondary-content: oklch(100% 0 0);
321
- --color-neutral-tertiary: oklch(100% 0 0);
322
- --color-neutral-tertiary-content: oklch(73.97% 0.0115 280.4);
323
- --color-base-placeholder: oklch(51.6% 0.0073 255.51);
324
- --color-backdrop: oklch(0% 0 0/ 0.4);
325
-
326
- /* Shadow color tokens */
327
- --color-shadow-primary: oklch(0.8975 0 0);
328
- --color-shadow-backdrop: oklch(0% 0 0/ 0.25);
329
-
330
- --color-metrics-increase: oklch(74.59% 0.1812 152.33);
331
- --color-metrics-decrease: oklch(63.07% 0.194 29.44);
332
- --color-metrics-neutral: oklch(62.99% 0.0152 202.37);
333
-
334
- --color-metrics-intensity-highest: oklch(65.64% 0.1155 219.3);
335
- --color-metrics-intensity-high: oklch(68.62% 0.0925 226.08);
336
- --color-metrics-intensity-medium: oklch(68.62% 0.0925 226.08);
337
- --color-metrics-intensity-low: oklch(76.18% 0.0656 213.66);
338
- --color-metrics-intensity-lowest: oklch(78% 0.0473 211.88);
339
-
340
- --color-scroll-thumb: oklch(75% 0 0);
341
- }
356
+ - **Zero Recompilation**: Add/modify themes without rebuilding
357
+ - **Multi-Tenant Support**: Different themes per deployment
358
+ - **Dynamic Assets**: Brand-specific logos and images per theme
359
+ - **Runtime Fonts**: Load custom fonts for each theme
360
+ - **Hot Updates**: Changes take effect immediately
342
361
 
343
- @plugin "daisyui/theme" {
344
- name: 'sixbell_telco__dark';
345
- default: false;
346
- prefersdark: true;
347
- color-scheme: dark;
348
-
349
- /* Daisy UI Colors */
350
- --color-base-100: oklch(18.22% 0 0);
351
- --color-base-200: oklch(23.5% 0 0);
352
- --color-base-300: oklch(28.5% 0 0);
353
- --color-base-content: oklch(100% 0 0);
354
- --color-primary: oklch(65.64% 0.1155 219.3);
355
- --color-primary-content: oklch(100% 0 0);
356
- --color-secondary: oklch(48.72% 0.0161 276.78);
357
- --color-secondary-content: oklch(100% 0 0);
358
- --color-accent: oklch(70.45% 0.1926 39.23);
359
- --color-accent-content: oklch(23.5% 0 0);
360
- --color-neutral: oklch(49.26% 0 0);
361
- --color-neutral-content: oklch(100% 0 0);
362
- --color-info: oklch(55.86% 0.1907 256);
363
- --color-info-content: oklch(100% 0 0);
364
- --color-success: oklch(73.79% 0.2409 140.89);
365
- --color-success-content: oklch(36.22% 0.1147 140.02);
366
- --color-warning: oklch(85.44% 0.1839 108.37);
367
- --color-warning-content: oklch(46.41% 0.0998 109);
368
- --color-error: oklch(65.92% 0.2275 29.05);
369
- --color-error-content: oklch(25.91% 0.0904 29.25);
370
-
371
- /* border radius */
372
- --radius-selector: 0.5rem;
373
- --radius-field: 0.25rem;
374
- --radius-box: 0.5rem;
375
-
376
- /* base sizes */
377
- --size-selector: 0.25rem;
378
- --size-field: 0.25rem;
379
-
380
- /* border size */
381
- --border: 1px;
382
-
383
- /* effects */
384
- --depth: 0;
385
- --noise: 0;
386
-
387
- /* Custom Colors */
388
- --color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
389
- --color-primary-light: color-mix(in oklch, var(--color-primary) 60%, #fff 40%);
390
- --color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
391
- --color-primary-gradient-content: oklch(100% 0 0);
392
- --color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
393
- --color-secondary-gradient-content: oklch(100% 0 0);
394
- --color-tertiary-gradient: color-mix(in oklch, var(--color-tertiary) 60%, #121212);
395
- --color-tertiary-gradient-content: oklch(100% 0 0);
396
- --color-accent-gradient: color-mix(in oklch, var(--color-accent) 60%, #121212);
397
- --color-accent-gradient-content: oklch(100% 0 0);
398
- --color-tertiary: oklch(72.52% 0 0);
399
- --color-tertiary-content: oklch(13.49% 0.0024 286.07);
400
- --color-neutral-secondary: oklch(73.97% 0.0115 280.4);
401
- --color-neutral-secondary-content: oklch(100% 0 0);
402
- --color-neutral-tertiary: oklch(100% 0 0);
403
- --color-neutral-tertiary-content: oklch(73.97% 0.0115 280.4);
404
- --color-base-placeholder: oklch(51.6% 0.0073 255.51);
405
- --color-backdrop: oklch(0% 0 0/ 0.4);
406
-
407
- /* Shadow color tokens */
408
- --color-shadow-primary: oklch(0 0 0);
409
- --color-shadow-backdrop: oklch(0% 0 0/ 0.25);
410
-
411
- --color-metrics-increase: oklch(74.59% 0.1812 152.33);
412
- --color-metrics-decrease: oklch(63.07% 0.194 29.44);
413
- --color-metrics-neutral: oklch(62.99% 0.0152 202.37);
414
-
415
- --color-metrics-intensity-highest: oklch(65.64% 0.1155 219.3);
416
- --color-metrics-intensity-high: oklch(68.62% 0.0925 226.08);
417
- --color-metrics-intensity-medium: oklch(68.62% 0.0925 226.08);
418
- --color-metrics-intensity-low: oklch(76.18% 0.0656 213.66);
419
- --color-metrics-intensity-lowest: oklch(78% 0.0473 211.88);
420
-
421
- --color-scroll-thumb: oklch(35% 0 0);
422
- }
362
+ ### 1. Update `themes.json`
423
363
 
424
- @theme {
425
- /* Color tokens registered for Tailwind utilities; values provided in theme plugin blocks */
426
- --color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
427
- --color-primary-light: color-mix(in oklch, var(--color-primary) 60%, #fff 40%);
428
- --color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
429
- --color-primary-gradient-content: oklch(100% 0 0);
430
- --color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
431
- --color-secondary-gradient-content: oklch(13.49% 0.0024 286.07);
432
- --color-tertiary-gradient: color-mix(in oklch, var(--color-tertiary) 60%, #121212);
433
- --color-tertiary-gradient-content: oklch(13.49% 0.0024 286.07);
434
- --color-accent-gradient: color-mix(in oklch, var(--color-accent) 60%, #121212);
435
- --color-accent-gradient-content: oklch(100% 0 0);
436
- --color-tertiary: oklch(72.52% 0 0);
437
- --color-tertiary-content: oklch(13.49% 0.0024 286.07);
438
- --color-neutral-secondary: oklch(73.97% 0.0115 280.4);
439
- --color-neutral-secondary-content: oklch(100% 0 0);
440
- --color-neutral-tertiary: oklch(100% 0 0);
441
- --color-neutral-tertiary-content: oklch(73.97% 0.0115 280.4);
442
- --color-base-placeholder: oklch(51.6% 0.0073 255.51);
443
- --color-backdrop: oklch(0% 0 0/ 0.4);
444
- --color-metrics-increase: oklch(74.59% 0.1812 152.33);
445
- --color-metrics-decrease: oklch(63.07% 0.194 29.44);
446
- --color-metrics-neutral: oklch(62.99% 0.0152 202.37);
447
- --color-metrics-intensity-highest: oklch(65.64% 0.1155 219.3);
448
- --color-metrics-intensity-high: oklch(68.62% 0.0925 226.08);
449
- --color-metrics-intensity-medium: oklch(68.62% 0.0925 226.08);
450
- --color-metrics-intensity-low: oklch(76.18% 0.0656 213.66);
451
- --color-metrics-intensity-lowest: oklch(78% 0.0473 211.88);
452
- --color-scroll-thumb: oklch(75% 0 0);
453
- --color-shadow-primary: oklch(0.8975 0 0);
454
- --color-shadow-backdrop: oklch(0% 0 0/ 0.25);
455
-
456
- /* Non-color design tokens (kept for convenience) */
457
- --font-poppins: Poppins, sans-serif;
458
- --font-heading: Poppins, sans-serif;
459
- --font-body: Poppins, sans-serif;
460
- --shadow-main: 0px 0px 4px 0px var(--shadow-primary);
461
- --shadow-backdrop: 0px 25px 50px -12px var(--shadow-backdrop);
462
- }
364
+ Add your custom theme to `/assets/themes/themes.json`:
463
365
 
464
- /* regular and bold weights */
465
- @font-face {
466
- font-family: 'Poppins';
467
- font-weight: 400;
468
- font-style: normal;
469
- src: url('./assets/fonts/Poppins-Regular.ttf');
366
+ ```json
367
+ {
368
+ "fonts": [
369
+ {
370
+ "family": "Poppins",
371
+ "displayName": "Poppins Sans-Serif",
372
+ "faces": [
373
+ {
374
+ "weight": 400,
375
+ "style": "normal",
376
+ "src": "./assets/fonts/Poppins-Regular.ttf"
377
+ },
378
+ {
379
+ "weight": 700,
380
+ "style": "normal",
381
+ "src": "./assets/fonts/Poppins-Bold.ttf"
382
+ }
383
+ ]
384
+ }
385
+ ],
386
+ "themes": {
387
+ "sixbell_telco": {
388
+ "light": {
389
+ "displayName": "Sixbell Telco Light",
390
+ "daisyuiName": "sixbell_telco__light",
391
+ "prefersDark": false,
392
+ "variables": {
393
+ "--color-primary": "oklch(65.64% 0.1155 219.3)",
394
+ "--color-secondary": "oklch(86.57% 0.0064 255.48)"
395
+ }
396
+ },
397
+ "dark": {
398
+ "displayName": "Sixbell Telco Dark",
399
+ "daisyuiName": "sixbell_telco__dark",
400
+ "prefersDark": true,
401
+ "variables": {
402
+ "--color-primary": "oklch(65.64% 0.1155 219.3)",
403
+ "--color-secondary": "oklch(48.72% 0.0161 276.78)"
404
+ }
405
+ }
406
+ },
407
+ "custom_theme": {
408
+ "light": {
409
+ "displayName": "Custom Theme Light",
410
+ "daisyuiName": "custom__light",
411
+ "prefersDark": false,
412
+ "variables": {
413
+ "--color-primary": "oklch(70% 0.15 220)",
414
+ "--color-secondary": "oklch(80% 0.1 210)"
415
+ }
416
+ },
417
+ "dark": {
418
+ "displayName": "Custom Theme Dark",
419
+ "daisyuiName": "custom__dark",
420
+ "prefersDark": true,
421
+ "variables": {
422
+ "--color-primary": "oklch(60% 0.12 220)",
423
+ "--color-secondary": "oklch(50% 0.08 210)"
424
+ }
425
+ }
426
+ }
427
+ },
428
+ "assets": {
429
+ "sixbell_telco": {
430
+ "logo": {
431
+ "light": "/assets/logos/sixbell-logo-light.svg",
432
+ "dark": "/assets/logos/sixbell-logo-dark.svg"
433
+ }
434
+ },
435
+ "custom_theme": {
436
+ "logo": {
437
+ "light": "/assets/logos/custom-logo-light.svg",
438
+ "dark": "/assets/logos/custom-logo-dark.svg"
439
+ }
440
+ }
441
+ },
442
+ "defaultTheme": "sixbell_telco",
443
+ "defaultScheme": "system",
444
+ "excludeThemes": []
470
445
  }
446
+ ```
471
447
 
472
- @font-face {
473
- font-family: 'Poppins';
474
- font-weight: 500;
475
- font-style: normal;
476
- src: url('./assets/fonts/Poppins-Medium.ttf');
477
- }
448
+ **Configuration Structure:**
478
449
 
479
- @font-face {
480
- font-family: 'Poppins';
481
- font-weight: 600;
482
- font-style: normal;
483
- src: url('./assets/fonts/Poppins-SemiBold.ttf');
484
- }
450
+ - `fonts`: Font definitions with faces (weight and style variants)
451
+ - `themes`: Theme variants (light/dark) with CSS variables and DaisyUI names
452
+ - `daisyuiName`: Maps to CSS `@plugin "daisyui/theme" { name: '...' }`
453
+ - `variables`: CSS custom properties applied to this theme variant
454
+ - `assets`: Theme-specific resources (logos, banners) for light/dark schemes
455
+ - `defaultTheme`: Initial theme on app startup
456
+ - `defaultScheme`: Initial color scheme (`'system'`, `'light'`, or `'dark'`)
485
457
 
486
- @font-face {
487
- font-family: 'Poppins';
488
- font-weight: 700;
489
- font-style: normal;
490
- src: url('./assets/fonts/Poppins-Bold.ttf');
491
- }
458
+ ### 2. Define DaisyUI Themes in Global Styles
492
459
 
493
- @font-face {
494
- font-family: 'Poppins';
495
- font-weight: 800;
496
- font-style: normal;
497
- src: url('./assets/fonts/Poppins-ExtraBold.ttf');
498
- }
460
+ In your global `styles.css`, import the SDK and define your theme CSS:
499
461
 
500
- @font-face {
501
- font-family: 'Poppins';
502
- font-weight: 900;
503
- font-style: normal;
504
- src: url('./assets/fonts/Poppins-Black.ttf');
505
- }
462
+ ```css
463
+ @import '../node_modules/@sixbell-telco/sdk/_index.css';
506
464
 
507
- /* italic style */
508
- @font-face {
509
- font-family: 'Poppins';
510
- font-weight: 400;
511
- font-style: italic;
512
- src: url('./assets/fonts/Poppins-Italic.ttf');
513
- }
465
+ @import 'tailwindcss';
514
466
 
515
- @font-face {
516
- font-family: 'Poppins';
517
- font-weight: 500;
518
- font-style: italic;
519
- src: url('./assets/fonts/Poppins-MediumItalic.ttf');
520
- }
467
+ @source '../src';
468
+ ```
521
469
 
522
- @font-face {
523
- font-family: 'Poppins';
524
- font-weight: 600;
525
- font-style: italic;
526
- src: url('./assets/fonts/Poppins-SemiBoldItalic.ttf');
527
- }
470
+ ### 3. Use Themes in Components
528
471
 
529
- @font-face {
530
- font-family: 'Poppins';
531
- font-weight: 700;
532
- font-style: italic;
533
- src: url('./assets/fonts/Poppins-BoldItalic.ttf');
534
- }
472
+ The ThemeService automatically loads available themes from `themes.json`:
535
473
 
536
- @font-face {
537
- font-family: 'Poppins';
538
- font-weight: 800;
539
- font-style: italic;
540
- src: url('./assets/fonts/Poppins-ExtraBoldItalic.ttf');
541
- }
474
+ ```typescript
475
+ import { Component, ChangeDetectionStrategy, inject, computed } from '@angular/core';
476
+ import { ThemeService, ThemeAssetsService } from '@sixbell-telco/sdk/utils/theme';
477
+ import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
478
+ import { CommonModule } from '@angular/common';
542
479
 
543
- @font-face {
544
- font-family: 'Poppins';
545
- font-weight: 900;
546
- font-style: italic;
547
- src: url('./assets/fonts/Poppins-BlackItalic.ttf');
548
- }
549
- ```
480
+ @Component({
481
+ selector: 'app-theme-switcher',
482
+ standalone: true,
483
+ imports: [CommonModule, ButtonComponent],
484
+ changeDetection: ChangeDetectionStrategy.OnPush,
485
+ template: `
486
+ <div>
487
+ <select (change)="themeService.setTheme($event.target.value)">
488
+ @for (theme of themeService.getAvailableThemes(); track theme) {
489
+ <option [value]="theme" [selected]="themeService.selectedTheme() === theme">
490
+ {{ themeService.getLocalizedThemeName(theme) }}
491
+ </option>
492
+ }
493
+ </select>
550
494
 
551
- ### 2. Add Theme to Service Configuration
495
+ <select (change)="themeService.setScheme($event.target.value)">
496
+ @for (scheme of themeService.getAvailableSchemes(); track scheme) {
497
+ <option [value]="scheme" [selected]="themeService.selectedScheme() === scheme">
498
+ {{ themeService.getLocalizedSchemeName(scheme) }}
499
+ </option>
500
+ }
501
+ </select>
552
502
 
553
- Include your custom theme in the theme service configuration:
503
+ <img [src]="logoUrl()" alt="Brand Logo" />
504
+ </div>
505
+ `,
506
+ })
507
+ export class ThemeSwitcherComponent {
508
+ themeService = inject(ThemeService);
509
+ private assetsService = inject(ThemeAssetsService);
554
510
 
555
- ```typescript
556
- provideTheme({
557
- additionalThemes: ['custom'], // Add your theme here
558
- defaultTheme: 'custom', // Optionally set as default
559
- }),
511
+ logoUrl = computed(() => this.assetsService.getAssetUrl('logo') || '/default-logo.svg');
512
+ }
560
513
  ```
561
514
 
562
- ### 3. Add Theme Translation Keys
515
+ ### 4. Add Theme Names to Translations
563
516
 
564
- Add the theme name to your translation files so it appears correctly in theme selectors:
517
+ Store theme and scheme display names in translation files. Create `/assets/themes/i18n/en.json`:
565
518
 
566
519
  **English (`en.json`):**
567
520
 
@@ -571,7 +524,12 @@ Add the theme name to your translation files so it appears correctly in theme se
571
524
  "theme": {
572
525
  "themes": {
573
526
  "sixbell_telco": "Sixbell Telco",
574
- "custom": "Custom"
527
+ "custom_theme": "Custom Theme"
528
+ },
529
+ "schemes": {
530
+ "system": "System",
531
+ "light": "Light",
532
+ "dark": "Dark"
575
533
  }
576
534
  }
577
535
  }
@@ -586,7 +544,12 @@ Add the theme name to your translation files so it appears correctly in theme se
586
544
  "theme": {
587
545
  "themes": {
588
546
  "sixbell_telco": "Sixbell Telco",
589
- "custom": "Perzonalizado"
547
+ "custom_theme": "Tema Personalizado"
548
+ },
549
+ "schemes": {
550
+ "system": "Sistema",
551
+ "light": "Claro",
552
+ "dark": "Oscuro"
590
553
  }
591
554
  }
592
555
  }
@@ -601,126 +564,65 @@ Add the theme name to your translation files so it appears correctly in theme se
601
564
  "theme": {
602
565
  "themes": {
603
566
  "sixbell_telco": "Sixbell Telco",
604
- "custom": "Personalizado"
567
+ "custom_theme": "Tema Personalizado"
568
+ },
569
+ "schemes": {
570
+ "system": "Sistema",
571
+ "light": "Claro",
572
+ "dark": "Escuro"
605
573
  }
606
574
  }
607
575
  }
608
576
  }
609
577
  ```
610
578
 
611
- Now your custom theme will be available in the theme service and will appear in theme selector components with proper translations.
579
+ Your themes are now fully configured. The ThemeService automatically:
612
580
 
613
- ## Adding Custom Languages
614
-
615
- To add additional languages to your application:
616
-
617
- ### 1. Create Translation Files
618
-
619
- Add your language translation file to `/assets/i18n/` following the naming convention `[language-code].json`:
620
-
621
- ```
622
- src/
623
- assets/
624
- i18n/
625
- en.json
626
- es.json
627
- pt.json
628
- de.json // New German translations
629
- fr.json // New French translations
630
- ```
581
+ - Loads theme definitions from `themes.json`
582
+ - Injects CSS variables via signals
583
+ - Resolves dynamic assets based on current theme and scheme
584
+ - Persists user preferences to localStorage
585
+ - Detects system dark mode preference when scheme is set to `'system'`
631
586
 
632
- ### 2. Add Language to Service Configuration
633
-
634
- Include your custom languages in the translation service configuration:
635
-
636
- ```typescript
637
- provideTranslation({
638
- additionalLanguages: [
639
- { code: 'de', name: 'Deutsch' },
640
- { code: 'fr', name: 'Français' },
641
- ],
642
- defaultLang: 'de', // Optionally set as default
643
- }),
644
- ```
645
-
646
- ### 3. Add Language Translation Keys
587
+ ## Adding Custom Languages
647
588
 
648
- **Important:** For custom languages to appear in language selector components, you must add the language keys to the translation files:
589
+ Languages are now managed through a runtime configuration file (`translation.json`), eliminating the need to reconfigure and recompile. This approach allows for:
649
590
 
650
- **English (`en.json`):**
591
+ - **Zero Recompilation**: Add or modify languages without rebuilding
592
+ - **Multi-Tenant Languages**: Different language sets per deployment environment
593
+ - **Hot Updates**: Changes to translation configuration take effect immediately
594
+ - **Flexible Structure**: Organize translation files any way you need
651
595
 
652
- ```json
653
- {
654
- "sdk": {
655
- "language": {
656
- "languages": {
657
- "en": "English",
658
- "es": "Spanish",
659
- "pt": "Portuguese",
660
- "de": "German",
661
- "fr": "French"
662
- }
663
- }
664
- }
665
- }
666
- ```
596
+ ### 1. Create or Update `translation.json`
667
597
 
668
- **German (`de.json`):**
598
+ Create `/assets/translation/translation.json` in your application:
669
599
 
670
600
  ```json
671
601
  {
672
- "sdk": {
673
- "language": {
674
- "languages": {
675
- "en": "Englisch",
676
- "es": "Spanisch",
677
- "pt": "Portugiesisch",
678
- "de": "Deutsch",
679
- "fr": "Französisch"
680
- }
681
- }
602
+ "defaultLanguage": "es",
603
+ "translationPaths": {
604
+ "en": "/assets/i18n/en.json",
605
+ "es": "/assets/i18n/es.json",
606
+ "pt": "/assets/i18n/pt.json"
682
607
  }
683
608
  }
684
609
  ```
685
610
 
686
- Repeat this pattern for all your translation files. Without these keys, the language names won't be properly displayed in language selector components.
611
+ **Configuration Structure:**
687
612
 
688
- ### Translation Files Setup
613
+ - `defaultLanguage`: Language code loaded on app initialization
614
+ - `translationPaths`: Map of language codes to their translation file paths
615
+ - Custom paths are fully supported - organize as needed for your architecture
689
616
 
690
- Create translation files in `/assets/i18n/` with the following structure:
617
+ ### 2. Create Translation Files
691
618
 
692
- ```
693
- src/
694
- assets/
695
- i18n/
696
- en.json
697
- es.json
698
- pt.json
699
- de.json // if using additional languages
700
- ```
619
+ Create language translation files at the paths defined in `translation.json`. The minimal translation structure includes SDK translations:
701
620
 
702
- #### English (`en.json`)
621
+ **English (`/assets/sdk/i18n/en.json`):**
703
622
 
704
623
  ```json
705
624
  {
706
625
  "sdk": {
707
- "theme": {
708
- "themes": {
709
- "sixbell_telco": "Sixbell telco"
710
- },
711
- "schemes": {
712
- "system": "System",
713
- "light": "Light",
714
- "dark": "Dark"
715
- }
716
- },
717
- "language": {
718
- "languages": {
719
- "en": "English",
720
- "es": "Spanish",
721
- "pt": "Portuguese"
722
- }
723
- },
724
626
  "fileUpload": {
725
627
  "dropzone": {
726
628
  "selectPrompt": "Click to select files or drag and drop here",
@@ -794,6 +696,7 @@ src/
794
696
  },
795
697
  "dataTable": {
796
698
  "entriesByPage": "Entries per page",
699
+ "perPage": "{{count}} / page",
797
700
  "totalEntries": "{{total}} entries",
798
701
  "entriesRange": "{{range}} of {{total}} entries",
799
702
  "emptyListMessage": "No items to show",
@@ -843,28 +746,11 @@ src/
843
746
  }
844
747
  ```
845
748
 
846
- #### Spanish (`es.json`)
749
+ **Spanish (`/assets/i18n/es.json`):**
847
750
 
848
751
  ```json
849
752
  {
850
753
  "sdk": {
851
- "theme": {
852
- "themes": {
853
- "sixbell_telco": "Sixbell telco"
854
- },
855
- "schemes": {
856
- "system": "Sistema",
857
- "light": "Claro",
858
- "dark": "Oscuro"
859
- }
860
- },
861
- "language": {
862
- "languages": {
863
- "en": "Inglés",
864
- "es": "Español",
865
- "pt": "Portugués"
866
- }
867
- },
868
754
  "fileUpload": {
869
755
  "dropzone": {
870
756
  "selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
@@ -931,6 +817,7 @@ src/
931
817
  },
932
818
  "table": {
933
819
  "entriesByPage": "Entradas por página",
820
+ "perPage": "{{count}} / página",
934
821
  "totalEntries": "{{total}} entradas",
935
822
  "entriesRange": "{{range}} de {{total}} entradas",
936
823
  "emptyListMessage": "No hay elementos para mostrar"
@@ -987,28 +874,11 @@ src/
987
874
  }
988
875
  ```
989
876
 
990
- #### Portuguese (`pt.json`)
877
+ **Portuguese (`/assets/i18n/pt.json`):**
991
878
 
992
879
  ```json
993
880
  {
994
881
  "sdk": {
995
- "theme": {
996
- "themes": {
997
- "sixbell_telco": "Sixbell telco"
998
- },
999
- "schemes": {
1000
- "system": "Sistema",
1001
- "light": "Claro",
1002
- "dark": "Escuro"
1003
- }
1004
- },
1005
- "language": {
1006
- "languages": {
1007
- "en": "Inglês",
1008
- "es": "Espanhol",
1009
- "pt": "Português"
1010
- }
1011
- },
1012
882
  "fileUpload": {
1013
883
  "dropzone": {
1014
884
  "selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
@@ -1075,6 +945,7 @@ src/
1075
945
  },
1076
946
  "table": {
1077
947
  "entriesByPage": "Entradas por página",
948
+ "perPage": "{{count}} / página",
1078
949
  "totalEntries": "{{total}} entradas",
1079
950
  "entriesRange": "{{range}} de {{total}} entradas",
1080
951
  "emptyListMessage": "Nenhum item para mostrar"
@@ -1131,6 +1002,73 @@ src/
1131
1002
  }
1132
1003
  ```
1133
1004
 
1005
+ ### 3. Access Language Functionality in Components
1006
+
1007
+ The TranslationService automatically loads available languages from `translation.json`:
1008
+
1009
+ ```typescript
1010
+ // In any component
1011
+ import { TranslationService } from '@sixbell-telco/sdk/utils/translation';
1012
+ import { inject } from '@angular/core';
1013
+
1014
+ export class MyComponent {
1015
+ private translationService = inject(TranslationService);
1016
+
1017
+ availableLanguages = this.translationService.availableLanguages;
1018
+ currentLanguage = this.translationService.currentLanguage;
1019
+
1020
+ setLanguage(languageCode: string) {
1021
+ this.translationService.setLanguage(languageCode);
1022
+ }
1023
+
1024
+ getLanguageName(languageCode: string): string {
1025
+ return this.translationService.getLanguageName(languageCode);
1026
+ }
1027
+ }
1028
+ ```
1029
+
1030
+ ### 4. Use Translations in Templates
1031
+
1032
+ Translations are automatically loaded and available through the `translate` pipe:
1033
+
1034
+ ```html
1035
+ <!-- Access any translation key -->
1036
+ <h1>{{ 'sdk.language.languages.en' | translate }}</h1>
1037
+
1038
+ <!-- With parameters -->
1039
+ <p>{{ 'welcome.message' | translate: { name: userName } }}</p>
1040
+
1041
+ <!-- In component -->
1042
+ <select (change)="setLanguage($event.target.value)">
1043
+ @for (lang of availableLanguages; track lang) {
1044
+ <option [value]="lang">{{ getLanguageName(lang) }}</option>
1045
+ }
1046
+ </select>
1047
+ ```
1048
+
1049
+ ### 5. Add Custom Application Translations
1050
+
1051
+ Extend the translation files with your application-specific keys:
1052
+
1053
+ **English (`/assets/i18n/en.json`):**
1054
+
1055
+ ```json
1056
+ {
1057
+ "app": {
1058
+ "title": "My Application",
1059
+ "welcome": "Welcome to our app",
1060
+ "features": {
1061
+ "description": "Powerful features for your business"
1062
+ }
1063
+ },
1064
+ "sdk": {
1065
+ ...// SDK translations
1066
+ }
1067
+ }
1068
+ ```
1069
+
1070
+ Your application is now configured with full multi-language support. Language preferences are automatically persisted and restored on return visits.
1071
+
1134
1072
  ## Usage Examples
1135
1073
 
1136
1074
  ### Using Components
@@ -1204,4 +1142,4 @@ For detailed component documentation, visit our [Storybook](https://storybook.js
1204
1142
 
1205
1143
  ## Last update
1206
1144
 
1207
- This file was last updated on September 2nd, 2025.
1145
+ This file was last updated on November 4th, 2025.