@tenphi/tasty 0.0.0-snapshot.fa94a5a → 0.0.0-snapshot.fc19da9

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 (372) hide show
  1. package/README.md +437 -362
  2. package/dist/babel-types-DpUCD2L_.d.ts +18 -0
  3. package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
  4. package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
  5. package/dist/chunks/build-config-BDLYGmKn.js +60 -0
  6. package/dist/chunks/build-config-BDLYGmKn.js.map +1 -0
  7. package/dist/chunks/collector-DqcB0UUT.js +210 -0
  8. package/dist/chunks/collector-DqcB0UUT.js.map +1 -0
  9. package/dist/chunks/config-engine-CGIMO2PV.js +272 -0
  10. package/dist/chunks/config-engine-CGIMO2PV.js.map +1 -0
  11. package/dist/chunks/config-file-DlZXJMj8.js +25 -0
  12. package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
  13. package/dist/chunks/css-definitions-BibU6ZnP.js +904 -0
  14. package/dist/chunks/css-definitions-BibU6ZnP.js.map +1 -0
  15. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  16. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  17. package/dist/{debug.js → chunks/debug-BzYPQ0H2.js} +197 -149
  18. package/dist/chunks/debug-BzYPQ0H2.js.map +1 -0
  19. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  20. package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
  21. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  22. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  23. package/dist/chunks/react-runtime-B2e-Wha-.js +689 -0
  24. package/dist/chunks/react-runtime-B2e-Wha-.js.map +1 -0
  25. package/dist/chunks/runtime-engine-yeyCAx2e.js +2431 -0
  26. package/dist/chunks/runtime-engine-yeyCAx2e.js.map +1 -0
  27. package/dist/chunks/runtime-state-C0u1jp-Q.js +141 -0
  28. package/dist/chunks/runtime-state-C0u1jp-Q.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
  30. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  31. package/dist/chunks/style-engine-D35rvcdB.js +5420 -0
  32. package/dist/chunks/style-engine-D35rvcdB.js.map +1 -0
  33. package/dist/chunks/zero-engine-DpkieEPZ.js +310 -0
  34. package/dist/chunks/zero-engine-DpkieEPZ.js.map +1 -0
  35. package/dist/collector-D4POJ53X.d.ts +164 -0
  36. package/dist/config-DvPUj4cw.d.ts +1364 -0
  37. package/dist/core/index.d.ts +5 -34
  38. package/dist/core/index.js +9 -27
  39. package/dist/hydrate-CRyjjAyl.d.ts +22 -0
  40. package/dist/index-DC4q-xDq.d.ts +1946 -0
  41. package/dist/index.d.ts +5 -51
  42. package/dist/index.js +11 -36
  43. package/dist/{utils/merge-styles.d.ts → merge-styles-Jb5iZ-Jf.d.ts} +3 -4
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +6 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  51. package/dist/ssr/astro-middleware-extract.js +9 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  54. package/dist/ssr/astro-middleware-static.js +7 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +18 -0
  57. package/dist/ssr/astro-middleware.js +7 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -12
  60. package/dist/ssr/astro.js +206 -50
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +2 -0
  64. package/dist/ssr/index.d.ts +17 -5
  65. package/dist/ssr/index.js +7 -9
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +64 -0
  68. package/dist/ssr/next-config.js +123 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +13 -12
  71. package/dist/ssr/next.js +40 -51
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +90 -5
  74. package/dist/static/index.js +31 -4
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +4 -0
  77. package/dist/static/inject.js +17 -0
  78. package/dist/static/inject.js.map +1 -0
  79. package/dist/types-ZbF2_6LV.d.ts +1567 -0
  80. package/dist/zero/babel.d.ts +20 -120
  81. package/dist/zero/babel.js +189 -148
  82. package/dist/zero/babel.js.map +1 -1
  83. package/dist/zero/index.d.ts +117 -3
  84. package/dist/zero/index.js +23 -3
  85. package/dist/zero/index.js.map +1 -0
  86. package/dist/zero/next.d.ts +16 -5
  87. package/dist/zero/next.js +8 -42
  88. package/dist/zero/next.js.map +1 -1
  89. package/docs/README.md +23 -12
  90. package/docs/adoption.md +72 -37
  91. package/docs/ai-agents.md +252 -0
  92. package/docs/comparison.md +83 -54
  93. package/docs/configuration.md +698 -81
  94. package/docs/debug.md +39 -24
  95. package/docs/design-system.md +174 -41
  96. package/docs/dsl.md +615 -197
  97. package/docs/getting-started.md +132 -52
  98. package/docs/injector.md +195 -90
  99. package/docs/methodology.md +153 -47
  100. package/docs/migration-v3.md +285 -0
  101. package/docs/pipeline.md +768 -0
  102. package/docs/plugins.md +333 -0
  103. package/docs/react-api.md +703 -0
  104. package/docs/runtime-benchmarks.md +388 -0
  105. package/docs/ssr.md +395 -149
  106. package/docs/styles.md +194 -45
  107. package/docs/tasty-static.md +327 -101
  108. package/package.json +153 -35
  109. package/tasty.config.ts +6 -0
  110. package/dist/_virtual/_rolldown/runtime.js +0 -8
  111. package/dist/chunks/cacheKey.js +0 -78
  112. package/dist/chunks/cacheKey.js.map +0 -1
  113. package/dist/chunks/definitions.d.ts +0 -37
  114. package/dist/chunks/definitions.js +0 -259
  115. package/dist/chunks/definitions.js.map +0 -1
  116. package/dist/chunks/renderChunk.js +0 -60
  117. package/dist/chunks/renderChunk.js.map +0 -1
  118. package/dist/config.d.ts +0 -366
  119. package/dist/config.js +0 -504
  120. package/dist/config.js.map +0 -1
  121. package/dist/counter-style/index.js +0 -51
  122. package/dist/counter-style/index.js.map +0 -1
  123. package/dist/debug.d.ts +0 -89
  124. package/dist/debug.js.map +0 -1
  125. package/dist/font-face/index.js +0 -63
  126. package/dist/font-face/index.js.map +0 -1
  127. package/dist/hooks/resolve-ssr-collector.js +0 -15
  128. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  129. package/dist/hooks/useCounterStyle.d.ts +0 -50
  130. package/dist/hooks/useCounterStyle.js +0 -47
  131. package/dist/hooks/useCounterStyle.js.map +0 -1
  132. package/dist/hooks/useFontFace.d.ts +0 -43
  133. package/dist/hooks/useFontFace.js +0 -71
  134. package/dist/hooks/useFontFace.js.map +0 -1
  135. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  136. package/dist/hooks/useGlobalStyles.js +0 -79
  137. package/dist/hooks/useGlobalStyles.js.map +0 -1
  138. package/dist/hooks/useKeyframes.d.ts +0 -56
  139. package/dist/hooks/useKeyframes.js +0 -65
  140. package/dist/hooks/useKeyframes.js.map +0 -1
  141. package/dist/hooks/useProperty.d.ts +0 -79
  142. package/dist/hooks/useProperty.js +0 -110
  143. package/dist/hooks/useProperty.js.map +0 -1
  144. package/dist/hooks/useRawCSS.d.ts +0 -53
  145. package/dist/hooks/useRawCSS.js +0 -36
  146. package/dist/hooks/useRawCSS.js.map +0 -1
  147. package/dist/hooks/useStyles.d.ts +0 -45
  148. package/dist/hooks/useStyles.js +0 -270
  149. package/dist/hooks/useStyles.js.map +0 -1
  150. package/dist/injector/index.d.ts +0 -183
  151. package/dist/injector/index.js +0 -180
  152. package/dist/injector/index.js.map +0 -1
  153. package/dist/injector/injector.d.ts +0 -166
  154. package/dist/injector/injector.js +0 -465
  155. package/dist/injector/injector.js.map +0 -1
  156. package/dist/injector/sheet-manager.d.ts +0 -136
  157. package/dist/injector/sheet-manager.js +0 -731
  158. package/dist/injector/sheet-manager.js.map +0 -1
  159. package/dist/injector/types.d.ts +0 -204
  160. package/dist/keyframes/index.js +0 -206
  161. package/dist/keyframes/index.js.map +0 -1
  162. package/dist/parser/classify.js +0 -320
  163. package/dist/parser/classify.js.map +0 -1
  164. package/dist/parser/const.js +0 -33
  165. package/dist/parser/const.js.map +0 -1
  166. package/dist/parser/lru.js +0 -109
  167. package/dist/parser/lru.js.map +0 -1
  168. package/dist/parser/parser.d.ts +0 -25
  169. package/dist/parser/parser.js +0 -116
  170. package/dist/parser/parser.js.map +0 -1
  171. package/dist/parser/tokenizer.js +0 -69
  172. package/dist/parser/tokenizer.js.map +0 -1
  173. package/dist/parser/types.d.ts +0 -51
  174. package/dist/parser/types.js +0 -46
  175. package/dist/parser/types.js.map +0 -1
  176. package/dist/pipeline/conditions.d.ts +0 -134
  177. package/dist/pipeline/conditions.js +0 -406
  178. package/dist/pipeline/conditions.js.map +0 -1
  179. package/dist/pipeline/exclusive.js +0 -231
  180. package/dist/pipeline/exclusive.js.map +0 -1
  181. package/dist/pipeline/index.d.ts +0 -53
  182. package/dist/pipeline/index.js +0 -699
  183. package/dist/pipeline/index.js.map +0 -1
  184. package/dist/pipeline/materialize.js +0 -1105
  185. package/dist/pipeline/materialize.js.map +0 -1
  186. package/dist/pipeline/parseStateKey.d.ts +0 -15
  187. package/dist/pipeline/parseStateKey.js +0 -447
  188. package/dist/pipeline/parseStateKey.js.map +0 -1
  189. package/dist/pipeline/simplify.js +0 -516
  190. package/dist/pipeline/simplify.js.map +0 -1
  191. package/dist/pipeline/warnings.js +0 -18
  192. package/dist/pipeline/warnings.js.map +0 -1
  193. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  194. package/dist/plugins/okhsl-plugin.js +0 -98
  195. package/dist/plugins/okhsl-plugin.js.map +0 -1
  196. package/dist/plugins/types.d.ts +0 -76
  197. package/dist/properties/index.js +0 -223
  198. package/dist/properties/index.js.map +0 -1
  199. package/dist/properties/property-type-resolver.d.ts +0 -24
  200. package/dist/properties/property-type-resolver.js +0 -91
  201. package/dist/properties/property-type-resolver.js.map +0 -1
  202. package/dist/ssr/async-storage.d.ts +0 -17
  203. package/dist/ssr/async-storage.js +0 -35
  204. package/dist/ssr/async-storage.js.map +0 -1
  205. package/dist/ssr/collect-auto-properties.js +0 -40
  206. package/dist/ssr/collect-auto-properties.js.map +0 -1
  207. package/dist/ssr/collector.d.ts +0 -102
  208. package/dist/ssr/collector.js +0 -227
  209. package/dist/ssr/collector.js.map +0 -1
  210. package/dist/ssr/context.d.ts +0 -8
  211. package/dist/ssr/context.js +0 -14
  212. package/dist/ssr/context.js.map +0 -1
  213. package/dist/ssr/format-global-rules.js +0 -22
  214. package/dist/ssr/format-global-rules.js.map +0 -1
  215. package/dist/ssr/format-keyframes.js +0 -70
  216. package/dist/ssr/format-keyframes.js.map +0 -1
  217. package/dist/ssr/format-property.js +0 -50
  218. package/dist/ssr/format-property.js.map +0 -1
  219. package/dist/ssr/format-rules.js +0 -70
  220. package/dist/ssr/format-rules.js.map +0 -1
  221. package/dist/ssr/hydrate.d.ts +0 -22
  222. package/dist/ssr/hydrate.js +0 -50
  223. package/dist/ssr/hydrate.js.map +0 -1
  224. package/dist/ssr/ssr-collector-ref.js +0 -12
  225. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  226. package/dist/states/index.d.ts +0 -49
  227. package/dist/states/index.js +0 -171
  228. package/dist/states/index.js.map +0 -1
  229. package/dist/static/tastyStatic.d.ts +0 -46
  230. package/dist/static/tastyStatic.js +0 -31
  231. package/dist/static/tastyStatic.js.map +0 -1
  232. package/dist/static/types.d.ts +0 -49
  233. package/dist/static/types.js +0 -24
  234. package/dist/static/types.js.map +0 -1
  235. package/dist/styles/align.d.ts +0 -15
  236. package/dist/styles/align.js +0 -14
  237. package/dist/styles/align.js.map +0 -1
  238. package/dist/styles/border.d.ts +0 -25
  239. package/dist/styles/border.js +0 -114
  240. package/dist/styles/border.js.map +0 -1
  241. package/dist/styles/color.d.ts +0 -14
  242. package/dist/styles/color.js +0 -27
  243. package/dist/styles/color.js.map +0 -1
  244. package/dist/styles/createStyle.js +0 -80
  245. package/dist/styles/createStyle.js.map +0 -1
  246. package/dist/styles/dimension.js +0 -97
  247. package/dist/styles/dimension.js.map +0 -1
  248. package/dist/styles/display.d.ts +0 -37
  249. package/dist/styles/display.js +0 -67
  250. package/dist/styles/display.js.map +0 -1
  251. package/dist/styles/fade.d.ts +0 -15
  252. package/dist/styles/fade.js +0 -58
  253. package/dist/styles/fade.js.map +0 -1
  254. package/dist/styles/fill.d.ts +0 -42
  255. package/dist/styles/fill.js +0 -52
  256. package/dist/styles/fill.js.map +0 -1
  257. package/dist/styles/flow.d.ts +0 -16
  258. package/dist/styles/flow.js +0 -12
  259. package/dist/styles/flow.js.map +0 -1
  260. package/dist/styles/gap.d.ts +0 -31
  261. package/dist/styles/gap.js +0 -37
  262. package/dist/styles/gap.js.map +0 -1
  263. package/dist/styles/height.d.ts +0 -17
  264. package/dist/styles/height.js +0 -20
  265. package/dist/styles/height.js.map +0 -1
  266. package/dist/styles/index.d.ts +0 -2
  267. package/dist/styles/index.js +0 -9
  268. package/dist/styles/index.js.map +0 -1
  269. package/dist/styles/inset.d.ts +0 -52
  270. package/dist/styles/inset.js +0 -150
  271. package/dist/styles/inset.js.map +0 -1
  272. package/dist/styles/justify.d.ts +0 -15
  273. package/dist/styles/justify.js +0 -14
  274. package/dist/styles/justify.js.map +0 -1
  275. package/dist/styles/list.d.ts +0 -16
  276. package/dist/styles/list.js +0 -98
  277. package/dist/styles/list.js.map +0 -1
  278. package/dist/styles/margin.d.ts +0 -24
  279. package/dist/styles/margin.js +0 -104
  280. package/dist/styles/margin.js.map +0 -1
  281. package/dist/styles/outline.d.ts +0 -29
  282. package/dist/styles/outline.js +0 -65
  283. package/dist/styles/outline.js.map +0 -1
  284. package/dist/styles/padding.d.ts +0 -24
  285. package/dist/styles/padding.js +0 -104
  286. package/dist/styles/padding.js.map +0 -1
  287. package/dist/styles/predefined.d.ts +0 -71
  288. package/dist/styles/predefined.js +0 -238
  289. package/dist/styles/predefined.js.map +0 -1
  290. package/dist/styles/preset.d.ts +0 -47
  291. package/dist/styles/preset.js +0 -112
  292. package/dist/styles/preset.js.map +0 -1
  293. package/dist/styles/radius.d.ts +0 -14
  294. package/dist/styles/radius.js +0 -51
  295. package/dist/styles/radius.js.map +0 -1
  296. package/dist/styles/scrollbar.d.ts +0 -25
  297. package/dist/styles/scrollbar.js +0 -48
  298. package/dist/styles/scrollbar.js.map +0 -1
  299. package/dist/styles/shadow.d.ts +0 -14
  300. package/dist/styles/shadow.js +0 -24
  301. package/dist/styles/shadow.js.map +0 -1
  302. package/dist/styles/transition.d.ts +0 -14
  303. package/dist/styles/transition.js +0 -158
  304. package/dist/styles/transition.js.map +0 -1
  305. package/dist/styles/types.d.ts +0 -545
  306. package/dist/styles/width.d.ts +0 -17
  307. package/dist/styles/width.js +0 -20
  308. package/dist/styles/width.js.map +0 -1
  309. package/dist/tasty.d.ts +0 -119
  310. package/dist/tasty.js +0 -232
  311. package/dist/tasty.js.map +0 -1
  312. package/dist/types.d.ts +0 -184
  313. package/dist/utils/cache-wrapper.js +0 -22
  314. package/dist/utils/cache-wrapper.js.map +0 -1
  315. package/dist/utils/case-converter.js +0 -8
  316. package/dist/utils/case-converter.js.map +0 -1
  317. package/dist/utils/color-math.d.ts +0 -46
  318. package/dist/utils/color-math.js +0 -749
  319. package/dist/utils/color-math.js.map +0 -1
  320. package/dist/utils/color-space.d.ts +0 -5
  321. package/dist/utils/color-space.js +0 -229
  322. package/dist/utils/color-space.js.map +0 -1
  323. package/dist/utils/colors.d.ts +0 -5
  324. package/dist/utils/colors.js +0 -11
  325. package/dist/utils/colors.js.map +0 -1
  326. package/dist/utils/css-types.d.ts +0 -7
  327. package/dist/utils/dotize.d.ts +0 -26
  328. package/dist/utils/dotize.js +0 -122
  329. package/dist/utils/dotize.js.map +0 -1
  330. package/dist/utils/filter-base-props.d.ts +0 -15
  331. package/dist/utils/filter-base-props.js +0 -45
  332. package/dist/utils/filter-base-props.js.map +0 -1
  333. package/dist/utils/get-display-name.d.ts +0 -7
  334. package/dist/utils/get-display-name.js +0 -10
  335. package/dist/utils/get-display-name.js.map +0 -1
  336. package/dist/utils/has-keys.js +0 -13
  337. package/dist/utils/has-keys.js.map +0 -1
  338. package/dist/utils/is-dev-env.js +0 -19
  339. package/dist/utils/is-dev-env.js.map +0 -1
  340. package/dist/utils/is-valid-element-type.js +0 -15
  341. package/dist/utils/is-valid-element-type.js.map +0 -1
  342. package/dist/utils/merge-styles.js.map +0 -1
  343. package/dist/utils/mod-attrs.d.ts +0 -8
  344. package/dist/utils/mod-attrs.js +0 -21
  345. package/dist/utils/mod-attrs.js.map +0 -1
  346. package/dist/utils/process-tokens.d.ts +0 -21
  347. package/dist/utils/process-tokens.js +0 -91
  348. package/dist/utils/process-tokens.js.map +0 -1
  349. package/dist/utils/resolve-recipes.d.ts +0 -17
  350. package/dist/utils/resolve-recipes.js +0 -147
  351. package/dist/utils/resolve-recipes.js.map +0 -1
  352. package/dist/utils/selector-transform.js +0 -32
  353. package/dist/utils/selector-transform.js.map +0 -1
  354. package/dist/utils/string.js +0 -8
  355. package/dist/utils/string.js.map +0 -1
  356. package/dist/utils/styles.d.ts +0 -101
  357. package/dist/utils/styles.js +0 -223
  358. package/dist/utils/styles.js.map +0 -1
  359. package/dist/utils/typography.d.ts +0 -47
  360. package/dist/utils/typography.js +0 -43
  361. package/dist/utils/typography.js.map +0 -1
  362. package/dist/utils/warnings.d.ts +0 -16
  363. package/dist/utils/warnings.js +0 -16
  364. package/dist/utils/warnings.js.map +0 -1
  365. package/dist/zero/css-writer.d.ts +0 -45
  366. package/dist/zero/css-writer.js +0 -74
  367. package/dist/zero/css-writer.js.map +0 -1
  368. package/dist/zero/extractor.d.ts +0 -24
  369. package/dist/zero/extractor.js +0 -267
  370. package/dist/zero/extractor.js.map +0 -1
  371. package/docs/PIPELINE.md +0 -519
  372. package/docs/runtime.md +0 -485
@@ -1,6 +1,8 @@
1
1
  # Configuration
2
2
 
3
- Configure the Tasty style system before your app renders using the `configure()` function. Configuration must be done **before any styles are generated** (before first render). For a higher-level docs map, see the [Docs Hub](README.md).
3
+ Tasty works without upfront configuration. Use `configure()` when your app or design system is ready to define shared tokens, state aliases, units, recipes, presets, or extension points.
4
+
5
+ Call it **before any styles are generated** (before first render). For a guided setup, see [Getting Started](getting-started.md). For the higher-level docs map, see the [Docs Hub](README.md).
4
6
 
5
7
  ```jsx
6
8
  import { configure } from '@tenphi/tasty';
@@ -21,17 +23,19 @@ configure({
21
23
 
22
24
  // Custom units (merged with built-in units)
23
25
  units: {
24
- vh: 'vh',
25
- vw: 'vw',
26
- custom: (n) => `${n * 10}px`, // Function-based unit
26
+ gu: '4px', // `2gu` → `8px`
27
+ cols: (n) => `calc(${n} * var(--col-width))`, // function-based unit
27
28
  },
28
29
 
29
- // Custom functions for the parser
30
- funcs: {
30
+ // Custom functions — a single map for both flavors, discriminated by value type:
31
+ functions: {
32
+ // Bare key + function value → parse-time function, called as `double(...)`
31
33
  double: (groups) => {
32
34
  const value = parseFloat(groups[0]?.output || '0');
33
35
  return `${value * 2}px`;
34
36
  },
37
+ // `$$name` key + object value → declarative CSS @function, called as `$$negative(...)`
38
+ $$negative: { args: ['$value'], result: '(-1 * $value)' },
35
39
  },
36
40
  });
37
41
  ```
@@ -42,43 +46,281 @@ These docs use `data-schema="dark"` in examples. If your app already standardize
42
46
 
43
47
  ## Options
44
48
 
45
- | Option | Type | Default | Description |
46
- |--------|------|---------|-------------|
47
- | `nonce` | `string` | - | CSP nonce for style elements |
48
- | `states` | `Record<string, string>` | - | Global state aliases for advanced state mapping |
49
- | `parserCacheSize` | `number` | `1000` | Parser LRU cache size |
50
- | `units` | `Record<string, string \| Function>` | Built-in | Custom units (merged with built-in). See [built-in units](dsl.md#built-in-units) |
51
- | `funcs` | `Record<string, Function>` | - | Custom parser functions (merged with existing) |
52
- | `handlers` | `Record<string, StyleHandlerDefinition>` | Built-in | Custom style handlers (replace built-in) |
53
- | `tokens` | `Record<string, value \| stateMap>` | - | Design tokens injected as `:root` CSS custom properties |
54
- | `replaceTokens` | `Record<string, string \| number>` | - | Parse-time token substitution (inline replacement) |
55
- | `keyframes` | `Record<string, KeyframesSteps>` | - | Global keyframes for animations |
56
- | `properties` | `Record<string, PropertyDefinition>` | - | Global CSS @property definitions |
57
- | `fontFace` | `Record<string, FontFaceInput>` | - | Global @font-face definitions |
58
- | `counterStyle` | `Record<string, CounterStyleDescriptors>` | - | Global @counter-style definitions |
59
- | `autoPropertyTypes` | `boolean` | `true` | Auto-infer and register `@property` types from values |
60
- | `recipes` | `Record<string, RecipeStyles>` | - | Predefined style recipes (named style bundles) |
61
- | `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | `'oklch'` | Color space for decomposed color token companion variables |
49
+ | Option | Type | Default | Description |
50
+ | -------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51
+ | `nonce` | `string` | - | CSP nonce for style elements |
52
+ | `maxRulesPerSheet` | `number` | `8192` | Maximum rules per injected stylesheet |
53
+ | `forceTextInjection` | `boolean` | `false` (`true` in test environments only while `configure()` has never been called) | Force text-node CSS injection instead of constructable stylesheets. Set it explicitly in test setup |
54
+ | `devMode` | `boolean` | auto | Enable development-mode features: performance metrics and debug info. Does not turn on dev warnings; those follow `NODE_ENV` (or `localStorage.TASTY_DEBUG = 'true'` in a browser) |
55
+ | `states` | `Record<string, string>` | - | Global state aliases for advanced state mapping |
56
+ | `parserCacheSize` | `number` | `1000` | Parser LRU cache size |
57
+ | `units` | `Record<string, string \| UnitHandler>` | Built-in | Custom units (merged with built-in). See [built-in units](dsl.md#built-in-units) |
58
+ | `functions` | `Record<string, FunctionDefinition \| Function>` | - | Custom functions (merged). Bare keys → parse functions; `$$name` keys → declarative CSS `@function` definitions |
59
+ | `handlers` | `Record<string, StyleHandlerDefinition>` | Built-in | Custom style handlers (replace built-in). See [Custom Style Handlers](#custom-style-handlers) |
60
+ | `propHandlers` | `Record<string, PropHandlerDefinition>` | - | Props middleware for every component — props in, props out. See [Props Middleware](#props-middleware) |
61
+ | `baseStyleProps` | `readonly string[]` | - | Style names exposed as props on **every** component. See [Base Style Props](#base-style-props) |
62
+ | `tokens` | `Record<string, value \| stateMap>` | - | Design tokens injected as `:root` CSS custom properties |
63
+ | `replaceTokens` | `Record<string, string \| number \| boolean>` | - | Parse-time token substitution (inline replacement). `boolean` is allowed for `#` color tokens |
64
+ | `keyframes` | `Record<string, KeyframesSteps>` | - | Global keyframes for animations |
65
+ | `properties` | `Record<string, PropertyDefinition>` | - | Global CSS @property definitions |
66
+ | `fontFaces` | `Record<string, FontFaceInput>` | - | Global @font-face definitions |
67
+ | `counterStyles` | `Record<string, CounterStyleDescriptors>` | - | Global @counter-style definitions |
68
+ | `polyfills` | `{ functions?: boolean }` | `{}` | Opt-in polyfills for not-yet-baseline features. `functions: true` inlines `@function` calls into plain CSS at parse time |
69
+ | `autoPropertyTypes` | `boolean` | `true` | Auto-infer and register `@property` types from values |
70
+ | `recipes` | `Record<string, RecipeStyles>` | - | Predefined style recipes (named style bundles) |
71
+ | `presets` | `Record<string, TypographyPreset>` | - | Typography presets — shorthand for `generateTypographyTokens()` |
72
+ | `globalStyles` | `Record<string, Styles>` | - | Global Tasty styles keyed by CSS selector |
73
+ | `plugins` | `TastyPlugin[]` | - | Plugins that bundle `functions`, `units`, `states`, `handlers`, `propHandlers`, `baseStyleProps`, `tokens`, `replaceTokens`, `recipes`, `presets`, `globalStyles`, `properties`, `keyframes`, `fontFaces`, and `counterStyles` (processed in order; later override earlier, and direct config wins over all). See [Plugins](plugins.md) |
74
+ | `gc` | `GCConfig` | - | Turns on automatic collection of unused styles: `{ touchInterval?, capacity?, grace? }` (defaults `1000`, `1000`, `10000` ms). Without it nothing is collected automatically; call `gc()` yourself |
75
+ | `batchInjection` | `boolean \| 'always'` | `false` | Defer stylesheet writes and apply them in one batch. See [Batched injection](#batched-injection) |
76
+ | `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | - | **Deprecated** — no longer has any effect. See [Color space](#color-space) |
77
+ | `namePrefix` | `string` | `'t'` (`tasty`) / `'ts'` (build-time) | Prefix prepended to every generated identifier (class, keyframe, counter-style names). Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. See [Name prefix](#name-prefix). |
78
+
79
+ ---
80
+
81
+ ## Batched Injection
82
+
83
+ Every `insertRule()` on a live stylesheet invalidates style for that sheet's
84
+ scope. Components inject during React's render phase, and if anything else reads
85
+ layout in the same pass, the two interleave:
86
+
87
+ ```
88
+ inject -> read (forced style recalc) -> inject -> read (forced recalc) -> ...
89
+ ```
90
+
91
+ A UI kit that measures during render — popovers, autosizing inputs, virtualized
92
+ lists — can turn one mount into a dozen full-tree recalculations. `batchInjection`
93
+ queues the writes instead and applies them together, so the tree is invalidated
94
+ once per flush.
95
+
96
+ ```tsx
97
+ import { configure, TastyBatchProvider } from '@tenphi/tasty';
98
+
99
+ configure({ batchInjection: true });
100
+
101
+ createRoot(el).render(
102
+ <TastyBatchProvider>
103
+ <App />
104
+ </TastyBatchProvider>,
105
+ );
106
+ ```
107
+
108
+ ### Why the provider is required
109
+
110
+ Deferring a write past React's layout phase would let a `useLayoutEffect`
111
+ measure an element whose rules are not in the sheet yet and read its _unstyled_
112
+ box — a wrong number, not a stale one, so it never self-corrects.
113
+
114
+ `TastyBatchProvider` closes that hole. It opens a _batch window_ during its
115
+ render and closes it — flushing — in `useInsertionEffect`, which React runs in
116
+ the mutation phase, before any layout effect:
117
+
118
+ ```
119
+ provider renders -> window OPEN
120
+ children render -> injections queued
121
+ provider insertionEffect -> FLUSH, window CLOSED
122
+ layout effects run -> rules are in the sheet
123
+ ```
124
+
125
+ With `batchInjection: true` a write is only ever queued inside such a window, so
126
+ turning the flag on can make injection cheaper but can never make a measurement
127
+ wrong. Injections outside a window are written straight through, exactly as with
128
+ batching off:
129
+
130
+ - a deep update that did not re-render the provider
131
+ - an injection from a layout effect, an event handler or an async callback
132
+ - SSR and RSC, where there is no live sheet at all
133
+
134
+ Mount the provider as high in the tree as you can: batching applies to the
135
+ commits it takes part in.
136
+
137
+ ### Modes
138
+
139
+ | Value | Behaviour |
140
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
141
+ | `false` (default) | One `insertRule()` per component, synchronously. |
142
+ | `true` | Batch inside a provider window only. Cannot affect measurement. Without the provider nothing is batched, and dev mode says so once. |
143
+ | `'always'` | Batch every injection, flushing on a microtask when no window is open. Covers more commits; a `useLayoutEffect` measuring a freshly mounted element can read its unstyled box. Paint is unaffected — microtasks always drain before the browser paints. |
144
+
145
+ ### Ordering
146
+
147
+ All writes share one FIFO queue — component rules, global rules, raw CSS,
148
+ `@property`, `@keyframes`, `@font-face`, `@counter-style` and `@function`.
149
+ Draining it in insertion order keeps the sheet byte-identical to unbatched
150
+ output, which matters because equal-specificity rules resolve by document order.
151
+
152
+ ### Client rendering, server rendering, and build-time extraction
153
+
154
+ **Server render — nothing to batch, safe to leave enabled.** SSR and RSC collect
155
+ CSS as text through `ServerStyleCollector`; the runtime injector never runs
156
+ there, so `batchInjection` changes nothing either way. `<TastyBatchProvider>`
157
+ renders its children and does nothing else: the window it opens is a no-op
158
+ without a `document`, and the `useInsertionEffect` that would close it never
159
+ fires on the server. Configure the flag once in shared code — no environment
160
+ branching needed.
161
+
162
+ **Hydration — the better your SSR coverage, the less there is to batch.**
163
+ `hydrateTastyClasses()` (wired up for you by `@tenphi/tasty/ssr/next` and the
164
+ Astro integration) pre-populates the injector from `window.__TASTY__`, so
165
+ hydrating a server-rendered class is a cache hit that produces no sheet write at
166
+ all. Batching pays off on what SSR could not cover: client-only routes, styles
167
+ that first appear after hydration (a `styles` prop that changes on interaction, a
168
+ modal or popover mounting), and dynamic tokens.
169
+
170
+ **Astro islands — one provider per island, or `'always'`.** Every island is its
171
+ own React root, so a provider inside one island does not open a window for
172
+ another. With `batchInjection: true`, wrap each island root that renders enough
173
+ tasty components to be worth it. `'always'` needs no provider and covers every
174
+ island, at the cost of the measurement hazard above. Either way, an island that
175
+ only re-hydrates server-rendered classes has nothing to batch.
176
+
177
+ **Build-time extraction (`tastyStatic`) — unaffected.** The Babel plugin never
178
+ touches the injector: the babel plugin emits either a CSS file import or an
179
+ `injectCSS()` call from `@tenphi/tasty/static/inject`, which appends text to a
180
+ single `<style data-tasty-static>` element. `batchInjection` only defers CSSOM
181
+ writes made by the browser injector, so extracted styles are unchanged. In an app
182
+ that mixes both, it still applies to the `tasty()` half.
183
+
184
+ ### `flushStyles()`
185
+
186
+ Applies every pending write immediately. Every injector read API calls it for
187
+ you — `getCSSText`, `getCSSTextForClasses`, `getCSSTextForNode`,
188
+ `getRawCSSText`, `isPropertyDefined`, `getMetrics`, `cleanup`, `gc` and
189
+ `destroy` — so a read never observes a partial sheet.
190
+ Call it directly before measuring in code that runs outside a batch window under
191
+ `'always'`:
192
+
193
+ ```tsx
194
+ import { flushStyles } from '@tenphi/tasty';
195
+
196
+ useLayoutEffect(() => {
197
+ flushStyles();
198
+ const { width } = ref.current.getBoundingClientRect();
199
+ }, []);
200
+ ```
201
+
202
+ `hasPendingStyleWrites()` reports whether anything is queued, and
203
+ `resetStyleBatch()` drops the queue without applying it (tests only).
62
204
 
63
205
  ---
64
206
 
65
207
  ## Color Space
66
208
 
67
- Controls the CSS color space used for decomposed color token companion variables. When you define `#name` color tokens, tasty generates both `--name-color` (full color) and `--name-color-{suffix}` (decomposed components for alpha composition).
209
+ > **Deprecated.** `configure({ colorSpace })` no longer has any effect and will
210
+ > be removed in the next major. Setting it warns in development.
211
+
212
+ A `#name` token's value used to be rewritten into a configured color space, so
213
+ `#brand: '#ff8800'` declared `--brand-color: oklch(0.75 0.16 55)`. That existed
214
+ to serve the opacity suffix, which needed numeric channels to write an alpha
215
+ into. Opacity now uses CSS relative color syntax —
216
+ `oklch(from var(--brand-color) l c h / .5)` — which has the browser read the
217
+ channels, so there is nothing left for the setting to decide.
218
+
219
+ A color is emitted exactly as authored:
220
+
221
+ ```jsx
222
+ configure({ tokens: { '#brand': '#ff8800' } });
223
+ // → --brand-color: #ff8800
224
+ ```
225
+
226
+ That holds for every form: a hex literal, a native color function, a bare CSS
227
+ color name, a `color-mix()`, a `light-dark()`, a fallback chain. A `#token`
228
+ reference still resolves to its `var()` chain, and a plugin color function such
229
+ as `okhsl()` is still resolved by the parser to the color it denotes.
230
+
231
+ To address a token's channels, use relative color syntax against the token:
232
+
233
+ ```css
234
+ background: oklch(from var(--brand-color) calc(l * 1.2) c h);
235
+ ```
236
+
237
+ This works on any `<color>`, including the ones no build-time conversion could
238
+ have evaluated — and it is what the [opacity suffix](dsl.md#color-tokens--opacity)
239
+ itself uses. Its space is always `oklch`, which is unbounded, so a wide-gamut
240
+ color survives a round trip a narrower space would clamp.
241
+
242
+ ### Migrating off `colorSpace`
243
+
244
+ Drop the option. If you relied on the uniform output format, nothing in Tasty
245
+ needs it — author your tokens in the space you want them emitted in, since the
246
+ value now passes through untouched:
247
+
248
+ ```jsx
249
+ // before: any input, normalized to the configured space on the way out
250
+ configure({ colorSpace: 'oklch', tokens: { '#brand': '#ff8800' } });
251
+
252
+ // after: author it in the space you want
253
+ configure({ tokens: { '#brand': 'oklch(0.75 0.16 55)' } });
254
+ ```
255
+
256
+ ### Migrating off the channel companions
257
+
258
+ A `#name` token used to declare a second variable beside `--name-color` holding
259
+ its channels decomposed, suffixed with the configured space —
260
+ `--brand-color-oklch: 0.75 0.16 55` — and a `color` style emitted
261
+ `--current-color-{space}` beside `--current-color`. Both are gone, for the same
262
+ reason: they existed so an opacity suffix had channels to write an alpha into.
263
+
264
+ These were never part of the public API, but they were visible in the emitted
265
+ CSS, so hand-authored CSS may reference one. Address the token itself instead:
266
+
267
+ ```css
268
+ /* before */
269
+ color: oklch(var(--brand-color-oklch) / 0.5);
270
+ background: oklch(var(--brand-color-oklch));
271
+
272
+ /* after */
273
+ color: oklch(from var(--brand-color) l c h / 0.5);
274
+ background: var(--brand-color);
275
+ ```
276
+
277
+ The replacement is strictly more capable — the companion could only be
278
+ decomposed for a color the engine could evaluate at build time, while relative
279
+ color syntax works on every `<color>`, including a `color-mix()`, a
280
+ `light-dark()`, and a variable Tasty never defined.
281
+
282
+ ---
283
+
284
+ ## Name Prefix
285
+
286
+ Every identifier Tasty generates — class names, keyframe names, counter-style names — starts with a configurable prefix. The `tasty()` client, SSR, and RSC paths default to `'t'`; the build-time extraction path (`tastyStatic` via the Babel plugin) defaults to `'ts'` so extracted classes can never collide with `tasty()` classes when both are loaded on the same page.
68
287
 
69
288
  ```jsx
70
289
  configure({
71
- colorSpace: 'oklch', // default
290
+ namePrefix: 'mb',
72
291
  });
73
292
  ```
74
293
 
75
- | Color Space | Suffix | Components Format | Alpha Syntax |
76
- |---|---|---|---|
77
- | `rgb` | `-rgb` | `255 128 0` | `rgb(var(--name-color-rgb) / .5)` |
78
- | `hsl` | `-hsl` | `300 100% 25%` | `hsl(var(--name-color-hsl) / .5)` |
79
- | `oklch` | `-oklch` | `0.42 0.16 328` | `oklch(var(--name-color-oklch) / .5)` |
294
+ The prefix is prepended verbatim to the hash, so include any separator inside the prefix string itself:
295
+
296
+ | Setting | Class | Keyframe | Counter-style |
297
+ | --------------------------- | ------------- | -------------- | -------------- |
298
+ | `'t'` (`tasty` default) | `t1a2b3` | `tk1a2b3` | `tc1a2b3` |
299
+ | `'ts'` (build-time default) | `ts1a2b3` | `tsk1a2b3` | `tsc1a2b3` |
300
+ | `'mb'` | `mb1a2b3` | `mbk1a2b3` | `mbc1a2b3` |
301
+ | `'myapp-'` | `myapp-1a2b3` | `myapp-k1a2b3` | `myapp-c1a2b3` |
302
+
303
+ The single-letter discriminators (`k` for keyframes, `c` for counter-styles) keep the three kinds visually distinct in devtools — they are not required for correctness because CSS keeps these in separate namespaces.
80
304
 
81
- The `oklch` color space is the default because it provides perceptually uniform color manipulation — alpha fading and color mixing produce more natural-looking results.
305
+ ### Rules
306
+
307
+ - Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. Examples that pass: `'t'`, `'ts'`, `'app'`, `'myapp-'`, `'_foo'`. Examples that fail: `''`, `'1foo'`, `'my app'`.
308
+ - Validated at `configure()` time; an invalid prefix throws synchronously rather than silently producing broken hydration.
309
+ - Locked once styles have been generated, like all other config.
310
+
311
+ ### Coexistence with build-time extraction
312
+
313
+ The `tasty()` and `tastyStatic()` paths **must use different prefixes** when both are loaded on the same page. Defaults already guarantee this; if you customize one, customize the other accordingly:
314
+
315
+ ```jsx
316
+ // app config (client / SSR / RSC)
317
+ configure({ namePrefix: 'mb' });
318
+
319
+ // tasty-zero.config.ts (Babel plugin)
320
+ export default { namePrefix: 'mbs' };
321
+ ```
322
+
323
+ If you only use one of the two builds, you only need to set `namePrefix` on that path.
82
324
 
83
325
  ---
84
326
 
@@ -91,8 +333,7 @@ Tokens support state maps for responsive or theme-aware values:
91
333
  ```jsx
92
334
  configure({
93
335
  tokens: {
94
- '$gap': '4px',
95
- '$radius': '6px',
336
+ '$sidebar-width': '280px',
96
337
  '#primary': {
97
338
  '': '#purple',
98
339
  '@dark': '#light-purple',
@@ -106,9 +347,11 @@ configure({
106
347
  ```
107
348
 
108
349
  - `$name` keys become `--name` CSS custom properties
109
- - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties (suffix depends on `colorSpace`, default `oklch`)
350
+ - `#name` keys become `--name-color` custom properties
351
+ - Tokens do not change units: `2x` stays `16px` whatever `$gap` is. To drive a unit from a token, point the unit at it: `units: { x: 'var(--gap)' }` makes `2x` compile to `calc(2 * var(--gap))`
352
+ - Names keep their case, since CSS custom properties are case-sensitive: `$myVar` is `--myVar` and is referenced as `$myVar`. A leading capital is not supported and folds — `$Foo` and `#Purple` become `--foo` and `--purple-color` — so start names lowercase. Kebab-case (`$my-var`) remains the convention.
110
353
 
111
- Tokens are automatically emitted in all rendering modes: runtime (client), SSR, and zero-runtime (Babel plugin).
354
+ Tokens are emitted by the client injector, by the SSR collector (`TastyRegistry`, `tastyIntegration()`, `runWithCollector()`), by the `withTastyNext()` shared stylesheet, and by the Babel plugin. The inline React Server Component path without a collector does not emit them — see [Server-Side Rendering](ssr.md).
112
355
 
113
356
  ---
114
357
 
@@ -141,7 +384,7 @@ Register custom fonts globally so every component can reference them by family n
141
384
 
142
385
  ```ts
143
386
  configure({
144
- fontFace: {
387
+ fontFaces: {
145
388
  'Brand Sans': [
146
389
  {
147
390
  src: 'url("/fonts/brand-regular.woff2") format("woff2")',
@@ -162,9 +405,9 @@ configure({
162
405
  });
163
406
  ```
164
407
 
165
- Now any component can use `fontFamily: '"Brand Sans", sans-serif'` and the browser will already have the `@font-face` rules in the stylesheet.
408
+ Now any component can use `font: '"Brand Sans", sans-serif'` and the browser will already have the `@font-face` rules in the stylesheet.
166
409
 
167
- See [Font Face (`@fontFace`)](dsl.md#font-face-fontface) for inline usage inside component styles and the full list of supported descriptors.
410
+ See [Font Face (`@font-face`)](dsl.md#font-face-font-face) for inline usage inside component styles and the full list of supported descriptors.
168
411
 
169
412
  ---
170
413
 
@@ -174,7 +417,7 @@ Define custom list-marker algorithms globally. Rules are injected eagerly when s
174
417
 
175
418
  ```ts
176
419
  configure({
177
- counterStyle: {
420
+ counterStyles: {
178
421
  thumbs: {
179
422
  system: 'cyclic',
180
423
  symbols: '"👍"',
@@ -190,7 +433,102 @@ configure({
190
433
 
191
434
  Components can then reference `listStyleType: 'thumbs'` directly.
192
435
 
193
- See [Counter Style (`@counterStyle`)](dsl.md#counter-style-counterstyle) for inline usage inside component styles and the full list of supported descriptors.
436
+ See [Counter Style (`@counter-style`)](dsl.md#counter-style-counter-style) for inline usage inside component styles and the full list of supported descriptors.
437
+
438
+ ---
439
+
440
+ ## Functions
441
+
442
+ The single `functions` map holds both kinds of custom functions, discriminated by the value type:
443
+
444
+ - **Parse functions** — a **bare key** with a **function value** `(groups) => string`. Runs at parse time and is called as `name(...)`. Use these for computed/derived CSS that JavaScript produces (e.g. color-space conversions).
445
+ - **CSS `@function` definitions** — a **`$$name` key** with an **object value** (a [`FunctionDefinition`](https://developer.mozilla.org/en-US/docs/Web/CSS/@function)). Injected eagerly as a native `@function` rule and called as `$$name(...)` (→ `--name(...)`).
446
+
447
+ ```ts
448
+ configure({
449
+ functions: {
450
+ // Parse function — bare key, function value
451
+ double: (groups) => `calc(2 * ${groups[0]?.output ?? '0'})`,
452
+
453
+ // CSS @function — `$$` key, object value
454
+ $$negative: { args: ['$value'], result: '(-1 * $value)' },
455
+ $$shadow: {
456
+ args: { '$shadow-color': { syntax: '<color>', default: 'inherit' } },
457
+ returns: '<color>',
458
+ $offset: '2px',
459
+ result: '$offset $offset ($shadow-color, black)',
460
+ },
461
+ },
462
+ });
463
+ ```
464
+
465
+ Components then invoke parse functions as `double(...)` and CSS functions with the `$$name(...)` sugar, e.g. `margin: '$$negative(10px) top'`.
466
+
467
+ > A key whose prefix doesn't match its value type (an object under a bare key, or a function under a `$$` key) is **ignored with a dev-mode warning**.
468
+
469
+ See [Functions (`@function`)](dsl.md#functions-function) for inline usage inside component styles, the full descriptor shape, and token conventions. `@function` is an experimental CSS feature — unsupported browsers safely ignore the native rule (see the polyfill below).
470
+
471
+ ### Custom color functions
472
+
473
+ A parse function whose output is an already-supported color (`rgb`, `hsl`, `#…`, `oklch`, …) is treated as a **color function**: it works everywhere a color is accepted — style values, `parseColor`, and the `#token.alpha` opacity suffix, which calls the function with a `/ alpha` part appended (read `groups[0].parts[1]`, as below) — with no extra registration. This is the same mechanism the built-in `okhsl`/`okhst` plugins use; they are ordinary plugins registered by default.
474
+
475
+ ```ts
476
+ import { configure, createColorFunc } from '@tenphi/tasty';
477
+
478
+ // A custom color space is just a `functions` entry.
479
+ const myColorPlugin = () => ({
480
+ name: 'mycolor',
481
+ functions: {
482
+ // Hand-written parse function:
483
+ mycolor: (groups) => {
484
+ // `mycolor(255 0 0 / .5)` and `#brand.5` both arrive as two parts
485
+ const [main, alpha] = groups[0].parts;
486
+ const [r, g, b] = main.all;
487
+ return alpha?.all.length
488
+ ? `rgb(${r} ${g} ${b} / ${alpha.output})`
489
+ : `rgb(${r} ${g} ${b})`;
490
+ },
491
+ },
492
+ });
493
+
494
+ configure({ plugins: [myColorPlugin()] });
495
+
496
+ // Now `mycolor(...)` is a color in every context:
497
+ // fill: 'mycolor(255 0 0)'
498
+ // fill: '#brand.5' (with replaceTokens: { '#brand': 'mycolor(255 0 0)' })
499
+ ```
500
+
501
+ For HSL-style color spaces (a hue angle plus two percentages), the exported `createColorFunc(name, convert, label?)` helper handles angle/percentage parsing, clamping, alpha, and caching. `convert` returns sRGB `[r, g, b]` in 0-1; `label` is an optional string used only in dev warnings (e.g. `'H S L'`) and has no effect on output. This is exactly how `okhslPlugin`/`okhstPlugin` are implemented.
502
+
503
+ ---
504
+
505
+ ## Polyfills
506
+
507
+ `@function` only ships natively in Chromium 139+. To use CSS functions in browsers that don't support the at-rule yet (Firefox, Safari), enable the **functions polyfill**, which expands every `$$name(...)` call into plain CSS (`calc()`/`var()`/`color-mix()`) at parse time instead of emitting the native `@function` rule:
508
+
509
+ ```ts
510
+ configure({
511
+ polyfills: {
512
+ functions: true, // default: false
513
+ },
514
+ functions: {
515
+ $$negative: { args: ['$value'], result: '(-1 * $value)' },
516
+ },
517
+ });
518
+
519
+ // Now `margin: '$$negative(10px) top'` renders `margin: calc(-1 * 10px) 0 0 0`
520
+ // — no native @function rule is emitted.
521
+ ```
522
+
523
+ This works across all rendering modes (client, SSR/RSC, and `tastyStatic`) because expansion happens in the parser. Note `polyfills.functions` (the feature toggle) is distinct from the top-level `functions` (the definitions map).
524
+
525
+ **Decided limitations when the polyfill is on:**
526
+
527
+ - **No native fallback** — functions are always inlined; we do exactly what is configured.
528
+ - **Conditional results** (`@media`/`@supports`/`if()` inside `result`) are inlined verbatim; the conditional nuance is not resolved per-element.
529
+ - **Typed params / `returns`** are dropped (inlining is purely lexical substitution).
530
+ - **Param name collisions** are avoided by fully inlining argument values (no function-internal custom properties are emitted) and by namespacing the function's own variables.
531
+ - **Recursion** — self/mutually-recursive functions are not expanded; the cycle guard bails and leaves the call untouched.
194
532
 
195
533
  ---
196
534
 
@@ -214,35 +552,117 @@ configure({
214
552
  });
215
553
  ```
216
554
 
217
- Recipe values are flat tasty styles (no sub-element keys). They may contain base styles, tokens, local states, `@keyframes`, and `@properties`. Recipes cannot reference other recipes.
555
+ Recipe values are flat tasty styles (no sub-element keys). They may contain base styles, tokens, local states, `@keyframes`, and `@property`.
556
+
557
+ **Recipes cannot reference other recipes.** A `recipe` key inside a configured recipe's value is not recursively resolved:
558
+
559
+ ```jsx
560
+ // Unsupported: applying 'elevatedCard' does not expand 'card elevated'.
561
+ configure({
562
+ recipes: {
563
+ elevatedCard: {
564
+ recipe: 'card elevated',
565
+ padding: '6x',
566
+ },
567
+ },
568
+ });
569
+ ```
570
+
571
+ Instead, compose the names where you apply the styles: `styles: { recipe: 'card elevated', padding: '6x' }`. Recipe references are resolved on the component root and independently inside each sub-element's styles (for example, `styles: { Panel: { recipe: 'card elevated' } }`). This sub-element support does not allow one recipe definition to inherit another. Tasty warns in development when a recipe definition contains a `recipe` key.
218
572
 
219
573
  For how to apply, compose, and override recipes in components, see [Recipes](dsl.md#recipes) in the Style DSL reference.
220
574
 
221
575
  ---
222
576
 
577
+ ## Typography Presets
578
+
579
+ Typography presets are a shorthand for `generateTypographyTokens()`. Instead of calling the function manually and spreading the result into `tokens`, pass the presets directly:
580
+
581
+ ```jsx
582
+ configure({
583
+ presets: {
584
+ h1: { fontSize: '32px', lineHeight: '1.2', fontWeight: '700' },
585
+ t2: { fontSize: '16px', lineHeight: '1.5', fontWeight: '400' },
586
+ tag: {
587
+ fontSize: '10px',
588
+ lineHeight: '1.4',
589
+ letterSpacing: '0.04em',
590
+ fontWeight: '600',
591
+ },
592
+ },
593
+ });
594
+ ```
595
+
596
+ Each preset generates `$name-font-size`, `$name-line-height`, `$name-letter-spacing`, `$name-font-weight`, and optional `$name-bold-font-weight`, `$name-icon-size`, `$name-text-transform`, `$name-font-family`, `$name-font-style` tokens.
597
+
598
+ Preset values support state maps for responsive or theme-aware typography:
599
+
600
+ ```jsx
601
+ configure({
602
+ presets: {
603
+ t2: {
604
+ fontSize: '16px',
605
+ lineHeight: '1.5',
606
+ fontWeight: { '': '400', '@dark': '300' },
607
+ },
608
+ },
609
+ });
610
+ ```
611
+
612
+ The generated tokens are merged **under** explicit `tokens` — if both `presets` and `tokens` define `$t2-font-weight`, the `tokens` value wins. Plugins can also provide `presets`; plugin presets are merged first, then config presets, then explicit tokens on top.
613
+
614
+ ---
615
+
616
+ ## Global Styles
617
+
618
+ Apply Tasty styles to any selector via configuration, without needing `useGlobalStyles(selector, ...)` at runtime:
619
+
620
+ ```jsx
621
+ configure({
622
+ globalStyles: {
623
+ body: {
624
+ fill: '#surface',
625
+ color: '#text',
626
+ preset: 't2',
627
+ margin: 0,
628
+ font: 'system-ui, sans-serif',
629
+ },
630
+ html: {
631
+ overflow: 'hidden',
632
+ },
633
+ },
634
+ });
635
+ ```
636
+
637
+ Each key is a CSS selector (a list such as `'.uni-checkbox, uni-checkbox'` styles every item), and each value is a Tasty `Styles` object supporting the full style syntax including style properties, tokens, state maps, `@keyframes`, and selector-based sub-styling (e.g. `$: '> .app'` for elements outside React scope). Global styles are injected alongside `:root` tokens when the first style is rendered.
638
+
639
+ Global styles are automatically emitted in all delivery modes: client rendering, server rendering, and build-time extraction with the Babel plugin. Plugins can also provide `globalStyles`; they are merged per selector with config global styles (config wins on conflict).
640
+
641
+ ---
642
+
223
643
  ## Auto Property Types
224
644
 
225
645
  CSS cannot transition or animate custom properties unless their type is declared via [`@property`](https://developer.mozilla.org/en-US/docs/Web/CSS/@property). Tasty handles this automatically — when a custom property is assigned a concrete value (e.g. `'$scale': 1`, `'$gap': '10px'`, `'#accent': 'purple'`), the type is inferred and a `@property` rule is registered.
226
646
 
227
- This works across all declaration contexts: component styles, `@keyframes`, global config, and the zero-runtime Babel plugin. It also resolves `var()` chains — if `$a` references `var(--b)`, the type propagates once `--b` is resolved.
647
+ This works across all declaration contexts: component styles, `@keyframes`, global config, and build-time extraction with the Babel plugin. It also resolves `var()` chains — if `$a` references `var(--b)`, the type propagates once `--b` is resolved.
228
648
 
229
649
  Supported types:
230
650
 
231
- | Detection | Inferred syntax |
232
- |-----------|-----------------|
233
- | `1`, `0.5`, `-3` (bare numbers) | `<number>` |
234
- | `10px`, `2rem`, `100vw` (length units) | `<length>` |
235
- | `50%` | `<percentage>` |
236
- | `45deg`, `0.5turn` (angle units) | `<angle>` |
237
- | `300ms`, `1s` (time units) | `<time>` |
238
- | `#name` tokens (by naming convention) | `<color>` |
651
+ | Detection | Inferred syntax |
652
+ | -------------------------------------- | --------------- |
653
+ | `1`, `0.5`, `-3` (bare numbers) | `<number>` |
654
+ | `10px`, `2rem`, `100vw` (length units) | `<length>` |
655
+ | `50%` | `<percentage>` |
656
+ | `45deg`, `0.5turn` (angle units) | `<angle>` |
657
+ | `300ms`, `1s` (time units) | `<time>` |
658
+ | `#name` tokens (by naming convention) | `<color>` |
239
659
 
240
- Auto-inferred properties use `inherits: true` (the CSS default). Use explicit `@properties` when you need different settings:
660
+ Auto-inferred properties use `inherits: true` (the CSS default). Use explicit `@property` when you need different settings:
241
661
 
242
662
  ```jsx
243
663
  // In component styles
244
664
  styles: {
245
- '@properties': {
665
+ '@property': {
246
666
  '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
247
667
  },
248
668
  }
@@ -255,7 +675,7 @@ configure({
255
675
  });
256
676
  ```
257
677
 
258
- To disable auto-inference entirely (only explicit `@properties` will be used):
678
+ To disable auto-inference entirely (only explicit `@property` will be used):
259
679
 
260
680
  ```jsx
261
681
  configure({ autoPropertyTypes: false });
@@ -267,27 +687,25 @@ configure({ autoPropertyTypes: false });
267
687
 
268
688
  Override or extend the built-in style property handlers. A handler definition can take three forms:
269
689
 
270
- | Form | Syntax | Description |
271
- |------|--------|-------------|
272
- | Function only | `handler` | Triggered by its key name; receives only that property |
273
- | Single dep | `['styleName', handler]` | Triggered by the specified style property |
274
- | Multi dep | `[['dep1', 'dep2', ...], handler]` | Triggered by any of the listed properties; receives all of them |
690
+ | Form | Syntax | Description |
691
+ | ------------- | ---------------------------------- | --------------------------------------------------------------- |
692
+ | Function only | `handler` | Triggered by its key name; receives only that property |
693
+ | Single dep | `['styleName', handler]` | Triggered by the specified style property |
694
+ | Multi dep | `[['dep1', 'dep2', ...], handler]` | Triggered by any of the listed properties; receives all of them |
275
695
 
276
- The multi-dep form is useful when output depends on several style properties together (e.g., `gap` needs to know `display` and `flow` to decide the CSS strategy).
696
+ The multi-dep form is useful when output depends on several style properties together (e.g., `gap` needs to know `display` and `flow` to decide the CSS strategy). A handler whose dependencies include a built-in style takes over that style's whole group — see [Replacing a built-in handler](#replacing-a-built-in-handler). Use `defineHandler` for it and the dependency types are inferred from the dependency list, so a typo in the destructure is a type error instead of a silent `undefined`.
277
697
 
278
698
  ```jsx
279
- import { configure, styleHandlers } from '@tenphi/tasty';
699
+ import {
700
+ configure,
701
+ defineHandler,
702
+ parseColor,
703
+ parseStyle,
704
+ styleHandlers,
705
+ } from '@tenphi/tasty';
280
706
 
281
707
  configure({
282
708
  handlers: {
283
- // Function only — overrides built-in fill handler
284
- fill: ({ fill }) => {
285
- if (fill?.startsWith('gradient:')) {
286
- return { background: fill.slice(9) };
287
- }
288
- return styleHandlers.fill({ fill });
289
- },
290
-
291
709
  // Function only — new single-prop handler
292
710
  elevation: ({ elevation }) => {
293
711
  const level = parseInt(elevation) || 1;
@@ -297,30 +715,229 @@ configure({
297
715
  };
298
716
  },
299
717
 
300
- // Multi dep — handler reads multiple style properties
301
- gap: [['display', 'flow', 'gap'], ({ display, flow, gap }) => {
302
- if (!gap) return;
303
- const isGrid = display?.includes('grid');
304
- return { gap: isGrid ? gap : `/* custom logic for ${flow} */` };
305
- }],
718
+ // Overriding a built-in: declare every style the built-in handled and pass
719
+ // them all through, or the ones you leave out stop working (see below).
720
+ fill: defineHandler(
721
+ [
722
+ 'fill',
723
+ 'backgroundColor',
724
+ 'image',
725
+ 'backgroundImage',
726
+ 'backgroundPosition',
727
+ 'backgroundSize',
728
+ 'backgroundRepeat',
729
+ 'backgroundAttachment',
730
+ 'backgroundOrigin',
731
+ 'backgroundClip',
732
+ 'background',
733
+ ],
734
+ (props) => {
735
+ if (
736
+ typeof props.fill === 'string' &&
737
+ props.fill.startsWith('gradient:')
738
+ ) {
739
+ return { background: props.fill.slice(9) };
740
+ }
741
+ return styleHandlers.fill(props);
742
+ },
743
+ ),
744
+
745
+ // Multi dep — triggered by either name, receives both
746
+ stripe: defineHandler(
747
+ ['stripe', 'stripeColor'],
748
+ ({ stripe, stripeColor }) => {
749
+ if (!stripe) return;
750
+ const width = parseStyle(String(stripe)).output;
751
+ const color = stripeColor
752
+ ? parseColor(String(stripeColor)).color
753
+ : 'currentcolor';
754
+ return { 'border-left': `${width} solid ${color}` };
755
+ },
756
+ ),
306
757
  },
307
758
  });
308
759
  ```
309
760
 
761
+ ### Return shape
762
+
763
+ A handler returns a `CSSMap`, an array of them, or nothing:
764
+
765
+ - Keys are **kebab-case** CSS property names (`'background-color'`, not `backgroundColor`) or `--custom-property` names. A camelCase key warns in development and is emitted verbatim, which the browser ignores.
766
+ - Values are stringified, so numbers are fine (`{ '-webkit-line-clamp': 3 }`).
767
+ - The reserved `$` key is a **selector suffix**: `{ $: '& > *:not(:last-child)', 'margin-right': gap }` applies the declarations to a nested selector. It accepts an array to fan out over several.
768
+ - Return an array of maps to emit several declaration sets, each with its own `$`.
769
+
770
+ Values arrive **state-resolved but unparsed** — the raw authored DSL string (`'2x'`, `'#purple.5'`, `true`, `4`). Call the exported `parseStyle()` / `parseColor()` yourself; nothing parses them for you.
771
+
772
+ ### Replacing a built-in handler
773
+
774
+ Built-in handlers are shared across several style names. Registering a handler for one of those names unregisters the built-in from **all** of them, and the displaced names then fall back to auto-generated CSS aliases — so `hide: true` starts emitting a literal `hide: true` declaration. A development-mode warning lists exactly what was displaced.
775
+
776
+ The shared groups worth knowing:
777
+
778
+ | Registering a handler for | Also takes over |
779
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
780
+ | `fill` | `backgroundColor`, `image`, `backgroundImage`, `backgroundPosition`, `backgroundSize`, `backgroundRepeat`, `backgroundAttachment`, `backgroundOrigin`, `backgroundClip`, `background` |
781
+ | `display` | `hide`, `whiteSpace`, `textOverflow`, `flow`, `gap` |
782
+ | `flow` | `gap` |
783
+ | `preset` | `font`, `fontFamily`, `fontSize`, `fontWeight`, `fontStyle`, `lineHeight`, `letterSpacing`, `textTransform` |
784
+ | `padding` / `margin` | their `Top`/`Right`/`Bottom`/`Left` longhands (`paddingTop`, `marginLeft`, …) |
785
+ | `inset` | `top`, `right`, `bottom`, `left` |
786
+ | `width` / `height` | `minWidth`/`maxWidth`, `minHeight`/`maxHeight` |
787
+
788
+ A multi-dep handler takes over every group its dependencies touch: `defineHandler(['display', 'flow', 'gap'], …)` takes over `display`, `flow`, and `gap` together, so it must emit `display` and `flex-flow` itself.
789
+
790
+ Either declare the whole group and delegate the rest to `styleHandlers.*`, or pick a name that isn't shared.
791
+
792
+ ### Chunk membership
793
+
794
+ Tasty renders and caches CSS in independent chunks, and a chunk's cache key covers only its own style values. All of a handler's dependencies must therefore live in one chunk. Custom style names are pulled into their handler's chunk automatically at registration; a handler whose dependencies span two _built-in_ chunks (say `fill` and `padding`) warns, because it would be invoked once per chunk with a subset of its inputs.
795
+
796
+ `configure({ handlers })` must run before the first render, like every other config option.
797
+
310
798
  ---
311
799
 
312
- ## Extending Style Types (TypeScript)
800
+ ## Props Middleware
313
801
 
314
- Use module augmentation to extend the `StylesInterface`:
802
+ `propHandlers` are middleware over a component's props — props in, props out. Where a style _handler_ turns a style property into CSS declarations, a prop handler turns a **component prop** into other props, including `styles`. It is the extension point for props whose value isn't a style value.
803
+
804
+ ```jsx
805
+ import { configure, mergeStyles } from '@tenphi/tasty';
806
+
807
+ configure({
808
+ propHandlers: {
809
+ glaze: (props) => {
810
+ const { glaze, ...rest } = props;
811
+ if (!glaze) return rest;
812
+
813
+ return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
814
+ },
815
+ },
816
+ });
817
+
818
+ <Element glaze="purple" />;
819
+ ```
820
+
821
+ The map key is the handler's name and, by default, the prop that triggers it, so an absent prop costs one property check rather than a call. A tuple overrides that: `['glaze', fn]`, `[['glaze', 'tint'], fn]`, or `['*', fn]` for unconditional.
822
+
823
+ Handlers run at the very top of every component's render, before any prop is destructured, so one can rewrite `styles`, `mods`, `tokens`, `variant`, `as`, `element`, and `qa`. They run in registration order — plugins first, then direct config — each receiving the previous one's output.
824
+
825
+ Handlers must be **pure** and must not mutate their input, and should memoize the styles they build per input value: style values are cached by object identity, so mutating one in place yields stale CSS, and a reference-stable object avoids re-serializing on every render.
826
+
827
+ Injected styles occupy the `styles` slot, so they beat a component's own default styles and lose to a style prop at the call site. Prop handlers do not apply to sub-elements or to build-time `tastyStatic()`, which has no props.
828
+
829
+ See [Plugins → Props middleware](plugins.md#props-middleware) for the full contract and a worked example.
830
+
831
+ ---
832
+
833
+ ## Base Style Props
834
+
835
+ `baseStyleProps` exposes style properties as props on **every** `tasty()` component, on top of the built-in base styles (`display`, `font`, `preset`, `hide`, `whiteSpace`, `opacity`, `transition`):
836
+
837
+ ```jsx
838
+ configure({ baseStyleProps: ['radius', 'shadow'] });
839
+
840
+ <Card radius="1r" shadow />;
841
+ ```
842
+
843
+ `configure()` may run after your components are defined — each factory resolves its prop list lazily.
844
+
845
+ Each name costs one property check per render of every component, and the effect is app-global, so keep the list short and use a factory's own `styleProps` for anything narrower. Avoid names that collide with real DOM or component props (`width`, `size`, `color`), since every component will then swallow them as styles.
846
+
847
+ ---
848
+
849
+ ## TypeScript
850
+
851
+ Component props are typed from the `tasty()` definition with no setup. Module augmentation adds the names your design system defines and the extensions your plugins add.
852
+
853
+ ### Component props
854
+
855
+ | In `tasty({ … })` | Adds the props |
856
+ | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
857
+ | `styleProps: ['gap', 'padding'] as const` | `gap`, `padding`, each typed like the style: a value or a state map |
858
+ | `modProps: { isLoading: Boolean, size: ['sm', 'md', 'lg'] as const }` | `isLoading?: boolean`, `size?: 'sm' \| 'md' \| 'lg'` (`String` gives `string`, `Number` gives `number`) |
859
+ | `modProps: ['isLoading'] as const` | `isLoading?: ModValue` |
860
+ | `tokenProps: ['progress', 'accentColor'] as const` | `progress?: TokenValue`, `accentColor?: TokenValue` |
861
+ | `variants: { default: {…}, danger: {…} }` | `variant?: 'default' \| 'danger'` |
862
+ | `elements: { Title: 'h3' }` | `Card.Title`, with the `h3` props plus `qa`, `qaVal`, `mods`, `tokens`, `isDisabled`, `isHidden`, `isChecked`, and a `ref` typed as `HTMLHeadingElement`; no `styles` |
863
+ | `as: SomeComponent` | `SomeComponent`'s own props, required ones still required |
864
+
865
+ Write the array forms with `as const`. Without it, `modProps: ['isLoading']` widens to `string[]` and every prop on the component is typed `ModValue`, so an `onClick` handler no longer type-checks. A `modProps` value list without `as const` widens to `string`.
866
+
867
+ `tasty(Base, { … })` keeps `Base`'s prop types and adds none for the options above, which that form ignores — see [Extend an existing component](react-api.md#extend-an-existing-component).
868
+
869
+ ### Registering your names and extensions
870
+
871
+ ```ts
872
+ // tasty.d.ts — keep the import: it makes this file a module, so the block
873
+ // below extends '@tenphi/tasty' instead of replacing it.
874
+ import '@tenphi/tasty';
315
875
 
316
- ```tsx
317
- // tasty.d.ts
318
876
  declare module '@tenphi/tasty' {
877
+ interface TastyNamedColors {
878
+ surface: true;
879
+ text: true;
880
+ primary: true;
881
+ }
882
+ interface TastyPresetNames {
883
+ h1: true;
884
+ t2: true;
885
+ }
886
+ interface TastyThemeNames {
887
+ danger: true;
888
+ success: true;
889
+ }
319
890
  interface StylesInterface {
320
- elevation?: string;
321
- gradient?: string;
891
+ stripe?: string;
892
+ }
893
+ interface TastyCustomProps {
894
+ glaze: 'soft' | 'strong' | { tone: string; intensity?: number };
895
+ }
896
+ interface TastyBaseStylePropNames {
897
+ radius: true;
898
+ stripe: true;
322
899
  }
323
900
  }
324
901
  ```
325
902
 
326
- See [Style DSL](dsl.md) for state maps, tokens, units, and extending semantics, and [Runtime API](runtime.md) for `tasty()`, hooks, and component props.
903
+ | Interface | Register | What it types |
904
+ | ------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------ |
905
+ | `TastyNamedColors` | Color token names from `tokens` and `replaceTokens`, without the `#` | Suggestions for `#name` and `#name.50` in `fill`, `color`, and `svgFill` |
906
+ | `TastyPresetNames` | `presets` names | The `preset` style and prop |
907
+ | `TastyThemeNames` | Theme names | The `theme` prop (rendered as `data-theme`) |
908
+ | `StylesInterface` | Style properties added with `handlers` | Their value type in `styles`, `styleProps`, and base style props |
909
+ | `TastyCustomProps` | Props added with `propHandlers` | An optional prop on every `tasty()` component (not on sub-elements) |
910
+ | `TastyBaseStylePropNames` | Names passed to `baseStyleProps` | A prop on every component, typed like the style it names |
911
+
912
+ - The first three add autocomplete, not checking: any other string still type-checks (`preset: 'h9'` compiles). The ESLint plugin is what reports unknown names.
913
+ - In `StylesInterface`, declare the plain value type (`stripe?: string`). Tasty adds state-map support itself, as it does for built-in styles.
914
+ - A custom style name in `styles` type-checks without augmentation, but `styleProps` and `TastyBaseStylePropNames` accept only names in `StylesInterface`. A base style prop name missing from it adds no prop.
915
+ - `TastyCustomProps` types the component prop, not the handler. A prop handler receives `Record<string, unknown>`, so cast inside it (`rest.styles as Styles`).
916
+ - State keys, `$` value tokens, units, and recipe names have no TypeScript types. The ESLint plugin checks them against `tasty.config.ts`.
917
+
918
+ ### `tasty.config.ts`
919
+
920
+ TypeScript augmentation does not reach the linter or the editor. [`@tenphi/eslint-plugin-tasty`](https://github.com/tenphi/eslint-plugin-tasty) and the Tasty VS Code extension read a `tasty.config.ts` (or `.js`, `.json`) at the project root instead. It only lists names: it is not passed to `configure()`, and it is unrelated to the Babel plugin's `configFile` (such as `tasty-zero.config.ts`).
921
+
922
+ ```ts
923
+ // tasty.config.ts
924
+ import type { TastyExtensionConfig } from '@tenphi/tasty';
925
+ import type { TastyValidationConfig } from '@tenphi/eslint-plugin-tasty';
926
+
927
+ export default {
928
+ tokens: ['#surface', '#text', '#primary', '$sidebar-width'],
929
+ units: ['cols'],
930
+ states: ['@mobile', '@dark'],
931
+ presets: ['h1', 't2'],
932
+ recipes: ['card', 'elevated'],
933
+ styles: ['stripe'],
934
+ importSources: ['@my-org/ui'],
935
+ presetDescriptions: { h1: 'Heading 1 (32px, bold)' },
936
+ } satisfies TastyExtensionConfig & TastyValidationConfig;
937
+ ```
938
+
939
+ `TastyExtensionConfig` from `@tenphi/tasty` types the fields the VS Code extension reads: `extends`, `tokens`, `units`, `functions`, `states`, `presets`, `styles`, `presetDescriptions`, and `stateDescriptions`. It has no `recipes`, `importSources`, `ownedSources`, or `styleFunctions`, so annotating the file with it alone rejects those ESLint fields; intersect it with the plugin's `TastyValidationConfig`, as above. An omitted list is not checked; `tokens: false`, `units: false`, or `functions: false` turns a check off even when an `extends` parent sets it.
940
+
941
+ Keep it in step with `configure()`: token names with their `#` or `$`, custom units, parse-function names, state aliases, presets, recipes, and custom style names.
942
+
943
+ See [Style DSL](dsl.md) for state maps, tokens, units, and extending semantics, and [React API](react-api.md) for `tasty()`, style functions, and component props.