dynamic-ds 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/dynamic-ds.mjs +11 -11
- package/fesm2022/dynamic-ds.mjs.map +1 -1
- package/lib/dynamic-ds.component.d.ts +5 -0
- package/lib/{fis-ds.service.d.ts → dynamic-ds.service.d.ts} +4 -4
- package/package.json +1 -1
- package/public-api.d.ts +3 -3
- package/fesm2022/fis-ds.mjs +0 -332
- package/fesm2022/fis-ds.mjs.map +0 -1
- package/lib/fis-ds.component.d.ts +0 -5
- /package/lib/{fis-ds.config.d.ts → dynamic-ds.config.d.ts} +0 -0
package/fesm2022/dynamic-ds.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { of } from 'rxjs';
|
|
|
5
5
|
// Token để inject config (Cầu nối giữa App và Lib)
|
|
6
6
|
const SYSTEM_DESIGN_CONFIG = new InjectionToken('SYSTEM_DESIGN_CONFIG');
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class DynamicDsService {
|
|
9
9
|
config;
|
|
10
10
|
// Default colors
|
|
11
11
|
DEFAULT_BRAND = '#006BDF';
|
|
@@ -288,10 +288,10 @@ class FisDsService {
|
|
|
288
288
|
}
|
|
289
289
|
: null;
|
|
290
290
|
}
|
|
291
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type:
|
|
292
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type:
|
|
291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsService, deps: [{ token: SYSTEM_DESIGN_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
292
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsService, providedIn: 'root' });
|
|
293
293
|
}
|
|
294
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type:
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsService, decorators: [{
|
|
295
295
|
type: Injectable,
|
|
296
296
|
args: [{
|
|
297
297
|
providedIn: 'root',
|
|
@@ -303,17 +303,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
303
303
|
args: [SYSTEM_DESIGN_CONFIG]
|
|
304
304
|
}] }] });
|
|
305
305
|
|
|
306
|
-
class
|
|
307
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type:
|
|
308
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type:
|
|
306
|
+
class DynamicDsComponent {
|
|
307
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
308
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DynamicDsComponent, isStandalone: true, selector: "lib-dynamic-ds", ngImport: i0, template: `
|
|
309
309
|
<p>
|
|
310
310
|
fis-ds works!
|
|
311
311
|
</p>
|
|
312
312
|
`, isInline: true, styles: [""] });
|
|
313
313
|
}
|
|
314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type:
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsComponent, decorators: [{
|
|
315
315
|
type: Component,
|
|
316
|
-
args: [{ selector: 'lib-
|
|
316
|
+
args: [{ selector: 'lib-dynamic-ds', imports: [], template: `
|
|
317
317
|
<p>
|
|
318
318
|
fis-ds works!
|
|
319
319
|
</p>
|
|
@@ -321,12 +321,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
321
321
|
}] });
|
|
322
322
|
|
|
323
323
|
/*
|
|
324
|
-
* Public API Surface of
|
|
324
|
+
* Public API Surface of dynamic-ds
|
|
325
325
|
*/
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
328
|
* Generated bundle index. Do not edit.
|
|
329
329
|
*/
|
|
330
330
|
|
|
331
|
-
export {
|
|
331
|
+
export { DynamicDsComponent, DynamicDsService, SYSTEM_DESIGN_CONFIG };
|
|
332
332
|
//# sourceMappingURL=dynamic-ds.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-ds.mjs","sources":["../../../projects/fis-ds/src/lib/fis-ds.config.ts","../../../projects/fis-ds/src/lib/fis-ds.service.ts","../../../projects/fis-ds/src/lib/fis-ds.component.ts","../../../projects/fis-ds/src/public-api.ts","../../../projects/fis-ds/src/dynamic-ds.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\n// Interface định nghĩa các màu cần thiết\r\nexport interface SystemDesignConfig {\r\n brand?: string;\r\n primary?: string;\r\n secondary?: string;\r\n functional?: string;\r\n utility?: string;\r\n}\r\n\r\n// Token để inject config (Cầu nối giữa App và Lib)\r\nexport const SYSTEM_DESIGN_CONFIG = new InjectionToken<SystemDesignConfig>(\r\n 'SYSTEM_DESIGN_CONFIG',\r\n);\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { SYSTEM_DESIGN_CONFIG, SystemDesignConfig } from './fis-ds.config';\r\nimport { Observable, of } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class FisDsService {\r\n // Default colors\r\n private readonly DEFAULT_BRAND = '#006BDF';\r\n private readonly DEFAULT_PRIMARY = '#006BDF';\r\n private readonly DEFAULT_SECONDARY = '#9F5100';\r\n private readonly DEFAULT_FUNCTIONAL = '#006BDF';\r\n private readonly DEFAULT_UTILITY = '#CF0026';\r\n\r\n constructor(\r\n @Optional()\r\n @Inject(SYSTEM_DESIGN_CONFIG)\r\n private readonly config: SystemDesignConfig,\r\n ) {}\r\n\r\n /**\r\n * Initialize theme colors from system config\r\n * Call this method during app initialization (e.g., in APP_INITIALIZER)\r\n * Each color is processed independently - uses fetched value if available, otherwise uses default\r\n * @returns Observable that completes when theme initialization is done\r\n */\r\n initializeTheme(): Observable<any> {\r\n console.log('[SystemDesignService] Initializing theme...');\r\n\r\n try {\r\n const brandColor = this.config?.brand;\r\n const primaryColor = this.config?.primary;\r\n const secondaryColor = this.config?.secondary;\r\n const functionalColor = this.config?.functional;\r\n const utilityColor = this.config?.utility;\r\n\r\n // Process each color individually - use fetched value OR default\r\n this.applyColorOrDefault(brandColor, 'brand', this.DEFAULT_BRAND);\r\n this.applyColorOrDefault(primaryColor, 'primary', this.DEFAULT_PRIMARY);\r\n this.applyColorOrDefault(\r\n secondaryColor,\r\n 'secondary',\r\n this.DEFAULT_SECONDARY,\r\n );\r\n this.applyColorOrDefault(\r\n functionalColor,\r\n 'functional',\r\n this.DEFAULT_FUNCTIONAL,\r\n );\r\n this.applyColorOrDefault(utilityColor, 'utility', this.DEFAULT_UTILITY);\r\n\r\n console.log('[SystemDesignService] Theme initialization completed');\r\n return of(true);\r\n } catch (error) {\r\n // If entire fetch fails, fallback to all defaults\r\n console.warn(\r\n '[SystemDesignService] Failed to fetch theme config, using all defaults',\r\n error,\r\n );\r\n this.resetToDefaults();\r\n return of(false);\r\n }\r\n }\r\n\r\n /**\r\n * Reload theme colors from latest system config\r\n * This is a convenience method that's equivalent to initializeTheme()\r\n * but with a more descriptive name for runtime reloading\r\n *\r\n * Usage: After updating theme config, call this to apply new colors\r\n * @returns Observable that completes when theme is reloaded\r\n */\r\n reloadThemeFromConfig(): Observable<any> {\r\n console.log('[SystemDesignService] Reloading theme from current config...');\r\n return this.initializeTheme();\r\n }\r\n\r\n /**\r\n * Apply color if valid, otherwise use default\r\n * @param fetchedColor Color fetched from config (may be null/undefined/invalid)\r\n * @param type Color type\r\n * @param defaultColor Default color to use as fallback\r\n */\r\n private applyColorOrDefault(\r\n fetchedColor: string | null | undefined,\r\n type: 'primary' | 'secondary' | 'brand' | 'functional' | 'utility',\r\n defaultColor: string,\r\n ): void {\r\n // Check if fetched color exists and is valid\r\n if (fetchedColor && this.isValidHexColor(fetchedColor)) {\r\n this.setColorPalette(fetchedColor, type);\r\n console.log(\r\n `[SystemDesignService] Applied ${type}: ${fetchedColor} (from config)`,\r\n );\r\n } else {\r\n this.setColorPalette(defaultColor, type);\r\n const reason = !fetchedColor ? 'not found' : 'invalid format';\r\n console.log(\r\n `[SystemDesignService] Applied ${type}: ${defaultColor} (default - ${reason})`,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Set color and generate full palette (900 -> 50)\r\n * @param color Hex color value (e.g., '#006BDF')\r\n * @param type Type of color ('primary' | 'secondary' | 'brand')\r\n */\r\n private setColorPalette(\r\n color: string,\r\n type: 'primary' | 'secondary' | 'brand' | 'functional' | 'utility',\r\n ): void {\r\n if (!this.isValidHexColor(color)) {\r\n console.error(`[SystemDesignService] Invalid color format: ${color}`);\r\n return;\r\n }\r\n\r\n // Set base color (600)\r\n document.documentElement.style.setProperty(`--${type}-color`, color);\r\n document.documentElement.style.setProperty(`--${type}-600`, color);\r\n\r\n // Set RGB for base color\r\n const rgb = this.hexToRgb(color);\r\n if (rgb) {\r\n const rgbValue = `${rgb.r}, ${rgb.g}, ${rgb.b}`;\r\n document.documentElement.style.setProperty(\r\n `--${type}-color-rgb`,\r\n rgbValue,\r\n );\r\n document.documentElement.style.setProperty(`--${type}-600-rgb`, rgbValue);\r\n }\r\n\r\n // Generate and set full palette\r\n const palette = this.generateColorPalette(color);\r\n\r\n Object.entries(palette).forEach(([shade, hexColor]) => {\r\n document.documentElement.style.setProperty(\r\n `--${type}-${shade}`,\r\n hexColor,\r\n );\r\n\r\n // Set RGB variant for each shade\r\n const shadeRgb = this.hexToRgb(hexColor);\r\n if (shadeRgb) {\r\n document.documentElement.style.setProperty(\r\n `--${type}-${shade}-rgb`,\r\n `${shadeRgb.r}, ${shadeRgb.g}, ${shadeRgb.b}`,\r\n );\r\n }\r\n });\r\n\r\n console.log(\r\n `[SystemDesignService] ${type} color palette generated from: ${color}`,\r\n );\r\n }\r\n\r\n /**\r\n * Generate color palette from base color\r\n * Creates all shades matching system-design.scss $shade-offsets\r\n * Uses RGB mix algorithm (mix with white/black) for accurate colors\r\n * @param baseColor Hex color string\r\n * @returns Object with shade keys and hex color values\r\n */\r\n private generateColorPalette(baseColor: string): Record<string, string> {\r\n const rgb = this.hexToRgb(baseColor);\r\n if (!rgb) {\r\n console.error('[SystemDesignService] Failed to convert color to RGB');\r\n return {};\r\n }\r\n\r\n // Shade offsets matching system-design.scss\r\n // Negative values = mix with black (darken)\r\n // Positive values = mix with white (lighten)\r\n const shadeOffsets: Record<string, number> = {\r\n '900': -73.5, // Darkest\r\n '875': -62.5,\r\n '850': -47.0,\r\n '800': -34.5,\r\n '700': -18.5,\r\n // '600' is the base color (0%), set separately\r\n '500': 17.5,\r\n '400': 33.0,\r\n '300': 53.0,\r\n '200': 72.0,\r\n '100': 85.0,\r\n '50': 89.5,\r\n '25': 93.5,\r\n '10': 97.0, // Lightest\r\n };\r\n\r\n const palette: Record<string, string> = {};\r\n\r\n Object.entries(shadeOffsets).forEach(([shade, offset]) => {\r\n palette[shade] = this.mixColor(rgb, offset);\r\n });\r\n\r\n return palette;\r\n }\r\n\r\n /**\r\n * Mix base color with white or black\r\n * @param baseRgb Base color RGB\r\n * @param weight Percentage to mix (-100 to 100)\r\n * Negative = mix with black (darken)\r\n * Positive = mix with white (lighten)\r\n * @returns Hex color string\r\n */\r\n private mixColor(\r\n baseRgb: { r: number; g: number; b: number },\r\n weight: number,\r\n ): string {\r\n const white = { r: 255, g: 255, b: 255 };\r\n const black = { r: 0, g: 0, b: 0 };\r\n\r\n let mixWith: { r: number; g: number; b: number };\r\n let mixWeight: number;\r\n\r\n if (weight > 0) {\r\n // Positive weight = mix with white (lighten)\r\n mixWith = white;\r\n mixWeight = weight / 100;\r\n } else {\r\n // Negative weight = mix with black (darken)\r\n mixWith = black;\r\n mixWeight = Math.abs(weight) / 100;\r\n }\r\n\r\n // Mix formula: result = base * (1 - weight) + mixWith * weight\r\n const r = Math.round(baseRgb.r * (1 - mixWeight) + mixWith.r * mixWeight);\r\n const g = Math.round(baseRgb.g * (1 - mixWeight) + mixWith.g * mixWeight);\r\n const b = Math.round(baseRgb.b * (1 - mixWeight) + mixWith.b * mixWeight);\r\n\r\n return this.rgbToHex({ r, g, b });\r\n }\r\n\r\n /**\r\n * Convert RGB to HEX\r\n * @param rgb RGB object\r\n * @returns Hex color string\r\n */\r\n private rgbToHex(rgb: { r: number; g: number; b: number }): string {\r\n const toHex = (n: number): string => {\r\n const hex = Math.max(0, Math.min(255, n)).toString(16);\r\n return hex.length === 1 ? '0' + hex : hex;\r\n };\r\n return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;\r\n }\r\n\r\n /**\r\n * Update system design colors dynamically\r\n * Call this when user changes theme colors in settings\r\n * Only updates colors that are provided and valid\r\n * @param colors Object containing colors to update (optional properties)\r\n */\r\n updateSystemDesignColor(colors: {\r\n primaryColor?: string;\r\n secondaryColor?: string;\r\n brandColor?: string;\r\n functionalColor?: string;\r\n utilityColor?: string;\r\n }): void {\r\n console.log('[SystemDesignService] Updating colors:', colors);\r\n\r\n // Update each color if provided and valid\r\n if (colors.brandColor) {\r\n if (this.isValidHexColor(colors.brandColor)) {\r\n this.setColorPalette(colors.brandColor, 'brand');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid brand color format:',\r\n colors.brandColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.primaryColor) {\r\n if (this.isValidHexColor(colors.primaryColor)) {\r\n this.setColorPalette(colors.primaryColor, 'primary');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid primary color format:',\r\n colors.primaryColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.secondaryColor) {\r\n if (this.isValidHexColor(colors.secondaryColor)) {\r\n this.setColorPalette(colors.secondaryColor, 'secondary');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid secondary color format:',\r\n colors.secondaryColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.functionalColor) {\r\n if (this.isValidHexColor(colors.functionalColor)) {\r\n this.setColorPalette(colors.functionalColor, 'functional');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid functional color format:',\r\n colors.functionalColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.utilityColor) {\r\n if (this.isValidHexColor(colors.utilityColor)) {\r\n this.setColorPalette(colors.utilityColor, 'utility');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid utility color format:',\r\n colors.utilityColor,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get current theme colors\r\n * @returns Object with current brand, primary, secondary, functional, and utility colors\r\n */\r\n getCurrentColors(): {\r\n brand: string;\r\n primary: string;\r\n secondary: string;\r\n functional: string;\r\n utility: string;\r\n } {\r\n const style = getComputedStyle(document.documentElement);\r\n return {\r\n brand: style.getPropertyValue('--brand-color').trim(),\r\n primary: style.getPropertyValue('--primary-color').trim(),\r\n secondary: style.getPropertyValue('--secondary-color').trim(),\r\n functional: style.getPropertyValue('--functional-color').trim(),\r\n utility: style.getPropertyValue('--utility-color').trim(),\r\n };\r\n }\r\n\r\n /**\r\n * Reset to default colors\r\n */\r\n resetToDefaults(): void {\r\n console.log('[SystemDesignService] Resetting to default colors');\r\n this.setColorPalette(this.DEFAULT_BRAND, 'brand');\r\n this.setColorPalette(this.DEFAULT_PRIMARY, 'primary');\r\n this.setColorPalette(this.DEFAULT_SECONDARY, 'secondary');\r\n this.setColorPalette(this.DEFAULT_FUNCTIONAL, 'functional');\r\n this.setColorPalette(this.DEFAULT_UTILITY, 'utility');\r\n }\r\n\r\n // ============================================================================\r\n // COLOR CONVERSION UTILITIES\r\n // ============================================================================\r\n\r\n /**\r\n * Validate hex color format\r\n * @param hex Color string to validate\r\n * @returns true if valid hex color\r\n */\r\n private isValidHexColor(hex: string): boolean {\r\n return /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.test(hex);\r\n }\r\n\r\n /**\r\n * Convert HEX to RGB\r\n * @param hex Hex color string (e.g., '#006BDF')\r\n * @returns RGB object or null if invalid\r\n */\r\n private hexToRgb(hex: string): { r: number; g: number; b: number } | null {\r\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\r\n return result\r\n ? {\r\n r: parseInt(result[1], 16),\r\n g: parseInt(result[2], 16),\r\n b: parseInt(result[3], 16),\r\n }\r\n : null;\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-fis-ds',\r\n imports: [],\r\n template: `\r\n <p>\r\n fis-ds works!\r\n </p>\r\n `,\r\n styles: ``\r\n})\r\nexport class FisDsComponent {\r\n\r\n}\r\n","/*\r\n * Public API Surface of fis-ds\r\n */\r\n\r\nexport * from './lib/fis-ds.service';\r\nexport * from './lib/fis-ds.component';\r\nexport * from './lib/fis-ds.config';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAWA;MACa,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;;MCNX,YAAY,CAAA;AAWJ,IAAA,MAAA;;IATF,aAAa,GAAG,SAAS;IACzB,eAAe,GAAG,SAAS;IAC3B,iBAAiB,GAAG,SAAS;IAC7B,kBAAkB,GAAG,SAAS;IAC9B,eAAe,GAAG,SAAS;AAE5C,IAAA,WAAA,CAGmB,MAA0B,EAAA;QAA1B,IAAM,CAAA,MAAA,GAAN,MAAM;;AAGzB;;;;;AAKG;IACH,eAAe,GAAA;AACb,QAAA,O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AA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA;;;ACTH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"dynamic-ds.mjs","sources":["../../../projects/dynamic-ds/src/lib/dynamic-ds.config.ts","../../../projects/dynamic-ds/src/lib/dynamic-ds.service.ts","../../../projects/dynamic-ds/src/lib/dynamic-ds.component.ts","../../../projects/dynamic-ds/src/public-api.ts","../../../projects/dynamic-ds/src/dynamic-ds.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\n// Interface định nghĩa các màu cần thiết\r\nexport interface SystemDesignConfig {\r\n brand?: string;\r\n primary?: string;\r\n secondary?: string;\r\n functional?: string;\r\n utility?: string;\r\n}\r\n\r\n// Token để inject config (Cầu nối giữa App và Lib)\r\nexport const SYSTEM_DESIGN_CONFIG = new InjectionToken<SystemDesignConfig>(\r\n 'SYSTEM_DESIGN_CONFIG',\r\n);\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { SYSTEM_DESIGN_CONFIG, SystemDesignConfig } from './dynamic-ds.config';\r\nimport { Observable, of } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class DynamicDsService {\r\n // Default colors\r\n private readonly DEFAULT_BRAND = '#006BDF';\r\n private readonly DEFAULT_PRIMARY = '#006BDF';\r\n private readonly DEFAULT_SECONDARY = '#9F5100';\r\n private readonly DEFAULT_FUNCTIONAL = '#006BDF';\r\n private readonly DEFAULT_UTILITY = '#CF0026';\r\n\r\n constructor(\r\n @Optional()\r\n @Inject(SYSTEM_DESIGN_CONFIG)\r\n private readonly config: SystemDesignConfig,\r\n ) {}\r\n\r\n /**\r\n * Initialize theme colors from system config\r\n * Call this method during app initialization (e.g., in APP_INITIALIZER)\r\n * Each color is processed independently - uses fetched value if available, otherwise uses default\r\n * @returns Observable that completes when theme initialization is done\r\n */\r\n initializeTheme(): Observable<any> {\r\n console.log('[SystemDesignService] Initializing theme...');\r\n\r\n try {\r\n const brandColor = this.config?.brand;\r\n const primaryColor = this.config?.primary;\r\n const secondaryColor = this.config?.secondary;\r\n const functionalColor = this.config?.functional;\r\n const utilityColor = this.config?.utility;\r\n\r\n // Process each color individually - use fetched value OR default\r\n this.applyColorOrDefault(brandColor, 'brand', this.DEFAULT_BRAND);\r\n this.applyColorOrDefault(primaryColor, 'primary', this.DEFAULT_PRIMARY);\r\n this.applyColorOrDefault(\r\n secondaryColor,\r\n 'secondary',\r\n this.DEFAULT_SECONDARY,\r\n );\r\n this.applyColorOrDefault(\r\n functionalColor,\r\n 'functional',\r\n this.DEFAULT_FUNCTIONAL,\r\n );\r\n this.applyColorOrDefault(utilityColor, 'utility', this.DEFAULT_UTILITY);\r\n\r\n console.log('[SystemDesignService] Theme initialization completed');\r\n return of(true);\r\n } catch (error) {\r\n // If entire fetch fails, fallback to all defaults\r\n console.warn(\r\n '[SystemDesignService] Failed to fetch theme config, using all defaults',\r\n error,\r\n );\r\n this.resetToDefaults();\r\n return of(false);\r\n }\r\n }\r\n\r\n /**\r\n * Reload theme colors from latest system config\r\n * This is a convenience method that's equivalent to initializeTheme()\r\n * but with a more descriptive name for runtime reloading\r\n *\r\n * Usage: After updating theme config, call this to apply new colors\r\n * @returns Observable that completes when theme is reloaded\r\n */\r\n reloadThemeFromConfig(): Observable<any> {\r\n console.log('[SystemDesignService] Reloading theme from current config...');\r\n return this.initializeTheme();\r\n }\r\n\r\n /**\r\n * Apply color if valid, otherwise use default\r\n * @param fetchedColor Color fetched from config (may be null/undefined/invalid)\r\n * @param type Color type\r\n * @param defaultColor Default color to use as fallback\r\n */\r\n private applyColorOrDefault(\r\n fetchedColor: string | null | undefined,\r\n type: 'primary' | 'secondary' | 'brand' | 'functional' | 'utility',\r\n defaultColor: string,\r\n ): void {\r\n // Check if fetched color exists and is valid\r\n if (fetchedColor && this.isValidHexColor(fetchedColor)) {\r\n this.setColorPalette(fetchedColor, type);\r\n console.log(\r\n `[SystemDesignService] Applied ${type}: ${fetchedColor} (from config)`,\r\n );\r\n } else {\r\n this.setColorPalette(defaultColor, type);\r\n const reason = !fetchedColor ? 'not found' : 'invalid format';\r\n console.log(\r\n `[SystemDesignService] Applied ${type}: ${defaultColor} (default - ${reason})`,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Set color and generate full palette (900 -> 50)\r\n * @param color Hex color value (e.g., '#006BDF')\r\n * @param type Type of color ('primary' | 'secondary' | 'brand')\r\n */\r\n private setColorPalette(\r\n color: string,\r\n type: 'primary' | 'secondary' | 'brand' | 'functional' | 'utility',\r\n ): void {\r\n if (!this.isValidHexColor(color)) {\r\n console.error(`[SystemDesignService] Invalid color format: ${color}`);\r\n return;\r\n }\r\n\r\n // Set base color (600)\r\n document.documentElement.style.setProperty(`--${type}-color`, color);\r\n document.documentElement.style.setProperty(`--${type}-600`, color);\r\n\r\n // Set RGB for base color\r\n const rgb = this.hexToRgb(color);\r\n if (rgb) {\r\n const rgbValue = `${rgb.r}, ${rgb.g}, ${rgb.b}`;\r\n document.documentElement.style.setProperty(\r\n `--${type}-color-rgb`,\r\n rgbValue,\r\n );\r\n document.documentElement.style.setProperty(`--${type}-600-rgb`, rgbValue);\r\n }\r\n\r\n // Generate and set full palette\r\n const palette = this.generateColorPalette(color);\r\n\r\n Object.entries(palette).forEach(([shade, hexColor]) => {\r\n document.documentElement.style.setProperty(\r\n `--${type}-${shade}`,\r\n hexColor,\r\n );\r\n\r\n // Set RGB variant for each shade\r\n const shadeRgb = this.hexToRgb(hexColor);\r\n if (shadeRgb) {\r\n document.documentElement.style.setProperty(\r\n `--${type}-${shade}-rgb`,\r\n `${shadeRgb.r}, ${shadeRgb.g}, ${shadeRgb.b}`,\r\n );\r\n }\r\n });\r\n\r\n console.log(\r\n `[SystemDesignService] ${type} color palette generated from: ${color}`,\r\n );\r\n }\r\n\r\n /**\r\n * Generate color palette from base color\r\n * Creates all shades matching system-design.scss $shade-offsets\r\n * Uses RGB mix algorithm (mix with white/black) for accurate colors\r\n * @param baseColor Hex color string\r\n * @returns Object with shade keys and hex color values\r\n */\r\n private generateColorPalette(baseColor: string): Record<string, string> {\r\n const rgb = this.hexToRgb(baseColor);\r\n if (!rgb) {\r\n console.error('[SystemDesignService] Failed to convert color to RGB');\r\n return {};\r\n }\r\n\r\n // Shade offsets matching system-design.scss\r\n // Negative values = mix with black (darken)\r\n // Positive values = mix with white (lighten)\r\n const shadeOffsets: Record<string, number> = {\r\n '900': -73.5, // Darkest\r\n '875': -62.5,\r\n '850': -47.0,\r\n '800': -34.5,\r\n '700': -18.5,\r\n // '600' is the base color (0%), set separately\r\n '500': 17.5,\r\n '400': 33.0,\r\n '300': 53.0,\r\n '200': 72.0,\r\n '100': 85.0,\r\n '50': 89.5,\r\n '25': 93.5,\r\n '10': 97.0, // Lightest\r\n };\r\n\r\n const palette: Record<string, string> = {};\r\n\r\n Object.entries(shadeOffsets).forEach(([shade, offset]) => {\r\n palette[shade] = this.mixColor(rgb, offset);\r\n });\r\n\r\n return palette;\r\n }\r\n\r\n /**\r\n * Mix base color with white or black\r\n * @param baseRgb Base color RGB\r\n * @param weight Percentage to mix (-100 to 100)\r\n * Negative = mix with black (darken)\r\n * Positive = mix with white (lighten)\r\n * @returns Hex color string\r\n */\r\n private mixColor(\r\n baseRgb: { r: number; g: number; b: number },\r\n weight: number,\r\n ): string {\r\n const white = { r: 255, g: 255, b: 255 };\r\n const black = { r: 0, g: 0, b: 0 };\r\n\r\n let mixWith: { r: number; g: number; b: number };\r\n let mixWeight: number;\r\n\r\n if (weight > 0) {\r\n // Positive weight = mix with white (lighten)\r\n mixWith = white;\r\n mixWeight = weight / 100;\r\n } else {\r\n // Negative weight = mix with black (darken)\r\n mixWith = black;\r\n mixWeight = Math.abs(weight) / 100;\r\n }\r\n\r\n // Mix formula: result = base * (1 - weight) + mixWith * weight\r\n const r = Math.round(baseRgb.r * (1 - mixWeight) + mixWith.r * mixWeight);\r\n const g = Math.round(baseRgb.g * (1 - mixWeight) + mixWith.g * mixWeight);\r\n const b = Math.round(baseRgb.b * (1 - mixWeight) + mixWith.b * mixWeight);\r\n\r\n return this.rgbToHex({ r, g, b });\r\n }\r\n\r\n /**\r\n * Convert RGB to HEX\r\n * @param rgb RGB object\r\n * @returns Hex color string\r\n */\r\n private rgbToHex(rgb: { r: number; g: number; b: number }): string {\r\n const toHex = (n: number): string => {\r\n const hex = Math.max(0, Math.min(255, n)).toString(16);\r\n return hex.length === 1 ? '0' + hex : hex;\r\n };\r\n return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;\r\n }\r\n\r\n /**\r\n * Update system design colors dynamically\r\n * Call this when user changes theme colors in settings\r\n * Only updates colors that are provided and valid\r\n * @param colors Object containing colors to update (optional properties)\r\n */\r\n updateSystemDesignColor(colors: {\r\n primaryColor?: string;\r\n secondaryColor?: string;\r\n brandColor?: string;\r\n functionalColor?: string;\r\n utilityColor?: string;\r\n }): void {\r\n console.log('[SystemDesignService] Updating colors:', colors);\r\n\r\n // Update each color if provided and valid\r\n if (colors.brandColor) {\r\n if (this.isValidHexColor(colors.brandColor)) {\r\n this.setColorPalette(colors.brandColor, 'brand');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid brand color format:',\r\n colors.brandColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.primaryColor) {\r\n if (this.isValidHexColor(colors.primaryColor)) {\r\n this.setColorPalette(colors.primaryColor, 'primary');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid primary color format:',\r\n colors.primaryColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.secondaryColor) {\r\n if (this.isValidHexColor(colors.secondaryColor)) {\r\n this.setColorPalette(colors.secondaryColor, 'secondary');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid secondary color format:',\r\n colors.secondaryColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.functionalColor) {\r\n if (this.isValidHexColor(colors.functionalColor)) {\r\n this.setColorPalette(colors.functionalColor, 'functional');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid functional color format:',\r\n colors.functionalColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.utilityColor) {\r\n if (this.isValidHexColor(colors.utilityColor)) {\r\n this.setColorPalette(colors.utilityColor, 'utility');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid utility color format:',\r\n colors.utilityColor,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get current theme colors\r\n * @returns Object with current brand, primary, secondary, functional, and utility colors\r\n */\r\n getCurrentColors(): {\r\n brand: string;\r\n primary: string;\r\n secondary: string;\r\n functional: string;\r\n utility: string;\r\n } {\r\n const style = getComputedStyle(document.documentElement);\r\n return {\r\n brand: style.getPropertyValue('--brand-color').trim(),\r\n primary: style.getPropertyValue('--primary-color').trim(),\r\n secondary: style.getPropertyValue('--secondary-color').trim(),\r\n functional: style.getPropertyValue('--functional-color').trim(),\r\n utility: style.getPropertyValue('--utility-color').trim(),\r\n };\r\n }\r\n\r\n /**\r\n * Reset to default colors\r\n */\r\n resetToDefaults(): void {\r\n console.log('[SystemDesignService] Resetting to default colors');\r\n this.setColorPalette(this.DEFAULT_BRAND, 'brand');\r\n this.setColorPalette(this.DEFAULT_PRIMARY, 'primary');\r\n this.setColorPalette(this.DEFAULT_SECONDARY, 'secondary');\r\n this.setColorPalette(this.DEFAULT_FUNCTIONAL, 'functional');\r\n this.setColorPalette(this.DEFAULT_UTILITY, 'utility');\r\n }\r\n\r\n // ============================================================================\r\n // COLOR CONVERSION UTILITIES\r\n // ============================================================================\r\n\r\n /**\r\n * Validate hex color format\r\n * @param hex Color string to validate\r\n * @returns true if valid hex color\r\n */\r\n private isValidHexColor(hex: string): boolean {\r\n return /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.test(hex);\r\n }\r\n\r\n /**\r\n * Convert HEX to RGB\r\n * @param hex Hex color string (e.g., '#006BDF')\r\n * @returns RGB object or null if invalid\r\n */\r\n private hexToRgb(hex: string): { r: number; g: number; b: number } | null {\r\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\r\n return result\r\n ? {\r\n r: parseInt(result[1], 16),\r\n g: parseInt(result[2], 16),\r\n b: parseInt(result[3], 16),\r\n }\r\n : null;\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-dynamic-ds',\r\n imports: [],\r\n template: `\r\n <p>\r\n fis-ds works!\r\n </p>\r\n `,\r\n styles: ``\r\n})\r\nexport class DynamicDsComponent {\r\n\r\n}\r\n","/*\r\n * Public API Surface of dynamic-ds\r\n */\r\n\r\nexport * from './lib/dynamic-ds.service';\r\nexport * from './lib/dynamic-ds.component';\r\nexport * from './lib/dynamic-ds.config';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAWA;MACa,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;;MCNX,gBAAgB,CAAA;AAWR,IAAA,MAAA;;IATF,aAAa,GAAG,SAAS;IACzB,eAAe,GAAG,SAAS;IAC3B,iBAAiB,GAAG,SAAS;IAC7B,kBAAkB,GAAG,SAAS;IAC9B,eAAe,GAAG,SAAS;AAE5C,IAAA,WAAA,CAGmB,MAA0B,EAAA;QAA1B,IAAM,CAAA,MAAA,GAAN,MAAM;;AAGzB;;;;;AAKG;IACH,eAAe,GAAA;AACb,QAAA,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC;AAE1D,QAAA,IAAI;AACF,YAAA,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK;AACrC,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO;AACzC,YAAA,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS;AAC7C,YAAA,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU;AAC/C,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,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AAA,EAAA,CAAA;AAVnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA;;4FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAUI;;0BACA,MAAM;2BAAC,oBAAoB;;;MCLnB,kBAAkB,CAAA;wGAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,kBAAkB,EAPnB,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAGU,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAV9B,SAAS;+BACE,gBAAgB,EAAA,OAAA,EACjB,EAAE,EACD,QAAA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA;;;ACTH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class DynamicDsComponent {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicDsComponent, never>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicDsComponent, "lib-dynamic-ds", never, {}, {}, never, never, true, never>;
|
|
5
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SystemDesignConfig } from './
|
|
1
|
+
import { SystemDesignConfig } from './dynamic-ds.config';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class DynamicDsService {
|
|
5
5
|
private readonly config;
|
|
6
6
|
private readonly DEFAULT_BRAND;
|
|
7
7
|
private readonly DEFAULT_PRIMARY;
|
|
@@ -101,6 +101,6 @@ export declare class FisDsService {
|
|
|
101
101
|
* @returns RGB object or null if invalid
|
|
102
102
|
*/
|
|
103
103
|
private hexToRgb;
|
|
104
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
105
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<
|
|
104
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicDsService, [{ optional: true; }]>;
|
|
105
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DynamicDsService>;
|
|
106
106
|
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './lib/
|
|
2
|
-
export * from './lib/
|
|
3
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/dynamic-ds.service';
|
|
2
|
+
export * from './lib/dynamic-ds.component';
|
|
3
|
+
export * from './lib/dynamic-ds.config';
|
package/fesm2022/fis-ds.mjs
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Optional, Inject, Injectable, Component } from '@angular/core';
|
|
3
|
-
import { of } from 'rxjs';
|
|
4
|
-
|
|
5
|
-
// Token để inject config (Cầu nối giữa App và Lib)
|
|
6
|
-
const SYSTEM_DESIGN_CONFIG = new InjectionToken('SYSTEM_DESIGN_CONFIG');
|
|
7
|
-
|
|
8
|
-
class FisDsService {
|
|
9
|
-
config;
|
|
10
|
-
// Default colors
|
|
11
|
-
DEFAULT_BRAND = '#006BDF';
|
|
12
|
-
DEFAULT_PRIMARY = '#006BDF';
|
|
13
|
-
DEFAULT_SECONDARY = '#9F5100';
|
|
14
|
-
DEFAULT_FUNCTIONAL = '#006BDF';
|
|
15
|
-
DEFAULT_UTILITY = '#CF0026';
|
|
16
|
-
constructor(config) {
|
|
17
|
-
this.config = config;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Initialize theme colors from system config
|
|
21
|
-
* Call this method during app initialization (e.g., in APP_INITIALIZER)
|
|
22
|
-
* Each color is processed independently - uses fetched value if available, otherwise uses default
|
|
23
|
-
* @returns Observable that completes when theme initialization is done
|
|
24
|
-
*/
|
|
25
|
-
initializeTheme() {
|
|
26
|
-
console.log('[SystemDesignService] Initializing theme...');
|
|
27
|
-
try {
|
|
28
|
-
const brandColor = this.config?.brand;
|
|
29
|
-
const primaryColor = this.config?.primary;
|
|
30
|
-
const secondaryColor = this.config?.secondary;
|
|
31
|
-
const functionalColor = this.config?.functional;
|
|
32
|
-
const utilityColor = this.config?.utility;
|
|
33
|
-
// Process each color individually - use fetched value OR default
|
|
34
|
-
this.applyColorOrDefault(brandColor, 'brand', this.DEFAULT_BRAND);
|
|
35
|
-
this.applyColorOrDefault(primaryColor, 'primary', this.DEFAULT_PRIMARY);
|
|
36
|
-
this.applyColorOrDefault(secondaryColor, 'secondary', this.DEFAULT_SECONDARY);
|
|
37
|
-
this.applyColorOrDefault(functionalColor, 'functional', this.DEFAULT_FUNCTIONAL);
|
|
38
|
-
this.applyColorOrDefault(utilityColor, 'utility', this.DEFAULT_UTILITY);
|
|
39
|
-
console.log('[SystemDesignService] Theme initialization completed');
|
|
40
|
-
return of(true);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
// If entire fetch fails, fallback to all defaults
|
|
44
|
-
console.warn('[SystemDesignService] Failed to fetch theme config, using all defaults', error);
|
|
45
|
-
this.resetToDefaults();
|
|
46
|
-
return of(false);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Reload theme colors from latest system config
|
|
51
|
-
* This is a convenience method that's equivalent to initializeTheme()
|
|
52
|
-
* but with a more descriptive name for runtime reloading
|
|
53
|
-
*
|
|
54
|
-
* Usage: After updating theme config, call this to apply new colors
|
|
55
|
-
* @returns Observable that completes when theme is reloaded
|
|
56
|
-
*/
|
|
57
|
-
reloadThemeFromConfig() {
|
|
58
|
-
console.log('[SystemDesignService] Reloading theme from current config...');
|
|
59
|
-
return this.initializeTheme();
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Apply color if valid, otherwise use default
|
|
63
|
-
* @param fetchedColor Color fetched from config (may be null/undefined/invalid)
|
|
64
|
-
* @param type Color type
|
|
65
|
-
* @param defaultColor Default color to use as fallback
|
|
66
|
-
*/
|
|
67
|
-
applyColorOrDefault(fetchedColor, type, defaultColor) {
|
|
68
|
-
// Check if fetched color exists and is valid
|
|
69
|
-
if (fetchedColor && this.isValidHexColor(fetchedColor)) {
|
|
70
|
-
this.setColorPalette(fetchedColor, type);
|
|
71
|
-
console.log(`[SystemDesignService] Applied ${type}: ${fetchedColor} (from config)`);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this.setColorPalette(defaultColor, type);
|
|
75
|
-
const reason = !fetchedColor ? 'not found' : 'invalid format';
|
|
76
|
-
console.log(`[SystemDesignService] Applied ${type}: ${defaultColor} (default - ${reason})`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Set color and generate full palette (900 -> 50)
|
|
81
|
-
* @param color Hex color value (e.g., '#006BDF')
|
|
82
|
-
* @param type Type of color ('primary' | 'secondary' | 'brand')
|
|
83
|
-
*/
|
|
84
|
-
setColorPalette(color, type) {
|
|
85
|
-
if (!this.isValidHexColor(color)) {
|
|
86
|
-
console.error(`[SystemDesignService] Invalid color format: ${color}`);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
// Set base color (600)
|
|
90
|
-
document.documentElement.style.setProperty(`--${type}-color`, color);
|
|
91
|
-
document.documentElement.style.setProperty(`--${type}-600`, color);
|
|
92
|
-
// Set RGB for base color
|
|
93
|
-
const rgb = this.hexToRgb(color);
|
|
94
|
-
if (rgb) {
|
|
95
|
-
const rgbValue = `${rgb.r}, ${rgb.g}, ${rgb.b}`;
|
|
96
|
-
document.documentElement.style.setProperty(`--${type}-color-rgb`, rgbValue);
|
|
97
|
-
document.documentElement.style.setProperty(`--${type}-600-rgb`, rgbValue);
|
|
98
|
-
}
|
|
99
|
-
// Generate and set full palette
|
|
100
|
-
const palette = this.generateColorPalette(color);
|
|
101
|
-
Object.entries(palette).forEach(([shade, hexColor]) => {
|
|
102
|
-
document.documentElement.style.setProperty(`--${type}-${shade}`, hexColor);
|
|
103
|
-
// Set RGB variant for each shade
|
|
104
|
-
const shadeRgb = this.hexToRgb(hexColor);
|
|
105
|
-
if (shadeRgb) {
|
|
106
|
-
document.documentElement.style.setProperty(`--${type}-${shade}-rgb`, `${shadeRgb.r}, ${shadeRgb.g}, ${shadeRgb.b}`);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
console.log(`[SystemDesignService] ${type} color palette generated from: ${color}`);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Generate color palette from base color
|
|
113
|
-
* Creates all shades matching system-design.scss $shade-offsets
|
|
114
|
-
* Uses RGB mix algorithm (mix with white/black) for accurate colors
|
|
115
|
-
* @param baseColor Hex color string
|
|
116
|
-
* @returns Object with shade keys and hex color values
|
|
117
|
-
*/
|
|
118
|
-
generateColorPalette(baseColor) {
|
|
119
|
-
const rgb = this.hexToRgb(baseColor);
|
|
120
|
-
if (!rgb) {
|
|
121
|
-
console.error('[SystemDesignService] Failed to convert color to RGB');
|
|
122
|
-
return {};
|
|
123
|
-
}
|
|
124
|
-
// Shade offsets matching system-design.scss
|
|
125
|
-
// Negative values = mix with black (darken)
|
|
126
|
-
// Positive values = mix with white (lighten)
|
|
127
|
-
const shadeOffsets = {
|
|
128
|
-
'900': -73.5, // Darkest
|
|
129
|
-
'875': -62.5,
|
|
130
|
-
'850': -47.0,
|
|
131
|
-
'800': -34.5,
|
|
132
|
-
'700': -18.5,
|
|
133
|
-
// '600' is the base color (0%), set separately
|
|
134
|
-
'500': 17.5,
|
|
135
|
-
'400': 33.0,
|
|
136
|
-
'300': 53.0,
|
|
137
|
-
'200': 72.0,
|
|
138
|
-
'100': 85.0,
|
|
139
|
-
'50': 89.5,
|
|
140
|
-
'25': 93.5,
|
|
141
|
-
'10': 97.0, // Lightest
|
|
142
|
-
};
|
|
143
|
-
const palette = {};
|
|
144
|
-
Object.entries(shadeOffsets).forEach(([shade, offset]) => {
|
|
145
|
-
palette[shade] = this.mixColor(rgb, offset);
|
|
146
|
-
});
|
|
147
|
-
return palette;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Mix base color with white or black
|
|
151
|
-
* @param baseRgb Base color RGB
|
|
152
|
-
* @param weight Percentage to mix (-100 to 100)
|
|
153
|
-
* Negative = mix with black (darken)
|
|
154
|
-
* Positive = mix with white (lighten)
|
|
155
|
-
* @returns Hex color string
|
|
156
|
-
*/
|
|
157
|
-
mixColor(baseRgb, weight) {
|
|
158
|
-
const white = { r: 255, g: 255, b: 255 };
|
|
159
|
-
const black = { r: 0, g: 0, b: 0 };
|
|
160
|
-
let mixWith;
|
|
161
|
-
let mixWeight;
|
|
162
|
-
if (weight > 0) {
|
|
163
|
-
// Positive weight = mix with white (lighten)
|
|
164
|
-
mixWith = white;
|
|
165
|
-
mixWeight = weight / 100;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
// Negative weight = mix with black (darken)
|
|
169
|
-
mixWith = black;
|
|
170
|
-
mixWeight = Math.abs(weight) / 100;
|
|
171
|
-
}
|
|
172
|
-
// Mix formula: result = base * (1 - weight) + mixWith * weight
|
|
173
|
-
const r = Math.round(baseRgb.r * (1 - mixWeight) + mixWith.r * mixWeight);
|
|
174
|
-
const g = Math.round(baseRgb.g * (1 - mixWeight) + mixWith.g * mixWeight);
|
|
175
|
-
const b = Math.round(baseRgb.b * (1 - mixWeight) + mixWith.b * mixWeight);
|
|
176
|
-
return this.rgbToHex({ r, g, b });
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Convert RGB to HEX
|
|
180
|
-
* @param rgb RGB object
|
|
181
|
-
* @returns Hex color string
|
|
182
|
-
*/
|
|
183
|
-
rgbToHex(rgb) {
|
|
184
|
-
const toHex = (n) => {
|
|
185
|
-
const hex = Math.max(0, Math.min(255, n)).toString(16);
|
|
186
|
-
return hex.length === 1 ? '0' + hex : hex;
|
|
187
|
-
};
|
|
188
|
-
return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Update system design colors dynamically
|
|
192
|
-
* Call this when user changes theme colors in settings
|
|
193
|
-
* Only updates colors that are provided and valid
|
|
194
|
-
* @param colors Object containing colors to update (optional properties)
|
|
195
|
-
*/
|
|
196
|
-
updateSystemDesignColor(colors) {
|
|
197
|
-
console.log('[SystemDesignService] Updating colors:', colors);
|
|
198
|
-
// Update each color if provided and valid
|
|
199
|
-
if (colors.brandColor) {
|
|
200
|
-
if (this.isValidHexColor(colors.brandColor)) {
|
|
201
|
-
this.setColorPalette(colors.brandColor, 'brand');
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
console.warn('[SystemDesignService] Invalid brand color format:', colors.brandColor);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (colors.primaryColor) {
|
|
208
|
-
if (this.isValidHexColor(colors.primaryColor)) {
|
|
209
|
-
this.setColorPalette(colors.primaryColor, 'primary');
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
console.warn('[SystemDesignService] Invalid primary color format:', colors.primaryColor);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
if (colors.secondaryColor) {
|
|
216
|
-
if (this.isValidHexColor(colors.secondaryColor)) {
|
|
217
|
-
this.setColorPalette(colors.secondaryColor, 'secondary');
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
console.warn('[SystemDesignService] Invalid secondary color format:', colors.secondaryColor);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
if (colors.functionalColor) {
|
|
224
|
-
if (this.isValidHexColor(colors.functionalColor)) {
|
|
225
|
-
this.setColorPalette(colors.functionalColor, 'functional');
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
console.warn('[SystemDesignService] Invalid functional color format:', colors.functionalColor);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
if (colors.utilityColor) {
|
|
232
|
-
if (this.isValidHexColor(colors.utilityColor)) {
|
|
233
|
-
this.setColorPalette(colors.utilityColor, 'utility');
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
console.warn('[SystemDesignService] Invalid utility color format:', colors.utilityColor);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get current theme colors
|
|
242
|
-
* @returns Object with current brand, primary, secondary, functional, and utility colors
|
|
243
|
-
*/
|
|
244
|
-
getCurrentColors() {
|
|
245
|
-
const style = getComputedStyle(document.documentElement);
|
|
246
|
-
return {
|
|
247
|
-
brand: style.getPropertyValue('--brand-color').trim(),
|
|
248
|
-
primary: style.getPropertyValue('--primary-color').trim(),
|
|
249
|
-
secondary: style.getPropertyValue('--secondary-color').trim(),
|
|
250
|
-
functional: style.getPropertyValue('--functional-color').trim(),
|
|
251
|
-
utility: style.getPropertyValue('--utility-color').trim(),
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Reset to default colors
|
|
256
|
-
*/
|
|
257
|
-
resetToDefaults() {
|
|
258
|
-
console.log('[SystemDesignService] Resetting to default colors');
|
|
259
|
-
this.setColorPalette(this.DEFAULT_BRAND, 'brand');
|
|
260
|
-
this.setColorPalette(this.DEFAULT_PRIMARY, 'primary');
|
|
261
|
-
this.setColorPalette(this.DEFAULT_SECONDARY, 'secondary');
|
|
262
|
-
this.setColorPalette(this.DEFAULT_FUNCTIONAL, 'functional');
|
|
263
|
-
this.setColorPalette(this.DEFAULT_UTILITY, 'utility');
|
|
264
|
-
}
|
|
265
|
-
// ============================================================================
|
|
266
|
-
// COLOR CONVERSION UTILITIES
|
|
267
|
-
// ============================================================================
|
|
268
|
-
/**
|
|
269
|
-
* Validate hex color format
|
|
270
|
-
* @param hex Color string to validate
|
|
271
|
-
* @returns true if valid hex color
|
|
272
|
-
*/
|
|
273
|
-
isValidHexColor(hex) {
|
|
274
|
-
return /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(hex);
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Convert HEX to RGB
|
|
278
|
-
* @param hex Hex color string (e.g., '#006BDF')
|
|
279
|
-
* @returns RGB object or null if invalid
|
|
280
|
-
*/
|
|
281
|
-
hexToRgb(hex) {
|
|
282
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
283
|
-
return result
|
|
284
|
-
? {
|
|
285
|
-
r: parseInt(result[1], 16),
|
|
286
|
-
g: parseInt(result[2], 16),
|
|
287
|
-
b: parseInt(result[3], 16),
|
|
288
|
-
}
|
|
289
|
-
: null;
|
|
290
|
-
}
|
|
291
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FisDsService, deps: [{ token: SYSTEM_DESIGN_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
292
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FisDsService, providedIn: 'root' });
|
|
293
|
-
}
|
|
294
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FisDsService, decorators: [{
|
|
295
|
-
type: Injectable,
|
|
296
|
-
args: [{
|
|
297
|
-
providedIn: 'root',
|
|
298
|
-
}]
|
|
299
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
300
|
-
type: Optional
|
|
301
|
-
}, {
|
|
302
|
-
type: Inject,
|
|
303
|
-
args: [SYSTEM_DESIGN_CONFIG]
|
|
304
|
-
}] }] });
|
|
305
|
-
|
|
306
|
-
class FisDsComponent {
|
|
307
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FisDsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
308
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: FisDsComponent, isStandalone: true, selector: "lib-fis-ds", ngImport: i0, template: `
|
|
309
|
-
<p>
|
|
310
|
-
fis-ds works!
|
|
311
|
-
</p>
|
|
312
|
-
`, isInline: true, styles: [""] });
|
|
313
|
-
}
|
|
314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FisDsComponent, decorators: [{
|
|
315
|
-
type: Component,
|
|
316
|
-
args: [{ selector: 'lib-fis-ds', imports: [], template: `
|
|
317
|
-
<p>
|
|
318
|
-
fis-ds works!
|
|
319
|
-
</p>
|
|
320
|
-
` }]
|
|
321
|
-
}] });
|
|
322
|
-
|
|
323
|
-
/*
|
|
324
|
-
* Public API Surface of fis-ds
|
|
325
|
-
*/
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Generated bundle index. Do not edit.
|
|
329
|
-
*/
|
|
330
|
-
|
|
331
|
-
export { FisDsComponent, FisDsService, SYSTEM_DESIGN_CONFIG };
|
|
332
|
-
//# sourceMappingURL=fis-ds.mjs.map
|
package/fesm2022/fis-ds.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fis-ds.mjs","sources":["../../../projects/fis-ds/src/lib/fis-ds.config.ts","../../../projects/fis-ds/src/lib/fis-ds.service.ts","../../../projects/fis-ds/src/lib/fis-ds.component.ts","../../../projects/fis-ds/src/public-api.ts","../../../projects/fis-ds/src/fis-ds.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\n// Interface định nghĩa các màu cần thiết\r\nexport interface SystemDesignConfig {\r\n brand?: string;\r\n primary?: string;\r\n secondary?: string;\r\n functional?: string;\r\n utility?: string;\r\n}\r\n\r\n// Token để inject config (Cầu nối giữa App và Lib)\r\nexport const SYSTEM_DESIGN_CONFIG = new InjectionToken<SystemDesignConfig>(\r\n 'SYSTEM_DESIGN_CONFIG',\r\n);\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { SYSTEM_DESIGN_CONFIG, SystemDesignConfig } from './fis-ds.config';\r\nimport { Observable, of } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class FisDsService {\r\n // Default colors\r\n private readonly DEFAULT_BRAND = '#006BDF';\r\n private readonly DEFAULT_PRIMARY = '#006BDF';\r\n private readonly DEFAULT_SECONDARY = '#9F5100';\r\n private readonly DEFAULT_FUNCTIONAL = '#006BDF';\r\n private readonly DEFAULT_UTILITY = '#CF0026';\r\n\r\n constructor(\r\n @Optional()\r\n @Inject(SYSTEM_DESIGN_CONFIG)\r\n private readonly config: SystemDesignConfig,\r\n ) {}\r\n\r\n /**\r\n * Initialize theme colors from system config\r\n * Call this method during app initialization (e.g., in APP_INITIALIZER)\r\n * Each color is processed independently - uses fetched value if available, otherwise uses default\r\n * @returns Observable that completes when theme initialization is done\r\n */\r\n initializeTheme(): Observable<any> {\r\n console.log('[SystemDesignService] Initializing theme...');\r\n\r\n try {\r\n const brandColor = this.config?.brand;\r\n const primaryColor = this.config?.primary;\r\n const secondaryColor = this.config?.secondary;\r\n const functionalColor = this.config?.functional;\r\n const utilityColor = this.config?.utility;\r\n\r\n // Process each color individually - use fetched value OR default\r\n this.applyColorOrDefault(brandColor, 'brand', this.DEFAULT_BRAND);\r\n this.applyColorOrDefault(primaryColor, 'primary', this.DEFAULT_PRIMARY);\r\n this.applyColorOrDefault(\r\n secondaryColor,\r\n 'secondary',\r\n this.DEFAULT_SECONDARY,\r\n );\r\n this.applyColorOrDefault(\r\n functionalColor,\r\n 'functional',\r\n this.DEFAULT_FUNCTIONAL,\r\n );\r\n this.applyColorOrDefault(utilityColor, 'utility', this.DEFAULT_UTILITY);\r\n\r\n console.log('[SystemDesignService] Theme initialization completed');\r\n return of(true);\r\n } catch (error) {\r\n // If entire fetch fails, fallback to all defaults\r\n console.warn(\r\n '[SystemDesignService] Failed to fetch theme config, using all defaults',\r\n error,\r\n );\r\n this.resetToDefaults();\r\n return of(false);\r\n }\r\n }\r\n\r\n /**\r\n * Reload theme colors from latest system config\r\n * This is a convenience method that's equivalent to initializeTheme()\r\n * but with a more descriptive name for runtime reloading\r\n *\r\n * Usage: After updating theme config, call this to apply new colors\r\n * @returns Observable that completes when theme is reloaded\r\n */\r\n reloadThemeFromConfig(): Observable<any> {\r\n console.log('[SystemDesignService] Reloading theme from current config...');\r\n return this.initializeTheme();\r\n }\r\n\r\n /**\r\n * Apply color if valid, otherwise use default\r\n * @param fetchedColor Color fetched from config (may be null/undefined/invalid)\r\n * @param type Color type\r\n * @param defaultColor Default color to use as fallback\r\n */\r\n private applyColorOrDefault(\r\n fetchedColor: string | null | undefined,\r\n type: 'primary' | 'secondary' | 'brand' | 'functional' | 'utility',\r\n defaultColor: string,\r\n ): void {\r\n // Check if fetched color exists and is valid\r\n if (fetchedColor && this.isValidHexColor(fetchedColor)) {\r\n this.setColorPalette(fetchedColor, type);\r\n console.log(\r\n `[SystemDesignService] Applied ${type}: ${fetchedColor} (from config)`,\r\n );\r\n } else {\r\n this.setColorPalette(defaultColor, type);\r\n const reason = !fetchedColor ? 'not found' : 'invalid format';\r\n console.log(\r\n `[SystemDesignService] Applied ${type}: ${defaultColor} (default - ${reason})`,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Set color and generate full palette (900 -> 50)\r\n * @param color Hex color value (e.g., '#006BDF')\r\n * @param type Type of color ('primary' | 'secondary' | 'brand')\r\n */\r\n private setColorPalette(\r\n color: string,\r\n type: 'primary' | 'secondary' | 'brand' | 'functional' | 'utility',\r\n ): void {\r\n if (!this.isValidHexColor(color)) {\r\n console.error(`[SystemDesignService] Invalid color format: ${color}`);\r\n return;\r\n }\r\n\r\n // Set base color (600)\r\n document.documentElement.style.setProperty(`--${type}-color`, color);\r\n document.documentElement.style.setProperty(`--${type}-600`, color);\r\n\r\n // Set RGB for base color\r\n const rgb = this.hexToRgb(color);\r\n if (rgb) {\r\n const rgbValue = `${rgb.r}, ${rgb.g}, ${rgb.b}`;\r\n document.documentElement.style.setProperty(\r\n `--${type}-color-rgb`,\r\n rgbValue,\r\n );\r\n document.documentElement.style.setProperty(`--${type}-600-rgb`, rgbValue);\r\n }\r\n\r\n // Generate and set full palette\r\n const palette = this.generateColorPalette(color);\r\n\r\n Object.entries(palette).forEach(([shade, hexColor]) => {\r\n document.documentElement.style.setProperty(\r\n `--${type}-${shade}`,\r\n hexColor,\r\n );\r\n\r\n // Set RGB variant for each shade\r\n const shadeRgb = this.hexToRgb(hexColor);\r\n if (shadeRgb) {\r\n document.documentElement.style.setProperty(\r\n `--${type}-${shade}-rgb`,\r\n `${shadeRgb.r}, ${shadeRgb.g}, ${shadeRgb.b}`,\r\n );\r\n }\r\n });\r\n\r\n console.log(\r\n `[SystemDesignService] ${type} color palette generated from: ${color}`,\r\n );\r\n }\r\n\r\n /**\r\n * Generate color palette from base color\r\n * Creates all shades matching system-design.scss $shade-offsets\r\n * Uses RGB mix algorithm (mix with white/black) for accurate colors\r\n * @param baseColor Hex color string\r\n * @returns Object with shade keys and hex color values\r\n */\r\n private generateColorPalette(baseColor: string): Record<string, string> {\r\n const rgb = this.hexToRgb(baseColor);\r\n if (!rgb) {\r\n console.error('[SystemDesignService] Failed to convert color to RGB');\r\n return {};\r\n }\r\n\r\n // Shade offsets matching system-design.scss\r\n // Negative values = mix with black (darken)\r\n // Positive values = mix with white (lighten)\r\n const shadeOffsets: Record<string, number> = {\r\n '900': -73.5, // Darkest\r\n '875': -62.5,\r\n '850': -47.0,\r\n '800': -34.5,\r\n '700': -18.5,\r\n // '600' is the base color (0%), set separately\r\n '500': 17.5,\r\n '400': 33.0,\r\n '300': 53.0,\r\n '200': 72.0,\r\n '100': 85.0,\r\n '50': 89.5,\r\n '25': 93.5,\r\n '10': 97.0, // Lightest\r\n };\r\n\r\n const palette: Record<string, string> = {};\r\n\r\n Object.entries(shadeOffsets).forEach(([shade, offset]) => {\r\n palette[shade] = this.mixColor(rgb, offset);\r\n });\r\n\r\n return palette;\r\n }\r\n\r\n /**\r\n * Mix base color with white or black\r\n * @param baseRgb Base color RGB\r\n * @param weight Percentage to mix (-100 to 100)\r\n * Negative = mix with black (darken)\r\n * Positive = mix with white (lighten)\r\n * @returns Hex color string\r\n */\r\n private mixColor(\r\n baseRgb: { r: number; g: number; b: number },\r\n weight: number,\r\n ): string {\r\n const white = { r: 255, g: 255, b: 255 };\r\n const black = { r: 0, g: 0, b: 0 };\r\n\r\n let mixWith: { r: number; g: number; b: number };\r\n let mixWeight: number;\r\n\r\n if (weight > 0) {\r\n // Positive weight = mix with white (lighten)\r\n mixWith = white;\r\n mixWeight = weight / 100;\r\n } else {\r\n // Negative weight = mix with black (darken)\r\n mixWith = black;\r\n mixWeight = Math.abs(weight) / 100;\r\n }\r\n\r\n // Mix formula: result = base * (1 - weight) + mixWith * weight\r\n const r = Math.round(baseRgb.r * (1 - mixWeight) + mixWith.r * mixWeight);\r\n const g = Math.round(baseRgb.g * (1 - mixWeight) + mixWith.g * mixWeight);\r\n const b = Math.round(baseRgb.b * (1 - mixWeight) + mixWith.b * mixWeight);\r\n\r\n return this.rgbToHex({ r, g, b });\r\n }\r\n\r\n /**\r\n * Convert RGB to HEX\r\n * @param rgb RGB object\r\n * @returns Hex color string\r\n */\r\n private rgbToHex(rgb: { r: number; g: number; b: number }): string {\r\n const toHex = (n: number): string => {\r\n const hex = Math.max(0, Math.min(255, n)).toString(16);\r\n return hex.length === 1 ? '0' + hex : hex;\r\n };\r\n return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;\r\n }\r\n\r\n /**\r\n * Update system design colors dynamically\r\n * Call this when user changes theme colors in settings\r\n * Only updates colors that are provided and valid\r\n * @param colors Object containing colors to update (optional properties)\r\n */\r\n updateSystemDesignColor(colors: {\r\n primaryColor?: string;\r\n secondaryColor?: string;\r\n brandColor?: string;\r\n functionalColor?: string;\r\n utilityColor?: string;\r\n }): void {\r\n console.log('[SystemDesignService] Updating colors:', colors);\r\n\r\n // Update each color if provided and valid\r\n if (colors.brandColor) {\r\n if (this.isValidHexColor(colors.brandColor)) {\r\n this.setColorPalette(colors.brandColor, 'brand');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid brand color format:',\r\n colors.brandColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.primaryColor) {\r\n if (this.isValidHexColor(colors.primaryColor)) {\r\n this.setColorPalette(colors.primaryColor, 'primary');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid primary color format:',\r\n colors.primaryColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.secondaryColor) {\r\n if (this.isValidHexColor(colors.secondaryColor)) {\r\n this.setColorPalette(colors.secondaryColor, 'secondary');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid secondary color format:',\r\n colors.secondaryColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.functionalColor) {\r\n if (this.isValidHexColor(colors.functionalColor)) {\r\n this.setColorPalette(colors.functionalColor, 'functional');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid functional color format:',\r\n colors.functionalColor,\r\n );\r\n }\r\n }\r\n\r\n if (colors.utilityColor) {\r\n if (this.isValidHexColor(colors.utilityColor)) {\r\n this.setColorPalette(colors.utilityColor, 'utility');\r\n } else {\r\n console.warn(\r\n '[SystemDesignService] Invalid utility color format:',\r\n colors.utilityColor,\r\n );\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get current theme colors\r\n * @returns Object with current brand, primary, secondary, functional, and utility colors\r\n */\r\n getCurrentColors(): {\r\n brand: string;\r\n primary: string;\r\n secondary: string;\r\n functional: string;\r\n utility: string;\r\n } {\r\n const style = getComputedStyle(document.documentElement);\r\n return {\r\n brand: style.getPropertyValue('--brand-color').trim(),\r\n primary: style.getPropertyValue('--primary-color').trim(),\r\n secondary: style.getPropertyValue('--secondary-color').trim(),\r\n functional: style.getPropertyValue('--functional-color').trim(),\r\n utility: style.getPropertyValue('--utility-color').trim(),\r\n };\r\n }\r\n\r\n /**\r\n * Reset to default colors\r\n */\r\n resetToDefaults(): void {\r\n console.log('[SystemDesignService] Resetting to default colors');\r\n this.setColorPalette(this.DEFAULT_BRAND, 'brand');\r\n this.setColorPalette(this.DEFAULT_PRIMARY, 'primary');\r\n this.setColorPalette(this.DEFAULT_SECONDARY, 'secondary');\r\n this.setColorPalette(this.DEFAULT_FUNCTIONAL, 'functional');\r\n this.setColorPalette(this.DEFAULT_UTILITY, 'utility');\r\n }\r\n\r\n // ============================================================================\r\n // COLOR CONVERSION UTILITIES\r\n // ============================================================================\r\n\r\n /**\r\n * Validate hex color format\r\n * @param hex Color string to validate\r\n * @returns true if valid hex color\r\n */\r\n private isValidHexColor(hex: string): boolean {\r\n return /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.test(hex);\r\n }\r\n\r\n /**\r\n * Convert HEX to RGB\r\n * @param hex Hex color string (e.g., '#006BDF')\r\n * @returns RGB object or null if invalid\r\n */\r\n private hexToRgb(hex: string): { r: number; g: number; b: number } | null {\r\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\r\n return result\r\n ? {\r\n r: parseInt(result[1], 16),\r\n g: parseInt(result[2], 16),\r\n b: parseInt(result[3], 16),\r\n }\r\n : null;\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-fis-ds',\r\n imports: [],\r\n template: `\r\n <p>\r\n fis-ds works!\r\n </p>\r\n `,\r\n styles: ``\r\n})\r\nexport class FisDsComponent {\r\n\r\n}\r\n","/*\r\n * Public API Surface of fis-ds\r\n */\r\n\r\nexport * from './lib/fis-ds.service';\r\nexport * from './lib/fis-ds.component';\r\nexport * from './lib/fis-ds.config';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAWA;MACa,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;;MCNX,YAAY,CAAA;AAWJ,IAAA,MAAA;;IATF,aAAa,GAAG,SAAS;IACzB,eAAe,GAAG,SAAS;IAC3B,iBAAiB,GAAG,SAAS;IAC7B,kBAAkB,GAAG,SAAS;IAC9B,eAAe,GAAG,SAAS;AAE5C,IAAA,WAAA,CAGmB,MAA0B,EAAA;QAA1B,IAAM,CAAA,MAAA,GAAN,MAAM;;AAGzB;;;;;AAKG;IACH,eAAe,GAAA;AACb,QAAA,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC;AAE1D,QAAA,IAAI;AACF,YAAA,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK;AACrC,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO;AACzC,YAAA,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS;AAC7C,YAAA,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU;AAC/C,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO;;YAGzC,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC;YACjE,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,CAAC,eAA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