typewritingclass 0.2.2 → 0.2.3

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 (139) hide show
  1. package/dist/borders-pzt8w5Wv.d.cts +24 -0
  2. package/dist/borders-pzt8w5Wv.d.ts +24 -0
  3. package/dist/chunk-34VD2OBF.cjs +74 -0
  4. package/dist/chunk-6CEDQ6GF.cjs +36 -0
  5. package/dist/chunk-75ZPJI57.cjs +9 -0
  6. package/dist/chunk-ATLK64TQ.js +85 -0
  7. package/dist/chunk-BAZLFQIV.cjs +85 -0
  8. package/dist/chunk-CB7B6PHY.cjs +19 -0
  9. package/dist/chunk-EBHM46CV.cjs +25 -0
  10. package/dist/chunk-IL3LVS32.js +36 -0
  11. package/dist/chunk-JKT74FUK.js +25 -0
  12. package/dist/chunk-L3IF2OVA.cjs +354 -0
  13. package/{src/theme/animations.ts → dist/chunk-L7AJQJBR.js} +16 -8
  14. package/dist/chunk-LARVCDO3.js +113 -0
  15. package/dist/chunk-M34ZK4IV.cjs +53 -0
  16. package/dist/chunk-MLKGABMK.js +9 -0
  17. package/dist/chunk-PBQX6PVK.js +80 -0
  18. package/dist/chunk-PTY5FTFB.cjs +80 -0
  19. package/dist/chunk-T776FXQK.js +53 -0
  20. package/dist/chunk-TAAEIXRF.js +74 -0
  21. package/dist/chunk-TUUH2FJY.cjs +39 -0
  22. package/dist/chunk-U2LSMKZS.js +60 -0
  23. package/dist/chunk-UUUE7HRN.cjs +60 -0
  24. package/dist/chunk-UUVUSZJS.cjs +113 -0
  25. package/dist/chunk-XEHQXLQR.js +354 -0
  26. package/dist/chunk-YHDPOIUZ.js +39 -0
  27. package/dist/colors-MvgcZKUW.d.cts +72 -0
  28. package/dist/colors-MvgcZKUW.d.ts +72 -0
  29. package/dist/index.cjs +2922 -0
  30. package/dist/index.d.cts +3515 -0
  31. package/dist/index.d.ts +3515 -0
  32. package/dist/index.js +2922 -0
  33. package/{src/theme/inject-theme.ts → dist/inject-theme-CTzyfQH0.d.cts} +4 -20
  34. package/dist/inject-theme-CTzyfQH0.d.ts +65 -0
  35. package/dist/inject.cjs +32 -0
  36. package/dist/inject.d.cts +2 -0
  37. package/dist/inject.d.ts +2 -0
  38. package/dist/inject.js +32 -0
  39. package/dist/rule.cjs +19 -0
  40. package/{src/rule.ts → dist/rule.d.cts} +10 -79
  41. package/dist/rule.d.ts +133 -0
  42. package/dist/rule.js +19 -0
  43. package/dist/runtime.cjs +9 -0
  44. package/{src/runtime.ts → dist/runtime.d.cts} +4 -7
  45. package/dist/runtime.d.ts +33 -0
  46. package/dist/runtime.js +9 -0
  47. package/dist/shadows-CWViP1Zk.d.cts +22 -0
  48. package/dist/shadows-CWViP1Zk.d.ts +22 -0
  49. package/dist/sizes-CS9iz8YG.d.cts +46 -0
  50. package/dist/sizes-CS9iz8YG.d.ts +46 -0
  51. package/dist/theme/animations.cjs +15 -0
  52. package/dist/theme/animations.d.cts +12 -0
  53. package/dist/theme/animations.d.ts +12 -0
  54. package/dist/theme/animations.js +15 -0
  55. package/dist/theme/borders.cjs +23 -0
  56. package/dist/theme/borders.d.cts +1 -0
  57. package/dist/theme/borders.d.ts +1 -0
  58. package/dist/theme/borders.js +23 -0
  59. package/dist/theme/colors.cjs +57 -0
  60. package/dist/theme/colors.d.cts +1 -0
  61. package/dist/theme/colors.d.ts +1 -0
  62. package/dist/theme/colors.js +57 -0
  63. package/dist/theme/createTheme.cjs +7 -0
  64. package/dist/theme/createTheme.d.cts +133 -0
  65. package/dist/theme/createTheme.d.ts +133 -0
  66. package/dist/theme/createTheme.js +7 -0
  67. package/dist/theme/filters.cjs +9 -0
  68. package/dist/theme/filters.d.cts +21 -0
  69. package/dist/theme/filters.d.ts +21 -0
  70. package/dist/theme/filters.js +9 -0
  71. package/dist/theme/index.cjs +35 -0
  72. package/dist/theme/index.d.cts +18 -0
  73. package/dist/theme/index.d.ts +18 -0
  74. package/dist/theme/index.js +35 -0
  75. package/dist/theme/shadows.cjs +21 -0
  76. package/dist/theme/shadows.d.cts +1 -0
  77. package/dist/theme/shadows.d.ts +1 -0
  78. package/dist/theme/shadows.js +21 -0
  79. package/dist/theme/sizes.cjs +21 -0
  80. package/dist/theme/sizes.d.cts +1 -0
  81. package/dist/theme/sizes.d.ts +1 -0
  82. package/dist/theme/sizes.js +21 -0
  83. package/dist/theme/typography.cjs +55 -0
  84. package/dist/theme/typography.d.cts +1 -0
  85. package/dist/theme/typography.d.ts +1 -0
  86. package/dist/theme/typography.js +55 -0
  87. package/dist/types-FfRD4Hbd.d.cts +346 -0
  88. package/dist/types-FfRD4Hbd.d.ts +346 -0
  89. package/dist/typography-C8wipcCK.d.cts +87 -0
  90. package/dist/typography-C8wipcCK.d.ts +87 -0
  91. package/package.json +117 -33
  92. package/src/css.ts +0 -140
  93. package/src/cx.ts +0 -105
  94. package/src/dcx.ts +0 -79
  95. package/src/dynamic.ts +0 -117
  96. package/src/hash.ts +0 -55
  97. package/src/index.ts +0 -139
  98. package/src/inject.ts +0 -86
  99. package/src/layer.ts +0 -81
  100. package/src/modifiers/aria.ts +0 -15
  101. package/src/modifiers/colorScheme.ts +0 -32
  102. package/src/modifiers/data.ts +0 -6
  103. package/src/modifiers/direction.ts +0 -5
  104. package/src/modifiers/group.ts +0 -21
  105. package/src/modifiers/index.ts +0 -17
  106. package/src/modifiers/media.ts +0 -11
  107. package/src/modifiers/peer.ts +0 -24
  108. package/src/modifiers/pseudo.ts +0 -183
  109. package/src/modifiers/pseudoElements.ts +0 -26
  110. package/src/modifiers/responsive.ts +0 -110
  111. package/src/modifiers/supports.ts +0 -6
  112. package/src/registry.ts +0 -171
  113. package/src/theme/borders.ts +0 -9
  114. package/src/theme/colors.ts +0 -326
  115. package/src/theme/createTheme.ts +0 -238
  116. package/src/theme/filters.ts +0 -20
  117. package/src/theme/index.ts +0 -9
  118. package/src/theme/shadows.ts +0 -8
  119. package/src/theme/sizes.ts +0 -37
  120. package/src/theme/spacing.ts +0 -44
  121. package/src/theme/typography.ts +0 -72
  122. package/src/tw.ts +0 -967
  123. package/src/types.ts +0 -273
  124. package/src/utilities/accessibility.ts +0 -33
  125. package/src/utilities/backgrounds.ts +0 -87
  126. package/src/utilities/borders.ts +0 -629
  127. package/src/utilities/colors.ts +0 -151
  128. package/src/utilities/effects.ts +0 -181
  129. package/src/utilities/filters.ts +0 -113
  130. package/src/utilities/index.ts +0 -57
  131. package/src/utilities/interactivity.ts +0 -254
  132. package/src/utilities/layout.ts +0 -1194
  133. package/src/utilities/spacing.ts +0 -681
  134. package/src/utilities/svg.ts +0 -35
  135. package/src/utilities/tables.ts +0 -54
  136. package/src/utilities/transforms.ts +0 -88
  137. package/src/utilities/transitions.ts +0 -107
  138. package/src/utilities/typography.ts +0 -387
  139. package/src/when.ts +0 -63
package/src/tw.ts DELETED
@@ -1,967 +0,0 @@
1
- import type { StyleRule, Modifier } from './types.ts'
2
- import { cx } from './cx.ts'
3
- import { when } from './when.ts'
4
-
5
- // --- Utilities ---
6
- import {
7
- p, px, py, pt, pr, pb, pl,
8
- m, mx, my, mt, mr, mb, ml,
9
- gap, gapX, gapY,
10
- ps, pe, ms, me,
11
- spaceX, spaceY, spaceXReverse, spaceYReverse,
12
- } from './utilities/spacing.ts'
13
- import { bg, textColor, borderColor } from './utilities/colors.ts'
14
- import {
15
- text, font, tracking, leading, textAlign,
16
- fontFamily, antialiased, subpixelAntialiased,
17
- italic, notItalic, truncate,
18
- normalNums, ordinal, slashedZero, liningNums, oldstyleNums,
19
- proportionalNums, tabularNums, diagonalFractions, stackedFractions,
20
- lineClamp, listStyleImage, listStylePosition, listStyleType,
21
- textDecoration, textDecorationColor, textDecorationStyle, textDecorationThickness,
22
- textUnderlineOffset, textTransform, textOverflow, textWrap, textIndent,
23
- verticalAlign, whitespace, wordBreak, hyphens, content_,
24
- } from './utilities/typography.ts'
25
- import {
26
- flex, flexCol, flexRow, flexWrap, inlineFlex,
27
- grid, gridCols, gridRows,
28
- w, h, size, minW, minH, maxW, maxH,
29
- display, items, justify, self,
30
- overflow, overflowX, overflowY,
31
- relative, absolute, fixed, sticky,
32
- top, right, bottom, left, inset,
33
- z,
34
- aspectRatio, columns, breakAfter, breakBefore, breakInside,
35
- boxDecorationBreak, boxSizing, float_, clear_, isolate, isolationAuto,
36
- objectFit, objectPosition, overscrollBehavior, overscrollX, overscrollY,
37
- static_, insetX, insetY, start, end,
38
- visible, invisible, collapse_,
39
- flexBasis, flexRowReverse, flexColReverse, flexWrapReverse, flexNowrap,
40
- flex1, flexAuto, flexInitial, flexNone,
41
- grow, shrink, order,
42
- colSpan, colStart, colEnd, rowSpan, rowStart, rowEnd,
43
- gridFlow, autoCols, autoRows,
44
- justifyItems, justifySelf, alignContent, placeContent, placeItems, placeSelf,
45
- container,
46
- } from './utilities/layout.ts'
47
- import {
48
- rounded, roundedT, roundedB, roundedL, roundedR,
49
- roundedTL, roundedTR, roundedBR, roundedBL,
50
- roundedSS, roundedSE, roundedEE, roundedES,
51
- border, borderT, borderR, borderB, borderL,
52
- borderX, borderY, borderS, borderE, borderStyle,
53
- ring, ringColor, ringOffsetWidth, ringOffsetColor, ringInset,
54
- outlineWidth, outlineColor, outlineStyle, outlineOffset, outline, outlineNone,
55
- divideX, divideY, divideColor, divideStyle, divideXReverse, divideYReverse,
56
- } from './utilities/borders.ts'
57
- import { shadow, opacity, backdrop, shadowColor, mixBlendMode, bgBlendMode } from './utilities/effects.ts'
58
- import {
59
- cursor, select, pointerEvents,
60
- accentColor, appearance, caretColor, resize,
61
- scrollBehavior, scrollMargin, scrollMarginX, scrollMarginY,
62
- scrollMarginT, scrollMarginR, scrollMarginB, scrollMarginL,
63
- scrollPadding, scrollPaddingX, scrollPaddingY,
64
- scrollPaddingT, scrollPaddingR, scrollPaddingB, scrollPaddingL,
65
- snapAlign, snapStop, snapType, touchAction, willChange,
66
- } from './utilities/interactivity.ts'
67
- import {
68
- blur, brightness, contrast, dropShadow, grayscale, hueRotate, invert, saturate, sepia,
69
- backdropBlur, backdropBrightness, backdropContrast, backdropGrayscale, backdropHueRotate,
70
- backdropInvert, backdropOpacity, backdropSaturate, backdropSepia,
71
- } from './utilities/filters.ts'
72
- import {
73
- scale, scaleX, scaleY, rotate, translateX, translateY, skewX, skewY,
74
- transformOrigin, transformGpu, transformNone,
75
- } from './utilities/transforms.ts'
76
- import {
77
- transition, transitionAll, transitionColors, transitionOpacity, transitionShadow, transitionTransform, transitionNone,
78
- duration, ease, delay, animate,
79
- } from './utilities/transitions.ts'
80
- import { borderCollapse, borderSeparate, borderSpacing, borderSpacingX, borderSpacingY, tableLayout, captionSide } from './utilities/tables.ts'
81
- import { fill, stroke, strokeWidth } from './utilities/svg.ts'
82
- import { srOnly, notSrOnly, forcedColorAdjust } from './utilities/accessibility.ts'
83
- import {
84
- bgAttachment, bgClip, bgOrigin, bgPosition, bgRepeat, bgSize, bgImage, bgGradient,
85
- gradientFrom, gradientVia, gradientTo,
86
- } from './utilities/backgrounds.ts'
87
-
88
- // --- Modifiers ---
89
- import {
90
- hover, focus, active, disabled, focusVisible, focusWithin, firstChild, lastChild,
91
- visited, checked, indeterminate, default_, required_, valid, invalid,
92
- inRange, outOfRange, placeholderShown, autofill, readOnly, empty,
93
- even, odd, firstOfType, lastOfType, onlyChild, onlyOfType, target, open_,
94
- has_,
95
- } from './modifiers/pseudo.ts'
96
- import { sm, md, lg, xl, _2xl, maxSm, maxMd, maxLg, maxXl, max2xl } from './modifiers/responsive.ts'
97
- import { dark } from './modifiers/colorScheme.ts'
98
- import { motionReduce, motionSafe, print_, portrait, landscape, contrastMore, contrastLess, forcedColors } from './modifiers/media.ts'
99
- import { before, after, placeholder_, file_, marker, selection_, firstLine, firstLetter, backdrop_ } from './modifiers/pseudoElements.ts'
100
- import { ariaChecked, ariaDisabled, ariaExpanded, ariaHidden, ariaPressed, ariaReadonly, ariaRequired, ariaSelected, aria } from './modifiers/aria.ts'
101
- import { data } from './modifiers/data.ts'
102
- import { supports } from './modifiers/supports.ts'
103
- import {
104
- groupHover, groupFocus, groupActive, groupFocusVisible, groupFocusWithin,
105
- groupDisabled, groupChecked, groupEmpty, groupFirst, groupLast, groupOdd, groupEven,
106
- groupOpen, groupVisited, groupHas,
107
- } from './modifiers/group.ts'
108
- import {
109
- peerHover, peerFocus, peerActive, peerFocusVisible, peerDisabled,
110
- peerChecked, peerInvalid, peerRequired, peerPlaceholderShown,
111
- peerFocusWithin, peerEmpty, peerFirst, peerLast, peerOdd, peerEven, peerOpen, peerVisited, peerHas,
112
- } from './modifiers/peer.ts'
113
- import { rtl, ltr } from './modifiers/direction.ts'
114
-
115
- // ---------------------------------------------------------------------------
116
- // Lookup tables
117
- // ---------------------------------------------------------------------------
118
-
119
- /** Utilities that require arguments — mapped name → function */
120
- const UTILS: Record<string, (...args: any[]) => StyleRule> = {
121
- // Spacing
122
- p, px, py, pt, pr, pb, pl,
123
- m, mx, my, mt, mr, mb, ml,
124
- gap, gapX, gapY,
125
- ps, pe, ms, me,
126
- spaceX, spaceY,
127
- // Colors
128
- bg, textColor, borderColor,
129
- // Typography
130
- text, font, tracking, leading, textAlign,
131
- fontFamily,
132
- lineClamp, listStyleImage, listStylePosition, listStyleType,
133
- textDecoration, textDecorationColor, textDecorationStyle, textDecorationThickness,
134
- textUnderlineOffset, textTransform, textOverflow, textWrap, textIndent,
135
- verticalAlign, whitespace, wordBreak, hyphens,
136
- content: content_,
137
- // Layout
138
- grid, gridCols, gridRows,
139
- w, h, size, minW, minH, maxW, maxH,
140
- display, items, justify, self,
141
- overflow, overflowX, overflowY,
142
- top, right, bottom, left, inset,
143
- z,
144
- aspectRatio, columns, breakAfter, breakBefore, breakInside,
145
- boxDecorationBreak, boxSizing,
146
- float: float_, clear: clear_,
147
- objectFit, objectPosition, overscrollBehavior, overscrollX, overscrollY,
148
- insetX, insetY, start, end,
149
- flexBasis,
150
- grow, shrink, order,
151
- colSpan, colStart, colEnd, rowSpan, rowStart, rowEnd,
152
- gridFlow, autoCols, autoRows,
153
- justifyItems, justifySelf, alignContent, placeContent, placeItems, placeSelf,
154
- // Borders
155
- rounded, roundedT, roundedB, roundedL, roundedR,
156
- roundedTL, roundedTR, roundedBR, roundedBL,
157
- roundedSS, roundedSE, roundedEE, roundedES,
158
- border, borderT, borderR, borderB, borderL,
159
- borderX, borderY, borderS, borderE, borderStyle,
160
- ring, ringColor, ringOffsetWidth, ringOffsetColor,
161
- outlineWidth, outlineColor, outlineStyle, outlineOffset, outline,
162
- divideX, divideY, divideColor, divideStyle,
163
- // Effects
164
- shadow, opacity, backdrop, shadowColor, mixBlendMode, bgBlendMode,
165
- // Interactivity
166
- cursor, select, pointerEvents,
167
- accentColor, appearance, caretColor, resize,
168
- scrollBehavior, scrollMargin, scrollMarginX, scrollMarginY,
169
- scrollMarginT, scrollMarginR, scrollMarginB, scrollMarginL,
170
- scrollPadding, scrollPaddingX, scrollPaddingY,
171
- scrollPaddingT, scrollPaddingR, scrollPaddingB, scrollPaddingL,
172
- snapAlign, snapStop, snapType, touchAction, willChange,
173
- // Filters
174
- blur, brightness, contrast, dropShadow, grayscale, hueRotate, invert, saturate, sepia,
175
- backdropBlur, backdropBrightness, backdropContrast, backdropGrayscale, backdropHueRotate,
176
- backdropInvert, backdropOpacity, backdropSaturate, backdropSepia,
177
- // Transforms
178
- scale, scaleX, scaleY, rotate, translateX, translateY, skewX, skewY, transformOrigin,
179
- // Transitions
180
- transition, duration, ease, delay, animate,
181
- // Tables
182
- borderSpacing, borderSpacingX, borderSpacingY, tableLayout, captionSide,
183
- // SVG
184
- fill, stroke, strokeWidth,
185
- // Accessibility
186
- forcedColorAdjust,
187
- // Backgrounds
188
- bgAttachment, bgClip, bgOrigin, bgPosition, bgRepeat, bgSize, bgImage, bgGradient,
189
- gradientFrom, gradientVia, gradientTo,
190
- }
191
-
192
- /** Value-less utilities (no arguments) — mapped name → thunk or string */
193
- const VALUELESS: Record<string, (() => StyleRule) | string> = {
194
- // Layout
195
- flex, flexCol, flexRow, flexWrap, inlineFlex,
196
- relative, absolute, fixed, sticky,
197
- static: static_,
198
- visible, invisible,
199
- collapse: collapse_,
200
- isolate, isolationAuto,
201
- container,
202
- flexRowReverse, flexColReverse, flexWrapReverse, flexNowrap,
203
- flex1, flexAuto, flexInitial, flexNone,
204
- // Typography
205
- antialiased, subpixelAntialiased,
206
- italic, notItalic, truncate,
207
- normalNums, ordinal, slashedZero, liningNums, oldstyleNums,
208
- proportionalNums, tabularNums, diagonalFractions, stackedFractions,
209
- // Borders
210
- ringInset, outlineNone,
211
- borderCollapse, borderSeparate,
212
- spaceXReverse, spaceYReverse, divideXReverse, divideYReverse,
213
- // Transforms
214
- transformGpu, transformNone,
215
- // Transitions
216
- transitionAll, transitionColors, transitionOpacity, transitionShadow, transitionTransform, transitionNone,
217
- // Accessibility
218
- srOnly, notSrOnly,
219
- // Raw class names
220
- group: 'group',
221
- peer: 'peer',
222
- }
223
-
224
- /** Simple modifiers (no arguments) — mapped name → Modifier */
225
- const MODS: Record<string, Modifier> = {
226
- // Pseudo-classes
227
- hover, focus, active, disabled, focusVisible, focusWithin, firstChild, lastChild,
228
- visited, checked, indeterminate,
229
- default: default_, required: required_,
230
- valid, invalid,
231
- inRange, outOfRange, placeholderShown, autofill, readOnly, empty,
232
- even, odd, firstOfType, lastOfType, onlyChild, onlyOfType, target,
233
- open: open_,
234
- // Responsive
235
- sm, md, lg, xl, _2xl, maxSm, maxMd, maxLg, maxXl, max2xl,
236
- // Color scheme
237
- dark,
238
- // Media
239
- motionReduce, motionSafe,
240
- print: print_,
241
- portrait, landscape, contrastMore, contrastLess, forcedColors,
242
- // Pseudo-elements
243
- before, after,
244
- placeholder: placeholder_, file: file_,
245
- marker,
246
- selection: selection_,
247
- firstLine, firstLetter,
248
- backdropEl: backdrop_,
249
- // ARIA
250
- ariaChecked, ariaDisabled, ariaExpanded, ariaHidden, ariaPressed, ariaReadonly, ariaRequired, ariaSelected,
251
- // Group
252
- groupHover, groupFocus, groupActive, groupFocusVisible, groupFocusWithin,
253
- groupDisabled, groupChecked, groupEmpty, groupFirst, groupLast, groupOdd, groupEven,
254
- groupOpen, groupVisited,
255
- // Peer
256
- peerHover, peerFocus, peerActive, peerFocusVisible, peerDisabled,
257
- peerChecked, peerInvalid, peerRequired, peerPlaceholderShown,
258
- peerFocusWithin, peerEmpty, peerFirst, peerLast, peerOdd, peerEven, peerOpen, peerVisited,
259
- // Direction
260
- rtl, ltr,
261
- }
262
-
263
- /** Parameterized modifiers (take arguments, return Modifier) */
264
- const PARAM_MODS: Record<string, (...args: any[]) => Modifier> = {
265
- has: has_,
266
- aria,
267
- data,
268
- supports,
269
- groupHas,
270
- peerHas,
271
- }
272
-
273
- // ---------------------------------------------------------------------------
274
- // Internal TwChain marker
275
- // ---------------------------------------------------------------------------
276
-
277
- const TW_BRAND = Symbol.for('twc.chain')
278
-
279
- /** @internal */
280
- export function isTwChain(value: unknown): value is TwChain {
281
- return value != null && (typeof value === 'object' || typeof value === 'function') && (value as any)[TW_BRAND] === true
282
- }
283
-
284
- // ---------------------------------------------------------------------------
285
- // TwChain type helpers
286
- // ---------------------------------------------------------------------------
287
-
288
- /** @internal A utility that accepts arguments and returns a chain. Also chainable without calling (for optional-arg utilities like `shadow`). */
289
- /**
290
- * A TwChain that is also assignable to `string`, so it can be used directly
291
- * in `className={tw.p(4)}` without wrapping in a template literal.
292
- * At runtime, the Proxy's `toString()` is called when string coercion occurs.
293
- */
294
- export type TwChainString = TwChain & string
295
-
296
- type TwUtility = ((...args: any[]) => TwChainString) & TwChainString
297
-
298
- /** @internal A modifier usable as a property (`tw.hover.bg(…)`) or function (`tw.hover(tw.bg(…))`). */
299
- type TwModifier = TwChainString & ((...chains: (TwChain | string)[]) => TwChainString)
300
-
301
- /** @internal A parameterized modifier that requires arguments before it becomes a modifier. */
302
- type TwParamModifier = (...args: any[]) => TwChainString
303
-
304
- // ---------------------------------------------------------------------------
305
- // TwChain type
306
- // ---------------------------------------------------------------------------
307
-
308
- /**
309
- * A chainable style builder created by the `tw` proxy.
310
- *
311
- * Every property access or method call returns a new `TwChain` with the
312
- * accumulated styles. When used in a string context (template literal,
313
- * `className=`, `String()`, etc.) it resolves to a class name string via `cx`.
314
- *
315
- * Modifiers can be used as properties for single-utility application
316
- * (`tw.hover.bg('red-500')`) or as functions accepting another chain
317
- * for multi-utility application (`tw.hover(tw.bg('red-500').textColor('white'))`).
318
- *
319
- * **Keep in sync with the UTILS, VALUELESS, MODS, and PARAM_MODS lookup tables.**
320
- */
321
- export interface TwChain {
322
- /** @internal Accumulated style rules */
323
- readonly _rules: readonly (StyleRule | string)[]
324
- /** @internal Brand marker */
325
- readonly [Symbol.toStringTag]: 'TwChain'
326
- /** Resolves the chain to a class name string */
327
- toString(): string
328
- /** Resolves the chain to a class name string */
329
- readonly value: string
330
- /** Resolves the chain to a class name string */
331
- readonly className: string
332
- /** Allow the chain to be called as a function */
333
- (...args: any[]): TwChainString
334
-
335
- // ---- Utilities (take arguments) — keep in sync with UTILS ----
336
-
337
- // Spacing
338
- readonly p: TwUtility
339
- readonly px: TwUtility
340
- readonly py: TwUtility
341
- readonly pt: TwUtility
342
- readonly pr: TwUtility
343
- readonly pb: TwUtility
344
- readonly pl: TwUtility
345
- readonly m: TwUtility
346
- readonly mx: TwUtility
347
- readonly my: TwUtility
348
- readonly mt: TwUtility
349
- readonly mr: TwUtility
350
- readonly mb: TwUtility
351
- readonly ml: TwUtility
352
- readonly gap: TwUtility
353
- readonly gapX: TwUtility
354
- readonly gapY: TwUtility
355
- readonly ps: TwUtility
356
- readonly pe: TwUtility
357
- readonly ms: TwUtility
358
- readonly me: TwUtility
359
- readonly spaceX: TwUtility
360
- readonly spaceY: TwUtility
361
- // Colors
362
- readonly bg: TwUtility
363
- readonly textColor: TwUtility
364
- readonly borderColor: TwUtility
365
- // Typography
366
- readonly text: TwUtility
367
- readonly font: TwUtility
368
- readonly tracking: TwUtility
369
- readonly leading: TwUtility
370
- readonly textAlign: TwUtility
371
- readonly fontFamily: TwUtility
372
- readonly lineClamp: TwUtility
373
- readonly listStyleImage: TwUtility
374
- readonly listStylePosition: TwUtility
375
- readonly listStyleType: TwUtility
376
- readonly textDecoration: TwUtility
377
- readonly textDecorationColor: TwUtility
378
- readonly textDecorationStyle: TwUtility
379
- readonly textDecorationThickness: TwUtility
380
- readonly textUnderlineOffset: TwUtility
381
- readonly textTransform: TwUtility
382
- readonly textOverflow: TwUtility
383
- readonly textWrap: TwUtility
384
- readonly textIndent: TwUtility
385
- readonly verticalAlign: TwUtility
386
- readonly whitespace: TwUtility
387
- readonly wordBreak: TwUtility
388
- readonly hyphens: TwUtility
389
- readonly content: TwUtility
390
- // Layout
391
- readonly grid: TwUtility
392
- readonly gridCols: TwUtility
393
- readonly gridRows: TwUtility
394
- readonly w: TwUtility
395
- readonly h: TwUtility
396
- readonly size: TwUtility
397
- readonly minW: TwUtility
398
- readonly minH: TwUtility
399
- readonly maxW: TwUtility
400
- readonly maxH: TwUtility
401
- readonly display: TwUtility
402
- readonly items: TwUtility
403
- readonly justify: TwUtility
404
- readonly self: TwUtility
405
- readonly overflow: TwUtility
406
- readonly overflowX: TwUtility
407
- readonly overflowY: TwUtility
408
- readonly top: TwUtility
409
- readonly right: TwUtility
410
- readonly bottom: TwUtility
411
- readonly left: TwUtility
412
- readonly inset: TwUtility
413
- readonly z: TwUtility
414
- readonly aspectRatio: TwUtility
415
- readonly columns: TwUtility
416
- readonly breakAfter: TwUtility
417
- readonly breakBefore: TwUtility
418
- readonly breakInside: TwUtility
419
- readonly boxDecorationBreak: TwUtility
420
- readonly boxSizing: TwUtility
421
- readonly float: TwUtility
422
- readonly clear: TwUtility
423
- readonly objectFit: TwUtility
424
- readonly objectPosition: TwUtility
425
- readonly overscrollBehavior: TwUtility
426
- readonly overscrollX: TwUtility
427
- readonly overscrollY: TwUtility
428
- readonly insetX: TwUtility
429
- readonly insetY: TwUtility
430
- readonly start: TwUtility
431
- readonly end: TwUtility
432
- readonly flexBasis: TwUtility
433
- readonly grow: TwUtility
434
- readonly shrink: TwUtility
435
- readonly order: TwUtility
436
- readonly colSpan: TwUtility
437
- readonly colStart: TwUtility
438
- readonly colEnd: TwUtility
439
- readonly rowSpan: TwUtility
440
- readonly rowStart: TwUtility
441
- readonly rowEnd: TwUtility
442
- readonly gridFlow: TwUtility
443
- readonly autoCols: TwUtility
444
- readonly autoRows: TwUtility
445
- readonly justifyItems: TwUtility
446
- readonly justifySelf: TwUtility
447
- readonly alignContent: TwUtility
448
- readonly placeContent: TwUtility
449
- readonly placeItems: TwUtility
450
- readonly placeSelf: TwUtility
451
- // Borders
452
- readonly rounded: TwUtility
453
- readonly roundedT: TwUtility
454
- readonly roundedB: TwUtility
455
- readonly roundedL: TwUtility
456
- readonly roundedR: TwUtility
457
- readonly roundedTL: TwUtility
458
- readonly roundedTR: TwUtility
459
- readonly roundedBR: TwUtility
460
- readonly roundedBL: TwUtility
461
- readonly roundedSS: TwUtility
462
- readonly roundedSE: TwUtility
463
- readonly roundedEE: TwUtility
464
- readonly roundedES: TwUtility
465
- readonly border: TwUtility
466
- readonly borderT: TwUtility
467
- readonly borderR: TwUtility
468
- readonly borderB: TwUtility
469
- readonly borderL: TwUtility
470
- readonly borderX: TwUtility
471
- readonly borderY: TwUtility
472
- readonly borderS: TwUtility
473
- readonly borderE: TwUtility
474
- readonly borderStyle: TwUtility
475
- readonly ring: TwUtility
476
- readonly ringColor: TwUtility
477
- readonly ringOffsetWidth: TwUtility
478
- readonly ringOffsetColor: TwUtility
479
- readonly outlineWidth: TwUtility
480
- readonly outlineColor: TwUtility
481
- readonly outlineStyle: TwUtility
482
- readonly outlineOffset: TwUtility
483
- readonly outline: TwUtility
484
- readonly divideX: TwUtility
485
- readonly divideY: TwUtility
486
- readonly divideColor: TwUtility
487
- readonly divideStyle: TwUtility
488
- // Effects
489
- readonly shadow: TwUtility
490
- readonly opacity: TwUtility
491
- readonly backdrop: TwUtility
492
- readonly shadowColor: TwUtility
493
- readonly mixBlendMode: TwUtility
494
- readonly bgBlendMode: TwUtility
495
- // Interactivity
496
- readonly cursor: TwUtility
497
- readonly select: TwUtility
498
- readonly pointerEvents: TwUtility
499
- readonly accentColor: TwUtility
500
- readonly appearance: TwUtility
501
- readonly caretColor: TwUtility
502
- readonly resize: TwUtility
503
- readonly scrollBehavior: TwUtility
504
- readonly scrollMargin: TwUtility
505
- readonly scrollMarginX: TwUtility
506
- readonly scrollMarginY: TwUtility
507
- readonly scrollMarginT: TwUtility
508
- readonly scrollMarginR: TwUtility
509
- readonly scrollMarginB: TwUtility
510
- readonly scrollMarginL: TwUtility
511
- readonly scrollPadding: TwUtility
512
- readonly scrollPaddingX: TwUtility
513
- readonly scrollPaddingY: TwUtility
514
- readonly scrollPaddingT: TwUtility
515
- readonly scrollPaddingR: TwUtility
516
- readonly scrollPaddingB: TwUtility
517
- readonly scrollPaddingL: TwUtility
518
- readonly snapAlign: TwUtility
519
- readonly snapStop: TwUtility
520
- readonly snapType: TwUtility
521
- readonly touchAction: TwUtility
522
- readonly willChange: TwUtility
523
- // Filters
524
- readonly blur: TwUtility
525
- readonly brightness: TwUtility
526
- readonly contrast: TwUtility
527
- readonly dropShadow: TwUtility
528
- readonly grayscale: TwUtility
529
- readonly hueRotate: TwUtility
530
- readonly invert: TwUtility
531
- readonly saturate: TwUtility
532
- readonly sepia: TwUtility
533
- readonly backdropBlur: TwUtility
534
- readonly backdropBrightness: TwUtility
535
- readonly backdropContrast: TwUtility
536
- readonly backdropGrayscale: TwUtility
537
- readonly backdropHueRotate: TwUtility
538
- readonly backdropInvert: TwUtility
539
- readonly backdropOpacity: TwUtility
540
- readonly backdropSaturate: TwUtility
541
- readonly backdropSepia: TwUtility
542
- // Transforms
543
- readonly scale: TwUtility
544
- readonly scaleX: TwUtility
545
- readonly scaleY: TwUtility
546
- readonly rotate: TwUtility
547
- readonly translateX: TwUtility
548
- readonly translateY: TwUtility
549
- readonly skewX: TwUtility
550
- readonly skewY: TwUtility
551
- readonly transformOrigin: TwUtility
552
- // Transitions
553
- readonly transition: TwUtility
554
- readonly duration: TwUtility
555
- readonly ease: TwUtility
556
- readonly delay: TwUtility
557
- readonly animate: TwUtility
558
- // Tables
559
- readonly borderSpacing: TwUtility
560
- readonly borderSpacingX: TwUtility
561
- readonly borderSpacingY: TwUtility
562
- readonly tableLayout: TwUtility
563
- readonly captionSide: TwUtility
564
- // SVG
565
- readonly fill: TwUtility
566
- readonly stroke: TwUtility
567
- readonly strokeWidth: TwUtility
568
- // Accessibility
569
- readonly forcedColorAdjust: TwUtility
570
- // Backgrounds
571
- readonly bgAttachment: TwUtility
572
- readonly bgClip: TwUtility
573
- readonly bgOrigin: TwUtility
574
- readonly bgPosition: TwUtility
575
- readonly bgRepeat: TwUtility
576
- readonly bgSize: TwUtility
577
- readonly bgImage: TwUtility
578
- readonly bgGradient: TwUtility
579
- readonly gradientFrom: TwUtility
580
- readonly gradientVia: TwUtility
581
- readonly gradientTo: TwUtility
582
-
583
- // ---- Value-less utilities (no arguments) — keep in sync with VALUELESS ----
584
-
585
- // Layout
586
- readonly flex: TwChainString
587
- readonly flexCol: TwChainString
588
- readonly flexRow: TwChainString
589
- readonly flexWrap: TwChainString
590
- readonly inlineFlex: TwChainString
591
- readonly relative: TwChainString
592
- readonly absolute: TwChainString
593
- readonly fixed: TwChainString
594
- readonly sticky: TwChainString
595
- readonly static: TwChainString
596
- readonly visible: TwChainString
597
- readonly invisible: TwChainString
598
- readonly collapse: TwChainString
599
- readonly isolate: TwChainString
600
- readonly isolationAuto: TwChainString
601
- readonly container: TwChainString
602
- readonly flexRowReverse: TwChainString
603
- readonly flexColReverse: TwChainString
604
- readonly flexWrapReverse: TwChainString
605
- readonly flexNowrap: TwChainString
606
- readonly flex1: TwChainString
607
- readonly flexAuto: TwChainString
608
- readonly flexInitial: TwChainString
609
- readonly flexNone: TwChainString
610
- // Typography
611
- readonly antialiased: TwChainString
612
- readonly subpixelAntialiased: TwChainString
613
- readonly italic: TwChainString
614
- readonly notItalic: TwChainString
615
- readonly truncate: TwChainString
616
- readonly normalNums: TwChainString
617
- readonly ordinal: TwChainString
618
- readonly slashedZero: TwChainString
619
- readonly liningNums: TwChainString
620
- readonly oldstyleNums: TwChainString
621
- readonly proportionalNums: TwChainString
622
- readonly tabularNums: TwChainString
623
- readonly diagonalFractions: TwChainString
624
- readonly stackedFractions: TwChainString
625
- // Borders
626
- readonly ringInset: TwChainString
627
- readonly outlineNone: TwChainString
628
- readonly borderCollapse: TwChainString
629
- readonly borderSeparate: TwChainString
630
- readonly spaceXReverse: TwChainString
631
- readonly spaceYReverse: TwChainString
632
- readonly divideXReverse: TwChainString
633
- readonly divideYReverse: TwChainString
634
- // Transforms
635
- readonly transformGpu: TwChainString
636
- readonly transformNone: TwChainString
637
- // Transitions
638
- readonly transitionAll: TwChainString
639
- readonly transitionColors: TwChainString
640
- readonly transitionOpacity: TwChainString
641
- readonly transitionShadow: TwChainString
642
- readonly transitionTransform: TwChainString
643
- readonly transitionNone: TwChainString
644
- // Accessibility
645
- readonly srOnly: TwChainString
646
- readonly notSrOnly: TwChainString
647
- // Raw class names
648
- readonly group: TwChainString
649
- readonly peer: TwChainString
650
-
651
- // ---- Simple modifiers (no arguments) — keep in sync with MODS ----
652
-
653
- // Pseudo-classes
654
- readonly hover: TwModifier
655
- readonly focus: TwModifier
656
- readonly active: TwModifier
657
- readonly disabled: TwModifier
658
- readonly focusVisible: TwModifier
659
- readonly focusWithin: TwModifier
660
- readonly firstChild: TwModifier
661
- readonly lastChild: TwModifier
662
- readonly visited: TwModifier
663
- readonly checked: TwModifier
664
- readonly indeterminate: TwModifier
665
- readonly default: TwModifier
666
- readonly required: TwModifier
667
- readonly valid: TwModifier
668
- readonly invalid: TwModifier
669
- readonly inRange: TwModifier
670
- readonly outOfRange: TwModifier
671
- readonly placeholderShown: TwModifier
672
- readonly autofill: TwModifier
673
- readonly readOnly: TwModifier
674
- readonly empty: TwModifier
675
- readonly even: TwModifier
676
- readonly odd: TwModifier
677
- readonly firstOfType: TwModifier
678
- readonly lastOfType: TwModifier
679
- readonly onlyChild: TwModifier
680
- readonly onlyOfType: TwModifier
681
- readonly target: TwModifier
682
- readonly open: TwModifier
683
- // Responsive
684
- readonly sm: TwModifier
685
- readonly md: TwModifier
686
- readonly lg: TwModifier
687
- readonly xl: TwModifier
688
- readonly _2xl: TwModifier
689
- readonly maxSm: TwModifier
690
- readonly maxMd: TwModifier
691
- readonly maxLg: TwModifier
692
- readonly maxXl: TwModifier
693
- readonly max2xl: TwModifier
694
- // Color scheme
695
- readonly dark: TwModifier
696
- // Media
697
- readonly motionReduce: TwModifier
698
- readonly motionSafe: TwModifier
699
- readonly print: TwModifier
700
- readonly portrait: TwModifier
701
- readonly landscape: TwModifier
702
- readonly contrastMore: TwModifier
703
- readonly contrastLess: TwModifier
704
- readonly forcedColors: TwModifier
705
- // Pseudo-elements
706
- readonly before: TwModifier
707
- readonly after: TwModifier
708
- readonly placeholder: TwModifier
709
- readonly file: TwModifier
710
- readonly marker: TwModifier
711
- readonly selection: TwModifier
712
- readonly firstLine: TwModifier
713
- readonly firstLetter: TwModifier
714
- readonly backdropEl: TwModifier
715
- // ARIA
716
- readonly ariaChecked: TwModifier
717
- readonly ariaDisabled: TwModifier
718
- readonly ariaExpanded: TwModifier
719
- readonly ariaHidden: TwModifier
720
- readonly ariaPressed: TwModifier
721
- readonly ariaReadonly: TwModifier
722
- readonly ariaRequired: TwModifier
723
- readonly ariaSelected: TwModifier
724
- // Group
725
- readonly groupHover: TwModifier
726
- readonly groupFocus: TwModifier
727
- readonly groupActive: TwModifier
728
- readonly groupFocusVisible: TwModifier
729
- readonly groupFocusWithin: TwModifier
730
- readonly groupDisabled: TwModifier
731
- readonly groupChecked: TwModifier
732
- readonly groupEmpty: TwModifier
733
- readonly groupFirst: TwModifier
734
- readonly groupLast: TwModifier
735
- readonly groupOdd: TwModifier
736
- readonly groupEven: TwModifier
737
- readonly groupOpen: TwModifier
738
- readonly groupVisited: TwModifier
739
- // Peer
740
- readonly peerHover: TwModifier
741
- readonly peerFocus: TwModifier
742
- readonly peerActive: TwModifier
743
- readonly peerFocusVisible: TwModifier
744
- readonly peerDisabled: TwModifier
745
- readonly peerChecked: TwModifier
746
- readonly peerInvalid: TwModifier
747
- readonly peerRequired: TwModifier
748
- readonly peerPlaceholderShown: TwModifier
749
- readonly peerFocusWithin: TwModifier
750
- readonly peerEmpty: TwModifier
751
- readonly peerFirst: TwModifier
752
- readonly peerLast: TwModifier
753
- readonly peerOdd: TwModifier
754
- readonly peerEven: TwModifier
755
- readonly peerOpen: TwModifier
756
- readonly peerVisited: TwModifier
757
- // Direction
758
- readonly rtl: TwModifier
759
- readonly ltr: TwModifier
760
-
761
- // ---- Parameterized modifiers — keep in sync with PARAM_MODS ----
762
-
763
- readonly has: TwParamModifier
764
- readonly aria: TwParamModifier
765
- readonly data: TwParamModifier
766
- readonly supports: TwParamModifier
767
- readonly groupHas: TwParamModifier
768
- readonly peerHas: TwParamModifier
769
-
770
- /** Fallback: unknown properties are treated as raw class names */
771
- [key: string]: any
772
- }
773
-
774
- // ---------------------------------------------------------------------------
775
- // Core proxy factory
776
- // ---------------------------------------------------------------------------
777
-
778
- function applyMods(rule: StyleRule, mods: Modifier[]): StyleRule {
779
- if (mods.length === 0) return rule
780
- return when(...mods)(rule)
781
- }
782
-
783
- function applyModsToRules(rules: (StyleRule | string)[], mods: Modifier[]): (StyleRule | string)[] {
784
- if (mods.length === 0) return rules
785
- return rules.map(r => typeof r === 'string' ? r : applyMods(r, mods))
786
- }
787
-
788
- function createChain(rules: (StyleRule | string)[], pendingMods: Modifier[]): TwChain {
789
- // The proxy target must be a function so `apply` trap works
790
- const target = function () {} as any
791
-
792
- return new Proxy(target, {
793
- get(_target, prop: string | symbol): any {
794
- // --- Brand / internal ---
795
- if (prop === TW_BRAND) return true
796
- if (prop === '_rules') return rules
797
-
798
- // --- String coercion ---
799
- if (prop === Symbol.toPrimitive || prop === 'toString' || prop === 'valueOf') {
800
- return () => cx(...rules)
801
- }
802
- if (prop === Symbol.toStringTag) return 'TwChain'
803
- if (prop === 'value' || prop === 'className') {
804
- return cx(...rules)
805
- }
806
-
807
- // --- Iterator support (for template literals) ---
808
- if (prop === Symbol.iterator) return undefined
809
-
810
- // --- Node.js inspect ---
811
- if (prop === 'inspect' || prop === Symbol.for('nodejs.util.inspect.custom')) {
812
- return () => `TwChain(${cx(...rules)})`
813
- }
814
-
815
- const name = prop as string
816
-
817
- // --- Parameterized modifiers (has, aria, data, supports, groupHas, peerHas) ---
818
- if (name in PARAM_MODS) {
819
- const paramModFn = PARAM_MODS[name]
820
- // Return a function that takes args and returns a new chain or modifier proxy
821
- return (...args: any[]) => {
822
- const mod = paramModFn(...args)
823
- return createChain(rules, [...pendingMods, mod])
824
- }
825
- }
826
-
827
- // --- Simple modifiers ---
828
- if (name in MODS) {
829
- const mod = MODS[name]
830
- // Return a proxy that:
831
- // 1. As property chain: adds modifier to pending (get trap delegates)
832
- // 2. As function call with TwChain arg: applies modifier to group
833
- const innerChain = createChain(rules, [...pendingMods, mod])
834
-
835
- return new Proxy(function () {} as any, {
836
- get(_t, innerProp: string | symbol) {
837
- return (innerChain as any)[innerProp]
838
- },
839
- apply(_t, _this, args) {
840
- // hover(tw.bg('red').textColor('white')) — group modifier
841
- if (args.length > 0 && isTwChain(args[0])) {
842
- const childRules = args[0]._rules as (StyleRule | string)[]
843
- const modified = applyModsToRules(childRules, [...pendingMods, mod])
844
- return createChain([...rules, ...modified], [])
845
- }
846
- // hover(tw.bg('red'), tw.p(4)) — multiple chain args
847
- // Collect all TwChain args
848
- const allChildRules: (StyleRule | string)[] = []
849
- for (const arg of args) {
850
- if (isTwChain(arg)) {
851
- allChildRules.push(...(arg._rules as (StyleRule | string)[]))
852
- }
853
- }
854
- if (allChildRules.length > 0) {
855
- const modified = applyModsToRules(allChildRules, [...pendingMods, mod])
856
- return createChain([...rules, ...modified], [])
857
- }
858
- // Fallback: shouldn't normally happen
859
- return innerChain
860
- },
861
- })
862
- }
863
-
864
- // --- Value-less utilities ---
865
- if (name in VALUELESS) {
866
- const entry = VALUELESS[name]
867
- if (typeof entry === 'string') {
868
- // Raw class name like 'group' or 'peer'
869
- return createChain([...rules, entry], [])
870
- }
871
- // Thunk: call it to get StyleRule
872
- const rule = entry()
873
- const modified = applyMods(rule, pendingMods)
874
- return createChain([...rules, modified], [])
875
- }
876
-
877
- // --- Utilities with arguments ---
878
- if (name in UTILS) {
879
- const utilFn = UTILS[name]
880
- // Return a callable proxy: tw.bg('red') calls this
881
- return new Proxy(function () {} as any, {
882
- get(_t, innerProp: string | symbol) {
883
- // If someone chains without calling (e.g., tw.shadow.hover)
884
- // treat as calling with no args (for optional-arg utilities like shadow())
885
- const rule = utilFn()
886
- const modified = applyMods(rule, pendingMods)
887
- return (createChain([...rules, modified], []) as any)[innerProp]
888
- },
889
- apply(_t, _this, args) {
890
- const rule = utilFn(...args)
891
- const modified = applyMods(rule, pendingMods)
892
- return createChain([...rules, modified], [])
893
- },
894
- })
895
- }
896
-
897
- // --- Unknown prop: treat as raw class name ---
898
- return createChain([...rules, name], [])
899
- },
900
-
901
- apply(_target, _this, args) {
902
- // tw(...args) — behaves like cx, appending to accumulated rules
903
- const extra: (StyleRule | string)[] = []
904
- for (const arg of args) {
905
- if (isTwChain(arg)) {
906
- extra.push(...(arg._rules as (StyleRule | string)[]))
907
- } else {
908
- extra.push(arg)
909
- }
910
- }
911
- return createChain([...rules, ...extra], pendingMods)
912
- },
913
- }) as unknown as TwChain
914
- }
915
-
916
- // ---------------------------------------------------------------------------
917
- // Public API
918
- // ---------------------------------------------------------------------------
919
-
920
- /**
921
- * Proxy-based chainable style builder.
922
- *
923
- * An alternative to importing individual utility and modifier functions.
924
- * One import gives you access to every utility, modifier, and value-less
925
- * shorthand through a fluent, chainable API.
926
- *
927
- * @example Basic chaining — any order
928
- * ```ts
929
- * import { tw } from 'typewritingclass'
930
- *
931
- * const card = tw.bg('slate-50').rounded('xl').p(6).shadow('md')
932
- * ```
933
- *
934
- * @example Single-utility modifier (property syntax)
935
- * ```ts
936
- * const title = tw.textColor('slate-900').hover.textColor('blue-600')
937
- * ```
938
- *
939
- * @example Multi-utility modifier (function syntax)
940
- * ```ts
941
- * const card = tw
942
- * .bg('slate-50')
943
- * .rounded('xl')
944
- * .p(6)
945
- * .hover(tw.bg('slate-100').shadow('lg').scale(105))
946
- * .focus(tw.ring(2).ringColor('blue-500'))
947
- * ```
948
- *
949
- * @example Value-less utilities
950
- * ```ts
951
- * const wrapper = tw.group.flex.flexCol.relative
952
- * ```
953
- *
954
- * @example Group/peer modifiers
955
- * ```ts
956
- * const icon = tw.opacity(0.5).groupHover.opacity(1)
957
- * ```
958
- *
959
- * @example Resolves to class string automatically
960
- * ```ts
961
- * <div className={tw.p(4).bg('blue-500')} />
962
- * <div className={`${tw.p(4)} extra-class`} />
963
- * const classes = tw.p(4).bg('blue-500').toString()
964
- * const classes = tw.p(4).bg('blue-500').value
965
- * ```
966
- */
967
- export const tw: TwChainString = createChain([], []) as TwChainString