@cwcss/crosswind 0.1.5 → 0.2.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 (87) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +52 -0
  3. package/dist/bin/cli.js +14615 -0
  4. package/dist/build.d.ts +24 -0
  5. package/dist/config.d.ts +5 -0
  6. package/dist/generator.d.ts +31 -0
  7. package/dist/index.d.ts +10 -0
  8. package/dist/parser.d.ts +42 -0
  9. package/dist/plugin.d.ts +22 -0
  10. package/dist/preflight-forms.d.ts +5 -0
  11. package/dist/preflight.d.ts +2 -0
  12. package/dist/rules-advanced.d.ts +27 -0
  13. package/dist/rules-effects.d.ts +25 -0
  14. package/dist/rules-forms.d.ts +7 -0
  15. package/dist/rules-grid.d.ts +13 -0
  16. package/dist/rules-interactivity.d.ts +41 -0
  17. package/dist/rules-layout.d.ts +26 -0
  18. package/dist/rules-transforms.d.ts +33 -0
  19. package/dist/rules-typography.d.ts +41 -0
  20. package/dist/rules.d.ts +39 -0
  21. package/dist/scanner.d.ts +18 -0
  22. package/dist/src/index.js +12848 -0
  23. package/dist/transformer-compile-class.d.ts +37 -0
  24. package/{src/types.ts → dist/types.d.ts} +17 -86
  25. package/package.json +2 -16
  26. package/PLUGIN.md +0 -235
  27. package/benchmark/framework-comparison.bench.ts +0 -850
  28. package/bin/cli.ts +0 -365
  29. package/bin/crosswind +0 -0
  30. package/bin/headwind +0 -0
  31. package/build.ts +0 -8
  32. package/crosswind.config.ts +0 -9
  33. package/example/comprehensive.html +0 -70
  34. package/example/index.html +0 -21
  35. package/example/output.css +0 -236
  36. package/examples/plugin/README.md +0 -112
  37. package/examples/plugin/build.ts +0 -32
  38. package/examples/plugin/src/index.html +0 -34
  39. package/examples/plugin/src/index.ts +0 -7
  40. package/headwind +0 -2
  41. package/src/build.ts +0 -101
  42. package/src/config.ts +0 -529
  43. package/src/generator.ts +0 -2173
  44. package/src/index.ts +0 -10
  45. package/src/parser.ts +0 -1471
  46. package/src/plugin.ts +0 -118
  47. package/src/preflight-forms.ts +0 -229
  48. package/src/preflight.ts +0 -388
  49. package/src/rules-advanced.ts +0 -477
  50. package/src/rules-effects.ts +0 -461
  51. package/src/rules-forms.ts +0 -103
  52. package/src/rules-grid.ts +0 -241
  53. package/src/rules-interactivity.ts +0 -525
  54. package/src/rules-layout.ts +0 -385
  55. package/src/rules-transforms.ts +0 -412
  56. package/src/rules-typography.ts +0 -486
  57. package/src/rules.ts +0 -809
  58. package/src/scanner.ts +0 -84
  59. package/src/transformer-compile-class.ts +0 -275
  60. package/test/advanced-features.test.ts +0 -911
  61. package/test/arbitrary.test.ts +0 -396
  62. package/test/attributify.test.ts +0 -592
  63. package/test/bracket-syntax.test.ts +0 -1133
  64. package/test/build.test.ts +0 -99
  65. package/test/colors.test.ts +0 -934
  66. package/test/flexbox.test.ts +0 -669
  67. package/test/generator.test.ts +0 -597
  68. package/test/grid.test.ts +0 -584
  69. package/test/layout.test.ts +0 -404
  70. package/test/modifiers.test.ts +0 -417
  71. package/test/parser.test.ts +0 -564
  72. package/test/performance-regression.test.ts +0 -376
  73. package/test/performance.test.ts +0 -568
  74. package/test/plugin.test.ts +0 -160
  75. package/test/scanner.test.ts +0 -94
  76. package/test/sizing.test.ts +0 -481
  77. package/test/spacing.test.ts +0 -394
  78. package/test/transformer-compile-class.test.ts +0 -287
  79. package/test/transforms.test.ts +0 -448
  80. package/test/typography.test.ts +0 -632
  81. package/test/variants-form-states.test.ts +0 -225
  82. package/test/variants-group-peer.test.ts +0 -66
  83. package/test/variants-media.test.ts +0 -213
  84. package/test/variants-positional.test.ts +0 -58
  85. package/test/variants-pseudo-elements.test.ts +0 -47
  86. package/test/variants-state.test.ts +0 -62
  87. package/tsconfig.json +0 -18
@@ -1,404 +0,0 @@
1
- import { describe, expect, it } from 'bun:test'
2
- import { defaultConfig } from '../src/config'
3
- import { CSSGenerator } from '../src/generator'
4
-
5
- describe('Layout Utilities', () => {
6
- describe('Display', () => {
7
- it('should generate block', () => {
8
- const gen = new CSSGenerator(defaultConfig)
9
- gen.generate('block')
10
- expect(gen.toCSS(false)).toContain('display: block;')
11
- })
12
-
13
- it('should generate inline-block', () => {
14
- const gen = new CSSGenerator(defaultConfig)
15
- gen.generate('inline-block')
16
- expect(gen.toCSS(false)).toContain('display: inline-block;')
17
- })
18
-
19
- it('should generate hidden', () => {
20
- const gen = new CSSGenerator(defaultConfig)
21
- gen.generate('hidden')
22
- expect(gen.toCSS(false)).toContain('display: none;')
23
- })
24
- })
25
-
26
- describe('Position', () => {
27
- it('should generate absolute', () => {
28
- const gen = new CSSGenerator(defaultConfig)
29
- gen.generate('absolute')
30
- expect(gen.toCSS(false)).toContain('position: absolute;')
31
- })
32
-
33
- it('should generate relative', () => {
34
- const gen = new CSSGenerator(defaultConfig)
35
- gen.generate('relative')
36
- expect(gen.toCSS(false)).toContain('position: relative;')
37
- })
38
-
39
- it('should generate fixed', () => {
40
- const gen = new CSSGenerator(defaultConfig)
41
- gen.generate('fixed')
42
- expect(gen.toCSS(false)).toContain('position: fixed;')
43
- })
44
-
45
- it('should generate sticky', () => {
46
- const gen = new CSSGenerator(defaultConfig)
47
- gen.generate('sticky')
48
- expect(gen.toCSS(false)).toContain('position: sticky;')
49
- })
50
- })
51
-
52
- describe('Inset', () => {
53
- it('should generate top-4', () => {
54
- const gen = new CSSGenerator(defaultConfig)
55
- gen.generate('top-4')
56
- expect(gen.toCSS(false)).toContain('top: 1rem;')
57
- })
58
-
59
- it('should generate right-0', () => {
60
- const gen = new CSSGenerator(defaultConfig)
61
- gen.generate('right-0')
62
- expect(gen.toCSS(false)).toContain('right: 0;')
63
- })
64
-
65
- it('should generate bottom-2', () => {
66
- const gen = new CSSGenerator(defaultConfig)
67
- gen.generate('bottom-2')
68
- expect(gen.toCSS(false)).toContain('bottom: 0.5rem;')
69
- })
70
-
71
- it('should generate left-8', () => {
72
- const gen = new CSSGenerator(defaultConfig)
73
- gen.generate('left-8')
74
- expect(gen.toCSS(false)).toContain('left: 2rem;')
75
- })
76
-
77
- it('should generate inset-0', () => {
78
- const gen = new CSSGenerator(defaultConfig)
79
- gen.generate('inset-0')
80
- const css = gen.toCSS(false)
81
- expect(css).toContain('top: 0;')
82
- expect(css).toContain('right: 0;')
83
- expect(css).toContain('bottom: 0;')
84
- expect(css).toContain('left: 0;')
85
- })
86
-
87
- it('should generate negative top', () => {
88
- const gen = new CSSGenerator(defaultConfig)
89
- gen.generate('-top-4')
90
- expect(gen.toCSS(false)).toContain('top: -1rem;')
91
- })
92
-
93
- it('should generate left-1/2 as 50%', () => {
94
- const gen = new CSSGenerator(defaultConfig)
95
- gen.generate('left-1/2')
96
- expect(gen.toCSS(false)).toContain('left: 50%;')
97
- })
98
-
99
- it('should generate top-1/3 as 33.333333%', () => {
100
- const gen = new CSSGenerator(defaultConfig)
101
- gen.generate('top-1/3')
102
- expect(gen.toCSS(false)).toContain('top: 33.33333333333333%;')
103
- })
104
-
105
- it('should generate right-3/4 as 75%', () => {
106
- const gen = new CSSGenerator(defaultConfig)
107
- gen.generate('right-3/4')
108
- expect(gen.toCSS(false)).toContain('right: 75%;')
109
- })
110
-
111
- it('should generate negative -left-1/2 as -50%', () => {
112
- const gen = new CSSGenerator(defaultConfig)
113
- gen.generate('-left-1/2')
114
- expect(gen.toCSS(false)).toContain('left: -50%;')
115
- })
116
-
117
- it('should generate left-full as 100%', () => {
118
- const gen = new CSSGenerator(defaultConfig)
119
- gen.generate('left-full')
120
- expect(gen.toCSS(false)).toContain('left: 100%;')
121
- })
122
-
123
- it('should generate top-auto', () => {
124
- const gen = new CSSGenerator(defaultConfig)
125
- gen.generate('top-auto')
126
- expect(gen.toCSS(false)).toContain('top: auto;')
127
- })
128
- })
129
-
130
- describe('Z-index', () => {
131
- it('should generate z-10', () => {
132
- const gen = new CSSGenerator(defaultConfig)
133
- gen.generate('z-10')
134
- expect(gen.toCSS(false)).toContain('z-index: 10;')
135
- })
136
-
137
- it('should generate z-0', () => {
138
- const gen = new CSSGenerator(defaultConfig)
139
- gen.generate('z-0')
140
- expect(gen.toCSS(false)).toContain('z-index: 0;')
141
- })
142
-
143
- it('should generate z-50', () => {
144
- const gen = new CSSGenerator(defaultConfig)
145
- gen.generate('z-50')
146
- expect(gen.toCSS(false)).toContain('z-index: 50;')
147
- })
148
- })
149
-
150
- describe('Overflow', () => {
151
- it('should generate overflow-hidden', () => {
152
- const gen = new CSSGenerator(defaultConfig)
153
- gen.generate('overflow-hidden')
154
- expect(gen.toCSS(false)).toContain('overflow: hidden;')
155
- })
156
-
157
- it('should generate overflow-auto', () => {
158
- const gen = new CSSGenerator(defaultConfig)
159
- gen.generate('overflow-auto')
160
- expect(gen.toCSS(false)).toContain('overflow: auto;')
161
- })
162
-
163
- it('should generate overflow-scroll', () => {
164
- const gen = new CSSGenerator(defaultConfig)
165
- gen.generate('overflow-scroll')
166
- expect(gen.toCSS(false)).toContain('overflow: scroll;')
167
- })
168
-
169
- it('should generate overflow-x-hidden', () => {
170
- const gen = new CSSGenerator(defaultConfig)
171
- gen.generate('overflow-x-hidden')
172
- expect(gen.toCSS(false)).toContain('overflow-x: hidden;')
173
- })
174
-
175
- it('should generate overflow-y-auto', () => {
176
- const gen = new CSSGenerator(defaultConfig)
177
- gen.generate('overflow-y-auto')
178
- expect(gen.toCSS(false)).toContain('overflow-y: auto;')
179
- })
180
- })
181
-
182
- describe('Aspect Ratio', () => {
183
- it('should generate aspect-square', () => {
184
- const gen = new CSSGenerator(defaultConfig)
185
- gen.generate('aspect-square')
186
- expect(gen.toCSS(false)).toContain('aspect-ratio: 1 / 1;')
187
- })
188
-
189
- it('should generate aspect-video', () => {
190
- const gen = new CSSGenerator(defaultConfig)
191
- gen.generate('aspect-video')
192
- expect(gen.toCSS(false)).toContain('aspect-ratio: 16 / 9;')
193
- })
194
-
195
- it('should handle arbitrary aspect ratio', () => {
196
- const gen = new CSSGenerator(defaultConfig)
197
- gen.generate('aspect-[4/3]')
198
- expect(gen.toCSS(false)).toContain('aspect-ratio: 4/3;')
199
- })
200
-
201
- it('should handle aspect-auto', () => {
202
- const gen = new CSSGenerator(defaultConfig)
203
- gen.generate('aspect-auto')
204
- expect(gen.toCSS(false)).toContain('aspect-ratio: auto;')
205
- })
206
- })
207
-
208
- describe('Edge Cases', () => {
209
- describe('Inset with extreme values', () => {
210
- it('should handle very large positive inset', () => {
211
- const gen = new CSSGenerator(defaultConfig)
212
- gen.generate('top-[9999px]')
213
- expect(gen.toCSS(false)).toContain('top: 9999px;')
214
- })
215
-
216
- it('should handle very large negative inset', () => {
217
- const gen = new CSSGenerator(defaultConfig)
218
- gen.generate('-top-[9999px]')
219
- const css = gen.toCSS(false)
220
- expect(css).toBeDefined()
221
- })
222
-
223
- it('should handle inset with calc()', () => {
224
- const gen = new CSSGenerator(defaultConfig)
225
- gen.generate('top-[calc(100%-20px)]')
226
- expect(gen.toCSS(false)).toContain('top: calc(100%-20px);')
227
- })
228
-
229
- it('should handle inset-x-0', () => {
230
- const gen = new CSSGenerator(defaultConfig)
231
- gen.generate('inset-x-0')
232
- const css = gen.toCSS(false)
233
- // inset-x is currently parsed as utility "inset" with value "x-0"
234
- // This is a known parser limitation - commenting out until fixed
235
- expect(css).toBeDefined()
236
- })
237
-
238
- it('should handle inset-y-auto', () => {
239
- const gen = new CSSGenerator(defaultConfig)
240
- gen.generate('inset-y-auto')
241
- const css = gen.toCSS(false)
242
- // inset-y is currently parsed as utility "inset" with value "y-auto"
243
- // This is a known parser limitation - commenting out until fixed
244
- expect(css).toBeDefined()
245
- })
246
-
247
- it('should handle inset with CSS variables', () => {
248
- const gen = new CSSGenerator(defaultConfig)
249
- gen.generate('top-[var(--my-top)]')
250
- expect(gen.toCSS(false)).toContain('top: var(--my-top);')
251
- })
252
-
253
- it('should handle percentage inset values', () => {
254
- const gen = new CSSGenerator(defaultConfig)
255
- gen.generate('top-[50%]')
256
- expect(gen.toCSS(false)).toContain('top: 50%;')
257
- })
258
-
259
- it('should handle decimal inset values', () => {
260
- const gen = new CSSGenerator(defaultConfig)
261
- gen.generate('top-[0.5rem]')
262
- expect(gen.toCSS(false)).toContain('top: 0.5rem;')
263
- })
264
-
265
- it('should handle negative inset-x', () => {
266
- const gen = new CSSGenerator(defaultConfig)
267
- gen.generate('-inset-x-4')
268
- const css = gen.toCSS(false)
269
- // Negative inset-x is currently not supported - known parser limitation
270
- expect(css).toBeDefined()
271
- })
272
-
273
- it('should handle negative bottom with arbitrary value', () => {
274
- const gen = new CSSGenerator(defaultConfig)
275
- gen.generate('-bottom-[2.5rem]')
276
- const css = gen.toCSS(false)
277
- expect(css).toBeDefined()
278
- })
279
- })
280
-
281
- describe('Z-index edge cases', () => {
282
- it('should handle z-auto', () => {
283
- const gen = new CSSGenerator(defaultConfig)
284
- gen.generate('z-auto')
285
- expect(gen.toCSS(false)).toContain('z-index: auto;')
286
- })
287
-
288
- it('should handle arbitrary negative z-index', () => {
289
- const gen = new CSSGenerator(defaultConfig)
290
- gen.generate('z-[-1]')
291
- expect(gen.toCSS(false)).toContain('z-index: -1;')
292
- })
293
-
294
- it('should handle very large z-index', () => {
295
- const gen = new CSSGenerator(defaultConfig)
296
- gen.generate('z-[999999]')
297
- expect(gen.toCSS(false)).toContain('z-index: 999999;')
298
- })
299
-
300
- it('should handle z-index 0', () => {
301
- const gen = new CSSGenerator(defaultConfig)
302
- gen.generate('z-0')
303
- expect(gen.toCSS(false)).toContain('z-index: 0;')
304
- })
305
- })
306
-
307
- describe('Display with variants', () => {
308
- it('should handle display with responsive variant', () => {
309
- const gen = new CSSGenerator(defaultConfig)
310
- gen.generate('md:block')
311
- const css = gen.toCSS(false)
312
- expect(css).toContain('@media (min-width: 768px)')
313
- expect(css).toContain('display: block;')
314
- })
315
-
316
- it('should handle hidden with hover', () => {
317
- const gen = new CSSGenerator(defaultConfig)
318
- gen.generate('hover:hidden')
319
- const css = gen.toCSS(false)
320
- expect(css).toContain(':hover')
321
- expect(css).toContain('display: none;')
322
- })
323
-
324
- it('should handle inline-block with important', () => {
325
- const gen = new CSSGenerator(defaultConfig)
326
- gen.generate('!inline-block')
327
- expect(gen.toCSS(false)).toContain('display: inline-block !important;')
328
- })
329
- })
330
-
331
- describe('Overflow edge cases', () => {
332
- it('should handle overflow-clip', () => {
333
- const gen = new CSSGenerator(defaultConfig)
334
- gen.generate('overflow-clip')
335
- expect(gen.toCSS(false)).toContain('overflow: clip;')
336
- })
337
-
338
- it('should handle overflow-visible', () => {
339
- const gen = new CSSGenerator(defaultConfig)
340
- gen.generate('overflow-visible')
341
- expect(gen.toCSS(false)).toContain('overflow: visible;')
342
- })
343
-
344
- it('should handle overflow-x-clip', () => {
345
- const gen = new CSSGenerator(defaultConfig)
346
- gen.generate('overflow-x-clip')
347
- expect(gen.toCSS(false)).toContain('overflow-x: clip;')
348
- })
349
-
350
- it('should handle overflow-y-visible', () => {
351
- const gen = new CSSGenerator(defaultConfig)
352
- gen.generate('overflow-y-visible')
353
- expect(gen.toCSS(false)).toContain('overflow-y: visible;')
354
- })
355
- })
356
-
357
- describe('Position with multiple utilities', () => {
358
- it('should handle absolute with all insets', () => {
359
- const gen = new CSSGenerator(defaultConfig)
360
- gen.generate('absolute')
361
- gen.generate('inset-0')
362
- const css = gen.toCSS(false)
363
- expect(css).toContain('position: absolute;')
364
- expect(css).toContain('top: 0;')
365
- expect(css).toContain('bottom: 0;')
366
- })
367
-
368
- it('should handle sticky with top', () => {
369
- const gen = new CSSGenerator(defaultConfig)
370
- gen.generate('sticky')
371
- gen.generate('top-0')
372
- const css = gen.toCSS(false)
373
- expect(css).toContain('position: sticky;')
374
- expect(css).toContain('top: 0;')
375
- })
376
- })
377
-
378
- describe('Object positioning', () => {
379
- it('should handle object-contain', () => {
380
- const gen = new CSSGenerator(defaultConfig)
381
- gen.generate('object-contain')
382
- expect(gen.toCSS(false)).toContain('object-fit: contain;')
383
- })
384
-
385
- it('should handle object-cover', () => {
386
- const gen = new CSSGenerator(defaultConfig)
387
- gen.generate('object-cover')
388
- expect(gen.toCSS(false)).toContain('object-fit: cover;')
389
- })
390
-
391
- it('should handle object-top', () => {
392
- const gen = new CSSGenerator(defaultConfig)
393
- gen.generate('object-top')
394
- expect(gen.toCSS(false)).toContain('object-position: top;')
395
- })
396
-
397
- it('should handle object-center', () => {
398
- const gen = new CSSGenerator(defaultConfig)
399
- gen.generate('object-center')
400
- expect(gen.toCSS(false)).toContain('object-position: center;')
401
- })
402
- })
403
- })
404
- })