dynamic-ds 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -28,28 +28,43 @@ npm install dynamic-ds
28
28
 
29
29
  ### 🚀 Quick Start
30
30
 
31
- #### 1. Import Styles
31
+ #### 1. Import Module
32
32
 
33
- Add the design system styles to your `angular.json`:
33
+ In your `app.module.ts`:
34
34
 
35
- ```json
36
- {
37
- "styles": [
38
- "node_modules/dynamic-ds/styles/system-design.scss"
39
- ]
40
- }
35
+ ```typescript
36
+ import { NgModule } from '@angular/core';
37
+ import { BrowserModule } from '@angular/platform-browser';
38
+ import { DynamicDsModule } from 'dynamic-ds';
39
+ import { AppComponent } from './app.component';
40
+
41
+ @NgModule({
42
+ declarations: [AppComponent],
43
+ imports: [
44
+ BrowserModule,
45
+ DynamicDsModule.forRoot({
46
+ brand: '#2740B4',
47
+ primary: '#006BDF',
48
+ secondary: '#9F5100',
49
+ functional: '#006BDF',
50
+ utility: '#CF0026'
51
+ })
52
+ ],
53
+ bootstrap: [AppComponent]
54
+ })
55
+ export class AppModule { }
41
56
  ```
42
57
 
43
- #### 2. Provide Configuration (Optional)
44
-
45
- In your `app.config.ts` or module:
58
+ **For standalone apps** (Angular 14+), in your `app.config.ts`:
46
59
 
47
60
  ```typescript
48
61
  import { ApplicationConfig } from '@angular/core';
62
+ import { provideAnimations } from '@angular/platform-browser/animations';
49
63
  import { SYSTEM_DESIGN_CONFIG } from 'dynamic-ds';
50
64
 
51
65
  export const appConfig: ApplicationConfig = {
52
66
  providers: [
67
+ provideAnimations(),
53
68
  {
54
69
  provide: SYSTEM_DESIGN_CONFIG,
55
70
  useValue: {
@@ -64,6 +79,24 @@ export const appConfig: ApplicationConfig = {
64
79
  };
65
80
  ```
66
81
 
82
+ #### 2. Import Styles
83
+
84
+ Add the design system styles to your `angular.json`:
85
+
86
+ ```json
87
+ {
88
+ "styles": [
89
+ "node_modules/dynamic-ds/src/lib/styles/system-design.scss"
90
+ ]
91
+ }
92
+ ```
93
+
94
+ Or import directly in your `styles.scss`:
95
+
96
+ ```scss
97
+ @import 'dynamic-ds/src/lib/styles/system-design.scss';
98
+ ```
99
+
67
100
  #### 3. Initialize Theme
68
101
 
69
102
  In your `app.component.ts`:
@@ -1,7 +1,25 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Optional, Inject, Injectable, Component } from '@angular/core';
2
+ import { Component, InjectionToken, Optional, Inject, Injectable, NgModule } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
3
4
  import { of } from 'rxjs';
4
5
 
6
+ class DynamicDsComponent {
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DynamicDsComponent, isStandalone: true, selector: "lib-dynamic-ds", ngImport: i0, template: `
9
+ <p>
10
+ fis-ds works!
11
+ </p>
12
+ `, isInline: true, styles: [""] });
13
+ }
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsComponent, decorators: [{
15
+ type: Component,
16
+ args: [{ selector: 'lib-dynamic-ds', imports: [], template: `
17
+ <p>
18
+ fis-ds works!
19
+ </p>
20
+ ` }]
21
+ }] });
22
+
5
23
  // Token để inject config (Cầu nối giữa App và Lib)
6
24
  const SYSTEM_DESIGN_CONFIG = new InjectionToken('SYSTEM_DESIGN_CONFIG');
7
25
 
@@ -303,21 +321,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
303
321
  args: [SYSTEM_DESIGN_CONFIG]
304
322
  }] }] });
305
323
 
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
- <p>
310
- fis-ds works!
311
- </p>
312
- `, isInline: true, styles: [""] });
324
+ class DynamicDsModule {
325
+ /**
326
+ * Use this method in your app.module.ts to configure the Design System
327
+ * @param config SystemDesignConfig with your custom colors
328
+ * @example
329
+ * DynamicDsModule.forRoot({
330
+ * brand: '#006BDF',
331
+ * primary: '#006BDF',
332
+ * secondary: '#9F5100',
333
+ * functional: '#006BDF',
334
+ * utility: '#CF0026'
335
+ * })
336
+ */
337
+ static forRoot(config) {
338
+ return {
339
+ ngModule: DynamicDsModule,
340
+ providers: [
341
+ DynamicDsService,
342
+ {
343
+ provide: SYSTEM_DESIGN_CONFIG,
344
+ useValue: config || {}
345
+ }
346
+ ]
347
+ };
348
+ }
349
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
350
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsModule, imports: [CommonModule,
351
+ DynamicDsComponent // Standalone component
352
+ ], exports: [DynamicDsComponent] });
353
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsModule, imports: [CommonModule] });
313
354
  }
314
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsComponent, decorators: [{
315
- type: Component,
316
- args: [{ selector: 'lib-dynamic-ds', imports: [], template: `
317
- <p>
318
- fis-ds works!
319
- </p>
320
- ` }]
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicDsModule, decorators: [{
356
+ type: NgModule,
357
+ args: [{
358
+ imports: [
359
+ CommonModule,
360
+ DynamicDsComponent // Standalone component
361
+ ],
362
+ exports: [
363
+ DynamicDsComponent
364
+ ]
365
+ }]
321
366
  }] });
322
367
 
323
368
  /*
@@ -328,5 +373,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
328
373
  * Generated bundle index. Do not edit.
329
374
  */
330
375
 
331
- export { DynamicDsComponent, DynamicDsService, SYSTEM_DESIGN_CONFIG };
376
+ export { DynamicDsComponent, DynamicDsModule, DynamicDsService, SYSTEM_DESIGN_CONFIG };
332
377
  //# sourceMappingURL=dynamic-ds.mjs.map
@@ -1 +1 @@
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,GAA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,gBAAgB,EAAA,OAAA,EACjB,EAAE,EACD,QAAA,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.component.ts","../../../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.module.ts","../../../projects/dynamic-ds/src/public-api.ts","../../../projects/dynamic-ds/src/dynamic-ds.ts"],"sourcesContent":["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","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 { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { DynamicDsComponent } from './dynamic-ds.component';\r\nimport { DynamicDsService } from './dynamic-ds.service';\r\nimport { SYSTEM_DESIGN_CONFIG, SystemDesignConfig } from './dynamic-ds.config';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n DynamicDsComponent // Standalone component\r\n ],\r\n exports: [\r\n DynamicDsComponent\r\n ]\r\n})\r\nexport class DynamicDsModule {\r\n /**\r\n * Use this method in your app.module.ts to configure the Design System\r\n * @param config SystemDesignConfig with your custom colors\r\n * @example\r\n * DynamicDsModule.forRoot({\r\n * brand: '#006BDF',\r\n * primary: '#006BDF',\r\n * secondary: '#9F5100',\r\n * functional: '#006BDF',\r\n * utility: '#CF0026'\r\n * })\r\n */\r\n static forRoot(config?: SystemDesignConfig): ModuleWithProviders<DynamicDsModule> {\r\n return {\r\n ngModule: DynamicDsModule,\r\n providers: [\r\n DynamicDsService,\r\n {\r\n provide: SYSTEM_DESIGN_CONFIG,\r\n useValue: config || {}\r\n }\r\n ]\r\n };\r\n }\r\n}\r\n","/*\r\n * Public API Surface of dynamic-ds\r\n */\r\n\r\nexport * from './lib/dynamic-ds.module';\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":";;;;;MAYa,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;;;ACEH;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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AA,IAAA,EAAA,eAAe,YAPxB,YAAY,CAAA,EAAA,CAAA;;4FAOH,eAAe,EAAA,UAAA,EAAA,CAAA;kBAT3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACZ,wBAAA,kBAAkB;AACnB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP;AACD;AACF,iBAAA;;;ACdD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,23 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { SystemDesignConfig } from './dynamic-ds.config';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/common";
5
+ import * as i2 from "./dynamic-ds.component";
6
+ export declare class DynamicDsModule {
7
+ /**
8
+ * Use this method in your app.module.ts to configure the Design System
9
+ * @param config SystemDesignConfig with your custom colors
10
+ * @example
11
+ * DynamicDsModule.forRoot({
12
+ * brand: '#006BDF',
13
+ * primary: '#006BDF',
14
+ * secondary: '#9F5100',
15
+ * functional: '#006BDF',
16
+ * utility: '#CF0026'
17
+ * })
18
+ */
19
+ static forRoot(config?: SystemDesignConfig): ModuleWithProviders<DynamicDsModule>;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DynamicDsModule, never>;
21
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DynamicDsModule, never, [typeof i1.CommonModule, typeof i2.DynamicDsComponent], [typeof i2.DynamicDsComponent]>;
22
+ static ɵinj: i0.ɵɵInjectorDeclaration<DynamicDsModule>;
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamic-ds",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A fully dynamic Design System Core Library for Angular",
5
5
  "author": "Lê Minh Bảo <leminhbao.work@gmail.com>",
6
6
  "contributors": [
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "license": "MIT",
21
21
  "peerDependencies": {
22
- "@angular/common": "^14.0.0",
23
- "@angular/core": "^14.0.0"
22
+ "@angular/common": ">=14.0.0",
23
+ "@angular/core": ">=14.0.0"
24
24
  },
25
25
  "dependencies": {
26
26
  "tslib": "^2.3.0"
package/public-api.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './lib/dynamic-ds.module';
1
2
  export * from './lib/dynamic-ds.service';
2
3
  export * from './lib/dynamic-ds.component';
3
4
  export * from './lib/dynamic-ds.config';