@tenphi/tasty 0.0.0-snapshot.2c5752e → 0.0.0-snapshot.2cbc2f8

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 (301) hide show
  1. package/README.md +330 -159
  2. package/dist/async-storage-B7_o6FKt.js +44 -0
  3. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  4. package/dist/collector-CpU85p2G.d.ts +108 -0
  5. package/dist/collector-OvXG7KWf.js +243 -0
  6. package/dist/collector-OvXG7KWf.js.map +1 -0
  7. package/dist/config-3h7BtX4l.d.ts +945 -0
  8. package/dist/config-BfqoUnBb.js +10950 -0
  9. package/dist/config-BfqoUnBb.js.map +1 -0
  10. package/dist/context-CkSg-kDT.js +24 -0
  11. package/dist/context-CkSg-kDT.js.map +1 -0
  12. package/dist/core/index.d.ts +5 -33
  13. package/dist/core/index.js +6 -26
  14. package/dist/core-DlcI4RnL.js +1598 -0
  15. package/dist/core-DlcI4RnL.js.map +1 -0
  16. package/dist/css-writer-C8h3QlRt.js +351 -0
  17. package/dist/css-writer-C8h3QlRt.js.map +1 -0
  18. package/dist/format-global-rules-Dbc_1tc3.js +22 -0
  19. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  20. package/dist/format-rules-D9CBkvVE.js +143 -0
  21. package/dist/format-rules-D9CBkvVE.js.map +1 -0
  22. package/dist/hydrate-sIvCdUlE.js +45 -0
  23. package/dist/hydrate-sIvCdUlE.js.map +1 -0
  24. package/dist/index-BsJz5xBF.d.ts +1286 -0
  25. package/dist/index-C_SRmAWj.d.ts +1778 -0
  26. package/dist/index.d.ts +5 -40
  27. package/dist/index.js +731 -32
  28. package/dist/index.js.map +1 -0
  29. package/dist/keyframes-bg4yPrZL.js +595 -0
  30. package/dist/keyframes-bg4yPrZL.js.map +1 -0
  31. package/dist/{utils/merge-styles.d.ts → merge-styles-BzOwGOGC.d.ts} +3 -3
  32. package/dist/{utils/merge-styles.js → merge-styles-CmWiXajN.js} +4 -6
  33. package/dist/merge-styles-CmWiXajN.js.map +1 -0
  34. package/dist/{utils/resolve-recipes.js → resolve-recipes-OwLUM8jV.js} +5 -8
  35. package/dist/resolve-recipes-OwLUM8jV.js.map +1 -0
  36. package/dist/ssr/astro-client.d.ts +1 -0
  37. package/dist/ssr/astro-client.js +19 -0
  38. package/dist/ssr/astro-client.js.map +1 -0
  39. package/dist/ssr/astro-middleware.d.ts +15 -0
  40. package/dist/ssr/astro-middleware.js +19 -0
  41. package/dist/ssr/astro-middleware.js.map +1 -0
  42. package/dist/ssr/astro.d.ts +97 -0
  43. package/dist/ssr/astro.js +149 -0
  44. package/dist/ssr/astro.js.map +1 -0
  45. package/dist/ssr/index.d.ts +44 -0
  46. package/dist/ssr/index.js +10 -0
  47. package/dist/ssr/index.js.map +1 -0
  48. package/dist/ssr/next.d.ts +46 -0
  49. package/dist/ssr/next.js +75 -0
  50. package/dist/ssr/next.js.map +1 -0
  51. package/dist/static/index.d.ts +91 -5
  52. package/dist/static/index.js +49 -4
  53. package/dist/static/index.js.map +1 -0
  54. package/dist/static/inject.d.ts +5 -0
  55. package/dist/static/inject.js +17 -0
  56. package/dist/static/inject.js.map +1 -0
  57. package/dist/zero/babel.d.ts +57 -84
  58. package/dist/zero/babel.js +232 -40
  59. package/dist/zero/babel.js.map +1 -1
  60. package/dist/zero/index.d.ts +67 -3
  61. package/dist/zero/index.js +2 -4
  62. package/dist/zero/next.d.ts +56 -30
  63. package/dist/zero/next.js +105 -40
  64. package/dist/zero/next.js.map +1 -1
  65. package/docs/README.md +31 -0
  66. package/docs/adoption.md +298 -0
  67. package/docs/comparison.md +419 -0
  68. package/docs/configuration.md +438 -0
  69. package/docs/debug.md +320 -0
  70. package/docs/design-system.md +436 -0
  71. package/docs/dsl.md +799 -0
  72. package/docs/getting-started.md +217 -0
  73. package/docs/injector.md +544 -0
  74. package/docs/methodology.md +642 -0
  75. package/docs/pipeline.md +744 -0
  76. package/docs/react-api.md +581 -0
  77. package/docs/ssr.md +444 -0
  78. package/docs/styles.md +598 -0
  79. package/docs/tasty-static.md +547 -0
  80. package/package.json +128 -35
  81. package/tasty.config.ts +16 -0
  82. package/dist/_virtual/_rolldown/runtime.js +0 -8
  83. package/dist/chunks/cacheKey.js +0 -70
  84. package/dist/chunks/cacheKey.js.map +0 -1
  85. package/dist/chunks/definitions.d.ts +0 -37
  86. package/dist/chunks/definitions.js +0 -260
  87. package/dist/chunks/definitions.js.map +0 -1
  88. package/dist/chunks/renderChunk.js +0 -61
  89. package/dist/chunks/renderChunk.js.map +0 -1
  90. package/dist/config.d.ts +0 -280
  91. package/dist/config.js +0 -403
  92. package/dist/config.js.map +0 -1
  93. package/dist/debug.d.ts +0 -204
  94. package/dist/debug.js +0 -733
  95. package/dist/debug.js.map +0 -1
  96. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  97. package/dist/hooks/useGlobalStyles.js +0 -56
  98. package/dist/hooks/useGlobalStyles.js.map +0 -1
  99. package/dist/hooks/useKeyframes.d.ts +0 -56
  100. package/dist/hooks/useKeyframes.js +0 -54
  101. package/dist/hooks/useKeyframes.js.map +0 -1
  102. package/dist/hooks/useProperty.d.ts +0 -79
  103. package/dist/hooks/useProperty.js +0 -91
  104. package/dist/hooks/useProperty.js.map +0 -1
  105. package/dist/hooks/useRawCSS.d.ts +0 -53
  106. package/dist/hooks/useRawCSS.js +0 -28
  107. package/dist/hooks/useRawCSS.js.map +0 -1
  108. package/dist/hooks/useStyles.d.ts +0 -40
  109. package/dist/hooks/useStyles.js +0 -169
  110. package/dist/hooks/useStyles.js.map +0 -1
  111. package/dist/injector/index.d.ts +0 -157
  112. package/dist/injector/index.js +0 -154
  113. package/dist/injector/index.js.map +0 -1
  114. package/dist/injector/injector.d.ts +0 -139
  115. package/dist/injector/injector.js +0 -404
  116. package/dist/injector/injector.js.map +0 -1
  117. package/dist/injector/sheet-manager.d.ts +0 -127
  118. package/dist/injector/sheet-manager.js +0 -714
  119. package/dist/injector/sheet-manager.js.map +0 -1
  120. package/dist/injector/types.d.ts +0 -135
  121. package/dist/keyframes/index.js +0 -206
  122. package/dist/keyframes/index.js.map +0 -1
  123. package/dist/parser/classify.js +0 -319
  124. package/dist/parser/classify.js.map +0 -1
  125. package/dist/parser/const.js +0 -33
  126. package/dist/parser/const.js.map +0 -1
  127. package/dist/parser/lru.js +0 -109
  128. package/dist/parser/lru.js.map +0 -1
  129. package/dist/parser/parser.d.ts +0 -25
  130. package/dist/parser/parser.js +0 -116
  131. package/dist/parser/parser.js.map +0 -1
  132. package/dist/parser/tokenizer.js +0 -69
  133. package/dist/parser/tokenizer.js.map +0 -1
  134. package/dist/parser/types.d.ts +0 -51
  135. package/dist/parser/types.js +0 -46
  136. package/dist/parser/types.js.map +0 -1
  137. package/dist/pipeline/conditions.d.ts +0 -134
  138. package/dist/pipeline/conditions.js +0 -400
  139. package/dist/pipeline/conditions.js.map +0 -1
  140. package/dist/pipeline/exclusive.js +0 -231
  141. package/dist/pipeline/exclusive.js.map +0 -1
  142. package/dist/pipeline/index.d.ts +0 -53
  143. package/dist/pipeline/index.js +0 -641
  144. package/dist/pipeline/index.js.map +0 -1
  145. package/dist/pipeline/materialize.js +0 -908
  146. package/dist/pipeline/materialize.js.map +0 -1
  147. package/dist/pipeline/parseStateKey.d.ts +0 -15
  148. package/dist/pipeline/parseStateKey.js +0 -430
  149. package/dist/pipeline/parseStateKey.js.map +0 -1
  150. package/dist/pipeline/simplify.js +0 -557
  151. package/dist/pipeline/simplify.js.map +0 -1
  152. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  153. package/dist/plugins/okhsl-plugin.js +0 -371
  154. package/dist/plugins/okhsl-plugin.js.map +0 -1
  155. package/dist/plugins/types.d.ts +0 -69
  156. package/dist/properties/index.js +0 -158
  157. package/dist/properties/index.js.map +0 -1
  158. package/dist/states/index.d.ts +0 -49
  159. package/dist/states/index.js +0 -416
  160. package/dist/states/index.js.map +0 -1
  161. package/dist/static/tastyStatic.d.ts +0 -46
  162. package/dist/static/tastyStatic.js +0 -31
  163. package/dist/static/tastyStatic.js.map +0 -1
  164. package/dist/static/types.d.ts +0 -49
  165. package/dist/static/types.js +0 -24
  166. package/dist/static/types.js.map +0 -1
  167. package/dist/styles/align.d.ts +0 -15
  168. package/dist/styles/align.js +0 -14
  169. package/dist/styles/align.js.map +0 -1
  170. package/dist/styles/border.d.ts +0 -25
  171. package/dist/styles/border.js +0 -114
  172. package/dist/styles/border.js.map +0 -1
  173. package/dist/styles/color.d.ts +0 -14
  174. package/dist/styles/color.js +0 -23
  175. package/dist/styles/color.js.map +0 -1
  176. package/dist/styles/createStyle.js +0 -77
  177. package/dist/styles/createStyle.js.map +0 -1
  178. package/dist/styles/dimension.js +0 -97
  179. package/dist/styles/dimension.js.map +0 -1
  180. package/dist/styles/display.d.ts +0 -37
  181. package/dist/styles/display.js +0 -67
  182. package/dist/styles/display.js.map +0 -1
  183. package/dist/styles/fade.d.ts +0 -15
  184. package/dist/styles/fade.js +0 -58
  185. package/dist/styles/fade.js.map +0 -1
  186. package/dist/styles/fill.d.ts +0 -44
  187. package/dist/styles/fill.js +0 -51
  188. package/dist/styles/fill.js.map +0 -1
  189. package/dist/styles/flow.d.ts +0 -16
  190. package/dist/styles/flow.js +0 -12
  191. package/dist/styles/flow.js.map +0 -1
  192. package/dist/styles/gap.d.ts +0 -31
  193. package/dist/styles/gap.js +0 -37
  194. package/dist/styles/gap.js.map +0 -1
  195. package/dist/styles/height.d.ts +0 -17
  196. package/dist/styles/height.js +0 -20
  197. package/dist/styles/height.js.map +0 -1
  198. package/dist/styles/index.d.ts +0 -2
  199. package/dist/styles/index.js +0 -9
  200. package/dist/styles/index.js.map +0 -1
  201. package/dist/styles/inset.d.ts +0 -50
  202. package/dist/styles/inset.js +0 -142
  203. package/dist/styles/inset.js.map +0 -1
  204. package/dist/styles/justify.d.ts +0 -15
  205. package/dist/styles/justify.js +0 -14
  206. package/dist/styles/justify.js.map +0 -1
  207. package/dist/styles/list.d.ts +0 -16
  208. package/dist/styles/list.js +0 -98
  209. package/dist/styles/list.js.map +0 -1
  210. package/dist/styles/margin.d.ts +0 -28
  211. package/dist/styles/margin.js +0 -96
  212. package/dist/styles/margin.js.map +0 -1
  213. package/dist/styles/outline.d.ts +0 -29
  214. package/dist/styles/outline.js +0 -65
  215. package/dist/styles/outline.js.map +0 -1
  216. package/dist/styles/padding.d.ts +0 -28
  217. package/dist/styles/padding.js +0 -96
  218. package/dist/styles/padding.js.map +0 -1
  219. package/dist/styles/predefined.d.ts +0 -73
  220. package/dist/styles/predefined.js +0 -241
  221. package/dist/styles/predefined.js.map +0 -1
  222. package/dist/styles/preset.d.ts +0 -47
  223. package/dist/styles/preset.js +0 -126
  224. package/dist/styles/preset.js.map +0 -1
  225. package/dist/styles/radius.d.ts +0 -14
  226. package/dist/styles/radius.js +0 -51
  227. package/dist/styles/radius.js.map +0 -1
  228. package/dist/styles/scrollbar.d.ts +0 -21
  229. package/dist/styles/scrollbar.js +0 -105
  230. package/dist/styles/scrollbar.js.map +0 -1
  231. package/dist/styles/shadow.d.ts +0 -14
  232. package/dist/styles/shadow.js +0 -24
  233. package/dist/styles/shadow.js.map +0 -1
  234. package/dist/styles/styledScrollbar.d.ts +0 -47
  235. package/dist/styles/styledScrollbar.js +0 -38
  236. package/dist/styles/styledScrollbar.js.map +0 -1
  237. package/dist/styles/transition.d.ts +0 -14
  238. package/dist/styles/transition.js +0 -138
  239. package/dist/styles/transition.js.map +0 -1
  240. package/dist/styles/types.d.ts +0 -498
  241. package/dist/styles/width.d.ts +0 -17
  242. package/dist/styles/width.js +0 -20
  243. package/dist/styles/width.js.map +0 -1
  244. package/dist/tasty.d.ts +0 -982
  245. package/dist/tasty.js +0 -191
  246. package/dist/tasty.js.map +0 -1
  247. package/dist/tokens/typography.d.ts +0 -19
  248. package/dist/tokens/typography.js +0 -237
  249. package/dist/tokens/typography.js.map +0 -1
  250. package/dist/types.d.ts +0 -184
  251. package/dist/utils/cache-wrapper.js +0 -26
  252. package/dist/utils/cache-wrapper.js.map +0 -1
  253. package/dist/utils/case-converter.js +0 -8
  254. package/dist/utils/case-converter.js.map +0 -1
  255. package/dist/utils/colors.d.ts +0 -5
  256. package/dist/utils/colors.js +0 -9
  257. package/dist/utils/colors.js.map +0 -1
  258. package/dist/utils/css-types.d.ts +0 -7
  259. package/dist/utils/dotize.d.ts +0 -26
  260. package/dist/utils/dotize.js +0 -122
  261. package/dist/utils/dotize.js.map +0 -1
  262. package/dist/utils/filter-base-props.d.ts +0 -15
  263. package/dist/utils/filter-base-props.js +0 -45
  264. package/dist/utils/filter-base-props.js.map +0 -1
  265. package/dist/utils/get-display-name.d.ts +0 -7
  266. package/dist/utils/get-display-name.js +0 -10
  267. package/dist/utils/get-display-name.js.map +0 -1
  268. package/dist/utils/hsl-to-rgb.js +0 -38
  269. package/dist/utils/hsl-to-rgb.js.map +0 -1
  270. package/dist/utils/is-dev-env.js +0 -19
  271. package/dist/utils/is-dev-env.js.map +0 -1
  272. package/dist/utils/is-valid-element-type.js +0 -15
  273. package/dist/utils/is-valid-element-type.js.map +0 -1
  274. package/dist/utils/merge-styles.js.map +0 -1
  275. package/dist/utils/mod-attrs.d.ts +0 -8
  276. package/dist/utils/mod-attrs.js +0 -21
  277. package/dist/utils/mod-attrs.js.map +0 -1
  278. package/dist/utils/okhsl-to-rgb.js +0 -296
  279. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  280. package/dist/utils/process-tokens.d.ts +0 -31
  281. package/dist/utils/process-tokens.js +0 -171
  282. package/dist/utils/process-tokens.js.map +0 -1
  283. package/dist/utils/resolve-recipes.d.ts +0 -17
  284. package/dist/utils/resolve-recipes.js.map +0 -1
  285. package/dist/utils/string.js +0 -8
  286. package/dist/utils/string.js.map +0 -1
  287. package/dist/utils/styles.d.ts +0 -183
  288. package/dist/utils/styles.js +0 -585
  289. package/dist/utils/styles.js.map +0 -1
  290. package/dist/utils/typography.d.ts +0 -36
  291. package/dist/utils/typography.js +0 -53
  292. package/dist/utils/typography.js.map +0 -1
  293. package/dist/utils/warnings.d.ts +0 -16
  294. package/dist/utils/warnings.js +0 -16
  295. package/dist/utils/warnings.js.map +0 -1
  296. package/dist/zero/css-writer.d.ts +0 -45
  297. package/dist/zero/css-writer.js +0 -74
  298. package/dist/zero/css-writer.js.map +0 -1
  299. package/dist/zero/extractor.d.ts +0 -24
  300. package/dist/zero/extractor.js +0 -150
  301. package/dist/zero/extractor.js.map +0 -1
package/docs/dsl.md ADDED
@@ -0,0 +1,799 @@
1
+ # Style DSL Reference
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()`.
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).
6
+
7
+ ---
8
+
9
+ ## Dictionary
10
+
11
+ ### Style Mapping
12
+
13
+ Object where keys represent states and values are the styles to apply:
14
+
15
+ ```jsx
16
+ fill: { '': '#white', hovered: '#gray.05', 'theme=danger': '#red' }
17
+ ```
18
+
19
+ #### State Key Types
20
+
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]` |
32
+
33
+ Operator precedence (highest to lowest): `!` (NOT) > `^` (XOR) > `|` (OR) > `&` (AND). Use parentheses to override: `hovered & (pressed ^ focused)`.
34
+
35
+ `^` (XOR) means "exactly one of" — `A ^ B` expands to `(A & !B) | (!A & B)`. This is useful for mutually exclusive states where exactly one should be active:
36
+
37
+ ```jsx
38
+ fill: {
39
+ '': '#surface',
40
+ 'hovered ^ focused': '#accent', // active when hovered OR focused, but not both
41
+ }
42
+ ```
43
+
44
+ #### Default State Ordering
45
+
46
+ Key order sets priority — later keys win and turn off earlier ones via negation. The bare default (`''`) is the lowest-priority state, so it **must be the first key**. If it appears after other states, Tasty moves it to the front and emits a dev warning (`MISPLACED_DEFAULT_STATE`); otherwise it would override every state above it.
47
+
48
+ ```jsx
49
+ // Correct — default first
50
+ color: { '': '#text', hovered: '#accent' }
51
+
52
+ // Auto-corrected with a warning — '' moved to the front
53
+ color: { hovered: '#accent', '': '#text' }
54
+ ```
55
+
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.
57
+
58
+ ### Sub-element
59
+
60
+ Element styled using a capitalized key. Identified by `data-element` attribute:
61
+
62
+ ```jsx
63
+ styles: { Title: { preset: 'h3' } }
64
+ // Targets: <div data-element="Title">
65
+ ```
66
+
67
+ #### Selector Affix (`$`)
68
+
69
+ Control how a sub-element selector attaches to the root selector using the `$` property inside the sub-element's styles.
70
+
71
+ Examples below assume the sub-element key is **Cell** (i.e. `[data-element="Cell"]` in CSS):
72
+
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 |
86
+
87
+ Rules for key injection (`[data-element="..."]`):
88
+
89
+ - **Trailing combinator** (`>`, `+`, `~`) — key is injected after it
90
+ - **Uppercase element name** (`Body`, `Row`) — key is injected as descendant
91
+ - **HTML tag** (`h1`, `a`, `span`) — no key injection; the tag IS the selector
92
+ - **Universal selector** (`*`) — no key injection
93
+ - **Pseudo / class / attribute** — no key injection
94
+
95
+ The `@` placeholder marks exactly where `[data-element="..."]` is injected, allowing you to attach pseudo-classes, pseudo-elements, or class selectors directly to the sub-element instead of the root:
96
+
97
+ ```jsx
98
+ const List = tasty({
99
+ styles: {
100
+ Item: {
101
+ $: '>@:last-child',
102
+ border: 'none',
103
+ },
104
+ },
105
+ });
106
+ // → .t0 > [data-element="Item"]:last-child { border: none }
107
+ ```
108
+
109
+ ### Color Token
110
+
111
+ Named color prefixed with `#` that maps to CSS custom properties. Supports opacity with `.N` suffix:
112
+
113
+ ```jsx
114
+ fill: '#purple.5' // → var(--purple-color) with 50% opacity
115
+ ```
116
+
117
+ ### Modifier
118
+
119
+ State value via `mods` prop that generates `data-*` attributes:
120
+
121
+ ```jsx
122
+ mods={{ hovered: true, theme: 'danger' }}
123
+ // → data-hovered="" data-theme="danger"
124
+ ```
125
+
126
+ Modifiers can also be exposed as top-level component props via `modProps` — see [Runtime — Mod Props](react-api.md#mod-props).
127
+
128
+ ---
129
+
130
+ ## Color Tokens & Opacity
131
+
132
+ ```jsx
133
+ color: '#purple', // Full opacity
134
+ color: '#purple.5', // 50% opacity
135
+ color: '#purple.05', // 5% opacity
136
+ fill: '#current', // → currentcolor
137
+ fill: '#current.5', // → color-mix(in oklab, currentcolor 50%, transparent)
138
+ color: '(#primary, #secondary)', // Fallback syntax
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Built-in Units
144
+
145
+ | Unit | Description | Example | CSS Output |
146
+ |------|-------------|---------|------------|
147
+ | `x` | Gap multiplier | `2x` | `calc(var(--gap) * 2)` |
148
+ | `r` | Border radius | `1r` | `var(--radius)` |
149
+ | `cr` | Card border radius | `1cr` | `var(--card-radius)` |
150
+ | `bw` | Border width | `2bw` | `calc(var(--border-width) * 2)` |
151
+ | `ow` | Outline width | `1ow` | `var(--outline-width)` |
152
+ | `sf` | Stable fraction | `1sf` | `minmax(0, 1fr)` |
153
+
154
+ You can register additional custom units via [`configure()`](configuration.md#options).
155
+
156
+ ---
157
+
158
+ ## Replace Tokens
159
+
160
+ Tokens defined via [`configure({ replaceTokens })`](configuration.md#replace-tokens-parse-time-substitution) are replaced at parse time and baked into the generated CSS:
161
+
162
+ ```jsx
163
+ const Card = tasty({
164
+ styles: {
165
+ padding: '$card-padding',
166
+ fill: '#surface',
167
+ border: '1bw solid #accent',
168
+ },
169
+ });
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Recipes
175
+
176
+ Apply predefined style bundles (defined via [`configure({ recipes })`](configuration.md#recipes)) using the `recipe` style property:
177
+
178
+ ```jsx
179
+ const Card = tasty({
180
+ styles: {
181
+ recipe: 'card',
182
+ color: '#text',
183
+ },
184
+ });
185
+
186
+ // Compose multiple recipes
187
+ const ElevatedCard = tasty({
188
+ styles: {
189
+ recipe: 'card elevated',
190
+ color: '#text',
191
+ },
192
+ });
193
+ ```
194
+
195
+ **Post-merge recipes (`/` separator):**
196
+
197
+ Recipes listed after `/` are applied *after* component styles using `mergeStyles`:
198
+
199
+ ```jsx
200
+ const Input = tasty({
201
+ styles: {
202
+ recipe: 'reset input / input-autofill',
203
+ preset: 't3',
204
+ },
205
+ });
206
+ ```
207
+
208
+ Use `none` to skip base recipes and apply only post recipes:
209
+
210
+ ```jsx
211
+ const Custom = tasty({
212
+ styles: {
213
+ recipe: 'none / disabled',
214
+ padding: '2x',
215
+ },
216
+ });
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Extending vs. Replacing State Maps
222
+
223
+ When a style property uses a state map, the merge behavior depends on whether the child provides a `''` (default) key:
224
+
225
+ - **No `''` key** — extend mode: parent states are preserved, child adds/overrides
226
+ - **Has `''` key** — replace mode: child defines everything from scratch
227
+
228
+ ```jsx
229
+ // Parent has: fill: { '': '#white', hovered: '#blue', disabled: '#gray' }
230
+
231
+ // Extend — no '' key, parent states preserved
232
+ const MyButton = tasty(Button, {
233
+ styles: {
234
+ fill: {
235
+ 'loading': '#yellow', // append new state
236
+ 'disabled': '#gray.20', // override existing state in place
237
+ },
238
+ },
239
+ });
240
+
241
+ // Replace — has '' key, parent states dropped
242
+ const MyButton = tasty(Button, {
243
+ styles: {
244
+ fill: {
245
+ '': '#red',
246
+ 'hovered': '#blue',
247
+ },
248
+ },
249
+ });
250
+ ```
251
+
252
+ Use `'@inherit'` to pull a parent state value. In extend mode it repositions the state; in replace mode it cherry-picks it:
253
+
254
+ ```jsx
255
+ // Extend mode: reposition disabled to end (highest CSS priority)
256
+ fill: {
257
+ 'loading': '#yellow',
258
+ disabled: '@inherit',
259
+ }
260
+
261
+ // Replace mode: cherry-pick disabled from parent
262
+ fill: {
263
+ '': '#red',
264
+ disabled: '@inherit',
265
+ }
266
+ ```
267
+
268
+ Use `null` inside a state map to remove a state, or `false` to block it entirely (tombstone):
269
+
270
+ ```jsx
271
+ fill: { pressed: null } // removes pressed from the result
272
+ fill: { disabled: false } // tombstone — no CSS for disabled, blocks recipe too
273
+ ```
274
+
275
+ ### Resetting Properties with `null` and `false`
276
+
277
+ ```jsx
278
+ const SimpleButton = tasty(Button, {
279
+ styles: {
280
+ fill: null, // discard parent's fill, let recipe fill in
281
+ border: false, // no border at all (tombstone — blocks recipe too)
282
+ },
283
+ });
284
+ ```
285
+
286
+ | Value | Meaning | Recipe fills in? |
287
+ |-------|---------|-----------------|
288
+ | `undefined` | Not provided — parent preserved | N/A |
289
+ | `null` | Intentional unset — parent discarded | Yes |
290
+ | `false` | Tombstone — blocks everything | No |
291
+
292
+ ---
293
+
294
+ ## Advanced States (`@` prefix)
295
+
296
+ | Prefix | Purpose | Example |
297
+ |--------|---------|---------|
298
+ | `@media` | Media queries | `@media(w < 768px)` |
299
+ | `@(...)` | Container queries | `@(panel, w >= 300px)` |
300
+ | `@supports` | Feature/selector support | `@supports(display: grid)` |
301
+ | `@root` | Root element states | `@root(schema=dark)` |
302
+ | `@parent` | Parent/ancestor element states | `@parent(hovered)` |
303
+ | `@own` | Sub-element's own state | `@own(hovered)` |
304
+ | `@starting` | Entry animation | `@starting` |
305
+ | `_` | Fallback floor (always-on, never negated) | `_` |
306
+ | `:is()` | CSS `:is()` structural pseudo-class | `:is(fieldset > label)` |
307
+ | `:has()` | CSS `:has()` relational pseudo-class | `:has(> Icon)` |
308
+ | `:not()` | CSS `:not()` negation (prefer `!:is()`) | `:not(:first-child)` |
309
+ | `:where()` | CSS `:where()` (zero specificity) | `:where(Section)` |
310
+
311
+ > **Specificity.** All state selectors Tasty generates (modifiers, pseudo-classes,
312
+ > `:is()`/`:not()` groups, and `@root` / `@parent` context) are wrapped in
313
+ > `:where(...)` so they carry **zero specificity**. The only specificity anchors
314
+ > are the doubled component class (`.t0.t0`) and sub-element `[data-element]`
315
+ > attributes. This means overlapping rules (e.g. a `_` fallback floor and the
316
+ > states layered over it) resolve purely by **source order** — Tasty emits
317
+ > lower-priority states first and higher-priority states last so the cascade
318
+ > produces the intended winner.
319
+
320
+ ### `@media(...)` — Media Queries
321
+
322
+ Media queries support dimension shorthands and custom unit expansion:
323
+
324
+ | Shorthand | Expands to |
325
+ |-----------|------------|
326
+ | `w` | `width` |
327
+ | `h` | `height` |
328
+
329
+ ```jsx
330
+ fill: {
331
+ '': '#surface',
332
+ '@media(w < 768px)': '#surface-mobile',
333
+ '@media(600px <= w < 1200px)': '#surface-tablet',
334
+ '@media(prefers-color-scheme: dark)': '#surface-dark',
335
+ }
336
+ ```
337
+
338
+ | Tasty syntax | CSS output |
339
+ |--------------|------------|
340
+ | `@media(w < 768px)` | `@media (width < 768px)` |
341
+ | `@media(600px <= w < 1200px)` | `@media (600px <= width < 1200px)` |
342
+ | `@media:print` | `@media print` |
343
+ | `@media:screen` | `@media screen` |
344
+ | `@media(prefers-color-scheme: dark)` | `@media (prefers-color-scheme: dark)` |
345
+ | `@media(prefers-reduced-motion)` | `@media (prefers-reduced-motion)` |
346
+
347
+ Custom units work inside media queries: `@media(w < 40x)` → `@media (width < calc(var(--gap) * 40))`.
348
+
349
+ In practice, define state aliases via `configure({ states })` and use `@mobile` instead of writing the full query in every component.
350
+
351
+ ### `@(...)` — Container Queries
352
+
353
+ 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`.
354
+
355
+ | Shorthand | Expands to |
356
+ |-----------|------------|
357
+ | `w` | `width` |
358
+ | `h` | `height` |
359
+ | `is` | `inline-size` |
360
+ | `bs` | `block-size` |
361
+
362
+ ```jsx
363
+ const Panel = tasty({
364
+ styles: {
365
+ flow: {
366
+ '': 'column',
367
+ '@(layout, w >= 600px)': 'row',
368
+ },
369
+ },
370
+ });
371
+ ```
372
+
373
+ | Tasty syntax | CSS output |
374
+ |--------------|------------|
375
+ | `@(layout, w < 600px)` | `@container layout (width < 600px)` |
376
+ | `@(w < 600px)` | `@container (width < 600px)` |
377
+ | `@(layout, $variant=danger)` | `@container layout style(--variant: "danger")` |
378
+ | `@(layout, $compact)` | `@container layout style(--compact)` |
379
+ | `@(scroll-state(stuck: top))` | `@container scroll-state(stuck: top)` |
380
+ | `@(nav, scroll-state(stuck: top))` | `@container nav scroll-state(stuck: top)` |
381
+
382
+ Container style queries use `$prop` (boolean) or `$prop=value` syntax, which maps to CSS `style(--prop)` or `style(--prop: "value")`.
383
+
384
+ ### `@supports(...)` — Feature Queries
385
+
386
+ Feature queries test CSS property support. Use `$` as the first argument to test selector support:
387
+
388
+ | Tasty syntax | CSS output |
389
+ |--------------|------------|
390
+ | `@supports(display: grid)` | `@supports (display: grid)` |
391
+ | `@supports($, :has(*))` | `@supports selector(:has(*))` |
392
+ | `!@supports(display: grid)` | `@supports (not (display: grid))` |
393
+
394
+ ```jsx
395
+ display: {
396
+ '': 'flex',
397
+ '@supports(display: grid)': 'grid',
398
+ }
399
+ ```
400
+
401
+ ### `_` — Fallback Floor
402
+
403
+ By default Tasty makes states **mutually exclusive**: a higher-priority state
404
+ turns the lower-priority ones off via negation, so exactly one branch applies.
405
+ This relies on `A | !A` always being true. CSS feature/container queries break
406
+ that assumption: `@supports(...)` and `@(...)` queries can be **unknown** (not
407
+ just true/false), and `not(unknown)` is also unknown — so a negated default
408
+ branch silently never applies. The classic case is `scroll-state`: a browser can
409
+ support `container-type: scroll-state` while a specific `scroll-state(...)` query
410
+ is unknown, leaving *no* branch active.
411
+
412
+ The `_` fallback floor solves this. Use `_` as a **standalone key** and its value
413
+ **always applies** as a guaranteed floor: it never receives negation, and
414
+ higher-priority states simply layer over it via the cascade.
415
+
416
+ ```jsx
417
+ inset: {
418
+ _: '0 top',
419
+ '@supports(container-type: scroll-state) & @(scroll-state(scrolled: block-end))':
420
+ '-80x top',
421
+ }
422
+ ```
423
+
424
+ ```css
425
+ .t0.t0 { inset: 0 ...; }
426
+ @container scroll-state(scrolled: block-end) {
427
+ @supports (container-type: scroll-state) {
428
+ .t0.t0 { inset: -80px ...; }
429
+ }
430
+ }
431
+ ```
432
+
433
+ The floor is emitted as a bare rule (no negated `@supports` / container branches),
434
+ so it always applies. When the override matches it wins because it is emitted
435
+ later and all state selectors share the same specificity (see the note on
436
+ `:where()` below).
437
+
438
+ Notes:
439
+
440
+ - `_` is a **standalone key only** — it defines a single map-wide floor and
441
+ cannot be combined with state logic. Keys like `_ & hovered` or `_ | focused`
442
+ are ignored with an `INVALID_FALLBACK_KEY` dev warning.
443
+ - `_` can coexist with the bare `''` default when other states exist: `''` is the
444
+ negated default, `_` is the always-on floor. With only `_` and `''` (no other
445
+ states) the `''` default is redundant — Tasty keeps the `_` value and drops
446
+ `''` with a `REDUNDANT_DEFAULT_STATE` warning.
447
+ - `_` is position-independent: it is always placed at the lowest priority
448
+ regardless of where it appears in the map.
449
+
450
+ #### `_` vs the `''` default
451
+
452
+ In simple maps where every other state is a plain modifier (always cleanly
453
+ on/off), `_` and `''` produce the **same visible result** — the base value shows
454
+ whenever no other state wins. They diverge in three situations, and the root
455
+ cause is always the same: **`''` is mutually exclusive (turned off by negation),
456
+ while `_` is always on (layered underneath).**
457
+
458
+ - **Unknown / invalid branches.** If a higher-priority branch sits behind a query
459
+ that can be *unknown* (`@supports`, container, `scroll-state`) or uses a
460
+ selector the browser drops, the negated `''` default disappears along with it
461
+ (`not(unknown) = unknown`), leaving the property with no rule. The `_` floor
462
+ survives because it is an unconditional bare rule. This is the case `_` exists
463
+ for.
464
+
465
+ - **Empty / "unset" states.** A state can intentionally produce *no* output (an
466
+ empty value) to leave a property unset while that state is active. With `''`
467
+ this works — the default is negated away and nothing replaces it, so the
468
+ property unsets. With `_` the floor can never be turned off, so its value keeps
469
+ applying and the "unset on this state" intent is lost.
470
+
471
+ ```jsx
472
+ // '' : color unsets while loading. '_' : color stays #text while loading.
473
+ color: { '': '#text', loading: '' }
474
+ ```
475
+
476
+ - **States with different output shapes.** Because `_` layers additively, when
477
+ different states emit *different sets* of declarations, the floor's
478
+ declarations bleed through wherever the winning state does not override the
479
+ same property — which can produce inconsistent combinations. A `''` default is
480
+ swapped out cleanly by its mutually-exclusive condition.
481
+
482
+ Rule of thumb: **use `''` for the normal default** (clean mutual exclusivity,
483
+ supports unsetting), and reach for `_` only when a value must survive an
484
+ *unknown* higher-priority branch.
485
+
486
+ ### `@root(...)` — Root Element States
487
+
488
+ Root states generate selectors on the `:root` element. They are useful for theme modes, feature flags, and other page-level conditions:
489
+
490
+ These docs use `data-schema` in examples. If your app standardizes on a different root attribute, keep the same pattern and swap the attribute name consistently in your aliases and selectors.
491
+
492
+ ```jsx
493
+ color: {
494
+ '': '#text',
495
+ '@root(schema=dark)': '#text-on-dark',
496
+ '@root(.premium-user)': '#gold',
497
+ }
498
+ ```
499
+
500
+ | Tasty syntax | CSS selector |
501
+ |--------------|-------------|
502
+ | `@root(schema=dark)` | `:root[data-schema="dark"]` |
503
+ | `@root(hovered)` | `:root[data-hovered]` |
504
+ | `@root(.premium-user)` | `:root.premium-user` |
505
+ | `@root([lang="en"])` | `:root[lang="en"]` |
506
+ | `!@root(schema=dark)` | `:root:not([data-schema="dark"])` |
507
+
508
+ Root conditions are prepended to the component selector: `:root[data-schema="dark"] .t0.t0 { ... }`.
509
+
510
+ ### `@own(...)` — Sub-element's Own State
511
+
512
+ By default, state keys in sub-element styles refer to the root component's state context. Use `@own(...)` when the sub-element should react to its own state:
513
+
514
+ ```jsx
515
+ const Nav = tasty({
516
+ styles: {
517
+ NavItem: {
518
+ color: {
519
+ '': '#text',
520
+ '@own(:hover)': '#primary',
521
+ '@own(:focus-visible)': '#primary',
522
+ 'selected': '#primary', // root-level modifier
523
+ },
524
+ },
525
+ },
526
+ elements: { NavItem: 'a' },
527
+ });
528
+ ```
529
+
530
+ | Tasty syntax (inside sub-element) | CSS output |
531
+ |-----------------------------------|------------|
532
+ | `@own(:hover)` | `:hover` on the sub-element selector |
533
+ | `@own(hovered)` | `[data-hovered]` on the sub-element selector |
534
+ | `@own(theme=dark)` | `[data-theme="dark"]` on the sub-element selector |
535
+
536
+ `@own()` is only valid inside sub-element styles. Using it on root styles emits a warning and is treated as a regular modifier.
537
+
538
+ ### `@starting` — Entry Animation
539
+
540
+ Wraps the rule in `@starting-style`, enabling CSS entry animations for elements as they appear in the DOM:
541
+
542
+ ```jsx
543
+ const FadeIn = tasty({
544
+ styles: {
545
+ opacity: { '': '1', '@starting': '0' },
546
+ transform: { '': 'scale(1)', '@starting': 'scale(0.95)' },
547
+ transition: 'opacity 0.3s, translate 0.3s',
548
+ },
549
+ });
550
+ ```
551
+
552
+ | Tasty syntax | CSS output |
553
+ |--------------|------------|
554
+ | `@starting` | `@starting-style { .t0.t0 { ... } }` |
555
+
556
+ ### `@parent(...)` — Parent Element States
557
+
558
+ Style based on ancestor element attributes. Uses `:is([selector] *)` / `:not([selector] *)` for symmetric, composable parent checks. Boolean logic (`&`, `|`, `!`, `^`) is supported inside `@parent()`.
559
+
560
+ ```jsx
561
+ const Highlight = tasty({
562
+ styles: {
563
+ fill: {
564
+ '': '#white',
565
+ '@parent(hovered)': '#gray.05', // Any ancestor has [data-hovered]
566
+ '@parent(theme=dark, >)': '#dark-02', // Direct parent has [data-theme="dark"]
567
+ },
568
+ },
569
+ });
570
+ ```
571
+
572
+ | Syntax | CSS Output |
573
+ |--------|------------|
574
+ | `@parent(hovered)` | `:is([data-hovered] *)` |
575
+ | `!@parent(hovered)` | `:not([data-hovered] *)` |
576
+ | `@parent(hovered, >)` | `:is([data-hovered] > *)` (direct parent) |
577
+ | `@parent(.active)` | `:is(.active *)` |
578
+ | `@parent(hovered & focused)` | `:is([data-hovered][data-focused] *)` (same ancestor) |
579
+ | `@parent(hovered) & @parent(focused)` | `:is([data-hovered] *):is([data-focused] *)` (independent ancestors) |
580
+ | `@parent(hovered \| focused)` | `:is([data-hovered] *, [data-focused] *)` (OR inside single wrapper) |
581
+
582
+ For sub-elements, the parent check applies to the root element's ancestors:
583
+
584
+ ```jsx
585
+ const Card = tasty({
586
+ styles: {
587
+ Label: {
588
+ color: {
589
+ '': '#text',
590
+ '@parent(hovered)': '#primary',
591
+ },
592
+ },
593
+ },
594
+ });
595
+ // → .t0.t0:is([data-hovered] *) [data-element="Label"]
596
+ ```
597
+
598
+ ### `:is()`, `:has()` — CSS Structural Pseudo-classes
599
+
600
+ Use CSS structural pseudo-classes directly in state keys. Capitalized words become `[data-element="..."]` selectors; lowercase words are HTML tags. A trailing combinator (`>`, `+`, `~`) is auto-completed with `*`.
601
+
602
+ `:where()` and `:not()` are also supported but rarely needed — use `:is()` and `!` negation instead.
603
+
604
+ > **Performance warning:** CSS structural pseudo-classes — especially `:has()` — can be costly for the browser to evaluate because they require inspecting the DOM tree beyond the matched element. Tasty already provides a rich, purpose-built state system (`@parent()`, `@own()`, modifiers, boolean logic) that covers the vast majority of use cases without the performance trade-off. **Prefer Tasty's built-in mechanisms and treat `:has()` / `:is()` as a last resort** for conditions that cannot be expressed any other way.
605
+
606
+ ```jsx
607
+ const Card = tasty({
608
+ styles: {
609
+ display: {
610
+ '': 'block',
611
+ ':has(> Icon)': 'grid', // has Icon as direct child
612
+ ':has(+ Icon)': 'grid', // immediately followed by an Icon sibling
613
+ ':has(~ Icon)': 'grid', // has an Icon sibling somewhere after
614
+ ':has(Icon +)': 'grid', // immediately preceded by an Icon sibling (auto-completes to `Icon + *`)
615
+ ':has(Icon ~)': 'grid', // has an Icon sibling somewhere before (auto-completes to `Icon ~ *`)
616
+ ':is(fieldset > label)': 'inline', // is a label inside a fieldset (HTML tags)
617
+ '!:has(> Icon)': 'flex', // negation: no Icon child
618
+ },
619
+ },
620
+ });
621
+ ```
622
+
623
+ | Syntax | CSS Output | Meaning |
624
+ |--------|------------|---------|
625
+ | `:has(> Icon)` | `:has(> [data-element="Icon"])` | Has Icon as direct child |
626
+ | `:has(+ Icon)` | `:has(+ [data-element="Icon"])` | Immediately followed by an Icon sibling |
627
+ | `:has(~ Icon)` | `:has(~ [data-element="Icon"])` | Has an Icon sibling somewhere after |
628
+ | `:has(Icon +)` | `:has([data-element="Icon"] + *)` | Immediately preceded by an Icon sibling |
629
+ | `:has(Icon ~)` | `:has([data-element="Icon"] ~ *)` | Has an Icon sibling somewhere before |
630
+ | `:has(>)` | `:has(> *)` | Has any direct child |
631
+ | `:is(> Field + input)` | `:is(> [data-element="Field"] + input)` | Structural match |
632
+ | `:has(button)` | `:has(button)` | HTML tag (lowercase, unchanged) |
633
+ | `!:has(> Icon)` | `:not(:has(> [data-element="Icon"]))` | Negation (use `!`) |
634
+ | `!:is(Panel)` | `:not([data-element="Panel"])` | Negation (use `!:is`) |
635
+
636
+ Combine with other states using boolean logic (`&`, `|`, `!`, `^`):
637
+
638
+ ```jsx
639
+ ':has(> Icon) & hovered' // AND: structural + data attribute
640
+ '@parent(hovered) & :has(> Icon)' // AND: parent check + structural
641
+ ':has(> Icon) | :has(> Button)' // OR: either sub-element present
642
+ ':has(> Icon) ^ :has(> Button)' // XOR: exactly one present
643
+ ```
644
+
645
+ > **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.
646
+
647
+ ---
648
+
649
+ ## Keyframes
650
+
651
+ Define animations inline using the `@keyframes` key in styles:
652
+
653
+ ```jsx
654
+ const Pulse = tasty({
655
+ styles: {
656
+ animation: 'pulse 2s infinite',
657
+ '@keyframes': {
658
+ pulse: {
659
+ '0%, 100%': { transform: 'scale(1)' },
660
+ '50%': { transform: 'scale(1.05)' },
661
+ },
662
+ },
663
+ },
664
+ });
665
+ ```
666
+
667
+ ---
668
+
669
+ ## Properties (`@property`)
670
+
671
+ CSS cannot transition or animate custom properties unless the browser knows their type. Tasty solves this automatically — when you assign a concrete value to a custom property, the type is inferred and a CSS `@property` rule is registered behind the scenes:
672
+
673
+ ```jsx
674
+ const AnimatedGradient = tasty({
675
+ styles: {
676
+ '$gradient-angle': '0deg',
677
+ '#theme': 'okhst(280 80% 50%)',
678
+ background: 'linear-gradient($gradient-angle, #theme, transparent)',
679
+ transition: '$$gradient-angle 0.3s, ##theme 0.3s',
680
+ },
681
+ });
682
+ ```
683
+
684
+ Here `$gradient-angle: '0deg'` is detected as `<angle>` and `#theme` as `<color>` (via the `#name` naming convention), so both transitions work without any manual `@property` declarations. Numeric types (`<number>`, `<length>`, `<percentage>`, `<angle>`, `<time>`) are inferred from values; `<color>` is inferred from `#name` tokens.
685
+
686
+ Use explicit `@properties` when you need non-default settings like `inherits: false`:
687
+
688
+ ```jsx
689
+ '@properties': {
690
+ '$gradient-angle': { syntax: '<angle>', inherits: false, initialValue: '0deg' },
691
+ },
692
+ ```
693
+
694
+ ---
695
+
696
+ ## Font Face (`@fontFace`)
697
+
698
+ Register custom fonts directly inside a `styles` object. Keys are font-family names, values are descriptor objects (or arrays of them for multiple weights/styles).
699
+
700
+ ```ts
701
+ const Heading = tasty({
702
+ styles: {
703
+ '@fontFace': {
704
+ 'Brand Sans': {
705
+ src: 'url("/fonts/brand-sans.woff2") format("woff2")',
706
+ fontDisplay: 'swap',
707
+ },
708
+ },
709
+ fontFamily: '"Brand Sans", sans-serif',
710
+ },
711
+ });
712
+ ```
713
+
714
+ ### Multiple weights
715
+
716
+ Supply an array to register several variants of the same family:
717
+
718
+ ```ts
719
+ '@fontFace': {
720
+ 'Brand Sans': [
721
+ { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
722
+ { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
723
+ ],
724
+ }
725
+ ```
726
+
727
+ ### Supported descriptors
728
+
729
+ | Descriptor | CSS property | Type |
730
+ |---|---|---|
731
+ | `src` (required) | `src` | `string` |
732
+ | `fontWeight` | `font-weight` | `string \| number` |
733
+ | `fontStyle` | `font-style` | `string` |
734
+ | `fontStretch` | `font-stretch` | `string` |
735
+ | `fontDisplay` | `font-display` | `'auto' \| 'block' \| 'swap' \| 'fallback' \| 'optional'` |
736
+ | `unicodeRange` | `unicode-range` | `string` |
737
+ | `ascentOverride` | `ascent-override` | `string` |
738
+ | `descentOverride` | `descent-override` | `string` |
739
+ | `lineGapOverride` | `line-gap-override` | `string` |
740
+ | `sizeAdjust` | `size-adjust` | `string` |
741
+ | `fontFeatureSettings` | `font-feature-settings` | `string` |
742
+ | `fontVariationSettings` | `font-variation-settings` | `string` |
743
+
744
+ > Font-face rules are permanent — they are injected once and never cleaned up, matching how browsers handle `@font-face`.
745
+
746
+ ---
747
+
748
+ ## Counter Style (`@counterStyle`)
749
+
750
+ Define custom list markers via the CSS `@counter-style` at-rule. Keys are counter-style names, values are descriptor objects.
751
+
752
+ ```ts
753
+ const EmojiList = tasty({
754
+ tag: 'ol',
755
+ styles: {
756
+ '@counterStyle': {
757
+ thumbs: {
758
+ system: 'cyclic',
759
+ symbols: '"👍"',
760
+ suffix: '" "',
761
+ },
762
+ },
763
+ listStyleType: 'thumbs',
764
+ },
765
+ });
766
+ ```
767
+
768
+ ### Supported descriptors
769
+
770
+ | Descriptor | CSS property | Type |
771
+ |---|---|---|
772
+ | `system` (required) | `system` | `'cyclic' \| 'numeric' \| 'alphabetic' \| 'symbolic' \| 'additive' \| 'fixed' \| string` |
773
+ | `symbols` | `symbols` | `string` |
774
+ | `additiveSymbols` | `additive-symbols` | `string` |
775
+ | `prefix` | `prefix` | `string` |
776
+ | `suffix` | `suffix` | `string` |
777
+ | `negative` | `negative` | `string` |
778
+ | `range` | `range` | `string` |
779
+ | `pad` | `pad` | `string` |
780
+ | `fallback` | `fallback` | `string` |
781
+ | `speakAs` | `speak-as` | `string` |
782
+
783
+ > Counter-style rules are permanent — they are injected once and never cleaned up, matching how browsers handle `@counter-style`.
784
+
785
+ ---
786
+
787
+ ## Style Properties
788
+
789
+ For a complete reference of all enhanced style properties — syntax, values, modifiers, and recommendations — see **[Style Properties Reference](styles.md)**.
790
+
791
+ ---
792
+
793
+ ## Learn more
794
+
795
+ - **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
796
+ - **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
797
+ - **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
798
+ - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
799
+ - **[Zero Runtime (tastyStatic)](tasty-static.md)** — Build-time static styling with Babel plugin