@shohojdhara/atomix 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/atomix.config.ts +58 -1
  2. package/dist/atomix.css +148 -120
  3. package/dist/atomix.css.map +1 -1
  4. package/dist/atomix.min.css +1 -1
  5. package/dist/atomix.min.css.map +1 -1
  6. package/dist/charts.d.ts +33 -0
  7. package/dist/charts.js +1227 -122
  8. package/dist/charts.js.map +1 -1
  9. package/dist/core.d.ts +33 -10
  10. package/dist/core.js +1052 -41
  11. package/dist/core.js.map +1 -1
  12. package/dist/forms.d.ts +33 -0
  13. package/dist/forms.js +2086 -1035
  14. package/dist/forms.js.map +1 -1
  15. package/dist/heavy.d.ts +42 -1
  16. package/dist/heavy.js +1620 -600
  17. package/dist/heavy.js.map +1 -1
  18. package/dist/index.d.ts +441 -270
  19. package/dist/index.esm.js +1900 -638
  20. package/dist/index.esm.js.map +1 -1
  21. package/dist/index.js +1935 -670
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.min.js +1 -1
  24. package/dist/index.min.js.map +1 -1
  25. package/package.json +6 -3
  26. package/scripts/atomix-cli.js +148 -4
  27. package/scripts/cli/__tests__/basic.test.js +3 -2
  28. package/scripts/cli/__tests__/clean.test.js +278 -0
  29. package/scripts/cli/__tests__/component-validator.test.js +433 -0
  30. package/scripts/cli/__tests__/generator.test.js +613 -0
  31. package/scripts/cli/__tests__/glass-motion.test.js +256 -0
  32. package/scripts/cli/__tests__/integration.test.js +719 -108
  33. package/scripts/cli/__tests__/migrate.test.js +74 -0
  34. package/scripts/cli/__tests__/security.test.js +206 -0
  35. package/scripts/cli/__tests__/test-setup.js +3 -1
  36. package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
  37. package/scripts/cli/__tests__/token-provider.test.js +361 -0
  38. package/scripts/cli/__tests__/utils.test.js +5 -5
  39. package/scripts/cli/commands/benchmark.js +105 -0
  40. package/scripts/cli/commands/build-theme.js +4 -1
  41. package/scripts/cli/commands/clean.js +109 -0
  42. package/scripts/cli/commands/doctor.js +88 -0
  43. package/scripts/cli/commands/generate.js +135 -14
  44. package/scripts/cli/commands/init.js +45 -18
  45. package/scripts/cli/commands/migrate.js +106 -0
  46. package/scripts/cli/commands/sync-tokens.js +206 -0
  47. package/scripts/cli/commands/theme-bridge.js +248 -0
  48. package/scripts/cli/commands/tokens.js +157 -0
  49. package/scripts/cli/commands/validate.js +194 -0
  50. package/scripts/cli/internal/ai-engine.js +156 -0
  51. package/scripts/cli/internal/component-validator.js +443 -0
  52. package/scripts/cli/internal/config-loader.js +162 -0
  53. package/scripts/cli/internal/filesystem.js +102 -2
  54. package/scripts/cli/internal/generator.js +359 -39
  55. package/scripts/cli/internal/glass-generator.js +398 -0
  56. package/scripts/cli/internal/hook-generator.js +369 -0
  57. package/scripts/cli/internal/hooks.js +61 -0
  58. package/scripts/cli/internal/itcss-generator.js +565 -0
  59. package/scripts/cli/internal/motion-generator.js +679 -0
  60. package/scripts/cli/internal/template-engine.js +301 -0
  61. package/scripts/cli/internal/theme-bridge.js +664 -0
  62. package/scripts/cli/internal/tokens/engine.js +122 -0
  63. package/scripts/cli/internal/tokens/provider.js +34 -0
  64. package/scripts/cli/internal/tokens/providers/figma.js +50 -0
  65. package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
  66. package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
  67. package/scripts/cli/internal/tokens/token-provider.js +443 -0
  68. package/scripts/cli/internal/tokens/token-validator.js +513 -0
  69. package/scripts/cli/internal/validator.js +276 -0
  70. package/scripts/cli/internal/wizard.js +60 -6
  71. package/scripts/cli/mappings.js +23 -0
  72. package/scripts/cli/migration-tools.js +164 -94
  73. package/scripts/cli/plugins/style-dictionary.js +46 -0
  74. package/scripts/cli/templates/README.md +525 -95
  75. package/scripts/cli/templates/common-templates.js +40 -14
  76. package/scripts/cli/templates/components/react-component.ts +282 -0
  77. package/scripts/cli/templates/config/project-config.ts +112 -0
  78. package/scripts/cli/templates/hooks/use-component.ts +477 -0
  79. package/scripts/cli/templates/index.js +19 -4
  80. package/scripts/cli/templates/index.ts +171 -0
  81. package/scripts/cli/templates/next-templates.js +72 -0
  82. package/scripts/cli/templates/react-templates.js +70 -126
  83. package/scripts/cli/templates/scss-templates.js +35 -35
  84. package/scripts/cli/templates/stories/storybook-story.ts +241 -0
  85. package/scripts/cli/templates/styles/scss-component.ts +255 -0
  86. package/scripts/cli/templates/tests/vitest-test.ts +229 -0
  87. package/scripts/cli/templates/token-templates.js +337 -1
  88. package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
  89. package/scripts/cli/templates/types/component-types.ts +145 -0
  90. package/scripts/cli/templates/utils/testing-utils.ts +144 -0
  91. package/scripts/cli/templates/vanilla-templates.js +39 -0
  92. package/scripts/cli/token-manager.js +8 -2
  93. package/scripts/cli/utils/cache-manager.js +240 -0
  94. package/scripts/cli/utils/detector.js +46 -0
  95. package/scripts/cli/utils/diagnostics.js +289 -0
  96. package/scripts/cli/utils/error.js +45 -3
  97. package/scripts/cli/utils/helpers.js +24 -0
  98. package/scripts/cli/utils/logger.js +1 -1
  99. package/scripts/cli/utils/security.js +302 -0
  100. package/scripts/cli/utils/telemetry.js +115 -0
  101. package/scripts/cli/utils/validation.js +4 -38
  102. package/scripts/cli/utils.js +46 -0
  103. package/src/components/Accordion/Accordion.stories.tsx +0 -18
  104. package/src/components/Accordion/Accordion.test.tsx +0 -17
  105. package/src/components/Accordion/Accordion.tsx +0 -4
  106. package/src/components/AtomixGlass/AtomixGlass.tsx +102 -2
  107. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +125 -12
  108. package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
  109. package/src/components/AtomixGlass/README.md +25 -10
  110. package/src/components/AtomixGlass/animation-system.ts +578 -0
  111. package/src/components/AtomixGlass/shader-utils.ts +3 -0
  112. package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +653 -0
  113. package/src/components/AtomixGlass/stories/AnimationTests.stories.tsx +95 -0
  114. package/src/components/AtomixGlass/stories/CardExamples.stories.tsx +212 -0
  115. package/src/components/AtomixGlass/stories/DashboardExamples.stories.tsx +348 -0
  116. package/src/components/AtomixGlass/stories/EcommerceExamples.stories.tsx +410 -0
  117. package/src/components/AtomixGlass/stories/FormExamples.stories.tsx +436 -0
  118. package/src/components/AtomixGlass/stories/HeroExamples.stories.tsx +264 -0
  119. package/src/components/AtomixGlass/stories/InteractivePlayground.stories.tsx +247 -0
  120. package/src/components/AtomixGlass/stories/MobileUIExamples.stories.tsx +418 -0
  121. package/src/components/AtomixGlass/stories/ModalExamples.stories.tsx +402 -0
  122. package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
  123. package/src/components/AtomixGlass/stories/Playground.stories.tsx +658 -93
  124. package/src/components/AtomixGlass/stories/PresetGallery.stories.tsx +335 -0
  125. package/src/components/AtomixGlass/stories/WidgetExamples.stories.tsx +441 -0
  126. package/src/components/AtomixGlass/stories/argTypes.ts +384 -0
  127. package/src/components/AtomixGlass/stories/shared-components.tsx +91 -1
  128. package/src/components/AtomixGlass/stories/types.ts +127 -0
  129. package/src/components/Avatar/Avatar.tsx +1 -1
  130. package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
  131. package/src/components/Button/Button.stories.tsx +10 -0
  132. package/src/components/Button/Button.test.tsx +16 -11
  133. package/src/components/Button/Button.tsx +4 -4
  134. package/src/components/Card/Card.tsx +1 -1
  135. package/src/components/Dropdown/Dropdown.tsx +12 -12
  136. package/src/components/Form/Select.tsx +62 -3
  137. package/src/components/Modal/Modal.tsx +14 -3
  138. package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
  139. package/src/components/Slider/Slider.stories.tsx +3 -3
  140. package/src/components/Slider/Slider.tsx +38 -0
  141. package/src/components/Steps/Steps.tsx +3 -3
  142. package/src/components/Tabs/Tabs.tsx +77 -8
  143. package/src/components/Testimonial/Testimonial.tsx +1 -1
  144. package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
  145. package/src/components/TypedButton/TypedButton.tsx +39 -0
  146. package/src/components/TypedButton/index.ts +2 -0
  147. package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
  148. package/src/lib/composables/index.ts +4 -7
  149. package/src/lib/composables/types.ts +45 -0
  150. package/src/lib/composables/useAccordion.ts +0 -7
  151. package/src/lib/composables/useAtomixGlass.ts +144 -5
  152. package/src/lib/composables/useChartExport.ts +3 -13
  153. package/src/lib/composables/useDropdown.ts +66 -0
  154. package/src/lib/composables/useFocusTrap.ts +80 -0
  155. package/src/lib/composables/usePerformanceMonitor.ts +448 -0
  156. package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
  157. package/src/lib/composables/useResponsiveGlass.ts +441 -0
  158. package/src/lib/composables/useTooltip.ts +16 -0
  159. package/src/lib/composables/useTypedButton.ts +66 -0
  160. package/src/lib/config/index.ts +62 -5
  161. package/src/lib/constants/components.ts +55 -0
  162. package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
  163. package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
  164. package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
  165. package/src/lib/types/components.ts +37 -11
  166. package/src/lib/types/glass.ts +35 -0
  167. package/src/lib/types/index.ts +1 -0
  168. package/src/lib/utils/displacement-generator.ts +1 -1
  169. package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
  170. package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
  171. package/src/styles/06-components/_components.testbutton.scss +212 -0
  172. package/src/styles/06-components/_components.testtypecheck.scss +212 -0
  173. package/src/styles/06-components/_components.typedbutton.scss +212 -0
  174. package/src/styles/99-utilities/_index.scss +1 -0
  175. package/src/styles/99-utilities/_utilities.text.scss +1 -1
  176. package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
  177. package/src/styles/06-components/old.chart.styles.scss +0 -2788
@@ -0,0 +1,565 @@
1
+ /**
2
+ * ITCSS Style Generator
3
+ * Automates creation of ITCSS architecture layers for components
4
+ */
5
+
6
+ import { join } from 'path';
7
+ import { existsSync } from 'fs';
8
+ import { filesystem } from './filesystem.js';
9
+ import { logger } from '../utils/logger.js';
10
+ import { AtomixCLIError } from '../utils/error.js';
11
+ import { generateGlassStyles } from './glass-generator.js';
12
+ import { generateMotionTokens, ANIMATION_PRESETS } from './motion-generator.js';
13
+
14
+ /**
15
+ * ITCSS Layer definitions
16
+ */
17
+ export const ITCSS_LAYERS = {
18
+ SETTINGS: {
19
+ name: 'settings',
20
+ order: '01',
21
+ path: 'src/styles/01-settings',
22
+ description: 'Global variables, config switches, and brand colors'
23
+ },
24
+ TOOLS: {
25
+ name: 'tools',
26
+ order: '02',
27
+ path: 'src/styles/02-tools',
28
+ description: 'Globally used mixins and functions'
29
+ },
30
+ GENERIC: {
31
+ name: 'generic',
32
+ order: '03',
33
+ path: 'src/styles/03-generic',
34
+ description: 'Ground-zero styles (normalize, resets, box-sizing)'
35
+ },
36
+ ELEMENTS: {
37
+ name: 'elements',
38
+ order: '04',
39
+ path: 'src/styles/04-elements',
40
+ description: 'Unclassed HTML elements (type selectors)'
41
+ },
42
+ OBJECTS: {
43
+ name: 'objects',
44
+ order: '05',
45
+ path: 'src/styles/05-objects',
46
+ description: 'Cosmetic-free design patterns (layouts, grids)'
47
+ },
48
+ COMPONENTS: {
49
+ name: 'components',
50
+ order: '06',
51
+ path: 'src/styles/06-components',
52
+ description: 'Designed components, chunks of UI'
53
+ },
54
+ UTILITIES: {
55
+ name: 'utilities',
56
+ order: '99',
57
+ path: 'src/styles/99-utilities',
58
+ description: 'Helper classes with ability to override anything'
59
+ }
60
+ };
61
+
62
+ /**
63
+ * Generate SCSS settings file for a component
64
+ */
65
+ export function generateSettingsFile(componentName, options = {}) {
66
+ const {
67
+ primaryColor = '--atomix-color-primary',
68
+ spacingBase = '--atomix-spacing-4',
69
+ radiusBase = '--atomix-radius-md'
70
+ } = options;
71
+
72
+ const componentPrefix = componentName.toLowerCase().replace(/([A-Z])/g, '-$1').replace(/^-/, '');
73
+
74
+ return `// ${componentName} Component Settings
75
+ // Generated by Atomix CLI
76
+ // =============================================================================
77
+
78
+ @use 'sass:color';
79
+ @use '../../lib/functions' as *;
80
+ @use '../../lib/mixins' as *;
81
+
82
+ // Component-specific CSS Custom Properties
83
+ // These override or extend global design tokens
84
+
85
+ :root {
86
+ // Brand Colors
87
+ --${componentPrefix}-primary: var(${primaryColor});
88
+ --${componentPrefix}-primary-hover: color.adjust(var(${primaryColor}), $lightness: -10%);
89
+ --${componentPrefix}-primary-active: color.adjust(var(${primaryColor}), $lightness: -20%);
90
+
91
+ // Spacing
92
+ --${componentPrefix}-padding-x: var(${spacingBase});
93
+ --${componentPrefix}-padding-y: calc(var(${spacingBase}) * 0.5);
94
+ --${componentPrefix}-gap: var(${spacingBase});
95
+
96
+ // Border Radius
97
+ --${componentPrefix}-radius: var(${radiusBase});
98
+
99
+ // Typography
100
+ --${componentPrefix}-font-size: var(--atomix-font-size-base);
101
+ --${componentPrefix}-font-weight: var(--atomix-font-weight-medium);
102
+ --${componentPrefix}-line-height: var(--atomix-line-height-tight);
103
+
104
+ // States
105
+ --${componentPrefix}-disabled-opacity: 0.5;
106
+ --${componentPrefix}-focus-ring: 0 0 0 2px var(--atomix-color-primary-200);
107
+ }
108
+
109
+ // Dark mode overrides
110
+ .dark {
111
+ :root {
112
+ --${componentPrefix}-focus-ring: 0 0 0 2px var(--atomix-color-primary-800);
113
+ }
114
+ }
115
+
116
+ // Component configuration map
117
+ $${componentPrefix}-config: (
118
+ 'primary': var(--${componentPrefix}-primary),
119
+ 'padding-x': var(--${componentPrefix}-padding-x),
120
+ 'padding-y': var(--${componentPrefix}-padding-y),
121
+ 'gap': var(--${componentPrefix}-gap),
122
+ 'radius': var(--${componentPrefix}-radius),
123
+ 'font-size': var(--${componentPrefix}-font-size),
124
+ 'font-weight': var(--${componentPrefix}-font-weight),
125
+ 'line-height': var(--${componentPrefix}-line-height),
126
+ ) !default;
127
+ `;
128
+ }
129
+
130
+ /**
131
+ * Generate SCSS component styles file
132
+ */
133
+ export function generateComponentStyles(componentName, options = {}) {
134
+ const {
135
+ baseClass = `c-${componentName.toLowerCase().replace(/([A-Z])/g, '-$1').replace(/^-/, '')}`,
136
+ hasVariants = true,
137
+ hasSizes = true,
138
+ hasStates = true,
139
+ hasAnimations = true
140
+ } = options;
141
+
142
+ const componentPrefix = componentName.toLowerCase().replace(/([A-Z])/g, '-$1').replace(/^-/, '');
143
+
144
+ return `// ${componentName} Component Styles
145
+ // Generated by Atomix CLI
146
+ // ITCSS Layer: Components
147
+ // =============================================================================
148
+
149
+ @use 'sass:map';
150
+ @use '../../01-settings/settings.${componentPrefix}' as *;
151
+ @use '../../02-tools/mixins' as *;
152
+ @use '../../02-tools/functions' as *;
153
+
154
+ // Base Component Class
155
+ // =============================================================================
156
+
157
+ .${baseClass} {
158
+ // Layout
159
+ display: inline-flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ gap: var(--${componentPrefix}-gap);
163
+
164
+ // Spacing
165
+ padding: var(--${componentPrefix}-padding-y) var(--${componentPrefix}-padding-x);
166
+
167
+ // Typography
168
+ font-size: var(--${componentPrefix}-font-size);
169
+ font-weight: var(--${componentPrefix}-font-weight);
170
+ line-height: var(--${componentPrefix}-line-height);
171
+
172
+ // Appearance
173
+ border-radius: var(--${componentPrefix}-radius);
174
+ border: none;
175
+ cursor: pointer;
176
+
177
+ // Transition
178
+ transition: all var(--atomix-duration-fast) var(--atomix-easing-smooth);
179
+
180
+ // Focus
181
+ &:focus-visible {
182
+ outline: none;
183
+ box-shadow: var(--${componentPrefix}-focus-ring);
184
+ }
185
+
186
+ // Disabled state
187
+ &:disabled {
188
+ opacity: var(--${componentPrefix}-disabled-opacity);
189
+ cursor: not-allowed;
190
+ pointer-events: none;
191
+ }
192
+ }
193
+
194
+ // Variants
195
+ // =============================================================================
196
+
197
+ @if ${hasVariants} {
198
+ .${baseClass}--variant-primary {
199
+ background-color: var(--${componentPrefix}-primary);
200
+ color: var(--atomix-color-white);
201
+
202
+ &:hover:not(:disabled) {
203
+ background-color: var(--${componentPrefix}-primary-hover);
204
+ }
205
+
206
+ &:active:not(:disabled) {
207
+ background-color: var(--${componentPrefix}-primary-active);
208
+ }
209
+ }
210
+
211
+ .${baseClass}--variant-secondary {
212
+ background-color: var(--atomix-color-neutral-100);
213
+ color: var(--atomix-color-neutral-900);
214
+
215
+ &:hover:not(:disabled) {
216
+ background-color: var(--atomix-color-neutral-200);
217
+ }
218
+ }
219
+
220
+ .${baseClass}--variant-outline {
221
+ background-color: transparent;
222
+ border: 1px solid var(--atomix-color-neutral-300);
223
+ color: var(--atomix-color-neutral-700);
224
+
225
+ &:hover:not(:disabled) {
226
+ border-color: var(--atomix-color-neutral-400);
227
+ background-color: var(--atomix-color-neutral-50);
228
+ }
229
+ }
230
+ }
231
+
232
+ // Glassmorphism Variant
233
+ // =============================================================================
234
+
235
+ .${baseClass}--glass {
236
+ background: rgba(255, 255, 255, 0.1);
237
+ backdrop-filter: blur(10px) saturate(200%);
238
+ border: 1px solid rgba(255, 255, 255, 0.2);
239
+
240
+ @media (prefers-reduced-transparency: reduce) {
241
+ background: rgba(255, 255, 255, 0.8);
242
+ backdrop-filter: none;
243
+ }
244
+
245
+ &:hover:not(:disabled) {
246
+ background: rgba(255, 255, 255, 0.15);
247
+ }
248
+ }
249
+
250
+ // Animation Variants
251
+ // =============================================================================
252
+
253
+ @if ${hasAnimations} {
254
+ // Fade In Animation
255
+ .${baseClass}--animate-fade-in {
256
+ animation: atomix-fade-in var(--atomix-duration-base) var(--atomix-easing-smooth);
257
+ }
258
+
259
+ // Slide In Up Animation
260
+ .${baseClass}--animate-slide-in-up {
261
+ animation: atomix-slide-in-up var(--atomix-duration-slow) var(--atomix-easing-smooth);
262
+ }
263
+
264
+ // Scale In Animation
265
+ .${baseClass}--animate-scale-in {
266
+ animation: atomix-scale-in var(--atomix-duration-base) var(--atomix-easing-smooth);
267
+ }
268
+
269
+ // Pulse Animation (for loading states)
270
+ .${baseClass}--animate-pulse {
271
+ animation: atomix-pulse 2s var(--atomix-easing-smooth) infinite;
272
+ }
273
+
274
+ // Shimmer Animation (for skeleton loaders)
275
+ .${baseClass}--animate-shimmer {
276
+ animation: atomix-shimmer 2s linear infinite;
277
+ background: linear-gradient(
278
+ 90deg,
279
+ var(--atomix-color-neutral-100) 0%,
280
+ var(--atomix-color-neutral-200) 50%,
281
+ var(--atomix-color-neutral-100) 100%
282
+ );
283
+ background-size: 200% 100%;
284
+ }
285
+ }
286
+
287
+ // Motion Preferences
288
+ // =============================================================================
289
+
290
+ @media (prefers-reduced-motion: reduce) {
291
+ .${baseClass},
292
+ .${baseClass} * {
293
+ animation-duration: 0.01ms !important;
294
+ animation-iteration-count: 1 !important;
295
+ transition-duration: 0.01ms !important;
296
+ }
297
+ }
298
+
299
+ // Sizes
300
+ // =============================================================================
301
+
302
+ @if ${hasSizes} {
303
+ .${baseClass}--size-sm {
304
+ padding: calc(var(--${componentPrefix}-padding-y) * 0.75) calc(var(--${componentPrefix}-padding-x) * 0.75);
305
+ font-size: var(--atomix-font-size-sm);
306
+ }
307
+
308
+ .${baseClass}--size-md {
309
+ // Default size - no overrides needed
310
+ }
311
+
312
+ .${baseClass}--size-lg {
313
+ padding: calc(var(--${componentPrefix}-padding-y) * 1.25) calc(var(--${componentPrefix}-padding-x) * 1.25);
314
+ font-size: var(--atomix-font-size-lg);
315
+ }
316
+ }
317
+
318
+ // States
319
+ // =============================================================================
320
+
321
+ @if ${hasStates} {
322
+ .${baseClass}--state-loading {
323
+ position: relative;
324
+ pointer-events: none;
325
+
326
+ &::after {
327
+ content: '';
328
+ position: absolute;
329
+ inset: 0;
330
+ background: rgba(255, 255, 255, 0.3);
331
+ backdrop-filter: blur(2px);
332
+ }
333
+ }
334
+
335
+ .${baseClass}--state-glass {
336
+ background-color: rgba(255, 255, 255, 0.1);
337
+ backdrop-filter: blur(10px);
338
+ border: 1px solid rgba(255, 255, 255, 0.2);
339
+ }
340
+ }
341
+
342
+ // Responsive Overrides
343
+ // =============================================================================
344
+
345
+ @include atomix-media-breakpoint-up(md) {
346
+ .${baseClass} {
347
+ // Tablet-specific adjustments if needed
348
+ }
349
+ }
350
+
351
+ @include atomix-media-breakpoint-up(lg) {
352
+ .${baseClass} {
353
+ // Desktop-specific adjustments if needed
354
+ }
355
+ }
356
+ `;
357
+ }
358
+
359
+ /**
360
+ * Generate index file for ITCSS layer
361
+ */
362
+ export function generateLayerIndex(layerKey) {
363
+ const layer = ITCSS_LAYERS[layerKey];
364
+
365
+ if (!layer) {
366
+ throw new Error(`Unknown ITCSS layer: ${layerKey}`);
367
+ }
368
+
369
+ const imports = [];
370
+
371
+ switch (layerKey) {
372
+ case 'SETTINGS':
373
+ imports.push(
374
+ "// Settings Layer",
375
+ "// Global variables, config switches, and brand colors",
376
+ "",
377
+ "@forward 'settings.colors';",
378
+ "@forward 'settings.typography';",
379
+ "@forward 'settings.spacing';",
380
+ "@forward 'settings.border-radius';",
381
+ "@forward 'settings.box-shadow';",
382
+ "@forward 'settings.breakpoints';"
383
+ );
384
+ break;
385
+ case 'TOOLS':
386
+ imports.push(
387
+ "// Tools Layer",
388
+ "// Globally used mixins and functions",
389
+ "",
390
+ "@forward 'functions';",
391
+ "@forward 'mixins';",
392
+ "@forward 'helpers';"
393
+ );
394
+ break;
395
+ case 'GENERIC':
396
+ imports.push(
397
+ "// Generic Layer",
398
+ "// Ground-zero styles (normalize.css, resets, box-sizing)",
399
+ "",
400
+ "@forward 'normalize';",
401
+ "@forward 'reset';",
402
+ "@forward 'box-sizing';"
403
+ );
404
+ break;
405
+ case 'ELEMENTS':
406
+ imports.push(
407
+ "// Elements Layer",
408
+ "// Unclassed HTML elements (type selectors)",
409
+ "",
410
+ "@forward 'elements.headings';",
411
+ "@forward 'elements.text';",
412
+ "@forward 'elements.links';",
413
+ "@forward 'elements.forms';"
414
+ );
415
+ break;
416
+ case 'OBJECTS':
417
+ imports.push(
418
+ "// Objects Layer",
419
+ "// Cosmetic-free design patterns (layouts, grids)",
420
+ "",
421
+ "@forward 'objects.grid';",
422
+ "@forward 'objects.flex';",
423
+ "@forward 'objects.container';",
424
+ "@forward 'objects.stack';"
425
+ );
426
+ break;
427
+ case 'COMPONENTS':
428
+ imports.push(
429
+ "// Components Layer",
430
+ "// Designed components, chunks of UI",
431
+ "",
432
+ "// Component imports are auto-generated",
433
+ "// Example:",
434
+ "// @forward 'components.button';",
435
+ "// @forward 'components.card';",
436
+ "// @forward 'components.input';"
437
+ );
438
+ break;
439
+ case 'UTILITIES':
440
+ imports.push(
441
+ "// Utilities Layer",
442
+ "// Helper classes with ability to override anything",
443
+ "",
444
+ "@forward 'utilities.display';",
445
+ "@forward 'utilities.spacing';",
446
+ "@forward 'utilities.flexibility';",
447
+ "@forward 'utilities.accessibility';"
448
+ );
449
+ break;
450
+ }
451
+
452
+ return imports.join('\n');
453
+ }
454
+
455
+ /**
456
+ * Create ITCSS directory structure
457
+ */
458
+ export async function createITCSSStructure(projectRoot) {
459
+ const created = [];
460
+
461
+ for (const [key, layer] of Object.entries(ITCSS_LAYERS)) {
462
+ const layerPath = join(projectRoot, layer.path);
463
+
464
+ // Create directory
465
+ await filesystem.createDirectory(layerPath);
466
+ created.push(layer.path);
467
+
468
+ // Create index file if it doesn't exist
469
+ const indexPath = join(layerPath, '_index.scss');
470
+ if (!existsSync(indexPath)) {
471
+ await filesystem.writeFile(indexPath, generateLayerIndex(key), 'utf8');
472
+ created.push(`${layer.path}/_index.scss`);
473
+ }
474
+ }
475
+
476
+ return created;
477
+ }
478
+
479
+ /**
480
+ * Generate complete component styles package
481
+ */
482
+ export async function generateComponentStylesPackage(componentName, projectRoot, options = {}) {
483
+ const {
484
+ skipSettings = false,
485
+ skipComponents = false,
486
+ force = false
487
+ } = options;
488
+
489
+ const created = [];
490
+ const componentPrefix = componentName.toLowerCase().replace(/([A-Z])/g, '-$1').replace(/^-/, '');
491
+
492
+ try {
493
+ // 1. Generate Settings File
494
+ if (!skipSettings) {
495
+ const settingsPath = join(projectRoot, 'src/styles/01-settings');
496
+ await filesystem.createDirectory(settingsPath);
497
+
498
+ const settingsFile = join(settingsPath, `_settings.${componentPrefix}.scss`);
499
+
500
+ if (force || !existsSync(settingsFile)) {
501
+ const settingsContent = generateSettingsFile(componentName);
502
+ await filesystem.writeFile(settingsFile, settingsContent, 'utf8');
503
+ created.push(`src/styles/01-settings/_settings.${componentPrefix}.scss`);
504
+ logger.debug(`Created settings file: ${settingsFile}`);
505
+ }
506
+ }
507
+
508
+ // 2. Generate Component Styles File
509
+ if (!skipComponents) {
510
+ const componentsPath = join(projectRoot, 'src/styles/06-components');
511
+ await filesystem.createDirectory(componentsPath);
512
+
513
+ const componentFile = join(componentsPath, `_components.${componentPrefix}.scss`);
514
+
515
+ if (force || !existsSync(componentFile)) {
516
+ const componentContent = generateComponentStyles(componentName);
517
+ await filesystem.writeFile(componentFile, componentContent, 'utf8');
518
+ created.push(`src/styles/06-components/_components.${componentPrefix}.scss`);
519
+ logger.debug(`Created component styles: ${componentFile}`);
520
+ }
521
+ }
522
+
523
+ return {
524
+ success: true,
525
+ created,
526
+ message: `Generated ${created.length} ITCSS files for ${componentName}`
527
+ };
528
+
529
+ } catch (error) {
530
+ throw new AtomixCLIError(
531
+ `Failed to generate ITCSS styles: ${error.message}`,
532
+ 'ITCSS_GENERATION_FAILED',
533
+ [
534
+ 'Check you have write permissions for src/styles directory',
535
+ 'Verify project root is correct',
536
+ 'Try running with --force flag to overwrite existing files'
537
+ ]
538
+ );
539
+ }
540
+ }
541
+
542
+ /**
543
+ * Check if ITCSS structure exists
544
+ */
545
+ export function checkITCSSStructure(projectRoot) {
546
+ const status = {
547
+ complete: true,
548
+ missing: [],
549
+ existing: []
550
+ };
551
+
552
+ for (const [key, layer] of Object.entries(ITCSS_LAYERS)) {
553
+ const layerPath = join(projectRoot, layer.path);
554
+ const indexPath = join(layerPath, '_index.scss');
555
+
556
+ if (existsSync(indexPath)) {
557
+ status.existing.push(layer.name);
558
+ } else {
559
+ status.missing.push(layer.name);
560
+ status.complete = false;
561
+ }
562
+ }
563
+
564
+ return status;
565
+ }