@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/src/rules-grid.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import type { UtilityRule } from './rules'
|
|
2
|
-
|
|
3
|
-
// Grid utilities
|
|
4
|
-
|
|
5
|
-
export const gridTemplateColumnsRule: UtilityRule = (parsed) => {
|
|
6
|
-
if (parsed.utility === 'grid-cols') {
|
|
7
|
-
const cols: Record<string, string> = {
|
|
8
|
-
1: 'repeat(1, minmax(0, 1fr))',
|
|
9
|
-
2: 'repeat(2, minmax(0, 1fr))',
|
|
10
|
-
3: 'repeat(3, minmax(0, 1fr))',
|
|
11
|
-
4: 'repeat(4, minmax(0, 1fr))',
|
|
12
|
-
5: 'repeat(5, minmax(0, 1fr))',
|
|
13
|
-
6: 'repeat(6, minmax(0, 1fr))',
|
|
14
|
-
7: 'repeat(7, minmax(0, 1fr))',
|
|
15
|
-
8: 'repeat(8, minmax(0, 1fr))',
|
|
16
|
-
9: 'repeat(9, minmax(0, 1fr))',
|
|
17
|
-
10: 'repeat(10, minmax(0, 1fr))',
|
|
18
|
-
11: 'repeat(11, minmax(0, 1fr))',
|
|
19
|
-
12: 'repeat(12, minmax(0, 1fr))',
|
|
20
|
-
none: 'none',
|
|
21
|
-
subgrid: 'subgrid',
|
|
22
|
-
}
|
|
23
|
-
return parsed.value ? { 'grid-template-columns': cols[parsed.value] || parsed.value } : undefined
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const gridColumnRule: UtilityRule = (parsed) => {
|
|
28
|
-
if (parsed.utility === 'col') {
|
|
29
|
-
const spans: Record<string, string> = {
|
|
30
|
-
'auto': 'auto',
|
|
31
|
-
'span-1': 'span 1 / span 1',
|
|
32
|
-
'span-2': 'span 2 / span 2',
|
|
33
|
-
'span-3': 'span 3 / span 3',
|
|
34
|
-
'span-4': 'span 4 / span 4',
|
|
35
|
-
'span-5': 'span 5 / span 5',
|
|
36
|
-
'span-6': 'span 6 / span 6',
|
|
37
|
-
'span-7': 'span 7 / span 7',
|
|
38
|
-
'span-8': 'span 8 / span 8',
|
|
39
|
-
'span-9': 'span 9 / span 9',
|
|
40
|
-
'span-10': 'span 10 / span 10',
|
|
41
|
-
'span-11': 'span 11 / span 11',
|
|
42
|
-
'span-12': 'span 12 / span 12',
|
|
43
|
-
'span-full': '1 / -1',
|
|
44
|
-
}
|
|
45
|
-
return parsed.value ? { 'grid-column': spans[parsed.value] || parsed.value } : undefined
|
|
46
|
-
}
|
|
47
|
-
if (parsed.utility === 'col-span' && parsed.value) {
|
|
48
|
-
const spans: Record<string, string> = {
|
|
49
|
-
auto: 'auto',
|
|
50
|
-
1: 'span 1 / span 1',
|
|
51
|
-
2: 'span 2 / span 2',
|
|
52
|
-
3: 'span 3 / span 3',
|
|
53
|
-
4: 'span 4 / span 4',
|
|
54
|
-
5: 'span 5 / span 5',
|
|
55
|
-
6: 'span 6 / span 6',
|
|
56
|
-
7: 'span 7 / span 7',
|
|
57
|
-
8: 'span 8 / span 8',
|
|
58
|
-
9: 'span 9 / span 9',
|
|
59
|
-
10: 'span 10 / span 10',
|
|
60
|
-
11: 'span 11 / span 11',
|
|
61
|
-
12: 'span 12 / span 12',
|
|
62
|
-
full: '1 / -1',
|
|
63
|
-
}
|
|
64
|
-
// Handle arbitrary values: col-span-[15] -> span 15 / span 15
|
|
65
|
-
if (parsed.arbitrary) {
|
|
66
|
-
return { 'grid-column': `span ${parsed.value} / span ${parsed.value}` } as Record<string, string>
|
|
67
|
-
}
|
|
68
|
-
return { 'grid-column': spans[parsed.value] || parsed.value } as Record<string, string>
|
|
69
|
-
}
|
|
70
|
-
if (parsed.utility === 'col-start' && parsed.value) {
|
|
71
|
-
return { 'grid-column-start': parsed.value } as Record<string, string>
|
|
72
|
-
}
|
|
73
|
-
if (parsed.utility === 'col-end' && parsed.value) {
|
|
74
|
-
return { 'grid-column-end': parsed.value } as Record<string, string>
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const gridTemplateRowsRule: UtilityRule = (parsed) => {
|
|
79
|
-
if (parsed.utility === 'grid-rows') {
|
|
80
|
-
const rows: Record<string, string> = {
|
|
81
|
-
1: 'repeat(1, minmax(0, 1fr))',
|
|
82
|
-
2: 'repeat(2, minmax(0, 1fr))',
|
|
83
|
-
3: 'repeat(3, minmax(0, 1fr))',
|
|
84
|
-
4: 'repeat(4, minmax(0, 1fr))',
|
|
85
|
-
5: 'repeat(5, minmax(0, 1fr))',
|
|
86
|
-
6: 'repeat(6, minmax(0, 1fr))',
|
|
87
|
-
none: 'none',
|
|
88
|
-
subgrid: 'subgrid',
|
|
89
|
-
}
|
|
90
|
-
return parsed.value ? { 'grid-template-rows': rows[parsed.value] || parsed.value } : undefined
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const gridRowRule: UtilityRule = (parsed) => {
|
|
95
|
-
if (parsed.utility === 'row') {
|
|
96
|
-
const spans: Record<string, string> = {
|
|
97
|
-
'auto': 'auto',
|
|
98
|
-
'span-1': 'span 1 / span 1',
|
|
99
|
-
'span-2': 'span 2 / span 2',
|
|
100
|
-
'span-3': 'span 3 / span 3',
|
|
101
|
-
'span-4': 'span 4 / span 4',
|
|
102
|
-
'span-5': 'span 5 / span 5',
|
|
103
|
-
'span-6': 'span 6 / span 6',
|
|
104
|
-
'span-full': '1 / -1',
|
|
105
|
-
}
|
|
106
|
-
return parsed.value ? { 'grid-row': spans[parsed.value] || parsed.value } : undefined
|
|
107
|
-
}
|
|
108
|
-
if (parsed.utility === 'row-span' && parsed.value) {
|
|
109
|
-
const spans: Record<string, string> = {
|
|
110
|
-
auto: 'auto',
|
|
111
|
-
1: 'span 1 / span 1',
|
|
112
|
-
2: 'span 2 / span 2',
|
|
113
|
-
3: 'span 3 / span 3',
|
|
114
|
-
4: 'span 4 / span 4',
|
|
115
|
-
5: 'span 5 / span 5',
|
|
116
|
-
6: 'span 6 / span 6',
|
|
117
|
-
full: '1 / -1',
|
|
118
|
-
}
|
|
119
|
-
// Handle arbitrary values: row-span-[15] -> span 15 / span 15
|
|
120
|
-
if (parsed.arbitrary) {
|
|
121
|
-
return { 'grid-row': `span ${parsed.value} / span ${parsed.value}` } as Record<string, string>
|
|
122
|
-
}
|
|
123
|
-
return { 'grid-row': spans[parsed.value] || parsed.value } as Record<string, string>
|
|
124
|
-
}
|
|
125
|
-
if (parsed.utility === 'row-start' && parsed.value) {
|
|
126
|
-
return { 'grid-row-start': parsed.value } as Record<string, string>
|
|
127
|
-
}
|
|
128
|
-
if (parsed.utility === 'row-end' && parsed.value) {
|
|
129
|
-
return { 'grid-row-end': parsed.value } as Record<string, string>
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export const gridAutoFlowRule: UtilityRule = (parsed) => {
|
|
134
|
-
if (parsed.utility === 'grid-flow' && parsed.value) {
|
|
135
|
-
const flows: Record<string, string> = {
|
|
136
|
-
'row': 'row',
|
|
137
|
-
'col': 'column',
|
|
138
|
-
'dense': 'dense',
|
|
139
|
-
'row-dense': 'row dense',
|
|
140
|
-
'col-dense': 'column dense',
|
|
141
|
-
}
|
|
142
|
-
return flows[parsed.value] ? { 'grid-auto-flow': flows[parsed.value] } : undefined
|
|
143
|
-
}
|
|
144
|
-
return undefined
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export const gridAutoColumnsRule: UtilityRule = (parsed) => {
|
|
148
|
-
if (parsed.utility === 'auto-cols') {
|
|
149
|
-
const values: Record<string, string> = {
|
|
150
|
-
auto: 'auto',
|
|
151
|
-
min: 'min-content',
|
|
152
|
-
max: 'max-content',
|
|
153
|
-
fr: 'minmax(0, 1fr)',
|
|
154
|
-
}
|
|
155
|
-
return parsed.value ? { 'grid-auto-columns': values[parsed.value] || parsed.value } : undefined
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export const gridAutoRowsRule: UtilityRule = (parsed) => {
|
|
160
|
-
if (parsed.utility === 'auto-rows') {
|
|
161
|
-
const values: Record<string, string> = {
|
|
162
|
-
auto: 'auto',
|
|
163
|
-
min: 'min-content',
|
|
164
|
-
max: 'max-content',
|
|
165
|
-
fr: 'minmax(0, 1fr)',
|
|
166
|
-
}
|
|
167
|
-
return parsed.value ? { 'grid-auto-rows': values[parsed.value] || parsed.value } : undefined
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export const gapRule: UtilityRule = (parsed, config) => {
|
|
172
|
-
if (parsed.utility === 'gap' && parsed.value) {
|
|
173
|
-
return { gap: config.theme.spacing[parsed.value] || parsed.value } as Record<string, string>
|
|
174
|
-
}
|
|
175
|
-
if (parsed.utility === 'gap-x' && parsed.value) {
|
|
176
|
-
return { 'column-gap': config.theme.spacing[parsed.value] || parsed.value } as Record<string, string>
|
|
177
|
-
}
|
|
178
|
-
if (parsed.utility === 'gap-y' && parsed.value) {
|
|
179
|
-
return { 'row-gap': config.theme.spacing[parsed.value] || parsed.value } as Record<string, string>
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export const placeContentRule: UtilityRule = (parsed) => {
|
|
184
|
-
if (parsed.utility === 'place' && parsed.value && parsed.value.startsWith('content-')) {
|
|
185
|
-
const val = parsed.value.replace('content-', '')
|
|
186
|
-
const values: Record<string, string> = {
|
|
187
|
-
center: 'center',
|
|
188
|
-
start: 'start',
|
|
189
|
-
end: 'end',
|
|
190
|
-
between: 'space-between',
|
|
191
|
-
around: 'space-around',
|
|
192
|
-
evenly: 'space-evenly',
|
|
193
|
-
stretch: 'stretch',
|
|
194
|
-
}
|
|
195
|
-
return values[val] ? { 'place-content': values[val] } : undefined
|
|
196
|
-
}
|
|
197
|
-
return undefined
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export const placeItemsRule: UtilityRule = (parsed) => {
|
|
201
|
-
if (parsed.utility === 'place' && parsed.value && parsed.value.startsWith('items-')) {
|
|
202
|
-
const val = parsed.value.replace('items-', '')
|
|
203
|
-
const values: Record<string, string> = {
|
|
204
|
-
start: 'start',
|
|
205
|
-
end: 'end',
|
|
206
|
-
center: 'center',
|
|
207
|
-
stretch: 'stretch',
|
|
208
|
-
}
|
|
209
|
-
return values[val] ? { 'place-items': values[val] } : undefined
|
|
210
|
-
}
|
|
211
|
-
return undefined
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export const placeSelfRule: UtilityRule = (parsed) => {
|
|
215
|
-
if (parsed.utility === 'place' && parsed.value && parsed.value.startsWith('self-')) {
|
|
216
|
-
const val = parsed.value.replace('self-', '')
|
|
217
|
-
const values: Record<string, string> = {
|
|
218
|
-
auto: 'auto',
|
|
219
|
-
start: 'start',
|
|
220
|
-
end: 'end',
|
|
221
|
-
center: 'center',
|
|
222
|
-
stretch: 'stretch',
|
|
223
|
-
}
|
|
224
|
-
return values[val] ? { 'place-self': values[val] } : undefined
|
|
225
|
-
}
|
|
226
|
-
return undefined
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export const gridRules: UtilityRule[] = [
|
|
230
|
-
gridTemplateColumnsRule,
|
|
231
|
-
gridColumnRule,
|
|
232
|
-
gridTemplateRowsRule,
|
|
233
|
-
gridRowRule,
|
|
234
|
-
gridAutoFlowRule,
|
|
235
|
-
gridAutoColumnsRule,
|
|
236
|
-
gridAutoRowsRule,
|
|
237
|
-
gapRule,
|
|
238
|
-
placeContentRule,
|
|
239
|
-
placeItemsRule,
|
|
240
|
-
placeSelfRule,
|
|
241
|
-
]
|