@cwcss/crosswind 0.1.5 → 0.1.6
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 +390 -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/index.js +12798 -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/transformer-compile-class.d.ts +37 -0
- package/{src/types.ts → dist/types.d.ts} +17 -86
- package/package.json +1 -1
- 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/flexbox.test.ts
DELETED
|
@@ -1,669 +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('Flexbox Utilities', () => {
|
|
6
|
-
describe('Display', () => {
|
|
7
|
-
it('should generate flex', () => {
|
|
8
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
9
|
-
gen.generate('flex')
|
|
10
|
-
expect(gen.toCSS(false)).toContain('display: flex;')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('should generate inline-flex', () => {
|
|
14
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
15
|
-
gen.generate('inline-flex')
|
|
16
|
-
expect(gen.toCSS(false)).toContain('display: inline-flex;')
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe('Direction', () => {
|
|
21
|
-
it('should generate flex-row', () => {
|
|
22
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
23
|
-
gen.generate('flex-row')
|
|
24
|
-
expect(gen.toCSS(false)).toContain('flex-direction: row;')
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('should generate flex-row-reverse', () => {
|
|
28
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
29
|
-
gen.generate('flex-row-reverse')
|
|
30
|
-
expect(gen.toCSS(false)).toContain('flex-direction: row-reverse;')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('should generate flex-col', () => {
|
|
34
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
35
|
-
gen.generate('flex-col')
|
|
36
|
-
expect(gen.toCSS(false)).toContain('flex-direction: column;')
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('should generate flex-col-reverse', () => {
|
|
40
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
41
|
-
gen.generate('flex-col-reverse')
|
|
42
|
-
expect(gen.toCSS(false)).toContain('flex-direction: column-reverse;')
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
describe('Wrap', () => {
|
|
47
|
-
it('should generate flex-wrap', () => {
|
|
48
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
49
|
-
gen.generate('flex-wrap')
|
|
50
|
-
expect(gen.toCSS(false)).toContain('flex-wrap: wrap;')
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('should generate flex-wrap-reverse', () => {
|
|
54
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
55
|
-
gen.generate('flex-wrap-reverse')
|
|
56
|
-
expect(gen.toCSS(false)).toContain('flex-wrap: wrap-reverse;')
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
it('should generate flex-nowrap', () => {
|
|
60
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
61
|
-
gen.generate('flex-nowrap')
|
|
62
|
-
expect(gen.toCSS(false)).toContain('flex-wrap: nowrap;')
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
describe('Justify Content', () => {
|
|
67
|
-
it('should generate justify-start', () => {
|
|
68
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
69
|
-
gen.generate('justify-start')
|
|
70
|
-
expect(gen.toCSS(false)).toContain('justify-content: flex-start;')
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('should generate justify-end', () => {
|
|
74
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
75
|
-
gen.generate('justify-end')
|
|
76
|
-
expect(gen.toCSS(false)).toContain('justify-content: flex-end;')
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('should generate justify-center', () => {
|
|
80
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
81
|
-
gen.generate('justify-center')
|
|
82
|
-
expect(gen.toCSS(false)).toContain('justify-content: center;')
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('should generate justify-between', () => {
|
|
86
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
87
|
-
gen.generate('justify-between')
|
|
88
|
-
expect(gen.toCSS(false)).toContain('justify-content: space-between;')
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
it('should generate justify-around', () => {
|
|
92
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
93
|
-
gen.generate('justify-around')
|
|
94
|
-
expect(gen.toCSS(false)).toContain('justify-content: space-around;')
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('should generate justify-evenly', () => {
|
|
98
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
99
|
-
gen.generate('justify-evenly')
|
|
100
|
-
expect(gen.toCSS(false)).toContain('justify-content: space-evenly;')
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
describe('Align Items', () => {
|
|
105
|
-
it('should generate items-start', () => {
|
|
106
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
107
|
-
gen.generate('items-start')
|
|
108
|
-
expect(gen.toCSS(false)).toContain('align-items: flex-start;')
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('should generate items-end', () => {
|
|
112
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
113
|
-
gen.generate('items-end')
|
|
114
|
-
expect(gen.toCSS(false)).toContain('align-items: flex-end;')
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
it('should generate items-center', () => {
|
|
118
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
119
|
-
gen.generate('items-center')
|
|
120
|
-
expect(gen.toCSS(false)).toContain('align-items: center;')
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it('should generate items-baseline', () => {
|
|
124
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
125
|
-
gen.generate('items-baseline')
|
|
126
|
-
expect(gen.toCSS(false)).toContain('align-items: baseline;')
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
it('should generate items-stretch', () => {
|
|
130
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
131
|
-
gen.generate('items-stretch')
|
|
132
|
-
expect(gen.toCSS(false)).toContain('align-items: stretch;')
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
describe('Align Self', () => {
|
|
137
|
-
it('should generate self-start', () => {
|
|
138
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
139
|
-
gen.generate('self-start')
|
|
140
|
-
expect(gen.toCSS(false)).toContain('align-self: flex-start;')
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it('should generate self-center', () => {
|
|
144
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
145
|
-
gen.generate('self-center')
|
|
146
|
-
expect(gen.toCSS(false)).toContain('align-self: center;')
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
it('should generate self-end', () => {
|
|
150
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
151
|
-
gen.generate('self-end')
|
|
152
|
-
expect(gen.toCSS(false)).toContain('align-self: flex-end;')
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
describe('Flex', () => {
|
|
157
|
-
it('should generate flex-1', () => {
|
|
158
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
159
|
-
gen.generate('flex-1')
|
|
160
|
-
expect(gen.toCSS(false)).toContain('flex: 1 1 0%;')
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
it('should generate flex-auto', () => {
|
|
164
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
165
|
-
gen.generate('flex-auto')
|
|
166
|
-
expect(gen.toCSS(false)).toContain('flex: 1 1 auto;')
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
it('should generate flex-initial', () => {
|
|
170
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
171
|
-
gen.generate('flex-initial')
|
|
172
|
-
expect(gen.toCSS(false)).toContain('flex: 0 1 auto;')
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
it('should generate flex-none', () => {
|
|
176
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
177
|
-
gen.generate('flex-none')
|
|
178
|
-
expect(gen.toCSS(false)).toContain('flex: none;')
|
|
179
|
-
})
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
describe('Order', () => {
|
|
183
|
-
it('should generate order-1', () => {
|
|
184
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
185
|
-
gen.generate('order-1')
|
|
186
|
-
expect(gen.toCSS(false)).toContain('order: 1;')
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
it('should generate order-first', () => {
|
|
190
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
191
|
-
gen.generate('order-first')
|
|
192
|
-
expect(gen.toCSS(false)).toContain('order: -9999;')
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
it('should generate order-last', () => {
|
|
196
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
197
|
-
gen.generate('order-last')
|
|
198
|
-
expect(gen.toCSS(false)).toContain('order: 9999;')
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
it('should generate order-none', () => {
|
|
202
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
203
|
-
gen.generate('order-none')
|
|
204
|
-
expect(gen.toCSS(false)).toContain('order: 0;')
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
it('should generate order with arbitrary value', () => {
|
|
208
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
209
|
-
gen.generate('order-[99]')
|
|
210
|
-
expect(gen.toCSS(false)).toContain('order: 99;')
|
|
211
|
-
})
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
describe('Flex Basis', () => {
|
|
215
|
-
it('should generate basis-1/2', () => {
|
|
216
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
217
|
-
gen.generate('basis-1/2')
|
|
218
|
-
expect(gen.toCSS(false)).toContain('flex-basis: 50%;')
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
it('should generate basis-auto', () => {
|
|
222
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
223
|
-
gen.generate('basis-auto')
|
|
224
|
-
expect(gen.toCSS(false)).toContain('flex-basis: auto;')
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
it('should generate basis-full', () => {
|
|
228
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
229
|
-
gen.generate('basis-full')
|
|
230
|
-
expect(gen.toCSS(false)).toContain('flex-basis: 100%;')
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
it('should generate basis-0', () => {
|
|
234
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
235
|
-
gen.generate('basis-0')
|
|
236
|
-
expect(gen.toCSS(false)).toContain('flex-basis: 0;')
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
it('should handle basis with very small fraction', () => {
|
|
240
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
241
|
-
gen.generate('basis-1/100')
|
|
242
|
-
expect(gen.toCSS(false)).toContain('flex-basis: 1%;')
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
it('should handle basis with calc', () => {
|
|
246
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
247
|
-
gen.generate('basis-[calc(50%-1rem)]')
|
|
248
|
-
expect(gen.toCSS(false)).toContain('flex-basis: calc(50%-1rem);')
|
|
249
|
-
})
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
describe('Justify Self', () => {
|
|
253
|
-
it('should generate justify-self-start', () => {
|
|
254
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
255
|
-
gen.generate('justify-self-start')
|
|
256
|
-
expect(gen.toCSS(false)).toContain('justify-self: start;')
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
it('should generate justify-self-center', () => {
|
|
260
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
261
|
-
gen.generate('justify-self-center')
|
|
262
|
-
expect(gen.toCSS(false)).toContain('justify-self: center;')
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
it('should generate justify-self-end', () => {
|
|
266
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
267
|
-
gen.generate('justify-self-end')
|
|
268
|
-
expect(gen.toCSS(false)).toContain('justify-self: end;')
|
|
269
|
-
})
|
|
270
|
-
})
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
describe('Edge Cases', () => {
|
|
274
|
-
describe('Gap utilities', () => {
|
|
275
|
-
it('should generate gap-4', () => {
|
|
276
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
277
|
-
gen.generate('gap-4')
|
|
278
|
-
expect(gen.toCSS(false)).toContain('gap: 1rem;')
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
it('should generate gap-x-2', () => {
|
|
282
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
283
|
-
gen.generate('gap-x-2')
|
|
284
|
-
expect(gen.toCSS(false)).toContain('column-gap: 0.5rem;')
|
|
285
|
-
})
|
|
286
|
-
|
|
287
|
-
it('should generate gap-y-8', () => {
|
|
288
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
289
|
-
gen.generate('gap-y-8')
|
|
290
|
-
expect(gen.toCSS(false)).toContain('row-gap: 2rem;')
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
it('should handle gap-0', () => {
|
|
294
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
295
|
-
gen.generate('gap-0')
|
|
296
|
-
expect(gen.toCSS(false)).toContain('gap: 0;')
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
it('should handle gap-px', () => {
|
|
300
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
301
|
-
gen.generate('gap-px')
|
|
302
|
-
expect(gen.toCSS(false)).toContain('gap: 1px;')
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
it('should handle gap with arbitrary value', () => {
|
|
306
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
307
|
-
gen.generate('gap-[2.5rem]')
|
|
308
|
-
expect(gen.toCSS(false)).toContain('gap: 2.5rem;')
|
|
309
|
-
})
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
describe('Flex grow and shrink', () => {
|
|
313
|
-
it('should generate flex-grow', () => {
|
|
314
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
315
|
-
gen.generate('flex-grow')
|
|
316
|
-
expect(gen.toCSS(false)).toContain('flex-grow: 1;')
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
it('should generate flex-grow-0', () => {
|
|
320
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
321
|
-
gen.generate('flex-grow-0')
|
|
322
|
-
expect(gen.toCSS(false)).toContain('flex-grow: 0;')
|
|
323
|
-
})
|
|
324
|
-
|
|
325
|
-
it('should generate flex-shrink', () => {
|
|
326
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
327
|
-
gen.generate('flex-shrink')
|
|
328
|
-
expect(gen.toCSS(false)).toContain('flex-shrink: 1;')
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
it('should generate flex-shrink-0', () => {
|
|
332
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
333
|
-
gen.generate('flex-shrink-0')
|
|
334
|
-
expect(gen.toCSS(false)).toContain('flex-shrink: 0;')
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
it('should handle arbitrary grow value', () => {
|
|
338
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
339
|
-
gen.generate('flex-grow-[2]')
|
|
340
|
-
expect(gen.toCSS(false)).toContain('flex-grow: 2;')
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
it('should handle arbitrary shrink value', () => {
|
|
344
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
345
|
-
gen.generate('flex-shrink-[3]')
|
|
346
|
-
expect(gen.toCSS(false)).toContain('flex-shrink: 3;')
|
|
347
|
-
})
|
|
348
|
-
})
|
|
349
|
-
|
|
350
|
-
describe('Align content', () => {
|
|
351
|
-
it('should generate content-normal', () => {
|
|
352
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
353
|
-
gen.generate('content-normal')
|
|
354
|
-
expect(gen.toCSS(false)).toContain('align-content: normal;')
|
|
355
|
-
})
|
|
356
|
-
|
|
357
|
-
it('should generate content-center', () => {
|
|
358
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
359
|
-
gen.generate('content-center')
|
|
360
|
-
expect(gen.toCSS(false)).toContain('align-content: center;')
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
it('should generate content-start', () => {
|
|
364
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
365
|
-
gen.generate('content-start')
|
|
366
|
-
expect(gen.toCSS(false)).toContain('align-content: flex-start;')
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
it('should generate content-end', () => {
|
|
370
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
371
|
-
gen.generate('content-end')
|
|
372
|
-
expect(gen.toCSS(false)).toContain('align-content: flex-end;')
|
|
373
|
-
})
|
|
374
|
-
|
|
375
|
-
it('should generate content-between', () => {
|
|
376
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
377
|
-
gen.generate('content-between')
|
|
378
|
-
expect(gen.toCSS(false)).toContain('align-content: space-between;')
|
|
379
|
-
})
|
|
380
|
-
|
|
381
|
-
it('should generate content-around', () => {
|
|
382
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
383
|
-
gen.generate('content-around')
|
|
384
|
-
expect(gen.toCSS(false)).toContain('align-content: space-around;')
|
|
385
|
-
})
|
|
386
|
-
|
|
387
|
-
it('should generate content-evenly', () => {
|
|
388
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
389
|
-
gen.generate('content-evenly')
|
|
390
|
-
expect(gen.toCSS(false)).toContain('align-content: space-evenly;')
|
|
391
|
-
})
|
|
392
|
-
|
|
393
|
-
it('should generate content-baseline', () => {
|
|
394
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
395
|
-
gen.generate('content-baseline')
|
|
396
|
-
expect(gen.toCSS(false)).toContain('align-content: baseline;')
|
|
397
|
-
})
|
|
398
|
-
|
|
399
|
-
it('should generate content-stretch', () => {
|
|
400
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
401
|
-
gen.generate('content-stretch')
|
|
402
|
-
expect(gen.toCSS(false)).toContain('align-content: stretch;')
|
|
403
|
-
})
|
|
404
|
-
})
|
|
405
|
-
|
|
406
|
-
describe('Justify items', () => {
|
|
407
|
-
it('should generate justify-items-start', () => {
|
|
408
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
409
|
-
gen.generate('justify-items-start')
|
|
410
|
-
expect(gen.toCSS(false)).toContain('justify-items: start;')
|
|
411
|
-
})
|
|
412
|
-
|
|
413
|
-
it('should generate justify-items-end', () => {
|
|
414
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
415
|
-
gen.generate('justify-items-end')
|
|
416
|
-
expect(gen.toCSS(false)).toContain('justify-items: end;')
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
it('should generate justify-items-center', () => {
|
|
420
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
421
|
-
gen.generate('justify-items-center')
|
|
422
|
-
expect(gen.toCSS(false)).toContain('justify-items: center;')
|
|
423
|
-
})
|
|
424
|
-
|
|
425
|
-
it('should generate justify-items-stretch', () => {
|
|
426
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
427
|
-
gen.generate('justify-items-stretch')
|
|
428
|
-
expect(gen.toCSS(false)).toContain('justify-items: stretch;')
|
|
429
|
-
})
|
|
430
|
-
})
|
|
431
|
-
|
|
432
|
-
describe('Order edge cases', () => {
|
|
433
|
-
it('should handle negative order', () => {
|
|
434
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
435
|
-
gen.generate('order-[-1]')
|
|
436
|
-
expect(gen.toCSS(false)).toContain('order: -1;')
|
|
437
|
-
})
|
|
438
|
-
|
|
439
|
-
it('should handle very large order', () => {
|
|
440
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
441
|
-
gen.generate('order-[999999]')
|
|
442
|
-
expect(gen.toCSS(false)).toContain('order: 999999;')
|
|
443
|
-
})
|
|
444
|
-
|
|
445
|
-
it('should handle order-2 through order-12', () => {
|
|
446
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
447
|
-
for (let i = 2; i <= 12; i++) {
|
|
448
|
-
gen.generate(`order-${i}`)
|
|
449
|
-
}
|
|
450
|
-
const css = gen.toCSS(false)
|
|
451
|
-
expect(css).toBeDefined()
|
|
452
|
-
})
|
|
453
|
-
})
|
|
454
|
-
|
|
455
|
-
describe('Flex basis edge cases', () => {
|
|
456
|
-
it('should handle basis with spacing values', () => {
|
|
457
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
458
|
-
gen.generate('basis-4')
|
|
459
|
-
expect(gen.toCSS(false)).toContain('flex-basis: 1rem;')
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
it('should handle basis-px', () => {
|
|
463
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
464
|
-
gen.generate('basis-px')
|
|
465
|
-
expect(gen.toCSS(false)).toContain('flex-basis: 1px;')
|
|
466
|
-
})
|
|
467
|
-
|
|
468
|
-
it('should handle basis with CSS variables', () => {
|
|
469
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
470
|
-
gen.generate('basis-[var(--basis-width)]')
|
|
471
|
-
expect(gen.toCSS(false)).toContain('flex-basis: var(--basis-width);')
|
|
472
|
-
})
|
|
473
|
-
|
|
474
|
-
it('should handle basis with min()', () => {
|
|
475
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
476
|
-
gen.generate('basis-[min(50%,300px)]')
|
|
477
|
-
expect(gen.toCSS(false)).toContain('flex-basis: min(50%,300px);')
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
it('should handle basis with clamp()', () => {
|
|
481
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
482
|
-
gen.generate('basis-[clamp(100px,50%,500px)]')
|
|
483
|
-
expect(gen.toCSS(false)).toContain('flex-basis: clamp(100px,50%,500px);')
|
|
484
|
-
})
|
|
485
|
-
})
|
|
486
|
-
|
|
487
|
-
describe('Arbitrary values', () => {
|
|
488
|
-
it('should handle arbitrary flex direction', () => {
|
|
489
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
490
|
-
gen.generate('flex-[0_1_250px]')
|
|
491
|
-
expect(gen.toCSS(false)).toContain('flex: 0 1 250px;')
|
|
492
|
-
})
|
|
493
|
-
|
|
494
|
-
it('should handle arbitrary justify-content', () => {
|
|
495
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
496
|
-
gen.generate('justify-[flex-start]')
|
|
497
|
-
expect(gen.toCSS(false)).toContain('justify-content: flex-start;')
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
it('should handle arbitrary align-items', () => {
|
|
501
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
502
|
-
gen.generate('items-[baseline]')
|
|
503
|
-
expect(gen.toCSS(false)).toContain('align-items: baseline;')
|
|
504
|
-
})
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
describe('Flexbox with variants', () => {
|
|
508
|
-
it('should handle flex with hover', () => {
|
|
509
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
510
|
-
gen.generate('hover:flex')
|
|
511
|
-
const css = gen.toCSS(false)
|
|
512
|
-
expect(css).toContain(':hover')
|
|
513
|
-
expect(css).toContain('display: flex;')
|
|
514
|
-
})
|
|
515
|
-
|
|
516
|
-
it('should handle flex-direction with responsive', () => {
|
|
517
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
518
|
-
gen.generate('md:flex-col')
|
|
519
|
-
const css = gen.toCSS(false)
|
|
520
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
521
|
-
expect(css).toContain('flex-direction: column;')
|
|
522
|
-
})
|
|
523
|
-
|
|
524
|
-
it('should handle gap with important', () => {
|
|
525
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
526
|
-
gen.generate('!gap-4')
|
|
527
|
-
expect(gen.toCSS(false)).toContain('gap: 1rem !important;')
|
|
528
|
-
})
|
|
529
|
-
|
|
530
|
-
it('should handle justify-content with dark mode', () => {
|
|
531
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
532
|
-
gen.generate('dark:justify-center')
|
|
533
|
-
const css = gen.toCSS(false)
|
|
534
|
-
expect(css).toContain('.dark')
|
|
535
|
-
expect(css).toContain('justify-content: center;')
|
|
536
|
-
})
|
|
537
|
-
|
|
538
|
-
it('should handle multiple variant combinations', () => {
|
|
539
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
540
|
-
gen.generate('lg:hover:flex-row')
|
|
541
|
-
const css = gen.toCSS(false)
|
|
542
|
-
expect(css).toContain('@media (min-width: 1024px)')
|
|
543
|
-
expect(css).toContain(':hover')
|
|
544
|
-
expect(css).toContain('flex-direction: row;')
|
|
545
|
-
})
|
|
546
|
-
})
|
|
547
|
-
|
|
548
|
-
describe('Align self edge cases', () => {
|
|
549
|
-
it('should generate self-auto', () => {
|
|
550
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
551
|
-
gen.generate('self-auto')
|
|
552
|
-
expect(gen.toCSS(false)).toContain('align-self: auto;')
|
|
553
|
-
})
|
|
554
|
-
|
|
555
|
-
it('should generate self-stretch', () => {
|
|
556
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
557
|
-
gen.generate('self-stretch')
|
|
558
|
-
expect(gen.toCSS(false)).toContain('align-self: stretch;')
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
it('should generate self-baseline', () => {
|
|
562
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
563
|
-
gen.generate('self-baseline')
|
|
564
|
-
expect(gen.toCSS(false)).toContain('align-self: baseline;')
|
|
565
|
-
})
|
|
566
|
-
})
|
|
567
|
-
|
|
568
|
-
describe('Place content', () => {
|
|
569
|
-
it('should generate place-content-center', () => {
|
|
570
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
571
|
-
gen.generate('place-content-center')
|
|
572
|
-
expect(gen.toCSS(false)).toContain('place-content: center;')
|
|
573
|
-
})
|
|
574
|
-
|
|
575
|
-
it('should generate place-content-start', () => {
|
|
576
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
577
|
-
gen.generate('place-content-start')
|
|
578
|
-
expect(gen.toCSS(false)).toContain('place-content: start;')
|
|
579
|
-
})
|
|
580
|
-
|
|
581
|
-
it('should generate place-content-end', () => {
|
|
582
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
583
|
-
gen.generate('place-content-end')
|
|
584
|
-
expect(gen.toCSS(false)).toContain('place-content: end;')
|
|
585
|
-
})
|
|
586
|
-
|
|
587
|
-
it('should generate place-content-between', () => {
|
|
588
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
589
|
-
gen.generate('place-content-between')
|
|
590
|
-
expect(gen.toCSS(false)).toContain('place-content: space-between;')
|
|
591
|
-
})
|
|
592
|
-
|
|
593
|
-
it('should generate place-content-around', () => {
|
|
594
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
595
|
-
gen.generate('place-content-around')
|
|
596
|
-
expect(gen.toCSS(false)).toContain('place-content: space-around;')
|
|
597
|
-
})
|
|
598
|
-
|
|
599
|
-
it('should generate place-content-evenly', () => {
|
|
600
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
601
|
-
gen.generate('place-content-evenly')
|
|
602
|
-
expect(gen.toCSS(false)).toContain('place-content: space-evenly;')
|
|
603
|
-
})
|
|
604
|
-
|
|
605
|
-
it('should generate place-content-stretch', () => {
|
|
606
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
607
|
-
gen.generate('place-content-stretch')
|
|
608
|
-
expect(gen.toCSS(false)).toContain('place-content: stretch;')
|
|
609
|
-
})
|
|
610
|
-
})
|
|
611
|
-
|
|
612
|
-
describe('Place items', () => {
|
|
613
|
-
it('should generate place-items-center', () => {
|
|
614
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
615
|
-
gen.generate('place-items-center')
|
|
616
|
-
expect(gen.toCSS(false)).toContain('place-items: center;')
|
|
617
|
-
})
|
|
618
|
-
|
|
619
|
-
it('should generate place-items-start', () => {
|
|
620
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
621
|
-
gen.generate('place-items-start')
|
|
622
|
-
expect(gen.toCSS(false)).toContain('place-items: start;')
|
|
623
|
-
})
|
|
624
|
-
|
|
625
|
-
it('should generate place-items-end', () => {
|
|
626
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
627
|
-
gen.generate('place-items-end')
|
|
628
|
-
expect(gen.toCSS(false)).toContain('place-items: end;')
|
|
629
|
-
})
|
|
630
|
-
|
|
631
|
-
it('should generate place-items-stretch', () => {
|
|
632
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
633
|
-
gen.generate('place-items-stretch')
|
|
634
|
-
expect(gen.toCSS(false)).toContain('place-items: stretch;')
|
|
635
|
-
})
|
|
636
|
-
})
|
|
637
|
-
|
|
638
|
-
describe('Place self', () => {
|
|
639
|
-
it('should generate place-self-center', () => {
|
|
640
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
641
|
-
gen.generate('place-self-center')
|
|
642
|
-
expect(gen.toCSS(false)).toContain('place-self: center;')
|
|
643
|
-
})
|
|
644
|
-
|
|
645
|
-
it('should generate place-self-start', () => {
|
|
646
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
647
|
-
gen.generate('place-self-start')
|
|
648
|
-
expect(gen.toCSS(false)).toContain('place-self: start;')
|
|
649
|
-
})
|
|
650
|
-
|
|
651
|
-
it('should generate place-self-end', () => {
|
|
652
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
653
|
-
gen.generate('place-self-end')
|
|
654
|
-
expect(gen.toCSS(false)).toContain('place-self: end;')
|
|
655
|
-
})
|
|
656
|
-
|
|
657
|
-
it('should generate place-self-auto', () => {
|
|
658
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
659
|
-
gen.generate('place-self-auto')
|
|
660
|
-
expect(gen.toCSS(false)).toContain('place-self: auto;')
|
|
661
|
-
})
|
|
662
|
-
|
|
663
|
-
it('should generate place-self-stretch', () => {
|
|
664
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
665
|
-
gen.generate('place-self-stretch')
|
|
666
|
-
expect(gen.toCSS(false)).toContain('place-self: stretch;')
|
|
667
|
-
})
|
|
668
|
-
})
|
|
669
|
-
})
|