@tenphi/tasty 0.0.0-snapshot.a8b0eee → 0.0.0-snapshot.a8f6ca4

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 (122) hide show
  1. package/README.md +181 -136
  2. package/dist/babel-Zs1Q03qt.d.ts +83 -0
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CUQVwdWF.js +42 -0
  6. package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
  7. package/dist/{collector-Crs9kGJW.js → chunks/collector-B0LTHw6Z.js} +64 -99
  8. package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
  9. package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
  10. package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
  11. package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
  12. package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
  13. package/dist/chunks/css-resources-BN8apgxt.js +142 -0
  14. package/dist/chunks/css-resources-BN8apgxt.js.map +1 -0
  15. package/dist/chunks/debug-C9LeNVoJ.js +501 -0
  16. package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
  17. package/dist/chunks/dsl-C5yuAn41.js +1373 -0
  18. package/dist/chunks/dsl-C5yuAn41.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-O-OUrKLH.js +557 -0
  22. package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
  23. package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
  24. package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
  25. package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
  26. package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
  27. package/dist/{merge-styles-BzQutdAK.js → chunks/shared-utils-DWA4LjIa.js} +55 -54
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/style-engine-C1ECBZxR.js +5131 -0
  30. package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
  31. package/dist/{css-writer-CPy_cbFJ.js → chunks/zero-engine-B6EnYcXY.js} +34 -112
  32. package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
  33. package/dist/{collector-osfWTeRd.d.ts → collector-hl5KNH7k.d.ts} +64 -7
  34. package/dist/{config-BoZDUHW5.d.ts → config-DWL1ZYue.d.ts} +490 -77
  35. package/dist/core/index.d.ts +5 -5
  36. package/dist/core/index.js +9 -6
  37. package/dist/{index-B_k47mc_.d.ts → index-D9N9GV24.d.ts} +549 -257
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +11 -732
  40. package/dist/{merge-styles-BMWcH6MF.d.ts → merge-styles-C_oMoJVd.d.ts} +2 -2
  41. package/dist/ssr/astro-client.js +1 -14
  42. package/dist/ssr/astro-client.js.map +1 -1
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  44. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  45. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  46. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  47. package/dist/ssr/astro-middleware-extract.js +9 -0
  48. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  49. package/dist/ssr/astro-middleware-static.d.ts +18 -0
  50. package/dist/ssr/astro-middleware-static.js +7 -0
  51. package/dist/ssr/astro-middleware-static.js.map +1 -0
  52. package/dist/ssr/astro-middleware.d.ts +11 -7
  53. package/dist/ssr/astro-middleware.js +2 -14
  54. package/dist/ssr/astro-middleware.js.map +1 -1
  55. package/dist/ssr/astro.d.ts +45 -7
  56. package/dist/ssr/astro.js +162 -91
  57. package/dist/ssr/astro.js.map +1 -1
  58. package/dist/ssr/index.d.ts +7 -14
  59. package/dist/ssr/index.js +5 -5
  60. package/dist/ssr/index.js.map +1 -1
  61. package/dist/ssr/next-config.d.ts +66 -0
  62. package/dist/ssr/next-config.js +124 -0
  63. package/dist/ssr/next-config.js.map +1 -0
  64. package/dist/ssr/next.d.ts +10 -4
  65. package/dist/ssr/next.js +27 -43
  66. package/dist/ssr/next.js.map +1 -1
  67. package/dist/static/index.d.ts +2 -2
  68. package/dist/static/index.js +4 -22
  69. package/dist/static/index.js.map +1 -1
  70. package/dist/static/inject.js.map +1 -1
  71. package/dist/{index-tcHuMPFt.d.ts → types-jKZNpias.d.ts} +875 -545
  72. package/dist/zero/babel.d.ts +2 -81
  73. package/dist/zero/babel.js +42 -109
  74. package/dist/zero/babel.js.map +1 -1
  75. package/dist/zero/index.d.ts +16 -2
  76. package/dist/zero/index.js +2 -2
  77. package/dist/zero/next.d.ts +1 -1
  78. package/dist/zero/next.js +0 -31
  79. package/dist/zero/next.js.map +1 -1
  80. package/docs/README.md +17 -9
  81. package/docs/adoption.md +56 -31
  82. package/docs/ai-agents.md +229 -0
  83. package/docs/comparison.md +69 -40
  84. package/docs/configuration.md +470 -85
  85. package/docs/debug.md +26 -14
  86. package/docs/design-system.md +43 -24
  87. package/docs/dsl.md +508 -177
  88. package/docs/getting-started.md +60 -39
  89. package/docs/injector.md +120 -30
  90. package/docs/methodology.md +44 -38
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +56 -11
  93. package/docs/plugins.md +353 -0
  94. package/docs/react-api.md +142 -42
  95. package/docs/runtime-benchmarks.md +388 -0
  96. package/docs/ssr.md +252 -86
  97. package/docs/styles.md +99 -20
  98. package/docs/tasty-static.md +140 -105
  99. package/package.json +112 -21
  100. package/tasty.config.ts +5 -0
  101. package/dist/async-storage-B7_o6FKt.js +0 -44
  102. package/dist/async-storage-B7_o6FKt.js.map +0 -1
  103. package/dist/collector-Crs9kGJW.js.map +0 -1
  104. package/dist/config-BaxtQMS3.js +0 -10464
  105. package/dist/config-BaxtQMS3.js.map +0 -1
  106. package/dist/context-CkSg-kDT.js +0 -24
  107. package/dist/context-CkSg-kDT.js.map +0 -1
  108. package/dist/core-CmxaoZ-N.js +0 -1598
  109. package/dist/core-CmxaoZ-N.js.map +0 -1
  110. package/dist/css-writer-CPy_cbFJ.js.map +0 -1
  111. package/dist/format-global-rules-Dbc_1tc3.js +0 -22
  112. package/dist/format-global-rules-Dbc_1tc3.js.map +0 -1
  113. package/dist/format-rules-CPirO_Mj.js +0 -143
  114. package/dist/format-rules-CPirO_Mj.js.map +0 -1
  115. package/dist/hydrate-CVn-A_3y.js +0 -45
  116. package/dist/hydrate-CVn-A_3y.js.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/dist/keyframes-vpzoVdUR.js +0 -588
  119. package/dist/keyframes-vpzoVdUR.js.map +0 -1
  120. package/dist/merge-styles-BzQutdAK.js.map +0 -1
  121. package/dist/resolve-recipes-DgH8A3Nn.js +0 -144
  122. package/dist/resolve-recipes-DgH8A3Nn.js.map +0 -1
@@ -1,6 +1,8 @@
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
 
@@ -8,19 +10,19 @@
8
10
 
9
11
  - **Static site generation (SSG)** — Pre-render all styles at build time
10
12
  - **No-JavaScript websites** — CSS works without any JS runtime
11
- - **Performance-critical pages** — Zero runtime overhead for styling
13
+ - **Performance-critical pages** — CSS extracted before the application renders
12
14
  - **Landing pages** — Minimal bundle size with pre-generated CSS
13
15
 
14
16
  ## Requirements
15
17
 
16
- The zero-runtime mode is part of the main `@tenphi/tasty` package but requires additional peer dependencies depending on your setup:
18
+ Build-time extraction is part of the main `@tenphi/tasty` package but requires additional peer dependencies depending on your setup:
17
19
 
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 |
20
+ | Dependency | Version | Required for |
21
+ | ---------------------------- | ------- | -------------------------------------------------------------------------- |
22
+ | `@babel/core` | >= 7.24 | Babel plugin (`@tenphi/tasty/babel-plugin`) |
23
+ | `@babel/helper-plugin-utils` | >= 7.24 | Babel plugin |
24
+ | `@babel/types` | >= 7.24 | Babel plugin |
25
+ | `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/zero/next`) when using `configFile` option |
24
26
 
25
27
  All of these are declared as optional peer dependencies of `@tenphi/tasty`. Install only what your setup requires:
26
28
 
@@ -107,11 +109,11 @@ tastyStatic('body', {
107
109
 
108
110
  ## StaticStyle Object
109
111
 
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 |
112
+ | Property | Type | Description |
113
+ | ------------ | -------------- | ------------------------------------------ |
114
+ | `className` | `string` | Space-separated class names for use in JSX |
115
+ | `styles` | `Styles` | The original (or merged) styles object |
116
+ | `toString()` | `() => string` | Returns `className` for string coercion |
115
117
 
116
118
  ---
117
119
 
@@ -123,66 +125,73 @@ tastyStatic('body', {
123
125
  // babel.config.js
124
126
  module.exports = {
125
127
  plugins: [
126
- ['@tenphi/tasty/babel-plugin', {
127
- output: 'public/tasty.css',
128
- }]
129
- ]
128
+ [
129
+ '@tenphi/tasty/babel-plugin',
130
+ {
131
+ output: 'public/tasty.css',
132
+ },
133
+ ],
134
+ ],
130
135
  };
131
136
  ```
132
137
 
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.
138
+ 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
139
 
135
140
  ### With Configuration
136
141
 
137
142
  ```javascript
138
143
  module.exports = {
139
144
  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)',
145
+ [
146
+ '@tenphi/tasty/babel-plugin',
147
+ {
148
+ output: 'public/tasty.css',
149
+ config: {
150
+ states: {
151
+ '@mobile': '@media(w < 768px)',
152
+ '@tablet': '@media(w < 1024px)',
153
+ '@dark': '@root(schema=dark)',
154
+ },
155
+ devMode: true,
147
156
  },
148
- devMode: true,
149
157
  },
150
- }]
151
- ]
158
+ ],
159
+ ],
152
160
  };
153
161
  ```
154
162
 
155
163
  ### Plugin Options
156
164
 
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:
165
+ | Option | Type | Default | Description |
166
+ | -------------------------- | ------------------------------------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
167
+ | `output` | `string` | `'tasty.css'` | Path for generated CSS file |
168
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS (see [Inject Mode](#inject-mode)) |
169
+ | `configFile` | `string` | — | Absolute path to a TS/JS module that default-exports a `TastyZeroConfig` object. JSON-serializable alternative to `config` — required for Turbopack. |
170
+ | `config` | `TastyZeroConfig \| () => TastyZeroConfig` | `{}` | Inline config object or factory function. Takes precedence over `configFile`. |
171
+ | `configDeps` | `string[]` | `[]` | Absolute file paths that affect config (for cache invalidation) |
172
+ | `injectImport` | `boolean` | `true` | Replace `@tenphi/tasty/static` imports with an import of the generated CSS file. Set to `false` to manage CSS imports manually. |
173
+ | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases (e.g. `{ '@mobile': '@media(w < 768px)' }`) |
174
+ | `config.devMode` | `boolean` | `false` | Add source comments to CSS |
175
+ | `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. |
176
+ | `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
177
+ | `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
178
+ | `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
179
+ | `config.fontFaces` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
180
+ | `config.counterStyles` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
181
+ | `config.units` | `Record<string, string \| UnitHandler>` | — | Custom units for the style parser (merged with built-ins). E.g. `{ em: 'em', vw: 'vw' }` |
182
+ | `config.functions` | `Record<string, FunctionDefinition \| Function>` | — | Custom functions (merged). Bare keys → parse functions; `$$name` keys → declarative CSS `@function` definitions |
183
+ | `config.polyfills` | `{ functions?: boolean }` | `{}` | Opt-in polyfills. `functions: true` inlines `@function` calls into plain CSS at build time |
184
+ | `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
185
+ | `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
186
+ | `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
187
+ | `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
188
+ | `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
189
+ | `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
190
+ | `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). |
191
+
192
+ ### Coexisting with `tasty()`
193
+
194
+ 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:
186
195
 
187
196
  ```ts
188
197
  // tasty-zero.config.ts (Babel plugin)
@@ -190,7 +199,7 @@ export default { namePrefix: 'mbs' };
190
199
  ```
191
200
 
192
201
  ```ts
193
- // app entry (runtime configure)
202
+ // app entry (`tasty()` configure)
194
203
  configure({ namePrefix: 'mb' });
195
204
  ```
196
205
 
@@ -204,16 +213,24 @@ Recipes work with `tastyStatic` the same way as with runtime `tasty`:
204
213
  // babel.config.js
205
214
  module.exports = {
206
215
  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' },
216
+ [
217
+ '@tenphi/tasty/babel-plugin',
218
+ {
219
+ output: 'public/tasty.css',
220
+ config: {
221
+ recipes: {
222
+ card: {
223
+ padding: '4x',
224
+ fill: '#surface',
225
+ radius: '1r',
226
+ border: true,
227
+ },
228
+ elevated: { shadow: '2x 2x 4x #shadow' },
229
+ },
213
230
  },
214
231
  },
215
- }]
216
- ]
232
+ ],
233
+ ],
217
234
  };
218
235
  ```
219
236
 
@@ -225,7 +242,7 @@ const card = tastyStatic({
225
242
  color: '#text',
226
243
  });
227
244
 
228
- <div className={card}>Styled card</div>
245
+ <div className={card}>Styled card</div>;
229
246
  ```
230
247
 
231
248
  ---
@@ -236,7 +253,7 @@ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automa
236
253
 
237
254
  ```typescript
238
255
  // next.config.ts
239
- import { withTastyZero } from '@tenphi/tasty/next';
256
+ import { withTastyZero } from '@tenphi/tasty/zero/next';
240
257
 
241
258
  export default withTastyZero({
242
259
  output: 'public/tasty.css',
@@ -249,14 +266,14 @@ export default withTastyZero({
249
266
 
250
267
  ### `withTastyZero` Options
251
268
 
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) |
269
+ | Option | Type | Default | Description |
270
+ | ------------ | -------------------- | -------------------- | ------------------------------------------------------------------------------------------------------- |
271
+ | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
272
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
273
+ | `enabled` | `boolean` | `true` | Enable/disable the plugin |
274
+ | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
275
+ | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
276
+ | `configDeps` | `string[]` | `[]` | Extra files the config depends on (for cache invalidation) |
260
277
 
261
278
  ### Turbopack Support
262
279
 
@@ -294,12 +311,15 @@ export default defineConfig({
294
311
  react({
295
312
  babel: {
296
313
  plugins: [
297
- ['@tenphi/tasty/babel-plugin', {
298
- output: 'public/tasty.css',
299
- config: {
300
- states: { '@mobile': '@media(w < 768px)' },
314
+ [
315
+ '@tenphi/tasty/babel-plugin',
316
+ {
317
+ output: 'public/tasty.css',
318
+ config: {
319
+ states: { '@mobile': '@media(w < 768px)' },
320
+ },
301
321
  },
302
- }],
322
+ ],
303
323
  ],
304
324
  },
305
325
  }),
@@ -333,7 +353,9 @@ export const Button = () => <button className={button}>Click</button>;
333
353
  const button = {
334
354
  className: 'ts3f2a1b ts8c4d2e',
335
355
  styles: { padding: '2x 4x', fill: '#purple', color: '#white' },
336
- toString() { return this.className; }
356
+ toString() {
357
+ return this.className;
358
+ },
337
359
  };
338
360
 
339
361
  export const Button = () => <button className={button}>Click</button>;
@@ -381,13 +403,16 @@ This is ideal for **reusable components**, **extensions**, and **libraries** whe
381
403
  // babel.config.js
382
404
  module.exports = {
383
405
  plugins: [
384
- ['@tenphi/tasty/babel-plugin', {
385
- mode: 'inject',
386
- config: {
387
- states: { '@mobile': '@media(w < 768px)' },
406
+ [
407
+ '@tenphi/tasty/babel-plugin',
408
+ {
409
+ mode: 'inject',
410
+ config: {
411
+ states: { '@mobile': '@media(w < 768px)' },
412
+ },
388
413
  },
389
- }]
390
- ]
414
+ ],
415
+ ],
391
416
  };
392
417
  ```
393
418
 
@@ -395,7 +420,7 @@ With Next.js:
395
420
 
396
421
  ```typescript
397
422
  // next.config.ts
398
- import { withTastyZero } from '@tenphi/tasty/next';
423
+ import { withTastyZero } from '@tenphi/tasty/zero/next';
399
424
 
400
425
  export default withTastyZero({
401
426
  mode: 'inject',
@@ -427,13 +452,20 @@ tastyStatic('.heading', { preset: 'h1' });
427
452
  ```tsx
428
453
  import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
429
454
 
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}");
455
+ const button =
456
+ (_$i(
457
+ 'ts3f2a1b ts8c4d2e',
458
+ '.ts3f2a1b.ts3f2a1b{padding:16px 32px}\n.ts8c4d2e.ts8c4d2e{background:#9370db}',
459
+ ),
460
+ {
461
+ className: 'ts3f2a1b ts8c4d2e',
462
+ styles: { padding: '2x 4x', fill: '#purple' },
463
+ toString() {
464
+ return this.className;
465
+ },
466
+ });
467
+
468
+ _$i('.heading', '.heading{font-size:2.5rem;font-weight:700;line-height:1.2}');
437
469
  ```
438
470
 
439
471
  ### Dev Mode / HMR
@@ -442,7 +474,7 @@ Class names are content-hashed (`ts` + MD5). When styles change, a new hash prod
442
474
 
443
475
  ### Limitations (inject mode)
444
476
 
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()`.
477
+ - **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()`.
446
478
  - **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
447
479
 
448
480
  ---
@@ -511,13 +543,15 @@ For dynamic styling needs, combine with regular CSS or CSS variables:
511
543
  ```tsx
512
544
  const card = tastyStatic({
513
545
  padding: '4x',
514
- fill: 'var(--card-bg, #white)',
546
+ fill: '($card-bg, #white)',
515
547
  });
516
548
 
517
549
  <div
518
550
  className={card}
519
- style={{ '--card-bg': isActive ? '#purple' : '#white' }}
520
- />
551
+ style={{
552
+ '--card-bg': isActive ? 'var(--purple-color)' : 'var(--white-color)',
553
+ }}
554
+ />;
521
555
  ```
522
556
 
523
557
  ---
@@ -534,14 +568,15 @@ const card = tastyStatic({
534
568
  ## Common Issues
535
569
 
536
570
  - 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()`.
571
+ - 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()`.
538
572
  - Turbopack config behaves inconsistently: prefer `configFile` over inline functions so the setup stays JSON-serializable.
539
573
 
540
574
  ---
541
575
 
542
576
  ## Related
543
577
 
544
- - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
578
+ - [Docs Hub](README.md) — Choose the right guide by task or CSS delivery model
545
579
  - [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
580
+ - [React API](react-api.md) — Client or server rendering with `tasty()`: component props, variants, sub-elements, and style functions
547
581
  - [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
582
+ - [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)