@tenphi/tasty 0.0.0-snapshot.d5c492a → 0.0.0-snapshot.d656d18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +147 -129
  2. package/dist/{babel-BUQGeOXA.d.ts → babel-_RVkw0iE.d.ts} +2 -2
  3. package/dist/chunks/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/{collector-BNQJyxFh.js → chunks/collector-DBGcmUEq.js} +36 -14
  5. package/dist/chunks/collector-DBGcmUEq.js.map +1 -0
  6. package/dist/chunks/css-resources-Cyl_axbI.js +149 -0
  7. package/dist/chunks/css-resources-Cyl_axbI.js.map +1 -0
  8. package/dist/{css-writer-B-SvwNbq.js → chunks/css-writer-PFzrSPeu.js} +3 -3
  9. package/dist/chunks/css-writer-PFzrSPeu.js.map +1 -0
  10. package/dist/chunks/debug-BUwqo6vC.js +582 -0
  11. package/dist/chunks/debug-BUwqo6vC.js.map +1 -0
  12. package/dist/chunks/dsl-CXvoaLnj.js +2097 -0
  13. package/dist/chunks/dsl-CXvoaLnj.js.map +1 -0
  14. package/dist/{hydrate-D38TyhAG.js → chunks/hydrate-6YoHZP6A.js} +3 -3
  15. package/dist/chunks/hydrate-6YoHZP6A.js.map +1 -0
  16. package/dist/chunks/react-runtime-B3CmvDEQ.js +1525 -0
  17. package/dist/chunks/react-runtime-B3CmvDEQ.js.map +1 -0
  18. package/dist/chunks/runtime-engine-Y00VWjrS.js +4719 -0
  19. package/dist/chunks/runtime-engine-Y00VWjrS.js.map +1 -0
  20. package/dist/{merge-styles-CFwtEHzv.js → chunks/shared-utils-OIg0N_dp.js} +42 -3
  21. package/dist/chunks/shared-utils-OIg0N_dp.js.map +1 -0
  22. package/dist/{config-zkrtb424.js → chunks/style-engine-CqSmIlud.js} +2273 -7362
  23. package/dist/chunks/style-engine-CqSmIlud.js.map +1 -0
  24. package/dist/{collector-DUaHCcTS.d.ts → collector-CVdVIy7s.d.ts} +21 -3
  25. package/dist/{config-YsxGv4tq.d.ts → config-BI0y21JV.d.ts} +141 -37
  26. package/dist/core/index.d.ts +5 -5
  27. package/dist/core/index.js +7 -6
  28. package/dist/{index-Cd45t5NM.d.ts → index-BzAC3p06.d.ts} +118 -23
  29. package/dist/{index-DhhUI0yi.d.ts → index-CrT0bsiI.d.ts} +134 -58
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +8 -921
  32. package/dist/{merge-styles-CU7JbEwg.d.ts → merge-styles-BFktNP8J.d.ts} +2 -2
  33. package/dist/ssr/astro-client.js +1 -1
  34. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  35. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  36. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  37. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  38. package/dist/ssr/astro-middleware-extract.js +9 -0
  39. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  40. package/dist/ssr/astro-middleware-static.d.ts +3 -1
  41. package/dist/ssr/astro-middleware.d.ts +3 -1
  42. package/dist/ssr/astro.d.ts +45 -3
  43. package/dist/ssr/astro.js +157 -14
  44. package/dist/ssr/astro.js.map +1 -1
  45. package/dist/ssr/index.d.ts +2 -2
  46. package/dist/ssr/index.js +4 -4
  47. package/dist/ssr/index.js.map +1 -1
  48. package/dist/ssr/next-config.d.ts +66 -0
  49. package/dist/ssr/next-config.js +115 -0
  50. package/dist/ssr/next-config.js.map +1 -0
  51. package/dist/ssr/next.d.ts +9 -2
  52. package/dist/ssr/next.js +26 -10
  53. package/dist/ssr/next.js.map +1 -1
  54. package/dist/static/index.d.ts +2 -2
  55. package/dist/static/index.js +1 -1
  56. package/dist/zero/babel.d.ts +1 -1
  57. package/dist/zero/babel.js +3 -4
  58. package/dist/zero/babel.js.map +1 -1
  59. package/dist/zero/index.d.ts +1 -1
  60. package/dist/zero/index.js +1 -1
  61. package/dist/zero/next.d.ts +1 -1
  62. package/docs/README.md +13 -8
  63. package/docs/adoption.md +56 -31
  64. package/docs/ai-agents.md +85 -79
  65. package/docs/comparison.md +69 -40
  66. package/docs/configuration.md +97 -87
  67. package/docs/debug.md +19 -7
  68. package/docs/design-system.md +41 -22
  69. package/docs/dsl.md +251 -208
  70. package/docs/getting-started.md +60 -39
  71. package/docs/injector.md +63 -26
  72. package/docs/methodology.md +42 -36
  73. package/docs/migration-v3.md +49 -49
  74. package/docs/plugins.md +37 -33
  75. package/docs/react-api.md +65 -44
  76. package/docs/runtime-benchmarks.md +351 -0
  77. package/docs/ssr.md +219 -61
  78. package/docs/styles.md +52 -18
  79. package/docs/tasty-static.md +137 -104
  80. package/package.json +62 -11
  81. package/dist/async-storage-DKK-wTD4.js.map +0 -1
  82. package/dist/collector-BNQJyxFh.js.map +0 -1
  83. package/dist/config-zkrtb424.js.map +0 -1
  84. package/dist/context-CA8YKeMn.js +0 -24
  85. package/dist/context-CA8YKeMn.js.map +0 -1
  86. package/dist/core-Bf48Z1I-.js +0 -1565
  87. package/dist/core-Bf48Z1I-.js.map +0 -1
  88. package/dist/css-writer-B-SvwNbq.js.map +0 -1
  89. package/dist/format-global-rules-DklyaXv-.js +0 -22
  90. package/dist/format-global-rules-DklyaXv-.js.map +0 -1
  91. package/dist/format-rules-Co21uwA3.js +0 -130
  92. package/dist/format-rules-Co21uwA3.js.map +0 -1
  93. package/dist/hydrate-D38TyhAG.js.map +0 -1
  94. package/dist/index.js.map +0 -1
  95. package/dist/keyframes-mDAB6pLf.js +0 -424
  96. package/dist/keyframes-mDAB6pLf.js.map +0 -1
  97. package/dist/merge-styles-CFwtEHzv.js.map +0 -1
  98. package/dist/resolve-recipes-B8pIVinB.js +0 -144
  99. package/dist/resolve-recipes-B8pIVinB.js.map +0 -1
  100. /package/dist/{async-storage-DKK-wTD4.js → chunks/async-storage-DKK-wTD4.js} +0 -0
package/docs/dsl.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Style DSL Reference
2
2
 
3
- This is the Tasty style language reference — the value syntax, state mappings, tokens, units, extending semantics, and special declarations that apply to both runtime `tasty()` and build-time `tastyStatic()`.
3
+ This is the language behind Tasty’s predictable state resolution. Every property can use a state map; later branches declare higher priority, and Tasty compiles them so only one generated selector can match.
4
4
 
5
- For the runtime React API (`tasty()`, hooks, component props), see [React API](react-api.md). For all enhanced style properties, see [Style Properties](styles.md). For global configuration, see [Configuration](configuration.md).
5
+ The same value syntax, state maps, tokens, units, extension semantics, and special declarations apply to React `tasty()`—whether rendered on the client or server—and build-time `tastyStatic()`.
6
+
7
+ For the React API (`tasty()`, style functions, component props), see [React API](react-api.md). For all enhanced style properties, see [Style Properties](styles.md). For global configuration, see [Configuration](configuration.md).
6
8
 
7
9
  ---
8
10
 
@@ -18,17 +20,28 @@ fill: { '': '#white', hovered: '#gray.05', 'theme=danger': '#red' }
18
20
 
19
21
  #### State Key Types
20
22
 
21
- | Syntax | Example | Generated CSS |
22
- |--------|---------|---------------|
23
- | Boolean modifier | `hovered` | `[data-hovered]` |
24
- | Value modifier | `theme=danger` | `[data-theme="danger"]` |
25
- | Pseudo-class | `:hover` | `:hover` |
26
- | Class selector | `.active` | `.active` |
27
- | Attribute selector | `[aria-expanded="true"]` | `[aria-expanded="true"]` |
28
- | Combined (AND) | `hovered & .active` | `[data-hovered].active` |
29
- | Combined (OR) | `hovered \| focused` | `[data-hovered], [data-focused]` |
30
- | Negated (NOT) | `!disabled` | `:not([data-disabled])` |
31
- | Exclusive (XOR) | `hovered ^ focused` | `[data-hovered]:not([data-focused]), :not([data-hovered])[data-focused]` |
23
+ | Syntax | Example | Generated CSS |
24
+ | ------------------ | ------------------------ | ------------------------------------------------------------------------ |
25
+ | Boolean modifier | `hovered` | `[data-hovered]` |
26
+ | Value modifier | `theme=danger` | `[data-theme="danger"]` |
27
+ | Pseudo-class | `:hover` | `:hover` |
28
+ | Class selector | `.active` | `.active` |
29
+ | Attribute selector | `[aria-expanded="true"]` | `[aria-expanded="true"]` |
30
+ | Combined (AND) | `hovered & .active` | `[data-hovered].active` |
31
+ | Combined (OR) | `hovered \| focused` | `[data-hovered], [data-focused]` |
32
+ | Negated (NOT) | `!disabled` | `:not([data-disabled])` |
33
+ | Exclusive (XOR) | `hovered ^ focused` | `[data-hovered]:not([data-focused]), :not([data-hovered])[data-focused]` |
34
+
35
+ #### Automatic Native States
36
+
37
+ `disabled` and `checked` are built-in automatic states. On a Tasty component, they track the corresponding native prop or attribute, so these pairs express the same component state:
38
+
39
+ | Concise Tasty state | Explicit attribute selector |
40
+ | ------------------- | --------------------------- |
41
+ | `disabled` | `[disabled]` |
42
+ | `checked` | `[checked]` |
43
+
44
+ Prefer the concise form when authoring Tasty component styles. Explicit attribute selectors remain valid and can be useful when targeting arbitrary attributes or when CSS-shaped syntax makes an introductory example easier to recognize.
32
45
 
33
46
  Operator precedence (highest to lowest): `!` (NOT) > `^` (XOR) > `|` (OR) > `&` (AND). Use parentheses to override: `hovered & (pressed ^ focused)`.
34
47
 
@@ -53,14 +66,18 @@ color: { '': '#text', hovered: '#accent' }
53
66
  color: { hovered: '#accent', '': '#text' }
54
67
  ```
55
68
 
56
- The bare `''` default still **receives negation** (it is turned off when a higher-priority state matches). For a value that must always apply as a guaranteed floor — even where a query is *unknown* — use the [`_` fallback floor](#_--fallback-floor) instead. The two can coexist: `''` is the negated default, `_` is the always-on floor. If a map contains only `_` and `''` (no other states), the `''` default is redundant — Tasty keeps the `_` value and drops `''` with a `REDUNDANT_DEFAULT_STATE` warning.
69
+ The bare `''` default still **receives negation** (it is turned off when a higher-priority state matches). For a value that must always apply as a guaranteed floor — even where a query is _unknown_ — use the [`_` fallback floor](#_--fallback-floor) instead. The two can coexist: `''` is the negated default, `_` is the always-on floor. If a map contains only `_` and `''` (no other states), the `''` default is redundant — Tasty keeps the `_` value and drops `''` with a `REDUNDANT_DEFAULT_STATE` warning.
57
70
 
58
71
  ### Sub-element
59
72
 
60
73
  Element styled using a capitalized key. Identified by `data-element` attribute:
61
74
 
62
75
  ```jsx
63
- styles: { Title: { preset: 'h3' } }
76
+ styles: {
77
+ Title: {
78
+ preset: 'h3';
79
+ }
80
+ }
64
81
  // Targets: <div data-element="Title">
65
82
  ```
66
83
 
@@ -70,19 +87,19 @@ Control how a sub-element selector attaches to the root selector using the `$` p
70
87
 
71
88
  Examples below assume the sub-element key is **Cell** (i.e. `[data-element="Cell"]` in CSS):
72
89
 
73
- | Pattern | Result | Description |
74
- |---------|--------|-------------|
75
- | *(none)* | `[data-element="Cell"]` | Descendant (default) |
76
- | `>` | `> [data-element="Cell"]` | Direct child |
77
- | `>Body>` | `> [data-element="Body"] > [data-element="Cell"]` | Chained elements |
78
- | `> Cell` | `> [data-element="Cell"]` | Self-name shorthand — when the trailing element name matches the sub-element's own key, it acts as the placeholder (same as `@`); no duplication |
79
- | `h1` | `h1` | Tag selector (no key injection) |
80
- | `h1 >` | `h1 > [data-element="Cell"]` | Key is direct child of tag |
81
- | `h1 *` | `h1 *` | Any descendant of tag |
82
- | `*` | `*` | All descendants |
83
- | `&::before` | `::before` | Root pseudo (no key); `&` is required |
84
- | `@::before` | `[data-element="Cell"]::before` | Pseudo on the sub-element |
85
- | `>@.active` | `> [data-element="Cell"].active` | Class on the sub-element |
90
+ | Pattern | Result | Description |
91
+ | ----------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
92
+ | _(none)_ | `[data-element="Cell"]` | Descendant (default) |
93
+ | `>` | `> [data-element="Cell"]` | Direct child |
94
+ | `>Body>` | `> [data-element="Body"] > [data-element="Cell"]` | Chained elements |
95
+ | `> Cell` | `> [data-element="Cell"]` | Self-name shorthand — when the trailing element name matches the sub-element's own key, it acts as the placeholder (same as `@`); no duplication |
96
+ | `h1` | `h1` | Tag selector (no key injection) |
97
+ | `h1 >` | `h1 > [data-element="Cell"]` | Key is direct child of tag |
98
+ | `h1 *` | `h1 *` | Any descendant of tag |
99
+ | `*` | `*` | All descendants |
100
+ | `&::before` | `::before` | Root pseudo (no key); `&` is required |
101
+ | `@::before` | `[data-element="Cell"]::before` | Pseudo on the sub-element |
102
+ | `>@.active` | `> [data-element="Cell"].active` | Class on the sub-element |
86
103
 
87
104
  Rules for key injection (`[data-element="..."]`):
88
105
 
@@ -111,7 +128,7 @@ const List = tasty({
111
128
  Named color prefixed with `#` that maps to CSS custom properties. Supports opacity with `.N` suffix:
112
129
 
113
130
  ```jsx
114
- fill: '#purple.5' // → oklch(from var(--purple-color) l c h / .5)
131
+ fill: '#purple.5'; // → oklch(from var(--purple-color) l c h / .5)
115
132
  ```
116
133
 
117
134
  ### Modifier
@@ -134,7 +151,7 @@ color: '#purple', // Full opacity
134
151
  color: '#purple.5', // 50% opacity
135
152
  color: '#purple.05', // 5% opacity
136
153
  color: '#purple.$fade', // Opacity from a custom property
137
- fill: '#current', // → var(--current-color)
154
+ fill: '#current', // → currentcolor
138
155
  color: '(#primary, #secondary)', // Fallback syntax
139
156
  ```
140
157
 
@@ -146,7 +163,7 @@ fill: '#purple.5';
146
163
  ```
147
164
 
148
165
  The channels are copied over and the alpha slot is written, which asks nothing of
149
- the color beyond *being* a color. That means the suffix works on every one of
166
+ the color beyond _being_ a color. That means the suffix works on every one of
150
167
  these:
151
168
 
152
169
  - a token holding a `color-mix()`, a `light-dark()`, or a `color()` in a space
@@ -163,31 +180,44 @@ Two properties follow from writing the alpha slot rather than compositing:
163
180
  `/ var(--fade)` unchanged, so it works whether `$fade` holds `.5` or `50%` —
164
181
  which is what `--*-opacity` properties are registered to accept.
165
182
 
166
- ### Why `#current` is a variable
183
+ ### `#current` is the keyword
184
+
185
+ `#current` emits the `currentcolor` keyword, so it resolves against the element
186
+ that reads it. That is what lets it follow a color an ancestor faded — a ramp
187
+ that expresses its disabled state once, in `color`, fades everything painted from
188
+ `#current` below it with no further declarations.
189
+
190
+ The `color` style also publishes `--current-color` beside every color it sets,
191
+ for anything that needs the inherited color _as a color_ rather than as the
192
+ keyword — hand-authored CSS, or a place the keyword will not do. Read it as
193
+ `$current-color`. It is registered with `initial-value: currentcolor`, so where
194
+ nothing published it, it still resolves against each element's own color:
167
195
 
168
- `#current` emits `var(--current-color)`, not the `currentcolor` keyword. The
169
- `color` style publishes `--current-color` alongside every color it sets, and the
170
- property is registered with `initial-value: currentcolor` — so where nothing has
171
- published it, the variable resolves against each element's own inherited color
172
- and is indistinguishable from the keyword.
196
+ ```jsx
197
+ fill: '$current-color'; // → var(--current-color)
198
+ ```
199
+
200
+ A color that already reads the color it inherits — `#current`, a `#current` fade
201
+ — is not published into it: resolving such a value a second time at a descendant
202
+ would fade it twice.
173
203
 
174
- The difference shows when a token is *defined* as `#current` and then faded:
204
+ One case needs the wider floor to be considered. A token _defined_ as `#current`
205
+ and then faded gives relative color syntax a `currentcolor` origin, which Safari
206
+ supports only from 18:
175
207
 
176
208
  ```jsx
177
209
  { '#ink': '#current', fill: '#ink.5' }
178
- // --ink-color: var(--current-color) → a concrete color where one was published
179
- // fill: oklch(from var(--ink-color) l c h / .5)
210
+ // --ink-color: currentcolor
211
+ // fill: oklch(from currentcolor l c h / .5) → Chrome, Firefox, Safari 18+
180
212
  ```
181
213
 
182
- Relative color syntax accepts a concrete origin from Safari 16.4, while
183
- `oklch(from currentcolor …)` needs Safari 18. Resolving through the variable is
184
- what keeps that token fadeable on the wider floor. Where no `color` style
185
- published the variable, the origin is the keyword again and the Safari 18 floor
186
- applies to that case alone.
214
+ Put the fade in the token instead — `{ '#ink': '#current.5' }` — and it goes
215
+ through `color-mix()`, which works from Safari 16.2 and composes like every other
216
+ `#current` fade.
187
217
 
188
218
  ### `#current` composes instead
189
219
 
190
- `#current` is the one exception, and the difference is deliberate. A token *names*
220
+ `#current` is the one exception, and the difference is deliberate. A token _names_
191
221
  a color, so fading it sets its alpha. `currentcolor` is the color an element
192
222
  **inherits**, which an ancestor may already have faded — `#current.4` means "40%
193
223
  of what reaches me":
@@ -253,22 +283,22 @@ configure({
253
283
  },
254
284
  });
255
285
 
256
- fill: '#solid.5'; // → hsl(220 90% 50% / .5)
257
- fill: '#adaptive.5'; // → oklch(from light-dark(…) l c h / .5)
286
+ fill: '#solid.5'; // → hsl(220 90% 50% / .5)
287
+ fill: '#adaptive.5'; // → oklch(from light-dark(…) l c h / .5)
258
288
  ```
259
289
 
260
290
  ---
261
291
 
262
292
  ## Built-in Units
263
293
 
264
- | Unit | Description | Example | CSS Output |
265
- |------|-------------|---------|------------|
266
- | `x` | Gap multiplier | `2x` | `calc(var(--gap) * 2)` |
267
- | `r` | Border radius | `1r` | `var(--radius)` |
268
- | `cr` | Card border radius | `1cr` | `var(--card-radius)` |
269
- | `bw` | Border width | `2bw` | `calc(var(--border-width) * 2)` |
270
- | `ow` | Outline width | `1ow` | `var(--outline-width)` |
271
- | `sf` | Stable fraction | `1sf` | `minmax(0, 1fr)` |
294
+ | Unit | Description | Example | CSS Output |
295
+ | ---- | ------------------ | ------- | ------------------------------- |
296
+ | `x` | Gap multiplier | `2x` | `calc(var(--gap) * 2)` |
297
+ | `r` | Border radius | `1r` | `var(--radius)` |
298
+ | `cr` | Card border radius | `1cr` | `var(--card-radius)` |
299
+ | `bw` | Border width | `2bw` | `calc(var(--border-width) * 2)` |
300
+ | `ow` | Outline width | `1ow` | `var(--outline-width)` |
301
+ | `sf` | Stable fraction | `1sf` | `minmax(0, 1fr)` |
272
302
 
273
303
  You can register additional custom units via [`configure()`](configuration.md#options).
274
304
 
@@ -313,7 +343,7 @@ const ElevatedCard = tasty({
313
343
 
314
344
  **Post-merge recipes (`/` separator):**
315
345
 
316
- Recipes listed after `/` are applied *after* component styles using `mergeStyles`:
346
+ Recipes listed after `/` are applied _after_ component styles using `mergeStyles`:
317
347
 
318
348
  ```jsx
319
349
  const Input = tasty({
@@ -351,8 +381,8 @@ When a style property uses a state map, the merge behavior depends on whether th
351
381
  const MyButton = tasty(Button, {
352
382
  styles: {
353
383
  fill: {
354
- 'loading': '#yellow', // append new state
355
- 'disabled': '#gray.20', // override existing state in place
384
+ loading: '#yellow', // append new state
385
+ disabled: '#gray.20', // override existing state in place
356
386
  },
357
387
  },
358
388
  });
@@ -362,7 +392,7 @@ const MyButton = tasty(Button, {
362
392
  styles: {
363
393
  fill: {
364
394
  '': '#red',
365
- 'hovered': '#blue',
395
+ hovered: '#blue',
366
396
  },
367
397
  },
368
398
  });
@@ -387,8 +417,12 @@ fill: {
387
417
  Use `null` inside a state map to remove a state, or `false` to block it entirely (tombstone):
388
418
 
389
419
  ```jsx
390
- fill: { pressed: null } // removes pressed from the result
391
- fill: { disabled: false } // tombstone — no CSS for disabled, blocks recipe too
420
+ fill: {
421
+ pressed: null;
422
+ } // removes pressed from the result
423
+ fill: {
424
+ disabled: false;
425
+ } // tombstone — no CSS for disabled, blocks recipe too
392
426
  ```
393
427
 
394
428
  ### Resetting Properties with `null` and `false`
@@ -396,36 +430,36 @@ fill: { disabled: false } // tombstone — no CSS for disabled, blocks recipe to
396
430
  ```jsx
397
431
  const SimpleButton = tasty(Button, {
398
432
  styles: {
399
- fill: null, // discard parent's fill, let recipe fill in
433
+ fill: null, // discard parent's fill, let recipe fill in
400
434
  border: false, // no border at all (tombstone — blocks recipe too)
401
435
  },
402
436
  });
403
437
  ```
404
438
 
405
- | Value | Meaning | Recipe fills in? |
406
- |-------|---------|-----------------|
407
- | `undefined` | Not provided — parent preserved | N/A |
408
- | `null` | Intentional unset — parent discarded | Yes |
409
- | `false` | Tombstone — blocks everything | No |
439
+ | Value | Meaning | Recipe fills in? |
440
+ | ----------- | ------------------------------------ | ---------------- |
441
+ | `undefined` | Not provided — parent preserved | N/A |
442
+ | `null` | Intentional unset — parent discarded | Yes |
443
+ | `false` | Tombstone — blocks everything | No |
410
444
 
411
445
  ---
412
446
 
413
447
  ## Advanced States (`@` prefix)
414
448
 
415
- | Prefix | Purpose | Example |
416
- |--------|---------|---------|
417
- | `@media` | Media queries | `@media(w < 768px)` |
418
- | `@(...)` | Container queries | `@(panel, w >= 300px)` |
419
- | `@supports` | Feature/selector support | `@supports(display: grid)` |
420
- | `@root` | Root element states | `@root(schema=dark)` |
421
- | `@parent` | Parent/ancestor element states | `@parent(hovered)` |
422
- | `@own` | Sub-element's own state | `@own(hovered)` |
423
- | `@starting` | Entry animation | `@starting` |
424
- | `_` | Fallback floor (always-on, never negated) | `_` |
425
- | `:is()` | CSS `:is()` structural pseudo-class | `:is(fieldset > label)` |
426
- | `:has()` | CSS `:has()` relational pseudo-class | `:has(> Icon)` |
427
- | `:not()` | CSS `:not()` negation (prefer `!:is()`) | `:not(:first-child)` |
428
- | `:where()` | CSS `:where()` (zero specificity) | `:where(Section)` |
449
+ | Prefix | Purpose | Example |
450
+ | ----------- | ----------------------------------------- | -------------------------- |
451
+ | `@media` | Media queries | `@media(w < 768px)` |
452
+ | `@(...)` | Container queries | `@(panel, w >= 300px)` |
453
+ | `@supports` | Feature/selector support | `@supports(display: grid)` |
454
+ | `@root` | Root element states | `@root(schema=dark)` |
455
+ | `@parent` | Parent/ancestor element states | `@parent(hovered)` |
456
+ | `@own` | Sub-element's own state | `@own(hovered)` |
457
+ | `@starting` | Entry animation | `@starting` |
458
+ | `_` | Fallback floor (always-on, never negated) | `_` |
459
+ | `:is()` | CSS `:is()` structural pseudo-class | `:is(fieldset > label)` |
460
+ | `:has()` | CSS `:has()` relational pseudo-class | `:has(> Icon)` |
461
+ | `:not()` | CSS `:not()` negation (prefer `!:is()`) | `:not(:first-child)` |
462
+ | `:where()` | CSS `:where()` (zero specificity) | `:where(Section)` |
429
463
 
430
464
  > **Specificity.** All state selectors Tasty generates (modifiers, pseudo-classes,
431
465
  > `:is()`/`:not()` groups, and `@root` / `@parent` context) are wrapped in
@@ -441,9 +475,9 @@ const SimpleButton = tasty(Button, {
441
475
  Media queries support dimension shorthands and custom unit expansion:
442
476
 
443
477
  | Shorthand | Expands to |
444
- |-----------|------------|
445
- | `w` | `width` |
446
- | `h` | `height` |
478
+ | --------- | ---------- |
479
+ | `w` | `width` |
480
+ | `h` | `height` |
447
481
 
448
482
  ```jsx
449
483
  fill: {
@@ -454,14 +488,14 @@ fill: {
454
488
  }
455
489
  ```
456
490
 
457
- | Tasty syntax | CSS output |
458
- |--------------|------------|
459
- | `@media(w < 768px)` | `@media (width < 768px)` |
460
- | `@media(600px <= w < 1200px)` | `@media (600px <= width < 1200px)` |
461
- | `@media:print` | `@media print` |
462
- | `@media:screen` | `@media screen` |
491
+ | Tasty syntax | CSS output |
492
+ | ------------------------------------ | ------------------------------------- |
493
+ | `@media(w < 768px)` | `@media (width < 768px)` |
494
+ | `@media(600px <= w < 1200px)` | `@media (600px <= width < 1200px)` |
495
+ | `@media:print` | `@media print` |
496
+ | `@media:screen` | `@media screen` |
463
497
  | `@media(prefers-color-scheme: dark)` | `@media (prefers-color-scheme: dark)` |
464
- | `@media(prefers-reduced-motion)` | `@media (prefers-reduced-motion)` |
498
+ | `@media(prefers-reduced-motion)` | `@media (prefers-reduced-motion)` |
465
499
 
466
500
  Custom units work inside media queries: `@media(w < 40x)` → `@media (width < calc(var(--gap) * 40))`.
467
501
 
@@ -471,12 +505,12 @@ In practice, define state aliases via `configure({ states })` and use `@mobile`
471
505
 
472
506
  Container queries use the syntax `@(name, condition)` for named containers or `@(condition)` for the nearest ancestor container. Dimension shorthands (`w`, `h`, `is`, `bs`) are expanded the same way as `@media`.
473
507
 
474
- | Shorthand | Expands to |
475
- |-----------|------------|
476
- | `w` | `width` |
477
- | `h` | `height` |
478
- | `is` | `inline-size` |
479
- | `bs` | `block-size` |
508
+ | Shorthand | Expands to |
509
+ | --------- | ------------- |
510
+ | `w` | `width` |
511
+ | `h` | `height` |
512
+ | `is` | `inline-size` |
513
+ | `bs` | `block-size` |
480
514
 
481
515
  ```jsx
482
516
  const Panel = tasty({
@@ -489,14 +523,14 @@ const Panel = tasty({
489
523
  });
490
524
  ```
491
525
 
492
- | Tasty syntax | CSS output |
493
- |--------------|------------|
494
- | `@(layout, w < 600px)` | `@container layout (width < 600px)` |
495
- | `@(w < 600px)` | `@container (width < 600px)` |
496
- | `@(layout, $variant=danger)` | `@container layout style(--variant: "danger")` |
497
- | `@(layout, $compact)` | `@container layout style(--compact)` |
498
- | `@(scroll-state(stuck: top))` | `@container scroll-state(stuck: top)` |
499
- | `@(nav, scroll-state(stuck: top))` | `@container nav scroll-state(stuck: top)` |
526
+ | Tasty syntax | CSS output |
527
+ | ---------------------------------- | ---------------------------------------------- |
528
+ | `@(layout, w < 600px)` | `@container layout (width < 600px)` |
529
+ | `@(w < 600px)` | `@container (width < 600px)` |
530
+ | `@(layout, $variant=danger)` | `@container layout style(--variant: "danger")` |
531
+ | `@(layout, $compact)` | `@container layout style(--compact)` |
532
+ | `@(scroll-state(stuck: top))` | `@container scroll-state(stuck: top)` |
533
+ | `@(nav, scroll-state(stuck: top))` | `@container nav scroll-state(stuck: top)` |
500
534
 
501
535
  Container style queries use `$prop` (boolean) or `$prop=value` syntax, which maps to CSS `style(--prop)` or `style(--prop: "value")`.
502
536
 
@@ -504,10 +538,10 @@ Container style queries use `$prop` (boolean) or `$prop=value` syntax, which map
504
538
 
505
539
  Feature queries test CSS property support. Use `$` as the first argument to test selector support:
506
540
 
507
- | Tasty syntax | CSS output |
508
- |--------------|------------|
509
- | `@supports(display: grid)` | `@supports (display: grid)` |
510
- | `@supports($, :has(*))` | `@supports selector(:has(*))` |
541
+ | Tasty syntax | CSS output |
542
+ | --------------------------- | --------------------------------- |
543
+ | `@supports(display: grid)` | `@supports (display: grid)` |
544
+ | `@supports($, :has(*))` | `@supports selector(:has(*))` |
511
545
  | `!@supports(display: grid)` | `@supports (not (display: grid))` |
512
546
 
513
547
  ```jsx
@@ -526,7 +560,7 @@ that assumption: `@supports(...)` and `@(...)` queries can be **unknown** (not
526
560
  just true/false), and `not(unknown)` is also unknown — so a negated default
527
561
  branch silently never applies. The classic case is `scroll-state`: a browser can
528
562
  support `container-type: scroll-state` while a specific `scroll-state(...)` query
529
- is unknown, leaving *no* branch active.
563
+ is unknown, leaving _no_ branch active.
530
564
 
531
565
  The `_` fallback floor solves this. Use `_` as a **standalone key** and its value
532
566
  **always applies** as a guaranteed floor: it never receives negation, and
@@ -541,10 +575,14 @@ inset: {
541
575
  ```
542
576
 
543
577
  ```css
544
- .t0.t0 { inset: 0 ...; }
578
+ .t0.t0 {
579
+ inset: 0...;
580
+ }
545
581
  @container scroll-state(scrolled: block-end) {
546
582
  @supports (container-type: scroll-state) {
547
- .t0.t0 { inset: -80px ...; }
583
+ .t0.t0 {
584
+ inset: -80px...;
585
+ }
548
586
  }
549
587
  }
550
588
  ```
@@ -575,13 +613,13 @@ cause is always the same: **`''` is mutually exclusive (turned off by negation),
575
613
  while `_` is always on (layered underneath).**
576
614
 
577
615
  - **Unknown / invalid branches.** If a higher-priority branch sits behind a query
578
- that can be *unknown* (`@supports`, container, `scroll-state`) or uses a
616
+ that can be _unknown_ (`@supports`, container, `scroll-state`) or uses a
579
617
  selector the browser drops, the negated `''` default disappears along with it
580
618
  (`not(unknown) = unknown`), leaving the property with no rule. The `_` floor
581
619
  survives because it is an unconditional bare rule. This is the case `_` exists
582
620
  for.
583
621
 
584
- - **Empty / "unset" states.** A state can intentionally produce *no* output (an
622
+ - **Empty / "unset" states.** A state can intentionally produce _no_ output (an
585
623
  empty value) to leave a property unset while that state is active. With `''`
586
624
  this works — the default is negated away and nothing replaces it, so the
587
625
  property unsets. With `_` the floor can never be turned off, so its value keeps
@@ -593,14 +631,14 @@ while `_` is always on (layered underneath).**
593
631
  ```
594
632
 
595
633
  - **States with different output shapes.** Because `_` layers additively, when
596
- different states emit *different sets* of declarations, the floor's
634
+ different states emit _different sets_ of declarations, the floor's
597
635
  declarations bleed through wherever the winning state does not override the
598
636
  same property — which can produce inconsistent combinations. A `''` default is
599
637
  swapped out cleanly by its mutually-exclusive condition.
600
638
 
601
639
  Rule of thumb: **use `''` for the normal default** (clean mutual exclusivity,
602
640
  supports unsetting), and reach for `_` only when a value must survive an
603
- *unknown* higher-priority branch.
641
+ _unknown_ higher-priority branch.
604
642
 
605
643
  ### `@root(...)` — Root Element States
606
644
 
@@ -616,13 +654,13 @@ color: {
616
654
  }
617
655
  ```
618
656
 
619
- | Tasty syntax | CSS selector |
620
- |--------------|-------------|
621
- | `@root(schema=dark)` | `:root[data-schema="dark"]` |
622
- | `@root(hovered)` | `:root[data-hovered]` |
623
- | `@root(.premium-user)` | `:root.premium-user` |
624
- | `@root([lang="en"])` | `:root[lang="en"]` |
625
- | `!@root(schema=dark)` | `:root:not([data-schema="dark"])` |
657
+ | Tasty syntax | CSS selector |
658
+ | ---------------------- | --------------------------------- |
659
+ | `@root(schema=dark)` | `:root[data-schema="dark"]` |
660
+ | `@root(hovered)` | `:root[data-hovered]` |
661
+ | `@root(.premium-user)` | `:root.premium-user` |
662
+ | `@root([lang="en"])` | `:root[lang="en"]` |
663
+ | `!@root(schema=dark)` | `:root:not([data-schema="dark"])` |
626
664
 
627
665
  Root conditions are prepended to the component selector: `:root[data-schema="dark"] .t0.t0 { ... }`.
628
666
 
@@ -638,7 +676,7 @@ const Nav = tasty({
638
676
  '': '#text',
639
677
  '@own(:hover)': '#primary',
640
678
  '@own(:focus-visible)': '#primary',
641
- 'selected': '#primary', // root-level modifier
679
+ selected: '#primary', // root-level modifier
642
680
  },
643
681
  },
644
682
  },
@@ -646,11 +684,11 @@ const Nav = tasty({
646
684
  });
647
685
  ```
648
686
 
649
- | Tasty syntax (inside sub-element) | CSS output |
650
- |-----------------------------------|------------|
651
- | `@own(:hover)` | `:hover` on the sub-element selector |
652
- | `@own(hovered)` | `[data-hovered]` on the sub-element selector |
653
- | `@own(theme=dark)` | `[data-theme="dark"]` on the sub-element selector |
687
+ | Tasty syntax (inside sub-element) | CSS output |
688
+ | --------------------------------- | ------------------------------------------------- |
689
+ | `@own(:hover)` | `:hover` on the sub-element selector |
690
+ | `@own(hovered)` | `[data-hovered]` on the sub-element selector |
691
+ | `@own(theme=dark)` | `[data-theme="dark"]` on the sub-element selector |
654
692
 
655
693
  `@own()` is only valid inside sub-element styles. Using it on root styles emits a warning and is treated as a regular modifier.
656
694
 
@@ -668,9 +706,9 @@ const FadeIn = tasty({
668
706
  });
669
707
  ```
670
708
 
671
- | Tasty syntax | CSS output |
672
- |--------------|------------|
673
- | `@starting` | `@starting-style { .t0.t0 { ... } }` |
709
+ | Tasty syntax | CSS output |
710
+ | ------------ | ------------------------------------ |
711
+ | `@starting` | `@starting-style { .t0.t0 { ... } }` |
674
712
 
675
713
  ### `@parent(...)` — Parent Element States
676
714
 
@@ -681,22 +719,22 @@ const Highlight = tasty({
681
719
  styles: {
682
720
  fill: {
683
721
  '': '#white',
684
- '@parent(hovered)': '#gray.05', // Any ancestor has [data-hovered]
685
- '@parent(theme=dark, >)': '#dark-02', // Direct parent has [data-theme="dark"]
722
+ '@parent(hovered)': '#gray.05', // Any ancestor has [data-hovered]
723
+ '@parent(theme=dark, >)': '#dark-02', // Direct parent has [data-theme="dark"]
686
724
  },
687
725
  },
688
726
  });
689
727
  ```
690
728
 
691
- | Syntax | CSS Output |
692
- |--------|------------|
693
- | `@parent(hovered)` | `:is([data-hovered] *)` |
694
- | `!@parent(hovered)` | `:not([data-hovered] *)` |
695
- | `@parent(hovered, >)` | `:is([data-hovered] > *)` (direct parent) |
696
- | `@parent(.active)` | `:is(.active *)` |
697
- | `@parent(hovered & focused)` | `:is([data-hovered][data-focused] *)` (same ancestor) |
729
+ | Syntax | CSS Output |
730
+ | ------------------------------------- | -------------------------------------------------------------------- |
731
+ | `@parent(hovered)` | `:is([data-hovered] *)` |
732
+ | `!@parent(hovered)` | `:not([data-hovered] *)` |
733
+ | `@parent(hovered, >)` | `:is([data-hovered] > *)` (direct parent) |
734
+ | `@parent(.active)` | `:is(.active *)` |
735
+ | `@parent(hovered & focused)` | `:is([data-hovered][data-focused] *)` (same ancestor) |
698
736
  | `@parent(hovered) & @parent(focused)` | `:is([data-hovered] *):is([data-focused] *)` (independent ancestors) |
699
- | `@parent(hovered \| focused)` | `:is([data-hovered] *, [data-focused] *)` (OR inside single wrapper) |
737
+ | `@parent(hovered \| focused)` | `:is([data-hovered] *, [data-focused] *)` (OR inside single wrapper) |
700
738
 
701
739
  For sub-elements, the parent check applies to the root element's ancestors:
702
740
 
@@ -727,38 +765,38 @@ const Card = tasty({
727
765
  styles: {
728
766
  display: {
729
767
  '': 'block',
730
- ':has(> Icon)': 'grid', // has Icon as direct child
731
- ':has(+ Icon)': 'grid', // immediately followed by an Icon sibling
732
- ':has(~ Icon)': 'grid', // has an Icon sibling somewhere after
733
- ':has(Icon +)': 'grid', // immediately preceded by an Icon sibling (auto-completes to `Icon + *`)
734
- ':has(Icon ~)': 'grid', // has an Icon sibling somewhere before (auto-completes to `Icon ~ *`)
735
- ':is(fieldset > label)': 'inline', // is a label inside a fieldset (HTML tags)
736
- '!:has(> Icon)': 'flex', // negation: no Icon child
768
+ ':has(> Icon)': 'grid', // has Icon as direct child
769
+ ':has(+ Icon)': 'grid', // immediately followed by an Icon sibling
770
+ ':has(~ Icon)': 'grid', // has an Icon sibling somewhere after
771
+ ':has(Icon +)': 'grid', // immediately preceded by an Icon sibling (auto-completes to `Icon + *`)
772
+ ':has(Icon ~)': 'grid', // has an Icon sibling somewhere before (auto-completes to `Icon ~ *`)
773
+ ':is(fieldset > label)': 'inline', // is a label inside a fieldset (HTML tags)
774
+ '!:has(> Icon)': 'flex', // negation: no Icon child
737
775
  },
738
776
  },
739
777
  });
740
778
  ```
741
779
 
742
- | Syntax | CSS Output | Meaning |
743
- |--------|------------|---------|
744
- | `:has(> Icon)` | `:has(> [data-element="Icon"])` | Has Icon as direct child |
745
- | `:has(+ Icon)` | `:has(+ [data-element="Icon"])` | Immediately followed by an Icon sibling |
746
- | `:has(~ Icon)` | `:has(~ [data-element="Icon"])` | Has an Icon sibling somewhere after |
747
- | `:has(Icon +)` | `:has([data-element="Icon"] + *)` | Immediately preceded by an Icon sibling |
748
- | `:has(Icon ~)` | `:has([data-element="Icon"] ~ *)` | Has an Icon sibling somewhere before |
749
- | `:has(>)` | `:has(> *)` | Has any direct child |
750
- | `:is(> Field + input)` | `:is(> [data-element="Field"] + input)` | Structural match |
751
- | `:has(button)` | `:has(button)` | HTML tag (lowercase, unchanged) |
752
- | `!:has(> Icon)` | `:not(:has(> [data-element="Icon"]))` | Negation (use `!`) |
753
- | `!:is(Panel)` | `:not([data-element="Panel"])` | Negation (use `!:is`) |
780
+ | Syntax | CSS Output | Meaning |
781
+ | ---------------------- | --------------------------------------- | --------------------------------------- |
782
+ | `:has(> Icon)` | `:has(> [data-element="Icon"])` | Has Icon as direct child |
783
+ | `:has(+ Icon)` | `:has(+ [data-element="Icon"])` | Immediately followed by an Icon sibling |
784
+ | `:has(~ Icon)` | `:has(~ [data-element="Icon"])` | Has an Icon sibling somewhere after |
785
+ | `:has(Icon +)` | `:has([data-element="Icon"] + *)` | Immediately preceded by an Icon sibling |
786
+ | `:has(Icon ~)` | `:has([data-element="Icon"] ~ *)` | Has an Icon sibling somewhere before |
787
+ | `:has(>)` | `:has(> *)` | Has any direct child |
788
+ | `:is(> Field + input)` | `:is(> [data-element="Field"] + input)` | Structural match |
789
+ | `:has(button)` | `:has(button)` | HTML tag (lowercase, unchanged) |
790
+ | `!:has(> Icon)` | `:not(:has(> [data-element="Icon"]))` | Negation (use `!`) |
791
+ | `!:is(Panel)` | `:not([data-element="Panel"])` | Negation (use `!:is`) |
754
792
 
755
793
  Combine with other states using boolean logic (`&`, `|`, `!`, `^`):
756
794
 
757
795
  ```jsx
758
- ':has(> Icon) & hovered' // AND: structural + data attribute
759
- '@parent(hovered) & :has(> Icon)' // AND: parent check + structural
760
- ':has(> Icon) | :has(> Button)' // OR: either sub-element present
761
- ':has(> Icon) ^ :has(> Button)' // XOR: exactly one present
796
+ ':has(> Icon) & hovered'; // AND: structural + data attribute
797
+ '@parent(hovered) & :has(> Icon)'; // AND: parent check + structural
798
+ ':has(> Icon) | :has(> Button)'; // OR: either sub-element present
799
+ ':has(> Icon) ^ :has(> Button)'; // XOR: exactly one present
762
800
  ```
763
801
 
764
802
  > **Nesting limit:** The state key parser supports up to 2 levels of nested parentheses inside `:is()`, `:has()`, `:not()`, and `:where()` — e.g. `:has(Input:not(:disabled))` works, but 3+ levels like `:has(:is(:not(:hover)))` will not be tokenized correctly. This covers virtually all practical use cases.
@@ -794,7 +832,7 @@ const AnimatedGradient = tasty({
794
832
  styles: {
795
833
  '$gradient-angle': '0deg',
796
834
  '#theme': 'okhst(280 80% 50%)',
797
- background: 'linear-gradient($gradient-angle, #theme, transparent)',
835
+ image: 'linear-gradient($gradient-angle, #theme, #clear)',
798
836
  transition: '$$gradient-angle 0.3s, ##theme 0.3s',
799
837
  },
800
838
  });
@@ -825,7 +863,7 @@ const Heading = tasty({
825
863
  fontDisplay: 'swap',
826
864
  },
827
865
  },
828
- fontFamily: '"Brand Sans", sans-serif',
866
+ font: '"Brand Sans", sans-serif',
829
867
  },
830
868
  });
831
869
  ```
@@ -845,20 +883,20 @@ Supply an array to register several variants of the same family:
845
883
 
846
884
  ### Supported descriptors
847
885
 
848
- | Descriptor | CSS property | Type |
849
- |---|---|---|
850
- | `src` (required) | `src` | `string` |
851
- | `fontWeight` | `font-weight` | `string \| number` |
852
- | `fontStyle` | `font-style` | `string` |
853
- | `fontStretch` | `font-stretch` | `string` |
854
- | `fontDisplay` | `font-display` | `'auto' \| 'block' \| 'swap' \| 'fallback' \| 'optional'` |
855
- | `unicodeRange` | `unicode-range` | `string` |
856
- | `ascentOverride` | `ascent-override` | `string` |
857
- | `descentOverride` | `descent-override` | `string` |
858
- | `lineGapOverride` | `line-gap-override` | `string` |
859
- | `sizeAdjust` | `size-adjust` | `string` |
860
- | `fontFeatureSettings` | `font-feature-settings` | `string` |
861
- | `fontVariationSettings` | `font-variation-settings` | `string` |
886
+ | Descriptor | CSS property | Type |
887
+ | ----------------------- | ------------------------- | --------------------------------------------------------- |
888
+ | `src` (required) | `src` | `string` |
889
+ | `fontWeight` | `font-weight` | `string \| number` |
890
+ | `fontStyle` | `font-style` | `string` |
891
+ | `fontStretch` | `font-stretch` | `string` |
892
+ | `fontDisplay` | `font-display` | `'auto' \| 'block' \| 'swap' \| 'fallback' \| 'optional'` |
893
+ | `unicodeRange` | `unicode-range` | `string` |
894
+ | `ascentOverride` | `ascent-override` | `string` |
895
+ | `descentOverride` | `descent-override` | `string` |
896
+ | `lineGapOverride` | `line-gap-override` | `string` |
897
+ | `sizeAdjust` | `size-adjust` | `string` |
898
+ | `fontFeatureSettings` | `font-feature-settings` | `string` |
899
+ | `fontVariationSettings` | `font-variation-settings` | `string` |
862
900
 
863
901
  > Font-face rules are permanent — they are injected once and never cleaned up, matching how browsers handle `@font-face`.
864
902
 
@@ -886,18 +924,18 @@ const EmojiList = tasty({
886
924
 
887
925
  ### Supported descriptors
888
926
 
889
- | Descriptor | CSS property | Type |
890
- |---|---|---|
891
- | `system` (required) | `system` | `'cyclic' \| 'numeric' \| 'alphabetic' \| 'symbolic' \| 'additive' \| 'fixed' \| string` |
892
- | `symbols` | `symbols` | `string` |
893
- | `additiveSymbols` | `additive-symbols` | `string` |
894
- | `prefix` | `prefix` | `string` |
895
- | `suffix` | `suffix` | `string` |
896
- | `negative` | `negative` | `string` |
897
- | `range` | `range` | `string` |
898
- | `pad` | `pad` | `string` |
899
- | `fallback` | `fallback` | `string` |
900
- | `speakAs` | `speak-as` | `string` |
927
+ | Descriptor | CSS property | Type |
928
+ | ------------------- | ------------------ | ---------------------------------------------------------------------------------------- |
929
+ | `system` (required) | `system` | `'cyclic' \| 'numeric' \| 'alphabetic' \| 'symbolic' \| 'additive' \| 'fixed' \| string` |
930
+ | `symbols` | `symbols` | `string` |
931
+ | `additiveSymbols` | `additive-symbols` | `string` |
932
+ | `prefix` | `prefix` | `string` |
933
+ | `suffix` | `suffix` | `string` |
934
+ | `negative` | `negative` | `string` |
935
+ | `range` | `range` | `string` |
936
+ | `pad` | `pad` | `string` |
937
+ | `fallback` | `fallback` | `string` |
938
+ | `speakAs` | `speak-as` | `string` |
901
939
 
902
940
  > Counter-style rules are permanent — they are injected once and never cleaned up, matching how browsers handle `@counter-style`.
903
941
 
@@ -919,18 +957,18 @@ const Box = tasty({
919
957
  styles: {
920
958
  '@function': {
921
959
  // simplest: one bare param + result (auto-calc, no explicit calc())
922
- '$$negative': { args: ['$value'], result: '(-1 * $value)' },
960
+ $$negative: { args: ['$value'], result: '(-1 * $value)' },
923
961
 
924
962
  // typed param + default + return type + local variable
925
- '$$shadow': {
963
+ $$shadow: {
926
964
  args: { '$shadow-color': { syntax: '<color>', default: 'inherit' } },
927
965
  returns: '<color>',
928
- '$offset': '2px', // local variable
966
+ $offset: '2px', // local variable
929
967
  result: '$offset $offset ($shadow-color, black)',
930
968
  },
931
969
  },
932
- marginTop: '$$negative(10px)', // → margin-top: --negative(10px)
933
- boxShadow: '$$shadow(#accent)', // → box-shadow: --shadow(var(--accent-color))
970
+ margin: '$$negative(10px) top', // → margin: --negative(10px) 0 0 0
971
+ shadow: '$$shadow(#accent)', // → box-shadow: --shadow(var(--accent-color))
934
972
  },
935
973
  });
936
974
  ```
@@ -938,22 +976,27 @@ const Box = tasty({
938
976
  Generated CSS:
939
977
 
940
978
  ```css
941
- @function --negative(--value) { result: calc(-1 * var(--value)); }
979
+ @function --negative(--value) {
980
+ result: calc(-1 * var(--value));
981
+ }
942
982
  @function --shadow(--shadow-color <color>: inherit) returns <color> {
943
983
  --offset: 2px;
944
984
  result: var(--offset) var(--offset) var(--shadow-color, black);
945
985
  }
946
- .t0 { margin-top: --negative(10px); box-shadow: --shadow(var(--accent-color)); }
986
+ .t0 {
987
+ margin: --negative(10px) 0 0 0;
988
+ box-shadow: --shadow(var(--accent-color));
989
+ }
947
990
  ```
948
991
 
949
992
  ### Descriptor shape
950
993
 
951
- | Field | Type | Notes |
952
- |---|---|---|
953
- | `result` (required) | `string` | The `result:` value, parsed through the Tasty DSL. |
954
- | `args` | `string[]` \| `Record<string, FunctionParameter>` | Ordered parameters. Array form lists bare names; object form maps names to type/default. |
955
- | `returns` | `string` | Optional return type, e.g. `'<color>'`. |
956
- | `$name` keys | `string \| number` | Any `$name` key declares a local variable `--name` (value parsed). |
994
+ | Field | Type | Notes |
995
+ | ------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------- |
996
+ | `result` (required) | `string` | The `result:` value, parsed through the Tasty DSL. |
997
+ | `args` | `string[]` \| `Record<string, FunctionParameter>` | Ordered parameters. Array form lists bare names; object form maps names to type/default. |
998
+ | `returns` | `string` | Optional return type, e.g. `'<color>'`. |
999
+ | `$name` keys | `string \| number` | Any `$name` key declares a local variable `--name` (value parsed). |
957
1000
 
958
1001
  A `FunctionParameter` is one of: `true` (bare param), a string CSS type shorthand (`'<length>'`), or `{ syntax?: string; default?: string | number }`.
959
1002
 
@@ -975,4 +1018,4 @@ For a complete reference of all enhanced style properties — syntax, values, mo
975
1018
  - **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
976
1019
  - **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
977
1020
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
978
- - **[Zero Runtime (tastyStatic)](tasty-static.md)** — Build-time static styling with Babel plugin
1021
+ - **[Build-Time Extraction (`tastyStatic`)](tasty-static.md)** — Static styling with the Babel plugin