@tenphi/tasty 0.0.0-snapshot.de420b6 → 0.0.0-snapshot.dfef2a5

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 (331) hide show
  1. package/README.md +321 -246
  2. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +17 -8
  3. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/babel-BUQGeOXA.d.ts +83 -0
  5. package/dist/collector-DTahQUiV.js +304 -0
  6. package/dist/collector-DTahQUiV.js.map +1 -0
  7. package/dist/collector-DUaHCcTS.d.ts +145 -0
  8. package/dist/config-B5kHzuNz.js +12269 -0
  9. package/dist/config-B5kHzuNz.js.map +1 -0
  10. package/dist/config-YsxGv4tq.d.ts +1263 -0
  11. package/dist/context-CA8YKeMn.js +24 -0
  12. package/dist/context-CA8YKeMn.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -33
  14. package/dist/core/index.js +6 -26
  15. package/dist/core-CTP5hhqP.js +1565 -0
  16. package/dist/core-CTP5hhqP.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-BrQjOLNY.js} +188 -13
  18. package/dist/css-writer-BrQjOLNY.js.map +1 -0
  19. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +3 -3
  20. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  21. package/dist/format-rules-DKOA-6qu.js +130 -0
  22. package/dist/format-rules-DKOA-6qu.js.map +1 -0
  23. package/dist/hydrate-OeMX99We.js +37 -0
  24. package/dist/hydrate-OeMX99We.js.map +1 -0
  25. package/dist/index-Cd45t5NM.d.ts +1521 -0
  26. package/dist/index-DhhUI0yi.d.ts +1904 -0
  27. package/dist/index.d.ts +5 -48
  28. package/dist/index.js +920 -32
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-CoBy6OgI.js +424 -0
  31. package/dist/keyframes-CoBy6OgI.js.map +1 -0
  32. package/dist/{utils/merge-styles.d.ts → merge-styles-CU7JbEwg.d.ts} +3 -3
  33. package/dist/{utils/merge-styles.js → merge-styles-oklji0KB.js} +4 -6
  34. package/dist/merge-styles-oklji0KB.js.map +1 -0
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-DTG81rzl.js} +5 -8
  36. package/dist/resolve-recipes-DTG81rzl.js.map +1 -0
  37. package/dist/ssr/astro-client.d.ts +1 -0
  38. package/dist/ssr/astro-client.js +19 -0
  39. package/dist/ssr/astro-client.js.map +1 -0
  40. package/dist/ssr/astro-middleware-static.d.ts +16 -0
  41. package/dist/ssr/astro-middleware-static.js +18 -0
  42. package/dist/ssr/astro-middleware-static.js.map +1 -0
  43. package/dist/ssr/astro-middleware.d.ts +17 -0
  44. package/dist/ssr/astro-middleware.js +19 -0
  45. package/dist/ssr/astro-middleware.js.map +1 -0
  46. package/dist/ssr/astro.d.ts +74 -10
  47. package/dist/ssr/astro.js +124 -32
  48. package/dist/ssr/astro.js.map +1 -1
  49. package/dist/ssr/index.d.ts +37 -5
  50. package/dist/ssr/index.js +7 -9
  51. package/dist/ssr/index.js.map +1 -1
  52. package/dist/ssr/next.d.ts +6 -6
  53. package/dist/ssr/next.js +19 -16
  54. package/dist/ssr/next.js.map +1 -1
  55. package/dist/static/index.d.ts +91 -5
  56. package/dist/static/index.js +49 -4
  57. package/dist/static/index.js.map +1 -0
  58. package/dist/static/inject.d.ts +5 -0
  59. package/dist/static/inject.js +17 -0
  60. package/dist/static/inject.js.map +1 -0
  61. package/dist/zero/babel.d.ts +2 -113
  62. package/dist/zero/babel.js +232 -42
  63. package/dist/zero/babel.js.map +1 -1
  64. package/dist/zero/index.d.ts +81 -3
  65. package/dist/zero/index.js +2 -4
  66. package/dist/zero/next.d.ts +51 -15
  67. package/dist/zero/next.js +75 -26
  68. package/dist/zero/next.js.map +1 -1
  69. package/docs/README.md +34 -0
  70. package/docs/adoption.md +298 -0
  71. package/docs/ai-agents.md +223 -0
  72. package/docs/comparison.md +419 -0
  73. package/docs/configuration.md +635 -33
  74. package/docs/debug.md +159 -344
  75. package/docs/design-system.md +436 -0
  76. package/docs/dsl.md +991 -0
  77. package/docs/getting-started.md +217 -0
  78. package/docs/injector.md +102 -33
  79. package/docs/methodology.md +642 -0
  80. package/docs/migration-v3.md +285 -0
  81. package/docs/pipeline.md +741 -0
  82. package/docs/plugins.md +349 -0
  83. package/docs/react-api.md +660 -0
  84. package/docs/ssr.md +186 -106
  85. package/docs/styles.md +104 -33
  86. package/docs/tasty-static.md +196 -23
  87. package/package.json +62 -21
  88. package/tasty.config.ts +6 -0
  89. package/dist/chunks/cacheKey.js +0 -70
  90. package/dist/chunks/cacheKey.js.map +0 -1
  91. package/dist/chunks/definitions.d.ts +0 -37
  92. package/dist/chunks/definitions.js +0 -259
  93. package/dist/chunks/definitions.js.map +0 -1
  94. package/dist/chunks/renderChunk.js +0 -61
  95. package/dist/chunks/renderChunk.js.map +0 -1
  96. package/dist/config.d.ts +0 -288
  97. package/dist/config.js +0 -417
  98. package/dist/config.js.map +0 -1
  99. package/dist/debug.d.ts +0 -204
  100. package/dist/debug.js +0 -733
  101. package/dist/debug.js.map +0 -1
  102. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  103. package/dist/hooks/useGlobalStyles.js +0 -80
  104. package/dist/hooks/useGlobalStyles.js.map +0 -1
  105. package/dist/hooks/useKeyframes.d.ts +0 -56
  106. package/dist/hooks/useKeyframes.js +0 -69
  107. package/dist/hooks/useKeyframes.js.map +0 -1
  108. package/dist/hooks/useProperty.d.ts +0 -79
  109. package/dist/hooks/useProperty.js +0 -114
  110. package/dist/hooks/useProperty.js.map +0 -1
  111. package/dist/hooks/useRawCSS.d.ts +0 -53
  112. package/dist/hooks/useRawCSS.js +0 -40
  113. package/dist/hooks/useRawCSS.js.map +0 -1
  114. package/dist/hooks/useStyles.d.ts +0 -45
  115. package/dist/hooks/useStyles.js +0 -243
  116. package/dist/hooks/useStyles.js.map +0 -1
  117. package/dist/injector/index.d.ts +0 -165
  118. package/dist/injector/index.js +0 -162
  119. package/dist/injector/index.js.map +0 -1
  120. package/dist/injector/injector.d.ts +0 -148
  121. package/dist/injector/injector.js +0 -436
  122. package/dist/injector/injector.js.map +0 -1
  123. package/dist/injector/sheet-manager.d.ts +0 -136
  124. package/dist/injector/sheet-manager.js +0 -729
  125. package/dist/injector/sheet-manager.js.map +0 -1
  126. package/dist/injector/types.d.ts +0 -144
  127. package/dist/keyframes/index.js +0 -206
  128. package/dist/keyframes/index.js.map +0 -1
  129. package/dist/parser/classify.js +0 -319
  130. package/dist/parser/classify.js.map +0 -1
  131. package/dist/parser/const.js +0 -33
  132. package/dist/parser/const.js.map +0 -1
  133. package/dist/parser/lru.js +0 -109
  134. package/dist/parser/lru.js.map +0 -1
  135. package/dist/parser/parser.d.ts +0 -25
  136. package/dist/parser/parser.js +0 -116
  137. package/dist/parser/parser.js.map +0 -1
  138. package/dist/parser/tokenizer.js +0 -69
  139. package/dist/parser/tokenizer.js.map +0 -1
  140. package/dist/parser/types.d.ts +0 -51
  141. package/dist/parser/types.js +0 -46
  142. package/dist/parser/types.js.map +0 -1
  143. package/dist/pipeline/conditions.d.ts +0 -134
  144. package/dist/pipeline/conditions.js +0 -406
  145. package/dist/pipeline/conditions.js.map +0 -1
  146. package/dist/pipeline/exclusive.js +0 -231
  147. package/dist/pipeline/exclusive.js.map +0 -1
  148. package/dist/pipeline/index.d.ts +0 -53
  149. package/dist/pipeline/index.js +0 -660
  150. package/dist/pipeline/index.js.map +0 -1
  151. package/dist/pipeline/materialize.js +0 -856
  152. package/dist/pipeline/materialize.js.map +0 -1
  153. package/dist/pipeline/parseStateKey.d.ts +0 -15
  154. package/dist/pipeline/parseStateKey.js +0 -451
  155. package/dist/pipeline/parseStateKey.js.map +0 -1
  156. package/dist/pipeline/simplify.js +0 -516
  157. package/dist/pipeline/simplify.js.map +0 -1
  158. package/dist/pipeline/warnings.js +0 -18
  159. package/dist/pipeline/warnings.js.map +0 -1
  160. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  161. package/dist/plugins/okhsl-plugin.js +0 -371
  162. package/dist/plugins/okhsl-plugin.js.map +0 -1
  163. package/dist/plugins/types.d.ts +0 -69
  164. package/dist/properties/index.js +0 -235
  165. package/dist/properties/index.js.map +0 -1
  166. package/dist/properties/property-type-resolver.d.ts +0 -24
  167. package/dist/properties/property-type-resolver.js +0 -83
  168. package/dist/properties/property-type-resolver.js.map +0 -1
  169. package/dist/ssr/async-storage.d.ts +0 -17
  170. package/dist/ssr/async-storage.js.map +0 -1
  171. package/dist/ssr/collector.d.ts +0 -85
  172. package/dist/ssr/collector.js +0 -173
  173. package/dist/ssr/collector.js.map +0 -1
  174. package/dist/ssr/context.d.ts +0 -8
  175. package/dist/ssr/context.js +0 -14
  176. package/dist/ssr/context.js.map +0 -1
  177. package/dist/ssr/format-global-rules.js.map +0 -1
  178. package/dist/ssr/format-keyframes.js +0 -70
  179. package/dist/ssr/format-keyframes.js.map +0 -1
  180. package/dist/ssr/format-property.js +0 -48
  181. package/dist/ssr/format-property.js.map +0 -1
  182. package/dist/ssr/format-rules.js +0 -70
  183. package/dist/ssr/format-rules.js.map +0 -1
  184. package/dist/ssr/hydrate.d.ts +0 -22
  185. package/dist/ssr/hydrate.js +0 -50
  186. package/dist/ssr/hydrate.js.map +0 -1
  187. package/dist/ssr/ssr-collector-ref.js +0 -12
  188. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  189. package/dist/states/index.d.ts +0 -49
  190. package/dist/states/index.js +0 -416
  191. package/dist/states/index.js.map +0 -1
  192. package/dist/static/tastyStatic.d.ts +0 -46
  193. package/dist/static/tastyStatic.js +0 -31
  194. package/dist/static/tastyStatic.js.map +0 -1
  195. package/dist/static/types.d.ts +0 -49
  196. package/dist/static/types.js +0 -24
  197. package/dist/static/types.js.map +0 -1
  198. package/dist/styles/align.d.ts +0 -15
  199. package/dist/styles/align.js +0 -14
  200. package/dist/styles/align.js.map +0 -1
  201. package/dist/styles/border.d.ts +0 -25
  202. package/dist/styles/border.js +0 -114
  203. package/dist/styles/border.js.map +0 -1
  204. package/dist/styles/color.d.ts +0 -14
  205. package/dist/styles/color.js +0 -23
  206. package/dist/styles/color.js.map +0 -1
  207. package/dist/styles/createStyle.js +0 -77
  208. package/dist/styles/createStyle.js.map +0 -1
  209. package/dist/styles/dimension.js +0 -97
  210. package/dist/styles/dimension.js.map +0 -1
  211. package/dist/styles/display.d.ts +0 -37
  212. package/dist/styles/display.js +0 -67
  213. package/dist/styles/display.js.map +0 -1
  214. package/dist/styles/fade.d.ts +0 -15
  215. package/dist/styles/fade.js +0 -58
  216. package/dist/styles/fade.js.map +0 -1
  217. package/dist/styles/fill.d.ts +0 -42
  218. package/dist/styles/fill.js +0 -52
  219. package/dist/styles/fill.js.map +0 -1
  220. package/dist/styles/flow.d.ts +0 -16
  221. package/dist/styles/flow.js +0 -12
  222. package/dist/styles/flow.js.map +0 -1
  223. package/dist/styles/gap.d.ts +0 -31
  224. package/dist/styles/gap.js +0 -37
  225. package/dist/styles/gap.js.map +0 -1
  226. package/dist/styles/height.d.ts +0 -17
  227. package/dist/styles/height.js +0 -20
  228. package/dist/styles/height.js.map +0 -1
  229. package/dist/styles/index.d.ts +0 -2
  230. package/dist/styles/index.js +0 -9
  231. package/dist/styles/index.js.map +0 -1
  232. package/dist/styles/inset.d.ts +0 -52
  233. package/dist/styles/inset.js +0 -150
  234. package/dist/styles/inset.js.map +0 -1
  235. package/dist/styles/justify.d.ts +0 -15
  236. package/dist/styles/justify.js +0 -14
  237. package/dist/styles/justify.js.map +0 -1
  238. package/dist/styles/list.d.ts +0 -16
  239. package/dist/styles/list.js +0 -98
  240. package/dist/styles/list.js.map +0 -1
  241. package/dist/styles/margin.d.ts +0 -24
  242. package/dist/styles/margin.js +0 -104
  243. package/dist/styles/margin.js.map +0 -1
  244. package/dist/styles/outline.d.ts +0 -29
  245. package/dist/styles/outline.js +0 -65
  246. package/dist/styles/outline.js.map +0 -1
  247. package/dist/styles/padding.d.ts +0 -24
  248. package/dist/styles/padding.js +0 -104
  249. package/dist/styles/padding.js.map +0 -1
  250. package/dist/styles/predefined.d.ts +0 -71
  251. package/dist/styles/predefined.js +0 -238
  252. package/dist/styles/predefined.js.map +0 -1
  253. package/dist/styles/preset.d.ts +0 -47
  254. package/dist/styles/preset.js +0 -126
  255. package/dist/styles/preset.js.map +0 -1
  256. package/dist/styles/radius.d.ts +0 -14
  257. package/dist/styles/radius.js +0 -51
  258. package/dist/styles/radius.js.map +0 -1
  259. package/dist/styles/scrollbar.d.ts +0 -25
  260. package/dist/styles/scrollbar.js +0 -48
  261. package/dist/styles/scrollbar.js.map +0 -1
  262. package/dist/styles/shadow.d.ts +0 -14
  263. package/dist/styles/shadow.js +0 -24
  264. package/dist/styles/shadow.js.map +0 -1
  265. package/dist/styles/transition.d.ts +0 -14
  266. package/dist/styles/transition.js +0 -158
  267. package/dist/styles/transition.js.map +0 -1
  268. package/dist/styles/types.d.ts +0 -495
  269. package/dist/styles/width.d.ts +0 -17
  270. package/dist/styles/width.js +0 -20
  271. package/dist/styles/width.js.map +0 -1
  272. package/dist/tasty.d.ts +0 -981
  273. package/dist/tasty.js +0 -206
  274. package/dist/tasty.js.map +0 -1
  275. package/dist/tokens/typography.d.ts +0 -19
  276. package/dist/tokens/typography.js +0 -237
  277. package/dist/tokens/typography.js.map +0 -1
  278. package/dist/types.d.ts +0 -184
  279. package/dist/utils/cache-wrapper.js +0 -26
  280. package/dist/utils/cache-wrapper.js.map +0 -1
  281. package/dist/utils/case-converter.js +0 -8
  282. package/dist/utils/case-converter.js.map +0 -1
  283. package/dist/utils/colors.d.ts +0 -5
  284. package/dist/utils/colors.js +0 -9
  285. package/dist/utils/colors.js.map +0 -1
  286. package/dist/utils/css-types.d.ts +0 -7
  287. package/dist/utils/dotize.d.ts +0 -26
  288. package/dist/utils/dotize.js +0 -122
  289. package/dist/utils/dotize.js.map +0 -1
  290. package/dist/utils/filter-base-props.d.ts +0 -15
  291. package/dist/utils/filter-base-props.js +0 -45
  292. package/dist/utils/filter-base-props.js.map +0 -1
  293. package/dist/utils/get-display-name.d.ts +0 -7
  294. package/dist/utils/get-display-name.js +0 -10
  295. package/dist/utils/get-display-name.js.map +0 -1
  296. package/dist/utils/hsl-to-rgb.js +0 -38
  297. package/dist/utils/hsl-to-rgb.js.map +0 -1
  298. package/dist/utils/is-dev-env.js +0 -19
  299. package/dist/utils/is-dev-env.js.map +0 -1
  300. package/dist/utils/is-valid-element-type.js +0 -15
  301. package/dist/utils/is-valid-element-type.js.map +0 -1
  302. package/dist/utils/merge-styles.js.map +0 -1
  303. package/dist/utils/mod-attrs.d.ts +0 -8
  304. package/dist/utils/mod-attrs.js +0 -21
  305. package/dist/utils/mod-attrs.js.map +0 -1
  306. package/dist/utils/okhsl-to-rgb.js +0 -296
  307. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  308. package/dist/utils/process-tokens.d.ts +0 -31
  309. package/dist/utils/process-tokens.js +0 -171
  310. package/dist/utils/process-tokens.js.map +0 -1
  311. package/dist/utils/resolve-recipes.d.ts +0 -17
  312. package/dist/utils/resolve-recipes.js.map +0 -1
  313. package/dist/utils/selector-transform.js +0 -32
  314. package/dist/utils/selector-transform.js.map +0 -1
  315. package/dist/utils/string.js +0 -8
  316. package/dist/utils/string.js.map +0 -1
  317. package/dist/utils/styles.d.ts +0 -177
  318. package/dist/utils/styles.js +0 -730
  319. package/dist/utils/styles.js.map +0 -1
  320. package/dist/utils/typography.d.ts +0 -36
  321. package/dist/utils/typography.js +0 -53
  322. package/dist/utils/typography.js.map +0 -1
  323. package/dist/utils/warnings.d.ts +0 -16
  324. package/dist/utils/warnings.js +0 -16
  325. package/dist/utils/warnings.js.map +0 -1
  326. package/dist/zero/css-writer.d.ts +0 -45
  327. package/dist/zero/css-writer.js +0 -74
  328. package/dist/zero/css-writer.js.map +0 -1
  329. package/dist/zero/extractor.d.ts +0 -24
  330. package/dist/zero/extractor.js.map +0 -1
  331. package/docs/usage.md +0 -695
package/docs/styles.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Style Properties Reference
2
2
 
3
- All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and custom functions. Values are parsed through the Tasty engine automatically.
3
+ All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and [custom functions](dsl.md#functions-function) (`$$negative(10px)`). Values are parsed through the Tasty engine automatically.
4
4
 
5
5
  The properties documented below have **custom handlers** with enhanced syntax. They should be **preferred** over their raw CSS equivalents because they:
6
6
 
@@ -100,18 +100,26 @@ For flex/grid layouts, outputs native `gap`. For block layouts, emulates gap usi
100
100
 
101
101
  Element padding with directional modifiers and multi-group support. Use **comma-separated groups** to set a base value and then override specific directions.
102
102
 
103
- **Syntax:** `[value]` | `[top right]` | `[top right bottom left]` | `[value directions...]` — comma-separated for multiple groups
103
+ **Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
104
104
 
105
105
  **Direction modifiers:** `top`, `right`, `bottom`, `left`
106
106
 
107
+ **Output modifier:** `longhand` — forces output as individual CSS longhand properties (`padding-top`, `padding-right`, `padding-bottom`, `padding-left`) instead of the `padding` shorthand. Useful when children need to selectively inherit individual directions.
108
+
109
+ **One value per directional group.** A group that names direction modifiers takes **exactly one** value, applied to every direction it names. For different values per side, use comma-separated groups: `padding: '2x top, 4x right'`. Writing `padding: '2x 4x top right'` ignores `4x` and warns in development — the parser keeps values and modifiers in separate buckets, so their interleaving in the source is not recoverable and `'2x 4x top right'`, `'2x top 4x right'` and `'top 2x right 4x'` are all the same input.
110
+
111
+ A group that names *no* direction keeps plain CSS shorthand order, which is unambiguous and unchanged.
112
+
107
113
  | Value | Effect |
108
114
  |-------|--------|
109
115
  | `"2x"` | All sides `2x` |
110
116
  | `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
111
117
  | `"2x top"` | Top `2x`, right/bottom/left `0` |
112
118
  | `"1x left right"` | Left and right `1x`, top/bottom `0` |
119
+ | `"2x top, 4x right"` | Top `2x`, right `4x`, bottom/left `0` |
113
120
  | `"1x, 2x top"` | All sides `1x`, then top overridden to `2x` |
114
121
  | `"1x, 2x top bottom"` | Left/right `1x`, top/bottom `2x` |
122
+ | `"2x longhand"` | All sides `2x`, output as 4 individual `padding-*` properties |
115
123
  | `true` | All sides `1x` |
116
124
  | Number | Converted to `px` |
117
125
 
@@ -125,15 +133,20 @@ Individual props `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`, `
125
133
 
126
134
  Element margin. Same syntax, modifiers, and multi-group support as `padding`.
127
135
 
128
- **Syntax:** `[value]` | `[top right]` | `[top right bottom left]` | `[value directions...]` — comma-separated for multiple groups
136
+ **Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
129
137
 
130
138
  **Direction modifiers:** `top`, `right`, `bottom`, `left`
131
139
 
140
+ **Output modifier:** `longhand` — forces output as individual CSS longhand properties (`margin-top`, etc.) instead of the `margin` shorthand.
141
+
142
+ The [one-value-per-directional-group rule](#padding) from `padding` applies here too.
143
+
132
144
  | Value | Effect |
133
145
  |-------|--------|
134
146
  | `"2x"` | All sides `2x` |
135
147
  | `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
136
148
  | `"2x top"` | Top `2x`, right/bottom/left `0` |
149
+ | `"2x top, 4x right"` | Top `2x`, right `4x`, bottom/left `0` |
137
150
  | `"auto left right, 1x top bottom"` | Left/right `auto`, top/bottom `1x` |
138
151
  | `true` | All sides `1x` |
139
152
  | Number | Converted to `px` |
@@ -146,37 +159,39 @@ Individual props `marginTop`, `marginRight`, `marginBottom`, `marginLeft`, `marg
146
159
 
147
160
  ### `width`
148
161
 
149
- Element width with min/max control.
162
+ Element width with min/max control. One, two, or three values set `min-width`, `width`, and `max-width` together.
150
163
 
151
- **Syntax:** `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
164
+ **Positional syntax:**
152
165
 
153
- **Modifiers:** `min`, `max`, `fixed`
166
+ | Value | min-width | width | max-width |
167
+ |-------|-----------|-------|-----------|
168
+ | `"10x"` | initial | `10x` | initial |
169
+ | `"1x 10x"` | `1x` | auto | `10x` |
170
+ | `"1x 5x 10x"` | `1x` | `5x` | `10x` |
171
+ | `"0 100% 800px"` | `0` | `100%` | `800px` |
172
+ | `"initial 100% 1400px"` | initial | `100%` | `1400px` |
173
+
174
+ **Modifier syntax:**
175
+
176
+ | Value | min-width | width | max-width |
177
+ |-------|-----------|-------|-----------|
178
+ | `"min 2x"` | `2x` | auto | initial |
179
+ | `"max 100%"` | initial | auto | `100%` |
180
+ | `"fixed 200px"` | `200px` | `200px` | `200px` |
154
181
 
155
182
  **Keywords:** `stretch`, `max-content`, `min-content`, `fit-content`
156
183
 
157
184
  | Value | Effect |
158
185
  |-------|--------|
159
- | `"10x"` | Width `10x`, min `initial`, max `initial` |
160
- | `"1x 10x"` | Width `auto`, min `1x`, max `10x` |
161
- | `"1x 5x 10x"` | Min `1x`, width `5x`, max `10x` |
162
- | `"min 2x"` | Min-width `2x`, width `auto`, max `initial` |
163
- | `"max 100%"` | Max-width `100%`, width `auto`, min `initial` |
164
- | `"fixed 200px"` | Min, width, and max all set to `200px` |
165
186
  | `"stretch"` | Fill available space (cross-browser) |
166
- | `true` | Width `auto`, min `initial`, max `initial` |
187
+ | `true` | Reset to `auto` / `initial` / `initial` |
167
188
  | Number | Converted to `px` |
168
189
 
169
190
  Separate `minWidth` and `maxWidth` props are supported and override values from the `width` syntax.
170
191
 
171
192
  ### `height`
172
193
 
173
- Element height. Same syntax and modifiers as `width`.
174
-
175
- **Syntax:** `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
176
-
177
- **Modifiers:** `min`, `max`, `fixed`
178
-
179
- **Keywords:** `max-content`, `min-content`, `fit-content`
194
+ Element height. Same syntax, modifiers, and positional patterns as `width`.
180
195
 
181
196
  Separate `minHeight` and `maxHeight` props are supported and override values from the `height` syntax.
182
197
 
@@ -184,17 +199,38 @@ Separate `minHeight` and `maxHeight` props are supported and override values fro
184
199
 
185
200
  Positioning offsets with directional modifiers and multi-group support. Same directional syntax as `padding`.
186
201
 
187
- **Syntax:** `[value]` | `[top right]` | `[top right bottom left]` | `[value directions...]` — comma-separated for multiple groups
202
+ **Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
188
203
 
189
204
  **Direction modifiers:** `top`, `right`, `bottom`, `left`
190
205
 
206
+ The [one-value-per-directional-group rule](#padding) from `padding` applies here too, with `dock`
207
+ as the single exception.
208
+
209
+ **`dock` modifier:** pins the named edge and spans its full length, by also applying the value
210
+ to the two perpendicular sides. `inset: 'bottom dock'` gives `inset: auto 0 0 0` — anchored to
211
+ the bottom, full width. Without a direction, `dock` fills every side.
212
+
213
+ `dock` is the one place a directional group takes **two** values: the first insets the named
214
+ edge, the second the sides it spans. `inset: '2x 4x bottom dock'` pins the bottom at `2x` and
215
+ insets the sides by `4x`. A third value, or a second value without `dock`, is ignored and warns
216
+ in development. With several directions the first value applies to each named edge and the
217
+ second to every side they span.
218
+
219
+ **Output modifier:** `longhand` — forces output as individual CSS properties (`top`, `right`, `bottom`, `left`) instead of the `inset` shorthand.
220
+
191
221
  | Value | Effect |
192
222
  |-------|--------|
193
223
  | `"0"` | All sides `0` |
194
224
  | `"2x top"` | Top `2x`, right/bottom/left `auto` |
195
225
  | `"1x left right"` | Left and right `1x`, top/bottom `auto` |
196
226
  | `"0, 2x top"` | All sides `0`, then top overridden to `2x` |
227
+ | `"0 longhand"` | All sides `0`, output as individual `top`/`right`/`bottom`/`left` |
197
228
  | `true` | All sides `0` |
229
+ | `"bottom dock"` | Bottom/left/right `0`, top `auto` — bottom-anchored, full width |
230
+ | `"right dock"` | Right/top/bottom `0`, left `auto` — right-anchored, full height |
231
+ | `"2x bottom dock"` | Bottom/left/right `2x`, top `auto` |
232
+ | `"2x 4x bottom dock"` | Bottom `2x`, left/right `4x`, top `auto` |
233
+ | `"dock"` | All sides `0` |
198
234
 
199
235
  Later comma-separated groups override earlier groups for conflicting directions.
200
236
 
@@ -218,6 +254,7 @@ Background color with design token support. Preferred over `backgroundColor` and
218
254
  | `"#purple.10"` | Token color at 10% opacity |
219
255
  | `"#surface #primary.10"` | Background `#surface` with `#primary.10` overlay (two colors enable smooth transitions between both) |
220
256
  | `"rgb(255 128 0)"` | CSS color value |
257
+ | `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
221
258
  | `true` | Default fill color |
222
259
 
223
260
  When two colors are provided, the first sets the background color and the second is applied as an overlay gradient layer. This enables independent CSS transitions on each color. The overlay is only applied when no explicit `image` or `backgroundImage` is set.
@@ -250,9 +287,17 @@ Text color with design token support.
250
287
  | `"#current"` | Current inherited color |
251
288
  | `"#current.5"` | Current inherited color at 50% opacity |
252
289
  | `"(#primary, #secondary)"` | Fallback: use `#primary`, fall back to `#secondary` |
290
+ | `"light-dark(#dark, #light)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
253
291
  | `true` | `currentColor` |
254
292
 
255
- When set to a named color token, also sets `$current-color` and `$current-color-rgb` custom properties for downstream use.
293
+ Also sets `$current-color` to the same color, for anything that needs the
294
+ inherited color as a color rather than as the `currentcolor` keyword. Every color
295
+ publishes it, not just a named token, so a reader below always takes the nearest
296
+ `color` rather than the nearest *token* color. A value that already reads the
297
+ inherited color — `#current` itself, a `#current` fade, a bare `currentColor` —
298
+ is not republished: resolving it a second time one level down would fade it
299
+ twice, and the variable into itself is a self-reference. `#current` does not go
300
+ through it; it is the keyword.
256
301
 
257
302
  ### `svgFill`
258
303
 
@@ -279,12 +324,15 @@ Border shorthand with directional and multi-group support. Use **comma-separated
279
324
 
280
325
  **Direction modifiers:** `top`, `right`, `bottom`, `left`
281
326
 
327
+ **Output modifier:** `longhand` — forces output as individual CSS properties (`border-top`, `border-right`, `border-bottom`, `border-left`) instead of the `border` shorthand. Useful when children need to selectively inherit individual sides.
328
+
282
329
  | Value | Effect |
283
330
  |-------|--------|
284
331
  | `true` | Default border (`1bw solid #border`) on all sides |
285
332
  | `"2bw dashed #purple"` | All sides: 2bw dashed purple |
286
333
  | `"2bw top"` | Top only: 2bw solid `#border`, others: 0 |
287
334
  | `"dotted #danger left right"` | Left/right: 1bw dotted `#danger`, others: 0 |
335
+ | `"1bw longhand"` | All sides: 1bw solid `#border`, output as 4 individual `border-*` properties |
288
336
  | `"1bw #red, 2bw #blue top"` | All sides: 1bw solid `#red`, top overridden to 2bw solid `#blue` |
289
337
  | `"1bw, dashed top bottom, #purple left right"` | Base: 1bw solid `#border`, top/bottom: 1bw dashed `#border`, left/right: 1bw solid `#purple` |
290
338
 
@@ -304,8 +352,15 @@ Border radius with shape presets and directional modifiers.
304
352
  | `"ellipse"` | Circular (`50%`) |
305
353
  | `"leaf"` | Asymmetric: sharp, round, sharp, round |
306
354
  | `"backleaf"` | Asymmetric: round, sharp, round, sharp |
355
+ | `"inherit"` | Inherit border-radius from parent |
307
356
 
308
- **Direction modifiers:** `top`, `right`, `bottom`, `left` — rounds only the specified corners.
357
+ **Edge modifiers:** `top`, `right`, `bottom`, `left` — rounds the *pair* of corners along that edge.
358
+
359
+ **Corner modifiers:** `top-left`, `top-right`, `bottom-right`, `bottom-left` — rounds a single corner.
360
+ Use these when an edge modifier would round one corner too many. Edge and corner modifiers combine
361
+ (`radius: 'top bottom-right'`).
362
+
363
+ **Output modifier:** `longhand` — forces output as individual CSS longhand properties (`border-top-left-radius`, `border-top-right-radius`, `border-bottom-right-radius`, `border-bottom-left-radius`) instead of the `border-radius` shorthand. Useful when children need to selectively inherit individual corners via `radius: 'inherit left'`.
309
364
 
310
365
  | Value | Effect |
311
366
  |-------|--------|
@@ -315,6 +370,12 @@ Border radius with shape presets and directional modifiers.
315
370
  | `"1r top"` | Top-left and top-right `1r`, bottom-left and bottom-right `0` |
316
371
  | `"leaf"` | Alternating sharp/round corners (top-left `0`, top-right `1r`, bottom-right `0`, bottom-left `1r`) |
317
372
  | `"backleaf"` | Inverse leaf (top-left `1r`, top-right `0`, bottom-right `1r`, bottom-left `0`) |
373
+ | `"1r longhand"` | All corners `1r`, output as 4 individual `border-*-radius` properties |
374
+ | `"inherit"` | All corners inherit from parent (`border-radius: inherit`) |
375
+ | `"inherit right"` | Right corners inherit from parent (uses longhand properties) |
376
+ | `"top-right"` | Top-right corner `1r`, every other corner `0` |
377
+ | `"4px top-left"` | Top-left corner `4px`, every other corner `0` |
378
+ | `"top bottom-right"` | Both top corners and bottom-right `1r`, bottom-left `0` |
318
379
 
319
380
  ### `outline`
320
381
 
@@ -344,7 +405,7 @@ Box shadow. Supports multiple shadows comma-separated.
344
405
 
345
406
  | Value | Effect |
346
407
  |-------|--------|
347
- | `true` | Default shadow (from `$shadow` token) |
408
+ | `true` | Default shadow (uses `var(--shadow)` — define a `$shadow` token in your design system) |
348
409
  | `"1x .5x .5x #dark.50"` | Custom shadow with Tasty units/colors |
349
410
  | `"0 1x 2x #dark.20"` | Standard shadow |
350
411
  | `"inset 0 1x 2x #dark.10"` | Inset shadow |
@@ -359,24 +420,29 @@ Multiple shadows: `shadow="1x 1x 2x #dark.20, inset 0 0 4x #dark.10"`
359
420
 
360
421
  Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style, and text-transform from named design tokens.
361
422
 
362
- **Syntax:** `[name] [modifiers...]`
423
+ **Syntax:** `name`, `name / modifier...`, or `modifier...` (shorthand)
363
424
 
364
425
  Preset names are project-specific (e.g. `h1`–`h6`, `t1`–`t4`, `p1`–`p4`). Register them for autocomplete by augmenting `TastyPresetNames`.
365
426
 
427
+ Use `/` to separate the preset name from one or more space-separated modifiers. When modifiers are used alone (without a name), the preset name defaults to `inherit`. Modifiers can be combined freely because they target different properties.
428
+
366
429
  **Modifiers:**
367
430
 
368
431
  | Modifier | Effect |
369
432
  |----------|--------|
370
- | `strong` | Sets `font-weight` to bold (from `$bold-font-weight` token) |
433
+ | `strong` (or `bold`) | Sets `font-weight` to bold (from `$bold-font-weight` token) |
371
434
  | `italic` | Sets `font-style: italic` |
372
435
  | `icon` | Sets font-size and line-height to icon size |
373
436
  | `tight` | Sets line-height equal to font-size |
374
437
 
375
438
  ```jsx
376
- preset="h1" // heading 1
377
- preset="h2 strong" // bold heading 2
378
- preset="t3 italic" // italic text 3
379
- preset="t2 tight" // text 2 with tight line-height
439
+ preset="h1" // heading 1
440
+ preset="h2 / strong" // bold heading 2
441
+ preset="h2 / strong italic" // bold + italic heading 2
442
+ preset="t3 / italic" // italic text 3
443
+ preset="t2 / strong tight" // bold text 2 with tight line-height
444
+ preset="bold" // inherit preset with bold (shorthand)
445
+ preset="bold italic" // inherit preset with bold + italic (shorthand)
380
446
  ```
381
447
 
382
448
  Individual typography props (`fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform`) can be used alongside `preset` to override specific values, but using `preset` alone is recommended.
@@ -511,7 +577,7 @@ Scrollbar styling using CSS standard properties (`scrollbar-width`, `scrollbar-c
511
577
 
512
578
  **Colors:** Up to 2 color values for thumb and track (optional), applied via `scrollbar-color`.
513
579
 
514
- **Defaults:** When no colors are specified, the thumb color comes from the `#scrollbar-thumb` token (`#text.5`) and the track color from the `#scrollbar-track` token (`#dark-bg`). These tokens are provided by the base token set. If the base tokens are not loaded, the track falls back to `transparent` via a CSS fallback, while the thumb has no CSS-level fallback — the browser treats the entire `scrollbar-color` declaration as invalid and reverts to the platform-default scrollbar appearance.
580
+ **Defaults:** When no colors are specified, the thumb color comes from `var(--scrollbar-thumb-color)` and the track color from `var(--scrollbar-track-color, transparent)`. These are not built-in — your design system should define `#scrollbar-thumb` and `#scrollbar-track` tokens (e.g. `'#text.5'` and `'#dark-bg'`). If neither token is defined, the track falls back to `transparent` via a CSS fallback, while the thumb has no CSS-level fallback — the browser treats the entire `scrollbar-color` declaration as invalid and reverts to the platform-default scrollbar appearance.
515
581
 
516
582
  **Note:** `none` takes precedence over all other modifiers and colors. Combining `none` with other tokens (e.g., `"none always #red"`) produces a warning, and only `scrollbar-width: none` is applied.
517
583
 
@@ -528,15 +594,20 @@ Scrollbar styling using CSS standard properties (`scrollbar-width`, `scrollbar-c
528
594
 
529
595
  Gradient-based edge fading using CSS masks. Use **comma-separated groups** to set different widths and colors per direction.
530
596
 
531
- **Syntax:** `[width] [directions...] [#from-color] [#to-color]` — comma-separated for multiple groups
597
+ **Syntax:** `[width] [direction...] [#from-color] [#to-color]` — comma-separated for multiple groups
532
598
 
533
599
  **Direction modifiers:** `top`, `right`, `bottom`, `left`
534
600
 
601
+ A group that names edges takes a **single** width, applied to every edge it names — different
602
+ widths per edge come from comma groups. A group that names no edge covers all four and keeps
603
+ plain CSS shorthand order, like `padding`. See the [`padding` rule](#padding).
604
+
535
605
  | Value | Effect |
536
606
  |-------|--------|
537
607
  | `"top"` | Fade top edge, default width (`2x`), all other edges unfaded |
538
608
  | `"2x left right"` | Fade left and right edges with `2x` width, top/bottom unfaded |
539
- | `"3x 1x top bottom"` | Fade top with `3x` width, bottom with `1x` width |
609
+ | `"3x 1x"` | All edges faded — top/bottom `3x`, left/right `1x` (CSS shorthand order) |
610
+ | `"3x top, 1x bottom"` | Fade top with `3x` width, bottom with `1x` width |
540
611
  | `"2x #transparent #dark"` | All edges faded with `2x` width, from `#transparent` to `#dark` |
541
612
  | `"top #a #b, bottom #c #d"` | Top fades from `#a` to `#b`, bottom fades from `#c` to `#d` |
542
613
 
@@ -1,6 +1,6 @@
1
1
  # Zero Runtime Mode (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.
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).
4
4
 
5
5
  ---
6
6
 
@@ -11,9 +11,30 @@
11
11
  - **Performance-critical pages** — Zero runtime overhead for styling
12
12
  - **Landing pages** — Minimal bundle size with pre-generated CSS
13
13
 
14
- ## Quick Start
14
+ ## Requirements
15
+
16
+ The zero-runtime mode is part of the main `@tenphi/tasty` package but requires additional peer dependencies depending on your setup:
17
+
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/zero/next`) when using `configFile` option |
24
+
25
+ All of these are declared as optional peer dependencies of `@tenphi/tasty`. Install only what your setup requires:
26
+
27
+ ```bash
28
+ # For any Babel-based setup (Vite, custom Babel config, etc.)
29
+ pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types
30
+
31
+ # For Next.js with TypeScript config file
32
+ pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types jiti
33
+ ```
34
+
35
+ ---
15
36
 
16
- The zero-runtime mode is part of the main `@tenphi/tasty` package. No additional packages required.
37
+ ## Quick Start
17
38
 
18
39
  ### Basic Usage
19
40
 
@@ -109,6 +130,8 @@ module.exports = {
109
130
  };
110
131
  ```
111
132
 
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.
134
+
112
135
  ### With Configuration
113
136
 
114
137
  ```javascript
@@ -120,7 +143,7 @@ module.exports = {
120
143
  states: {
121
144
  '@mobile': '@media(w < 768px)',
122
145
  '@tablet': '@media(w < 1024px)',
123
- '@dark': '@root(theme=dark)',
146
+ '@dark': '@root(schema=dark)',
124
147
  },
125
148
  devMode: true,
126
149
  },
@@ -134,9 +157,43 @@ module.exports = {
134
157
  | Option | Type | Default | Description |
135
158
  |--------|------|---------|-------------|
136
159
  | `output` | `string` | `'tasty.css'` | Path for generated CSS file |
137
- | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases |
160
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS (see [Inject Mode](#inject-mode)) |
161
+ | `configFile` | `string` | — | Absolute path to a TS/JS module that default-exports a `TastyZeroConfig` object. JSON-serializable alternative to `config` — required for Turbopack. |
162
+ | `config` | `TastyZeroConfig \| () => TastyZeroConfig` | `{}` | Inline config object or factory function. Takes precedence over `configFile`. |
163
+ | `configDeps` | `string[]` | `[]` | Absolute file paths that affect config (for cache invalidation) |
164
+ | `injectImport` | `boolean` | `true` | Replace `@tenphi/tasty/static` imports with an import of the generated CSS file. Set to `false` to manage CSS imports manually. |
165
+ | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases (e.g. `{ '@mobile': '@media(w < 768px)' }`) |
138
166
  | `config.devMode` | `boolean` | `false` | Add source comments to CSS |
167
+ | `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. |
168
+ | `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
139
169
  | `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
170
+ | `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
171
+ | `config.fontFaces` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
172
+ | `config.counterStyles` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
173
+ | `config.units` | `Record<string, string \| UnitHandler>` | — | Custom units for the style parser (merged with built-ins). E.g. `{ em: 'em', vw: 'vw' }` |
174
+ | `config.functions` | `Record<string, FunctionDefinition \| Function>` | — | Custom functions (merged). Bare keys → parse functions; `$$name` keys → declarative CSS `@function` definitions |
175
+ | `config.polyfills` | `{ functions?: boolean }` | `{}` | Opt-in polyfills. `functions: true` inlines `@function` calls into plain CSS at build time |
176
+ | `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
177
+ | `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
178
+ | `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
179
+ | `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
180
+ | `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
181
+ | `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
182
+ | `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). |
183
+
184
+ ### Coexisting with runtime tasty
185
+
186
+ When a page mixes `tastyStatic` with runtime `tasty`, both must use **different** `namePrefix` values. The defaults handle this automatically (`'t'` for runtime, `'ts'` for zero-runtime). If you customize one, customize the other:
187
+
188
+ ```ts
189
+ // tasty-zero.config.ts (Babel plugin)
190
+ export default { namePrefix: 'mbs' };
191
+ ```
192
+
193
+ ```ts
194
+ // app entry (runtime configure)
195
+ configure({ namePrefix: 'mb' });
196
+ ```
140
197
 
141
198
  ---
142
199
 
@@ -176,31 +233,52 @@ const card = tastyStatic({
176
233
 
177
234
  ## Next.js Integration
178
235
 
179
- ```javascript
180
- // next.config.js
181
- const { withTastyZero } = require('@tenphi/tasty/next');
236
+ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automatically. No `--webpack` flag is needed — it works with whichever bundler Next.js uses.
182
237
 
183
- module.exports = withTastyZero({
238
+ ```typescript
239
+ // next.config.ts
240
+ import { withTastyZero } from '@tenphi/tasty/zero/next';
241
+
242
+ export default withTastyZero({
184
243
  output: 'public/tasty.css',
185
- config: {
186
- states: {
187
- '@mobile': '@media(w < 768px)',
188
- },
189
- devMode: process.env.NODE_ENV === 'development',
190
- },
244
+ configFile: './app/tasty-zero.config.ts',
245
+ configDeps: ['./app/theme.ts'],
191
246
  })({
192
247
  reactStrictMode: true,
193
248
  });
194
249
  ```
195
250
 
196
- ### Including the CSS
251
+ ### `withTastyZero` Options
197
252
 
198
- ```tsx
199
- // app/layout.tsx (App Router)
200
- import '@/public/tasty.css';
253
+ | Option | Type | Default | Description |
254
+ |--------|------|---------|-------------|
255
+ | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
256
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
257
+ | `enabled` | `boolean` | `true` | Enable/disable the plugin |
258
+ | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
259
+ | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
260
+ | `configDeps` | `string[]` | `[]` | Extra files the config depends on (for cache invalidation) |
261
+
262
+ ### Turbopack Support
263
+
264
+ 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.
201
265
 
202
- // or pages/_app.tsx (Pages Router)
203
- import '../public/tasty.css';
266
+ 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.
267
+
268
+ **Requirements**: `babel-loader` must be installed in your project:
269
+
270
+ ```bash
271
+ pnpm add babel-loader
272
+ ```
273
+
274
+ ### CSS Injection
275
+
276
+ `withTastyZero` automatically injects the generated CSS into your app. Every file that imports from `@tenphi/tasty/static` gets its import replaced with an import of the output CSS file at build time. No manual CSS import is needed.
277
+
278
+ The generated CSS file (e.g. `public/tasty.css`) is created as an empty stub before the first build if it doesn't exist, so there's no chicken-and-egg problem with fresh clones or CI builds. Add it to `.gitignore`:
279
+
280
+ ```gitignore
281
+ public/tasty.css
204
282
  ```
205
283
 
206
284
  ---
@@ -285,6 +363,91 @@ export const Button = () => <button className={button}>Click</button>;
285
363
 
286
364
  ---
287
365
 
366
+ ## Inject Mode
367
+
368
+ 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.
369
+
370
+ This is ideal for **reusable components**, **extensions**, and **libraries** where consumers shouldn't need to manage an external CSS file.
371
+
372
+ ### How It Works
373
+
374
+ 1. The Babel plugin extracts CSS at build time (same pipeline as file mode).
375
+ 2. Instead of writing to a `.css` file, the CSS is embedded as string literals in the JS output.
376
+ 3. The `@tenphi/tasty/static` import is rewritten to `@tenphi/tasty/static/inject`.
377
+ 4. Each `tastyStatic` call becomes a self-contained expression that injects its CSS and evaluates to a `StaticStyle` object.
378
+
379
+ ### Configuration
380
+
381
+ ```javascript
382
+ // babel.config.js
383
+ module.exports = {
384
+ plugins: [
385
+ ['@tenphi/tasty/babel-plugin', {
386
+ mode: 'inject',
387
+ config: {
388
+ states: { '@mobile': '@media(w < 768px)' },
389
+ },
390
+ }]
391
+ ]
392
+ };
393
+ ```
394
+
395
+ With Next.js:
396
+
397
+ ```typescript
398
+ // next.config.ts
399
+ import { withTastyZero } from '@tenphi/tasty/zero/next';
400
+
401
+ export default withTastyZero({
402
+ mode: 'inject',
403
+ configFile: './app/tasty-zero.config.ts',
404
+ })({
405
+ reactStrictMode: true,
406
+ });
407
+ ```
408
+
409
+ When `mode` is `'inject'`, the `output` and `injectImport` options are ignored.
410
+
411
+ ### Build Transformation (inject mode)
412
+
413
+ **Before:**
414
+
415
+ ```tsx
416
+ import { tastyStatic } from '@tenphi/tasty/static';
417
+
418
+ const button = tastyStatic({
419
+ padding: '2x 4x',
420
+ fill: '#purple',
421
+ });
422
+
423
+ tastyStatic('.heading', { preset: 'h1' });
424
+ ```
425
+
426
+ **After:**
427
+
428
+ ```tsx
429
+ import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
430
+
431
+ const button = (_$i("ts3f2a1b ts8c4d2e", ".ts3f2a1b.ts3f2a1b{padding:16px 32px}\n.ts8c4d2e.ts8c4d2e{background:#9370db}"), {
432
+ className: 'ts3f2a1b ts8c4d2e',
433
+ styles: { padding: '2x 4x', fill: '#purple' },
434
+ toString() { return this.className; }
435
+ });
436
+
437
+ _$i(".heading", ".heading{font-size:2.5rem;font-weight:700;line-height:1.2}");
438
+ ```
439
+
440
+ ### Dev Mode / HMR
441
+
442
+ 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.
443
+
444
+ ### Limitations (inject mode)
445
+
446
+ - **Client-side only** — Styles are injected via the DOM, so they are not available during SSR. For server-rendered apps, use `mode: 'file'` or the runtime `tasty()`.
447
+ - **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
448
+
449
+ ---
450
+
288
451
  ## Style Extension
289
452
 
290
453
  ```tsx
@@ -366,11 +529,21 @@ const card = tastyStatic({
366
529
  2. **Use selector mode** for global/body styles
367
530
  3. **Enable devMode** in development for easier debugging
368
531
  4. **Configure states** for consistent responsive breakpoints
369
- 5. **Import generated CSS** early in your app entry point
532
+
533
+ ---
534
+
535
+ ## Common Issues
536
+
537
+ - 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.
538
+ - 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()`.
539
+ - Turbopack config behaves inconsistently: prefer `configFile` over inline functions so the setup stays JSON-serializable.
370
540
 
371
541
  ---
372
542
 
373
543
  ## Related
374
544
 
375
- - [Usage Guide](usage.md) — Runtime styling: component creation, state mappings, sub-elements, variants, and hooks
545
+ - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
546
+ - [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
547
+ - [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
376
548
  - [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
549
+ - [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)