@tenphi/tasty 0.0.0-snapshot.e4aff73 → 0.0.0-snapshot.e4e4347

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 (360) hide show
  1. package/README.md +441 -362
  2. package/dist/babel-types-BKDTT4--.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-5d8WlQbq.js +60 -0
  6. package/dist/chunks/build-config-5d8WlQbq.js.map +1 -0
  7. package/dist/chunks/collector-CjCak4iE.js +210 -0
  8. package/dist/chunks/collector-CjCak4iE.js.map +1 -0
  9. package/dist/chunks/config-engine-uOFYZidB.js +272 -0
  10. package/dist/chunks/config-engine-uOFYZidB.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-ubrHP97m.js +910 -0
  14. package/dist/chunks/css-definitions-ubrHP97m.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-CJ31U_WE.js} +197 -149
  18. package/dist/chunks/debug-CJ31U_WE.js.map +1 -0
  19. package/dist/chunks/dsl-DYSJc1-T.js +1383 -0
  20. package/dist/chunks/dsl-DYSJc1-T.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-CyyCI02N.js +689 -0
  24. package/dist/chunks/react-runtime-CyyCI02N.js.map +1 -0
  25. package/dist/chunks/runtime-engine-BQmOu5-W.js +2432 -0
  26. package/dist/chunks/runtime-engine-BQmOu5-W.js.map +1 -0
  27. package/dist/chunks/runtime-state-DEsyUMU-.js +152 -0
  28. package/dist/chunks/runtime-state-DEsyUMU-.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
  30. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  31. package/dist/chunks/style-engine-BX2LshDZ.js +5466 -0
  32. package/dist/chunks/style-engine-BX2LshDZ.js.map +1 -0
  33. package/dist/chunks/zero-engine-Dw0P4yGM.js +310 -0
  34. package/dist/chunks/zero-engine-Dw0P4yGM.js.map +1 -0
  35. package/dist/collector-CTU-nl0g.d.ts +164 -0
  36. package/dist/config-CcxqSZI2.d.ts +1368 -0
  37. package/dist/core/index.d.ts +5 -34
  38. package/dist/core/index.js +9 -27
  39. package/dist/hydrate-CRyjjAyl.d.ts +22 -0
  40. package/dist/index-xtey-KDu.d.ts +1950 -0
  41. package/dist/index.d.ts +5 -49
  42. package/dist/index.js +11 -34
  43. package/dist/{utils/merge-styles.d.ts → merge-styles-DSkVc6CD.d.ts} +3 -4
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +6 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  51. package/dist/ssr/astro-middleware-extract.js +9 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  54. package/dist/ssr/astro-middleware-static.js +7 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +18 -0
  57. package/dist/ssr/astro-middleware.js +7 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -12
  60. package/dist/ssr/astro.js +206 -50
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +2 -0
  64. package/dist/ssr/index.d.ts +17 -5
  65. package/dist/ssr/index.js +7 -9
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +64 -0
  68. package/dist/ssr/next-config.js +123 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +13 -12
  71. package/dist/ssr/next.js +40 -51
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +90 -5
  74. package/dist/static/index.js +31 -4
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +4 -0
  77. package/dist/static/inject.js +17 -0
  78. package/dist/static/inject.js.map +1 -0
  79. package/dist/types-DJEM_BOJ.d.ts +1567 -0
  80. package/dist/zero/babel.d.ts +20 -108
  81. package/dist/zero/babel.js +211 -142
  82. package/dist/zero/babel.js.map +1 -1
  83. package/dist/zero/index.d.ts +135 -3
  84. package/dist/zero/index.js +23 -3
  85. package/dist/zero/index.js.map +1 -0
  86. package/dist/zero/next.d.ts +16 -5
  87. package/dist/zero/next.js +8 -42
  88. package/dist/zero/next.js.map +1 -1
  89. package/docs/README.md +23 -12
  90. package/docs/adoption.md +72 -37
  91. package/docs/ai-agents.md +255 -0
  92. package/docs/comparison.md +83 -54
  93. package/docs/configuration.md +764 -74
  94. package/docs/debug.md +39 -24
  95. package/docs/design-system.md +187 -37
  96. package/docs/dsl.md +711 -164
  97. package/docs/getting-started.md +132 -52
  98. package/docs/injector.md +197 -90
  99. package/docs/methodology.md +154 -48
  100. package/docs/migration-v3.md +285 -0
  101. package/docs/pipeline.md +768 -0
  102. package/docs/plugins.md +333 -0
  103. package/docs/react-api.md +742 -0
  104. package/docs/runtime-benchmarks.md +388 -0
  105. package/docs/ssr.md +403 -149
  106. package/docs/styles.md +200 -45
  107. package/docs/tasty-static.md +354 -99
  108. package/package.json +153 -35
  109. package/tasty.config.ts +6 -0
  110. package/dist/_virtual/_rolldown/runtime.js +0 -8
  111. package/dist/chunks/cacheKey.js +0 -78
  112. package/dist/chunks/cacheKey.js.map +0 -1
  113. package/dist/chunks/definitions.d.ts +0 -37
  114. package/dist/chunks/definitions.js +0 -259
  115. package/dist/chunks/definitions.js.map +0 -1
  116. package/dist/chunks/renderChunk.js +0 -60
  117. package/dist/chunks/renderChunk.js.map +0 -1
  118. package/dist/config.d.ts +0 -323
  119. package/dist/config.js +0 -465
  120. package/dist/config.js.map +0 -1
  121. package/dist/debug.d.ts +0 -89
  122. package/dist/debug.js.map +0 -1
  123. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  124. package/dist/hooks/useGlobalStyles.js +0 -83
  125. package/dist/hooks/useGlobalStyles.js.map +0 -1
  126. package/dist/hooks/useKeyframes.d.ts +0 -56
  127. package/dist/hooks/useKeyframes.js +0 -69
  128. package/dist/hooks/useKeyframes.js.map +0 -1
  129. package/dist/hooks/useProperty.d.ts +0 -79
  130. package/dist/hooks/useProperty.js +0 -114
  131. package/dist/hooks/useProperty.js.map +0 -1
  132. package/dist/hooks/useRawCSS.d.ts +0 -53
  133. package/dist/hooks/useRawCSS.js +0 -40
  134. package/dist/hooks/useRawCSS.js.map +0 -1
  135. package/dist/hooks/useStyles.d.ts +0 -45
  136. package/dist/hooks/useStyles.js +0 -249
  137. package/dist/hooks/useStyles.js.map +0 -1
  138. package/dist/injector/index.d.ts +0 -165
  139. package/dist/injector/index.js +0 -162
  140. package/dist/injector/index.js.map +0 -1
  141. package/dist/injector/injector.d.ts +0 -148
  142. package/dist/injector/injector.js +0 -430
  143. package/dist/injector/injector.js.map +0 -1
  144. package/dist/injector/sheet-manager.d.ts +0 -136
  145. package/dist/injector/sheet-manager.js +0 -729
  146. package/dist/injector/sheet-manager.js.map +0 -1
  147. package/dist/injector/types.d.ts +0 -144
  148. package/dist/keyframes/index.js +0 -206
  149. package/dist/keyframes/index.js.map +0 -1
  150. package/dist/parser/classify.js +0 -320
  151. package/dist/parser/classify.js.map +0 -1
  152. package/dist/parser/const.js +0 -33
  153. package/dist/parser/const.js.map +0 -1
  154. package/dist/parser/lru.js +0 -109
  155. package/dist/parser/lru.js.map +0 -1
  156. package/dist/parser/parser.d.ts +0 -25
  157. package/dist/parser/parser.js +0 -116
  158. package/dist/parser/parser.js.map +0 -1
  159. package/dist/parser/tokenizer.js +0 -69
  160. package/dist/parser/tokenizer.js.map +0 -1
  161. package/dist/parser/types.d.ts +0 -51
  162. package/dist/parser/types.js +0 -46
  163. package/dist/parser/types.js.map +0 -1
  164. package/dist/pipeline/conditions.d.ts +0 -134
  165. package/dist/pipeline/conditions.js +0 -406
  166. package/dist/pipeline/conditions.js.map +0 -1
  167. package/dist/pipeline/exclusive.js +0 -231
  168. package/dist/pipeline/exclusive.js.map +0 -1
  169. package/dist/pipeline/index.d.ts +0 -53
  170. package/dist/pipeline/index.js +0 -681
  171. package/dist/pipeline/index.js.map +0 -1
  172. package/dist/pipeline/materialize.js +0 -1105
  173. package/dist/pipeline/materialize.js.map +0 -1
  174. package/dist/pipeline/parseStateKey.d.ts +0 -15
  175. package/dist/pipeline/parseStateKey.js +0 -447
  176. package/dist/pipeline/parseStateKey.js.map +0 -1
  177. package/dist/pipeline/simplify.js +0 -516
  178. package/dist/pipeline/simplify.js.map +0 -1
  179. package/dist/pipeline/warnings.js +0 -18
  180. package/dist/pipeline/warnings.js.map +0 -1
  181. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  182. package/dist/plugins/okhsl-plugin.js +0 -98
  183. package/dist/plugins/okhsl-plugin.js.map +0 -1
  184. package/dist/plugins/types.d.ts +0 -76
  185. package/dist/properties/index.js +0 -223
  186. package/dist/properties/index.js.map +0 -1
  187. package/dist/properties/property-type-resolver.d.ts +0 -24
  188. package/dist/properties/property-type-resolver.js +0 -91
  189. package/dist/properties/property-type-resolver.js.map +0 -1
  190. package/dist/ssr/async-storage.d.ts +0 -17
  191. package/dist/ssr/async-storage.js +0 -35
  192. package/dist/ssr/async-storage.js.map +0 -1
  193. package/dist/ssr/collect-auto-properties.js +0 -40
  194. package/dist/ssr/collect-auto-properties.js.map +0 -1
  195. package/dist/ssr/collector.d.ts +0 -85
  196. package/dist/ssr/collector.js +0 -183
  197. package/dist/ssr/collector.js.map +0 -1
  198. package/dist/ssr/context.d.ts +0 -8
  199. package/dist/ssr/context.js +0 -14
  200. package/dist/ssr/context.js.map +0 -1
  201. package/dist/ssr/format-global-rules.js +0 -22
  202. package/dist/ssr/format-global-rules.js.map +0 -1
  203. package/dist/ssr/format-keyframes.js +0 -70
  204. package/dist/ssr/format-keyframes.js.map +0 -1
  205. package/dist/ssr/format-property.js +0 -50
  206. package/dist/ssr/format-property.js.map +0 -1
  207. package/dist/ssr/format-rules.js +0 -70
  208. package/dist/ssr/format-rules.js.map +0 -1
  209. package/dist/ssr/hydrate.d.ts +0 -22
  210. package/dist/ssr/hydrate.js +0 -50
  211. package/dist/ssr/hydrate.js.map +0 -1
  212. package/dist/ssr/ssr-collector-ref.js +0 -12
  213. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  214. package/dist/states/index.d.ts +0 -49
  215. package/dist/states/index.js +0 -169
  216. package/dist/states/index.js.map +0 -1
  217. package/dist/static/tastyStatic.d.ts +0 -46
  218. package/dist/static/tastyStatic.js +0 -31
  219. package/dist/static/tastyStatic.js.map +0 -1
  220. package/dist/static/types.d.ts +0 -49
  221. package/dist/static/types.js +0 -24
  222. package/dist/static/types.js.map +0 -1
  223. package/dist/styles/align.d.ts +0 -15
  224. package/dist/styles/align.js +0 -14
  225. package/dist/styles/align.js.map +0 -1
  226. package/dist/styles/border.d.ts +0 -25
  227. package/dist/styles/border.js +0 -114
  228. package/dist/styles/border.js.map +0 -1
  229. package/dist/styles/color.d.ts +0 -14
  230. package/dist/styles/color.js +0 -27
  231. package/dist/styles/color.js.map +0 -1
  232. package/dist/styles/createStyle.js +0 -80
  233. package/dist/styles/createStyle.js.map +0 -1
  234. package/dist/styles/dimension.js +0 -97
  235. package/dist/styles/dimension.js.map +0 -1
  236. package/dist/styles/display.d.ts +0 -37
  237. package/dist/styles/display.js +0 -67
  238. package/dist/styles/display.js.map +0 -1
  239. package/dist/styles/fade.d.ts +0 -15
  240. package/dist/styles/fade.js +0 -58
  241. package/dist/styles/fade.js.map +0 -1
  242. package/dist/styles/fill.d.ts +0 -42
  243. package/dist/styles/fill.js +0 -52
  244. package/dist/styles/fill.js.map +0 -1
  245. package/dist/styles/flow.d.ts +0 -16
  246. package/dist/styles/flow.js +0 -12
  247. package/dist/styles/flow.js.map +0 -1
  248. package/dist/styles/gap.d.ts +0 -31
  249. package/dist/styles/gap.js +0 -37
  250. package/dist/styles/gap.js.map +0 -1
  251. package/dist/styles/height.d.ts +0 -17
  252. package/dist/styles/height.js +0 -20
  253. package/dist/styles/height.js.map +0 -1
  254. package/dist/styles/index.d.ts +0 -2
  255. package/dist/styles/index.js +0 -9
  256. package/dist/styles/index.js.map +0 -1
  257. package/dist/styles/inset.d.ts +0 -52
  258. package/dist/styles/inset.js +0 -150
  259. package/dist/styles/inset.js.map +0 -1
  260. package/dist/styles/justify.d.ts +0 -15
  261. package/dist/styles/justify.js +0 -14
  262. package/dist/styles/justify.js.map +0 -1
  263. package/dist/styles/list.d.ts +0 -16
  264. package/dist/styles/list.js +0 -98
  265. package/dist/styles/list.js.map +0 -1
  266. package/dist/styles/margin.d.ts +0 -24
  267. package/dist/styles/margin.js +0 -104
  268. package/dist/styles/margin.js.map +0 -1
  269. package/dist/styles/outline.d.ts +0 -29
  270. package/dist/styles/outline.js +0 -65
  271. package/dist/styles/outline.js.map +0 -1
  272. package/dist/styles/padding.d.ts +0 -24
  273. package/dist/styles/padding.js +0 -104
  274. package/dist/styles/padding.js.map +0 -1
  275. package/dist/styles/predefined.d.ts +0 -71
  276. package/dist/styles/predefined.js +0 -238
  277. package/dist/styles/predefined.js.map +0 -1
  278. package/dist/styles/preset.d.ts +0 -47
  279. package/dist/styles/preset.js +0 -126
  280. package/dist/styles/preset.js.map +0 -1
  281. package/dist/styles/radius.d.ts +0 -14
  282. package/dist/styles/radius.js +0 -51
  283. package/dist/styles/radius.js.map +0 -1
  284. package/dist/styles/scrollbar.d.ts +0 -25
  285. package/dist/styles/scrollbar.js +0 -48
  286. package/dist/styles/scrollbar.js.map +0 -1
  287. package/dist/styles/shadow.d.ts +0 -14
  288. package/dist/styles/shadow.js +0 -24
  289. package/dist/styles/shadow.js.map +0 -1
  290. package/dist/styles/transition.d.ts +0 -14
  291. package/dist/styles/transition.js +0 -158
  292. package/dist/styles/transition.js.map +0 -1
  293. package/dist/styles/types.d.ts +0 -523
  294. package/dist/styles/width.d.ts +0 -17
  295. package/dist/styles/width.js +0 -20
  296. package/dist/styles/width.js.map +0 -1
  297. package/dist/tasty.d.ts +0 -114
  298. package/dist/tasty.js +0 -232
  299. package/dist/tasty.js.map +0 -1
  300. package/dist/types.d.ts +0 -184
  301. package/dist/utils/cache-wrapper.js +0 -22
  302. package/dist/utils/cache-wrapper.js.map +0 -1
  303. package/dist/utils/case-converter.js +0 -8
  304. package/dist/utils/case-converter.js.map +0 -1
  305. package/dist/utils/color-math.d.ts +0 -46
  306. package/dist/utils/color-math.js +0 -749
  307. package/dist/utils/color-math.js.map +0 -1
  308. package/dist/utils/color-space.d.ts +0 -5
  309. package/dist/utils/color-space.js +0 -229
  310. package/dist/utils/color-space.js.map +0 -1
  311. package/dist/utils/colors.d.ts +0 -5
  312. package/dist/utils/colors.js +0 -11
  313. package/dist/utils/colors.js.map +0 -1
  314. package/dist/utils/css-types.d.ts +0 -7
  315. package/dist/utils/dotize.d.ts +0 -26
  316. package/dist/utils/dotize.js +0 -122
  317. package/dist/utils/dotize.js.map +0 -1
  318. package/dist/utils/filter-base-props.d.ts +0 -15
  319. package/dist/utils/filter-base-props.js +0 -45
  320. package/dist/utils/filter-base-props.js.map +0 -1
  321. package/dist/utils/get-display-name.d.ts +0 -7
  322. package/dist/utils/get-display-name.js +0 -10
  323. package/dist/utils/get-display-name.js.map +0 -1
  324. package/dist/utils/has-keys.js +0 -13
  325. package/dist/utils/has-keys.js.map +0 -1
  326. package/dist/utils/is-dev-env.js +0 -19
  327. package/dist/utils/is-dev-env.js.map +0 -1
  328. package/dist/utils/is-valid-element-type.js +0 -15
  329. package/dist/utils/is-valid-element-type.js.map +0 -1
  330. package/dist/utils/merge-styles.js.map +0 -1
  331. package/dist/utils/mod-attrs.d.ts +0 -8
  332. package/dist/utils/mod-attrs.js +0 -21
  333. package/dist/utils/mod-attrs.js.map +0 -1
  334. package/dist/utils/process-tokens.d.ts +0 -21
  335. package/dist/utils/process-tokens.js +0 -91
  336. package/dist/utils/process-tokens.js.map +0 -1
  337. package/dist/utils/resolve-recipes.d.ts +0 -17
  338. package/dist/utils/resolve-recipes.js +0 -147
  339. package/dist/utils/resolve-recipes.js.map +0 -1
  340. package/dist/utils/selector-transform.js +0 -32
  341. package/dist/utils/selector-transform.js.map +0 -1
  342. package/dist/utils/string.js +0 -8
  343. package/dist/utils/string.js.map +0 -1
  344. package/dist/utils/styles.d.ts +0 -101
  345. package/dist/utils/styles.js +0 -223
  346. package/dist/utils/styles.js.map +0 -1
  347. package/dist/utils/typography.d.ts +0 -47
  348. package/dist/utils/typography.js +0 -43
  349. package/dist/utils/typography.js.map +0 -1
  350. package/dist/utils/warnings.d.ts +0 -16
  351. package/dist/utils/warnings.js +0 -16
  352. package/dist/utils/warnings.js.map +0 -1
  353. package/dist/zero/css-writer.d.ts +0 -45
  354. package/dist/zero/css-writer.js +0 -74
  355. package/dist/zero/css-writer.js.map +0 -1
  356. package/dist/zero/extractor.d.ts +0 -24
  357. package/dist/zero/extractor.js +0 -215
  358. package/dist/zero/extractor.js.map +0 -1
  359. package/docs/PIPELINE.md +0 -519
  360. package/docs/runtime.md +0 -397
@@ -1,35 +1,43 @@
1
- # Zero Runtime Mode (tastyStatic)
1
+ # Build-Time Extraction (`tastyStatic`)
2
2
 
3
- `tastyStatic` is a build-time utility for generating CSS with zero runtime overhead. It's designed for static sites, no-JS websites, and performance-critical applications where you want to eliminate all runtime styling code. For the broader docs map, see the [Docs Hub](README.md).
3
+ `tastyStatic` is Tasty's framework-agnostic build-time utility for extracting CSS before rendering. It produces no client styling runtime in file mode, but it is not the only way to achieve zero-runtime delivery: server-only `tasty()` also ships no Tasty runtime to the browser while retaining the full React component API. Astro's `tastyIntegration({ islands: false })` is the clearest example; the same architecture applies to server-only Next.js RSC.
4
+
5
+ Choose `tastyStatic` specifically when styles must be generated during the build, when the consumer is not React, or when you want static class-name objects instead of components. For the broader docs map, see the [Docs Hub](README.md).
4
6
 
5
7
  ---
6
8
 
7
9
  ## When to Use
8
10
 
9
- - **Static site generation (SSG)** — Pre-render all styles at build time
10
- - **No-JavaScript websites** — CSS works without any JS runtime
11
- - **Performance-critical pages** — Zero runtime overhead for styling
12
- - **Landing pages** — Minimal bundle size with pre-generated CSS
11
+ - **CSS that must exist before anything renders** — static sites, landing pages, and HTML served from a CDN get one stylesheet generated at build time
12
+ - **No React at runtime** — `tastyStatic` returns class names, so plain DOM code or any templating that sets `class` can use them; the [Programmatic API](#programmatic-api) covers frameworks Babel does not process
13
+ - **Class-name objects instead of components** — extend them with `tastyStatic(base, styles)` and pass them wherever a `className` goes
14
+ - **Self-contained packages** — [inject mode](#inject-mode) embeds the CSS in the JavaScript, so consumers have no stylesheet to wire up
15
+
16
+ If the styles depend on props, keep `tasty()`: rendered only on the server, it also ships no styling runtime (see [Server-Side Rendering](ssr.md)).
13
17
 
14
18
  ## Requirements
15
19
 
16
- The zero-runtime mode is part of the main `@tenphi/tasty` package but requires additional peer dependencies depending on your setup:
20
+ Build-time extraction is part of the main `@tenphi/tasty` package but requires additional peer dependencies depending on your setup:
17
21
 
18
- | Dependency | Version | Required for |
19
- |---|---|---|
20
- | `@babel/core` | >= 7.24 | Babel plugin (`@tenphi/tasty/babel-plugin`) |
21
- | `@babel/helper-plugin-utils` | >= 7.24 | Babel plugin |
22
- | `@babel/types` | >= 7.24 | Babel plugin |
23
- | `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/next`) when using `configFile` option |
22
+ | Dependency | Version | Required for |
23
+ | ---------------------------- | ------- | ---------------------------------------------------- |
24
+ | `@babel/core` | >= 7.24 | Babel plugin (`@tenphi/tasty/babel-plugin`) |
25
+ | `@babel/helper-plugin-utils` | >= 7.24 | Babel plugin |
26
+ | `@babel/types` | >= 7.24 | Babel plugin |
27
+ | `jiti` | >= 2.6 | `configFile` only (Babel plugin and Next.js wrapper) |
28
+ | `babel-loader` | any | Next.js wrapper (`@tenphi/tasty/zero/next`) |
24
29
 
25
- All of these are declared as optional peer dependencies of `@tenphi/tasty`. Install only what your setup requires:
30
+ The Babel packages and `jiti` are optional peer dependencies of `@tenphi/tasty`; `babel-loader` is resolved from your project. `jiti` is loaded only to read a `configFile`, so a setup that passes `config` directly does not need it; without it, `configFile` fails with an error that says to install it. Install what your setup requires:
26
31
 
27
32
  ```bash
28
- # For any Babel-based setup (Vite, custom Babel config, etc.)
33
+ # Any Babel-based setup (Vite, custom Babel config, etc.)
29
34
  pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types
30
35
 
31
- # For Next.js with TypeScript config file
32
- pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types jiti
36
+ # Next.js
37
+ pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types babel-loader
38
+
39
+ # Either, with configFile
40
+ pnpm add -D jiti
33
41
  ```
34
42
 
35
43
  ---
@@ -50,13 +58,15 @@ const button = tastyStatic({
50
58
  radius: '1r',
51
59
  });
52
60
 
53
- // Use in JSX - works via toString() coercion
54
- <button className={button}>Click me</button>
61
+ // Use in JSX
62
+ <button className={button.className}>Click me</button>;
55
63
 
56
- // Or access className explicitly
57
- <button className={button.className}>Click me</button>
64
+ // toString() returns the class name, for template strings and plain JS
65
+ element.className = `${button} is-active`;
58
66
  ```
59
67
 
68
+ In TSX, pass `button.className`: React types `className` as `string`, so passing the `StaticStyle` object fails type-checking even though it works at runtime.
69
+
60
70
  ---
61
71
 
62
72
  ## API Reference
@@ -103,15 +113,17 @@ tastyStatic('body', {
103
113
  });
104
114
  ```
105
115
 
116
+ The selector can be a list (`'.uni-checkbox, uni-checkbox'`): every item gets the states and sub-elements. Local `@keyframes` and `@starting` states work as in `tastyStatic(styles)`.
117
+
106
118
  ---
107
119
 
108
120
  ## StaticStyle Object
109
121
 
110
- | Property | Type | Description |
111
- |----------|------|-------------|
112
- | `className` | `string` | Space-separated class names for use in JSX |
113
- | `styles` | `Styles` | The original (or merged) styles object |
114
- | `toString()` | `() => string` | Returns `className` for string coercion |
122
+ | Property | Type | Description |
123
+ | ------------ | -------------- | ------------------------------------------ |
124
+ | `className` | `string` | Space-separated class names for use in JSX |
125
+ | `styles` | `Styles` | The original (or merged) styles object |
126
+ | `toString()` | `() => string` | Returns `className` for string coercion |
115
127
 
116
128
  ---
117
129
 
@@ -123,46 +135,84 @@ tastyStatic('body', {
123
135
  // babel.config.js
124
136
  module.exports = {
125
137
  plugins: [
126
- ['@tenphi/tasty/babel-plugin', {
127
- output: 'public/tasty.css',
128
- }]
129
- ]
138
+ [
139
+ '@tenphi/tasty/babel-plugin',
140
+ {
141
+ output: 'public/tasty.css',
142
+ },
143
+ ],
144
+ ],
130
145
  };
131
146
  ```
132
147
 
133
- These examples use `data-schema="dark"` as the root-state convention. If your app already uses a different root attribute such as `data-theme`, keep the same alias pattern and swap the attribute name consistently in your zero-runtime config.
148
+ These examples use `data-schema="dark"` as the root-state convention. If your app already uses a different root attribute such as `data-theme`, keep the same alias pattern and swap the attribute name consistently in your build-time config.
134
149
 
135
150
  ### With Configuration
136
151
 
137
152
  ```javascript
138
153
  module.exports = {
139
154
  plugins: [
140
- ['@tenphi/tasty/babel-plugin', {
141
- output: 'public/tasty.css',
142
- config: {
143
- states: {
144
- '@mobile': '@media(w < 768px)',
145
- '@tablet': '@media(w < 1024px)',
146
- '@dark': '@root(schema=dark)',
155
+ [
156
+ '@tenphi/tasty/babel-plugin',
157
+ {
158
+ output: 'public/tasty.css',
159
+ config: {
160
+ states: {
161
+ '@mobile': '@media(w < 768px)',
162
+ '@tablet': '@media(w < 1024px)',
163
+ '@dark': '@root(schema=dark)',
164
+ },
165
+ devMode: true,
147
166
  },
148
- devMode: true,
149
167
  },
150
- }]
151
- ]
168
+ ],
169
+ ],
152
170
  };
153
171
  ```
154
172
 
155
173
  ### Plugin Options
156
174
 
157
- | Option | Type | Default | Description |
158
- |--------|------|---------|-------------|
159
- | `output` | `string` | `'tasty.css'` | Path for generated CSS file |
160
- | `configFile` | `string` | — | Absolute path to a TS/JS module that default-exports a `TastyZeroConfig` object. JSON-serializable alternative to `config` — required for Turbopack. |
161
- | `config` | `TastyZeroConfig \| () => TastyZeroConfig` | `{}` | Inline config object or factory function. Takes precedence over `configFile`. |
162
- | `configDeps` | `string[]` | `[]` | Absolute file paths that affect config (for cache invalidation) |
163
- | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases |
164
- | `config.devMode` | `boolean` | `false` | Add source comments to CSS |
165
- | `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
175
+ | Option | Type | Default | Description |
176
+ | -------------------------- | ------------------------------------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
177
+ | `output` | `string` | `'tasty.css'` | Path for generated CSS file |
178
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS (see [Inject Mode](#inject-mode)) |
179
+ | `configFile` | `string` | — | Absolute path to a TS/JS module that default-exports a `TastyZeroConfig` object. JSON-serializable alternative to `config` — required for Turbopack. Loaded with the optional `jiti` peer. |
180
+ | `config` | `TastyZeroConfig \| () => TastyZeroConfig` | `{}` | Inline config object or factory function. Takes precedence over `configFile`. |
181
+ | `configDeps` | `string[]` | `[]` | Absolute file paths that affect config (for cache invalidation) |
182
+ | `injectImport` | `boolean` | `true` | Replace `@tenphi/tasty/static` imports with an import of the generated CSS file. Set to `false` to manage CSS imports manually. |
183
+ | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases (e.g. `{ '@mobile': '@media(w < 768px)' }`) |
184
+ | `config.devMode` | `boolean` | `false` | Add source comments to CSS |
185
+ | `config.tokens` | `ConfigTokens` | — | Design tokens injected as CSS custom properties on `:root`. Values are parsed through the Tasty DSL. Supports state maps for responsive/themed tokens. |
186
+ | `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
187
+ | `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
188
+ | `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
189
+ | `config.fontFaces` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
190
+ | `config.counterStyles` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
191
+ | `config.properties` | `Record<string, PropertyDefinition>` | — | Global `@property` definitions, written with Tasty's [default properties](dsl.md#default-properties) |
192
+ | `config.units` | `Record<string, string \| UnitHandler>` | — | Custom units for the style parser (merged with built-ins). E.g. `{ u: 'var(--u)' }` makes `2u` compile to `calc(2 * var(--u))`. Native CSS units need no entry |
193
+ | `config.functions` | `Record<string, FunctionDefinition \| Function>` | — | Custom functions (merged). Bare keys → parse functions; `$$name` keys → declarative CSS `@function` definitions |
194
+ | `config.polyfills` | `{ functions?: boolean }` | `{}` | Opt-in polyfills. `functions: true` inlines `@function` calls into plain CSS at build time |
195
+ | `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
196
+ | `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
197
+ | `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
198
+ | `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
199
+ | `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
200
+ | `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
201
+ | `config.namePrefix` | `string` | `'ts'` | Prefix prepended to every generated identifier. Defaults to `'ts'` so static classes never collide with runtime (`'t'`) classes. See [Configuration: Name prefix](configuration.md#name-prefix). |
202
+
203
+ ### Coexisting with `tasty()`
204
+
205
+ When a page mixes `tastyStatic` with `tasty`, both must use **different** `namePrefix` values. The defaults handle this automatically (`'t'` for React rendering, `'ts'` for build-time extraction). If you customize one, customize the other:
206
+
207
+ ```ts
208
+ // tasty-zero.config.ts (Babel plugin)
209
+ export default { namePrefix: 'mbs' };
210
+ ```
211
+
212
+ ```ts
213
+ // app entry (`tasty()` configure)
214
+ configure({ namePrefix: 'mb' });
215
+ ```
166
216
 
167
217
  ---
168
218
 
@@ -174,16 +224,24 @@ Recipes work with `tastyStatic` the same way as with runtime `tasty`:
174
224
  // babel.config.js
175
225
  module.exports = {
176
226
  plugins: [
177
- ['@tenphi/tasty/babel-plugin', {
178
- output: 'public/tasty.css',
179
- config: {
180
- recipes: {
181
- card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
182
- elevated: { shadow: '2x 2x 4x #shadow' },
227
+ [
228
+ '@tenphi/tasty/babel-plugin',
229
+ {
230
+ output: 'public/tasty.css',
231
+ config: {
232
+ recipes: {
233
+ card: {
234
+ padding: '4x',
235
+ fill: '#surface',
236
+ radius: '1r',
237
+ border: true,
238
+ },
239
+ elevated: { shadow: '2x 2x 4x #shadow' },
240
+ },
183
241
  },
184
242
  },
185
- }]
186
- ]
243
+ ],
244
+ ],
187
245
  };
188
246
  ```
189
247
 
@@ -195,7 +253,7 @@ const card = tastyStatic({
195
253
  color: '#text',
196
254
  });
197
255
 
198
- <div className={card}>Styled card</div>
256
+ <div className={card.className}>Styled card</div>;
199
257
  ```
200
258
 
201
259
  ---
@@ -206,7 +264,7 @@ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automa
206
264
 
207
265
  ```typescript
208
266
  // next.config.ts
209
- import { withTastyZero } from '@tenphi/tasty/next';
267
+ import { withTastyZero } from '@tenphi/tasty/zero/next';
210
268
 
211
269
  export default withTastyZero({
212
270
  output: 'public/tasty.css',
@@ -219,24 +277,25 @@ export default withTastyZero({
219
277
 
220
278
  ### `withTastyZero` Options
221
279
 
222
- | Option | Type | Default | Description |
223
- |--------|------|---------|-------------|
224
- | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
225
- | `enabled` | `boolean` | `true` | Enable/disable the plugin |
226
- | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
227
- | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
228
- | `configDeps` | `string[]` | `[]` | Extra files the config depends on (for cache invalidation) |
280
+ | Option | Type | Default | Description |
281
+ | ------------ | -------------------- | -------------------- | ------------------------------------------------------------------------------------------------------- |
282
+ | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
283
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
284
+ | `enabled` | `boolean` | `true` | Enable/disable the plugin |
285
+ | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
286
+ | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
287
+ | `configDeps` | `string[]` | `[]` | Extra files the config depends on (for cache invalidation) |
229
288
 
230
289
  ### Turbopack Support
231
290
 
232
291
  Starting with Next.js 16, Turbopack is the default bundler. `withTastyZero` supports it out of the box by injecting `turbopack.rules` with `babel-loader` and JSON-serializable options.
233
292
 
234
- The `configFile` option is key for Turbopack — it passes a file path (JSON-serializable) instead of a function, and the Babel plugin loads the config internally via jiti.
293
+ The `configFile` option is key for Turbopack — it passes a file path (JSON-serializable) instead of a function, and the Babel plugin loads the config internally via `jiti`, which must be installed.
235
294
 
236
- **Requirements**: `babel-loader` must be installed in your project:
295
+ **Requirements**: `babel-loader` must be installed in your project (see [Requirements](#requirements)):
237
296
 
238
297
  ```bash
239
- pnpm add babel-loader
298
+ pnpm add -D babel-loader
240
299
  ```
241
300
 
242
301
  ### CSS Injection
@@ -251,31 +310,95 @@ public/tasty.css
251
310
 
252
311
  ---
253
312
 
313
+ ## Programmatic API
314
+
315
+ `@tenphi/tasty/zero` turns styles into CSS in Node without Babel or React — for build scripts, or CSS shipped to other frameworks:
316
+
317
+ ```ts
318
+ import {
319
+ configure,
320
+ extractStylesForSelector,
321
+ extractStylesWithChunks,
322
+ } from '@tenphi/tasty/zero';
323
+
324
+ configure({
325
+ units: { u: 'var(--unit)' },
326
+ states: { '@dark': '@root(schema=dark)' },
327
+ });
328
+
329
+ extractStylesForSelector('.card', { padding: '2u', fill: '#surface' }).css;
330
+ // → '.card { padding: calc(2 * var(--unit)); background-color: … }'
331
+
332
+ extractStylesWithChunks({ display: 'flex', gap: '1u' });
333
+ // → [{ className: 'ts…', css: '.ts….ts… { … }' }]
334
+ ```
335
+
336
+ `configure()` takes the same options as the Babel plugin's `config` (see [Plugin Options](#plugin-options)) and replaces the previous configuration on each call; `resetConfig()` returns to the defaults. Options that shape the extracted rules apply — `states`, `units`, parse `functions`, `handlers`, `replaceTokens`, `recipes`, `plugins`, `namePrefix`. Definitions that become at-rules or global CSS of their own are not emitted with the rules: `tokens`, `globalStyles`, `fontFaces`, `counterStyles`, `properties` and `$$` `@function` definitions. Render tokens and global styles with `extractStylesForSelector(':root', tokens)` and `extractStylesForSelector(selector, styles)`.
337
+
338
+ `extractConfigProperties()` returns the `@property` rules the Babel plugin writes at the top of its output: Tasty's [default set](dsl.md#default-properties) (`#border`, `#outline`, `$gap`, `$radius`, `$transition`, …) overlaid with the configured `properties`, or with the `properties` map you pass it. Emit them once per stylesheet. Style handlers read several of these tokens with no fallback of their own (`border: true` reads `#border`, `transition` reads `$transition`), so without them those declarations resolve to nothing.
339
+
340
+ The configuration is process-wide and shared with the Babel plugin and the runtime `configure()` from `@tenphi/tasty`. The extractors re-apply their own configuration when the Babel plugin replaced it, but not after a runtime `configure()` — don't mix the runtime and build-time configuration in one process.
341
+
342
+ `extractStylesForSelector()` output starts with the `@keyframes` its rules animate — local `@keyframes` and configured `keyframes` — under hashed names the `animation` declarations are rewritten to. `extractStylesWithChunks()` returns class rules only.
343
+
344
+ To write the results to a file the way the Babel plugin does, use `createCSSWriter()`. It deduplicates blocks by key and prepends the generated-file header:
345
+
346
+ ```ts
347
+ import {
348
+ createCSSWriter,
349
+ extractConfigProperties,
350
+ extractStylesWithChunks,
351
+ } from '@tenphi/tasty/zero';
352
+
353
+ const writer = createCSSWriter('dist/tasty.css', { devMode: true });
354
+
355
+ for (const prop of extractConfigProperties()) {
356
+ writer.add(`@property:${prop.name}`, prop.css);
357
+ }
358
+
359
+ for (const chunk of extractStylesWithChunks({ display: 'flex', gap: '1u' })) {
360
+ writer.add(chunk.className, chunk.css, 'src/card.ts'); // source is a devMode comment
361
+ }
362
+
363
+ writer.write(); // also: has(key), getCSS(), clear(), getOutputPath()
364
+ ```
365
+
366
+ ---
367
+
254
368
  ## Vite Integration
255
369
 
370
+ `@vitejs/plugin-react` 6 no longer runs Babel; add it with `@rolldown/plugin-babel` (`pnpm add -D @rolldown/plugin-babel`):
371
+
256
372
  ```typescript
257
373
  // vite.config.ts
258
374
  import { defineConfig } from 'vite';
259
375
  import react from '@vitejs/plugin-react';
376
+ import babel from '@rolldown/plugin-babel';
260
377
 
261
378
  export default defineConfig({
262
379
  plugins: [
263
- react({
264
- babel: {
265
- plugins: [
266
- ['@tenphi/tasty/babel-plugin', {
267
- output: 'public/tasty.css',
380
+ react(),
381
+ babel({
382
+ plugins: [
383
+ [
384
+ '@tenphi/tasty/babel-plugin',
385
+ {
386
+ output: 'src/tasty.css',
268
387
  config: {
269
388
  states: { '@mobile': '@media(w < 768px)' },
270
389
  },
271
- }],
390
+ },
272
391
  ],
273
- },
392
+ ],
274
393
  }),
275
394
  ],
276
395
  });
277
396
  ```
278
397
 
398
+ With `@vitejs/plugin-react` 5 or older, pass the same `plugins` array to `react({ babel: { plugins } })` instead.
399
+
400
+ Keep `output` outside `public/`: the plugin replaces each `@tenphi/tasty/static` import with an import of the generated file, and Vite does not let JavaScript import files from `public/`. Vite then bundles the CSS like any other stylesheet.
401
+
279
402
  ---
280
403
 
281
404
  ## Build Transformation
@@ -293,42 +416,169 @@ const button = tastyStatic({
293
416
 
294
417
  tastyStatic('.heading', { preset: 'h1' });
295
418
 
296
- export const Button = () => <button className={button}>Click</button>;
419
+ export const Button = () => <button className={button.className}>Click</button>;
297
420
  ```
298
421
 
299
422
  ### After (Production Build)
300
423
 
301
424
  ```tsx
425
+ import './tasty.css';
426
+
302
427
  const button = {
303
- className: 'ts3f2a1b ts8c4d2e',
428
+ className: 'ts3f783b ts070801',
304
429
  styles: { padding: '2x 4x', fill: '#purple', color: '#white' },
305
- toString() { return this.className; }
430
+ toString() {
431
+ return this.className;
432
+ },
306
433
  };
307
434
 
308
- export const Button = () => <button className={button}>Click</button>;
435
+ export const Button = () => <button className={button.className}>Click</button>;
309
436
  ```
310
437
 
438
+ The `@tenphi/tasty/static` import becomes an import of the generated file (relative to the source file), and the selector-mode call is removed.
439
+
311
440
  ### Generated CSS (tasty.css)
312
441
 
313
442
  ```css
314
443
  /* Generated by @tenphi/tasty/zero - DO NOT EDIT */
315
444
 
316
- .ts3f2a1b.ts3f2a1b {
317
- padding: 16px 32px;
445
+ @property --tasty-second-fill-color {
446
+ syntax: '<color>';
447
+ inherits: false;
448
+ initial-value: transparent;
318
449
  }
319
450
 
320
- .ts8c4d2e.ts8c4d2e {
321
- background: #9370db;
322
- color: #fff;
451
+ @property --current-color {
452
+ syntax: '<color>';
453
+ inherits: true;
454
+ initial-value: currentcolor;
455
+ }
456
+
457
+ /* …the rest of Tasty's default @property rules (--white-color, --border-color, --gap, --transition, …), then config.properties */
458
+
459
+ .ts3f783b.ts3f783b {
460
+ color: var(--white-color);
461
+ --current-color: var(--white-color);
323
462
  }
324
463
 
325
- .heading.heading {
326
- font-size: 2.5rem;
327
- font-weight: 700;
328
- line-height: 1.2;
464
+ .ts3f783b.ts3f783b {
465
+ background-color: var(--purple-color);
466
+ }
467
+
468
+ .ts070801.ts070801 {
469
+ padding: 16px 32px;
470
+ }
471
+
472
+ .heading {
473
+ font-size: var(--h1-font-size, var(--default-font-size));
474
+ /* …line-height, letter-spacing, font-weight, and the rest of the h1 preset */
329
475
  }
330
476
  ```
331
477
 
478
+ The file starts with Tasty's [default `@property` rules](dsl.md#default-properties) and your `config.properties`, written once. Styles are split into chunks (here appearance and spacing), each with its own class. Color tokens compile to custom properties: `#purple` becomes `var(--purple-color)`. Define it in `config.tokens` and the plugin writes it to `:root` at the top of the same file. Units are literal (`2x` is `16px`). Selector-mode rules use the selector as written, without the doubled specificity of class rules.
479
+
480
+ ---
481
+
482
+ ## Inject Mode
483
+
484
+ By default the Babel plugin writes CSS to a file (`mode: 'file'`). **Inject mode** (`mode: 'inject'`) embeds CSS inline in your JavaScript and injects it at runtime via a tiny injector. No CSS file is produced.
485
+
486
+ This is ideal for **reusable components**, **extensions**, and **libraries** where consumers shouldn't need to manage an external CSS file.
487
+
488
+ ### How It Works
489
+
490
+ 1. The Babel plugin extracts CSS at build time (same pipeline as file mode).
491
+ 2. Instead of writing to a `.css` file, the CSS is embedded as string literals in the JS output.
492
+ 3. The `@tenphi/tasty/static` import is rewritten to `@tenphi/tasty/static/inject`.
493
+ 4. Each `tastyStatic` call becomes a self-contained expression that injects its CSS and evaluates to a `StaticStyle` object.
494
+
495
+ ### Configuration
496
+
497
+ ```javascript
498
+ // babel.config.js
499
+ module.exports = {
500
+ plugins: [
501
+ [
502
+ '@tenphi/tasty/babel-plugin',
503
+ {
504
+ mode: 'inject',
505
+ config: {
506
+ states: { '@mobile': '@media(w < 768px)' },
507
+ },
508
+ },
509
+ ],
510
+ ],
511
+ };
512
+ ```
513
+
514
+ With Next.js:
515
+
516
+ ```typescript
517
+ // next.config.ts
518
+ import { withTastyZero } from '@tenphi/tasty/zero/next';
519
+
520
+ export default withTastyZero({
521
+ mode: 'inject',
522
+ configFile: './app/tasty-zero.config.ts',
523
+ })({
524
+ reactStrictMode: true,
525
+ });
526
+ ```
527
+
528
+ When `mode` is `'inject'`, the `output` and `injectImport` options are ignored.
529
+
530
+ ### Build Transformation (inject mode)
531
+
532
+ **Before:**
533
+
534
+ ```tsx
535
+ import { tastyStatic } from '@tenphi/tasty/static';
536
+
537
+ const button = tastyStatic({
538
+ padding: '2x 4x',
539
+ fill: '#purple',
540
+ });
541
+
542
+ tastyStatic('.heading', { preset: 'h1' });
543
+ ```
544
+
545
+ **After:**
546
+
547
+ ```tsx
548
+ import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
549
+
550
+ _$i(
551
+ '@property',
552
+ '@property --tasty-second-fill-color { … }\n@property --current-color { … }\n…',
553
+ );
554
+
555
+ const button =
556
+ (_$i(
557
+ 'tsa903d6 ts070801',
558
+ '.tsa903d6.tsa903d6 { background-color: var(--purple-color); }\n.ts070801.ts070801 { padding: 16px 32px; }',
559
+ ),
560
+ {
561
+ className: 'tsa903d6 ts070801',
562
+ styles: { padding: '2x 4x', fill: '#purple' },
563
+ toString() {
564
+ return this.className;
565
+ },
566
+ });
567
+
568
+ _$i('.heading', '.heading { font-size: var(--h1-font-size, …); … }');
569
+ ```
570
+
571
+ Each file that calls `tastyStatic()` starts by injecting Tasty's default `@property` rules and your `config.properties` under the `@property` id. `injectCSS()` skips an id it has already injected, so the page gets them once.
572
+
573
+ ### Dev Mode / HMR
574
+
575
+ Class names are content-hashed (`ts` + MD5). When styles change, a new hash produces a new `_$i` call that injects fresh CSS. The injector deduplicates by id, so unchanged styles are skipped. Old CSS stays in the DOM but is harmless since no elements reference those class names.
576
+
577
+ ### Limitations (inject mode)
578
+
579
+ - **Client-side only** — Styles are injected via the DOM, so they are not available during SSR. For server-rendered apps, use `mode: 'file'` or React `tasty()`.
580
+ - **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
581
+
332
582
  ---
333
583
 
334
584
  ## Style Extension
@@ -341,7 +591,7 @@ const button = tastyStatic({
341
591
  radius: '1r',
342
592
  fill: '#gray.20',
343
593
  color: '#text',
344
- transition: 'fill 0.15s',
594
+ transition: 'fill',
345
595
  });
346
596
 
347
597
  // Variants
@@ -377,7 +627,7 @@ const card = tastyStatic({
377
627
 
378
628
  ## Extending Style Types (TypeScript)
379
629
 
380
- If you add custom style properties, use module augmentation so `tastyStatic` recognizes them too. See [Extending Style Types](configuration.md#extending-style-types-typescript) in the configuration docs.
630
+ If you add custom style properties, use module augmentation so `tastyStatic` recognizes them too. See [TypeScript](configuration.md#typescript) in the configuration docs.
381
631
 
382
632
  ---
383
633
 
@@ -395,13 +645,17 @@ For dynamic styling needs, combine with regular CSS or CSS variables:
395
645
  ```tsx
396
646
  const card = tastyStatic({
397
647
  padding: '4x',
398
- fill: 'var(--card-bg, #white)',
648
+ fill: '($card-bg, #white)',
399
649
  });
400
650
 
401
651
  <div
402
- className={card}
403
- style={{ '--card-bg': isActive ? '#purple' : '#white' }}
404
- />
652
+ className={card.className}
653
+ style={
654
+ {
655
+ '--card-bg': isActive ? 'var(--purple-color)' : 'var(--white-color)',
656
+ } as React.CSSProperties
657
+ }
658
+ />;
405
659
  ```
406
660
 
407
661
  ---
@@ -418,14 +672,15 @@ const card = tastyStatic({
418
672
  ## Common Issues
419
673
 
420
674
  - No CSS file is generated: make sure the Babel plugin actually runs for files importing `@tenphi/tasty/static`, and verify the `output` path is writable.
421
- - Styles stay dynamic by mistake: `tastyStatic()` only supports build-time-known values. Move runtime values to CSS variables or switch that component to runtime `tasty()`.
675
+ - Styles stay dynamic by mistake: `tastyStatic()` only supports build-time-known values. Move dynamic values to CSS variables or switch that component to React `tasty()`.
422
676
  - Turbopack config behaves inconsistently: prefer `configFile` over inline functions so the setup stays JSON-serializable.
423
677
 
424
678
  ---
425
679
 
426
680
  ## Related
427
681
 
428
- - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
682
+ - [Docs Hub](README.md) — Choose the right guide by task or CSS delivery model
429
683
  - [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
430
- - [Runtime API](runtime.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, hooks
684
+ - [React API](react-api.md) — Client or server rendering with `tasty()`: component props, variants, sub-elements, and style functions
431
685
  - [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
686
+ - [Plugins & Extension Points](plugins.md) — Which extension points work at build time (`functions`, `units`, `states`, `handlers`, `recipes`) and which do not (`propHandlers` — `tastyStatic()` takes styles objects, not props)