typewritingclass 0.2.2 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/borders-pzt8w5Wv.d.cts +24 -0
- package/dist/borders-pzt8w5Wv.d.ts +24 -0
- package/dist/chunk-34VD2OBF.cjs +74 -0
- package/dist/chunk-6CEDQ6GF.cjs +36 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-ATLK64TQ.js +85 -0
- package/dist/chunk-BAZLFQIV.cjs +85 -0
- package/dist/chunk-CB7B6PHY.cjs +19 -0
- package/dist/chunk-EBHM46CV.cjs +25 -0
- package/dist/chunk-IL3LVS32.js +36 -0
- package/dist/chunk-JKT74FUK.js +25 -0
- package/dist/chunk-L3IF2OVA.cjs +354 -0
- package/{src/theme/animations.ts → dist/chunk-L7AJQJBR.js} +16 -8
- package/dist/chunk-LARVCDO3.js +113 -0
- package/dist/chunk-M34ZK4IV.cjs +53 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-PBQX6PVK.js +80 -0
- package/dist/chunk-PTY5FTFB.cjs +80 -0
- package/dist/chunk-T776FXQK.js +53 -0
- package/dist/chunk-TAAEIXRF.js +74 -0
- package/dist/chunk-TUUH2FJY.cjs +39 -0
- package/dist/chunk-U2LSMKZS.js +60 -0
- package/dist/chunk-UUUE7HRN.cjs +60 -0
- package/dist/chunk-UUVUSZJS.cjs +113 -0
- package/dist/chunk-XEHQXLQR.js +354 -0
- package/dist/chunk-YHDPOIUZ.js +39 -0
- package/dist/colors-MvgcZKUW.d.cts +72 -0
- package/dist/colors-MvgcZKUW.d.ts +72 -0
- package/dist/index.cjs +2944 -0
- package/dist/index.d.cts +3542 -0
- package/dist/index.d.ts +3542 -0
- package/dist/index.js +2944 -0
- package/{src/theme/inject-theme.ts → dist/inject-theme-CTzyfQH0.d.cts} +4 -20
- package/dist/inject-theme-CTzyfQH0.d.ts +65 -0
- package/dist/inject.cjs +32 -0
- package/dist/inject.d.cts +2 -0
- package/dist/inject.d.ts +2 -0
- package/dist/inject.js +32 -0
- package/dist/rule.cjs +19 -0
- package/{src/rule.ts → dist/rule.d.cts} +10 -79
- package/dist/rule.d.ts +133 -0
- package/dist/rule.js +19 -0
- package/dist/runtime.cjs +9 -0
- package/{src/runtime.ts → dist/runtime.d.cts} +4 -7
- package/dist/runtime.d.ts +33 -0
- package/dist/runtime.js +9 -0
- package/dist/shadows-CWViP1Zk.d.cts +22 -0
- package/dist/shadows-CWViP1Zk.d.ts +22 -0
- package/dist/sizes-CS9iz8YG.d.cts +46 -0
- package/dist/sizes-CS9iz8YG.d.ts +46 -0
- package/dist/theme/animations.cjs +15 -0
- package/dist/theme/animations.d.cts +12 -0
- package/dist/theme/animations.d.ts +12 -0
- package/dist/theme/animations.js +15 -0
- package/dist/theme/borders.cjs +23 -0
- package/dist/theme/borders.d.cts +1 -0
- package/dist/theme/borders.d.ts +1 -0
- package/dist/theme/borders.js +23 -0
- package/dist/theme/colors.cjs +57 -0
- package/dist/theme/colors.d.cts +1 -0
- package/dist/theme/colors.d.ts +1 -0
- package/dist/theme/colors.js +57 -0
- package/dist/theme/createTheme.cjs +7 -0
- package/dist/theme/createTheme.d.cts +133 -0
- package/dist/theme/createTheme.d.ts +133 -0
- package/dist/theme/createTheme.js +7 -0
- package/dist/theme/filters.cjs +9 -0
- package/dist/theme/filters.d.cts +21 -0
- package/dist/theme/filters.d.ts +21 -0
- package/dist/theme/filters.js +9 -0
- package/dist/theme/index.cjs +35 -0
- package/dist/theme/index.d.cts +18 -0
- package/dist/theme/index.d.ts +18 -0
- package/dist/theme/index.js +35 -0
- package/dist/theme/shadows.cjs +21 -0
- package/dist/theme/shadows.d.cts +1 -0
- package/dist/theme/shadows.d.ts +1 -0
- package/dist/theme/shadows.js +21 -0
- package/dist/theme/sizes.cjs +21 -0
- package/dist/theme/sizes.d.cts +1 -0
- package/dist/theme/sizes.d.ts +1 -0
- package/dist/theme/sizes.js +21 -0
- package/dist/theme/typography.cjs +55 -0
- package/dist/theme/typography.d.cts +1 -0
- package/dist/theme/typography.d.ts +1 -0
- package/dist/theme/typography.js +55 -0
- package/dist/types-FfRD4Hbd.d.cts +346 -0
- package/dist/types-FfRD4Hbd.d.ts +346 -0
- package/dist/typography-C8wipcCK.d.cts +87 -0
- package/dist/typography-C8wipcCK.d.ts +87 -0
- package/package.json +117 -33
- package/src/css.ts +0 -140
- package/src/cx.ts +0 -105
- package/src/dcx.ts +0 -79
- package/src/dynamic.ts +0 -117
- package/src/hash.ts +0 -55
- package/src/index.ts +0 -139
- package/src/inject.ts +0 -86
- package/src/layer.ts +0 -81
- package/src/modifiers/aria.ts +0 -15
- package/src/modifiers/colorScheme.ts +0 -32
- package/src/modifiers/data.ts +0 -6
- package/src/modifiers/direction.ts +0 -5
- package/src/modifiers/group.ts +0 -21
- package/src/modifiers/index.ts +0 -17
- package/src/modifiers/media.ts +0 -11
- package/src/modifiers/peer.ts +0 -24
- package/src/modifiers/pseudo.ts +0 -183
- package/src/modifiers/pseudoElements.ts +0 -26
- package/src/modifiers/responsive.ts +0 -110
- package/src/modifiers/supports.ts +0 -6
- package/src/registry.ts +0 -171
- package/src/theme/borders.ts +0 -9
- package/src/theme/colors.ts +0 -326
- package/src/theme/createTheme.ts +0 -238
- package/src/theme/filters.ts +0 -20
- package/src/theme/index.ts +0 -9
- package/src/theme/shadows.ts +0 -8
- package/src/theme/sizes.ts +0 -37
- package/src/theme/spacing.ts +0 -44
- package/src/theme/typography.ts +0 -72
- package/src/tw.ts +0 -967
- package/src/types.ts +0 -273
- package/src/utilities/accessibility.ts +0 -33
- package/src/utilities/backgrounds.ts +0 -87
- package/src/utilities/borders.ts +0 -629
- package/src/utilities/colors.ts +0 -151
- package/src/utilities/effects.ts +0 -181
- package/src/utilities/filters.ts +0 -113
- package/src/utilities/index.ts +0 -57
- package/src/utilities/interactivity.ts +0 -254
- package/src/utilities/layout.ts +0 -1194
- package/src/utilities/spacing.ts +0 -681
- package/src/utilities/svg.ts +0 -35
- package/src/utilities/tables.ts +0 -54
- package/src/utilities/transforms.ts +0 -88
- package/src/utilities/transitions.ts +0 -107
- package/src/utilities/typography.ts +0 -387
- package/src/when.ts +0 -63
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3542 @@
|
|
|
1
|
+
import { S as StyleRule, D as DynamicResult, M as Modifier, a as DynamicValue } from './types-FfRD4Hbd.js';
|
|
2
|
+
export { B as Brand, C as CSSColor, b as CSSFontWeight, c as CSSLength, d as CSSShadow, e as ColorInput, R as RadiusInput, f as ShadowInput, g as SizeInput, h as SpacingInput, U as Utility, i as dynamic, j as isDynamic } from './types-FfRD4Hbd.js';
|
|
3
|
+
export { ThemeConfig, ThemeResult, ThemeVars, createTheme } from './theme/createTheme.js';
|
|
4
|
+
export { i as injectTheme, s as setTheme } from './inject-theme-CTzyfQH0.js';
|
|
5
|
+
import { T as TextSize } from './typography-C8wipcCK.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Assigns an explicit layer priority to a style rule.
|
|
9
|
+
*
|
|
10
|
+
* By default, rules receive auto-incremented layer numbers based on
|
|
11
|
+
* declaration order. Use `layer()` to override this and force a rule
|
|
12
|
+
* to a specific priority level. Higher numbers = higher priority
|
|
13
|
+
* (overrides lower).
|
|
14
|
+
*
|
|
15
|
+
* @param priority - The explicit layer number to assign.
|
|
16
|
+
* @returns A function that accepts style rules and wraps them with the given layer.
|
|
17
|
+
*
|
|
18
|
+
* @example Force a reset to lowest priority
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { cx, layer, p, bg } from 'typewritingclass'
|
|
21
|
+
*
|
|
22
|
+
* cx(layer(0)(bg('white')), p(4))
|
|
23
|
+
* // bg('white') is forced to layer 0, p(4) gets auto-assigned layer 1
|
|
24
|
+
* // p(4) overrides any conflicting property from bg('white')
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Force an override to highest priority
|
|
28
|
+
* ```ts
|
|
29
|
+
* cx(p(4), layer(1000)(p(8)))
|
|
30
|
+
* // p(8) at layer 1000 always overrides p(4)
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function layer(priority: number): (...rules: StyleRule[]) => StyleRule;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Composes style rules and string class names into a single CSS class string.
|
|
37
|
+
*
|
|
38
|
+
* Each {@link StyleRule} is registered in the global stylesheet and assigned a
|
|
39
|
+
* unique, deterministic class name. Later arguments override earlier ones when
|
|
40
|
+
* CSS properties conflict -- order is your specificity.
|
|
41
|
+
*
|
|
42
|
+
* Plain strings are passed through unchanged, so you can mix generated rules
|
|
43
|
+
* with external or hand-written class names.
|
|
44
|
+
*
|
|
45
|
+
* @param args - Style rules from utility functions, or plain class name strings.
|
|
46
|
+
* @returns A space-separated class string ready for `className` or `class`.
|
|
47
|
+
*
|
|
48
|
+
* @example Basic composition
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { cx, p, bg, rounded } from 'typewritingclass'
|
|
51
|
+
* import { blue } from 'typewritingclass/theme/colors'
|
|
52
|
+
* import { lg } from 'typewritingclass/theme/borders'
|
|
53
|
+
*
|
|
54
|
+
* const className = cx(p(4), bg(blue[500]), rounded(lg))
|
|
55
|
+
* // => "_a1b2c _d3e4f _g5h6i"
|
|
56
|
+
* // CSS: padding: 1rem; background-color: #3b82f6; border-radius: 0.5rem;
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Override earlier rules
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { cx, p } from 'typewritingclass'
|
|
62
|
+
*
|
|
63
|
+
* cx(p(4), p(2))
|
|
64
|
+
* // Only p(2) applies -- later rules are placed on a higher layer
|
|
65
|
+
* // CSS: padding: 0.5rem;
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Mix string classes with rules
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { cx, p, bg } from 'typewritingclass'
|
|
71
|
+
* import { white } from 'typewritingclass/theme/colors'
|
|
72
|
+
*
|
|
73
|
+
* cx('my-component', p(4), bg(white))
|
|
74
|
+
* // => "my-component _a1b2c _d3e4f"
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example With modifiers
|
|
78
|
+
* ```ts
|
|
79
|
+
* import { cx, p, bg, when, hover, md } from 'typewritingclass'
|
|
80
|
+
* import { blue } from 'typewritingclass/theme/colors'
|
|
81
|
+
*
|
|
82
|
+
* cx(
|
|
83
|
+
* p(4),
|
|
84
|
+
* when(hover)(bg(blue[600])),
|
|
85
|
+
* when(md)(p(8)),
|
|
86
|
+
* )
|
|
87
|
+
* // CSS:
|
|
88
|
+
* // .cls1 { padding: 1rem; }
|
|
89
|
+
* // .cls2:hover { background-color: #2563eb; }
|
|
90
|
+
* // @media (min-width: 768px) { .cls3 { padding: 2rem; } }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
declare function cx(...args: (StyleRule | string)[]): string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Composes style rules into a class string **and** an inline style object,
|
|
97
|
+
* supporting runtime-dynamic CSS values.
|
|
98
|
+
*
|
|
99
|
+
* Works exactly like {@link cx} for static rules, but also collects
|
|
100
|
+
* `dynamicBindings` from any rule that references a {@link DynamicValue}.
|
|
101
|
+
* The returned `style` object maps CSS custom properties to their current
|
|
102
|
+
* values and must be spread onto the element's `style` attribute so the
|
|
103
|
+
* generated `var()` references resolve correctly.
|
|
104
|
+
*
|
|
105
|
+
* Use `dcx` instead of `cx` whenever at least one of your style rules was
|
|
106
|
+
* built with {@link dynamic}.
|
|
107
|
+
*
|
|
108
|
+
* @param args - Style rules from utility functions, or plain class name strings.
|
|
109
|
+
* @returns A {@link DynamicResult} with `className` (space-separated class string)
|
|
110
|
+
* and `style` (CSS custom property assignments for inline styles).
|
|
111
|
+
*
|
|
112
|
+
* @example Dynamic background color
|
|
113
|
+
* ```ts
|
|
114
|
+
* import { dcx, bg, p, dynamic } from 'typewritingclass'
|
|
115
|
+
*
|
|
116
|
+
* const userColor = dynamic('#e11d48')
|
|
117
|
+
* const { className, style } = dcx(p(4), bg(userColor))
|
|
118
|
+
* // className => "_a1b2c _d3e4f"
|
|
119
|
+
* // style => { '--twc-d0': '#e11d48' }
|
|
120
|
+
*
|
|
121
|
+
* // In React JSX:
|
|
122
|
+
* // <div className={className} style={style} />
|
|
123
|
+
* // CSS: ._d3e4f { background-color: var(--twc-d0); }
|
|
124
|
+
* // Inline: style="--twc-d0: #e11d48;"
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example Mixing static and dynamic rules
|
|
128
|
+
* ```ts
|
|
129
|
+
* import { dcx, p, bg, rounded, dynamic } from 'typewritingclass'
|
|
130
|
+
* import { blue } from 'typewritingclass/theme/colors'
|
|
131
|
+
*
|
|
132
|
+
* const radius = dynamic('12px')
|
|
133
|
+
* const { className, style } = dcx(p(4), bg(blue[500]), rounded(radius))
|
|
134
|
+
* // className => "_a1b2c _d3e4f _g5h6i"
|
|
135
|
+
* // style => { '--twc-d0': '12px' }
|
|
136
|
+
* // CSS: ._g5h6i { border-radius: var(--twc-d0); }
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @example No dynamic values -- style is an empty object
|
|
140
|
+
* ```ts
|
|
141
|
+
* import { dcx, p } from 'typewritingclass'
|
|
142
|
+
*
|
|
143
|
+
* const { className, style } = dcx(p(4))
|
|
144
|
+
* // className => "_a1b2c"
|
|
145
|
+
* // style => {}
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare function dcx(...args: (StyleRule | string)[]): DynamicResult;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Creates a conditional style applicator by composing one or more modifiers.
|
|
152
|
+
*
|
|
153
|
+
* Returns a function that accepts style rules and wraps them with the given
|
|
154
|
+
* modifiers applied right-to-left (innermost modifier listed first). This
|
|
155
|
+
* lets you express multi-condition rules like "on hover at the `md` breakpoint"
|
|
156
|
+
* in a readable, composable way.
|
|
157
|
+
*
|
|
158
|
+
* Multiple style rules passed to the returned function are merged into a single
|
|
159
|
+
* combined rule before modifiers are applied, so selectors and media queries
|
|
160
|
+
* are shared across all declarations.
|
|
161
|
+
*
|
|
162
|
+
* @param modifiers - One or more {@link Modifier} functions (e.g. `hover`, `md`, `dark`)
|
|
163
|
+
* applied right-to-left around the inner rules.
|
|
164
|
+
* @returns A function that accepts {@link StyleRule}s and returns a single
|
|
165
|
+
* modifier-wrapped `StyleRule`.
|
|
166
|
+
*
|
|
167
|
+
* @example Single modifier -- hover state
|
|
168
|
+
* ```ts
|
|
169
|
+
* import { cx, bg, when, hover } from 'typewritingclass'
|
|
170
|
+
* import { blue } from 'typewritingclass/theme/colors'
|
|
171
|
+
*
|
|
172
|
+
* cx(when(hover)(bg(blue[600])))
|
|
173
|
+
* // CSS: .cls:hover { background-color: #2563eb; }
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example Stacked modifiers -- hover at medium breakpoint
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { cx, bg, p, when, hover, md } from 'typewritingclass'
|
|
179
|
+
* import { blue } from 'typewritingclass/theme/colors'
|
|
180
|
+
*
|
|
181
|
+
* cx(when(hover, md)(bg(blue[700]), p(8)))
|
|
182
|
+
* // CSS:
|
|
183
|
+
* // @media (min-width: 768px) {
|
|
184
|
+
* // .cls:hover { background-color: #1d4ed8; padding: 2rem; }
|
|
185
|
+
* // }
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @example Dark mode styling
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { cx, bg, textColor, when, dark } from 'typewritingclass'
|
|
191
|
+
* import { slate, white } from 'typewritingclass/theme/colors'
|
|
192
|
+
*
|
|
193
|
+
* cx(
|
|
194
|
+
* bg(white),
|
|
195
|
+
* textColor(slate[900]),
|
|
196
|
+
* when(dark)(bg(slate[900]), textColor(white)),
|
|
197
|
+
* )
|
|
198
|
+
* // CSS:
|
|
199
|
+
* // .cls1 { background-color: #ffffff; }
|
|
200
|
+
* // .cls2 { color: #0f172a; }
|
|
201
|
+
* // .dark .cls3 { background-color: #0f172a; color: #ffffff; }
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare function when(...modifiers: Modifier[]): (...rules: StyleRule[]) => StyleRule;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Creates a {@link StyleRule} from a plain object of CSS declarations.
|
|
208
|
+
*
|
|
209
|
+
* Use this overload when you want to write raw CSS property-value pairs
|
|
210
|
+
* without reaching for a specific utility function.
|
|
211
|
+
*
|
|
212
|
+
* @param declarations - A record mapping CSS property names to their values.
|
|
213
|
+
* @returns A {@link StyleRule} containing the given declarations.
|
|
214
|
+
*
|
|
215
|
+
* @example Object of declarations
|
|
216
|
+
* ```ts
|
|
217
|
+
* import { cx, css } from 'typewritingclass'
|
|
218
|
+
*
|
|
219
|
+
* cx(css({ display: 'grid', 'grid-template-columns': '1fr 1fr', gap: '1rem' }))
|
|
220
|
+
* // CSS: display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
declare function css(declarations: Record<string, string>): StyleRule;
|
|
224
|
+
/**
|
|
225
|
+
* Creates a {@link StyleRule} from a tagged template literal of CSS declarations.
|
|
226
|
+
*
|
|
227
|
+
* Interpolated values can be plain strings, numbers, or {@link DynamicValue}
|
|
228
|
+
* instances. Dynamic values are replaced with `var(--twc-dN)` references in
|
|
229
|
+
* the generated CSS and must be applied to the element via inline styles
|
|
230
|
+
* (see {@link dcx}).
|
|
231
|
+
*
|
|
232
|
+
* @param strings - The static portions of the template literal (provided automatically).
|
|
233
|
+
* @param values - Interpolated expressions -- strings, numbers, or {@link DynamicValue}s.
|
|
234
|
+
* @returns A {@link StyleRule} with parsed declarations (and `dynamicBindings`
|
|
235
|
+
* if any interpolated value was created with {@link dynamic}).
|
|
236
|
+
*
|
|
237
|
+
* @example Tagged template with static values
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { cx, css } from 'typewritingclass'
|
|
240
|
+
*
|
|
241
|
+
* cx(css`
|
|
242
|
+
* display: flex;
|
|
243
|
+
* align-items: center;
|
|
244
|
+
* gap: 0.5rem;
|
|
245
|
+
* `)
|
|
246
|
+
* // CSS: display: flex; align-items: center; gap: 0.5rem;
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @example Tagged template with interpolated values
|
|
250
|
+
* ```ts
|
|
251
|
+
* import { cx, css } from 'typewritingclass'
|
|
252
|
+
* import { blue } from 'typewritingclass/theme/colors'
|
|
253
|
+
*
|
|
254
|
+
* const size = '2rem'
|
|
255
|
+
* cx(css`
|
|
256
|
+
* width: ${size};
|
|
257
|
+
* height: ${size};
|
|
258
|
+
* background-color: ${blue[500]};
|
|
259
|
+
* `)
|
|
260
|
+
* // CSS: width: 2rem; height: 2rem; background-color: #3b82f6;
|
|
261
|
+
* ```
|
|
262
|
+
*
|
|
263
|
+
* @example Tagged template with dynamic values
|
|
264
|
+
* ```ts
|
|
265
|
+
* import { dcx, css, dynamic } from 'typewritingclass'
|
|
266
|
+
*
|
|
267
|
+
* const color = dynamic('#e11d48')
|
|
268
|
+
* const { className, style } = dcx(css`
|
|
269
|
+
* background-color: ${color};
|
|
270
|
+
* padding: 1rem;
|
|
271
|
+
* `)
|
|
272
|
+
* // className => "_a1b2c"
|
|
273
|
+
* // style => { '--twc-d0': '#e11d48' }
|
|
274
|
+
* // CSS: ._a1b2c { background-color: var(--twc-d0); padding: 1rem; }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
declare function css(strings: TemplateStringsArray, ...values: (string | number | DynamicValue)[]): StyleRule;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Generates a complete CSS stylesheet string from all registered rules.
|
|
281
|
+
*
|
|
282
|
+
* Rules are sorted by their layer number (ascending) so that later-declared
|
|
283
|
+
* utilities naturally override earlier ones in the cascade. Rules are
|
|
284
|
+
* separated by blank lines.
|
|
285
|
+
*
|
|
286
|
+
* @internal
|
|
287
|
+
* @returns The full CSS string for all registered style rules, or an empty
|
|
288
|
+
* string if no rules have been registered.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* register('_a', createRule({ padding: '1rem' }), 0)
|
|
293
|
+
* register('_b', createRule({ margin: '0' }), 1)
|
|
294
|
+
*
|
|
295
|
+
* generateCSS()
|
|
296
|
+
* // "._a {\n padding: 1rem;\n}\n\n._b {\n margin: 0;\n}"
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
declare function generateCSS(): string;
|
|
300
|
+
|
|
301
|
+
/** @internal A utility that accepts arguments and returns a chain. Also chainable without calling (for optional-arg utilities like `shadow`). */
|
|
302
|
+
/**
|
|
303
|
+
* A TwChain that is also assignable to `string`, so it can be used directly
|
|
304
|
+
* in `className={tw.p(4)}` without wrapping in a template literal.
|
|
305
|
+
* At runtime, the Proxy's `toString()` is called when string coercion occurs.
|
|
306
|
+
*/
|
|
307
|
+
type TwChainString = TwChain & string;
|
|
308
|
+
type TwUtility = ((...args: any[]) => TwChainString) & TwChainString;
|
|
309
|
+
/** @internal A modifier usable as a property (`tw.hover.bg(…)`) or function (`tw.hover(tw.bg(…))`). */
|
|
310
|
+
type TwModifier = TwChainString & ((...chains: (TwChain | string)[]) => TwChainString);
|
|
311
|
+
/** @internal A parameterized modifier that requires arguments before it becomes a modifier. */
|
|
312
|
+
type TwParamModifier = (...args: any[]) => TwChainString;
|
|
313
|
+
/**
|
|
314
|
+
* A chainable style builder created by the `tw` proxy.
|
|
315
|
+
*
|
|
316
|
+
* Every property access or method call returns a new `TwChain` with the
|
|
317
|
+
* accumulated styles. When used in a string context (template literal,
|
|
318
|
+
* `className=`, `String()`, etc.) it resolves to a class name string via `cx`.
|
|
319
|
+
*
|
|
320
|
+
* Modifiers can be used as properties for single-utility application
|
|
321
|
+
* (`tw.hover.bg('red-500')`) or as functions accepting another chain
|
|
322
|
+
* for multi-utility application (`tw.hover(tw.bg('red-500').textColor('white'))`).
|
|
323
|
+
*
|
|
324
|
+
* **Keep in sync with the UTILS, VALUELESS, MODS, and PARAM_MODS lookup tables.**
|
|
325
|
+
*/
|
|
326
|
+
interface TwChain {
|
|
327
|
+
/** @internal Accumulated style rules */
|
|
328
|
+
readonly _rules: readonly (StyleRule | string)[];
|
|
329
|
+
/** @internal Brand marker */
|
|
330
|
+
readonly [Symbol.toStringTag]: 'TwChain';
|
|
331
|
+
/** Resolves the chain to a class name string */
|
|
332
|
+
toString(): string;
|
|
333
|
+
/** Resolves the chain to a class name string */
|
|
334
|
+
readonly value: string;
|
|
335
|
+
/** Resolves the chain to a class name string */
|
|
336
|
+
readonly className: string;
|
|
337
|
+
/** Allow the chain to be called as a function */
|
|
338
|
+
(...args: any[]): TwChainString;
|
|
339
|
+
readonly p: TwUtility;
|
|
340
|
+
readonly px: TwUtility;
|
|
341
|
+
readonly py: TwUtility;
|
|
342
|
+
readonly pt: TwUtility;
|
|
343
|
+
readonly pr: TwUtility;
|
|
344
|
+
readonly pb: TwUtility;
|
|
345
|
+
readonly pl: TwUtility;
|
|
346
|
+
readonly m: TwUtility;
|
|
347
|
+
readonly mx: TwUtility;
|
|
348
|
+
readonly my: TwUtility;
|
|
349
|
+
readonly mt: TwUtility;
|
|
350
|
+
readonly mr: TwUtility;
|
|
351
|
+
readonly mb: TwUtility;
|
|
352
|
+
readonly ml: TwUtility;
|
|
353
|
+
readonly gap: TwUtility;
|
|
354
|
+
readonly gapX: TwUtility;
|
|
355
|
+
readonly gapY: TwUtility;
|
|
356
|
+
readonly ps: TwUtility;
|
|
357
|
+
readonly pe: TwUtility;
|
|
358
|
+
readonly ms: TwUtility;
|
|
359
|
+
readonly me: TwUtility;
|
|
360
|
+
readonly spaceX: TwUtility;
|
|
361
|
+
readonly spaceY: TwUtility;
|
|
362
|
+
readonly bg: TwUtility;
|
|
363
|
+
readonly textColor: TwUtility;
|
|
364
|
+
readonly borderColor: TwUtility;
|
|
365
|
+
readonly text: TwUtility;
|
|
366
|
+
readonly font: TwUtility;
|
|
367
|
+
readonly tracking: TwUtility;
|
|
368
|
+
readonly leading: TwUtility;
|
|
369
|
+
readonly textAlign: TwUtility;
|
|
370
|
+
readonly fontFamily: TwUtility;
|
|
371
|
+
readonly lineClamp: TwUtility;
|
|
372
|
+
readonly listStyleImage: TwUtility;
|
|
373
|
+
readonly listStylePosition: TwUtility;
|
|
374
|
+
readonly listStyleType: TwUtility;
|
|
375
|
+
readonly textDecoration: TwUtility;
|
|
376
|
+
readonly textDecorationColor: TwUtility;
|
|
377
|
+
readonly textDecorationStyle: TwUtility;
|
|
378
|
+
readonly textDecorationThickness: TwUtility;
|
|
379
|
+
readonly textUnderlineOffset: TwUtility;
|
|
380
|
+
readonly textTransform: TwUtility;
|
|
381
|
+
readonly textOverflow: TwUtility;
|
|
382
|
+
readonly textWrap: TwUtility;
|
|
383
|
+
readonly textIndent: TwUtility;
|
|
384
|
+
readonly verticalAlign: TwUtility;
|
|
385
|
+
readonly whitespace: TwUtility;
|
|
386
|
+
readonly wordBreak: TwUtility;
|
|
387
|
+
readonly hyphens: TwUtility;
|
|
388
|
+
readonly content: TwUtility;
|
|
389
|
+
readonly grid: TwUtility;
|
|
390
|
+
readonly gridCols: TwUtility;
|
|
391
|
+
readonly gridRows: TwUtility;
|
|
392
|
+
readonly w: TwUtility;
|
|
393
|
+
readonly h: TwUtility;
|
|
394
|
+
readonly size: TwUtility;
|
|
395
|
+
readonly minW: TwUtility;
|
|
396
|
+
readonly minH: TwUtility;
|
|
397
|
+
readonly maxW: TwUtility;
|
|
398
|
+
readonly maxH: TwUtility;
|
|
399
|
+
readonly display: TwUtility;
|
|
400
|
+
readonly items: TwUtility;
|
|
401
|
+
readonly justify: TwUtility;
|
|
402
|
+
readonly self: TwUtility;
|
|
403
|
+
readonly overflow: TwUtility;
|
|
404
|
+
readonly overflowX: TwUtility;
|
|
405
|
+
readonly overflowY: TwUtility;
|
|
406
|
+
readonly top: TwUtility;
|
|
407
|
+
readonly right: TwUtility;
|
|
408
|
+
readonly bottom: TwUtility;
|
|
409
|
+
readonly left: TwUtility;
|
|
410
|
+
readonly inset: TwUtility;
|
|
411
|
+
readonly z: TwUtility;
|
|
412
|
+
readonly aspectRatio: TwUtility;
|
|
413
|
+
readonly columns: TwUtility;
|
|
414
|
+
readonly breakAfter: TwUtility;
|
|
415
|
+
readonly breakBefore: TwUtility;
|
|
416
|
+
readonly breakInside: TwUtility;
|
|
417
|
+
readonly boxDecorationBreak: TwUtility;
|
|
418
|
+
readonly boxSizing: TwUtility;
|
|
419
|
+
readonly float: TwUtility;
|
|
420
|
+
readonly clear: TwUtility;
|
|
421
|
+
readonly objectFit: TwUtility;
|
|
422
|
+
readonly objectPosition: TwUtility;
|
|
423
|
+
readonly overscrollBehavior: TwUtility;
|
|
424
|
+
readonly overscrollX: TwUtility;
|
|
425
|
+
readonly overscrollY: TwUtility;
|
|
426
|
+
readonly insetX: TwUtility;
|
|
427
|
+
readonly insetY: TwUtility;
|
|
428
|
+
readonly start: TwUtility;
|
|
429
|
+
readonly end: TwUtility;
|
|
430
|
+
readonly flexBasis: TwUtility;
|
|
431
|
+
readonly grow: TwUtility;
|
|
432
|
+
readonly shrink: TwUtility;
|
|
433
|
+
readonly order: TwUtility;
|
|
434
|
+
readonly colSpan: TwUtility;
|
|
435
|
+
readonly colStart: TwUtility;
|
|
436
|
+
readonly colEnd: TwUtility;
|
|
437
|
+
readonly rowSpan: TwUtility;
|
|
438
|
+
readonly rowStart: TwUtility;
|
|
439
|
+
readonly rowEnd: TwUtility;
|
|
440
|
+
readonly gridFlow: TwUtility;
|
|
441
|
+
readonly autoCols: TwUtility;
|
|
442
|
+
readonly autoRows: TwUtility;
|
|
443
|
+
readonly justifyItems: TwUtility;
|
|
444
|
+
readonly justifySelf: TwUtility;
|
|
445
|
+
readonly alignContent: TwUtility;
|
|
446
|
+
readonly placeContent: TwUtility;
|
|
447
|
+
readonly placeItems: TwUtility;
|
|
448
|
+
readonly placeSelf: TwUtility;
|
|
449
|
+
readonly rounded: TwUtility;
|
|
450
|
+
readonly roundedT: TwUtility;
|
|
451
|
+
readonly roundedB: TwUtility;
|
|
452
|
+
readonly roundedL: TwUtility;
|
|
453
|
+
readonly roundedR: TwUtility;
|
|
454
|
+
readonly roundedTL: TwUtility;
|
|
455
|
+
readonly roundedTR: TwUtility;
|
|
456
|
+
readonly roundedBR: TwUtility;
|
|
457
|
+
readonly roundedBL: TwUtility;
|
|
458
|
+
readonly roundedSS: TwUtility;
|
|
459
|
+
readonly roundedSE: TwUtility;
|
|
460
|
+
readonly roundedEE: TwUtility;
|
|
461
|
+
readonly roundedES: TwUtility;
|
|
462
|
+
readonly border: TwUtility;
|
|
463
|
+
readonly borderT: TwUtility;
|
|
464
|
+
readonly borderR: TwUtility;
|
|
465
|
+
readonly borderB: TwUtility;
|
|
466
|
+
readonly borderL: TwUtility;
|
|
467
|
+
readonly borderX: TwUtility;
|
|
468
|
+
readonly borderY: TwUtility;
|
|
469
|
+
readonly borderS: TwUtility;
|
|
470
|
+
readonly borderE: TwUtility;
|
|
471
|
+
readonly borderStyle: TwUtility;
|
|
472
|
+
readonly ring: TwUtility;
|
|
473
|
+
readonly ringColor: TwUtility;
|
|
474
|
+
readonly ringOffsetWidth: TwUtility;
|
|
475
|
+
readonly ringOffsetColor: TwUtility;
|
|
476
|
+
readonly outlineWidth: TwUtility;
|
|
477
|
+
readonly outlineColor: TwUtility;
|
|
478
|
+
readonly outlineStyle: TwUtility;
|
|
479
|
+
readonly outlineOffset: TwUtility;
|
|
480
|
+
readonly outline: TwUtility;
|
|
481
|
+
readonly divideX: TwUtility;
|
|
482
|
+
readonly divideY: TwUtility;
|
|
483
|
+
readonly divideColor: TwUtility;
|
|
484
|
+
readonly divideStyle: TwUtility;
|
|
485
|
+
readonly shadow: TwUtility;
|
|
486
|
+
readonly opacity: TwUtility;
|
|
487
|
+
readonly backdrop: TwUtility;
|
|
488
|
+
readonly shadowColor: TwUtility;
|
|
489
|
+
readonly mixBlendMode: TwUtility;
|
|
490
|
+
readonly bgBlendMode: TwUtility;
|
|
491
|
+
readonly cursor: TwUtility;
|
|
492
|
+
readonly select: TwUtility;
|
|
493
|
+
readonly pointerEvents: TwUtility;
|
|
494
|
+
readonly accentColor: TwUtility;
|
|
495
|
+
readonly appearance: TwUtility;
|
|
496
|
+
readonly caretColor: TwUtility;
|
|
497
|
+
readonly resize: TwUtility;
|
|
498
|
+
readonly scrollBehavior: TwUtility;
|
|
499
|
+
readonly scrollMargin: TwUtility;
|
|
500
|
+
readonly scrollMarginX: TwUtility;
|
|
501
|
+
readonly scrollMarginY: TwUtility;
|
|
502
|
+
readonly scrollMarginT: TwUtility;
|
|
503
|
+
readonly scrollMarginR: TwUtility;
|
|
504
|
+
readonly scrollMarginB: TwUtility;
|
|
505
|
+
readonly scrollMarginL: TwUtility;
|
|
506
|
+
readonly scrollPadding: TwUtility;
|
|
507
|
+
readonly scrollPaddingX: TwUtility;
|
|
508
|
+
readonly scrollPaddingY: TwUtility;
|
|
509
|
+
readonly scrollPaddingT: TwUtility;
|
|
510
|
+
readonly scrollPaddingR: TwUtility;
|
|
511
|
+
readonly scrollPaddingB: TwUtility;
|
|
512
|
+
readonly scrollPaddingL: TwUtility;
|
|
513
|
+
readonly snapAlign: TwUtility;
|
|
514
|
+
readonly snapStop: TwUtility;
|
|
515
|
+
readonly snapType: TwUtility;
|
|
516
|
+
readonly touchAction: TwUtility;
|
|
517
|
+
readonly willChange: TwUtility;
|
|
518
|
+
readonly blur: TwUtility;
|
|
519
|
+
readonly brightness: TwUtility;
|
|
520
|
+
readonly contrast: TwUtility;
|
|
521
|
+
readonly dropShadow: TwUtility;
|
|
522
|
+
readonly grayscale: TwUtility;
|
|
523
|
+
readonly hueRotate: TwUtility;
|
|
524
|
+
readonly invert: TwUtility;
|
|
525
|
+
readonly saturate: TwUtility;
|
|
526
|
+
readonly sepia: TwUtility;
|
|
527
|
+
readonly backdropBlur: TwUtility;
|
|
528
|
+
readonly backdropBrightness: TwUtility;
|
|
529
|
+
readonly backdropContrast: TwUtility;
|
|
530
|
+
readonly backdropGrayscale: TwUtility;
|
|
531
|
+
readonly backdropHueRotate: TwUtility;
|
|
532
|
+
readonly backdropInvert: TwUtility;
|
|
533
|
+
readonly backdropOpacity: TwUtility;
|
|
534
|
+
readonly backdropSaturate: TwUtility;
|
|
535
|
+
readonly backdropSepia: TwUtility;
|
|
536
|
+
readonly scale: TwUtility;
|
|
537
|
+
readonly scaleX: TwUtility;
|
|
538
|
+
readonly scaleY: TwUtility;
|
|
539
|
+
readonly rotate: TwUtility;
|
|
540
|
+
readonly translateX: TwUtility;
|
|
541
|
+
readonly translateY: TwUtility;
|
|
542
|
+
readonly skewX: TwUtility;
|
|
543
|
+
readonly skewY: TwUtility;
|
|
544
|
+
readonly transformOrigin: TwUtility;
|
|
545
|
+
readonly transition: TwUtility;
|
|
546
|
+
readonly duration: TwUtility;
|
|
547
|
+
readonly ease: TwUtility;
|
|
548
|
+
readonly delay: TwUtility;
|
|
549
|
+
readonly animate: TwUtility;
|
|
550
|
+
readonly borderSpacing: TwUtility;
|
|
551
|
+
readonly borderSpacingX: TwUtility;
|
|
552
|
+
readonly borderSpacingY: TwUtility;
|
|
553
|
+
readonly tableLayout: TwUtility;
|
|
554
|
+
readonly captionSide: TwUtility;
|
|
555
|
+
readonly fill: TwUtility;
|
|
556
|
+
readonly stroke: TwUtility;
|
|
557
|
+
readonly strokeWidth: TwUtility;
|
|
558
|
+
readonly forcedColorAdjust: TwUtility;
|
|
559
|
+
readonly bgAttachment: TwUtility;
|
|
560
|
+
readonly bgClip: TwUtility;
|
|
561
|
+
readonly bgOrigin: TwUtility;
|
|
562
|
+
readonly bgPosition: TwUtility;
|
|
563
|
+
readonly bgRepeat: TwUtility;
|
|
564
|
+
readonly bgSize: TwUtility;
|
|
565
|
+
readonly bgImage: TwUtility;
|
|
566
|
+
readonly bgGradient: TwUtility;
|
|
567
|
+
readonly gradientFrom: TwUtility;
|
|
568
|
+
readonly gradientVia: TwUtility;
|
|
569
|
+
readonly gradientTo: TwUtility;
|
|
570
|
+
readonly flex: TwChainString;
|
|
571
|
+
readonly flexCol: TwChainString;
|
|
572
|
+
readonly flexRow: TwChainString;
|
|
573
|
+
readonly flexWrap: TwChainString;
|
|
574
|
+
readonly inlineFlex: TwChainString;
|
|
575
|
+
readonly relative: TwChainString;
|
|
576
|
+
readonly absolute: TwChainString;
|
|
577
|
+
readonly fixed: TwChainString;
|
|
578
|
+
readonly sticky: TwChainString;
|
|
579
|
+
readonly static: TwChainString;
|
|
580
|
+
readonly visible: TwChainString;
|
|
581
|
+
readonly invisible: TwChainString;
|
|
582
|
+
readonly collapse: TwChainString;
|
|
583
|
+
readonly isolate: TwChainString;
|
|
584
|
+
readonly isolationAuto: TwChainString;
|
|
585
|
+
readonly container: TwChainString;
|
|
586
|
+
readonly flexRowReverse: TwChainString;
|
|
587
|
+
readonly flexColReverse: TwChainString;
|
|
588
|
+
readonly flexWrapReverse: TwChainString;
|
|
589
|
+
readonly flexNowrap: TwChainString;
|
|
590
|
+
readonly flex1: TwChainString;
|
|
591
|
+
readonly flexAuto: TwChainString;
|
|
592
|
+
readonly flexInitial: TwChainString;
|
|
593
|
+
readonly flexNone: TwChainString;
|
|
594
|
+
readonly antialiased: TwChainString;
|
|
595
|
+
readonly subpixelAntialiased: TwChainString;
|
|
596
|
+
readonly italic: TwChainString;
|
|
597
|
+
readonly notItalic: TwChainString;
|
|
598
|
+
readonly truncate: TwChainString;
|
|
599
|
+
readonly normalNums: TwChainString;
|
|
600
|
+
readonly ordinal: TwChainString;
|
|
601
|
+
readonly slashedZero: TwChainString;
|
|
602
|
+
readonly liningNums: TwChainString;
|
|
603
|
+
readonly oldstyleNums: TwChainString;
|
|
604
|
+
readonly proportionalNums: TwChainString;
|
|
605
|
+
readonly tabularNums: TwChainString;
|
|
606
|
+
readonly diagonalFractions: TwChainString;
|
|
607
|
+
readonly stackedFractions: TwChainString;
|
|
608
|
+
readonly ringInset: TwChainString;
|
|
609
|
+
readonly outlineNone: TwChainString;
|
|
610
|
+
readonly borderCollapse: TwChainString;
|
|
611
|
+
readonly borderSeparate: TwChainString;
|
|
612
|
+
readonly spaceXReverse: TwChainString;
|
|
613
|
+
readonly spaceYReverse: TwChainString;
|
|
614
|
+
readonly divideXReverse: TwChainString;
|
|
615
|
+
readonly divideYReverse: TwChainString;
|
|
616
|
+
readonly transformGpu: TwChainString;
|
|
617
|
+
readonly transformNone: TwChainString;
|
|
618
|
+
readonly transitionAll: TwChainString;
|
|
619
|
+
readonly transitionColors: TwChainString;
|
|
620
|
+
readonly transitionOpacity: TwChainString;
|
|
621
|
+
readonly transitionShadow: TwChainString;
|
|
622
|
+
readonly transitionTransform: TwChainString;
|
|
623
|
+
readonly transitionNone: TwChainString;
|
|
624
|
+
readonly srOnly: TwChainString;
|
|
625
|
+
readonly notSrOnly: TwChainString;
|
|
626
|
+
readonly group: TwChainString;
|
|
627
|
+
readonly peer: TwChainString;
|
|
628
|
+
readonly hover: TwModifier;
|
|
629
|
+
readonly focus: TwModifier;
|
|
630
|
+
readonly active: TwModifier;
|
|
631
|
+
readonly disabled: TwModifier;
|
|
632
|
+
readonly focusVisible: TwModifier;
|
|
633
|
+
readonly focusWithin: TwModifier;
|
|
634
|
+
readonly firstChild: TwModifier;
|
|
635
|
+
readonly lastChild: TwModifier;
|
|
636
|
+
readonly visited: TwModifier;
|
|
637
|
+
readonly checked: TwModifier;
|
|
638
|
+
readonly indeterminate: TwModifier;
|
|
639
|
+
readonly default: TwModifier;
|
|
640
|
+
readonly required: TwModifier;
|
|
641
|
+
readonly valid: TwModifier;
|
|
642
|
+
readonly invalid: TwModifier;
|
|
643
|
+
readonly inRange: TwModifier;
|
|
644
|
+
readonly outOfRange: TwModifier;
|
|
645
|
+
readonly placeholderShown: TwModifier;
|
|
646
|
+
readonly autofill: TwModifier;
|
|
647
|
+
readonly readOnly: TwModifier;
|
|
648
|
+
readonly empty: TwModifier;
|
|
649
|
+
readonly even: TwModifier;
|
|
650
|
+
readonly odd: TwModifier;
|
|
651
|
+
readonly firstOfType: TwModifier;
|
|
652
|
+
readonly lastOfType: TwModifier;
|
|
653
|
+
readonly onlyChild: TwModifier;
|
|
654
|
+
readonly onlyOfType: TwModifier;
|
|
655
|
+
readonly target: TwModifier;
|
|
656
|
+
readonly open: TwModifier;
|
|
657
|
+
readonly sm: TwModifier;
|
|
658
|
+
readonly md: TwModifier;
|
|
659
|
+
readonly lg: TwModifier;
|
|
660
|
+
readonly xl: TwModifier;
|
|
661
|
+
readonly _2xl: TwModifier;
|
|
662
|
+
readonly maxSm: TwModifier;
|
|
663
|
+
readonly maxMd: TwModifier;
|
|
664
|
+
readonly maxLg: TwModifier;
|
|
665
|
+
readonly maxXl: TwModifier;
|
|
666
|
+
readonly max2xl: TwModifier;
|
|
667
|
+
readonly dark: TwModifier;
|
|
668
|
+
readonly motionReduce: TwModifier;
|
|
669
|
+
readonly motionSafe: TwModifier;
|
|
670
|
+
readonly print: TwModifier;
|
|
671
|
+
readonly portrait: TwModifier;
|
|
672
|
+
readonly landscape: TwModifier;
|
|
673
|
+
readonly contrastMore: TwModifier;
|
|
674
|
+
readonly contrastLess: TwModifier;
|
|
675
|
+
readonly forcedColors: TwModifier;
|
|
676
|
+
readonly before: TwModifier;
|
|
677
|
+
readonly after: TwModifier;
|
|
678
|
+
readonly placeholder: TwModifier;
|
|
679
|
+
readonly file: TwModifier;
|
|
680
|
+
readonly marker: TwModifier;
|
|
681
|
+
readonly selection: TwModifier;
|
|
682
|
+
readonly firstLine: TwModifier;
|
|
683
|
+
readonly firstLetter: TwModifier;
|
|
684
|
+
readonly backdropEl: TwModifier;
|
|
685
|
+
readonly ariaChecked: TwModifier;
|
|
686
|
+
readonly ariaDisabled: TwModifier;
|
|
687
|
+
readonly ariaExpanded: TwModifier;
|
|
688
|
+
readonly ariaHidden: TwModifier;
|
|
689
|
+
readonly ariaPressed: TwModifier;
|
|
690
|
+
readonly ariaReadonly: TwModifier;
|
|
691
|
+
readonly ariaRequired: TwModifier;
|
|
692
|
+
readonly ariaSelected: TwModifier;
|
|
693
|
+
readonly groupHover: TwModifier;
|
|
694
|
+
readonly groupFocus: TwModifier;
|
|
695
|
+
readonly groupActive: TwModifier;
|
|
696
|
+
readonly groupFocusVisible: TwModifier;
|
|
697
|
+
readonly groupFocusWithin: TwModifier;
|
|
698
|
+
readonly groupDisabled: TwModifier;
|
|
699
|
+
readonly groupChecked: TwModifier;
|
|
700
|
+
readonly groupEmpty: TwModifier;
|
|
701
|
+
readonly groupFirst: TwModifier;
|
|
702
|
+
readonly groupLast: TwModifier;
|
|
703
|
+
readonly groupOdd: TwModifier;
|
|
704
|
+
readonly groupEven: TwModifier;
|
|
705
|
+
readonly groupOpen: TwModifier;
|
|
706
|
+
readonly groupVisited: TwModifier;
|
|
707
|
+
readonly peerHover: TwModifier;
|
|
708
|
+
readonly peerFocus: TwModifier;
|
|
709
|
+
readonly peerActive: TwModifier;
|
|
710
|
+
readonly peerFocusVisible: TwModifier;
|
|
711
|
+
readonly peerDisabled: TwModifier;
|
|
712
|
+
readonly peerChecked: TwModifier;
|
|
713
|
+
readonly peerInvalid: TwModifier;
|
|
714
|
+
readonly peerRequired: TwModifier;
|
|
715
|
+
readonly peerPlaceholderShown: TwModifier;
|
|
716
|
+
readonly peerFocusWithin: TwModifier;
|
|
717
|
+
readonly peerEmpty: TwModifier;
|
|
718
|
+
readonly peerFirst: TwModifier;
|
|
719
|
+
readonly peerLast: TwModifier;
|
|
720
|
+
readonly peerOdd: TwModifier;
|
|
721
|
+
readonly peerEven: TwModifier;
|
|
722
|
+
readonly peerOpen: TwModifier;
|
|
723
|
+
readonly peerVisited: TwModifier;
|
|
724
|
+
readonly rtl: TwModifier;
|
|
725
|
+
readonly ltr: TwModifier;
|
|
726
|
+
readonly has: TwParamModifier;
|
|
727
|
+
readonly aria: TwParamModifier;
|
|
728
|
+
readonly data: TwParamModifier;
|
|
729
|
+
readonly supports: TwParamModifier;
|
|
730
|
+
readonly groupHas: TwParamModifier;
|
|
731
|
+
readonly peerHas: TwParamModifier;
|
|
732
|
+
/** Fallback: unknown properties are treated as raw class names */
|
|
733
|
+
[key: string]: any;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Proxy-based chainable style builder.
|
|
737
|
+
*
|
|
738
|
+
* An alternative to importing individual utility and modifier functions.
|
|
739
|
+
* One import gives you access to every utility, modifier, and value-less
|
|
740
|
+
* shorthand through a fluent, chainable API.
|
|
741
|
+
*
|
|
742
|
+
* @example Basic chaining — any order
|
|
743
|
+
* ```ts
|
|
744
|
+
* import { tw } from 'typewritingclass'
|
|
745
|
+
*
|
|
746
|
+
* const card = tw.bg('slate-50').rounded('xl').p(6).shadow('md')
|
|
747
|
+
* ```
|
|
748
|
+
*
|
|
749
|
+
* @example Single-utility modifier (property syntax)
|
|
750
|
+
* ```ts
|
|
751
|
+
* const title = tw.textColor('slate-900').hover.textColor('blue-600')
|
|
752
|
+
* ```
|
|
753
|
+
*
|
|
754
|
+
* @example Multi-utility modifier (function syntax)
|
|
755
|
+
* ```ts
|
|
756
|
+
* const card = tw
|
|
757
|
+
* .bg('slate-50')
|
|
758
|
+
* .rounded('xl')
|
|
759
|
+
* .p(6)
|
|
760
|
+
* .hover(tw.bg('slate-100').shadow('lg').scale(105))
|
|
761
|
+
* .focus(tw.ring(2).ringColor('blue-500'))
|
|
762
|
+
* ```
|
|
763
|
+
*
|
|
764
|
+
* @example Value-less utilities
|
|
765
|
+
* ```ts
|
|
766
|
+
* const wrapper = tw.group.flex.flexCol.relative
|
|
767
|
+
* ```
|
|
768
|
+
*
|
|
769
|
+
* @example Group/peer modifiers
|
|
770
|
+
* ```ts
|
|
771
|
+
* const icon = tw.opacity(0.5).groupHover.opacity(1)
|
|
772
|
+
* ```
|
|
773
|
+
*
|
|
774
|
+
* @example Resolves to class string automatically
|
|
775
|
+
* ```ts
|
|
776
|
+
* <div className={tw.p(4).bg('blue-500')} />
|
|
777
|
+
* <div className={`${tw.p(4)} extra-class`} />
|
|
778
|
+
* const classes = tw.p(4).bg('blue-500').toString()
|
|
779
|
+
* const classes = tw.p(4).bg('blue-500').value
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
declare const tw: TwChainString;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Loads a Google Font and returns the font family name for use with {@link fontFamily}.
|
|
786
|
+
*
|
|
787
|
+
* In browser environments this injects a `<link>` tag for the Google Fonts CSS.
|
|
788
|
+
* The returned string is the font family name, ready to pass to `fontFamily()`.
|
|
789
|
+
*
|
|
790
|
+
* @param family - The Google Font family name, e.g. `'Inter'` or `'Fira Code'`.
|
|
791
|
+
* @param options - Optional settings for weights and display strategy.
|
|
792
|
+
* @returns The font family name string.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```ts
|
|
796
|
+
* import { tw, googleFonts } from 'typewritingclass'
|
|
797
|
+
*
|
|
798
|
+
* const heading = tw.fontFamily(googleFonts('Inter'))
|
|
799
|
+
* ```
|
|
800
|
+
*
|
|
801
|
+
* @example With specific weights
|
|
802
|
+
* ```ts
|
|
803
|
+
* const body = tw.fontFamily(googleFonts('Roboto', { weights: [400, 700] }))
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
806
|
+
declare function googleFonts(family: string, options?: {
|
|
807
|
+
weights?: number[];
|
|
808
|
+
display?: string;
|
|
809
|
+
}): string;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Sets padding on all sides.
|
|
813
|
+
*
|
|
814
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
815
|
+
* or a {@link DynamicValue} for runtime values.
|
|
816
|
+
*
|
|
817
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'2.5rem'`), or `dynamic()` value.
|
|
818
|
+
* @returns A {@link StyleRule} that sets `padding`.
|
|
819
|
+
*
|
|
820
|
+
* @example Theme scale
|
|
821
|
+
* ```ts
|
|
822
|
+
* import { cx, p } from 'typewritingclass'
|
|
823
|
+
*
|
|
824
|
+
* cx(p(4))
|
|
825
|
+
* // CSS: padding: 1rem;
|
|
826
|
+
* ```
|
|
827
|
+
*
|
|
828
|
+
* @example Raw value
|
|
829
|
+
* ```ts
|
|
830
|
+
* cx(p('2.5rem'))
|
|
831
|
+
* // CSS: padding: 2.5rem;
|
|
832
|
+
* ```
|
|
833
|
+
*
|
|
834
|
+
* @example Dynamic value
|
|
835
|
+
* ```ts
|
|
836
|
+
* import { dcx, p, dynamic } from 'typewritingclass'
|
|
837
|
+
*
|
|
838
|
+
* const { className, style } = dcx(p(dynamic(spacing)))
|
|
839
|
+
* // CSS: padding: var(--twc-d0);
|
|
840
|
+
* // style: { '--twc-d0': spacing }
|
|
841
|
+
* ```
|
|
842
|
+
*/
|
|
843
|
+
declare function p(value: number | string | DynamicValue): StyleRule;
|
|
844
|
+
/**
|
|
845
|
+
* Sets horizontal padding (left and right).
|
|
846
|
+
*
|
|
847
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
848
|
+
* or a {@link DynamicValue} for runtime values.
|
|
849
|
+
*
|
|
850
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'20px'`), or `dynamic()` value.
|
|
851
|
+
* @returns A {@link StyleRule} that sets `padding-left` and `padding-right`.
|
|
852
|
+
*
|
|
853
|
+
* @example Theme scale
|
|
854
|
+
* ```ts
|
|
855
|
+
* import { cx, px } from 'typewritingclass'
|
|
856
|
+
*
|
|
857
|
+
* cx(px(6))
|
|
858
|
+
* // CSS: padding-left: 1.5rem; padding-right: 1.5rem;
|
|
859
|
+
* ```
|
|
860
|
+
*
|
|
861
|
+
* @example Raw value
|
|
862
|
+
* ```ts
|
|
863
|
+
* cx(px('10px'))
|
|
864
|
+
* // CSS: padding-left: 10px; padding-right: 10px;
|
|
865
|
+
* ```
|
|
866
|
+
*
|
|
867
|
+
* @example Dynamic value
|
|
868
|
+
* ```ts
|
|
869
|
+
* import { dcx, px, dynamic } from 'typewritingclass'
|
|
870
|
+
*
|
|
871
|
+
* const { className, style } = dcx(px(dynamic(spacing)))
|
|
872
|
+
* // CSS: padding-left: var(--twc-d0); padding-right: var(--twc-d0);
|
|
873
|
+
* // style: { '--twc-d0': spacing }
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
declare function px(value: number | string | DynamicValue): StyleRule;
|
|
877
|
+
/**
|
|
878
|
+
* Sets vertical padding (top and bottom).
|
|
879
|
+
*
|
|
880
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
881
|
+
* or a {@link DynamicValue} for runtime values.
|
|
882
|
+
*
|
|
883
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'20px'`), or `dynamic()` value.
|
|
884
|
+
* @returns A {@link StyleRule} that sets `padding-top` and `padding-bottom`.
|
|
885
|
+
*
|
|
886
|
+
* @example Theme scale
|
|
887
|
+
* ```ts
|
|
888
|
+
* import { cx, py } from 'typewritingclass'
|
|
889
|
+
*
|
|
890
|
+
* cx(py(2))
|
|
891
|
+
* // CSS: padding-top: 0.5rem; padding-bottom: 0.5rem;
|
|
892
|
+
* ```
|
|
893
|
+
*
|
|
894
|
+
* @example Raw value
|
|
895
|
+
* ```ts
|
|
896
|
+
* cx(py('1em'))
|
|
897
|
+
* // CSS: padding-top: 1em; padding-bottom: 1em;
|
|
898
|
+
* ```
|
|
899
|
+
*
|
|
900
|
+
* @example Dynamic value
|
|
901
|
+
* ```ts
|
|
902
|
+
* import { dcx, py, dynamic } from 'typewritingclass'
|
|
903
|
+
*
|
|
904
|
+
* const { className, style } = dcx(py(dynamic(spacing)))
|
|
905
|
+
* // CSS: padding-top: var(--twc-d0); padding-bottom: var(--twc-d0);
|
|
906
|
+
* // style: { '--twc-d0': spacing }
|
|
907
|
+
* ```
|
|
908
|
+
*/
|
|
909
|
+
declare function py(value: number | string | DynamicValue): StyleRule;
|
|
910
|
+
/**
|
|
911
|
+
* Sets top padding.
|
|
912
|
+
*
|
|
913
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
914
|
+
* or a {@link DynamicValue} for runtime values.
|
|
915
|
+
*
|
|
916
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'8px'`), or `dynamic()` value.
|
|
917
|
+
* @returns A {@link StyleRule} that sets `padding-top`.
|
|
918
|
+
*
|
|
919
|
+
* @example Theme scale
|
|
920
|
+
* ```ts
|
|
921
|
+
* import { cx, pt } from 'typewritingclass'
|
|
922
|
+
*
|
|
923
|
+
* cx(pt(8))
|
|
924
|
+
* // CSS: padding-top: 2rem;
|
|
925
|
+
* ```
|
|
926
|
+
*
|
|
927
|
+
* @example Raw value
|
|
928
|
+
* ```ts
|
|
929
|
+
* cx(pt('0.5em'))
|
|
930
|
+
* // CSS: padding-top: 0.5em;
|
|
931
|
+
* ```
|
|
932
|
+
*
|
|
933
|
+
* @example Dynamic value
|
|
934
|
+
* ```ts
|
|
935
|
+
* import { dcx, pt, dynamic } from 'typewritingclass'
|
|
936
|
+
*
|
|
937
|
+
* const { className, style } = dcx(pt(dynamic(spacing)))
|
|
938
|
+
* // CSS: padding-top: var(--twc-d0);
|
|
939
|
+
* // style: { '--twc-d0': spacing }
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
declare function pt(value: number | string | DynamicValue): StyleRule;
|
|
943
|
+
/**
|
|
944
|
+
* Sets right padding.
|
|
945
|
+
*
|
|
946
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
947
|
+
* or a {@link DynamicValue} for runtime values.
|
|
948
|
+
*
|
|
949
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'12px'`), or `dynamic()` value.
|
|
950
|
+
* @returns A {@link StyleRule} that sets `padding-right`.
|
|
951
|
+
*
|
|
952
|
+
* @example Theme scale
|
|
953
|
+
* ```ts
|
|
954
|
+
* import { cx, pr } from 'typewritingclass'
|
|
955
|
+
*
|
|
956
|
+
* cx(pr(3))
|
|
957
|
+
* // CSS: padding-right: 0.75rem;
|
|
958
|
+
* ```
|
|
959
|
+
*
|
|
960
|
+
* @example Raw value
|
|
961
|
+
* ```ts
|
|
962
|
+
* cx(pr('1rem'))
|
|
963
|
+
* // CSS: padding-right: 1rem;
|
|
964
|
+
* ```
|
|
965
|
+
*
|
|
966
|
+
* @example Dynamic value
|
|
967
|
+
* ```ts
|
|
968
|
+
* import { dcx, pr, dynamic } from 'typewritingclass'
|
|
969
|
+
*
|
|
970
|
+
* const { className, style } = dcx(pr(dynamic(spacing)))
|
|
971
|
+
* // CSS: padding-right: var(--twc-d0);
|
|
972
|
+
* // style: { '--twc-d0': spacing }
|
|
973
|
+
* ```
|
|
974
|
+
*/
|
|
975
|
+
declare function pr(value: number | string | DynamicValue): StyleRule;
|
|
976
|
+
/**
|
|
977
|
+
* Sets bottom padding.
|
|
978
|
+
*
|
|
979
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
980
|
+
* or a {@link DynamicValue} for runtime values.
|
|
981
|
+
*
|
|
982
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'16px'`), or `dynamic()` value.
|
|
983
|
+
* @returns A {@link StyleRule} that sets `padding-bottom`.
|
|
984
|
+
*
|
|
985
|
+
* @example Theme scale
|
|
986
|
+
* ```ts
|
|
987
|
+
* import { cx, pb } from 'typewritingclass'
|
|
988
|
+
*
|
|
989
|
+
* cx(pb(10))
|
|
990
|
+
* // CSS: padding-bottom: 2.5rem;
|
|
991
|
+
* ```
|
|
992
|
+
*
|
|
993
|
+
* @example Raw value
|
|
994
|
+
* ```ts
|
|
995
|
+
* cx(pb('2em'))
|
|
996
|
+
* // CSS: padding-bottom: 2em;
|
|
997
|
+
* ```
|
|
998
|
+
*
|
|
999
|
+
* @example Dynamic value
|
|
1000
|
+
* ```ts
|
|
1001
|
+
* import { dcx, pb, dynamic } from 'typewritingclass'
|
|
1002
|
+
*
|
|
1003
|
+
* const { className, style } = dcx(pb(dynamic(spacing)))
|
|
1004
|
+
* // CSS: padding-bottom: var(--twc-d0);
|
|
1005
|
+
* // style: { '--twc-d0': spacing }
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
declare function pb(value: number | string | DynamicValue): StyleRule;
|
|
1009
|
+
/**
|
|
1010
|
+
* Sets left padding.
|
|
1011
|
+
*
|
|
1012
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1013
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1014
|
+
*
|
|
1015
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'24px'`), or `dynamic()` value.
|
|
1016
|
+
* @returns A {@link StyleRule} that sets `padding-left`.
|
|
1017
|
+
*
|
|
1018
|
+
* @example Theme scale
|
|
1019
|
+
* ```ts
|
|
1020
|
+
* import { cx, pl } from 'typewritingclass'
|
|
1021
|
+
*
|
|
1022
|
+
* cx(pl(5))
|
|
1023
|
+
* // CSS: padding-left: 1.25rem;
|
|
1024
|
+
* ```
|
|
1025
|
+
*
|
|
1026
|
+
* @example Raw value
|
|
1027
|
+
* ```ts
|
|
1028
|
+
* cx(pl('3ch'))
|
|
1029
|
+
* // CSS: padding-left: 3ch;
|
|
1030
|
+
* ```
|
|
1031
|
+
*
|
|
1032
|
+
* @example Dynamic value
|
|
1033
|
+
* ```ts
|
|
1034
|
+
* import { dcx, pl, dynamic } from 'typewritingclass'
|
|
1035
|
+
*
|
|
1036
|
+
* const { className, style } = dcx(pl(dynamic(spacing)))
|
|
1037
|
+
* // CSS: padding-left: var(--twc-d0);
|
|
1038
|
+
* // style: { '--twc-d0': spacing }
|
|
1039
|
+
* ```
|
|
1040
|
+
*/
|
|
1041
|
+
declare function pl(value: number | string | DynamicValue): StyleRule;
|
|
1042
|
+
/**
|
|
1043
|
+
* Sets margin on all sides.
|
|
1044
|
+
*
|
|
1045
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1046
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1047
|
+
*
|
|
1048
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'auto'`), or `dynamic()` value.
|
|
1049
|
+
* @returns A {@link StyleRule} that sets `margin`.
|
|
1050
|
+
*
|
|
1051
|
+
* @example Theme scale
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* import { cx, m } from 'typewritingclass'
|
|
1054
|
+
*
|
|
1055
|
+
* cx(m(4))
|
|
1056
|
+
* // CSS: margin: 1rem;
|
|
1057
|
+
* ```
|
|
1058
|
+
*
|
|
1059
|
+
* @example Raw value
|
|
1060
|
+
* ```ts
|
|
1061
|
+
* cx(m('auto'))
|
|
1062
|
+
* // CSS: margin: auto;
|
|
1063
|
+
* ```
|
|
1064
|
+
*
|
|
1065
|
+
* @example Dynamic value
|
|
1066
|
+
* ```ts
|
|
1067
|
+
* import { dcx, m, dynamic } from 'typewritingclass'
|
|
1068
|
+
*
|
|
1069
|
+
* const { className, style } = dcx(m(dynamic(spacing)))
|
|
1070
|
+
* // CSS: margin: var(--twc-d0);
|
|
1071
|
+
* // style: { '--twc-d0': spacing }
|
|
1072
|
+
* ```
|
|
1073
|
+
*/
|
|
1074
|
+
declare function m(value: number | string | DynamicValue): StyleRule;
|
|
1075
|
+
/**
|
|
1076
|
+
* Sets horizontal margin (left and right).
|
|
1077
|
+
*
|
|
1078
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1079
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1080
|
+
*
|
|
1081
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'auto'`), or `dynamic()` value.
|
|
1082
|
+
* @returns A {@link StyleRule} that sets `margin-left` and `margin-right`.
|
|
1083
|
+
*
|
|
1084
|
+
* @example Theme scale
|
|
1085
|
+
* ```ts
|
|
1086
|
+
* import { cx, mx } from 'typewritingclass'
|
|
1087
|
+
*
|
|
1088
|
+
* cx(mx(8))
|
|
1089
|
+
* // CSS: margin-left: 2rem; margin-right: 2rem;
|
|
1090
|
+
* ```
|
|
1091
|
+
*
|
|
1092
|
+
* @example Raw value
|
|
1093
|
+
* ```ts
|
|
1094
|
+
* cx(mx('auto'))
|
|
1095
|
+
* // CSS: margin-left: auto; margin-right: auto;
|
|
1096
|
+
* ```
|
|
1097
|
+
*
|
|
1098
|
+
* @example Dynamic value
|
|
1099
|
+
* ```ts
|
|
1100
|
+
* import { dcx, mx, dynamic } from 'typewritingclass'
|
|
1101
|
+
*
|
|
1102
|
+
* const { className, style } = dcx(mx(dynamic(spacing)))
|
|
1103
|
+
* // CSS: margin-left: var(--twc-d0); margin-right: var(--twc-d0);
|
|
1104
|
+
* // style: { '--twc-d0': spacing }
|
|
1105
|
+
* ```
|
|
1106
|
+
*/
|
|
1107
|
+
declare function mx(value: number | string | DynamicValue): StyleRule;
|
|
1108
|
+
/**
|
|
1109
|
+
* Sets vertical margin (top and bottom).
|
|
1110
|
+
*
|
|
1111
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1112
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1113
|
+
*
|
|
1114
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'2em'`), or `dynamic()` value.
|
|
1115
|
+
* @returns A {@link StyleRule} that sets `margin-top` and `margin-bottom`.
|
|
1116
|
+
*
|
|
1117
|
+
* @example Theme scale
|
|
1118
|
+
* ```ts
|
|
1119
|
+
* import { cx, my } from 'typewritingclass'
|
|
1120
|
+
*
|
|
1121
|
+
* cx(my(6))
|
|
1122
|
+
* // CSS: margin-top: 1.5rem; margin-bottom: 1.5rem;
|
|
1123
|
+
* ```
|
|
1124
|
+
*
|
|
1125
|
+
* @example Raw value
|
|
1126
|
+
* ```ts
|
|
1127
|
+
* cx(my('0.5em'))
|
|
1128
|
+
* // CSS: margin-top: 0.5em; margin-bottom: 0.5em;
|
|
1129
|
+
* ```
|
|
1130
|
+
*
|
|
1131
|
+
* @example Dynamic value
|
|
1132
|
+
* ```ts
|
|
1133
|
+
* import { dcx, my, dynamic } from 'typewritingclass'
|
|
1134
|
+
*
|
|
1135
|
+
* const { className, style } = dcx(my(dynamic(spacing)))
|
|
1136
|
+
* // CSS: margin-top: var(--twc-d0); margin-bottom: var(--twc-d0);
|
|
1137
|
+
* // style: { '--twc-d0': spacing }
|
|
1138
|
+
* ```
|
|
1139
|
+
*/
|
|
1140
|
+
declare function my(value: number | string | DynamicValue): StyleRule;
|
|
1141
|
+
/**
|
|
1142
|
+
* Sets top margin.
|
|
1143
|
+
*
|
|
1144
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1145
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1146
|
+
*
|
|
1147
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'1em'`), or `dynamic()` value.
|
|
1148
|
+
* @returns A {@link StyleRule} that sets `margin-top`.
|
|
1149
|
+
*
|
|
1150
|
+
* @example Theme scale
|
|
1151
|
+
* ```ts
|
|
1152
|
+
* import { cx, mt } from 'typewritingclass'
|
|
1153
|
+
*
|
|
1154
|
+
* cx(mt(2))
|
|
1155
|
+
* // CSS: margin-top: 0.5rem;
|
|
1156
|
+
* ```
|
|
1157
|
+
*
|
|
1158
|
+
* @example Raw value
|
|
1159
|
+
* ```ts
|
|
1160
|
+
* cx(mt('10px'))
|
|
1161
|
+
* // CSS: margin-top: 10px;
|
|
1162
|
+
* ```
|
|
1163
|
+
*
|
|
1164
|
+
* @example Dynamic value
|
|
1165
|
+
* ```ts
|
|
1166
|
+
* import { dcx, mt, dynamic } from 'typewritingclass'
|
|
1167
|
+
*
|
|
1168
|
+
* const { className, style } = dcx(mt(dynamic(spacing)))
|
|
1169
|
+
* // CSS: margin-top: var(--twc-d0);
|
|
1170
|
+
* // style: { '--twc-d0': spacing }
|
|
1171
|
+
* ```
|
|
1172
|
+
*/
|
|
1173
|
+
declare function mt(value: number | string | DynamicValue): StyleRule;
|
|
1174
|
+
/**
|
|
1175
|
+
* Sets right margin.
|
|
1176
|
+
*
|
|
1177
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1178
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1179
|
+
*
|
|
1180
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'1em'`), or `dynamic()` value.
|
|
1181
|
+
* @returns A {@link StyleRule} that sets `margin-right`.
|
|
1182
|
+
*
|
|
1183
|
+
* @example Theme scale
|
|
1184
|
+
* ```ts
|
|
1185
|
+
* import { cx, mr } from 'typewritingclass'
|
|
1186
|
+
*
|
|
1187
|
+
* cx(mr(3))
|
|
1188
|
+
* // CSS: margin-right: 0.75rem;
|
|
1189
|
+
* ```
|
|
1190
|
+
*
|
|
1191
|
+
* @example Raw value
|
|
1192
|
+
* ```ts
|
|
1193
|
+
* cx(mr('auto'))
|
|
1194
|
+
* // CSS: margin-right: auto;
|
|
1195
|
+
* ```
|
|
1196
|
+
*
|
|
1197
|
+
* @example Dynamic value
|
|
1198
|
+
* ```ts
|
|
1199
|
+
* import { dcx, mr, dynamic } from 'typewritingclass'
|
|
1200
|
+
*
|
|
1201
|
+
* const { className, style } = dcx(mr(dynamic(spacing)))
|
|
1202
|
+
* // CSS: margin-right: var(--twc-d0);
|
|
1203
|
+
* // style: { '--twc-d0': spacing }
|
|
1204
|
+
* ```
|
|
1205
|
+
*/
|
|
1206
|
+
declare function mr(value: number | string | DynamicValue): StyleRule;
|
|
1207
|
+
/**
|
|
1208
|
+
* Sets bottom margin.
|
|
1209
|
+
*
|
|
1210
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1211
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1212
|
+
*
|
|
1213
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'2em'`), or `dynamic()` value.
|
|
1214
|
+
* @returns A {@link StyleRule} that sets `margin-bottom`.
|
|
1215
|
+
*
|
|
1216
|
+
* @example Theme scale
|
|
1217
|
+
* ```ts
|
|
1218
|
+
* import { cx, mb } from 'typewritingclass'
|
|
1219
|
+
*
|
|
1220
|
+
* cx(mb(4))
|
|
1221
|
+
* // CSS: margin-bottom: 1rem;
|
|
1222
|
+
* ```
|
|
1223
|
+
*
|
|
1224
|
+
* @example Raw value
|
|
1225
|
+
* ```ts
|
|
1226
|
+
* cx(mb('20px'))
|
|
1227
|
+
* // CSS: margin-bottom: 20px;
|
|
1228
|
+
* ```
|
|
1229
|
+
*
|
|
1230
|
+
* @example Dynamic value
|
|
1231
|
+
* ```ts
|
|
1232
|
+
* import { dcx, mb, dynamic } from 'typewritingclass'
|
|
1233
|
+
*
|
|
1234
|
+
* const { className, style } = dcx(mb(dynamic(spacing)))
|
|
1235
|
+
* // CSS: margin-bottom: var(--twc-d0);
|
|
1236
|
+
* // style: { '--twc-d0': spacing }
|
|
1237
|
+
* ```
|
|
1238
|
+
*/
|
|
1239
|
+
declare function mb(value: number | string | DynamicValue): StyleRule;
|
|
1240
|
+
/**
|
|
1241
|
+
* Sets left margin.
|
|
1242
|
+
*
|
|
1243
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1244
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1245
|
+
*
|
|
1246
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'auto'`), or `dynamic()` value.
|
|
1247
|
+
* @returns A {@link StyleRule} that sets `margin-left`.
|
|
1248
|
+
*
|
|
1249
|
+
* @example Theme scale
|
|
1250
|
+
* ```ts
|
|
1251
|
+
* import { cx, ml } from 'typewritingclass'
|
|
1252
|
+
*
|
|
1253
|
+
* cx(ml(12))
|
|
1254
|
+
* // CSS: margin-left: 3rem;
|
|
1255
|
+
* ```
|
|
1256
|
+
*
|
|
1257
|
+
* @example Raw value
|
|
1258
|
+
* ```ts
|
|
1259
|
+
* cx(ml('auto'))
|
|
1260
|
+
* // CSS: margin-left: auto;
|
|
1261
|
+
* ```
|
|
1262
|
+
*
|
|
1263
|
+
* @example Dynamic value
|
|
1264
|
+
* ```ts
|
|
1265
|
+
* import { dcx, ml, dynamic } from 'typewritingclass'
|
|
1266
|
+
*
|
|
1267
|
+
* const { className, style } = dcx(ml(dynamic(spacing)))
|
|
1268
|
+
* // CSS: margin-left: var(--twc-d0);
|
|
1269
|
+
* // style: { '--twc-d0': spacing }
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
declare function ml(value: number | string | DynamicValue): StyleRule;
|
|
1273
|
+
/**
|
|
1274
|
+
* Sets gap between flex or grid children on both axes.
|
|
1275
|
+
*
|
|
1276
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1277
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1278
|
+
*
|
|
1279
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'20px'`), or `dynamic()` value.
|
|
1280
|
+
* @returns A {@link StyleRule} that sets `gap`.
|
|
1281
|
+
*
|
|
1282
|
+
* @example Theme scale
|
|
1283
|
+
* ```ts
|
|
1284
|
+
* import { cx, gap } from 'typewritingclass'
|
|
1285
|
+
*
|
|
1286
|
+
* cx(gap(4))
|
|
1287
|
+
* // CSS: gap: 1rem;
|
|
1288
|
+
* ```
|
|
1289
|
+
*
|
|
1290
|
+
* @example Raw value
|
|
1291
|
+
* ```ts
|
|
1292
|
+
* cx(gap('1.5em'))
|
|
1293
|
+
* // CSS: gap: 1.5em;
|
|
1294
|
+
* ```
|
|
1295
|
+
*
|
|
1296
|
+
* @example Dynamic value
|
|
1297
|
+
* ```ts
|
|
1298
|
+
* import { dcx, gap, dynamic } from 'typewritingclass'
|
|
1299
|
+
*
|
|
1300
|
+
* const { className, style } = dcx(gap(dynamic(spacing)))
|
|
1301
|
+
* // CSS: gap: var(--twc-d0);
|
|
1302
|
+
* // style: { '--twc-d0': spacing }
|
|
1303
|
+
* ```
|
|
1304
|
+
*/
|
|
1305
|
+
declare function gap(value: number | string | DynamicValue): StyleRule;
|
|
1306
|
+
/**
|
|
1307
|
+
* Sets horizontal (column) gap between flex or grid children.
|
|
1308
|
+
*
|
|
1309
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1310
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1311
|
+
*
|
|
1312
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'10px'`), or `dynamic()` value.
|
|
1313
|
+
* @returns A {@link StyleRule} that sets `column-gap`.
|
|
1314
|
+
*
|
|
1315
|
+
* @example Theme scale
|
|
1316
|
+
* ```ts
|
|
1317
|
+
* import { cx, gapX } from 'typewritingclass'
|
|
1318
|
+
*
|
|
1319
|
+
* cx(gapX(2))
|
|
1320
|
+
* // CSS: column-gap: 0.5rem;
|
|
1321
|
+
* ```
|
|
1322
|
+
*
|
|
1323
|
+
* @example Raw value
|
|
1324
|
+
* ```ts
|
|
1325
|
+
* cx(gapX('12px'))
|
|
1326
|
+
* // CSS: column-gap: 12px;
|
|
1327
|
+
* ```
|
|
1328
|
+
*
|
|
1329
|
+
* @example Dynamic value
|
|
1330
|
+
* ```ts
|
|
1331
|
+
* import { dcx, gapX, dynamic } from 'typewritingclass'
|
|
1332
|
+
*
|
|
1333
|
+
* const { className, style } = dcx(gapX(dynamic(spacing)))
|
|
1334
|
+
* // CSS: column-gap: var(--twc-d0);
|
|
1335
|
+
* // style: { '--twc-d0': spacing }
|
|
1336
|
+
* ```
|
|
1337
|
+
*/
|
|
1338
|
+
declare function gapX(value: number | string | DynamicValue): StyleRule;
|
|
1339
|
+
/**
|
|
1340
|
+
* Sets vertical (row) gap between flex or grid children.
|
|
1341
|
+
*
|
|
1342
|
+
* Accepts a theme spacing scale number, a raw CSS string,
|
|
1343
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1344
|
+
*
|
|
1345
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'10px'`), or `dynamic()` value.
|
|
1346
|
+
* @returns A {@link StyleRule} that sets `row-gap`.
|
|
1347
|
+
*
|
|
1348
|
+
* @example Theme scale
|
|
1349
|
+
* ```ts
|
|
1350
|
+
* import { cx, gapY } from 'typewritingclass'
|
|
1351
|
+
*
|
|
1352
|
+
* cx(gapY(3))
|
|
1353
|
+
* // CSS: row-gap: 0.75rem;
|
|
1354
|
+
* ```
|
|
1355
|
+
*
|
|
1356
|
+
* @example Raw value
|
|
1357
|
+
* ```ts
|
|
1358
|
+
* cx(gapY('8px'))
|
|
1359
|
+
* // CSS: row-gap: 8px;
|
|
1360
|
+
* ```
|
|
1361
|
+
*
|
|
1362
|
+
* @example Dynamic value
|
|
1363
|
+
* ```ts
|
|
1364
|
+
* import { dcx, gapY, dynamic } from 'typewritingclass'
|
|
1365
|
+
*
|
|
1366
|
+
* const { className, style } = dcx(gapY(dynamic(spacing)))
|
|
1367
|
+
* // CSS: row-gap: var(--twc-d0);
|
|
1368
|
+
* // style: { '--twc-d0': spacing }
|
|
1369
|
+
* ```
|
|
1370
|
+
*/
|
|
1371
|
+
declare function gapY(value: number | string | DynamicValue): StyleRule;
|
|
1372
|
+
declare function ps(value: number | string | DynamicValue): StyleRule;
|
|
1373
|
+
declare function pe(value: number | string | DynamicValue): StyleRule;
|
|
1374
|
+
declare function ms(value: number | string | DynamicValue): StyleRule;
|
|
1375
|
+
declare function me(value: number | string | DynamicValue): StyleRule;
|
|
1376
|
+
declare function spaceX(value: number | string | DynamicValue): StyleRule;
|
|
1377
|
+
declare function spaceY(value: number | string | DynamicValue): StyleRule;
|
|
1378
|
+
declare function spaceXReverse(): StyleRule;
|
|
1379
|
+
declare function spaceYReverse(): StyleRule;
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Sets the background color of an element.
|
|
1383
|
+
*
|
|
1384
|
+
* Accepts a raw CSS color string or a {@link DynamicValue} for runtime values.
|
|
1385
|
+
*
|
|
1386
|
+
* @param color - CSS color string (e.g. `'#3b82f6'`, `'red'`, `'rgb(59, 130, 246)'`) or `dynamic()` value.
|
|
1387
|
+
* @returns A {@link StyleRule} that sets `background-color`.
|
|
1388
|
+
*
|
|
1389
|
+
* @example CSS color string
|
|
1390
|
+
* ```ts
|
|
1391
|
+
* import { cx, bg } from 'typewritingclass'
|
|
1392
|
+
*
|
|
1393
|
+
* cx(bg('#3b82f6'))
|
|
1394
|
+
* // CSS: background-color: #3b82f6;
|
|
1395
|
+
* ```
|
|
1396
|
+
*
|
|
1397
|
+
* @example Named color
|
|
1398
|
+
* ```ts
|
|
1399
|
+
* cx(bg('transparent'))
|
|
1400
|
+
* // CSS: background-color: transparent;
|
|
1401
|
+
* ```
|
|
1402
|
+
*
|
|
1403
|
+
* @example Dynamic value
|
|
1404
|
+
* ```ts
|
|
1405
|
+
* import { dcx, bg, dynamic } from 'typewritingclass'
|
|
1406
|
+
*
|
|
1407
|
+
* const { className, style } = dcx(bg(dynamic(themeColor)))
|
|
1408
|
+
* // CSS: background-color: var(--twc-d0);
|
|
1409
|
+
* // style: { '--twc-d0': themeColor }
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
declare function bg(color: string | DynamicValue): StyleRule;
|
|
1413
|
+
/**
|
|
1414
|
+
* Sets the text color of an element.
|
|
1415
|
+
*
|
|
1416
|
+
* Accepts a raw CSS color string or a {@link DynamicValue} for runtime values.
|
|
1417
|
+
*
|
|
1418
|
+
* @param color - CSS color string (e.g. `'#111827'`, `'white'`, `'rgb(17, 24, 39)'`) or `dynamic()` value.
|
|
1419
|
+
* @returns A {@link StyleRule} that sets `color`.
|
|
1420
|
+
*
|
|
1421
|
+
* @example CSS color string
|
|
1422
|
+
* ```ts
|
|
1423
|
+
* import { cx, textColor } from 'typewritingclass'
|
|
1424
|
+
*
|
|
1425
|
+
* cx(textColor('#111827'))
|
|
1426
|
+
* // CSS: color: #111827;
|
|
1427
|
+
* ```
|
|
1428
|
+
*
|
|
1429
|
+
* @example Named color
|
|
1430
|
+
* ```ts
|
|
1431
|
+
* cx(textColor('inherit'))
|
|
1432
|
+
* // CSS: color: inherit;
|
|
1433
|
+
* ```
|
|
1434
|
+
*
|
|
1435
|
+
* @example Dynamic value
|
|
1436
|
+
* ```ts
|
|
1437
|
+
* import { dcx, textColor, dynamic } from 'typewritingclass'
|
|
1438
|
+
*
|
|
1439
|
+
* const { className, style } = dcx(textColor(dynamic(themeColor)))
|
|
1440
|
+
* // CSS: color: var(--twc-d0);
|
|
1441
|
+
* // style: { '--twc-d0': themeColor }
|
|
1442
|
+
* ```
|
|
1443
|
+
*/
|
|
1444
|
+
declare function textColor(color: string | DynamicValue): StyleRule;
|
|
1445
|
+
/**
|
|
1446
|
+
* Sets the border color of an element.
|
|
1447
|
+
*
|
|
1448
|
+
* Accepts a raw CSS color string or a {@link DynamicValue} for runtime values.
|
|
1449
|
+
*
|
|
1450
|
+
* @param color - CSS color string (e.g. `'#e5e7eb'`, `'red'`, `'rgb(229, 231, 235)'`) or `dynamic()` value.
|
|
1451
|
+
* @returns A {@link StyleRule} that sets `border-color`.
|
|
1452
|
+
*
|
|
1453
|
+
* @example CSS color string
|
|
1454
|
+
* ```ts
|
|
1455
|
+
* import { cx, borderColor } from 'typewritingclass'
|
|
1456
|
+
*
|
|
1457
|
+
* cx(borderColor('#e5e7eb'))
|
|
1458
|
+
* // CSS: border-color: #e5e7eb;
|
|
1459
|
+
* ```
|
|
1460
|
+
*
|
|
1461
|
+
* @example Named color
|
|
1462
|
+
* ```ts
|
|
1463
|
+
* cx(borderColor('currentColor'))
|
|
1464
|
+
* // CSS: border-color: currentColor;
|
|
1465
|
+
* ```
|
|
1466
|
+
*
|
|
1467
|
+
* @example Dynamic value
|
|
1468
|
+
* ```ts
|
|
1469
|
+
* import { dcx, borderColor, dynamic } from 'typewritingclass'
|
|
1470
|
+
*
|
|
1471
|
+
* const { className, style } = dcx(borderColor(dynamic(themeColor)))
|
|
1472
|
+
* // CSS: border-color: var(--twc-d0);
|
|
1473
|
+
* // style: { '--twc-d0': themeColor }
|
|
1474
|
+
* ```
|
|
1475
|
+
*/
|
|
1476
|
+
declare function borderColor(color: string | DynamicValue): StyleRule;
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* Sets the font size (and optionally line height) of an element.
|
|
1480
|
+
*
|
|
1481
|
+
* Accepts a {@link TextSize} object from the typography theme (which sets both
|
|
1482
|
+
* `font-size` and `line-height`), a raw CSS string for `font-size` only,
|
|
1483
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1484
|
+
*
|
|
1485
|
+
* @param size - A {@link TextSize} preset (e.g. `typography.base`), a raw CSS string (`'1.5rem'`), or `dynamic()` value.
|
|
1486
|
+
* @returns A {@link StyleRule} that sets `font-size` and optionally `line-height`.
|
|
1487
|
+
*
|
|
1488
|
+
* @example TextSize preset
|
|
1489
|
+
* ```ts
|
|
1490
|
+
* import { cx, text } from 'typewritingclass'
|
|
1491
|
+
* import * as typography from 'typewritingclass/theme/typography'
|
|
1492
|
+
*
|
|
1493
|
+
* cx(text(typography.lg))
|
|
1494
|
+
* // CSS: font-size: 1.125rem; line-height: 1.75rem;
|
|
1495
|
+
* ```
|
|
1496
|
+
*
|
|
1497
|
+
* @example Raw value
|
|
1498
|
+
* ```ts
|
|
1499
|
+
* cx(text('2rem'))
|
|
1500
|
+
* // CSS: font-size: 2rem;
|
|
1501
|
+
* ```
|
|
1502
|
+
*
|
|
1503
|
+
* @example Dynamic value
|
|
1504
|
+
* ```ts
|
|
1505
|
+
* import { dcx, text, dynamic } from 'typewritingclass'
|
|
1506
|
+
*
|
|
1507
|
+
* const { className, style } = dcx(text(dynamic(fontSize)))
|
|
1508
|
+
* // CSS: font-size: var(--twc-d0);
|
|
1509
|
+
* // style: { '--twc-d0': fontSize }
|
|
1510
|
+
* ```
|
|
1511
|
+
*/
|
|
1512
|
+
declare function text(size: TextSize | string | DynamicValue): StyleRule;
|
|
1513
|
+
/**
|
|
1514
|
+
* Sets the font weight of an element.
|
|
1515
|
+
*
|
|
1516
|
+
* Accepts a raw CSS font-weight string or a {@link DynamicValue} for runtime values.
|
|
1517
|
+
* Use the typography theme exports (e.g. `typography.bold`) for standard weights.
|
|
1518
|
+
*
|
|
1519
|
+
* @param weight - A font-weight string (`'700'`, `'bold'`) or `dynamic()` value.
|
|
1520
|
+
* @returns A {@link StyleRule} that sets `font-weight`.
|
|
1521
|
+
*
|
|
1522
|
+
* @example Typography theme weight
|
|
1523
|
+
* ```ts
|
|
1524
|
+
* import { cx, font } from 'typewritingclass'
|
|
1525
|
+
* import * as typography from 'typewritingclass/theme/typography'
|
|
1526
|
+
*
|
|
1527
|
+
* cx(font(typography.bold))
|
|
1528
|
+
* // CSS: font-weight: 700;
|
|
1529
|
+
* ```
|
|
1530
|
+
*
|
|
1531
|
+
* @example Raw value
|
|
1532
|
+
* ```ts
|
|
1533
|
+
* cx(font('600'))
|
|
1534
|
+
* // CSS: font-weight: 600;
|
|
1535
|
+
* ```
|
|
1536
|
+
*
|
|
1537
|
+
* @example Dynamic value
|
|
1538
|
+
* ```ts
|
|
1539
|
+
* import { dcx, font, dynamic } from 'typewritingclass'
|
|
1540
|
+
*
|
|
1541
|
+
* const { className, style } = dcx(font(dynamic(weight)))
|
|
1542
|
+
* // CSS: font-weight: var(--twc-d0);
|
|
1543
|
+
* // style: { '--twc-d0': weight }
|
|
1544
|
+
* ```
|
|
1545
|
+
*/
|
|
1546
|
+
declare function font(weight: string | DynamicValue): StyleRule;
|
|
1547
|
+
/**
|
|
1548
|
+
* Sets the letter spacing (tracking) of an element.
|
|
1549
|
+
*
|
|
1550
|
+
* Accepts a raw CSS letter-spacing string or a {@link DynamicValue} for runtime values.
|
|
1551
|
+
*
|
|
1552
|
+
* @param value - A CSS letter-spacing string (`'-0.025em'`, `'0.05em'`) or `dynamic()` value.
|
|
1553
|
+
* @returns A {@link StyleRule} that sets `letter-spacing`.
|
|
1554
|
+
*
|
|
1555
|
+
* @example Raw value
|
|
1556
|
+
* ```ts
|
|
1557
|
+
* import { cx, tracking } from 'typewritingclass'
|
|
1558
|
+
*
|
|
1559
|
+
* cx(tracking('-0.025em'))
|
|
1560
|
+
* // CSS: letter-spacing: -0.025em;
|
|
1561
|
+
* ```
|
|
1562
|
+
*
|
|
1563
|
+
* @example Wide tracking
|
|
1564
|
+
* ```ts
|
|
1565
|
+
* cx(tracking('0.1em'))
|
|
1566
|
+
* // CSS: letter-spacing: 0.1em;
|
|
1567
|
+
* ```
|
|
1568
|
+
*
|
|
1569
|
+
* @example Dynamic value
|
|
1570
|
+
* ```ts
|
|
1571
|
+
* import { dcx, tracking, dynamic } from 'typewritingclass'
|
|
1572
|
+
*
|
|
1573
|
+
* const { className, style } = dcx(tracking(dynamic(letterSpacing)))
|
|
1574
|
+
* // CSS: letter-spacing: var(--twc-d0);
|
|
1575
|
+
* // style: { '--twc-d0': letterSpacing }
|
|
1576
|
+
* ```
|
|
1577
|
+
*/
|
|
1578
|
+
declare function tracking(value: string | DynamicValue): StyleRule;
|
|
1579
|
+
/**
|
|
1580
|
+
* Sets the line height (leading) of an element.
|
|
1581
|
+
*
|
|
1582
|
+
* Accepts a raw CSS line-height string or a {@link DynamicValue} for runtime values.
|
|
1583
|
+
*
|
|
1584
|
+
* @param value - A CSS line-height string (`'1.5'`, `'2rem'`) or `dynamic()` value.
|
|
1585
|
+
* @returns A {@link StyleRule} that sets `line-height`.
|
|
1586
|
+
*
|
|
1587
|
+
* @example Unitless ratio
|
|
1588
|
+
* ```ts
|
|
1589
|
+
* import { cx, leading } from 'typewritingclass'
|
|
1590
|
+
*
|
|
1591
|
+
* cx(leading('1.5'))
|
|
1592
|
+
* // CSS: line-height: 1.5;
|
|
1593
|
+
* ```
|
|
1594
|
+
*
|
|
1595
|
+
* @example Fixed value
|
|
1596
|
+
* ```ts
|
|
1597
|
+
* cx(leading('2rem'))
|
|
1598
|
+
* // CSS: line-height: 2rem;
|
|
1599
|
+
* ```
|
|
1600
|
+
*
|
|
1601
|
+
* @example Dynamic value
|
|
1602
|
+
* ```ts
|
|
1603
|
+
* import { dcx, leading, dynamic } from 'typewritingclass'
|
|
1604
|
+
*
|
|
1605
|
+
* const { className, style } = dcx(leading(dynamic(lineHeight)))
|
|
1606
|
+
* // CSS: line-height: var(--twc-d0);
|
|
1607
|
+
* // style: { '--twc-d0': lineHeight }
|
|
1608
|
+
* ```
|
|
1609
|
+
*/
|
|
1610
|
+
declare function leading(value: string | number | DynamicValue): StyleRule;
|
|
1611
|
+
/**
|
|
1612
|
+
* Sets the text alignment of an element.
|
|
1613
|
+
*
|
|
1614
|
+
* Accepts a raw CSS text-align string.
|
|
1615
|
+
*
|
|
1616
|
+
* @param value - A CSS text-align value (`'left'`, `'center'`, `'right'`, `'justify'`).
|
|
1617
|
+
* @returns A {@link StyleRule} that sets `text-align`.
|
|
1618
|
+
*
|
|
1619
|
+
* @example Center alignment
|
|
1620
|
+
* ```ts
|
|
1621
|
+
* import { cx, textAlign } from 'typewritingclass'
|
|
1622
|
+
*
|
|
1623
|
+
* cx(textAlign('center'))
|
|
1624
|
+
* // CSS: text-align: center;
|
|
1625
|
+
* ```
|
|
1626
|
+
*
|
|
1627
|
+
* @example Right alignment
|
|
1628
|
+
* ```ts
|
|
1629
|
+
* cx(textAlign('right'))
|
|
1630
|
+
* // CSS: text-align: right;
|
|
1631
|
+
* ```
|
|
1632
|
+
*/
|
|
1633
|
+
declare function textAlign(value: string): StyleRule;
|
|
1634
|
+
declare function fontFamily(value: string | DynamicValue): StyleRule;
|
|
1635
|
+
declare function antialiased(): StyleRule;
|
|
1636
|
+
declare function subpixelAntialiased(): StyleRule;
|
|
1637
|
+
declare function italic(): StyleRule;
|
|
1638
|
+
declare function notItalic(): StyleRule;
|
|
1639
|
+
declare function normalNums(): StyleRule;
|
|
1640
|
+
declare function ordinal(): StyleRule;
|
|
1641
|
+
declare function slashedZero(): StyleRule;
|
|
1642
|
+
declare function liningNums(): StyleRule;
|
|
1643
|
+
declare function oldstyleNums(): StyleRule;
|
|
1644
|
+
declare function proportionalNums(): StyleRule;
|
|
1645
|
+
declare function tabularNums(): StyleRule;
|
|
1646
|
+
declare function diagonalFractions(): StyleRule;
|
|
1647
|
+
declare function stackedFractions(): StyleRule;
|
|
1648
|
+
declare function lineClamp(value: number): StyleRule;
|
|
1649
|
+
declare function listStyleImage(value: string): StyleRule;
|
|
1650
|
+
declare function listStylePosition(value: string): StyleRule;
|
|
1651
|
+
declare function listStyleType(value: string): StyleRule;
|
|
1652
|
+
declare function textDecoration(value: string): StyleRule;
|
|
1653
|
+
declare function textDecorationColor(value: string | DynamicValue): StyleRule;
|
|
1654
|
+
declare function textDecorationStyle(value: string): StyleRule;
|
|
1655
|
+
declare function textDecorationThickness(value: string | DynamicValue): StyleRule;
|
|
1656
|
+
declare function textUnderlineOffset(value: string | DynamicValue): StyleRule;
|
|
1657
|
+
declare function textTransform(value: string): StyleRule;
|
|
1658
|
+
declare function textOverflow(value: string): StyleRule;
|
|
1659
|
+
declare function textWrap(value: string): StyleRule;
|
|
1660
|
+
declare function textIndent(value: string | DynamicValue): StyleRule;
|
|
1661
|
+
declare function verticalAlign(value: string): StyleRule;
|
|
1662
|
+
declare function whitespace(value: string): StyleRule;
|
|
1663
|
+
declare function wordBreak(value: string): StyleRule;
|
|
1664
|
+
declare function hyphens(value: string): StyleRule;
|
|
1665
|
+
declare function content_(value: string): StyleRule;
|
|
1666
|
+
declare function truncate(): StyleRule;
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* Sets the element to `display: flex`.
|
|
1670
|
+
*
|
|
1671
|
+
* Takes no arguments and produces a single flex display declaration.
|
|
1672
|
+
*
|
|
1673
|
+
* @returns A {@link StyleRule} that sets `display: flex`.
|
|
1674
|
+
*
|
|
1675
|
+
* @example
|
|
1676
|
+
* ```ts
|
|
1677
|
+
* import { cx, flex } from 'typewritingclass'
|
|
1678
|
+
*
|
|
1679
|
+
* cx(flex())
|
|
1680
|
+
* // CSS: display: flex;
|
|
1681
|
+
* ```
|
|
1682
|
+
*/
|
|
1683
|
+
declare function flex(): StyleRule;
|
|
1684
|
+
/**
|
|
1685
|
+
* Sets `flex-direction: column` on a flex container.
|
|
1686
|
+
*
|
|
1687
|
+
* Takes no arguments. Use with `flex()` to create a column-oriented flex container.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns A {@link StyleRule} that sets `flex-direction: column`.
|
|
1690
|
+
*
|
|
1691
|
+
* @example
|
|
1692
|
+
* ```ts
|
|
1693
|
+
* import { cx, flex, flexCol } from 'typewritingclass'
|
|
1694
|
+
*
|
|
1695
|
+
* cx(flex(), flexCol())
|
|
1696
|
+
* // CSS: display: flex; flex-direction: column;
|
|
1697
|
+
* ```
|
|
1698
|
+
*/
|
|
1699
|
+
declare function flexCol(): StyleRule;
|
|
1700
|
+
/**
|
|
1701
|
+
* Sets `flex-direction: row` on a flex container.
|
|
1702
|
+
*
|
|
1703
|
+
* Takes no arguments. Use with `flex()` to create a row-oriented flex container.
|
|
1704
|
+
*
|
|
1705
|
+
* @returns A {@link StyleRule} that sets `flex-direction: row`.
|
|
1706
|
+
*
|
|
1707
|
+
* @example
|
|
1708
|
+
* ```ts
|
|
1709
|
+
* import { cx, flex, flexRow } from 'typewritingclass'
|
|
1710
|
+
*
|
|
1711
|
+
* cx(flex(), flexRow())
|
|
1712
|
+
* // CSS: display: flex; flex-direction: row;
|
|
1713
|
+
* ```
|
|
1714
|
+
*/
|
|
1715
|
+
declare function flexRow(): StyleRule;
|
|
1716
|
+
/**
|
|
1717
|
+
* Sets `flex-wrap: wrap` on a flex container to allow children to wrap.
|
|
1718
|
+
*
|
|
1719
|
+
* Takes no arguments.
|
|
1720
|
+
*
|
|
1721
|
+
* @returns A {@link StyleRule} that sets `flex-wrap: wrap`.
|
|
1722
|
+
*
|
|
1723
|
+
* @example
|
|
1724
|
+
* ```ts
|
|
1725
|
+
* import { cx, flexWrap } from 'typewritingclass'
|
|
1726
|
+
*
|
|
1727
|
+
* cx(flexWrap())
|
|
1728
|
+
* // CSS: flex-wrap: wrap;
|
|
1729
|
+
* ```
|
|
1730
|
+
*/
|
|
1731
|
+
declare function flexWrap(): StyleRule;
|
|
1732
|
+
/**
|
|
1733
|
+
* Sets the element to `display: inline-flex`.
|
|
1734
|
+
*
|
|
1735
|
+
* Takes no arguments and produces an inline-level flex container.
|
|
1736
|
+
*
|
|
1737
|
+
* @returns A {@link StyleRule} that sets `display: inline-flex`.
|
|
1738
|
+
*
|
|
1739
|
+
* @example
|
|
1740
|
+
* ```ts
|
|
1741
|
+
* import { cx, inlineFlex } from 'typewritingclass'
|
|
1742
|
+
*
|
|
1743
|
+
* cx(inlineFlex())
|
|
1744
|
+
* // CSS: display: inline-flex;
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
declare function inlineFlex(): StyleRule;
|
|
1748
|
+
/**
|
|
1749
|
+
* Sets the element to `display: grid`, optionally defining equal-width columns.
|
|
1750
|
+
*
|
|
1751
|
+
* When called without arguments, sets only `display: grid`. When called with a
|
|
1752
|
+
* column count, also sets `grid-template-columns` with equal-width `1fr` columns.
|
|
1753
|
+
*
|
|
1754
|
+
* @param cols - Optional number of equal-width columns.
|
|
1755
|
+
* @returns A {@link StyleRule} that sets `display: grid` and optionally `grid-template-columns`.
|
|
1756
|
+
*
|
|
1757
|
+
* @example Grid without columns
|
|
1758
|
+
* ```ts
|
|
1759
|
+
* import { cx, grid } from 'typewritingclass'
|
|
1760
|
+
*
|
|
1761
|
+
* cx(grid())
|
|
1762
|
+
* // CSS: display: grid;
|
|
1763
|
+
* ```
|
|
1764
|
+
*
|
|
1765
|
+
* @example Grid with columns
|
|
1766
|
+
* ```ts
|
|
1767
|
+
* cx(grid(3))
|
|
1768
|
+
* // CSS: display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1769
|
+
* ```
|
|
1770
|
+
*/
|
|
1771
|
+
declare function grid(cols?: number): StyleRule;
|
|
1772
|
+
/**
|
|
1773
|
+
* Sets the number of equal-width grid columns.
|
|
1774
|
+
*
|
|
1775
|
+
* @param n - The number of columns.
|
|
1776
|
+
* @returns A {@link StyleRule} that sets `grid-template-columns`.
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* ```ts
|
|
1780
|
+
* import { cx, gridCols } from 'typewritingclass'
|
|
1781
|
+
*
|
|
1782
|
+
* cx(gridCols(4))
|
|
1783
|
+
* // CSS: grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
1784
|
+
* ```
|
|
1785
|
+
*/
|
|
1786
|
+
declare function gridCols(n: number): StyleRule;
|
|
1787
|
+
/**
|
|
1788
|
+
* Sets the number of equal-height grid rows.
|
|
1789
|
+
*
|
|
1790
|
+
* @param n - The number of rows.
|
|
1791
|
+
* @returns A {@link StyleRule} that sets `grid-template-rows`.
|
|
1792
|
+
*
|
|
1793
|
+
* @example
|
|
1794
|
+
* ```ts
|
|
1795
|
+
* import { cx, gridRows } from 'typewritingclass'
|
|
1796
|
+
*
|
|
1797
|
+
* cx(gridRows(3))
|
|
1798
|
+
* // CSS: grid-template-rows: repeat(3, minmax(0, 1fr));
|
|
1799
|
+
* ```
|
|
1800
|
+
*/
|
|
1801
|
+
declare function gridRows(n: number): StyleRule;
|
|
1802
|
+
/**
|
|
1803
|
+
* Sets the width of an element.
|
|
1804
|
+
*
|
|
1805
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
1806
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1807
|
+
*
|
|
1808
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'100%'`), or `dynamic()` value.
|
|
1809
|
+
* @returns A {@link StyleRule} that sets `width`.
|
|
1810
|
+
*
|
|
1811
|
+
* @example Theme scale
|
|
1812
|
+
* ```ts
|
|
1813
|
+
* import { cx, w } from 'typewritingclass'
|
|
1814
|
+
*
|
|
1815
|
+
* cx(w(64))
|
|
1816
|
+
* // CSS: width: 16rem;
|
|
1817
|
+
* ```
|
|
1818
|
+
*
|
|
1819
|
+
* @example Raw value
|
|
1820
|
+
* ```ts
|
|
1821
|
+
* cx(w('100%'))
|
|
1822
|
+
* // CSS: width: 100%;
|
|
1823
|
+
* ```
|
|
1824
|
+
*
|
|
1825
|
+
* @example Dynamic value
|
|
1826
|
+
* ```ts
|
|
1827
|
+
* import { dcx, w, dynamic } from 'typewritingclass'
|
|
1828
|
+
*
|
|
1829
|
+
* const { className, style } = dcx(w(dynamic(width)))
|
|
1830
|
+
* // CSS: width: var(--twc-d0);
|
|
1831
|
+
* // style: { '--twc-d0': width }
|
|
1832
|
+
* ```
|
|
1833
|
+
*/
|
|
1834
|
+
declare function w(value: number | string | DynamicValue): StyleRule;
|
|
1835
|
+
/**
|
|
1836
|
+
* Sets the height of an element.
|
|
1837
|
+
*
|
|
1838
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
1839
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1840
|
+
*
|
|
1841
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'100vh'`), or `dynamic()` value.
|
|
1842
|
+
* @returns A {@link StyleRule} that sets `height`.
|
|
1843
|
+
*
|
|
1844
|
+
* @example Theme scale
|
|
1845
|
+
* ```ts
|
|
1846
|
+
* import { cx, h } from 'typewritingclass'
|
|
1847
|
+
*
|
|
1848
|
+
* cx(h(12))
|
|
1849
|
+
* // CSS: height: 3rem;
|
|
1850
|
+
* ```
|
|
1851
|
+
*
|
|
1852
|
+
* @example Raw value
|
|
1853
|
+
* ```ts
|
|
1854
|
+
* cx(h('100vh'))
|
|
1855
|
+
* // CSS: height: 100vh;
|
|
1856
|
+
* ```
|
|
1857
|
+
*
|
|
1858
|
+
* @example Dynamic value
|
|
1859
|
+
* ```ts
|
|
1860
|
+
* import { dcx, h, dynamic } from 'typewritingclass'
|
|
1861
|
+
*
|
|
1862
|
+
* const { className, style } = dcx(h(dynamic(height)))
|
|
1863
|
+
* // CSS: height: var(--twc-d0);
|
|
1864
|
+
* // style: { '--twc-d0': height }
|
|
1865
|
+
* ```
|
|
1866
|
+
*/
|
|
1867
|
+
declare function h(value: number | string | DynamicValue): StyleRule;
|
|
1868
|
+
/**
|
|
1869
|
+
* Sets both width and height of an element to the same value.
|
|
1870
|
+
*
|
|
1871
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
1872
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1873
|
+
*
|
|
1874
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'48px'`), or `dynamic()` value.
|
|
1875
|
+
* @returns A {@link StyleRule} that sets both `width` and `height`.
|
|
1876
|
+
*
|
|
1877
|
+
* @example Theme scale
|
|
1878
|
+
* ```ts
|
|
1879
|
+
* import { cx, size } from 'typewritingclass'
|
|
1880
|
+
*
|
|
1881
|
+
* cx(size(10))
|
|
1882
|
+
* // CSS: width: 2.5rem; height: 2.5rem;
|
|
1883
|
+
* ```
|
|
1884
|
+
*
|
|
1885
|
+
* @example Raw value
|
|
1886
|
+
* ```ts
|
|
1887
|
+
* cx(size('48px'))
|
|
1888
|
+
* // CSS: width: 48px; height: 48px;
|
|
1889
|
+
* ```
|
|
1890
|
+
*
|
|
1891
|
+
* @example Dynamic value
|
|
1892
|
+
* ```ts
|
|
1893
|
+
* import { dcx, size, dynamic } from 'typewritingclass'
|
|
1894
|
+
*
|
|
1895
|
+
* const { className, style } = dcx(size(dynamic(dim)))
|
|
1896
|
+
* // CSS: width: var(--twc-d0); height: var(--twc-d0);
|
|
1897
|
+
* // style: { '--twc-d0': dim }
|
|
1898
|
+
* ```
|
|
1899
|
+
*/
|
|
1900
|
+
declare function size(value: number | string | DynamicValue): StyleRule;
|
|
1901
|
+
/**
|
|
1902
|
+
* Sets the minimum width of an element.
|
|
1903
|
+
*
|
|
1904
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
1905
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1906
|
+
*
|
|
1907
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'200px'`), or `dynamic()` value.
|
|
1908
|
+
* @returns A {@link StyleRule} that sets `min-width`.
|
|
1909
|
+
*
|
|
1910
|
+
* @example Theme scale
|
|
1911
|
+
* ```ts
|
|
1912
|
+
* import { cx, minW } from 'typewritingclass'
|
|
1913
|
+
*
|
|
1914
|
+
* cx(minW(48))
|
|
1915
|
+
* // CSS: min-width: 12rem;
|
|
1916
|
+
* ```
|
|
1917
|
+
*
|
|
1918
|
+
* @example Raw value
|
|
1919
|
+
* ```ts
|
|
1920
|
+
* cx(minW('0'))
|
|
1921
|
+
* // CSS: min-width: 0;
|
|
1922
|
+
* ```
|
|
1923
|
+
*
|
|
1924
|
+
* @example Dynamic value
|
|
1925
|
+
* ```ts
|
|
1926
|
+
* import { dcx, minW, dynamic } from 'typewritingclass'
|
|
1927
|
+
*
|
|
1928
|
+
* const { className, style } = dcx(minW(dynamic(minWidth)))
|
|
1929
|
+
* // CSS: min-width: var(--twc-d0);
|
|
1930
|
+
* // style: { '--twc-d0': minWidth }
|
|
1931
|
+
* ```
|
|
1932
|
+
*/
|
|
1933
|
+
declare function minW(value: number | string | DynamicValue): StyleRule;
|
|
1934
|
+
/**
|
|
1935
|
+
* Sets the minimum height of an element.
|
|
1936
|
+
*
|
|
1937
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
1938
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1939
|
+
*
|
|
1940
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'100vh'`), or `dynamic()` value.
|
|
1941
|
+
* @returns A {@link StyleRule} that sets `min-height`.
|
|
1942
|
+
*
|
|
1943
|
+
* @example Theme scale
|
|
1944
|
+
* ```ts
|
|
1945
|
+
* import { cx, minH } from 'typewritingclass'
|
|
1946
|
+
*
|
|
1947
|
+
* cx(minH(96))
|
|
1948
|
+
* // CSS: min-height: 24rem;
|
|
1949
|
+
* ```
|
|
1950
|
+
*
|
|
1951
|
+
* @example Raw value
|
|
1952
|
+
* ```ts
|
|
1953
|
+
* cx(minH('100vh'))
|
|
1954
|
+
* // CSS: min-height: 100vh;
|
|
1955
|
+
* ```
|
|
1956
|
+
*
|
|
1957
|
+
* @example Dynamic value
|
|
1958
|
+
* ```ts
|
|
1959
|
+
* import { dcx, minH, dynamic } from 'typewritingclass'
|
|
1960
|
+
*
|
|
1961
|
+
* const { className, style } = dcx(minH(dynamic(minHeight)))
|
|
1962
|
+
* // CSS: min-height: var(--twc-d0);
|
|
1963
|
+
* // style: { '--twc-d0': minHeight }
|
|
1964
|
+
* ```
|
|
1965
|
+
*/
|
|
1966
|
+
declare function minH(value: number | string | DynamicValue): StyleRule;
|
|
1967
|
+
/**
|
|
1968
|
+
* Sets the maximum width of an element.
|
|
1969
|
+
*
|
|
1970
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
1971
|
+
* or a {@link DynamicValue} for runtime values.
|
|
1972
|
+
*
|
|
1973
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'768px'`), or `dynamic()` value.
|
|
1974
|
+
* @returns A {@link StyleRule} that sets `max-width`.
|
|
1975
|
+
*
|
|
1976
|
+
* @example Theme scale
|
|
1977
|
+
* ```ts
|
|
1978
|
+
* import { cx, maxW } from 'typewritingclass'
|
|
1979
|
+
*
|
|
1980
|
+
* cx(maxW(80))
|
|
1981
|
+
* // CSS: max-width: 20rem;
|
|
1982
|
+
* ```
|
|
1983
|
+
*
|
|
1984
|
+
* @example Raw value
|
|
1985
|
+
* ```ts
|
|
1986
|
+
* cx(maxW('768px'))
|
|
1987
|
+
* // CSS: max-width: 768px;
|
|
1988
|
+
* ```
|
|
1989
|
+
*
|
|
1990
|
+
* @example Dynamic value
|
|
1991
|
+
* ```ts
|
|
1992
|
+
* import { dcx, maxW, dynamic } from 'typewritingclass'
|
|
1993
|
+
*
|
|
1994
|
+
* const { className, style } = dcx(maxW(dynamic(maxWidth)))
|
|
1995
|
+
* // CSS: max-width: var(--twc-d0);
|
|
1996
|
+
* // style: { '--twc-d0': maxWidth }
|
|
1997
|
+
* ```
|
|
1998
|
+
*/
|
|
1999
|
+
declare function maxW(value: number | string | DynamicValue): StyleRule;
|
|
2000
|
+
/**
|
|
2001
|
+
* Sets the maximum height of an element.
|
|
2002
|
+
*
|
|
2003
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
2004
|
+
* or a {@link DynamicValue} for runtime values.
|
|
2005
|
+
*
|
|
2006
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'100vh'`), or `dynamic()` value.
|
|
2007
|
+
* @returns A {@link StyleRule} that sets `max-height`.
|
|
2008
|
+
*
|
|
2009
|
+
* @example Theme scale
|
|
2010
|
+
* ```ts
|
|
2011
|
+
* import { cx, maxH } from 'typewritingclass'
|
|
2012
|
+
*
|
|
2013
|
+
* cx(maxH(40))
|
|
2014
|
+
* // CSS: max-height: 10rem;
|
|
2015
|
+
* ```
|
|
2016
|
+
*
|
|
2017
|
+
* @example Raw value
|
|
2018
|
+
* ```ts
|
|
2019
|
+
* cx(maxH('100vh'))
|
|
2020
|
+
* // CSS: max-height: 100vh;
|
|
2021
|
+
* ```
|
|
2022
|
+
*
|
|
2023
|
+
* @example Dynamic value
|
|
2024
|
+
* ```ts
|
|
2025
|
+
* import { dcx, maxH, dynamic } from 'typewritingclass'
|
|
2026
|
+
*
|
|
2027
|
+
* const { className, style } = dcx(maxH(dynamic(maxHeight)))
|
|
2028
|
+
* // CSS: max-height: var(--twc-d0);
|
|
2029
|
+
* // style: { '--twc-d0': maxHeight }
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
declare function maxH(value: number | string | DynamicValue): StyleRule;
|
|
2033
|
+
/**
|
|
2034
|
+
* Sets the CSS `display` property of an element.
|
|
2035
|
+
*
|
|
2036
|
+
* Accepts any valid CSS display value as a string.
|
|
2037
|
+
*
|
|
2038
|
+
* @param value - A CSS display value (`'block'`, `'none'`, `'inline-block'`, etc.).
|
|
2039
|
+
* @returns A {@link StyleRule} that sets `display`.
|
|
2040
|
+
*
|
|
2041
|
+
* @example Block display
|
|
2042
|
+
* ```ts
|
|
2043
|
+
* import { cx, display } from 'typewritingclass'
|
|
2044
|
+
*
|
|
2045
|
+
* cx(display('block'))
|
|
2046
|
+
* // CSS: display: block;
|
|
2047
|
+
* ```
|
|
2048
|
+
*
|
|
2049
|
+
* @example Hide element
|
|
2050
|
+
* ```ts
|
|
2051
|
+
* cx(display('none'))
|
|
2052
|
+
* // CSS: display: none;
|
|
2053
|
+
* ```
|
|
2054
|
+
*/
|
|
2055
|
+
declare function display(value: string): StyleRule;
|
|
2056
|
+
/**
|
|
2057
|
+
* Sets the `align-items` property on a flex or grid container.
|
|
2058
|
+
*
|
|
2059
|
+
* Accepts any valid CSS align-items value as a string.
|
|
2060
|
+
*
|
|
2061
|
+
* @param value - A CSS align-items value (`'center'`, `'flex-start'`, `'stretch'`, etc.).
|
|
2062
|
+
* @returns A {@link StyleRule} that sets `align-items`.
|
|
2063
|
+
*
|
|
2064
|
+
* @example Center alignment
|
|
2065
|
+
* ```ts
|
|
2066
|
+
* import { cx, items } from 'typewritingclass'
|
|
2067
|
+
*
|
|
2068
|
+
* cx(items('center'))
|
|
2069
|
+
* // CSS: align-items: center;
|
|
2070
|
+
* ```
|
|
2071
|
+
*
|
|
2072
|
+
* @example Start alignment
|
|
2073
|
+
* ```ts
|
|
2074
|
+
* cx(items('flex-start'))
|
|
2075
|
+
* // CSS: align-items: flex-start;
|
|
2076
|
+
* ```
|
|
2077
|
+
*/
|
|
2078
|
+
declare function items(value: string): StyleRule;
|
|
2079
|
+
/**
|
|
2080
|
+
* Sets the `justify-content` property on a flex or grid container.
|
|
2081
|
+
*
|
|
2082
|
+
* Accepts any valid CSS justify-content value as a string.
|
|
2083
|
+
*
|
|
2084
|
+
* @param value - A CSS justify-content value (`'center'`, `'space-between'`, `'flex-end'`, etc.).
|
|
2085
|
+
* @returns A {@link StyleRule} that sets `justify-content`.
|
|
2086
|
+
*
|
|
2087
|
+
* @example Center justification
|
|
2088
|
+
* ```ts
|
|
2089
|
+
* import { cx, justify } from 'typewritingclass'
|
|
2090
|
+
*
|
|
2091
|
+
* cx(justify('center'))
|
|
2092
|
+
* // CSS: justify-content: center;
|
|
2093
|
+
* ```
|
|
2094
|
+
*
|
|
2095
|
+
* @example Space between
|
|
2096
|
+
* ```ts
|
|
2097
|
+
* cx(justify('space-between'))
|
|
2098
|
+
* // CSS: justify-content: space-between;
|
|
2099
|
+
* ```
|
|
2100
|
+
*/
|
|
2101
|
+
declare function justify(value: string): StyleRule;
|
|
2102
|
+
/**
|
|
2103
|
+
* Sets the `align-self` property on a flex or grid child.
|
|
2104
|
+
*
|
|
2105
|
+
* Accepts any valid CSS align-self value as a string.
|
|
2106
|
+
*
|
|
2107
|
+
* @param value - A CSS align-self value (`'center'`, `'flex-start'`, `'stretch'`, etc.).
|
|
2108
|
+
* @returns A {@link StyleRule} that sets `align-self`.
|
|
2109
|
+
*
|
|
2110
|
+
* @example Center self-alignment
|
|
2111
|
+
* ```ts
|
|
2112
|
+
* import { cx, self } from 'typewritingclass'
|
|
2113
|
+
*
|
|
2114
|
+
* cx(self('center'))
|
|
2115
|
+
* // CSS: align-self: center;
|
|
2116
|
+
* ```
|
|
2117
|
+
*
|
|
2118
|
+
* @example End self-alignment
|
|
2119
|
+
* ```ts
|
|
2120
|
+
* cx(self('flex-end'))
|
|
2121
|
+
* // CSS: align-self: flex-end;
|
|
2122
|
+
* ```
|
|
2123
|
+
*/
|
|
2124
|
+
declare function self(value: string): StyleRule;
|
|
2125
|
+
/**
|
|
2126
|
+
* Sets the `overflow` behavior on both axes of an element.
|
|
2127
|
+
*
|
|
2128
|
+
* Accepts any valid CSS overflow value as a string.
|
|
2129
|
+
*
|
|
2130
|
+
* @param value - A CSS overflow value (`'hidden'`, `'auto'`, `'scroll'`, `'visible'`).
|
|
2131
|
+
* @returns A {@link StyleRule} that sets `overflow`.
|
|
2132
|
+
*
|
|
2133
|
+
* @example Hidden overflow
|
|
2134
|
+
* ```ts
|
|
2135
|
+
* import { cx, overflow } from 'typewritingclass'
|
|
2136
|
+
*
|
|
2137
|
+
* cx(overflow('hidden'))
|
|
2138
|
+
* // CSS: overflow: hidden;
|
|
2139
|
+
* ```
|
|
2140
|
+
*
|
|
2141
|
+
* @example Auto overflow
|
|
2142
|
+
* ```ts
|
|
2143
|
+
* cx(overflow('auto'))
|
|
2144
|
+
* // CSS: overflow: auto;
|
|
2145
|
+
* ```
|
|
2146
|
+
*/
|
|
2147
|
+
declare function overflow(value: string): StyleRule;
|
|
2148
|
+
/**
|
|
2149
|
+
* Sets the horizontal overflow behavior of an element.
|
|
2150
|
+
*
|
|
2151
|
+
* Accepts any valid CSS overflow-x value as a string.
|
|
2152
|
+
*
|
|
2153
|
+
* @param value - A CSS overflow-x value (`'hidden'`, `'auto'`, `'scroll'`, `'visible'`).
|
|
2154
|
+
* @returns A {@link StyleRule} that sets `overflow-x`.
|
|
2155
|
+
*
|
|
2156
|
+
* @example Auto horizontal scroll
|
|
2157
|
+
* ```ts
|
|
2158
|
+
* import { cx, overflowX } from 'typewritingclass'
|
|
2159
|
+
*
|
|
2160
|
+
* cx(overflowX('auto'))
|
|
2161
|
+
* // CSS: overflow-x: auto;
|
|
2162
|
+
* ```
|
|
2163
|
+
*
|
|
2164
|
+
* @example Hidden horizontal overflow
|
|
2165
|
+
* ```ts
|
|
2166
|
+
* cx(overflowX('hidden'))
|
|
2167
|
+
* // CSS: overflow-x: hidden;
|
|
2168
|
+
* ```
|
|
2169
|
+
*/
|
|
2170
|
+
declare function overflowX(value: string): StyleRule;
|
|
2171
|
+
/**
|
|
2172
|
+
* Sets the vertical overflow behavior of an element.
|
|
2173
|
+
*
|
|
2174
|
+
* Accepts any valid CSS overflow-y value as a string.
|
|
2175
|
+
*
|
|
2176
|
+
* @param value - A CSS overflow-y value (`'hidden'`, `'auto'`, `'scroll'`, `'visible'`).
|
|
2177
|
+
* @returns A {@link StyleRule} that sets `overflow-y`.
|
|
2178
|
+
*
|
|
2179
|
+
* @example Scrollable vertical overflow
|
|
2180
|
+
* ```ts
|
|
2181
|
+
* import { cx, overflowY } from 'typewritingclass'
|
|
2182
|
+
*
|
|
2183
|
+
* cx(overflowY('scroll'))
|
|
2184
|
+
* // CSS: overflow-y: scroll;
|
|
2185
|
+
* ```
|
|
2186
|
+
*
|
|
2187
|
+
* @example Hidden vertical overflow
|
|
2188
|
+
* ```ts
|
|
2189
|
+
* cx(overflowY('hidden'))
|
|
2190
|
+
* // CSS: overflow-y: hidden;
|
|
2191
|
+
* ```
|
|
2192
|
+
*/
|
|
2193
|
+
declare function overflowY(value: string): StyleRule;
|
|
2194
|
+
/**
|
|
2195
|
+
* Sets the element to `position: relative`.
|
|
2196
|
+
*
|
|
2197
|
+
* Takes no arguments. Creates a positioning context for absolutely positioned children.
|
|
2198
|
+
*
|
|
2199
|
+
* @returns A {@link StyleRule} that sets `position: relative`.
|
|
2200
|
+
*
|
|
2201
|
+
* @example
|
|
2202
|
+
* ```ts
|
|
2203
|
+
* import { cx, relative } from 'typewritingclass'
|
|
2204
|
+
*
|
|
2205
|
+
* cx(relative())
|
|
2206
|
+
* // CSS: position: relative;
|
|
2207
|
+
* ```
|
|
2208
|
+
*/
|
|
2209
|
+
declare function relative(): StyleRule;
|
|
2210
|
+
/**
|
|
2211
|
+
* Sets the element to `position: absolute`.
|
|
2212
|
+
*
|
|
2213
|
+
* Takes no arguments. Removes the element from normal flow and positions it
|
|
2214
|
+
* relative to its nearest positioned ancestor.
|
|
2215
|
+
*
|
|
2216
|
+
* @returns A {@link StyleRule} that sets `position: absolute`.
|
|
2217
|
+
*
|
|
2218
|
+
* @example
|
|
2219
|
+
* ```ts
|
|
2220
|
+
* import { cx, absolute } from 'typewritingclass'
|
|
2221
|
+
*
|
|
2222
|
+
* cx(absolute())
|
|
2223
|
+
* // CSS: position: absolute;
|
|
2224
|
+
* ```
|
|
2225
|
+
*/
|
|
2226
|
+
declare function absolute(): StyleRule;
|
|
2227
|
+
/**
|
|
2228
|
+
* Sets the element to `position: fixed`.
|
|
2229
|
+
*
|
|
2230
|
+
* Takes no arguments. Removes the element from normal flow and positions it
|
|
2231
|
+
* relative to the viewport.
|
|
2232
|
+
*
|
|
2233
|
+
* @returns A {@link StyleRule} that sets `position: fixed`.
|
|
2234
|
+
*
|
|
2235
|
+
* @example
|
|
2236
|
+
* ```ts
|
|
2237
|
+
* import { cx, fixed } from 'typewritingclass'
|
|
2238
|
+
*
|
|
2239
|
+
* cx(fixed())
|
|
2240
|
+
* // CSS: position: fixed;
|
|
2241
|
+
* ```
|
|
2242
|
+
*/
|
|
2243
|
+
declare function fixed(): StyleRule;
|
|
2244
|
+
/**
|
|
2245
|
+
* Sets the element to `position: sticky`.
|
|
2246
|
+
*
|
|
2247
|
+
* Takes no arguments. The element is treated as relative until it crosses a
|
|
2248
|
+
* specified threshold, then treated as fixed.
|
|
2249
|
+
*
|
|
2250
|
+
* @returns A {@link StyleRule} that sets `position: sticky`.
|
|
2251
|
+
*
|
|
2252
|
+
* @example
|
|
2253
|
+
* ```ts
|
|
2254
|
+
* import { cx, sticky } from 'typewritingclass'
|
|
2255
|
+
*
|
|
2256
|
+
* cx(sticky())
|
|
2257
|
+
* // CSS: position: sticky;
|
|
2258
|
+
* ```
|
|
2259
|
+
*/
|
|
2260
|
+
declare function sticky(): StyleRule;
|
|
2261
|
+
/**
|
|
2262
|
+
* Sets the `top` position offset of a positioned element.
|
|
2263
|
+
*
|
|
2264
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
2265
|
+
* or a {@link DynamicValue} for runtime values.
|
|
2266
|
+
*
|
|
2267
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'0'`), or `dynamic()` value.
|
|
2268
|
+
* @returns A {@link StyleRule} that sets `top`.
|
|
2269
|
+
*
|
|
2270
|
+
* @example Theme scale
|
|
2271
|
+
* ```ts
|
|
2272
|
+
* import { cx, top } from 'typewritingclass'
|
|
2273
|
+
*
|
|
2274
|
+
* cx(top(0))
|
|
2275
|
+
* // CSS: top: 0px;
|
|
2276
|
+
* ```
|
|
2277
|
+
*
|
|
2278
|
+
* @example Raw value
|
|
2279
|
+
* ```ts
|
|
2280
|
+
* cx(top('50%'))
|
|
2281
|
+
* // CSS: top: 50%;
|
|
2282
|
+
* ```
|
|
2283
|
+
*
|
|
2284
|
+
* @example Dynamic value
|
|
2285
|
+
* ```ts
|
|
2286
|
+
* import { dcx, top, dynamic } from 'typewritingclass'
|
|
2287
|
+
*
|
|
2288
|
+
* const { className, style } = dcx(top(dynamic(offset)))
|
|
2289
|
+
* // CSS: top: var(--twc-d0);
|
|
2290
|
+
* // style: { '--twc-d0': offset }
|
|
2291
|
+
* ```
|
|
2292
|
+
*/
|
|
2293
|
+
declare function top(value: number | string | DynamicValue): StyleRule;
|
|
2294
|
+
/**
|
|
2295
|
+
* Sets the `right` position offset of a positioned element.
|
|
2296
|
+
*
|
|
2297
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
2298
|
+
* or a {@link DynamicValue} for runtime values.
|
|
2299
|
+
*
|
|
2300
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'0'`), or `dynamic()` value.
|
|
2301
|
+
* @returns A {@link StyleRule} that sets `right`.
|
|
2302
|
+
*
|
|
2303
|
+
* @example Theme scale
|
|
2304
|
+
* ```ts
|
|
2305
|
+
* import { cx, right } from 'typewritingclass'
|
|
2306
|
+
*
|
|
2307
|
+
* cx(right(4))
|
|
2308
|
+
* // CSS: right: 1rem;
|
|
2309
|
+
* ```
|
|
2310
|
+
*
|
|
2311
|
+
* @example Raw value
|
|
2312
|
+
* ```ts
|
|
2313
|
+
* cx(right('0'))
|
|
2314
|
+
* // CSS: right: 0;
|
|
2315
|
+
* ```
|
|
2316
|
+
*
|
|
2317
|
+
* @example Dynamic value
|
|
2318
|
+
* ```ts
|
|
2319
|
+
* import { dcx, right, dynamic } from 'typewritingclass'
|
|
2320
|
+
*
|
|
2321
|
+
* const { className, style } = dcx(right(dynamic(offset)))
|
|
2322
|
+
* // CSS: right: var(--twc-d0);
|
|
2323
|
+
* // style: { '--twc-d0': offset }
|
|
2324
|
+
* ```
|
|
2325
|
+
*/
|
|
2326
|
+
declare function right(value: number | string | DynamicValue): StyleRule;
|
|
2327
|
+
/**
|
|
2328
|
+
* Sets the `bottom` position offset of a positioned element.
|
|
2329
|
+
*
|
|
2330
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
2331
|
+
* or a {@link DynamicValue} for runtime values.
|
|
2332
|
+
*
|
|
2333
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'0'`), or `dynamic()` value.
|
|
2334
|
+
* @returns A {@link StyleRule} that sets `bottom`.
|
|
2335
|
+
*
|
|
2336
|
+
* @example Theme scale
|
|
2337
|
+
* ```ts
|
|
2338
|
+
* import { cx, bottom } from 'typewritingclass'
|
|
2339
|
+
*
|
|
2340
|
+
* cx(bottom(0))
|
|
2341
|
+
* // CSS: bottom: 0px;
|
|
2342
|
+
* ```
|
|
2343
|
+
*
|
|
2344
|
+
* @example Raw value
|
|
2345
|
+
* ```ts
|
|
2346
|
+
* cx(bottom('2rem'))
|
|
2347
|
+
* // CSS: bottom: 2rem;
|
|
2348
|
+
* ```
|
|
2349
|
+
*
|
|
2350
|
+
* @example Dynamic value
|
|
2351
|
+
* ```ts
|
|
2352
|
+
* import { dcx, bottom, dynamic } from 'typewritingclass'
|
|
2353
|
+
*
|
|
2354
|
+
* const { className, style } = dcx(bottom(dynamic(offset)))
|
|
2355
|
+
* // CSS: bottom: var(--twc-d0);
|
|
2356
|
+
* // style: { '--twc-d0': offset }
|
|
2357
|
+
* ```
|
|
2358
|
+
*/
|
|
2359
|
+
declare function bottom(value: number | string | DynamicValue): StyleRule;
|
|
2360
|
+
/**
|
|
2361
|
+
* Sets the `left` position offset of a positioned element.
|
|
2362
|
+
*
|
|
2363
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
2364
|
+
* or a {@link DynamicValue} for runtime values.
|
|
2365
|
+
*
|
|
2366
|
+
* @param value - Spacing scale number (`4` -> `1rem`), raw string (`'0'`), or `dynamic()` value.
|
|
2367
|
+
* @returns A {@link StyleRule} that sets `left`.
|
|
2368
|
+
*
|
|
2369
|
+
* @example Theme scale
|
|
2370
|
+
* ```ts
|
|
2371
|
+
* import { cx, left } from 'typewritingclass'
|
|
2372
|
+
*
|
|
2373
|
+
* cx(left(4))
|
|
2374
|
+
* // CSS: left: 1rem;
|
|
2375
|
+
* ```
|
|
2376
|
+
*
|
|
2377
|
+
* @example Raw value
|
|
2378
|
+
* ```ts
|
|
2379
|
+
* cx(left('50%'))
|
|
2380
|
+
* // CSS: left: 50%;
|
|
2381
|
+
* ```
|
|
2382
|
+
*
|
|
2383
|
+
* @example Dynamic value
|
|
2384
|
+
* ```ts
|
|
2385
|
+
* import { dcx, left, dynamic } from 'typewritingclass'
|
|
2386
|
+
*
|
|
2387
|
+
* const { className, style } = dcx(left(dynamic(offset)))
|
|
2388
|
+
* // CSS: left: var(--twc-d0);
|
|
2389
|
+
* // style: { '--twc-d0': offset }
|
|
2390
|
+
* ```
|
|
2391
|
+
*/
|
|
2392
|
+
declare function left(value: number | string | DynamicValue): StyleRule;
|
|
2393
|
+
/**
|
|
2394
|
+
* Sets the `inset` shorthand property (top, right, bottom, left) on a positioned element.
|
|
2395
|
+
*
|
|
2396
|
+
* Accepts a theme spacing scale number (maps to the spacing scale), a raw CSS string,
|
|
2397
|
+
* or a {@link DynamicValue} for runtime values.
|
|
2398
|
+
*
|
|
2399
|
+
* @param value - Spacing scale number (`0` -> `0px`), raw string (`'0'`), or `dynamic()` value.
|
|
2400
|
+
* @returns A {@link StyleRule} that sets `inset`.
|
|
2401
|
+
*
|
|
2402
|
+
* @example Theme scale
|
|
2403
|
+
* ```ts
|
|
2404
|
+
* import { cx, inset } from 'typewritingclass'
|
|
2405
|
+
*
|
|
2406
|
+
* cx(inset(0))
|
|
2407
|
+
* // CSS: inset: 0px;
|
|
2408
|
+
* ```
|
|
2409
|
+
*
|
|
2410
|
+
* @example Raw value
|
|
2411
|
+
* ```ts
|
|
2412
|
+
* cx(inset('0'))
|
|
2413
|
+
* // CSS: inset: 0;
|
|
2414
|
+
* ```
|
|
2415
|
+
*
|
|
2416
|
+
* @example Dynamic value
|
|
2417
|
+
* ```ts
|
|
2418
|
+
* import { dcx, inset, dynamic } from 'typewritingclass'
|
|
2419
|
+
*
|
|
2420
|
+
* const { className, style } = dcx(inset(dynamic(offset)))
|
|
2421
|
+
* // CSS: inset: var(--twc-d0);
|
|
2422
|
+
* // style: { '--twc-d0': offset }
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
declare function inset(value: number | string | DynamicValue): StyleRule;
|
|
2426
|
+
/**
|
|
2427
|
+
* Sets the `z-index` stacking order of an element.
|
|
2428
|
+
*
|
|
2429
|
+
* Accepts a numeric z-index value, a raw string, or a {@link DynamicValue}
|
|
2430
|
+
* for runtime values. Numeric values are converted to strings.
|
|
2431
|
+
*
|
|
2432
|
+
* @param value - A z-index number (`10`, `50`), raw string (`'auto'`), or `dynamic()` value.
|
|
2433
|
+
* @returns A {@link StyleRule} that sets `z-index`.
|
|
2434
|
+
*
|
|
2435
|
+
* @example Numeric z-index
|
|
2436
|
+
* ```ts
|
|
2437
|
+
* import { cx, z } from 'typewritingclass'
|
|
2438
|
+
*
|
|
2439
|
+
* cx(z(10))
|
|
2440
|
+
* // CSS: z-index: 10;
|
|
2441
|
+
* ```
|
|
2442
|
+
*
|
|
2443
|
+
* @example String z-index
|
|
2444
|
+
* ```ts
|
|
2445
|
+
* cx(z('auto'))
|
|
2446
|
+
* // CSS: z-index: auto;
|
|
2447
|
+
* ```
|
|
2448
|
+
*
|
|
2449
|
+
* @example Dynamic value
|
|
2450
|
+
* ```ts
|
|
2451
|
+
* import { dcx, z, dynamic } from 'typewritingclass'
|
|
2452
|
+
*
|
|
2453
|
+
* const { className, style } = dcx(z(dynamic(zIndex)))
|
|
2454
|
+
* // CSS: z-index: var(--twc-d0);
|
|
2455
|
+
* // style: { '--twc-d0': zIndex }
|
|
2456
|
+
* ```
|
|
2457
|
+
*/
|
|
2458
|
+
declare function z(value: number | string | DynamicValue): StyleRule;
|
|
2459
|
+
declare function aspectRatio(value: string): StyleRule;
|
|
2460
|
+
declare function columns(value: string | number): StyleRule;
|
|
2461
|
+
declare function breakAfter(value: string): StyleRule;
|
|
2462
|
+
declare function breakBefore(value: string): StyleRule;
|
|
2463
|
+
declare function breakInside(value: string): StyleRule;
|
|
2464
|
+
declare function boxDecorationBreak(value: string): StyleRule;
|
|
2465
|
+
declare function boxSizing(value: string): StyleRule;
|
|
2466
|
+
declare function float_(value: string): StyleRule;
|
|
2467
|
+
declare function clear_(value: string): StyleRule;
|
|
2468
|
+
declare function isolate(): StyleRule;
|
|
2469
|
+
declare function isolationAuto(): StyleRule;
|
|
2470
|
+
declare function objectFit(value: string): StyleRule;
|
|
2471
|
+
declare function objectPosition(value: string): StyleRule;
|
|
2472
|
+
declare function overscrollBehavior(value: string): StyleRule;
|
|
2473
|
+
declare function overscrollX(value: string): StyleRule;
|
|
2474
|
+
declare function overscrollY(value: string): StyleRule;
|
|
2475
|
+
declare function static_(): StyleRule;
|
|
2476
|
+
declare function insetX(value: number | string | DynamicValue): StyleRule;
|
|
2477
|
+
declare function insetY(value: number | string | DynamicValue): StyleRule;
|
|
2478
|
+
declare function start(value: number | string | DynamicValue): StyleRule;
|
|
2479
|
+
declare function end(value: number | string | DynamicValue): StyleRule;
|
|
2480
|
+
declare function visible(): StyleRule;
|
|
2481
|
+
declare function invisible(): StyleRule;
|
|
2482
|
+
declare function collapse_(): StyleRule;
|
|
2483
|
+
declare function flexBasis(value: number | string | DynamicValue): StyleRule;
|
|
2484
|
+
declare function flexRowReverse(): StyleRule;
|
|
2485
|
+
declare function flexColReverse(): StyleRule;
|
|
2486
|
+
declare function flexWrapReverse(): StyleRule;
|
|
2487
|
+
declare function flexNowrap(): StyleRule;
|
|
2488
|
+
declare function flex1(): StyleRule;
|
|
2489
|
+
declare function flexAuto(): StyleRule;
|
|
2490
|
+
declare function flexInitial(): StyleRule;
|
|
2491
|
+
declare function flexNone(): StyleRule;
|
|
2492
|
+
declare function grow(value?: string | number): StyleRule;
|
|
2493
|
+
declare function shrink(value?: string | number): StyleRule;
|
|
2494
|
+
declare function order(value: number | string | DynamicValue): StyleRule;
|
|
2495
|
+
declare function colSpan(value: number | string): StyleRule;
|
|
2496
|
+
declare function colStart(value: number | string): StyleRule;
|
|
2497
|
+
declare function colEnd(value: number | string): StyleRule;
|
|
2498
|
+
declare function rowSpan(value: number | string): StyleRule;
|
|
2499
|
+
declare function rowStart(value: number | string): StyleRule;
|
|
2500
|
+
declare function rowEnd(value: number | string): StyleRule;
|
|
2501
|
+
declare function gridFlow(value: string): StyleRule;
|
|
2502
|
+
declare function autoCols(value: string): StyleRule;
|
|
2503
|
+
declare function autoRows(value: string): StyleRule;
|
|
2504
|
+
declare function justifyItems(value: string): StyleRule;
|
|
2505
|
+
declare function justifySelf(value: string): StyleRule;
|
|
2506
|
+
declare function alignContent(value: string): StyleRule;
|
|
2507
|
+
declare function placeContent(value: string): StyleRule;
|
|
2508
|
+
declare function placeItems(value: string): StyleRule;
|
|
2509
|
+
declare function placeSelf(value: string): StyleRule;
|
|
2510
|
+
declare function container(): StyleRule;
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Sets the `border-radius` on all corners of an element.
|
|
2514
|
+
*
|
|
2515
|
+
* When called without arguments, uses the default border radius (`0.25rem`).
|
|
2516
|
+
* Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
|
|
2517
|
+
*
|
|
2518
|
+
* @param value - Optional CSS border-radius string (`'0.5rem'`, `'9999px'`) or `dynamic()` value. Defaults to `'0.25rem'`.
|
|
2519
|
+
* @returns A {@link StyleRule} that sets `border-radius`.
|
|
2520
|
+
*
|
|
2521
|
+
* @example Default radius
|
|
2522
|
+
* ```ts
|
|
2523
|
+
* import { cx, rounded } from 'typewritingclass'
|
|
2524
|
+
*
|
|
2525
|
+
* cx(rounded())
|
|
2526
|
+
* // CSS: border-radius: 0.25rem;
|
|
2527
|
+
* ```
|
|
2528
|
+
*
|
|
2529
|
+
* @example Custom radius
|
|
2530
|
+
* ```ts
|
|
2531
|
+
* cx(rounded('0.5rem'))
|
|
2532
|
+
* // CSS: border-radius: 0.5rem;
|
|
2533
|
+
* ```
|
|
2534
|
+
*
|
|
2535
|
+
* @example Full rounding (pill shape)
|
|
2536
|
+
* ```ts
|
|
2537
|
+
* cx(rounded('9999px'))
|
|
2538
|
+
* // CSS: border-radius: 9999px;
|
|
2539
|
+
* ```
|
|
2540
|
+
*
|
|
2541
|
+
* @example Dynamic value
|
|
2542
|
+
* ```ts
|
|
2543
|
+
* import { dcx, rounded, dynamic } from 'typewritingclass'
|
|
2544
|
+
*
|
|
2545
|
+
* const { className, style } = dcx(rounded(dynamic(radius)))
|
|
2546
|
+
* // CSS: border-radius: var(--twc-d0);
|
|
2547
|
+
* // style: { '--twc-d0': radius }
|
|
2548
|
+
* ```
|
|
2549
|
+
*/
|
|
2550
|
+
declare function rounded(value?: string | DynamicValue): StyleRule;
|
|
2551
|
+
/**
|
|
2552
|
+
* Sets the `border-radius` on the top-left and top-right corners of an element.
|
|
2553
|
+
*
|
|
2554
|
+
* When called without arguments, uses the default border radius (`0.25rem`).
|
|
2555
|
+
* Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
|
|
2556
|
+
*
|
|
2557
|
+
* @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
|
|
2558
|
+
* @returns A {@link StyleRule} that sets `border-top-left-radius` and `border-top-right-radius`.
|
|
2559
|
+
*
|
|
2560
|
+
* @example Default radius
|
|
2561
|
+
* ```ts
|
|
2562
|
+
* import { cx, roundedT } from 'typewritingclass'
|
|
2563
|
+
*
|
|
2564
|
+
* cx(roundedT())
|
|
2565
|
+
* // CSS: border-top-left-radius: 0.25rem; border-top-right-radius: 0.25rem;
|
|
2566
|
+
* ```
|
|
2567
|
+
*
|
|
2568
|
+
* @example Custom radius
|
|
2569
|
+
* ```ts
|
|
2570
|
+
* cx(roundedT('1rem'))
|
|
2571
|
+
* // CSS: border-top-left-radius: 1rem; border-top-right-radius: 1rem;
|
|
2572
|
+
* ```
|
|
2573
|
+
*
|
|
2574
|
+
* @example Dynamic value
|
|
2575
|
+
* ```ts
|
|
2576
|
+
* import { dcx, roundedT, dynamic } from 'typewritingclass'
|
|
2577
|
+
*
|
|
2578
|
+
* const { className, style } = dcx(roundedT(dynamic(radius)))
|
|
2579
|
+
* // CSS: border-top-left-radius: var(--twc-d0); border-top-right-radius: var(--twc-d0);
|
|
2580
|
+
* // style: { '--twc-d0': radius }
|
|
2581
|
+
* ```
|
|
2582
|
+
*/
|
|
2583
|
+
declare function roundedT(value?: string | DynamicValue): StyleRule;
|
|
2584
|
+
/**
|
|
2585
|
+
* Sets the `border-radius` on the bottom-left and bottom-right corners of an element.
|
|
2586
|
+
*
|
|
2587
|
+
* When called without arguments, uses the default border radius (`0.25rem`).
|
|
2588
|
+
* Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
|
|
2589
|
+
*
|
|
2590
|
+
* @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
|
|
2591
|
+
* @returns A {@link StyleRule} that sets `border-bottom-left-radius` and `border-bottom-right-radius`.
|
|
2592
|
+
*
|
|
2593
|
+
* @example Default radius
|
|
2594
|
+
* ```ts
|
|
2595
|
+
* import { cx, roundedB } from 'typewritingclass'
|
|
2596
|
+
*
|
|
2597
|
+
* cx(roundedB())
|
|
2598
|
+
* // CSS: border-bottom-left-radius: 0.25rem; border-bottom-right-radius: 0.25rem;
|
|
2599
|
+
* ```
|
|
2600
|
+
*
|
|
2601
|
+
* @example Custom radius
|
|
2602
|
+
* ```ts
|
|
2603
|
+
* cx(roundedB('1rem'))
|
|
2604
|
+
* // CSS: border-bottom-left-radius: 1rem; border-bottom-right-radius: 1rem;
|
|
2605
|
+
* ```
|
|
2606
|
+
*
|
|
2607
|
+
* @example Dynamic value
|
|
2608
|
+
* ```ts
|
|
2609
|
+
* import { dcx, roundedB, dynamic } from 'typewritingclass'
|
|
2610
|
+
*
|
|
2611
|
+
* const { className, style } = dcx(roundedB(dynamic(radius)))
|
|
2612
|
+
* // CSS: border-bottom-left-radius: var(--twc-d0); border-bottom-right-radius: var(--twc-d0);
|
|
2613
|
+
* // style: { '--twc-d0': radius }
|
|
2614
|
+
* ```
|
|
2615
|
+
*/
|
|
2616
|
+
declare function roundedB(value?: string | DynamicValue): StyleRule;
|
|
2617
|
+
/**
|
|
2618
|
+
* Sets the `border-radius` on the top-left and bottom-left corners of an element.
|
|
2619
|
+
*
|
|
2620
|
+
* When called without arguments, uses the default border radius (`0.25rem`).
|
|
2621
|
+
* Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
|
|
2622
|
+
*
|
|
2623
|
+
* @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
|
|
2624
|
+
* @returns A {@link StyleRule} that sets `border-top-left-radius` and `border-bottom-left-radius`.
|
|
2625
|
+
*
|
|
2626
|
+
* @example Default radius
|
|
2627
|
+
* ```ts
|
|
2628
|
+
* import { cx, roundedL } from 'typewritingclass'
|
|
2629
|
+
*
|
|
2630
|
+
* cx(roundedL())
|
|
2631
|
+
* // CSS: border-top-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem;
|
|
2632
|
+
* ```
|
|
2633
|
+
*
|
|
2634
|
+
* @example Custom radius
|
|
2635
|
+
* ```ts
|
|
2636
|
+
* cx(roundedL('0.75rem'))
|
|
2637
|
+
* // CSS: border-top-left-radius: 0.75rem; border-bottom-left-radius: 0.75rem;
|
|
2638
|
+
* ```
|
|
2639
|
+
*
|
|
2640
|
+
* @example Dynamic value
|
|
2641
|
+
* ```ts
|
|
2642
|
+
* import { dcx, roundedL, dynamic } from 'typewritingclass'
|
|
2643
|
+
*
|
|
2644
|
+
* const { className, style } = dcx(roundedL(dynamic(radius)))
|
|
2645
|
+
* // CSS: border-top-left-radius: var(--twc-d0); border-bottom-left-radius: var(--twc-d0);
|
|
2646
|
+
* // style: { '--twc-d0': radius }
|
|
2647
|
+
* ```
|
|
2648
|
+
*/
|
|
2649
|
+
declare function roundedL(value?: string | DynamicValue): StyleRule;
|
|
2650
|
+
/**
|
|
2651
|
+
* Sets the `border-radius` on the top-right and bottom-right corners of an element.
|
|
2652
|
+
*
|
|
2653
|
+
* When called without arguments, uses the default border radius (`0.25rem`).
|
|
2654
|
+
* Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
|
|
2655
|
+
*
|
|
2656
|
+
* @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
|
|
2657
|
+
* @returns A {@link StyleRule} that sets `border-top-right-radius` and `border-bottom-right-radius`.
|
|
2658
|
+
*
|
|
2659
|
+
* @example Default radius
|
|
2660
|
+
* ```ts
|
|
2661
|
+
* import { cx, roundedR } from 'typewritingclass'
|
|
2662
|
+
*
|
|
2663
|
+
* cx(roundedR())
|
|
2664
|
+
* // CSS: border-top-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem;
|
|
2665
|
+
* ```
|
|
2666
|
+
*
|
|
2667
|
+
* @example Custom radius
|
|
2668
|
+
* ```ts
|
|
2669
|
+
* cx(roundedR('0.75rem'))
|
|
2670
|
+
* // CSS: border-top-right-radius: 0.75rem; border-bottom-right-radius: 0.75rem;
|
|
2671
|
+
* ```
|
|
2672
|
+
*
|
|
2673
|
+
* @example Dynamic value
|
|
2674
|
+
* ```ts
|
|
2675
|
+
* import { dcx, roundedR, dynamic } from 'typewritingclass'
|
|
2676
|
+
*
|
|
2677
|
+
* const { className, style } = dcx(roundedR(dynamic(radius)))
|
|
2678
|
+
* // CSS: border-top-right-radius: var(--twc-d0); border-bottom-right-radius: var(--twc-d0);
|
|
2679
|
+
* // style: { '--twc-d0': radius }
|
|
2680
|
+
* ```
|
|
2681
|
+
*/
|
|
2682
|
+
declare function roundedR(value?: string | DynamicValue): StyleRule;
|
|
2683
|
+
/**
|
|
2684
|
+
* Sets a solid border on all sides of an element.
|
|
2685
|
+
*
|
|
2686
|
+
* When called without arguments, defaults to `1px` width. Sets both
|
|
2687
|
+
* `border-width` and `border-style: solid`.
|
|
2688
|
+
*
|
|
2689
|
+
* @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
|
|
2690
|
+
* @returns A {@link StyleRule} that sets `border-width` and `border-style`.
|
|
2691
|
+
*
|
|
2692
|
+
* @example Default width
|
|
2693
|
+
* ```ts
|
|
2694
|
+
* import { cx, border } from 'typewritingclass'
|
|
2695
|
+
*
|
|
2696
|
+
* cx(border())
|
|
2697
|
+
* // CSS: border-width: 1px; border-style: solid;
|
|
2698
|
+
* ```
|
|
2699
|
+
*
|
|
2700
|
+
* @example Custom width
|
|
2701
|
+
* ```ts
|
|
2702
|
+
* cx(border('2px'))
|
|
2703
|
+
* // CSS: border-width: 2px; border-style: solid;
|
|
2704
|
+
* ```
|
|
2705
|
+
*/
|
|
2706
|
+
declare function border(width?: string | number): StyleRule;
|
|
2707
|
+
/**
|
|
2708
|
+
* Sets a solid border on the top side of an element.
|
|
2709
|
+
*
|
|
2710
|
+
* When called without arguments, defaults to `1px` width. Sets both
|
|
2711
|
+
* `border-top-width` and `border-style: solid`.
|
|
2712
|
+
*
|
|
2713
|
+
* @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
|
|
2714
|
+
* @returns A {@link StyleRule} that sets `border-top-width` and `border-style`.
|
|
2715
|
+
*
|
|
2716
|
+
* @example Default width
|
|
2717
|
+
* ```ts
|
|
2718
|
+
* import { cx, borderT } from 'typewritingclass'
|
|
2719
|
+
*
|
|
2720
|
+
* cx(borderT())
|
|
2721
|
+
* // CSS: border-top-width: 1px; border-style: solid;
|
|
2722
|
+
* ```
|
|
2723
|
+
*
|
|
2724
|
+
* @example Custom width
|
|
2725
|
+
* ```ts
|
|
2726
|
+
* cx(borderT('2px'))
|
|
2727
|
+
* // CSS: border-top-width: 2px; border-style: solid;
|
|
2728
|
+
* ```
|
|
2729
|
+
*/
|
|
2730
|
+
declare function borderT(width?: string | number): StyleRule;
|
|
2731
|
+
/**
|
|
2732
|
+
* Sets a solid border on the right side of an element.
|
|
2733
|
+
*
|
|
2734
|
+
* When called without arguments, defaults to `1px` width. Sets both
|
|
2735
|
+
* `border-right-width` and `border-style: solid`.
|
|
2736
|
+
*
|
|
2737
|
+
* @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
|
|
2738
|
+
* @returns A {@link StyleRule} that sets `border-right-width` and `border-style`.
|
|
2739
|
+
*
|
|
2740
|
+
* @example Default width
|
|
2741
|
+
* ```ts
|
|
2742
|
+
* import { cx, borderR } from 'typewritingclass'
|
|
2743
|
+
*
|
|
2744
|
+
* cx(borderR())
|
|
2745
|
+
* // CSS: border-right-width: 1px; border-style: solid;
|
|
2746
|
+
* ```
|
|
2747
|
+
*
|
|
2748
|
+
* @example Custom width
|
|
2749
|
+
* ```ts
|
|
2750
|
+
* cx(borderR('3px'))
|
|
2751
|
+
* // CSS: border-right-width: 3px; border-style: solid;
|
|
2752
|
+
* ```
|
|
2753
|
+
*/
|
|
2754
|
+
declare function borderR(width?: string | number): StyleRule;
|
|
2755
|
+
/**
|
|
2756
|
+
* Sets a solid border on the bottom side of an element.
|
|
2757
|
+
*
|
|
2758
|
+
* When called without arguments, defaults to `1px` width. Sets both
|
|
2759
|
+
* `border-bottom-width` and `border-style: solid`.
|
|
2760
|
+
*
|
|
2761
|
+
* @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
|
|
2762
|
+
* @returns A {@link StyleRule} that sets `border-bottom-width` and `border-style`.
|
|
2763
|
+
*
|
|
2764
|
+
* @example Default width
|
|
2765
|
+
* ```ts
|
|
2766
|
+
* import { cx, borderB } from 'typewritingclass'
|
|
2767
|
+
*
|
|
2768
|
+
* cx(borderB())
|
|
2769
|
+
* // CSS: border-bottom-width: 1px; border-style: solid;
|
|
2770
|
+
* ```
|
|
2771
|
+
*
|
|
2772
|
+
* @example Custom width
|
|
2773
|
+
* ```ts
|
|
2774
|
+
* cx(borderB('2px'))
|
|
2775
|
+
* // CSS: border-bottom-width: 2px; border-style: solid;
|
|
2776
|
+
* ```
|
|
2777
|
+
*/
|
|
2778
|
+
declare function borderB(width?: string | number): StyleRule;
|
|
2779
|
+
/**
|
|
2780
|
+
* Sets a solid border on the left side of an element.
|
|
2781
|
+
*
|
|
2782
|
+
* When called without arguments, defaults to `1px` width. Sets both
|
|
2783
|
+
* `border-left-width` and `border-style: solid`.
|
|
2784
|
+
*
|
|
2785
|
+
* @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
|
|
2786
|
+
* @returns A {@link StyleRule} that sets `border-left-width` and `border-style`.
|
|
2787
|
+
*
|
|
2788
|
+
* @example Default width
|
|
2789
|
+
* ```ts
|
|
2790
|
+
* import { cx, borderL } from 'typewritingclass'
|
|
2791
|
+
*
|
|
2792
|
+
* cx(borderL())
|
|
2793
|
+
* // CSS: border-left-width: 1px; border-style: solid;
|
|
2794
|
+
* ```
|
|
2795
|
+
*
|
|
2796
|
+
* @example Custom width
|
|
2797
|
+
* ```ts
|
|
2798
|
+
* cx(borderL('4px'))
|
|
2799
|
+
* // CSS: border-left-width: 4px; border-style: solid;
|
|
2800
|
+
* ```
|
|
2801
|
+
*/
|
|
2802
|
+
declare function borderL(width?: string | number): StyleRule;
|
|
2803
|
+
/**
|
|
2804
|
+
* Creates a focus-ring-style `box-shadow` around an element.
|
|
2805
|
+
*
|
|
2806
|
+
* When called without arguments, defaults to `3px` width and `#3b82f6` (blue) color.
|
|
2807
|
+
* Produces a `box-shadow` with zero offset and zero blur, acting as an outline alternative.
|
|
2808
|
+
*
|
|
2809
|
+
* @param width - Optional ring width string (`'2px'`). Defaults to `'3px'`.
|
|
2810
|
+
* @param color - Optional ring color string (`'#ef4444'`). Defaults to `'#3b82f6'`.
|
|
2811
|
+
* @returns A {@link StyleRule} that sets `box-shadow`.
|
|
2812
|
+
*
|
|
2813
|
+
* @example Default ring
|
|
2814
|
+
* ```ts
|
|
2815
|
+
* import { cx, ring } from 'typewritingclass'
|
|
2816
|
+
*
|
|
2817
|
+
* cx(ring())
|
|
2818
|
+
* // CSS: box-shadow: 0 0 0 3px #3b82f6;
|
|
2819
|
+
* ```
|
|
2820
|
+
*
|
|
2821
|
+
* @example Custom width and color
|
|
2822
|
+
* ```ts
|
|
2823
|
+
* cx(ring('2px', '#ef4444'))
|
|
2824
|
+
* // CSS: box-shadow: 0 0 0 2px #ef4444;
|
|
2825
|
+
* ```
|
|
2826
|
+
*
|
|
2827
|
+
* @example Custom width only
|
|
2828
|
+
* ```ts
|
|
2829
|
+
* cx(ring('1px'))
|
|
2830
|
+
* // CSS: box-shadow: 0 0 0 1px #3b82f6;
|
|
2831
|
+
* ```
|
|
2832
|
+
*/
|
|
2833
|
+
declare function ring(width?: string | number, color?: string): StyleRule;
|
|
2834
|
+
declare function roundedTL(value?: string | DynamicValue): StyleRule;
|
|
2835
|
+
declare function roundedTR(value?: string | DynamicValue): StyleRule;
|
|
2836
|
+
declare function roundedBR(value?: string | DynamicValue): StyleRule;
|
|
2837
|
+
declare function roundedBL(value?: string | DynamicValue): StyleRule;
|
|
2838
|
+
declare function roundedSS(value?: string | DynamicValue): StyleRule;
|
|
2839
|
+
declare function roundedSE(value?: string | DynamicValue): StyleRule;
|
|
2840
|
+
declare function roundedEE(value?: string | DynamicValue): StyleRule;
|
|
2841
|
+
declare function roundedES(value?: string | DynamicValue): StyleRule;
|
|
2842
|
+
declare function borderX(width?: string | number): StyleRule;
|
|
2843
|
+
declare function borderY(width?: string | number): StyleRule;
|
|
2844
|
+
declare function borderS(width?: string | number): StyleRule;
|
|
2845
|
+
declare function borderE(width?: string | number): StyleRule;
|
|
2846
|
+
declare function borderStyle(value: string): StyleRule;
|
|
2847
|
+
declare function outlineWidth(value: string | number): StyleRule;
|
|
2848
|
+
declare function outlineColor(value: string | DynamicValue): StyleRule;
|
|
2849
|
+
declare function outlineStyle(value: string): StyleRule;
|
|
2850
|
+
declare function outlineOffset(value: string | number): StyleRule;
|
|
2851
|
+
declare function outline(width?: string | number, style?: string, color?: string): StyleRule;
|
|
2852
|
+
declare function outlineNone(): StyleRule;
|
|
2853
|
+
declare function ringInset(): StyleRule;
|
|
2854
|
+
declare function ringColor(value: string | DynamicValue): StyleRule;
|
|
2855
|
+
declare function ringOffsetWidth(value: string | number): StyleRule;
|
|
2856
|
+
declare function ringOffsetColor(value: string | DynamicValue): StyleRule;
|
|
2857
|
+
declare function divideX(width?: string | number): StyleRule;
|
|
2858
|
+
declare function divideY(width?: string | number): StyleRule;
|
|
2859
|
+
declare function divideColor(value: string | DynamicValue): StyleRule;
|
|
2860
|
+
declare function divideStyle(value: string): StyleRule;
|
|
2861
|
+
declare function divideXReverse(): StyleRule;
|
|
2862
|
+
declare function divideYReverse(): StyleRule;
|
|
2863
|
+
|
|
2864
|
+
/**
|
|
2865
|
+
* Sets the `box-shadow` of an element.
|
|
2866
|
+
*
|
|
2867
|
+
* When called without arguments, uses the default shadow from the shadows theme
|
|
2868
|
+
* (`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`).
|
|
2869
|
+
* Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
|
|
2870
|
+
*
|
|
2871
|
+
* @param value - Optional CSS box-shadow string or `dynamic()` value. Defaults to the theme's `DEFAULT` shadow.
|
|
2872
|
+
* @returns A {@link StyleRule} that sets `box-shadow`.
|
|
2873
|
+
*
|
|
2874
|
+
* @example Default shadow
|
|
2875
|
+
* ```ts
|
|
2876
|
+
* import { cx, shadow } from 'typewritingclass'
|
|
2877
|
+
*
|
|
2878
|
+
* cx(shadow())
|
|
2879
|
+
* // CSS: box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
2880
|
+
* ```
|
|
2881
|
+
*
|
|
2882
|
+
* @example Custom shadow
|
|
2883
|
+
* ```ts
|
|
2884
|
+
* cx(shadow('0 4px 6px -1px rgb(0 0 0 / 0.1)'))
|
|
2885
|
+
* // CSS: box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
|
|
2886
|
+
* ```
|
|
2887
|
+
*
|
|
2888
|
+
* @example No shadow
|
|
2889
|
+
* ```ts
|
|
2890
|
+
* cx(shadow('none'))
|
|
2891
|
+
* // CSS: box-shadow: none;
|
|
2892
|
+
* ```
|
|
2893
|
+
*
|
|
2894
|
+
* @example Dynamic value
|
|
2895
|
+
* ```ts
|
|
2896
|
+
* import { dcx, shadow, dynamic } from 'typewritingclass'
|
|
2897
|
+
*
|
|
2898
|
+
* const { className, style } = dcx(shadow(dynamic(shadowValue)))
|
|
2899
|
+
* // CSS: box-shadow: var(--twc-d0);
|
|
2900
|
+
* // style: { '--twc-d0': shadowValue }
|
|
2901
|
+
* ```
|
|
2902
|
+
*/
|
|
2903
|
+
declare function shadow(value?: string | DynamicValue): StyleRule;
|
|
2904
|
+
/**
|
|
2905
|
+
* Sets the `opacity` of an element.
|
|
2906
|
+
*
|
|
2907
|
+
* Accepts a numeric opacity value (between `0` and `1`) or a {@link DynamicValue}
|
|
2908
|
+
* for runtime values. The numeric value is converted to a string for the CSS declaration.
|
|
2909
|
+
*
|
|
2910
|
+
* @param value - A numeric opacity (`0` to `1`) or `dynamic()` value.
|
|
2911
|
+
* @returns A {@link StyleRule} that sets `opacity`.
|
|
2912
|
+
*
|
|
2913
|
+
* @example Fully opaque
|
|
2914
|
+
* ```ts
|
|
2915
|
+
* import { cx, opacity } from 'typewritingclass'
|
|
2916
|
+
*
|
|
2917
|
+
* cx(opacity(1))
|
|
2918
|
+
* // CSS: opacity: 1;
|
|
2919
|
+
* ```
|
|
2920
|
+
*
|
|
2921
|
+
* @example Semi-transparent
|
|
2922
|
+
* ```ts
|
|
2923
|
+
* cx(opacity(0.5))
|
|
2924
|
+
* // CSS: opacity: 0.5;
|
|
2925
|
+
* ```
|
|
2926
|
+
*
|
|
2927
|
+
* @example Hidden
|
|
2928
|
+
* ```ts
|
|
2929
|
+
* cx(opacity(0))
|
|
2930
|
+
* // CSS: opacity: 0;
|
|
2931
|
+
* ```
|
|
2932
|
+
*
|
|
2933
|
+
* @example Dynamic value
|
|
2934
|
+
* ```ts
|
|
2935
|
+
* import { dcx, opacity, dynamic } from 'typewritingclass'
|
|
2936
|
+
*
|
|
2937
|
+
* const { className, style } = dcx(opacity(dynamic(opacityValue)))
|
|
2938
|
+
* // CSS: opacity: var(--twc-d0);
|
|
2939
|
+
* // style: { '--twc-d0': opacityValue }
|
|
2940
|
+
* ```
|
|
2941
|
+
*/
|
|
2942
|
+
declare function opacity(value: number | DynamicValue): StyleRule;
|
|
2943
|
+
/**
|
|
2944
|
+
* Sets the `backdrop-filter` CSS property on an element.
|
|
2945
|
+
*
|
|
2946
|
+
* Applies graphical effects (such as blurring or color shifting) to the area
|
|
2947
|
+
* behind the element. Accepts a raw CSS backdrop-filter string or a
|
|
2948
|
+
* {@link DynamicValue} for runtime values.
|
|
2949
|
+
*
|
|
2950
|
+
* @param value - A CSS backdrop-filter string (`'blur(8px)'`, `'saturate(180%)'`) or `dynamic()` value.
|
|
2951
|
+
* @returns A {@link StyleRule} that sets `backdrop-filter`.
|
|
2952
|
+
*
|
|
2953
|
+
* @example Blur backdrop
|
|
2954
|
+
* ```ts
|
|
2955
|
+
* import { cx, backdrop } from 'typewritingclass'
|
|
2956
|
+
*
|
|
2957
|
+
* cx(backdrop('blur(8px)'))
|
|
2958
|
+
* // CSS: backdrop-filter: blur(8px);
|
|
2959
|
+
* ```
|
|
2960
|
+
*
|
|
2961
|
+
* @example Saturate backdrop
|
|
2962
|
+
* ```ts
|
|
2963
|
+
* cx(backdrop('saturate(180%)'))
|
|
2964
|
+
* // CSS: backdrop-filter: saturate(180%);
|
|
2965
|
+
* ```
|
|
2966
|
+
*
|
|
2967
|
+
* @example Combined filters
|
|
2968
|
+
* ```ts
|
|
2969
|
+
* cx(backdrop('blur(12px) saturate(150%)'))
|
|
2970
|
+
* // CSS: backdrop-filter: blur(12px) saturate(150%);
|
|
2971
|
+
* ```
|
|
2972
|
+
*
|
|
2973
|
+
* @example Dynamic value
|
|
2974
|
+
* ```ts
|
|
2975
|
+
* import { dcx, backdrop, dynamic } from 'typewritingclass'
|
|
2976
|
+
*
|
|
2977
|
+
* const { className, style } = dcx(backdrop(dynamic(filterValue)))
|
|
2978
|
+
* // CSS: backdrop-filter: var(--twc-d0);
|
|
2979
|
+
* // style: { '--twc-d0': filterValue }
|
|
2980
|
+
* ```
|
|
2981
|
+
*/
|
|
2982
|
+
declare function backdrop(value: string | DynamicValue): StyleRule;
|
|
2983
|
+
declare function shadowColor(value: string | DynamicValue): StyleRule;
|
|
2984
|
+
declare function mixBlendMode(value: string): StyleRule;
|
|
2985
|
+
declare function bgBlendMode(value: string): StyleRule;
|
|
2986
|
+
|
|
2987
|
+
/**
|
|
2988
|
+
* Sets the `cursor` style of an element.
|
|
2989
|
+
*
|
|
2990
|
+
* Accepts a raw CSS cursor string or a {@link DynamicValue} for runtime values.
|
|
2991
|
+
*
|
|
2992
|
+
* @param value - A CSS cursor value (`'pointer'`, `'grab'`, `'not-allowed'`, etc.) or `dynamic()` value.
|
|
2993
|
+
* @returns A {@link StyleRule} that sets `cursor`.
|
|
2994
|
+
*
|
|
2995
|
+
* @example Pointer cursor
|
|
2996
|
+
* ```ts
|
|
2997
|
+
* import { cx, cursor } from 'typewritingclass'
|
|
2998
|
+
*
|
|
2999
|
+
* cx(cursor('pointer'))
|
|
3000
|
+
* // CSS: cursor: pointer;
|
|
3001
|
+
* ```
|
|
3002
|
+
*
|
|
3003
|
+
* @example Not-allowed cursor
|
|
3004
|
+
* ```ts
|
|
3005
|
+
* cx(cursor('not-allowed'))
|
|
3006
|
+
* // CSS: cursor: not-allowed;
|
|
3007
|
+
* ```
|
|
3008
|
+
*
|
|
3009
|
+
* @example Dynamic value
|
|
3010
|
+
* ```ts
|
|
3011
|
+
* import { dcx, cursor, dynamic } from 'typewritingclass'
|
|
3012
|
+
*
|
|
3013
|
+
* const { className, style } = dcx(cursor(dynamic(cursorType)))
|
|
3014
|
+
* // CSS: cursor: var(--twc-d0);
|
|
3015
|
+
* // style: { '--twc-d0': cursorType }
|
|
3016
|
+
* ```
|
|
3017
|
+
*/
|
|
3018
|
+
declare function cursor(value: string | DynamicValue): StyleRule;
|
|
3019
|
+
/**
|
|
3020
|
+
* Sets the `user-select` behavior of an element.
|
|
3021
|
+
*
|
|
3022
|
+
* Controls whether the user can select text within the element.
|
|
3023
|
+
* Accepts a raw CSS user-select string.
|
|
3024
|
+
*
|
|
3025
|
+
* @param value - A CSS user-select value (`'none'`, `'text'`, `'all'`, `'auto'`).
|
|
3026
|
+
* @returns A {@link StyleRule} that sets `user-select`.
|
|
3027
|
+
*
|
|
3028
|
+
* @example Prevent selection
|
|
3029
|
+
* ```ts
|
|
3030
|
+
* import { cx, select } from 'typewritingclass'
|
|
3031
|
+
*
|
|
3032
|
+
* cx(select('none'))
|
|
3033
|
+
* // CSS: user-select: none;
|
|
3034
|
+
* ```
|
|
3035
|
+
*
|
|
3036
|
+
* @example Allow text selection
|
|
3037
|
+
* ```ts
|
|
3038
|
+
* cx(select('text'))
|
|
3039
|
+
* // CSS: user-select: text;
|
|
3040
|
+
* ```
|
|
3041
|
+
*
|
|
3042
|
+
* @example Select all on click
|
|
3043
|
+
* ```ts
|
|
3044
|
+
* cx(select('all'))
|
|
3045
|
+
* // CSS: user-select: all;
|
|
3046
|
+
* ```
|
|
3047
|
+
*/
|
|
3048
|
+
declare function select(value: string): StyleRule;
|
|
3049
|
+
/**
|
|
3050
|
+
* Sets the `pointer-events` behavior of an element.
|
|
3051
|
+
*
|
|
3052
|
+
* Controls whether the element can be the target of pointer events (clicks, hovers, etc.).
|
|
3053
|
+
* Accepts a raw CSS pointer-events string.
|
|
3054
|
+
*
|
|
3055
|
+
* @param value - A CSS pointer-events value (`'none'`, `'auto'`).
|
|
3056
|
+
* @returns A {@link StyleRule} that sets `pointer-events`.
|
|
3057
|
+
*
|
|
3058
|
+
* @example Disable pointer events
|
|
3059
|
+
* ```ts
|
|
3060
|
+
* import { cx, pointerEvents } from 'typewritingclass'
|
|
3061
|
+
*
|
|
3062
|
+
* cx(pointerEvents('none'))
|
|
3063
|
+
* // CSS: pointer-events: none;
|
|
3064
|
+
* ```
|
|
3065
|
+
*
|
|
3066
|
+
* @example Enable pointer events
|
|
3067
|
+
* ```ts
|
|
3068
|
+
* cx(pointerEvents('auto'))
|
|
3069
|
+
* // CSS: pointer-events: auto;
|
|
3070
|
+
* ```
|
|
3071
|
+
*/
|
|
3072
|
+
declare function pointerEvents(value: string): StyleRule;
|
|
3073
|
+
declare function accentColor(value: string | DynamicValue): StyleRule;
|
|
3074
|
+
declare function appearance(value: string): StyleRule;
|
|
3075
|
+
declare function caretColor(value: string | DynamicValue): StyleRule;
|
|
3076
|
+
declare function resize(value: string): StyleRule;
|
|
3077
|
+
declare function scrollBehavior(value: string): StyleRule;
|
|
3078
|
+
declare function scrollMargin(value: number | string | DynamicValue): StyleRule;
|
|
3079
|
+
declare function scrollMarginX(value: number | string | DynamicValue): StyleRule;
|
|
3080
|
+
declare function scrollMarginY(value: number | string | DynamicValue): StyleRule;
|
|
3081
|
+
declare function scrollMarginT(value: number | string | DynamicValue): StyleRule;
|
|
3082
|
+
declare function scrollMarginR(value: number | string | DynamicValue): StyleRule;
|
|
3083
|
+
declare function scrollMarginB(value: number | string | DynamicValue): StyleRule;
|
|
3084
|
+
declare function scrollMarginL(value: number | string | DynamicValue): StyleRule;
|
|
3085
|
+
declare function scrollPadding(value: number | string | DynamicValue): StyleRule;
|
|
3086
|
+
declare function scrollPaddingX(value: number | string | DynamicValue): StyleRule;
|
|
3087
|
+
declare function scrollPaddingY(value: number | string | DynamicValue): StyleRule;
|
|
3088
|
+
declare function scrollPaddingT(value: number | string | DynamicValue): StyleRule;
|
|
3089
|
+
declare function scrollPaddingR(value: number | string | DynamicValue): StyleRule;
|
|
3090
|
+
declare function scrollPaddingB(value: number | string | DynamicValue): StyleRule;
|
|
3091
|
+
declare function scrollPaddingL(value: number | string | DynamicValue): StyleRule;
|
|
3092
|
+
declare function snapAlign(value: string): StyleRule;
|
|
3093
|
+
declare function snapStop(value: string): StyleRule;
|
|
3094
|
+
declare function snapType(value: string): StyleRule;
|
|
3095
|
+
declare function touchAction(value: string): StyleRule;
|
|
3096
|
+
declare function willChange(value: string): StyleRule;
|
|
3097
|
+
|
|
3098
|
+
declare function blur(value?: string | DynamicValue): StyleRule;
|
|
3099
|
+
declare function brightness(value: string | DynamicValue): StyleRule;
|
|
3100
|
+
declare function contrast(value: string | DynamicValue): StyleRule;
|
|
3101
|
+
declare function dropShadow(value?: string | DynamicValue): StyleRule;
|
|
3102
|
+
declare function grayscale(value?: string | DynamicValue): StyleRule;
|
|
3103
|
+
declare function hueRotate(value: string | DynamicValue): StyleRule;
|
|
3104
|
+
declare function invert(value?: string | DynamicValue): StyleRule;
|
|
3105
|
+
declare function saturate(value: string | DynamicValue): StyleRule;
|
|
3106
|
+
declare function sepia(value?: string | DynamicValue): StyleRule;
|
|
3107
|
+
declare function backdropBlur(value?: string | DynamicValue): StyleRule;
|
|
3108
|
+
declare function backdropBrightness(value: string | DynamicValue): StyleRule;
|
|
3109
|
+
declare function backdropContrast(value: string | DynamicValue): StyleRule;
|
|
3110
|
+
declare function backdropGrayscale(value?: string | DynamicValue): StyleRule;
|
|
3111
|
+
declare function backdropHueRotate(value: string | DynamicValue): StyleRule;
|
|
3112
|
+
declare function backdropInvert(value?: string | DynamicValue): StyleRule;
|
|
3113
|
+
declare function backdropOpacity(value: string | DynamicValue): StyleRule;
|
|
3114
|
+
declare function backdropSaturate(value: string | DynamicValue): StyleRule;
|
|
3115
|
+
declare function backdropSepia(value?: string | DynamicValue): StyleRule;
|
|
3116
|
+
|
|
3117
|
+
declare function scale(value: string | number | DynamicValue): StyleRule;
|
|
3118
|
+
declare function scaleX(value: string | number | DynamicValue): StyleRule;
|
|
3119
|
+
declare function scaleY(value: string | number | DynamicValue): StyleRule;
|
|
3120
|
+
declare function rotate(value: string | DynamicValue): StyleRule;
|
|
3121
|
+
declare function translateX(value: string | number | DynamicValue): StyleRule;
|
|
3122
|
+
declare function translateY(value: string | number | DynamicValue): StyleRule;
|
|
3123
|
+
declare function skewX(value: string | DynamicValue): StyleRule;
|
|
3124
|
+
declare function skewY(value: string | DynamicValue): StyleRule;
|
|
3125
|
+
declare function transformOrigin(value: string | DynamicValue): StyleRule;
|
|
3126
|
+
declare function transformGpu(): StyleRule;
|
|
3127
|
+
declare function transformNone(): StyleRule;
|
|
3128
|
+
|
|
3129
|
+
declare function transition(): StyleRule;
|
|
3130
|
+
declare function transitionAll(): StyleRule;
|
|
3131
|
+
declare function transitionColors(): StyleRule;
|
|
3132
|
+
declare function transitionOpacity(): StyleRule;
|
|
3133
|
+
declare function transitionShadow(): StyleRule;
|
|
3134
|
+
declare function transitionTransform(): StyleRule;
|
|
3135
|
+
declare function transitionNone(): StyleRule;
|
|
3136
|
+
declare function duration(value: string | number | DynamicValue): StyleRule;
|
|
3137
|
+
declare function ease(value: string | DynamicValue): StyleRule;
|
|
3138
|
+
declare function delay(value: string | number | DynamicValue): StyleRule;
|
|
3139
|
+
declare function animate(value: string | DynamicValue): StyleRule;
|
|
3140
|
+
|
|
3141
|
+
declare function borderCollapse(): StyleRule;
|
|
3142
|
+
declare function borderSeparate(): StyleRule;
|
|
3143
|
+
declare function borderSpacing(value: number | string | DynamicValue): StyleRule;
|
|
3144
|
+
declare function borderSpacingX(value: number | string | DynamicValue): StyleRule;
|
|
3145
|
+
declare function borderSpacingY(value: number | string | DynamicValue): StyleRule;
|
|
3146
|
+
declare function tableLayout(value: string): StyleRule;
|
|
3147
|
+
declare function captionSide(value: string): StyleRule;
|
|
3148
|
+
|
|
3149
|
+
declare function fill(value: string | DynamicValue): StyleRule;
|
|
3150
|
+
declare function stroke(value: string | DynamicValue): StyleRule;
|
|
3151
|
+
declare function strokeWidth(value: string | number | DynamicValue): StyleRule;
|
|
3152
|
+
|
|
3153
|
+
declare function srOnly(): StyleRule;
|
|
3154
|
+
declare function notSrOnly(): StyleRule;
|
|
3155
|
+
declare function forcedColorAdjust(value: string): StyleRule;
|
|
3156
|
+
|
|
3157
|
+
declare function bgAttachment(value: string): StyleRule;
|
|
3158
|
+
declare function bgClip(value: string): StyleRule;
|
|
3159
|
+
declare function bgOrigin(value: string): StyleRule;
|
|
3160
|
+
declare function bgPosition(value: string | DynamicValue): StyleRule;
|
|
3161
|
+
declare function bgRepeat(value: string): StyleRule;
|
|
3162
|
+
declare function bgSize(value: string | DynamicValue): StyleRule;
|
|
3163
|
+
declare function bgImage(value: string | DynamicValue): StyleRule;
|
|
3164
|
+
declare function bgGradient(direction?: string): StyleRule;
|
|
3165
|
+
declare function gradientFrom(color: string | DynamicValue): StyleRule;
|
|
3166
|
+
declare function gradientVia(color: string | DynamicValue): StyleRule;
|
|
3167
|
+
declare function gradientTo(color: string | DynamicValue): StyleRule;
|
|
3168
|
+
|
|
3169
|
+
/**
|
|
3170
|
+
* Applies styles only when the element is hovered.
|
|
3171
|
+
*
|
|
3172
|
+
* Use with {@link when} to conditionally apply style rules on `:hover`.
|
|
3173
|
+
*
|
|
3174
|
+
* @param rule - The style rule to apply on hover.
|
|
3175
|
+
* @returns A new {@link StyleRule} scoped to the `:hover` pseudo-class.
|
|
3176
|
+
*
|
|
3177
|
+
* @example
|
|
3178
|
+
* ```ts
|
|
3179
|
+
* import { cx, bg, when, hover } from 'typewritingclass'
|
|
3180
|
+
*
|
|
3181
|
+
* cx(bg('#3b82f6'), when(hover)(bg('#2563eb')))
|
|
3182
|
+
* // CSS: .abc { background-color: #3b82f6; }
|
|
3183
|
+
* // .def:hover { background-color: #2563eb; }
|
|
3184
|
+
* ```
|
|
3185
|
+
*/
|
|
3186
|
+
declare const hover: Modifier;
|
|
3187
|
+
/**
|
|
3188
|
+
* Applies styles only when the element has keyboard or pointer focus.
|
|
3189
|
+
*
|
|
3190
|
+
* Use with {@link when} to conditionally apply style rules on `:focus`.
|
|
3191
|
+
*
|
|
3192
|
+
* @param rule - The style rule to apply on focus.
|
|
3193
|
+
* @returns A new {@link StyleRule} scoped to the `:focus` pseudo-class.
|
|
3194
|
+
*
|
|
3195
|
+
* @example
|
|
3196
|
+
* ```ts
|
|
3197
|
+
* import { cx, borderColor, when, focus } from 'typewritingclass'
|
|
3198
|
+
*
|
|
3199
|
+
* cx(borderColor('#d1d5db'), when(focus)(borderColor('#3b82f6')))
|
|
3200
|
+
* // CSS: .abc { border-color: #d1d5db; }
|
|
3201
|
+
* // .def:focus { border-color: #3b82f6; }
|
|
3202
|
+
* ```
|
|
3203
|
+
*/
|
|
3204
|
+
declare const focus: Modifier;
|
|
3205
|
+
/**
|
|
3206
|
+
* Applies styles only when the element is being actively pressed.
|
|
3207
|
+
*
|
|
3208
|
+
* Use with {@link when} to conditionally apply style rules on `:active`.
|
|
3209
|
+
*
|
|
3210
|
+
* @param rule - The style rule to apply while the element is active.
|
|
3211
|
+
* @returns A new {@link StyleRule} scoped to the `:active` pseudo-class.
|
|
3212
|
+
*
|
|
3213
|
+
* @example
|
|
3214
|
+
* ```ts
|
|
3215
|
+
* import { cx, bg, when, active } from 'typewritingclass'
|
|
3216
|
+
*
|
|
3217
|
+
* cx(bg('#3b82f6'), when(active)(bg('#1d4ed8')))
|
|
3218
|
+
* // CSS: .abc { background-color: #3b82f6; }
|
|
3219
|
+
* // .def:active { background-color: #1d4ed8; }
|
|
3220
|
+
* ```
|
|
3221
|
+
*/
|
|
3222
|
+
declare const active: Modifier;
|
|
3223
|
+
/**
|
|
3224
|
+
* Applies styles only when the element is disabled.
|
|
3225
|
+
*
|
|
3226
|
+
* Use with {@link when} to conditionally apply style rules on `:disabled`.
|
|
3227
|
+
* Commonly used for form controls such as buttons and inputs.
|
|
3228
|
+
*
|
|
3229
|
+
* @param rule - The style rule to apply when disabled.
|
|
3230
|
+
* @returns A new {@link StyleRule} scoped to the `:disabled` pseudo-class.
|
|
3231
|
+
*
|
|
3232
|
+
* @example
|
|
3233
|
+
* ```ts
|
|
3234
|
+
* import { cx, opacity, when, disabled } from 'typewritingclass'
|
|
3235
|
+
*
|
|
3236
|
+
* cx(opacity('1'), when(disabled)(opacity('0.5')))
|
|
3237
|
+
* // CSS: .abc { opacity: 1; }
|
|
3238
|
+
* // .def:disabled { opacity: 0.5; }
|
|
3239
|
+
* ```
|
|
3240
|
+
*/
|
|
3241
|
+
declare const disabled: Modifier;
|
|
3242
|
+
/**
|
|
3243
|
+
* Applies styles only when the element has visible focus (typically keyboard focus).
|
|
3244
|
+
*
|
|
3245
|
+
* Use with {@link when} to conditionally apply style rules on `:focus-visible`.
|
|
3246
|
+
* Unlike {@link focus}, this only matches when the user agent determines that
|
|
3247
|
+
* focus should be visibly indicated (e.g., keyboard navigation, not mouse clicks).
|
|
3248
|
+
*
|
|
3249
|
+
* @param rule - The style rule to apply on visible focus.
|
|
3250
|
+
* @returns A new {@link StyleRule} scoped to the `:focus-visible` pseudo-class.
|
|
3251
|
+
*
|
|
3252
|
+
* @example
|
|
3253
|
+
* ```ts
|
|
3254
|
+
* import { cx, outline, when, focusVisible } from 'typewritingclass'
|
|
3255
|
+
*
|
|
3256
|
+
* cx(when(focusVisible)(outline('2px solid #3b82f6')))
|
|
3257
|
+
* // CSS: .abc:focus-visible { outline: 2px solid #3b82f6; }
|
|
3258
|
+
* ```
|
|
3259
|
+
*/
|
|
3260
|
+
declare const focusVisible: Modifier;
|
|
3261
|
+
/**
|
|
3262
|
+
* Applies styles when the element or any of its descendants has focus.
|
|
3263
|
+
*
|
|
3264
|
+
* Use with {@link when} to conditionally apply style rules on `:focus-within`.
|
|
3265
|
+
* Useful for styling a parent container when a child input receives focus.
|
|
3266
|
+
*
|
|
3267
|
+
* @param rule - The style rule to apply when focus is within the element.
|
|
3268
|
+
* @returns A new {@link StyleRule} scoped to the `:focus-within` pseudo-class.
|
|
3269
|
+
*
|
|
3270
|
+
* @example
|
|
3271
|
+
* ```ts
|
|
3272
|
+
* import { cx, borderColor, when, focusWithin } from 'typewritingclass'
|
|
3273
|
+
*
|
|
3274
|
+
* cx(borderColor('#d1d5db'), when(focusWithin)(borderColor('#3b82f6')))
|
|
3275
|
+
* // CSS: .abc { border-color: #d1d5db; }
|
|
3276
|
+
* // .def:focus-within { border-color: #3b82f6; }
|
|
3277
|
+
* ```
|
|
3278
|
+
*/
|
|
3279
|
+
declare const focusWithin: Modifier;
|
|
3280
|
+
/**
|
|
3281
|
+
* Applies styles only when the element is the first child of its parent.
|
|
3282
|
+
*
|
|
3283
|
+
* Use with {@link when} to conditionally apply style rules on `:first-child`.
|
|
3284
|
+
*
|
|
3285
|
+
* @param rule - The style rule to apply to the first child.
|
|
3286
|
+
* @returns A new {@link StyleRule} scoped to the `:first-child` pseudo-class.
|
|
3287
|
+
*
|
|
3288
|
+
* @example
|
|
3289
|
+
* ```ts
|
|
3290
|
+
* import { cx, mt, when, firstChild } from 'typewritingclass'
|
|
3291
|
+
*
|
|
3292
|
+
* cx(mt('1rem'), when(firstChild)(mt('0')))
|
|
3293
|
+
* // CSS: .abc { margin-top: 1rem; }
|
|
3294
|
+
* // .def:first-child { margin-top: 0; }
|
|
3295
|
+
* ```
|
|
3296
|
+
*/
|
|
3297
|
+
declare const firstChild: Modifier;
|
|
3298
|
+
/**
|
|
3299
|
+
* Applies styles only when the element is the last child of its parent.
|
|
3300
|
+
*
|
|
3301
|
+
* Use with {@link when} to conditionally apply style rules on `:last-child`.
|
|
3302
|
+
*
|
|
3303
|
+
* @param rule - The style rule to apply to the last child.
|
|
3304
|
+
* @returns A new {@link StyleRule} scoped to the `:last-child` pseudo-class.
|
|
3305
|
+
*
|
|
3306
|
+
* @example
|
|
3307
|
+
* ```ts
|
|
3308
|
+
* import { cx, mb, when, lastChild } from 'typewritingclass'
|
|
3309
|
+
*
|
|
3310
|
+
* cx(mb('1rem'), when(lastChild)(mb('0')))
|
|
3311
|
+
* // CSS: .abc { margin-bottom: 1rem; }
|
|
3312
|
+
* // .def:last-child { margin-bottom: 0; }
|
|
3313
|
+
* ```
|
|
3314
|
+
*/
|
|
3315
|
+
declare const lastChild: Modifier;
|
|
3316
|
+
declare const visited: Modifier;
|
|
3317
|
+
declare const checked: Modifier;
|
|
3318
|
+
declare const indeterminate: Modifier;
|
|
3319
|
+
declare const default_: Modifier;
|
|
3320
|
+
declare const required_: Modifier;
|
|
3321
|
+
declare const valid: Modifier;
|
|
3322
|
+
declare const invalid: Modifier;
|
|
3323
|
+
declare const inRange: Modifier;
|
|
3324
|
+
declare const outOfRange: Modifier;
|
|
3325
|
+
declare const placeholderShown: Modifier;
|
|
3326
|
+
declare const autofill: Modifier;
|
|
3327
|
+
declare const readOnly: Modifier;
|
|
3328
|
+
declare const empty: Modifier;
|
|
3329
|
+
declare const even: Modifier;
|
|
3330
|
+
declare const odd: Modifier;
|
|
3331
|
+
declare const firstOfType: Modifier;
|
|
3332
|
+
declare const lastOfType: Modifier;
|
|
3333
|
+
declare const onlyChild: Modifier;
|
|
3334
|
+
declare const onlyOfType: Modifier;
|
|
3335
|
+
declare const target: Modifier;
|
|
3336
|
+
declare const open_: Modifier;
|
|
3337
|
+
declare function has_(selector: string): Modifier;
|
|
3338
|
+
|
|
3339
|
+
/**
|
|
3340
|
+
* Applies styles at the **small** breakpoint and above (`min-width: 640px`).
|
|
3341
|
+
*
|
|
3342
|
+
* Use with {@link when} to make style rules responsive. Wraps the rule in a
|
|
3343
|
+
* `@media (min-width: 640px)` query.
|
|
3344
|
+
*
|
|
3345
|
+
* @param rule - The style rule to apply at `>=640px`.
|
|
3346
|
+
* @returns A new {@link StyleRule} wrapped in the small-breakpoint media query.
|
|
3347
|
+
*
|
|
3348
|
+
* @example
|
|
3349
|
+
* ```ts
|
|
3350
|
+
* import { cx, p, when, sm } from 'typewritingclass'
|
|
3351
|
+
*
|
|
3352
|
+
* cx(p('1rem'), when(sm)(p('2rem')))
|
|
3353
|
+
* // CSS: .abc { padding: 1rem; }
|
|
3354
|
+
* // @media (min-width: 640px) { .def { padding: 2rem; } }
|
|
3355
|
+
* ```
|
|
3356
|
+
*/
|
|
3357
|
+
declare const sm: Modifier;
|
|
3358
|
+
/**
|
|
3359
|
+
* Applies styles at the **medium** breakpoint and above (`min-width: 768px`).
|
|
3360
|
+
*
|
|
3361
|
+
* Use with {@link when} to make style rules responsive. Wraps the rule in a
|
|
3362
|
+
* `@media (min-width: 768px)` query.
|
|
3363
|
+
*
|
|
3364
|
+
* @param rule - The style rule to apply at `>=768px`.
|
|
3365
|
+
* @returns A new {@link StyleRule} wrapped in the medium-breakpoint media query.
|
|
3366
|
+
*
|
|
3367
|
+
* @example
|
|
3368
|
+
* ```ts
|
|
3369
|
+
* import { cx, grid, gridCols, when, md } from 'typewritingclass'
|
|
3370
|
+
*
|
|
3371
|
+
* cx(gridCols('1'), when(md)(gridCols('2')))
|
|
3372
|
+
* // CSS: .abc { grid-template-columns: 1; }
|
|
3373
|
+
* // @media (min-width: 768px) { .def { grid-template-columns: 2; } }
|
|
3374
|
+
* ```
|
|
3375
|
+
*/
|
|
3376
|
+
declare const md: Modifier;
|
|
3377
|
+
/**
|
|
3378
|
+
* Applies styles at the **large** breakpoint and above (`min-width: 1024px`).
|
|
3379
|
+
*
|
|
3380
|
+
* Use with {@link when} to make style rules responsive. Wraps the rule in a
|
|
3381
|
+
* `@media (min-width: 1024px)` query.
|
|
3382
|
+
*
|
|
3383
|
+
* @param rule - The style rule to apply at `>=1024px`.
|
|
3384
|
+
* @returns A new {@link StyleRule} wrapped in the large-breakpoint media query.
|
|
3385
|
+
*
|
|
3386
|
+
* @example
|
|
3387
|
+
* ```ts
|
|
3388
|
+
* import { cx, maxW, when, lg } from 'typewritingclass'
|
|
3389
|
+
*
|
|
3390
|
+
* cx(maxW('100%'), when(lg)(maxW('1024px')))
|
|
3391
|
+
* // CSS: .abc { max-width: 100%; }
|
|
3392
|
+
* // @media (min-width: 1024px) { .def { max-width: 1024px; } }
|
|
3393
|
+
* ```
|
|
3394
|
+
*/
|
|
3395
|
+
declare const lg: Modifier;
|
|
3396
|
+
/**
|
|
3397
|
+
* Applies styles at the **extra-large** breakpoint and above (`min-width: 1280px`).
|
|
3398
|
+
*
|
|
3399
|
+
* Use with {@link when} to make style rules responsive. Wraps the rule in a
|
|
3400
|
+
* `@media (min-width: 1280px)` query.
|
|
3401
|
+
*
|
|
3402
|
+
* @param rule - The style rule to apply at `>=1280px`.
|
|
3403
|
+
* @returns A new {@link StyleRule} wrapped in the extra-large-breakpoint media query.
|
|
3404
|
+
*
|
|
3405
|
+
* @example
|
|
3406
|
+
* ```ts
|
|
3407
|
+
* import { cx, maxW, when, xl } from 'typewritingclass'
|
|
3408
|
+
*
|
|
3409
|
+
* cx(maxW('100%'), when(xl)(maxW('1280px')))
|
|
3410
|
+
* // CSS: .abc { max-width: 100%; }
|
|
3411
|
+
* // @media (min-width: 1280px) { .def { max-width: 1280px; } }
|
|
3412
|
+
* ```
|
|
3413
|
+
*/
|
|
3414
|
+
declare const xl: Modifier;
|
|
3415
|
+
/**
|
|
3416
|
+
* Applies styles at the **2x-large** breakpoint and above (`min-width: 1536px`).
|
|
3417
|
+
*
|
|
3418
|
+
* Use with {@link when} to make style rules responsive. Wraps the rule in a
|
|
3419
|
+
* `@media (min-width: 1536px)` query.
|
|
3420
|
+
*
|
|
3421
|
+
* Exported as `_2xl` because identifiers cannot start with a digit in JavaScript.
|
|
3422
|
+
*
|
|
3423
|
+
* @param rule - The style rule to apply at `>=1536px`.
|
|
3424
|
+
* @returns A new {@link StyleRule} wrapped in the 2xl-breakpoint media query.
|
|
3425
|
+
*
|
|
3426
|
+
* @example
|
|
3427
|
+
* ```ts
|
|
3428
|
+
* import { cx, maxW, when, _2xl } from 'typewritingclass'
|
|
3429
|
+
*
|
|
3430
|
+
* cx(maxW('100%'), when(_2xl)(maxW('1536px')))
|
|
3431
|
+
* // CSS: .abc { max-width: 100%; }
|
|
3432
|
+
* // @media (min-width: 1536px) { .def { max-width: 1536px; } }
|
|
3433
|
+
* ```
|
|
3434
|
+
*/
|
|
3435
|
+
declare const _2xl: Modifier;
|
|
3436
|
+
declare const maxSm: Modifier;
|
|
3437
|
+
declare const maxMd: Modifier;
|
|
3438
|
+
declare const maxLg: Modifier;
|
|
3439
|
+
declare const maxXl: Modifier;
|
|
3440
|
+
declare const max2xl: Modifier;
|
|
3441
|
+
|
|
3442
|
+
/**
|
|
3443
|
+
* Applies styles only when the user's operating system or browser is set to a dark color scheme.
|
|
3444
|
+
*
|
|
3445
|
+
* Use with {@link when} to conditionally apply style rules inside a
|
|
3446
|
+
* `@media (prefers-color-scheme: dark)` query. This responds to the user's
|
|
3447
|
+
* system-level preference, not a manual theme toggle. For manual theme switching,
|
|
3448
|
+
* see {@link setTheme} and the theme API.
|
|
3449
|
+
*
|
|
3450
|
+
* @param rule - The style rule to apply in dark mode.
|
|
3451
|
+
* @returns A new {@link StyleRule} wrapped in the `prefers-color-scheme: dark` media query.
|
|
3452
|
+
*
|
|
3453
|
+
* @example
|
|
3454
|
+
* ```ts
|
|
3455
|
+
* import { cx, bg, color, when, dark } from 'typewritingclass'
|
|
3456
|
+
*
|
|
3457
|
+
* cx(
|
|
3458
|
+
* bg('#ffffff'),
|
|
3459
|
+
* color('#111827'),
|
|
3460
|
+
* when(dark)(bg('#111827')),
|
|
3461
|
+
* when(dark)(color('#f9fafb')),
|
|
3462
|
+
* )
|
|
3463
|
+
* // CSS: .abc { background-color: #ffffff; }
|
|
3464
|
+
* // .def { color: #111827; }
|
|
3465
|
+
* // @media (prefers-color-scheme: dark) { .ghi { background-color: #111827; } }
|
|
3466
|
+
* // @media (prefers-color-scheme: dark) { .jkl { color: #f9fafb; } }
|
|
3467
|
+
* ```
|
|
3468
|
+
*/
|
|
3469
|
+
declare const dark: Modifier;
|
|
3470
|
+
|
|
3471
|
+
declare const motionReduce: Modifier;
|
|
3472
|
+
declare const motionSafe: Modifier;
|
|
3473
|
+
declare const print_: Modifier;
|
|
3474
|
+
declare const portrait: Modifier;
|
|
3475
|
+
declare const landscape: Modifier;
|
|
3476
|
+
declare const contrastMore: Modifier;
|
|
3477
|
+
declare const contrastLess: Modifier;
|
|
3478
|
+
declare const forcedColors: Modifier;
|
|
3479
|
+
|
|
3480
|
+
declare const before: Modifier;
|
|
3481
|
+
declare const after: Modifier;
|
|
3482
|
+
declare const placeholder_: Modifier;
|
|
3483
|
+
declare const file_: Modifier;
|
|
3484
|
+
declare const marker: Modifier;
|
|
3485
|
+
declare const selection_: Modifier;
|
|
3486
|
+
declare const firstLine: Modifier;
|
|
3487
|
+
declare const firstLetter: Modifier;
|
|
3488
|
+
declare const backdrop_: Modifier;
|
|
3489
|
+
|
|
3490
|
+
declare const ariaChecked: Modifier;
|
|
3491
|
+
declare const ariaDisabled: Modifier;
|
|
3492
|
+
declare const ariaExpanded: Modifier;
|
|
3493
|
+
declare const ariaHidden: Modifier;
|
|
3494
|
+
declare const ariaPressed: Modifier;
|
|
3495
|
+
declare const ariaReadonly: Modifier;
|
|
3496
|
+
declare const ariaRequired: Modifier;
|
|
3497
|
+
declare const ariaSelected: Modifier;
|
|
3498
|
+
declare function aria(attr: string): Modifier;
|
|
3499
|
+
|
|
3500
|
+
declare function data(attr: string): Modifier;
|
|
3501
|
+
|
|
3502
|
+
declare function supports(query: string): Modifier;
|
|
3503
|
+
|
|
3504
|
+
declare const groupHover: Modifier;
|
|
3505
|
+
declare const groupFocus: Modifier;
|
|
3506
|
+
declare const groupActive: Modifier;
|
|
3507
|
+
declare const groupFocusVisible: Modifier;
|
|
3508
|
+
declare const groupFocusWithin: Modifier;
|
|
3509
|
+
declare const groupDisabled: Modifier;
|
|
3510
|
+
declare const groupChecked: Modifier;
|
|
3511
|
+
declare const groupEmpty: Modifier;
|
|
3512
|
+
declare const groupFirst: Modifier;
|
|
3513
|
+
declare const groupLast: Modifier;
|
|
3514
|
+
declare const groupOdd: Modifier;
|
|
3515
|
+
declare const groupEven: Modifier;
|
|
3516
|
+
declare const groupOpen: Modifier;
|
|
3517
|
+
declare const groupVisited: Modifier;
|
|
3518
|
+
declare function groupHas(selector: string): Modifier;
|
|
3519
|
+
|
|
3520
|
+
declare const peerHover: Modifier;
|
|
3521
|
+
declare const peerFocus: Modifier;
|
|
3522
|
+
declare const peerActive: Modifier;
|
|
3523
|
+
declare const peerFocusVisible: Modifier;
|
|
3524
|
+
declare const peerDisabled: Modifier;
|
|
3525
|
+
declare const peerChecked: Modifier;
|
|
3526
|
+
declare const peerInvalid: Modifier;
|
|
3527
|
+
declare const peerRequired: Modifier;
|
|
3528
|
+
declare const peerPlaceholderShown: Modifier;
|
|
3529
|
+
declare const peerFocusWithin: Modifier;
|
|
3530
|
+
declare const peerEmpty: Modifier;
|
|
3531
|
+
declare const peerFirst: Modifier;
|
|
3532
|
+
declare const peerLast: Modifier;
|
|
3533
|
+
declare const peerOdd: Modifier;
|
|
3534
|
+
declare const peerEven: Modifier;
|
|
3535
|
+
declare const peerOpen: Modifier;
|
|
3536
|
+
declare const peerVisited: Modifier;
|
|
3537
|
+
declare function peerHas(selector: string): Modifier;
|
|
3538
|
+
|
|
3539
|
+
declare const rtl: Modifier;
|
|
3540
|
+
declare const ltr: Modifier;
|
|
3541
|
+
|
|
3542
|
+
export { DynamicResult, DynamicValue, Modifier, StyleRule, type TwChain, _2xl, absolute, accentColor, active, after, alignContent, animate, antialiased, appearance, aria, ariaChecked, ariaDisabled, ariaExpanded, ariaHidden, ariaPressed, ariaReadonly, ariaRequired, ariaSelected, aspectRatio, autoCols, autoRows, autofill, backdrop, backdropBlur, backdropBrightness, backdropContrast, backdropGrayscale, backdropHueRotate, backdropInvert, backdropOpacity, backdropSaturate, backdropSepia, backdrop_, before, bg, bgAttachment, bgBlendMode, bgClip, bgGradient, bgImage, bgOrigin, bgPosition, bgRepeat, bgSize, blur, border, borderB, borderCollapse, borderColor, borderE, borderL, borderR, borderS, borderSeparate, borderSpacing, borderSpacingX, borderSpacingY, borderStyle, borderT, borderX, borderY, bottom, boxDecorationBreak, boxSizing, breakAfter, breakBefore, breakInside, brightness, captionSide, caretColor, checked, clear_, colEnd, colSpan, colStart, collapse_, columns, container, content_, contrast, contrastLess, contrastMore, css, cursor, cx, dark, data, dcx, default_, delay, diagonalFractions, disabled, display, divideColor, divideStyle, divideX, divideXReverse, divideY, divideYReverse, dropShadow, duration, ease, empty, end, even, file_, fill, firstChild, firstLetter, firstLine, firstOfType, fixed, flex, flex1, flexAuto, flexBasis, flexCol, flexColReverse, flexInitial, flexNone, flexNowrap, flexRow, flexRowReverse, flexWrap, flexWrapReverse, float_, focus, focusVisible, focusWithin, font, fontFamily, forcedColorAdjust, forcedColors, gap, gapX, gapY, generateCSS, googleFonts, gradientFrom, gradientTo, gradientVia, grayscale, grid, gridCols, gridFlow, gridRows, groupActive, groupChecked, groupDisabled, groupEmpty, groupEven, groupFirst, groupFocus, groupFocusVisible, groupFocusWithin, groupHas, groupHover, groupLast, groupOdd, groupOpen, groupVisited, grow, h, has_, hover, hueRotate, hyphens, inRange, indeterminate, inlineFlex, inset, insetX, insetY, invalid, invert, invisible, isolate, isolationAuto, italic, items, justify, justifyItems, justifySelf, landscape, lastChild, lastOfType, layer, leading, left, lg, lineClamp, liningNums, listStyleImage, listStylePosition, listStyleType, ltr, m, marker, max2xl, maxH, maxLg, maxMd, maxSm, maxW, maxXl, mb, md, me, minH, minW, mixBlendMode, ml, motionReduce, motionSafe, mr, ms, mt, mx, my, normalNums, notItalic, notSrOnly, objectFit, objectPosition, odd, oldstyleNums, onlyChild, onlyOfType, opacity, open_, order, ordinal, outOfRange, outline, outlineColor, outlineNone, outlineOffset, outlineStyle, outlineWidth, overflow, overflowX, overflowY, overscrollBehavior, overscrollX, overscrollY, p, pb, pe, peerActive, peerChecked, peerDisabled, peerEmpty, peerEven, peerFirst, peerFocus, peerFocusVisible, peerFocusWithin, peerHas, peerHover, peerInvalid, peerLast, peerOdd, peerOpen, peerPlaceholderShown, peerRequired, peerVisited, pl, placeContent, placeItems, placeSelf, placeholderShown, placeholder_, pointerEvents, portrait, pr, print_, proportionalNums, ps, pt, px, py, readOnly, relative, required_, resize, right, ring, ringColor, ringInset, ringOffsetColor, ringOffsetWidth, rotate, rounded, roundedB, roundedBL, roundedBR, roundedEE, roundedES, roundedL, roundedR, roundedSE, roundedSS, roundedT, roundedTL, roundedTR, rowEnd, rowSpan, rowStart, rtl, saturate, scale, scaleX, scaleY, scrollBehavior, scrollMargin, scrollMarginB, scrollMarginL, scrollMarginR, scrollMarginT, scrollMarginX, scrollMarginY, scrollPadding, scrollPaddingB, scrollPaddingL, scrollPaddingR, scrollPaddingT, scrollPaddingX, scrollPaddingY, select, selection_, self, sepia, shadow, shadowColor, shrink, size, skewX, skewY, slashedZero, sm, snapAlign, snapStop, snapType, spaceX, spaceXReverse, spaceY, spaceYReverse, srOnly, stackedFractions, start, static_, sticky, stroke, strokeWidth, subpixelAntialiased, supports, tableLayout, tabularNums, target, text, textAlign, textColor, textDecoration, textDecorationColor, textDecorationStyle, textDecorationThickness, textIndent, textOverflow, textTransform, textUnderlineOffset, textWrap, top, touchAction, tracking, transformGpu, transformNone, transformOrigin, transition, transitionAll, transitionColors, transitionNone, transitionOpacity, transitionShadow, transitionTransform, translateX, translateY, truncate, tw, valid, verticalAlign, visible, visited, w, when, whitespace, willChange, wordBreak, xl, z };
|