@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.9 → 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
@@ -1,37 +1,46 @@
1
-
1
+ import type { ThemeTokens, TokenExportOptions } from './types';
2
2
 
3
3
  export class TokenExporter {
4
4
  /**
5
5
  * Exports tokens in the specified format
6
6
  */
7
- static exportTokens(tokens, options)) {
8
- case 'json', options);
9
- case 'css', options);
10
- case 'scss', options);
11
- case 'js', options);
12
- case 'ts', options);
13
- default}`);
7
+ static exportTokens(tokens: ThemeTokens, options: TokenExportOptions): string {
8
+ switch (options.format) {
9
+ case 'json':
10
+ return this.exportAsJSON(tokens, options);
11
+ case 'css':
12
+ return this.exportAsCSS(tokens, options);
13
+ case 'scss':
14
+ return this.exportAsSCSS(tokens, options);
15
+ case 'js':
16
+ return this.exportAsJS(tokens, options);
17
+ case 'ts':
18
+ return this.exportAsTS(tokens, options);
19
+ default:
20
+ throw new Error(`Unsupported export format: ${options.format}`);
14
21
  }
15
22
  }
16
23
 
17
24
  /**
18
25
  * Exports tokens as JSON
19
26
  */
20
- private static exportAsJSON(tokens, options)= options.includeMetadata ? tokens ;
27
+ private static exportAsJSON(tokens: ThemeTokens, options: TokenExportOptions): string {
28
+ const exportData = options.includeMetadata ? tokens : tokens.tokens;
21
29
  return JSON.stringify(exportData, null, 2);
22
30
  }
23
31
 
24
32
  /**
25
33
  * Exports tokens as CSS custom properties
26
34
  */
27
- private static exportAsCSS(tokens, options)= '';
35
+ private static exportAsCSS(tokens: ThemeTokens, options: TokenExportOptions): string {
36
+ let css = '';
28
37
 
29
38
  if (options.includeComments) {
30
39
  css += `/* ${tokens.theme} Design Tokens - v${tokens.version} */\n`;
31
- css += `/* Generated on).toISOString()} */\n\n`;
40
+ css += `/* Generated on: ${new Date().toISOString()} */\n\n`;
32
41
  }
33
42
 
34
- css += `;
43
+ css += `:root {\n`;
35
44
 
36
45
  // Export color tokens
37
46
  if (tokens.tokens.color) {
@@ -70,18 +79,19 @@ export class TokenExporter {
70
79
  /**
71
80
  * Exports color tokens as CSS custom properties
72
81
  */
73
- private static exportColorTokensAsCSS(colorTokens, indent)= '';
82
+ private static exportColorTokensAsCSS(colorTokens: any, indent: number): string {
83
+ let css = '';
74
84
  const spaces = ' '.repeat(indent);
75
85
 
76
- Object.entries(colorTokens).forEach(([category, categoryTokens], any]) => {
86
+ Object.entries(colorTokens).forEach(([category, categoryTokens]: [string, any]) => {
77
87
  if (typeof categoryTokens === 'object' && categoryTokens.value) {
78
88
  // Single token
79
- css += `${spaces}--color-${category}};\n`;
89
+ css += `${spaces}--color-${category}: ${categoryTokens.value};\n`;
80
90
  } else if (typeof categoryTokens === 'object') {
81
91
  // Token group
82
- Object.entries(categoryTokens).forEach(([shade, token], any]) => {
92
+ Object.entries(categoryTokens).forEach(([shade, token]: [string, any]) => {
83
93
  if (token && typeof token === 'object' && token.value) {
84
- css += `${spaces}--color-${category}-${shade}};\n`;
94
+ css += `${spaces}--color-${category}-${shade}: ${token.value};\n`;
85
95
  }
86
96
  });
87
97
  }
@@ -93,13 +103,14 @@ export class TokenExporter {
93
103
  /**
94
104
  * Exports font tokens as CSS custom properties
95
105
  */
96
- private static exportFontTokensAsCSS(fontTokens, indent)= '';
106
+ private static exportFontTokensAsCSS(fontTokens: any, indent: number): string {
107
+ let css = '';
97
108
  const spaces = ' '.repeat(indent);
98
109
 
99
- Object.entries(fontTokens).forEach(([name, token], any]) => {
110
+ Object.entries(fontTokens).forEach(([name, token]: [string, any]) => {
100
111
  if (token && typeof token === 'object' && token.value) {
101
112
  const cssVarName = this.getFontCSSVarName(name, token.type);
102
- css += `${spaces}--font-${cssVarName}};\n`;
113
+ css += `${spaces}--font-${cssVarName}: ${token.value};\n`;
103
114
  }
104
115
  });
105
116
 
@@ -109,7 +120,8 @@ export class TokenExporter {
109
120
  /**
110
121
  * Gets the CSS variable name for font tokens
111
122
  */
112
- private static getFontCSSVarName(name, type)=== 'fontFamily') {
123
+ private static getFontCSSVarName(name: string, type: string): string {
124
+ if (type === 'fontFamily') {
113
125
  return name;
114
126
  }
115
127
  if (type === 'fontSize') {
@@ -127,12 +139,13 @@ export class TokenExporter {
127
139
  /**
128
140
  * Exports spacing tokens as CSS custom properties
129
141
  */
130
- private static exportSpacingTokensAsCSS(spacingTokens, indent)= '';
142
+ private static exportSpacingTokensAsCSS(spacingTokens: any, indent: number): string {
143
+ let css = '';
131
144
  const spaces = ' '.repeat(indent);
132
145
 
133
- Object.entries(spacingTokens).forEach(([scale, token], any]) => {
146
+ Object.entries(spacingTokens).forEach(([scale, token]: [string, any]) => {
134
147
  if (token && typeof token === 'object' && token.value) {
135
- css += `${spaces}--spacing-${scale}}px;\n`;
148
+ css += `${spaces}--spacing-${scale}: ${token.value}px;\n`;
136
149
  }
137
150
  });
138
151
 
@@ -142,12 +155,13 @@ export class TokenExporter {
142
155
  /**
143
156
  * Exports shadow tokens as CSS custom properties
144
157
  */
145
- private static exportShadowTokensAsCSS(shadowTokens, indent)= '';
158
+ private static exportShadowTokensAsCSS(shadowTokens: any, indent: number): string {
159
+ let css = '';
146
160
  const spaces = ' '.repeat(indent);
147
161
 
148
- Object.entries(shadowTokens).forEach(([elevation, token], any]) => {
162
+ Object.entries(shadowTokens).forEach(([elevation, token]: [string, any]) => {
149
163
  if (token && typeof token === 'object' && token.value) {
150
- css += `${spaces}--shadow-${elevation}};\n`;
164
+ css += `${spaces}--shadow-${elevation}: ${token.value};\n`;
151
165
  }
152
166
  });
153
167
 
@@ -157,12 +171,13 @@ export class TokenExporter {
157
171
  /**
158
172
  * Exports transition tokens as CSS custom properties
159
173
  */
160
- private static exportTransitionTokensAsCSS(transitionTokens, indent)= '';
174
+ private static exportTransitionTokensAsCSS(transitionTokens: any, indent: number): string {
175
+ let css = '';
161
176
  const spaces = ' '.repeat(indent);
162
177
 
163
- Object.entries(transitionTokens).forEach(([name, token], any]) => {
178
+ Object.entries(transitionTokens).forEach(([name, token]: [string, any]) => {
164
179
  if (token && typeof token === 'object' && token.value) {
165
- css += `${spaces}--transition-${name}};\n`;
180
+ css += `${spaces}--transition-${name}: ${token.value};\n`;
166
181
  }
167
182
  });
168
183
 
@@ -172,12 +187,13 @@ export class TokenExporter {
172
187
  /**
173
188
  * Exports breakpoint tokens as CSS custom properties
174
189
  */
175
- private static exportBreakpointTokensAsCSS(breakpointTokens, indent)= '';
190
+ private static exportBreakpointTokensAsCSS(breakpointTokens: any, indent: number): string {
191
+ let css = '';
176
192
  const spaces = ' '.repeat(indent);
177
193
 
178
- Object.entries(breakpointTokens).forEach(([name, token], any]) => {
194
+ Object.entries(breakpointTokens).forEach(([name, token]: [string, any]) => {
179
195
  if (token && typeof token === 'object' && token.value) {
180
- css += `${spaces}--breakpoint-${name}}px;\n`;
196
+ css += `${spaces}--breakpoint-${name}: ${token.value}px;\n`;
181
197
  }
182
198
  });
183
199
 
@@ -187,11 +203,12 @@ export class TokenExporter {
187
203
  /**
188
204
  * Exports tokens as SCSS variables
189
205
  */
190
- private static exportAsSCSS(tokens, options)= '';
206
+ private static exportAsSCSS(tokens: ThemeTokens, options: TokenExportOptions): string {
207
+ let scss = '';
191
208
 
192
209
  if (options.includeComments) {
193
210
  scss += `// ${tokens.theme} Design Tokens - v${tokens.version}\n`;
194
- scss += `// Generated on).toISOString()}\n\n`;
211
+ scss += `// Generated on: ${new Date().toISOString()}\n\n`;
195
212
  }
196
213
 
197
214
  // Export color tokens
@@ -230,17 +247,18 @@ export class TokenExporter {
230
247
  /**
231
248
  * Exports color tokens as SCSS variables
232
249
  */
233
- private static exportColorTokensAsSCSS(colorTokens)= '\n// Color Tokens\n';
250
+ private static exportColorTokensAsSCSS(colorTokens: any): string {
251
+ let scss = '\n// Color Tokens\n';
234
252
 
235
- Object.entries(colorTokens).forEach(([category, categoryTokens], any]) => {
253
+ Object.entries(colorTokens).forEach(([category, categoryTokens]: [string, any]) => {
236
254
  if (typeof categoryTokens === 'object' && categoryTokens.value) {
237
255
  // Single token
238
- scss += `$color-${category}};\n`;
256
+ scss += `$color-${category}: ${categoryTokens.value};\n`;
239
257
  } else if (typeof categoryTokens === 'object') {
240
258
  // Token group
241
- Object.entries(categoryTokens).forEach(([shade, token], any]) => {
259
+ Object.entries(categoryTokens).forEach(([shade, token]: [string, any]) => {
242
260
  if (token && typeof token === 'object' && token.value) {
243
- scss += `$color-${category}-${shade}};\n`;
261
+ scss += `$color-${category}-${shade}: ${token.value};\n`;
244
262
  }
245
263
  });
246
264
  }
@@ -252,12 +270,13 @@ export class TokenExporter {
252
270
  /**
253
271
  * Exports font tokens as SCSS variables
254
272
  */
255
- private static exportFontTokensAsSCSS(fontTokens)= '\n// Font Tokens\n';
273
+ private static exportFontTokensAsSCSS(fontTokens: any): string {
274
+ let scss = '\n// Font Tokens\n';
256
275
 
257
- Object.entries(fontTokens).forEach(([name, token], any]) => {
276
+ Object.entries(fontTokens).forEach(([name, token]: [string, any]) => {
258
277
  if (token && typeof token === 'object' && token.value) {
259
278
  const scssVarName = this.getFontSCSSVarName(name, token.type);
260
- scss += `$font-${scssVarName}};\n`;
279
+ scss += `$font-${scssVarName}: ${token.value};\n`;
261
280
  }
262
281
  });
263
282
 
@@ -267,7 +286,8 @@ export class TokenExporter {
267
286
  /**
268
287
  * Gets the SCSS variable name for font tokens
269
288
  */
270
- private static getFontSCSSVarName(name, type)=== 'fontFamily') {
289
+ private static getFontSCSSVarName(name: string, type: string): string {
290
+ if (type === 'fontFamily') {
271
291
  return name;
272
292
  }
273
293
  if (type === 'fontSize') {
@@ -285,11 +305,12 @@ export class TokenExporter {
285
305
  /**
286
306
  * Exports spacing tokens as SCSS variables
287
307
  */
288
- private static exportSpacingTokensAsSCSS(spacingTokens)= '\n// Spacing Tokens\n';
308
+ private static exportSpacingTokensAsSCSS(spacingTokens: any): string {
309
+ let scss = '\n// Spacing Tokens\n';
289
310
 
290
- Object.entries(spacingTokens).forEach(([scale, token], any]) => {
311
+ Object.entries(spacingTokens).forEach(([scale, token]: [string, any]) => {
291
312
  if (token && typeof token === 'object' && token.value) {
292
- scss += `$spacing-${scale}}px;\n`;
313
+ scss += `$spacing-${scale}: ${token.value}px;\n`;
293
314
  }
294
315
  });
295
316
 
@@ -299,11 +320,12 @@ export class TokenExporter {
299
320
  /**
300
321
  * Exports shadow tokens as SCSS variables
301
322
  */
302
- private static exportShadowTokensAsSCSS(shadowTokens)= '\n// Shadow Tokens\n';
323
+ private static exportShadowTokensAsSCSS(shadowTokens: any): string {
324
+ let scss = '\n// Shadow Tokens\n';
303
325
 
304
- Object.entries(shadowTokens).forEach(([elevation, token], any]) => {
326
+ Object.entries(shadowTokens).forEach(([elevation, token]: [string, any]) => {
305
327
  if (token && typeof token === 'object' && token.value) {
306
- scss += `$shadow-${elevation}};\n`;
328
+ scss += `$shadow-${elevation}: ${token.value};\n`;
307
329
  }
308
330
  });
309
331
 
@@ -313,11 +335,12 @@ export class TokenExporter {
313
335
  /**
314
336
  * Exports transition tokens as SCSS variables
315
337
  */
316
- private static exportTransitionTokensAsSCSS(transitionTokens)= '\n// Transition Tokens\n';
338
+ private static exportTransitionTokensAsSCSS(transitionTokens: any): string {
339
+ let scss = '\n// Transition Tokens\n';
317
340
 
318
- Object.entries(transitionTokens).forEach(([name, token], any]) => {
341
+ Object.entries(transitionTokens).forEach(([name, token]: [string, any]) => {
319
342
  if (token && typeof token === 'object' && token.value) {
320
- scss += `$transition-${name}};\n`;
343
+ scss += `$transition-${name}: ${token.value};\n`;
321
344
  }
322
345
  });
323
346
 
@@ -327,11 +350,12 @@ export class TokenExporter {
327
350
  /**
328
351
  * Exports breakpoint tokens as SCSS variables
329
352
  */
330
- private static exportBreakpointTokensAsSCSS(breakpointTokens)= '\n// Breakpoint Tokens\n';
353
+ private static exportBreakpointTokensAsSCSS(breakpointTokens: any): string {
354
+ let scss = '\n// Breakpoint Tokens\n';
331
355
 
332
- Object.entries(breakpointTokens).forEach(([name, token], any]) => {
356
+ Object.entries(breakpointTokens).forEach(([name, token]: [string, any]) => {
333
357
  if (token && typeof token === 'object' && token.value) {
334
- scss += `$breakpoint-${name}}px;\n`;
358
+ scss += `$breakpoint-${name}: ${token.value}px;\n`;
335
359
  }
336
360
  });
337
361
 
@@ -341,12 +365,13 @@ export class TokenExporter {
341
365
  /**
342
366
  * Exports tokens as JavaScript object
343
367
  */
344
- private static exportAsJS(tokens, options)= options.includeMetadata ? tokens ;
368
+ private static exportAsJS(tokens: ThemeTokens, options: TokenExportOptions): string {
369
+ const exportData = options.includeMetadata ? tokens : tokens.tokens;
345
370
  let js = '';
346
371
 
347
372
  if (options.includeComments) {
348
373
  js += `// ${tokens.theme} Design Tokens - v${tokens.version}\n`;
349
- js += `// Generated on).toISOString()}\n\n`;
374
+ js += `// Generated on: ${new Date().toISOString()}\n\n`;
350
375
  }
351
376
 
352
377
  js += `module.exports = ${JSON.stringify(exportData, null, 2)};\n`;
@@ -356,16 +381,17 @@ export class TokenExporter {
356
381
  /**
357
382
  * Exports tokens as TypeScript object
358
383
  */
359
- private static exportAsTS(tokens, options)= options.includeMetadata ? tokens ;
384
+ private static exportAsTS(tokens: ThemeTokens, options: TokenExportOptions): string {
385
+ const exportData = options.includeMetadata ? tokens : tokens.tokens;
360
386
  let ts = '';
361
387
 
362
388
  if (options.includeComments) {
363
389
  ts += `// ${tokens.theme} Design Tokens - v${tokens.version}\n`;
364
- ts += `// Generated on).toISOString()}\n\n`;
390
+ ts += `// Generated on: ${new Date().toISOString()}\n\n`;
365
391
  }
366
392
 
367
393
  ts += `export const tokens = ${JSON.stringify(exportData, null, 2)} as const;\n`;
368
- ts += `\n`;
394
+ ts += `export type Tokens = typeof tokens;\n`;
369
395
  return ts;
370
396
  }
371
397
  }
@@ -1,17 +1,20 @@
1
-
2
-
1
+ import type { CompleteThemeConfig } from '../themes/types';
2
+ import type { ThemeTokens, TokenGroup, ColorToken, FontToken, SpacingToken, ShadowToken, TransitionToken } from './types';
3
3
 
4
4
  export class TokenGenerator {
5
5
  /**
6
6
  * Generates design tokens from a complete theme configuration
7
7
  */
8
- static generateTokens(themeConfig),
9
- version,
10
- tokens),
11
- font),
12
- spacing),
13
- shadow),
14
- transition)
8
+ static generateTokens(themeConfig: CompleteThemeConfig): ThemeTokens {
9
+ return {
10
+ theme: themeConfig.meta.name,
11
+ version: themeConfig.meta.version || '1.0.0',
12
+ tokens: {
13
+ color: this.generateColorTokens(themeConfig.colors),
14
+ font: this.generateFontTokens(themeConfig.fonts),
15
+ spacing: this.generateSpacingTokens(themeConfig.spacing),
16
+ shadow: this.generateShadowTokens(themeConfig.shadows),
17
+ transition: this.generateTransitionTokens(themeConfig.transitions)
15
18
  }
16
19
  };
17
20
  }
@@ -19,7 +22,8 @@ export class TokenGenerator {
19
22
  /**
20
23
  * Generates color tokens from theme colors
21
24
  */
22
- private static generateColorTokens(colors])= {};
25
+ private static generateColorTokens(colors: CompleteThemeConfig['colors']): TokenGroup {
26
+ const colorTokens: TokenGroup = {};
23
27
 
24
28
  // Primary colors
25
29
  if (colors.primary) {
@@ -62,17 +66,18 @@ export class TokenGenerator {
62
66
  /**
63
67
  * Creates a color group from a color scale
64
68
  */
65
- private static createColorGroup(colorScale, semantic])= {};
69
+ private static createColorGroup(colorScale: any, semantic: ColorToken['semantic']): TokenGroup {
70
+ const group: TokenGroup = {};
66
71
 
67
72
  Object.entries(colorScale).forEach(([shade, value]) => {
68
73
  if (typeof value === 'string') {
69
74
  group[shade] = {
70
75
  value,
71
- type,
76
+ type: 'color',
72
77
  semantic,
73
- description} color - ${shade} shade`,
74
- category,
75
- tags, shade]
78
+ description: `${semantic} color - ${shade} shade`,
79
+ category: 'color',
80
+ tags: [semantic, shade]
76
81
  } as ColorToken;
77
82
  }
78
83
  });
@@ -83,56 +88,57 @@ export class TokenGenerator {
83
88
  /**
84
89
  * Generates font tokens from theme fonts
85
90
  */
86
- private static generateFontTokens(fonts])= {};
91
+ private static generateFontTokens(fonts: CompleteThemeConfig['fonts']): TokenGroup {
92
+ const fontTokens: TokenGroup = {};
87
93
 
88
94
  // Font families
89
95
  if (fonts.primary) {
90
96
  fontTokens.primary = {
91
- value,
92
- type,
93
- description,
94
- category,
95
- tags, 'font']
97
+ value: fonts.primary.family,
98
+ type: 'fontFamily',
99
+ description: 'Primary font family',
100
+ category: 'typography',
101
+ tags: ['primary', 'font']
96
102
  } as FontToken;
97
103
  }
98
104
 
99
105
  if (fonts.secondary) {
100
106
  fontTokens.secondary = {
101
- value,
102
- type,
103
- description,
104
- category,
105
- tags, 'font']
107
+ value: fonts.secondary.family,
108
+ type: 'fontFamily',
109
+ description: 'Secondary font family',
110
+ category: 'typography',
111
+ tags: ['secondary', 'font']
106
112
  } as FontToken;
107
113
  }
108
114
 
109
115
  if (fonts.display) {
110
116
  fontTokens.display = {
111
- value,
112
- type,
113
- description,
114
- category,
115
- tags, 'font']
117
+ value: fonts.display.family,
118
+ type: 'fontFamily',
119
+ description: 'Display font family',
120
+ category: 'typography',
121
+ tags: ['display', 'font']
116
122
  } as FontToken;
117
123
  }
118
124
 
119
125
  if (fonts.body) {
120
126
  fontTokens.body = {
121
- value,
122
- type,
123
- description,
124
- category,
125
- tags, 'font']
127
+ value: fonts.body.family,
128
+ type: 'fontFamily',
129
+ description: 'Body font family',
130
+ category: 'typography',
131
+ tags: ['body', 'font']
126
132
  } as FontToken;
127
133
  }
128
134
 
129
135
  if (fonts.mono) {
130
136
  fontTokens.mono = {
131
- value,
132
- type,
133
- description,
134
- category,
135
- tags, 'font']
137
+ value: fonts.mono.family,
138
+ type: 'fontFamily',
139
+ description: 'Monospace font family',
140
+ category: 'typography',
141
+ tags: ['mono', 'font']
136
142
  } as FontToken;
137
143
  }
138
144
 
@@ -141,10 +147,10 @@ export class TokenGenerator {
141
147
  Object.entries(fonts.primary.sizes).forEach(([size, value]) => {
142
148
  fontTokens[`size-${size}`] = {
143
149
  value,
144
- type,
145
- description}`,
146
- category,
147
- tags, 'size', size]
150
+ type: 'fontSize',
151
+ description: `Font size - ${size}`,
152
+ category: 'typography',
153
+ tags: ['font', 'size', size]
148
154
  } as FontToken;
149
155
  });
150
156
  }
@@ -153,11 +159,11 @@ export class TokenGenerator {
153
159
  if (fonts.primary?.weights) {
154
160
  fonts.primary.weights.forEach((weight, index) => {
155
161
  fontTokens[`weight-${index}`] = {
156
- value,
157
- type,
158
- description}`,
159
- category,
160
- tags, 'weight', weight.toString()]
162
+ value: weight,
163
+ type: 'fontWeight',
164
+ description: `Font weight - ${weight}`,
165
+ category: 'typography',
166
+ tags: ['font', 'weight', weight.toString()]
161
167
  } as FontToken;
162
168
  });
163
169
  }
@@ -167,10 +173,10 @@ export class TokenGenerator {
167
173
  Object.entries(fonts.primary.lineHeights).forEach(([height, value]) => {
168
174
  fontTokens[`line-height-${height}`] = {
169
175
  value,
170
- type,
171
- description}`,
172
- category,
173
- tags, 'line-height', height]
176
+ type: 'lineHeight',
177
+ description: `Line height - ${height}`,
178
+ category: 'typography',
179
+ tags: ['font', 'line-height', height]
174
180
  } as FontToken;
175
181
  });
176
182
  }
@@ -180,10 +186,10 @@ export class TokenGenerator {
180
186
  Object.entries(fonts.primary.letterSpacing).forEach(([spacing, value]) => {
181
187
  fontTokens[`letter-spacing-${spacing}`] = {
182
188
  value,
183
- type,
184
- description}`,
185
- category,
186
- tags, 'letter-spacing', spacing]
189
+ type: 'letterSpacing',
190
+ description: `Letter spacing - ${spacing}`,
191
+ category: 'typography',
192
+ tags: ['font', 'letter-spacing', spacing]
187
193
  } as FontToken;
188
194
  });
189
195
  }
@@ -194,17 +200,18 @@ export class TokenGenerator {
194
200
  /**
195
201
  * Generates spacing tokens from theme spacing
196
202
  */
197
- private static generateSpacingTokens(spacing])= {};
203
+ private static generateSpacingTokens(spacing: CompleteThemeConfig['spacing']): TokenGroup {
204
+ const spacingTokens: TokenGroup = {};
198
205
 
199
206
  if (spacing) {
200
207
  Object.entries(spacing).forEach(([scale, value]) => {
201
208
  spacingTokens[scale] = {
202
209
  value,
203
- type,
204
- unit,
205
- description}`,
206
- category,
207
- tags, 'layout', scale]
210
+ type: 'spacing',
211
+ unit: 'px',
212
+ description: `Spacing scale - ${scale}`,
213
+ category: 'layout',
214
+ tags: ['spacing', 'layout', scale]
208
215
  } as SpacingToken;
209
216
  });
210
217
  }
@@ -215,17 +222,18 @@ export class TokenGenerator {
215
222
  /**
216
223
  * Generates shadow tokens from theme shadows
217
224
  */
218
- private static generateShadowTokens(shadows])= {};
225
+ private static generateShadowTokens(shadows: CompleteThemeConfig['shadows']): TokenGroup {
226
+ const shadowTokens: TokenGroup = {};
219
227
 
220
228
  if (shadows) {
221
229
  Object.entries(shadows).forEach(([elevation, value]) => {
222
230
  shadowTokens[elevation] = {
223
231
  value,
224
- type,
225
- elevation,
226
- description} elevation`,
227
- category,
228
- tags, 'elevation', elevation]
232
+ type: 'shadow',
233
+ elevation: elevation as 'low' | 'medium' | 'high',
234
+ description: `Shadow - ${elevation} elevation`,
235
+ category: 'effects',
236
+ tags: ['shadow', 'elevation', elevation]
229
237
  } as ShadowToken;
230
238
  });
231
239
  }
@@ -236,17 +244,18 @@ export class TokenGenerator {
236
244
  /**
237
245
  * Generates transition tokens from theme transitions
238
246
  */
239
- private static generateTransitionTokens(transitions])= {};
247
+ private static generateTransitionTokens(transitions: CompleteThemeConfig['transitions']): TokenGroup {
248
+ const transitionTokens: TokenGroup = {};
240
249
 
241
250
  if (transitions) {
242
251
  Object.entries(transitions).forEach(([name, value]) => {
243
252
  transitionTokens[name] = {
244
253
  value,
245
- type,
246
- easing),
247
- description}`,
248
- category,
249
- tags, 'animation', name]
254
+ type: 'transition',
255
+ easing: this.detectEasing(value),
256
+ description: `Transition - ${name}`,
257
+ category: 'animation',
258
+ tags: ['transition', 'animation', name]
250
259
  } as TransitionToken;
251
260
  });
252
261
  }
@@ -257,7 +266,7 @@ export class TokenGenerator {
257
266
  /**
258
267
  * Detects easing function from transition value
259
268
  */
260
- private static detectEasing(transition)] {
269
+ private static detectEasing(transition: string): TransitionToken['easing'] {
261
270
  if (transition.includes('ease-in-out')) return 'ease-in-out';
262
271
  if (transition.includes('ease-in')) return 'ease-in';
263
272
  if (transition.includes('ease-out')) return 'ease-out';