@tenphi/tasty 0.0.0-snapshot.b49e579 → 0.0.0-snapshot.b4e384c
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 +436 -394
- package/dist/babel-types-Dc5zghyE.d.ts +18 -0
- package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
- package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
- package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
- package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
- package/dist/{collector-D6fpuCdp.js → chunks/collector-Cb8ah2JF.js} +25 -119
- package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
- package/dist/chunks/config-engine-CMYFZYQh.js +272 -0
- package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
- package/dist/chunks/config-file-DlZXJMj8.js +25 -0
- package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
- package/dist/chunks/css-definitions-B4aWBkH3.js +910 -0
- package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
- package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
- package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
- package/dist/chunks/debug-D2Pu7Xhy.js +502 -0
- package/dist/chunks/debug-D2Pu7Xhy.js.map +1 -0
- package/dist/chunks/dsl-CsFl9LGn.js +1458 -0
- package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-DHiopXCu.js +691 -0
- package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
- package/dist/chunks/runtime-engine-NGCofNXy.js +2435 -0
- package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
- package/dist/chunks/runtime-state-lZjMbvwV.js +152 -0
- package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
- package/dist/{merge-styles-biRwSixM.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-DnkV_4Jg.js +5602 -0
- package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
- package/dist/{css-writer-DB4ZVUYy.js → chunks/zero-engine-DcwaCvFs.js} +65 -145
- package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
- package/dist/{collector-D8o4Wdq-.d.ts → collector-D2OT6I2G.d.ts} +23 -4
- package/dist/{config-De8L9NWM.d.ts → config-C4ftFxgI.d.ts} +273 -78
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -6
- package/dist/hydrate-CRyjjAyl.d.ts +22 -0
- package/dist/{index-DzGxoeyN.d.ts → index-DxQNRj50.d.ts} +369 -258
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -867
- package/dist/{merge-styles-DLm4wdnb.d.ts → merge-styles-D39qBtox.d.ts} +2 -3
- package/dist/ssr/astro-client.d.ts +1 -1
- package/dist/ssr/astro-client.js +1 -14
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +3 -2
- package/dist/ssr/astro-middleware-static.js +0 -11
- package/dist/ssr/astro-middleware-static.js.map +1 -1
- package/dist/ssr/astro-middleware.d.ts +3 -2
- package/dist/ssr/astro-middleware.js +0 -12
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +40 -6
- package/dist/ssr/astro.js +157 -93
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +2 -0
- package/dist/ssr/index.d.ts +5 -25
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +123 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +9 -8
- package/dist/ssr/next.js +29 -43
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +8 -9
- package/dist/static/index.js +4 -22
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.d.ts +1 -2
- package/dist/{index-KUYya3x7.d.ts → types-CYQIhUg1.d.ts} +745 -592
- package/dist/zero/babel.d.ts +73 -2
- package/dist/zero/babel.js +81 -144
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +63 -8
- package/dist/zero/index.js +25 -2
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +4 -5
- package/dist/zero/next.js +3 -38
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +16 -8
- package/docs/adoption.md +69 -36
- package/docs/ai-agents.md +122 -86
- package/docs/comparison.md +77 -47
- package/docs/configuration.md +434 -110
- package/docs/debug.md +21 -8
- package/docs/design-system.md +152 -31
- package/docs/dsl.md +503 -222
- package/docs/getting-started.md +130 -50
- package/docs/injector.md +117 -68
- package/docs/methodology.md +81 -50
- package/docs/migration-v3.md +52 -52
- package/docs/pipeline.md +55 -31
- package/docs/plugins.md +59 -75
- package/docs/react-api.md +141 -55
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +285 -101
- package/docs/styles.md +178 -35
- package/docs/tasty-static.md +286 -135
- package/package.json +125 -41
- package/dist/async-storage-DKK-wTD4.js +0 -44
- package/dist/async-storage-DKK-wTD4.js.map +0 -1
- package/dist/babel-R2qT7yLN.d.ts +0 -83
- package/dist/collector-D6fpuCdp.js.map +0 -1
- package/dist/config-Bxme0Moq.js +0 -12442
- package/dist/config-Bxme0Moq.js.map +0 -1
- package/dist/context-CA8YKeMn.js +0 -24
- package/dist/context-CA8YKeMn.js.map +0 -1
- package/dist/core-BR4waa0Q.js +0 -1552
- package/dist/core-BR4waa0Q.js.map +0 -1
- package/dist/css-writer-DB4ZVUYy.js.map +0 -1
- package/dist/format-global-rules-DklyaXv-.js +0 -22
- package/dist/format-global-rules-DklyaXv-.js.map +0 -1
- package/dist/format-rules-BXSRL8KZ.js +0 -145
- package/dist/format-rules-BXSRL8KZ.js.map +0 -1
- package/dist/hydrate-D_EWjD6z.js +0 -37
- package/dist/hydrate-D_EWjD6z.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyframes-DrUITLCz.js +0 -424
- package/dist/keyframes-DrUITLCz.js.map +0 -1
- package/dist/merge-styles-biRwSixM.js.map +0 -1
- package/dist/resolve-recipes-CBVdPz67.js +0 -144
- package/dist/resolve-recipes-CBVdPz67.js.map +0 -1
package/docs/styles.md
CHANGED
|
@@ -10,6 +10,8 @@ The properties documented below have **custom handlers** with enhanced syntax. T
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
+
[`@tenphi/eslint-plugin-tasty`](getting-started.md#eslint-plugin) reports raw CSS properties that have a handler here (`prefer-shorthand-property`) and modifiers a property does not accept (`valid-directional-modifier`, `valid-radius-shape`).
|
|
14
|
+
|
|
13
15
|
---
|
|
14
16
|
|
|
15
17
|
## Recommended Props
|
|
@@ -20,9 +22,10 @@ Use these instead of their raw CSS counterparts:
|
|
|
20
22
|
|-----|------------|
|
|
21
23
|
| `fill` | `backgroundColor`, `background` |
|
|
22
24
|
| `image` | `backgroundImage` |
|
|
23
|
-
| `padding` (with direction modifiers) | `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft` |
|
|
24
|
-
| `margin` (with direction modifiers) | `marginTop`, `marginRight`, `marginBottom`, `marginLeft` |
|
|
25
|
-
|
|
|
25
|
+
| `padding` (with physical direction modifiers) | `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft` |
|
|
26
|
+
| `margin` (with physical direction modifiers) | `marginTop`, `marginRight`, `marginBottom`, `marginLeft` |
|
|
27
|
+
| Logical block/inline category styles (with `start`/`end` modifiers) | Native logical axis/edge declarations |
|
|
28
|
+
| `width` / `blockSize` / `inlineSize` (with `min`/`max` modifiers) | Their separate min/max declarations when one state map is sufficient |
|
|
26
29
|
| `height` (with `min`/`max` modifiers) | `minHeight`, `maxHeight` |
|
|
27
30
|
| `border` | `borderColor`, `borderWidth`, `borderStyle` |
|
|
28
31
|
| `radius` | `borderRadius` |
|
|
@@ -36,6 +39,24 @@ Use these instead of their raw CSS counterparts:
|
|
|
36
39
|
|
|
37
40
|
## Layout
|
|
38
41
|
|
|
42
|
+
### `overscrollBehavior`
|
|
43
|
+
|
|
44
|
+
The native `overscrollBehavior` shorthand and its `overscrollBehaviorBlock`,
|
|
45
|
+
`overscrollBehaviorInline`, `overscrollBehaviorX`, and `overscrollBehaviorY`
|
|
46
|
+
longhands support `auto`, `contain`, `none`, and `chain`. The shorthand can set
|
|
47
|
+
separate X and Y values, for example `overscrollBehavior: 'chain contain'`.
|
|
48
|
+
|
|
49
|
+
`chain` allows scroll chaining to another scrollable area while suppressing
|
|
50
|
+
boundary effects such as bounce. It requires browser support; use a feature
|
|
51
|
+
query and a fallback floor when targeting browsers without it:
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
overscrollBehaviorBlock: {
|
|
55
|
+
_: 'auto',
|
|
56
|
+
'@supports(overscroll-behavior-block: chain)': 'chain',
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
39
60
|
### `display`
|
|
40
61
|
|
|
41
62
|
Standard CSS display values. Handled together with `hide`, `textOverflow`, `overflow`, and `whiteSpace` for priority resolution.
|
|
@@ -45,7 +66,7 @@ Standard CSS display values. Handled together with `hide`, `textOverflow`, `over
|
|
|
45
66
|
| `display` | Any CSS display value | Overridden by `hide` or multi-line `textOverflow` |
|
|
46
67
|
| `hide` | `true` / `false` | Shortcut for `display: none`. Highest priority |
|
|
47
68
|
| `overflow` | Any CSS overflow value | Overridden when `textOverflow` sets `hidden` |
|
|
48
|
-
| `whiteSpace` | Any CSS white-space value |
|
|
69
|
+
| `whiteSpace` | Any CSS white-space value | Explicit value wins over the `nowrap` / `initial` that `textOverflow` sets |
|
|
49
70
|
|
|
50
71
|
### `textOverflow`
|
|
51
72
|
|
|
@@ -59,7 +80,7 @@ Text truncation with optional multi-line clamping.
|
|
|
59
80
|
| `"ellipsis / 3"` | Multi-line clamp (3 lines) with ellipsis, sets `overflow: hidden` and `white-space: initial` |
|
|
60
81
|
| `"clip"` | Single-line truncation without ellipsis, sets `overflow: hidden` and `white-space: nowrap` |
|
|
61
82
|
| `"clip / 2"` | Multi-line clip (2 lines), sets `overflow: hidden` and `white-space: initial` |
|
|
62
|
-
| `
|
|
83
|
+
| `"initial"` | Reset text-overflow to initial |
|
|
63
84
|
|
|
64
85
|
Explicit `whiteSpace` overrides the default white-space set by `textOverflow`.
|
|
65
86
|
|
|
@@ -125,9 +146,9 @@ A group that names *no* direction keeps plain CSS shorthand order, which is unam
|
|
|
125
146
|
|
|
126
147
|
Later comma-separated groups override earlier groups for conflicting directions.
|
|
127
148
|
|
|
128
|
-
|
|
149
|
+
A group with directions but no value (`padding: 'top'`) uses `1x`, the same as `padding: true`, so it follows `configure({ units })`.
|
|
129
150
|
|
|
130
|
-
|
|
151
|
+
Individual physical props `paddingTop`, `paddingRight`, `paddingBottom`, and `paddingLeft` are supported, but `padding` with modifiers is recommended. Use `blockPadding` or `inlinePadding` for an enhanced logical-axis shorthand; native declarations such as `paddingInlineStart` remain ordinary CSS properties. See [Logical properties](#logical-properties).
|
|
131
152
|
|
|
132
153
|
### `margin`
|
|
133
154
|
|
|
@@ -153,9 +174,7 @@ The [one-value-per-directional-group rule](#padding) from `padding` applies here
|
|
|
153
174
|
|
|
154
175
|
Later comma-separated groups override earlier groups for conflicting directions.
|
|
155
176
|
|
|
156
|
-
Individual props `marginTop`, `marginRight`, `marginBottom`, `marginLeft
|
|
157
|
-
|
|
158
|
-
**Priority:** `margin` < `marginBlock`/`marginInline` < `marginTop`/`marginRight`/`marginBottom`/`marginLeft`
|
|
177
|
+
Individual physical props `marginTop`, `marginRight`, `marginBottom`, and `marginLeft` are supported, but `margin` with modifiers is recommended. Use `blockMargin` or `inlineMargin` for an enhanced logical-axis shorthand; native declarations such as `marginInlineStart` remain ordinary CSS properties. See [Logical properties](#logical-properties).
|
|
159
178
|
|
|
160
179
|
### `width`
|
|
161
180
|
|
|
@@ -178,12 +197,15 @@ Element width with min/max control. One, two, or three values set `min-width`, `
|
|
|
178
197
|
| `"min 2x"` | `2x` | auto | initial |
|
|
179
198
|
| `"max 100%"` | initial | auto | `100%` |
|
|
180
199
|
| `"fixed 200px"` | `200px` | `200px` | `200px` |
|
|
200
|
+
| `"min"` | `1x` | auto | initial |
|
|
201
|
+
| `"max"` | initial | auto | `100%` |
|
|
202
|
+
| `"fixed"` | `max-content` | `max-content` | `max-content` |
|
|
181
203
|
|
|
182
204
|
**Keywords:** `stretch`, `max-content`, `min-content`, `fit-content`
|
|
183
205
|
|
|
184
206
|
| Value | Effect |
|
|
185
207
|
|-------|--------|
|
|
186
|
-
| `"stretch"` | Fill available space
|
|
208
|
+
| `"stretch"` | Fill the available space, margins included. Emitted with `-webkit-fill-available` and `-moz-available` fallbacks for engines without the standard keyword |
|
|
187
209
|
| `true` | Reset to `auto` / `initial` / `initial` |
|
|
188
210
|
| Number | Converted to `px` |
|
|
189
211
|
|
|
@@ -191,7 +213,7 @@ Separate `minWidth` and `maxWidth` props are supported and override values from
|
|
|
191
213
|
|
|
192
214
|
### `height`
|
|
193
215
|
|
|
194
|
-
Element height. Same syntax, modifiers, and positional patterns as `width`.
|
|
216
|
+
Element height. Same syntax, modifiers, keywords, and positional patterns as `width`, including `stretch`.
|
|
195
217
|
|
|
196
218
|
Separate `minHeight` and `maxHeight` props are supported and override values from the `height` syntax.
|
|
197
219
|
|
|
@@ -234,9 +256,44 @@ second to every side they span.
|
|
|
234
256
|
|
|
235
257
|
Later comma-separated groups override earlier groups for conflicting directions.
|
|
236
258
|
|
|
237
|
-
Individual props `top`, `right`, `bottom`, `left
|
|
259
|
+
Individual physical props `top`, `right`, `bottom`, and `left` are supported. When only those props are used (without `inset`), individual CSS properties are output for correct cascade behavior with state overrides. Use `blockInset` or `inlineInset` for logical axes; native declarations such as `insetInlineStart` remain ordinary CSS properties.
|
|
260
|
+
|
|
261
|
+
### Logical properties
|
|
262
|
+
|
|
263
|
+
Tasty provides one enhanced handler for each logical axis/category pair. Each handler emits native logical CSS instead of converting values to `top`, `right`, `bottom`, `left`, `width`, or `height`. The browser therefore resolves `block`, `inline`, `start`, and `end` from the element's `writingMode` and `direction`.
|
|
264
|
+
|
|
265
|
+
```jsx
|
|
266
|
+
styles: {
|
|
267
|
+
direction: 'rtl',
|
|
268
|
+
inlinePadding: '1x start, 2x end',
|
|
269
|
+
inlineBorder: '1bw solid #accent start',
|
|
270
|
+
blockInset: '0 end',
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
An axis handler accepts one value for both edges or two values in logical **start/end** order. Use `start` and `end` modifiers, with comma-separated groups for different edge values. Unspecified padding, margin, and scroll edges reset to `0`; unspecified inset edges reset to `auto`. The `longhand` modifier emits the two native start/end declarations.
|
|
275
|
+
|
|
276
|
+
| Category | Block axis | Inline axis |
|
|
277
|
+
|----------|------------|-------------|
|
|
278
|
+
| Size | `blockSize` | `inlineSize` |
|
|
279
|
+
| Padding | `blockPadding` | `inlinePadding` |
|
|
280
|
+
| Margin | `blockMargin` | `inlineMargin` |
|
|
281
|
+
| Inset | `blockInset` | `inlineInset` |
|
|
282
|
+
| Scroll margin | `blockScrollMargin` | `inlineScrollMargin` |
|
|
283
|
+
| Scroll padding | `blockScrollPadding` | `inlineScrollPadding` |
|
|
284
|
+
| Border | `blockBorder` | `inlineBorder` |
|
|
285
|
+
|
|
286
|
+
`blockSize` and `inlineSize` use the same enhanced one/two/three-value and `min`/`max`/`fixed` syntax as `width`. Separate `minBlockSize`, `maxBlockSize`, `minInlineSize`, and `maxInlineSize` declarations override constraints produced by that shorthand.
|
|
287
|
+
|
|
288
|
+
`blockBorder` and `inlineBorder` use the same width/style/color parsing and defaults as `border`, including `1bw`, color tokens, and `true`. Logical padding, margin, scroll margin, and scroll padding default to `1x` for `true`; logical inset defaults to `0`.
|
|
289
|
+
|
|
290
|
+
Native logical CSS names—such as `paddingInlineStart`, `borderBlockColor`, and `borderStartStartRadius`—remain available as ordinary CSS properties. They support Tasty tokens and units through the normal value parser, but do not get category defaults or directional shorthand behavior.
|
|
238
291
|
|
|
239
|
-
|
|
292
|
+
The physical `scrollMargin` and `scrollPadding` shorthands support the same values and physical direction modifiers as `padding`. Their logical counterparts stay in separate axis handlers.
|
|
293
|
+
|
|
294
|
+
`writingMode`, `direction`, and `textOrientation` are standard CSS control properties. They use Tasty's normal value parser and need no special handler.
|
|
295
|
+
|
|
296
|
+
Avoid setting physical and logical declarations that resolve to the same edge in one style block. Tasty keeps them separate and lets the native CSS cascade resolve the overlap, whose result also depends on writing mode and direction.
|
|
240
297
|
|
|
241
298
|
---
|
|
242
299
|
|
|
@@ -246,18 +303,65 @@ Individual props `top`, `right`, `bottom`, `left`, `insetBlock`, `insetInline` a
|
|
|
246
303
|
|
|
247
304
|
Background color with design token support. Preferred over `backgroundColor` and `background`.
|
|
248
305
|
|
|
249
|
-
**Syntax:** `[color]`
|
|
306
|
+
**Syntax:** `[color]`
|
|
250
307
|
|
|
251
308
|
| Value | Effect |
|
|
252
309
|
|-------|--------|
|
|
253
310
|
| `"#purple"` | Token-based background color |
|
|
254
311
|
| `"#purple.10"` | Token color at 10% opacity |
|
|
255
|
-
| `"#surface
|
|
312
|
+
| `"#surface+#dark.04"` | `#dark` at 4% opacity over `#surface`, as one color — see [Compound colors](dsl.md#compound-colors) |
|
|
256
313
|
| `"rgb(255 128 0)"` | CSS color value |
|
|
257
314
|
| `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
258
|
-
| `true` | Default fill color |
|
|
259
315
|
|
|
260
|
-
|
|
316
|
+
#### Overlays
|
|
317
|
+
|
|
318
|
+
An overlay over a base color is a [compound color](dsl.md#compound-colors):
|
|
319
|
+
|
|
320
|
+
```jsx
|
|
321
|
+
fill: { '': '#surface', hovered: '#surface+#dark.04', pressed: '#surface+#dark.08' }
|
|
322
|
+
// hovered → background-color: color-mix(in srgb, var(--dark-color) 4%, var(--surface-color));
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
The overlay token has to be opaque, with its opacity in the suffix: a translucent
|
|
326
|
+
token, or one that turns `#clear` in some state, leaves the background
|
|
327
|
+
see-through. Because the result is one `background-color`:
|
|
328
|
+
|
|
329
|
+
- contrast checkers such as axe-core and Lighthouse can read it;
|
|
330
|
+
- it transitions and animates between states like any other color;
|
|
331
|
+
- an `image` on the same element stays the only `background-image` layer.
|
|
332
|
+
|
|
333
|
+
#### Two colors separated by a space (deprecated)
|
|
334
|
+
|
|
335
|
+
`fill: '#surface #dark.04'` paints the first color as `background-color` and the second as a `linear-gradient()` layer over it, through the `--tasty-second-fill-color` custom property. It still works, with a development warning, and is going away in the next major version: contrast checkers can't see through a `background-image`, so axe-core reports every text node over the layer as *incomplete*.
|
|
336
|
+
|
|
337
|
+
Put a `+` where the space is:
|
|
338
|
+
|
|
339
|
+
| Before | After |
|
|
340
|
+
|--------|-------|
|
|
341
|
+
| `'#surface #dark.04'` | `'#surface+#dark.04'` |
|
|
342
|
+
| `'#surface #clear'` | `'#surface'` |
|
|
343
|
+
| `'#surface #accent'` (an opaque overlay) | `'#accent'` |
|
|
344
|
+
| `'#base #overlay'` (a token holding a translucent color) | `'#base+#overlay.$overlay-alpha'`, with `#overlay` opaque and `$overlay-alpha` its opacity as a number |
|
|
345
|
+
|
|
346
|
+
The rewrites are exact when the overlay token is opaque. A state map no longer needs the same two-color shape in every state to transition smoothly: every state is now a plain background color.
|
|
347
|
+
|
|
348
|
+
If an overlay has to stay a translucent token, draw the layer yourself with `fill: '#base', image: 'linear-gradient(#overlay, #overlay)'`. Contrast checkers can't read that either.
|
|
349
|
+
|
|
350
|
+
#### Two colors mixed with a comma (deprecated)
|
|
351
|
+
|
|
352
|
+
`fill: '#dark 4%, #surface'` mixes the two colors in sRGB, as the arguments of `color-mix()`: `color-mix(in srgb, var(--dark-color) 4%, var(--surface-color))`. It still works, with a development warning, and is going away in the next major version. A compound color is the same mix, in every color slot, and `color-mix()` itself covers what a compound can't write. `tasty/prefer-fill-mix` in [`@tenphi/eslint-plugin-tasty`](https://github.com/tenphi/eslint-plugin-tasty) rewrites each mix to the same color.
|
|
353
|
+
|
|
354
|
+
| Before | After |
|
|
355
|
+
|--------|-------|
|
|
356
|
+
| `'#dark 4%, #surface'`, `'#surface, #dark 4%'` | `'#surface+#dark.04'` |
|
|
357
|
+
| `'#accent 10%, #surface+#dark.04'` | `'#surface+#dark.04+#accent.1'` |
|
|
358
|
+
| `'#dark $hover-weight, #surface'` (a percentage) | `'#surface+#dark.$hover-alpha'`, with `$hover-alpha` the opacity as a number — or `'color-mix(in srgb, #dark $hover-weight, #surface)'` |
|
|
359
|
+
| `'#dark, #surface'`, `'rgb(0 0 0) 4%, #surface'`, and any other mix | `'color-mix(in srgb, #dark, #surface)'` — the same parts, in `color-mix()` |
|
|
360
|
+
| `'#dark.04, #surface'` (a translucent part without a percentage) | `'#surface+#dark.04'` |
|
|
361
|
+
|
|
362
|
+
Every rewrite but the last row's is the same color. `'#dark.04, #surface'` mixed a translucent color in by half and came out 52% opaque, so its rewrite paints what it was most likely meant to: `#dark` at 4% over `#surface`.
|
|
363
|
+
|
|
364
|
+
There is no default fill color, so `fill: true` is ignored with a development warning. Use `false` for no fill.
|
|
261
365
|
|
|
262
366
|
**Related deprecated props:** `backgroundColor` (use `fill`), `background` (overrides all background props when set — avoid).
|
|
263
367
|
|
|
@@ -288,9 +392,17 @@ Text color with design token support.
|
|
|
288
392
|
| `"#current.5"` | Current inherited color at 50% opacity |
|
|
289
393
|
| `"(#primary, #secondary)"` | Fallback: use `#primary`, fall back to `#secondary` |
|
|
290
394
|
| `"light-dark(#dark, #light)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
395
|
+
| `"#ddd"` | Hex literal, read as the `#ddd` token with the literal as fallback: `var(--ddd-color, #ddd)`, as in every color style |
|
|
291
396
|
| `true` | `currentColor` |
|
|
292
397
|
|
|
293
|
-
|
|
398
|
+
Also sets `$current-color` to the same color, for anything that needs the
|
|
399
|
+
inherited color as a color rather than as the `currentcolor` keyword. Every color
|
|
400
|
+
publishes it, not just a named token, so a reader below always takes the nearest
|
|
401
|
+
`color` rather than the nearest *token* color. A value that already reads the
|
|
402
|
+
inherited color — `#current` itself, a `#current` fade, a bare `currentColor` —
|
|
403
|
+
is not republished: resolving it a second time one level down would fade it
|
|
404
|
+
twice, and the variable into itself is a self-reference. `#current` does not go
|
|
405
|
+
through it; it is the keyword.
|
|
294
406
|
|
|
295
407
|
### `svgFill`
|
|
296
408
|
|
|
@@ -298,7 +410,7 @@ SVG fill color. Same color token syntax as `fill` and `color`. Outputs the nativ
|
|
|
298
410
|
|
|
299
411
|
```jsx
|
|
300
412
|
svgFill="#purple.10"
|
|
301
|
-
svgFill="
|
|
413
|
+
svgFill="#current"
|
|
302
414
|
```
|
|
303
415
|
|
|
304
416
|
---
|
|
@@ -311,7 +423,7 @@ Border shorthand with directional and multi-group support. Use **comma-separated
|
|
|
311
423
|
|
|
312
424
|
**Syntax:** `[width] [style] [color] [directions...]` — comma-separated for multiple groups
|
|
313
425
|
|
|
314
|
-
**Defaults:** width = `1bw`, style = `solid`, color = `#border`
|
|
426
|
+
**Defaults:** width = `1bw`, style = `solid`, color = `#border`, which is the text color (`currentColor`) until your tokens define `#border`
|
|
315
427
|
|
|
316
428
|
**Styles:** `none`, `hidden`, `dotted`, `dashed`, `solid`, `double`, `groove`, `ridge`, `inset`, `outset`
|
|
317
429
|
|
|
@@ -328,9 +440,12 @@ Border shorthand with directional and multi-group support. Use **comma-separated
|
|
|
328
440
|
| `"1bw longhand"` | All sides: 1bw solid `#border`, output as 4 individual `border-*` properties |
|
|
329
441
|
| `"1bw #red, 2bw #blue top"` | All sides: 1bw solid `#red`, top overridden to 2bw solid `#blue` |
|
|
330
442
|
| `"1bw, dashed top bottom, #purple left right"` | Base: 1bw solid `#border`, top/bottom: 1bw dashed `#border`, left/right: 1bw solid `#purple` |
|
|
443
|
+
| `"1bw CanvasText"` | All sides: 1bw solid in the system color `CanvasText` (see [Color keywords](dsl.md#color-keywords)) |
|
|
331
444
|
|
|
332
445
|
Later comma-separated groups override earlier groups for conflicting directions.
|
|
333
446
|
|
|
447
|
+
A directional group without a width (`'dotted left'`) uses `1bw`, the same as `border: true`, so it follows `configure({ units })`.
|
|
448
|
+
|
|
334
449
|
### `radius`
|
|
335
450
|
|
|
336
451
|
Border radius with shape presets and directional modifiers.
|
|
@@ -370,13 +485,15 @@ Use these when an edge modifier would round one corner too many. Edge and corner
|
|
|
370
485
|
| `"4px top-left"` | Top-left corner `4px`, every other corner `0` |
|
|
371
486
|
| `"top bottom-right"` | Both top corners and bottom-right `1r`, bottom-left `0` |
|
|
372
487
|
|
|
488
|
+
A value-less corner group (`'top-right'`, `'top bottom-right'`) uses `1r`, the same as `radius: true`, so it follows `configure({ units })`.
|
|
489
|
+
|
|
373
490
|
### `outline`
|
|
374
491
|
|
|
375
492
|
Outline with inline offset support.
|
|
376
493
|
|
|
377
494
|
**Syntax:** `[width] [style] [color] / [offset]`
|
|
378
495
|
|
|
379
|
-
**Defaults:** width = `1ow`, style = `solid`, color = `#outline`
|
|
496
|
+
**Defaults:** width = `1ow`, style = `solid`, color = `#outline`, which is the text color (`currentColor`) until your tokens define `#outline`
|
|
380
497
|
|
|
381
498
|
**Styles:** Same as `border` (`none`, `dotted`, `dashed`, `solid`, etc.)
|
|
382
499
|
|
|
@@ -411,7 +528,7 @@ Multiple shadows: `shadow="1x 1x 2x #dark.20, inset 0 0 4x #dark.10"`
|
|
|
411
528
|
|
|
412
529
|
### `preset`
|
|
413
530
|
|
|
414
|
-
Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style,
|
|
531
|
+
Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style, text-transform, and font-family (unless `font` or `fontFamily` is set) from named design tokens. It also sets the `--bold-font-weight` and `--icon-size` variables that `strong` and `icon` read.
|
|
415
532
|
|
|
416
533
|
**Syntax:** `name`, `name / modifier...`, or `modifier...` (shorthand)
|
|
417
534
|
|
|
@@ -423,10 +540,11 @@ Use `/` to separate the preset name from one or more space-separated modifiers.
|
|
|
423
540
|
|
|
424
541
|
| Modifier | Effect |
|
|
425
542
|
|----------|--------|
|
|
426
|
-
| `strong` (or `bold`) | Sets `font-weight` to bold (from `$bold-font-weight` token) |
|
|
543
|
+
| `strong` (or `bold`) | Sets `font-weight` to bold (from `$bold-font-weight` token, `700` until your tokens define it) |
|
|
427
544
|
| `italic` | Sets `font-style: italic` |
|
|
428
545
|
| `icon` | Sets font-size and line-height to icon size |
|
|
429
546
|
| `tight` | Sets line-height equal to font-size |
|
|
547
|
+
| `normal` | Sets `line-height: normal` |
|
|
430
548
|
|
|
431
549
|
```jsx
|
|
432
550
|
preset="h1" // heading 1
|
|
@@ -446,9 +564,9 @@ Font family with design-system fallback. Preferred over `fontFamily`.
|
|
|
446
564
|
|
|
447
565
|
| Value | Effect |
|
|
448
566
|
|-------|--------|
|
|
449
|
-
| `"monospace"` | Monospace
|
|
450
|
-
| `true` | Default
|
|
451
|
-
| `"CustomFont"` | Custom font
|
|
567
|
+
| `"monospace"` | Monospace stack from `$font-mono`, falling back to the built-in `$font-mono-fallback` |
|
|
568
|
+
| `true` | Default sans stack from `$font-sans`, falling back to `$font-sans-fallback` |
|
|
569
|
+
| `"CustomFont"` | Custom font followed by the `$font-sans` stack |
|
|
452
570
|
|
|
453
571
|
`fontFamily` is supported as a direct pass-through without fallback logic.
|
|
454
572
|
|
|
@@ -524,26 +642,51 @@ When easing is provided without a duration, the default timing variable is used
|
|
|
524
642
|
| `width` | `width`, `min-width`, `max-width` |
|
|
525
643
|
| `height` | `height`, `min-height`, `max-height` |
|
|
526
644
|
| `gap` | `gap`, `margin` |
|
|
527
|
-
| `zIndex` | `z-index` |
|
|
645
|
+
| `zIndex` | `z-index` (same as writing `z-index`) |
|
|
528
646
|
| `inset` | `inset`, `top`, `right`, `bottom`, `left` |
|
|
529
647
|
|
|
530
|
-
|
|
648
|
+
Any other name passes through as a CSS property.
|
|
649
|
+
|
|
650
|
+
When two entries cover the same property, an entry that names that one property wins over a group such as `theme`, in either order: `opacity 120ms ease-in-out, theme` keeps the opacity timing. Otherwise the later entry wins, as in CSS.
|
|
651
|
+
|
|
652
|
+
Default timing: `$transition` (or `${name}-transition` with `$transition` fallback per semantic name). `$transition` is `80ms` until your tokens define it. Prefer omitting the duration or using a duration token instead of repeating raw time values across components. Explicit zero can disable motion.
|
|
531
653
|
|
|
532
654
|
```jsx
|
|
533
|
-
transition="theme
|
|
534
|
-
transition="fill
|
|
535
|
-
transition="fade
|
|
655
|
+
transition="theme"
|
|
656
|
+
transition="fill, radius"
|
|
657
|
+
transition="fade $transition ease-in"
|
|
536
658
|
transition="fill ease-in" // easing without duration (uses default timing)
|
|
537
659
|
transition="radius ease-in-out" // easing keyword only
|
|
538
|
-
transition="$$custom-prop
|
|
660
|
+
transition="$$custom-prop" // custom property transition
|
|
661
|
+
transition="none" // no transition at all, e.g. under @media(prefers-reduced-motion: reduce)
|
|
539
662
|
```
|
|
540
663
|
|
|
664
|
+
`none` and the CSS-wide keywords (`inherit`, `initial`, `unset`, `revert`, `revert-layer`) are the whole value, not a name to transition.
|
|
665
|
+
|
|
541
666
|
**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.
|
|
542
667
|
|
|
543
668
|
If the name is not a semantic name, it is used as a literal CSS property name.
|
|
544
669
|
|
|
545
670
|
---
|
|
546
671
|
|
|
672
|
+
### `animation`
|
|
673
|
+
|
|
674
|
+
`animation` is the native CSS shorthand. Tasty parses tokens in its value and
|
|
675
|
+
tracks local `@keyframes` names referenced by it, so it needs no custom style
|
|
676
|
+
handler. Define a complete animation with the shorthand, using a configured
|
|
677
|
+
duration token where appropriate (for example,
|
|
678
|
+
`animation: 'pulse $animation-duration ease-in infinite'`).
|
|
679
|
+
|
|
680
|
+
Use `animationDuration`, `animationTimeline`, `animationRange`, and other CSS
|
|
681
|
+
longhands when changing just one part of an existing animation in a state or
|
|
682
|
+
component extension. Setting `animation` resets omitted parts, including its
|
|
683
|
+
timeline and range. The same principle applies to `transitionDuration` and
|
|
684
|
+
other transition longhands when a base `transition` is already defined.
|
|
685
|
+
`transitionBehavior` remains a separate CSS longhand; Tasty's semantic
|
|
686
|
+
`transition` syntax covers name, timing, easing, and delay.
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
547
690
|
## Scrollbar & Overflow
|
|
548
691
|
|
|
549
692
|
### `scrollbar`
|
|
@@ -597,11 +740,11 @@ plain CSS shorthand order, like `padding`. See the [`padding` rule](#padding).
|
|
|
597
740
|
|
|
598
741
|
| Value | Effect |
|
|
599
742
|
|-------|--------|
|
|
600
|
-
| `"top"` | Fade top edge, default width
|
|
743
|
+
| `"top"` | Fade top edge, default width `2x`, all other edges unfaded |
|
|
601
744
|
| `"2x left right"` | Fade left and right edges with `2x` width, top/bottom unfaded |
|
|
602
745
|
| `"3x 1x"` | All edges faded — top/bottom `3x`, left/right `1x` (CSS shorthand order) |
|
|
603
746
|
| `"3x top, 1x bottom"` | Fade top with `3x` width, bottom with `1x` width |
|
|
604
|
-
| `"2x #
|
|
747
|
+
| `"2x #clear #dark"` | All edges faded with `2x` width, from `#clear` to `#dark` |
|
|
605
748
|
| `"top #a #b, bottom #c #d"` | Top fades from `#a` to `#b`, bottom fades from `#c` to `#d` |
|
|
606
749
|
|
|
607
750
|
Colors are optional: first = transparent mask start, second = opaque mask end.
|