@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/typography.test.ts
DELETED
|
@@ -1,632 +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('Typography Utilities', () => {
|
|
6
|
-
describe('Font size', () => {
|
|
7
|
-
it('should generate text-sm', () => {
|
|
8
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
9
|
-
gen.generate('text-sm')
|
|
10
|
-
const css = gen.toCSS(false)
|
|
11
|
-
expect(css).toContain('font-size:')
|
|
12
|
-
expect(css).toContain('line-height:')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('should generate text-lg', () => {
|
|
16
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
17
|
-
gen.generate('text-lg')
|
|
18
|
-
const css = gen.toCSS(false)
|
|
19
|
-
expect(css).toContain('font-size:')
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('Font weight', () => {
|
|
24
|
-
it('should generate font-bold', () => {
|
|
25
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
26
|
-
gen.generate('font-bold')
|
|
27
|
-
expect(gen.toCSS(false)).toContain('font-weight: 700;')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('should generate font-normal', () => {
|
|
31
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
32
|
-
gen.generate('font-normal')
|
|
33
|
-
expect(gen.toCSS(false)).toContain('font-weight: 400;')
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('should generate font-semibold', () => {
|
|
37
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
38
|
-
gen.generate('font-semibold')
|
|
39
|
-
expect(gen.toCSS(false)).toContain('font-weight: 600;')
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
describe('Text align', () => {
|
|
44
|
-
it('should generate text-center', () => {
|
|
45
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
46
|
-
gen.generate('text-center')
|
|
47
|
-
expect(gen.toCSS(false)).toContain('text-align: center;')
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('should generate text-left', () => {
|
|
51
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
52
|
-
gen.generate('text-left')
|
|
53
|
-
expect(gen.toCSS(false)).toContain('text-align: left;')
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
it('should generate text-right', () => {
|
|
57
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
58
|
-
gen.generate('text-right')
|
|
59
|
-
expect(gen.toCSS(false)).toContain('text-align: right;')
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
describe('Text transform', () => {
|
|
64
|
-
it('should generate uppercase', () => {
|
|
65
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
66
|
-
gen.generate('uppercase')
|
|
67
|
-
expect(gen.toCSS(false)).toContain('text-transform: uppercase;')
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('should generate lowercase', () => {
|
|
71
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
72
|
-
gen.generate('lowercase')
|
|
73
|
-
expect(gen.toCSS(false)).toContain('text-transform: lowercase;')
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('should generate capitalize', () => {
|
|
77
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
78
|
-
gen.generate('capitalize')
|
|
79
|
-
expect(gen.toCSS(false)).toContain('text-transform: capitalize;')
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
describe('Text decoration', () => {
|
|
84
|
-
it('should generate underline', () => {
|
|
85
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
86
|
-
gen.generate('underline')
|
|
87
|
-
expect(gen.toCSS(false)).toContain('text-decoration-line: underline;')
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('should generate line-through', () => {
|
|
91
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
92
|
-
gen.generate('line-through')
|
|
93
|
-
expect(gen.toCSS(false)).toContain('text-decoration-line: line-through;')
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it('should generate decoration-wavy', () => {
|
|
97
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
98
|
-
gen.generate('decoration-wavy')
|
|
99
|
-
expect(gen.toCSS(false)).toContain('text-decoration-style: wavy;')
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('should generate underline-offset', () => {
|
|
103
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
104
|
-
gen.generate('underline-offset-4')
|
|
105
|
-
expect(gen.toCSS(false)).toContain('text-underline-offset: 4px;')
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('should generate decoration-color', () => {
|
|
109
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
110
|
-
gen.generate('decoration-blue-500')
|
|
111
|
-
expect(gen.toCSS(false)).toContain('text-decoration-color: oklch(62.3% 0.214 259.815);')
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
describe('Font style', () => {
|
|
116
|
-
it('should generate italic', () => {
|
|
117
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
118
|
-
gen.generate('italic')
|
|
119
|
-
expect(gen.toCSS(false)).toContain('font-style: italic;')
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
it('should generate not-italic', () => {
|
|
123
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
124
|
-
gen.generate('not-italic')
|
|
125
|
-
expect(gen.toCSS(false)).toContain('font-style: normal;')
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
describe('Line height', () => {
|
|
130
|
-
it('should generate leading-tight', () => {
|
|
131
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
132
|
-
gen.generate('leading-tight')
|
|
133
|
-
expect(gen.toCSS(false)).toContain('line-height: 1.25;')
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
it('should generate leading-loose', () => {
|
|
137
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
138
|
-
gen.generate('leading-loose')
|
|
139
|
-
expect(gen.toCSS(false)).toContain('line-height: 2;')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('should generate leading-normal', () => {
|
|
143
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
144
|
-
gen.generate('leading-normal')
|
|
145
|
-
expect(gen.toCSS(false)).toContain('line-height: 1.5;')
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
describe('White space', () => {
|
|
150
|
-
it('should generate whitespace-nowrap', () => {
|
|
151
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
152
|
-
gen.generate('whitespace-nowrap')
|
|
153
|
-
expect(gen.toCSS(false)).toContain('white-space: nowrap;')
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('should generate whitespace-normal', () => {
|
|
157
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
158
|
-
gen.generate('whitespace-normal')
|
|
159
|
-
expect(gen.toCSS(false)).toContain('white-space: normal;')
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
describe('Letter spacing', () => {
|
|
164
|
-
it('should generate tracking-tight', () => {
|
|
165
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
166
|
-
gen.generate('tracking-tight')
|
|
167
|
-
expect(gen.toCSS(false)).toContain('letter-spacing:')
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
it('should generate tracking-wide', () => {
|
|
171
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
172
|
-
gen.generate('tracking-wide')
|
|
173
|
-
expect(gen.toCSS(false)).toContain('letter-spacing:')
|
|
174
|
-
})
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
describe('Edge Cases', () => {
|
|
178
|
-
describe('Arbitrary font sizes', () => {
|
|
179
|
-
it('should handle arbitrary font size', () => {
|
|
180
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
181
|
-
gen.generate('text-[32px]')
|
|
182
|
-
expect(gen.toCSS(false)).toContain('font-size: 32px;')
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
it('should handle arbitrary font size with rem', () => {
|
|
186
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
187
|
-
gen.generate('text-[2.5rem]')
|
|
188
|
-
expect(gen.toCSS(false)).toContain('font-size: 2.5rem;')
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
it('should handle arbitrary font size with clamp', () => {
|
|
192
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
193
|
-
gen.generate('text-[clamp(1rem,2.5vw,3rem)]')
|
|
194
|
-
expect(gen.toCSS(false)).toContain('font-size: clamp(1rem,2.5vw,3rem);')
|
|
195
|
-
})
|
|
196
|
-
})
|
|
197
|
-
|
|
198
|
-
describe('Font families', () => {
|
|
199
|
-
it('should handle font-sans', () => {
|
|
200
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
201
|
-
gen.generate('font-sans')
|
|
202
|
-
expect(gen.toCSS(false)).toContain('font-family:')
|
|
203
|
-
expect(gen.toCSS(false)).toContain('ui-sans-serif')
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
it('should handle font-serif', () => {
|
|
207
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
208
|
-
gen.generate('font-serif')
|
|
209
|
-
expect(gen.toCSS(false)).toContain('font-family:')
|
|
210
|
-
expect(gen.toCSS(false)).toContain('ui-serif')
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
it('should handle font-mono', () => {
|
|
214
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
215
|
-
gen.generate('font-mono')
|
|
216
|
-
expect(gen.toCSS(false)).toContain('font-family:')
|
|
217
|
-
expect(gen.toCSS(false)).toContain('ui-monospace')
|
|
218
|
-
})
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
describe('Arbitrary font weights', () => {
|
|
222
|
-
it('should handle arbitrary font weight', () => {
|
|
223
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
224
|
-
gen.generate('font-[450]')
|
|
225
|
-
expect(gen.toCSS(false)).toContain('font-weight: 450;')
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
it('should handle arbitrary font weight with variable', () => {
|
|
229
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
230
|
-
gen.generate('font-[var(--font-weight)]')
|
|
231
|
-
expect(gen.toCSS(false)).toContain('font-weight: var(--font-weight);')
|
|
232
|
-
})
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
describe('Text overflow utilities', () => {
|
|
236
|
-
it('should handle truncate', () => {
|
|
237
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
238
|
-
gen.generate('truncate')
|
|
239
|
-
const css = gen.toCSS(false)
|
|
240
|
-
expect(css).toContain('overflow: hidden;')
|
|
241
|
-
expect(css).toContain('text-overflow: ellipsis;')
|
|
242
|
-
expect(css).toContain('white-space: nowrap;')
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
it('should handle text-ellipsis', () => {
|
|
246
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
247
|
-
gen.generate('text-ellipsis')
|
|
248
|
-
expect(gen.toCSS(false)).toContain('text-overflow: ellipsis;')
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
it('should handle text-clip', () => {
|
|
252
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
253
|
-
gen.generate('text-clip')
|
|
254
|
-
expect(gen.toCSS(false)).toContain('text-overflow: clip;')
|
|
255
|
-
})
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
describe('Vertical align', () => {
|
|
259
|
-
it('should handle align-baseline', () => {
|
|
260
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
261
|
-
gen.generate('align-baseline')
|
|
262
|
-
expect(gen.toCSS(false)).toContain('vertical-align: baseline;')
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
it('should handle align-top', () => {
|
|
266
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
267
|
-
gen.generate('align-top')
|
|
268
|
-
expect(gen.toCSS(false)).toContain('vertical-align: top;')
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
it('should handle align-middle', () => {
|
|
272
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
273
|
-
gen.generate('align-middle')
|
|
274
|
-
expect(gen.toCSS(false)).toContain('vertical-align: middle;')
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
it('should handle align-bottom', () => {
|
|
278
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
279
|
-
gen.generate('align-bottom')
|
|
280
|
-
expect(gen.toCSS(false)).toContain('vertical-align: bottom;')
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
it('should handle align-text-top', () => {
|
|
284
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
285
|
-
gen.generate('align-text-top')
|
|
286
|
-
expect(gen.toCSS(false)).toContain('vertical-align: text-top;')
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
it('should handle align-text-bottom', () => {
|
|
290
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
291
|
-
gen.generate('align-text-bottom')
|
|
292
|
-
expect(gen.toCSS(false)).toContain('vertical-align: text-bottom;')
|
|
293
|
-
})
|
|
294
|
-
|
|
295
|
-
it('should handle align-sub', () => {
|
|
296
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
297
|
-
gen.generate('align-sub')
|
|
298
|
-
expect(gen.toCSS(false)).toContain('vertical-align: sub;')
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
it('should handle align-super', () => {
|
|
302
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
303
|
-
gen.generate('align-super')
|
|
304
|
-
expect(gen.toCSS(false)).toContain('vertical-align: super;')
|
|
305
|
-
})
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
describe('Text indent', () => {
|
|
309
|
-
it('should handle indent with spacing scale', () => {
|
|
310
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
311
|
-
gen.generate('indent-4')
|
|
312
|
-
expect(gen.toCSS(false)).toContain('text-indent: 1rem;')
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
it('should handle arbitrary indent', () => {
|
|
316
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
317
|
-
gen.generate('indent-[2.5rem]')
|
|
318
|
-
expect(gen.toCSS(false)).toContain('text-indent: 2.5rem;')
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
it('should handle negative indent', () => {
|
|
322
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
323
|
-
gen.generate('-indent-4')
|
|
324
|
-
expect(gen.toCSS(false)).toContain('text-indent: -1rem;')
|
|
325
|
-
})
|
|
326
|
-
})
|
|
327
|
-
|
|
328
|
-
describe('Word and overflow wrap', () => {
|
|
329
|
-
it('should handle break-normal', () => {
|
|
330
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
331
|
-
gen.generate('break-normal')
|
|
332
|
-
const css = gen.toCSS(false)
|
|
333
|
-
expect(css).toContain('overflow-wrap: normal;')
|
|
334
|
-
expect(css).toContain('word-break: normal;')
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
it('should handle break-words', () => {
|
|
338
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
339
|
-
gen.generate('break-words')
|
|
340
|
-
expect(gen.toCSS(false)).toContain('overflow-wrap: break-word;')
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
it('should handle break-all', () => {
|
|
344
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
345
|
-
gen.generate('break-all')
|
|
346
|
-
expect(gen.toCSS(false)).toContain('word-break: break-all;')
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
it('should handle break-keep', () => {
|
|
350
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
351
|
-
gen.generate('break-keep')
|
|
352
|
-
expect(gen.toCSS(false)).toContain('word-break: keep-all;')
|
|
353
|
-
})
|
|
354
|
-
})
|
|
355
|
-
|
|
356
|
-
describe('List style', () => {
|
|
357
|
-
it('should handle list-none', () => {
|
|
358
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
359
|
-
gen.generate('list-none')
|
|
360
|
-
expect(gen.toCSS(false)).toContain('list-style-type: none;')
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
it('should handle list-disc', () => {
|
|
364
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
365
|
-
gen.generate('list-disc')
|
|
366
|
-
expect(gen.toCSS(false)).toContain('list-style-type: disc;')
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
it('should handle list-decimal', () => {
|
|
370
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
371
|
-
gen.generate('list-decimal')
|
|
372
|
-
expect(gen.toCSS(false)).toContain('list-style-type: decimal;')
|
|
373
|
-
})
|
|
374
|
-
|
|
375
|
-
it('should handle list-inside', () => {
|
|
376
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
377
|
-
gen.generate('list-inside')
|
|
378
|
-
expect(gen.toCSS(false)).toContain('list-style-position: inside;')
|
|
379
|
-
})
|
|
380
|
-
|
|
381
|
-
it('should handle list-outside', () => {
|
|
382
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
383
|
-
gen.generate('list-outside')
|
|
384
|
-
expect(gen.toCSS(false)).toContain('list-style-position: outside;')
|
|
385
|
-
})
|
|
386
|
-
})
|
|
387
|
-
|
|
388
|
-
describe('Arbitrary letter spacing and line height', () => {
|
|
389
|
-
it('should handle arbitrary letter spacing', () => {
|
|
390
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
391
|
-
gen.generate('tracking-[0.5em]')
|
|
392
|
-
expect(gen.toCSS(false)).toContain('letter-spacing: 0.5em;')
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
it('should handle arbitrary line height', () => {
|
|
396
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
397
|
-
gen.generate('leading-[3rem]')
|
|
398
|
-
expect(gen.toCSS(false)).toContain('line-height: 3rem;')
|
|
399
|
-
})
|
|
400
|
-
|
|
401
|
-
it('should handle negative letter spacing with arbitrary value', () => {
|
|
402
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
403
|
-
gen.generate('tracking-[-0.05em]')
|
|
404
|
-
expect(gen.toCSS(false)).toContain('letter-spacing: -0.05em;')
|
|
405
|
-
})
|
|
406
|
-
})
|
|
407
|
-
|
|
408
|
-
describe('Font variant numeric', () => {
|
|
409
|
-
it('should handle normal-nums', () => {
|
|
410
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
411
|
-
gen.generate('normal-nums')
|
|
412
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: normal;')
|
|
413
|
-
})
|
|
414
|
-
|
|
415
|
-
it('should handle ordinal', () => {
|
|
416
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
417
|
-
gen.generate('ordinal')
|
|
418
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: ordinal;')
|
|
419
|
-
})
|
|
420
|
-
|
|
421
|
-
it('should handle slashed-zero', () => {
|
|
422
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
423
|
-
gen.generate('slashed-zero')
|
|
424
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: slashed-zero;')
|
|
425
|
-
})
|
|
426
|
-
|
|
427
|
-
it('should handle lining-nums', () => {
|
|
428
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
429
|
-
gen.generate('lining-nums')
|
|
430
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: lining-nums;')
|
|
431
|
-
})
|
|
432
|
-
|
|
433
|
-
it('should handle oldstyle-nums', () => {
|
|
434
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
435
|
-
gen.generate('oldstyle-nums')
|
|
436
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: oldstyle-nums;')
|
|
437
|
-
})
|
|
438
|
-
|
|
439
|
-
it('should handle proportional-nums', () => {
|
|
440
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
441
|
-
gen.generate('proportional-nums')
|
|
442
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: proportional-nums;')
|
|
443
|
-
})
|
|
444
|
-
|
|
445
|
-
it('should handle tabular-nums', () => {
|
|
446
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
447
|
-
gen.generate('tabular-nums')
|
|
448
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: tabular-nums;')
|
|
449
|
-
})
|
|
450
|
-
|
|
451
|
-
it('should handle diagonal-fractions', () => {
|
|
452
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
453
|
-
gen.generate('diagonal-fractions')
|
|
454
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: diagonal-fractions;')
|
|
455
|
-
})
|
|
456
|
-
|
|
457
|
-
it('should handle stacked-fractions', () => {
|
|
458
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
459
|
-
gen.generate('stacked-fractions')
|
|
460
|
-
expect(gen.toCSS(false)).toContain('font-variant-numeric: stacked-fractions;')
|
|
461
|
-
})
|
|
462
|
-
})
|
|
463
|
-
|
|
464
|
-
describe('Text decoration thickness', () => {
|
|
465
|
-
it('should handle decoration-auto', () => {
|
|
466
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
467
|
-
gen.generate('decoration-auto')
|
|
468
|
-
expect(gen.toCSS(false)).toContain('text-decoration-thickness: auto;')
|
|
469
|
-
})
|
|
470
|
-
|
|
471
|
-
it('should handle decoration-from-font', () => {
|
|
472
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
473
|
-
gen.generate('decoration-from-font')
|
|
474
|
-
expect(gen.toCSS(false)).toContain('text-decoration-thickness: from-font;')
|
|
475
|
-
})
|
|
476
|
-
|
|
477
|
-
it('should handle decoration-0', () => {
|
|
478
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
479
|
-
gen.generate('decoration-0')
|
|
480
|
-
expect(gen.toCSS(false)).toContain('text-decoration-thickness: 0px;')
|
|
481
|
-
})
|
|
482
|
-
|
|
483
|
-
it('should handle decoration-1', () => {
|
|
484
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
485
|
-
gen.generate('decoration-1')
|
|
486
|
-
expect(gen.toCSS(false)).toContain('text-decoration-thickness: 1px;')
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
it('should handle decoration-2', () => {
|
|
490
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
491
|
-
gen.generate('decoration-2')
|
|
492
|
-
expect(gen.toCSS(false)).toContain('text-decoration-thickness: 2px;')
|
|
493
|
-
})
|
|
494
|
-
|
|
495
|
-
it('should handle arbitrary decoration thickness', () => {
|
|
496
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
497
|
-
gen.generate('decoration-[3px]')
|
|
498
|
-
expect(gen.toCSS(false)).toContain('text-decoration-thickness: 3px;')
|
|
499
|
-
})
|
|
500
|
-
})
|
|
501
|
-
|
|
502
|
-
describe('Typography with variants', () => {
|
|
503
|
-
it('should handle text-center with responsive variant', () => {
|
|
504
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
505
|
-
gen.generate('md:text-center')
|
|
506
|
-
const css = gen.toCSS(false)
|
|
507
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
508
|
-
expect(css).toContain('text-align: center;')
|
|
509
|
-
})
|
|
510
|
-
|
|
511
|
-
it('should handle font-bold with hover variant', () => {
|
|
512
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
513
|
-
gen.generate('hover:font-bold')
|
|
514
|
-
const css = gen.toCSS(false)
|
|
515
|
-
expect(css).toContain(':hover')
|
|
516
|
-
expect(css).toContain('font-weight: 700;')
|
|
517
|
-
})
|
|
518
|
-
|
|
519
|
-
it('should handle text-lg with dark mode variant', () => {
|
|
520
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
521
|
-
gen.generate('dark:text-lg')
|
|
522
|
-
const css = gen.toCSS(false)
|
|
523
|
-
expect(css).toContain('.dark')
|
|
524
|
-
expect(css).toContain('font-size:')
|
|
525
|
-
})
|
|
526
|
-
})
|
|
527
|
-
|
|
528
|
-
describe('Text with CSS variables', () => {
|
|
529
|
-
it('should handle font size with CSS variable', () => {
|
|
530
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
531
|
-
gen.generate('text-[var(--font-size)]')
|
|
532
|
-
expect(gen.toCSS(false)).toContain('font-size: var(--font-size);')
|
|
533
|
-
})
|
|
534
|
-
|
|
535
|
-
it('should handle line height with CSS variable', () => {
|
|
536
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
537
|
-
gen.generate('leading-[var(--line-height)]')
|
|
538
|
-
expect(gen.toCSS(false)).toContain('line-height: var(--line-height);')
|
|
539
|
-
})
|
|
540
|
-
})
|
|
541
|
-
|
|
542
|
-
describe('Hyphens', () => {
|
|
543
|
-
it('should handle hyphens-none', () => {
|
|
544
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
545
|
-
gen.generate('hyphens-none')
|
|
546
|
-
expect(gen.toCSS(false)).toContain('hyphens: none;')
|
|
547
|
-
})
|
|
548
|
-
|
|
549
|
-
it('should handle hyphens-manual', () => {
|
|
550
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
551
|
-
gen.generate('hyphens-manual')
|
|
552
|
-
expect(gen.toCSS(false)).toContain('hyphens: manual;')
|
|
553
|
-
})
|
|
554
|
-
|
|
555
|
-
it('should handle hyphens-auto', () => {
|
|
556
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
557
|
-
gen.generate('hyphens-auto')
|
|
558
|
-
expect(gen.toCSS(false)).toContain('hyphens: auto;')
|
|
559
|
-
})
|
|
560
|
-
})
|
|
561
|
-
|
|
562
|
-
describe('Text wrap', () => {
|
|
563
|
-
it('should handle text-wrap', () => {
|
|
564
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
565
|
-
gen.generate('text-wrap')
|
|
566
|
-
expect(gen.toCSS(false)).toContain('text-wrap: wrap;')
|
|
567
|
-
})
|
|
568
|
-
|
|
569
|
-
it('should handle text-nowrap', () => {
|
|
570
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
571
|
-
gen.generate('text-nowrap')
|
|
572
|
-
expect(gen.toCSS(false)).toContain('text-wrap: nowrap;')
|
|
573
|
-
})
|
|
574
|
-
|
|
575
|
-
it('should handle text-balance', () => {
|
|
576
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
577
|
-
gen.generate('text-balance')
|
|
578
|
-
expect(gen.toCSS(false)).toContain('text-wrap: balance;')
|
|
579
|
-
})
|
|
580
|
-
|
|
581
|
-
it('should handle text-pretty', () => {
|
|
582
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
583
|
-
gen.generate('text-pretty')
|
|
584
|
-
expect(gen.toCSS(false)).toContain('text-wrap: pretty;')
|
|
585
|
-
})
|
|
586
|
-
})
|
|
587
|
-
|
|
588
|
-
describe('Content utilities', () => {
|
|
589
|
-
it('should handle content with arbitrary value', () => {
|
|
590
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
591
|
-
gen.generate('content-["Hello"]')
|
|
592
|
-
expect(gen.toCSS(false)).toContain('content: "Hello";')
|
|
593
|
-
})
|
|
594
|
-
|
|
595
|
-
it('should handle content-none', () => {
|
|
596
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
597
|
-
gen.generate('content-none')
|
|
598
|
-
expect(gen.toCSS(false)).toContain('content: none;')
|
|
599
|
-
})
|
|
600
|
-
})
|
|
601
|
-
|
|
602
|
-
describe('Edge cases', () => {
|
|
603
|
-
it('should handle very large font sizes', () => {
|
|
604
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
605
|
-
gen.generate('text-[500px]')
|
|
606
|
-
const css = gen.toCSS(false)
|
|
607
|
-
expect(css).toContain('500px')
|
|
608
|
-
})
|
|
609
|
-
|
|
610
|
-
it('should handle very small font sizes', () => {
|
|
611
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
612
|
-
gen.generate('text-[1px]')
|
|
613
|
-
const css = gen.toCSS(false)
|
|
614
|
-
expect(css).toContain('1px')
|
|
615
|
-
})
|
|
616
|
-
|
|
617
|
-
it('should handle line-clamp with large numbers', () => {
|
|
618
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
619
|
-
gen.generate('line-clamp-999')
|
|
620
|
-
const css = gen.toCSS(false)
|
|
621
|
-
expect(css).toContain('-webkit-line-clamp')
|
|
622
|
-
})
|
|
623
|
-
|
|
624
|
-
it('should handle font family with spaces', () => {
|
|
625
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
626
|
-
gen.generate('font-[\'Comic_Sans_MS\']')
|
|
627
|
-
const css = gen.toCSS(false)
|
|
628
|
-
expect(css.length).toBeGreaterThan(0)
|
|
629
|
-
})
|
|
630
|
-
})
|
|
631
|
-
})
|
|
632
|
-
})
|