@pure-ds/core 0.4.37 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/types/pds.d.ts +34 -11
  2. package/dist/types/public/assets/auto-definer-XWHRBQPU.d.ts +9 -0
  3. package/dist/types/public/assets/auto-definer-XWHRBQPU.d.ts.map +1 -0
  4. package/dist/types/public/assets/chunk-746HIXIK.d.ts +52 -0
  5. package/dist/types/public/assets/chunk-746HIXIK.d.ts.map +1 -0
  6. package/dist/types/public/assets/chunk-APJV5T3J.d.ts +106 -0
  7. package/dist/types/public/assets/chunk-APJV5T3J.d.ts.map +1 -0
  8. package/dist/types/public/assets/chunk-BEPKFFM7.d.ts +398 -0
  9. package/dist/types/public/assets/chunk-BEPKFFM7.d.ts.map +1 -0
  10. package/dist/types/public/assets/chunk-ISS7UH5H.d.ts +2424 -0
  11. package/dist/types/public/assets/chunk-ISS7UH5H.d.ts.map +1 -0
  12. package/dist/types/public/assets/chunk-RUPLQUDG.d.ts +582 -0
  13. package/dist/types/public/assets/chunk-RUPLQUDG.d.ts.map +1 -0
  14. package/dist/types/public/assets/chunk-USML4NYF.d.ts +18 -0
  15. package/dist/types/public/assets/chunk-USML4NYF.d.ts.map +1 -0
  16. package/dist/types/public/assets/chunk-Z47A3HLT.d.ts +3 -0
  17. package/dist/types/public/assets/chunk-Z47A3HLT.d.ts.map +1 -0
  18. package/dist/types/public/assets/js/auto-definer-HZLD2XF4.d.ts +9 -0
  19. package/dist/types/public/assets/js/auto-definer-HZLD2XF4.d.ts.map +1 -0
  20. package/dist/types/public/assets/js/chunk-6A6DFAIG.d.ts +88 -0
  21. package/dist/types/public/assets/js/chunk-6A6DFAIG.d.ts.map +1 -0
  22. package/dist/types/public/assets/js/chunk-746HIXIK.d.ts +52 -0
  23. package/dist/types/public/assets/js/chunk-746HIXIK.d.ts.map +1 -0
  24. package/dist/types/public/assets/js/chunk-A3TZGIYX.d.ts +4 -0
  25. package/dist/types/public/assets/js/chunk-A3TZGIYX.d.ts.map +1 -0
  26. package/dist/types/public/assets/js/chunk-BEPKFFM7.d.ts +398 -0
  27. package/dist/types/public/assets/js/chunk-BEPKFFM7.d.ts.map +1 -0
  28. package/dist/types/public/assets/js/chunk-OTTRJ5MB.d.ts +1695 -0
  29. package/dist/types/public/assets/js/chunk-OTTRJ5MB.d.ts.map +1 -0
  30. package/dist/types/public/assets/js/chunk-RBPKHG76.d.ts +747 -0
  31. package/dist/types/public/assets/js/chunk-RBPKHG76.d.ts.map +1 -0
  32. package/dist/types/public/assets/js/chunk-RUPLQUDG.d.ts +582 -0
  33. package/dist/types/public/assets/js/chunk-RUPLQUDG.d.ts.map +1 -0
  34. package/dist/types/public/assets/js/chunk-SMD2R3CX.d.ts +68 -0
  35. package/dist/types/public/assets/js/chunk-SMD2R3CX.d.ts.map +1 -0
  36. package/dist/types/public/assets/js/chunk-Y73DA2D5.d.ts +15 -0
  37. package/dist/types/public/assets/js/chunk-Y73DA2D5.d.ts.map +1 -0
  38. package/dist/types/public/assets/js/chunks/auto-definer-X7MSXKTU.d.ts +9 -0
  39. package/dist/types/public/assets/js/chunks/auto-definer-X7MSXKTU.d.ts.map +1 -0
  40. package/dist/types/public/assets/js/chunks/chunk-7BDQH5CT.d.ts +485 -0
  41. package/dist/types/public/assets/js/chunks/chunk-7BDQH5CT.d.ts.map +1 -0
  42. package/dist/types/public/assets/js/chunks/chunk-MWB3S7NG.d.ts +3 -0
  43. package/dist/types/public/assets/js/chunks/chunk-MWB3S7NG.d.ts.map +1 -0
  44. package/dist/types/public/assets/js/chunks/chunk-WIMLORAU.d.ts +5 -0
  45. package/dist/types/public/assets/js/chunks/chunk-WIMLORAU.d.ts.map +1 -0
  46. package/dist/types/public/assets/js/chunks/chunk-WN4Y2ELN.d.ts +833 -0
  47. package/dist/types/public/assets/js/chunks/chunk-WN4Y2ELN.d.ts.map +1 -0
  48. package/dist/types/public/assets/js/chunks/chunk-XQOUIBLO.d.ts +1687 -0
  49. package/dist/types/public/assets/js/chunks/chunk-XQOUIBLO.d.ts.map +1 -0
  50. package/dist/types/public/assets/js/chunks/font-loader-VN5SRNOD.d.ts +5 -0
  51. package/dist/types/public/assets/js/chunks/font-loader-VN5SRNOD.d.ts.map +1 -0
  52. package/dist/types/public/assets/js/chunks/pds-live-validation-BQPWN5JG.d.ts +38 -0
  53. package/dist/types/public/assets/js/chunks/pds-live-validation-BQPWN5JG.d.ts.map +1 -0
  54. package/dist/types/public/assets/js/common-WIAC4WAJ.d.ts +4 -0
  55. package/dist/types/public/assets/js/common-WIAC4WAJ.d.ts.map +1 -0
  56. package/dist/types/public/assets/js/pds-config-WEBAXXSM.d.ts +4 -0
  57. package/dist/types/public/assets/js/pds-config-WEBAXXSM.d.ts.map +1 -0
  58. package/dist/types/public/assets/js/pds-core/pds-generator.d.ts +700 -0
  59. package/dist/types/public/assets/js/pds-core/pds-generator.d.ts.map +1 -0
  60. package/dist/types/public/assets/js/pds-core/pds-utilities.d.ts +27 -0
  61. package/dist/types/public/assets/js/pds-core/pds-utilities.d.ts.map +1 -0
  62. package/dist/types/public/assets/js/pds-enums-DCBZHS64.d.ts +3 -0
  63. package/dist/types/public/assets/js/pds-enums-DCBZHS64.d.ts.map +1 -0
  64. package/dist/types/public/assets/js/pds-gen.d.ts +106 -0
  65. package/dist/types/public/assets/js/pds-gen.d.ts.map +1 -0
  66. package/dist/types/public/assets/js/pds-live.d.ts +11 -0
  67. package/dist/types/public/assets/js/pds-live.d.ts.map +1 -0
  68. package/dist/types/public/assets/js/pds-manager.d.ts +1047 -0
  69. package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -0
  70. package/dist/types/public/assets/js/pds-ontology-2DICJXHO.d.ts +9 -0
  71. package/dist/types/public/assets/js/pds-ontology-2DICJXHO.d.ts.map +1 -0
  72. package/dist/types/public/assets/js/pds-query-B54LBKKR.d.ts +70 -0
  73. package/dist/types/public/assets/js/pds-query-B54LBKKR.d.ts.map +1 -0
  74. package/dist/types/public/assets/js/pds.d.ts +1 -18
  75. package/dist/types/public/assets/js/pds.d.ts.map +1 -1
  76. package/dist/types/public/assets/pds-ontology-ZO6TJHO3.d.ts +9 -0
  77. package/dist/types/public/assets/pds-ontology-ZO6TJHO3.d.ts.map +1 -0
  78. package/dist/types/src/js/common/pds-core/pds-config.d.ts +757 -0
  79. package/dist/types/src/js/common/pds-core/pds-config.d.ts.map +1 -0
  80. package/dist/types/src/js/common/pds-core/pds-enhancers.d.ts +28 -0
  81. package/dist/types/src/js/common/pds-core/pds-enhancers.d.ts.map +1 -0
  82. package/dist/types/src/js/common/pds-core/pds-enums.d.ts +87 -0
  83. package/dist/types/src/js/common/pds-core/pds-enums.d.ts.map +1 -0
  84. package/dist/types/src/js/common/pds-core/pds-generator.d.ts +700 -0
  85. package/dist/types/src/js/common/pds-core/pds-generator.d.ts.map +1 -0
  86. package/dist/types/src/js/common/pds-core/pds-ontology.d.ts +380 -0
  87. package/dist/types/src/js/common/pds-core/pds-ontology.d.ts.map +1 -0
  88. package/dist/types/src/js/common/pds-core/pds-paths.d.ts +37 -0
  89. package/dist/types/src/js/common/pds-core/pds-paths.d.ts.map +1 -0
  90. package/dist/types/src/js/common/pds-core/pds-query.d.ts +102 -0
  91. package/dist/types/src/js/common/pds-core/pds-query.d.ts.map +1 -0
  92. package/dist/types/src/js/common/pds-core/pds-registry.d.ts +35 -0
  93. package/dist/types/src/js/common/pds-core/pds-registry.d.ts.map +1 -0
  94. package/dist/types/src/js/common/pds-core/pds-utilities.d.ts +27 -0
  95. package/dist/types/src/js/common/pds-core/pds-utilities.d.ts.map +1 -0
  96. package/dist/types/src/js/pds-core/pds-generator.d.ts +38 -46
  97. package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
  98. package/dist/types/src/js/pds-core/pds-live.d.ts +39 -0
  99. package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -0
  100. package/dist/types/src/js/pds-core/pds-runtime.d.ts +39 -0
  101. package/dist/types/src/js/pds-core/pds-runtime.d.ts.map +1 -0
  102. package/dist/types/src/js/pds-core/pds-start-helpers.d.ts +60 -0
  103. package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -0
  104. package/dist/types/src/js/pds-core/pds-utilities.d.ts +27 -0
  105. package/dist/types/src/js/pds-core/pds-utilities.d.ts.map +1 -0
  106. package/dist/types/src/js/pds-gen.d.ts +48 -0
  107. package/dist/types/src/js/pds-gen.d.ts.map +1 -0
  108. package/dist/types/src/js/pds-live-runtime.d.ts +7 -0
  109. package/dist/types/src/js/pds-live-runtime.d.ts.map +1 -0
  110. package/dist/types/src/js/pds-live-validation.d.ts +44 -0
  111. package/dist/types/src/js/pds-live-validation.d.ts.map +1 -0
  112. package/dist/types/src/js/pds-live.d.ts +11 -0
  113. package/dist/types/src/js/pds-live.d.ts.map +1 -0
  114. package/dist/types/src/js/pds-manager.d.ts +2 -0
  115. package/dist/types/src/js/pds-manager.d.ts.map +1 -0
  116. package/dist/types/src/js/pds.d.ts +6 -33
  117. package/dist/types/src/js/pds.d.ts.map +1 -1
  118. package/package.json +11 -12
  119. package/packages/pds-cli/bin/{generate-css-data.mjs → generate-css-data.js} +563 -563
  120. package/packages/pds-cli/bin/{generate-manifest.mjs → generate-manifest.js} +352 -352
  121. package/packages/pds-cli/bin/{pds-build-icons.mjs → pds-build-icons.js} +152 -152
  122. package/packages/pds-cli/bin/{pds-dx.mjs → pds-dx.js} +114 -114
  123. package/packages/pds-cli/bin/{pds-init-config.mjs → pds-init-config.js} +34 -34
  124. package/packages/pds-cli/bin/{pds-setup-copilot.mjs → pds-setup-copilot.js} +106 -106
  125. package/packages/pds-cli/bin/{pds-static.mjs → pds-static.js} +597 -581
  126. package/packages/pds-cli/bin/{pds.mjs → pds.js} +127 -127
  127. package/packages/pds-cli/bin/postinstall.mjs +522 -563
  128. package/packages/pds-cli/bin/{sync-assets.mjs → sync-assets.js} +251 -251
  129. package/packages/pds-cli/lib/{asset-roots.mjs → asset-roots.js} +47 -47
  130. package/packages/pds-cli/lib/{fs-writer.mjs → fs-writer.js} +75 -75
  131. package/public/assets/js/app.js +95 -118
  132. package/public/assets/js/pds-manager.js +3251 -0
  133. package/public/assets/js/pds.js +10 -3201
  134. package/readme.md +2014 -2016
  135. package/src/js/pds-core/pds-enhancers.js +518 -518
  136. package/src/js/pds-core/pds-enums.js +86 -86
  137. package/src/js/pds-core/pds-generator.js +255 -185
  138. package/src/js/pds-core/pds-live.js +434 -0
  139. package/src/js/pds-core/pds-paths.js +109 -109
  140. package/src/js/pds-core/pds-registry.js +79 -79
  141. package/src/js/pds-core/pds-runtime.js +184 -0
  142. package/src/js/pds-core/pds-start-helpers.js +405 -0
  143. package/src/js/pds.d.ts +34 -11
  144. package/src/js/pds.js +43 -1182
  145. package/getting-started.md +0 -626
  146. package/src/js/pds-core/pds.d.ts +0 -129
@@ -1,563 +1,563 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Generate CSS Custom Data for IntelliSense
5
- * Creates VS Code CSS custom data and standard CSS data formats
6
- * Provides autocomplete for CSS tokens, classes, and custom properties
7
- */
8
-
9
- import { writeFile, mkdir, readFile } from 'fs/promises';
10
- import { existsSync } from 'fs';
11
- import path from 'path';
12
- import { fileURLToPath, pathToFileURL } from 'url';
13
-
14
- const __filename = fileURLToPath(import.meta.url);
15
- const __dirname = path.dirname(__filename);
16
- const repoRoot = path.resolve(__dirname, '../../../');
17
-
18
- // Colors for terminal output
19
- const COLORS = {
20
- reset: '\x1b[0m',
21
- bold: '\x1b[1m',
22
- green: '\x1b[32m',
23
- yellow: '\x1b[33m',
24
- blue: '\x1b[34m',
25
- red: '\x1b[31m',
26
- cyan: '\x1b[36m',
27
- };
28
- const shouldLogToStderr = () => process.env.PDS_LOG_STREAM === 'stderr' || process.env.PDS_POSTINSTALL === '1';
29
- const log = (msg, color = 'reset') => {
30
- const colorCode = COLORS[color] || '';
31
- const text = `${colorCode}${msg}${COLORS.reset}`;
32
- if (shouldLogToStderr()) {
33
- process.stderr.write(`${text}\n`);
34
- } else {
35
- console.log(text);
36
- }
37
- };
38
-
39
- /**
40
- * Extract CSS custom properties from generated tokens
41
- */
42
- function extractCSSProperties(generator) {
43
- const properties = [];
44
- const compiled = generator.compiled;
45
-
46
- if (!compiled?.tokens) {
47
- log('āš ļø No tokens found in generator', 'yellow');
48
- return properties;
49
- }
50
-
51
- // Extract color tokens
52
- if (compiled.tokens.colors) {
53
- for (const [colorName, colorScale] of Object.entries(compiled.tokens.colors)) {
54
- if (typeof colorScale === 'object' && colorScale !== null) {
55
- // Color scales (50-900)
56
- for (const [shade, value] of Object.entries(colorScale)) {
57
- properties.push({
58
- name: `--color-${colorName}-${shade}`,
59
- description: `${colorName} color scale - shade ${shade}`,
60
- syntax: '<color>',
61
- value: value,
62
- category: 'Color Tokens'
63
- });
64
- }
65
- } else if (typeof colorScale === 'string') {
66
- // Single color value
67
- properties.push({
68
- name: `--color-${colorName}`,
69
- description: `${colorName} color`,
70
- syntax: '<color>',
71
- value: colorScale,
72
- category: 'Color Tokens'
73
- });
74
- }
75
- }
76
- }
77
-
78
- // Extract spacing tokens
79
- if (compiled.tokens.spacing) {
80
- for (const [key, value] of Object.entries(compiled.tokens.spacing)) {
81
- properties.push({
82
- name: `--spacing-${key}`,
83
- description: `Spacing scale value ${key}`,
84
- syntax: '<length>',
85
- value: value,
86
- category: 'Spacing Tokens'
87
- });
88
- }
89
- }
90
-
91
- // Extract typography tokens
92
- if (compiled.tokens.typography) {
93
- const typo = compiled.tokens.typography;
94
-
95
- // Font families
96
- if (typo.families) {
97
- for (const [key, value] of Object.entries(typo.families)) {
98
- properties.push({
99
- name: `--font-family-${key}`,
100
- description: `Font family for ${key}`,
101
- syntax: '<custom-ident>',
102
- value: value,
103
- category: 'Typography Tokens'
104
- });
105
- }
106
- }
107
-
108
- // Font sizes
109
- if (typo.sizes) {
110
- for (const [key, value] of Object.entries(typo.sizes)) {
111
- properties.push({
112
- name: `--font-size-${key}`,
113
- description: `Font size ${key}`,
114
- syntax: '<length>',
115
- value: value,
116
- category: 'Typography Tokens'
117
- });
118
- }
119
- }
120
-
121
- // Font weights
122
- if (typo.weights) {
123
- for (const [key, value] of Object.entries(typo.weights)) {
124
- properties.push({
125
- name: `--font-weight-${key}`,
126
- description: `Font weight ${key}`,
127
- syntax: '<number>',
128
- value: value,
129
- category: 'Typography Tokens'
130
- });
131
- }
132
- }
133
-
134
- // Line heights
135
- if (typo.lineHeights) {
136
- for (const [key, value] of Object.entries(typo.lineHeights)) {
137
- properties.push({
138
- name: `--line-height-${key}`,
139
- description: `Line height ${key}`,
140
- syntax: '<number> | <length>',
141
- value: value,
142
- category: 'Typography Tokens'
143
- });
144
- }
145
- }
146
- }
147
-
148
- // Extract border radius tokens
149
- if (compiled.tokens.radius) {
150
- for (const [key, value] of Object.entries(compiled.tokens.radius)) {
151
- properties.push({
152
- name: `--radius-${key}`,
153
- description: `Border radius ${key}`,
154
- syntax: '<length>',
155
- value: value,
156
- category: 'Border Tokens'
157
- });
158
- }
159
- }
160
-
161
- // Extract border width tokens
162
- if (compiled.tokens.borderWidths) {
163
- for (const [key, value] of Object.entries(compiled.tokens.borderWidths)) {
164
- properties.push({
165
- name: `--border-width-${key}`,
166
- description: `Border width ${key}`,
167
- syntax: '<length>',
168
- value: value,
169
- category: 'Border Tokens'
170
- });
171
- }
172
- }
173
-
174
- // Extract shadow tokens
175
- if (compiled.tokens.shadows) {
176
- for (const [key, value] of Object.entries(compiled.tokens.shadows)) {
177
- properties.push({
178
- name: `--shadow-${key}`,
179
- description: `Shadow ${key}`,
180
- syntax: '<shadow>',
181
- value: value,
182
- category: 'Shadow Tokens'
183
- });
184
- }
185
- }
186
-
187
- // Extract transition tokens
188
- if (compiled.tokens.transitions) {
189
- for (const [key, value] of Object.entries(compiled.tokens.transitions)) {
190
- properties.push({
191
- name: `--transition-${key}`,
192
- description: `Transition ${key}`,
193
- syntax: '<time>',
194
- value: value,
195
- category: 'Transition Tokens'
196
- });
197
- }
198
- }
199
-
200
- // Extract z-index tokens
201
- if (compiled.tokens.zIndex) {
202
- for (const [key, value] of Object.entries(compiled.tokens.zIndex)) {
203
- properties.push({
204
- name: `--z-${key}`,
205
- description: `Z-index ${key}`,
206
- syntax: '<integer>',
207
- value: value,
208
- category: 'Layout Tokens'
209
- });
210
- }
211
- }
212
-
213
- // Extract layout tokens
214
- if (compiled.tokens.layout) {
215
- for (const [key, value] of Object.entries(compiled.tokens.layout)) {
216
- if (key === 'breakpoints') {
217
- for (const [bp, bpValue] of Object.entries(value)) {
218
- properties.push({
219
- name: `--breakpoint-${bp}`,
220
- description: `Breakpoint ${bp}`,
221
- syntax: '<length>',
222
- value: bpValue,
223
- category: 'Layout Tokens'
224
- });
225
- }
226
- } else {
227
- properties.push({
228
- name: `--layout-${key}`,
229
- description: `Layout ${key}`,
230
- syntax: '<length>',
231
- value: value,
232
- category: 'Layout Tokens'
233
- });
234
- }
235
- }
236
- }
237
-
238
- // Surface tokens (semantic)
239
- const surfaceTokens = [
240
- { name: '--surface-bg', description: 'Surface background color', category: 'Surface Tokens' },
241
- { name: '--surface-text', description: 'Surface text color', category: 'Surface Tokens' },
242
- { name: '--surface-text-secondary', description: 'Surface secondary text color', category: 'Surface Tokens' },
243
- { name: '--surface-border', description: 'Surface border color', category: 'Surface Tokens' },
244
- { name: '--surface-shadow', description: 'Surface shadow', category: 'Surface Tokens' },
245
- { name: '--surface-hover', description: 'Surface hover state', category: 'Surface Tokens' },
246
- ];
247
-
248
- for (const token of surfaceTokens) {
249
- properties.push({
250
- name: token.name,
251
- description: token.description,
252
- syntax: '<color>',
253
- category: token.category
254
- });
255
- }
256
-
257
- return properties;
258
- }
259
-
260
- /**
261
- * Extract CSS classes from ontology and utilities
262
- */
263
- async function extractCSSClasses(ontology) {
264
- const classes = [];
265
-
266
- // Primitives
267
- if (ontology.primitives) {
268
- for (const primitive of ontology.primitives) {
269
- for (const selector of primitive.selectors) {
270
- // Only add class selectors
271
- if (selector.startsWith('.')) {
272
- const className = selector.slice(1);
273
- classes.push({
274
- name: className,
275
- description: `${primitive.name} primitive component`,
276
- category: 'Primitives'
277
- });
278
- }
279
- }
280
- }
281
- }
282
-
283
- // Components
284
- if (ontology.components) {
285
- for (const component of ontology.components) {
286
- for (const selector of component.selectors) {
287
- if (selector.startsWith('.')) {
288
- const className = selector.slice(1);
289
- classes.push({
290
- name: className,
291
- description: `${component.name} component`,
292
- category: 'Components'
293
- });
294
- }
295
- }
296
- }
297
- }
298
-
299
- // Layout patterns
300
- if (ontology.layoutPatterns) {
301
- for (const pattern of ontology.layoutPatterns) {
302
- for (const selector of pattern.selectors) {
303
- if (selector.startsWith('.')) {
304
- const className = selector.slice(1);
305
- classes.push({
306
- name: className,
307
- description: pattern.description || `${pattern.name} layout pattern`,
308
- category: 'Layout Utilities'
309
- });
310
- }
311
- }
312
- }
313
- }
314
-
315
- // Utilities - handle nested object structure
316
- if (ontology.utilities && typeof ontology.utilities === 'object') {
317
- // Recursively extract all selectors from nested utility categories
318
- const extractSelectors = (obj, category = 'Utilities') => {
319
- for (const [key, value] of Object.entries(obj)) {
320
- if (Array.isArray(value)) {
321
- // It's an array of selectors
322
- for (const selector of value) {
323
- if (typeof selector === 'string' && selector.startsWith('.')) {
324
- const className = selector.slice(1);
325
- classes.push({
326
- name: className,
327
- description: `${key} utility class`,
328
- category
329
- });
330
- }
331
- }
332
- } else if (typeof value === 'object' && value !== null) {
333
- // It's a nested object, recurse
334
- extractSelectors(value, key);
335
- }
336
- }
337
- };
338
- extractSelectors(ontology.utilities);
339
- }
340
-
341
- return classes;
342
- }
343
-
344
- /**
345
- * Generate common variants for wildcard utilities
346
- */
347
- function generateUtilityVariants(baseClass) {
348
- const variants = [];
349
-
350
- if (baseClass.includes('gap-')) {
351
- // Gap utilities (0-12)
352
- for (let i = 0; i <= 12; i++) {
353
- variants.push({
354
- name: `gap-${i}`,
355
- description: `Gap spacing of ${i} units`
356
- });
357
- }
358
- } else if (baseClass.includes('items-')) {
359
- // Flexbox align-items
360
- const alignments = ['start', 'end', 'center', 'baseline', 'stretch'];
361
- for (const align of alignments) {
362
- variants.push({
363
- name: `items-${align}`,
364
- description: `Align items: ${align}`
365
- });
366
- }
367
- } else if (baseClass.includes('justify-')) {
368
- // Flexbox justify-content
369
- const justifications = ['start', 'end', 'center', 'between', 'around', 'evenly'];
370
- for (const justify of justifications) {
371
- variants.push({
372
- name: `justify-${justify}`,
373
- description: `Justify content: ${justify}`
374
- });
375
- }
376
- } else if (baseClass.includes('border-glow-')) {
377
- // Border glow variants
378
- const colors = ['primary', 'secondary', 'accent', 'success', 'warning', 'danger', 'info'];
379
- for (const color of colors) {
380
- variants.push({
381
- name: `border-glow-${color}`,
382
- description: `Border glow effect with ${color} color`
383
- });
384
- }
385
- }
386
-
387
- return variants;
388
- }
389
-
390
- /**
391
- * Extract data attributes from enhancements
392
- */
393
- function extractDataAttributes(ontology) {
394
- const attributes = [];
395
-
396
- if (ontology.enhancements) {
397
- for (const enhancement of ontology.enhancements) {
398
- // Extract data attributes from selectors like "[data-dropdown]"
399
- const matches = enhancement.match(/\[data-([^\]]+)\]/g);
400
- if (matches) {
401
- for (const match of matches) {
402
- const attrName = match.slice(1, -1); // Remove [ and ]
403
- attributes.push({
404
- name: attrName,
405
- description: `Enhancement: ${enhancement}`,
406
- category: 'Data Enhancements'
407
- });
408
- }
409
- }
410
- }
411
- }
412
-
413
- return attributes;
414
- }
415
-
416
- /**
417
- * Convert to VS Code CSS custom data format
418
- */
419
- function toVSCodeFormat(properties, classes) {
420
- return {
421
- version: 1.1,
422
- properties: properties.map(prop => ({
423
- name: prop.name,
424
- description: prop.description,
425
- syntax: prop.syntax || '<custom-ident>',
426
- ...(prop.value && { references: [{ name: 'Value', url: `data:text/plain,${encodeURIComponent(prop.value)}` }] })
427
- })),
428
- atDirectives: [],
429
- pseudoClasses: classes.map(cls => ({
430
- name: cls.name,
431
- description: cls.description
432
- })).slice(0, 100), // Limit for performance
433
- pseudoElements: []
434
- };
435
- }
436
-
437
- /**
438
- * Convert to standard CSS data format (for other editors)
439
- */
440
- function toStandardFormat(properties, classes, attributes) {
441
- return {
442
- version: '1.1',
443
- cssProperties: properties.map(prop => ({
444
- name: prop.name,
445
- description: prop.description,
446
- syntax: prop.syntax || '<custom-ident>',
447
- value: prop.value || undefined,
448
- category: prop.category
449
- })),
450
- cssClasses: classes.map(cls => ({
451
- name: cls.name,
452
- description: cls.description,
453
- category: cls.category
454
- })),
455
- dataAttributes: attributes.map(attr => ({
456
- name: attr.name,
457
- description: attr.description,
458
- category: attr.category
459
- })),
460
- metadata: {
461
- generator: 'PDS CSS Data Generator',
462
- generatedAt: new Date().toISOString(),
463
- totalProperties: properties.length,
464
- totalClasses: classes.length,
465
- totalAttributes: attributes.length
466
- }
467
- };
468
- }
469
-
470
- /**
471
- * Generate CSS IntelliSense data files
472
- */
473
- async function generateCSSData(targetDir) {
474
- try {
475
- log('šŸŽØ Generating CSS IntelliSense data...', 'bold');
476
-
477
- // Import Generator and ontology
478
- const generatorPath = path.join(repoRoot, 'src/js/pds-core/pds-generator.js');
479
- const ontologyPath = path.join(repoRoot, 'src/js/pds-core/pds-ontology.js');
480
- const configPath = path.join(repoRoot, 'src/js/pds-core/pds-config.js');
481
-
482
- log('šŸ“¦ Loading PDS modules...', 'blue');
483
- const { Generator } = await import(pathToFileURL(generatorPath).href);
484
- const { ontology } = await import(pathToFileURL(ontologyPath).href);
485
- const { presets } = await import(pathToFileURL(configPath).href);
486
-
487
- // Generate design system with default preset
488
- log('āš™ļø Generating design system...', 'blue');
489
- const generator = new Generator({ preset: 'default', design: presets.default });
490
-
491
- // Extract data
492
- log('šŸ” Extracting CSS properties...', 'blue');
493
- const properties = extractCSSProperties(generator);
494
- log(` Found ${properties.length} CSS custom properties`, 'cyan');
495
-
496
- log('šŸ” Extracting CSS classes...', 'blue');
497
- const classes = await extractCSSClasses(ontology);
498
- log(` Found ${classes.length} CSS classes`, 'cyan');
499
-
500
- log('šŸ” Extracting data attributes...', 'blue');
501
- const attributes = extractDataAttributes(ontology);
502
- log(` Found ${attributes.length} data attributes`, 'cyan');
503
-
504
- // Generate VS Code format
505
- log('šŸ“ Generating VS Code CSS custom data...', 'blue');
506
- const vscodeData = toVSCodeFormat(properties, classes);
507
-
508
- // Generate standard format
509
- log('šŸ“ Generating standard CSS data...', 'blue');
510
- const standardData = toStandardFormat(properties, classes, attributes);
511
-
512
- // Write files to repository
513
- const vscodeOutputPath = path.join(repoRoot, 'public/assets/pds/pds.css-data.json');
514
- const standardOutputPath = path.join(repoRoot, 'public/assets/pds/pds-css-complete.json');
515
-
516
- await mkdir(path.dirname(vscodeOutputPath), { recursive: true });
517
- await writeFile(vscodeOutputPath, JSON.stringify(vscodeData, null, 2), 'utf-8');
518
- log(`āœ… VS Code CSS data: ${path.relative(repoRoot, vscodeOutputPath)}`, 'green');
519
-
520
- await writeFile(standardOutputPath, JSON.stringify(standardData, null, 2), 'utf-8');
521
- log(`āœ… Standard CSS data: ${path.relative(repoRoot, standardOutputPath)}`, 'green');
522
-
523
- // Copy to target directory if specified
524
- if (targetDir) {
525
- const targetVSCodePath = path.join(targetDir, 'pds.css-data.json');
526
- const targetStandardPath = path.join(targetDir, 'pds-css-complete.json');
527
-
528
- await mkdir(targetDir, { recursive: true });
529
- await writeFile(targetVSCodePath, JSON.stringify(vscodeData, null, 2), 'utf-8');
530
- await writeFile(targetStandardPath, JSON.stringify(standardData, null, 2), 'utf-8');
531
-
532
- log(`āœ… Copied to ${path.relative(process.cwd(), targetDir)}`, 'green');
533
- }
534
-
535
- // Create workspace settings reference
536
- const settingsRef = {
537
- "css.customData": ["public/assets/pds/pds.css-data.json"]
538
- };
539
- const settingsPath = path.join(repoRoot, 'pds.css-data.json');
540
- await writeFile(settingsPath, JSON.stringify(settingsRef, null, 2), 'utf-8');
541
- log(`āœ… Created settings reference: pds.css-data.json`, 'green');
542
-
543
- log('\n✨ CSS IntelliSense data generation complete!', 'bold');
544
- log('šŸ“š To enable in VS Code, add to .vscode/settings.json:', 'cyan');
545
- log(' "css.customData": ["node_modules/pure-ds/public/assets/pds/pds.css-data.json"]', 'blue');
546
-
547
- return true;
548
- } catch (error) {
549
- log(`āŒ Error generating CSS data: ${error.message}`, 'red');
550
- console.error(error);
551
- return false;
552
- }
553
- }
554
-
555
- export { generateCSSData };
556
-
557
- // Run if called directly
558
- if (process.argv[1] && (process.argv[1].endsWith('generate-css-data.mjs') || process.argv[1].endsWith('generate-css-data.js'))) {
559
- const targetDir = process.argv[2] || null;
560
- generateCSSData(targetDir).then(success => {
561
- process.exit(success ? 0 : 1);
562
- });
563
- }
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Generate CSS Custom Data for IntelliSense
5
+ * Creates VS Code CSS custom data and standard CSS data formats
6
+ * Provides autocomplete for CSS tokens, classes, and custom properties
7
+ */
8
+
9
+ import { writeFile, mkdir, readFile } from 'fs/promises';
10
+ import { existsSync } from 'fs';
11
+ import path from 'path';
12
+ import { fileURLToPath, pathToFileURL } from 'url';
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
16
+ const repoRoot = path.resolve(__dirname, '../../../');
17
+
18
+ // Colors for terminal output
19
+ const COLORS = {
20
+ reset: '\x1b[0m',
21
+ bold: '\x1b[1m',
22
+ green: '\x1b[32m',
23
+ yellow: '\x1b[33m',
24
+ blue: '\x1b[34m',
25
+ red: '\x1b[31m',
26
+ cyan: '\x1b[36m',
27
+ };
28
+ const shouldLogToStderr = () => process.env.PDS_LOG_STREAM === 'stderr' || process.env.PDS_POSTINSTALL === '1';
29
+ const log = (msg, color = 'reset') => {
30
+ const colorCode = COLORS[color] || '';
31
+ const text = `${colorCode}${msg}${COLORS.reset}`;
32
+ if (shouldLogToStderr()) {
33
+ process.stderr.write(`${text}\n`);
34
+ } else {
35
+ console.log(text);
36
+ }
37
+ };
38
+
39
+ /**
40
+ * Extract CSS custom properties from generated tokens
41
+ */
42
+ function extractCSSProperties(generator) {
43
+ const properties = [];
44
+ const compiled = generator.compiled;
45
+
46
+ if (!compiled?.tokens) {
47
+ log('āš ļø No tokens found in generator', 'yellow');
48
+ return properties;
49
+ }
50
+
51
+ // Extract color tokens
52
+ if (compiled.tokens.colors) {
53
+ for (const [colorName, colorScale] of Object.entries(compiled.tokens.colors)) {
54
+ if (typeof colorScale === 'object' && colorScale !== null) {
55
+ // Color scales (50-900)
56
+ for (const [shade, value] of Object.entries(colorScale)) {
57
+ properties.push({
58
+ name: `--color-${colorName}-${shade}`,
59
+ description: `${colorName} color scale - shade ${shade}`,
60
+ syntax: '<color>',
61
+ value: value,
62
+ category: 'Color Tokens'
63
+ });
64
+ }
65
+ } else if (typeof colorScale === 'string') {
66
+ // Single color value
67
+ properties.push({
68
+ name: `--color-${colorName}`,
69
+ description: `${colorName} color`,
70
+ syntax: '<color>',
71
+ value: colorScale,
72
+ category: 'Color Tokens'
73
+ });
74
+ }
75
+ }
76
+ }
77
+
78
+ // Extract spacing tokens
79
+ if (compiled.tokens.spacing) {
80
+ for (const [key, value] of Object.entries(compiled.tokens.spacing)) {
81
+ properties.push({
82
+ name: `--spacing-${key}`,
83
+ description: `Spacing scale value ${key}`,
84
+ syntax: '<length>',
85
+ value: value,
86
+ category: 'Spacing Tokens'
87
+ });
88
+ }
89
+ }
90
+
91
+ // Extract typography tokens
92
+ if (compiled.tokens.typography) {
93
+ const typo = compiled.tokens.typography;
94
+
95
+ // Font families
96
+ if (typo.families) {
97
+ for (const [key, value] of Object.entries(typo.families)) {
98
+ properties.push({
99
+ name: `--font-family-${key}`,
100
+ description: `Font family for ${key}`,
101
+ syntax: '<custom-ident>',
102
+ value: value,
103
+ category: 'Typography Tokens'
104
+ });
105
+ }
106
+ }
107
+
108
+ // Font sizes
109
+ if (typo.sizes) {
110
+ for (const [key, value] of Object.entries(typo.sizes)) {
111
+ properties.push({
112
+ name: `--font-size-${key}`,
113
+ description: `Font size ${key}`,
114
+ syntax: '<length>',
115
+ value: value,
116
+ category: 'Typography Tokens'
117
+ });
118
+ }
119
+ }
120
+
121
+ // Font weights
122
+ if (typo.weights) {
123
+ for (const [key, value] of Object.entries(typo.weights)) {
124
+ properties.push({
125
+ name: `--font-weight-${key}`,
126
+ description: `Font weight ${key}`,
127
+ syntax: '<number>',
128
+ value: value,
129
+ category: 'Typography Tokens'
130
+ });
131
+ }
132
+ }
133
+
134
+ // Line heights
135
+ if (typo.lineHeights) {
136
+ for (const [key, value] of Object.entries(typo.lineHeights)) {
137
+ properties.push({
138
+ name: `--line-height-${key}`,
139
+ description: `Line height ${key}`,
140
+ syntax: '<number> | <length>',
141
+ value: value,
142
+ category: 'Typography Tokens'
143
+ });
144
+ }
145
+ }
146
+ }
147
+
148
+ // Extract border radius tokens
149
+ if (compiled.tokens.radius) {
150
+ for (const [key, value] of Object.entries(compiled.tokens.radius)) {
151
+ properties.push({
152
+ name: `--radius-${key}`,
153
+ description: `Border radius ${key}`,
154
+ syntax: '<length>',
155
+ value: value,
156
+ category: 'Border Tokens'
157
+ });
158
+ }
159
+ }
160
+
161
+ // Extract border width tokens
162
+ if (compiled.tokens.borderWidths) {
163
+ for (const [key, value] of Object.entries(compiled.tokens.borderWidths)) {
164
+ properties.push({
165
+ name: `--border-width-${key}`,
166
+ description: `Border width ${key}`,
167
+ syntax: '<length>',
168
+ value: value,
169
+ category: 'Border Tokens'
170
+ });
171
+ }
172
+ }
173
+
174
+ // Extract shadow tokens
175
+ if (compiled.tokens.shadows) {
176
+ for (const [key, value] of Object.entries(compiled.tokens.shadows)) {
177
+ properties.push({
178
+ name: `--shadow-${key}`,
179
+ description: `Shadow ${key}`,
180
+ syntax: '<shadow>',
181
+ value: value,
182
+ category: 'Shadow Tokens'
183
+ });
184
+ }
185
+ }
186
+
187
+ // Extract transition tokens
188
+ if (compiled.tokens.transitions) {
189
+ for (const [key, value] of Object.entries(compiled.tokens.transitions)) {
190
+ properties.push({
191
+ name: `--transition-${key}`,
192
+ description: `Transition ${key}`,
193
+ syntax: '<time>',
194
+ value: value,
195
+ category: 'Transition Tokens'
196
+ });
197
+ }
198
+ }
199
+
200
+ // Extract z-index tokens
201
+ if (compiled.tokens.zIndex) {
202
+ for (const [key, value] of Object.entries(compiled.tokens.zIndex)) {
203
+ properties.push({
204
+ name: `--z-${key}`,
205
+ description: `Z-index ${key}`,
206
+ syntax: '<integer>',
207
+ value: value,
208
+ category: 'Layout Tokens'
209
+ });
210
+ }
211
+ }
212
+
213
+ // Extract layout tokens
214
+ if (compiled.tokens.layout) {
215
+ for (const [key, value] of Object.entries(compiled.tokens.layout)) {
216
+ if (key === 'breakpoints') {
217
+ for (const [bp, bpValue] of Object.entries(value)) {
218
+ properties.push({
219
+ name: `--breakpoint-${bp}`,
220
+ description: `Breakpoint ${bp}`,
221
+ syntax: '<length>',
222
+ value: bpValue,
223
+ category: 'Layout Tokens'
224
+ });
225
+ }
226
+ } else {
227
+ properties.push({
228
+ name: `--layout-${key}`,
229
+ description: `Layout ${key}`,
230
+ syntax: '<length>',
231
+ value: value,
232
+ category: 'Layout Tokens'
233
+ });
234
+ }
235
+ }
236
+ }
237
+
238
+ // Surface tokens (semantic)
239
+ const surfaceTokens = [
240
+ { name: '--surface-bg', description: 'Surface background color', category: 'Surface Tokens' },
241
+ { name: '--surface-text', description: 'Surface text color', category: 'Surface Tokens' },
242
+ { name: '--surface-text-secondary', description: 'Surface secondary text color', category: 'Surface Tokens' },
243
+ { name: '--surface-border', description: 'Surface border color', category: 'Surface Tokens' },
244
+ { name: '--surface-shadow', description: 'Surface shadow', category: 'Surface Tokens' },
245
+ { name: '--surface-hover', description: 'Surface hover state', category: 'Surface Tokens' },
246
+ ];
247
+
248
+ for (const token of surfaceTokens) {
249
+ properties.push({
250
+ name: token.name,
251
+ description: token.description,
252
+ syntax: '<color>',
253
+ category: token.category
254
+ });
255
+ }
256
+
257
+ return properties;
258
+ }
259
+
260
+ /**
261
+ * Extract CSS classes from ontology and utilities
262
+ */
263
+ async function extractCSSClasses(ontology) {
264
+ const classes = [];
265
+
266
+ // Primitives
267
+ if (ontology.primitives) {
268
+ for (const primitive of ontology.primitives) {
269
+ for (const selector of primitive.selectors) {
270
+ // Only add class selectors
271
+ if (selector.startsWith('.')) {
272
+ const className = selector.slice(1);
273
+ classes.push({
274
+ name: className,
275
+ description: `${primitive.name} primitive component`,
276
+ category: 'Primitives'
277
+ });
278
+ }
279
+ }
280
+ }
281
+ }
282
+
283
+ // Components
284
+ if (ontology.components) {
285
+ for (const component of ontology.components) {
286
+ for (const selector of component.selectors) {
287
+ if (selector.startsWith('.')) {
288
+ const className = selector.slice(1);
289
+ classes.push({
290
+ name: className,
291
+ description: `${component.name} component`,
292
+ category: 'Components'
293
+ });
294
+ }
295
+ }
296
+ }
297
+ }
298
+
299
+ // Layout patterns
300
+ if (ontology.layoutPatterns) {
301
+ for (const pattern of ontology.layoutPatterns) {
302
+ for (const selector of pattern.selectors) {
303
+ if (selector.startsWith('.')) {
304
+ const className = selector.slice(1);
305
+ classes.push({
306
+ name: className,
307
+ description: pattern.description || `${pattern.name} layout pattern`,
308
+ category: 'Layout Utilities'
309
+ });
310
+ }
311
+ }
312
+ }
313
+ }
314
+
315
+ // Utilities - handle nested object structure
316
+ if (ontology.utilities && typeof ontology.utilities === 'object') {
317
+ // Recursively extract all selectors from nested utility categories
318
+ const extractSelectors = (obj, category = 'Utilities') => {
319
+ for (const [key, value] of Object.entries(obj)) {
320
+ if (Array.isArray(value)) {
321
+ // It's an array of selectors
322
+ for (const selector of value) {
323
+ if (typeof selector === 'string' && selector.startsWith('.')) {
324
+ const className = selector.slice(1);
325
+ classes.push({
326
+ name: className,
327
+ description: `${key} utility class`,
328
+ category
329
+ });
330
+ }
331
+ }
332
+ } else if (typeof value === 'object' && value !== null) {
333
+ // It's a nested object, recurse
334
+ extractSelectors(value, key);
335
+ }
336
+ }
337
+ };
338
+ extractSelectors(ontology.utilities);
339
+ }
340
+
341
+ return classes;
342
+ }
343
+
344
+ /**
345
+ * Generate common variants for wildcard utilities
346
+ */
347
+ function generateUtilityVariants(baseClass) {
348
+ const variants = [];
349
+
350
+ if (baseClass.includes('gap-')) {
351
+ // Gap utilities (0-12)
352
+ for (let i = 0; i <= 12; i++) {
353
+ variants.push({
354
+ name: `gap-${i}`,
355
+ description: `Gap spacing of ${i} units`
356
+ });
357
+ }
358
+ } else if (baseClass.includes('items-')) {
359
+ // Flexbox align-items
360
+ const alignments = ['start', 'end', 'center', 'baseline', 'stretch'];
361
+ for (const align of alignments) {
362
+ variants.push({
363
+ name: `items-${align}`,
364
+ description: `Align items: ${align}`
365
+ });
366
+ }
367
+ } else if (baseClass.includes('justify-')) {
368
+ // Flexbox justify-content
369
+ const justifications = ['start', 'end', 'center', 'between', 'around', 'evenly'];
370
+ for (const justify of justifications) {
371
+ variants.push({
372
+ name: `justify-${justify}`,
373
+ description: `Justify content: ${justify}`
374
+ });
375
+ }
376
+ } else if (baseClass.includes('border-glow-')) {
377
+ // Border glow variants
378
+ const colors = ['primary', 'secondary', 'accent', 'success', 'warning', 'danger', 'info'];
379
+ for (const color of colors) {
380
+ variants.push({
381
+ name: `border-glow-${color}`,
382
+ description: `Border glow effect with ${color} color`
383
+ });
384
+ }
385
+ }
386
+
387
+ return variants;
388
+ }
389
+
390
+ /**
391
+ * Extract data attributes from enhancements
392
+ */
393
+ function extractDataAttributes(ontology) {
394
+ const attributes = [];
395
+
396
+ if (ontology.enhancements) {
397
+ for (const enhancement of ontology.enhancements) {
398
+ // Extract data attributes from selectors like "[data-dropdown]"
399
+ const matches = enhancement.match(/\[data-([^\]]+)\]/g);
400
+ if (matches) {
401
+ for (const match of matches) {
402
+ const attrName = match.slice(1, -1); // Remove [ and ]
403
+ attributes.push({
404
+ name: attrName,
405
+ description: `Enhancement: ${enhancement}`,
406
+ category: 'Data Enhancements'
407
+ });
408
+ }
409
+ }
410
+ }
411
+ }
412
+
413
+ return attributes;
414
+ }
415
+
416
+ /**
417
+ * Convert to VS Code CSS custom data format
418
+ */
419
+ function toVSCodeFormat(properties, classes) {
420
+ return {
421
+ version: 1.1,
422
+ properties: properties.map(prop => ({
423
+ name: prop.name,
424
+ description: prop.description,
425
+ syntax: prop.syntax || '<custom-ident>',
426
+ ...(prop.value && { references: [{ name: 'Value', url: `data:text/plain,${encodeURIComponent(prop.value)}` }] })
427
+ })),
428
+ atDirectives: [],
429
+ pseudoClasses: classes.map(cls => ({
430
+ name: cls.name,
431
+ description: cls.description
432
+ })).slice(0, 100), // Limit for performance
433
+ pseudoElements: []
434
+ };
435
+ }
436
+
437
+ /**
438
+ * Convert to standard CSS data format (for other editors)
439
+ */
440
+ function toStandardFormat(properties, classes, attributes) {
441
+ return {
442
+ version: '1.1',
443
+ cssProperties: properties.map(prop => ({
444
+ name: prop.name,
445
+ description: prop.description,
446
+ syntax: prop.syntax || '<custom-ident>',
447
+ value: prop.value || undefined,
448
+ category: prop.category
449
+ })),
450
+ cssClasses: classes.map(cls => ({
451
+ name: cls.name,
452
+ description: cls.description,
453
+ category: cls.category
454
+ })),
455
+ dataAttributes: attributes.map(attr => ({
456
+ name: attr.name,
457
+ description: attr.description,
458
+ category: attr.category
459
+ })),
460
+ metadata: {
461
+ generator: 'PDS CSS Data Generator',
462
+ generatedAt: new Date().toISOString(),
463
+ totalProperties: properties.length,
464
+ totalClasses: classes.length,
465
+ totalAttributes: attributes.length
466
+ }
467
+ };
468
+ }
469
+
470
+ /**
471
+ * Generate CSS IntelliSense data files
472
+ */
473
+ async function generateCSSData(targetDir) {
474
+ try {
475
+ log('šŸŽØ Generating CSS IntelliSense data...', 'bold');
476
+
477
+ // Import Generator and ontology
478
+ const generatorPath = path.join(repoRoot, 'src/js/pds-core/pds-generator.js');
479
+ const ontologyPath = path.join(repoRoot, 'src/js/pds-core/pds-ontology.js');
480
+ const configPath = path.join(repoRoot, 'src/js/pds-core/pds-config.js');
481
+
482
+ log('šŸ“¦ Loading PDS modules...', 'blue');
483
+ const { Generator } = await import(pathToFileURL(generatorPath).href);
484
+ const { ontology } = await import(pathToFileURL(ontologyPath).href);
485
+ const { presets } = await import(pathToFileURL(configPath).href);
486
+
487
+ // Generate design system with default preset
488
+ log('āš™ļø Generating design system...', 'blue');
489
+ const generator = new Generator({ preset: 'default', design: presets.default });
490
+
491
+ // Extract data
492
+ log('šŸ” Extracting CSS properties...', 'blue');
493
+ const properties = extractCSSProperties(generator);
494
+ log(` Found ${properties.length} CSS custom properties`, 'cyan');
495
+
496
+ log('šŸ” Extracting CSS classes...', 'blue');
497
+ const classes = await extractCSSClasses(ontology);
498
+ log(` Found ${classes.length} CSS classes`, 'cyan');
499
+
500
+ log('šŸ” Extracting data attributes...', 'blue');
501
+ const attributes = extractDataAttributes(ontology);
502
+ log(` Found ${attributes.length} data attributes`, 'cyan');
503
+
504
+ // Generate VS Code format
505
+ log('šŸ“ Generating VS Code CSS custom data...', 'blue');
506
+ const vscodeData = toVSCodeFormat(properties, classes);
507
+
508
+ // Generate standard format
509
+ log('šŸ“ Generating standard CSS data...', 'blue');
510
+ const standardData = toStandardFormat(properties, classes, attributes);
511
+
512
+ // Write files to repository
513
+ const vscodeOutputPath = path.join(repoRoot, 'public/assets/pds/pds.css-data.json');
514
+ const standardOutputPath = path.join(repoRoot, 'public/assets/pds/pds-css-complete.json');
515
+
516
+ await mkdir(path.dirname(vscodeOutputPath), { recursive: true });
517
+ await writeFile(vscodeOutputPath, JSON.stringify(vscodeData, null, 2), 'utf-8');
518
+ log(`āœ… VS Code CSS data: ${path.relative(repoRoot, vscodeOutputPath)}`, 'green');
519
+
520
+ await writeFile(standardOutputPath, JSON.stringify(standardData, null, 2), 'utf-8');
521
+ log(`āœ… Standard CSS data: ${path.relative(repoRoot, standardOutputPath)}`, 'green');
522
+
523
+ // Copy to target directory if specified
524
+ if (targetDir) {
525
+ const targetVSCodePath = path.join(targetDir, 'pds.css-data.json');
526
+ const targetStandardPath = path.join(targetDir, 'pds-css-complete.json');
527
+
528
+ await mkdir(targetDir, { recursive: true });
529
+ await writeFile(targetVSCodePath, JSON.stringify(vscodeData, null, 2), 'utf-8');
530
+ await writeFile(targetStandardPath, JSON.stringify(standardData, null, 2), 'utf-8');
531
+
532
+ log(`āœ… Copied to ${path.relative(process.cwd(), targetDir)}`, 'green');
533
+ }
534
+
535
+ // Create workspace settings reference
536
+ const settingsRef = {
537
+ "css.customData": ["public/assets/pds/pds.css-data.json"]
538
+ };
539
+ const settingsPath = path.join(repoRoot, 'pds.css-data.json');
540
+ await writeFile(settingsPath, JSON.stringify(settingsRef, null, 2), 'utf-8');
541
+ log(`āœ… Created settings reference: pds.css-data.json`, 'green');
542
+
543
+ log('\n✨ CSS IntelliSense data generation complete!', 'bold');
544
+ log('šŸ“š To enable in VS Code, add to .vscode/settings.json:', 'cyan');
545
+ log(' "css.customData": ["node_modules/pure-ds/public/assets/pds/pds.css-data.json"]', 'blue');
546
+
547
+ return true;
548
+ } catch (error) {
549
+ log(`āŒ Error generating CSS data: ${error.message}`, 'red');
550
+ console.error(error);
551
+ return false;
552
+ }
553
+ }
554
+
555
+ export { generateCSSData };
556
+
557
+ // Run if called directly
558
+ if (process.argv[1] && process.argv[1].endsWith('generate-css-data.js')) {
559
+ const targetDir = process.argv[2] || null;
560
+ generateCSSData(targetDir).then(success => {
561
+ process.exit(success ? 0 : 1);
562
+ });
563
+ }