@tenphi/tasty 0.0.0-snapshot.12603a1 → 0.0.0-snapshot.126a4e6

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 (382) 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-BngQcVXh.js +60 -0
  6. package/dist/chunks/build-config-BngQcVXh.js.map +1 -0
  7. package/dist/chunks/collector-Bbc7qWbI.js +210 -0
  8. package/dist/chunks/collector-Bbc7qWbI.js.map +1 -0
  9. package/dist/chunks/config-engine-BqLEJbJT.js +272 -0
  10. package/dist/chunks/config-engine-BqLEJbJT.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-Cq0dX0wx.js +900 -0
  14. package/dist/chunks/css-definitions-Cq0dX0wx.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-CvpIn45p.js} +196 -147
  18. package/dist/chunks/debug-CvpIn45p.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-RA1Y_ZyX.js +689 -0
  24. package/dist/chunks/react-runtime-RA1Y_ZyX.js.map +1 -0
  25. package/dist/chunks/runtime-engine-6IJkSRqT.js +2431 -0
  26. package/dist/chunks/runtime-engine-6IJkSRqT.js.map +1 -0
  27. package/dist/chunks/runtime-state-CYsu2V_x.js +141 -0
  28. package/dist/chunks/runtime-state-CYsu2V_x.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +60 -56
  30. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  31. package/dist/chunks/style-engine-BhcHz1Hv.js +5420 -0
  32. package/dist/chunks/style-engine-BhcHz1Hv.js.map +1 -0
  33. package/dist/chunks/zero-engine-BF2cETp0.js +310 -0
  34. package/dist/chunks/zero-engine-BF2cETp0.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 -33
  38. package/dist/core/index.js +9 -26
  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 -50
  42. package/dist/index.js +11 -35
  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 +205 -48
  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 +6 -7
  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 +38 -47
  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 -3
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +1 -2
  77. package/dist/static/inject.js.map +1 -1
  78. package/dist/types-ZbF2_6LV.d.ts +1567 -0
  79. package/dist/zero/babel.d.ts +5 -120
  80. package/dist/zero/babel.js +123 -146
  81. package/dist/zero/babel.js.map +1 -1
  82. package/dist/zero/index.d.ts +117 -3
  83. package/dist/zero/index.js +24 -3
  84. package/dist/zero/index.js.map +1 -0
  85. package/dist/zero/next.d.ts +4 -5
  86. package/dist/zero/next.js +3 -38
  87. package/dist/zero/next.js.map +1 -1
  88. package/docs/README.md +23 -12
  89. package/docs/adoption.md +72 -37
  90. package/docs/ai-agents.md +252 -0
  91. package/docs/comparison.md +83 -54
  92. package/docs/configuration.md +698 -81
  93. package/docs/debug.md +39 -24
  94. package/docs/design-system.md +174 -41
  95. package/docs/dsl.md +617 -195
  96. package/docs/getting-started.md +132 -52
  97. package/docs/injector.md +195 -90
  98. package/docs/methodology.md +153 -47
  99. package/docs/migration-v3.md +285 -0
  100. package/docs/pipeline.md +768 -0
  101. package/docs/plugins.md +333 -0
  102. package/docs/react-api.md +703 -0
  103. package/docs/runtime-benchmarks.md +388 -0
  104. package/docs/ssr.md +395 -149
  105. package/docs/styles.md +175 -46
  106. package/docs/tasty-static.md +257 -118
  107. package/package.json +148 -35
  108. package/tasty.config.ts +6 -0
  109. package/dist/_virtual/_rolldown/runtime.js +0 -7
  110. package/dist/chunks/cacheKey.d.ts +0 -1
  111. package/dist/chunks/cacheKey.js +0 -77
  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 -258
  115. package/dist/chunks/definitions.js.map +0 -1
  116. package/dist/chunks/index.d.ts +0 -1
  117. package/dist/chunks/renderChunk.d.ts +0 -1
  118. package/dist/chunks/renderChunk.js +0 -59
  119. package/dist/chunks/renderChunk.js.map +0 -1
  120. package/dist/config.d.ts +0 -366
  121. package/dist/config.js +0 -503
  122. package/dist/config.js.map +0 -1
  123. package/dist/counter-style/index.js +0 -51
  124. package/dist/counter-style/index.js.map +0 -1
  125. package/dist/debug.d.ts +0 -89
  126. package/dist/debug.js.map +0 -1
  127. package/dist/font-face/index.js +0 -63
  128. package/dist/font-face/index.js.map +0 -1
  129. package/dist/hooks/index.d.ts +0 -7
  130. package/dist/hooks/resolve-ssr-collector.js +0 -14
  131. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  132. package/dist/hooks/useCounterStyle.d.ts +0 -50
  133. package/dist/hooks/useCounterStyle.js +0 -46
  134. package/dist/hooks/useCounterStyle.js.map +0 -1
  135. package/dist/hooks/useFontFace.d.ts +0 -43
  136. package/dist/hooks/useFontFace.js +0 -70
  137. package/dist/hooks/useFontFace.js.map +0 -1
  138. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  139. package/dist/hooks/useGlobalStyles.js +0 -78
  140. package/dist/hooks/useGlobalStyles.js.map +0 -1
  141. package/dist/hooks/useKeyframes.d.ts +0 -56
  142. package/dist/hooks/useKeyframes.js +0 -64
  143. package/dist/hooks/useKeyframes.js.map +0 -1
  144. package/dist/hooks/useProperty.d.ts +0 -79
  145. package/dist/hooks/useProperty.js +0 -109
  146. package/dist/hooks/useProperty.js.map +0 -1
  147. package/dist/hooks/useRawCSS.d.ts +0 -53
  148. package/dist/hooks/useRawCSS.js +0 -35
  149. package/dist/hooks/useRawCSS.js.map +0 -1
  150. package/dist/hooks/useStyles.d.ts +0 -45
  151. package/dist/hooks/useStyles.js +0 -237
  152. package/dist/hooks/useStyles.js.map +0 -1
  153. package/dist/injector/index.d.ts +0 -183
  154. package/dist/injector/index.js +0 -179
  155. package/dist/injector/index.js.map +0 -1
  156. package/dist/injector/injector.d.ts +0 -166
  157. package/dist/injector/injector.js +0 -464
  158. package/dist/injector/injector.js.map +0 -1
  159. package/dist/injector/sheet-manager.d.ts +0 -136
  160. package/dist/injector/sheet-manager.js +0 -733
  161. package/dist/injector/sheet-manager.js.map +0 -1
  162. package/dist/injector/types.d.ts +0 -204
  163. package/dist/keyframes/index.js +0 -206
  164. package/dist/keyframes/index.js.map +0 -1
  165. package/dist/parser/classify.js +0 -319
  166. package/dist/parser/classify.js.map +0 -1
  167. package/dist/parser/const.js +0 -60
  168. package/dist/parser/const.js.map +0 -1
  169. package/dist/parser/lru.js +0 -109
  170. package/dist/parser/lru.js.map +0 -1
  171. package/dist/parser/parser.d.ts +0 -25
  172. package/dist/parser/parser.js +0 -115
  173. package/dist/parser/parser.js.map +0 -1
  174. package/dist/parser/tokenizer.js +0 -69
  175. package/dist/parser/tokenizer.js.map +0 -1
  176. package/dist/parser/types.d.ts +0 -51
  177. package/dist/parser/types.js +0 -46
  178. package/dist/parser/types.js.map +0 -1
  179. package/dist/pipeline/conditions.d.ts +0 -134
  180. package/dist/pipeline/conditions.js +0 -406
  181. package/dist/pipeline/conditions.js.map +0 -1
  182. package/dist/pipeline/exclusive.js +0 -230
  183. package/dist/pipeline/exclusive.js.map +0 -1
  184. package/dist/pipeline/index.d.ts +0 -55
  185. package/dist/pipeline/index.js +0 -708
  186. package/dist/pipeline/index.js.map +0 -1
  187. package/dist/pipeline/materialize.js +0 -1103
  188. package/dist/pipeline/materialize.js.map +0 -1
  189. package/dist/pipeline/parseStateKey.d.ts +0 -15
  190. package/dist/pipeline/parseStateKey.js +0 -446
  191. package/dist/pipeline/parseStateKey.js.map +0 -1
  192. package/dist/pipeline/simplify.js +0 -515
  193. package/dist/pipeline/simplify.js.map +0 -1
  194. package/dist/pipeline/warnings.js +0 -18
  195. package/dist/pipeline/warnings.js.map +0 -1
  196. package/dist/plugins/index.d.ts +0 -2
  197. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  198. package/dist/plugins/okhsl-plugin.js +0 -97
  199. package/dist/plugins/okhsl-plugin.js.map +0 -1
  200. package/dist/plugins/types.d.ts +0 -76
  201. package/dist/properties/index.js +0 -222
  202. package/dist/properties/index.js.map +0 -1
  203. package/dist/properties/property-type-resolver.d.ts +0 -24
  204. package/dist/properties/property-type-resolver.js +0 -90
  205. package/dist/properties/property-type-resolver.js.map +0 -1
  206. package/dist/ssr/async-storage.d.ts +0 -17
  207. package/dist/ssr/async-storage.js +0 -34
  208. package/dist/ssr/async-storage.js.map +0 -1
  209. package/dist/ssr/collect-auto-properties.js +0 -39
  210. package/dist/ssr/collect-auto-properties.js.map +0 -1
  211. package/dist/ssr/collector.d.ts +0 -102
  212. package/dist/ssr/collector.js +0 -226
  213. package/dist/ssr/collector.js.map +0 -1
  214. package/dist/ssr/context.d.ts +0 -8
  215. package/dist/ssr/context.js +0 -13
  216. package/dist/ssr/context.js.map +0 -1
  217. package/dist/ssr/format-global-rules.js +0 -22
  218. package/dist/ssr/format-global-rules.js.map +0 -1
  219. package/dist/ssr/format-keyframes.js +0 -69
  220. package/dist/ssr/format-keyframes.js.map +0 -1
  221. package/dist/ssr/format-property.js +0 -49
  222. package/dist/ssr/format-property.js.map +0 -1
  223. package/dist/ssr/format-rules.js +0 -73
  224. package/dist/ssr/format-rules.js.map +0 -1
  225. package/dist/ssr/hydrate.d.ts +0 -22
  226. package/dist/ssr/hydrate.js +0 -49
  227. package/dist/ssr/hydrate.js.map +0 -1
  228. package/dist/ssr/ssr-collector-ref.js +0 -12
  229. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  230. package/dist/states/index.d.ts +0 -49
  231. package/dist/states/index.js +0 -170
  232. package/dist/states/index.js.map +0 -1
  233. package/dist/static/tastyStatic.d.ts +0 -46
  234. package/dist/static/tastyStatic.js +0 -30
  235. package/dist/static/tastyStatic.js.map +0 -1
  236. package/dist/static/types.d.ts +0 -49
  237. package/dist/static/types.js +0 -24
  238. package/dist/static/types.js.map +0 -1
  239. package/dist/styles/border.d.ts +0 -25
  240. package/dist/styles/border.js +0 -120
  241. package/dist/styles/border.js.map +0 -1
  242. package/dist/styles/color.d.ts +0 -14
  243. package/dist/styles/color.js +0 -26
  244. package/dist/styles/color.js.map +0 -1
  245. package/dist/styles/const.js +0 -17
  246. package/dist/styles/const.js.map +0 -1
  247. package/dist/styles/createStyle.js +0 -79
  248. package/dist/styles/createStyle.js.map +0 -1
  249. package/dist/styles/dimension.js +0 -109
  250. package/dist/styles/dimension.js.map +0 -1
  251. package/dist/styles/directional.js +0 -133
  252. package/dist/styles/directional.js.map +0 -1
  253. package/dist/styles/display.d.ts +0 -30
  254. package/dist/styles/display.js +0 -73
  255. package/dist/styles/display.js.map +0 -1
  256. package/dist/styles/fade.d.ts +0 -15
  257. package/dist/styles/fade.js +0 -62
  258. package/dist/styles/fade.js.map +0 -1
  259. package/dist/styles/fill.d.ts +0 -42
  260. package/dist/styles/fill.js +0 -51
  261. package/dist/styles/fill.js.map +0 -1
  262. package/dist/styles/flow.d.ts +0 -16
  263. package/dist/styles/flow.js +0 -12
  264. package/dist/styles/flow.js.map +0 -1
  265. package/dist/styles/gap.d.ts +0 -31
  266. package/dist/styles/gap.js +0 -38
  267. package/dist/styles/gap.js.map +0 -1
  268. package/dist/styles/height.d.ts +0 -17
  269. package/dist/styles/height.js +0 -19
  270. package/dist/styles/height.js.map +0 -1
  271. package/dist/styles/index.d.ts +0 -1
  272. package/dist/styles/index.js +0 -8
  273. package/dist/styles/index.js.map +0 -1
  274. package/dist/styles/inset.d.ts +0 -24
  275. package/dist/styles/inset.js +0 -34
  276. package/dist/styles/inset.js.map +0 -1
  277. package/dist/styles/list.d.ts +0 -16
  278. package/dist/styles/list.js +0 -100
  279. package/dist/styles/list.js.map +0 -1
  280. package/dist/styles/margin.d.ts +0 -24
  281. package/dist/styles/margin.js +0 -32
  282. package/dist/styles/margin.js.map +0 -1
  283. package/dist/styles/outline.d.ts +0 -29
  284. package/dist/styles/outline.js +0 -55
  285. package/dist/styles/outline.js.map +0 -1
  286. package/dist/styles/padding.d.ts +0 -24
  287. package/dist/styles/padding.js +0 -32
  288. package/dist/styles/padding.js.map +0 -1
  289. package/dist/styles/placement.d.ts +0 -37
  290. package/dist/styles/placement.js +0 -74
  291. package/dist/styles/placement.js.map +0 -1
  292. package/dist/styles/predefined.d.ts +0 -71
  293. package/dist/styles/predefined.js +0 -237
  294. package/dist/styles/predefined.js.map +0 -1
  295. package/dist/styles/preset.d.ts +0 -52
  296. package/dist/styles/preset.js +0 -127
  297. package/dist/styles/preset.js.map +0 -1
  298. package/dist/styles/radius.d.ts +0 -12
  299. package/dist/styles/radius.js +0 -83
  300. package/dist/styles/radius.js.map +0 -1
  301. package/dist/styles/scrollMargin.d.ts +0 -24
  302. package/dist/styles/scrollMargin.js +0 -32
  303. package/dist/styles/scrollMargin.js.map +0 -1
  304. package/dist/styles/scrollbar.d.ts +0 -25
  305. package/dist/styles/scrollbar.js +0 -51
  306. package/dist/styles/scrollbar.js.map +0 -1
  307. package/dist/styles/shadow.d.ts +0 -14
  308. package/dist/styles/shadow.js +0 -25
  309. package/dist/styles/shadow.js.map +0 -1
  310. package/dist/styles/shared.js +0 -17
  311. package/dist/styles/shared.js.map +0 -1
  312. package/dist/styles/transition.d.ts +0 -14
  313. package/dist/styles/transition.js +0 -159
  314. package/dist/styles/transition.js.map +0 -1
  315. package/dist/styles/types.d.ts +0 -564
  316. package/dist/styles/width.d.ts +0 -17
  317. package/dist/styles/width.js +0 -19
  318. package/dist/styles/width.js.map +0 -1
  319. package/dist/tasty.d.ts +0 -119
  320. package/dist/tasty.js +0 -231
  321. package/dist/tasty.js.map +0 -1
  322. package/dist/types.d.ts +0 -184
  323. package/dist/utils/cache-wrapper.js +0 -21
  324. package/dist/utils/cache-wrapper.js.map +0 -1
  325. package/dist/utils/case-converter.js +0 -8
  326. package/dist/utils/case-converter.js.map +0 -1
  327. package/dist/utils/color-math.d.ts +0 -46
  328. package/dist/utils/color-math.js +0 -749
  329. package/dist/utils/color-math.js.map +0 -1
  330. package/dist/utils/color-space.d.ts +0 -5
  331. package/dist/utils/color-space.js +0 -228
  332. package/dist/utils/color-space.js.map +0 -1
  333. package/dist/utils/colors.d.ts +0 -5
  334. package/dist/utils/colors.js +0 -10
  335. package/dist/utils/colors.js.map +0 -1
  336. package/dist/utils/css-types.d.ts +0 -7
  337. package/dist/utils/dotize.d.ts +0 -26
  338. package/dist/utils/dotize.js +0 -122
  339. package/dist/utils/dotize.js.map +0 -1
  340. package/dist/utils/filter-base-props.d.ts +0 -15
  341. package/dist/utils/filter-base-props.js +0 -45
  342. package/dist/utils/filter-base-props.js.map +0 -1
  343. package/dist/utils/get-display-name.d.ts +0 -7
  344. package/dist/utils/get-display-name.js +0 -10
  345. package/dist/utils/get-display-name.js.map +0 -1
  346. package/dist/utils/has-keys.js +0 -13
  347. package/dist/utils/has-keys.js.map +0 -1
  348. package/dist/utils/is-dev-env.js +0 -19
  349. package/dist/utils/is-dev-env.js.map +0 -1
  350. package/dist/utils/is-valid-element-type.js +0 -15
  351. package/dist/utils/is-valid-element-type.js.map +0 -1
  352. package/dist/utils/merge-styles.js.map +0 -1
  353. package/dist/utils/mod-attrs.d.ts +0 -6
  354. package/dist/utils/mod-attrs.js +0 -20
  355. package/dist/utils/mod-attrs.js.map +0 -1
  356. package/dist/utils/process-tokens.d.ts +0 -21
  357. package/dist/utils/process-tokens.js +0 -90
  358. package/dist/utils/process-tokens.js.map +0 -1
  359. package/dist/utils/resolve-recipes.d.ts +0 -17
  360. package/dist/utils/resolve-recipes.js +0 -146
  361. package/dist/utils/resolve-recipes.js.map +0 -1
  362. package/dist/utils/selector-transform.js +0 -32
  363. package/dist/utils/selector-transform.js.map +0 -1
  364. package/dist/utils/string.js +0 -8
  365. package/dist/utils/string.js.map +0 -1
  366. package/dist/utils/styles.d.ts +0 -99
  367. package/dist/utils/styles.js +0 -220
  368. package/dist/utils/styles.js.map +0 -1
  369. package/dist/utils/typography.d.ts +0 -47
  370. package/dist/utils/typography.js +0 -51
  371. package/dist/utils/typography.js.map +0 -1
  372. package/dist/utils/warnings.d.ts +0 -16
  373. package/dist/utils/warnings.js +0 -16
  374. package/dist/utils/warnings.js.map +0 -1
  375. package/dist/zero/css-writer.d.ts +0 -45
  376. package/dist/zero/css-writer.js +0 -73
  377. package/dist/zero/css-writer.js.map +0 -1
  378. package/dist/zero/extractor.d.ts +0 -24
  379. package/dist/zero/extractor.js +0 -266
  380. package/dist/zero/extractor.js.map +0 -1
  381. package/docs/PIPELINE.md +0 -519
  382. package/docs/runtime.md +0 -485
package/README.md CHANGED
@@ -1,57 +1,54 @@
1
1
  <p align="center">
2
- <img src="assets/tasty.svg" width="128" height="128" alt="Tasty logo">
2
+ <img src="assets/tasty.svg" width="128" height="128" alt="Tasty logo" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">Tasty</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>Deterministic styling for stateful component systems.</strong><br>
9
- A design-system styling engine that compiles component states into mutually exclusive selectors.
8
+ <strong>CSS-in-JS for React design systems.</strong><br />
9
+ Build components whose styles don’t fight.
10
10
  </p>
11
11
 
12
12
  <p align="center">
13
- <a href="https://www.npmjs.com/package/@tenphi/tasty"><img src="https://img.shields.io/npm/v/@tenphi/tasty.svg" alt="npm version"></a>
14
- <a href="https://github.com/tenphi/tasty/actions/workflows/ci.yml"><img src="https://github.com/tenphi/tasty/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
15
- <a href="https://github.com/tenphi/tasty/blob/main/LICENSE"><img src="https://img.shields.io/github/license/tenphi/tasty" alt="license"></a>
13
+ <a href="https://www.npmjs.com/package/@tenphi/tasty"><img src="https://img.shields.io/npm/v/@tenphi/tasty.svg" alt="npm version" /></a>
14
+ <a href="https://github.com/tenphi/tasty/actions/workflows/ci.yml"><img src="https://github.com/tenphi/tasty/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
15
+ <a href="https://github.com/tenphi/tasty/blob/main/LICENSE"><img src="https://img.shields.io/github/license/tenphi/tasty" alt="license" /></a>
16
16
  </p>
17
17
 
18
18
  ---
19
19
 
20
- Tasty is a styling engine for design systems that generates deterministic CSS for stateful components.
20
+ Tasty is a styling engine for teams that build component libraries. You describe hover, disabled, variants, themes, and breakpoints as **state maps**, in a CSS-like language built from your design system's own tokens and conventions. Tasty compiles each map into selectors that never match at the same time, so the result never depends on specificity or source order.
21
21
 
22
- It compiles state maps into **mutually exclusive selectors**, so for a given property and component state, one branch wins by construction instead of competing through cascade and specificity.
23
-
24
- That is the core guarantee: component styling resolves from declared state logic, not from source-order accidents or specificity fights.
22
+ ```tsx
23
+ import { tasty } from '@tenphi/tasty';
25
24
 
26
- Tasty fits best when you are building a design system or component library with intersecting states, variants, tokens, sub-elements, responsive rules, and extension semantics that need to stay predictable over time.
25
+ const Button = tasty({
26
+ as: 'button',
27
+ styles: {
28
+ fill: {
29
+ '': '#primary',
30
+ ':hover': '#primary-hover',
31
+ ':active': '#primary-pressed',
32
+ '[disabled]': '#surface',
33
+ },
34
+ },
35
+ });
36
+ ```
27
37
 
28
- On top of that foundation, Tasty gives teams a governed styling model: a CSS-like DSL, tokens, recipes, typed style props, sub-elements, and multiple rendering modes.
38
+ Later keys have higher priority. If this button is both hovered and disabled, `[disabled]` wins and the hover rule does not apply. That decision is compiled into the selectors themselves, so you can add states, variants, themes, and overrides without reopening selector logic by hand.
29
39
 
30
- - **New here?** Start with [Comparison](docs/comparison.md) if you are evaluating fit.
31
- - **Adopting Tasty?** Read the [Adoption Guide](docs/adoption.md).
32
- - **Want the mechanism first?** Jump to [How It Actually Works](#how-it-actually-works).
33
- - **Ready to build?** Go to [Getting Started](docs/getting-started.md).
40
+ - **Ready to try it?** Follow [Getting Started](docs/getting-started.md).
41
+ - **Evaluating fit?** Read [Comparison](docs/comparison.md) and the [Adoption Guide](docs/adoption.md).
42
+ - **Building a component library?** See [Methodology](docs/methodology.md) and [Building a Design System](docs/design-system.md).
34
43
 
35
44
  ## Why Tasty
36
45
 
37
- - **Deterministic composition, not cascade fights** — Stateful styles resolve from the state map you declared, not from selector competition. See [How It Actually Works](#how-it-actually-works).
38
- - **Built for design-system teams** — Best fit for reusable component systems with complex state interactions.
39
- - **A governed styling model, not just syntax sugar** — Design-system authors define the styling language product teams consume.
40
- - **DSL that still feels like CSS** — Familiar property names, less selector boilerplate. Start with the [Style DSL](docs/dsl.md), then use [Style Properties](docs/styles.md) as the handler reference.
41
-
42
- ### Supporting capabilities
43
-
44
- - **Typed style props and mod props** — `styleProps` exposes selected CSS properties as typed React props (`<Space flow="row" gap="2x">`); `modProps` does the same for modifier keys (`<Button isLoading size="large">`). Both support state maps and full TypeScript autocomplete. See [Style Props](#style-props) and [Mod Props](#mod-props).
45
- - **Runtime, SSR, and zero-runtime options** — Use `tasty()` for runtime React components, add SSR integrations when your framework renders that runtime on the server, or use `tastyStatic()` when you specifically want build-time extraction instead of runtime styling.
46
- - **Broad modern CSS coverage** — Media queries, container queries, `@supports`, `:has()`, `@starting-style`, `@property`, `@keyframes`, and more. Features that do not fit the component model (such as `@layer` and `!important`) are intentionally left out.
47
- - **Performance and caching** — Runtime mode injects CSS on demand, reuses chunks aggressively, and relies on multi-level caching so large component systems stay practical.
48
- - **TypeScript-first and AI-friendly** — Style definitions are declarative, structurally consistent, and fully typed, which helps both humans and tooling understand advanced stateful styles without hidden cascade logic.
49
-
50
- ## Why It Exists
51
-
52
- Modern component styling becomes fragile when multiple selectors can still win for the same property. Hover, disabled, theme, breakpoint, parent state, and root state rules start competing through specificity and source order.
53
-
54
- Tasty replaces that competition with explicit state-map resolution. Each property compiles into mutually exclusive branches, so component styling stays deterministic as systems grow. For the full mechanism, jump to [How It Actually Works](#how-it-actually-works).
46
+ - **States that can't conflict** — Every state map compiles into mutually exclusive selectors, and the last matching key wins by construction. Adding a state, variant, or override never means re-deriving selector interactions. [How it works →](#how-it-works)
47
+ - **Your design system's language** — Define color tokens, units, state aliases like `@mobile` and `@dark`, typography presets, and recipes once with `configure()`. Components then read like the spec: `padding: '2x'`, `fill: '#surface'`, `preset: 'h3'`. [Design-system integration →](#design-system-integration)
48
+ - **Typed component APIs** — Decide exactly what consumers can change. `styleProps`, `modProps`, `tokenProps`, `variants`, and sub-elements become typed React props and components with full autocomplete. [Component API →](#component-api)
49
+ - **Guardrails in the editor and CI** — An ESLint and oxlint plugin with 40+ rules checks property names, values, tokens, state keys, presets, and recipes against your project's config. TypeScript augmentation autocompletes your own token, preset, and theme names. [Types and linting →](#types-and-linting)
50
+ - **Modern CSS, one model** — Media and container queries, `@supports`, `:has()`, root and parent states, and `@starting-style` are all state keys. `@keyframes`, `@property`, `@font-face`, `@counter-style`, and `@function` are built in. [CSS coverage →](#css-coverage)
51
+ - **Render anywhere** — The same styles work in client React, React Server Components, and streaming SSR (Next.js, Astro). Render only on the server to ship no styling runtime at all, or extract CSS at build time with `tastyStatic()`. [Rendering modes →](#rendering-modes)
55
52
 
56
53
  ## Installation
57
54
 
@@ -59,33 +56,13 @@ Tasty replaces that competition with explicit state-map resolution. Each propert
59
56
  pnpm add @tenphi/tasty
60
57
  ```
61
58
 
62
- Requirements:
63
-
64
- - Node.js 20+
65
- - React 18+ (peer dependency for the React entry points)
66
- - `pnpm`, `npm`, or `yarn`
67
-
68
- Other package managers:
69
-
70
- ```bash
71
- npm add @tenphi/tasty
72
- yarn add @tenphi/tasty
73
- ```
74
-
75
- ## Start Here
76
-
77
- For the fuller docs map beyond the quick routes above, start here:
78
-
79
- - **[Comparison](docs/comparison.md)** — read this first if you are evaluating whether Tasty fits your team's styling model
80
- - **[Adoption Guide](docs/adoption.md)** — understand who Tasty is for, where it fits, and how to introduce it incrementally
81
- - **[Getting Started](docs/getting-started.md)** — the canonical onboarding path: install, first component, optional shared `configure()`, ESLint, editor tooling, and rendering mode selection
82
- - **[Style rendering pipeline](docs/PIPELINE.md)** — see the selector model behind deterministic style resolution
83
- - **[Docs Hub](docs/README.md)** — choose docs by role and task: runtime, zero-runtime, runtime SSR integration, design-system authoring, internals, and debugging
84
- - **[Methodology](docs/methodology.md)** — the recommended component model and public API conventions for design-system code
59
+ Requires Node.js 20+ and React 18+ (a peer dependency of the React entry points). `npm add @tenphi/tasty` and `yarn add @tenphi/tasty` work the same way.
85
60
 
86
61
  ## Quick Start
87
62
 
88
- ### Create a styled component
63
+ ### 1. Write a component
64
+
65
+ Plain CSS values work as-is, so a first component looks like CSS you already know:
89
66
 
90
67
  ```tsx
91
68
  import { tasty } from '@tenphi/tasty';
@@ -94,139 +71,154 @@ const Card = tasty({
94
71
  as: 'div',
95
72
  styles: {
96
73
  display: 'flex',
97
- flow: 'column',
74
+ flow: 'column', // flex-flow
98
75
  padding: '24px',
99
76
  gap: '12px',
100
- fill: 'white',
77
+ fill: 'white', // background-color
101
78
  color: '#222',
102
79
  border: '1px solid #ddd',
103
- radius: '12px',
80
+ radius: '12px', // border-radius
104
81
  },
105
82
  });
106
83
 
107
- // Just a React component
108
- <Card>Hello World</Card>
84
+ <Card>Hello World</Card>;
109
85
  ```
110
86
 
111
- Every value maps to CSS you'd recognize. This example is intentionally a simple first contact, not a tour of the whole DSL.
87
+ ### 2. Bring in your design system
112
88
 
113
- When you want a more design-system-shaped authoring model, Tasty also supports built-in units, tokens, recipes, state aliases, and color values such as `okhsl(...)` without extra runtime libraries.
89
+ Call `configure()` once, before your app renders, to define the vocabulary every component shares:
114
90
 
115
- Use `configure()` when you want to define shared tokens, state aliases, recipes, or other conventions for your app or design system. For a fuller onboarding path, follow [Getting Started](docs/getting-started.md).
91
+ ```tsx
92
+ // tasty.setup.ts — import it at the top of your entry point
93
+ import { configure } from '@tenphi/tasty';
94
+
95
+ configure({
96
+ tokens: {
97
+ '#surface': { '': '#fff', '@dark': '#1c1c1e' },
98
+ '#text': { '': '#222', '@dark': '#f2f2f7' },
99
+ '#border': '#ddd',
100
+ },
101
+ units: { x: '8px', r: '12px' }, // spacing step and radius
102
+ states: {
103
+ '@mobile': '@media(w < 768px)',
104
+ '@dark':
105
+ '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
106
+ },
107
+ });
108
+ ```
116
109
 
117
- ### Add state-driven styles
110
+ The same card, written in that vocabulary:
111
+
112
+ ```tsx
113
+ const Card = tasty({
114
+ styles: {
115
+ display: 'flex',
116
+ flow: 'column',
117
+ padding: { '': '3x', '@mobile': '2x' }, // 24px, 16px on mobile
118
+ gap: '1.5x', // 12px
119
+ fill: '#surface', // var(--surface-color)
120
+ color: '#text',
121
+ border: true, // 1bw solid #border
122
+ radius: '1r', // 12px
123
+ },
124
+ });
125
+ ```
126
+
127
+ The component never mentions dark mode, yet it follows the `@dark` tokens. Change a token or a unit once and every component follows.
128
+
129
+ ### 3. Add states and a typed API
118
130
 
119
131
  ```tsx
120
132
  const Button = tasty({
121
133
  as: 'button',
134
+ modProps: { isLoading: Boolean, size: ['sm', 'md', 'lg'] as const },
122
135
  styles: {
123
- padding: '1.5x 3x',
136
+ padding: { '': '1.5x 3x', 'size=sm': '1x 2x', 'size=lg': '2x 4x' },
137
+ radius: '1r',
124
138
  fill: {
125
139
  '': '#primary',
126
140
  ':hover': '#primary-hover',
127
141
  ':active': '#primary-pressed',
128
- '[disabled]': '#surface',
129
- },
130
- color: {
131
- '': '#on-primary',
132
- '[disabled]': '#text.40',
133
- },
134
- cursor: {
135
- '': 'pointer',
136
- '[disabled]': 'not-allowed',
142
+ disabled: '#surface',
137
143
  },
144
+ color: { '': '#on-primary', disabled: '#text.40' },
145
+ cursor: { '': 'pointer', isLoading: 'wait', disabled: 'not-allowed' },
138
146
  transition: 'theme',
139
147
  },
140
148
  });
149
+
150
+ <Button size="lg" isLoading>
151
+ Save
152
+ </Button>;
153
+ // renders <button data-is-loading data-size="lg" class="…">
141
154
  ```
142
155
 
143
- State keys support pseudo-classes first (`:hover`, `:active`), then modifiers (`theme=danger`), attributes (`[disabled]`), media/container queries, root states, and more. Tasty compiles them into exclusive selectors automatically.
156
+ `size` is typed as `'sm' | 'md' | 'lg'`. Mod props become `data-*` attributes, which state keys like `size=lg` and `isLoading` select. `disabled` tracks the native `disabled` prop, `#text.40` is the text color at 40% opacity, and `transition: 'theme'` is a named group that transitions color, background, border, shadow, outline, and opacity together.
144
157
 
145
- ### Extend any component
158
+ ### 4. Extend a component
146
159
 
147
160
  ```tsx
148
- import { Button } from 'my-ui-lib';
149
-
150
161
  const DangerButton = tasty(Button, {
151
162
  styles: {
152
163
  fill: {
153
164
  '': '#danger',
154
165
  ':hover': '#danger-hover',
166
+ ':active': '#danger-pressed',
167
+ disabled: '@inherit', // keep the parent's disabled branch
155
168
  },
156
169
  },
157
170
  });
158
171
  ```
159
172
 
160
- Child styles merge with parent styles intelligently — state maps can extend or replace parent states per-property.
173
+ A state map with a `''` key replaces the parent's map; a map without one extends it. `@inherit` pulls a single branch from the parent, `null` removes one, and `false` blocks it entirely. See [Extending vs. replacing state maps](docs/dsl.md#extending-vs-replacing-state-maps).
161
174
 
162
- ### Optional: configure shared conventions
175
+ [Getting Started](docs/getting-started.md) continues from here with setup, linting, editor tooling, and choosing a rendering mode.
163
176
 
164
- ```tsx
165
- import { configure } from '@tenphi/tasty';
177
+ ## How It Works
166
178
 
167
- configure({
168
- states: {
169
- '@mobile': '@media(w < 768px)',
170
- '@tablet': '@media(w < 1024px)',
171
- '@dark': '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
172
- },
173
- recipes: {
174
- card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
175
- },
176
- });
177
- ```
179
+ The cascade resolves conflicts by specificity, then by source order. Take two rules for a button's background:
178
180
 
179
- Use `configure()` once when your app or design system needs shared aliases, tokens, recipes, or parser extensions. Predefined states turn complex selector logic into single tokens, so teams can write `@mobile` instead of repeating media query expressions in every component.
181
+ ```css
182
+ .btn:hover {
183
+ background: dodgerblue;
184
+ }
185
+ .btn[disabled] {
186
+ background: gray;
187
+ }
188
+ ```
180
189
 
181
- ### Props as the public API
190
+ Both selectors have specificity `(0, 2, 0)`. When the button is hovered **and** disabled, both match and the later rule wins. Swap the two rules and a hovered disabled button silently turns blue. The logic is correct; only the order is wrong, which is why this class of bug survives code review.
182
191
 
183
- `styleProps` exposes selected CSS properties as typed React props, and `modProps` does the same for modifier keys. Together they let design systems define a governed, typed component API without wrapper elements or `styles` overrides:
192
+ Tasty removes the competition. For the same intent:
184
193
 
185
194
  ```tsx
186
- <Space flow="row" gap="2x" placeItems="center">
187
- <Button isLoading size="large" placeSelf="end">Submit</Button>
188
- </Space>
195
+ fill: {
196
+ '': '#primary',
197
+ ':hover': '#primary-hover',
198
+ '[disabled]': '#surface',
199
+ }
189
200
  ```
190
201
 
191
- See [Style Props](#style-props) and [Mod Props](#mod-props) below, or the full reference in [Runtime API](docs/runtime.md#style-props).
192
-
193
- ## Choose a Styling Approach
194
-
195
- Once you understand the component model, pick the rendering mode that matches your app.
196
-
197
- | Approach | Entry point | Best for | Trade-off |
198
- |----------|-------------|----------|-----------|
199
- | **Runtime** | `@tenphi/tasty` | Interactive apps with reusable stateful components and design systems | Full feature set; CSS is generated on demand at runtime |
200
- | **Zero-runtime** | `@tenphi/tasty/static` | Static sites, SSG, landing pages | Requires the Babel plugin; no component-level `styleProps` or runtime-only APIs |
201
-
202
- If your framework can execute runtime React code on the server, you can also add **SSR on top of runtime** with `@tenphi/tasty/ssr/*`. This uses the same `tasty()` pipeline, but collects CSS during server rendering and hydrates the cache on the client. That is the model for Next.js, generic React SSR, and Astro islands. See [Getting Started](docs/getting-started.md#choosing-a-rendering-mode), [Zero Runtime](docs/tasty-static.md), and [Server-Side Rendering](docs/ssr.md).
203
-
204
- ## How It Actually Works
205
-
206
- This is the core idea that makes everything else possible.
207
-
208
- For the end-to-end architecture — parsing state keys, building exclusive conditions, merging by output, and materializing selectors and at-rules — see **[Style rendering pipeline](docs/PIPELINE.md)**.
209
-
210
- ### The structural problem with normal CSS
211
-
212
- First, the **cascade** resolves conflicts by specificity and source order: when multiple selectors match, the one with the highest specificity wins, or — if specificity is equal — the last one in source order wins. That makes styles inherently fragile. Reordering imports, adding a media query, or composing components from different libraries can silently break styling.
213
-
214
- A small example makes this tangible. Two rules for a button's background:
202
+ it generates:
215
203
 
216
204
  ```css
217
- .btn:hover { background: dodgerblue; }
218
- .btn[disabled] { background: gray; }
205
+ .t0.t0:where(:not([disabled]):not(:hover)) {
206
+ background-color: var(--primary-color);
207
+ }
208
+ .t0.t0:where(:not([disabled]):hover) {
209
+ background-color: var(--primary-hover-color);
210
+ }
211
+ .t0.t0:where([disabled]) {
212
+ background-color: var(--surface-color);
213
+ }
219
214
  ```
220
215
 
221
- Both selectors have specificity `(0, 1, 1)`. When the button is hovered **and** disabled, both match — and the last rule in source order wins. Swap the two lines and a hovered disabled button silently turns blue instead of gray. This class of bug is invisible in code review because the logic is correct; only the ordering is wrong.
222
-
223
- ### Why real state logic is hard to author by hand
224
-
225
- Authoring selectors that capture real-world state logic is fundamentally hard. A single state like "dark mode" may depend on a root attribute, an OS preference, or both — each branch needing its own selector, proper negation of competing branches, and correct `@media` nesting. The example below shows the CSS you'd write by hand for just *one* property with *one* state. Scale that across dozens of properties, then add breakpoints and container queries, and the selector logic quickly becomes unmanageable.
216
+ Each branch is guarded by the negation of every higher-priority branch, so exactly one rule matches any element. Reorder the rules, split them across stylesheets, or extend the component: the outcome stays the same. Because the logic stays in CSS rather than JavaScript, the browser handles layout, painting, and transitions natively.
226
217
 
227
- ### What Tasty generates instead
218
+ <details>
219
+ <summary><strong>A harder case: dark mode from a root attribute or the OS preference</strong></summary>
228
220
 
229
- Tasty solves both problems at once: **every state mapping compiles into mutually exclusive selectors.**
221
+ Say `@dark` means "the root has `data-schema="dark"`, or no schema is set and the OS prefers dark":
230
222
 
231
223
  ```tsx
232
224
  const Text = tasty({
@@ -235,344 +227,425 @@ const Text = tasty({
235
227
  '': '#text',
236
228
  '@dark': '#text-on-dark',
237
229
  },
238
- padding: {
239
- '': '4x',
240
- '@mobile': '2x',
241
- },
242
230
  },
243
231
  });
244
232
  ```
245
233
 
246
- If `@dark` expands to `@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))`, try writing the CSS by hand. A first attempt might look like this:
234
+ A first attempt by hand:
247
235
 
248
236
  ```css
249
- /* First attempt — the @media branch is too broad */
250
- .t0 { color: var(--text-color); }
251
- :root[data-schema="dark"] .t0 { color: var(--text-on-dark-color); }
252
- @media (prefers-color-scheme: dark) {
253
- .t0 { color: var(--text-on-dark-color); }
237
+ .t0 {
238
+ color: var(--text-color);
239
+ }
240
+ :root[data-schema='dark'] .t0 {
241
+ color: var(--text-on-dark-color);
254
242
  }
255
- ```
256
-
257
- The `@media` branch fires even when `data-schema="light"` is explicitly set. Fix that:
258
-
259
- ```css
260
- /* Second attempt — @media is scoped, but the default is still too broad */
261
- .t0 { color: var(--text-color); }
262
- :root[data-schema="dark"] .t0 { color: var(--text-on-dark-color); }
263
243
  @media (prefers-color-scheme: dark) {
264
- :root:not([data-schema]) .t0 { color: var(--text-on-dark-color); }
244
+ .t0 {
245
+ color: var(--text-on-dark-color);
246
+ }
265
247
  }
266
248
  ```
267
249
 
268
- Better — but the bare `.t0` default still matches unconditionally. It matches in dark mode, it matches when `data-schema="dark"` is set, and it can beat the attribute selector by source order if another rule re-declares it later. There is no selector that says "apply this default only when none of the dark branches win."
269
-
270
- This is just *one* property with *one* state, and getting it right already takes multiple iterations. The correct selectors require negating every other branch — which is exactly what Tasty generates automatically:
250
+ The `@media` branch fires even when `data-schema="light"` is set explicitly. Scoping it to `:root:not([data-schema])` fixes that, but the bare `.t0` default still matches unconditionally, and it can beat the attribute selector by source order if another rule re-declares it later. No single selector says "apply the default only when none of the dark branches win". The correct version negates every other branch, which is what Tasty generates:
271
251
 
272
252
  ```css
273
- /* Branch 1: Explicit dark schema */
274
- :root[data-schema="dark"] .t0.t0 {
253
+ /* Explicit dark schema */
254
+ :where(:root[data-schema='dark']) .t0.t0 {
275
255
  color: var(--text-on-dark-color);
276
256
  }
277
257
 
278
- /* Branch 2: No schema attribute + OS prefers dark */
258
+ /* No schema attribute, OS prefers dark */
279
259
  @media (prefers-color-scheme: dark) {
280
- :root:not([data-schema]) .t0.t0 {
260
+ :where(:root:not([data-schema])) .t0.t0 {
281
261
  color: var(--text-on-dark-color);
282
262
  }
283
263
  }
284
264
 
285
- /* Default: no schema + OS does not prefer dark */
265
+ /* Default: OS prefers light, schema is not dark */
286
266
  @media (not (prefers-color-scheme: dark)) {
287
- :root:not([data-schema="dark"]) .t0.t0 {
267
+ :where(:root:not([data-schema='dark'])) .t0.t0 {
288
268
  color: var(--text-color);
289
269
  }
290
270
  }
291
271
 
292
- /* Default: schema is set but not dark (any OS preference) */
293
- :root:not([data-schema="dark"])[data-schema] .t0.t0 {
294
- color: var(--text-color);
272
+ /* Default: OS prefers dark, but a non-dark schema is set */
273
+ @media (prefers-color-scheme: dark) {
274
+ :where(:root:not([data-schema='dark'])[data-schema]) .t0.t0 {
275
+ color: var(--text-color);
276
+ }
295
277
  }
296
278
  ```
297
279
 
298
- ### What guarantee that gives you
280
+ That is one property with one state. Multiply it by dozens of properties, breakpoints, and container queries, and hand-written selectors stop being maintainable.
281
+
282
+ </details>
299
283
 
300
- Every rule is guarded by the negation of higher-priority rules. No two rules can match at the same time. No specificity arithmetic. No source-order dependence. Components compose and extend without collisions.
284
+ For the full compiler model (parsing state keys, building exclusive conditions, merging by value, materializing selectors and at-rules), see the [Style rendering pipeline](docs/pipeline.md). [Try it in the playground →](https://tasty.style/playground)
301
285
 
302
- By absorbing selector complexity, Tasty makes advanced CSS patterns practical again — nested container queries, multi-condition `@supports` gates, and combined root-state/media branches. You stay in pure CSS instead of relying on JavaScript workarounds, so the browser can optimize layout, painting, and transitions natively. Tasty keeps the solution in CSS while removing much of the selector bookkeeping that is hard to maintain by hand.
286
+ ## Design-System Integration
303
287
 
304
- [Try it in the playground →](https://tasty.style/playground)
288
+ `configure()` is where a design system's vocabulary lives. Everything defined there is available to every component, and the same names feed the linter and TypeScript.
305
289
 
306
- ## Capabilities
290
+ | Define | With `configure({ … })` | Use in styles |
291
+ | ---------------------------- | ------------------------------------------------------- | -------------------------------------------------------- |
292
+ | Color tokens | `tokens: { '#surface': '#fff' }` | `fill: '#surface'`, `color: '#text.60'` |
293
+ | Value tokens | `tokens: { '$sidebar-width': '280px' }` | `width: '$sidebar-width'` |
294
+ | Units | `units: { x: '8px', r: '6px' }` | `padding: '2x'`, `radius: '1r'` |
295
+ | State aliases | `states: { '@mobile': '@media(w < 768px)' }` | `gap: { '': '2x', '@mobile': '1x' }` |
296
+ | Typography presets | `presets: { h1: { fontSize: '2rem', … } }` | `preset: 'h1'` |
297
+ | Recipes | `recipes: { card: { padding: '4x', … } }` | `recipe: 'card'` |
298
+ | Global at-rules | `keyframes`, `properties`, `fontFaces`, `counterStyles` | `animation: 'fade-in 200ms'` |
299
+ | Functions, handlers, plugins | `functions`, `handlers`, `propHandlers`, `plugins` | `$$name(...)`, new style properties, new component props |
307
300
 
308
- This section is a quick product tour. For the canonical guides and references, start from the [Docs Hub](docs/README.md).
301
+ Tokens accept state maps, so a theme is just more branches: `'#surface': { '': '#fff', '@dark': '#1c1c1e' }`. To generate whole light, dark, and high-contrast palettes with contrast solving, use [Glaze](#glaze).
309
302
 
310
- ### Design Tokens and Custom Units
303
+ ### Built-in units
311
304
 
312
- Tokens are first-class. Colors use `#name` syntax. Spacing, radius, and border width use multiplier units tied to CSS custom properties:
305
+ | Unit | Default | Example |
306
+ | ---- | ------------------- | ------------------------ |
307
+ | `x` | `8px` spacing step | `2x` → `16px` |
308
+ | `r` | `6px` radius | `1r` → `6px` |
309
+ | `cr` | `10px` card radius | `1cr` → `10px` |
310
+ | `bw` | `1px` border width | `2bw` → `2px` |
311
+ | `ow` | `3px` outline width | `1ow` → `3px` |
312
+ | `sf` | stable fraction | `1sf` → `minmax(0, 1fr)` |
313
+
314
+ Units compile to plain values. Override them with `configure({ units })`. When the scale has to change at runtime, point a unit at a custom property and define it as a token: `units: { x: 'var(--gap)' }` with `tokens: { $gap: '8px' }` makes `2x` compile to `calc(2 * var(--gap))`. Parentheses become `calc()`: `width: '(100% - 4x)'`.
315
+
316
+ ### Recipes
317
+
318
+ Recipes are reusable style bundles, state maps included:
313
319
 
314
320
  ```tsx
315
- fill: '#surface', // → var(--surface-color)
316
- color: '#text.80', // → 80% opacity text token
317
- padding: '2x', // → calc(var(--gap) * 2)
318
- radius: '1r', // → var(--radius)
319
- border: '1bw solid #border',
321
+ configure({
322
+ recipes: {
323
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
324
+ elevated: { shadow: '0 1x 3x #shadow' },
325
+ },
326
+ });
327
+
328
+ const Panel = tasty({ styles: { recipe: 'card elevated', gap: '2x' } });
320
329
  ```
321
330
 
322
- | Unit | Maps to | Example |
323
- |------|---------|---------|
324
- | `x` | `--gap` multiplier | `2x` → `calc(var(--gap) * 2)` |
325
- | `r` | `--radius` multiplier | `1r` → `var(--radius)` |
326
- | `bw` | `--border-width` multiplier | `1bw` → `var(--border-width)` |
327
- | `ow` | `--outline-width` multiplier | `1ow` → `var(--outline-width)` |
328
- | `cr` | `--card-radius` multiplier | `1cr` → `var(--card-radius)` |
331
+ Local styles merge over recipes with the same extend/replace rules as component extension. Recipes listed after `/` apply after local styles, and `none` skips base recipes. See [Style DSL — Recipes](docs/dsl.md#recipes).
329
332
 
330
- Define your own units via `configure({ units: { ... } })`.
333
+ For token vocabularies, state aliases, layout primitives, and override contracts, see [Building a Design System](docs/design-system.md). To add your own style properties, units, functions, or component props, see [Plugins & Extension Points](docs/plugins.md).
331
334
 
332
- ### State System
335
+ ## Component API
333
336
 
334
- Every style property accepts a state mapping object. Keys can be combined with boolean logic:
337
+ A Tasty component's public API is something you design. Instead of handing consumers an open `styles` escape hatch, expose the knobs they need as typed props.
335
338
 
336
- | State type | Syntax | CSS output |
337
- |------------|--------|------------|
338
- | Data attribute (boolean modifier) | `disabled` | `[data-disabled]` |
339
- | Data attribute (value modifier) | `theme=danger` | `[data-theme="danger"]` |
340
- | Pseudo-class | `:hover` | `:hover` |
341
- | Attribute selector | `[role="tab"]` | `[role="tab"]` |
342
- | Class selector (supported) | `.is-active` | `.is-active` |
343
- | Media query | `@media(w < 768px)` | `@media (width < 768px)` |
344
- | Container query | `@(panel, w >= 300px)` | `@container panel (width >= 300px)` |
345
- | Root state | `@root(schema=dark)` | `:root[data-schema="dark"]` |
346
- | Parent state | `@parent(theme=danger)` | `:is([data-theme="danger"] *)` |
347
- | Feature query | `@supports(display: grid)` | `@supports (display: grid)` |
348
- | Entry animation | `@starting` | `@starting-style` |
339
+ ### Style props
349
340
 
350
- Combine with `&` (AND), `|` (OR), `!` (NOT):
341
+ `styleProps` turns selected style properties into props. They accept state maps, so responsive values use the same syntax:
351
342
 
352
343
  ```tsx
353
- fill: {
354
- '': '#surface',
355
- 'theme=danger & :hover': '#danger-hover',
356
- '[aria-selected="true"]': '#accent-subtle',
357
- }
358
- ```
344
+ import { tasty, FLOW_STYLES } from '@tenphi/tasty';
359
345
 
360
- ### Sub-Element Styling
346
+ const Space = tasty({
347
+ styles: { display: 'flex', flow: 'column', gap: '1x' },
348
+ styleProps: FLOW_STYLES,
349
+ });
361
350
 
362
- Compound components can style inner parts from the parent definition with capitalized keys in `styles` and optional `elements` declarations, producing typed sub-components like `<Card.Title />` instead of separate wrapper components or ad hoc class naming.
351
+ <Space flow="row" gap={{ '': '2x', '@mobile': '1x' }} />;
352
+ ```
363
353
 
364
- Sub-elements share the root state context by default, so keys like `:hover`, modifiers, root states, and media queries resolve as one coordinated styling block. Use `@own(...)` when a sub-element should react to its own state, and use the `$` selector affix when you need precise descendant targeting.
354
+ ### Mod props
365
355
 
366
- See [Runtime API - Sub-element Styling](docs/runtime.md#sub-element-styling), [Style DSL - Advanced States](docs/dsl.md#advanced-states--prefix), and [Methodology](docs/methodology.md#component-architecture-root--sub-elements).
356
+ `modProps` exposes modifiers as typed props (`<Button isLoading size="lg">`, as in the [Quick Start](#3-add-states-and-a-typed-api)). Use `Boolean`, `String`, `Number`, or a `const` array of allowed values.
367
357
 
368
- ### Style Props
358
+ ### Token props
369
359
 
370
- `styleProps` exposes selected CSS properties as typed React props. Components control which properties to open up; consumers get layout and composition knobs without `styles` overrides. Supports state maps for responsive values.
360
+ `tokenProps` handles values that change often, such as progress, user-picked colors, or measured sizes. They set custom properties inline, so the class name and the CSS stay the same while the value changes:
371
361
 
372
362
  ```tsx
373
- const Space = tasty({
374
- styles: { display: 'flex', flow: 'column', gap: '1x' },
375
- styleProps: FLOW_STYLES,
363
+ const Progress = tasty({
364
+ tokenProps: ['progress', 'accentColor'] as const,
365
+ styles: { width: '$progress', fill: '#accent' },
376
366
  });
377
367
 
378
- <Space flow="row" gap={{ '': '2x', '@tablet': '4x' }}>
368
+ <Progress progress="75%" accentColor="#purple" />;
369
+ // style="--progress:75%;--accent-color:var(--purple-color)"
379
370
  ```
380
371
 
381
- See [Runtime API - Style Props](docs/runtime.md#style-props) and [Methodology - styleProps](docs/methodology.md#styleprops-as-the-public-api).
372
+ ### Variants
382
373
 
383
- ### Mod Props
374
+ Variants are named style sets. `variant` is typed from their keys, `default` applies when no `variant` is passed, and only the variants actually rendered emit CSS:
384
375
 
385
- `modProps` exposes modifier keys as typed React props — the modifier equivalent of `styleProps`. Accepts an array of key names or an object with type descriptors (`Boolean`, `String`, `Number`, or enum arrays) for full TypeScript autocomplete.
376
+ ```tsx
377
+ const Badge = tasty({
378
+ styles: { padding: '.5x 1x', radius: '1r' },
379
+ variants: {
380
+ default: { fill: '#surface', color: '#text' },
381
+ danger: { fill: '#danger', color: '#on-danger' },
382
+ },
383
+ });
384
+
385
+ <Badge variant="danger">Failed</Badge>;
386
+ ```
387
+
388
+ ### Sub-elements
389
+
390
+ Compound components style their inner parts from one definition. `elements` produces typed sub-components:
386
391
 
387
392
  ```tsx
388
- const Button = tasty({
389
- as: 'button',
390
- modProps: { isLoading: Boolean, size: ['sm', 'md', 'lg'] as const },
393
+ const Card = tasty({
391
394
  styles: {
392
- fill: { '': '#primary', isLoading: '#primary.5' },
393
- padding: { '': '2x 4x', 'size=sm': '1x 2x' },
395
+ padding: '4x',
396
+ Title: { preset: 'h3', color: { '': '#text', ':hover': '#primary' } },
397
+ Content: { color: '#text' },
394
398
  },
399
+ elements: { Title: 'h3', Content: 'div' },
395
400
  });
396
401
 
397
- <Button isLoading size="lg">Submit</Button>
402
+ <Card>
403
+ <Card.Title>Revenue</Card.Title>
404
+ <Card.Content>Up 12% this week</Card.Content>
405
+ </Card>;
398
406
  ```
399
407
 
400
- See [Runtime API - Mod Props](docs/runtime.md#mod-props) and [Methodology - modProps](docs/methodology.md#modprops-and-mods).
408
+ Sub-elements share the root's state context: `:hover` inside `Title` means "when the card is hovered". Use `@own(...)` when a part should react to its own state, and the `$` selector affix for precise descendant targeting.
401
409
 
402
- ### Variants
410
+ All of these are covered in [React API](docs/react-api.md). For guidance on what to expose and when, see [Methodology](docs/methodology.md).
403
411
 
404
- Variants let one component expose named visual versions without pre-generating a separate class for every possible combination. In runtime mode, Tasty emits only the variant CSS that is actually used.
412
+ ## Types and Linting
405
413
 
406
- See [Runtime API - Variants](docs/runtime.md#variants).
414
+ ### TypeScript
407
415
 
408
- ### Recipes
416
+ Component props are typed from their definitions: `modProps` value lists become unions, `variant` is typed from the variant keys, style props are typed like the styles they expose, and sub-elements are typed components. Register your design system's names to get autocomplete inside style values too:
409
417
 
410
- Recipes are reusable style bundles defined in `configure({ recipes })` and applied with the `recipe` style property. They are useful when your design system wants shared state logic or visual presets without forcing every component to repeat the same style map.
418
+ ```ts
419
+ // tasty.d.ts
420
+ import '@tenphi/tasty';
411
421
 
412
- Use `/` to post-apply recipes after local styles when recipe states should win the final merge order, and use `none` to skip base recipes entirely.
422
+ declare module '@tenphi/tasty' {
423
+ // '#surface', '#primary.50' in fill, color, and other color props
424
+ interface TastyNamedColors {
425
+ surface: true;
426
+ primary: true;
427
+ }
428
+ // preset: 'h1'
429
+ interface TastyPresetNames {
430
+ h1: true;
431
+ t2: true;
432
+ }
433
+ // <Button theme="danger" />
434
+ interface TastyThemeNames {
435
+ danger: true;
436
+ }
437
+ }
438
+ ```
413
439
 
414
- See [Style DSL - Recipes](docs/dsl.md#recipes) and [Configuration - recipes](docs/configuration.md#recipes).
440
+ `StylesInterface`, `TastyCustomProps`, and `TastyBaseStylePropNames` type the style properties, component props, and base style props your plugins add. See [Configuration → TypeScript](docs/configuration.md#typescript).
415
441
 
416
- ### Auto-Inferred `@property`
442
+ ### ESLint and oxlint
417
443
 
418
- Tasty usually removes the need to hand-author CSS [`@property`](https://developer.mozilla.org/en-US/docs/Web/CSS/@property) rules. When a custom property receives a concrete value, Tasty infers its syntax and registers the matching `@property` automatically, which makes transitions and animations on custom properties work without extra boilerplate.
444
+ [`@tenphi/eslint-plugin-tasty`](https://github.com/tenphi/eslint-plugin-tasty) validates style objects and JSX style props at lint time:
419
445
 
420
- If you prefer explicit control, disable inference with `configure({ autoPropertyTypes: false })` or declare the properties yourself.
446
+ ```bash
447
+ pnpm add -D @tenphi/eslint-plugin-tasty
448
+ ```
421
449
 
422
- See [Style DSL - Properties (`@property`)](docs/dsl.md#properties-property).
450
+ ```js
451
+ // eslint.config.js
452
+ import tasty from '@tenphi/eslint-plugin-tasty';
423
453
 
424
- ### Explicit `@properties`
454
+ export default [tasty.configs.recommended]; // or tasty.configs.strict
455
+ ```
425
456
 
426
- Use explicit `@properties` only when you need to override defaults such as `inherits: false` or a custom `initialValue`.
457
+ A `tasty.config.ts` at the project root tells the plugin what your design system defines:
458
+
459
+ ```ts
460
+ // tasty.config.ts
461
+ export default {
462
+ tokens: ['#surface', '#text', '#primary', '$sidebar-width'],
463
+ states: ['@mobile', '@dark'],
464
+ presets: ['h1', 'h2', 't1', 't2'],
465
+ recipes: ['card', 'elevated'],
466
+ importSources: ['@my-org/ui'], // modules that re-export tasty()
467
+ };
468
+ ```
427
469
 
428
- See [Style DSL - Properties (`@property`)](docs/dsl.md#properties-property).
470
+ With that in place, `recommended` catches:
429
471
 
430
- ### React Hooks
472
+ - Typos in property names (checked against the full CSS property set) and malformed values
473
+ - Unknown color tokens, units, presets, and recipes (plus `$` tokens and state aliases in `strict`)
474
+ - Invalid state keys, missing `''` defaults, nested state maps, and `!important`
475
+ - Raw colors and pixel lengths where tokens belong, and non-idiomatic syntax such as `calc(...)` or `display: 'none'`, some with autofixes
476
+ - `style`, `className`, and instance `styles` on Tasty components, in favor of their typed API
477
+ - Bad values in JSX style props, such as `<Box fill="red" gap="17px" />`
431
478
 
432
- When you do not need a full component wrapper, use the hooks directly: `useStyles` for local class names, `useGlobalStyles` for selector-scoped global CSS, `useRawCSS` for raw rules, plus `useKeyframes` and `useProperty` for animation and custom-property primitives.
479
+ The same rule sets run under oxlint. See the [plugin README](https://github.com/tenphi/eslint-plugin-tasty) for every rule and option.
433
480
 
434
- See [Runtime API - Hooks](docs/runtime.md#hooks).
481
+ ## CSS Coverage
435
482
 
436
- ### Zero-Runtime Mode
483
+ Every style property accepts a state map, and every kind of condition is a state key:
437
484
 
438
- Use `tastyStatic` when you want the same DSL and state model, but with CSS extracted at build time and no styling runtime in the client bundle. It is a strong fit for static sites, landing pages, and other build-time-first setups.
485
+ | State type | Syntax | CSS output |
486
+ | ---------------- | -------------------------- | ----------------------------------- |
487
+ | Boolean modifier | `loading` | `[data-loading]` |
488
+ | Value modifier | `theme=danger` | `[data-theme="danger"]` |
489
+ | Pseudo-class | `:hover` | `:hover` |
490
+ | Attribute | `[aria-selected="true"]` | `[aria-selected="true"]` |
491
+ | Class | `.is-active` | `.is-active` |
492
+ | Media query | `@media(w < 768px)` | `@media (width < 768px)` |
493
+ | Container query | `@(panel, w >= 300px)` | `@container panel (width >= 300px)` |
494
+ | Root state | `@root(schema=dark)` | `:root[data-schema="dark"]` |
495
+ | Parent state | `@parent(theme=danger)` | `:is([data-theme="danger"] *)` |
496
+ | Structural | `:has(> Icon)` | `:has(> [data-element="Icon"])` |
497
+ | Feature query | `@supports(display: grid)` | `@supports (display: grid)` |
498
+ | Entry animation | `@starting` | `@starting-style` |
439
499
 
440
- See [Zero Runtime (tastyStatic)](docs/tasty-static.md) and [Getting Started - Choosing a rendering mode](docs/getting-started.md#choosing-a-rendering-mode).
500
+ Combine them with `&` (and), `|` (or), `!` (not), and `^` (xor): `'theme=danger & :hover'`. The `_` key sets a fallback floor for queries a browser may evaluate as unknown. See [Style DSL](docs/dsl.md).
441
501
 
442
- ### `tasty` vs `tastyStatic`
502
+ At-rules live next to the styles that use them:
443
503
 
444
- `tasty()` returns React components and injects CSS on demand at runtime. `tastyStatic()` returns class names and extracts CSS during the build. Both share the same DSL, tokens, units, state mappings, and recipes, so the main choice is runtime flexibility versus build-time extraction.
504
+ ```tsx
505
+ const Spinner = tasty({
506
+ styles: {
507
+ '@keyframes': { spin: { to: { transform: 'rotate(360deg)' } } },
508
+ animation: 'spin 1s linear infinite',
509
+ },
510
+ });
511
+ ```
445
512
 
446
- See [Zero Runtime (tastyStatic)](docs/tasty-static.md), [Runtime API](docs/runtime.md), and [Comparison - Build-time vs runtime](docs/comparison.md#build-time-vs-runtime).
513
+ - **`@keyframes`**: inline, as above, or global via `configure({ keyframes })`.
514
+ - **`@property`**: inferred automatically when a custom property gets a concrete value, so custom properties can transition and animate with no boilerplate. Declare one explicitly to change `inherits` or the initial value.
515
+ - **`@font-face`** and **`@counter-style`**: in styles, in `configure()`, or with the matching style function.
516
+ - **`@function`**: define parameterized CSS functions as `$$name` and call them anywhere a value is accepted. An opt-in polyfill inlines the calls for browsers that do not support it yet.
447
517
 
448
- ### Server-Side Rendering
518
+ Tasty also ships its own style properties (`fill`, `flow`, `radius`, `preset`, `fade`, `scrollbar`, `hide`, and more), documented in [Style Properties](docs/styles.md). `@layer` and `!important` are intentionally left out: they would bring back the priority fights that state maps remove.
449
519
 
450
- SSR layers on top of runtime `tasty()` rather than introducing a separate styling model. Existing components stay unchanged while Tasty collects CSS during server rendering and hydrates the cache on the client.
520
+ ### Style functions
451
521
 
452
- Use `@tenphi/tasty/ssr/next` for Next.js App Router, `@tenphi/tasty/ssr/astro` for Astro, or the core SSR API for other React SSR setups.
522
+ When you don't need a component, call the style functions directly: `useStyles` for a class name, `useGlobalStyles` for selector-scoped global CSS, `useRawCSS` for raw rules, plus `useKeyframes`, `useProperty`, `useFontFace`, `useCounterStyle`, and `useFunction`. Apart from `useStyles`, which reads React context, they are plain functions despite the `use` prefix, so they work in React Server Components and outside React; `computeStyles` is the hook-free equivalent of `useStyles`. See [React API — Style Functions](docs/react-api.md#style-functions).
453
523
 
454
- See the [full SSR guide](docs/ssr.md).
524
+ ## Rendering Modes
455
525
 
456
- ## Entry Points
526
+ The DSL, tokens, units, state maps, and recipes are the same everywhere. What changes is where CSS is generated:
457
527
 
458
- | Import | Description | Platform |
459
- |--------|-------------|----------|
460
- | `@tenphi/tasty` | Runtime style engine (`tasty`, hooks, `configure`) | Browser |
461
- | `@tenphi/tasty/static` | Zero-runtime static styles (`tastyStatic`) | Browser |
462
- | `@tenphi/tasty/core` | Lower-level internals (config, parser, pipeline, injector, style handlers) for tooling and advanced use | Browser / Node |
463
- | `@tenphi/tasty/babel-plugin` | Babel plugin for zero-runtime CSS extraction | Node |
464
- | `@tenphi/tasty/zero` | Programmatic extraction API | Node |
465
- | `@tenphi/tasty/next` | Next.js integration wrapper | Node |
466
- | `@tenphi/tasty/ssr` | Core SSR API (collector, context, hydration) | Node |
467
- | `@tenphi/tasty/ssr/next` | Next.js App Router SSR integration | Node |
468
- | `@tenphi/tasty/ssr/astro` | Astro middleware + auto-hydration | Node / Browser |
528
+ | Approach | Authoring API | CSS is generated | Tasty runtime in the browser | Best for |
529
+ | ------------------------- | ------------------------------------------- | ----------------------------------- | ---------------------------- | ---------------------------------------------------------------- |
530
+ | **Server-only React** | `tasty()` plus `@tenphi/tasty/ssr/*` | During server or static rendering | None | Astro without islands, server-only RSC, SSG |
531
+ | **Hydrated React** | `tasty()` plus `@tenphi/tasty/ssr/*` | During SSR, then on demand in React | Only in hydrated components | Interactive React apps, Next.js client components, Astro islands |
532
+ | **Build-time extraction** | `tastyStatic()` from `@tenphi/tasty/static` | During the build | None in file mode | Non-React frameworks, CSS needed before rendering |
469
533
 
470
- ## Browser Requirements
534
+ - **`tasty()` renders on the server.** Components are hook-free and render as React Server Components by default. Rendered only on the server, they keep the full React API (`styleProps`, sub-elements, variants) and ship no styling runtime. Astro's `tastyIntegration({ islands: false })` is the verified zero-JavaScript setup; server-only Next.js RSC follows the same architecture. Without an integration, each element inlines its own CSS and configured tokens and global styles are not emitted, so use one for anything that relies on `configure()`.
535
+ - **SSR integrations** add CSS batching, cross-tree deduplication, FOUC prevention, and client cache hydration for apps that also render on the client: `TastyRegistry` from `@tenphi/tasty/ssr/next` (plus `withTastyNext()` from `@tenphi/tasty/ssr/next-config` for a shared global stylesheet), `tastyIntegration()` from `@tenphi/tasty/ssr/astro`, and a core API for other React SSR setups. Streaming is supported.
536
+ - **`tastyStatic()`** returns class names and extracts CSS during the build through a Babel plugin, with no React dependency. File mode ships no runtime; inject mode ships a tiny CSS injector.
471
537
 
472
- Tasty's exclusive selector system relies on modern CSS pseudo-class syntax:
538
+ See [Server-Side Rendering](docs/ssr.md), [Build-Time Extraction](docs/tasty-static.md), and [Choosing a rendering mode](docs/getting-started.md#choosing-a-rendering-mode).
473
539
 
474
- - **`:is()`** — available across all major browsers since January 2021 ([MDN Baseline](https://developer.mozilla.org/en-US/docs/Web/CSS/:is)).
475
- - **Level-4 `:not()` with selector lists** — Chrome/Edge 88+, Firefox 84+, Safari 9+, Opera 75+.
476
- - **Not supported:** IE 11.
540
+ ## Tooling
477
541
 
478
- ## Performance
542
+ ### ESLint plugin
479
543
 
480
- ### Bundle Size
544
+ Covered in [Types and Linting](#eslint-and-oxlint): 40+ rules for ESLint 9+ and oxlint, configured from `tasty.config.ts`.
481
545
 
482
- All sizes measured with [size-limit](https://github.com/ai/size-limit) — minified and brotli-compressed, including all dependencies.
546
+ ### VS Code extension
483
547
 
484
- | Entry point | Size |
485
- |-------------|------|
486
- | `@tenphi/tasty` (runtime + SSR) | ~44 kB |
487
- | `@tenphi/tasty/core` (runtime, no SSR) | ~41 kB |
488
- | `@tenphi/tasty/static` (zero-runtime) | ~1.5 kB |
548
+ [Tasty for VS Code](https://github.com/tenphi/tasty-vscode-extension) highlights color tokens, units, state keys, presets, and style properties inside `tasty()`, `tastyStatic()`, `styles` objects, and style functions, and adds snippets for components, state maps, and `configure()`. Install the `.vsix` from the [latest release](https://github.com/tenphi/tasty-vscode-extension/releases/latest).
489
549
 
490
- Run `pnpm size` for exact up-to-date numbers.
550
+ <p align="center">
551
+ <img src="assets/tasty-vscode-highlight.png" width="512" alt="Tasty VS Code syntax highlighting example" />
552
+ </p>
491
553
 
492
- ### Runtime Benchmarks
554
+ ### Glaze
493
555
 
494
- If you choose the runtime approach, performance is usually a non-issue in practice. The numbers below show single-call throughput for the core pipeline stages, measured with `vitest bench` on an Apple M1 Max (Node 22).
556
+ [`@tenphi/glaze`](https://github.com/tenphi/glaze) generates light, dark, and high-contrast themes from one hue in the OKHST color space, solves WCAG and APCA contrast, and exports Tasty tokens directly (as well as CSS, DTCG, and Tailwind):
495
557
 
496
- | Operation | ops/sec | Latency (mean) |
497
- |-----------|--------:|---------------:|
498
- | `renderStyles` — 5 flat properties (cold) | ~72,000 | ~14 us |
499
- | `renderStyles` — state map with media/hover/modifier (cold) | ~22,000 | ~46 us |
500
- | `renderStyles` — same styles (cached) | ~7,200,000 | ~0.14 us |
501
- | `parseStateKey` — simple key like `:hover` (cold) | ~1,200,000 | ~0.9 us |
502
- | `parseStateKey` — complex OR/AND/NOT key (cold) | ~190,000 | ~5 us |
503
- | `parseStateKey` — any key (cached) | ~3,300,000–8,900,000 | ~0.1–0.3 us |
504
- | `parseStyle` — value tokens like `2x 4x` (cold) | ~345,000 | ~3 us |
505
- | `parseStyle` — color tokens (cold) | ~525,000 | ~1.9 us |
506
- | `parseStyle` — any value (cached) | ~15,500,000 | ~0.06 us |
558
+ ```ts
559
+ import { glaze } from '@tenphi/glaze';
560
+ import { configure } from '@tenphi/tasty';
507
561
 
508
- "Cold" benchmarks use unique inputs to bypass all caches. Cached benchmarks reuse a single input and measure the LRU hot path.
562
+ const theme = glaze(280, 80); // hue, saturation
563
+ theme.colors({
564
+ surface: { tone: 97, saturation: 0.15 },
565
+ text: { base: 'surface', tone: '-1', contrast: 'AA' },
566
+ });
509
567
 
510
- Run `pnpm bench` to reproduce.
568
+ configure({ tokens: theme.tasty() }); // #surface and #text, light and dark
569
+ ```
511
570
 
512
- #### What This Means in Practice
571
+ ### Debugging
513
572
 
514
- - **Cached path dominates production.** After a component's first render, subsequent renders with stable styles skip the pipeline entirely (React `useMemo` + LRU cache hits at every level). All cached operations are sub-microsecond — effectively free.
515
- - **Cold path is fast enough.** The heaviest cold operation — a complex state map with media queries, hover, and modifiers — takes ~46 us. Even a page with 100 unique styled components adds only ~5 ms of total style computation on first render, negligible next to React reconciliation and DOM work.
516
- - **Cache multipliers are 30x–100x.** This confirms the multi-level LRU architecture (parser, state-key, simplify, condition, pipeline) is delivering real value.
517
- - **Comparable to lighter systems.** Emotion's `css()` is typically 5–20 us for simple styles; Tasty's cold `renderStyles` at ~14 us for 5 properties is in the same range despite doing significantly more work (state maps, design tokens, sub-elements, chunking).
518
- - **On slower devices.** The benchmarks above are from an M1 Max (Geekbench 6 SC ~2,400). A mid-range consumer laptop (~1,800 SC) is roughly 1.3x slower; a mid-range phone (~1,200 SC) is roughly 2x slower; a budget phone (~700 SC) is roughly 3–4x slower. Even at 4x, the heaviest cold operation stays under 200 us and 100 unique components under 20 ms — still well within a single frame budget. The cached path remains sub-microsecond on all devices.
573
+ `tastyDebug` inspects what Tasty injected, straight from the browser console:
519
574
 
520
- ### How It Stays Fast
575
+ ```ts
576
+ import { tastyDebug } from '@tenphi/tasty';
521
577
 
522
- - CSS is generated and injected only when styles are actually used.
523
- - Multi-level caching avoids repeated parsing and style recomputation.
524
- - Styles are split into reusable chunks and applied as multiple class names, so matching chunks can be reused across components instead of re-injected.
525
- - Style normalization guarantees equivalent style input resolves to the same chunks, improving deduplication hit rates.
526
- - A style garbage collector removes unused styles/chunks over time.
527
- - A dedicated style injector minimizes DOM/style-tag overhead.
528
- - This approach is validated in enterprise-scale apps where runtime styling overhead is not noticeable in normal UI flows.
578
+ tastyDebug.install(); // exposes window.tastyDebug
579
+ tastyDebug.inspect('.my-button'); // classes, chunks, and the CSS that applies
580
+ ```
529
581
 
530
- ## Ecosystem
582
+ See [Debug Utilities](docs/debug.md).
531
583
 
532
- Tasty is the core of a production-ready styling platform. These companion tools complete the picture:
584
+ ### AI coding agents
533
585
 
534
- ### [ESLint Plugin](https://github.com/tenphi/eslint-plugin-tasty)
586
+ Style definitions are declarative and fully typed, so agents can read and write them reliably. [Style Rules for AI Agents](docs/ai-agents.md) is a one-page brief to add to an agent's context.
535
587
 
536
- `@tenphi/eslint-plugin-tasty` — 27 total lint rules for style property names, value syntax, token existence, state keys, and best practices. The `recommended` preset enables 18 of them as a practical default. Catch typos and invalid styles at lint time, not at runtime.
588
+ ## Performance
537
589
 
538
- ```bash
539
- pnpm add -D @tenphi/eslint-plugin-tasty
540
- ```
590
+ ### Bundle size
541
591
 
542
- ```js
543
- import tasty from '@tenphi/eslint-plugin-tasty';
544
- export default [tasty.configs.recommended];
545
- ```
592
+ Measured with [size-limit](https://github.com/ai/size-limit): minified and brotli-compressed, including all dependencies.
546
593
 
547
- ### [Glaze](https://github.com/tenphi/glaze)
594
+ | Entry point | Size |
595
+ | ------------------------------------------------- | -------- |
596
+ | `@tenphi/tasty`, importing `tasty` | 50.79 kB |
597
+ | `@tenphi/tasty`, everything | 57.54 kB |
598
+ | `@tenphi/tasty/core`, everything (no SSR) | 54.45 kB |
599
+ | `@tenphi/tasty/static` (build-time authoring API) | 920 B |
600
+ | `@tenphi/tasty/ssr/astro-client` | 283 B |
601
+ | `@tenphi/tasty/zero` (Node, build time) | 37.57 kB |
602
+ | `@tenphi/tasty/babel-plugin` (Node, build time) | 41.65 kB |
548
603
 
549
- `@tenphi/glaze` — OKHSL-based color theme generator with automatic WCAG contrast solving. Generate light, dark, and high-contrast palettes from a single hue, and export them directly as Tasty color tokens.
604
+ Run `pnpm size` to reproduce; numbers shift slightly between releases.
550
605
 
551
- ```tsx
552
- import { glaze } from '@tenphi/glaze';
606
+ ### Runtime
553
607
 
554
- const theme = glaze(280, 80);
555
- theme.colors({
556
- surface: { lightness: 97 },
557
- text: { base: 'surface', lightness: '-52', contrast: 'AAA' },
558
- });
608
+ When styles are generated in the browser:
559
609
 
560
- const tokens = theme.tasty(); // Ready-to-use Tasty tokens
561
- ```
610
+ - CSS is generated and injected only for styles that are actually rendered.
611
+ - Styles are split into chunks and normalized, so equivalent styles resolve to the same classes and are reused across components instead of re-injected.
612
+ - Multi-level caching avoids re-parsing and recomputation.
613
+ - Unused styles can be garbage-collected over time with `configure({ gc })`, or on demand with `gc()` and `cleanup()`.
614
+ - Optional [batched injection](docs/configuration.md#batched-injection) groups stylesheet writes before layout reads.
615
+ - The approach runs in enterprise-scale apps where runtime styling overhead is not noticeable in normal UI flows.
562
616
 
563
- ### [VS Code Extension](https://github.com/tenphi/tasty-vscode-extension)
617
+ Reproducible benchmarks cover the core pipeline, the React overhead of an empty `tasty({})` wrapper, cold generation and injection against equivalent precompiled CSS, steady-state interactions, and page-load cold start. See [Runtime Benchmarks](docs/runtime-benchmarks.md) for methodology and results.
564
618
 
565
- Syntax highlighting for Tasty styles in TypeScript, TSX, JavaScript, and JSX. Highlights color tokens, custom units, state keys, presets, and style properties inside `tasty()`, `tastyStatic()`, and related APIs.
619
+ ## Browser Support
566
620
 
567
- <p align="center">
568
- <img src="assets/tasty-vscode-highlight.png" width="512" alt="Tasty VS Code syntax highlighting example">
569
- </p>
621
+ Exclusive selectors rely on `:is()`, `:where()`, and level-4 `:not()` with selector lists: Chrome and Edge 88+, Firefox 84+, Safari 14+. Internet Explorer is not supported.
622
+
623
+ ## Entry Points
624
+
625
+ | Import | Description | Platform |
626
+ | -------------------------------- | ------------------------------------------------------------------------------------------------------- | -------------- |
627
+ | `@tenphi/tasty` | React style engine (`tasty`, style functions, `configure`) | Browser / Node |
628
+ | `@tenphi/tasty/core` | Lower-level internals (config, parser, pipeline, injector, style handlers) for tooling and advanced use | Browser / Node |
629
+ | `@tenphi/tasty/static` | Build-time extraction authoring API (`tastyStatic`) | Build time |
630
+ | `@tenphi/tasty/static/inject` | Runtime helper the Babel plugin rewrites `tastyStatic` imports to in inject mode | Browser |
631
+ | `@tenphi/tasty/babel-plugin` | Babel plugin for build-time CSS extraction | Node |
632
+ | `@tenphi/tasty/zero` | Programmatic extraction API | Node |
633
+ | `@tenphi/tasty/zero/next` | Next.js wrapper for build-time extraction | Node |
634
+ | `@tenphi/tasty/ssr` | Core SSR API (collector, context, hydration) | Node |
635
+ | `@tenphi/tasty/ssr/next` | Next.js App Router SSR integration (`TastyRegistry`) | Node |
636
+ | `@tenphi/tasty/ssr/next-config` | Next.js config wrapper for a shared global stylesheet (`withTastyNext`) | Node |
637
+ | `@tenphi/tasty/ssr/astro` | Astro integration and middleware | Node |
638
+ | `@tenphi/tasty/ssr/astro-client` | Astro client-side cache hydration | Browser |
570
639
 
571
640
  ## Built with Tasty
572
641
 
573
642
  ### [tasty.style](https://tasty.style) ([source](https://github.com/tenphi/tasty.style))
574
643
 
575
- The official Tasty documentation and landing page — itself built entirely with Tasty. A showcase for zero-runtime styling via `tastyStatic`, SSR with Next.js, and OKHSL color theming with Glaze.
644
+ The official Tasty documentation and landing page — itself built entirely with `tasty()`. A showcase for server-rendered Tasty with Next.js and OKHST color theming with Glaze.
645
+
646
+ ### [Cookbook](https://cookbook.tenphi.me) ([source](https://github.com/tenphi/cookbook))
647
+
648
+ `@tenphi/cookbook` builds a static Astro documentation site from your repository or a published npm package. Brand colors, semantic palettes, fonts, typography, and individual component parts are configured through Tasty and Glaze, so the docs match your product.
576
649
 
577
650
  ### [Cube Cloud](https://cube.dev/)
578
651
 
@@ -588,41 +661,43 @@ Open-source React UI kit built on Tasty + React Aria. 100+ production components
588
661
 
589
662
  ## Documentation
590
663
 
591
- Start from the docs hub if you want the shortest path to the right guide for your role or styling approach.
592
-
593
- - **[Docs Hub](docs/README.md)** — audience-based navigation across onboarding, design-system authoring, runtime, zero-runtime, runtime SSR integration, debugging, and internals
664
+ The [Docs Hub](docs/README.md) routes you by role, rendering mode, and task.
594
665
 
595
- ### Start here
666
+ **Start here**
596
667
 
597
- - **[Getting Started](docs/getting-started.md)** — Installation, first component, optional shared configuration, ESLint plugin setup, editor tooling, and rendering mode decision tree
598
- - **[Methodology](docs/methodology.md)** — The recommended patterns for structuring Tasty components: root + sub-elements, styleProps, tokens, styles vs style, wrapping and extension
668
+ - [Getting Started](docs/getting-started.md) — Install, first component, shared configuration, ESLint, editor tooling, and choosing a rendering mode
669
+ - [Methodology](docs/methodology.md) — The recommended component model: root + sub-elements, `styleProps`, tokens, `styles` vs `style`, wrapping and extension
599
670
 
600
- ### Guides
671
+ **Guides**
601
672
 
602
- - **[Building a Design System](docs/design-system.md)** — Practical guide to building a DS layer: token vocabulary, state aliases, recipes, primitives, compound components, override contracts
603
- - **[Adoption Guide](docs/adoption.md)** — Where Tasty sits in the stack, who should adopt it, what you define yourself, and how to introduce it incrementally into an existing design system
673
+ - [Building a Design System](docs/design-system.md) — Token vocabulary, state aliases, recipes, primitives, compound components, and override contracts
674
+ - [Adoption Guide](docs/adoption.md) — Where Tasty fits, who should adopt it, and how to introduce it incrementally
675
+ - [Comparison](docs/comparison.md) — Tasty next to Tailwind, Panda CSS, vanilla-extract, StyleX, Stitches, and Emotion
604
676
 
605
- ### Reference
677
+ **Reference**
606
678
 
607
- - **[Style DSL](docs/dsl.md)** — The Tasty style language: state maps, tokens, units, color syntax, extending semantics, recipes, keyframes, and @property
608
- - **[Runtime API](docs/runtime.md)** — React-specific API: `tasty()` factory, component props, variants, sub-elements, and hooks
609
- - **[Configuration](docs/configuration.md)** — Global configuration: tokens, recipes, custom units, style handlers, and TypeScript extensions
610
- - **[Style Properties](docs/styles.md)** — Complete reference for all enhanced style properties: syntax, values, modifiers, and recommendations
679
+ - [Style DSL](docs/dsl.md) — State maps, tokens, units, colors, extending semantics, recipes, and at-rules
680
+ - [Style Properties](docs/styles.md) — Every enhanced style property: syntax, values, and modifiers
681
+ - [React API](docs/react-api.md) — `tasty()`, component props, variants, sub-elements, and style functions
682
+ - [Configuration](docs/configuration.md) — Everything `configure()` accepts
683
+ - [Plugins & Extension Points](docs/plugins.md) — Custom style handlers, props middleware, and typing your extension
684
+ - [Style Rules for AI Agents](docs/ai-agents.md) — A condensed brief for writing correct styles
611
685
 
612
- ### Rendering modes
686
+ **Rendering modes**
613
687
 
614
- - **[Zero Runtime (tastyStatic)](docs/tasty-static.md)** — Build-time static styling: Babel plugin setup, Next.js integration, and static style patterns
615
- - **[Server-Side Rendering](docs/ssr.md)** — SSR setup for Next.js, Astro, and generic frameworks: streaming support, cache hydration, and troubleshooting
688
+ - [Server-Side Rendering](docs/ssr.md) — Next.js, Astro, and generic React SSR: streaming, cache hydration, and troubleshooting
689
+ - [Build-Time Extraction (`tastyStatic`)](docs/tasty-static.md) — Babel plugin setup, Next.js integration, and static style patterns
616
690
 
617
- ### Internals
691
+ **Internals**
618
692
 
619
- - **[Style rendering pipeline](docs/PIPELINE.md)** — How `Styles` become mutually exclusive CSS rules: parse → exclusives → combinations → handlers → merge → materialize (`src/pipeline/`)
620
- - **[Style Injector](docs/injector.md)** — Internal CSS injection engine: `inject()`, `injectGlobal()`, `injectRawCSS()`, `keyframes()`, deduplication, reference counting, cleanup, SSR support, and Shadow DOM
621
- - **[Debug Utilities](docs/debug.md)** — Runtime CSS inspection via `tastyDebug`: CSS extraction, element inspection, cache metrics, chunk breakdown, and performance monitoring
693
+ - [Style rendering pipeline](docs/pipeline.md) — How state maps become mutually exclusive CSS rules
694
+ - [Style Injector](docs/injector.md) — Deduplication, reference counting, cleanup, SSR, and Shadow DOM
695
+ - [Debug Utilities](docs/debug.md) — Inspecting CSS, elements, caches, and chunks at runtime
696
+ - [Runtime Benchmarks](docs/runtime-benchmarks.md) — Methodology and results
622
697
 
623
- ### Context
698
+ **Upgrading**
624
699
 
625
- - **[Comparison](docs/comparison.md)** — How Tasty compares to Tailwind, Panda CSS, vanilla-extract, StyleX, Stitches, and Emotion: positioning, trade-offs, and when each tool fits best
700
+ - [Migration Guide (v2 → v3)](docs/migration-v3.md) — Every breaking change in 3.0, with a search-and-replace cheat sheet
626
701
 
627
702
  ## License
628
703