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