@sixbell-telco/sdk 1.0.3 → 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.
- package/CHANGELOG.md +102 -0
- package/README.md +641 -163
- package/_index.css +85 -28
- package/components/avatar/src/avatar.component.d.ts +40 -26
- package/components/badge/src/badge.component.d.ts +0 -4
- package/components/button/src/button.component.d.ts +2 -2
- package/components/dialog/dialog-actions/dialog-actions.component.d.ts +8 -0
- package/components/dialog/dialog-content/dialog-content.component.d.ts +5 -0
- package/components/dialog/dialog-sub-title/dialog-sub-title.component.d.ts +5 -0
- package/components/dialog/dialog-title/dialog-title.component.d.ts +5 -0
- package/components/dialog/index.d.ts +5 -0
- package/components/dialog/public-api.d.ts +5 -0
- package/components/dialog/src/dialog.component.d.ts +132 -0
- package/components/dropdown/dropdown-chevron/dropdown-chevron.component.d.ts +39 -0
- package/components/dropdown/dropdown-content/dropdown-content.component.d.ts +41 -0
- package/components/dropdown/dropdown-group/dropdown-group.component.d.ts +9 -0
- package/components/dropdown/dropdown-item/dropdown-item.component.d.ts +23 -12
- package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +49 -0
- package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +53 -0
- package/components/dropdown/dropdown-label/dropdown-label.component.d.ts +17 -0
- package/components/dropdown/dropdown-separator/dropdown-separator.component.d.ts +21 -0
- package/components/dropdown/dropdown-trigger/dropdown-trigger.component.d.ts +121 -0
- package/components/dropdown/public-api.d.ts +9 -0
- package/components/dropdown/src/dropdown.component.d.ts +20 -174
- package/components/dropdown/src/services/dropdown.service.d.ts +22 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar/dropdown-menu-bar.component.d.ts +22 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-content/dropdown-menu-bar-content.component.d.ts +64 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-item/dropdown-menu-bar-item.component.d.ts +37 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-checkbox/dropdown-menu-bar-item-checkbox.component.d.ts +54 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-radio/dropdown-menu-bar-item-radio.component.d.ts +58 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-label/dropdown-menu-bar-label.component.d.ts +16 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-separator/dropdown-menu-bar-separator.component.d.ts +16 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-sub-trigger/dropdown-menu-bar-sub-trigger.component.d.ts +29 -0
- package/components/dropdown-menu/bar/dropdown-menu-bar-trigger/dropdown-menu-bar-trigger.component.d.ts +50 -0
- package/components/dropdown-menu/bar/index.d.ts +5 -0
- package/components/dropdown-menu/bar/public-api.d.ts +9 -0
- package/components/dropdown-menu/context/dropdown-context-menu-trigger/dropdown-context-menu-trigger.component.d.ts +23 -0
- package/components/dropdown-menu/context/index.d.ts +5 -0
- package/components/dropdown-menu/context/public-api.d.ts +1 -0
- package/components/dropdown-menu/dropdown-menu-chevron/dropdown-menu-chevron.component.d.ts +43 -0
- package/components/dropdown-menu/index.d.ts +5 -0
- package/components/dropdown-menu/public-api.d.ts +13 -0
- package/components/dropdown-menu/src/directives/dropdown-menu.directive.d.ts +40 -0
- package/components/dropdown-menu/src/dropdown-menu/dropdown-menu.component.d.ts +9 -0
- package/components/dropdown-menu/src/dropdown-menu-content/dropdown-menu-content.component.d.ts +40 -0
- package/components/dropdown-menu/src/dropdown-menu-group/dropdown-menu-group.component.d.ts +8 -0
- package/components/dropdown-menu/src/dropdown-menu-item/dropdown-menu-item.component.d.ts +38 -0
- package/components/dropdown-menu/src/dropdown-menu-label/dropdown-menu-label.component.d.ts +16 -0
- package/components/dropdown-menu/src/dropdown-menu-separator/dropdown-menu-separator.component.d.ts +16 -0
- package/components/dropdown-menu/src/dropdown-menu-sub/dropdown-menu-sub.component.d.ts +8 -0
- package/components/dropdown-menu/src/dropdown-menu-sub-content/dropdown-menu-sub-content.component.d.ts +31 -0
- package/components/dropdown-menu/src/dropdown-menu-sub-trigger/dropdown-menu-sub-trigger.component.d.ts +18 -0
- package/components/dropdown-menu/src/dropdown-menu-trigger/dropdown-menu-trigger.component.d.ts +19 -0
- package/components/dropdown-menu/src/services/dropdown-menu.service.d.ts +22 -0
- package/directives/auto-focus/src/autofocus.directive.d.ts +3 -3
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +75 -39
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs +1 -1
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-button.mjs +1 -0
- package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +305 -0
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +529 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs +52 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs +539 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +592 -213
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +5 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +295 -0
- package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +332 -0
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -0
- package/package.json +29 -9
- package/sixbell-telco-sdk-1.2.0.tgz +0 -0
- package/utils/theme/README.md +185 -0
- package/{components/modal → utils/theme}/index.d.ts +1 -1
- package/utils/theme/public-api.d.ts +1 -0
- package/utils/theme/src/theme.service.d.ts +206 -0
- package/utils/translation/README.md +274 -0
- package/utils/translation/index.d.ts +5 -0
- package/utils/translation/public-api.d.ts +5 -0
- package/utils/translation/src/translation.service.d.ts +197 -0
- package/components/modal/modal-actions/modal-actions.component.d.ts +0 -8
- package/components/modal/modal-content/modal-content.component.d.ts +0 -5
- package/components/modal/modal-title/modal-title.component.d.ts +0 -5
- package/components/modal/public-api.d.ts +0 -4
- package/components/modal/src/modal.component.d.ts +0 -102
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs +0 -202
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +0 -1
- package/sixbell-telco-sdk-1.0.3.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-utils-translation.mjs","sources":["../../../projects/sdk/utils/translation/src/translation.service.ts","../../../projects/sdk/utils/translation/public-api.ts","../../../projects/sdk/utils/translation/sixbell-telco-sdk-utils-translation.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { HttpBackend, HttpClient } from '@angular/common/http';\nimport { EnvironmentProviders, Inject, inject, Injectable, InjectionToken, Optional, provideAppInitializer, Provider } from '@angular/core';\nimport {\n\tMissingTranslationHandler,\n\tMissingTranslationHandlerParams,\n\tprovideTranslateService,\n\tTranslateLoader,\n\tTranslateService,\n} from '@ngx-translate/core';\nimport { TranslateHttpLoader } from '@ngx-translate/http-loader';\nimport { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';\n\n/**\n * Language definition interface\n */\nexport interface LanguageDefinition {\n\t/** Language code (ISO 639-1 format recommended) */\n\tcode: string;\n\t/** Display name for the language */\n\tname: string;\n}\n\n/**\n * Helper function to create a language definition with full type safety and IntelliSense\n */\nexport function createLanguage(config: LanguageDefinition): LanguageDefinition {\n\treturn {\n\t\tcode: config.code,\n\t\tname: config.name,\n\t};\n}\n\n// Default base languages - always available\nexport const DEFAULT_LANGUAGES: readonly LanguageDefinition[] = [\n\t{ code: 'en', name: 'English' },\n\t{ code: 'es', name: 'Español' },\n\t{ code: 'pt', name: 'Português' },\n] as const;\n\nexport const DEFAULT_LANGUAGE_CODE = 'en';\n\n// Export language codes for IntelliSense\nexport const DEFAULT_LANGUAGE_CODES = ['en', 'es', 'pt'] as const;\nexport type DefaultLanguageCode = (typeof DEFAULT_LANGUAGE_CODES)[number];\n\n// Helper type to extract language codes from LanguageDefinition arrays\ntype ExtractLanguageCode<T> = T extends readonly (infer U)[] ? (U extends LanguageDefinition ? U['code'] : never) : never;\n\n// Custom missing translation handler to show keys instead of falling back to default language\nexport class PlaceholderMissingTranslationHandler implements MissingTranslationHandler {\n\thandle(params: MissingTranslationHandlerParams): string {\n\t\t// Return the translation key as placeholder to make missing translations visible\n\t\treturn params.key;\n\t}\n}\n\n/**\n * Main translation configuration interface\n */\nexport interface TranslationConfig {\n\t/**\n\t * Additional languages to make available beyond the default base languages (en, es, pt)\n\t * When you add languages here, they become available in defaultLang and excludeLanguages\n\t * @example [{ code: 'de', name: 'Deutsch' }, { code: 'fr', name: 'Français' }]\n\t */\n\tadditionalLanguages?: readonly LanguageDefinition[];\n\t/**\n\t * Languages to exclude from the available set\n\t * IntelliSense includes: base languages (en, es, pt) + any additionalLanguages you specified above\n\t * @example ['pt'] to exclude Portuguese\n\t */\n\texcludeLanguages?: readonly string[];\n\t/**\n\t * Default language code\n\t * IntelliSense includes: base languages (en, es, pt) + any additionalLanguages you specified above\n\t * @example 'en'\n\t */\n\tdefaultLang?: string;\n\t/** Translation file paths */\n\ttranslationPaths?: string[];\n}\n\n// Injection tokens for dependency injection\nexport const TRANSLATION_CONFIG_TOKEN = new InjectionToken<TranslationConfig>('Translation Configuration');\n\nconst LOCALIZATION_LOCAL_STORAGE_KEY = 'language';\n\n/**\n * Factory function to create HTTP loader for translations with custom paths\n */\nexport function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {\n\treturn new TranslateHttpLoader(http, './assets/i18n/', '.json');\n}\n\n/**\n * Factory function to create multi-path HTTP loader for translations\n */\nexport function MultiPathHttpLoaderFactory(httpBackend: HttpBackend, paths: string[]): MultiTranslateHttpLoader {\n\treturn new MultiTranslateHttpLoader(httpBackend, paths);\n}\n\n/**\n * Utility function to extend default languages with additional ones\n */\nexport function extendDefaultLanguages(additionalLanguages: LanguageDefinition[]): LanguageDefinition[] {\n\treturn [...DEFAULT_LANGUAGES, ...additionalLanguages];\n}\n\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class TranslationService {\n\tprivate readonly translate = inject(TranslateService);\n\tprivate readonly document = inject(DOCUMENT);\n\tprivate initialized = false;\n\n\t// Default configuration - can be overridden by provider\n\tprivate config: {\n\t\tavailableLanguages: LanguageDefinition[];\n\t\tdefaultLang: string;\n\t\ttranslationPaths: string[];\n\t} = {\n\t\tavailableLanguages: [...DEFAULT_LANGUAGES],\n\t\tdefaultLang: DEFAULT_LANGUAGE_CODE,\n\t\ttranslationPaths: ['/assets/i18n/'],\n\t};\n\n\tconstructor(@Optional() @Inject(TRANSLATION_CONFIG_TOKEN) private readonly translationConfig?: TranslationConfig) {\n\t\t// Configure with provided config or defaults\n\t\tif (translationConfig) {\n\t\t\tthis.configure(translationConfig);\n\t\t} else {\n\t\t\t// Initialize with defaults immediately\n\t\t\tthis.initializeFromStorage();\n\t\t\tthis.applyLanguage();\n\t\t\tthis.initialized = true;\n\t\t}\n\t}\n\n\t/**\n\t * Configure and initialize the translation service (used by provider)\n\t */\n\tpublic configure(config: TranslationConfig = {}): void {\n\t\t// Start with default base languages (en, es, pt)\n\t\tlet availableLanguages = [...DEFAULT_LANGUAGES];\n\n\t\t// Handle additional languages\n\t\tif (config.additionalLanguages) {\n\t\t\tavailableLanguages = [...DEFAULT_LANGUAGES, ...config.additionalLanguages];\n\t\t}\n\n\t\t// Apply language exclusions if specified\n\t\tif (config.excludeLanguages) {\n\t\t\tconst excludeCodes = config.excludeLanguages as string[];\n\t\t\tavailableLanguages = availableLanguages.filter((lang) => !excludeCodes.includes(lang.code));\n\t\t}\n\n\t\t// Determine default language\n\t\tconst defaultLang = config.defaultLang || DEFAULT_LANGUAGE_CODE;\n\n\t\t// Update configuration\n\t\tthis.config = {\n\t\t\tavailableLanguages,\n\t\t\tdefaultLang,\n\t\t\ttranslationPaths: config.translationPaths || this.config.translationPaths,\n\t\t};\n\n\t\t// Validate defaultLang is in available languages\n\t\tconst availableCodes = this.config.availableLanguages.map((lang) => lang.code);\n\t\tif (!availableCodes.includes(this.config.defaultLang)) {\n\t\t\tconsole.warn(\n\t\t\t\t`TranslationService: defaultLang '${this.config.defaultLang}' not in availableLanguages, using '${availableCodes[0] || DEFAULT_LANGUAGE_CODE}'`,\n\t\t\t);\n\t\t\tthis.config.defaultLang = availableCodes[0] || DEFAULT_LANGUAGE_CODE;\n\t\t}\n\n\t\t// If this is called after constructor (provider case), re-initialize with new config\n\t\tif (this.initialized) {\n\t\t\tthis.initializeFromStorage();\n\t\t} else {\n\t\t\tthis.initializeFromStorage();\n\t\t\tthis.initialized = true;\n\t\t}\n\t}\n\n\t/**\n\t * Initialize translation 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('TranslationService: Browser environment not available, using defaults');\n\t\t\tthis.applyLanguage();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Set up translate service with available languages\n\t\t\tthis.translate.setDefaultLang(this.config.defaultLang);\n\n\t\t\t// Load available translations\n\t\t\tconst languageCodes = this.config.availableLanguages.map((lang) => lang.code);\n\t\t\tthis.translate.addLangs(languageCodes);\n\n\t\t\t// Get current language from storage or use default\n\t\t\tconst savedLang = localStorage.getItem(LOCALIZATION_LOCAL_STORAGE_KEY);\n\t\t\tconst currentLang = savedLang && languageCodes.includes(savedLang) ? savedLang : this.config.defaultLang;\n\n\t\t\t// Apply language immediately\n\t\t\tthis.applyLanguage(currentLang);\n\t\t} catch (error) {\n\t\t\tconsole.error('TranslationService: Failed to initialize from storage:', error);\n\t\t\tthis.applyLanguage();\n\t\t}\n\t}\n\n\t/**\n\t * Apply the current language to the translate service and document\n\t */\n\tprivate applyLanguage(lang?: string): void {\n\t\tconst targetLang = lang || this.config.defaultLang;\n\n\t\t// Set the language in translate service\n\t\tthis.translate.use(targetLang);\n\n\t\t// Update HTML lang attribute for accessibility and SEO\n\t\tthis.document.documentElement.lang = targetLang;\n\n\t\t// Persist to localStorage\n\t\tif (typeof localStorage !== 'undefined') {\n\t\t\tlocalStorage.setItem(LOCALIZATION_LOCAL_STORAGE_KEY, targetLang);\n\t\t}\n\t}\n\n\t/**\n\t * Set the current language and persist to localStorage\n\t */\n\tsetLanguage(lang: string): void {\n\t\tif (lang) {\n\t\t\t// Validate language is available\n\t\t\tconst availableCodes = this.config.availableLanguages.map((l) => l.code);\n\t\t\tif (!availableCodes.includes(lang)) {\n\t\t\t\tconsole.warn(`TranslationService: Language '${lang}' not available, using default '${this.config.defaultLang}'`);\n\t\t\t\tlang = this.config.defaultLang;\n\t\t\t}\n\n\t\t\tthis.applyLanguage(lang);\n\t\t}\n\t}\n\n\t/**\n\t * Get the current language from localStorage or default\n\t */\n\tgetCurrentLanguage(): string {\n\t\tif (typeof localStorage === 'undefined') {\n\t\t\treturn this.config.defaultLang;\n\t\t}\n\n\t\tconst saved = localStorage.getItem(LOCALIZATION_LOCAL_STORAGE_KEY);\n\t\tconst availableCodes = this.config.availableLanguages.map((l) => l.code);\n\n\t\treturn saved && availableCodes.includes(saved) ? saved : this.config.defaultLang;\n\t}\n\n\t/**\n\t * Get the current HTML lang attribute\n\t */\n\tgetCurrentHtmlLanguage(): string {\n\t\treturn this.document.documentElement.lang || this.config.defaultLang;\n\t}\n\n\t/**\n\t * Get available languages\n\t */\n\tgetAvailableLanguages(): string[] {\n\t\treturn this.translate.getLangs();\n\t}\n\n\t/**\n\t * Get default language\n\t */\n\tgetDefaultLanguage(): string {\n\t\treturn this.config.defaultLang;\n\t}\n\n\t/**\n\t * Instantly translate a key with optional parameters\n\t */\n\tinstant(key: string, params?: object | undefined): string {\n\t\tif (params) {\n\t\t\treturn this.translate.instant(key, params);\n\t\t}\n\n\t\treturn this.translate.instant(key);\n\t}\n\n\t/**\n\t * Get observable translation for a key\n\t */\n\tget(key: string, params?: object | undefined) {\n\t\tif (params) {\n\t\t\treturn this.translate.get(key, params);\n\t\t}\n\n\t\treturn this.translate.get(key);\n\t}\n\n\t/**\n\t * Get stream of translations for a key\n\t */\n\tstream(key: string, params?: object | undefined) {\n\t\tif (params) {\n\t\t\treturn this.translate.stream(key, params);\n\t\t}\n\n\t\treturn this.translate.stream(key);\n\t}\n\n\t/**\n\t * Get available languages configuration\n\t */\n\tgetAvailableLanguagesConfig(): LanguageDefinition[] {\n\t\treturn this.config.availableLanguages;\n\t}\n\n\t/**\n\t * Get available language codes\n\t */\n\tgetAvailableLanguageCodes(): string[] {\n\t\treturn this.config.availableLanguages.map((lang) => lang.code);\n\t}\n\n\t/**\n\t * Get language configuration by code\n\t */\n\tgetLanguageByCode(code: string): LanguageDefinition | undefined {\n\t\treturn this.config.availableLanguages.find((lang) => lang.code === code);\n\t}\n\n\t/**\n\t * Get language display name by code\n\t */\n\tgetLanguageDisplayName(code: string): string {\n\t\tconst language = this.getLanguageByCode(code);\n\t\treturn language ? language.name : code.toUpperCase();\n\t}\n\n\t/**\n\t * Get localized language name by code using translations\n\t * This automatically returns the localized name based on the current language\n\t */\n\tgetLocalizedLanguageName(code: string): string {\n\t\tconst translationKey = `sdk.language.languages.${code}`;\n\t\tconst translatedName = this.translate.instant(translationKey);\n\n\t\tif (translatedName && translatedName !== translationKey) {\n\t\t\treturn translatedName;\n\t\t}\n\n\t\tconst language = this.getLanguageByCode(code);\n\t\treturn language ? language.name : code.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.getAvailableLanguagesConfig(); // Trigger any lazy initialization\n\t}\n}\n\n/**\n * Provider function for translation configuration in Angular applications\n * This provides the translation configuration through dependency injection\n *\n * @example\n * ```typescript\n * // Basic usage - only default languages available (en, es, pt)\n * provideTranslation({\n * defaultLang: 'es' // IntelliSense shows: 'en', 'es', 'pt'\n * }),\n *\n * // With additional languages - IntelliSense includes base + additional languages\n * provideTranslation({\n * additionalLanguages: [\n * { code: 'de', name: 'Deutsch' },\n * { code: 'fr', name: 'Français' }\n * ] as const,\n * defaultLang: 'de', // IntelliSense shows: 'en', 'es', 'pt', 'de', 'fr'\n * excludeLanguages: ['pt'] as const // IntelliSense shows: 'en', 'es', 'pt', 'de', 'fr'\n * })\n * ```\n */\n\n// Overload 1: No config provided - use all defaults\nexport function provideTranslation(): (Provider | EnvironmentProviders)[];\n\n// Overload 2: Config without additionalLanguages - provides IntelliSense for base languages only\nexport function provideTranslation(config: {\n\t/**\n\t * Default language code (from base languages: en, es, pt)\n\t */\n\tdefaultLang?: DefaultLanguageCode;\n\t/**\n\t * Languages to exclude from the default base languages (en, es, pt)\n\t */\n\texcludeLanguages?: readonly DefaultLanguageCode[];\n\t/** Translation file paths */\n\ttranslationPaths?: string[];\n\tadditionalLanguages?: never;\n}): (Provider | EnvironmentProviders)[];\n\n// Overload 3: Config with additionalLanguages - provides IntelliSense for base + additional languages\nexport function provideTranslation<const T extends readonly LanguageDefinition[]>(config: {\n\t/**\n\t * Additional languages to make available beyond the default base languages (en, es, pt)\n\t */\n\tadditionalLanguages: T;\n\t/**\n\t * Default language code (includes both base and additional languages)\n\t */\n\tdefaultLang?: DefaultLanguageCode | ExtractLanguageCode<T>;\n\t/**\n\t * Languages to exclude from the available set (includes both base and additional languages)\n\t */\n\texcludeLanguages?: readonly (DefaultLanguageCode | ExtractLanguageCode<T>)[];\n\t/** Translation file paths */\n\ttranslationPaths?: string[];\n}): (Provider | EnvironmentProviders)[];\n\n// Implementation\nexport function provideTranslation(config?: TranslationConfig): (Provider | EnvironmentProviders)[] {\n\t// Determine which loader to use based on configuration\n\tconst loaderProvider =\n\t\tconfig?.translationPaths && config.translationPaths.length > 0\n\t\t\t? {\n\t\t\t\t\tprovide: TranslateLoader,\n\t\t\t\t\tuseFactory: (httpBackend: HttpBackend) => MultiPathHttpLoaderFactory(httpBackend, config.translationPaths!),\n\t\t\t\t\tdeps: [HttpBackend],\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tprovide: TranslateLoader,\n\t\t\t\t\tuseFactory: HttpLoaderFactory,\n\t\t\t\t\tdeps: [HttpClient],\n\t\t\t\t};\n\n\treturn [\n\t\t// Provide the complete ngx-translate setup with appropriate loader and missing translation handler\n\t\tprovideTranslateService({\n\t\t\tloader: loaderProvider,\n\t\t\tmissingTranslationHandler: {\n\t\t\t\tprovide: MissingTranslationHandler,\n\t\t\t\tuseClass: PlaceholderMissingTranslationHandler,\n\t\t\t},\n\t\t\tuseDefaultLang: false, // Don't fall back to default language, use missing translation handler instead\n\t\t}),\n\t\t// Provide our translation configuration\n\t\t{\n\t\t\tprovide: TRANSLATION_CONFIG_TOKEN,\n\t\t\tuseValue: config || {},\n\t\t},\n\t\t// Automatically initialize translation service for MFE compatibility\n\t\tprovideAppInitializer(() => inject(TranslationService).init()),\n\t];\n}\n","// Export our translation service and types\nexport * from './src/translation.service';\n\n// Re-export useful ngx-translate components and services for convenience\nexport {\n\tDefaultLangChangeEvent,\n\tFakeMissingTranslationHandler,\n\tLangChangeEvent,\n\tMissingTranslationHandler,\n\tTranslateCompiler,\n\tTranslateDefaultParser,\n\tTranslateDirective,\n\tTranslateFakeCompiler,\n\tTranslateLoader,\n\tTranslateModule,\n\tTranslateParser,\n\tTranslatePipe,\n\tTranslateService,\n\tTranslateStore,\n\tTranslationChangeEvent,\n\tprovideTranslateService,\n} from '@ngx-translate/core';\n\n// Re-export the HTTP loader for advanced use cases\nexport { TranslateHttpLoader } from '@ngx-translate/http-loader';\n\n// Re-export MultiTranslateHttpLoader for multi-path scenarios\nexport { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';\n\n// Re-export HttpBackend for custom loader factories\nexport { HttpBackend } from '@angular/common/http';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAuBA;;AAEG;AACG,SAAU,cAAc,CAAC,MAA0B,EAAA;IACxD,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;KACjB;AACF;AAEA;AACa,MAAA,iBAAiB,GAAkC;AAC/D,IAAA,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;AAC/B,IAAA,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;AAC/B,IAAA,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE;;AAG3B,MAAM,qBAAqB,GAAG;AAErC;AACa,MAAA,sBAAsB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI;AAMvD;MACa,oCAAoC,CAAA;AAChD,IAAA,MAAM,CAAC,MAAuC,EAAA;;QAE7C,OAAO,MAAM,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UAAU,EAAE,CAAC,WAAwB,KAAK,0BAA0B,CAAC,WAAW,EAAE,MAAM,CAAC,gBAAiB,CAAC;YAC3G,IAAI,EAAE,CAAC,WAAW,CAAC;AACnB;AACF,UAAE;AACA,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE,CAAC,UAAU,CAAC;SAClB;IAEJ,OAAO;;AAEN,QAAA,uBAAuB,CAAC;AACvB,YAAA,MAAM,EAAE,cAAc;AACtB,YAAA,yBAAyB,EAAE;AAC1B,gBAAA,OAAO,EAAE,yBAAyB;AAClC,gBAAA,QAAQ,EAAE,oCAAoC;AAC9C,aAAA;YACD,cAAc,EAAE,KAAK;SACrB,CAAC;;AAEF,QAAA;AACC,YAAA,OAAO,EAAE,wBAAwB;YACjC,QAAQ,EAAE,MAAM,IAAI,EAAE;AACtB,SAAA;;QAED,qBAAqB,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC;KAC9D;AACF;;ACldA;;ACAA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixbell-telco/sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A collection of reusable components designed for use in Sixbell Telco Angular projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixbell",
|
|
@@ -74,10 +74,18 @@
|
|
|
74
74
|
"types": "./components/countdown/index.d.ts",
|
|
75
75
|
"default": "./fesm2022/sixbell-telco-sdk-components-countdown.mjs"
|
|
76
76
|
},
|
|
77
|
+
"./components/dialog": {
|
|
78
|
+
"types": "./components/dialog/index.d.ts",
|
|
79
|
+
"default": "./fesm2022/sixbell-telco-sdk-components-dialog.mjs"
|
|
80
|
+
},
|
|
77
81
|
"./components/dropdown": {
|
|
78
82
|
"types": "./components/dropdown/index.d.ts",
|
|
79
83
|
"default": "./fesm2022/sixbell-telco-sdk-components-dropdown.mjs"
|
|
80
84
|
},
|
|
85
|
+
"./components/dropdown-menu": {
|
|
86
|
+
"types": "./components/dropdown-menu/index.d.ts",
|
|
87
|
+
"default": "./fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs"
|
|
88
|
+
},
|
|
81
89
|
"./components/dual-list": {
|
|
82
90
|
"types": "./components/dual-list/index.d.ts",
|
|
83
91
|
"default": "./fesm2022/sixbell-telco-sdk-components-dual-list.mjs"
|
|
@@ -94,10 +102,6 @@
|
|
|
94
102
|
"types": "./components/link/index.d.ts",
|
|
95
103
|
"default": "./fesm2022/sixbell-telco-sdk-components-link.mjs"
|
|
96
104
|
},
|
|
97
|
-
"./components/modal": {
|
|
98
|
-
"types": "./components/modal/index.d.ts",
|
|
99
|
-
"default": "./fesm2022/sixbell-telco-sdk-components-modal.mjs"
|
|
100
|
-
},
|
|
101
105
|
"./components/notification": {
|
|
102
106
|
"types": "./components/notification/index.d.ts",
|
|
103
107
|
"default": "./fesm2022/sixbell-telco-sdk-components-notification.mjs"
|
|
@@ -138,6 +142,22 @@
|
|
|
138
142
|
"types": "./utils/cn/index.d.ts",
|
|
139
143
|
"default": "./fesm2022/sixbell-telco-sdk-utils-cn.mjs"
|
|
140
144
|
},
|
|
145
|
+
"./utils/theme": {
|
|
146
|
+
"types": "./utils/theme/index.d.ts",
|
|
147
|
+
"default": "./fesm2022/sixbell-telco-sdk-utils-theme.mjs"
|
|
148
|
+
},
|
|
149
|
+
"./utils/translation": {
|
|
150
|
+
"types": "./utils/translation/index.d.ts",
|
|
151
|
+
"default": "./fesm2022/sixbell-telco-sdk-utils-translation.mjs"
|
|
152
|
+
},
|
|
153
|
+
"./components/dropdown-menu/context": {
|
|
154
|
+
"types": "./components/dropdown-menu/context/index.d.ts",
|
|
155
|
+
"default": "./fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs"
|
|
156
|
+
},
|
|
157
|
+
"./components/dropdown-menu/bar": {
|
|
158
|
+
"types": "./components/dropdown-menu/bar/index.d.ts",
|
|
159
|
+
"default": "./fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs"
|
|
160
|
+
},
|
|
141
161
|
"./components/forms/checkbox": {
|
|
142
162
|
"types": "./components/forms/checkbox/index.d.ts",
|
|
143
163
|
"default": "./fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs"
|
|
@@ -190,14 +210,14 @@
|
|
|
190
210
|
"types": "./utils/generators/uuid/index.d.ts",
|
|
191
211
|
"default": "./fesm2022/sixbell-telco-sdk-utils-generators-uuid.mjs"
|
|
192
212
|
},
|
|
193
|
-
"./utils/pipes/extract-extension": {
|
|
194
|
-
"types": "./utils/pipes/extract-extension/index.d.ts",
|
|
195
|
-
"default": "./fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs"
|
|
196
|
-
},
|
|
197
213
|
"./utils/pipes/time": {
|
|
198
214
|
"types": "./utils/pipes/time/index.d.ts",
|
|
199
215
|
"default": "./fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs"
|
|
200
216
|
},
|
|
217
|
+
"./utils/pipes/extract-extension": {
|
|
218
|
+
"types": "./utils/pipes/extract-extension/index.d.ts",
|
|
219
|
+
"default": "./fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs"
|
|
220
|
+
},
|
|
201
221
|
"./utils/pipes/to-bytes-extesion": {
|
|
202
222
|
"types": "./utils/pipes/to-bytes-extesion/index.d.ts",
|
|
203
223
|
"default": "./fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs"
|
|
Binary file
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Theme Service
|
|
2
|
+
|
|
3
|
+
A modern Angular service for theme management with reactive signals and TypeScript IntelliSense support.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
The Theme Service provides:
|
|
8
|
+
|
|
9
|
+
- **Reactive theme management** using Angular signals
|
|
10
|
+
- **TypeScript IntelliSense** for theme codes and color schemes
|
|
11
|
+
- **Automatic persistence** to localStorage
|
|
12
|
+
- **System theme detection** for light/dark preferences
|
|
13
|
+
- **Provider-based setup** for Angular applications
|
|
14
|
+
|
|
15
|
+
## How to use
|
|
16
|
+
|
|
17
|
+
### Basic setup
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// app.config.ts
|
|
21
|
+
import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
|
|
22
|
+
|
|
23
|
+
export const appConfig: ApplicationConfig = {
|
|
24
|
+
providers: [
|
|
25
|
+
provideTheme({
|
|
26
|
+
defaultScheme: 'system',
|
|
27
|
+
defaultTheme: 'sixbell_telco', // IntelliSense: 'sixbell_telco'
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### With additional themes
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
// app.config.ts
|
|
37
|
+
import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
|
|
38
|
+
|
|
39
|
+
export const appConfig: ApplicationConfig = {
|
|
40
|
+
providers: [
|
|
41
|
+
provideTheme({
|
|
42
|
+
additionalThemes: ['custom', 'dark_mode'],
|
|
43
|
+
defaultTheme: 'custom', // IntelliSense: 'sixbell_telco' | 'custom' | 'dark_mode'
|
|
44
|
+
excludeThemes: ['sixbell_telco'], // IntelliSense: all available themes
|
|
45
|
+
defaultScheme: 'dark',
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Using in components
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// component.ts
|
|
55
|
+
import { ThemeService } from '@sixbell-telco/sdk/utils/theme';
|
|
56
|
+
|
|
57
|
+
@Component({
|
|
58
|
+
template: `
|
|
59
|
+
<div [class]="theme.finalTheme()">
|
|
60
|
+
<p>Current theme: {{ theme.selectedTheme() }}</p>
|
|
61
|
+
<p>Dark mode: {{ theme.isDarkTheme() ? 'Yes' : 'No' }}</p>
|
|
62
|
+
</div>
|
|
63
|
+
`,
|
|
64
|
+
})
|
|
65
|
+
export class MyComponent {
|
|
66
|
+
theme = inject(ThemeService);
|
|
67
|
+
|
|
68
|
+
changeTheme(themeName: string) {
|
|
69
|
+
this.theme.setTheme(themeName);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
toggleScheme() {
|
|
73
|
+
const current = this.theme.selectedScheme();
|
|
74
|
+
this.theme.setScheme(current === 'dark' ? 'light' : 'dark');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Reactive themes in templates
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- Conditional rendering based on theme -->
|
|
83
|
+
<div [class]="theme.finalTheme()">Content with reactive theme classes</div>
|
|
84
|
+
|
|
85
|
+
<!-- Dark mode specific content -->
|
|
86
|
+
@if (theme.isDarkTheme()) {
|
|
87
|
+
<p>Dark mode is active</p>
|
|
88
|
+
} @else {
|
|
89
|
+
<p>Light mode is active</p>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
<!-- Theme selector -->
|
|
93
|
+
<select (change)="changeTheme($event.target.value)">
|
|
94
|
+
@for (themeName of theme.getAvailableThemes(); track themeName) {
|
|
95
|
+
<option [value]="themeName">{{ themeName }}</option>
|
|
96
|
+
}
|
|
97
|
+
</select>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Key features
|
|
101
|
+
|
|
102
|
+
- **Signal-based reactivity** - Modern Angular reactive patterns
|
|
103
|
+
- **IntelliSense support** - Full TypeScript autocomplete for theme codes
|
|
104
|
+
- **System theme detection** - Automatic light/dark mode based on OS preference
|
|
105
|
+
- **Flexible configuration** - Add themes, exclude unwanted ones
|
|
106
|
+
- **Provider pattern** - Clean Angular dependency injection setup
|
|
107
|
+
- **Automatic persistence** - Saves user preferences to localStorage
|
|
108
|
+
|
|
109
|
+
## Default theme
|
|
110
|
+
|
|
111
|
+
- `sixbell_telco` - Always available unless excluded
|
|
112
|
+
|
|
113
|
+
You can add more themes using `additionalThemes` or exclude the default one using `excludeThemes`.
|
|
114
|
+
|
|
115
|
+
## Color schemes
|
|
116
|
+
|
|
117
|
+
- `system` - Follows OS preference (default)
|
|
118
|
+
- `light` - Force light mode
|
|
119
|
+
- `dark` - Force dark mode
|
|
120
|
+
|
|
121
|
+
## Reactive signals
|
|
122
|
+
|
|
123
|
+
The service exposes these reactive signals:
|
|
124
|
+
|
|
125
|
+
- `selectedTheme()` - Current selected theme
|
|
126
|
+
- `selectedScheme()` - Current selected scheme ('system' | 'light' | 'dark')
|
|
127
|
+
- `resolvedScheme()` - Actual resolved scheme ('light' | 'dark')
|
|
128
|
+
- `isDarkTheme()` - Boolean indicating if current resolved scheme is dark
|
|
129
|
+
- `finalTheme()` - Complete theme string (e.g., 'sixbell_telco\_\_dark')
|
|
130
|
+
|
|
131
|
+
## Methods
|
|
132
|
+
|
|
133
|
+
- `setTheme(theme: string)` - Change current theme
|
|
134
|
+
- `setScheme(scheme: ThemeScheme)` - Change color scheme
|
|
135
|
+
- `getAvailableThemes()` - Get list of available themes
|
|
136
|
+
- `getAvailableSchemes()` - Get list of available schemes
|
|
137
|
+
- `getDefaultTheme()` - Get default theme
|
|
138
|
+
|
|
139
|
+
## Configuration options
|
|
140
|
+
|
|
141
|
+
| Property | Type | Description |
|
|
142
|
+
| ------------------ | ------------------------------- | ------------------------------------------------------------- |
|
|
143
|
+
| `additionalThemes` | `readonly string[]` | Additional themes beyond the default `sixbell_telco` |
|
|
144
|
+
| `defaultTheme` | `string` | Default theme to use (with IntelliSense for available themes) |
|
|
145
|
+
| `excludeThemes` | `readonly string[]` | Themes to exclude from available themes |
|
|
146
|
+
| `defaultScheme` | `'system' \| 'light' \| 'dark'` | Default color scheme preference |
|
|
147
|
+
|
|
148
|
+
## Advanced usage
|
|
149
|
+
|
|
150
|
+
### System theme detection
|
|
151
|
+
|
|
152
|
+
The service automatically detects system color scheme preferences:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
@Component({
|
|
156
|
+
template: `
|
|
157
|
+
<p>System prefers: {{ theme.resolvedScheme() }}</p>
|
|
158
|
+
<p>User selected: {{ theme.selectedScheme() }}</p>
|
|
159
|
+
`,
|
|
160
|
+
})
|
|
161
|
+
export class ThemeInfoComponent {
|
|
162
|
+
theme = inject(ThemeService);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Reactive CSS classes
|
|
167
|
+
|
|
168
|
+
Use the `finalTheme()` signal for dynamic CSS classes:
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
@Component({
|
|
172
|
+
template: `
|
|
173
|
+
<div [class]="'app-container ' + theme.finalTheme()">
|
|
174
|
+
<div [class.dark-mode]="theme.isDarkTheme()">Content adapts to theme automatically</div>
|
|
175
|
+
</div>
|
|
176
|
+
`,
|
|
177
|
+
})
|
|
178
|
+
export class AppComponent {
|
|
179
|
+
theme = inject(ThemeService);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Theme persistence
|
|
184
|
+
|
|
185
|
+
User preferences are automatically saved to localStorage and restored on app initialization. No additional setup required.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/theme.service';
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { EnvironmentProviders, InjectionToken, Provider, RendererFactory2 } from '@angular/core';
|
|
2
|
+
import { TranslationService } from '@sixbell-telco/sdk/utils/translation';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export type ThemeScheme = 'system' | 'light' | 'dark';
|
|
5
|
+
export type ResolvedThemeScheme = 'light' | 'dark';
|
|
6
|
+
export declare const DEFAULT_BASE_THEME = "sixbell_telco";
|
|
7
|
+
export declare const DEFAULT_THEMES: readonly ["sixbell_telco"];
|
|
8
|
+
export declare const DEFAULT_THEME_CODES: readonly ["sixbell_telco"];
|
|
9
|
+
export type DefaultThemeCode = (typeof DEFAULT_THEME_CODES)[number];
|
|
10
|
+
type ExtractThemeCode<T> = T extends readonly (infer U)[] ? U : never;
|
|
11
|
+
/**
|
|
12
|
+
* Base theme configuration interface without additional themes
|
|
13
|
+
* Provides IntelliSense for the default base theme (sixbell_telco)
|
|
14
|
+
*/
|
|
15
|
+
export interface ThemeConfigWithoutAdditionalThemes {
|
|
16
|
+
/**
|
|
17
|
+
* Default theme code (base theme: sixbell_telco)
|
|
18
|
+
* @example 'sixbell_telco'
|
|
19
|
+
*/
|
|
20
|
+
defaultTheme?: DefaultThemeCode;
|
|
21
|
+
/**
|
|
22
|
+
* Themes to exclude from the available set (base theme: sixbell_telco)
|
|
23
|
+
* @example ['sixbell_telco'] to exclude the default theme
|
|
24
|
+
*/
|
|
25
|
+
excludeThemes?: readonly DefaultThemeCode[];
|
|
26
|
+
/**
|
|
27
|
+
* Default color scheme preference
|
|
28
|
+
* @example 'system' | 'light' | 'dark'
|
|
29
|
+
*/
|
|
30
|
+
defaultScheme?: ThemeScheme;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Theme configuration interface with additional themes providing IntelliSense
|
|
34
|
+
*/
|
|
35
|
+
export interface ThemeConfigWithAdditionalThemes<T extends readonly string[]> {
|
|
36
|
+
/**
|
|
37
|
+
* Additional themes to make available beyond the default base theme (sixbell_telco)
|
|
38
|
+
* When you add themes here, they become available in defaultTheme and excludeThemes
|
|
39
|
+
* @example ['custom', 'dark_mode', 'high_contrast']
|
|
40
|
+
*/
|
|
41
|
+
additionalThemes: T;
|
|
42
|
+
/**
|
|
43
|
+
* Default theme code
|
|
44
|
+
* IntelliSense includes: base theme (sixbell_telco) + any additionalThemes you specified above
|
|
45
|
+
* @example 'sixbell_telco'
|
|
46
|
+
*/
|
|
47
|
+
defaultTheme?: DefaultThemeCode | ExtractThemeCode<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Themes to exclude from the available set
|
|
50
|
+
* IntelliSense includes: base theme (sixbell_telco) + any additionalThemes you specified above
|
|
51
|
+
* @example ['sixbell_telco'] to exclude the default theme
|
|
52
|
+
*/
|
|
53
|
+
excludeThemes?: readonly (DefaultThemeCode | ExtractThemeCode<T>)[];
|
|
54
|
+
/**
|
|
55
|
+
* Default color scheme preference
|
|
56
|
+
* @example 'system' | 'light' | 'dark'
|
|
57
|
+
*/
|
|
58
|
+
defaultScheme?: ThemeScheme;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Main theme configuration interface (generic version)
|
|
62
|
+
* Always provides IntelliSense for at least the base theme (sixbell_telco)
|
|
63
|
+
*/
|
|
64
|
+
export interface ThemeConfig {
|
|
65
|
+
/**
|
|
66
|
+
* Additional themes to make available beyond the default base theme (sixbell_telco)
|
|
67
|
+
* When you add themes here, they become available in defaultTheme and excludeThemes
|
|
68
|
+
* @example ['custom', 'dark_mode', 'high_contrast']
|
|
69
|
+
*/
|
|
70
|
+
additionalThemes?: readonly string[];
|
|
71
|
+
/**
|
|
72
|
+
* Default theme code
|
|
73
|
+
* Always includes base theme (sixbell_telco), plus any additionalThemes you specify
|
|
74
|
+
* @example 'sixbell_telco'
|
|
75
|
+
*/
|
|
76
|
+
defaultTheme?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Themes to exclude from the available set
|
|
79
|
+
* Always includes base theme (sixbell_telco), plus any additionalThemes you specify
|
|
80
|
+
* @example ['sixbell_telco'] to exclude the default theme
|
|
81
|
+
*/
|
|
82
|
+
excludeThemes?: readonly string[];
|
|
83
|
+
/**
|
|
84
|
+
* Default color scheme preference
|
|
85
|
+
* @example 'system' | 'light' | 'dark'
|
|
86
|
+
*/
|
|
87
|
+
defaultScheme?: ThemeScheme;
|
|
88
|
+
}
|
|
89
|
+
export declare const THEME_CONFIG_TOKEN: InjectionToken<ThemeConfig>;
|
|
90
|
+
export declare class ThemeService {
|
|
91
|
+
private readonly rendererFactory;
|
|
92
|
+
private readonly document;
|
|
93
|
+
private readonly themeConfig?;
|
|
94
|
+
readonly translationService: TranslationService;
|
|
95
|
+
private readonly renderer;
|
|
96
|
+
private initialized;
|
|
97
|
+
private config;
|
|
98
|
+
selectedTheme: import("@angular/core").WritableSignal<string>;
|
|
99
|
+
selectedScheme: import("@angular/core").WritableSignal<ThemeScheme>;
|
|
100
|
+
/**
|
|
101
|
+
* Get the actual resolved scheme ('light' or 'dark') regardless of user selection.
|
|
102
|
+
* This is useful for conditional rendering where you need to know the actual
|
|
103
|
+
* light/dark state, even when the user has selected 'system' preference.
|
|
104
|
+
*/
|
|
105
|
+
resolvedScheme: import("@angular/core").Signal<"light" | "dark">;
|
|
106
|
+
/**
|
|
107
|
+
* Convenient computed signal that returns true when the current resolved scheme is 'dark'.
|
|
108
|
+
*/
|
|
109
|
+
isDarkTheme: import("@angular/core").Signal<boolean>;
|
|
110
|
+
finalTheme: import("@angular/core").Signal<string>;
|
|
111
|
+
constructor(rendererFactory: RendererFactory2, document: Document, themeConfig?: ThemeConfig | undefined);
|
|
112
|
+
/**
|
|
113
|
+
* Configure and initialize the theme service (used by provider)
|
|
114
|
+
*/
|
|
115
|
+
configure(config?: ThemeConfig): void;
|
|
116
|
+
/**
|
|
117
|
+
* Initialize theme from localStorage and apply it immediately
|
|
118
|
+
*/
|
|
119
|
+
private initializeFromStorage;
|
|
120
|
+
/**
|
|
121
|
+
* Apply the current theme to the document
|
|
122
|
+
*/
|
|
123
|
+
private applyTheme;
|
|
124
|
+
/**
|
|
125
|
+
* Set the current theme
|
|
126
|
+
*/
|
|
127
|
+
setTheme(theme: string): void;
|
|
128
|
+
/**
|
|
129
|
+
* Set the current color scheme
|
|
130
|
+
*/
|
|
131
|
+
setScheme(scheme: ThemeScheme): void;
|
|
132
|
+
/**
|
|
133
|
+
* Get available themes
|
|
134
|
+
*/
|
|
135
|
+
getAvailableThemes(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Get available schemes
|
|
138
|
+
*/
|
|
139
|
+
getAvailableSchemes(): ThemeScheme[];
|
|
140
|
+
/**
|
|
141
|
+
* Get default theme
|
|
142
|
+
*/
|
|
143
|
+
getDefaultTheme(): string;
|
|
144
|
+
/**
|
|
145
|
+
* Get default scheme
|
|
146
|
+
*/
|
|
147
|
+
getDefaultScheme(): ThemeScheme;
|
|
148
|
+
/**
|
|
149
|
+
* Get localized scheme name by code using translations
|
|
150
|
+
* This automatically returns the localized name based on the current language
|
|
151
|
+
*/
|
|
152
|
+
getLocalizedSchemeName(scheme: string): string;
|
|
153
|
+
/**
|
|
154
|
+
* Get localized theme name by code using translations
|
|
155
|
+
* This automatically returns the localized name based on the current language
|
|
156
|
+
*/
|
|
157
|
+
getLocalizedThemeName(theme: string): string;
|
|
158
|
+
/**
|
|
159
|
+
* Force initialization method for MFE environments
|
|
160
|
+
*/
|
|
161
|
+
init(): void;
|
|
162
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, [null, null, { optional: true; }]>;
|
|
163
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Provider function for theme configuration in Angular applications
|
|
167
|
+
* This provides the theme configuration through dependency injection
|
|
168
|
+
*
|
|
169
|
+
* @param config Optional theme configuration
|
|
170
|
+
* @returns Provider array that configures theme service
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* // app.config.ts
|
|
175
|
+
* import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
|
|
176
|
+
*
|
|
177
|
+
* export const appConfig: ApplicationConfig = {
|
|
178
|
+
* providers: [
|
|
179
|
+
* provideRouter(routes),
|
|
180
|
+
*
|
|
181
|
+
* // Basic usage - sixbell_telco always available
|
|
182
|
+
* provideTheme({
|
|
183
|
+
* defaultScheme: 'light',
|
|
184
|
+
* defaultTheme: 'sixbell_telco' // IntelliSense: 'sixbell_telco'
|
|
185
|
+
* }),
|
|
186
|
+
*
|
|
187
|
+
* // With additional themes
|
|
188
|
+
* provideTheme({
|
|
189
|
+
* additionalThemes: ['wom', 'custom'] as const,
|
|
190
|
+
* defaultTheme: 'custom', // IntelliSense: 'sixbell_telco' | string
|
|
191
|
+
* excludeThemes: ['wom'] as const, // IntelliSense: 'sixbell_telco' | string
|
|
192
|
+
* defaultScheme: 'system'
|
|
193
|
+
* }),
|
|
194
|
+
*
|
|
195
|
+
* // ... other providers
|
|
196
|
+
* ],
|
|
197
|
+
* };
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export declare function provideTheme<const T extends readonly string[] = []>(config?: {
|
|
201
|
+
additionalThemes?: T;
|
|
202
|
+
defaultTheme?: T extends readonly [string, ...string[]] ? DefaultThemeCode | ExtractThemeCode<T> : DefaultThemeCode;
|
|
203
|
+
excludeThemes?: T extends readonly [string, ...string[]] ? readonly (DefaultThemeCode | ExtractThemeCode<T>)[] : readonly DefaultThemeCode[];
|
|
204
|
+
defaultScheme?: ThemeScheme;
|
|
205
|
+
}): (Provider | EnvironmentProviders)[];
|
|
206
|
+
export {};
|