@vaneui/ui 0.1.1 → 0.1.2

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 (75) hide show
  1. package/package.json +1 -5
  2. package/dist/components/complex/index.d.ts +0 -1
  3. package/dist/components/complex/index.js +0 -132
  4. package/dist/components/complex/index.js.map +0 -1
  5. package/dist/components/complex/sharer.d.ts +0 -39
  6. package/dist/components/themeContext.d.ts +0 -50
  7. package/dist/components/themedComponent.d.ts +0 -7
  8. package/dist/components/ui/badge.d.ts +0 -3
  9. package/dist/components/ui/button.d.ts +0 -3
  10. package/dist/components/ui/card.d.ts +0 -3
  11. package/dist/components/ui/chip.d.ts +0 -3
  12. package/dist/components/ui/classes/appearanceClasses.d.ts +0 -13
  13. package/dist/components/ui/classes/spacingClasses.d.ts +0 -2
  14. package/dist/components/ui/classes/typographyClasses.d.ts +0 -10
  15. package/dist/components/ui/col.d.ts +0 -3
  16. package/dist/components/ui/container.d.ts +0 -3
  17. package/dist/components/ui/divider.d.ts +0 -3
  18. package/dist/components/ui/grid.d.ts +0 -4
  19. package/dist/components/ui/layout.d.ts +0 -7
  20. package/dist/components/ui/props/keys.d.ts +0 -81
  21. package/dist/components/ui/props/props.d.ts +0 -43
  22. package/dist/components/ui/row.d.ts +0 -3
  23. package/dist/components/ui/section.d.ts +0 -3
  24. package/dist/components/ui/stack.d.ts +0 -3
  25. package/dist/components/ui/theme/appearance/layoutAppearanceTheme.d.ts +0 -10
  26. package/dist/components/ui/theme/appearance/textAppearanceTheme.d.ts +0 -10
  27. package/dist/components/ui/theme/appearance/variantTheme.d.ts +0 -15
  28. package/dist/components/ui/theme/badgeTheme.d.ts +0 -32
  29. package/dist/components/ui/theme/buttonTheme.d.ts +0 -32
  30. package/dist/components/ui/theme/cardTheme.d.ts +0 -37
  31. package/dist/components/ui/theme/chipTheme.d.ts +0 -32
  32. package/dist/components/ui/theme/colTheme.d.ts +0 -15
  33. package/dist/components/ui/theme/common/ComponentTheme.d.ts +0 -52
  34. package/dist/components/ui/theme/common/baseTheme.d.ts +0 -12
  35. package/dist/components/ui/theme/containerTheme.d.ts +0 -31
  36. package/dist/components/ui/theme/dividerTheme.d.ts +0 -9
  37. package/dist/components/ui/theme/gridTheme.d.ts +0 -10
  38. package/dist/components/ui/theme/layout/borderTheme.d.ts +0 -9
  39. package/dist/components/ui/theme/layout/directionTheme.d.ts +0 -9
  40. package/dist/components/ui/theme/layout/displayTheme.d.ts +0 -9
  41. package/dist/components/ui/theme/layout/hideTheme.d.ts +0 -9
  42. package/dist/components/ui/theme/layout/itemsTheme.d.ts +0 -9
  43. package/dist/components/ui/theme/layout/justifyTheme.d.ts +0 -9
  44. package/dist/components/ui/theme/layout/positionTheme.d.ts +0 -9
  45. package/dist/components/ui/theme/layout/radiusTheme.d.ts +0 -9
  46. package/dist/components/ui/theme/layout/ringTheme.d.ts +0 -9
  47. package/dist/components/ui/theme/layout/shadowTheme.d.ts +0 -9
  48. package/dist/components/ui/theme/layout/wrapTheme.d.ts +0 -9
  49. package/dist/components/ui/theme/rowTheme.d.ts +0 -15
  50. package/dist/components/ui/theme/sectionTheme.d.ts +0 -34
  51. package/dist/components/ui/theme/size/breakpointTheme.d.ts +0 -9
  52. package/dist/components/ui/theme/size/gapTheme.d.ts +0 -9
  53. package/dist/components/ui/theme/size/pxTheme.d.ts +0 -9
  54. package/dist/components/ui/theme/size/pyTheme.d.ts +0 -9
  55. package/dist/components/ui/theme/size/sizeTheme.d.ts +0 -9
  56. package/dist/components/ui/theme/stackTheme.d.ts +0 -19
  57. package/dist/components/ui/theme/typography/fontFamilyTheme.d.ts +0 -9
  58. package/dist/components/ui/theme/typography/fontStyleTheme.d.ts +0 -9
  59. package/dist/components/ui/theme/typography/fontWeightTheme.d.ts +0 -9
  60. package/dist/components/ui/theme/typography/textAlignTheme.d.ts +0 -9
  61. package/dist/components/ui/theme/typography/textDecorationTheme.d.ts +0 -9
  62. package/dist/components/ui/theme/typography/textTransformTheme.d.ts +0 -9
  63. package/dist/components/ui/theme/typographyComponentTheme.d.ts +0 -22
  64. package/dist/components/ui/typography.d.ts +0 -9
  65. package/dist/components/utils/componentUtils.d.ts +0 -4
  66. package/dist/components/utils/deepMerge.d.ts +0 -4
  67. package/dist/components/utils/deepPartial.d.ts +0 -3
  68. package/dist/components/utils/tests/deepMerge.test.d.ts +0 -1
  69. package/dist/index.d.ts +0 -8
  70. package/dist/index.esm.js +0 -4723
  71. package/dist/index.esm.js.map +0 -1
  72. package/dist/index.js +0 -4747
  73. package/dist/index.js.map +0 -1
  74. package/dist/ui.css +0 -2049
  75. package/dist/vars.css +0 -132
package/dist/index.esm.js DELETED
@@ -1,4723 +0,0 @@
1
- 'use client';
2
-
3
- import { jsx } from 'react/jsx-runtime';
4
- import { createContext, useMemo, useContext } from 'react';
5
-
6
- /**
7
- * Base Theme class that all theme types will extend
8
- */
9
- class BaseTheme {
10
- }
11
-
12
- const MODE_KEYS = ['base', 'hover', 'active'];
13
- const SIZE_KEYS = ['xs', 'sm', 'md', 'lg', 'xl'];
14
- const VARIANT_KEYS = ['filled', 'outline'];
15
- const APPEARANCE_KEYS = ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info', 'transparent'];
16
- const TEXT_APPEARANCE_KEYS = [...APPEARANCE_KEYS, 'muted', 'link'];
17
- const FONT_FAMILY_KEYS = ['sans', 'serif', 'mono'];
18
- const FONT_WEIGHT_KEYS = ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black'];
19
- const FONT_STYLE_KEYS = ['italic', 'notItalic'];
20
- const TEXT_DECORATION_KEYS = ['underline', 'lineThrough', 'noUnderline', 'overline'];
21
- const TEXT_TRANSFORM_KEYS = ['uppercase', 'lowercase', 'capitalize', 'normalCase'];
22
- const TEXT_ALIGN_KEYS = ['textLeft', 'textCenter', 'textRight', 'textJustify'];
23
- const BORDER_KEYS = ['border', 'noBorder'];
24
- const SHADOW_KEYS = ['shadow', 'noShadow'];
25
- const RING_KEYS = ['ring', 'noRing'];
26
- const PADDING_KEYS = ['padding', 'noPadding'];
27
- const BREAKPOINT_KEYS = ['xsCol', 'smCol', 'mdCol', 'lgCol', 'xlCol'];
28
- const HIDE_KEYS = ['xsHide', 'smHide', 'mdHide', 'lgHide', 'xlHide'];
29
- const POSITION_KEYS = ['relative', 'absolute', 'fixed', 'sticky', 'static'];
30
- const DIRECTION_REVERSE_KEYS = ['reverse'];
31
- const GAP_KEYS = ['gap', 'noGap'];
32
- const PILL_KEYS = ['pill'];
33
- const SHARP_KEYS = ['sharp'];
34
- const ROUNDED_KEYS = ['rounded'];
35
- const SHAPE_KEYS = [...PILL_KEYS, ...SHARP_KEYS, ...ROUNDED_KEYS];
36
- const FLEX_DIRECTION_KEYS = ['row', 'column', 'rowReverse', 'columnReverse'];
37
- const ITEMS_KEYS = ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'itemsStretch'];
38
- const JUSTIFY_KEYS = ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'];
39
- const WRAP_KEYS = ['flexWrap', 'flexNoWrap', 'flexWrapReverse'];
40
- const DISPLAY_KEYS = ['inline', 'block', 'inlineBlock', 'flex', 'inlineFlex', 'grid', 'inlineGrid', 'contents', 'table', 'tableCell', 'hidden'];
41
- // A master list of all groups where only one key can be 'true' at a time.
42
- const EXCLUSIVE_KEY_GROUPS = [
43
- MODE_KEYS,
44
- SIZE_KEYS,
45
- TEXT_APPEARANCE_KEYS,
46
- VARIANT_KEYS,
47
- FONT_FAMILY_KEYS,
48
- FONT_WEIGHT_KEYS,
49
- FONT_STYLE_KEYS,
50
- TEXT_DECORATION_KEYS,
51
- TEXT_TRANSFORM_KEYS,
52
- TEXT_ALIGN_KEYS,
53
- BORDER_KEYS,
54
- SHADOW_KEYS,
55
- RING_KEYS,
56
- PADDING_KEYS,
57
- BREAKPOINT_KEYS,
58
- HIDE_KEYS,
59
- POSITION_KEYS,
60
- DIRECTION_REVERSE_KEYS,
61
- GAP_KEYS,
62
- SHAPE_KEYS,
63
- FLEX_DIRECTION_KEYS,
64
- ITEMS_KEYS,
65
- JUSTIFY_KEYS,
66
- WRAP_KEYS,
67
- DISPLAY_KEYS,
68
- ];
69
- // Base component keys
70
- const BASE_COMPONENT_KEYS = [
71
- ...SIZE_KEYS,
72
- ...HIDE_KEYS,
73
- ...ITEMS_KEYS,
74
- ...JUSTIFY_KEYS,
75
- ...POSITION_KEYS,
76
- ...DISPLAY_KEYS
77
- ];
78
- // Font keys
79
- const FONT_KEYS = [
80
- ...FONT_WEIGHT_KEYS,
81
- ...FONT_STYLE_KEYS,
82
- ...TEXT_DECORATION_KEYS,
83
- ...TEXT_TRANSFORM_KEYS,
84
- ...FONT_FAMILY_KEYS,
85
- ...TEXT_APPEARANCE_KEYS,
86
- ...TEXT_ALIGN_KEYS
87
- ];
88
- // Typography component keys
89
- const TYPOGRAPHY_COMPONENT_KEYS = [
90
- ...BASE_COMPONENT_KEYS,
91
- ...FONT_KEYS
92
- ];
93
- // Button keys
94
- const BUTTON_KEYS = [
95
- ...TYPOGRAPHY_COMPONENT_KEYS,
96
- ...SHAPE_KEYS,
97
- ...BORDER_KEYS,
98
- ...SHADOW_KEYS,
99
- ...RING_KEYS,
100
- ...GAP_KEYS,
101
- ...PADDING_KEYS,
102
- ...VARIANT_KEYS,
103
- ...APPEARANCE_KEYS
104
- ];
105
- // Grid keys
106
- const GRID_KEYS = [
107
- ...BASE_COMPONENT_KEYS,
108
- ...GAP_KEYS,
109
- ...APPEARANCE_KEYS
110
- ];
111
- // Row keys
112
- const ROW_KEYS = [
113
- ...BASE_COMPONENT_KEYS,
114
- ...WRAP_KEYS,
115
- ...GAP_KEYS,
116
- ...DIRECTION_REVERSE_KEYS,
117
- ...BREAKPOINT_KEYS,
118
- ...APPEARANCE_KEYS
119
- ];
120
- // Col keys
121
- const COL_KEYS = [
122
- ...BASE_COMPONENT_KEYS,
123
- ...WRAP_KEYS,
124
- ...GAP_KEYS,
125
- ...DIRECTION_REVERSE_KEYS,
126
- ...APPEARANCE_KEYS
127
- ];
128
- // Card keys
129
- const CARD_KEYS = [
130
- ...TYPOGRAPHY_COMPONENT_KEYS,
131
- ...GAP_KEYS,
132
- ...SHARP_KEYS,
133
- ...ROUNDED_KEYS,
134
- ...BREAKPOINT_KEYS,
135
- ...APPEARANCE_KEYS,
136
- ...BORDER_KEYS,
137
- ...RING_KEYS,
138
- ...SHADOW_KEYS,
139
- ...PADDING_KEYS,
140
- ...FLEX_DIRECTION_KEYS,
141
- ...DIRECTION_REVERSE_KEYS,
142
- ...WRAP_KEYS
143
- ];
144
- // Stack keys
145
- const STACK_KEYS = [
146
- ...BASE_COMPONENT_KEYS,
147
- ...WRAP_KEYS,
148
- ...GAP_KEYS,
149
- ...DIRECTION_REVERSE_KEYS,
150
- ...BREAKPOINT_KEYS,
151
- ...APPEARANCE_KEYS,
152
- ...FLEX_DIRECTION_KEYS,
153
- ...PADDING_KEYS
154
- ];
155
- // Badge keys
156
- const BADGE_KEYS = [
157
- ...TYPOGRAPHY_COMPONENT_KEYS,
158
- ...SHAPE_KEYS,
159
- ...VARIANT_KEYS,
160
- ...SHADOW_KEYS,
161
- ...BORDER_KEYS,
162
- ...RING_KEYS,
163
- ...GAP_KEYS,
164
- ...PADDING_KEYS,
165
- ...APPEARANCE_KEYS
166
- ];
167
- // Chip keys
168
- const CHIP_KEYS = [
169
- ...TYPOGRAPHY_COMPONENT_KEYS,
170
- ...SHAPE_KEYS,
171
- ...VARIANT_KEYS,
172
- ...SHADOW_KEYS,
173
- ...BORDER_KEYS,
174
- ...RING_KEYS,
175
- ...GAP_KEYS,
176
- ...PADDING_KEYS,
177
- ...APPEARANCE_KEYS
178
- ];
179
- // Divider keys
180
- const DIVIDER_KEYS = [
181
- ...BASE_COMPONENT_KEYS,
182
- ...APPEARANCE_KEYS
183
- ];
184
- // Container keys
185
- const CONTAINER_KEYS = [
186
- ...BASE_COMPONENT_KEYS,
187
- ...APPEARANCE_KEYS,
188
- ...BORDER_KEYS,
189
- ...SHADOW_KEYS,
190
- ...RING_KEYS,
191
- ...GAP_KEYS,
192
- ...SHAPE_KEYS
193
- ];
194
- // Section keys
195
- const SECTION_KEYS = [
196
- ...BASE_COMPONENT_KEYS,
197
- ...FLEX_DIRECTION_KEYS,
198
- ...APPEARANCE_KEYS,
199
- ...PADDING_KEYS,
200
- ...DIRECTION_REVERSE_KEYS,
201
- ...WRAP_KEYS,
202
- ...BREAKPOINT_KEYS,
203
- ...GAP_KEYS,
204
- ...BORDER_KEYS,
205
- ...SHADOW_KEYS,
206
- ...RING_KEYS,
207
- ...SHAPE_KEYS,
208
- ];
209
-
210
- /**
211
- * Pick the first truthy key from props, then from defaults, then undefined.
212
- */
213
- function pickFirstTruthyKey(props, defaults, keys) {
214
- let falsyKeys = [];
215
- for (const k of keys) {
216
- const p = props[k];
217
- if (p === true)
218
- return k;
219
- if (p === false)
220
- falsyKeys.push(k);
221
- }
222
- for (const k of keys) {
223
- const d = defaults[k];
224
- if (d === true && !falsyKeys.includes(k))
225
- return k;
226
- }
227
- return undefined;
228
- }
229
-
230
- class HideTheme extends BaseTheme {
231
- constructor(initialConfig) {
232
- super();
233
- HIDE_KEYS.forEach((key) => {
234
- var _a;
235
- this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : HideTheme.defaultClasses[key];
236
- });
237
- }
238
- getClasses(props, defaults) {
239
- const key = pickFirstTruthyKey(props, defaults, HIDE_KEYS);
240
- return [key ? this[key] : ''];
241
- }
242
- }
243
- HideTheme.defaultClasses = {
244
- xsHide: "max-xs:hidden",
245
- smHide: "max-sm:hidden",
246
- mdHide: "max-md:hidden",
247
- lgHide: "max-lg:hidden",
248
- xlHide: "max-xl:hidden"
249
- };
250
-
251
- class ItemsTheme extends BaseTheme {
252
- constructor(initialConfig) {
253
- super();
254
- ITEMS_KEYS.forEach((key) => {
255
- var _a;
256
- this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : ItemsTheme.defaultClasses[key];
257
- });
258
- }
259
- getClasses(props, defaults) {
260
- const pickedKey = pickFirstTruthyKey(props, defaults, ITEMS_KEYS);
261
- return [pickedKey && this[pickedKey] ? this[pickedKey] : ''];
262
- }
263
- }
264
- ItemsTheme.defaultClasses = {
265
- itemsStart: "items-start",
266
- itemsEnd: "items-end",
267
- itemsCenter: "items-center",
268
- itemsBaseline: "items-baseline",
269
- itemsStretch: "items-stretch",
270
- };
271
-
272
- class JustifyTheme extends BaseTheme {
273
- constructor(initialConfig) {
274
- super();
275
- JUSTIFY_KEYS.forEach((key) => {
276
- var _a;
277
- this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : JustifyTheme.defaultClasses[key];
278
- });
279
- }
280
- getClasses(props, defaults) {
281
- const key = pickFirstTruthyKey(props, defaults, JUSTIFY_KEYS);
282
- return [key ? this[key] : ''];
283
- }
284
- }
285
- JustifyTheme.defaultClasses = {
286
- justifyStart: "justify-start",
287
- justifyEnd: "justify-end",
288
- justifyCenter: "justify-center",
289
- justifyBetween: "justify-between",
290
- justifyAround: "justify-around",
291
- justifyEvenly: "justify-evenly",
292
- justifyStretch: "justify-stretch",
293
- justifyBaseline: "justify-baseline",
294
- };
295
-
296
- class PositionTheme extends BaseTheme {
297
- constructor(initialConfig) {
298
- super();
299
- POSITION_KEYS.forEach((key) => {
300
- var _a;
301
- this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : PositionTheme.defaultClasses[key];
302
- });
303
- }
304
- getClasses(props, defaults) {
305
- const key = pickFirstTruthyKey(props, defaults, POSITION_KEYS);
306
- return [key ? this[key] : ''];
307
- }
308
- }
309
- PositionTheme.defaultClasses = {
310
- relative: "relative",
311
- absolute: "absolute",
312
- fixed: "fixed",
313
- sticky: "sticky",
314
- static: "static"
315
- };
316
-
317
- const fontWeightClasses = {
318
- thin: "font-thin",
319
- extralight: "font-extralight",
320
- light: "font-light",
321
- normal: "font-normal",
322
- medium: "font-medium",
323
- semibold: "font-semibold",
324
- bold: "font-bold",
325
- extrabold: "font-extrabold",
326
- black: "font-black",
327
- };
328
- const fontStyleClasses = {
329
- italic: "italic",
330
- notItalic: "not-italic",
331
- };
332
- const fontFamilyClasses = {
333
- sans: "font-sans",
334
- serif: "font-serif",
335
- mono: "font-mono",
336
- };
337
- const textDecorationClasses = {
338
- underline: "underline",
339
- lineThrough: "line-through",
340
- noUnderline: "no-underline",
341
- overline: "overline",
342
- };
343
- const textTransformClasses = {
344
- uppercase: "uppercase",
345
- lowercase: "lowercase",
346
- capitalize: "capitalize",
347
- normalCase: "normal-case",
348
- };
349
- const textAlignClasses = {
350
- textLeft: "text-left",
351
- textCenter: "text-center",
352
- textRight: "text-right",
353
- textJustify: "text-justify",
354
- };
355
- // Text appearance classes for filled buttons (all white text)
356
- const filledTextAppearanceClasses = {
357
- default: "text-white",
358
- primary: "text-white",
359
- secondary: "text-white",
360
- tertiary: "text-white",
361
- muted: "text-white",
362
- link: "text-white",
363
- accent: "text-white",
364
- success: "text-white",
365
- danger: "text-white",
366
- warning: "text-white",
367
- info: "text-white",
368
- transparent: "text-transparent",
369
- };
370
- // Default text appearance classes (for non-button components)
371
- const textAppearanceClasses = {
372
- default: "text-(--text-color-default)",
373
- primary: "text-(--text-color-primary)",
374
- secondary: "text-(--text-color-secondary)",
375
- tertiary: "text-(--text-color-tertiary)",
376
- muted: "text-(--text-color-muted)",
377
- link: "text-(--text-color-link)",
378
- accent: "text-(--text-color-accent)",
379
- success: "text-(--text-color-success)",
380
- danger: "text-(--text-color-danger)",
381
- warning: "text-(--text-color-warning)",
382
- info: "text-(--text-color-info)",
383
- transparent: "text-transparent",
384
- };
385
- // Text size classes
386
- const textSizeClasses = {
387
- xs: "text-xs",
388
- sm: "text-sm",
389
- md: "text-base",
390
- lg: "text-lg",
391
- xl: "text-xl",
392
- };
393
-
394
- class FontStyleTheme extends BaseTheme {
395
- constructor(initial) {
396
- super();
397
- FONT_STYLE_KEYS.forEach((key) => {
398
- var _a;
399
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
400
- });
401
- }
402
- getClasses(props, defaults) {
403
- const key = pickFirstTruthyKey(props, defaults, FONT_STYLE_KEYS);
404
- return [key ? this[key] : '']; // No default for font style
405
- }
406
- }
407
- FontStyleTheme.defaultClasses = fontStyleClasses;
408
-
409
- class FontFamilyTheme extends BaseTheme {
410
- constructor(initial) {
411
- super();
412
- FONT_FAMILY_KEYS.forEach((key) => {
413
- var _a;
414
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontFamilyTheme.defaultClasses[key];
415
- });
416
- }
417
- getClasses(props, defaults) {
418
- const key = pickFirstTruthyKey(props, defaults, FONT_FAMILY_KEYS);
419
- return [this[key !== null && key !== void 0 ? key : 'sans'] || ''];
420
- }
421
- }
422
- FontFamilyTheme.defaultClasses = fontFamilyClasses;
423
-
424
- class FontWeightTheme extends BaseTheme {
425
- constructor(initial) {
426
- super();
427
- FONT_WEIGHT_KEYS.forEach((key) => {
428
- var _a;
429
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontWeightTheme.defaultClasses[key];
430
- });
431
- }
432
- getClasses(props, defaults) {
433
- const key = pickFirstTruthyKey(props, defaults, FONT_WEIGHT_KEYS);
434
- return [this[key !== null && key !== void 0 ? key : 'normal'] || '']; // Default to 'normal' if no key is provided
435
- }
436
- }
437
- FontWeightTheme.defaultClasses = fontWeightClasses;
438
-
439
- class TextDecorationTheme extends BaseTheme {
440
- constructor(initial) {
441
- super();
442
- TEXT_DECORATION_KEYS.forEach((key) => {
443
- var _a;
444
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextDecorationTheme.defaultClasses[key];
445
- });
446
- }
447
- getClasses(props, defaults) {
448
- const key = pickFirstTruthyKey(props, defaults, TEXT_DECORATION_KEYS);
449
- return [key ? this[key] : '']; // No default for text decoration
450
- }
451
- }
452
- TextDecorationTheme.defaultClasses = textDecorationClasses;
453
-
454
- class TextTransformTheme extends BaseTheme {
455
- constructor(initial) {
456
- super();
457
- TEXT_TRANSFORM_KEYS.forEach((key) => {
458
- var _a;
459
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextTransformTheme.defaultClasses[key];
460
- });
461
- }
462
- getClasses(props, defaults) {
463
- const key = pickFirstTruthyKey(props, defaults, TEXT_TRANSFORM_KEYS);
464
- return [key ? this[key] : '']; // No default for text transform
465
- }
466
- }
467
- TextTransformTheme.defaultClasses = textTransformClasses;
468
-
469
- class TextAlignTheme extends BaseTheme {
470
- constructor(initial) {
471
- super();
472
- TEXT_ALIGN_KEYS.forEach((key) => {
473
- var _a;
474
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextAlignTheme.defaultClasses[key];
475
- });
476
- }
477
- getClasses(props, defaults) {
478
- const key = pickFirstTruthyKey(props, defaults, TEXT_ALIGN_KEYS);
479
- return [key ? this[key] : '']; // No default for text align
480
- }
481
- }
482
- TextAlignTheme.defaultClasses = textAlignClasses;
483
-
484
- const isObject = (item) => {
485
- return item !== null && typeof item === 'object' && !Array.isArray(item);
486
- };
487
- const deepMerge = (target, source) => {
488
- const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
489
- for (const key in source) {
490
- if (Object.prototype.hasOwnProperty.call(source, key)) {
491
- const sourceValue = source[key];
492
- const targetValue = output[key];
493
- if (sourceValue === undefined) {
494
- continue;
495
- }
496
- // Special case: If the key is 'defaults', use the contextual mergeDefaults function.
497
- if (key === 'defaults' &&
498
- isObject(targetValue) &&
499
- isObject(sourceValue)) {
500
- output[key] = mergeDefaults(targetValue, sourceValue);
501
- }
502
- // For all other objects, use the standard recursive deep merge.
503
- else if (isObject(targetValue) && isObject(sourceValue)) {
504
- output[key] = deepMerge(targetValue, sourceValue);
505
- }
506
- // For non-object values, just assign the value from the source.
507
- else {
508
- output[key] = sourceValue;
509
- }
510
- }
511
- }
512
- return output;
513
- };
514
- const deepClone = (source) => {
515
- if (!isObject(source)) {
516
- return source;
517
- }
518
- const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
519
- for (const key in output) {
520
- if (Object.prototype.hasOwnProperty.call(output, key)) {
521
- output[key] = deepClone(output[key]);
522
- }
523
- }
524
- return output;
525
- };
526
- const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
527
- const mergeDefaults = (baseDefaults, overrideDefaults) => {
528
- const finalDefaults = { ...baseDefaults };
529
- // Iterate over the override keys to apply them.
530
- for (const key in overrideDefaults) {
531
- if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
532
- const overrideValue = overrideDefaults[key];
533
- // If the override is setting a key to true...
534
- if (overrideValue) {
535
- // Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
536
- const group = findGroup(key);
537
- // If the key is part of an exclusive group...
538
- if (group) {
539
- // ...set all other keys in that group to false.
540
- group.forEach(groupKey => {
541
- if (groupKey !== key) {
542
- finalDefaults[groupKey] = false;
543
- }
544
- });
545
- }
546
- }
547
- finalDefaults[key] = overrideValue;
548
- }
549
- }
550
- return finalDefaults;
551
- };
552
-
553
- class DisplayTheme extends BaseTheme {
554
- constructor(initialConfig) {
555
- super();
556
- DISPLAY_KEYS.forEach((key) => {
557
- var _a;
558
- this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : DisplayTheme.defaultClasses[key];
559
- });
560
- }
561
- getClasses(props, defaults) {
562
- const pickedKey = pickFirstTruthyKey(props, defaults, DISPLAY_KEYS);
563
- return [pickedKey && this[pickedKey] ? this[pickedKey] : ''];
564
- }
565
- }
566
- DisplayTheme.defaultClasses = {
567
- inline: "inline",
568
- block: "block",
569
- inlineBlock: "inline-block",
570
- flex: "flex",
571
- inlineFlex: "inline-flex",
572
- grid: "grid",
573
- inlineGrid: "inline-grid",
574
- contents: "contents",
575
- table: "table",
576
- tableCell: "table-cell",
577
- hidden: "hidden"
578
- };
579
-
580
- const CLASS_PART_SEPARATOR = '-';
581
- const createClassGroupUtils = config => {
582
- const classMap = createClassMap(config);
583
- const {
584
- conflictingClassGroups,
585
- conflictingClassGroupModifiers
586
- } = config;
587
- const getClassGroupId = className => {
588
- const classParts = className.split(CLASS_PART_SEPARATOR);
589
- // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.
590
- if (classParts[0] === '' && classParts.length !== 1) {
591
- classParts.shift();
592
- }
593
- return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
594
- };
595
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
596
- const conflicts = conflictingClassGroups[classGroupId] || [];
597
- if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
598
- return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
599
- }
600
- return conflicts;
601
- };
602
- return {
603
- getClassGroupId,
604
- getConflictingClassGroupIds
605
- };
606
- };
607
- const getGroupRecursive = (classParts, classPartObject) => {
608
- if (classParts.length === 0) {
609
- return classPartObject.classGroupId;
610
- }
611
- const currentClassPart = classParts[0];
612
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
613
- const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
614
- if (classGroupFromNextClassPart) {
615
- return classGroupFromNextClassPart;
616
- }
617
- if (classPartObject.validators.length === 0) {
618
- return undefined;
619
- }
620
- const classRest = classParts.join(CLASS_PART_SEPARATOR);
621
- return classPartObject.validators.find(({
622
- validator
623
- }) => validator(classRest))?.classGroupId;
624
- };
625
- const arbitraryPropertyRegex = /^\[(.+)\]$/;
626
- const getGroupIdForArbitraryProperty = className => {
627
- if (arbitraryPropertyRegex.test(className)) {
628
- const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
629
- const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
630
- if (property) {
631
- // I use two dots here because one dot is used as prefix for class groups in plugins
632
- return 'arbitrary..' + property;
633
- }
634
- }
635
- };
636
- /**
637
- * Exported for testing only
638
- */
639
- const createClassMap = config => {
640
- const {
641
- theme,
642
- classGroups
643
- } = config;
644
- const classMap = {
645
- nextPart: new Map(),
646
- validators: []
647
- };
648
- for (const classGroupId in classGroups) {
649
- processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme);
650
- }
651
- return classMap;
652
- };
653
- const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
654
- classGroup.forEach(classDefinition => {
655
- if (typeof classDefinition === 'string') {
656
- const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
657
- classPartObjectToEdit.classGroupId = classGroupId;
658
- return;
659
- }
660
- if (typeof classDefinition === 'function') {
661
- if (isThemeGetter(classDefinition)) {
662
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
663
- return;
664
- }
665
- classPartObject.validators.push({
666
- validator: classDefinition,
667
- classGroupId
668
- });
669
- return;
670
- }
671
- Object.entries(classDefinition).forEach(([key, classGroup]) => {
672
- processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
673
- });
674
- });
675
- };
676
- const getPart = (classPartObject, path) => {
677
- let currentClassPartObject = classPartObject;
678
- path.split(CLASS_PART_SEPARATOR).forEach(pathPart => {
679
- if (!currentClassPartObject.nextPart.has(pathPart)) {
680
- currentClassPartObject.nextPart.set(pathPart, {
681
- nextPart: new Map(),
682
- validators: []
683
- });
684
- }
685
- currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
686
- });
687
- return currentClassPartObject;
688
- };
689
- const isThemeGetter = func => func.isThemeGetter;
690
-
691
- // LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
692
- const createLruCache = maxCacheSize => {
693
- if (maxCacheSize < 1) {
694
- return {
695
- get: () => undefined,
696
- set: () => {}
697
- };
698
- }
699
- let cacheSize = 0;
700
- let cache = new Map();
701
- let previousCache = new Map();
702
- const update = (key, value) => {
703
- cache.set(key, value);
704
- cacheSize++;
705
- if (cacheSize > maxCacheSize) {
706
- cacheSize = 0;
707
- previousCache = cache;
708
- cache = new Map();
709
- }
710
- };
711
- return {
712
- get(key) {
713
- let value = cache.get(key);
714
- if (value !== undefined) {
715
- return value;
716
- }
717
- if ((value = previousCache.get(key)) !== undefined) {
718
- update(key, value);
719
- return value;
720
- }
721
- },
722
- set(key, value) {
723
- if (cache.has(key)) {
724
- cache.set(key, value);
725
- } else {
726
- update(key, value);
727
- }
728
- }
729
- };
730
- };
731
- const IMPORTANT_MODIFIER = '!';
732
- const MODIFIER_SEPARATOR = ':';
733
- const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
734
- const createParseClassName = config => {
735
- const {
736
- prefix,
737
- experimentalParseClassName
738
- } = config;
739
- /**
740
- * Parse class name into parts.
741
- *
742
- * Inspired by `splitAtTopLevelOnly` used in Tailwind CSS
743
- * @see https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
744
- */
745
- let parseClassName = className => {
746
- const modifiers = [];
747
- let bracketDepth = 0;
748
- let parenDepth = 0;
749
- let modifierStart = 0;
750
- let postfixModifierPosition;
751
- for (let index = 0; index < className.length; index++) {
752
- let currentCharacter = className[index];
753
- if (bracketDepth === 0 && parenDepth === 0) {
754
- if (currentCharacter === MODIFIER_SEPARATOR) {
755
- modifiers.push(className.slice(modifierStart, index));
756
- modifierStart = index + MODIFIER_SEPARATOR_LENGTH;
757
- continue;
758
- }
759
- if (currentCharacter === '/') {
760
- postfixModifierPosition = index;
761
- continue;
762
- }
763
- }
764
- if (currentCharacter === '[') {
765
- bracketDepth++;
766
- } else if (currentCharacter === ']') {
767
- bracketDepth--;
768
- } else if (currentCharacter === '(') {
769
- parenDepth++;
770
- } else if (currentCharacter === ')') {
771
- parenDepth--;
772
- }
773
- }
774
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
775
- const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
776
- const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
777
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
778
- return {
779
- modifiers,
780
- hasImportantModifier,
781
- baseClassName,
782
- maybePostfixModifierPosition
783
- };
784
- };
785
- if (prefix) {
786
- const fullPrefix = prefix + MODIFIER_SEPARATOR;
787
- const parseClassNameOriginal = parseClassName;
788
- parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
789
- isExternal: true,
790
- modifiers: [],
791
- hasImportantModifier: false,
792
- baseClassName: className,
793
- maybePostfixModifierPosition: undefined
794
- };
795
- }
796
- if (experimentalParseClassName) {
797
- const parseClassNameOriginal = parseClassName;
798
- parseClassName = className => experimentalParseClassName({
799
- className,
800
- parseClassName: parseClassNameOriginal
801
- });
802
- }
803
- return parseClassName;
804
- };
805
- const stripImportantModifier = baseClassName => {
806
- if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
807
- return baseClassName.substring(0, baseClassName.length - 1);
808
- }
809
- /**
810
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
811
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
812
- */
813
- if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
814
- return baseClassName.substring(1);
815
- }
816
- return baseClassName;
817
- };
818
-
819
- /**
820
- * Sorts modifiers according to following schema:
821
- * - Predefined modifiers are sorted alphabetically
822
- * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
823
- */
824
- const createSortModifiers = config => {
825
- const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map(modifier => [modifier, true]));
826
- const sortModifiers = modifiers => {
827
- if (modifiers.length <= 1) {
828
- return modifiers;
829
- }
830
- const sortedModifiers = [];
831
- let unsortedModifiers = [];
832
- modifiers.forEach(modifier => {
833
- const isPositionSensitive = modifier[0] === '[' || orderSensitiveModifiers[modifier];
834
- if (isPositionSensitive) {
835
- sortedModifiers.push(...unsortedModifiers.sort(), modifier);
836
- unsortedModifiers = [];
837
- } else {
838
- unsortedModifiers.push(modifier);
839
- }
840
- });
841
- sortedModifiers.push(...unsortedModifiers.sort());
842
- return sortedModifiers;
843
- };
844
- return sortModifiers;
845
- };
846
- const createConfigUtils = config => ({
847
- cache: createLruCache(config.cacheSize),
848
- parseClassName: createParseClassName(config),
849
- sortModifiers: createSortModifiers(config),
850
- ...createClassGroupUtils(config)
851
- });
852
- const SPLIT_CLASSES_REGEX = /\s+/;
853
- const mergeClassList = (classList, configUtils) => {
854
- const {
855
- parseClassName,
856
- getClassGroupId,
857
- getConflictingClassGroupIds,
858
- sortModifiers
859
- } = configUtils;
860
- /**
861
- * Set of classGroupIds in following format:
862
- * `{importantModifier}{variantModifiers}{classGroupId}`
863
- * @example 'float'
864
- * @example 'hover:focus:bg-color'
865
- * @example 'md:!pr'
866
- */
867
- const classGroupsInConflict = [];
868
- const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
869
- let result = '';
870
- for (let index = classNames.length - 1; index >= 0; index -= 1) {
871
- const originalClassName = classNames[index];
872
- const {
873
- isExternal,
874
- modifiers,
875
- hasImportantModifier,
876
- baseClassName,
877
- maybePostfixModifierPosition
878
- } = parseClassName(originalClassName);
879
- if (isExternal) {
880
- result = originalClassName + (result.length > 0 ? ' ' + result : result);
881
- continue;
882
- }
883
- let hasPostfixModifier = !!maybePostfixModifierPosition;
884
- let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
885
- if (!classGroupId) {
886
- if (!hasPostfixModifier) {
887
- // Not a Tailwind class
888
- result = originalClassName + (result.length > 0 ? ' ' + result : result);
889
- continue;
890
- }
891
- classGroupId = getClassGroupId(baseClassName);
892
- if (!classGroupId) {
893
- // Not a Tailwind class
894
- result = originalClassName + (result.length > 0 ? ' ' + result : result);
895
- continue;
896
- }
897
- hasPostfixModifier = false;
898
- }
899
- const variantModifier = sortModifiers(modifiers).join(':');
900
- const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
901
- const classId = modifierId + classGroupId;
902
- if (classGroupsInConflict.includes(classId)) {
903
- // Tailwind class omitted due to conflict
904
- continue;
905
- }
906
- classGroupsInConflict.push(classId);
907
- const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
908
- for (let i = 0; i < conflictGroups.length; ++i) {
909
- const group = conflictGroups[i];
910
- classGroupsInConflict.push(modifierId + group);
911
- }
912
- // Tailwind class not in conflict
913
- result = originalClassName + (result.length > 0 ? ' ' + result : result);
914
- }
915
- return result;
916
- };
917
-
918
- /**
919
- * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
920
- *
921
- * Specifically:
922
- * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js
923
- * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts
924
- *
925
- * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
926
- */
927
- function twJoin() {
928
- let index = 0;
929
- let argument;
930
- let resolvedValue;
931
- let string = '';
932
- while (index < arguments.length) {
933
- if (argument = arguments[index++]) {
934
- if (resolvedValue = toValue(argument)) {
935
- string && (string += ' ');
936
- string += resolvedValue;
937
- }
938
- }
939
- }
940
- return string;
941
- }
942
- const toValue = mix => {
943
- if (typeof mix === 'string') {
944
- return mix;
945
- }
946
- let resolvedValue;
947
- let string = '';
948
- for (let k = 0; k < mix.length; k++) {
949
- if (mix[k]) {
950
- if (resolvedValue = toValue(mix[k])) {
951
- string && (string += ' ');
952
- string += resolvedValue;
953
- }
954
- }
955
- }
956
- return string;
957
- };
958
- function createTailwindMerge(createConfigFirst, ...createConfigRest) {
959
- let configUtils;
960
- let cacheGet;
961
- let cacheSet;
962
- let functionToCall = initTailwindMerge;
963
- function initTailwindMerge(classList) {
964
- const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
965
- configUtils = createConfigUtils(config);
966
- cacheGet = configUtils.cache.get;
967
- cacheSet = configUtils.cache.set;
968
- functionToCall = tailwindMerge;
969
- return tailwindMerge(classList);
970
- }
971
- function tailwindMerge(classList) {
972
- const cachedResult = cacheGet(classList);
973
- if (cachedResult) {
974
- return cachedResult;
975
- }
976
- const result = mergeClassList(classList, configUtils);
977
- cacheSet(classList, result);
978
- return result;
979
- }
980
- return function callTailwindMerge() {
981
- return functionToCall(twJoin.apply(null, arguments));
982
- };
983
- }
984
- const fromTheme = key => {
985
- const themeGetter = theme => theme[key] || [];
986
- themeGetter.isThemeGetter = true;
987
- return themeGetter;
988
- };
989
- const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
990
- const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
991
- const fractionRegex = /^\d+\/\d+$/;
992
- const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
993
- const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
994
- const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
995
- // Shadow always begins with x and y offset separated by underscore optionally prepended by inset
996
- const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
997
- const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
998
- const isFraction = value => fractionRegex.test(value);
999
- const isNumber = value => Boolean(value) && !Number.isNaN(Number(value));
1000
- const isInteger = value => Boolean(value) && Number.isInteger(Number(value));
1001
- const isPercent = value => value.endsWith('%') && isNumber(value.slice(0, -1));
1002
- const isTshirtSize = value => tshirtUnitRegex.test(value);
1003
- const isAny = () => true;
1004
- const isLengthOnly = value =>
1005
- // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
1006
- // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
1007
- // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
1008
- lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
1009
- const isNever = () => false;
1010
- const isShadow = value => shadowRegex.test(value);
1011
- const isImage = value => imageRegex.test(value);
1012
- const isAnyNonArbitrary = value => !isArbitraryValue(value) && !isArbitraryVariable(value);
1013
- const isArbitrarySize = value => getIsArbitraryValue(value, isLabelSize, isNever);
1014
- const isArbitraryValue = value => arbitraryValueRegex.test(value);
1015
- const isArbitraryLength = value => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
1016
- const isArbitraryNumber = value => getIsArbitraryValue(value, isLabelNumber, isNumber);
1017
- const isArbitraryPosition = value => getIsArbitraryValue(value, isLabelPosition, isNever);
1018
- const isArbitraryImage = value => getIsArbitraryValue(value, isLabelImage, isImage);
1019
- const isArbitraryShadow = value => getIsArbitraryValue(value, isNever, isShadow);
1020
- const isArbitraryVariable = value => arbitraryVariableRegex.test(value);
1021
- const isArbitraryVariableLength = value => getIsArbitraryVariable(value, isLabelLength);
1022
- const isArbitraryVariableFamilyName = value => getIsArbitraryVariable(value, isLabelFamilyName);
1023
- const isArbitraryVariablePosition = value => getIsArbitraryVariable(value, isLabelPosition);
1024
- const isArbitraryVariableSize = value => getIsArbitraryVariable(value, isLabelSize);
1025
- const isArbitraryVariableImage = value => getIsArbitraryVariable(value, isLabelImage);
1026
- const isArbitraryVariableShadow = value => getIsArbitraryVariable(value, isLabelShadow, true);
1027
- // Helpers
1028
- const getIsArbitraryValue = (value, testLabel, testValue) => {
1029
- const result = arbitraryValueRegex.exec(value);
1030
- if (result) {
1031
- if (result[1]) {
1032
- return testLabel(result[1]);
1033
- }
1034
- return testValue(result[2]);
1035
- }
1036
- return false;
1037
- };
1038
- const getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
1039
- const result = arbitraryVariableRegex.exec(value);
1040
- if (result) {
1041
- if (result[1]) {
1042
- return testLabel(result[1]);
1043
- }
1044
- return shouldMatchNoLabel;
1045
- }
1046
- return false;
1047
- };
1048
- // Labels
1049
- const isLabelPosition = label => label === 'position';
1050
- const imageLabels = /*#__PURE__*/new Set(['image', 'url']);
1051
- const isLabelImage = label => imageLabels.has(label);
1052
- const sizeLabels = /*#__PURE__*/new Set(['length', 'size', 'percentage']);
1053
- const isLabelSize = label => sizeLabels.has(label);
1054
- const isLabelLength = label => label === 'length';
1055
- const isLabelNumber = label => label === 'number';
1056
- const isLabelFamilyName = label => label === 'family-name';
1057
- const isLabelShadow = label => label === 'shadow';
1058
- const getDefaultConfig = () => {
1059
- /**
1060
- * Theme getters for theme variable namespaces
1061
- * @see https://tailwindcss.com/docs/theme#theme-variable-namespaces
1062
- */
1063
- /***/
1064
- const themeColor = fromTheme('color');
1065
- const themeFont = fromTheme('font');
1066
- const themeText = fromTheme('text');
1067
- const themeFontWeight = fromTheme('font-weight');
1068
- const themeTracking = fromTheme('tracking');
1069
- const themeLeading = fromTheme('leading');
1070
- const themeBreakpoint = fromTheme('breakpoint');
1071
- const themeContainer = fromTheme('container');
1072
- const themeSpacing = fromTheme('spacing');
1073
- const themeRadius = fromTheme('radius');
1074
- const themeShadow = fromTheme('shadow');
1075
- const themeInsetShadow = fromTheme('inset-shadow');
1076
- const themeDropShadow = fromTheme('drop-shadow');
1077
- const themeBlur = fromTheme('blur');
1078
- const themePerspective = fromTheme('perspective');
1079
- const themeAspect = fromTheme('aspect');
1080
- const themeEase = fromTheme('ease');
1081
- const themeAnimate = fromTheme('animate');
1082
- /**
1083
- * Helpers to avoid repeating the same scales
1084
- *
1085
- * We use functions that create a new array every time they're called instead of static arrays.
1086
- * This ensures that users who modify any scale by mutating the array (e.g. with `array.push(element)`) don't accidentally mutate arrays in other parts of the config.
1087
- */
1088
- /***/
1089
- const scaleBreak = () => ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'];
1090
- const scalePosition = () => ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top'];
1091
- const scaleOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll'];
1092
- const scaleOverscroll = () => ['auto', 'contain', 'none'];
1093
- const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
1094
- const scaleInset = () => [isFraction, 'full', 'auto', ...scaleUnambiguousSpacing()];
1095
- const scaleGridTemplateColsRows = () => [isInteger, 'none', 'subgrid', isArbitraryVariable, isArbitraryValue];
1096
- const scaleGridColRowStartAndEnd = () => ['auto', {
1097
- span: ['full', isInteger, isArbitraryVariable, isArbitraryValue]
1098
- }, isInteger, isArbitraryVariable, isArbitraryValue];
1099
- const scaleGridColRowStartOrEnd = () => [isInteger, 'auto', isArbitraryVariable, isArbitraryValue];
1100
- const scaleGridAutoColsRows = () => ['auto', 'min', 'max', 'fr', isArbitraryVariable, isArbitraryValue];
1101
- const scaleAlignPrimaryAxis = () => ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch', 'baseline'];
1102
- const scaleAlignSecondaryAxis = () => ['start', 'end', 'center', 'stretch'];
1103
- const scaleMargin = () => ['auto', ...scaleUnambiguousSpacing()];
1104
- const scaleSizing = () => [isFraction, 'auto', 'full', 'dvw', 'dvh', 'lvw', 'lvh', 'svw', 'svh', 'min', 'max', 'fit', ...scaleUnambiguousSpacing()];
1105
- const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
1106
- const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
1107
- const scaleRadius = () => [
1108
- // Deprecated since Tailwind CSS v4.0.0
1109
- '', 'none', 'full', themeRadius, isArbitraryVariable, isArbitraryValue];
1110
- const scaleBorderWidth = () => ['', isNumber, isArbitraryVariableLength, isArbitraryLength];
1111
- const scaleLineStyle = () => ['solid', 'dashed', 'dotted', 'double'];
1112
- const scaleBlendMode = () => ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
1113
- const scaleBlur = () => [
1114
- // Deprecated since Tailwind CSS v4.0.0
1115
- '', 'none', themeBlur, isArbitraryVariable, isArbitraryValue];
1116
- const scaleOrigin = () => ['center', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'left', 'top-left', isArbitraryVariable, isArbitraryValue];
1117
- const scaleRotate = () => ['none', isNumber, isArbitraryVariable, isArbitraryValue];
1118
- const scaleScale = () => ['none', isNumber, isArbitraryVariable, isArbitraryValue];
1119
- const scaleSkew = () => [isNumber, isArbitraryVariable, isArbitraryValue];
1120
- const scaleTranslate = () => [isFraction, 'full', ...scaleUnambiguousSpacing()];
1121
- return {
1122
- cacheSize: 500,
1123
- theme: {
1124
- animate: ['spin', 'ping', 'pulse', 'bounce'],
1125
- aspect: ['video'],
1126
- blur: [isTshirtSize],
1127
- breakpoint: [isTshirtSize],
1128
- color: [isAny],
1129
- container: [isTshirtSize],
1130
- 'drop-shadow': [isTshirtSize],
1131
- ease: ['in', 'out', 'in-out'],
1132
- font: [isAnyNonArbitrary],
1133
- 'font-weight': ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black'],
1134
- 'inset-shadow': [isTshirtSize],
1135
- leading: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose'],
1136
- perspective: ['dramatic', 'near', 'normal', 'midrange', 'distant', 'none'],
1137
- radius: [isTshirtSize],
1138
- shadow: [isTshirtSize],
1139
- spacing: ['px', isNumber],
1140
- text: [isTshirtSize],
1141
- tracking: ['tighter', 'tight', 'normal', 'wide', 'wider', 'widest']
1142
- },
1143
- classGroups: {
1144
- // --------------
1145
- // --- Layout ---
1146
- // --------------
1147
- /**
1148
- * Aspect Ratio
1149
- * @see https://tailwindcss.com/docs/aspect-ratio
1150
- */
1151
- aspect: [{
1152
- aspect: ['auto', 'square', isFraction, isArbitraryValue, isArbitraryVariable, themeAspect]
1153
- }],
1154
- /**
1155
- * Container
1156
- * @see https://tailwindcss.com/docs/container
1157
- * @deprecated since Tailwind CSS v4.0.0
1158
- */
1159
- container: ['container'],
1160
- /**
1161
- * Columns
1162
- * @see https://tailwindcss.com/docs/columns
1163
- */
1164
- columns: [{
1165
- columns: [isNumber, isArbitraryValue, isArbitraryVariable, themeContainer]
1166
- }],
1167
- /**
1168
- * Break After
1169
- * @see https://tailwindcss.com/docs/break-after
1170
- */
1171
- 'break-after': [{
1172
- 'break-after': scaleBreak()
1173
- }],
1174
- /**
1175
- * Break Before
1176
- * @see https://tailwindcss.com/docs/break-before
1177
- */
1178
- 'break-before': [{
1179
- 'break-before': scaleBreak()
1180
- }],
1181
- /**
1182
- * Break Inside
1183
- * @see https://tailwindcss.com/docs/break-inside
1184
- */
1185
- 'break-inside': [{
1186
- 'break-inside': ['auto', 'avoid', 'avoid-page', 'avoid-column']
1187
- }],
1188
- /**
1189
- * Box Decoration Break
1190
- * @see https://tailwindcss.com/docs/box-decoration-break
1191
- */
1192
- 'box-decoration': [{
1193
- 'box-decoration': ['slice', 'clone']
1194
- }],
1195
- /**
1196
- * Box Sizing
1197
- * @see https://tailwindcss.com/docs/box-sizing
1198
- */
1199
- box: [{
1200
- box: ['border', 'content']
1201
- }],
1202
- /**
1203
- * Display
1204
- * @see https://tailwindcss.com/docs/display
1205
- */
1206
- display: ['block', 'inline-block', 'inline', 'flex', 'inline-flex', 'table', 'inline-table', 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row-group', 'table-row', 'flow-root', 'grid', 'inline-grid', 'contents', 'list-item', 'hidden'],
1207
- /**
1208
- * Screen Reader Only
1209
- * @see https://tailwindcss.com/docs/display#screen-reader-only
1210
- */
1211
- sr: ['sr-only', 'not-sr-only'],
1212
- /**
1213
- * Floats
1214
- * @see https://tailwindcss.com/docs/float
1215
- */
1216
- float: [{
1217
- float: ['right', 'left', 'none', 'start', 'end']
1218
- }],
1219
- /**
1220
- * Clear
1221
- * @see https://tailwindcss.com/docs/clear
1222
- */
1223
- clear: [{
1224
- clear: ['left', 'right', 'both', 'none', 'start', 'end']
1225
- }],
1226
- /**
1227
- * Isolation
1228
- * @see https://tailwindcss.com/docs/isolation
1229
- */
1230
- isolation: ['isolate', 'isolation-auto'],
1231
- /**
1232
- * Object Fit
1233
- * @see https://tailwindcss.com/docs/object-fit
1234
- */
1235
- 'object-fit': [{
1236
- object: ['contain', 'cover', 'fill', 'none', 'scale-down']
1237
- }],
1238
- /**
1239
- * Object Position
1240
- * @see https://tailwindcss.com/docs/object-position
1241
- */
1242
- 'object-position': [{
1243
- object: [...scalePosition(), isArbitraryValue, isArbitraryVariable]
1244
- }],
1245
- /**
1246
- * Overflow
1247
- * @see https://tailwindcss.com/docs/overflow
1248
- */
1249
- overflow: [{
1250
- overflow: scaleOverflow()
1251
- }],
1252
- /**
1253
- * Overflow X
1254
- * @see https://tailwindcss.com/docs/overflow
1255
- */
1256
- 'overflow-x': [{
1257
- 'overflow-x': scaleOverflow()
1258
- }],
1259
- /**
1260
- * Overflow Y
1261
- * @see https://tailwindcss.com/docs/overflow
1262
- */
1263
- 'overflow-y': [{
1264
- 'overflow-y': scaleOverflow()
1265
- }],
1266
- /**
1267
- * Overscroll Behavior
1268
- * @see https://tailwindcss.com/docs/overscroll-behavior
1269
- */
1270
- overscroll: [{
1271
- overscroll: scaleOverscroll()
1272
- }],
1273
- /**
1274
- * Overscroll Behavior X
1275
- * @see https://tailwindcss.com/docs/overscroll-behavior
1276
- */
1277
- 'overscroll-x': [{
1278
- 'overscroll-x': scaleOverscroll()
1279
- }],
1280
- /**
1281
- * Overscroll Behavior Y
1282
- * @see https://tailwindcss.com/docs/overscroll-behavior
1283
- */
1284
- 'overscroll-y': [{
1285
- 'overscroll-y': scaleOverscroll()
1286
- }],
1287
- /**
1288
- * Position
1289
- * @see https://tailwindcss.com/docs/position
1290
- */
1291
- position: ['static', 'fixed', 'absolute', 'relative', 'sticky'],
1292
- /**
1293
- * Top / Right / Bottom / Left
1294
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1295
- */
1296
- inset: [{
1297
- inset: scaleInset()
1298
- }],
1299
- /**
1300
- * Right / Left
1301
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1302
- */
1303
- 'inset-x': [{
1304
- 'inset-x': scaleInset()
1305
- }],
1306
- /**
1307
- * Top / Bottom
1308
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1309
- */
1310
- 'inset-y': [{
1311
- 'inset-y': scaleInset()
1312
- }],
1313
- /**
1314
- * Start
1315
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1316
- */
1317
- start: [{
1318
- start: scaleInset()
1319
- }],
1320
- /**
1321
- * End
1322
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1323
- */
1324
- end: [{
1325
- end: scaleInset()
1326
- }],
1327
- /**
1328
- * Top
1329
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1330
- */
1331
- top: [{
1332
- top: scaleInset()
1333
- }],
1334
- /**
1335
- * Right
1336
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1337
- */
1338
- right: [{
1339
- right: scaleInset()
1340
- }],
1341
- /**
1342
- * Bottom
1343
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1344
- */
1345
- bottom: [{
1346
- bottom: scaleInset()
1347
- }],
1348
- /**
1349
- * Left
1350
- * @see https://tailwindcss.com/docs/top-right-bottom-left
1351
- */
1352
- left: [{
1353
- left: scaleInset()
1354
- }],
1355
- /**
1356
- * Visibility
1357
- * @see https://tailwindcss.com/docs/visibility
1358
- */
1359
- visibility: ['visible', 'invisible', 'collapse'],
1360
- /**
1361
- * Z-Index
1362
- * @see https://tailwindcss.com/docs/z-index
1363
- */
1364
- z: [{
1365
- z: [isInteger, 'auto', isArbitraryVariable, isArbitraryValue]
1366
- }],
1367
- // ------------------------
1368
- // --- Flexbox and Grid ---
1369
- // ------------------------
1370
- /**
1371
- * Flex Basis
1372
- * @see https://tailwindcss.com/docs/flex-basis
1373
- */
1374
- basis: [{
1375
- basis: [isFraction, 'full', 'auto', themeContainer, ...scaleUnambiguousSpacing()]
1376
- }],
1377
- /**
1378
- * Flex Direction
1379
- * @see https://tailwindcss.com/docs/flex-direction
1380
- */
1381
- 'flex-direction': [{
1382
- flex: ['row', 'row-reverse', 'col', 'col-reverse']
1383
- }],
1384
- /**
1385
- * Flex Wrap
1386
- * @see https://tailwindcss.com/docs/flex-wrap
1387
- */
1388
- 'flex-wrap': [{
1389
- flex: ['nowrap', 'wrap', 'wrap-reverse']
1390
- }],
1391
- /**
1392
- * Flex
1393
- * @see https://tailwindcss.com/docs/flex
1394
- */
1395
- flex: [{
1396
- flex: [isNumber, isFraction, 'auto', 'initial', 'none', isArbitraryValue]
1397
- }],
1398
- /**
1399
- * Flex Grow
1400
- * @see https://tailwindcss.com/docs/flex-grow
1401
- */
1402
- grow: [{
1403
- grow: ['', isNumber, isArbitraryVariable, isArbitraryValue]
1404
- }],
1405
- /**
1406
- * Flex Shrink
1407
- * @see https://tailwindcss.com/docs/flex-shrink
1408
- */
1409
- shrink: [{
1410
- shrink: ['', isNumber, isArbitraryVariable, isArbitraryValue]
1411
- }],
1412
- /**
1413
- * Order
1414
- * @see https://tailwindcss.com/docs/order
1415
- */
1416
- order: [{
1417
- order: [isInteger, 'first', 'last', 'none', isArbitraryVariable, isArbitraryValue]
1418
- }],
1419
- /**
1420
- * Grid Template Columns
1421
- * @see https://tailwindcss.com/docs/grid-template-columns
1422
- */
1423
- 'grid-cols': [{
1424
- 'grid-cols': scaleGridTemplateColsRows()
1425
- }],
1426
- /**
1427
- * Grid Column Start / End
1428
- * @see https://tailwindcss.com/docs/grid-column
1429
- */
1430
- 'col-start-end': [{
1431
- col: scaleGridColRowStartAndEnd()
1432
- }],
1433
- /**
1434
- * Grid Column Start
1435
- * @see https://tailwindcss.com/docs/grid-column
1436
- */
1437
- 'col-start': [{
1438
- 'col-start': scaleGridColRowStartOrEnd()
1439
- }],
1440
- /**
1441
- * Grid Column End
1442
- * @see https://tailwindcss.com/docs/grid-column
1443
- */
1444
- 'col-end': [{
1445
- 'col-end': scaleGridColRowStartOrEnd()
1446
- }],
1447
- /**
1448
- * Grid Template Rows
1449
- * @see https://tailwindcss.com/docs/grid-template-rows
1450
- */
1451
- 'grid-rows': [{
1452
- 'grid-rows': scaleGridTemplateColsRows()
1453
- }],
1454
- /**
1455
- * Grid Row Start / End
1456
- * @see https://tailwindcss.com/docs/grid-row
1457
- */
1458
- 'row-start-end': [{
1459
- row: scaleGridColRowStartAndEnd()
1460
- }],
1461
- /**
1462
- * Grid Row Start
1463
- * @see https://tailwindcss.com/docs/grid-row
1464
- */
1465
- 'row-start': [{
1466
- 'row-start': scaleGridColRowStartOrEnd()
1467
- }],
1468
- /**
1469
- * Grid Row End
1470
- * @see https://tailwindcss.com/docs/grid-row
1471
- */
1472
- 'row-end': [{
1473
- 'row-end': scaleGridColRowStartOrEnd()
1474
- }],
1475
- /**
1476
- * Grid Auto Flow
1477
- * @see https://tailwindcss.com/docs/grid-auto-flow
1478
- */
1479
- 'grid-flow': [{
1480
- 'grid-flow': ['row', 'col', 'dense', 'row-dense', 'col-dense']
1481
- }],
1482
- /**
1483
- * Grid Auto Columns
1484
- * @see https://tailwindcss.com/docs/grid-auto-columns
1485
- */
1486
- 'auto-cols': [{
1487
- 'auto-cols': scaleGridAutoColsRows()
1488
- }],
1489
- /**
1490
- * Grid Auto Rows
1491
- * @see https://tailwindcss.com/docs/grid-auto-rows
1492
- */
1493
- 'auto-rows': [{
1494
- 'auto-rows': scaleGridAutoColsRows()
1495
- }],
1496
- /**
1497
- * Gap
1498
- * @see https://tailwindcss.com/docs/gap
1499
- */
1500
- gap: [{
1501
- gap: scaleUnambiguousSpacing()
1502
- }],
1503
- /**
1504
- * Gap X
1505
- * @see https://tailwindcss.com/docs/gap
1506
- */
1507
- 'gap-x': [{
1508
- 'gap-x': scaleUnambiguousSpacing()
1509
- }],
1510
- /**
1511
- * Gap Y
1512
- * @see https://tailwindcss.com/docs/gap
1513
- */
1514
- 'gap-y': [{
1515
- 'gap-y': scaleUnambiguousSpacing()
1516
- }],
1517
- /**
1518
- * Justify Content
1519
- * @see https://tailwindcss.com/docs/justify-content
1520
- */
1521
- 'justify-content': [{
1522
- justify: [...scaleAlignPrimaryAxis(), 'normal']
1523
- }],
1524
- /**
1525
- * Justify Items
1526
- * @see https://tailwindcss.com/docs/justify-items
1527
- */
1528
- 'justify-items': [{
1529
- 'justify-items': [...scaleAlignSecondaryAxis(), 'normal']
1530
- }],
1531
- /**
1532
- * Justify Self
1533
- * @see https://tailwindcss.com/docs/justify-self
1534
- */
1535
- 'justify-self': [{
1536
- 'justify-self': ['auto', ...scaleAlignSecondaryAxis()]
1537
- }],
1538
- /**
1539
- * Align Content
1540
- * @see https://tailwindcss.com/docs/align-content
1541
- */
1542
- 'align-content': [{
1543
- content: ['normal', ...scaleAlignPrimaryAxis()]
1544
- }],
1545
- /**
1546
- * Align Items
1547
- * @see https://tailwindcss.com/docs/align-items
1548
- */
1549
- 'align-items': [{
1550
- items: [...scaleAlignSecondaryAxis(), 'baseline']
1551
- }],
1552
- /**
1553
- * Align Self
1554
- * @see https://tailwindcss.com/docs/align-self
1555
- */
1556
- 'align-self': [{
1557
- self: ['auto', ...scaleAlignSecondaryAxis(), 'baseline']
1558
- }],
1559
- /**
1560
- * Place Content
1561
- * @see https://tailwindcss.com/docs/place-content
1562
- */
1563
- 'place-content': [{
1564
- 'place-content': scaleAlignPrimaryAxis()
1565
- }],
1566
- /**
1567
- * Place Items
1568
- * @see https://tailwindcss.com/docs/place-items
1569
- */
1570
- 'place-items': [{
1571
- 'place-items': [...scaleAlignSecondaryAxis(), 'baseline']
1572
- }],
1573
- /**
1574
- * Place Self
1575
- * @see https://tailwindcss.com/docs/place-self
1576
- */
1577
- 'place-self': [{
1578
- 'place-self': ['auto', ...scaleAlignSecondaryAxis()]
1579
- }],
1580
- // Spacing
1581
- /**
1582
- * Padding
1583
- * @see https://tailwindcss.com/docs/padding
1584
- */
1585
- p: [{
1586
- p: scaleUnambiguousSpacing()
1587
- }],
1588
- /**
1589
- * Padding X
1590
- * @see https://tailwindcss.com/docs/padding
1591
- */
1592
- px: [{
1593
- px: scaleUnambiguousSpacing()
1594
- }],
1595
- /**
1596
- * Padding Y
1597
- * @see https://tailwindcss.com/docs/padding
1598
- */
1599
- py: [{
1600
- py: scaleUnambiguousSpacing()
1601
- }],
1602
- /**
1603
- * Padding Start
1604
- * @see https://tailwindcss.com/docs/padding
1605
- */
1606
- ps: [{
1607
- ps: scaleUnambiguousSpacing()
1608
- }],
1609
- /**
1610
- * Padding End
1611
- * @see https://tailwindcss.com/docs/padding
1612
- */
1613
- pe: [{
1614
- pe: scaleUnambiguousSpacing()
1615
- }],
1616
- /**
1617
- * Padding Top
1618
- * @see https://tailwindcss.com/docs/padding
1619
- */
1620
- pt: [{
1621
- pt: scaleUnambiguousSpacing()
1622
- }],
1623
- /**
1624
- * Padding Right
1625
- * @see https://tailwindcss.com/docs/padding
1626
- */
1627
- pr: [{
1628
- pr: scaleUnambiguousSpacing()
1629
- }],
1630
- /**
1631
- * Padding Bottom
1632
- * @see https://tailwindcss.com/docs/padding
1633
- */
1634
- pb: [{
1635
- pb: scaleUnambiguousSpacing()
1636
- }],
1637
- /**
1638
- * Padding Left
1639
- * @see https://tailwindcss.com/docs/padding
1640
- */
1641
- pl: [{
1642
- pl: scaleUnambiguousSpacing()
1643
- }],
1644
- /**
1645
- * Margin
1646
- * @see https://tailwindcss.com/docs/margin
1647
- */
1648
- m: [{
1649
- m: scaleMargin()
1650
- }],
1651
- /**
1652
- * Margin X
1653
- * @see https://tailwindcss.com/docs/margin
1654
- */
1655
- mx: [{
1656
- mx: scaleMargin()
1657
- }],
1658
- /**
1659
- * Margin Y
1660
- * @see https://tailwindcss.com/docs/margin
1661
- */
1662
- my: [{
1663
- my: scaleMargin()
1664
- }],
1665
- /**
1666
- * Margin Start
1667
- * @see https://tailwindcss.com/docs/margin
1668
- */
1669
- ms: [{
1670
- ms: scaleMargin()
1671
- }],
1672
- /**
1673
- * Margin End
1674
- * @see https://tailwindcss.com/docs/margin
1675
- */
1676
- me: [{
1677
- me: scaleMargin()
1678
- }],
1679
- /**
1680
- * Margin Top
1681
- * @see https://tailwindcss.com/docs/margin
1682
- */
1683
- mt: [{
1684
- mt: scaleMargin()
1685
- }],
1686
- /**
1687
- * Margin Right
1688
- * @see https://tailwindcss.com/docs/margin
1689
- */
1690
- mr: [{
1691
- mr: scaleMargin()
1692
- }],
1693
- /**
1694
- * Margin Bottom
1695
- * @see https://tailwindcss.com/docs/margin
1696
- */
1697
- mb: [{
1698
- mb: scaleMargin()
1699
- }],
1700
- /**
1701
- * Margin Left
1702
- * @see https://tailwindcss.com/docs/margin
1703
- */
1704
- ml: [{
1705
- ml: scaleMargin()
1706
- }],
1707
- /**
1708
- * Space Between X
1709
- * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1710
- */
1711
- 'space-x': [{
1712
- 'space-x': scaleUnambiguousSpacing()
1713
- }],
1714
- /**
1715
- * Space Between X Reverse
1716
- * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1717
- */
1718
- 'space-x-reverse': ['space-x-reverse'],
1719
- /**
1720
- * Space Between Y
1721
- * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1722
- */
1723
- 'space-y': [{
1724
- 'space-y': scaleUnambiguousSpacing()
1725
- }],
1726
- /**
1727
- * Space Between Y Reverse
1728
- * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1729
- */
1730
- 'space-y-reverse': ['space-y-reverse'],
1731
- // --------------
1732
- // --- Sizing ---
1733
- // --------------
1734
- /**
1735
- * Size
1736
- * @see https://tailwindcss.com/docs/width#setting-both-width-and-height
1737
- */
1738
- size: [{
1739
- size: scaleSizing()
1740
- }],
1741
- /**
1742
- * Width
1743
- * @see https://tailwindcss.com/docs/width
1744
- */
1745
- w: [{
1746
- w: [themeContainer, 'screen', ...scaleSizing()]
1747
- }],
1748
- /**
1749
- * Min-Width
1750
- * @see https://tailwindcss.com/docs/min-width
1751
- */
1752
- 'min-w': [{
1753
- 'min-w': [themeContainer, 'screen', /** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1754
- 'none', ...scaleSizing()]
1755
- }],
1756
- /**
1757
- * Max-Width
1758
- * @see https://tailwindcss.com/docs/max-width
1759
- */
1760
- 'max-w': [{
1761
- 'max-w': [themeContainer, 'screen', 'none', /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1762
- 'prose', /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1763
- {
1764
- screen: [themeBreakpoint]
1765
- }, ...scaleSizing()]
1766
- }],
1767
- /**
1768
- * Height
1769
- * @see https://tailwindcss.com/docs/height
1770
- */
1771
- h: [{
1772
- h: ['screen', ...scaleSizing()]
1773
- }],
1774
- /**
1775
- * Min-Height
1776
- * @see https://tailwindcss.com/docs/min-height
1777
- */
1778
- 'min-h': [{
1779
- 'min-h': ['screen', 'none', ...scaleSizing()]
1780
- }],
1781
- /**
1782
- * Max-Height
1783
- * @see https://tailwindcss.com/docs/max-height
1784
- */
1785
- 'max-h': [{
1786
- 'max-h': ['screen', ...scaleSizing()]
1787
- }],
1788
- // ------------------
1789
- // --- Typography ---
1790
- // ------------------
1791
- /**
1792
- * Font Size
1793
- * @see https://tailwindcss.com/docs/font-size
1794
- */
1795
- 'font-size': [{
1796
- text: ['base', themeText, isArbitraryVariableLength, isArbitraryLength]
1797
- }],
1798
- /**
1799
- * Font Smoothing
1800
- * @see https://tailwindcss.com/docs/font-smoothing
1801
- */
1802
- 'font-smoothing': ['antialiased', 'subpixel-antialiased'],
1803
- /**
1804
- * Font Style
1805
- * @see https://tailwindcss.com/docs/font-style
1806
- */
1807
- 'font-style': ['italic', 'not-italic'],
1808
- /**
1809
- * Font Weight
1810
- * @see https://tailwindcss.com/docs/font-weight
1811
- */
1812
- 'font-weight': [{
1813
- font: [themeFontWeight, isArbitraryVariable, isArbitraryNumber]
1814
- }],
1815
- /**
1816
- * Font Stretch
1817
- * @see https://tailwindcss.com/docs/font-stretch
1818
- */
1819
- 'font-stretch': [{
1820
- 'font-stretch': ['ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded', isPercent, isArbitraryValue]
1821
- }],
1822
- /**
1823
- * Font Family
1824
- * @see https://tailwindcss.com/docs/font-family
1825
- */
1826
- 'font-family': [{
1827
- font: [isArbitraryVariableFamilyName, isArbitraryValue, themeFont]
1828
- }],
1829
- /**
1830
- * Font Variant Numeric
1831
- * @see https://tailwindcss.com/docs/font-variant-numeric
1832
- */
1833
- 'fvn-normal': ['normal-nums'],
1834
- /**
1835
- * Font Variant Numeric
1836
- * @see https://tailwindcss.com/docs/font-variant-numeric
1837
- */
1838
- 'fvn-ordinal': ['ordinal'],
1839
- /**
1840
- * Font Variant Numeric
1841
- * @see https://tailwindcss.com/docs/font-variant-numeric
1842
- */
1843
- 'fvn-slashed-zero': ['slashed-zero'],
1844
- /**
1845
- * Font Variant Numeric
1846
- * @see https://tailwindcss.com/docs/font-variant-numeric
1847
- */
1848
- 'fvn-figure': ['lining-nums', 'oldstyle-nums'],
1849
- /**
1850
- * Font Variant Numeric
1851
- * @see https://tailwindcss.com/docs/font-variant-numeric
1852
- */
1853
- 'fvn-spacing': ['proportional-nums', 'tabular-nums'],
1854
- /**
1855
- * Font Variant Numeric
1856
- * @see https://tailwindcss.com/docs/font-variant-numeric
1857
- */
1858
- 'fvn-fraction': ['diagonal-fractions', 'stacked-fractions'],
1859
- /**
1860
- * Letter Spacing
1861
- * @see https://tailwindcss.com/docs/letter-spacing
1862
- */
1863
- tracking: [{
1864
- tracking: [themeTracking, isArbitraryVariable, isArbitraryValue]
1865
- }],
1866
- /**
1867
- * Line Clamp
1868
- * @see https://tailwindcss.com/docs/line-clamp
1869
- */
1870
- 'line-clamp': [{
1871
- 'line-clamp': [isNumber, 'none', isArbitraryVariable, isArbitraryNumber]
1872
- }],
1873
- /**
1874
- * Line Height
1875
- * @see https://tailwindcss.com/docs/line-height
1876
- */
1877
- leading: [{
1878
- leading: [/** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1879
- themeLeading, ...scaleUnambiguousSpacing()]
1880
- }],
1881
- /**
1882
- * List Style Image
1883
- * @see https://tailwindcss.com/docs/list-style-image
1884
- */
1885
- 'list-image': [{
1886
- 'list-image': ['none', isArbitraryVariable, isArbitraryValue]
1887
- }],
1888
- /**
1889
- * List Style Position
1890
- * @see https://tailwindcss.com/docs/list-style-position
1891
- */
1892
- 'list-style-position': [{
1893
- list: ['inside', 'outside']
1894
- }],
1895
- /**
1896
- * List Style Type
1897
- * @see https://tailwindcss.com/docs/list-style-type
1898
- */
1899
- 'list-style-type': [{
1900
- list: ['disc', 'decimal', 'none', isArbitraryVariable, isArbitraryValue]
1901
- }],
1902
- /**
1903
- * Text Alignment
1904
- * @see https://tailwindcss.com/docs/text-align
1905
- */
1906
- 'text-alignment': [{
1907
- text: ['left', 'center', 'right', 'justify', 'start', 'end']
1908
- }],
1909
- /**
1910
- * Placeholder Color
1911
- * @deprecated since Tailwind CSS v3.0.0
1912
- * @see https://v3.tailwindcss.com/docs/placeholder-color
1913
- */
1914
- 'placeholder-color': [{
1915
- placeholder: scaleColor()
1916
- }],
1917
- /**
1918
- * Text Color
1919
- * @see https://tailwindcss.com/docs/text-color
1920
- */
1921
- 'text-color': [{
1922
- text: scaleColor()
1923
- }],
1924
- /**
1925
- * Text Decoration
1926
- * @see https://tailwindcss.com/docs/text-decoration
1927
- */
1928
- 'text-decoration': ['underline', 'overline', 'line-through', 'no-underline'],
1929
- /**
1930
- * Text Decoration Style
1931
- * @see https://tailwindcss.com/docs/text-decoration-style
1932
- */
1933
- 'text-decoration-style': [{
1934
- decoration: [...scaleLineStyle(), 'wavy']
1935
- }],
1936
- /**
1937
- * Text Decoration Thickness
1938
- * @see https://tailwindcss.com/docs/text-decoration-thickness
1939
- */
1940
- 'text-decoration-thickness': [{
1941
- decoration: [isNumber, 'from-font', 'auto', isArbitraryVariable, isArbitraryLength]
1942
- }],
1943
- /**
1944
- * Text Decoration Color
1945
- * @see https://tailwindcss.com/docs/text-decoration-color
1946
- */
1947
- 'text-decoration-color': [{
1948
- decoration: scaleColor()
1949
- }],
1950
- /**
1951
- * Text Underline Offset
1952
- * @see https://tailwindcss.com/docs/text-underline-offset
1953
- */
1954
- 'underline-offset': [{
1955
- 'underline-offset': [isNumber, 'auto', isArbitraryVariable, isArbitraryValue]
1956
- }],
1957
- /**
1958
- * Text Transform
1959
- * @see https://tailwindcss.com/docs/text-transform
1960
- */
1961
- 'text-transform': ['uppercase', 'lowercase', 'capitalize', 'normal-case'],
1962
- /**
1963
- * Text Overflow
1964
- * @see https://tailwindcss.com/docs/text-overflow
1965
- */
1966
- 'text-overflow': ['truncate', 'text-ellipsis', 'text-clip'],
1967
- /**
1968
- * Text Wrap
1969
- * @see https://tailwindcss.com/docs/text-wrap
1970
- */
1971
- 'text-wrap': [{
1972
- text: ['wrap', 'nowrap', 'balance', 'pretty']
1973
- }],
1974
- /**
1975
- * Text Indent
1976
- * @see https://tailwindcss.com/docs/text-indent
1977
- */
1978
- indent: [{
1979
- indent: scaleUnambiguousSpacing()
1980
- }],
1981
- /**
1982
- * Vertical Alignment
1983
- * @see https://tailwindcss.com/docs/vertical-align
1984
- */
1985
- 'vertical-align': [{
1986
- align: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super', isArbitraryVariable, isArbitraryValue]
1987
- }],
1988
- /**
1989
- * Whitespace
1990
- * @see https://tailwindcss.com/docs/whitespace
1991
- */
1992
- whitespace: [{
1993
- whitespace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces']
1994
- }],
1995
- /**
1996
- * Word Break
1997
- * @see https://tailwindcss.com/docs/word-break
1998
- */
1999
- break: [{
2000
- break: ['normal', 'words', 'all', 'keep']
2001
- }],
2002
- /**
2003
- * Hyphens
2004
- * @see https://tailwindcss.com/docs/hyphens
2005
- */
2006
- hyphens: [{
2007
- hyphens: ['none', 'manual', 'auto']
2008
- }],
2009
- /**
2010
- * Content
2011
- * @see https://tailwindcss.com/docs/content
2012
- */
2013
- content: [{
2014
- content: ['none', isArbitraryVariable, isArbitraryValue]
2015
- }],
2016
- // -------------------
2017
- // --- Backgrounds ---
2018
- // -------------------
2019
- /**
2020
- * Background Attachment
2021
- * @see https://tailwindcss.com/docs/background-attachment
2022
- */
2023
- 'bg-attachment': [{
2024
- bg: ['fixed', 'local', 'scroll']
2025
- }],
2026
- /**
2027
- * Background Clip
2028
- * @see https://tailwindcss.com/docs/background-clip
2029
- */
2030
- 'bg-clip': [{
2031
- 'bg-clip': ['border', 'padding', 'content', 'text']
2032
- }],
2033
- /**
2034
- * Background Origin
2035
- * @see https://tailwindcss.com/docs/background-origin
2036
- */
2037
- 'bg-origin': [{
2038
- 'bg-origin': ['border', 'padding', 'content']
2039
- }],
2040
- /**
2041
- * Background Position
2042
- * @see https://tailwindcss.com/docs/background-position
2043
- */
2044
- 'bg-position': [{
2045
- bg: [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition]
2046
- }],
2047
- /**
2048
- * Background Repeat
2049
- * @see https://tailwindcss.com/docs/background-repeat
2050
- */
2051
- 'bg-repeat': [{
2052
- bg: ['no-repeat', {
2053
- repeat: ['', 'x', 'y', 'space', 'round']
2054
- }]
2055
- }],
2056
- /**
2057
- * Background Size
2058
- * @see https://tailwindcss.com/docs/background-size
2059
- */
2060
- 'bg-size': [{
2061
- bg: ['auto', 'cover', 'contain', isArbitraryVariableSize, isArbitrarySize]
2062
- }],
2063
- /**
2064
- * Background Image
2065
- * @see https://tailwindcss.com/docs/background-image
2066
- */
2067
- 'bg-image': [{
2068
- bg: ['none', {
2069
- linear: [{
2070
- to: ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl']
2071
- }, isInteger, isArbitraryVariable, isArbitraryValue],
2072
- radial: ['', isArbitraryVariable, isArbitraryValue],
2073
- conic: [isInteger, isArbitraryVariable, isArbitraryValue]
2074
- }, isArbitraryVariableImage, isArbitraryImage]
2075
- }],
2076
- /**
2077
- * Background Color
2078
- * @see https://tailwindcss.com/docs/background-color
2079
- */
2080
- 'bg-color': [{
2081
- bg: scaleColor()
2082
- }],
2083
- /**
2084
- * Gradient Color Stops From Position
2085
- * @see https://tailwindcss.com/docs/gradient-color-stops
2086
- */
2087
- 'gradient-from-pos': [{
2088
- from: scaleGradientStopPosition()
2089
- }],
2090
- /**
2091
- * Gradient Color Stops Via Position
2092
- * @see https://tailwindcss.com/docs/gradient-color-stops
2093
- */
2094
- 'gradient-via-pos': [{
2095
- via: scaleGradientStopPosition()
2096
- }],
2097
- /**
2098
- * Gradient Color Stops To Position
2099
- * @see https://tailwindcss.com/docs/gradient-color-stops
2100
- */
2101
- 'gradient-to-pos': [{
2102
- to: scaleGradientStopPosition()
2103
- }],
2104
- /**
2105
- * Gradient Color Stops From
2106
- * @see https://tailwindcss.com/docs/gradient-color-stops
2107
- */
2108
- 'gradient-from': [{
2109
- from: scaleColor()
2110
- }],
2111
- /**
2112
- * Gradient Color Stops Via
2113
- * @see https://tailwindcss.com/docs/gradient-color-stops
2114
- */
2115
- 'gradient-via': [{
2116
- via: scaleColor()
2117
- }],
2118
- /**
2119
- * Gradient Color Stops To
2120
- * @see https://tailwindcss.com/docs/gradient-color-stops
2121
- */
2122
- 'gradient-to': [{
2123
- to: scaleColor()
2124
- }],
2125
- // ---------------
2126
- // --- Borders ---
2127
- // ---------------
2128
- /**
2129
- * Border Radius
2130
- * @see https://tailwindcss.com/docs/border-radius
2131
- */
2132
- rounded: [{
2133
- rounded: scaleRadius()
2134
- }],
2135
- /**
2136
- * Border Radius Start
2137
- * @see https://tailwindcss.com/docs/border-radius
2138
- */
2139
- 'rounded-s': [{
2140
- 'rounded-s': scaleRadius()
2141
- }],
2142
- /**
2143
- * Border Radius End
2144
- * @see https://tailwindcss.com/docs/border-radius
2145
- */
2146
- 'rounded-e': [{
2147
- 'rounded-e': scaleRadius()
2148
- }],
2149
- /**
2150
- * Border Radius Top
2151
- * @see https://tailwindcss.com/docs/border-radius
2152
- */
2153
- 'rounded-t': [{
2154
- 'rounded-t': scaleRadius()
2155
- }],
2156
- /**
2157
- * Border Radius Right
2158
- * @see https://tailwindcss.com/docs/border-radius
2159
- */
2160
- 'rounded-r': [{
2161
- 'rounded-r': scaleRadius()
2162
- }],
2163
- /**
2164
- * Border Radius Bottom
2165
- * @see https://tailwindcss.com/docs/border-radius
2166
- */
2167
- 'rounded-b': [{
2168
- 'rounded-b': scaleRadius()
2169
- }],
2170
- /**
2171
- * Border Radius Left
2172
- * @see https://tailwindcss.com/docs/border-radius
2173
- */
2174
- 'rounded-l': [{
2175
- 'rounded-l': scaleRadius()
2176
- }],
2177
- /**
2178
- * Border Radius Start Start
2179
- * @see https://tailwindcss.com/docs/border-radius
2180
- */
2181
- 'rounded-ss': [{
2182
- 'rounded-ss': scaleRadius()
2183
- }],
2184
- /**
2185
- * Border Radius Start End
2186
- * @see https://tailwindcss.com/docs/border-radius
2187
- */
2188
- 'rounded-se': [{
2189
- 'rounded-se': scaleRadius()
2190
- }],
2191
- /**
2192
- * Border Radius End End
2193
- * @see https://tailwindcss.com/docs/border-radius
2194
- */
2195
- 'rounded-ee': [{
2196
- 'rounded-ee': scaleRadius()
2197
- }],
2198
- /**
2199
- * Border Radius End Start
2200
- * @see https://tailwindcss.com/docs/border-radius
2201
- */
2202
- 'rounded-es': [{
2203
- 'rounded-es': scaleRadius()
2204
- }],
2205
- /**
2206
- * Border Radius Top Left
2207
- * @see https://tailwindcss.com/docs/border-radius
2208
- */
2209
- 'rounded-tl': [{
2210
- 'rounded-tl': scaleRadius()
2211
- }],
2212
- /**
2213
- * Border Radius Top Right
2214
- * @see https://tailwindcss.com/docs/border-radius
2215
- */
2216
- 'rounded-tr': [{
2217
- 'rounded-tr': scaleRadius()
2218
- }],
2219
- /**
2220
- * Border Radius Bottom Right
2221
- * @see https://tailwindcss.com/docs/border-radius
2222
- */
2223
- 'rounded-br': [{
2224
- 'rounded-br': scaleRadius()
2225
- }],
2226
- /**
2227
- * Border Radius Bottom Left
2228
- * @see https://tailwindcss.com/docs/border-radius
2229
- */
2230
- 'rounded-bl': [{
2231
- 'rounded-bl': scaleRadius()
2232
- }],
2233
- /**
2234
- * Border Width
2235
- * @see https://tailwindcss.com/docs/border-width
2236
- */
2237
- 'border-w': [{
2238
- border: scaleBorderWidth()
2239
- }],
2240
- /**
2241
- * Border Width X
2242
- * @see https://tailwindcss.com/docs/border-width
2243
- */
2244
- 'border-w-x': [{
2245
- 'border-x': scaleBorderWidth()
2246
- }],
2247
- /**
2248
- * Border Width Y
2249
- * @see https://tailwindcss.com/docs/border-width
2250
- */
2251
- 'border-w-y': [{
2252
- 'border-y': scaleBorderWidth()
2253
- }],
2254
- /**
2255
- * Border Width Start
2256
- * @see https://tailwindcss.com/docs/border-width
2257
- */
2258
- 'border-w-s': [{
2259
- 'border-s': scaleBorderWidth()
2260
- }],
2261
- /**
2262
- * Border Width End
2263
- * @see https://tailwindcss.com/docs/border-width
2264
- */
2265
- 'border-w-e': [{
2266
- 'border-e': scaleBorderWidth()
2267
- }],
2268
- /**
2269
- * Border Width Top
2270
- * @see https://tailwindcss.com/docs/border-width
2271
- */
2272
- 'border-w-t': [{
2273
- 'border-t': scaleBorderWidth()
2274
- }],
2275
- /**
2276
- * Border Width Right
2277
- * @see https://tailwindcss.com/docs/border-width
2278
- */
2279
- 'border-w-r': [{
2280
- 'border-r': scaleBorderWidth()
2281
- }],
2282
- /**
2283
- * Border Width Bottom
2284
- * @see https://tailwindcss.com/docs/border-width
2285
- */
2286
- 'border-w-b': [{
2287
- 'border-b': scaleBorderWidth()
2288
- }],
2289
- /**
2290
- * Border Width Left
2291
- * @see https://tailwindcss.com/docs/border-width
2292
- */
2293
- 'border-w-l': [{
2294
- 'border-l': scaleBorderWidth()
2295
- }],
2296
- /**
2297
- * Divide Width X
2298
- * @see https://tailwindcss.com/docs/border-width#between-children
2299
- */
2300
- 'divide-x': [{
2301
- 'divide-x': scaleBorderWidth()
2302
- }],
2303
- /**
2304
- * Divide Width X Reverse
2305
- * @see https://tailwindcss.com/docs/border-width#between-children
2306
- */
2307
- 'divide-x-reverse': ['divide-x-reverse'],
2308
- /**
2309
- * Divide Width Y
2310
- * @see https://tailwindcss.com/docs/border-width#between-children
2311
- */
2312
- 'divide-y': [{
2313
- 'divide-y': scaleBorderWidth()
2314
- }],
2315
- /**
2316
- * Divide Width Y Reverse
2317
- * @see https://tailwindcss.com/docs/border-width#between-children
2318
- */
2319
- 'divide-y-reverse': ['divide-y-reverse'],
2320
- /**
2321
- * Border Style
2322
- * @see https://tailwindcss.com/docs/border-style
2323
- */
2324
- 'border-style': [{
2325
- border: [...scaleLineStyle(), 'hidden', 'none']
2326
- }],
2327
- /**
2328
- * Divide Style
2329
- * @see https://tailwindcss.com/docs/border-style#setting-the-divider-style
2330
- */
2331
- 'divide-style': [{
2332
- divide: [...scaleLineStyle(), 'hidden', 'none']
2333
- }],
2334
- /**
2335
- * Border Color
2336
- * @see https://tailwindcss.com/docs/border-color
2337
- */
2338
- 'border-color': [{
2339
- border: scaleColor()
2340
- }],
2341
- /**
2342
- * Border Color X
2343
- * @see https://tailwindcss.com/docs/border-color
2344
- */
2345
- 'border-color-x': [{
2346
- 'border-x': scaleColor()
2347
- }],
2348
- /**
2349
- * Border Color Y
2350
- * @see https://tailwindcss.com/docs/border-color
2351
- */
2352
- 'border-color-y': [{
2353
- 'border-y': scaleColor()
2354
- }],
2355
- /**
2356
- * Border Color S
2357
- * @see https://tailwindcss.com/docs/border-color
2358
- */
2359
- 'border-color-s': [{
2360
- 'border-s': scaleColor()
2361
- }],
2362
- /**
2363
- * Border Color E
2364
- * @see https://tailwindcss.com/docs/border-color
2365
- */
2366
- 'border-color-e': [{
2367
- 'border-e': scaleColor()
2368
- }],
2369
- /**
2370
- * Border Color Top
2371
- * @see https://tailwindcss.com/docs/border-color
2372
- */
2373
- 'border-color-t': [{
2374
- 'border-t': scaleColor()
2375
- }],
2376
- /**
2377
- * Border Color Right
2378
- * @see https://tailwindcss.com/docs/border-color
2379
- */
2380
- 'border-color-r': [{
2381
- 'border-r': scaleColor()
2382
- }],
2383
- /**
2384
- * Border Color Bottom
2385
- * @see https://tailwindcss.com/docs/border-color
2386
- */
2387
- 'border-color-b': [{
2388
- 'border-b': scaleColor()
2389
- }],
2390
- /**
2391
- * Border Color Left
2392
- * @see https://tailwindcss.com/docs/border-color
2393
- */
2394
- 'border-color-l': [{
2395
- 'border-l': scaleColor()
2396
- }],
2397
- /**
2398
- * Divide Color
2399
- * @see https://tailwindcss.com/docs/divide-color
2400
- */
2401
- 'divide-color': [{
2402
- divide: scaleColor()
2403
- }],
2404
- /**
2405
- * Outline Style
2406
- * @see https://tailwindcss.com/docs/outline-style
2407
- */
2408
- 'outline-style': [{
2409
- outline: [...scaleLineStyle(), 'none', 'hidden']
2410
- }],
2411
- /**
2412
- * Outline Offset
2413
- * @see https://tailwindcss.com/docs/outline-offset
2414
- */
2415
- 'outline-offset': [{
2416
- 'outline-offset': [isNumber, isArbitraryVariable, isArbitraryValue]
2417
- }],
2418
- /**
2419
- * Outline Width
2420
- * @see https://tailwindcss.com/docs/outline-width
2421
- */
2422
- 'outline-w': [{
2423
- outline: ['', isNumber, isArbitraryVariableLength, isArbitraryLength]
2424
- }],
2425
- /**
2426
- * Outline Color
2427
- * @see https://tailwindcss.com/docs/outline-color
2428
- */
2429
- 'outline-color': [{
2430
- outline: [themeColor]
2431
- }],
2432
- // ---------------
2433
- // --- Effects ---
2434
- // ---------------
2435
- /**
2436
- * Box Shadow
2437
- * @see https://tailwindcss.com/docs/box-shadow
2438
- */
2439
- shadow: [{
2440
- shadow: [
2441
- // Deprecated since Tailwind CSS v4.0.0
2442
- '', 'none', themeShadow, isArbitraryVariableShadow, isArbitraryShadow]
2443
- }],
2444
- /**
2445
- * Box Shadow Color
2446
- * @see https://tailwindcss.com/docs/box-shadow#setting-the-shadow-color
2447
- */
2448
- 'shadow-color': [{
2449
- shadow: scaleColor()
2450
- }],
2451
- /**
2452
- * Inset Box Shadow
2453
- * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-shadow
2454
- */
2455
- 'inset-shadow': [{
2456
- 'inset-shadow': ['none', isArbitraryVariable, isArbitraryValue, themeInsetShadow]
2457
- }],
2458
- /**
2459
- * Inset Box Shadow Color
2460
- * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-shadow-color
2461
- */
2462
- 'inset-shadow-color': [{
2463
- 'inset-shadow': scaleColor()
2464
- }],
2465
- /**
2466
- * Ring Width
2467
- * @see https://tailwindcss.com/docs/box-shadow#adding-a-ring
2468
- */
2469
- 'ring-w': [{
2470
- ring: scaleBorderWidth()
2471
- }],
2472
- /**
2473
- * Ring Width Inset
2474
- * @see https://v3.tailwindcss.com/docs/ring-width#inset-rings
2475
- * @deprecated since Tailwind CSS v4.0.0
2476
- * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
2477
- */
2478
- 'ring-w-inset': ['ring-inset'],
2479
- /**
2480
- * Ring Color
2481
- * @see https://tailwindcss.com/docs/box-shadow#setting-the-ring-color
2482
- */
2483
- 'ring-color': [{
2484
- ring: scaleColor()
2485
- }],
2486
- /**
2487
- * Ring Offset Width
2488
- * @see https://v3.tailwindcss.com/docs/ring-offset-width
2489
- * @deprecated since Tailwind CSS v4.0.0
2490
- * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
2491
- */
2492
- 'ring-offset-w': [{
2493
- 'ring-offset': [isNumber, isArbitraryLength]
2494
- }],
2495
- /**
2496
- * Ring Offset Color
2497
- * @see https://v3.tailwindcss.com/docs/ring-offset-color
2498
- * @deprecated since Tailwind CSS v4.0.0
2499
- * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
2500
- */
2501
- 'ring-offset-color': [{
2502
- 'ring-offset': scaleColor()
2503
- }],
2504
- /**
2505
- * Inset Ring Width
2506
- * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-ring
2507
- */
2508
- 'inset-ring-w': [{
2509
- 'inset-ring': scaleBorderWidth()
2510
- }],
2511
- /**
2512
- * Inset Ring Color
2513
- * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-ring-color
2514
- */
2515
- 'inset-ring-color': [{
2516
- 'inset-ring': scaleColor()
2517
- }],
2518
- /**
2519
- * Opacity
2520
- * @see https://tailwindcss.com/docs/opacity
2521
- */
2522
- opacity: [{
2523
- opacity: [isNumber, isArbitraryVariable, isArbitraryValue]
2524
- }],
2525
- /**
2526
- * Mix Blend Mode
2527
- * @see https://tailwindcss.com/docs/mix-blend-mode
2528
- */
2529
- 'mix-blend': [{
2530
- 'mix-blend': [...scaleBlendMode(), 'plus-darker', 'plus-lighter']
2531
- }],
2532
- /**
2533
- * Background Blend Mode
2534
- * @see https://tailwindcss.com/docs/background-blend-mode
2535
- */
2536
- 'bg-blend': [{
2537
- 'bg-blend': scaleBlendMode()
2538
- }],
2539
- // ---------------
2540
- // --- Filters ---
2541
- // ---------------
2542
- /**
2543
- * Filter
2544
- * @see https://tailwindcss.com/docs/filter
2545
- */
2546
- filter: [{
2547
- filter: [
2548
- // Deprecated since Tailwind CSS v3.0.0
2549
- '', 'none', isArbitraryVariable, isArbitraryValue]
2550
- }],
2551
- /**
2552
- * Blur
2553
- * @see https://tailwindcss.com/docs/blur
2554
- */
2555
- blur: [{
2556
- blur: scaleBlur()
2557
- }],
2558
- /**
2559
- * Brightness
2560
- * @see https://tailwindcss.com/docs/brightness
2561
- */
2562
- brightness: [{
2563
- brightness: [isNumber, isArbitraryVariable, isArbitraryValue]
2564
- }],
2565
- /**
2566
- * Contrast
2567
- * @see https://tailwindcss.com/docs/contrast
2568
- */
2569
- contrast: [{
2570
- contrast: [isNumber, isArbitraryVariable, isArbitraryValue]
2571
- }],
2572
- /**
2573
- * Drop Shadow
2574
- * @see https://tailwindcss.com/docs/drop-shadow
2575
- */
2576
- 'drop-shadow': [{
2577
- 'drop-shadow': [
2578
- // Deprecated since Tailwind CSS v4.0.0
2579
- '', 'none', themeDropShadow, isArbitraryVariable, isArbitraryValue]
2580
- }],
2581
- /**
2582
- * Grayscale
2583
- * @see https://tailwindcss.com/docs/grayscale
2584
- */
2585
- grayscale: [{
2586
- grayscale: ['', isNumber, isArbitraryVariable, isArbitraryValue]
2587
- }],
2588
- /**
2589
- * Hue Rotate
2590
- * @see https://tailwindcss.com/docs/hue-rotate
2591
- */
2592
- 'hue-rotate': [{
2593
- 'hue-rotate': [isNumber, isArbitraryVariable, isArbitraryValue]
2594
- }],
2595
- /**
2596
- * Invert
2597
- * @see https://tailwindcss.com/docs/invert
2598
- */
2599
- invert: [{
2600
- invert: ['', isNumber, isArbitraryVariable, isArbitraryValue]
2601
- }],
2602
- /**
2603
- * Saturate
2604
- * @see https://tailwindcss.com/docs/saturate
2605
- */
2606
- saturate: [{
2607
- saturate: [isNumber, isArbitraryVariable, isArbitraryValue]
2608
- }],
2609
- /**
2610
- * Sepia
2611
- * @see https://tailwindcss.com/docs/sepia
2612
- */
2613
- sepia: [{
2614
- sepia: ['', isNumber, isArbitraryVariable, isArbitraryValue]
2615
- }],
2616
- /**
2617
- * Backdrop Filter
2618
- * @see https://tailwindcss.com/docs/backdrop-filter
2619
- */
2620
- 'backdrop-filter': [{
2621
- 'backdrop-filter': [
2622
- // Deprecated since Tailwind CSS v3.0.0
2623
- '', 'none', isArbitraryVariable, isArbitraryValue]
2624
- }],
2625
- /**
2626
- * Backdrop Blur
2627
- * @see https://tailwindcss.com/docs/backdrop-blur
2628
- */
2629
- 'backdrop-blur': [{
2630
- 'backdrop-blur': scaleBlur()
2631
- }],
2632
- /**
2633
- * Backdrop Brightness
2634
- * @see https://tailwindcss.com/docs/backdrop-brightness
2635
- */
2636
- 'backdrop-brightness': [{
2637
- 'backdrop-brightness': [isNumber, isArbitraryVariable, isArbitraryValue]
2638
- }],
2639
- /**
2640
- * Backdrop Contrast
2641
- * @see https://tailwindcss.com/docs/backdrop-contrast
2642
- */
2643
- 'backdrop-contrast': [{
2644
- 'backdrop-contrast': [isNumber, isArbitraryVariable, isArbitraryValue]
2645
- }],
2646
- /**
2647
- * Backdrop Grayscale
2648
- * @see https://tailwindcss.com/docs/backdrop-grayscale
2649
- */
2650
- 'backdrop-grayscale': [{
2651
- 'backdrop-grayscale': ['', isNumber, isArbitraryVariable, isArbitraryValue]
2652
- }],
2653
- /**
2654
- * Backdrop Hue Rotate
2655
- * @see https://tailwindcss.com/docs/backdrop-hue-rotate
2656
- */
2657
- 'backdrop-hue-rotate': [{
2658
- 'backdrop-hue-rotate': [isNumber, isArbitraryVariable, isArbitraryValue]
2659
- }],
2660
- /**
2661
- * Backdrop Invert
2662
- * @see https://tailwindcss.com/docs/backdrop-invert
2663
- */
2664
- 'backdrop-invert': [{
2665
- 'backdrop-invert': ['', isNumber, isArbitraryVariable, isArbitraryValue]
2666
- }],
2667
- /**
2668
- * Backdrop Opacity
2669
- * @see https://tailwindcss.com/docs/backdrop-opacity
2670
- */
2671
- 'backdrop-opacity': [{
2672
- 'backdrop-opacity': [isNumber, isArbitraryVariable, isArbitraryValue]
2673
- }],
2674
- /**
2675
- * Backdrop Saturate
2676
- * @see https://tailwindcss.com/docs/backdrop-saturate
2677
- */
2678
- 'backdrop-saturate': [{
2679
- 'backdrop-saturate': [isNumber, isArbitraryVariable, isArbitraryValue]
2680
- }],
2681
- /**
2682
- * Backdrop Sepia
2683
- * @see https://tailwindcss.com/docs/backdrop-sepia
2684
- */
2685
- 'backdrop-sepia': [{
2686
- 'backdrop-sepia': ['', isNumber, isArbitraryVariable, isArbitraryValue]
2687
- }],
2688
- // --------------
2689
- // --- Tables ---
2690
- // --------------
2691
- /**
2692
- * Border Collapse
2693
- * @see https://tailwindcss.com/docs/border-collapse
2694
- */
2695
- 'border-collapse': [{
2696
- border: ['collapse', 'separate']
2697
- }],
2698
- /**
2699
- * Border Spacing
2700
- * @see https://tailwindcss.com/docs/border-spacing
2701
- */
2702
- 'border-spacing': [{
2703
- 'border-spacing': scaleUnambiguousSpacing()
2704
- }],
2705
- /**
2706
- * Border Spacing X
2707
- * @see https://tailwindcss.com/docs/border-spacing
2708
- */
2709
- 'border-spacing-x': [{
2710
- 'border-spacing-x': scaleUnambiguousSpacing()
2711
- }],
2712
- /**
2713
- * Border Spacing Y
2714
- * @see https://tailwindcss.com/docs/border-spacing
2715
- */
2716
- 'border-spacing-y': [{
2717
- 'border-spacing-y': scaleUnambiguousSpacing()
2718
- }],
2719
- /**
2720
- * Table Layout
2721
- * @see https://tailwindcss.com/docs/table-layout
2722
- */
2723
- 'table-layout': [{
2724
- table: ['auto', 'fixed']
2725
- }],
2726
- /**
2727
- * Caption Side
2728
- * @see https://tailwindcss.com/docs/caption-side
2729
- */
2730
- caption: [{
2731
- caption: ['top', 'bottom']
2732
- }],
2733
- // ---------------------------------
2734
- // --- Transitions and Animation ---
2735
- // ---------------------------------
2736
- /**
2737
- * Transition Property
2738
- * @see https://tailwindcss.com/docs/transition-property
2739
- */
2740
- transition: [{
2741
- transition: ['', 'all', 'colors', 'opacity', 'shadow', 'transform', 'none', isArbitraryVariable, isArbitraryValue]
2742
- }],
2743
- /**
2744
- * Transition Behavior
2745
- * @see https://tailwindcss.com/docs/transition-behavior
2746
- */
2747
- 'transition-behavior': [{
2748
- transition: ['normal', 'discrete']
2749
- }],
2750
- /**
2751
- * Transition Duration
2752
- * @see https://tailwindcss.com/docs/transition-duration
2753
- */
2754
- duration: [{
2755
- duration: [isNumber, 'initial', isArbitraryVariable, isArbitraryValue]
2756
- }],
2757
- /**
2758
- * Transition Timing Function
2759
- * @see https://tailwindcss.com/docs/transition-timing-function
2760
- */
2761
- ease: [{
2762
- ease: ['linear', 'initial', themeEase, isArbitraryVariable, isArbitraryValue]
2763
- }],
2764
- /**
2765
- * Transition Delay
2766
- * @see https://tailwindcss.com/docs/transition-delay
2767
- */
2768
- delay: [{
2769
- delay: [isNumber, isArbitraryVariable, isArbitraryValue]
2770
- }],
2771
- /**
2772
- * Animation
2773
- * @see https://tailwindcss.com/docs/animation
2774
- */
2775
- animate: [{
2776
- animate: ['none', themeAnimate, isArbitraryVariable, isArbitraryValue]
2777
- }],
2778
- // ------------------
2779
- // --- Transforms ---
2780
- // ------------------
2781
- /**
2782
- * Backface Visibility
2783
- * @see https://tailwindcss.com/docs/backface-visibility
2784
- */
2785
- backface: [{
2786
- backface: ['hidden', 'visible']
2787
- }],
2788
- /**
2789
- * Perspective
2790
- * @see https://tailwindcss.com/docs/perspective
2791
- */
2792
- perspective: [{
2793
- perspective: [themePerspective, isArbitraryVariable, isArbitraryValue]
2794
- }],
2795
- /**
2796
- * Perspective Origin
2797
- * @see https://tailwindcss.com/docs/perspective-origin
2798
- */
2799
- 'perspective-origin': [{
2800
- 'perspective-origin': scaleOrigin()
2801
- }],
2802
- /**
2803
- * Rotate
2804
- * @see https://tailwindcss.com/docs/rotate
2805
- */
2806
- rotate: [{
2807
- rotate: scaleRotate()
2808
- }],
2809
- /**
2810
- * Rotate X
2811
- * @see https://tailwindcss.com/docs/rotate
2812
- */
2813
- 'rotate-x': [{
2814
- 'rotate-x': scaleRotate()
2815
- }],
2816
- /**
2817
- * Rotate Y
2818
- * @see https://tailwindcss.com/docs/rotate
2819
- */
2820
- 'rotate-y': [{
2821
- 'rotate-y': scaleRotate()
2822
- }],
2823
- /**
2824
- * Rotate Z
2825
- * @see https://tailwindcss.com/docs/rotate
2826
- */
2827
- 'rotate-z': [{
2828
- 'rotate-z': scaleRotate()
2829
- }],
2830
- /**
2831
- * Scale
2832
- * @see https://tailwindcss.com/docs/scale
2833
- */
2834
- scale: [{
2835
- scale: scaleScale()
2836
- }],
2837
- /**
2838
- * Scale X
2839
- * @see https://tailwindcss.com/docs/scale
2840
- */
2841
- 'scale-x': [{
2842
- 'scale-x': scaleScale()
2843
- }],
2844
- /**
2845
- * Scale Y
2846
- * @see https://tailwindcss.com/docs/scale
2847
- */
2848
- 'scale-y': [{
2849
- 'scale-y': scaleScale()
2850
- }],
2851
- /**
2852
- * Scale Z
2853
- * @see https://tailwindcss.com/docs/scale
2854
- */
2855
- 'scale-z': [{
2856
- 'scale-z': scaleScale()
2857
- }],
2858
- /**
2859
- * Scale 3D
2860
- * @see https://tailwindcss.com/docs/scale
2861
- */
2862
- 'scale-3d': ['scale-3d'],
2863
- /**
2864
- * Skew
2865
- * @see https://tailwindcss.com/docs/skew
2866
- */
2867
- skew: [{
2868
- skew: scaleSkew()
2869
- }],
2870
- /**
2871
- * Skew X
2872
- * @see https://tailwindcss.com/docs/skew
2873
- */
2874
- 'skew-x': [{
2875
- 'skew-x': scaleSkew()
2876
- }],
2877
- /**
2878
- * Skew Y
2879
- * @see https://tailwindcss.com/docs/skew
2880
- */
2881
- 'skew-y': [{
2882
- 'skew-y': scaleSkew()
2883
- }],
2884
- /**
2885
- * Transform
2886
- * @see https://tailwindcss.com/docs/transform
2887
- */
2888
- transform: [{
2889
- transform: [isArbitraryVariable, isArbitraryValue, '', 'none', 'gpu', 'cpu']
2890
- }],
2891
- /**
2892
- * Transform Origin
2893
- * @see https://tailwindcss.com/docs/transform-origin
2894
- */
2895
- 'transform-origin': [{
2896
- origin: scaleOrigin()
2897
- }],
2898
- /**
2899
- * Transform Style
2900
- * @see https://tailwindcss.com/docs/transform-style
2901
- */
2902
- 'transform-style': [{
2903
- transform: ['3d', 'flat']
2904
- }],
2905
- /**
2906
- * Translate
2907
- * @see https://tailwindcss.com/docs/translate
2908
- */
2909
- translate: [{
2910
- translate: scaleTranslate()
2911
- }],
2912
- /**
2913
- * Translate X
2914
- * @see https://tailwindcss.com/docs/translate
2915
- */
2916
- 'translate-x': [{
2917
- 'translate-x': scaleTranslate()
2918
- }],
2919
- /**
2920
- * Translate Y
2921
- * @see https://tailwindcss.com/docs/translate
2922
- */
2923
- 'translate-y': [{
2924
- 'translate-y': scaleTranslate()
2925
- }],
2926
- /**
2927
- * Translate Z
2928
- * @see https://tailwindcss.com/docs/translate
2929
- */
2930
- 'translate-z': [{
2931
- 'translate-z': scaleTranslate()
2932
- }],
2933
- /**
2934
- * Translate None
2935
- * @see https://tailwindcss.com/docs/translate
2936
- */
2937
- 'translate-none': ['translate-none'],
2938
- // ---------------------
2939
- // --- Interactivity ---
2940
- // ---------------------
2941
- /**
2942
- * Accent Color
2943
- * @see https://tailwindcss.com/docs/accent-color
2944
- */
2945
- accent: [{
2946
- accent: scaleColor()
2947
- }],
2948
- /**
2949
- * Appearance
2950
- * @see https://tailwindcss.com/docs/appearance
2951
- */
2952
- appearance: [{
2953
- appearance: ['none', 'auto']
2954
- }],
2955
- /**
2956
- * Caret Color
2957
- * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
2958
- */
2959
- 'caret-color': [{
2960
- caret: scaleColor()
2961
- }],
2962
- /**
2963
- * Color Scheme
2964
- * @see https://tailwindcss.com/docs/color-scheme
2965
- */
2966
- 'color-scheme': [{
2967
- scheme: ['normal', 'dark', 'light', 'light-dark', 'only-dark', 'only-light']
2968
- }],
2969
- /**
2970
- * Cursor
2971
- * @see https://tailwindcss.com/docs/cursor
2972
- */
2973
- cursor: [{
2974
- cursor: ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'help', 'not-allowed', 'none', 'context-menu', 'progress', 'cell', 'crosshair', 'vertical-text', 'alias', 'copy', 'no-drop', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', isArbitraryVariable, isArbitraryValue]
2975
- }],
2976
- /**
2977
- * Field Sizing
2978
- * @see https://tailwindcss.com/docs/field-sizing
2979
- */
2980
- 'field-sizing': [{
2981
- 'field-sizing': ['fixed', 'content']
2982
- }],
2983
- /**
2984
- * Pointer Events
2985
- * @see https://tailwindcss.com/docs/pointer-events
2986
- */
2987
- 'pointer-events': [{
2988
- 'pointer-events': ['auto', 'none']
2989
- }],
2990
- /**
2991
- * Resize
2992
- * @see https://tailwindcss.com/docs/resize
2993
- */
2994
- resize: [{
2995
- resize: ['none', '', 'y', 'x']
2996
- }],
2997
- /**
2998
- * Scroll Behavior
2999
- * @see https://tailwindcss.com/docs/scroll-behavior
3000
- */
3001
- 'scroll-behavior': [{
3002
- scroll: ['auto', 'smooth']
3003
- }],
3004
- /**
3005
- * Scroll Margin
3006
- * @see https://tailwindcss.com/docs/scroll-margin
3007
- */
3008
- 'scroll-m': [{
3009
- 'scroll-m': scaleUnambiguousSpacing()
3010
- }],
3011
- /**
3012
- * Scroll Margin X
3013
- * @see https://tailwindcss.com/docs/scroll-margin
3014
- */
3015
- 'scroll-mx': [{
3016
- 'scroll-mx': scaleUnambiguousSpacing()
3017
- }],
3018
- /**
3019
- * Scroll Margin Y
3020
- * @see https://tailwindcss.com/docs/scroll-margin
3021
- */
3022
- 'scroll-my': [{
3023
- 'scroll-my': scaleUnambiguousSpacing()
3024
- }],
3025
- /**
3026
- * Scroll Margin Start
3027
- * @see https://tailwindcss.com/docs/scroll-margin
3028
- */
3029
- 'scroll-ms': [{
3030
- 'scroll-ms': scaleUnambiguousSpacing()
3031
- }],
3032
- /**
3033
- * Scroll Margin End
3034
- * @see https://tailwindcss.com/docs/scroll-margin
3035
- */
3036
- 'scroll-me': [{
3037
- 'scroll-me': scaleUnambiguousSpacing()
3038
- }],
3039
- /**
3040
- * Scroll Margin Top
3041
- * @see https://tailwindcss.com/docs/scroll-margin
3042
- */
3043
- 'scroll-mt': [{
3044
- 'scroll-mt': scaleUnambiguousSpacing()
3045
- }],
3046
- /**
3047
- * Scroll Margin Right
3048
- * @see https://tailwindcss.com/docs/scroll-margin
3049
- */
3050
- 'scroll-mr': [{
3051
- 'scroll-mr': scaleUnambiguousSpacing()
3052
- }],
3053
- /**
3054
- * Scroll Margin Bottom
3055
- * @see https://tailwindcss.com/docs/scroll-margin
3056
- */
3057
- 'scroll-mb': [{
3058
- 'scroll-mb': scaleUnambiguousSpacing()
3059
- }],
3060
- /**
3061
- * Scroll Margin Left
3062
- * @see https://tailwindcss.com/docs/scroll-margin
3063
- */
3064
- 'scroll-ml': [{
3065
- 'scroll-ml': scaleUnambiguousSpacing()
3066
- }],
3067
- /**
3068
- * Scroll Padding
3069
- * @see https://tailwindcss.com/docs/scroll-padding
3070
- */
3071
- 'scroll-p': [{
3072
- 'scroll-p': scaleUnambiguousSpacing()
3073
- }],
3074
- /**
3075
- * Scroll Padding X
3076
- * @see https://tailwindcss.com/docs/scroll-padding
3077
- */
3078
- 'scroll-px': [{
3079
- 'scroll-px': scaleUnambiguousSpacing()
3080
- }],
3081
- /**
3082
- * Scroll Padding Y
3083
- * @see https://tailwindcss.com/docs/scroll-padding
3084
- */
3085
- 'scroll-py': [{
3086
- 'scroll-py': scaleUnambiguousSpacing()
3087
- }],
3088
- /**
3089
- * Scroll Padding Start
3090
- * @see https://tailwindcss.com/docs/scroll-padding
3091
- */
3092
- 'scroll-ps': [{
3093
- 'scroll-ps': scaleUnambiguousSpacing()
3094
- }],
3095
- /**
3096
- * Scroll Padding End
3097
- * @see https://tailwindcss.com/docs/scroll-padding
3098
- */
3099
- 'scroll-pe': [{
3100
- 'scroll-pe': scaleUnambiguousSpacing()
3101
- }],
3102
- /**
3103
- * Scroll Padding Top
3104
- * @see https://tailwindcss.com/docs/scroll-padding
3105
- */
3106
- 'scroll-pt': [{
3107
- 'scroll-pt': scaleUnambiguousSpacing()
3108
- }],
3109
- /**
3110
- * Scroll Padding Right
3111
- * @see https://tailwindcss.com/docs/scroll-padding
3112
- */
3113
- 'scroll-pr': [{
3114
- 'scroll-pr': scaleUnambiguousSpacing()
3115
- }],
3116
- /**
3117
- * Scroll Padding Bottom
3118
- * @see https://tailwindcss.com/docs/scroll-padding
3119
- */
3120
- 'scroll-pb': [{
3121
- 'scroll-pb': scaleUnambiguousSpacing()
3122
- }],
3123
- /**
3124
- * Scroll Padding Left
3125
- * @see https://tailwindcss.com/docs/scroll-padding
3126
- */
3127
- 'scroll-pl': [{
3128
- 'scroll-pl': scaleUnambiguousSpacing()
3129
- }],
3130
- /**
3131
- * Scroll Snap Align
3132
- * @see https://tailwindcss.com/docs/scroll-snap-align
3133
- */
3134
- 'snap-align': [{
3135
- snap: ['start', 'end', 'center', 'align-none']
3136
- }],
3137
- /**
3138
- * Scroll Snap Stop
3139
- * @see https://tailwindcss.com/docs/scroll-snap-stop
3140
- */
3141
- 'snap-stop': [{
3142
- snap: ['normal', 'always']
3143
- }],
3144
- /**
3145
- * Scroll Snap Type
3146
- * @see https://tailwindcss.com/docs/scroll-snap-type
3147
- */
3148
- 'snap-type': [{
3149
- snap: ['none', 'x', 'y', 'both']
3150
- }],
3151
- /**
3152
- * Scroll Snap Type Strictness
3153
- * @see https://tailwindcss.com/docs/scroll-snap-type
3154
- */
3155
- 'snap-strictness': [{
3156
- snap: ['mandatory', 'proximity']
3157
- }],
3158
- /**
3159
- * Touch Action
3160
- * @see https://tailwindcss.com/docs/touch-action
3161
- */
3162
- touch: [{
3163
- touch: ['auto', 'none', 'manipulation']
3164
- }],
3165
- /**
3166
- * Touch Action X
3167
- * @see https://tailwindcss.com/docs/touch-action
3168
- */
3169
- 'touch-x': [{
3170
- 'touch-pan': ['x', 'left', 'right']
3171
- }],
3172
- /**
3173
- * Touch Action Y
3174
- * @see https://tailwindcss.com/docs/touch-action
3175
- */
3176
- 'touch-y': [{
3177
- 'touch-pan': ['y', 'up', 'down']
3178
- }],
3179
- /**
3180
- * Touch Action Pinch Zoom
3181
- * @see https://tailwindcss.com/docs/touch-action
3182
- */
3183
- 'touch-pz': ['touch-pinch-zoom'],
3184
- /**
3185
- * User Select
3186
- * @see https://tailwindcss.com/docs/user-select
3187
- */
3188
- select: [{
3189
- select: ['none', 'text', 'all', 'auto']
3190
- }],
3191
- /**
3192
- * Will Change
3193
- * @see https://tailwindcss.com/docs/will-change
3194
- */
3195
- 'will-change': [{
3196
- 'will-change': ['auto', 'scroll', 'contents', 'transform', isArbitraryVariable, isArbitraryValue]
3197
- }],
3198
- // -----------
3199
- // --- SVG ---
3200
- // -----------
3201
- /**
3202
- * Fill
3203
- * @see https://tailwindcss.com/docs/fill
3204
- */
3205
- fill: [{
3206
- fill: ['none', ...scaleColor()]
3207
- }],
3208
- /**
3209
- * Stroke Width
3210
- * @see https://tailwindcss.com/docs/stroke-width
3211
- */
3212
- 'stroke-w': [{
3213
- stroke: [isNumber, isArbitraryVariableLength, isArbitraryLength, isArbitraryNumber]
3214
- }],
3215
- /**
3216
- * Stroke
3217
- * @see https://tailwindcss.com/docs/stroke
3218
- */
3219
- stroke: [{
3220
- stroke: ['none', ...scaleColor()]
3221
- }],
3222
- // ---------------------
3223
- // --- Accessibility ---
3224
- // ---------------------
3225
- /**
3226
- * Forced Color Adjust
3227
- * @see https://tailwindcss.com/docs/forced-color-adjust
3228
- */
3229
- 'forced-color-adjust': [{
3230
- 'forced-color-adjust': ['auto', 'none']
3231
- }]
3232
- },
3233
- conflictingClassGroups: {
3234
- overflow: ['overflow-x', 'overflow-y'],
3235
- overscroll: ['overscroll-x', 'overscroll-y'],
3236
- inset: ['inset-x', 'inset-y', 'start', 'end', 'top', 'right', 'bottom', 'left'],
3237
- 'inset-x': ['right', 'left'],
3238
- 'inset-y': ['top', 'bottom'],
3239
- flex: ['basis', 'grow', 'shrink'],
3240
- gap: ['gap-x', 'gap-y'],
3241
- p: ['px', 'py', 'ps', 'pe', 'pt', 'pr', 'pb', 'pl'],
3242
- px: ['pr', 'pl'],
3243
- py: ['pt', 'pb'],
3244
- m: ['mx', 'my', 'ms', 'me', 'mt', 'mr', 'mb', 'ml'],
3245
- mx: ['mr', 'ml'],
3246
- my: ['mt', 'mb'],
3247
- size: ['w', 'h'],
3248
- 'font-size': ['leading'],
3249
- 'fvn-normal': ['fvn-ordinal', 'fvn-slashed-zero', 'fvn-figure', 'fvn-spacing', 'fvn-fraction'],
3250
- 'fvn-ordinal': ['fvn-normal'],
3251
- 'fvn-slashed-zero': ['fvn-normal'],
3252
- 'fvn-figure': ['fvn-normal'],
3253
- 'fvn-spacing': ['fvn-normal'],
3254
- 'fvn-fraction': ['fvn-normal'],
3255
- 'line-clamp': ['display', 'overflow'],
3256
- rounded: ['rounded-s', 'rounded-e', 'rounded-t', 'rounded-r', 'rounded-b', 'rounded-l', 'rounded-ss', 'rounded-se', 'rounded-ee', 'rounded-es', 'rounded-tl', 'rounded-tr', 'rounded-br', 'rounded-bl'],
3257
- 'rounded-s': ['rounded-ss', 'rounded-es'],
3258
- 'rounded-e': ['rounded-se', 'rounded-ee'],
3259
- 'rounded-t': ['rounded-tl', 'rounded-tr'],
3260
- 'rounded-r': ['rounded-tr', 'rounded-br'],
3261
- 'rounded-b': ['rounded-br', 'rounded-bl'],
3262
- 'rounded-l': ['rounded-tl', 'rounded-bl'],
3263
- 'border-spacing': ['border-spacing-x', 'border-spacing-y'],
3264
- 'border-w': ['border-w-s', 'border-w-e', 'border-w-t', 'border-w-r', 'border-w-b', 'border-w-l'],
3265
- 'border-w-x': ['border-w-r', 'border-w-l'],
3266
- 'border-w-y': ['border-w-t', 'border-w-b'],
3267
- 'border-color': ['border-color-s', 'border-color-e', 'border-color-t', 'border-color-r', 'border-color-b', 'border-color-l'],
3268
- 'border-color-x': ['border-color-r', 'border-color-l'],
3269
- 'border-color-y': ['border-color-t', 'border-color-b'],
3270
- translate: ['translate-x', 'translate-y', 'translate-none'],
3271
- 'translate-none': ['translate', 'translate-x', 'translate-y', 'translate-z'],
3272
- 'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-ms', 'scroll-me', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'],
3273
- 'scroll-mx': ['scroll-mr', 'scroll-ml'],
3274
- 'scroll-my': ['scroll-mt', 'scroll-mb'],
3275
- 'scroll-p': ['scroll-px', 'scroll-py', 'scroll-ps', 'scroll-pe', 'scroll-pt', 'scroll-pr', 'scroll-pb', 'scroll-pl'],
3276
- 'scroll-px': ['scroll-pr', 'scroll-pl'],
3277
- 'scroll-py': ['scroll-pt', 'scroll-pb'],
3278
- touch: ['touch-x', 'touch-y', 'touch-pz'],
3279
- 'touch-x': ['touch'],
3280
- 'touch-y': ['touch'],
3281
- 'touch-pz': ['touch']
3282
- },
3283
- conflictingClassGroupModifiers: {
3284
- 'font-size': ['leading']
3285
- },
3286
- orderSensitiveModifiers: ['before', 'after', 'placeholder', 'file', 'marker', 'selection', 'first-line', 'first-letter', 'backdrop', '*', '**']
3287
- };
3288
- };
3289
- const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
3290
-
3291
- class ComponentTheme {
3292
- constructor(tag, base, subThemes, defaults = {}) {
3293
- this.tag = tag;
3294
- this.base = base;
3295
- this.defaults = defaults;
3296
- const defaultInternalThemes = {
3297
- layout: {
3298
- hide: new HideTheme(),
3299
- items: new ItemsTheme(),
3300
- justify: new JustifyTheme(),
3301
- position: new PositionTheme(),
3302
- display: new DisplayTheme()
3303
- },
3304
- typography: {
3305
- fontFamily: new FontFamilyTheme(),
3306
- fontWeight: new FontWeightTheme(),
3307
- fontStyle: new FontStyleTheme(),
3308
- textDecoration: new TextDecorationTheme(),
3309
- textTransform: new TextTransformTheme(),
3310
- textAlign: new TextAlignTheme()
3311
- }
3312
- };
3313
- this.themes = deepMerge(defaultInternalThemes, subThemes);
3314
- }
3315
- getClasses(props, defaults = this.defaults) {
3316
- const user = props;
3317
- const defs = defaults;
3318
- const classes = [];
3319
- if (this.base) {
3320
- classes.push(...this.base.split(/\s+/));
3321
- }
3322
- const walk = (map) => {
3323
- for (const key of Object.keys(map)) {
3324
- const node = map[key];
3325
- if (node instanceof BaseTheme) {
3326
- classes.push(...node.getClasses(user, defs));
3327
- }
3328
- else if (node && typeof node === "object" && !Array.isArray(node)) {
3329
- walk(node);
3330
- }
3331
- }
3332
- };
3333
- walk(this.themes);
3334
- return classes.filter(Boolean);
3335
- }
3336
- getComponentConfig(props, propsToOmit = []) {
3337
- var _a;
3338
- const cleanProps = { ...props };
3339
- for (const k of propsToOmit) {
3340
- delete cleanProps[k];
3341
- }
3342
- const { className, tag, ...other } = cleanProps;
3343
- const componentTag = (_a = tag !== null && tag !== void 0 ? tag : this.tag) !== null && _a !== void 0 ? _a : "div";
3344
- const themeGeneratedClasses = this.getClasses(props);
3345
- const finalClasses = twMerge(...themeGeneratedClasses, className);
3346
- return {
3347
- Tag: componentTag,
3348
- finalClasses,
3349
- finalProps: other,
3350
- };
3351
- }
3352
- }
3353
-
3354
- class SizeTheme extends BaseTheme {
3355
- constructor(initial) {
3356
- super();
3357
- SIZE_KEYS.forEach((key) => {
3358
- var _a;
3359
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : SizeTheme.defaultClasses[key];
3360
- });
3361
- }
3362
- getClasses(props, defaults) {
3363
- const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS);
3364
- return [this[size !== null && size !== void 0 ? size : 'md'] || ''];
3365
- }
3366
- }
3367
- SizeTheme.defaultClasses = {
3368
- xs: '',
3369
- sm: '',
3370
- md: '',
3371
- lg: '',
3372
- xl: ''
3373
- };
3374
-
3375
- class GapTheme extends BaseTheme {
3376
- constructor(initial) {
3377
- super();
3378
- GAP_KEYS.forEach((key) => {
3379
- var _a;
3380
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : GapTheme.defaultClasses[key];
3381
- });
3382
- }
3383
- getClasses(props, defaults) {
3384
- const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
3385
- const key = pickFirstTruthyKey(props, defaults, GAP_KEYS) || 'noGap';
3386
- return [typeof this[key] === 'string' ? this[key] : this[key][size]];
3387
- }
3388
- }
3389
- GapTheme.defaultClasses = {
3390
- gap: {
3391
- xs: 'gap-2',
3392
- sm: 'gap-3',
3393
- md: 'gap-4',
3394
- lg: 'gap-5',
3395
- xl: 'gap-6',
3396
- },
3397
- noGap: "gap-0"
3398
- };
3399
-
3400
- class RadiusTheme extends BaseTheme {
3401
- constructor(initial) {
3402
- super();
3403
- SHAPE_KEYS.forEach((key) => {
3404
- var _a;
3405
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : RadiusTheme.defaultClasses[key];
3406
- });
3407
- }
3408
- getClasses(props, defaults) {
3409
- const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
3410
- const shape = pickFirstTruthyKey(props, defaults, SHAPE_KEYS) || 'rounded';
3411
- return [typeof this[shape] === 'string' ? this[shape] : this[shape][size]];
3412
- }
3413
- }
3414
- RadiusTheme.defaultClasses = {
3415
- pill: "rounded-full",
3416
- sharp: "rounded-none",
3417
- rounded: {
3418
- xs: "rounded-sm",
3419
- sm: "rounded-md",
3420
- md: "rounded-lg",
3421
- lg: "rounded-xl",
3422
- xl: "rounded-2xl",
3423
- }
3424
- };
3425
-
3426
- class ShadowTheme extends BaseTheme {
3427
- constructor(initial) {
3428
- super();
3429
- SHADOW_KEYS.forEach((key) => {
3430
- var _a;
3431
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowTheme.defaultClasses[key];
3432
- });
3433
- }
3434
- getClasses(props, defaults) {
3435
- const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
3436
- const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
3437
- if (key === undefined) {
3438
- return [];
3439
- }
3440
- const isModeStringMap = MODE_KEYS.every(m => typeof this[key][m] === "string");
3441
- return MODE_KEYS.map(mode => isModeStringMap
3442
- ? this[key][mode]
3443
- : this[key][mode][size]);
3444
- }
3445
- }
3446
- ShadowTheme.defaultClasses = {
3447
- shadow: {
3448
- base: {
3449
- xs: "shadow-2xs",
3450
- sm: "shadow-xs",
3451
- md: "shadow-sm",
3452
- lg: "shadow-md",
3453
- xl: "shadow-lg"
3454
- },
3455
- hover: {
3456
- xs: "hover:shadow-xs",
3457
- sm: "hover:shadow-sm",
3458
- md: "hover:shadow-md",
3459
- lg: "hover:shadow-lg",
3460
- xl: "hover:shadow-xl"
3461
- },
3462
- active: {
3463
- xs: "active:shadow-xs",
3464
- sm: "active:shadow-sm",
3465
- md: "active:shadow-md",
3466
- lg: "active:shadow-lg",
3467
- xl: "active:shadow-xl"
3468
- },
3469
- },
3470
- noShadow: {
3471
- base: "shadow-none",
3472
- hover: "hover:shadow-none",
3473
- active: "active:shadow-none",
3474
- }
3475
- };
3476
-
3477
- class BorderTheme extends BaseTheme {
3478
- constructor(initial) {
3479
- super();
3480
- BORDER_KEYS.forEach((key) => {
3481
- this[key] = {
3482
- ...BorderTheme.defaultClasses[key],
3483
- ...((initial === null || initial === void 0 ? void 0 : initial[key]) || {}),
3484
- };
3485
- });
3486
- }
3487
- getClasses(props, defaults) {
3488
- const key = pickFirstTruthyKey(props, defaults, BORDER_KEYS);
3489
- if (!key || !this[key]) {
3490
- return MODE_KEYS.map(() => '');
3491
- }
3492
- return MODE_KEYS.map(mode => this[key][mode] || '');
3493
- }
3494
- }
3495
- BorderTheme.defaultClasses = {
3496
- border: {
3497
- base: "border",
3498
- hover: "hover:border",
3499
- active: "active:border",
3500
- },
3501
- noBorder: {
3502
- base: "",
3503
- hover: "",
3504
- active: "",
3505
- },
3506
- //noBorder: {
3507
- // base: "border-none",
3508
- // hover: "hover:border-none",
3509
- // active: "active:border-none",
3510
- //},
3511
- };
3512
-
3513
- class RingTheme extends BaseTheme {
3514
- constructor(initial) {
3515
- super();
3516
- RING_KEYS.forEach((key) => {
3517
- this[key] = {
3518
- ...RingTheme.defaultClasses[key],
3519
- ...((initial === null || initial === void 0 ? void 0 : initial[key]) || {}),
3520
- };
3521
- });
3522
- }
3523
- getClasses(props, defaults) {
3524
- const key = pickFirstTruthyKey(props, defaults, RING_KEYS);
3525
- if (!key || !this[key]) {
3526
- return MODE_KEYS.map(() => '');
3527
- }
3528
- return MODE_KEYS.map(mode => this[key][mode] || '');
3529
- }
3530
- }
3531
- RingTheme.defaultClasses = {
3532
- ring: {
3533
- base: "ring ring-inset",
3534
- hover: "hover:ring hover:ring-inset",
3535
- active: "active:ring active:ring-inset",
3536
- },
3537
- noRing: {
3538
- base: "ring-0",
3539
- hover: "hover:ring-0",
3540
- active: "active:ring-0",
3541
- },
3542
- };
3543
-
3544
- class PxTheme extends BaseTheme {
3545
- constructor(initial) {
3546
- super();
3547
- PADDING_KEYS.forEach((key) => {
3548
- var _a;
3549
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : PxTheme.defaultClasses[key];
3550
- });
3551
- }
3552
- getClasses(props, defaults) {
3553
- const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
3554
- const key = pickFirstTruthyKey(props, defaults, PADDING_KEYS) || 'noPadding';
3555
- return [typeof this[key] === 'string' ? this[key] : this[key][size]];
3556
- }
3557
- }
3558
- PxTheme.defaultClasses = {
3559
- padding: {
3560
- xs: "px-2",
3561
- sm: "px-4",
3562
- md: "px-6",
3563
- lg: "px-8",
3564
- xl: "px-10"
3565
- },
3566
- noPadding: "px-0"
3567
- };
3568
-
3569
- class PyTheme extends BaseTheme {
3570
- constructor(initial) {
3571
- super();
3572
- PADDING_KEYS.forEach((key) => {
3573
- var _a;
3574
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : PyTheme.defaultClasses[key];
3575
- });
3576
- }
3577
- getClasses(props, defaults) {
3578
- const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
3579
- const key = pickFirstTruthyKey(props, defaults, PADDING_KEYS) || 'noPadding';
3580
- return [typeof this[key] === 'string' ? this[key] : this[key][size]];
3581
- }
3582
- }
3583
- PyTheme.defaultClasses = {
3584
- padding: {
3585
- xs: "py-2",
3586
- sm: "py-4",
3587
- md: "py-6",
3588
- lg: "py-8",
3589
- xl: "py-10"
3590
- },
3591
- noPadding: "py-0"
3592
- };
3593
-
3594
- class TextAppearanceTheme extends BaseTheme {
3595
- constructor(initialOverrides) {
3596
- super();
3597
- TEXT_APPEARANCE_KEYS.forEach((textKey) => {
3598
- const defaultModesForKey = TextAppearanceTheme.defaultFullConfig[textKey];
3599
- const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
3600
- this[textKey] = {
3601
- ...defaultModesForKey,
3602
- ...(overrideModesForKey || {}),
3603
- };
3604
- });
3605
- }
3606
- getClasses(props, defaults) {
3607
- const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
3608
- const modesForAppearance = this[pickedAppearanceKey];
3609
- if (!modesForAppearance) {
3610
- return MODE_KEYS.map(() => '');
3611
- }
3612
- return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
3613
- }
3614
- static createDefaultStyle(src = {}) {
3615
- const initialOverridesForConstructor = {};
3616
- TEXT_APPEARANCE_KEYS.forEach((textKey) => {
3617
- const modesForCurrentTextKey = {};
3618
- let keyHasDataInSrc = false;
3619
- MODE_KEYS.forEach((modeKey) => {
3620
- var _a;
3621
- const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
3622
- if (classValue !== undefined) {
3623
- modesForCurrentTextKey[modeKey] = classValue;
3624
- keyHasDataInSrc = true;
3625
- }
3626
- });
3627
- if (keyHasDataInSrc) {
3628
- initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
3629
- }
3630
- });
3631
- return new TextAppearanceTheme(initialOverridesForConstructor);
3632
- }
3633
- }
3634
- TextAppearanceTheme.defaultFullConfig = (() => {
3635
- const config = {};
3636
- TEXT_APPEARANCE_KEYS.forEach((key) => {
3637
- config[key] = {
3638
- base: textAppearanceClasses[key] || '',
3639
- hover: '',
3640
- active: '',
3641
- };
3642
- });
3643
- return config;
3644
- })();
3645
-
3646
- // Background classes for filled buttons
3647
- const filledBackgroundAppearanceClasses = {
3648
- default: "bg-(--filled-background-color-default)",
3649
- primary: "bg-(--filled-background-color-primary)",
3650
- secondary: "bg-(--filled-background-color-secondary)",
3651
- tertiary: "bg-(--filled-background-color-tertiary)",
3652
- accent: "bg-(--filled-background-color-accent)",
3653
- success: "bg-(--filled-background-color-success)",
3654
- danger: "bg-(--filled-background-color-danger)",
3655
- warning: "bg-(--filled-background-color-warning)",
3656
- info: "bg-(--filled-background-color-info)",
3657
- transparent: "bg-transparent",
3658
- muted: "bg-(--filled-background-color-muted)",
3659
- link: "bg-(--filled-background-color-link)",
3660
- };
3661
- // Hover background classes for filled buttons
3662
- const filledHoverBackgroundAppearanceClasses = {
3663
- default: "hover:bg-(--filled-background-color-hover-default)",
3664
- primary: "hover:bg-(--filled-background-color-hover-primary)",
3665
- secondary: "hover:bg-(--filled-background-color-hover-secondary)",
3666
- tertiary: "hover:bg-(--filled-background-color-hover-tertiary)",
3667
- accent: "hover:bg-(--filled-background-color-hover-accent)",
3668
- success: "hover:bg-(--filled-background-color-hover-success)",
3669
- danger: "hover:bg-(--filled-background-color-hover-danger)",
3670
- warning: "hover:bg-(--filled-background-color-hover-warning)",
3671
- info: "hover:bg-(--filled-background-color-hover-info)",
3672
- transparent: "hover:bg-transparent",
3673
- muted: "hover:bg-(--filled-background-color-hover-muted)",
3674
- link: "hover:bg-(--filled-background-color-hover-link)",
3675
- };
3676
- // Active background classes for filled buttons
3677
- const filledActiveBackgroundAppearanceClasses = {
3678
- default: "active:bg-(--filled-background-color-active-default)",
3679
- primary: "active:bg-(--filled-background-color-active-primary)",
3680
- secondary: "active:bg-(--filled-background-color-active-secondary)",
3681
- tertiary: "active:bg-(--filled-background-color-active-tertiary)",
3682
- accent: "active:bg-(--filled-background-color-active-accent)",
3683
- success: "active:bg-(--filled-background-color-active-success)",
3684
- danger: "active:bg-(--filled-background-color-active-danger)",
3685
- warning: "active:bg-(--filled-background-color-active-warning)",
3686
- info: "active:bg-(--filled-background-color-active-info)",
3687
- transparent: "active:bg-transparent",
3688
- muted: "active:bg-(--filled-background-color-active-muted)",
3689
- link: "active:bg-(--filled-background-color-active-link)",
3690
- };
3691
- // Default background appearance classes (for non-button components)
3692
- const backgroundAppearanceClasses = {
3693
- default: "bg-(--background-color-default)",
3694
- primary: "bg-(--background-color-primary)",
3695
- secondary: "bg-(--background-color-secondary)",
3696
- tertiary: "bg-(--background-color-tertiary)",
3697
- accent: "bg-(--background-color-accent)",
3698
- success: "bg-(--background-color-success)",
3699
- danger: "bg-(--background-color-danger)",
3700
- warning: "bg-(--background-color-warning)",
3701
- info: "bg-(--background-color-info)",
3702
- transparent: "bg-transparent",
3703
- muted: "bg-(--background-color-muted)",
3704
- link: "bg-(--background-color-link)",
3705
- };
3706
- // Hover background appearance classes for outline buttons
3707
- const hoverBackgroundAppearanceClasses = {
3708
- default: "hover:bg-(--background-color-hover-default)",
3709
- primary: "hover:bg-(--background-color-hover-primary)",
3710
- secondary: "hover:bg-(--background-color-hover-secondary)",
3711
- tertiary: "hover:bg-(--background-color-hover-tertiary)",
3712
- accent: "hover:bg-(--background-color-hover-accent)",
3713
- success: "hover:bg-(--background-color-hover-success)",
3714
- danger: "hover:bg-(--background-color-hover-danger)",
3715
- warning: "hover:bg-(--background-color-hover-warning)",
3716
- info: "hover:bg-(--background-color-hover-info)",
3717
- transparent: "hover:bg-transparent",
3718
- muted: "hover:bg-(--background-color-hover-muted)",
3719
- link: "hover:bg-(--background-color-hover-link)",
3720
- };
3721
- // Active background appearance classes for outline buttons
3722
- const activeBackgroundAppearanceClasses = {
3723
- default: "active:bg-(--background-color-active-default)",
3724
- primary: "active:bg-(--background-color-active-primary)",
3725
- secondary: "active:bg-(--background-color-active-secondary)",
3726
- tertiary: "active:bg-(--background-color-active-tertiary)",
3727
- accent: "active:bg-(--background-color-active-accent)",
3728
- success: "active:bg-(--background-color-active-success)",
3729
- danger: "active:bg-(--background-color-active-danger)",
3730
- warning: "active:bg-(--background-color-active-warning)",
3731
- info: "active:bg-(--background-color-active-info)",
3732
- transparent: "active:bg-transparent",
3733
- muted: "active:bg-(--background-color-active-muted)",
3734
- link: "active:bg-(--background-color-active-link)",
3735
- };
3736
- const layoutBackgroundAppearanceClasses = {
3737
- default: "bg-(--layout-background-default)",
3738
- primary: "bg-(--layout-background-primary)",
3739
- secondary: "bg-(--layout-background-secondary)",
3740
- tertiary: "bg-(--layout-background-tertiary)",
3741
- accent: "bg-(--layout-background-accent)",
3742
- success: "bg-(--layout-background-success)",
3743
- danger: "bg-(--layout-background-danger)",
3744
- warning: "bg-(--layout-background-warning)",
3745
- info: "bg-(--layout-background-info)",
3746
- transparent: "bg-transparent",
3747
- };
3748
- const bgBorderAppearanceClasses = {
3749
- default: "bg-(--border-color-default)",
3750
- primary: "bg-(--border-color-primary)",
3751
- secondary: "bg-(--border-color-secondary)",
3752
- tertiary: "bg-(--border-color-tertiary)",
3753
- accent: "bg-(--border-color-accent)",
3754
- success: "bg-(--border-color-success)",
3755
- danger: "bg-(--border-color-danger)",
3756
- warning: "bg-(--border-color-warning)",
3757
- info: "bg-(--border-color-info)",
3758
- transparent: "bg-transparent",
3759
- muted: "bg-(--border-color-muted)",
3760
- link: "bg-(--border-color-link)",
3761
- };
3762
- const borderAppearanceClasses = {
3763
- default: "border-(--border-color-default)",
3764
- primary: "border-(--border-color-primary)",
3765
- secondary: "border-(--border-color-secondary)",
3766
- tertiary: "border-(--border-color-tertiary)",
3767
- accent: "border-(--border-color-accent)",
3768
- success: "border-(--border-color-success)",
3769
- danger: "border-(--border-color-danger)",
3770
- warning: "border-(--border-color-warning)",
3771
- info: "border-(--border-color-info)",
3772
- transparent: "border-transparent",
3773
- muted: "border-(--border-color-muted)",
3774
- link: "border-(--border-color-link)",
3775
- };
3776
- // Border classes for filled elements
3777
- const filledBorderAppearanceClasses = {
3778
- default: "border-(--filled-border-color-default)",
3779
- primary: "border-(--filled-border-color-primary)",
3780
- secondary: "border-(--filled-border-color-secondary)",
3781
- tertiary: "border-(--filled-border-color-tertiary)",
3782
- accent: "border-(--filled-border-color-accent)",
3783
- success: "border-(--filled-border-color-success)",
3784
- danger: "border-(--filled-border-color-danger)",
3785
- warning: "border-(--filled-border-color-warning)",
3786
- info: "border-(--filled-border-color-info)",
3787
- transparent: "border-transparent",
3788
- muted: "border-(--filled-border-color-muted)",
3789
- link: "border-(--filled-border-color-link)",
3790
- };
3791
- const ringAppearanceClasses = {
3792
- default: "ring-(--border-color-default)",
3793
- primary: "ring-(--border-color-primary)",
3794
- secondary: "ring-(--border-color-secondary)",
3795
- tertiary: "ring-(--border-color-tertiary)",
3796
- accent: "ring-(--border-color-accent)",
3797
- success: "ring-(--border-color-success)",
3798
- danger: "ring-(--border-color-danger)",
3799
- warning: "ring-(--border-color-warning)",
3800
- info: "ring-(--border-color-info)",
3801
- transparent: "ring-transparent",
3802
- muted: "ring-(--border-color-muted)",
3803
- link: "ring-(--border-color-link)",
3804
- };
3805
- // Ring classes for filled elements
3806
- const filledRingAppearanceClasses = {
3807
- default: "ring-(--filled-border-color-default)",
3808
- primary: "ring-(--filled-border-color-primary)",
3809
- secondary: "ring-(--filled-border-color-secondary)",
3810
- tertiary: "ring-(--filled-border-color-tertiary)",
3811
- accent: "ring-(--filled-border-color-accent)",
3812
- success: "ring-(--filled-border-color-success)",
3813
- danger: "ring-(--filled-border-color-danger)",
3814
- warning: "ring-(--filled-border-color-warning)",
3815
- info: "ring-(--filled-border-color-info)",
3816
- transparent: "ring-transparent",
3817
- muted: "ring-(--filled-border-color-muted)",
3818
- link: "ring-(--filled-border-color-link)",
3819
- };
3820
-
3821
- class VariantTheme extends BaseTheme {
3822
- constructor(variantInstances = VariantTheme.defaultInstances) {
3823
- super();
3824
- VARIANT_KEYS.forEach((variantKey) => {
3825
- this[variantKey] = variantInstances[variantKey] || VariantTheme.defaultInstances[variantKey];
3826
- });
3827
- }
3828
- getClasses(props, defaults) {
3829
- const activeVariantKey = pickFirstTruthyKey(props, defaults, VARIANT_KEYS) || 'outline';
3830
- const activeTextAppearanceTheme = this[activeVariantKey];
3831
- if (!activeTextAppearanceTheme) {
3832
- return [];
3833
- }
3834
- return activeTextAppearanceTheme.getClasses(props, defaults);
3835
- }
3836
- static createDefault(initialInstances) {
3837
- const fullInitialInstances = {
3838
- ...VariantTheme.defaultInstances,
3839
- ...(initialInstances || {})
3840
- };
3841
- return new VariantTheme(fullInitialInstances);
3842
- }
3843
- static createDefaultBackground() {
3844
- return this.createDefault({
3845
- outline: TextAppearanceTheme.createDefaultStyle({
3846
- base: backgroundAppearanceClasses,
3847
- hover: hoverBackgroundAppearanceClasses,
3848
- active: activeBackgroundAppearanceClasses
3849
- }),
3850
- filled: TextAppearanceTheme.createDefaultStyle({
3851
- base: filledBackgroundAppearanceClasses,
3852
- hover: filledHoverBackgroundAppearanceClasses,
3853
- active: filledActiveBackgroundAppearanceClasses
3854
- })
3855
- });
3856
- }
3857
- static createDefaultText() {
3858
- return this.createDefault({
3859
- outline: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
3860
- filled: TextAppearanceTheme.createDefaultStyle({ base: filledTextAppearanceClasses })
3861
- });
3862
- }
3863
- static createDefaultBorder() {
3864
- return this.createDefault({
3865
- outline: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
3866
- filled: TextAppearanceTheme.createDefaultStyle({ base: filledBorderAppearanceClasses })
3867
- });
3868
- }
3869
- static createDefaultRing() {
3870
- return this.createDefault({
3871
- outline: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
3872
- filled: TextAppearanceTheme.createDefaultStyle({ base: filledRingAppearanceClasses })
3873
- });
3874
- }
3875
- }
3876
- VariantTheme.defaultInstances = Object.fromEntries(VARIANT_KEYS.map(variantKey => [
3877
- variantKey,
3878
- new TextAppearanceTheme()
3879
- ]));
3880
-
3881
- const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer transition-all duration-200 whitespace-nowrap", {
3882
- size: {
3883
- px: new PxTheme({
3884
- padding: {
3885
- xs: 'px-2',
3886
- sm: 'px-3',
3887
- md: 'px-4',
3888
- lg: 'px-5',
3889
- xl: 'px-6',
3890
- }
3891
- }),
3892
- py: new PyTheme({
3893
- padding: {
3894
- xs: 'py-1',
3895
- sm: 'py-1.5',
3896
- md: 'py-2',
3897
- lg: 'py-2.5',
3898
- xl: 'py-3',
3899
- }
3900
- }),
3901
- gap: new GapTheme({
3902
- gap: {
3903
- xs: 'gap-1',
3904
- sm: 'gap-1.5',
3905
- md: 'gap-2',
3906
- lg: 'gap-2.5',
3907
- xl: 'gap-3',
3908
- }
3909
- }),
3910
- text: new SizeTheme({
3911
- xs: 'text-xs',
3912
- sm: 'text-sm',
3913
- md: 'text-base',
3914
- lg: 'text-lg',
3915
- xl: 'text-xl',
3916
- }),
3917
- shadow: new ShadowTheme(),
3918
- },
3919
- appearance: {
3920
- background: VariantTheme.createDefaultBackground(),
3921
- text: VariantTheme.createDefaultText(),
3922
- border: VariantTheme.createDefaultBorder(),
3923
- ring: VariantTheme.createDefaultRing(),
3924
- },
3925
- layout: {
3926
- border: new BorderTheme(),
3927
- ring: new RingTheme(),
3928
- radius: new RadiusTheme({
3929
- rounded: {
3930
- xs: 'rounded-sm',
3931
- sm: 'rounded-md',
3932
- md: 'rounded-md',
3933
- lg: 'rounded-lg',
3934
- xl: 'rounded-xl',
3935
- }
3936
- }),
3937
- },
3938
- }, {
3939
- md: true,
3940
- inlineFlex: true,
3941
- itemsCenter: true,
3942
- justifyCenter: true,
3943
- outline: true,
3944
- default: true,
3945
- rounded: true,
3946
- sans: true,
3947
- semibold: true,
3948
- textCenter: true,
3949
- noBorder: true,
3950
- gap: true,
3951
- padding: true,
3952
- ring: true,
3953
- shadow: true,
3954
- });
3955
-
3956
- const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all duration-200 whitespace-nowrap", {
3957
- size: {
3958
- px: new PxTheme({
3959
- padding: {
3960
- xs: "px-2",
3961
- sm: "px-3",
3962
- md: "px-4",
3963
- lg: "px-5",
3964
- xl: "px-6"
3965
- }
3966
- }),
3967
- py: new PyTheme({
3968
- padding: {
3969
- xs: 'py-1',
3970
- sm: 'py-1.5',
3971
- md: 'py-2',
3972
- lg: 'py-2.5',
3973
- xl: 'py-3',
3974
- }
3975
- }),
3976
- gap: new GapTheme({
3977
- gap: {
3978
- xs: 'gap-1',
3979
- sm: 'gap-1.5',
3980
- md: 'gap-2',
3981
- lg: 'gap-2.5',
3982
- xl: 'gap-3',
3983
- }
3984
- }),
3985
- text: new SizeTheme({
3986
- xs: 'text-xs',
3987
- sm: 'text-sm',
3988
- md: 'text-base',
3989
- lg: 'text-lg',
3990
- xl: 'text-xl',
3991
- }),
3992
- shadow: new ShadowTheme(),
3993
- },
3994
- appearance: {
3995
- background: VariantTheme.createDefault({
3996
- outline: TextAppearanceTheme.createDefaultStyle({
3997
- base: backgroundAppearanceClasses,
3998
- }),
3999
- filled: TextAppearanceTheme.createDefaultStyle({
4000
- base: filledBackgroundAppearanceClasses,
4001
- })
4002
- }),
4003
- text: VariantTheme.createDefaultText(),
4004
- border: VariantTheme.createDefaultBorder(),
4005
- ring: VariantTheme.createDefaultRing(),
4006
- },
4007
- layout: {
4008
- border: new BorderTheme(),
4009
- ring: new RingTheme(),
4010
- radius: new RadiusTheme({
4011
- rounded: {
4012
- xs: "rounded-xs",
4013
- sm: "rounded-sm",
4014
- md: "rounded-md",
4015
- lg: "rounded-lg",
4016
- xl: "rounded-xl"
4017
- }
4018
- }),
4019
- },
4020
- }, {
4021
- md: true,
4022
- inlineFlex: true,
4023
- outline: true,
4024
- pill: true,
4025
- sans: true,
4026
- semibold: true,
4027
- uppercase: true,
4028
- noShadow: true,
4029
- itemsCenter: true,
4030
- padding: true,
4031
- gap: true,
4032
- ring: true,
4033
- });
4034
-
4035
- const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all duration-200 whitespace-nowrap", {
4036
- size: {
4037
- px: new PxTheme({
4038
- padding: {
4039
- xs: 'px-2',
4040
- sm: 'px-2.5',
4041
- md: 'px-3',
4042
- lg: 'px-3.5',
4043
- xl: 'px-4',
4044
- }
4045
- }),
4046
- py: new PyTheme({
4047
- padding: {
4048
- xs: 'py-0.5',
4049
- sm: 'py-1',
4050
- md: 'py-1.5',
4051
- lg: 'py-2',
4052
- xl: 'py-2.5',
4053
- }
4054
- }),
4055
- text: new SizeTheme({
4056
- xs: 'text-xs',
4057
- sm: 'text-sm',
4058
- md: 'text-base',
4059
- lg: 'text-lg',
4060
- xl: 'text-xl',
4061
- }),
4062
- gap: new GapTheme({
4063
- gap: {
4064
- xs: 'gap-1',
4065
- sm: 'gap-1.5',
4066
- md: 'gap-2',
4067
- lg: 'gap-2.5',
4068
- xl: 'gap-3',
4069
- }
4070
- }),
4071
- shadow: new ShadowTheme(),
4072
- },
4073
- appearance: {
4074
- background: VariantTheme.createDefault({
4075
- outline: TextAppearanceTheme.createDefaultStyle({
4076
- base: backgroundAppearanceClasses,
4077
- }),
4078
- filled: TextAppearanceTheme.createDefaultStyle({
4079
- base: filledBackgroundAppearanceClasses,
4080
- })
4081
- }),
4082
- text: VariantTheme.createDefaultText(),
4083
- border: VariantTheme.createDefaultBorder(),
4084
- ring: VariantTheme.createDefaultRing(),
4085
- },
4086
- layout: {
4087
- radius: new RadiusTheme({
4088
- rounded: {
4089
- xs: 'rounded-sm',
4090
- sm: 'rounded-md',
4091
- md: 'rounded-lg',
4092
- lg: 'rounded-xl',
4093
- xl: 'rounded-2xl',
4094
- }
4095
- }),
4096
- border: new BorderTheme(),
4097
- ring: new RingTheme(),
4098
- },
4099
- }, {
4100
- md: true,
4101
- inlineFlex: true,
4102
- itemsCenter: true,
4103
- outline: true,
4104
- secondary: true,
4105
- rounded: true,
4106
- mono: true,
4107
- normal: true,
4108
- noShadow: true,
4109
- padding: true,
4110
- gap: true,
4111
- ring: true,
4112
- });
4113
-
4114
- const typographyThemeDefaults = {
4115
- md: true,
4116
- default: true,
4117
- sans: true,
4118
- normal: true,
4119
- };
4120
- const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap = textSizeClasses, defaults = typographyThemeDefaults) => {
4121
- return new ComponentTheme(tag, base, {
4122
- size: {
4123
- text: new SizeTheme(textSizeMap),
4124
- },
4125
- appearance: {
4126
- text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
4127
- }
4128
- }, defaults);
4129
- };
4130
- // Page title specific theme
4131
- const pageTitleTheme = createTypographyComponentTheme("h1", "text-balance tracking-tighter w-fit", {
4132
- xs: "text-3xl max-lg:text-2xl max-md:text-xl",
4133
- sm: "text-4xl max-lg:text-3xl max-md:text-2xl",
4134
- md: "text-5xl max-lg:text-4xl max-md:text-3xl",
4135
- lg: "text-6xl max-lg:text-5xl max-md:text-4xl",
4136
- xl: "text-7xl max-lg:text-6xl max-md:text-5xl",
4137
- }, mergeDefaults(typographyThemeDefaults, { semibold: true }));
4138
- // Section title specific theme
4139
- const sectionTitleTheme = createTypographyComponentTheme("h2", "text-balance w-fit", {
4140
- xs: "text-2xl max-lg:text-xl max-md:text-lg",
4141
- sm: "text-3xl max-lg:text-2xl max-md:text-xl",
4142
- md: "text-4xl max-lg:text-3xl max-md:text-2xl",
4143
- lg: "text-5xl max-lg:text-4xl max-md:text-3xl",
4144
- xl: "text-6xl max-lg:text-5xl max-md:text-4xl",
4145
- }, mergeDefaults(typographyThemeDefaults, { semibold: true }));
4146
- // Title specific theme
4147
- const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", {
4148
- xs: "text-lg",
4149
- sm: "text-xl",
4150
- md: "text-2xl",
4151
- lg: "text-3xl",
4152
- xl: "text-4xl",
4153
- }, mergeDefaults(typographyThemeDefaults, { semibold: true }));
4154
- // Text specific theme
4155
- const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", textSizeClasses, mergeDefaults(typographyThemeDefaults, { secondary: true }));
4156
- // Link specific theme
4157
- const linkTheme = createTypographyComponentTheme("a", "hover:underline w-fit", textSizeClasses, mergeDefaults(typographyThemeDefaults, { link: true }));
4158
- // List item specific theme
4159
- const listItemTheme = createTypographyComponentTheme("li");
4160
- // List specific theme
4161
- const listTheme = createTypographyComponentTheme("ul", "list-disc list-inside");
4162
-
4163
- class DirectionTheme extends BaseTheme {
4164
- constructor(initial) {
4165
- super();
4166
- FLEX_DIRECTION_KEYS.forEach((key) => {
4167
- this[key] = (initial === null || initial === void 0 ? void 0 : initial[key]) || DirectionTheme.defaultClasses[key];
4168
- });
4169
- }
4170
- getClasses(props, defaults) {
4171
- let direction = pickFirstTruthyKey(props, defaults, FLEX_DIRECTION_KEYS) || 'column';
4172
- const reverse = pickFirstTruthyKey(props, defaults, DIRECTION_REVERSE_KEYS);
4173
- if (reverse) {
4174
- switch (direction) {
4175
- case "column":
4176
- direction = "columnReverse";
4177
- break;
4178
- case "row":
4179
- direction = "rowReverse";
4180
- break;
4181
- }
4182
- }
4183
- return direction ? [this[direction]] : [];
4184
- }
4185
- }
4186
- DirectionTheme.defaultClasses = {
4187
- row: "flex-row",
4188
- column: "flex-col",
4189
- rowReverse: "flex-row-reverse",
4190
- columnReverse: "flex-col-reverse",
4191
- };
4192
-
4193
- class WrapTheme extends BaseTheme {
4194
- constructor(initialConfig) {
4195
- super();
4196
- WRAP_KEYS.forEach((key) => {
4197
- var _a;
4198
- this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : WrapTheme.defaultClasses[key];
4199
- });
4200
- }
4201
- getClasses(props, defaults) {
4202
- const key = pickFirstTruthyKey(props, defaults, WRAP_KEYS);
4203
- return key ? [this[key]] : [];
4204
- }
4205
- }
4206
- WrapTheme.defaultClasses = {
4207
- flexWrap: "flex-wrap",
4208
- flexNoWrap: "flex-nowrap",
4209
- flexWrapReverse: "flex-wrap-reverse"
4210
- };
4211
-
4212
- const commonGaps = {
4213
- xs: 'gap-2',
4214
- sm: 'gap-3',
4215
- md: 'gap-4',
4216
- lg: 'gap-5',
4217
- xl: 'gap-6',
4218
- };
4219
-
4220
- class LayoutAppearanceTheme extends BaseTheme {
4221
- constructor(initialOverrides) {
4222
- super();
4223
- APPEARANCE_KEYS.forEach((textKey) => {
4224
- const defaultModesForKey = LayoutAppearanceTheme.defaultFullConfig[textKey];
4225
- const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
4226
- this[textKey] = {
4227
- ...defaultModesForKey,
4228
- ...(overrideModesForKey || {}),
4229
- };
4230
- });
4231
- }
4232
- getClasses(props, defaults) {
4233
- const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, APPEARANCE_KEYS) || 'default';
4234
- const modesForAppearance = this[pickedAppearanceKey];
4235
- if (!modesForAppearance) {
4236
- return MODE_KEYS.map(() => '');
4237
- }
4238
- return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
4239
- }
4240
- static createDefaultStyle(src = {}) {
4241
- const initialOverridesForConstructor = {};
4242
- APPEARANCE_KEYS.forEach((textKey) => {
4243
- const modesForCurrentTextKey = {};
4244
- let keyHasDataInSrc = false;
4245
- MODE_KEYS.forEach((modeKey) => {
4246
- var _a;
4247
- const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
4248
- if (classValue !== undefined) {
4249
- modesForCurrentTextKey[modeKey] = classValue;
4250
- keyHasDataInSrc = true;
4251
- }
4252
- });
4253
- if (keyHasDataInSrc) {
4254
- initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
4255
- }
4256
- });
4257
- return new LayoutAppearanceTheme(initialOverridesForConstructor);
4258
- }
4259
- }
4260
- LayoutAppearanceTheme.defaultFullConfig = (() => {
4261
- const config = {};
4262
- APPEARANCE_KEYS.forEach((key) => {
4263
- config[key] = {
4264
- base: textAppearanceClasses[key] || '',
4265
- hover: '',
4266
- active: '',
4267
- };
4268
- });
4269
- return config;
4270
- })();
4271
-
4272
- class BreakpointTheme extends BaseTheme {
4273
- constructor(initial) {
4274
- super();
4275
- BREAKPOINT_KEYS.forEach((key) => {
4276
- var _a;
4277
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : BreakpointTheme.defaultClasses[key];
4278
- });
4279
- }
4280
- getClasses(props, defaults) {
4281
- const key = pickFirstTruthyKey(props, defaults, BREAKPOINT_KEYS);
4282
- if (!key)
4283
- return [];
4284
- return [this[key] || ''];
4285
- }
4286
- }
4287
- BreakpointTheme.defaultClasses = {
4288
- xsCol: "max-xs:flex-col",
4289
- smCol: "max-sm:flex-col",
4290
- mdCol: "max-md:flex-col",
4291
- lgCol: "max-lg:flex-col",
4292
- xlCol: "max-xl:flex-col"
4293
- };
4294
-
4295
- const defaultCardTheme = new ComponentTheme("div", "overflow-hidden", {
4296
- size: {
4297
- px: new PxTheme({
4298
- padding: {
4299
- xs: 'px-3',
4300
- sm: 'px-4',
4301
- md: 'px-5',
4302
- lg: 'px-6',
4303
- xl: 'px-8',
4304
- }
4305
- }),
4306
- py: new PyTheme({
4307
- padding: {
4308
- xs: 'py-2',
4309
- sm: 'py-3',
4310
- md: 'py-4',
4311
- lg: 'py-5',
4312
- xl: 'py-6',
4313
- }
4314
- }),
4315
- gap: new GapTheme({ gap: commonGaps }),
4316
- shadow: new ShadowTheme(),
4317
- },
4318
- layout: {
4319
- border: new BorderTheme(),
4320
- ring: new RingTheme(),
4321
- radius: new RadiusTheme({
4322
- rounded: {
4323
- xs: "rounded-md",
4324
- sm: "rounded-lg",
4325
- md: "rounded-xl",
4326
- lg: "rounded-2xl",
4327
- xl: "rounded-3xl"
4328
- }
4329
- }),
4330
- wrap: new WrapTheme(),
4331
- direction: new DirectionTheme(),
4332
- breakpoint: new BreakpointTheme(),
4333
- },
4334
- appearance: {
4335
- background: LayoutAppearanceTheme.createDefaultStyle({
4336
- base: layoutBackgroundAppearanceClasses,
4337
- }),
4338
- text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
4339
- border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
4340
- ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
4341
- }
4342
- }, {
4343
- md: true,
4344
- flex: true,
4345
- default: true,
4346
- rounded: true,
4347
- normal: true,
4348
- column: true,
4349
- border: true,
4350
- gap: true,
4351
- padding: true,
4352
- });
4353
-
4354
- const defaultRowTheme = new ComponentTheme("div", "flex-row", {
4355
- size: {
4356
- gap: new GapTheme({ gap: commonGaps }),
4357
- breakpoint: new BreakpointTheme(),
4358
- },
4359
- layout: {
4360
- wrap: new WrapTheme(),
4361
- },
4362
- }, {
4363
- md: true,
4364
- flex: true,
4365
- transparent: true,
4366
- itemsCenter: true,
4367
- gap: true,
4368
- });
4369
-
4370
- const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
4371
- appearance: {
4372
- background: TextAppearanceTheme.createDefaultStyle({
4373
- base: bgBorderAppearanceClasses,
4374
- }),
4375
- }
4376
- }, {
4377
- md: true,
4378
- default: true,
4379
- });
4380
-
4381
- const defaultContainerTheme = new ComponentTheme("div", "flex-col mx-auto w-full", {
4382
- size: {
4383
- gap: new GapTheme({
4384
- gap: {
4385
- xs: 'gap-2 max-lg:gap-1',
4386
- sm: 'gap-4 max-lg:gap-3 max-md:gap-2',
4387
- md: 'gap-6 max-lg:gap-5 max-md:gap-4',
4388
- lg: 'gap-8 max-lg:gap-7 max-md:gap-6',
4389
- xl: 'gap-10 max-lg:gap-9 max-md:gap-8',
4390
- }
4391
- }),
4392
- maxWidth: new SizeTheme({
4393
- xs: 'max-w-3xl',
4394
- sm: 'max-w-4xl',
4395
- md: 'max-w-5xl',
4396
- lg: 'max-w-6xl',
4397
- xl: 'max-w-7xl',
4398
- }),
4399
- },
4400
- layout: {
4401
- border: new BorderTheme(),
4402
- ring: new RingTheme(),
4403
- wrap: new WrapTheme(),
4404
- direction: new DirectionTheme(),
4405
- radius: new RadiusTheme({
4406
- rounded: {
4407
- xs: "rounded-md",
4408
- sm: "rounded-lg",
4409
- md: "rounded-xl",
4410
- lg: "rounded-2xl",
4411
- xl: "rounded-3xl"
4412
- }
4413
- }),
4414
- },
4415
- appearance: {
4416
- background: LayoutAppearanceTheme.createDefaultStyle({
4417
- base: layoutBackgroundAppearanceClasses,
4418
- }),
4419
- text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
4420
- border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
4421
- ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
4422
- }
4423
- }, {
4424
- transparent: true,
4425
- noRing: true,
4426
- flex: true,
4427
- md: true,
4428
- itemsCenter: true,
4429
- gap: true,
4430
- sharp: true,
4431
- });
4432
-
4433
- const defaultColTheme = new ComponentTheme("div", "flex-col", {
4434
- size: {
4435
- gap: new GapTheme({ gap: commonGaps }),
4436
- },
4437
- layout: {
4438
- wrap: new WrapTheme(),
4439
- direction: new DirectionTheme(),
4440
- },
4441
- }, {
4442
- md: true,
4443
- flex: true,
4444
- transparent: true,
4445
- gap: true,
4446
- });
4447
-
4448
- const defaultStackTheme = new ComponentTheme("div", "", {
4449
- size: {
4450
- px: new PxTheme({
4451
- padding: {
4452
- xs: 'px-2',
4453
- sm: 'px-3',
4454
- md: 'px-4',
4455
- lg: 'px-5',
4456
- xl: 'px-6',
4457
- }
4458
- }),
4459
- py: new PyTheme({
4460
- padding: {
4461
- xs: 'py-2',
4462
- sm: 'py-3',
4463
- md: 'py-4',
4464
- lg: 'py-5',
4465
- xl: 'py-6',
4466
- }
4467
- }),
4468
- gap: new GapTheme({
4469
- gap: commonGaps
4470
- }),
4471
- },
4472
- layout: {
4473
- wrap: new WrapTheme(),
4474
- direction: new DirectionTheme(),
4475
- },
4476
- }, {
4477
- md: true,
4478
- flex: true,
4479
- transparent: true,
4480
- column: true,
4481
- flexWrap: true,
4482
- gap: true,
4483
- padding: true,
4484
- });
4485
-
4486
- const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
4487
- size: {
4488
- px: new PxTheme({
4489
- padding: {
4490
- xs: 'px-5 max-lg:px-4 max-md:px-3',
4491
- sm: 'px-6 max-lg:px-5 max-md:px-4',
4492
- md: 'px-7 max-lg:px-6 max-md:px-5',
4493
- lg: 'px-8 max-lg:px-7 max-md:px-6',
4494
- xl: 'px-9 max-lg:px-8 max-md:px-7',
4495
- }
4496
- }),
4497
- py: new PyTheme({
4498
- padding: {
4499
- xs: 'py-4 max-md:py-3',
4500
- sm: 'py-8 max-md:py-6',
4501
- md: 'py-12 max-md:py-6',
4502
- lg: 'py-16 max-lg:py-14 max-md:py-12',
4503
- xl: 'py-20 max-lg:py-16 max-md:py-12',
4504
- }
4505
- }),
4506
- gap: new GapTheme({
4507
- gap: {
4508
- xs: 'gap-4',
4509
- sm: 'gap-6',
4510
- md: 'gap-8',
4511
- lg: 'gap-12',
4512
- xl: 'gap-16',
4513
- }
4514
- }),
4515
- shadow: new ShadowTheme(),
4516
- },
4517
- appearance: {
4518
- background: LayoutAppearanceTheme.createDefaultStyle({
4519
- base: layoutBackgroundAppearanceClasses,
4520
- }),
4521
- text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
4522
- border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
4523
- ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
4524
- },
4525
- layout: {
4526
- wrap: new WrapTheme(),
4527
- direction: new DirectionTheme(),
4528
- border: new BorderTheme(),
4529
- ring: new RingTheme(),
4530
- radius: new RadiusTheme({
4531
- rounded: {
4532
- xs: 'rounded-md',
4533
- sm: 'rounded-lg',
4534
- md: 'rounded-xl',
4535
- lg: 'rounded-2xl',
4536
- xl: 'rounded-3xl',
4537
- }
4538
- }),
4539
- },
4540
- }, {
4541
- md: true,
4542
- flex: true,
4543
- default: true,
4544
- itemsStart: true,
4545
- gap: true,
4546
- padding: true,
4547
- noBorder: true,
4548
- noRing: true,
4549
- noShadow: true,
4550
- sharp: true,
4551
- });
4552
-
4553
- const gridDefaults = {
4554
- md: true,
4555
- gap: true,
4556
- grid: true,
4557
- };
4558
- const gridSubThemes = {
4559
- size: {
4560
- gap: new GapTheme({
4561
- gap: {
4562
- xs: "gap-2",
4563
- sm: "gap-4 max-lg:gap-2",
4564
- md: "gap-6 max-lg:gap-4",
4565
- lg: "gap-8 max-lg:gap-6 max-md:gap-4",
4566
- xl: "gap-10 max-lg:gap-8 max-md:gap-6"
4567
- }
4568
- }),
4569
- },
4570
- };
4571
- const defaultGrid3Theme = new ComponentTheme("div", "grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
4572
- const defaultGrid4Theme = new ComponentTheme("div", "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
4573
-
4574
- const COMPONENT_KEYS = ['button', 'badge', 'chip', 'card', 'divider', 'row', 'col', 'stack', 'section',
4575
- 'grid3', 'grid4', 'pageTitle', 'sectionTitle', 'title', 'text', 'link', 'list', 'listItem'];
4576
- const defaultTheme = {
4577
- button: defaultButtonTheme,
4578
- badge: defaultBadgeTheme,
4579
- chip: defaultChipTheme,
4580
- card: defaultCardTheme,
4581
- divider: defaultDividerTheme,
4582
- container: defaultContainerTheme,
4583
- row: defaultRowTheme,
4584
- col: defaultColTheme,
4585
- stack: defaultStackTheme,
4586
- section: defaultSectionTheme,
4587
- grid3: defaultGrid3Theme,
4588
- grid4: defaultGrid4Theme,
4589
- pageTitle: pageTitleTheme,
4590
- sectionTitle: sectionTitleTheme,
4591
- title: titleTheme,
4592
- text: textTheme,
4593
- link: linkTheme,
4594
- listItem: listItemTheme,
4595
- list: listTheme,
4596
- };
4597
- const ThemeContext = createContext(defaultTheme);
4598
- function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, themeOverride }) {
4599
- const mergedTheme = useMemo(() => {
4600
- let finalTheme = themeObject
4601
- ? deepMerge(defaultTheme, themeObject)
4602
- : defaultTheme;
4603
- if (typeof themeOverride === 'function') {
4604
- const themeToModify = deepClone(finalTheme);
4605
- finalTheme = themeOverride(themeToModify);
4606
- }
4607
- if (themeDefaults !== undefined) {
4608
- for (const key in themeDefaults) {
4609
- const componentKey = key;
4610
- const componentTheme = finalTheme[componentKey];
4611
- const themeDefault = themeDefaults[componentKey];
4612
- if (themeDefault !== undefined) {
4613
- finalTheme[componentKey].defaults =
4614
- mergeDefaults(componentTheme.defaults, themeDefaults[componentKey]);
4615
- }
4616
- }
4617
- }
4618
- return finalTheme;
4619
- }, [themeObject, themeOverride]);
4620
- return (jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
4621
- }
4622
- function useTheme() {
4623
- return useContext(ThemeContext);
4624
- }
4625
-
4626
- function ThemedComponent({ theme, propsToOmit, ...props }) {
4627
- const { Tag, finalClasses, finalProps } = useMemo(() => {
4628
- return theme.getComponentConfig(props, propsToOmit);
4629
- }, [theme, props, propsToOmit]);
4630
- return (jsx(Tag, { className: finalClasses, ...finalProps, children: props.children }));
4631
- }
4632
-
4633
- const Button = (props) => {
4634
- const theme = useTheme();
4635
- return jsx(ThemedComponent, { theme: theme.button, propsToOmit: BUTTON_KEYS, ...props });
4636
- };
4637
-
4638
- const Badge = (props) => {
4639
- const theme = useTheme();
4640
- return jsx(ThemedComponent, { theme: theme.badge, propsToOmit: BADGE_KEYS, ...props });
4641
- };
4642
-
4643
- const Divider = (props) => {
4644
- const theme = useTheme();
4645
- return jsx(ThemedComponent, { theme: theme.divider, propsToOmit: DIVIDER_KEYS, ...props });
4646
- };
4647
-
4648
- const Chip = (props) => {
4649
- const theme = useTheme();
4650
- return jsx(ThemedComponent, { theme: theme.chip, propsToOmit: CHIP_KEYS, ...props });
4651
- };
4652
-
4653
- const Section = (props) => {
4654
- const theme = useTheme();
4655
- return jsx(ThemedComponent, { theme: theme.section, propsToOmit: SECTION_KEYS, ...props });
4656
- };
4657
-
4658
- const Container = (props) => {
4659
- const theme = useTheme();
4660
- return jsx(ThemedComponent, { theme: theme.container, propsToOmit: CONTAINER_KEYS, ...props });
4661
- };
4662
-
4663
- const Col = (props) => {
4664
- const theme = useTheme();
4665
- return jsx(ThemedComponent, { theme: theme.col, propsToOmit: COL_KEYS, ...props });
4666
- };
4667
-
4668
- const Row = (props) => {
4669
- const theme = useTheme();
4670
- return jsx(ThemedComponent, { theme: theme.row, propsToOmit: ROW_KEYS, ...props });
4671
- };
4672
-
4673
- const Grid3 = (props) => {
4674
- const theme = useTheme();
4675
- return jsx(ThemedComponent, { theme: theme.grid3, propsToOmit: GRID_KEYS, ...props });
4676
- };
4677
- const Grid4 = (props) => {
4678
- const theme = useTheme();
4679
- return jsx(ThemedComponent, { theme: theme.grid4, propsToOmit: GRID_KEYS, ...props });
4680
- };
4681
-
4682
- const Card = (props) => {
4683
- const theme = useTheme();
4684
- return jsx(ThemedComponent, { theme: theme.card, propsToOmit: CARD_KEYS, ...props });
4685
- };
4686
-
4687
- const Stack = (props) => {
4688
- const theme = useTheme();
4689
- const stackTheme = theme.stack;
4690
- return jsx(ThemedComponent, { theme: stackTheme, propsToOmit: STACK_KEYS, ...props });
4691
- };
4692
-
4693
- const PageTitle = (props) => {
4694
- const theme = useTheme();
4695
- return jsx(ThemedComponent, { theme: theme.pageTitle, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4696
- };
4697
- const SectionTitle = (props) => {
4698
- const theme = useTheme();
4699
- return jsx(ThemedComponent, { theme: theme.sectionTitle, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4700
- };
4701
- const Title = (props) => {
4702
- const theme = useTheme();
4703
- return jsx(ThemedComponent, { theme: theme.title, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4704
- };
4705
- const Text = (props) => {
4706
- const theme = useTheme();
4707
- return jsx(ThemedComponent, { theme: theme.text, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4708
- };
4709
- const Link = (props) => {
4710
- const theme = useTheme();
4711
- return jsx(ThemedComponent, { theme: theme.link, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4712
- };
4713
- const ListItem = (props) => {
4714
- const theme = useTheme();
4715
- return jsx(ThemedComponent, { theme: theme.listItem, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4716
- };
4717
- const List = (props) => {
4718
- const theme = useTheme();
4719
- return jsx(ThemedComponent, { theme: theme.list, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
4720
- };
4721
-
4722
- export { Badge, Button, COMPONENT_KEYS, Card, Chip, Col, Container, Divider, Grid3, Grid4, Link, List, ListItem, PageTitle, Row, Section, SectionTitle, Stack, Text, ThemeProvider, Title, defaultTheme, useTheme };
4723
- //# sourceMappingURL=index.esm.js.map