@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.
Files changed (86) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +390 -0
  3. package/dist/build.d.ts +24 -0
  4. package/dist/config.d.ts +5 -0
  5. package/dist/generator.d.ts +31 -0
  6. package/dist/index.d.ts +10 -0
  7. package/dist/index.js +12798 -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/transformer-compile-class.d.ts +37 -0
  23. package/{src/types.ts → dist/types.d.ts} +17 -86
  24. package/package.json +1 -1
  25. package/PLUGIN.md +0 -235
  26. package/benchmark/framework-comparison.bench.ts +0 -850
  27. package/bin/cli.ts +0 -365
  28. package/bin/crosswind +0 -0
  29. package/bin/headwind +0 -0
  30. package/build.ts +0 -8
  31. package/crosswind.config.ts +0 -9
  32. package/example/comprehensive.html +0 -70
  33. package/example/index.html +0 -21
  34. package/example/output.css +0 -236
  35. package/examples/plugin/README.md +0 -112
  36. package/examples/plugin/build.ts +0 -32
  37. package/examples/plugin/src/index.html +0 -34
  38. package/examples/plugin/src/index.ts +0 -7
  39. package/headwind +0 -2
  40. package/src/build.ts +0 -101
  41. package/src/config.ts +0 -529
  42. package/src/generator.ts +0 -2173
  43. package/src/index.ts +0 -10
  44. package/src/parser.ts +0 -1471
  45. package/src/plugin.ts +0 -118
  46. package/src/preflight-forms.ts +0 -229
  47. package/src/preflight.ts +0 -388
  48. package/src/rules-advanced.ts +0 -477
  49. package/src/rules-effects.ts +0 -461
  50. package/src/rules-forms.ts +0 -103
  51. package/src/rules-grid.ts +0 -241
  52. package/src/rules-interactivity.ts +0 -525
  53. package/src/rules-layout.ts +0 -385
  54. package/src/rules-transforms.ts +0 -412
  55. package/src/rules-typography.ts +0 -486
  56. package/src/rules.ts +0 -809
  57. package/src/scanner.ts +0 -84
  58. package/src/transformer-compile-class.ts +0 -275
  59. package/test/advanced-features.test.ts +0 -911
  60. package/test/arbitrary.test.ts +0 -396
  61. package/test/attributify.test.ts +0 -592
  62. package/test/bracket-syntax.test.ts +0 -1133
  63. package/test/build.test.ts +0 -99
  64. package/test/colors.test.ts +0 -934
  65. package/test/flexbox.test.ts +0 -669
  66. package/test/generator.test.ts +0 -597
  67. package/test/grid.test.ts +0 -584
  68. package/test/layout.test.ts +0 -404
  69. package/test/modifiers.test.ts +0 -417
  70. package/test/parser.test.ts +0 -564
  71. package/test/performance-regression.test.ts +0 -376
  72. package/test/performance.test.ts +0 -568
  73. package/test/plugin.test.ts +0 -160
  74. package/test/scanner.test.ts +0 -94
  75. package/test/sizing.test.ts +0 -481
  76. package/test/spacing.test.ts +0 -394
  77. package/test/transformer-compile-class.test.ts +0 -287
  78. package/test/transforms.test.ts +0 -448
  79. package/test/typography.test.ts +0 -632
  80. package/test/variants-form-states.test.ts +0 -225
  81. package/test/variants-group-peer.test.ts +0 -66
  82. package/test/variants-media.test.ts +0 -213
  83. package/test/variants-positional.test.ts +0 -58
  84. package/test/variants-pseudo-elements.test.ts +0 -47
  85. package/test/variants-state.test.ts +0 -62
  86. package/tsconfig.json +0 -18
@@ -1,461 +0,0 @@
1
- import type { UtilityRule } from './rules'
2
-
3
- // =============================================================================
4
- // Shadow color helpers
5
- // =============================================================================
6
-
7
- // Flat color cache for shadow color lookups
8
- let shadowColorCache: Map<string, string> | null = null
9
- let shadowColorCacheConfig: any = null
10
-
11
- function buildShadowColorCache(colors: Record<string, any>): Map<string, string> {
12
- const cache = new Map<string, string>()
13
- for (const [name, value] of Object.entries(colors)) {
14
- if (typeof value === 'string') {
15
- cache.set(name, value)
16
- }
17
- else if (typeof value === 'object' && value !== null) {
18
- for (const [shade, shadeValue] of Object.entries(value)) {
19
- if (typeof shadeValue === 'string') {
20
- cache.set(`${name}-${shade}`, shadeValue)
21
- }
22
- }
23
- }
24
- }
25
- return cache
26
- }
27
-
28
- function applyShadowOpacity(color: string, opacity: number): string {
29
- if (color.charCodeAt(0) === 35) { // '#'
30
- let hex = color.slice(1)
31
- // Expand 3-char hex (#rgb) to 6-char (#rrggbb)
32
- if (hex.length === 3) {
33
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]
34
- }
35
- const r = Number.parseInt(hex.slice(0, 2), 16)
36
- const g = Number.parseInt(hex.slice(2, 4), 16)
37
- const b = Number.parseInt(hex.slice(4, 6), 16)
38
- return `rgb(${r} ${g} ${b} / ${opacity})`
39
- }
40
- return color
41
- }
42
-
43
- /**
44
- * Replace color values in a shadow string with var(--hw-shadow-color)
45
- * e.g., '0 10px 15px -3px rgb(0 0 0 / 0.1)' -> '0 10px 15px -3px var(--hw-shadow-color)'
46
- */
47
- function createColoredShadow(shadow: string): string {
48
- return shadow.replace(/rgba?\([^)]+\)/g, 'var(--hw-shadow-color)')
49
- }
50
-
51
- // =============================================================================
52
- // Backgrounds, Borders, Effects utilities
53
- // =============================================================================
54
-
55
- // Background utilities
56
- export const backgroundAttachmentRule: UtilityRule = (parsed) => {
57
- if (parsed.utility === 'bg' && parsed.value) {
58
- const values: Record<string, string> = {
59
- fixed: 'fixed',
60
- local: 'local',
61
- scroll: 'scroll',
62
- }
63
- return values[parsed.value] ? { 'background-attachment': values[parsed.value] } : undefined
64
- }
65
- return undefined
66
- }
67
-
68
- export const backgroundClipRule: UtilityRule = (parsed) => {
69
- if (parsed.utility === 'bg' && parsed.value && parsed.value.startsWith('clip-')) {
70
- const val = parsed.value.replace('clip-', '')
71
- const values: Record<string, string> = {
72
- border: 'border-box',
73
- padding: 'padding-box',
74
- content: 'content-box',
75
- text: 'text',
76
- }
77
- return values[val] ? { 'background-clip': values[val] } : undefined
78
- }
79
- return undefined
80
- }
81
-
82
- export const backgroundImageRule: UtilityRule = (parsed) => {
83
- if (parsed.utility === 'bg' && parsed.value) {
84
- const gradients: Record<string, string> = {
85
- 'gradient-to-t': 'linear-gradient(to top, var(--hw-gradient-stops))',
86
- 'gradient-to-tr': 'linear-gradient(to top right, var(--hw-gradient-stops))',
87
- 'gradient-to-r': 'linear-gradient(to right, var(--hw-gradient-stops))',
88
- 'gradient-to-br': 'linear-gradient(to bottom right, var(--hw-gradient-stops))',
89
- 'gradient-to-b': 'linear-gradient(to bottom, var(--hw-gradient-stops))',
90
- 'gradient-to-bl': 'linear-gradient(to bottom left, var(--hw-gradient-stops))',
91
- 'gradient-to-l': 'linear-gradient(to left, var(--hw-gradient-stops))',
92
- 'gradient-to-tl': 'linear-gradient(to top left, var(--hw-gradient-stops))',
93
- }
94
- if (gradients[parsed.value]) {
95
- return { 'background-image': gradients[parsed.value] } as Record<string, string>
96
- }
97
- }
98
- }
99
-
100
- export const backgroundOriginRule: UtilityRule = (parsed) => {
101
- const values: Record<string, string> = {
102
- 'bg-origin-border': 'border-box',
103
- 'bg-origin-padding': 'padding-box',
104
- 'bg-origin-content': 'content-box',
105
- }
106
- return values[parsed.raw] ? { 'background-origin': values[parsed.raw] } : undefined
107
- }
108
-
109
- export const backgroundPositionRule: UtilityRule = (parsed) => {
110
- const positions: Record<string, string> = {
111
- 'bg-bottom': 'bottom',
112
- 'bg-center': 'center',
113
- 'bg-left': 'left',
114
- 'bg-left-bottom': 'left bottom',
115
- 'bg-left-top': 'left top',
116
- 'bg-right': 'right',
117
- 'bg-right-bottom': 'right bottom',
118
- 'bg-right-top': 'right top',
119
- 'bg-top': 'top',
120
- }
121
- return positions[parsed.raw] ? { 'background-position': positions[parsed.raw] } : undefined
122
- }
123
-
124
- export const backgroundRepeatRule: UtilityRule = (parsed) => {
125
- const repeats: Record<string, string> = {
126
- 'bg-repeat': 'repeat',
127
- 'bg-no-repeat': 'no-repeat',
128
- 'bg-repeat-x': 'repeat-x',
129
- 'bg-repeat-y': 'repeat-y',
130
- 'bg-repeat-round': 'round',
131
- 'bg-repeat-space': 'space',
132
- }
133
- return repeats[parsed.raw] ? { 'background-repeat': repeats[parsed.raw] } : undefined
134
- }
135
-
136
- export const backgroundSizeRule: UtilityRule = (parsed) => {
137
- const sizes: Record<string, string> = {
138
- 'bg-auto': 'auto',
139
- 'bg-cover': 'cover',
140
- 'bg-contain': 'contain',
141
- }
142
- return sizes[parsed.raw] ? { 'background-size': sizes[parsed.raw] } : undefined
143
- }
144
-
145
- // Border utilities
146
- export const borderStyleRule: UtilityRule = (parsed) => {
147
- if (parsed.utility === 'border' && parsed.value) {
148
- const styles: Record<string, string> = {
149
- solid: 'solid',
150
- dashed: 'dashed',
151
- dotted: 'dotted',
152
- double: 'double',
153
- hidden: 'hidden',
154
- none: 'none',
155
- }
156
- return styles[parsed.value] ? { 'border-style': styles[parsed.value] } : undefined
157
- }
158
- return undefined
159
- }
160
-
161
- export const outlineRule: UtilityRule = (parsed, config) => {
162
- // Outline offset
163
- if (parsed.utility === 'outline-offset' && parsed.value) {
164
- const offsets: Record<string, string> = {
165
- 0: '0px',
166
- 1: '1px',
167
- 2: '2px',
168
- 4: '4px',
169
- 8: '8px',
170
- }
171
- return { 'outline-offset': offsets[parsed.value] || parsed.value } as Record<string, string>
172
- }
173
-
174
- // Outline styles
175
- if (parsed.utility === 'outline' && parsed.value) {
176
- const outlineStyles: Record<string, string> = {
177
- none: 'none',
178
- solid: 'solid',
179
- dashed: 'dashed',
180
- dotted: 'dotted',
181
- double: 'double',
182
- }
183
- if (outlineStyles[parsed.value]) {
184
- return { 'outline-style': outlineStyles[parsed.value] } as Record<string, string>
185
- }
186
- }
187
-
188
- if (parsed.utility === 'outline') {
189
- if (!parsed.value) {
190
- return { 'outline-width': '1px' } as Record<string, string>
191
- }
192
-
193
- // Check for colors first (e.g., outline-blue-500)
194
- const parts = parsed.value.split('-')
195
- if (parts.length === 2) {
196
- const [colorName, shade] = parts
197
- const colorValue = config.theme.colors[colorName]
198
- if (typeof colorValue === 'object' && colorValue[shade]) {
199
- return { 'outline-color': colorValue[shade] } as Record<string, string>
200
- }
201
- }
202
-
203
- // Direct color (e.g., outline-black)
204
- const directColor = config.theme.colors[parsed.value]
205
- if (typeof directColor === 'string') {
206
- return { 'outline-color': directColor } as Record<string, string>
207
- }
208
-
209
- // Check for width values
210
- const widths: Record<string, string> = {
211
- 0: '0px',
212
- 1: '1px',
213
- 2: '2px',
214
- 4: '4px',
215
- 8: '8px',
216
- }
217
- if (widths[parsed.value]) {
218
- return { 'outline-width': widths[parsed.value] } as Record<string, string>
219
- }
220
-
221
- // Fallback to raw value as width
222
- return { 'outline-width': parsed.value } as Record<string, string>
223
- }
224
- }
225
-
226
- // Effect utilities
227
- export const boxShadowThemeRule: UtilityRule = (parsed, config) => {
228
- if (parsed.utility === 'shadow') {
229
- const shadow = parsed.value
230
- ? config.theme.boxShadow[parsed.value]
231
- : config.theme.boxShadow.DEFAULT
232
- if (!shadow) return undefined
233
-
234
- // shadow-none is a simple reset — no CSS variables needed
235
- if (shadow === 'none') {
236
- return {
237
- '--hw-shadow': '0 0 #0000',
238
- 'box-shadow': 'var(--hw-ring-offset-shadow, 0 0 #0000), var(--hw-ring-shadow, 0 0 #0000), var(--hw-shadow)',
239
- } as Record<string, string>
240
- }
241
-
242
- // Generate CSS variable-based shadow for color support
243
- const colored = createColoredShadow(shadow)
244
- return {
245
- '--hw-shadow': shadow,
246
- '--hw-shadow-colored': colored,
247
- 'box-shadow': 'var(--hw-ring-offset-shadow, 0 0 #0000), var(--hw-ring-shadow, 0 0 #0000), var(--hw-shadow)',
248
- } as Record<string, string>
249
- }
250
- }
251
-
252
- // Shadow color utilities (shadow-{color}, shadow-{color}/{opacity})
253
- export const shadowColorRule: UtilityRule = (parsed, config) => {
254
- if (parsed.utility !== 'shadow' || !parsed.value)
255
- return undefined
256
-
257
- // Skip if it matches a theme shadow size (sm, md, lg, xl, none, DEFAULT)
258
- if (config.theme.boxShadow[parsed.value])
259
- return undefined
260
-
261
- // Build/update color cache if needed
262
- if (shadowColorCache === null || shadowColorCacheConfig !== config.theme.colors) {
263
- shadowColorCache = buildShadowColorCache(config.theme.colors)
264
- shadowColorCacheConfig = config.theme.colors
265
- }
266
-
267
- const value = parsed.value
268
- const slashIdx = value.indexOf('/')
269
-
270
- let colorName: string
271
- let opacity: number | undefined
272
-
273
- if (slashIdx !== -1) {
274
- colorName = value.slice(0, slashIdx)
275
- const opacityValue = Number.parseInt(value.slice(slashIdx + 1), 10)
276
- if (Number.isNaN(opacityValue) || opacityValue < 0 || opacityValue > 100)
277
- return undefined
278
- opacity = opacityValue / 100
279
- }
280
- else {
281
- colorName = value
282
- }
283
-
284
- const resolvedColor = shadowColorCache.get(colorName)
285
- if (!resolvedColor) return undefined
286
-
287
- const finalColor = opacity !== undefined
288
- ? applyShadowOpacity(resolvedColor, opacity)
289
- : resolvedColor
290
-
291
- return {
292
- '--hw-shadow-color': finalColor,
293
- '--hw-shadow': 'var(--hw-shadow-colored)',
294
- } as Record<string, string>
295
- }
296
-
297
- export const textShadowRule: UtilityRule = (parsed) => {
298
- if (parsed.utility === 'text-shadow') {
299
- const shadows: Record<string, string> = {
300
- sm: '0 1px 2px rgba(0, 0, 0, 0.05)',
301
- DEFAULT: '0 1px 3px rgba(0, 0, 0, 0.1)',
302
- md: '0 4px 6px rgba(0, 0, 0, 0.1)',
303
- lg: '0 10px 15px rgba(0, 0, 0, 0.1)',
304
- xl: '0 20px 25px rgba(0, 0, 0, 0.1)',
305
- none: 'none',
306
- }
307
- return parsed.value ? { 'text-shadow': shadows[parsed.value] || parsed.value } : undefined
308
- }
309
- }
310
-
311
- export const opacityRule: UtilityRule = (parsed) => {
312
- if (parsed.utility === 'opacity' && parsed.value) {
313
- const opacityMap: Record<string, string> = {
314
- 0: '0',
315
- 5: '0.05',
316
- 10: '0.1',
317
- 20: '0.2',
318
- 25: '0.25',
319
- 30: '0.3',
320
- 40: '0.4',
321
- 50: '0.5',
322
- 60: '0.6',
323
- 70: '0.7',
324
- 75: '0.75',
325
- 80: '0.8',
326
- 90: '0.9',
327
- 95: '0.95',
328
- 100: '1',
329
- }
330
- return { opacity: opacityMap[parsed.value] || parsed.value }
331
- }
332
- }
333
-
334
- export const mixBlendModeRule: UtilityRule = (parsed) => {
335
- if (parsed.utility === 'mix-blend') {
336
- const modes = ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity']
337
- return parsed.value && modes.includes(parsed.value) ? { 'mix-blend-mode': parsed.value } : undefined
338
- }
339
- }
340
-
341
- export const backgroundBlendModeRule: UtilityRule = (parsed) => {
342
- if (parsed.utility === 'bg-blend') {
343
- const modes = ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity']
344
- return parsed.value && modes.includes(parsed.value) ? { 'background-blend-mode': parsed.value } : undefined
345
- }
346
- }
347
-
348
- // Mask utilities
349
- export const maskRule: UtilityRule = (parsed) => {
350
- // mask-clip
351
- if (parsed.utility === 'mask-clip' && parsed.value) {
352
- const clips: Record<string, string> = {
353
- 'border': 'border-box',
354
- 'padding': 'padding-box',
355
- 'content': 'content-box',
356
- 'text': 'text',
357
- 'fill': 'fill-box',
358
- 'stroke': 'stroke-box',
359
- 'view': 'view-box',
360
- 'no-clip': 'no-clip',
361
- }
362
- return { 'mask-clip': clips[parsed.value] || parsed.value } as Record<string, string>
363
- }
364
-
365
- // mask-composite
366
- if (parsed.utility === 'mask-composite' && parsed.value) {
367
- const composites = ['add', 'subtract', 'intersect', 'exclude']
368
- return composites.includes(parsed.value) ? { 'mask-composite': parsed.value } as Record<string, string> : undefined
369
- }
370
-
371
- // mask-image
372
- if (parsed.utility === 'mask-image' && parsed.value) {
373
- if (parsed.value === 'none') {
374
- return { 'mask-image': 'none' } as Record<string, string>
375
- }
376
- return { 'mask-image': `url(${parsed.value})` } as Record<string, string>
377
- }
378
-
379
- // mask-mode
380
- if (parsed.utility === 'mask-mode' && parsed.value) {
381
- const modes = ['alpha', 'luminance', 'match-source']
382
- return modes.includes(parsed.value) ? { 'mask-mode': parsed.value } as Record<string, string> : undefined
383
- }
384
-
385
- // mask-origin
386
- if (parsed.utility === 'mask-origin' && parsed.value) {
387
- const origins: Record<string, string> = {
388
- border: 'border-box',
389
- padding: 'padding-box',
390
- content: 'content-box',
391
- fill: 'fill-box',
392
- stroke: 'stroke-box',
393
- view: 'view-box',
394
- }
395
- return { 'mask-origin': origins[parsed.value] || parsed.value } as Record<string, string>
396
- }
397
-
398
- // mask-position
399
- if (parsed.utility === 'mask-position' && parsed.value) {
400
- const positions: Record<string, string> = {
401
- 'center': 'center',
402
- 'top': 'top',
403
- 'right': 'right',
404
- 'bottom': 'bottom',
405
- 'left': 'left',
406
- 'top-left': 'top left',
407
- 'top-right': 'top right',
408
- 'bottom-left': 'bottom left',
409
- 'bottom-right': 'bottom right',
410
- }
411
- return { 'mask-position': positions[parsed.value] || parsed.value } as Record<string, string>
412
- }
413
-
414
- // mask-repeat
415
- if (parsed.utility === 'mask-repeat' && parsed.value) {
416
- const repeats: Record<string, string> = {
417
- 'repeat': 'repeat',
418
- 'no-repeat': 'no-repeat',
419
- 'repeat-x': 'repeat-x',
420
- 'repeat-y': 'repeat-y',
421
- 'round': 'round',
422
- 'space': 'space',
423
- }
424
- return { 'mask-repeat': repeats[parsed.value] || parsed.value } as Record<string, string>
425
- }
426
-
427
- // mask-size
428
- if (parsed.utility === 'mask-size' && parsed.value) {
429
- const sizes: Record<string, string> = {
430
- auto: 'auto',
431
- cover: 'cover',
432
- contain: 'contain',
433
- }
434
- return { 'mask-size': sizes[parsed.value] || parsed.value } as Record<string, string>
435
- }
436
-
437
- // mask-type
438
- if (parsed.utility === 'mask-type' && parsed.value) {
439
- const types = ['alpha', 'luminance']
440
- return types.includes(parsed.value) ? { 'mask-type': parsed.value } as Record<string, string> : undefined
441
- }
442
- }
443
-
444
- export const effectsRules: UtilityRule[] = [
445
- backgroundAttachmentRule,
446
- backgroundClipRule,
447
- backgroundImageRule,
448
- backgroundOriginRule,
449
- backgroundPositionRule,
450
- backgroundRepeatRule,
451
- backgroundSizeRule,
452
- borderStyleRule,
453
- outlineRule,
454
- boxShadowThemeRule,
455
- shadowColorRule,
456
- textShadowRule,
457
- opacityRule,
458
- mixBlendModeRule,
459
- backgroundBlendModeRule,
460
- maskRule,
461
- ]
@@ -1,103 +0,0 @@
1
- import type { UtilityRule } from './rules'
2
-
3
- /**
4
- * Tailwind Forms utility classes
5
- * Provides form-* classes that can be used to explicitly apply form styles
6
- */
7
-
8
- const baseInputStyles = {
9
- 'appearance': 'none',
10
- 'background-color': '#fff',
11
- 'border-color': '#6b7280',
12
- 'border-width': '1px',
13
- 'border-radius': '0px',
14
- 'padding-top': '0.5rem',
15
- 'padding-right': '0.75rem',
16
- 'padding-bottom': '0.5rem',
17
- 'padding-left': '0.75rem',
18
- 'font-size': '1rem',
19
- 'line-height': '1.5rem',
20
- }
21
-
22
- const baseCheckboxRadioStyles = {
23
- 'appearance': 'none',
24
- 'padding': '0',
25
- 'print-color-adjust': 'exact',
26
- 'display': 'inline-block',
27
- 'vertical-align': 'middle',
28
- 'background-origin': 'border-box',
29
- 'user-select': 'none',
30
- 'flex-shrink': '0',
31
- 'height': '1rem',
32
- 'width': '1rem',
33
- 'color': '#2563eb',
34
- 'background-color': '#fff',
35
- 'border-color': '#6b7280',
36
- 'border-width': '1px',
37
- }
38
-
39
- export const formInputRule: UtilityRule = (parsed) => {
40
- if (parsed.utility === 'form-input' && !parsed.value) {
41
- return baseInputStyles
42
- }
43
- }
44
-
45
- export const formTextareaRule: UtilityRule = (parsed) => {
46
- if (parsed.utility === 'form-textarea' && !parsed.value) {
47
- return baseInputStyles
48
- }
49
- }
50
-
51
- export const formSelectRule: UtilityRule = (parsed) => {
52
- if (parsed.utility === 'form-select' && !parsed.value) {
53
- return {
54
- ...baseInputStyles,
55
- 'background-image': 'url("data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' fill=\'none\' viewBox=\'0 0 20 20\'%3e%3cpath stroke=\'%236b7280\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'1.5\' d=\'M6 8l4 4 4-4\'/%3e%3c/svg%3e")',
56
- 'background-position': 'right 0.5rem center',
57
- 'background-repeat': 'no-repeat',
58
- 'background-size': '1.5em 1.5em',
59
- 'padding-right': '2.5rem',
60
- 'print-color-adjust': 'exact',
61
- }
62
- }
63
- }
64
-
65
- export const formMultiselectRule: UtilityRule = (parsed) => {
66
- if (parsed.utility === 'form-multiselect' && !parsed.value) {
67
- return {
68
- ...baseInputStyles,
69
- 'background-image': 'initial',
70
- 'background-position': 'initial',
71
- 'background-repeat': 'unset',
72
- 'background-size': 'initial',
73
- 'print-color-adjust': 'unset',
74
- }
75
- }
76
- }
77
-
78
- export const formCheckboxRule: UtilityRule = (parsed) => {
79
- if (parsed.utility === 'form-checkbox' && !parsed.value) {
80
- return {
81
- ...baseCheckboxRadioStyles,
82
- 'border-radius': '0px',
83
- }
84
- }
85
- }
86
-
87
- export const formRadioRule: UtilityRule = (parsed) => {
88
- if (parsed.utility === 'form-radio' && !parsed.value) {
89
- return {
90
- ...baseCheckboxRadioStyles,
91
- 'border-radius': '100%',
92
- }
93
- }
94
- }
95
-
96
- export const formsRules: UtilityRule[] = [
97
- formInputRule,
98
- formTextareaRule,
99
- formSelectRule,
100
- formMultiselectRule,
101
- formCheckboxRule,
102
- formRadioRule,
103
- ]