@tenphi/tasty 0.0.0-snapshot.db103fd → 0.0.0-snapshot.dd9840e

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 (334) hide show
  1. package/README.md +29 -23
  2. package/dist/{ssr/async-storage.js → async-storage-B7_o6FKt.js} +16 -6
  3. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  4. package/dist/{ssr/collector.js → collector-DrgDE7QB.js} +36 -32
  5. package/dist/collector-DrgDE7QB.js.map +1 -0
  6. package/dist/{ssr/collector.d.ts → collector-LuU1vZ68.d.ts} +11 -15
  7. package/dist/config-_aQ_PZ-P.js +10131 -0
  8. package/dist/config-_aQ_PZ-P.js.map +1 -0
  9. package/dist/config-vuCRkBWX.d.ts +884 -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-BqO8pplb.js +1592 -0
  15. package/dist/core-BqO8pplb.js.map +1 -0
  16. package/dist/{zero/extractor.js → css-writer-D--REwtp.js} +74 -11
  17. package/dist/css-writer-D--REwtp.js.map +1 -0
  18. package/dist/{ssr/format-global-rules.js → format-global-rules-Dbc_1tc3.js} +2 -2
  19. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  20. package/dist/format-rules-xwteB7a1.js +143 -0
  21. package/dist/format-rules-xwteB7a1.js.map +1 -0
  22. package/dist/hydrate-BvPT4ndL.js +45 -0
  23. package/dist/hydrate-BvPT4ndL.js.map +1 -0
  24. package/dist/index-dUtwpOux.d.ts +1266 -0
  25. package/dist/index-h0MibUBL.d.ts +1602 -0
  26. package/dist/index.d.ts +5 -50
  27. package/dist/index.js +732 -35
  28. package/dist/index.js.map +1 -0
  29. package/dist/keyframes-ClPFWy33.js +587 -0
  30. package/dist/keyframes-ClPFWy33.js.map +1 -0
  31. package/dist/{utils/merge-styles.js → merge-styles-BUQsEpbv.js} +3 -4
  32. package/dist/merge-styles-BUQsEpbv.js.map +1 -0
  33. package/dist/{utils/merge-styles.d.ts → merge-styles-CtDJMhpJ.d.ts} +3 -3
  34. package/dist/{utils/resolve-recipes.js → resolve-recipes-C0-AMzCz.js} +4 -6
  35. package/dist/resolve-recipes-C0-AMzCz.js.map +1 -0
  36. package/dist/ssr/astro-client.js +19 -0
  37. package/dist/ssr/astro-client.js.map +1 -0
  38. package/dist/ssr/astro-middleware.d.ts +15 -0
  39. package/dist/ssr/astro-middleware.js +19 -0
  40. package/dist/ssr/astro-middleware.js.map +1 -0
  41. package/dist/ssr/astro.d.ts +89 -10
  42. package/dist/ssr/astro.js +115 -30
  43. package/dist/ssr/astro.js.map +1 -1
  44. package/dist/ssr/index.d.ts +44 -5
  45. package/dist/ssr/index.js +6 -7
  46. package/dist/ssr/index.js.map +1 -1
  47. package/dist/ssr/next.d.ts +5 -4
  48. package/dist/ssr/next.js +16 -10
  49. package/dist/ssr/next.js.map +1 -1
  50. package/dist/static/index.d.ts +91 -5
  51. package/dist/static/index.js +49 -3
  52. package/dist/static/index.js.map +1 -0
  53. package/dist/zero/babel.d.ts +7 -108
  54. package/dist/zero/babel.js +45 -17
  55. package/dist/zero/babel.js.map +1 -1
  56. package/dist/zero/index.d.ts +67 -3
  57. package/dist/zero/index.js +1 -2
  58. package/docs/README.md +4 -4
  59. package/docs/adoption.md +5 -3
  60. package/docs/comparison.md +24 -25
  61. package/docs/configuration.md +69 -1
  62. package/docs/debug.md +11 -9
  63. package/docs/design-system.md +22 -10
  64. package/docs/dsl.md +23 -8
  65. package/docs/getting-started.md +10 -10
  66. package/docs/injector.md +43 -27
  67. package/docs/methodology.md +52 -3
  68. package/docs/{PIPELINE.md → pipeline.md} +204 -50
  69. package/docs/{runtime.md → react-api.md} +104 -32
  70. package/docs/ssr.md +139 -81
  71. package/docs/styles.md +14 -0
  72. package/docs/tasty-static.md +14 -2
  73. package/package.json +17 -10
  74. package/dist/_virtual/_rolldown/runtime.js +0 -7
  75. package/dist/chunks/cacheKey.js +0 -77
  76. package/dist/chunks/cacheKey.js.map +0 -1
  77. package/dist/chunks/definitions.d.ts +0 -37
  78. package/dist/chunks/definitions.js +0 -258
  79. package/dist/chunks/definitions.js.map +0 -1
  80. package/dist/chunks/index.d.ts +0 -1
  81. package/dist/chunks/renderChunk.d.ts +0 -1
  82. package/dist/chunks/renderChunk.js +0 -59
  83. package/dist/chunks/renderChunk.js.map +0 -1
  84. package/dist/config.d.ts +0 -366
  85. package/dist/config.js +0 -503
  86. package/dist/config.js.map +0 -1
  87. package/dist/counter-style/index.js +0 -51
  88. package/dist/counter-style/index.js.map +0 -1
  89. package/dist/debug.d.ts +0 -89
  90. package/dist/debug.js +0 -453
  91. package/dist/debug.js.map +0 -1
  92. package/dist/font-face/index.js +0 -63
  93. package/dist/font-face/index.js.map +0 -1
  94. package/dist/hooks/index.d.ts +0 -7
  95. package/dist/hooks/resolve-ssr-collector.js +0 -14
  96. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  97. package/dist/hooks/useCounterStyle.d.ts +0 -50
  98. package/dist/hooks/useCounterStyle.js +0 -46
  99. package/dist/hooks/useCounterStyle.js.map +0 -1
  100. package/dist/hooks/useFontFace.d.ts +0 -43
  101. package/dist/hooks/useFontFace.js +0 -70
  102. package/dist/hooks/useFontFace.js.map +0 -1
  103. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  104. package/dist/hooks/useGlobalStyles.js +0 -78
  105. package/dist/hooks/useGlobalStyles.js.map +0 -1
  106. package/dist/hooks/useKeyframes.d.ts +0 -56
  107. package/dist/hooks/useKeyframes.js +0 -64
  108. package/dist/hooks/useKeyframes.js.map +0 -1
  109. package/dist/hooks/useProperty.d.ts +0 -79
  110. package/dist/hooks/useProperty.js +0 -109
  111. package/dist/hooks/useProperty.js.map +0 -1
  112. package/dist/hooks/useRawCSS.d.ts +0 -53
  113. package/dist/hooks/useRawCSS.js +0 -35
  114. package/dist/hooks/useRawCSS.js.map +0 -1
  115. package/dist/hooks/useStyles.d.ts +0 -45
  116. package/dist/hooks/useStyles.js +0 -237
  117. package/dist/hooks/useStyles.js.map +0 -1
  118. package/dist/injector/index.d.ts +0 -183
  119. package/dist/injector/index.js +0 -179
  120. package/dist/injector/index.js.map +0 -1
  121. package/dist/injector/injector.d.ts +0 -166
  122. package/dist/injector/injector.js +0 -464
  123. package/dist/injector/injector.js.map +0 -1
  124. package/dist/injector/sheet-manager.d.ts +0 -136
  125. package/dist/injector/sheet-manager.js +0 -733
  126. package/dist/injector/sheet-manager.js.map +0 -1
  127. package/dist/injector/types.d.ts +0 -204
  128. package/dist/keyframes/index.js +0 -206
  129. package/dist/keyframes/index.js.map +0 -1
  130. package/dist/parser/classify.js +0 -319
  131. package/dist/parser/classify.js.map +0 -1
  132. package/dist/parser/const.js +0 -49
  133. package/dist/parser/const.js.map +0 -1
  134. package/dist/parser/lru.js +0 -109
  135. package/dist/parser/lru.js.map +0 -1
  136. package/dist/parser/parser.d.ts +0 -25
  137. package/dist/parser/parser.js +0 -115
  138. package/dist/parser/parser.js.map +0 -1
  139. package/dist/parser/tokenizer.js +0 -69
  140. package/dist/parser/tokenizer.js.map +0 -1
  141. package/dist/parser/types.d.ts +0 -51
  142. package/dist/parser/types.js +0 -46
  143. package/dist/parser/types.js.map +0 -1
  144. package/dist/pipeline/conditions.d.ts +0 -134
  145. package/dist/pipeline/conditions.js +0 -406
  146. package/dist/pipeline/conditions.js.map +0 -1
  147. package/dist/pipeline/exclusive.js +0 -230
  148. package/dist/pipeline/exclusive.js.map +0 -1
  149. package/dist/pipeline/index.d.ts +0 -55
  150. package/dist/pipeline/index.js +0 -708
  151. package/dist/pipeline/index.js.map +0 -1
  152. package/dist/pipeline/materialize.js +0 -1103
  153. package/dist/pipeline/materialize.js.map +0 -1
  154. package/dist/pipeline/parseStateKey.d.ts +0 -15
  155. package/dist/pipeline/parseStateKey.js +0 -446
  156. package/dist/pipeline/parseStateKey.js.map +0 -1
  157. package/dist/pipeline/simplify.js +0 -515
  158. package/dist/pipeline/simplify.js.map +0 -1
  159. package/dist/pipeline/warnings.js +0 -18
  160. package/dist/pipeline/warnings.js.map +0 -1
  161. package/dist/plugins/index.d.ts +0 -2
  162. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  163. package/dist/plugins/okhsl-plugin.js +0 -97
  164. package/dist/plugins/okhsl-plugin.js.map +0 -1
  165. package/dist/plugins/types.d.ts +0 -76
  166. package/dist/properties/index.js +0 -222
  167. package/dist/properties/index.js.map +0 -1
  168. package/dist/properties/property-type-resolver.d.ts +0 -24
  169. package/dist/properties/property-type-resolver.js +0 -90
  170. package/dist/properties/property-type-resolver.js.map +0 -1
  171. package/dist/ssr/async-storage.d.ts +0 -17
  172. package/dist/ssr/async-storage.js.map +0 -1
  173. package/dist/ssr/collect-auto-properties.js +0 -39
  174. package/dist/ssr/collect-auto-properties.js.map +0 -1
  175. package/dist/ssr/collector.js.map +0 -1
  176. package/dist/ssr/context.d.ts +0 -8
  177. package/dist/ssr/context.js +0 -13
  178. package/dist/ssr/context.js.map +0 -1
  179. package/dist/ssr/format-global-rules.js.map +0 -1
  180. package/dist/ssr/format-keyframes.js +0 -69
  181. package/dist/ssr/format-keyframes.js.map +0 -1
  182. package/dist/ssr/format-property.js +0 -49
  183. package/dist/ssr/format-property.js.map +0 -1
  184. package/dist/ssr/format-rules.js +0 -73
  185. package/dist/ssr/format-rules.js.map +0 -1
  186. package/dist/ssr/hydrate.d.ts +0 -22
  187. package/dist/ssr/hydrate.js +0 -49
  188. package/dist/ssr/hydrate.js.map +0 -1
  189. package/dist/ssr/ssr-collector-ref.js +0 -12
  190. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  191. package/dist/states/index.d.ts +0 -49
  192. package/dist/states/index.js +0 -170
  193. package/dist/states/index.js.map +0 -1
  194. package/dist/static/tastyStatic.d.ts +0 -46
  195. package/dist/static/tastyStatic.js +0 -30
  196. package/dist/static/tastyStatic.js.map +0 -1
  197. package/dist/static/types.d.ts +0 -49
  198. package/dist/static/types.js +0 -24
  199. package/dist/static/types.js.map +0 -1
  200. package/dist/styles/align.d.ts +0 -15
  201. package/dist/styles/align.js +0 -14
  202. package/dist/styles/align.js.map +0 -1
  203. package/dist/styles/border.d.ts +0 -25
  204. package/dist/styles/border.js +0 -113
  205. package/dist/styles/border.js.map +0 -1
  206. package/dist/styles/color.d.ts +0 -14
  207. package/dist/styles/color.js +0 -26
  208. package/dist/styles/color.js.map +0 -1
  209. package/dist/styles/createStyle.js +0 -79
  210. package/dist/styles/createStyle.js.map +0 -1
  211. package/dist/styles/dimension.js +0 -96
  212. package/dist/styles/dimension.js.map +0 -1
  213. package/dist/styles/display.d.ts +0 -37
  214. package/dist/styles/display.js +0 -66
  215. package/dist/styles/display.js.map +0 -1
  216. package/dist/styles/fade.d.ts +0 -15
  217. package/dist/styles/fade.js +0 -57
  218. package/dist/styles/fade.js.map +0 -1
  219. package/dist/styles/fill.d.ts +0 -42
  220. package/dist/styles/fill.js +0 -51
  221. package/dist/styles/fill.js.map +0 -1
  222. package/dist/styles/flow.d.ts +0 -16
  223. package/dist/styles/flow.js +0 -12
  224. package/dist/styles/flow.js.map +0 -1
  225. package/dist/styles/gap.d.ts +0 -31
  226. package/dist/styles/gap.js +0 -36
  227. package/dist/styles/gap.js.map +0 -1
  228. package/dist/styles/height.d.ts +0 -17
  229. package/dist/styles/height.js +0 -19
  230. package/dist/styles/height.js.map +0 -1
  231. package/dist/styles/index.d.ts +0 -1
  232. package/dist/styles/index.js +0 -8
  233. package/dist/styles/index.js.map +0 -1
  234. package/dist/styles/inset.d.ts +0 -52
  235. package/dist/styles/inset.js +0 -149
  236. package/dist/styles/inset.js.map +0 -1
  237. package/dist/styles/justify.d.ts +0 -15
  238. package/dist/styles/justify.js +0 -14
  239. package/dist/styles/justify.js.map +0 -1
  240. package/dist/styles/list.d.ts +0 -16
  241. package/dist/styles/list.js +0 -98
  242. package/dist/styles/list.js.map +0 -1
  243. package/dist/styles/margin.d.ts +0 -24
  244. package/dist/styles/margin.js +0 -103
  245. package/dist/styles/margin.js.map +0 -1
  246. package/dist/styles/outline.d.ts +0 -29
  247. package/dist/styles/outline.js +0 -64
  248. package/dist/styles/outline.js.map +0 -1
  249. package/dist/styles/padding.d.ts +0 -24
  250. package/dist/styles/padding.js +0 -103
  251. package/dist/styles/padding.js.map +0 -1
  252. package/dist/styles/predefined.d.ts +0 -71
  253. package/dist/styles/predefined.js +0 -237
  254. package/dist/styles/predefined.js.map +0 -1
  255. package/dist/styles/preset.d.ts +0 -52
  256. package/dist/styles/preset.js +0 -126
  257. package/dist/styles/preset.js.map +0 -1
  258. package/dist/styles/radius.d.ts +0 -12
  259. package/dist/styles/radius.js +0 -71
  260. package/dist/styles/radius.js.map +0 -1
  261. package/dist/styles/scrollbar.d.ts +0 -25
  262. package/dist/styles/scrollbar.js +0 -46
  263. package/dist/styles/scrollbar.js.map +0 -1
  264. package/dist/styles/shadow.d.ts +0 -14
  265. package/dist/styles/shadow.js +0 -23
  266. package/dist/styles/shadow.js.map +0 -1
  267. package/dist/styles/transition.d.ts +0 -14
  268. package/dist/styles/transition.js +0 -157
  269. package/dist/styles/transition.js.map +0 -1
  270. package/dist/styles/types.d.ts +0 -549
  271. package/dist/styles/width.d.ts +0 -17
  272. package/dist/styles/width.js +0 -19
  273. package/dist/styles/width.js.map +0 -1
  274. package/dist/tasty.d.ts +0 -119
  275. package/dist/tasty.js +0 -231
  276. package/dist/tasty.js.map +0 -1
  277. package/dist/types.d.ts +0 -184
  278. package/dist/utils/cache-wrapper.js +0 -21
  279. package/dist/utils/cache-wrapper.js.map +0 -1
  280. package/dist/utils/case-converter.js +0 -8
  281. package/dist/utils/case-converter.js.map +0 -1
  282. package/dist/utils/color-math.d.ts +0 -46
  283. package/dist/utils/color-math.js +0 -749
  284. package/dist/utils/color-math.js.map +0 -1
  285. package/dist/utils/color-space.d.ts +0 -5
  286. package/dist/utils/color-space.js +0 -228
  287. package/dist/utils/color-space.js.map +0 -1
  288. package/dist/utils/colors.d.ts +0 -5
  289. package/dist/utils/colors.js +0 -10
  290. package/dist/utils/colors.js.map +0 -1
  291. package/dist/utils/css-types.d.ts +0 -7
  292. package/dist/utils/dotize.d.ts +0 -26
  293. package/dist/utils/dotize.js +0 -122
  294. package/dist/utils/dotize.js.map +0 -1
  295. package/dist/utils/filter-base-props.d.ts +0 -15
  296. package/dist/utils/filter-base-props.js +0 -45
  297. package/dist/utils/filter-base-props.js.map +0 -1
  298. package/dist/utils/get-display-name.d.ts +0 -7
  299. package/dist/utils/get-display-name.js +0 -10
  300. package/dist/utils/get-display-name.js.map +0 -1
  301. package/dist/utils/has-keys.js +0 -13
  302. package/dist/utils/has-keys.js.map +0 -1
  303. package/dist/utils/is-dev-env.js +0 -19
  304. package/dist/utils/is-dev-env.js.map +0 -1
  305. package/dist/utils/is-valid-element-type.js +0 -15
  306. package/dist/utils/is-valid-element-type.js.map +0 -1
  307. package/dist/utils/merge-styles.js.map +0 -1
  308. package/dist/utils/mod-attrs.d.ts +0 -6
  309. package/dist/utils/mod-attrs.js +0 -20
  310. package/dist/utils/mod-attrs.js.map +0 -1
  311. package/dist/utils/process-tokens.d.ts +0 -21
  312. package/dist/utils/process-tokens.js +0 -90
  313. package/dist/utils/process-tokens.js.map +0 -1
  314. package/dist/utils/resolve-recipes.d.ts +0 -17
  315. package/dist/utils/resolve-recipes.js.map +0 -1
  316. package/dist/utils/selector-transform.js +0 -32
  317. package/dist/utils/selector-transform.js.map +0 -1
  318. package/dist/utils/string.js +0 -8
  319. package/dist/utils/string.js.map +0 -1
  320. package/dist/utils/styles.d.ts +0 -99
  321. package/dist/utils/styles.js +0 -220
  322. package/dist/utils/styles.js.map +0 -1
  323. package/dist/utils/typography.d.ts +0 -47
  324. package/dist/utils/typography.js +0 -51
  325. package/dist/utils/typography.js.map +0 -1
  326. package/dist/utils/warnings.d.ts +0 -16
  327. package/dist/utils/warnings.js +0 -16
  328. package/dist/utils/warnings.js.map +0 -1
  329. package/dist/zero/css-writer.d.ts +0 -45
  330. package/dist/zero/css-writer.js +0 -73
  331. package/dist/zero/css-writer.js.map +0 -1
  332. package/dist/zero/extractor.d.ts +0 -24
  333. package/dist/zero/extractor.js.map +0 -1
  334. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
package/docs/debug.md CHANGED
@@ -12,6 +12,8 @@ In development mode (`isDevEnv()` returns `true`), `tastyDebug` is automatically
12
12
 
13
13
  All methods **log to the console by default**. Pass `{ raw: true }` to suppress logging and only return data.
14
14
 
15
+ > **Note (2.0.0+):** Class names use a content-addressed base36 hash format (e.g. `t3a5f`) instead of the previous sequential `t{number}` format. Cross-environment hydration reads the rendered class list from `window.__TASTY__` (the legacy `window.__TASTY_SSR_CACHE__` global was removed in 2.0.0).
16
+
15
17
  ---
16
18
 
17
19
  ## Quick Start
@@ -69,8 +71,8 @@ Retrieves CSS text for a given target. Logs the result with rule count and size.
69
71
  | `'unused'` | CSS with refCount = 0 (cached but not used) |
70
72
  | `'global'` | Only global CSS (from `injectGlobal`) |
71
73
  | `'page'` | All CSS on the page (including non-tasty) |
72
- | `'t42'` | CSS for a specific tasty class |
73
- | `['t0', 't5']` | CSS for multiple tasty classes |
74
+ | `'t3a5f'` | CSS for a specific tasty class (class names are `t` + base36 hash) |
75
+ | `['t3a5f', 't9k2']` | CSS for multiple tasty classes |
74
76
  | `'.my-button'` | CSS affecting a DOM element (by selector) |
75
77
  | `element` | CSS affecting a DOM element (by reference) |
76
78
 
@@ -88,11 +90,11 @@ interface CssOptions extends DebugOptions {
88
90
  tastyDebug.css('active');
89
91
 
90
92
  // Specific class, silent
91
- const css = tastyDebug.css('t42', { raw: true });
93
+ const css = tastyDebug.css('t3a5f', { raw: true });
92
94
 
93
95
  // Compare original vs browser-parsed CSS (dev mode only)
94
- tastyDebug.css('t42'); // live CSSOM
95
- tastyDebug.css('t42', { source: true }); // original output
96
+ tastyDebug.css('t3a5f'); // live CSSOM
97
+ tastyDebug.css('t3a5f', { source: true }); // original output
96
98
 
97
99
  // Shadow DOM
98
100
  tastyDebug.css('all', { root: shadowRoot });
@@ -125,11 +127,11 @@ interface ChunkInfo {
125
127
  ```typescript
126
128
  tastyDebug.inspect('.my-card');
127
129
  // Logs: inspect div — 3 classes, 5 rules, 1.2KB
128
- // Chunks: t3→appearance, t7→font, t12→dimension
130
+ // Chunks: t3a5f→appearance, t9k2→font, tb71→dimension
129
131
 
130
132
  // Silent
131
133
  const result = tastyDebug.inspect('.my-card', { raw: true });
132
- console.log(result.classes); // ['t3', 't7', 't12']
134
+ console.log(result.classes); // ['t3a5f', 't9k2', 'tb71']
133
135
  console.log(result.rules); // 5
134
136
  ```
135
137
 
@@ -291,10 +293,10 @@ tastyDebug.summary({ root: shadowRoot });
291
293
  tastyDebug.inspect('.my-button');
292
294
 
293
295
  // 2. See CSS for a specific class
294
- tastyDebug.css('t3');
296
+ tastyDebug.css('t3a5f');
295
297
 
296
298
  // 3. Compare original vs browser-parsed (dev mode)
297
- tastyDebug.css('t3', { source: true });
299
+ tastyDebug.css('t3a5f', { source: true });
298
300
  ```
299
301
 
300
302
  ### Checking cache efficiency
@@ -84,25 +84,37 @@ configure({
84
84
 
85
85
  ### Typography presets
86
86
 
87
- Use `generateTypographyTokens()` to create typography tokens from your own presets, then pass them to `configure({ tokens })`:
87
+ Pass typography presets directly to `configure()` — they are converted to tokens automatically:
88
88
 
89
89
  ```tsx
90
- import { configure, generateTypographyTokens } from '@tenphi/tasty';
90
+ import { configure } from '@tenphi/tasty';
91
91
 
92
- const typographyTokens = generateTypographyTokens({
93
- h1: { fontSize: '2rem', lineHeight: '1.2', letterSpacing: '-0.02em', fontWeight: 700 },
94
- t2: { fontSize: '0.875rem', lineHeight: '1.5', letterSpacing: 'normal', fontWeight: 400 },
92
+ configure({
93
+ presets: {
94
+ h1: { fontSize: '2rem', lineHeight: '1.2', letterSpacing: '-0.02em', fontWeight: 700 },
95
+ t2: { fontSize: '0.875rem', lineHeight: '1.5', letterSpacing: 'normal', fontWeight: 400 },
96
+ },
95
97
  });
98
+ ```
99
+
100
+ Preset values support state maps for responsive or theme-aware typography:
96
101
 
102
+ ```tsx
97
103
  configure({
98
- tokens: {
99
- ...typographyTokens,
104
+ presets: {
105
+ t2: {
106
+ fontSize: '0.875rem',
107
+ lineHeight: '1.5',
108
+ fontWeight: { '': 400, '@dark': 300 },
109
+ },
100
110
  },
101
111
  });
102
112
  ```
103
113
 
104
114
  Then use `preset: 'h1'` or `preset: 't2'` in any component's styles.
105
115
 
116
+ > You can also call `generateTypographyTokens()` manually and spread the result into `tokens` for more control — `presets` is just a shorthand.
117
+
106
118
  ### Registering brand fonts
107
119
 
108
120
  Register your design system's custom fonts via `configure({ fontFace })` so every component can reference them:
@@ -334,7 +346,7 @@ Usage:
334
346
 
335
347
  Sub-elements share the root component's state context by default. A `disabled` modifier on `<Card>` affects `Title`, `Content`, and `Footer` styles automatically — no prop drilling. For the full mental model, see [Methodology — Component architecture](methodology.md#component-architecture-root--sub-elements).
336
348
 
337
- For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [Runtime API — Sub-element Styling](runtime.md#sub-element-styling).
349
+ For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [React API — Sub-element Styling](react-api.md#sub-element-styling).
338
350
 
339
351
  ---
340
352
 
@@ -404,7 +416,7 @@ ds/
404
416
  index.ts # Recipe definitions (imported by config.ts)
405
417
  tokens/
406
418
  colors.ts # Color token definitions
407
- typography.ts # Typography presets via generateTypographyTokens()
419
+ typography.ts # Typography presets for configure({ presets })
408
420
  spacing.ts # Spacing token definitions
409
421
  index.ts # Public API: re-exports components + configure
410
422
  ```
@@ -418,7 +430,7 @@ The key principle: `config.ts` imports tokens and recipes, calls `configure()`,
418
430
  - **[Methodology](methodology.md)** — The recommended patterns for structuring Tasty components
419
431
  - **[Getting Started](getting-started.md)** — Installation, first component, tooling setup
420
432
  - **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
421
- - **[Runtime API](runtime.md)** — `tasty()` factory, component props, variants, sub-elements, hooks
433
+ - **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
422
434
  - **[Configuration](configuration.md)** — Full `configure()` API: tokens, recipes, custom units, style handlers
423
435
  - **[Adoption Guide](adoption.md)** — Who should adopt Tasty, incremental phases, what changes for product engineers
424
436
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
package/docs/dsl.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
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
4
 
5
- For the runtime React API (`tasty()`, hooks, component props), see [Runtime API](runtime.md). For all enhanced style properties, see [Style Properties](styles.md). For global configuration, see [Configuration](configuration.md).
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
6
 
7
7
  ---
8
8
 
@@ -25,7 +25,21 @@ fill: { '': '#white', hovered: '#gray.05', 'theme=danger': '#red' }
25
25
  | Pseudo-class | `:hover` | `:hover` |
26
26
  | Class selector | `.active` | `.active` |
27
27
  | Attribute selector | `[aria-expanded="true"]` | `[aria-expanded="true"]` |
28
- | Combined | `hovered & .active` | `[data-hovered].active` |
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
+ ```
29
43
 
30
44
  ### Sub-element
31
45
 
@@ -93,7 +107,7 @@ mods={{ hovered: true, theme: 'danger' }}
93
107
  // → data-hovered="" data-theme="danger"
94
108
  ```
95
109
 
96
- Modifiers can also be exposed as top-level component props via `modProps` — see [Runtime — Mod Props](runtime.md#mod-props).
110
+ Modifiers can also be exposed as top-level component props via `modProps` — see [Runtime — Mod Props](react-api.md#mod-props).
97
111
 
98
112
  ---
99
113
 
@@ -430,7 +444,7 @@ const FadeIn = tasty({
430
444
 
431
445
  ### `@parent(...)` — Parent Element States
432
446
 
433
- Style based on ancestor element attributes. Uses `:is([selector] *)` / `:not([selector] *)` for symmetric, composable parent checks. Boolean logic (`&`, `|`, `!`) is supported inside `@parent()`.
447
+ Style based on ancestor element attributes. Uses `:is([selector] *)` / `:not([selector] *)` for symmetric, composable parent checks. Boolean logic (`&`, `|`, `!`, `^`) is supported inside `@parent()`.
434
448
 
435
449
  ```jsx
436
450
  const Highlight = tasty({
@@ -508,12 +522,13 @@ const Card = tasty({
508
522
  | `!:has(> Icon)` | `:not(:has(> [data-element="Icon"]))` | Negation (use `!`) |
509
523
  | `!:is(Panel)` | `:not([data-element="Panel"])` | Negation (use `!:is`) |
510
524
 
511
- Combine with other states using boolean logic:
525
+ Combine with other states using boolean logic (`&`, `|`, `!`, `^`):
512
526
 
513
527
  ```jsx
514
- ':has(> Icon) & hovered' // structural + data attribute
515
- '@parent(hovered) & :has(> Icon)' // parent check + structural
528
+ ':has(> Icon) & hovered' // AND: structural + data attribute
529
+ '@parent(hovered) & :has(> Icon)' // AND: parent check + structural
516
530
  ':has(> Icon) | :has(> Button)' // OR: either sub-element present
531
+ ':has(> Icon) ^ :has(> Button)' // XOR: exactly one present
517
532
  ```
518
533
 
519
534
  > **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.
@@ -666,7 +681,7 @@ For a complete reference of all enhanced style properties — syntax, values, mo
666
681
 
667
682
  ## Learn more
668
683
 
669
- - **[Runtime API](runtime.md)** — `tasty()` factory, component props, variants, sub-elements, hooks
684
+ - **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
670
685
  - **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
671
686
  - **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
672
687
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
@@ -1,6 +1,6 @@
1
1
  # Getting Started
2
2
 
3
- This guide walks you from zero to a working Tasty component, then through the optional shared configuration and tooling layers. It is the right starting point when you already want to try Tasty in code. If you are still deciding whether Tasty fits your team, start with [Comparison](comparison.md) and [Adoption Guide](adoption.md) first. For a feature overview, see the [README](../README.md). For the full style language reference, see the [Style DSL](dsl.md). For the React API, see the [Runtime API](runtime.md). For the rest of the docs by role or task, see the [Docs Hub](README.md).
3
+ This guide walks you from zero to a working Tasty component, then through the optional shared configuration and tooling layers. It is the right starting point when you already want to try Tasty in code. If you are still deciding whether Tasty fits your team, start with [Comparison](comparison.md) and [Adoption Guide](adoption.md) first. For a feature overview, see the [README](../README.md). For the full style language reference, see the [Style DSL](dsl.md). For the React API, see the [React API](react-api.md). For the rest of the docs by role or task, see the [Docs Hub](README.md).
4
4
 
5
5
  ---
6
6
 
@@ -179,19 +179,19 @@ export default [
179
179
 
180
180
  ## Choosing a rendering mode
181
181
 
182
- Tasty has two styling approaches. Pick the one that fits your use case, then decide whether your runtime setup also needs server rendering support:
182
+ `tasty()` is the default for all React apps. All `tasty()` components and style functions are hook-free and work as React Server Components without `'use client'`. In server-only contexts, they produce zero client JavaScript with the full feature set.
183
183
 
184
184
  | Approach | Entry point | Best for | Trade-off |
185
185
  |------|-------------|----------|-----------|
186
- | **Runtime** | `tasty()` from `@tenphi/tasty` | Interactive apps with reusable stateful components, design systems | CSS generated at runtime; full feature set (styleProps, sub-elements, variants) |
187
- | **Zero-runtime** | `tastyStatic()` from `@tenphi/tasty/static` | Static sites, landing pages, SSG | Zero JS overhead; requires Babel plugin; no dynamic props |
186
+ | **Runtime (default)** | `tasty()` from `@tenphi/tasty` | All React apps — server-rendered by default, zero client JS until you need interactivity | Full feature set (styleProps, sub-elements, variants); CSS computed during rendering |
187
+ | **Runtime + SSR integration** | Add `@tenphi/tasty/ssr/*` | Apps with client-side hydration (Next.js client components, Astro islands) | Adds CSS batching, deduplication, FOUC prevention, and client cache hydration |
188
+ | **Zero-runtime** | `tastyStatic()` from `@tenphi/tasty/static` | Non-React frameworks or build-time extraction without React | Requires Babel plugin; no `styleProps` or runtime-only APIs |
188
189
 
189
- Both share the same DSL, tokens, units, and state mappings.
190
+ Both `tasty()` and `tastyStatic()` share the same DSL, tokens, units, and state mappings.
190
191
 
191
- - Runtime is the default and requires no extra setup beyond `@tenphi/tasty`.
192
- - If your framework can execute runtime code during server rendering, add SSR support on top of runtime with `@tenphi/tasty/ssr/next`, `@tenphi/tasty/ssr/astro`, or the core SSR API. This still uses `tasty()`; it just collects CSS on the server and hydrates the cache on the client.
193
- - Zero-runtime requires the Babel plugin and additional peer dependencies. See [Zero Runtime (tastyStatic)](tasty-static.md).
194
- - SSR works with existing `tasty()` components — wrap your app with a registry, middleware, or collector. See [Server-Side Rendering](ssr.md).
192
+ - **Runtime** is the default and requires no extra setup beyond `@tenphi/tasty`. In server-only contexts (Next.js RSC, Astro without `client:*` directives, SSG), `tasty()` produces static HTML + CSS with zero client JavaScript — the same end result as `tastyStatic()` but with the full feature set. For example, `tasty()` + `tastyIntegration()` in Astro without islands gives you the complete API with zero JS shipped.
193
+ - **SSR integration** is only needed when your app also has client-side rendering. Add `@tenphi/tasty/ssr/next`, `@tenphi/tasty/ssr/astro`, or the core SSR API to get CSS deduplication and cache hydration. See [Server-Side Rendering](ssr.md).
194
+ - **Zero-runtime** requires the Babel plugin and additional peer dependencies. Use it when you need build-time extraction without a React runtime. See [Zero Runtime (tastyStatic)](tasty-static.md).
195
195
 
196
196
  ---
197
197
 
@@ -200,7 +200,7 @@ Both share the same DSL, tokens, units, and state mappings.
200
200
  - **[Docs Hub](README.md)** — Pick the next guide by role, styling approach, or task
201
201
  - **[Methodology](methodology.md)** — The recommended patterns for structuring Tasty components: sub-elements, styleProps, tokens, extension
202
202
  - **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
203
- - **[Runtime API](runtime.md)** — `tasty()` factory, component props, variants, sub-elements, hooks
203
+ - **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
204
204
  - **[Building a Design System](design-system.md)** — Practical guide to building a DS layer with Tasty: tokens, recipes, primitives, compound components
205
205
  - **[Adoption Guide](adoption.md)** — Roll out Tasty inside an existing design system or platform team
206
206
  - **[Comparison](comparison.md)** — Evaluate Tasty against other styling systems
package/docs/injector.md CHANGED
@@ -115,11 +115,13 @@ dispose();
115
115
 
116
116
  ### `useRawCSS(css, options?)` or `useRawCSS(factory, deps, options?)`
117
117
 
118
- React hook for injecting raw CSS. Uses `useInsertionEffect` for proper timing and cleanup.
118
+ Inject raw CSS without parsing. Hook-free — works in client components, SSR, and React Server Components.
119
119
 
120
120
  Supports two overloads:
121
- - **Static CSS**: `useRawCSS(cssString, options?)`
122
- - **Factory function**: `useRawCSS(() => cssString, deps, options?)` - re-evaluates when deps change (like `useMemo`)
121
+ - **Static CSS**: `useRawCSS(cssString, options?)` — content-based deduplication
122
+ - **Factory function**: `useRawCSS(() => cssString, deps, options?)` — factory called on every invocation, dedup handled internally
123
+
124
+ Use the `id` option for update tracking — when the CSS changes for the same id, the previous injection is replaced:
123
125
 
124
126
  ```tsx
125
127
  import { useRawCSS } from '@tenphi/tasty';
@@ -132,7 +134,7 @@ function GlobalReset() {
132
134
  return null;
133
135
  }
134
136
 
135
- // Dynamic CSS with factory function (like useMemo)
137
+ // Dynamic CSS with factory function and update tracking
136
138
  function ThemeStyles({ theme }: { theme: 'dark' | 'light' }) {
137
139
  useRawCSS(() => `
138
140
  body {
@@ -140,7 +142,7 @@ function ThemeStyles({ theme }: { theme: 'dark' | 'light' }) {
140
142
  background: ${theme === 'dark' ? '#000' : '#fff'};
141
143
  color: ${theme === 'dark' ? '#fff' : '#000'};
142
144
  }
143
- `, [theme]);
145
+ `, [theme], { id: 'theme-body' });
144
146
 
145
147
  return null;
146
148
  }
@@ -207,13 +209,12 @@ import { configure } from '@tenphi/tasty';
207
209
  configure({
208
210
  devMode: true, // Enable development features (auto-detected)
209
211
  maxRulesPerSheet: 8192, // Cap rules per stylesheet (default: 8192)
210
- unusedStylesThreshold: 500, // Trigger cleanup threshold (CSS rules only)
211
- bulkCleanupDelay: 5000, // Cleanup delay (ms) - ignored if idleCleanup is true
212
- idleCleanup: true, // Use requestIdleCallback for cleanup
213
- bulkCleanupBatchRatio: 0.5, // Clean up oldest 50% per batch
214
- unusedStylesMinAgeMs: 10000, // Minimum age before cleanup (ms)
215
212
  forceTextInjection: false, // Force textContent insertion (auto-detected for tests)
216
213
  nonce: 'csp-nonce', // CSP nonce for security
214
+ gc: { // Garbage collection for unused styles
215
+ touchInterval: 1000, // Touch events between GC cycles (default: 1000)
216
+ capacity: 1000, // Max unused styles to retain (default: 1000)
217
+ },
217
218
  states: { // Global predefined states for advanced state mapping
218
219
  '@mobile': '@media(w < 768px)',
219
220
  '@dark': '@root(schema=dark)',
@@ -223,13 +224,14 @@ configure({
223
224
 
224
225
  **Auto-Detection Features:**
225
226
  - `devMode`: Automatically enabled in development environments (detected via `isDevEnv()`)
226
- - `forceTextInjection`: Automatically enabled in test environments (Jest, Vitest, Mocha, jsdom)
227
+ - `forceTextInjection`: Automatically enabled in test environments (Jest, Vitest, Mocha, happy-dom, jsdom)
227
228
 
228
229
  **Configuration Notes:**
229
230
  - Most options have sensible defaults and auto-detection
230
231
  - `configure()` is optional - the injector works with defaults
231
232
  - **Configuration is locked after styles are generated** - calling `configure()` after first render will emit a warning and be ignored
232
- - `unusedStylesMinAgeMs`: Minimum time (ms) a style must remain unused before being eligible for cleanup. Helps prevent removal of styles that might be quickly reactivated.
233
+ - `gc.touchInterval`: Number of touch events between GC cycles. Each style render counts as a touch. When the counter reaches this value, GC is scheduled via `requestIdleCallback`.
234
+ - `gc.capacity`: Maximum number of unused styles (refCount = 0, not in DOM) to retain. When exceeded, the oldest are evicted first. Actively referenced styles don't count against this limit.
233
235
 
234
236
  ---
235
237
 
@@ -291,21 +293,34 @@ comp3.dispose(); // refCount: 1 → 0, eligible for bulk cleanup
291
293
  // Next inject() with same styles will increment refCount and reuse immediately
292
294
  ```
293
295
 
294
- ### Smart Cleanup System
296
+ ### Garbage Collection
295
297
 
296
298
  ```typescript
297
- import { configure } from '@tenphi/tasty';
299
+ import { configure, gc } from '@tenphi/tasty';
298
300
 
299
- // CSS rules: Not immediately deleted, marked for bulk cleanup (refCount = 0)
300
301
  // Keyframes: Disposed immediately when refCount = 0 (safer for global scope)
302
+ // CSS rules: Tracked by touch count and cleaned up via gc()
301
303
 
302
304
  configure({
303
- unusedStylesThreshold: 100, // Cleanup when 100+ unused CSS rules
304
- bulkCleanupBatchRatio: 0.3, // Remove oldest 30% each time
305
+ gc: {
306
+ touchInterval: 1000, // Schedule GC every 1000 touches
307
+ capacity: 1000, // Max unused styles to retain
308
+ },
305
309
  });
306
310
 
311
+ // Manual GC (synchronous, returns number of swept styles):
312
+ gc();
313
+
314
+ // Force-remove ALL unused styles (e.g. on route change or test teardown):
315
+ gc({ force: true });
316
+
317
+ // GC is also triggered automatically by touch count during rendering.
318
+ // Every `touchInterval` touches, GC is scheduled via requestIdleCallback.
319
+
307
320
  // Benefits:
308
- // - CSS rules: Batch cleanup prevents DOM manipulation overhead
321
+ // - Activity-proportional: busy apps trigger GC more often
322
+ // - DOM-safe: styles currently in the DOM are never evicted
323
+ // - Oldest-first: least recently used styles are evicted first
309
324
  // - Keyframes: Immediate cleanup prevents global namespace pollution
310
325
  // - Unused styles can be instantly reactivated (just increment refCount)
311
326
  ```
@@ -351,7 +366,7 @@ const componentCSS = getCssTextForNode(container);
351
366
  // Automatically detected test environments:
352
367
  // - NODE_ENV === 'test'
353
368
  // - Jest globals (jest, describe, it, expect)
354
- // - jsdom user agent
369
+ // - jsdom / HappyDOM user agent
355
370
  // - Vitest globals (vitest)
356
371
  // - Mocha globals (mocha)
357
372
 
@@ -462,13 +477,14 @@ injectGlobal([
462
477
  { selector: '.container', declarations: 'max-width: 1200px;' }
463
478
  ]);
464
479
 
465
- // ✅ Configure appropriate thresholds for your app (BEFORE first render!)
480
+ // ✅ Configure GC for your app (BEFORE first render!)
466
481
  import { configure } from '@tenphi/tasty';
467
482
 
468
483
  configure({
469
- unusedStylesThreshold: 500, // Default threshold (adjust based on app size)
470
- bulkCleanupBatchRatio: 0.5, // Default: clean oldest 50% per batch
471
- unusedStylesMinAgeMs: 10000, // Wait 10s before cleanup eligibility
484
+ gc: {
485
+ touchInterval: 1000, // Schedule GC every 1000 style touches
486
+ capacity: 1000, // Max unused styles to retain
487
+ },
472
488
  });
473
489
  ```
474
490
 
@@ -480,8 +496,8 @@ configure({
480
496
  // 1. Hash-based deduplication - same CSS = same className
481
497
  // 2. Reference counting - styles stay alive while in use (refCount > 0)
482
498
  // 3. Immediate keyframes cleanup - disposed instantly when refCount = 0
483
- // 4. Batch CSS cleanup - unused CSS rules (refCount = 0) cleaned in batches
484
- // 5. Non-stacking cleanups - prevents timeout accumulation
499
+ // 4. Touch-count GC - unused CSS rules are evicted oldest-first when over capacity
500
+ // 5. DOM safety guard - styles visible in the DOM are never evicted
485
501
 
486
502
  // Manual cleanup is rarely needed but available:
487
503
  cleanup(); // Force immediate cleanup of all unused CSS rules (refCount = 0)
@@ -511,7 +527,7 @@ const StyledButton = tasty({
511
527
  // 4. dispose() is called when component unmounts
512
528
  ```
513
529
 
514
- For most development, you'll use the [Runtime API](./runtime.md) rather than the injector directly. The injector provides the high-performance foundation that makes Tasty's declarative styling possible.
530
+ For most development, you'll use the [React API](./react-api.md) rather than the injector directly. The injector provides the high-performance foundation that makes Tasty's declarative styling possible.
515
531
 
516
532
  ---
517
533
 
@@ -525,4 +541,4 @@ Direct injector usage is recommended for:
525
541
  - **Performance-critical scenarios** where you need direct control
526
542
  - **Testing utilities** that need to inject or extract CSS
527
543
 
528
- For regular component styling, prefer the [`tasty()` API](./runtime.md) which provides a more developer-friendly interface.
544
+ For regular component styling, prefer the [`tasty()` API](./react-api.md) which provides a more developer-friendly interface.
@@ -214,7 +214,7 @@ The array form is simpler but types all values as `ModValue`:
214
214
  modProps: ['isLoading', 'isSelected'] as const,
215
215
  ```
216
216
 
217
- For the full API reference, see [Runtime — Mod Props](runtime.md#mod-props).
217
+ For the full API reference, see [Runtime — Mod Props](react-api.md#mod-props).
218
218
 
219
219
  ---
220
220
 
@@ -256,6 +256,54 @@ The `tokens` prop sets `style="--progress: 75%"` on the DOM element. The `$progr
256
256
 
257
257
  Design tokens (via `configure({ tokens })`) are injected as CSS custom properties on `:root`. Replace tokens (via `configure({ replaceTokens })`) are resolved at parse time and baked into the generated CSS. The `tokens` prop on components is resolved at render time via inline CSS custom properties. Use design tokens for design-system constants, replace tokens for value aliases, and the `tokens` prop for truly dynamic per-instance values.
258
258
 
259
+ ### tokenProps
260
+
261
+ `tokenProps` expose token keys as top-level component props — the token equivalent of `styleProps` and `modProps`. Use them when a component has a fixed set of known dynamic token values.
262
+
263
+ #### Array form
264
+
265
+ Prop names are plain camelCase identifiers. Names ending in `Color` map to `#` color tokens; everything else maps to `$` custom property tokens:
266
+
267
+ ```tsx
268
+ const ProgressBar = tasty({
269
+ tokenProps: ['progress', 'accentColor'] as const,
270
+ styles: { width: '$progress', fill: '#accent' },
271
+ });
272
+
273
+ // Clean prop API — no tokens object needed
274
+ <ProgressBar progress="75%" accentColor="#purple" />
275
+
276
+ // Conversion:
277
+ // 'progress' → $progress → --progress
278
+ // 'accentColor' → #accent → --accent-color + --accent-color-oklch
279
+ ```
280
+
281
+ #### Object form
282
+
283
+ Keys are prop names; values are `$`/`#`-prefixed token keys. No suffix convention needed — the prefix in the value is explicit:
284
+
285
+ ```tsx
286
+ const Card = tasty({
287
+ tokenProps: {
288
+ size: '$card-size',
289
+ color: '#card-accent',
290
+ },
291
+ styles: { padding: '$card-size', fill: '#card-accent' },
292
+ });
293
+
294
+ <Card size="4x" color="#purple" />
295
+ ```
296
+
297
+ #### Merge order
298
+
299
+ When all three token sources are present, values merge with increasing priority:
300
+
301
+ 1. `tokens` option in `tasty({...})` — default tokens (lowest)
302
+ 2. `tokens` prop on the component instance — runtime overrides
303
+ 3. `tokenProps`-derived values — highest priority (explicit named props win)
304
+
305
+ The `tokens` prop remains available for ad-hoc or dynamic tokens alongside `tokenProps`.
306
+
259
307
  ---
260
308
 
261
309
  ## styles prop vs style prop
@@ -458,7 +506,8 @@ See [Configuration](configuration.md) for the full `configure()` API.
458
506
  - **Use `elements` prop** to declare typed sub-components for compound components
459
507
  - **Use `styleProps`** to define what product engineers can customize
460
508
  - **Use `modProps`** to expose known modifier states as clean component props
461
- - **Use `tokens` prop** for per-instance dynamic values (progress, user color)
509
+ - **Use `tokenProps`** to expose known token keys as clean component props
510
+ - **Use `tokens` prop** for ad-hoc or dynamic per-instance token values (progress, user color)
462
511
  - **Use modifiers** (`mods` or `modProps`) for state-driven style changes instead of runtime `styles` prop changes
463
512
 
464
513
  ### Avoid
@@ -561,7 +610,7 @@ The `elements` prop gives you typed sub-components with automatic `data-element`
561
610
  - **[Getting Started](getting-started.md)** — Installation, first component, tooling setup
562
611
  - **[Building a Design System](design-system.md)** — Practical guide to building a DS layer with Tasty
563
612
  - **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
564
- - **[Runtime API](runtime.md)** — `tasty()` factory, component props, variants, sub-elements, hooks
613
+ - **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
565
614
  - **[Configuration](configuration.md)** — Full `configure()` API: tokens, recipes, custom units, style handlers
566
615
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
567
616
  - **[Adoption Guide](adoption.md)** — Who should adopt Tasty, incremental phases, what changes for product engineers