@tenphi/tasty 0.0.0-snapshot.a7fb1f5 → 0.0.0-snapshot.a8a2a5d

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 (387) hide show
  1. package/README.md +453 -360
  2. package/dist/babel-types-BOABQvEI.d.ts +16 -0
  3. package/dist/chunks/async-storage-CzSKAyrI.js +36 -0
  4. package/dist/chunks/async-storage-CzSKAyrI.js.map +1 -0
  5. package/dist/chunks/build-config-DQkT3Wru.js +59 -0
  6. package/dist/chunks/build-config-DQkT3Wru.js.map +1 -0
  7. package/dist/chunks/collector-Df9zcabl.js +209 -0
  8. package/dist/chunks/collector-Df9zcabl.js.map +1 -0
  9. package/dist/chunks/config-engine-C7OUmM1J.js +269 -0
  10. package/dist/chunks/config-engine-C7OUmM1J.js.map +1 -0
  11. package/dist/chunks/config-file-BX3F_61U.js +24 -0
  12. package/dist/chunks/config-file-BX3F_61U.js.map +1 -0
  13. package/dist/chunks/css-definitions-BkdTqT7G.js +896 -0
  14. package/dist/chunks/css-definitions-BkdTqT7G.js.map +1 -0
  15. package/dist/chunks/css-resources-C0zT36nQ.js +141 -0
  16. package/dist/chunks/css-resources-C0zT36nQ.js.map +1 -0
  17. package/dist/{debug.js → chunks/debug-CwGMB2RI.js} +197 -149
  18. package/dist/chunks/debug-CwGMB2RI.js.map +1 -0
  19. package/dist/chunks/dsl-BAwiOznp.js +1442 -0
  20. package/dist/chunks/dsl-BAwiOznp.js.map +1 -0
  21. package/dist/chunks/hydration-DEmoq1sQ.js +39 -0
  22. package/dist/chunks/hydration-DEmoq1sQ.js.map +1 -0
  23. package/dist/chunks/react-runtime-B8YqpFx7.js +678 -0
  24. package/dist/chunks/react-runtime-B8YqpFx7.js.map +1 -0
  25. package/dist/chunks/runtime-engine-CHNH2nGy.js +2418 -0
  26. package/dist/chunks/runtime-engine-CHNH2nGy.js.map +1 -0
  27. package/dist/chunks/runtime-state-BxLKsQzs.js +150 -0
  28. package/dist/chunks/runtime-state-BxLKsQzs.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-CYgOs2mp.js} +58 -58
  30. package/dist/chunks/shared-utils-CYgOs2mp.js.map +1 -0
  31. package/dist/chunks/style-engine-DkKH-TqL.js +5573 -0
  32. package/dist/chunks/style-engine-DkKH-TqL.js.map +1 -0
  33. package/dist/chunks/zero-engine-C-0ar_PT.js +308 -0
  34. package/dist/chunks/zero-engine-C-0ar_PT.js.map +1 -0
  35. package/dist/collector-BN6hCWIx.d.ts +160 -0
  36. package/dist/config-Chmu-PnP.d.ts +1349 -0
  37. package/dist/core/index.d.ts +5 -34
  38. package/dist/core/index.js +9 -27
  39. package/dist/hydrate-CTh8SGd9.d.ts +20 -0
  40. package/dist/index-szujmf6W.d.ts +1848 -0
  41. package/dist/index.d.ts +5 -51
  42. package/dist/index.js +11 -36
  43. package/dist/merge-styles-Cx25bpax.d.ts +4 -0
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +5 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +8 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +8 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +8 -0
  51. package/dist/ssr/astro-middleware-extract.js +8 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +15 -0
  54. package/dist/ssr/astro-middleware-static.js +6 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +16 -0
  57. package/dist/ssr/astro-middleware.js +6 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -14
  60. package/dist/ssr/astro.js +205 -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 +1 -0
  64. package/dist/ssr/index.d.ts +15 -4
  65. package/dist/ssr/index.js +7 -8
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +63 -0
  68. package/dist/ssr/next-config.js +122 -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 +33 -48
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +86 -5
  74. package/dist/static/index.js +29 -3
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +1 -4
  77. package/dist/static/inject.js +1 -2
  78. package/dist/static/inject.js.map +1 -1
  79. package/dist/types-DbMN-Yyn.d.ts +1545 -0
  80. package/dist/zero/babel.d.ts +12 -123
  81. package/dist/zero/babel.js +125 -151
  82. package/dist/zero/babel.js.map +1 -1
  83. package/dist/zero/index.d.ts +130 -3
  84. package/dist/zero/index.js +24 -3
  85. package/dist/zero/index.js.map +1 -0
  86. package/dist/zero/next.d.ts +5 -7
  87. package/dist/zero/next.js +4 -40
  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 +259 -0
  92. package/docs/comparison.md +83 -54
  93. package/docs/configuration.md +712 -81
  94. package/docs/debug.md +39 -24
  95. package/docs/design-system.md +186 -41
  96. package/docs/dsl.md +740 -197
  97. package/docs/getting-started.md +132 -52
  98. package/docs/injector.md +184 -92
  99. package/docs/llms.txt +31 -0
  100. package/docs/methodology.md +107 -50
  101. package/docs/migration-v3.md +285 -0
  102. package/docs/pipeline.md +768 -0
  103. package/docs/plugins.md +333 -0
  104. package/docs/react-api.md +746 -0
  105. package/docs/runtime-benchmarks.md +388 -0
  106. package/docs/ssr.md +399 -117
  107. package/docs/styles.md +234 -49
  108. package/docs/tasty-static.md +298 -118
  109. package/harness/dev.harnesspm/rules/usage.md +12 -0
  110. package/harness/dev.harnesspm/scripts/render.mjs +320 -0
  111. package/harness/dev.harnesspm/scripts/styles.mjs +299 -0
  112. package/harness/plugin.json +20 -0
  113. package/package.json +159 -44
  114. package/tasty.config.ts +7 -0
  115. package/dist/_virtual/_rolldown/runtime.js +0 -7
  116. package/dist/chunks/cacheKey.d.ts +0 -1
  117. package/dist/chunks/cacheKey.js +0 -77
  118. package/dist/chunks/cacheKey.js.map +0 -1
  119. package/dist/chunks/definitions.d.ts +0 -37
  120. package/dist/chunks/definitions.js +0 -258
  121. package/dist/chunks/definitions.js.map +0 -1
  122. package/dist/chunks/index.d.ts +0 -1
  123. package/dist/chunks/renderChunk.d.ts +0 -1
  124. package/dist/chunks/renderChunk.js +0 -59
  125. package/dist/chunks/renderChunk.js.map +0 -1
  126. package/dist/compute-styles.d.ts +0 -31
  127. package/dist/compute-styles.js +0 -357
  128. package/dist/compute-styles.js.map +0 -1
  129. package/dist/config.d.ts +0 -366
  130. package/dist/config.js +0 -502
  131. package/dist/config.js.map +0 -1
  132. package/dist/counter-style/index.js +0 -51
  133. package/dist/counter-style/index.js.map +0 -1
  134. package/dist/debug.d.ts +0 -89
  135. package/dist/debug.js.map +0 -1
  136. package/dist/font-face/index.js +0 -63
  137. package/dist/font-face/index.js.map +0 -1
  138. package/dist/hooks/index.d.ts +0 -7
  139. package/dist/hooks/useCounterStyle.d.ts +0 -50
  140. package/dist/hooks/useCounterStyle.js +0 -45
  141. package/dist/hooks/useCounterStyle.js.map +0 -1
  142. package/dist/hooks/useFontFace.d.ts +0 -43
  143. package/dist/hooks/useFontFace.js +0 -69
  144. package/dist/hooks/useFontFace.js.map +0 -1
  145. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  146. package/dist/hooks/useGlobalStyles.js +0 -77
  147. package/dist/hooks/useGlobalStyles.js.map +0 -1
  148. package/dist/hooks/useKeyframes.d.ts +0 -56
  149. package/dist/hooks/useKeyframes.js +0 -63
  150. package/dist/hooks/useKeyframes.js.map +0 -1
  151. package/dist/hooks/useProperty.d.ts +0 -79
  152. package/dist/hooks/useProperty.js +0 -108
  153. package/dist/hooks/useProperty.js.map +0 -1
  154. package/dist/hooks/useRawCSS.d.ts +0 -53
  155. package/dist/hooks/useRawCSS.js +0 -34
  156. package/dist/hooks/useRawCSS.js.map +0 -1
  157. package/dist/hooks/useStyles.d.ts +0 -40
  158. package/dist/hooks/useStyles.js +0 -29
  159. package/dist/hooks/useStyles.js.map +0 -1
  160. package/dist/injector/index.d.ts +0 -187
  161. package/dist/injector/index.js +0 -192
  162. package/dist/injector/index.js.map +0 -1
  163. package/dist/injector/injector.d.ts +0 -195
  164. package/dist/injector/injector.js +0 -587
  165. package/dist/injector/injector.js.map +0 -1
  166. package/dist/injector/sheet-manager.d.ts +0 -132
  167. package/dist/injector/sheet-manager.js +0 -697
  168. package/dist/injector/sheet-manager.js.map +0 -1
  169. package/dist/injector/types.d.ts +0 -235
  170. package/dist/keyframes/index.js +0 -206
  171. package/dist/keyframes/index.js.map +0 -1
  172. package/dist/parser/classify.js +0 -319
  173. package/dist/parser/classify.js.map +0 -1
  174. package/dist/parser/const.js +0 -60
  175. package/dist/parser/const.js.map +0 -1
  176. package/dist/parser/lru.js +0 -109
  177. package/dist/parser/lru.js.map +0 -1
  178. package/dist/parser/parser.d.ts +0 -25
  179. package/dist/parser/parser.js +0 -115
  180. package/dist/parser/parser.js.map +0 -1
  181. package/dist/parser/tokenizer.js +0 -69
  182. package/dist/parser/tokenizer.js.map +0 -1
  183. package/dist/parser/types.d.ts +0 -51
  184. package/dist/parser/types.js +0 -46
  185. package/dist/parser/types.js.map +0 -1
  186. package/dist/pipeline/conditions.d.ts +0 -134
  187. package/dist/pipeline/conditions.js +0 -406
  188. package/dist/pipeline/conditions.js.map +0 -1
  189. package/dist/pipeline/exclusive.js +0 -230
  190. package/dist/pipeline/exclusive.js.map +0 -1
  191. package/dist/pipeline/index.d.ts +0 -55
  192. package/dist/pipeline/index.js +0 -708
  193. package/dist/pipeline/index.js.map +0 -1
  194. package/dist/pipeline/materialize.js +0 -1103
  195. package/dist/pipeline/materialize.js.map +0 -1
  196. package/dist/pipeline/parseStateKey.d.ts +0 -15
  197. package/dist/pipeline/parseStateKey.js +0 -446
  198. package/dist/pipeline/parseStateKey.js.map +0 -1
  199. package/dist/pipeline/simplify.js +0 -515
  200. package/dist/pipeline/simplify.js.map +0 -1
  201. package/dist/pipeline/warnings.js +0 -18
  202. package/dist/pipeline/warnings.js.map +0 -1
  203. package/dist/plugins/index.d.ts +0 -2
  204. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  205. package/dist/plugins/okhsl-plugin.js +0 -97
  206. package/dist/plugins/okhsl-plugin.js.map +0 -1
  207. package/dist/plugins/types.d.ts +0 -76
  208. package/dist/properties/index.js +0 -222
  209. package/dist/properties/index.js.map +0 -1
  210. package/dist/properties/property-type-resolver.d.ts +0 -24
  211. package/dist/properties/property-type-resolver.js +0 -90
  212. package/dist/properties/property-type-resolver.js.map +0 -1
  213. package/dist/ssr/async-storage.d.ts +0 -17
  214. package/dist/ssr/async-storage.js +0 -34
  215. package/dist/ssr/async-storage.js.map +0 -1
  216. package/dist/ssr/collect-auto-properties.js +0 -39
  217. package/dist/ssr/collect-auto-properties.js.map +0 -1
  218. package/dist/ssr/collector.d.ts +0 -102
  219. package/dist/ssr/collector.js +0 -219
  220. package/dist/ssr/collector.js.map +0 -1
  221. package/dist/ssr/format-global-rules.js +0 -22
  222. package/dist/ssr/format-global-rules.js.map +0 -1
  223. package/dist/ssr/format-keyframes.js +0 -69
  224. package/dist/ssr/format-keyframes.js.map +0 -1
  225. package/dist/ssr/format-property.js +0 -49
  226. package/dist/ssr/format-property.js.map +0 -1
  227. package/dist/ssr/format-rules.js +0 -73
  228. package/dist/ssr/format-rules.js.map +0 -1
  229. package/dist/ssr/hydrate.d.ts +0 -22
  230. package/dist/ssr/hydrate.js +0 -49
  231. package/dist/ssr/hydrate.js.map +0 -1
  232. package/dist/ssr/ssr-collector-ref.js +0 -12
  233. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  234. package/dist/states/index.d.ts +0 -49
  235. package/dist/states/index.js +0 -170
  236. package/dist/states/index.js.map +0 -1
  237. package/dist/static/tastyStatic.d.ts +0 -46
  238. package/dist/static/tastyStatic.js +0 -30
  239. package/dist/static/tastyStatic.js.map +0 -1
  240. package/dist/static/types.d.ts +0 -49
  241. package/dist/static/types.js +0 -24
  242. package/dist/static/types.js.map +0 -1
  243. package/dist/styles/border.d.ts +0 -25
  244. package/dist/styles/border.js +0 -120
  245. package/dist/styles/border.js.map +0 -1
  246. package/dist/styles/color.d.ts +0 -14
  247. package/dist/styles/color.js +0 -26
  248. package/dist/styles/color.js.map +0 -1
  249. package/dist/styles/const.js +0 -17
  250. package/dist/styles/const.js.map +0 -1
  251. package/dist/styles/createStyle.js +0 -79
  252. package/dist/styles/createStyle.js.map +0 -1
  253. package/dist/styles/dimension.js +0 -109
  254. package/dist/styles/dimension.js.map +0 -1
  255. package/dist/styles/directional.js +0 -133
  256. package/dist/styles/directional.js.map +0 -1
  257. package/dist/styles/display.d.ts +0 -30
  258. package/dist/styles/display.js +0 -73
  259. package/dist/styles/display.js.map +0 -1
  260. package/dist/styles/fade.d.ts +0 -15
  261. package/dist/styles/fade.js +0 -62
  262. package/dist/styles/fade.js.map +0 -1
  263. package/dist/styles/fill.d.ts +0 -42
  264. package/dist/styles/fill.js +0 -51
  265. package/dist/styles/fill.js.map +0 -1
  266. package/dist/styles/flow.d.ts +0 -16
  267. package/dist/styles/flow.js +0 -12
  268. package/dist/styles/flow.js.map +0 -1
  269. package/dist/styles/gap.d.ts +0 -31
  270. package/dist/styles/gap.js +0 -38
  271. package/dist/styles/gap.js.map +0 -1
  272. package/dist/styles/height.d.ts +0 -17
  273. package/dist/styles/height.js +0 -19
  274. package/dist/styles/height.js.map +0 -1
  275. package/dist/styles/index.d.ts +0 -1
  276. package/dist/styles/index.js +0 -8
  277. package/dist/styles/index.js.map +0 -1
  278. package/dist/styles/inset.d.ts +0 -24
  279. package/dist/styles/inset.js +0 -34
  280. package/dist/styles/inset.js.map +0 -1
  281. package/dist/styles/list.d.ts +0 -16
  282. package/dist/styles/list.js +0 -100
  283. package/dist/styles/list.js.map +0 -1
  284. package/dist/styles/margin.d.ts +0 -24
  285. package/dist/styles/margin.js +0 -32
  286. package/dist/styles/margin.js.map +0 -1
  287. package/dist/styles/outline.d.ts +0 -29
  288. package/dist/styles/outline.js +0 -55
  289. package/dist/styles/outline.js.map +0 -1
  290. package/dist/styles/padding.d.ts +0 -24
  291. package/dist/styles/padding.js +0 -32
  292. package/dist/styles/padding.js.map +0 -1
  293. package/dist/styles/placement.d.ts +0 -37
  294. package/dist/styles/placement.js +0 -74
  295. package/dist/styles/placement.js.map +0 -1
  296. package/dist/styles/predefined.d.ts +0 -71
  297. package/dist/styles/predefined.js +0 -237
  298. package/dist/styles/predefined.js.map +0 -1
  299. package/dist/styles/preset.d.ts +0 -52
  300. package/dist/styles/preset.js +0 -127
  301. package/dist/styles/preset.js.map +0 -1
  302. package/dist/styles/radius.d.ts +0 -12
  303. package/dist/styles/radius.js +0 -83
  304. package/dist/styles/radius.js.map +0 -1
  305. package/dist/styles/scrollMargin.d.ts +0 -24
  306. package/dist/styles/scrollMargin.js +0 -32
  307. package/dist/styles/scrollMargin.js.map +0 -1
  308. package/dist/styles/scrollbar.d.ts +0 -25
  309. package/dist/styles/scrollbar.js +0 -51
  310. package/dist/styles/scrollbar.js.map +0 -1
  311. package/dist/styles/shadow.d.ts +0 -14
  312. package/dist/styles/shadow.js +0 -25
  313. package/dist/styles/shadow.js.map +0 -1
  314. package/dist/styles/shared.js +0 -17
  315. package/dist/styles/shared.js.map +0 -1
  316. package/dist/styles/transition.d.ts +0 -14
  317. package/dist/styles/transition.js +0 -159
  318. package/dist/styles/transition.js.map +0 -1
  319. package/dist/styles/types.d.ts +0 -564
  320. package/dist/styles/width.d.ts +0 -17
  321. package/dist/styles/width.js +0 -19
  322. package/dist/styles/width.js.map +0 -1
  323. package/dist/tasty.d.ts +0 -134
  324. package/dist/tasty.js +0 -243
  325. package/dist/tasty.js.map +0 -1
  326. package/dist/types.d.ts +0 -184
  327. package/dist/utils/cache-wrapper.js +0 -21
  328. package/dist/utils/cache-wrapper.js.map +0 -1
  329. package/dist/utils/case-converter.js +0 -8
  330. package/dist/utils/case-converter.js.map +0 -1
  331. package/dist/utils/color-math.d.ts +0 -46
  332. package/dist/utils/color-math.js +0 -749
  333. package/dist/utils/color-math.js.map +0 -1
  334. package/dist/utils/color-space.d.ts +0 -5
  335. package/dist/utils/color-space.js +0 -228
  336. package/dist/utils/color-space.js.map +0 -1
  337. package/dist/utils/colors.d.ts +0 -5
  338. package/dist/utils/colors.js +0 -10
  339. package/dist/utils/colors.js.map +0 -1
  340. package/dist/utils/css-types.d.ts +0 -7
  341. package/dist/utils/dotize.d.ts +0 -26
  342. package/dist/utils/dotize.js +0 -122
  343. package/dist/utils/dotize.js.map +0 -1
  344. package/dist/utils/filter-base-props.d.ts +0 -15
  345. package/dist/utils/filter-base-props.js +0 -45
  346. package/dist/utils/filter-base-props.js.map +0 -1
  347. package/dist/utils/get-display-name.d.ts +0 -7
  348. package/dist/utils/get-display-name.js +0 -10
  349. package/dist/utils/get-display-name.js.map +0 -1
  350. package/dist/utils/has-keys.js +0 -13
  351. package/dist/utils/has-keys.js.map +0 -1
  352. package/dist/utils/is-dev-env.js +0 -19
  353. package/dist/utils/is-dev-env.js.map +0 -1
  354. package/dist/utils/is-valid-element-type.js +0 -15
  355. package/dist/utils/is-valid-element-type.js.map +0 -1
  356. package/dist/utils/merge-styles.d.ts +0 -7
  357. package/dist/utils/merge-styles.js.map +0 -1
  358. package/dist/utils/mod-attrs.d.ts +0 -6
  359. package/dist/utils/mod-attrs.js +0 -20
  360. package/dist/utils/mod-attrs.js.map +0 -1
  361. package/dist/utils/process-tokens.d.ts +0 -17
  362. package/dist/utils/process-tokens.js +0 -83
  363. package/dist/utils/process-tokens.js.map +0 -1
  364. package/dist/utils/resolve-recipes.d.ts +0 -17
  365. package/dist/utils/resolve-recipes.js +0 -146
  366. package/dist/utils/resolve-recipes.js.map +0 -1
  367. package/dist/utils/selector-transform.js +0 -32
  368. package/dist/utils/selector-transform.js.map +0 -1
  369. package/dist/utils/string.js +0 -8
  370. package/dist/utils/string.js.map +0 -1
  371. package/dist/utils/styles.d.ts +0 -99
  372. package/dist/utils/styles.js +0 -220
  373. package/dist/utils/styles.js.map +0 -1
  374. package/dist/utils/typography.d.ts +0 -47
  375. package/dist/utils/typography.js +0 -51
  376. package/dist/utils/typography.js.map +0 -1
  377. package/dist/utils/warnings.d.ts +0 -16
  378. package/dist/utils/warnings.js +0 -16
  379. package/dist/utils/warnings.js.map +0 -1
  380. package/dist/zero/css-writer.d.ts +0 -45
  381. package/dist/zero/css-writer.js +0 -73
  382. package/dist/zero/css-writer.js.map +0 -1
  383. package/dist/zero/extractor.d.ts +0 -24
  384. package/dist/zero/extractor.js +0 -266
  385. package/dist/zero/extractor.js.map +0 -1
  386. package/docs/PIPELINE.md +0 -519
  387. package/docs/runtime.md +0 -572
package/docs/injector.md CHANGED
@@ -9,11 +9,11 @@ A high-performance CSS-in-JS solution that powers the Tasty design system with e
9
9
  The Style Injector is the core engine behind Tasty's styling system, providing:
10
10
 
11
11
  - **Hash-based deduplication** - Identical CSS gets the same className
12
- - **Reference counting** - Automatic cleanup when components unmount (refCount = 0)
13
- - **CSS nesting flattening** - Handles `&`, `.Class`, `SubElement` patterns
14
- - **Keyframes injection** - First-class `@keyframes` support with immediate disposal
12
+ - **DOM-driven lifetime** - Styles are collected once nothing renders them
13
+ - **Selector assembly** - Prepends the doubled `.tX.tX` class and root prefix to the pipeline's selector fragments (sub-element and `&` nesting is flattened earlier, by the pipeline)
14
+ - **At-rule injection** - First-class `@keyframes`, `@property`, `@font-face`, `@counter-style`, and `@function` support
15
15
  - **Smart cleanup** - CSS rules batched cleanup, keyframes disposed immediately
16
- - **SSR support** - Deterministic class names and CSS extraction
16
+ - **SSR support** - Deterministic class names shared with `ServerStyleCollector`, and hydration of server-rendered classes
17
17
  - **Multiple roots** - Works with Document and ShadowRoot
18
18
  - **Non-stacking cleanups** - Prevents timeout accumulation for better performance
19
19
 
@@ -55,18 +55,26 @@ Injects CSS rules and returns a className with dispose function.
55
55
  ```typescript
56
56
  import { inject } from '@tenphi/tasty';
57
57
 
58
- // Component styling - generates tasty class names
58
+ // Rules flagged needsClassName get the generated class prepended (doubled)
59
59
  const result = inject([{
60
- selector: '.t-abc123',
60
+ selector: '',
61
61
  declarations: 'color: red; padding: 10px;',
62
+ needsClassName: true,
62
63
  }]);
63
64
 
64
- console.log(result.className); // 't-abc123'
65
+ console.log(result.className); // 'th8n0uh' — `t` + base36 hash of the rules
66
+ // Injected: .th8n0uh.th8n0uh { color: red; padding: 10px; }
65
67
 
66
- // Cleanup when component unmounts (refCount decremented)
68
+ // Release the pin; the class becomes collectible once nothing renders it
67
69
  result.dispose();
68
70
  ```
69
71
 
72
+ `inject()` **pins** the class it returns, and `gc()` never evicts a pinned class
73
+ — that is what `dispose()` releases. Pass `{ pin: false }` when the caller keeps
74
+ no handle and the DOM is the only record that the class is in use; `dispose()`
75
+ is then a no-op. The render path (`tasty()` / `computeStyles()`) injects this
76
+ way, because a hook-free render has no unmount signal to dispose on.
77
+
70
78
  ### `injectGlobal(rules, options?): { dispose: () => void }`
71
79
 
72
80
  Injects global styles that don't reserve tasty class names.
@@ -115,11 +123,13 @@ dispose();
115
123
 
116
124
  ### `useRawCSS(css, options?)` or `useRawCSS(factory, deps, options?)`
117
125
 
118
- React hook for injecting raw CSS. Uses `useInsertionEffect` for proper timing and cleanup.
126
+ Inject raw CSS without parsing. Hook-free — works in client components, SSR, and React Server Components.
119
127
 
120
128
  Supports two overloads:
121
- - **Static CSS**: `useRawCSS(cssString, options?)`
122
- - **Factory function**: `useRawCSS(() => cssString, deps, options?)` - re-evaluates when deps change (like `useMemo`)
129
+ - **Static CSS**: `useRawCSS(cssString, options?)` — content-based deduplication
130
+ - **Factory function**: `useRawCSS(() => cssString, deps, options?)` — factory called on every invocation, dedup handled internally
131
+
132
+ Use the `id` option for update tracking — when the CSS changes for the same id, the previous injection is replaced:
123
133
 
124
134
  ```tsx
125
135
  import { useRawCSS } from '@tenphi/tasty';
@@ -132,7 +142,7 @@ function GlobalReset() {
132
142
  return null;
133
143
  }
134
144
 
135
- // Dynamic CSS with factory function (like useMemo)
145
+ // Dynamic CSS with factory function and update tracking
136
146
  function ThemeStyles({ theme }: { theme: 'dark' | 'light' }) {
137
147
  useRawCSS(() => `
138
148
  body {
@@ -140,7 +150,7 @@ function ThemeStyles({ theme }: { theme: 'dark' | 'light' }) {
140
150
  background: ${theme === 'dark' ? '#000' : '#fff'};
141
151
  color: ${theme === 'dark' ? '#fff' : '#000'};
142
152
  }
143
- `, [theme]);
153
+ `, [theme], { id: 'theme-body' });
144
154
 
145
155
  return null;
146
156
  }
@@ -167,7 +177,7 @@ const result = testInjector.inject(rules);
167
177
  Injects CSS keyframes with automatic deduplication.
168
178
 
169
179
  ```typescript
170
- // Generated name (k0, k1, k2...)
180
+ // Generated name (tk0, tk1, … — namePrefix + 'k' + counter)
171
181
  const fadeIn = keyframes({
172
182
  from: { opacity: 0 },
173
183
  to: { opacity: 1 },
@@ -210,11 +220,8 @@ configure({
210
220
  forceTextInjection: false, // Force textContent insertion (auto-detected for tests)
211
221
  nonce: 'csp-nonce', // CSP nonce for security
212
222
  gc: { // Garbage collection for unused styles
213
- auto: true, // Enable automatic background sweep
214
- baseMaxAge: 60000, // Base TTL (ms) for single-use styles
215
- cooldown: 30000, // Minimum time between GC runs
216
- autoInterval: 300000, // Background sweep interval (ms)
217
- cacheCapacity: 5000, // Hard cap on cached styles (optional)
223
+ touchInterval: 1000, // Touch events between GC cycles (default: 1000)
224
+ capacity: 1000, // Max unused styles to retain (default: 1000)
218
225
  },
219
226
  states: { // Global predefined states for advanced state mapping
220
227
  '@mobile': '@media(w < 768px)',
@@ -225,15 +232,78 @@ configure({
225
232
 
226
233
  **Auto-Detection Features:**
227
234
  - `devMode`: Automatically enabled in development environments (detected via `isDevEnv()`)
228
- - `forceTextInjection`: Automatically enabled in test environments (Jest, Vitest, Mocha, jsdom)
235
+ - `forceTextInjection`: Automatically enabled in test environments (Jest, Vitest, Mocha, happy-dom, jsdom)
236
+
237
+ **Injection Modes:**
238
+
239
+ Each sheet picks its write mode once, when it is created, and keeps it for its
240
+ lifetime:
241
+
242
+ | Mode | How rules are written | How rules are removed |
243
+ |---|---|---|
244
+ | CSSOM (default) | `styleSheet.insertRule(rule, index)` | `styleSheet.deleteRule(index)` |
245
+ | Text (`forceTextInjection`, or when `styleElement.sheet` is unavailable) | appended to `<style>.textContent` | rule texts are tracked per sheet and the element's text is rebuilt without them |
246
+ | Adopted (ShadowRoot with constructable sheets) | `insertRule` on the constructable sheet | `deleteRule` on the constructable sheet |
247
+
248
+ Text mode cannot edit a single rule in place the way CSSOM can, so the sheet
249
+ keeps the inserted rule texts in index order and rewrites the element on delete.
250
+ Dispose, ref-counted cleanup and GC therefore behave identically in every mode.
229
251
 
230
252
  **Configuration Notes:**
231
253
  - Most options have sensible defaults and auto-detection
232
254
  - `configure()` is optional - the injector works with defaults
233
255
  - **Configuration is locked after styles are generated** - calling `configure()` after first render will emit a warning and be ignored
234
- - `gc.baseMaxAge`: Base TTL for a style rendered only once. Popular styles get longer TTLs via logarithmic scaling (`baseMaxAge * log2(hitCount + 1)`).
235
- - `gc.auto`: When true, runs a periodic background sweep at `gc.autoInterval` intervals using `requestIdleCallback`.
236
- - `gc.cooldown`: Minimum time between GC runs to avoid thrashing.
256
+ - `gc.touchInterval`: Number of renders between sweeps. When the counter reaches this value, a sweep is scheduled via `requestIdleCallback`; without idle callbacks nothing is collected automatically.
257
+ - `gc.grace`: How long a class is left alone after collection first notices nothing is carrying it, in milliseconds (default `10000`).
258
+ - Automatic sweeps are opt-in: they run only when `configure({ gc })` is set (`gc: {}` enables them with these defaults). Without it nothing is collected until you call `gc()` or `cleanup()`.
259
+
260
+ **What a sweep does.** Everything the injector holds falls into one of five bands, and only the last is ever deleted:
261
+
262
+ | Band | | Deleted |
263
+ |---|---|---|
264
+ | 1 | **Rendered** — some element carries the class right now | never |
265
+ | 2 | **Not ours** — queued for a batched write, pre-allocated, or server-rendered | never |
266
+ | 3 | **Hot** — nothing carries it, but that was noticed less than `grace` ago | never |
267
+ | 4 | **Cached** — cold, but within `capacity` when ordered by when it went cold | never |
268
+ | 5 | Everything else | on every sweep |
269
+
270
+ `gc({ force: true })` and `cleanup()` take bands 4 and 5 together, ignoring capacity. Band 3 is spared even then: an explicit cleanup is still no reason to take rules from a render that has not committed yet.
271
+
272
+ `tasty()` components cache the class names they computed, so a re-render with the same styles skips the pipeline. Whenever `gc()`, `cleanup()` or `destroy()` deletes rules, those caches are dropped too, so a component whose CSS was collected injects it again on its next render.
273
+
274
+ > **Why band 3 exists.** Rendering is not commit-aware: a render can resolve a class and commit it a little later, and in between nothing on the page carries it. From outside React that is indistinguishable from a class that is finished, so collection does not try to tell them apart — it leaves alone anything only just noticed to be cold. A render would have to stay pending for the whole window to lose its rules, and it gets them back on its next render.
275
+ >
276
+ > The clock starts when a sweep *notices*, not when the element actually left — nothing observes that moment, so starting it at the sighting is what gives every class the same full window however long ago it went.
277
+ >
278
+ > This is also why collection costs nothing to run: the timestamps are written by the sweep's own DOM scan, so rendering tracks nothing per class.
279
+ - `gc.capacity`: Maximum number of unused styles (not in the DOM, not pinned) to retain. When exceeded, the least recently used are evicted first. Rendered and pinned styles don't count against this limit.
280
+
281
+ ---
282
+
283
+ ### At-rule injection
284
+
285
+ Beyond ordinary rules, the injector has a dedicated entry point per at-rule. All of them deduplicate by name and are **permanent** — there is no ref-counting or dispose, because a rule that other CSS references by name cannot be safely removed while any of it might still apply.
286
+
287
+ | Function | Injects | Notes |
288
+ |---|---|---|
289
+ | `keyframes(steps, nameOrOptions?)` | `@keyframes` | The exception: ref-counted and disposed immediately when unused. Returns the injected name, which may differ from the requested one. |
290
+ | `property(name, options?)` | `@property` | `name` accepts `$name`, `#name`, or `--name`. Usually unnecessary — types are inferred automatically unless `configure({ autoPropertyTypes: false })`. |
291
+ | `fontFace(family, descriptors, options?)` | `@font-face` | Deduplicated by family **and** descriptor content, so several faces of one family coexist. |
292
+ | `counterStyle(name, descriptors, options?)` | `@counter-style` | |
293
+ | `func(name, definition, options?)` | `@function` | `name` accepts `$$name`, `$name`, or `--name`. Abbreviated because `function` is a reserved word. |
294
+
295
+ Every one of these takes an optional `root` (a `Document` or `ShadowRoot`).
296
+
297
+ `counterStyle()` and `func()` also accept `weak: true`, which registers the rule **without** overriding an existing one of the same name. `configure()` uses it for global `@counter-style` and `@function` definitions so a component-local definition always wins over the global default, regardless of which is injected first.
298
+
299
+ ```ts
300
+ import { counterStyle, fontFace, func, property } from '@tenphi/tasty';
301
+
302
+ property('$card-elevation', { syntax: '<number>', initialValue: '0' });
303
+ fontFace('Inter', { src: 'url(/inter.woff2)', fontWeight: '400 700' });
304
+ counterStyle('dashes', { system: 'cyclic', symbols: '"—"', suffix: ' ' });
305
+ func('$$negative', { args: ['$value'], result: '(-1 * $value)' });
306
+ ```
237
307
 
238
308
  ---
239
309
 
@@ -241,87 +311,111 @@ configure({
241
311
 
242
312
  ### Style Result Format
243
313
 
244
- The injector works with `StyleResult` objects from the tasty parser:
314
+ The injector works with `StyleResult` objects from the pipeline (`renderStyles`):
245
315
 
246
316
  ```typescript
247
317
  interface StyleResult {
248
- selector: string; // CSS selector
249
- declarations: string; // CSS declarations
250
- atRules?: string[]; // @media, @supports, etc.
251
- nestingLevel?: number; // Nesting depth for specificity
318
+ selector: string; // full selector, or a fragment when needsClassName
319
+ declarations: string; // CSS declarations
320
+ atRules?: string[]; // @media, @container, @supports, …
321
+ needsClassName?: boolean; // prepend the generated `.tX.tX` (OR'd fragments joined with '|||')
322
+ rootPrefix?: string; // root-state prefix placed before the class
323
+ startingStyle?: boolean; // wrap declarations in @starting-style
252
324
  }
253
325
 
254
326
  // Example StyleResult
255
327
  const styleRule: StyleResult = {
256
- selector: '.t-button',
328
+ selector: ':where([data-hovered])',
257
329
  declarations: 'padding: 8px 16px; background: blue; color: white;',
258
330
  atRules: ['@media (min-width: 768px)'],
259
- nestingLevel: 0,
331
+ needsClassName: true,
260
332
  };
261
333
  ```
262
334
 
335
+ ### Batched Injection
336
+
337
+ `configure({ batchInjection: true })` queues every sheet write — component
338
+ rules, global rules, raw CSS and at-rules — into one FIFO and applies them
339
+ together, so the document is style-invalidated once per flush instead of once per
340
+ component. `<TastyBatchProvider>` flushes in `useInsertionEffect`, before any
341
+ layout effect, so a queued write can never be observed by a measurement. See
342
+ [Batched injection](configuration.md#batched-injection) for the modes and the
343
+ ordering guarantee. `flushStyles()` applies pending writes on demand; every read
344
+ API here calls it for you.
345
+
263
346
  ### Deduplication & Performance
264
347
 
265
348
  ```typescript
266
- // Identical CSS rules get the same className
267
- const button1 = inject([{
268
- selector: '.t-btn1',
269
- declarations: 'padding: 8px; color: red;'
270
- }]);
349
+ const rule = { selector: '', declarations: 'padding: 8px; color: red;', needsClassName: true };
271
350
 
272
- const button2 = inject([{
273
- selector: '.t-btn2',
274
- declarations: 'padding: 8px; color: red;' // Same declarations
275
- }]);
351
+ const button1 = inject([rule], { cacheKey: 'button' });
352
+ const button2 = inject([rule], { cacheKey: 'button' });
276
353
 
277
- // Both get the same className due to deduplication
354
+ // One class, one copy of the CSS
278
355
  console.log(button1.className === button2.className); // true
279
356
  ```
280
357
 
281
- ### Reference Counting
358
+ Without `cacheKey` the class name is a hash of the rules, so injecting the same rules again reuses the class the same way: the rules are written once, and each call adds a pin that its own `dispose()` releases.
359
+
360
+ ### Pinning
282
361
 
283
362
  ```typescript
284
- // Multiple components using the same styles
285
- const comp1 = inject([commonStyle]);
286
- const comp2 = inject([commonStyle]);
287
- const comp3 = inject([commonStyle]);
288
-
289
- // Style is kept alive while any component uses it
290
- comp1.dispose(); // refCount: 3 → 2
291
- comp2.dispose(); // refCount: 2 → 1
292
- comp3.dispose(); // refCount: 1 → 0, eligible for bulk cleanup
293
-
294
- // Rule exists but refCount = 0 means unused
295
- // Next inject() with same styles will increment refCount and reuse immediately
363
+ // Multiple callers using the same styles
364
+ const comp1 = inject([commonStyle], { cacheKey: 'common' });
365
+ const comp2 = inject([commonStyle], { cacheKey: 'common' });
366
+ const comp3 = inject([commonStyle], { cacheKey: 'common' });
367
+
368
+ // Style is pinned while any caller holds a handle
369
+ comp1.dispose(); // pins: 3 → 2
370
+ comp2.dispose(); // pins: 2 → 1
371
+ comp3.dispose(); // pins: 1 → 0, now up to the DOM and gc()
372
+
373
+ // Unpinned does not mean deleted: the rule stays cached and is reused instantly
374
+ // by the next inject(). gc() decides when it actually goes.
296
375
  ```
297
376
 
377
+ Pinning covers callers that hold a handle. Styles that come from rendering are
378
+ never pinned — see `{ pin: false }` under
379
+ [`inject()`](#injectrules-options-injectresult) — so what keeps them alive is
380
+ being in the DOM, and nothing else.
381
+
298
382
  ### Garbage Collection
299
383
 
300
384
  ```typescript
301
- import { configure, gc, maybeGC } from '@tenphi/tasty';
385
+ import { configure, gc } from '@tenphi/tasty';
302
386
 
303
387
  // Keyframes: Disposed immediately when refCount = 0 (safer for global scope)
304
- // CSS rules: Tracked by popularity and cleaned up via gc()
388
+ // CSS rules: Tracked by touch count and cleaned up via gc()
389
+ //
390
+ // A CSS rule is collectible when no element carries its class AND nobody
391
+ // pinned it with inject().
305
392
 
306
393
  configure({
307
394
  gc: {
308
- auto: true, // Enable background sweep
309
- baseMaxAge: 60000, // 1-minute base TTL
310
- cooldown: 30000, // 30s between runs
395
+ touchInterval: 1000, // Schedule GC every 1000 touches
396
+ capacity: 1000, // Max unused styles to retain
311
397
  },
312
398
  });
313
399
 
314
400
  // Manual GC (synchronous, returns number of swept styles):
315
401
  gc();
316
402
 
317
- // Event-driven GC with cooldown (e.g. on route change):
318
- maybeGC();
403
+ // Force-remove ALL unused styles (e.g. on route change or test teardown):
404
+ gc({ force: true });
405
+
406
+ // cleanup() is the same thing:
407
+ cleanup();
408
+
409
+ // Every `touchInterval` renders, a sweep is scheduled in idle time. It scans
410
+ // the DOM for the classes actually on the page and sorts everything the
411
+ // injector holds into five bands — only the last one is deleted. See below.
319
412
 
320
413
  // Benefits:
321
- // - Popularity-aware: frequently used styles survive longer
414
+ // - Activity-proportional: busy apps trigger GC more often
322
415
  // - DOM-safe: styles currently in the DOM are never evicted
416
+ // - Oldest-first: least recently used styles are evicted first
323
417
  // - Keyframes: Immediate cleanup prevents global namespace pollution
324
- // - Unused styles can be instantly reactivated (just increment refCount)
418
+ // - Unused styles stay cached until evicted, so re-rendering them is a cache hit
325
419
  ```
326
420
 
327
421
  ### Shadow DOM Support
@@ -348,15 +442,16 @@ const shadowAnimation = keyframes({
348
442
 
349
443
  ### Server-Side Rendering
350
444
 
445
+ `getCSSText()` reads the injector's stylesheets, so it needs a DOM; on a server it throws. Collect server CSS with `ServerStyleCollector` from `@tenphi/tasty/ssr` (`collector.getCSS()`) — see [SSR](./ssr.md).
446
+
351
447
  ```typescript
352
- import { getCssText, getCssTextForNode } from '@tenphi/tasty';
448
+ import { getCSSText, getCSSTextForNode } from '@tenphi/tasty';
449
+ import { render } from '@testing-library/react';
353
450
 
354
- // Extract all CSS for SSR
355
- const cssText = getCssText();
451
+ const cssText = getCSSText(); // everything the injector holds (browser / test DOM)
356
452
 
357
- // Extract CSS for specific DOM subtree (like jest-styled-components)
358
- const container = render(<MyComponent />);
359
- const componentCSS = getCssTextForNode(container);
453
+ const { container } = render(<MyComponent />);
454
+ const componentCSS = getCSSTextForNode(container); // only the CSS this subtree uses
360
455
  ```
361
456
 
362
457
  ### Test Environment Detection
@@ -365,7 +460,7 @@ const componentCSS = getCssTextForNode(container);
365
460
  // Automatically detected test environments:
366
461
  // - NODE_ENV === 'test'
367
462
  // - Jest globals (jest, describe, it, expect)
368
- // - jsdom user agent
463
+ // - jsdom / HappyDOM user agent
369
464
  // - Vitest globals (vitest)
370
465
  // - Mocha globals (mocha)
371
466
 
@@ -416,11 +511,11 @@ const metrics = injector.instance.getMetrics();
416
511
  console.log({
417
512
  cacheHits: metrics.hits, // Successful cache hits
418
513
  cacheMisses: metrics.misses, // New styles injected
419
- unusedHits: metrics.unusedHits, // Current unused styles (calculated on demand)
514
+ unusedHits: metrics.unusedHits, // Styles currently eligible for eviction (scans the DOM)
420
515
  bulkCleanups: metrics.bulkCleanups, // Number of bulk cleanup operations
421
516
  stylesCleanedUp: metrics.stylesCleanedUp, // Total styles removed in bulk cleanups
422
517
  totalInsertions: metrics.totalInsertions, // Lifetime insertions
423
- totalUnused: metrics.totalUnused, // Total styles marked as unused (refCount = 0)
518
+ totalUnused: metrics.totalUnused, // Times a pinned style lost its last pin
424
519
  startTime: metrics.startTime, // Metrics collection start timestamp
425
520
  cleanupHistory: metrics.cleanupHistory, // Detailed cleanup operation history
426
521
  });
@@ -429,17 +524,14 @@ console.log({
429
524
  ### Debug Information
430
525
 
431
526
  ```typescript
432
- // Get detailed information about injected styles
433
- const debugInfo = injector.instance.getDebugInfo();
527
+ import { tastyDebug } from '@tenphi/tasty';
434
528
 
435
- console.log({
436
- activeStyles: debugInfo.activeStyles, // Currently active styles
437
- unusedStyles: debugInfo.unusedStyles, // Styles marked for cleanup
438
- totalSheets: debugInfo.totalSheets, // Number of stylesheets
439
- totalRules: debugInfo.totalRules, // Total CSS rules
440
- });
529
+ const { activeClasses, unusedClasses, hotClasses, totalRuleCount } =
530
+ tastyDebug.summary({ raw: true });
441
531
  ```
442
532
 
533
+ See [Debug Utilities](./debug.md).
534
+
443
535
  ### Cleanup History
444
536
 
445
537
  ```typescript
@@ -464,10 +556,10 @@ metrics.cleanupHistory.forEach(cleanup => {
464
556
 
465
557
  ```typescript
466
558
  // ✅ Reuse styles - identical CSS gets deduplicated
467
- const buttonBase = { padding: '8px 16px', borderRadius: '4px' };
559
+ const buttonBase = 'padding: 8px 16px; border-radius: 4px;';
468
560
 
469
561
  // ✅ Avoid frequent disposal and re-injection
470
- // Let the reference counting system handle cleanup
562
+ // Let the injector handle cleanup
471
563
 
472
564
  // ✅ Use bulk operations for global styles
473
565
  injectGlobal([
@@ -481,8 +573,8 @@ import { configure } from '@tenphi/tasty';
481
573
 
482
574
  configure({
483
575
  gc: {
484
- auto: true, // Enable background sweep for long-lived pages
485
- baseMaxAge: 60000, // Default base TTL (adjust based on app size)
576
+ touchInterval: 1000, // Schedule GC every 1000 style touches
577
+ capacity: 1000, // Max unused styles to retain
486
578
  },
487
579
  });
488
580
  ```
@@ -493,13 +585,13 @@ configure({
493
585
  // The injector automatically manages memory through:
494
586
 
495
587
  // 1. Hash-based deduplication - same CSS = same className
496
- // 2. Reference counting - styles stay alive while in use (refCount > 0)
497
- // 3. Immediate keyframes cleanup - disposed instantly when refCount = 0
498
- // 4. Popularity-aware GC - unused CSS rules are scored by hitCount and age
499
- // 5. DOM safety guard - styles visible in the DOM are never evicted
588
+ // 2. DOM-driven lifetime - a rendered class is never evicted
589
+ // 3. Pinning - inject() callers hold their classes until they dispose
590
+ // 4. Immediate keyframes cleanup - disposed instantly when refCount = 0
591
+ // 5. Touch-count GC - unused CSS rules are evicted oldest-first when over capacity
500
592
 
501
593
  // Manual cleanup is rarely needed but available:
502
- cleanup(); // Force immediate cleanup of all unused CSS rules (refCount = 0)
594
+ cleanup(); // Remove every rule that is neither rendered nor pinned
503
595
  destroy(); // Nuclear option: remove all stylesheets and reset
504
596
  ```
505
597
 
@@ -521,12 +613,12 @@ const StyledButton = tasty({
521
613
 
522
614
  // Internally uses the injector:
523
615
  // 1. Styles are parsed into StyleResult objects
524
- // 2. inject() is called with the parsed results
616
+ // 2. inject() is called with the parsed results, unpinned
525
617
  // 3. Component gets the returned className
526
- // 4. dispose() is called when component unmounts
618
+ // 4. gc() reclaims the class once no element carries it
527
619
  ```
528
620
 
529
- For most development, you'll use the [Runtime API](./runtime.md) rather than the injector directly. The injector provides the high-performance foundation that makes Tasty's declarative styling possible.
621
+ For most development, you'll use the [React API](./react-api.md) rather than the injector directly. The injector provides the high-performance foundation that makes Tasty's declarative styling possible.
530
622
 
531
623
  ---
532
624
 
@@ -540,4 +632,4 @@ Direct injector usage is recommended for:
540
632
  - **Performance-critical scenarios** where you need direct control
541
633
  - **Testing utilities** that need to inject or extract CSS
542
634
 
543
- For regular component styling, prefer the [`tasty()` API](./runtime.md) which provides a more developer-friendly interface.
635
+ For regular component styling, prefer the [`tasty()` API](./react-api.md) which provides a more developer-friendly interface.
package/docs/llms.txt ADDED
@@ -0,0 +1,31 @@
1
+ # Tasty
2
+
3
+ > Docs for `@tenphi/tasty`, the version installed in this project. Read the style rules for AI agents before you write or review styles.
4
+
5
+ ## Start here
6
+
7
+ - [Tasty Style Rules for AI Agents](ai-agents.md): the rules for correct styles, with a checklist. Read it before you write or review styles.
8
+ - [Getting Started](getting-started.md): installation, a first component, configuration, the ESLint plugin, and choosing a rendering mode.
9
+
10
+ ## Guides
11
+
12
+ - [Methodology](methodology.md): root and sub-elements, `styleProps` as the public API, `tokens`, `styles` vs `style`, wrapping and extending, anti-patterns.
13
+ - [Building a Design System](design-system.md): token vocabularies, state aliases, recipes, layout primitives, compound components, override contracts.
14
+
15
+ ## Reference
16
+
17
+ - [Style DSL Reference](dsl.md): state maps and state keys, color tokens, units, replace tokens, recipes, advanced states (`@media`, `@parent`, `@root`, `:has`), keyframes, `@property`, `@font-face`, `@function`.
18
+ - [Style Properties Reference](styles.md): every Tasty style property (`fill`, `padding`, `border`, `radius`, `flow`, `preset`, …) and its syntax.
19
+ - [React API](react-api.md): `tasty()`, extending, `styleProps`, `modProps`, `tokenProps`, variants, sub-elements, `useStyles` and the other style functions.
20
+ - [Configuration](configuration.md): `configure()`: state aliases, units, tokens, replace tokens, recipes, presets, handlers, plugins.
21
+ - [Plugins & Extension Points](plugins.md): choosing between functions, units, states, handlers, prop handlers, recipes and base style props.
22
+
23
+ ## Rendering modes
24
+
25
+ - [Build-Time Extraction (`tastyStatic`)](tasty-static.md): zero-runtime CSS through the Babel plugin, Next.js setup, config files, limitations.
26
+ - [Server-Side Rendering (SSR)](ssr.md): the style collector, hydration, Next.js App Router and Astro.
27
+
28
+ ## Help
29
+
30
+ - [Tasty Debug Utilities](debug.md): `tastyDebug` in the browser console: the CSS on the page, cache metrics, chunks.
31
+ - [Migration Guide: v2 → v3](migration-v3.md): every breaking change from v2, with a search-and-replace cheat sheet.