@tenphi/tasty 0.0.0-snapshot.c8bdaeb → 0.0.0-snapshot.cae4fee

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 (303) hide show
  1. package/README.md +314 -159
  2. package/dist/async-storage-B7_o6FKt.js +44 -0
  3. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  4. package/dist/collector-C-keQH9m.js +243 -0
  5. package/dist/collector-C-keQH9m.js.map +1 -0
  6. package/dist/collector-osfWTeRd.d.ts +108 -0
  7. package/dist/config-BBiyxMCe.js +10559 -0
  8. package/dist/config-BBiyxMCe.js.map +1 -0
  9. package/dist/config-BoZDUHW5.d.ts +945 -0
  10. package/dist/context-CkSg-kDT.js +24 -0
  11. package/dist/context-CkSg-kDT.js.map +1 -0
  12. package/dist/core/index.d.ts +5 -33
  13. package/dist/core/index.js +6 -26
  14. package/dist/core-BO4319td.js +1598 -0
  15. package/dist/core-BO4319td.js.map +1 -0
  16. package/dist/css-writer-BWvwQzz0.js +351 -0
  17. package/dist/css-writer-BWvwQzz0.js.map +1 -0
  18. package/dist/format-global-rules-Dbc_1tc3.js +22 -0
  19. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  20. package/dist/format-rules-BSjeH4Z7.js +143 -0
  21. package/dist/format-rules-BSjeH4Z7.js.map +1 -0
  22. package/dist/hydrate-CcvrP4qJ.js +45 -0
  23. package/dist/hydrate-CcvrP4qJ.js.map +1 -0
  24. package/dist/index-B_k47mc_.d.ts +1655 -0
  25. package/dist/index-tcHuMPFt.d.ts +1286 -0
  26. package/dist/index.d.ts +5 -48
  27. package/dist/index.js +731 -32
  28. package/dist/index.js.map +1 -0
  29. package/dist/keyframes-BUQhdOSJ.js +588 -0
  30. package/dist/keyframes-BUQhdOSJ.js.map +1 -0
  31. package/dist/{utils/merge-styles.d.ts → merge-styles-BMWcH6MF.d.ts} +3 -3
  32. package/dist/{utils/merge-styles.js → merge-styles-Cd2vBl9b.js} +4 -6
  33. package/dist/merge-styles-Cd2vBl9b.js.map +1 -0
  34. package/dist/{utils/resolve-recipes.js → resolve-recipes-C1nrvnYh.js} +5 -8
  35. package/dist/resolve-recipes-C1nrvnYh.js.map +1 -0
  36. package/dist/ssr/astro-client.d.ts +1 -0
  37. package/dist/ssr/astro-client.js +19 -0
  38. package/dist/ssr/astro-client.js.map +1 -0
  39. package/dist/ssr/astro-middleware.d.ts +15 -0
  40. package/dist/ssr/astro-middleware.js +19 -0
  41. package/dist/ssr/astro-middleware.js.map +1 -0
  42. package/dist/ssr/astro.d.ts +97 -0
  43. package/dist/ssr/astro.js +149 -0
  44. package/dist/ssr/astro.js.map +1 -0
  45. package/dist/ssr/index.d.ts +44 -0
  46. package/dist/ssr/index.js +10 -0
  47. package/dist/ssr/index.js.map +1 -0
  48. package/dist/ssr/next.d.ts +46 -0
  49. package/dist/ssr/next.js +75 -0
  50. package/dist/ssr/next.js.map +1 -0
  51. package/dist/static/index.d.ts +91 -5
  52. package/dist/static/index.js +49 -4
  53. package/dist/static/index.js.map +1 -0
  54. package/dist/static/inject.d.ts +5 -0
  55. package/dist/static/inject.js +17 -0
  56. package/dist/static/inject.js.map +1 -0
  57. package/dist/zero/babel.d.ts +57 -84
  58. package/dist/zero/babel.js +232 -40
  59. package/dist/zero/babel.js.map +1 -1
  60. package/dist/zero/index.d.ts +67 -3
  61. package/dist/zero/index.js +2 -4
  62. package/dist/zero/next.d.ts +56 -30
  63. package/dist/zero/next.js +105 -40
  64. package/dist/zero/next.js.map +1 -1
  65. package/docs/README.md +31 -0
  66. package/docs/adoption.md +298 -0
  67. package/docs/comparison.md +419 -0
  68. package/docs/configuration.md +438 -0
  69. package/docs/debug.md +320 -0
  70. package/docs/design-system.md +436 -0
  71. package/docs/dsl.md +690 -0
  72. package/docs/getting-started.md +217 -0
  73. package/docs/injector.md +544 -0
  74. package/docs/methodology.md +642 -0
  75. package/docs/pipeline.md +699 -0
  76. package/docs/react-api.md +581 -0
  77. package/docs/ssr.md +444 -0
  78. package/docs/styles.md +598 -0
  79. package/docs/tasty-static.md +547 -0
  80. package/package.json +70 -37
  81. package/tasty.config.ts +1 -0
  82. package/dist/_virtual/_rolldown/runtime.js +0 -8
  83. package/dist/chunks/cacheKey.js +0 -70
  84. package/dist/chunks/cacheKey.js.map +0 -1
  85. package/dist/chunks/definitions.d.ts +0 -37
  86. package/dist/chunks/definitions.js +0 -260
  87. package/dist/chunks/definitions.js.map +0 -1
  88. package/dist/chunks/renderChunk.js +0 -61
  89. package/dist/chunks/renderChunk.js.map +0 -1
  90. package/dist/config.d.ts +0 -280
  91. package/dist/config.js +0 -403
  92. package/dist/config.js.map +0 -1
  93. package/dist/debug.d.ts +0 -204
  94. package/dist/debug.js +0 -733
  95. package/dist/debug.js.map +0 -1
  96. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  97. package/dist/hooks/useGlobalStyles.js +0 -56
  98. package/dist/hooks/useGlobalStyles.js.map +0 -1
  99. package/dist/hooks/useKeyframes.d.ts +0 -56
  100. package/dist/hooks/useKeyframes.js +0 -54
  101. package/dist/hooks/useKeyframes.js.map +0 -1
  102. package/dist/hooks/useProperty.d.ts +0 -79
  103. package/dist/hooks/useProperty.js +0 -91
  104. package/dist/hooks/useProperty.js.map +0 -1
  105. package/dist/hooks/useRawCSS.d.ts +0 -53
  106. package/dist/hooks/useRawCSS.js +0 -28
  107. package/dist/hooks/useRawCSS.js.map +0 -1
  108. package/dist/hooks/useStyles.d.ts +0 -40
  109. package/dist/hooks/useStyles.js +0 -169
  110. package/dist/hooks/useStyles.js.map +0 -1
  111. package/dist/injector/index.d.ts +0 -157
  112. package/dist/injector/index.js +0 -154
  113. package/dist/injector/index.js.map +0 -1
  114. package/dist/injector/injector.d.ts +0 -139
  115. package/dist/injector/injector.js +0 -404
  116. package/dist/injector/injector.js.map +0 -1
  117. package/dist/injector/sheet-manager.d.ts +0 -127
  118. package/dist/injector/sheet-manager.js +0 -714
  119. package/dist/injector/sheet-manager.js.map +0 -1
  120. package/dist/injector/types.d.ts +0 -135
  121. package/dist/keyframes/index.js +0 -206
  122. package/dist/keyframes/index.js.map +0 -1
  123. package/dist/parser/classify.js +0 -319
  124. package/dist/parser/classify.js.map +0 -1
  125. package/dist/parser/const.js +0 -33
  126. package/dist/parser/const.js.map +0 -1
  127. package/dist/parser/lru.js +0 -109
  128. package/dist/parser/lru.js.map +0 -1
  129. package/dist/parser/parser.d.ts +0 -25
  130. package/dist/parser/parser.js +0 -116
  131. package/dist/parser/parser.js.map +0 -1
  132. package/dist/parser/tokenizer.js +0 -69
  133. package/dist/parser/tokenizer.js.map +0 -1
  134. package/dist/parser/types.d.ts +0 -51
  135. package/dist/parser/types.js +0 -46
  136. package/dist/parser/types.js.map +0 -1
  137. package/dist/pipeline/conditions.d.ts +0 -134
  138. package/dist/pipeline/conditions.js +0 -406
  139. package/dist/pipeline/conditions.js.map +0 -1
  140. package/dist/pipeline/exclusive.js +0 -231
  141. package/dist/pipeline/exclusive.js.map +0 -1
  142. package/dist/pipeline/index.d.ts +0 -53
  143. package/dist/pipeline/index.js +0 -660
  144. package/dist/pipeline/index.js.map +0 -1
  145. package/dist/pipeline/materialize.js +0 -844
  146. package/dist/pipeline/materialize.js.map +0 -1
  147. package/dist/pipeline/parseStateKey.d.ts +0 -15
  148. package/dist/pipeline/parseStateKey.js +0 -438
  149. package/dist/pipeline/parseStateKey.js.map +0 -1
  150. package/dist/pipeline/simplify.js +0 -516
  151. package/dist/pipeline/simplify.js.map +0 -1
  152. package/dist/pipeline/warnings.js +0 -18
  153. package/dist/pipeline/warnings.js.map +0 -1
  154. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  155. package/dist/plugins/okhsl-plugin.js +0 -371
  156. package/dist/plugins/okhsl-plugin.js.map +0 -1
  157. package/dist/plugins/types.d.ts +0 -69
  158. package/dist/properties/index.js +0 -158
  159. package/dist/properties/index.js.map +0 -1
  160. package/dist/states/index.d.ts +0 -49
  161. package/dist/states/index.js +0 -416
  162. package/dist/states/index.js.map +0 -1
  163. package/dist/static/tastyStatic.d.ts +0 -46
  164. package/dist/static/tastyStatic.js +0 -31
  165. package/dist/static/tastyStatic.js.map +0 -1
  166. package/dist/static/types.d.ts +0 -49
  167. package/dist/static/types.js +0 -24
  168. package/dist/static/types.js.map +0 -1
  169. package/dist/styles/align.d.ts +0 -15
  170. package/dist/styles/align.js +0 -14
  171. package/dist/styles/align.js.map +0 -1
  172. package/dist/styles/border.d.ts +0 -25
  173. package/dist/styles/border.js +0 -114
  174. package/dist/styles/border.js.map +0 -1
  175. package/dist/styles/color.d.ts +0 -14
  176. package/dist/styles/color.js +0 -23
  177. package/dist/styles/color.js.map +0 -1
  178. package/dist/styles/createStyle.js +0 -77
  179. package/dist/styles/createStyle.js.map +0 -1
  180. package/dist/styles/dimension.js +0 -97
  181. package/dist/styles/dimension.js.map +0 -1
  182. package/dist/styles/display.d.ts +0 -37
  183. package/dist/styles/display.js +0 -67
  184. package/dist/styles/display.js.map +0 -1
  185. package/dist/styles/fade.d.ts +0 -15
  186. package/dist/styles/fade.js +0 -58
  187. package/dist/styles/fade.js.map +0 -1
  188. package/dist/styles/fill.d.ts +0 -42
  189. package/dist/styles/fill.js +0 -51
  190. package/dist/styles/fill.js.map +0 -1
  191. package/dist/styles/flow.d.ts +0 -16
  192. package/dist/styles/flow.js +0 -12
  193. package/dist/styles/flow.js.map +0 -1
  194. package/dist/styles/gap.d.ts +0 -31
  195. package/dist/styles/gap.js +0 -37
  196. package/dist/styles/gap.js.map +0 -1
  197. package/dist/styles/height.d.ts +0 -17
  198. package/dist/styles/height.js +0 -20
  199. package/dist/styles/height.js.map +0 -1
  200. package/dist/styles/index.d.ts +0 -2
  201. package/dist/styles/index.js +0 -9
  202. package/dist/styles/index.js.map +0 -1
  203. package/dist/styles/inset.d.ts +0 -52
  204. package/dist/styles/inset.js +0 -150
  205. package/dist/styles/inset.js.map +0 -1
  206. package/dist/styles/justify.d.ts +0 -15
  207. package/dist/styles/justify.js +0 -14
  208. package/dist/styles/justify.js.map +0 -1
  209. package/dist/styles/list.d.ts +0 -16
  210. package/dist/styles/list.js +0 -98
  211. package/dist/styles/list.js.map +0 -1
  212. package/dist/styles/margin.d.ts +0 -24
  213. package/dist/styles/margin.js +0 -104
  214. package/dist/styles/margin.js.map +0 -1
  215. package/dist/styles/outline.d.ts +0 -29
  216. package/dist/styles/outline.js +0 -65
  217. package/dist/styles/outline.js.map +0 -1
  218. package/dist/styles/padding.d.ts +0 -24
  219. package/dist/styles/padding.js +0 -104
  220. package/dist/styles/padding.js.map +0 -1
  221. package/dist/styles/predefined.d.ts +0 -73
  222. package/dist/styles/predefined.js +0 -241
  223. package/dist/styles/predefined.js.map +0 -1
  224. package/dist/styles/preset.d.ts +0 -47
  225. package/dist/styles/preset.js +0 -126
  226. package/dist/styles/preset.js.map +0 -1
  227. package/dist/styles/radius.d.ts +0 -14
  228. package/dist/styles/radius.js +0 -51
  229. package/dist/styles/radius.js.map +0 -1
  230. package/dist/styles/scrollbar.d.ts +0 -21
  231. package/dist/styles/scrollbar.js +0 -112
  232. package/dist/styles/scrollbar.js.map +0 -1
  233. package/dist/styles/shadow.d.ts +0 -14
  234. package/dist/styles/shadow.js +0 -24
  235. package/dist/styles/shadow.js.map +0 -1
  236. package/dist/styles/styledScrollbar.d.ts +0 -47
  237. package/dist/styles/styledScrollbar.js +0 -38
  238. package/dist/styles/styledScrollbar.js.map +0 -1
  239. package/dist/styles/transition.d.ts +0 -14
  240. package/dist/styles/transition.js +0 -158
  241. package/dist/styles/transition.js.map +0 -1
  242. package/dist/styles/types.d.ts +0 -498
  243. package/dist/styles/width.d.ts +0 -17
  244. package/dist/styles/width.js +0 -20
  245. package/dist/styles/width.js.map +0 -1
  246. package/dist/tasty.d.ts +0 -982
  247. package/dist/tasty.js +0 -206
  248. package/dist/tasty.js.map +0 -1
  249. package/dist/tokens/typography.d.ts +0 -19
  250. package/dist/tokens/typography.js +0 -237
  251. package/dist/tokens/typography.js.map +0 -1
  252. package/dist/types.d.ts +0 -184
  253. package/dist/utils/cache-wrapper.js +0 -26
  254. package/dist/utils/cache-wrapper.js.map +0 -1
  255. package/dist/utils/case-converter.js +0 -8
  256. package/dist/utils/case-converter.js.map +0 -1
  257. package/dist/utils/colors.d.ts +0 -5
  258. package/dist/utils/colors.js +0 -9
  259. package/dist/utils/colors.js.map +0 -1
  260. package/dist/utils/css-types.d.ts +0 -7
  261. package/dist/utils/dotize.d.ts +0 -26
  262. package/dist/utils/dotize.js +0 -122
  263. package/dist/utils/dotize.js.map +0 -1
  264. package/dist/utils/filter-base-props.d.ts +0 -15
  265. package/dist/utils/filter-base-props.js +0 -45
  266. package/dist/utils/filter-base-props.js.map +0 -1
  267. package/dist/utils/get-display-name.d.ts +0 -7
  268. package/dist/utils/get-display-name.js +0 -10
  269. package/dist/utils/get-display-name.js.map +0 -1
  270. package/dist/utils/hsl-to-rgb.js +0 -38
  271. package/dist/utils/hsl-to-rgb.js.map +0 -1
  272. package/dist/utils/is-dev-env.js +0 -19
  273. package/dist/utils/is-dev-env.js.map +0 -1
  274. package/dist/utils/is-valid-element-type.js +0 -15
  275. package/dist/utils/is-valid-element-type.js.map +0 -1
  276. package/dist/utils/merge-styles.js.map +0 -1
  277. package/dist/utils/mod-attrs.d.ts +0 -8
  278. package/dist/utils/mod-attrs.js +0 -21
  279. package/dist/utils/mod-attrs.js.map +0 -1
  280. package/dist/utils/okhsl-to-rgb.js +0 -296
  281. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  282. package/dist/utils/process-tokens.d.ts +0 -31
  283. package/dist/utils/process-tokens.js +0 -171
  284. package/dist/utils/process-tokens.js.map +0 -1
  285. package/dist/utils/resolve-recipes.d.ts +0 -17
  286. package/dist/utils/resolve-recipes.js.map +0 -1
  287. package/dist/utils/string.js +0 -8
  288. package/dist/utils/string.js.map +0 -1
  289. package/dist/utils/styles.d.ts +0 -178
  290. package/dist/utils/styles.js +0 -590
  291. package/dist/utils/styles.js.map +0 -1
  292. package/dist/utils/typography.d.ts +0 -36
  293. package/dist/utils/typography.js +0 -53
  294. package/dist/utils/typography.js.map +0 -1
  295. package/dist/utils/warnings.d.ts +0 -16
  296. package/dist/utils/warnings.js +0 -16
  297. package/dist/utils/warnings.js.map +0 -1
  298. package/dist/zero/css-writer.d.ts +0 -45
  299. package/dist/zero/css-writer.js +0 -74
  300. package/dist/zero/css-writer.js.map +0 -1
  301. package/dist/zero/extractor.d.ts +0 -24
  302. package/dist/zero/extractor.js +0 -150
  303. package/dist/zero/extractor.js.map +0 -1
@@ -0,0 +1,547 @@
1
+ # Zero Runtime Mode (tastyStatic)
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).
4
+
5
+ ---
6
+
7
+ ## When to Use
8
+
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
13
+
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/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
+ ---
36
+
37
+ ## Quick Start
38
+
39
+ ### Basic Usage
40
+
41
+ ```tsx
42
+ import { tastyStatic } from '@tenphi/tasty/static';
43
+
44
+ // Define styles - returns StaticStyle object
45
+ const button = tastyStatic({
46
+ display: 'inline-flex',
47
+ padding: '2x 4x',
48
+ fill: '#purple',
49
+ color: '#white',
50
+ radius: '1r',
51
+ });
52
+
53
+ // Use in JSX - works via toString() coercion
54
+ <button className={button}>Click me</button>
55
+
56
+ // Or access className explicitly
57
+ <button className={button.className}>Click me</button>
58
+ ```
59
+
60
+ ---
61
+
62
+ ## API Reference
63
+
64
+ ### tastyStatic(styles)
65
+
66
+ Creates a `StaticStyle` object from a styles definition.
67
+
68
+ ```tsx
69
+ const card = tastyStatic({
70
+ padding: '4x',
71
+ fill: '#white',
72
+ border: true,
73
+ radius: true,
74
+ });
75
+ ```
76
+
77
+ ### tastyStatic(base, styles)
78
+
79
+ Extends an existing `StaticStyle` with additional styles. Uses `mergeStyles` internally for proper nested selector handling.
80
+
81
+ ```tsx
82
+ const button = tastyStatic({
83
+ padding: '2x 4x',
84
+ fill: '#blue',
85
+ Icon: { color: '#white' },
86
+ });
87
+
88
+ const primaryButton = tastyStatic(button, {
89
+ fill: '#purple',
90
+ Icon: { opacity: 0.8 },
91
+ });
92
+ ```
93
+
94
+ ### tastyStatic(selector, styles)
95
+
96
+ Generates global styles for a CSS selector. The call is removed from the bundle after transformation.
97
+
98
+ ```tsx
99
+ tastyStatic('body', {
100
+ fill: '#surface',
101
+ color: '#text',
102
+ preset: 't3',
103
+ });
104
+ ```
105
+
106
+ ---
107
+
108
+ ## StaticStyle Object
109
+
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 |
115
+
116
+ ---
117
+
118
+ ## Babel Plugin Configuration
119
+
120
+ ### Basic Configuration
121
+
122
+ ```javascript
123
+ // babel.config.js
124
+ module.exports = {
125
+ plugins: [
126
+ ['@tenphi/tasty/babel-plugin', {
127
+ output: 'public/tasty.css',
128
+ }]
129
+ ]
130
+ };
131
+ ```
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
+
135
+ ### With Configuration
136
+
137
+ ```javascript
138
+ module.exports = {
139
+ 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)',
147
+ },
148
+ devMode: true,
149
+ },
150
+ }]
151
+ ]
152
+ };
153
+ ```
154
+
155
+ ### Plugin Options
156
+
157
+ | Option | Type | Default | Description |
158
+ |--------|------|---------|-------------|
159
+ | `output` | `string` | `'tasty.css'` | Path for generated CSS file |
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)' }`) |
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. |
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.fontFace` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
172
+ | `config.counterStyle` | `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.funcs` | `Record<string, Function>` | — | Custom functions for the style parser (merged with existing) |
175
+ | `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
176
+ | `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
177
+ | `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
178
+ | `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
179
+ | `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
180
+ | `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
181
+ | `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). |
182
+
183
+ ### Coexisting with runtime tasty
184
+
185
+ 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:
186
+
187
+ ```ts
188
+ // tasty-zero.config.ts (Babel plugin)
189
+ export default { namePrefix: 'mbs' };
190
+ ```
191
+
192
+ ```ts
193
+ // app entry (runtime configure)
194
+ configure({ namePrefix: 'mb' });
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Recipes
200
+
201
+ Recipes work with `tastyStatic` the same way as with runtime `tasty`:
202
+
203
+ ```javascript
204
+ // babel.config.js
205
+ module.exports = {
206
+ plugins: [
207
+ ['@tenphi/tasty/babel-plugin', {
208
+ output: 'public/tasty.css',
209
+ config: {
210
+ recipes: {
211
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
212
+ elevated: { shadow: '2x 2x 4x #shadow' },
213
+ },
214
+ },
215
+ }]
216
+ ]
217
+ };
218
+ ```
219
+
220
+ ```tsx
221
+ import { tastyStatic } from '@tenphi/tasty/static';
222
+
223
+ const card = tastyStatic({
224
+ recipe: 'card elevated',
225
+ color: '#text',
226
+ });
227
+
228
+ <div className={card}>Styled card</div>
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Next.js Integration
234
+
235
+ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automatically. No `--webpack` flag is needed — it works with whichever bundler Next.js uses.
236
+
237
+ ```typescript
238
+ // next.config.ts
239
+ import { withTastyZero } from '@tenphi/tasty/next';
240
+
241
+ export default withTastyZero({
242
+ output: 'public/tasty.css',
243
+ configFile: './app/tasty-zero.config.ts',
244
+ configDeps: ['./app/theme.ts'],
245
+ })({
246
+ reactStrictMode: true,
247
+ });
248
+ ```
249
+
250
+ ### `withTastyZero` Options
251
+
252
+ | Option | Type | Default | Description |
253
+ |--------|------|---------|-------------|
254
+ | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
255
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
256
+ | `enabled` | `boolean` | `true` | Enable/disable the plugin |
257
+ | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
258
+ | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
259
+ | `configDeps` | `string[]` | `[]` | Extra files the config depends on (for cache invalidation) |
260
+
261
+ ### Turbopack Support
262
+
263
+ 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.
264
+
265
+ 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.
266
+
267
+ **Requirements**: `babel-loader` must be installed in your project:
268
+
269
+ ```bash
270
+ pnpm add babel-loader
271
+ ```
272
+
273
+ ### CSS Injection
274
+
275
+ `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.
276
+
277
+ 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`:
278
+
279
+ ```gitignore
280
+ public/tasty.css
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Vite Integration
286
+
287
+ ```typescript
288
+ // vite.config.ts
289
+ import { defineConfig } from 'vite';
290
+ import react from '@vitejs/plugin-react';
291
+
292
+ export default defineConfig({
293
+ plugins: [
294
+ react({
295
+ babel: {
296
+ plugins: [
297
+ ['@tenphi/tasty/babel-plugin', {
298
+ output: 'public/tasty.css',
299
+ config: {
300
+ states: { '@mobile': '@media(w < 768px)' },
301
+ },
302
+ }],
303
+ ],
304
+ },
305
+ }),
306
+ ],
307
+ });
308
+ ```
309
+
310
+ ---
311
+
312
+ ## Build Transformation
313
+
314
+ ### Before (Source Code)
315
+
316
+ ```tsx
317
+ import { tastyStatic } from '@tenphi/tasty/static';
318
+
319
+ const button = tastyStatic({
320
+ padding: '2x 4x',
321
+ fill: '#purple',
322
+ color: '#white',
323
+ });
324
+
325
+ tastyStatic('.heading', { preset: 'h1' });
326
+
327
+ export const Button = () => <button className={button}>Click</button>;
328
+ ```
329
+
330
+ ### After (Production Build)
331
+
332
+ ```tsx
333
+ const button = {
334
+ className: 'ts3f2a1b ts8c4d2e',
335
+ styles: { padding: '2x 4x', fill: '#purple', color: '#white' },
336
+ toString() { return this.className; }
337
+ };
338
+
339
+ export const Button = () => <button className={button}>Click</button>;
340
+ ```
341
+
342
+ ### Generated CSS (tasty.css)
343
+
344
+ ```css
345
+ /* Generated by @tenphi/tasty/zero - DO NOT EDIT */
346
+
347
+ .ts3f2a1b.ts3f2a1b {
348
+ padding: 16px 32px;
349
+ }
350
+
351
+ .ts8c4d2e.ts8c4d2e {
352
+ background: #9370db;
353
+ color: #fff;
354
+ }
355
+
356
+ .heading.heading {
357
+ font-size: 2.5rem;
358
+ font-weight: 700;
359
+ line-height: 1.2;
360
+ }
361
+ ```
362
+
363
+ ---
364
+
365
+ ## Inject Mode
366
+
367
+ 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.
368
+
369
+ This is ideal for **reusable components**, **extensions**, and **libraries** where consumers shouldn't need to manage an external CSS file.
370
+
371
+ ### How It Works
372
+
373
+ 1. The Babel plugin extracts CSS at build time (same pipeline as file mode).
374
+ 2. Instead of writing to a `.css` file, the CSS is embedded as string literals in the JS output.
375
+ 3. The `@tenphi/tasty/static` import is rewritten to `@tenphi/tasty/static/inject`.
376
+ 4. Each `tastyStatic` call becomes a self-contained expression that injects its CSS and evaluates to a `StaticStyle` object.
377
+
378
+ ### Configuration
379
+
380
+ ```javascript
381
+ // babel.config.js
382
+ module.exports = {
383
+ plugins: [
384
+ ['@tenphi/tasty/babel-plugin', {
385
+ mode: 'inject',
386
+ config: {
387
+ states: { '@mobile': '@media(w < 768px)' },
388
+ },
389
+ }]
390
+ ]
391
+ };
392
+ ```
393
+
394
+ With Next.js:
395
+
396
+ ```typescript
397
+ // next.config.ts
398
+ import { withTastyZero } from '@tenphi/tasty/next';
399
+
400
+ export default withTastyZero({
401
+ mode: 'inject',
402
+ configFile: './app/tasty-zero.config.ts',
403
+ })({
404
+ reactStrictMode: true,
405
+ });
406
+ ```
407
+
408
+ When `mode` is `'inject'`, the `output` and `injectImport` options are ignored.
409
+
410
+ ### Build Transformation (inject mode)
411
+
412
+ **Before:**
413
+
414
+ ```tsx
415
+ import { tastyStatic } from '@tenphi/tasty/static';
416
+
417
+ const button = tastyStatic({
418
+ padding: '2x 4x',
419
+ fill: '#purple',
420
+ });
421
+
422
+ tastyStatic('.heading', { preset: 'h1' });
423
+ ```
424
+
425
+ **After:**
426
+
427
+ ```tsx
428
+ import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
429
+
430
+ const button = (_$i("ts3f2a1b ts8c4d2e", ".ts3f2a1b.ts3f2a1b{padding:16px 32px}\n.ts8c4d2e.ts8c4d2e{background:#9370db}"), {
431
+ className: 'ts3f2a1b ts8c4d2e',
432
+ styles: { padding: '2x 4x', fill: '#purple' },
433
+ toString() { return this.className; }
434
+ });
435
+
436
+ _$i(".heading", ".heading{font-size:2.5rem;font-weight:700;line-height:1.2}");
437
+ ```
438
+
439
+ ### Dev Mode / HMR
440
+
441
+ 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.
442
+
443
+ ### Limitations (inject mode)
444
+
445
+ - **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()`.
446
+ - **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
447
+
448
+ ---
449
+
450
+ ## Style Extension
451
+
452
+ ```tsx
453
+ // Base button
454
+ const button = tastyStatic({
455
+ display: 'inline-flex',
456
+ padding: '2x 4x',
457
+ radius: '1r',
458
+ fill: '#gray.20',
459
+ color: '#text',
460
+ transition: 'fill 0.15s',
461
+ });
462
+
463
+ // Variants
464
+ const primaryButton = tastyStatic(button, {
465
+ fill: '#purple',
466
+ color: '#white',
467
+ });
468
+
469
+ const dangerButton = tastyStatic(button, {
470
+ fill: '#danger',
471
+ color: '#white',
472
+ });
473
+ ```
474
+
475
+ ---
476
+
477
+ ## State-based Styling
478
+
479
+ ```tsx
480
+ const card = tastyStatic({
481
+ padding: {
482
+ '': '4x',
483
+ '@mobile': '2x',
484
+ },
485
+ display: {
486
+ '': 'flex',
487
+ '@mobile': 'block',
488
+ },
489
+ });
490
+ ```
491
+
492
+ ---
493
+
494
+ ## Extending Style Types (TypeScript)
495
+
496
+ 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.
497
+
498
+ ---
499
+
500
+ ## Limitations
501
+
502
+ 1. **Static values only** — All style values must be known at build time
503
+ 2. **No runtime props** — Cannot use `styleProps` or dynamic `styles` prop
504
+ 3. **No mods at runtime** — Modifiers must be defined statically
505
+ 4. **Build-time transformation required** — Babel plugin must process files
506
+
507
+ ### Workarounds
508
+
509
+ For dynamic styling needs, combine with regular CSS or CSS variables:
510
+
511
+ ```tsx
512
+ const card = tastyStatic({
513
+ padding: '4x',
514
+ fill: 'var(--card-bg, #white)',
515
+ });
516
+
517
+ <div
518
+ className={card}
519
+ style={{ '--card-bg': isActive ? '#purple' : '#white' }}
520
+ />
521
+ ```
522
+
523
+ ---
524
+
525
+ ## Best Practices
526
+
527
+ 1. **Define base styles** for common patterns, then extend for variants
528
+ 2. **Use selector mode** for global/body styles
529
+ 3. **Enable devMode** in development for easier debugging
530
+ 4. **Configure states** for consistent responsive breakpoints
531
+
532
+ ---
533
+
534
+ ## Common Issues
535
+
536
+ - 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.
537
+ - 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()`.
538
+ - Turbopack config behaves inconsistently: prefer `configFile` over inline functions so the setup stays JSON-serializable.
539
+
540
+ ---
541
+
542
+ ## Related
543
+
544
+ - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
545
+ - [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
546
+ - [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
547
+ - [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers