@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.8 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/components/ui/accessibility-demo.esm.js +30 -24
  3. package/dist/components/ui/accessibility-demo.js +30 -24
  4. package/dist/components/ui/advanced-component-architecture-demo.esm.js +235 -179
  5. package/dist/components/ui/advanced-component-architecture-demo.js +235 -179
  6. package/dist/components/ui/advanced-transition-system-demo.esm.js +110 -64
  7. package/dist/components/ui/advanced-transition-system-demo.js +110 -64
  8. package/dist/components/ui/advanced-transition-system.esm.js +166 -122
  9. package/dist/components/ui/advanced-transition-system.js +166 -122
  10. package/dist/components/ui/animation/animated-container.esm.js +52 -29
  11. package/dist/components/ui/animation/animated-container.js +52 -29
  12. package/dist/components/ui/animation/staggered-container.esm.js +18 -9
  13. package/dist/components/ui/animation/staggered-container.js +18 -9
  14. package/dist/components/ui/animation-demo.esm.js +67 -35
  15. package/dist/components/ui/animation-demo.js +67 -35
  16. package/dist/components/ui/badge.esm.js +9 -6
  17. package/dist/components/ui/badge.js +9 -6
  18. package/dist/components/ui/battery-conscious-animation-demo.esm.js +122 -87
  19. package/dist/components/ui/battery-conscious-animation-demo.js +122 -87
  20. package/dist/components/ui/border-radius-shadow-demo.esm.js +23 -12
  21. package/dist/components/ui/border-radius-shadow-demo.js +23 -12
  22. package/dist/components/ui/button.esm.js +8 -2
  23. package/dist/components/ui/button.js +8 -2
  24. package/dist/components/ui/card.esm.js +33 -8
  25. package/dist/components/ui/card.js +33 -8
  26. package/dist/components/ui/checkbox.esm.js +3 -3
  27. package/dist/components/ui/checkbox.js +3 -3
  28. package/dist/components/ui/color-preview.esm.js +68 -45
  29. package/dist/components/ui/color-preview.js +68 -45
  30. package/dist/components/ui/data-display/chart.esm.js +112 -84
  31. package/dist/components/ui/data-display/chart.js +112 -84
  32. package/dist/components/ui/data-display/data-grid-simple.esm.js +1 -1
  33. package/dist/components/ui/data-display/data-grid-simple.js +1 -1
  34. package/dist/components/ui/data-display/data-grid.esm.js +80 -67
  35. package/dist/components/ui/data-display/data-grid.js +80 -67
  36. package/dist/components/ui/data-display/list.esm.js +53 -45
  37. package/dist/components/ui/data-display/list.js +53 -45
  38. package/dist/components/ui/data-display/table.esm.js +62 -54
  39. package/dist/components/ui/data-display/table.js +62 -54
  40. package/dist/components/ui/data-display/timeline.esm.js +39 -34
  41. package/dist/components/ui/data-display/timeline.js +39 -34
  42. package/dist/components/ui/data-display/tree.esm.js +116 -84
  43. package/dist/components/ui/data-display/tree.js +116 -84
  44. package/dist/components/ui/data-display/types.esm.js +389 -364
  45. package/dist/components/ui/data-display/types.js +389 -364
  46. package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +120 -70
  47. package/dist/components/ui/enterprise-mobile-experience-demo.js +120 -70
  48. package/dist/components/ui/enterprise-mobile-experience.esm.js +124 -73
  49. package/dist/components/ui/enterprise-mobile-experience.js +124 -73
  50. package/dist/components/ui/feedback/alert.esm.js +22 -15
  51. package/dist/components/ui/feedback/alert.js +22 -15
  52. package/dist/components/ui/feedback/progress.esm.js +47 -24
  53. package/dist/components/ui/feedback/progress.js +47 -24
  54. package/dist/components/ui/feedback/skeleton.esm.js +39 -29
  55. package/dist/components/ui/feedback/skeleton.js +39 -29
  56. package/dist/components/ui/feedback/toast.esm.js +62 -38
  57. package/dist/components/ui/feedback/toast.js +62 -38
  58. package/dist/components/ui/feedback/types.esm.js +83 -83
  59. package/dist/components/ui/feedback/types.js +83 -83
  60. package/dist/components/ui/font-preview.esm.js +41 -39
  61. package/dist/components/ui/font-preview.js +41 -39
  62. package/dist/components/ui/form-demo.esm.js +150 -113
  63. package/dist/components/ui/form-demo.js +150 -113
  64. package/dist/components/ui/hardware-acceleration-demo.esm.js +137 -87
  65. package/dist/components/ui/hardware-acceleration-demo.js +137 -87
  66. package/dist/components/ui/input.esm.js +4 -1
  67. package/dist/components/ui/input.js +4 -1
  68. package/dist/components/ui/layout-demo.esm.js +81 -56
  69. package/dist/components/ui/layout-demo.js +81 -56
  70. package/dist/components/ui/layouts/adaptive-layout.esm.js +27 -8
  71. package/dist/components/ui/layouts/adaptive-layout.js +27 -8
  72. package/dist/components/ui/layouts/desktop-layout.esm.js +39 -19
  73. package/dist/components/ui/layouts/desktop-layout.js +39 -19
  74. package/dist/components/ui/layouts/mobile-layout.esm.js +19 -9
  75. package/dist/components/ui/layouts/mobile-layout.js +19 -9
  76. package/dist/components/ui/layouts/tablet-layout.esm.js +28 -14
  77. package/dist/components/ui/layouts/tablet-layout.js +28 -14
  78. package/dist/components/ui/mobile-form-validation.esm.js +120 -87
  79. package/dist/components/ui/mobile-form-validation.js +120 -87
  80. package/dist/components/ui/mobile-input-demo.esm.js +19 -13
  81. package/dist/components/ui/mobile-input-demo.js +19 -13
  82. package/dist/components/ui/mobile-input.esm.js +185 -120
  83. package/dist/components/ui/mobile-input.js +185 -120
  84. package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +128 -111
  85. package/dist/components/ui/mobile-skeleton-loading-demo.js +128 -111
  86. package/dist/components/ui/navigation/breadcrumb.esm.js +17 -14
  87. package/dist/components/ui/navigation/breadcrumb.js +17 -14
  88. package/dist/components/ui/navigation/index.esm.js +23 -1
  89. package/dist/components/ui/navigation/index.js +23 -1
  90. package/dist/components/ui/navigation/menu.esm.js +49 -35
  91. package/dist/components/ui/navigation/menu.js +49 -35
  92. package/dist/components/ui/navigation/navigation-demo.esm.js +81 -74
  93. package/dist/components/ui/navigation/navigation-demo.js +81 -74
  94. package/dist/components/ui/navigation/pagination.esm.js +62 -50
  95. package/dist/components/ui/navigation/pagination.js +62 -50
  96. package/dist/components/ui/navigation/sidebar.esm.js +56 -42
  97. package/dist/components/ui/navigation/sidebar.js +56 -42
  98. package/dist/components/ui/navigation/stepper.esm.js +34 -23
  99. package/dist/components/ui/navigation/stepper.js +34 -23
  100. package/dist/components/ui/navigation/tabs.esm.js +32 -21
  101. package/dist/components/ui/navigation/tabs.js +32 -21
  102. package/dist/components/ui/navigation/types.esm.js +196 -195
  103. package/dist/components/ui/navigation/types.js +196 -195
  104. package/dist/components/ui/overlay/backdrop.esm.js +17 -16
  105. package/dist/components/ui/overlay/backdrop.js +17 -16
  106. package/dist/components/ui/overlay/focus-manager.esm.js +21 -19
  107. package/dist/components/ui/overlay/focus-manager.js +21 -19
  108. package/dist/components/ui/overlay/index.esm.js +22 -2
  109. package/dist/components/ui/overlay/index.js +22 -2
  110. package/dist/components/ui/overlay/modal.esm.js +38 -34
  111. package/dist/components/ui/overlay/modal.js +38 -34
  112. package/dist/components/ui/overlay/overlay-manager.esm.js +25 -20
  113. package/dist/components/ui/overlay/overlay-manager.js +25 -20
  114. package/dist/components/ui/overlay/popover.esm.js +74 -58
  115. package/dist/components/ui/overlay/popover.js +74 -58
  116. package/dist/components/ui/overlay/portal.esm.js +7 -7
  117. package/dist/components/ui/overlay/portal.js +7 -7
  118. package/dist/components/ui/overlay/tooltip.esm.js +54 -39
  119. package/dist/components/ui/overlay/tooltip.js +54 -39
  120. package/dist/components/ui/overlay/types.esm.js +132 -131
  121. package/dist/components/ui/overlay/types.js +132 -131
  122. package/dist/components/ui/performance-demo.esm.js +135 -88
  123. package/dist/components/ui/performance-demo.js +135 -88
  124. package/dist/components/ui/semantic-input-system-demo.esm.js +117 -80
  125. package/dist/components/ui/semantic-input-system-demo.js +117 -80
  126. package/dist/components/ui/theme-customizer.esm.js +84 -52
  127. package/dist/components/ui/theme-customizer.js +84 -52
  128. package/dist/components/ui/theme-preview.esm.js +95 -43
  129. package/dist/components/ui/theme-preview.js +95 -43
  130. package/dist/components/ui/theme-switcher.esm.js +70 -44
  131. package/dist/components/ui/theme-switcher.js +70 -44
  132. package/dist/components/ui/theme-toggle.esm.js +3 -3
  133. package/dist/components/ui/theme-toggle.js +3 -3
  134. package/dist/components/ui/token-demo.esm.js +33 -21
  135. package/dist/components/ui/token-demo.js +33 -21
  136. package/dist/components/ui/touch-demo.esm.js +102 -73
  137. package/dist/components/ui/touch-demo.js +102 -73
  138. package/dist/components/ui/touch-friendly-interface-demo.esm.js +102 -64
  139. package/dist/components/ui/touch-friendly-interface-demo.js +102 -64
  140. package/dist/components/ui/touch-friendly-interface.esm.js +85 -61
  141. package/dist/components/ui/touch-friendly-interface.js +85 -61
  142. package/dist/hooks/use-accessibility-support.esm.js +115 -85
  143. package/dist/hooks/use-accessibility-support.js +115 -85
  144. package/dist/hooks/use-adaptive-layout.esm.js +56 -33
  145. package/dist/hooks/use-adaptive-layout.js +56 -33
  146. package/dist/hooks/use-advanced-patterns.esm.js +57 -42
  147. package/dist/hooks/use-advanced-patterns.js +57 -42
  148. package/dist/hooks/use-advanced-transition-system.esm.js +112 -71
  149. package/dist/hooks/use-advanced-transition-system.js +112 -71
  150. package/dist/hooks/use-animation-profile.esm.js +63 -34
  151. package/dist/hooks/use-animation-profile.js +63 -34
  152. package/dist/hooks/use-battery-animations.esm.js +80 -55
  153. package/dist/hooks/use-battery-animations.js +80 -55
  154. package/dist/hooks/use-battery-conscious-loading.esm.js +166 -123
  155. package/dist/hooks/use-battery-conscious-loading.js +166 -123
  156. package/dist/hooks/use-battery-optimization.esm.js +78 -55
  157. package/dist/hooks/use-battery-optimization.js +78 -55
  158. package/dist/hooks/use-battery-status.esm.js +73 -51
  159. package/dist/hooks/use-battery-status.js +73 -51
  160. package/dist/hooks/use-component-performance.esm.js +62 -47
  161. package/dist/hooks/use-component-performance.js +62 -47
  162. package/dist/hooks/use-device-loading-states.esm.js +152 -109
  163. package/dist/hooks/use-device-loading-states.js +152 -109
  164. package/dist/hooks/use-device.esm.js +25 -14
  165. package/dist/hooks/use-device.js +25 -14
  166. package/dist/hooks/use-enterprise-mobile-experience.esm.js +137 -88
  167. package/dist/hooks/use-enterprise-mobile-experience.js +137 -88
  168. package/dist/hooks/use-form-feedback.esm.js +124 -81
  169. package/dist/hooks/use-form-feedback.js +124 -81
  170. package/dist/hooks/use-form-performance.esm.js +127 -92
  171. package/dist/hooks/use-form-performance.js +127 -92
  172. package/dist/hooks/use-frame-rate.esm.js +56 -37
  173. package/dist/hooks/use-frame-rate.js +56 -37
  174. package/dist/hooks/use-gestures.esm.js +96 -72
  175. package/dist/hooks/use-gestures.js +96 -72
  176. package/dist/hooks/use-hardware-acceleration.esm.js +65 -37
  177. package/dist/hooks/use-hardware-acceleration.js +65 -37
  178. package/dist/hooks/use-input-accessibility.esm.js +157 -119
  179. package/dist/hooks/use-input-accessibility.js +157 -119
  180. package/dist/hooks/use-input-performance.esm.js +139 -104
  181. package/dist/hooks/use-input-performance.js +139 -104
  182. package/dist/hooks/use-layout-performance.esm.js +50 -29
  183. package/dist/hooks/use-layout-performance.js +50 -29
  184. package/dist/hooks/use-loading-accessibility.esm.js +209 -169
  185. package/dist/hooks/use-loading-accessibility.js +209 -169
  186. package/dist/hooks/use-loading-performance.esm.js +117 -93
  187. package/dist/hooks/use-loading-performance.js +117 -93
  188. package/dist/hooks/use-memory-usage.esm.js +57 -38
  189. package/dist/hooks/use-memory-usage.js +57 -38
  190. package/dist/hooks/use-mobile-form-layout.esm.js +111 -74
  191. package/dist/hooks/use-mobile-form-layout.js +111 -74
  192. package/dist/hooks/use-mobile-form-validation.esm.js +211 -144
  193. package/dist/hooks/use-mobile-form-validation.js +211 -144
  194. package/dist/hooks/use-mobile-keyboard-optimization.esm.js +154 -113
  195. package/dist/hooks/use-mobile-keyboard-optimization.js +154 -113
  196. package/dist/hooks/use-mobile-layout.esm.js +73 -51
  197. package/dist/hooks/use-mobile-layout.js +73 -51
  198. package/dist/hooks/use-mobile-optimization.esm.js +72 -44
  199. package/dist/hooks/use-mobile-optimization.js +72 -44
  200. package/dist/hooks/use-mobile-skeleton.esm.js +97 -64
  201. package/dist/hooks/use-mobile-skeleton.js +97 -64
  202. package/dist/hooks/use-mobile-touch.esm.js +128 -93
  203. package/dist/hooks/use-mobile-touch.js +128 -93
  204. package/dist/hooks/use-performance-throttling.esm.js +72 -48
  205. package/dist/hooks/use-performance-throttling.js +72 -48
  206. package/dist/hooks/use-performance.esm.js +90 -52
  207. package/dist/hooks/use-performance.js +90 -52
  208. package/dist/hooks/use-reusable-architecture.esm.js +94 -65
  209. package/dist/hooks/use-reusable-architecture.js +94 -65
  210. package/dist/hooks/use-semantic-input-types.esm.js +166 -124
  211. package/dist/hooks/use-semantic-input-types.js +166 -124
  212. package/dist/hooks/use-semantic-input.esm.js +178 -126
  213. package/dist/hooks/use-semantic-input.js +178 -126
  214. package/dist/hooks/use-tablet-layout.esm.js +67 -38
  215. package/dist/hooks/use-tablet-layout.js +67 -38
  216. package/dist/hooks/use-touch-friendly-input.esm.js +193 -149
  217. package/dist/hooks/use-touch-friendly-input.js +193 -149
  218. package/dist/hooks/use-touch-friendly-interface.esm.js +99 -67
  219. package/dist/hooks/use-touch-friendly-interface.js +99 -67
  220. package/dist/hooks/use-touch-optimization.esm.js +99 -72
  221. package/dist/hooks/use-touch-optimization.js +99 -72
  222. package/dist/index.esm.js +289 -280
  223. package/dist/index.js +289 -280
  224. package/dist/lib/utils.esm.js +1 -1
  225. package/dist/lib/utils.js +1 -1
  226. package/dist/plugins/theme-css-generator.esm.js +104 -55
  227. package/dist/plugins/theme-css-generator.js +104 -55
  228. package/dist/provider.esm.js +4 -4
  229. package/dist/provider.js +4 -4
  230. package/dist/styles.css +1 -1
  231. package/dist/theme.esm.js +633 -468
  232. package/dist/theme.js +633 -468
  233. package/dist/themes/ThemeContext.esm.js +15 -15
  234. package/dist/themes/ThemeContext.js +15 -15
  235. package/dist/themes/ThemeProvider.esm.js +25 -22
  236. package/dist/themes/ThemeProvider.js +25 -22
  237. package/dist/themes/accessibility.esm.js +147 -108
  238. package/dist/themes/accessibility.js +147 -108
  239. package/dist/themes/aria-patterns.esm.js +198 -162
  240. package/dist/themes/aria-patterns.js +198 -162
  241. package/dist/themes/base-themes.esm.js +14 -11
  242. package/dist/themes/base-themes.js +14 -11
  243. package/dist/themes/colorManager.esm.js +101 -83
  244. package/dist/themes/colorManager.js +101 -83
  245. package/dist/themes/examples/dark-theme.esm.js +133 -103
  246. package/dist/themes/examples/dark-theme.js +133 -103
  247. package/dist/themes/examples/minimal-theme.esm.js +83 -61
  248. package/dist/themes/examples/minimal-theme.js +83 -61
  249. package/dist/themes/focus-management.esm.js +202 -143
  250. package/dist/themes/focus-management.js +202 -143
  251. package/dist/themes/fontLoader.esm.js +28 -19
  252. package/dist/themes/fontLoader.js +28 -19
  253. package/dist/themes/high-contrast.esm.js +152 -104
  254. package/dist/themes/high-contrast.js +152 -104
  255. package/dist/themes/inheritance.esm.js +35 -27
  256. package/dist/themes/inheritance.js +35 -27
  257. package/dist/themes/keyboard-navigation.esm.js +152 -123
  258. package/dist/themes/keyboard-navigation.js +152 -123
  259. package/dist/themes/motion-reduction.esm.js +193 -133
  260. package/dist/themes/motion-reduction.js +193 -133
  261. package/dist/themes/navigation.esm.js +146 -146
  262. package/dist/themes/navigation.js +146 -146
  263. package/dist/themes/screen-reader.esm.js +159 -94
  264. package/dist/themes/screen-reader.js +159 -94
  265. package/dist/themes/systemThemeDetector.esm.js +42 -34
  266. package/dist/themes/systemThemeDetector.js +42 -34
  267. package/dist/themes/themeCSSUpdater.esm.js +21 -9
  268. package/dist/themes/themeCSSUpdater.js +21 -9
  269. package/dist/themes/themePersistence.esm.js +68 -47
  270. package/dist/themes/themePersistence.js +68 -47
  271. package/dist/themes/themes/stan-design.esm.js +633 -468
  272. package/dist/themes/themes/stan-design.js +633 -468
  273. package/dist/themes/types.esm.js +301 -287
  274. package/dist/themes/types.js +301 -287
  275. package/dist/themes/useSystemTheme.esm.js +4 -4
  276. package/dist/themes/useSystemTheme.js +4 -4
  277. package/dist/themes/useTheme.esm.js +4 -4
  278. package/dist/themes/useTheme.js +4 -4
  279. package/dist/themes/validation.esm.js +128 -77
  280. package/dist/themes/validation.js +128 -77
  281. package/dist/tokens/index.esm.js +15 -4
  282. package/dist/tokens/index.js +15 -4
  283. package/dist/tokens/tokenExporter.esm.js +87 -61
  284. package/dist/tokens/tokenExporter.js +87 -61
  285. package/dist/tokens/tokenGenerator.esm.js +86 -77
  286. package/dist/tokens/tokenGenerator.js +86 -77
  287. package/dist/tokens/tokenManager.esm.js +64 -51
  288. package/dist/tokens/tokenManager.js +64 -51
  289. package/dist/tokens/tokenValidator.esm.js +193 -147
  290. package/dist/tokens/tokenValidator.js +193 -147
  291. package/dist/tokens/types.esm.js +49 -35
  292. package/dist/tokens/types.js +49 -35
  293. package/dist/utils/bundle-analyzer.esm.js +83 -65
  294. package/dist/utils/bundle-analyzer.js +83 -65
  295. package/dist/utils/bundle-splitting.esm.js +142 -117
  296. package/dist/utils/bundle-splitting.js +142 -117
  297. package/dist/utils/lazy-loading.esm.js +132 -106
  298. package/dist/utils/lazy-loading.js +132 -106
  299. package/dist/utils/performance-monitor.esm.js +170 -129
  300. package/dist/utils/performance-monitor.js +170 -129
  301. package/dist/utils/tree-shaking.esm.js +69 -61
  302. package/dist/utils/tree-shaking.js +69 -61
  303. package/package.json +1 -1
  304. package/src/index.ts +146 -146
@@ -15,26 +15,27 @@ export class ColorManager {
15
15
  /**
16
16
  * Generate a complete color scale from a base color
17
17
  */
18
- static generateColorScale(config), hueShift= 0, saturationAdjust = 0, lightnessAdjust = 0 } = config;
18
+ static generateColorScale(config: ColorGenerationConfig): ColorScale {
19
+ const { baseColor, hueShift: _hueShift = 0, saturationAdjust = 0, lightnessAdjust = 0 } = config;
19
20
 
20
21
  // Parse the base color
21
22
  const hsl = this.hexToHsl(baseColor);
22
23
  if (!hsl) {
23
- throw new Error(`Invalid color format}`);
24
+ throw new Error(`Invalid color format: ${baseColor}`);
24
25
  }
25
26
 
26
27
  // Generate the scale - preserve base color at 500
27
- const scale= {
28
- 50, 0, saturationAdjust, 95 + lightnessAdjust),
29
- 100, 0, saturationAdjust, 90 + lightnessAdjust),
30
- 200, 0, saturationAdjust, 80 + lightnessAdjust),
31
- 300, 0, saturationAdjust, 70 + lightnessAdjust),
32
- 400, 0, saturationAdjust, 60 + lightnessAdjust),
33
- 500, // Keep original base color
34
- 600, 0, saturationAdjust, 40 + lightnessAdjust),
35
- 700, 0, saturationAdjust, 30 + lightnessAdjust),
36
- 800, 0, saturationAdjust, 20 + lightnessAdjust),
37
- 900, 0, saturationAdjust, 10 + lightnessAdjust)
28
+ const scale: ColorScale = {
29
+ 50: this.adjustHsl(hsl, 0, saturationAdjust, 95 + lightnessAdjust),
30
+ 100: this.adjustHsl(hsl, 0, saturationAdjust, 90 + lightnessAdjust),
31
+ 200: this.adjustHsl(hsl, 0, saturationAdjust, 80 + lightnessAdjust),
32
+ 300: this.adjustHsl(hsl, 0, saturationAdjust, 70 + lightnessAdjust),
33
+ 400: this.adjustHsl(hsl, 0, saturationAdjust, 60 + lightnessAdjust),
34
+ 500: baseColor, // Keep original base color
35
+ 600: this.adjustHsl(hsl, 0, saturationAdjust, 40 + lightnessAdjust),
36
+ 700: this.adjustHsl(hsl, 0, saturationAdjust, 30 + lightnessAdjust),
37
+ 800: this.adjustHsl(hsl, 0, saturationAdjust, 20 + lightnessAdjust),
38
+ 900: this.adjustHsl(hsl, 0, saturationAdjust, 10 + lightnessAdjust)
38
39
  };
39
40
 
40
41
  // Add optional variations
@@ -53,9 +54,10 @@ export class ColorManager {
53
54
  /**
54
55
  * Generate semantic colors based on a primary color
55
56
  */
56
- static generateSemanticColors(primaryColor)= this.hexToHsl(primaryColor);
57
+ static generateSemanticColors(primaryColor: string): SemanticColors {
58
+ const primaryHsl = this.hexToHsl(primaryColor);
57
59
  if (!primaryHsl) {
58
- throw new Error(`Invalid primary color}`);
60
+ throw new Error(`Invalid primary color: ${primaryColor}`);
59
61
  }
60
62
 
61
63
  // Generate semantic colors with appropriate hues
@@ -65,61 +67,63 @@ export class ColorManager {
65
67
  const infoHue = 210; // Blue
66
68
 
67
69
  return {
68
- success, 70, 50),
69
- warning, 90, 50),
70
- error, 80, 50),
71
- info, 80, 50),
70
+ success: this.hslToHex(successHue, 70, 50),
71
+ warning: this.hslToHex(warningHue, 90, 50),
72
+ error: this.hslToHex(errorHue, 80, 50),
73
+ info: this.hslToHex(infoHue, 80, 50),
72
74
 
73
75
  // Light variants
74
- successLight, 70, 90),
75
- warningLight, 90, 90),
76
- errorLight, 80, 90),
77
- infoLight, 80, 90),
76
+ successLight: this.hslToHex(successHue, 70, 90),
77
+ warningLight: this.hslToHex(warningHue, 90, 90),
78
+ errorLight: this.hslToHex(errorHue, 80, 90),
79
+ infoLight: this.hslToHex(infoHue, 80, 90),
78
80
 
79
81
  // Dark variants
80
- successDark, 70, 30),
81
- warningDark, 90, 30),
82
- errorDark, 80, 30),
83
- infoDark, 80, 30)
82
+ successDark: this.hslToHex(successHue, 70, 30),
83
+ warningDark: this.hslToHex(warningHue, 90, 30),
84
+ errorDark: this.hslToHex(errorHue, 80, 30),
85
+ infoDark: this.hslToHex(infoHue, 80, 30)
84
86
  };
85
87
  }
86
88
 
87
89
  /**
88
90
  * Generate neutral color scale
89
91
  */
90
- static generateNeutralColors(baseColor= '#6b7280')= this.hexToHsl(baseColor);
92
+ static generateNeutralColors(baseColor: string = '#6b7280'): ColorScale {
93
+ const hsl = this.hexToHsl(baseColor);
91
94
  if (!hsl) {
92
- throw new Error(`Invalid neutral color}`);
95
+ throw new Error(`Invalid neutral color: ${baseColor}`);
93
96
  }
94
97
 
95
98
  return {
96
- 50, 5, 97),
97
- 100, 5, 90),
98
- 200, 5, 80),
99
- 300, 5, 70),
100
- 400, 5, 60),
101
- 500, // Keep original base color
102
- 600, 5, 40),
103
- 700, 5, 30),
104
- 800, 5, 20),
105
- 900, 5, 10)
99
+ 50: this.hslToHex(hsl.h, 5, 97),
100
+ 100: this.hslToHex(hsl.h, 5, 90),
101
+ 200: this.hslToHex(hsl.h, 5, 80),
102
+ 300: this.hslToHex(hsl.h, 5, 70),
103
+ 400: this.hslToHex(hsl.h, 5, 60),
104
+ 500: baseColor, // Keep original base color
105
+ 600: this.hslToHex(hsl.h, 5, 40),
106
+ 700: this.hslToHex(hsl.h, 5, 30),
107
+ 800: this.hslToHex(hsl.h, 5, 20),
108
+ 900: this.hslToHex(hsl.h, 5, 10)
106
109
  };
107
110
  }
108
111
 
109
112
  /**
110
113
  * Check color contrast for accessibility
111
114
  */
112
- static checkColorContrast(foreground, background)= this.calculateContrastRatio(foreground, background);
115
+ static checkColorContrast(foreground: string, background: string): ColorAccessibility {
116
+ const ratio = this.calculateContrastRatio(foreground, background);
113
117
 
114
118
  const aa = ratio >= 4.5; // WCAG AA standard for normal text
115
119
  const aaa = ratio >= 7; // WCAG AAA standard for normal text
116
120
 
117
- const recommendations] = [];
121
+ const recommendations: string[] = [];
118
122
  if (!aa) {
119
- recommendations.push('Increase contrast to meet WCAG AA standards (4.5)');
123
+ recommendations.push('Increase contrast to meet WCAG AA standards (4.5:1)');
120
124
  }
121
125
  if (!aaa) {
122
- recommendations.push('Increase contrast to meet WCAG AAA standards (7)');
126
+ recommendations.push('Increase contrast to meet WCAG AAA standards (7:1)');
123
127
  }
124
128
  if (ratio < 3) {
125
129
  recommendations.push('Consider using a different color combination for better readability');
@@ -128,14 +132,17 @@ export class ColorManager {
128
132
  return {
129
133
  aa,
130
134
  aaa,
131
- contrastRatio,
132
- recommended};
135
+ contrastRatio: ratio,
136
+ recommended: recommendations
137
+ };
133
138
  }
134
139
 
135
140
  /**
136
141
  * Validate color format
137
142
  */
138
- static isValidColor(color)]{6}|[A-Fa-f0-9]{3})$/.test(color)) {
143
+ static isValidColor(color: string): boolean {
144
+ // Check hex format
145
+ if (/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(color)) {
139
146
  return true;
140
147
  }
141
148
 
@@ -146,7 +153,7 @@ export class ColorManager {
146
153
  return parseInt(r) <= 255 && parseInt(g) <= 255 && parseInt(b) <= 255;
147
154
  }
148
155
 
149
- // Check hsl format with valid ranges (h, s, l)
156
+ // Check hsl format with valid ranges (h: 0-360, s: 0-100%, l: 0-100%)
150
157
  const hslMatch = color.match(/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$/);
151
158
  if (hslMatch) {
152
159
  const [, h, s, l] = hslMatch;
@@ -165,7 +172,7 @@ export class ColorManager {
165
172
  /**
166
173
  * Convert hex color to HSL
167
174
  */
168
- private static hexToHsl(hex); s; l} | null {
175
+ private static hexToHsl(hex: string): { h: number; s: number; l: number } | null {
169
176
  try {
170
177
  // Remove # if present
171
178
  hex = hex.replace('#', '');
@@ -191,23 +198,26 @@ export class ColorManager {
191
198
 
192
199
  if (max !== min) {
193
200
  const d = max - min;
194
- s = l > 0.5 ? d / (2 - max - min) );
201
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
195
202
 
196
203
  switch (max) {
197
- case r= (g - b) / d + (g < b ? 6 );
204
+ case r:
205
+ h = (g - b) / d + (g < b ? 6 : 0);
198
206
  break;
199
- case g= (b - r) / d + 2;
207
+ case g:
208
+ h = (b - r) / d + 2;
200
209
  break;
201
- case b= (r - g) / d + 4;
210
+ case b:
211
+ h = (r - g) / d + 4;
202
212
  break;
203
213
  }
204
214
  h /= 6;
205
215
  }
206
216
 
207
217
  return {
208
- h),
209
- s),
210
- l)
218
+ h: Math.round(h * 360),
219
+ s: Math.round(s * 100),
220
+ l: Math.round(l * 100)
211
221
  };
212
222
  } catch {
213
223
  return null;
@@ -217,11 +227,12 @@ export class ColorManager {
217
227
  /**
218
228
  * Convert HSL to hex color
219
229
  */
220
- private static hslToHex(h, s, l)= h / 360;
230
+ private static hslToHex(h: number, s: number, l: number): string {
231
+ h = h / 360;
221
232
  s = s / 100;
222
233
  l = l / 100;
223
234
 
224
- const hue2rgb = (p, q, t)=> {
235
+ const hue2rgb = (p: number, q: number, t: number): number => {
225
236
  if (t < 0) t += 1;
226
237
  if (t > 1) t -= 1;
227
238
  if (t < 1/6) return p + (q - p) * 6 * t;
@@ -230,21 +241,21 @@ export class ColorManager {
230
241
  return p;
231
242
  };
232
243
 
233
- let r, g, b;
244
+ let r: number, g: number, b: number;
234
245
 
235
246
  if (s === 0) {
236
247
  r = g = b = l;
237
248
  } else {
238
- const q = l < 0.5 ? l * (1 + s) ;
249
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
239
250
  const p = 2 * l - q;
240
251
  r = hue2rgb(p, q, h + 1/3);
241
252
  g = hue2rgb(p, q, h);
242
253
  b = hue2rgb(p, q, h - 1/3);
243
254
  }
244
255
 
245
- const toHex = (c)=> {
256
+ const toHex = (c: number): string => {
246
257
  const hex = Math.round(c * 255).toString(16);
247
- return hex.length === 1 ? '0' + hex ;
258
+ return hex.length === 1 ? '0' + hex : hex;
248
259
  };
249
260
 
250
261
  return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
@@ -254,10 +265,12 @@ export class ColorManager {
254
265
  * Adjust HSL values
255
266
  */
256
267
  private static adjustHsl(
257
- base; s; l},
258
- hShift,
259
- sAdjust,
260
- lValue)= (base.h + hShift) % 360;
268
+ base: { h: number; s: number; l: number },
269
+ hShift: number,
270
+ sAdjust: number,
271
+ lValue: number
272
+ ): string {
273
+ const h = (base.h + hShift) % 360;
261
274
  const s = Math.max(0, Math.min(100, base.s + sAdjust));
262
275
  const l = Math.max(0, Math.min(100, lValue));
263
276
 
@@ -267,7 +280,8 @@ export class ColorManager {
267
280
  /**
268
281
  * Calculate contrast ratio between two colors
269
282
  */
270
- private static calculateContrastRatio(color1, color2)= this.calculateLuminance(color1);
283
+ private static calculateContrastRatio(color1: string, color2: string): number {
284
+ const luminance1 = this.calculateLuminance(color1);
271
285
  const luminance2 = this.calculateLuminance(color2);
272
286
 
273
287
  const lighter = Math.max(luminance1, luminance2);
@@ -279,14 +293,15 @@ export class ColorManager {
279
293
  /**
280
294
  * Calculate relative luminance of a color
281
295
  */
282
- private static calculateLuminance(color)= this.hexToRgb(color);
296
+ private static calculateLuminance(color: string): number {
297
+ const rgb = this.hexToRgb(color);
283
298
  if (!rgb) return 0;
284
299
 
285
300
  const { r, g, b } = rgb;
286
301
 
287
302
  const [rs, gs, bs] = [r, g, b].map(c => {
288
303
  c = c / 255;
289
- return c <= 0.03928 ? c / 12.92 ) / 1.055, 2.4);
304
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
290
305
  });
291
306
 
292
307
  return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
@@ -295,7 +310,7 @@ export class ColorManager {
295
310
  /**
296
311
  * Convert hex to RGB
297
312
  */
298
- private static hexToRgb(hex); g; b} | null {
313
+ private static hexToRgb(hex: string): { r: number; g: number; b: number } | null {
299
314
  try {
300
315
  hex = hex.replace('#', '');
301
316
 
@@ -308,9 +323,9 @@ export class ColorManager {
308
323
  }
309
324
 
310
325
  return {
311
- r, 2), 16),
312
- g, 2), 16),
313
- b, 2), 16)
326
+ r: parseInt(hex.substr(0, 2), 16),
327
+ g: parseInt(hex.substr(2, 2), 16),
328
+ b: parseInt(hex.substr(4, 2), 16)
314
329
  };
315
330
  } catch {
316
331
  return null;
@@ -320,28 +335,31 @@ export class ColorManager {
320
335
  /**
321
336
  * Generate a high contrast color
322
337
  */
323
- private static generateContrastColor(baseColor)= this.hexToHsl(baseColor);
338
+ private static generateContrastColor(baseColor: string): string {
339
+ const hsl = this.hexToHsl(baseColor);
324
340
  if (!hsl) return '#000000';
325
341
 
326
342
  // Generate a contrasting color by shifting hue by 180 degrees
327
343
  const contrastHue = (hsl.h + 180) % 360;
328
344
 
329
345
  // Use high saturation and appropriate lightness for contrast
330
- return this.hslToHex(contrastHue, 80, hsl.l > 50 ? 20 );
346
+ return this.hslToHex(contrastHue, 80, hsl.l > 50 ? 20 : 80);
331
347
  }
332
348
 
333
349
  /**
334
350
  * Create a color palette with accessibility information
335
351
  */
336
352
  static createColorPalette(
337
- name,
338
- baseColor,
339
- description,
340
- tags] = []
341
- )= this.generateColorScale({
353
+ name: string,
354
+ baseColor: string,
355
+ description: string,
356
+ tags: string[] = []
357
+ ): ColorPalette {
358
+ const colors = this.generateColorScale({
342
359
  baseColor,
343
- generateShades,
344
- generateContrast});
360
+ generateShades: true,
361
+ generateContrast: true
362
+ });
345
363
 
346
364
  const accessibility = this.checkColorContrast(colors[500], '#ffffff');
347
365
 
@@ -350,8 +368,8 @@ export class ColorManager {
350
368
  description,
351
369
  colors,
352
370
  accessibility,
353
- usage, 'accent', 'brand'],
354
- tags, 'generated', 'accessible']
371
+ usage: ['primary', 'accent', 'brand'],
372
+ tags: [...tags, 'generated', 'accessible']
355
373
  };
356
374
  }
357
375
  }