@sixbell-telco/sdk 1.3.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.
- package/CHANGELOG.md +81 -0
- package/README.md +437 -472
- package/_index.css +109 -11
- package/assets/styles/toast.css +8 -0
- package/components/forms/date-picker/constants/date-picker.constants.d.ts +13 -0
- package/components/forms/date-picker/index.d.ts +5 -0
- package/components/forms/date-picker/public-api.d.ts +3 -0
- package/components/forms/date-picker/src/date-picker.component.d.ts +323 -0
- package/components/forms/date-picker/types/date-picker.types.d.ts +39 -0
- package/components/{forms/datepicker → sonner}/index.d.ts +1 -1
- package/components/sonner/public-api.d.ts +2 -0
- package/components/sonner/src/sonner.component.d.ts +39 -0
- package/components/sonner/toaster/index.d.ts +5 -0
- package/components/sonner/toaster/public-api.d.ts +1 -0
- package/components/sonner/toaster/src/toaster.component.d.ts +89 -0
- package/components/toast/public-api.d.ts +9 -0
- package/components/toast/services/toast.service.d.ts +3 -0
- package/components/toast/toast-message/toast-message.component.d.ts +3 -0
- package/components/toast/toasts-container/toasts-container.component.d.ts +3 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs +885 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs +132 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner.mjs +179 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +14 -0
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs +90 -2
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-logger.mjs +578 -0
- package/fesm2022/sixbell-telco-sdk-utils-logger.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-resource-loader.mjs +1222 -0
- package/fesm2022/sixbell-telco-sdk-utils-resource-loader.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +1434 -180
- package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +734 -182
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
- package/package.json +68 -51
- package/utils/date/src/date-utils.d.ts +44 -0
- package/utils/logger/README.md +539 -0
- package/utils/logger/index.d.ts +5 -0
- package/utils/logger/public-api.d.ts +3 -0
- package/utils/logger/src/constants.d.ts +15 -0
- package/utils/logger/src/logger.service.d.ts +123 -0
- package/utils/logger/src/models/logger.d.ts +25 -0
- package/utils/logger/src/providers/logger.provider.d.ts +3 -0
- package/utils/resource-loader/README.md +460 -0
- package/utils/resource-loader/index.d.ts +5 -0
- package/utils/resource-loader/public-api.d.ts +1 -0
- package/utils/resource-loader/src/cache/index.d.ts +2 -0
- package/utils/resource-loader/src/cache/layers/factory.d.ts +38 -0
- package/utils/resource-loader/src/cache/layers/index.d.ts +3 -0
- package/utils/resource-loader/src/cache/layers/indexed-db-cache.d.ts +118 -0
- package/utils/resource-loader/src/cache/layers/local-storage-cache.d.ts +86 -0
- package/utils/resource-loader/src/cache/layers/memory-cache.d.ts +76 -0
- package/utils/resource-loader/src/cache/types.d.ts +107 -0
- package/utils/resource-loader/src/config/index.d.ts +1 -0
- package/utils/resource-loader/src/config/load-config.d.ts +32 -0
- package/utils/resource-loader/src/constants.d.ts +38 -0
- package/utils/resource-loader/src/http/index.d.ts +1 -0
- package/utils/resource-loader/src/http/retryable-client.d.ts +43 -0
- package/utils/resource-loader/src/index.d.ts +1 -0
- package/utils/resource-loader/src/resource-loader.d.ts +67 -0
- package/utils/resource-loader/src/types.d.ts +152 -0
- package/utils/resource-loader/src/utils/cache-validator.d.ts +72 -0
- package/utils/resource-loader/src/utils/helpers.d.ts +15 -0
- package/utils/resource-loader/src/utils/index.d.ts +2 -0
- package/utils/theme/README.md +1054 -109
- package/utils/theme/public-api.d.ts +9 -1
- package/utils/theme/src/constants.d.ts +74 -0
- package/utils/theme/src/models/theme.d.ts +288 -0
- package/utils/theme/src/providers/constants.d.ts +7 -0
- package/utils/theme/src/providers/theme.provider.d.ts +13 -0
- package/utils/theme/src/providers/theme.provider.types.d.ts +29 -0
- package/utils/theme/src/theme-assets/theme-assets.service.d.ts +214 -0
- package/utils/theme/src/theme-assets/theme-assets.types.d.ts +10 -0
- package/utils/theme/src/theme-dom/theme-dom.service.d.ts +87 -0
- package/utils/theme/src/theme-scheme/theme-scheme.service.d.ts +44 -0
- package/utils/theme/src/theme-storage/theme-storage.service.d.ts +47 -0
- package/utils/theme/src/theme.service.d.ts +40 -186
- package/utils/theme/src/utils/utils.d.ts +86 -0
- package/utils/translation/README.md +1414 -176
- package/utils/translation/public-api.d.ts +6 -0
- package/utils/translation/src/constants.d.ts +52 -0
- package/utils/translation/src/models/translation.d.ts +59 -0
- package/utils/translation/src/providers/constants.d.ts +11 -0
- package/utils/translation/src/providers/translation.provider.d.ts +73 -0
- package/utils/translation/src/providers/translation.provider.types.d.ts +26 -0
- package/utils/translation/src/translation-dom/translation-dom.service.d.ts +26 -0
- package/utils/translation/src/translation-storage/translation-storage.service.d.ts +34 -0
- package/utils/translation/src/translation.service.d.ts +19 -166
- package/components/forms/datepicker/constants/datepicker.constants.d.ts +0 -5
- package/components/forms/datepicker/public-api.d.ts +0 -3
- package/components/forms/datepicker/src/datepicker.component.d.ts +0 -165
- package/components/forms/datepicker/types/datepicker.types.d.ts +0 -7
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +0 -487
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -63,10 +63,12 @@ Happy coding!
|
|
|
63
63
|
|
|
64
64
|
### Services
|
|
65
65
|
|
|
66
|
-
| Service | Description
|
|
67
|
-
| ------------------- |
|
|
68
|
-
|
|
|
69
|
-
| Theme Service |
|
|
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
|
-
|
|
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
|
-
|
|
170
|
+
Configure logging with different levels for development and production:
|
|
167
171
|
|
|
168
172
|
```typescript
|
|
169
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
|
215
|
+
The Theme Service loads theme configuration from a runtime JSON file:
|
|
193
216
|
|
|
194
217
|
```typescript
|
|
195
|
-
|
|
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 {
|
|
221
|
-
import {
|
|
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
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
344
|
+
**Key Benefits of Runtime Configuration:**
|
|
252
345
|
|
|
253
|
-
|
|
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
|
-
|
|
352
|
+
## Adding Custom Themes
|
|
256
353
|
|
|
257
|
-
|
|
354
|
+
Themes are managed through a runtime configuration file (`themes.json`) with CSS variables and font definitions. This approach allows for:
|
|
258
355
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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
|
-
|
|
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
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
501
|
-
|
|
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
|
-
|
|
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
|
-
@
|
|
516
|
-
|
|
517
|
-
font-weight: 500;
|
|
518
|
-
font-style: italic;
|
|
519
|
-
src: url('./assets/fonts/Poppins-MediumItalic.ttf');
|
|
520
|
-
}
|
|
467
|
+
@source '../src';
|
|
468
|
+
```
|
|
521
469
|
|
|
522
|
-
|
|
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
|
-
|
|
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
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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
|
-
@
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
556
|
-
|
|
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
|
-
###
|
|
515
|
+
### 4. Add Theme Names to Translations
|
|
563
516
|
|
|
564
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
|
|
612
|
-
|
|
613
|
-
## Adding Custom Languages
|
|
614
|
-
|
|
615
|
-
To add additional languages to your application:
|
|
579
|
+
Your themes are now fully configured. The ThemeService automatically:
|
|
616
580
|
|
|
617
|
-
|
|
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'`
|
|
618
586
|
|
|
619
|
-
|
|
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
|
-
```
|
|
631
|
-
|
|
632
|
-
### 2. Add Language to Service Configuration
|
|
633
|
-
|
|
634
|
-
Include your custom languages in the translation service configuration:
|
|
587
|
+
## Adding Custom Languages
|
|
635
588
|
|
|
636
|
-
|
|
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
|
-
```
|
|
589
|
+
Languages are now managed through a runtime configuration file (`translation.json`), eliminating the need to reconfigure and recompile. This approach allows for:
|
|
645
590
|
|
|
646
|
-
|
|
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
|
|
647
595
|
|
|
648
|
-
|
|
596
|
+
### 1. Create or Update `translation.json`
|
|
649
597
|
|
|
650
|
-
|
|
598
|
+
Create `/assets/translation/translation.json` in your application:
|
|
651
599
|
|
|
652
600
|
```json
|
|
653
601
|
{
|
|
654
|
-
"
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
"pt": "Portuguese",
|
|
660
|
-
"de": "German",
|
|
661
|
-
"fr": "French"
|
|
662
|
-
}
|
|
663
|
-
}
|
|
602
|
+
"defaultLanguage": "es",
|
|
603
|
+
"translationPaths": {
|
|
604
|
+
"en": "/assets/i18n/en.json",
|
|
605
|
+
"es": "/assets/i18n/es.json",
|
|
606
|
+
"pt": "/assets/i18n/pt.json"
|
|
664
607
|
}
|
|
665
608
|
}
|
|
666
609
|
```
|
|
667
610
|
|
|
668
|
-
**
|
|
611
|
+
**Configuration Structure:**
|
|
669
612
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
"language": {
|
|
674
|
-
"languages": {
|
|
675
|
-
"en": "Englisch",
|
|
676
|
-
"es": "Spanisch",
|
|
677
|
-
"pt": "Portugiesisch",
|
|
678
|
-
"de": "Deutsch",
|
|
679
|
-
"fr": "Französisch"
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
```
|
|
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
|
|
685
616
|
|
|
686
|
-
|
|
617
|
+
### 2. Create Translation Files
|
|
687
618
|
|
|
688
|
-
|
|
619
|
+
Create language translation files at the paths defined in `translation.json`. The minimal translation structure includes SDK translations:
|
|
689
620
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
```
|
|
693
|
-
src/
|
|
694
|
-
assets/
|
|
695
|
-
i18n/
|
|
696
|
-
en.json
|
|
697
|
-
es.json
|
|
698
|
-
pt.json
|
|
699
|
-
de.json // if using additional languages
|
|
700
|
-
```
|
|
701
|
-
|
|
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",
|
|
@@ -787,6 +689,7 @@ src/
|
|
|
787
689
|
},
|
|
788
690
|
"table": {
|
|
789
691
|
"entriesByPage": "Entries per page",
|
|
692
|
+
"perPage": "{{count}} / page",
|
|
790
693
|
"totalEntries": "{{total}} entries",
|
|
791
694
|
"entriesRange": "{{range}} of {{total}} entries",
|
|
792
695
|
"emptyListMessage": "No items to show"
|
|
@@ -823,39 +726,31 @@ src/
|
|
|
823
726
|
"datePicker": {
|
|
824
727
|
"quickActions": {
|
|
825
728
|
"title": "Quick Select",
|
|
729
|
+
"lastHour": "Last hour",
|
|
730
|
+
"last3Hours": "Last 3 hours",
|
|
731
|
+
"last6Hours": "Last 6 hours",
|
|
732
|
+
"last12Hours": "Last 12 hours",
|
|
733
|
+
"last24Hours": "Last 24 hours",
|
|
826
734
|
"last7Days": "Last 7 days",
|
|
827
735
|
"last30Days": "Last 30 days",
|
|
828
736
|
"last6Months": "Last 6 months",
|
|
829
737
|
"lastYear": "Last year",
|
|
830
738
|
"clear": "Clear"
|
|
739
|
+
},
|
|
740
|
+
"labels": {
|
|
741
|
+
"from": "From",
|
|
742
|
+
"to": "To"
|
|
831
743
|
}
|
|
832
744
|
}
|
|
833
745
|
}
|
|
834
746
|
}
|
|
835
747
|
```
|
|
836
748
|
|
|
837
|
-
|
|
749
|
+
**Spanish (`/assets/i18n/es.json`):**
|
|
838
750
|
|
|
839
751
|
```json
|
|
840
752
|
{
|
|
841
753
|
"sdk": {
|
|
842
|
-
"theme": {
|
|
843
|
-
"themes": {
|
|
844
|
-
"sixbell_telco": "Sixbell telco"
|
|
845
|
-
},
|
|
846
|
-
"schemes": {
|
|
847
|
-
"system": "Sistema",
|
|
848
|
-
"light": "Claro",
|
|
849
|
-
"dark": "Oscuro"
|
|
850
|
-
}
|
|
851
|
-
},
|
|
852
|
-
"language": {
|
|
853
|
-
"languages": {
|
|
854
|
-
"en": "Inglés",
|
|
855
|
-
"es": "Español",
|
|
856
|
-
"pt": "Portugués"
|
|
857
|
-
}
|
|
858
|
-
},
|
|
859
754
|
"fileUpload": {
|
|
860
755
|
"dropzone": {
|
|
861
756
|
"selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
|
|
@@ -922,6 +817,7 @@ src/
|
|
|
922
817
|
},
|
|
923
818
|
"table": {
|
|
924
819
|
"entriesByPage": "Entradas por página",
|
|
820
|
+
"perPage": "{{count}} / página",
|
|
925
821
|
"totalEntries": "{{total}} entradas",
|
|
926
822
|
"entriesRange": "{{range}} de {{total}} entradas",
|
|
927
823
|
"emptyListMessage": "No hay elementos para mostrar"
|
|
@@ -958,39 +854,31 @@ src/
|
|
|
958
854
|
"datePicker": {
|
|
959
855
|
"quickActions": {
|
|
960
856
|
"title": "Selección Rápida",
|
|
857
|
+
"lastHour": "Última hora",
|
|
858
|
+
"last3Hours": "Últimas 3 horas",
|
|
859
|
+
"last6Hours": "Últimas 6 horas",
|
|
860
|
+
"last12Hours": "Últimas 12 horas",
|
|
861
|
+
"last24Hours": "Últimas 24 horas",
|
|
961
862
|
"last7Days": "Últimos 7 días",
|
|
962
863
|
"last30Days": "Últimos 30 días",
|
|
963
864
|
"last6Months": "Últimos 6 meses",
|
|
964
865
|
"lastYear": "Último año",
|
|
965
866
|
"clear": "Limpiar"
|
|
867
|
+
},
|
|
868
|
+
"labels": {
|
|
869
|
+
"from": "Desde",
|
|
870
|
+
"to": "Hasta"
|
|
966
871
|
}
|
|
967
872
|
}
|
|
968
873
|
}
|
|
969
874
|
}
|
|
970
875
|
```
|
|
971
876
|
|
|
972
|
-
|
|
877
|
+
**Portuguese (`/assets/i18n/pt.json`):**
|
|
973
878
|
|
|
974
879
|
```json
|
|
975
880
|
{
|
|
976
881
|
"sdk": {
|
|
977
|
-
"theme": {
|
|
978
|
-
"themes": {
|
|
979
|
-
"sixbell_telco": "Sixbell telco"
|
|
980
|
-
},
|
|
981
|
-
"schemes": {
|
|
982
|
-
"system": "Sistema",
|
|
983
|
-
"light": "Claro",
|
|
984
|
-
"dark": "Escuro"
|
|
985
|
-
}
|
|
986
|
-
},
|
|
987
|
-
"language": {
|
|
988
|
-
"languages": {
|
|
989
|
-
"en": "Inglês",
|
|
990
|
-
"es": "Espanhol",
|
|
991
|
-
"pt": "Português"
|
|
992
|
-
}
|
|
993
|
-
},
|
|
994
882
|
"fileUpload": {
|
|
995
883
|
"dropzone": {
|
|
996
884
|
"selectPrompt": "Haz clic para seleccionar archivos o arrastra y suelta aquí",
|
|
@@ -1057,6 +945,7 @@ src/
|
|
|
1057
945
|
},
|
|
1058
946
|
"table": {
|
|
1059
947
|
"entriesByPage": "Entradas por página",
|
|
948
|
+
"perPage": "{{count}} / página",
|
|
1060
949
|
"totalEntries": "{{total}} entradas",
|
|
1061
950
|
"entriesRange": "{{range}} de {{total}} entradas",
|
|
1062
951
|
"emptyListMessage": "Nenhum item para mostrar"
|
|
@@ -1093,17 +982,93 @@ src/
|
|
|
1093
982
|
"datePicker": {
|
|
1094
983
|
"quickActions": {
|
|
1095
984
|
"title": "Seleção Rápida",
|
|
985
|
+
"lastHour": "Última hora",
|
|
986
|
+
"last3Hours": "Últimas 3 horas",
|
|
987
|
+
"last6Hours": "Últimas 6 horas",
|
|
988
|
+
"last12Hours": "Últimas 12 horas",
|
|
989
|
+
"last24Hours": "Últimas 24 horas",
|
|
1096
990
|
"last7Days": "Últimos 7 dias",
|
|
1097
991
|
"last30Days": "Últimos 30 dias",
|
|
1098
992
|
"last6Months": "Últimos 6 meses",
|
|
1099
993
|
"lastYear": "Último ano",
|
|
1100
994
|
"clear": "Limpar"
|
|
995
|
+
},
|
|
996
|
+
"labels": {
|
|
997
|
+
"from": "De",
|
|
998
|
+
"to": "Até"
|
|
1101
999
|
}
|
|
1102
1000
|
}
|
|
1103
1001
|
}
|
|
1104
1002
|
}
|
|
1105
1003
|
```
|
|
1106
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
|
+
|
|
1107
1072
|
## Usage Examples
|
|
1108
1073
|
|
|
1109
1074
|
### Using Components
|
|
@@ -1177,4 +1142,4 @@ For detailed component documentation, visit our [Storybook](https://storybook.js
|
|
|
1177
1142
|
|
|
1178
1143
|
## Last update
|
|
1179
1144
|
|
|
1180
|
-
This file was last updated on
|
|
1145
|
+
This file was last updated on November 4th, 2025.
|