@tenphi/tasty 0.6.0 → 0.7.0
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/README.md +76 -15
- package/dist/config.d.ts +8 -0
- package/dist/config.js.map +1 -1
- package/dist/hooks/useStyles.js +5 -5
- package/dist/hooks/useStyles.js.map +1 -1
- package/dist/injector/injector.js +38 -25
- package/dist/injector/injector.js.map +1 -1
- package/dist/injector/sheet-manager.d.ts +12 -4
- package/dist/injector/sheet-manager.js +23 -9
- package/dist/injector/sheet-manager.js.map +1 -1
- package/dist/injector/types.d.ts +9 -0
- package/dist/properties/index.js +77 -17
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/property-type-resolver.d.ts +24 -0
- package/dist/properties/property-type-resolver.js +83 -0
- package/dist/properties/property-type-resolver.js.map +1 -0
- package/dist/styles/fill.js +6 -5
- package/dist/styles/fill.js.map +1 -1
- package/dist/utils/styles.js +161 -0
- package/dist/utils/styles.js.map +1 -1
- package/dist/zero/babel.d.ts +5 -0
- package/dist/zero/babel.js +13 -7
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/extractor.js +66 -1
- package/dist/zero/extractor.js.map +1 -1
- package/docs/configuration.md +211 -0
- package/docs/debug.md +505 -0
- package/docs/injector.md +528 -0
- package/docs/styles.md +567 -0
- package/docs/tasty-static.md +376 -0
- package/docs/usage.md +643 -0
- package/package.json +5 -4
package/docs/styles.md
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
# Style Properties Reference
|
|
2
|
+
|
|
3
|
+
All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and custom functions. Values are parsed through the Tasty engine automatically.
|
|
4
|
+
|
|
5
|
+
The properties documented below have **custom handlers** with enhanced syntax. They should be **preferred** over their raw CSS equivalents because they:
|
|
6
|
+
|
|
7
|
+
- Provide concise, declarative syntax for common patterns
|
|
8
|
+
- Simplify overrides when extending components
|
|
9
|
+
- Keep style definitions predictable and composable
|
|
10
|
+
|
|
11
|
+
Other CSS properties (e.g. `opacity`, `transform`, `cursor`, `position`, `zIndex`) are passed through with standard Tasty value parsing but no special handler logic.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Recommended Props
|
|
16
|
+
|
|
17
|
+
Use these instead of their raw CSS counterparts:
|
|
18
|
+
|
|
19
|
+
| Use | Instead of |
|
|
20
|
+
|-----|------------|
|
|
21
|
+
| `fill` | `backgroundColor`, `background` |
|
|
22
|
+
| `image` | `backgroundImage` |
|
|
23
|
+
| `padding` (with direction modifiers) | `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft` |
|
|
24
|
+
| `margin` (with direction modifiers) | `marginTop`, `marginRight`, `marginBottom`, `marginLeft` |
|
|
25
|
+
| `width` (with `min`/`max` modifiers) | `minWidth`, `maxWidth` |
|
|
26
|
+
| `height` (with `min`/`max` modifiers) | `minHeight`, `maxHeight` |
|
|
27
|
+
| `border` | `borderColor`, `borderWidth`, `borderStyle` |
|
|
28
|
+
| `radius` | `borderRadius` |
|
|
29
|
+
| `flow` | `flexDirection`, `gridAutoFlow` |
|
|
30
|
+
| `preset` | `fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform` |
|
|
31
|
+
| `font` | `fontFamily` |
|
|
32
|
+
| `inset` (with direction modifiers) | `top`, `right`, `bottom`, `left` |
|
|
33
|
+
| `scrollbar` | Raw scrollbar CSS properties |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Layout
|
|
38
|
+
|
|
39
|
+
### `display`
|
|
40
|
+
|
|
41
|
+
Standard CSS display values. Handled together with `hide`, `textOverflow`, `overflow`, and `whiteSpace` for priority resolution.
|
|
42
|
+
|
|
43
|
+
| Prop | Values | Notes |
|
|
44
|
+
|------|--------|-------|
|
|
45
|
+
| `display` | Any CSS display value | Overridden by `hide` or multi-line `textOverflow` |
|
|
46
|
+
| `hide` | `true` / `false` | Shortcut for `display: none`. Highest priority |
|
|
47
|
+
| `overflow` | Any CSS overflow value | Overridden when `textOverflow` sets `hidden` |
|
|
48
|
+
| `whiteSpace` | Any CSS white-space value | Overridden when `textOverflow` sets `nowrap` or `initial` |
|
|
49
|
+
|
|
50
|
+
### `textOverflow`
|
|
51
|
+
|
|
52
|
+
Text truncation with optional multi-line clamping.
|
|
53
|
+
|
|
54
|
+
**Syntax:** `[ellipsis|clip]` or `[ellipsis|clip] / [lines]`
|
|
55
|
+
|
|
56
|
+
| Value | Effect |
|
|
57
|
+
|-------|--------|
|
|
58
|
+
| `"ellipsis"` | Single-line truncation with ellipsis, sets `overflow: hidden` and `white-space: nowrap` |
|
|
59
|
+
| `"ellipsis / 3"` | Multi-line clamp (3 lines) with ellipsis, sets `overflow: hidden` and `white-space: initial` |
|
|
60
|
+
| `"clip"` | Single-line truncation without ellipsis, sets `overflow: hidden` and `white-space: nowrap` |
|
|
61
|
+
| `"clip / 2"` | Multi-line clip (2 lines), sets `overflow: hidden` and `white-space: initial` |
|
|
62
|
+
| `true` or `"initial"` | Reset text-overflow to initial |
|
|
63
|
+
|
|
64
|
+
Explicit `whiteSpace` overrides the default white-space set by `textOverflow`.
|
|
65
|
+
|
|
66
|
+
### `flow`
|
|
67
|
+
|
|
68
|
+
Unified direction control for flex and grid layouts.
|
|
69
|
+
|
|
70
|
+
**Syntax:** `[direction] [wrap|dense]`
|
|
71
|
+
|
|
72
|
+
| Layout | CSS output |
|
|
73
|
+
|--------|------------|
|
|
74
|
+
| Flex | `flex-flow` (direction + wrap) |
|
|
75
|
+
| Grid | `grid-auto-flow` (direction + density) |
|
|
76
|
+
| Block | No CSS output (used by `gap` for direction) |
|
|
77
|
+
|
|
78
|
+
```jsx
|
|
79
|
+
flow="row wrap" // flex: row wrap
|
|
80
|
+
flow="column dense" // grid: column dense
|
|
81
|
+
flow="column" // flex: column; or grid: column
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `gap`
|
|
85
|
+
|
|
86
|
+
Spacing between child elements. Adapts to layout type.
|
|
87
|
+
|
|
88
|
+
**Syntax:** `[row-gap]` or `[row-gap column-gap]`
|
|
89
|
+
|
|
90
|
+
| Value | Effect |
|
|
91
|
+
|-------|--------|
|
|
92
|
+
| `"2x"` | Gap of `2x` |
|
|
93
|
+
| `"1x 2x"` | Row gap `1x`, column gap `2x` |
|
|
94
|
+
| `true` | Default gap (`1x`) |
|
|
95
|
+
| Number | Converted to `px` |
|
|
96
|
+
|
|
97
|
+
For flex/grid layouts, outputs native `gap`. For block layouts, emulates gap using `margin` on children based on `flow` direction.
|
|
98
|
+
|
|
99
|
+
### `padding`
|
|
100
|
+
|
|
101
|
+
Element padding with directional modifiers and multi-group support. Use **comma-separated groups** to set a base value and then override specific directions.
|
|
102
|
+
|
|
103
|
+
**Syntax:** `[value]` | `[top right]` | `[top right bottom left]` | `[value directions...]` — comma-separated for multiple groups
|
|
104
|
+
|
|
105
|
+
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
106
|
+
|
|
107
|
+
| Value | Effect |
|
|
108
|
+
|-------|--------|
|
|
109
|
+
| `"2x"` | All sides `2x` |
|
|
110
|
+
| `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
|
|
111
|
+
| `"2x top"` | Top `2x`, right/bottom/left `0` |
|
|
112
|
+
| `"1x left right"` | Left and right `1x`, top/bottom `0` |
|
|
113
|
+
| `"1x, 2x top"` | All sides `1x`, then top overridden to `2x` |
|
|
114
|
+
| `"1x, 2x top bottom"` | Left/right `1x`, top/bottom `2x` |
|
|
115
|
+
| `true` | All sides `1x` |
|
|
116
|
+
| Number | Converted to `px` |
|
|
117
|
+
|
|
118
|
+
Later comma-separated groups override earlier groups for conflicting directions.
|
|
119
|
+
|
|
120
|
+
Individual props `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`, `paddingBlock`, `paddingInline` are supported but `padding` with modifiers is recommended.
|
|
121
|
+
|
|
122
|
+
**Priority:** `padding` < `paddingBlock`/`paddingInline` < `paddingTop`/`paddingRight`/`paddingBottom`/`paddingLeft`
|
|
123
|
+
|
|
124
|
+
### `margin`
|
|
125
|
+
|
|
126
|
+
Element margin. Same syntax, modifiers, and multi-group support as `padding`.
|
|
127
|
+
|
|
128
|
+
**Syntax:** `[value]` | `[top right]` | `[top right bottom left]` | `[value directions...]` — comma-separated for multiple groups
|
|
129
|
+
|
|
130
|
+
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
131
|
+
|
|
132
|
+
| Value | Effect |
|
|
133
|
+
|-------|--------|
|
|
134
|
+
| `"2x"` | All sides `2x` |
|
|
135
|
+
| `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
|
|
136
|
+
| `"2x top"` | Top `2x`, right/bottom/left `0` |
|
|
137
|
+
| `"auto left right, 1x top bottom"` | Left/right `auto`, top/bottom `1x` |
|
|
138
|
+
| `true` | All sides `1x` |
|
|
139
|
+
| Number | Converted to `px` |
|
|
140
|
+
|
|
141
|
+
Later comma-separated groups override earlier groups for conflicting directions.
|
|
142
|
+
|
|
143
|
+
Individual props `marginTop`, `marginRight`, `marginBottom`, `marginLeft`, `marginBlock`, `marginInline` are supported but `margin` with modifiers is recommended.
|
|
144
|
+
|
|
145
|
+
**Priority:** `margin` < `marginBlock`/`marginInline` < `marginTop`/`marginRight`/`marginBottom`/`marginLeft`
|
|
146
|
+
|
|
147
|
+
### `width`
|
|
148
|
+
|
|
149
|
+
Element width with min/max control.
|
|
150
|
+
|
|
151
|
+
**Syntax:** `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
|
|
152
|
+
|
|
153
|
+
**Modifiers:** `min`, `max`, `fixed`
|
|
154
|
+
|
|
155
|
+
**Keywords:** `stretch`, `max-content`, `min-content`, `fit-content`
|
|
156
|
+
|
|
157
|
+
| Value | Effect |
|
|
158
|
+
|-------|--------|
|
|
159
|
+
| `"10x"` | Width `10x`, min `initial`, max `initial` |
|
|
160
|
+
| `"1x 10x"` | Width `auto`, min `1x`, max `10x` |
|
|
161
|
+
| `"1x 5x 10x"` | Min `1x`, width `5x`, max `10x` |
|
|
162
|
+
| `"min 2x"` | Min-width `2x`, width `auto`, max `initial` |
|
|
163
|
+
| `"max 100%"` | Max-width `100%`, width `auto`, min `initial` |
|
|
164
|
+
| `"fixed 200px"` | Min, width, and max all set to `200px` |
|
|
165
|
+
| `"stretch"` | Fill available space (cross-browser) |
|
|
166
|
+
| `true` | Width `auto`, min `initial`, max `initial` |
|
|
167
|
+
| Number | Converted to `px` |
|
|
168
|
+
|
|
169
|
+
Separate `minWidth` and `maxWidth` props are supported and override values from the `width` syntax.
|
|
170
|
+
|
|
171
|
+
### `height`
|
|
172
|
+
|
|
173
|
+
Element height. Same syntax and modifiers as `width`.
|
|
174
|
+
|
|
175
|
+
**Syntax:** `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
|
|
176
|
+
|
|
177
|
+
**Modifiers:** `min`, `max`, `fixed`
|
|
178
|
+
|
|
179
|
+
**Keywords:** `max-content`, `min-content`, `fit-content`
|
|
180
|
+
|
|
181
|
+
Separate `minHeight` and `maxHeight` props are supported and override values from the `height` syntax.
|
|
182
|
+
|
|
183
|
+
### `inset`
|
|
184
|
+
|
|
185
|
+
Positioning offsets with directional modifiers and multi-group support. Same directional syntax as `padding`.
|
|
186
|
+
|
|
187
|
+
**Syntax:** `[value]` | `[top right]` | `[top right bottom left]` | `[value directions...]` — comma-separated for multiple groups
|
|
188
|
+
|
|
189
|
+
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
190
|
+
|
|
191
|
+
| Value | Effect |
|
|
192
|
+
|-------|--------|
|
|
193
|
+
| `"0"` | All sides `0` |
|
|
194
|
+
| `"2x top"` | Top `2x`, right/bottom/left `auto` |
|
|
195
|
+
| `"1x left right"` | Left and right `1x`, top/bottom `auto` |
|
|
196
|
+
| `"0, 2x top"` | All sides `0`, then top overridden to `2x` |
|
|
197
|
+
| `true` | All sides `0` |
|
|
198
|
+
|
|
199
|
+
Later comma-separated groups override earlier groups for conflicting directions.
|
|
200
|
+
|
|
201
|
+
Individual props `top`, `right`, `bottom`, `left`, `insetBlock`, `insetInline` are supported. When only individual direction props are used (without `inset`), individual CSS properties are output for correct cascade behavior with state overrides.
|
|
202
|
+
|
|
203
|
+
**Priority:** `inset` < `insetBlock`/`insetInline` < `top`/`right`/`bottom`/`left`
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Color & Background
|
|
208
|
+
|
|
209
|
+
### `fill`
|
|
210
|
+
|
|
211
|
+
Background color with design token support. Preferred over `backgroundColor` and `background`.
|
|
212
|
+
|
|
213
|
+
**Syntax:** `[color]` or `[base-color] [overlay-color]`
|
|
214
|
+
|
|
215
|
+
| Value | Effect |
|
|
216
|
+
|-------|--------|
|
|
217
|
+
| `"#purple"` | Token-based background color |
|
|
218
|
+
| `"#purple.10"` | Token color at 10% opacity |
|
|
219
|
+
| `"#surface #primary.10"` | Background `#surface` with `#primary.10` overlay (two colors enable smooth transitions between both) |
|
|
220
|
+
| `"rgb(255 128 0)"` | CSS color value |
|
|
221
|
+
| `true` | Default fill color |
|
|
222
|
+
|
|
223
|
+
When two colors are provided, the first sets the background color and the second is applied as an overlay gradient layer. This enables independent CSS transitions on each color. The overlay is only applied when no explicit `image` or `backgroundImage` is set.
|
|
224
|
+
|
|
225
|
+
**Related deprecated props:** `backgroundColor` (use `fill`), `background` (overrides all background props when set — avoid).
|
|
226
|
+
|
|
227
|
+
### `image`
|
|
228
|
+
|
|
229
|
+
Background image. Preferred over `backgroundImage`.
|
|
230
|
+
|
|
231
|
+
**Syntax:** Any CSS background-image value (parsed for token support).
|
|
232
|
+
|
|
233
|
+
```jsx
|
|
234
|
+
image="url(/path/to/image.png)"
|
|
235
|
+
image="linear-gradient(to right, #purple, #danger)"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Other background props (`backgroundPosition`, `backgroundSize`, `backgroundRepeat`, `backgroundAttachment`, `backgroundOrigin`, `backgroundClip`) are supported as separate props with standard Tasty value parsing.
|
|
239
|
+
|
|
240
|
+
### `color`
|
|
241
|
+
|
|
242
|
+
Text color with design token support.
|
|
243
|
+
|
|
244
|
+
**Syntax:** Color token, CSS color, `true`, or fallback syntax
|
|
245
|
+
|
|
246
|
+
| Value | Effect |
|
|
247
|
+
|-------|--------|
|
|
248
|
+
| `"#purple"` | Token-based text color |
|
|
249
|
+
| `"#purple.5"` | Token at 50% opacity |
|
|
250
|
+
| `"#current"` | Current inherited color |
|
|
251
|
+
| `"#current.5"` | Current inherited color at 50% opacity |
|
|
252
|
+
| `"(#primary, #secondary)"` | Fallback: use `#primary`, fall back to `#secondary` |
|
|
253
|
+
| `true` | `currentColor` |
|
|
254
|
+
|
|
255
|
+
When set to a named color token, also sets `$current-color` and `$current-color-rgb` custom properties for downstream use.
|
|
256
|
+
|
|
257
|
+
### `svgFill`
|
|
258
|
+
|
|
259
|
+
SVG fill color. Same color token syntax as `fill` and `color`. Outputs the native CSS `fill` property.
|
|
260
|
+
|
|
261
|
+
```jsx
|
|
262
|
+
svgFill="#purple.10"
|
|
263
|
+
svgFill="currentColor"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Border & Outline
|
|
269
|
+
|
|
270
|
+
### `border`
|
|
271
|
+
|
|
272
|
+
Border shorthand with directional and multi-group support. Use **comma-separated groups** to set different values per direction — this is the recommended approach for directional borders.
|
|
273
|
+
|
|
274
|
+
**Syntax:** `[width] [style] [color] [directions...]` — comma-separated for multiple groups
|
|
275
|
+
|
|
276
|
+
**Defaults:** width = `1bw`, style = `solid`, color = `#border`
|
|
277
|
+
|
|
278
|
+
**Styles:** `none`, `hidden`, `dotted`, `dashed`, `solid`, `double`, `groove`, `ridge`, `inset`, `outset`
|
|
279
|
+
|
|
280
|
+
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
281
|
+
|
|
282
|
+
| Value | Effect |
|
|
283
|
+
|-------|--------|
|
|
284
|
+
| `true` | Default border (`1bw solid #border`) on all sides |
|
|
285
|
+
| `"2bw dashed #purple"` | All sides: 2bw dashed purple |
|
|
286
|
+
| `"2bw top"` | Top only: 2bw solid `#border`, others: 0 |
|
|
287
|
+
| `"dotted #danger left right"` | Left/right: 1bw dotted `#danger`, others: 0 |
|
|
288
|
+
| `"1bw #red, 2bw #blue top"` | All sides: 1bw solid `#red`, top overridden to 2bw solid `#blue` |
|
|
289
|
+
| `"1bw, dashed top bottom, #purple left right"` | Base: 1bw solid `#border`, top/bottom: 1bw dashed `#border`, left/right: 1bw solid `#purple` |
|
|
290
|
+
|
|
291
|
+
Later comma-separated groups override earlier groups for conflicting directions.
|
|
292
|
+
|
|
293
|
+
### `radius`
|
|
294
|
+
|
|
295
|
+
Border radius with shape presets and directional modifiers.
|
|
296
|
+
|
|
297
|
+
**Syntax:** `[value] [modifiers...]` | `[shape]` | `true`
|
|
298
|
+
|
|
299
|
+
**Shapes:**
|
|
300
|
+
|
|
301
|
+
| Shape | Effect |
|
|
302
|
+
|-------|--------|
|
|
303
|
+
| `"round"` | Fully rounded (`9999rem`) |
|
|
304
|
+
| `"ellipse"` | Circular (`50%`) |
|
|
305
|
+
| `"leaf"` | Asymmetric: sharp, round, sharp, round |
|
|
306
|
+
| `"backleaf"` | Asymmetric: round, sharp, round, sharp |
|
|
307
|
+
|
|
308
|
+
**Direction modifiers:** `top`, `right`, `bottom`, `left` — rounds only the specified corners.
|
|
309
|
+
|
|
310
|
+
| Value | Effect |
|
|
311
|
+
|-------|--------|
|
|
312
|
+
| `"2r"` | All corners `2r` |
|
|
313
|
+
| `true` | All corners `1r` |
|
|
314
|
+
| `"round"` | All corners `9999rem` (pill shape) |
|
|
315
|
+
| `"1r top"` | Top-left and top-right `1r`, bottom-left and bottom-right `0` |
|
|
316
|
+
| `"leaf"` | Alternating sharp/round corners (top-left `0`, top-right `1r`, bottom-right `0`, bottom-left `1r`) |
|
|
317
|
+
| `"backleaf"` | Inverse leaf (top-left `1r`, top-right `0`, bottom-right `1r`, bottom-left `0`) |
|
|
318
|
+
|
|
319
|
+
### `outline`
|
|
320
|
+
|
|
321
|
+
Outline with inline offset support.
|
|
322
|
+
|
|
323
|
+
**Syntax:** `[width] [style] [color] / [offset]`
|
|
324
|
+
|
|
325
|
+
**Defaults:** width = `1ow`, style = `solid`, color = `#outline`
|
|
326
|
+
|
|
327
|
+
**Styles:** Same as `border` (`none`, `dotted`, `dashed`, `solid`, etc.)
|
|
328
|
+
|
|
329
|
+
| Value | Effect |
|
|
330
|
+
|-------|--------|
|
|
331
|
+
| `true` | Default outline (`1ow solid #outline`) |
|
|
332
|
+
| `"2ow dashed #purple"` | 2ow dashed `#purple` outline |
|
|
333
|
+
| `"2ow #danger / 1x"` | 2ow solid `#danger` outline with 1x offset |
|
|
334
|
+
| `"2ow / 1x"` | 2ow solid `#outline` with 1x offset |
|
|
335
|
+
| `0` | No outline |
|
|
336
|
+
|
|
337
|
+
The `/` separator separates outline from offset. A separate `outlineOffset` prop is also supported but the slash syntax takes precedence.
|
|
338
|
+
|
|
339
|
+
### `shadow`
|
|
340
|
+
|
|
341
|
+
Box shadow. Supports multiple shadows comma-separated.
|
|
342
|
+
|
|
343
|
+
**Syntax:** `[inset] [x] [y] [blur] [spread] [color]`
|
|
344
|
+
|
|
345
|
+
| Value | Effect |
|
|
346
|
+
|-------|--------|
|
|
347
|
+
| `true` | Default shadow (from `$shadow` token) |
|
|
348
|
+
| `"1x .5x .5x #dark.50"` | Custom shadow with Tasty units/colors |
|
|
349
|
+
| `"0 1x 2x #dark.20"` | Standard shadow |
|
|
350
|
+
| `"inset 0 1x 2x #dark.10"` | Inset shadow |
|
|
351
|
+
|
|
352
|
+
Multiple shadows: `shadow="1x 1x 2x #dark.20, inset 0 0 4x #dark.10"`
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Typography
|
|
357
|
+
|
|
358
|
+
### `preset`
|
|
359
|
+
|
|
360
|
+
Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style, and text-transform from named design tokens.
|
|
361
|
+
|
|
362
|
+
**Syntax:** `[name] [modifiers...]`
|
|
363
|
+
|
|
364
|
+
Preset names are project-specific (e.g. `h1`–`h6`, `t1`–`t4`, `p1`–`p4`). Register them for autocomplete by augmenting `TastyPresetNames`.
|
|
365
|
+
|
|
366
|
+
**Modifiers:**
|
|
367
|
+
|
|
368
|
+
| Modifier | Effect |
|
|
369
|
+
|----------|--------|
|
|
370
|
+
| `strong` | Sets `font-weight` to bold (from `$bold-font-weight` token) |
|
|
371
|
+
| `italic` | Sets `font-style: italic` |
|
|
372
|
+
| `icon` | Sets font-size and line-height to icon size |
|
|
373
|
+
| `tight` | Sets line-height equal to font-size |
|
|
374
|
+
|
|
375
|
+
```jsx
|
|
376
|
+
preset="h1" // heading 1
|
|
377
|
+
preset="h2 strong" // bold heading 2
|
|
378
|
+
preset="t3 italic" // italic text 3
|
|
379
|
+
preset="t2 tight" // text 2 with tight line-height
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Individual typography props (`fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform`) can be used alongside `preset` to override specific values, but using `preset` alone is recommended.
|
|
383
|
+
|
|
384
|
+
### `font`
|
|
385
|
+
|
|
386
|
+
Font family with design-system fallback. Preferred over `fontFamily`.
|
|
387
|
+
|
|
388
|
+
| Value | Effect |
|
|
389
|
+
|-------|--------|
|
|
390
|
+
| `"monospace"` | Monospace font stack (from `$monospace-font` token) |
|
|
391
|
+
| `true` | Default system font (from `$font` token) |
|
|
392
|
+
| `"CustomFont"` | Custom font with system font fallback |
|
|
393
|
+
|
|
394
|
+
`fontFamily` is supported as a direct pass-through without fallback logic.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Alignment
|
|
399
|
+
|
|
400
|
+
Use the individual CSS properties (`alignItems`, `alignContent`, `justifyItems`, `justifyContent`, `placeItems`, `placeContent`) for precise control. The shorthands below set both the `-items` and `-content` variants to the same value, which is convenient but less flexible.
|
|
401
|
+
|
|
402
|
+
### `align`
|
|
403
|
+
|
|
404
|
+
Shorthand that sets both `align-items` and `align-content` to the same value.
|
|
405
|
+
|
|
406
|
+
```jsx
|
|
407
|
+
align="center"
|
|
408
|
+
align="flex-start"
|
|
409
|
+
align="space-between"
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### `justify`
|
|
413
|
+
|
|
414
|
+
Shorthand that sets both `justify-items` and `justify-content` to the same value.
|
|
415
|
+
|
|
416
|
+
```jsx
|
|
417
|
+
justify="center"
|
|
418
|
+
justify="space-between"
|
|
419
|
+
justify="flex-end"
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### `place`
|
|
423
|
+
|
|
424
|
+
Shorthand that sets both `place-items` and `place-content` to the same value.
|
|
425
|
+
|
|
426
|
+
```jsx
|
|
427
|
+
place="center"
|
|
428
|
+
place="stretch"
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Individual props `placeContent` and `placeItems` are also available for separate control.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Animation & Transition
|
|
436
|
+
|
|
437
|
+
### `transition`
|
|
438
|
+
|
|
439
|
+
Semantic transition names that expand to groups of CSS properties.
|
|
440
|
+
|
|
441
|
+
**Syntax:** `[name] [timing] [easing] [delay]` or `[name] [easing] [delay]` — comma-separated for multiple transitions.
|
|
442
|
+
|
|
443
|
+
When easing is provided without a duration, the default timing variable is used automatically.
|
|
444
|
+
|
|
445
|
+
**Semantic names:**
|
|
446
|
+
|
|
447
|
+
| Name | CSS properties |
|
|
448
|
+
|------|---------------|
|
|
449
|
+
| `fill` | `background-color`, `background-image`, `--tasty-second-fill-color` |
|
|
450
|
+
| `color` | `color` |
|
|
451
|
+
| `theme` | `color`, `background-color`, `background-image`, `box-shadow`, `border`, `border-radius`, `outline`, `opacity`, `--tasty-second-fill-color` |
|
|
452
|
+
| `border` | `border`, `border-top`, `border-right`, `border-bottom`, `border-left` |
|
|
453
|
+
| `radius` | `border-radius` |
|
|
454
|
+
| `shadow` | `box-shadow` |
|
|
455
|
+
| `outline` | `outline`, `outline-offset` |
|
|
456
|
+
| `preset` | `font-size`, `line-height`, `letter-spacing`, `font-weight`, `font-style` |
|
|
457
|
+
| `text` | `font-weight`, `text-decoration-color` |
|
|
458
|
+
| `fade` | `mask`, `mask-composite` |
|
|
459
|
+
| `opacity` | `opacity` |
|
|
460
|
+
| `translate` | `transform`, `translate` |
|
|
461
|
+
| `rotate` | `transform`, `rotate` |
|
|
462
|
+
| `scale` | `transform`, `scale` |
|
|
463
|
+
| `filter` | `filter`, `backdrop-filter` |
|
|
464
|
+
| `image` / `background` | All background-related properties |
|
|
465
|
+
| `width` | `width`, `min-width`, `max-width` |
|
|
466
|
+
| `height` | `height`, `min-height`, `max-height` |
|
|
467
|
+
| `gap` | `gap`, `margin` |
|
|
468
|
+
| `zIndex` | `z-index` |
|
|
469
|
+
| `inset` | `inset`, `top`, `right`, `bottom`, `left` |
|
|
470
|
+
|
|
471
|
+
Default timing: `$transition` (or `${name}-transition` with `$transition` fallback per semantic name).
|
|
472
|
+
|
|
473
|
+
```jsx
|
|
474
|
+
transition="theme 0.3s"
|
|
475
|
+
transition="fill 0.2s, radius 0.3s"
|
|
476
|
+
transition="fade 0.15s ease-in"
|
|
477
|
+
transition="fill ease-in" // easing without duration (uses default timing)
|
|
478
|
+
transition="radius ease-in-out" // easing keyword only
|
|
479
|
+
transition="$$custom-prop 0.3s" // custom property transition
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
**Recognized easing keywords:** `ease`, `ease-in`, `ease-out`, `ease-in-out`, `linear`, `step-start`, `step-end`. CSS easing functions (`cubic-bezier(...)`, `steps(...)`, `linear(...)`) are also recognized.
|
|
483
|
+
|
|
484
|
+
If the name is not a semantic name, it is used as a literal CSS property name.
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## Scrollbar & Overflow
|
|
489
|
+
|
|
490
|
+
### `scrollbar`
|
|
491
|
+
|
|
492
|
+
Cross-browser scrollbar styling. Sets Firefox (`scrollbar-width`, `scrollbar-color`) and WebKit (`::-webkit-scrollbar` pseudo-elements) properties.
|
|
493
|
+
|
|
494
|
+
**Syntax:** `[modifiers...] [size] [thumb-color] [track-color] [corner-color]`
|
|
495
|
+
|
|
496
|
+
**Modifiers:**
|
|
497
|
+
|
|
498
|
+
| Modifier | Effect |
|
|
499
|
+
|----------|--------|
|
|
500
|
+
| `thin` | Thin scrollbar (`scrollbar-width: thin`) |
|
|
501
|
+
| `none` | Hide scrollbar (still scrollable) |
|
|
502
|
+
| `auto` | Browser-default scrollbar width |
|
|
503
|
+
| `stable` | Reserve space for scrollbar (`scrollbar-gutter: stable`) |
|
|
504
|
+
| `both-edges` | Reserve space on both sides (`scrollbar-gutter: stable both-edges`) |
|
|
505
|
+
| `always` | Force scrollbars visible (`overflow: scroll` + `scrollbar-gutter: stable`) |
|
|
506
|
+
| `styled` | Enhanced appearance with rounded thumb, transitions, and custom sizing |
|
|
507
|
+
|
|
508
|
+
**Colors:** Up to 3 color values for thumb, track, and corner (optional).
|
|
509
|
+
|
|
510
|
+
**Defaults:** size = `8px`, thumb = `$scrollbar-thumb-color`, track = `transparent`, corner = same as track
|
|
511
|
+
|
|
512
|
+
| Value | Effect |
|
|
513
|
+
|-------|--------|
|
|
514
|
+
| `true` | Thin scrollbar with default thumb/track colors |
|
|
515
|
+
| `"none"` | Hidden scrollbar (still scrollable) |
|
|
516
|
+
| `"thin 10px #purple.40 #dark.04"` | Thin, 10px, thumb `#purple.40`, track `#dark.04` |
|
|
517
|
+
| `"styled 12px #purple.40 #dark.04 #white.10"` | Styled, 12px, thumb `#purple.40`, track `#dark.04`, corner `#white.10` |
|
|
518
|
+
| `"always 8px #primary.50 #white.02"` | Always visible, 8px, thumb `#primary.50`, track `#white.02` |
|
|
519
|
+
|
|
520
|
+
### `fade`
|
|
521
|
+
|
|
522
|
+
Gradient-based edge fading using CSS masks. Use **comma-separated groups** to set different widths and colors per direction.
|
|
523
|
+
|
|
524
|
+
**Syntax:** `[width] [directions...] [#from-color] [#to-color]` — comma-separated for multiple groups
|
|
525
|
+
|
|
526
|
+
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
527
|
+
|
|
528
|
+
| Value | Effect |
|
|
529
|
+
|-------|--------|
|
|
530
|
+
| `"top"` | Fade top edge, default width (`2x`), all other edges unfaded |
|
|
531
|
+
| `"2x left right"` | Fade left and right edges with `2x` width, top/bottom unfaded |
|
|
532
|
+
| `"3x 1x top bottom"` | Fade top with `3x` width, bottom with `1x` width |
|
|
533
|
+
| `"2x #transparent #dark"` | All edges faded with `2x` width, from `#transparent` to `#dark` |
|
|
534
|
+
| `"top #a #b, bottom #c #d"` | Top fades from `#a` to `#b`, bottom fades from `#c` to `#d` |
|
|
535
|
+
|
|
536
|
+
Colors are optional: first = transparent mask start, second = opaque mask end.
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## Grid Aliases
|
|
541
|
+
|
|
542
|
+
### `gridColumns`
|
|
543
|
+
|
|
544
|
+
Alias for `grid-template-columns`.
|
|
545
|
+
|
|
546
|
+
| Value | Effect |
|
|
547
|
+
|-------|--------|
|
|
548
|
+
| `"1fr 2fr 1fr"` | Three columns with ratios |
|
|
549
|
+
| `3` (number) | Three equal `minmax(1px, 1fr)` columns |
|
|
550
|
+
| `"repeat(auto-fit, minmax(200px, 1fr))"` | Responsive columns |
|
|
551
|
+
|
|
552
|
+
### `gridRows`
|
|
553
|
+
|
|
554
|
+
Alias for `grid-template-rows`.
|
|
555
|
+
|
|
556
|
+
| Value | Effect |
|
|
557
|
+
|-------|--------|
|
|
558
|
+
| `"auto 1fr auto"` | Header, content, footer |
|
|
559
|
+
| `4` (number) | Four equal `auto` rows |
|
|
560
|
+
|
|
561
|
+
### `gridAreas`
|
|
562
|
+
|
|
563
|
+
Alias for `grid-template-areas`. Pass-through string value.
|
|
564
|
+
|
|
565
|
+
### `gridTemplate`
|
|
566
|
+
|
|
567
|
+
Alias for `grid-template`. Slash-separated rows/columns with number conversion.
|