@tenphi/tasty 0.0.0-snapshot.002b1b3

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 (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +637 -0
  3. package/dist/async-storage-B7_o6FKt.js +44 -0
  4. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  5. package/dist/collector-LuU1vZ68.d.ts +98 -0
  6. package/dist/collector-MOYY2SOr.js +230 -0
  7. package/dist/collector-MOYY2SOr.js.map +1 -0
  8. package/dist/config-A237aY9H.js +10235 -0
  9. package/dist/config-A237aY9H.js.map +1 -0
  10. package/dist/config-vuCRkBWX.d.ts +884 -0
  11. package/dist/context-CkSg-kDT.js +24 -0
  12. package/dist/context-CkSg-kDT.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -0
  14. package/dist/core/index.js +6 -0
  15. package/dist/core-BkKav78f.js +1592 -0
  16. package/dist/core-BkKav78f.js.map +1 -0
  17. package/dist/css-writer-Cos9tQRM.js +329 -0
  18. package/dist/css-writer-Cos9tQRM.js.map +1 -0
  19. package/dist/format-global-rules-Dbc_1tc3.js +22 -0
  20. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  21. package/dist/format-rules-C2oiTsEO.js +143 -0
  22. package/dist/format-rules-C2oiTsEO.js.map +1 -0
  23. package/dist/hydrate-miFzWIKR.js +45 -0
  24. package/dist/hydrate-miFzWIKR.js.map +1 -0
  25. package/dist/index-CJMXAAO5.d.ts +1602 -0
  26. package/dist/index-dUtwpOux.d.ts +1266 -0
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.js +732 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-DDtNo_hl.js +587 -0
  31. package/dist/keyframes-DDtNo_hl.js.map +1 -0
  32. package/dist/merge-styles-CtDJMhpJ.d.ts +7 -0
  33. package/dist/merge-styles-D_HbBOlq.js +144 -0
  34. package/dist/merge-styles-D_HbBOlq.js.map +1 -0
  35. package/dist/resolve-recipes-B7-823LL.js +144 -0
  36. package/dist/resolve-recipes-B7-823LL.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.d.ts +15 -0
  41. package/dist/ssr/astro-middleware.js +19 -0
  42. package/dist/ssr/astro-middleware.js.map +1 -0
  43. package/dist/ssr/astro.d.ts +97 -0
  44. package/dist/ssr/astro.js +149 -0
  45. package/dist/ssr/astro.js.map +1 -0
  46. package/dist/ssr/index.d.ts +44 -0
  47. package/dist/ssr/index.js +10 -0
  48. package/dist/ssr/index.js.map +1 -0
  49. package/dist/ssr/next.d.ts +46 -0
  50. package/dist/ssr/next.js +75 -0
  51. package/dist/ssr/next.js.map +1 -0
  52. package/dist/static/index.d.ts +91 -0
  53. package/dist/static/index.js +50 -0
  54. package/dist/static/index.js.map +1 -0
  55. package/dist/static/inject.d.ts +5 -0
  56. package/dist/static/inject.js +17 -0
  57. package/dist/static/inject.js.map +1 -0
  58. package/dist/zero/babel.d.ts +81 -0
  59. package/dist/zero/babel.js +466 -0
  60. package/dist/zero/babel.js.map +1 -0
  61. package/dist/zero/index.d.ts +67 -0
  62. package/dist/zero/index.js +2 -0
  63. package/dist/zero/next.d.ts +86 -0
  64. package/dist/zero/next.js +143 -0
  65. package/dist/zero/next.js.map +1 -0
  66. package/docs/README.md +31 -0
  67. package/docs/adoption.md +298 -0
  68. package/docs/comparison.md +419 -0
  69. package/docs/configuration.md +394 -0
  70. package/docs/debug.md +320 -0
  71. package/docs/design-system.md +436 -0
  72. package/docs/dsl.md +688 -0
  73. package/docs/getting-started.md +217 -0
  74. package/docs/injector.md +544 -0
  75. package/docs/methodology.md +616 -0
  76. package/docs/pipeline.md +673 -0
  77. package/docs/react-api.md +557 -0
  78. package/docs/ssr.md +442 -0
  79. package/docs/styles.md +596 -0
  80. package/docs/tasty-static.md +532 -0
  81. package/package.json +222 -0
  82. package/tasty.config.ts +15 -0
@@ -0,0 +1,532 @@
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
+
182
+ ---
183
+
184
+ ## Recipes
185
+
186
+ Recipes work with `tastyStatic` the same way as with runtime `tasty`:
187
+
188
+ ```javascript
189
+ // babel.config.js
190
+ module.exports = {
191
+ plugins: [
192
+ ['@tenphi/tasty/babel-plugin', {
193
+ output: 'public/tasty.css',
194
+ config: {
195
+ recipes: {
196
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
197
+ elevated: { shadow: '2x 2x 4x #shadow' },
198
+ },
199
+ },
200
+ }]
201
+ ]
202
+ };
203
+ ```
204
+
205
+ ```tsx
206
+ import { tastyStatic } from '@tenphi/tasty/static';
207
+
208
+ const card = tastyStatic({
209
+ recipe: 'card elevated',
210
+ color: '#text',
211
+ });
212
+
213
+ <div className={card}>Styled card</div>
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Next.js Integration
219
+
220
+ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automatically. No `--webpack` flag is needed — it works with whichever bundler Next.js uses.
221
+
222
+ ```typescript
223
+ // next.config.ts
224
+ import { withTastyZero } from '@tenphi/tasty/next';
225
+
226
+ export default withTastyZero({
227
+ output: 'public/tasty.css',
228
+ configFile: './app/tasty-zero.config.ts',
229
+ configDeps: ['./app/theme.ts'],
230
+ })({
231
+ reactStrictMode: true,
232
+ });
233
+ ```
234
+
235
+ ### `withTastyZero` Options
236
+
237
+ | Option | Type | Default | Description |
238
+ |--------|------|---------|-------------|
239
+ | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
240
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
241
+ | `enabled` | `boolean` | `true` | Enable/disable the plugin |
242
+ | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
243
+ | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
244
+ | `configDeps` | `string[]` | `[]` | Extra files the config depends on (for cache invalidation) |
245
+
246
+ ### Turbopack Support
247
+
248
+ 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.
249
+
250
+ 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.
251
+
252
+ **Requirements**: `babel-loader` must be installed in your project:
253
+
254
+ ```bash
255
+ pnpm add babel-loader
256
+ ```
257
+
258
+ ### CSS Injection
259
+
260
+ `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.
261
+
262
+ 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`:
263
+
264
+ ```gitignore
265
+ public/tasty.css
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Vite Integration
271
+
272
+ ```typescript
273
+ // vite.config.ts
274
+ import { defineConfig } from 'vite';
275
+ import react from '@vitejs/plugin-react';
276
+
277
+ export default defineConfig({
278
+ plugins: [
279
+ react({
280
+ babel: {
281
+ plugins: [
282
+ ['@tenphi/tasty/babel-plugin', {
283
+ output: 'public/tasty.css',
284
+ config: {
285
+ states: { '@mobile': '@media(w < 768px)' },
286
+ },
287
+ }],
288
+ ],
289
+ },
290
+ }),
291
+ ],
292
+ });
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Build Transformation
298
+
299
+ ### Before (Source Code)
300
+
301
+ ```tsx
302
+ import { tastyStatic } from '@tenphi/tasty/static';
303
+
304
+ const button = tastyStatic({
305
+ padding: '2x 4x',
306
+ fill: '#purple',
307
+ color: '#white',
308
+ });
309
+
310
+ tastyStatic('.heading', { preset: 'h1' });
311
+
312
+ export const Button = () => <button className={button}>Click</button>;
313
+ ```
314
+
315
+ ### After (Production Build)
316
+
317
+ ```tsx
318
+ const button = {
319
+ className: 'ts3f2a1b ts8c4d2e',
320
+ styles: { padding: '2x 4x', fill: '#purple', color: '#white' },
321
+ toString() { return this.className; }
322
+ };
323
+
324
+ export const Button = () => <button className={button}>Click</button>;
325
+ ```
326
+
327
+ ### Generated CSS (tasty.css)
328
+
329
+ ```css
330
+ /* Generated by @tenphi/tasty/zero - DO NOT EDIT */
331
+
332
+ .ts3f2a1b.ts3f2a1b {
333
+ padding: 16px 32px;
334
+ }
335
+
336
+ .ts8c4d2e.ts8c4d2e {
337
+ background: #9370db;
338
+ color: #fff;
339
+ }
340
+
341
+ .heading.heading {
342
+ font-size: 2.5rem;
343
+ font-weight: 700;
344
+ line-height: 1.2;
345
+ }
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Inject Mode
351
+
352
+ 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.
353
+
354
+ This is ideal for **reusable components**, **extensions**, and **libraries** where consumers shouldn't need to manage an external CSS file.
355
+
356
+ ### How It Works
357
+
358
+ 1. The Babel plugin extracts CSS at build time (same pipeline as file mode).
359
+ 2. Instead of writing to a `.css` file, the CSS is embedded as string literals in the JS output.
360
+ 3. The `@tenphi/tasty/static` import is rewritten to `@tenphi/tasty/static/inject`.
361
+ 4. Each `tastyStatic` call becomes a self-contained expression that injects its CSS and evaluates to a `StaticStyle` object.
362
+
363
+ ### Configuration
364
+
365
+ ```javascript
366
+ // babel.config.js
367
+ module.exports = {
368
+ plugins: [
369
+ ['@tenphi/tasty/babel-plugin', {
370
+ mode: 'inject',
371
+ config: {
372
+ states: { '@mobile': '@media(w < 768px)' },
373
+ },
374
+ }]
375
+ ]
376
+ };
377
+ ```
378
+
379
+ With Next.js:
380
+
381
+ ```typescript
382
+ // next.config.ts
383
+ import { withTastyZero } from '@tenphi/tasty/next';
384
+
385
+ export default withTastyZero({
386
+ mode: 'inject',
387
+ configFile: './app/tasty-zero.config.ts',
388
+ })({
389
+ reactStrictMode: true,
390
+ });
391
+ ```
392
+
393
+ When `mode` is `'inject'`, the `output` and `injectImport` options are ignored.
394
+
395
+ ### Build Transformation (inject mode)
396
+
397
+ **Before:**
398
+
399
+ ```tsx
400
+ import { tastyStatic } from '@tenphi/tasty/static';
401
+
402
+ const button = tastyStatic({
403
+ padding: '2x 4x',
404
+ fill: '#purple',
405
+ });
406
+
407
+ tastyStatic('.heading', { preset: 'h1' });
408
+ ```
409
+
410
+ **After:**
411
+
412
+ ```tsx
413
+ import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
414
+
415
+ const button = (_$i("ts3f2a1b ts8c4d2e", ".ts3f2a1b.ts3f2a1b{padding:16px 32px}\n.ts8c4d2e.ts8c4d2e{background:#9370db}"), {
416
+ className: 'ts3f2a1b ts8c4d2e',
417
+ styles: { padding: '2x 4x', fill: '#purple' },
418
+ toString() { return this.className; }
419
+ });
420
+
421
+ _$i(".heading", ".heading{font-size:2.5rem;font-weight:700;line-height:1.2}");
422
+ ```
423
+
424
+ ### Dev Mode / HMR
425
+
426
+ 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.
427
+
428
+ ### Limitations (inject mode)
429
+
430
+ - **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()`.
431
+ - **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
432
+
433
+ ---
434
+
435
+ ## Style Extension
436
+
437
+ ```tsx
438
+ // Base button
439
+ const button = tastyStatic({
440
+ display: 'inline-flex',
441
+ padding: '2x 4x',
442
+ radius: '1r',
443
+ fill: '#gray.20',
444
+ color: '#text',
445
+ transition: 'fill 0.15s',
446
+ });
447
+
448
+ // Variants
449
+ const primaryButton = tastyStatic(button, {
450
+ fill: '#purple',
451
+ color: '#white',
452
+ });
453
+
454
+ const dangerButton = tastyStatic(button, {
455
+ fill: '#danger',
456
+ color: '#white',
457
+ });
458
+ ```
459
+
460
+ ---
461
+
462
+ ## State-based Styling
463
+
464
+ ```tsx
465
+ const card = tastyStatic({
466
+ padding: {
467
+ '': '4x',
468
+ '@mobile': '2x',
469
+ },
470
+ display: {
471
+ '': 'flex',
472
+ '@mobile': 'block',
473
+ },
474
+ });
475
+ ```
476
+
477
+ ---
478
+
479
+ ## Extending Style Types (TypeScript)
480
+
481
+ 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.
482
+
483
+ ---
484
+
485
+ ## Limitations
486
+
487
+ 1. **Static values only** — All style values must be known at build time
488
+ 2. **No runtime props** — Cannot use `styleProps` or dynamic `styles` prop
489
+ 3. **No mods at runtime** — Modifiers must be defined statically
490
+ 4. **Build-time transformation required** — Babel plugin must process files
491
+
492
+ ### Workarounds
493
+
494
+ For dynamic styling needs, combine with regular CSS or CSS variables:
495
+
496
+ ```tsx
497
+ const card = tastyStatic({
498
+ padding: '4x',
499
+ fill: 'var(--card-bg, #white)',
500
+ });
501
+
502
+ <div
503
+ className={card}
504
+ style={{ '--card-bg': isActive ? '#purple' : '#white' }}
505
+ />
506
+ ```
507
+
508
+ ---
509
+
510
+ ## Best Practices
511
+
512
+ 1. **Define base styles** for common patterns, then extend for variants
513
+ 2. **Use selector mode** for global/body styles
514
+ 3. **Enable devMode** in development for easier debugging
515
+ 4. **Configure states** for consistent responsive breakpoints
516
+
517
+ ---
518
+
519
+ ## Common Issues
520
+
521
+ - 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.
522
+ - 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()`.
523
+ - Turbopack config behaves inconsistently: prefer `configFile` over inline functions so the setup stays JSON-serializable.
524
+
525
+ ---
526
+
527
+ ## Related
528
+
529
+ - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
530
+ - [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
531
+ - [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
532
+ - [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers