@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.
- package/LICENSE.md +21 -0
- package/README.md +52 -0
- package/dist/bin/cli.js +14615 -0
- package/dist/build.d.ts +24 -0
- package/dist/config.d.ts +5 -0
- package/dist/generator.d.ts +31 -0
- package/dist/index.d.ts +10 -0
- package/dist/parser.d.ts +42 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/preflight-forms.d.ts +5 -0
- package/dist/preflight.d.ts +2 -0
- package/dist/rules-advanced.d.ts +27 -0
- package/dist/rules-effects.d.ts +25 -0
- package/dist/rules-forms.d.ts +7 -0
- package/dist/rules-grid.d.ts +13 -0
- package/dist/rules-interactivity.d.ts +41 -0
- package/dist/rules-layout.d.ts +26 -0
- package/dist/rules-transforms.d.ts +33 -0
- package/dist/rules-typography.d.ts +41 -0
- package/dist/rules.d.ts +39 -0
- package/dist/scanner.d.ts +18 -0
- package/dist/src/index.js +12848 -0
- package/dist/transformer-compile-class.d.ts +37 -0
- package/{src/types.ts → dist/types.d.ts} +17 -86
- package/package.json +2 -16
- package/PLUGIN.md +0 -235
- package/benchmark/framework-comparison.bench.ts +0 -850
- package/bin/cli.ts +0 -365
- package/bin/crosswind +0 -0
- package/bin/headwind +0 -0
- package/build.ts +0 -8
- package/crosswind.config.ts +0 -9
- package/example/comprehensive.html +0 -70
- package/example/index.html +0 -21
- package/example/output.css +0 -236
- package/examples/plugin/README.md +0 -112
- package/examples/plugin/build.ts +0 -32
- package/examples/plugin/src/index.html +0 -34
- package/examples/plugin/src/index.ts +0 -7
- package/headwind +0 -2
- package/src/build.ts +0 -101
- package/src/config.ts +0 -529
- package/src/generator.ts +0 -2173
- package/src/index.ts +0 -10
- package/src/parser.ts +0 -1471
- package/src/plugin.ts +0 -118
- package/src/preflight-forms.ts +0 -229
- package/src/preflight.ts +0 -388
- package/src/rules-advanced.ts +0 -477
- package/src/rules-effects.ts +0 -461
- package/src/rules-forms.ts +0 -103
- package/src/rules-grid.ts +0 -241
- package/src/rules-interactivity.ts +0 -525
- package/src/rules-layout.ts +0 -385
- package/src/rules-transforms.ts +0 -412
- package/src/rules-typography.ts +0 -486
- package/src/rules.ts +0 -809
- package/src/scanner.ts +0 -84
- package/src/transformer-compile-class.ts +0 -275
- package/test/advanced-features.test.ts +0 -911
- package/test/arbitrary.test.ts +0 -396
- package/test/attributify.test.ts +0 -592
- package/test/bracket-syntax.test.ts +0 -1133
- package/test/build.test.ts +0 -99
- package/test/colors.test.ts +0 -934
- package/test/flexbox.test.ts +0 -669
- package/test/generator.test.ts +0 -597
- package/test/grid.test.ts +0 -584
- package/test/layout.test.ts +0 -404
- package/test/modifiers.test.ts +0 -417
- package/test/parser.test.ts +0 -564
- package/test/performance-regression.test.ts +0 -376
- package/test/performance.test.ts +0 -568
- package/test/plugin.test.ts +0 -160
- package/test/scanner.test.ts +0 -94
- package/test/sizing.test.ts +0 -481
- package/test/spacing.test.ts +0 -394
- package/test/transformer-compile-class.test.ts +0 -287
- package/test/transforms.test.ts +0 -448
- package/test/typography.test.ts +0 -632
- package/test/variants-form-states.test.ts +0 -225
- package/test/variants-group-peer.test.ts +0 -66
- package/test/variants-media.test.ts +0 -213
- package/test/variants-positional.test.ts +0 -58
- package/test/variants-pseudo-elements.test.ts +0 -47
- package/test/variants-state.test.ts +0 -62
- package/tsconfig.json +0 -18
package/test/grid.test.ts
DELETED
|
@@ -1,584 +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('Grid Utilities', () => {
|
|
6
|
-
describe('Display', () => {
|
|
7
|
-
it('should generate grid', () => {
|
|
8
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
9
|
-
gen.generate('grid')
|
|
10
|
-
expect(gen.toCSS(false)).toContain('display: grid;')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('should generate inline-grid', () => {
|
|
14
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
15
|
-
gen.generate('inline-grid')
|
|
16
|
-
expect(gen.toCSS(false)).toContain('display: inline-grid;')
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe('Grid Template Columns', () => {
|
|
21
|
-
it('should generate grid-cols-3', () => {
|
|
22
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
23
|
-
gen.generate('grid-cols-3')
|
|
24
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: repeat(3, minmax(0, 1fr));')
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('should generate grid-cols-12', () => {
|
|
28
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
29
|
-
gen.generate('grid-cols-12')
|
|
30
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: repeat(12, minmax(0, 1fr));')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('should generate grid-cols-none', () => {
|
|
34
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
35
|
-
gen.generate('grid-cols-none')
|
|
36
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: none;')
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
describe('Grid Template Rows', () => {
|
|
41
|
-
it('should generate grid-rows-2', () => {
|
|
42
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
43
|
-
gen.generate('grid-rows-2')
|
|
44
|
-
expect(gen.toCSS(false)).toContain('grid-template-rows: repeat(2, minmax(0, 1fr));')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('should generate grid-rows-6', () => {
|
|
48
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
49
|
-
gen.generate('grid-rows-6')
|
|
50
|
-
expect(gen.toCSS(false)).toContain('grid-template-rows: repeat(6, minmax(0, 1fr));')
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
describe('Gap', () => {
|
|
55
|
-
it('should generate gap-4', () => {
|
|
56
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
57
|
-
gen.generate('gap-4')
|
|
58
|
-
expect(gen.toCSS(false)).toContain('gap: 1rem;')
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('should generate gap-x-2', () => {
|
|
62
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
63
|
-
gen.generate('gap-x-2')
|
|
64
|
-
expect(gen.toCSS(false)).toContain('column-gap: 0.5rem;')
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('should generate gap-y-8', () => {
|
|
68
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
69
|
-
gen.generate('gap-y-8')
|
|
70
|
-
expect(gen.toCSS(false)).toContain('row-gap: 2rem;')
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
describe('Justify Items', () => {
|
|
75
|
-
it('should generate justify-items-center', () => {
|
|
76
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
77
|
-
gen.generate('justify-items-center')
|
|
78
|
-
expect(gen.toCSS(false)).toContain('justify-items: center;')
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it('should generate justify-items-start', () => {
|
|
82
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
83
|
-
gen.generate('justify-items-start')
|
|
84
|
-
expect(gen.toCSS(false)).toContain('justify-items: start;')
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('should generate justify-items-end', () => {
|
|
88
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
89
|
-
gen.generate('justify-items-end')
|
|
90
|
-
expect(gen.toCSS(false)).toContain('justify-items: end;')
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('should generate justify-items-stretch', () => {
|
|
94
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
95
|
-
gen.generate('justify-items-stretch')
|
|
96
|
-
expect(gen.toCSS(false)).toContain('justify-items: stretch;')
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
describe('Align Content', () => {
|
|
101
|
-
it('should generate content-between', () => {
|
|
102
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
103
|
-
gen.generate('content-between')
|
|
104
|
-
expect(gen.toCSS(false)).toContain('align-content: space-between;')
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
it('should generate content-center', () => {
|
|
108
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
109
|
-
gen.generate('content-center')
|
|
110
|
-
expect(gen.toCSS(false)).toContain('align-content: center;')
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('should generate content-start', () => {
|
|
114
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
115
|
-
gen.generate('content-start')
|
|
116
|
-
expect(gen.toCSS(false)).toContain('align-content: flex-start;')
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
it('should generate content-end', () => {
|
|
120
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
121
|
-
gen.generate('content-end')
|
|
122
|
-
expect(gen.toCSS(false)).toContain('align-content: flex-end;')
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
it('should generate content-around', () => {
|
|
126
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
127
|
-
gen.generate('content-around')
|
|
128
|
-
expect(gen.toCSS(false)).toContain('align-content: space-around;')
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
it('should generate content-evenly', () => {
|
|
132
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
133
|
-
gen.generate('content-evenly')
|
|
134
|
-
expect(gen.toCSS(false)).toContain('align-content: space-evenly;')
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
describe('Grid Auto Flow', () => {
|
|
139
|
-
it('should generate grid-flow-row', () => {
|
|
140
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
141
|
-
gen.generate('grid-flow-row')
|
|
142
|
-
expect(gen.toCSS(false)).toContain('grid-auto-flow: row;')
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
it('should generate grid-flow-col', () => {
|
|
146
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
147
|
-
gen.generate('grid-flow-col')
|
|
148
|
-
expect(gen.toCSS(false)).toContain('grid-auto-flow: column;')
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
it('should generate grid-flow-dense', () => {
|
|
152
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
153
|
-
gen.generate('grid-flow-dense')
|
|
154
|
-
expect(gen.toCSS(false)).toContain('grid-auto-flow: dense;')
|
|
155
|
-
})
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
describe('Grid Column Span', () => {
|
|
159
|
-
it('should generate col-span-2', () => {
|
|
160
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
161
|
-
gen.generate('col-span-2')
|
|
162
|
-
expect(gen.toCSS(false)).toContain('grid-column: span 2 / span 2;')
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
it('should generate col-span-full', () => {
|
|
166
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
167
|
-
gen.generate('col-span-full')
|
|
168
|
-
expect(gen.toCSS(false)).toContain('grid-column: 1 / -1;')
|
|
169
|
-
})
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
describe('Grid Row Span', () => {
|
|
173
|
-
it('should generate row-span-2', () => {
|
|
174
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
175
|
-
gen.generate('row-span-2')
|
|
176
|
-
expect(gen.toCSS(false)).toContain('grid-row: span 2 / span 2;')
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
it('should generate row-span-full', () => {
|
|
180
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
181
|
-
gen.generate('row-span-full')
|
|
182
|
-
expect(gen.toCSS(false)).toContain('grid-row: 1 / -1;')
|
|
183
|
-
})
|
|
184
|
-
})
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
describe('Edge Cases', () => {
|
|
188
|
-
describe('Grid with variants', () => {
|
|
189
|
-
it('should handle grid with responsive', () => {
|
|
190
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
191
|
-
gen.generate('md:grid')
|
|
192
|
-
const css = gen.toCSS(false)
|
|
193
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
194
|
-
expect(css).toContain('display: grid;')
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
it('should handle grid-cols with responsive', () => {
|
|
198
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
199
|
-
gen.generate('lg:grid-cols-3')
|
|
200
|
-
const css = gen.toCSS(false)
|
|
201
|
-
expect(css).toContain('@media (min-width: 1024px)')
|
|
202
|
-
expect(css).toContain('grid-template-columns: repeat(3, minmax(0, 1fr));')
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
it('should handle grid-flow with variants', () => {
|
|
206
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
207
|
-
gen.generate('md:grid-flow-row')
|
|
208
|
-
const css = gen.toCSS(false)
|
|
209
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
210
|
-
expect(css).toContain('grid-auto-flow: row;')
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
it('should handle place-content with variants', () => {
|
|
214
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
215
|
-
gen.generate('sm:place-content-center')
|
|
216
|
-
const css = gen.toCSS(false)
|
|
217
|
-
expect(css).toContain('@media (min-width: 640px)')
|
|
218
|
-
expect(css).toContain('place-content: center;')
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
it('should handle place-items with variants', () => {
|
|
222
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
223
|
-
gen.generate('md:place-items-center')
|
|
224
|
-
const css = gen.toCSS(false)
|
|
225
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
226
|
-
expect(css).toContain('place-items: center;')
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
it('should handle place-self with variants', () => {
|
|
230
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
231
|
-
gen.generate('lg:place-self-center')
|
|
232
|
-
const css = gen.toCSS(false)
|
|
233
|
-
expect(css).toContain('@media (min-width: 1024px)')
|
|
234
|
-
expect(css).toContain('place-self: center;')
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
it('should handle gap with important', () => {
|
|
238
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
239
|
-
gen.generate('!gap-4')
|
|
240
|
-
expect(gen.toCSS(false)).toContain('gap: 1rem !important;')
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
it('should handle justify-items with hover', () => {
|
|
244
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
245
|
-
gen.generate('hover:justify-items-center')
|
|
246
|
-
const css = gen.toCSS(false)
|
|
247
|
-
expect(css).toContain(':hover')
|
|
248
|
-
expect(css).toContain('justify-items: center;')
|
|
249
|
-
})
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
describe('Grid auto columns and rows', () => {
|
|
253
|
-
it('should generate auto-cols-auto', () => {
|
|
254
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
255
|
-
gen.generate('auto-cols-auto')
|
|
256
|
-
expect(gen.toCSS(false)).toContain('grid-auto-columns: auto;')
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
it('should generate auto-cols-min', () => {
|
|
260
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
261
|
-
gen.generate('auto-cols-min')
|
|
262
|
-
expect(gen.toCSS(false)).toContain('grid-auto-columns: min-content;')
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
it('should generate auto-cols-max', () => {
|
|
266
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
267
|
-
gen.generate('auto-cols-max')
|
|
268
|
-
expect(gen.toCSS(false)).toContain('grid-auto-columns: max-content;')
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
it('should generate auto-cols-fr', () => {
|
|
272
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
273
|
-
gen.generate('auto-cols-fr')
|
|
274
|
-
expect(gen.toCSS(false)).toContain('grid-auto-columns: minmax(0, 1fr);')
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
it('should generate auto-rows-auto', () => {
|
|
278
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
279
|
-
gen.generate('auto-rows-auto')
|
|
280
|
-
expect(gen.toCSS(false)).toContain('grid-auto-rows: auto;')
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
it('should generate auto-rows-min', () => {
|
|
284
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
285
|
-
gen.generate('auto-rows-min')
|
|
286
|
-
expect(gen.toCSS(false)).toContain('grid-auto-rows: min-content;')
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
it('should generate auto-rows-max', () => {
|
|
290
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
291
|
-
gen.generate('auto-rows-max')
|
|
292
|
-
expect(gen.toCSS(false)).toContain('grid-auto-rows: max-content;')
|
|
293
|
-
})
|
|
294
|
-
|
|
295
|
-
it('should generate auto-rows-fr', () => {
|
|
296
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
297
|
-
gen.generate('auto-rows-fr')
|
|
298
|
-
expect(gen.toCSS(false)).toContain('grid-auto-rows: minmax(0, 1fr);')
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
it('should handle auto-cols with arbitrary value', () => {
|
|
302
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
303
|
-
gen.generate('auto-cols-[200px]')
|
|
304
|
-
expect(gen.toCSS(false)).toContain('grid-auto-columns: 200px;')
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
it('should handle auto-rows with arbitrary value', () => {
|
|
308
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
309
|
-
gen.generate('auto-rows-[minmax(0,2fr)]')
|
|
310
|
-
expect(gen.toCSS(false)).toContain('grid-auto-rows: minmax(0,2fr);')
|
|
311
|
-
})
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
describe('Grid column and row start/end', () => {
|
|
315
|
-
it('should generate col-start-1', () => {
|
|
316
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
317
|
-
gen.generate('col-start-1')
|
|
318
|
-
expect(gen.toCSS(false)).toContain('grid-column-start: 1;')
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
it('should generate col-start-auto', () => {
|
|
322
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
323
|
-
gen.generate('col-start-auto')
|
|
324
|
-
expect(gen.toCSS(false)).toContain('grid-column-start: auto;')
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
it('should generate col-end-4', () => {
|
|
328
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
329
|
-
gen.generate('col-end-4')
|
|
330
|
-
expect(gen.toCSS(false)).toContain('grid-column-end: 4;')
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
it('should generate col-end-auto', () => {
|
|
334
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
335
|
-
gen.generate('col-end-auto')
|
|
336
|
-
expect(gen.toCSS(false)).toContain('grid-column-end: auto;')
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
it('should generate row-start-2', () => {
|
|
340
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
341
|
-
gen.generate('row-start-2')
|
|
342
|
-
expect(gen.toCSS(false)).toContain('grid-row-start: 2;')
|
|
343
|
-
})
|
|
344
|
-
|
|
345
|
-
it('should generate row-end-3', () => {
|
|
346
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
347
|
-
gen.generate('row-end-3')
|
|
348
|
-
expect(gen.toCSS(false)).toContain('grid-row-end: 3;')
|
|
349
|
-
})
|
|
350
|
-
|
|
351
|
-
it('should handle negative col-start', () => {
|
|
352
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
353
|
-
gen.generate('col-start-[-1]')
|
|
354
|
-
expect(gen.toCSS(false)).toContain('grid-column-start: -1;')
|
|
355
|
-
})
|
|
356
|
-
|
|
357
|
-
it('should handle large column numbers', () => {
|
|
358
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
359
|
-
gen.generate('col-start-[13]')
|
|
360
|
-
expect(gen.toCSS(false)).toContain('grid-column-start: 13;')
|
|
361
|
-
})
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
describe('Grid template columns/rows edge cases', () => {
|
|
365
|
-
it('should handle grid-cols-1', () => {
|
|
366
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
367
|
-
gen.generate('grid-cols-1')
|
|
368
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: repeat(1, minmax(0, 1fr));')
|
|
369
|
-
})
|
|
370
|
-
|
|
371
|
-
it('should handle grid-rows-1', () => {
|
|
372
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
373
|
-
gen.generate('grid-rows-1')
|
|
374
|
-
expect(gen.toCSS(false)).toContain('grid-template-rows: repeat(1, minmax(0, 1fr));')
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
it('should handle arbitrary grid-cols with subgrid', () => {
|
|
378
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
379
|
-
gen.generate('grid-cols-[subgrid]')
|
|
380
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: subgrid;')
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
it('should handle arbitrary grid-rows with subgrid', () => {
|
|
384
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
385
|
-
gen.generate('grid-rows-[subgrid]')
|
|
386
|
-
expect(gen.toCSS(false)).toContain('grid-template-rows: subgrid;')
|
|
387
|
-
})
|
|
388
|
-
|
|
389
|
-
it('should handle grid-cols with arbitrary repeat', () => {
|
|
390
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
391
|
-
gen.generate('grid-cols-[100px]')
|
|
392
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: 100px;')
|
|
393
|
-
})
|
|
394
|
-
})
|
|
395
|
-
|
|
396
|
-
describe('Grid flow combinations', () => {
|
|
397
|
-
it('should generate grid-flow-row-dense', () => {
|
|
398
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
399
|
-
gen.generate('grid-flow-row-dense')
|
|
400
|
-
expect(gen.toCSS(false)).toContain('grid-auto-flow: row dense;')
|
|
401
|
-
})
|
|
402
|
-
|
|
403
|
-
it('should generate grid-flow-col-dense', () => {
|
|
404
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
405
|
-
gen.generate('grid-flow-col-dense')
|
|
406
|
-
expect(gen.toCSS(false)).toContain('grid-auto-flow: column dense;')
|
|
407
|
-
})
|
|
408
|
-
})
|
|
409
|
-
|
|
410
|
-
describe('Place utilities comprehensive', () => {
|
|
411
|
-
it('should generate place-content-start', () => {
|
|
412
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
413
|
-
gen.generate('place-content-start')
|
|
414
|
-
expect(gen.toCSS(false)).toContain('place-content: start;')
|
|
415
|
-
})
|
|
416
|
-
|
|
417
|
-
it('should generate place-content-end', () => {
|
|
418
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
419
|
-
gen.generate('place-content-end')
|
|
420
|
-
expect(gen.toCSS(false)).toContain('place-content: end;')
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
it('should generate place-content-between', () => {
|
|
424
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
425
|
-
gen.generate('place-content-between')
|
|
426
|
-
expect(gen.toCSS(false)).toContain('place-content: space-between;')
|
|
427
|
-
})
|
|
428
|
-
|
|
429
|
-
it('should generate place-content-around', () => {
|
|
430
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
431
|
-
gen.generate('place-content-around')
|
|
432
|
-
expect(gen.toCSS(false)).toContain('place-content: space-around;')
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
it('should generate place-content-evenly', () => {
|
|
436
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
437
|
-
gen.generate('place-content-evenly')
|
|
438
|
-
expect(gen.toCSS(false)).toContain('place-content: space-evenly;')
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
it('should generate place-content-stretch', () => {
|
|
442
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
443
|
-
gen.generate('place-content-stretch')
|
|
444
|
-
expect(gen.toCSS(false)).toContain('place-content: stretch;')
|
|
445
|
-
})
|
|
446
|
-
|
|
447
|
-
it('should generate place-items-start', () => {
|
|
448
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
449
|
-
gen.generate('place-items-start')
|
|
450
|
-
expect(gen.toCSS(false)).toContain('place-items: start;')
|
|
451
|
-
})
|
|
452
|
-
|
|
453
|
-
it('should generate place-items-end', () => {
|
|
454
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
455
|
-
gen.generate('place-items-end')
|
|
456
|
-
expect(gen.toCSS(false)).toContain('place-items: end;')
|
|
457
|
-
})
|
|
458
|
-
|
|
459
|
-
it('should generate place-items-center', () => {
|
|
460
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
461
|
-
gen.generate('place-items-center')
|
|
462
|
-
expect(gen.toCSS(false)).toContain('place-items: center;')
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
it('should generate place-items-stretch', () => {
|
|
466
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
467
|
-
gen.generate('place-items-stretch')
|
|
468
|
-
expect(gen.toCSS(false)).toContain('place-items: stretch;')
|
|
469
|
-
})
|
|
470
|
-
|
|
471
|
-
it('should generate place-self-auto', () => {
|
|
472
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
473
|
-
gen.generate('place-self-auto')
|
|
474
|
-
expect(gen.toCSS(false)).toContain('place-self: auto;')
|
|
475
|
-
})
|
|
476
|
-
|
|
477
|
-
it('should generate place-self-start', () => {
|
|
478
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
479
|
-
gen.generate('place-self-start')
|
|
480
|
-
expect(gen.toCSS(false)).toContain('place-self: start;')
|
|
481
|
-
})
|
|
482
|
-
|
|
483
|
-
it('should generate place-self-end', () => {
|
|
484
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
485
|
-
gen.generate('place-self-end')
|
|
486
|
-
expect(gen.toCSS(false)).toContain('place-self: end;')
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
it('should generate place-self-center', () => {
|
|
490
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
491
|
-
gen.generate('place-self-center')
|
|
492
|
-
expect(gen.toCSS(false)).toContain('place-self: center;')
|
|
493
|
-
})
|
|
494
|
-
|
|
495
|
-
it('should generate place-self-stretch', () => {
|
|
496
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
497
|
-
gen.generate('place-self-stretch')
|
|
498
|
-
expect(gen.toCSS(false)).toContain('place-self: stretch;')
|
|
499
|
-
})
|
|
500
|
-
})
|
|
501
|
-
|
|
502
|
-
describe('Gap edge cases', () => {
|
|
503
|
-
it('should handle gap-0', () => {
|
|
504
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
505
|
-
gen.generate('gap-0')
|
|
506
|
-
expect(gen.toCSS(false)).toContain('gap: 0;')
|
|
507
|
-
})
|
|
508
|
-
|
|
509
|
-
it('should handle gap-px', () => {
|
|
510
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
511
|
-
gen.generate('gap-px')
|
|
512
|
-
expect(gen.toCSS(false)).toContain('gap: 1px;')
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
it('should handle gap-x-0', () => {
|
|
516
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
517
|
-
gen.generate('gap-x-0')
|
|
518
|
-
expect(gen.toCSS(false)).toContain('column-gap: 0;')
|
|
519
|
-
})
|
|
520
|
-
|
|
521
|
-
it('should handle gap-y-px', () => {
|
|
522
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
523
|
-
gen.generate('gap-y-px')
|
|
524
|
-
expect(gen.toCSS(false)).toContain('row-gap: 1px;')
|
|
525
|
-
})
|
|
526
|
-
|
|
527
|
-
it('should handle gap with arbitrary value', () => {
|
|
528
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
529
|
-
gen.generate('gap-[2.5rem]')
|
|
530
|
-
expect(gen.toCSS(false)).toContain('gap: 2.5rem;')
|
|
531
|
-
})
|
|
532
|
-
|
|
533
|
-
it('should handle gap-x with calc', () => {
|
|
534
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
535
|
-
gen.generate('gap-x-[calc(100%-2rem)]')
|
|
536
|
-
expect(gen.toCSS(false)).toContain('column-gap: calc(100%-2rem);')
|
|
537
|
-
})
|
|
538
|
-
})
|
|
539
|
-
|
|
540
|
-
describe('Grid span edge cases', () => {
|
|
541
|
-
it('should handle col-span-auto', () => {
|
|
542
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
543
|
-
gen.generate('col-span-auto')
|
|
544
|
-
expect(gen.toCSS(false)).toContain('grid-column: auto;')
|
|
545
|
-
})
|
|
546
|
-
|
|
547
|
-
it('should handle row-span-auto', () => {
|
|
548
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
549
|
-
gen.generate('row-span-auto')
|
|
550
|
-
expect(gen.toCSS(false)).toContain('grid-row: auto;')
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
it('should handle col-span with large number', () => {
|
|
554
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
555
|
-
gen.generate('col-span-[20]')
|
|
556
|
-
expect(gen.toCSS(false)).toContain('grid-column: span 20 / span 20;')
|
|
557
|
-
})
|
|
558
|
-
|
|
559
|
-
it('should handle row-span with large number', () => {
|
|
560
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
561
|
-
gen.generate('row-span-[15]')
|
|
562
|
-
expect(gen.toCSS(false)).toContain('grid-row: span 15 / span 15;')
|
|
563
|
-
})
|
|
564
|
-
})
|
|
565
|
-
|
|
566
|
-
describe('Grid with multiple variants', () => {
|
|
567
|
-
it('should handle dark mode with grid', () => {
|
|
568
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
569
|
-
gen.generate('dark:grid-cols-4')
|
|
570
|
-
const css = gen.toCSS(false)
|
|
571
|
-
expect(css).toContain('.dark')
|
|
572
|
-
expect(css).toContain('grid-template-columns: repeat(4, minmax(0, 1fr));')
|
|
573
|
-
})
|
|
574
|
-
|
|
575
|
-
it('should handle combined responsive and hover', () => {
|
|
576
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
577
|
-
gen.generate('md:hover:grid-cols-2')
|
|
578
|
-
const css = gen.toCSS(false)
|
|
579
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
580
|
-
expect(css).toContain(':hover')
|
|
581
|
-
expect(css).toContain('grid-template-columns: repeat(2, minmax(0, 1fr));')
|
|
582
|
-
})
|
|
583
|
-
})
|
|
584
|
-
})
|