@cwcss/crosswind 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +52 -0
  3. package/dist/bin/cli.js +14615 -0
  4. package/dist/build.d.ts +24 -0
  5. package/dist/config.d.ts +5 -0
  6. package/dist/generator.d.ts +31 -0
  7. package/dist/index.d.ts +10 -0
  8. package/dist/parser.d.ts +42 -0
  9. package/dist/plugin.d.ts +22 -0
  10. package/dist/preflight-forms.d.ts +5 -0
  11. package/dist/preflight.d.ts +2 -0
  12. package/dist/rules-advanced.d.ts +27 -0
  13. package/dist/rules-effects.d.ts +25 -0
  14. package/dist/rules-forms.d.ts +7 -0
  15. package/dist/rules-grid.d.ts +13 -0
  16. package/dist/rules-interactivity.d.ts +41 -0
  17. package/dist/rules-layout.d.ts +26 -0
  18. package/dist/rules-transforms.d.ts +33 -0
  19. package/dist/rules-typography.d.ts +41 -0
  20. package/dist/rules.d.ts +39 -0
  21. package/dist/scanner.d.ts +18 -0
  22. package/dist/src/index.js +12848 -0
  23. package/dist/transformer-compile-class.d.ts +37 -0
  24. package/{src/types.ts → dist/types.d.ts} +17 -86
  25. package/package.json +2 -16
  26. package/PLUGIN.md +0 -235
  27. package/benchmark/framework-comparison.bench.ts +0 -850
  28. package/bin/cli.ts +0 -365
  29. package/bin/crosswind +0 -0
  30. package/bin/headwind +0 -0
  31. package/build.ts +0 -8
  32. package/crosswind.config.ts +0 -9
  33. package/example/comprehensive.html +0 -70
  34. package/example/index.html +0 -21
  35. package/example/output.css +0 -236
  36. package/examples/plugin/README.md +0 -112
  37. package/examples/plugin/build.ts +0 -32
  38. package/examples/plugin/src/index.html +0 -34
  39. package/examples/plugin/src/index.ts +0 -7
  40. package/headwind +0 -2
  41. package/src/build.ts +0 -101
  42. package/src/config.ts +0 -529
  43. package/src/generator.ts +0 -2173
  44. package/src/index.ts +0 -10
  45. package/src/parser.ts +0 -1471
  46. package/src/plugin.ts +0 -118
  47. package/src/preflight-forms.ts +0 -229
  48. package/src/preflight.ts +0 -388
  49. package/src/rules-advanced.ts +0 -477
  50. package/src/rules-effects.ts +0 -461
  51. package/src/rules-forms.ts +0 -103
  52. package/src/rules-grid.ts +0 -241
  53. package/src/rules-interactivity.ts +0 -525
  54. package/src/rules-layout.ts +0 -385
  55. package/src/rules-transforms.ts +0 -412
  56. package/src/rules-typography.ts +0 -486
  57. package/src/rules.ts +0 -809
  58. package/src/scanner.ts +0 -84
  59. package/src/transformer-compile-class.ts +0 -275
  60. package/test/advanced-features.test.ts +0 -911
  61. package/test/arbitrary.test.ts +0 -396
  62. package/test/attributify.test.ts +0 -592
  63. package/test/bracket-syntax.test.ts +0 -1133
  64. package/test/build.test.ts +0 -99
  65. package/test/colors.test.ts +0 -934
  66. package/test/flexbox.test.ts +0 -669
  67. package/test/generator.test.ts +0 -597
  68. package/test/grid.test.ts +0 -584
  69. package/test/layout.test.ts +0 -404
  70. package/test/modifiers.test.ts +0 -417
  71. package/test/parser.test.ts +0 -564
  72. package/test/performance-regression.test.ts +0 -376
  73. package/test/performance.test.ts +0 -568
  74. package/test/plugin.test.ts +0 -160
  75. package/test/scanner.test.ts +0 -94
  76. package/test/sizing.test.ts +0 -481
  77. package/test/spacing.test.ts +0 -394
  78. package/test/transformer-compile-class.test.ts +0 -287
  79. package/test/transforms.test.ts +0 -448
  80. package/test/typography.test.ts +0 -632
  81. package/test/variants-form-states.test.ts +0 -225
  82. package/test/variants-group-peer.test.ts +0 -66
  83. package/test/variants-media.test.ts +0 -213
  84. package/test/variants-positional.test.ts +0 -58
  85. package/test/variants-pseudo-elements.test.ts +0 -47
  86. package/test/variants-state.test.ts +0 -62
  87. package/tsconfig.json +0 -18
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
- ]