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

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 (125) hide show
  1. package/README.md +181 -136
  2. package/dist/babel-types-C_7kRP38.d.ts +18 -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-Betc6IB6.js +60 -0
  6. package/dist/chunks/build-config-Betc6IB6.js.map +1 -0
  7. package/dist/{collector-Crs9kGJW.js → chunks/collector-DqqisglQ.js} +68 -101
  8. package/dist/chunks/collector-DqqisglQ.js.map +1 -0
  9. package/dist/chunks/config-engine-BPeROwq2.js +272 -0
  10. package/dist/chunks/config-engine-BPeROwq2.js.map +1 -0
  11. package/dist/chunks/css-definitions-IeuyJTGk.js +899 -0
  12. package/dist/chunks/css-definitions-IeuyJTGk.js.map +1 -0
  13. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  15. package/dist/chunks/debug-P1E2jkj7.js +502 -0
  16. package/dist/chunks/debug-P1E2jkj7.js.map +1 -0
  17. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  18. package/dist/chunks/dsl-DRhFWQzo.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-XMBbGRes.js +582 -0
  22. package/dist/chunks/react-runtime-XMBbGRes.js.map +1 -0
  23. package/dist/chunks/runtime-engine-CsIMtulO.js +2415 -0
  24. package/dist/chunks/runtime-engine-CsIMtulO.js.map +1 -0
  25. package/dist/chunks/runtime-state-CyKzDioI.js +141 -0
  26. package/dist/chunks/runtime-state-CyKzDioI.js.map +1 -0
  27. package/dist/{merge-styles-BzQutdAK.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
  28. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  29. package/dist/chunks/style-engine-RbokDN6A.js +5427 -0
  30. package/dist/chunks/style-engine-RbokDN6A.js.map +1 -0
  31. package/dist/{css-writer-CPy_cbFJ.js → chunks/zero-engine-DbtjMsfo.js} +81 -137
  32. package/dist/chunks/zero-engine-DbtjMsfo.js.map +1 -0
  33. package/dist/{collector-osfWTeRd.d.ts → collector-w4mBj5gd.d.ts} +64 -8
  34. package/dist/{config-BoZDUHW5.d.ts → config-CrZOfNJ5.d.ts} +489 -85
  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-CYJtAI9a.d.ts} +664 -399
  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-VXwJ0Frr.d.ts} +2 -3
  41. package/dist/ssr/astro-client.d.ts +1 -1
  42. package/dist/ssr/astro-client.js +1 -14
  43. package/dist/ssr/astro-client.js.map +1 -1
  44. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  45. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  46. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract.js +9 -0
  49. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  50. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  51. package/dist/ssr/astro-middleware-static.js +7 -0
  52. package/dist/ssr/astro-middleware-static.js.map +1 -0
  53. package/dist/ssr/astro-middleware.d.ts +11 -8
  54. package/dist/ssr/astro-middleware.js +2 -14
  55. package/dist/ssr/astro-middleware.js.map +1 -1
  56. package/dist/ssr/astro.d.ts +40 -10
  57. package/dist/ssr/astro.js +163 -91
  58. package/dist/ssr/astro.js.map +1 -1
  59. package/dist/ssr/index.d.ts +10 -18
  60. package/dist/ssr/index.js +5 -5
  61. package/dist/ssr/index.js.map +1 -1
  62. package/dist/ssr/next-config.d.ts +64 -0
  63. package/dist/ssr/next-config.js +134 -0
  64. package/dist/ssr/next-config.js.map +1 -0
  65. package/dist/ssr/next.d.ts +9 -9
  66. package/dist/ssr/next.js +29 -44
  67. package/dist/ssr/next.js.map +1 -1
  68. package/dist/static/index.d.ts +8 -9
  69. package/dist/static/index.js +4 -22
  70. package/dist/static/index.js.map +1 -1
  71. package/dist/static/inject.d.ts +1 -2
  72. package/dist/static/inject.js.map +1 -1
  73. package/dist/{index-tcHuMPFt.d.ts → types-JEY8PVYP.d.ts} +874 -593
  74. package/dist/zero/babel.d.ts +5 -19
  75. package/dist/zero/babel.js +74 -144
  76. package/dist/zero/babel.js.map +1 -1
  77. package/dist/zero/index.d.ts +57 -7
  78. package/dist/zero/index.js +24 -2
  79. package/dist/zero/index.js.map +1 -0
  80. package/dist/zero/next.d.ts +4 -5
  81. package/dist/zero/next.js +0 -31
  82. package/dist/zero/next.js.map +1 -1
  83. package/docs/README.md +17 -9
  84. package/docs/adoption.md +56 -31
  85. package/docs/ai-agents.md +250 -0
  86. package/docs/comparison.md +69 -40
  87. package/docs/configuration.md +487 -86
  88. package/docs/debug.md +26 -14
  89. package/docs/design-system.md +43 -24
  90. package/docs/dsl.md +558 -181
  91. package/docs/getting-started.md +64 -41
  92. package/docs/injector.md +120 -30
  93. package/docs/methodology.md +46 -40
  94. package/docs/migration-v3.md +285 -0
  95. package/docs/pipeline.md +87 -21
  96. package/docs/plugins.md +353 -0
  97. package/docs/react-api.md +151 -42
  98. package/docs/runtime-benchmarks.md +388 -0
  99. package/docs/ssr.md +252 -86
  100. package/docs/styles.md +142 -25
  101. package/docs/tasty-static.md +174 -106
  102. package/package.json +127 -35
  103. package/tasty.config.ts +5 -0
  104. package/dist/async-storage-B7_o6FKt.js +0 -44
  105. package/dist/async-storage-B7_o6FKt.js.map +0 -1
  106. package/dist/collector-Crs9kGJW.js.map +0 -1
  107. package/dist/config-BaxtQMS3.js +0 -10464
  108. package/dist/config-BaxtQMS3.js.map +0 -1
  109. package/dist/context-CkSg-kDT.js +0 -24
  110. package/dist/context-CkSg-kDT.js.map +0 -1
  111. package/dist/core-CmxaoZ-N.js +0 -1598
  112. package/dist/core-CmxaoZ-N.js.map +0 -1
  113. package/dist/css-writer-CPy_cbFJ.js.map +0 -1
  114. package/dist/format-global-rules-Dbc_1tc3.js +0 -22
  115. package/dist/format-global-rules-Dbc_1tc3.js.map +0 -1
  116. package/dist/format-rules-CPirO_Mj.js +0 -143
  117. package/dist/format-rules-CPirO_Mj.js.map +0 -1
  118. package/dist/hydrate-CVn-A_3y.js +0 -45
  119. package/dist/hydrate-CVn-A_3y.js.map +0 -1
  120. package/dist/index.js.map +0 -1
  121. package/dist/keyframes-vpzoVdUR.js +0 -588
  122. package/dist/keyframes-vpzoVdUR.js.map +0 -1
  123. package/dist/merge-styles-BzQutdAK.js.map +0 -1
  124. package/dist/resolve-recipes-DgH8A3Nn.js +0 -144
  125. package/dist/resolve-recipes-DgH8A3Nn.js.map +0 -1
package/docs/debug.md CHANGED
@@ -6,9 +6,7 @@ Runtime CSS inspection and diagnostics for the Tasty styling system. Inspect inj
6
6
 
7
7
  ## Overview
8
8
 
9
- `tastyDebug` is a diagnostic object that exposes Tasty's runtime CSS state. It is designed for development use but can be manually installed in production for debugging.
10
-
11
- In development mode (`isDevEnv()` returns `true`), `tastyDebug` is automatically installed on `window.tastyDebug`. In production, install it manually when needed.
9
+ `tastyDebug` is a diagnostic object that exposes Tasty's runtime CSS state. It is designed for development use and can be installed on `window` explicitly when needed.
12
10
 
13
11
  All methods **log to the console by default**. Pass `{ raw: true }` to suppress logging and only return data.
14
12
 
@@ -19,7 +17,6 @@ All methods **log to the console by default**. Pass `{ raw: true }` to suppress
19
17
  ## Quick Start
20
18
 
21
19
  ```typescript
22
- // Auto-installed in dev mode. Otherwise:
23
20
  import { tastyDebug } from '@tenphi/tasty';
24
21
  tastyDebug.install();
25
22
 
@@ -54,6 +51,19 @@ interface DebugOptions {
54
51
 
55
52
  When `raw` is `false` (the default), results are logged to the console **and** returned. When `raw` is `true`, results are returned silently.
56
53
 
54
+ ### Environments Without a DOM
55
+
56
+ `tastyDebug` reads the document, so on a server — SSR, a Node REPL, a test
57
+ runner in the `node` environment — there is nothing for it to read. Every
58
+ method returns its empty result (`''`, an empty `InspectResult`, a summary of
59
+ zeroes, `metrics: null`) instead of throwing, and explains itself once with a
60
+ console warning. `{ raw: true }` suppresses that warning along with the rest of
61
+ the logging.
62
+
63
+ To see the styles a server render produced, read the `ServerStyleCollector`
64
+ instead — `collector.getCSS()` and `collector.getRenderedClassNames()`. See
65
+ [SSR](./ssr.md).
66
+
57
67
  ---
58
68
 
59
69
  ## API Reference
@@ -68,7 +78,7 @@ Retrieves CSS text for a given target. Logs the result with rule count and size.
68
78
  |---|---|
69
79
  | `'all'` | All tasty CSS (component + global + raw) |
70
80
  | `'active'` | CSS for classes currently in the DOM |
71
- | `'unused'` | CSS with refCount = 0 (cached but not used) |
81
+ | `'unused'` | CSS for injected classes no element carries (cached but not rendered) |
72
82
  | `'global'` | Only global CSS (from `injectGlobal`) |
73
83
  | `'page'` | All CSS on the page (including non-tasty) |
74
84
  | `'t3a5f'` | CSS for a specific tasty class (class names are `t` + base36 hash) |
@@ -79,7 +89,7 @@ Retrieves CSS text for a given target. Logs the result with rule count and size.
79
89
  **Extra options:**
80
90
 
81
91
  ```typescript
82
- interface CssOptions extends DebugOptions {
92
+ interface CSSOptions extends DebugOptions {
83
93
  prettify?: boolean; // Format output (default: true)
84
94
  source?: boolean; // Read original CSS instead of live CSSOM (default: false, dev-mode only)
85
95
  }
@@ -111,14 +121,14 @@ Inspects a DOM element and returns detailed information about its tasty styles,
111
121
  ```typescript
112
122
  interface InspectResult {
113
123
  element?: Element | null;
114
- classes: string[]; // Tasty classes on the element
115
- chunks: ChunkInfo[]; // Chunk assignment per class
116
- css: string; // Prettified CSS
117
- size: number; // CSS size in characters
118
- rules: number; // Number of CSS rule blocks
124
+ classes: string[]; // Tasty classes on the element
125
+ chunks: DebugChunkInfo[]; // Chunk assignment per class
126
+ css: string; // Prettified CSS
127
+ size: number; // CSS size in characters
128
+ rules: number; // Number of CSS rule blocks
119
129
  }
120
130
 
121
- interface ChunkInfo {
131
+ interface DebugChunkInfo {
122
132
  className: string;
123
133
  chunkName: string | null; // e.g., 'appearance', 'font', 'dimension'
124
134
  }
@@ -241,7 +251,9 @@ tastyDebug.cache();
241
251
 
242
252
  ### `cleanup(opts?): void`
243
253
 
244
- Forces immediate cleanup of all unused styles (those with `refCount = 0`).
254
+ Removes every injected style that is neither carried by an element nor pinned by
255
+ an outstanding `inject()` handle — the same set `summary()` reports as unused.
256
+ Equivalent to `gc({ force: true })`.
245
257
 
246
258
  ```typescript
247
259
  tastyDebug.cleanup();
@@ -262,7 +274,7 @@ tastyDebug.help();
262
274
 
263
275
  ### `install(): void`
264
276
 
265
- Attaches `tastyDebug` to `window.tastyDebug`. Called automatically in development mode.
277
+ Attaches `tastyDebug` to `window.tastyDebug`.
266
278
 
267
279
  ```typescript
268
280
  import { tastyDebug } from '@tenphi/tasty';
@@ -1,8 +1,8 @@
1
1
  # Building a Design System
2
2
 
3
- This guide walks through building a design-system styling layer on top of Tasty — defining tokens, state aliases, recipes, primitive components, and compound components with sub-elements.
3
+ This guide shows how to build shared React components whose styles stay predictable as states, variants, themes, and responsive rules accumulate. You will define tokens, state aliases, recipes, primitive APIs, and compound components with sub-elements.
4
4
 
5
- It assumes you have already decided to adopt Tasty. The goal is not just to centralize tokens, but to define a styling language whose component states resolve deterministically across variants, responsive rules, and sub-elements. For evaluation criteria, audience fit, and incremental adoption phases, see the [Adoption Guide](adoption.md). For the recommended component patterns and mental model, see [Methodology](methodology.md).
5
+ It assumes you have already decided to adopt Tasty. The goal is not only to centralize values, but to give your design system one state model and a governed component-facing styling API. For evaluation criteria and incremental rollout, see the [Adoption Guide](adoption.md). For the recommended component architecture, see [Methodology](methodology.md).
6
6
 
7
7
  ---
8
8
 
@@ -43,8 +43,8 @@ configure({
43
43
  '#border': '#e0e0e0',
44
44
 
45
45
  // Unit values
46
- '$gap': '8px',
47
- '$radius': '4px',
46
+ $gap: '8px',
47
+ $radius: '4px',
48
48
  '$border-width': '1px',
49
49
  '$outline-width': '2px',
50
50
  },
@@ -91,8 +91,18 @@ import { configure } from '@tenphi/tasty';
91
91
 
92
92
  configure({
93
93
  presets: {
94
- h1: { fontSize: '2rem', lineHeight: '1.2', letterSpacing: '-0.02em', fontWeight: 700 },
95
- t2: { fontSize: '0.875rem', lineHeight: '1.5', letterSpacing: 'normal', fontWeight: 400 },
94
+ h1: {
95
+ fontSize: '2rem',
96
+ lineHeight: '1.2',
97
+ letterSpacing: '-0.02em',
98
+ fontWeight: 700,
99
+ },
100
+ t2: {
101
+ fontSize: '0.875rem',
102
+ lineHeight: '1.5',
103
+ letterSpacing: 'normal',
104
+ fontWeight: 400,
105
+ },
96
106
  },
97
107
  });
98
108
  ```
@@ -117,14 +127,22 @@ Then use `preset: 'h1'` or `preset: 't2'` in any component's styles.
117
127
 
118
128
  ### Registering brand fonts
119
129
 
120
- Register your design system's custom fonts via `configure({ fontFace })` so every component can reference them:
130
+ Register your design system's custom fonts via `configure({ fontFaces })` so every component can reference them:
121
131
 
122
132
  ```ts
123
133
  configure({
124
- fontFace: {
134
+ fontFaces: {
125
135
  'Brand Sans': [
126
- { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
127
- { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
136
+ {
137
+ src: 'url("/fonts/brand-regular.woff2") format("woff2")',
138
+ fontWeight: 400,
139
+ fontDisplay: 'swap',
140
+ },
141
+ {
142
+ src: 'url("/fonts/brand-bold.woff2") format("woff2")',
143
+ fontWeight: 700,
144
+ fontDisplay: 'swap',
145
+ },
128
146
  ],
129
147
  },
130
148
  });
@@ -144,7 +162,8 @@ configure({
144
162
  '@mobile': '@media(w < 768px)',
145
163
  '@tablet': '@media(768px <= w < 1024px)',
146
164
  '@desktop': '@media(w >= 1024px)',
147
- '@dark': '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
165
+ '@dark':
166
+ '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
148
167
  '@reduced-motion': '@media(prefers-reduced-motion: reduce)',
149
168
  },
150
169
  });
@@ -185,7 +204,7 @@ configure({
185
204
  'input-reset': {
186
205
  border: 'none',
187
206
  outline: 'none',
188
- fill: 'transparent',
207
+ fill: '#clear',
189
208
  font: true,
190
209
  preset: 't3',
191
210
  },
@@ -211,7 +230,7 @@ const ProfileCard = tasty({
211
230
  });
212
231
  ```
213
232
 
214
- Use the `/` separator when a recipe should be applied *after* local styles (post-merge), so recipe states take priority:
233
+ Use the `/` separator when a recipe should be applied _after_ local styles (post-merge), so recipe states take priority:
215
234
 
216
235
  ```tsx
217
236
  const Input = tasty({
@@ -283,12 +302,12 @@ Product engineers use these to compose layouts without writing CSS:
283
302
 
284
303
  Match the prop set to the component's role:
285
304
 
286
- | Component category | Recommended styleProps |
287
- |--------------------|----------------------|
288
- | Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align, justify, padding, fill |
289
- | Positioned elements (`Button`, `Badge`) | `POSITION_STYLES` — placeSelf, gridArea, order |
290
- | Text elements | `['preset', 'color']` or a custom subset |
291
- | Compound components | Typically none — styling happens via sub-elements and wrapping |
305
+ | Component category | Recommended styleProps |
306
+ | ------------------------------------------ | -------------------------------------------------------------- |
307
+ | Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align, justify, padding, fill |
308
+ | Positioned elements (`Button`, `Badge`) | `POSITION_STYLES` — placeSelf, gridArea, order |
309
+ | Text elements | `['preset', 'color']` or a custom subset |
310
+ | Compound components | Typically none — styling happens via sub-elements and wrapping |
292
311
 
293
312
  Exposing too many props weakens the design system's constraints. See [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api) for the rationale.
294
313
 
@@ -335,9 +354,7 @@ Usage:
335
354
  ```tsx
336
355
  <Card>
337
356
  <Card.Title>Monthly Revenue</Card.Title>
338
- <Card.Content>
339
- $1.2M — up 12% from last month.
340
- </Card.Content>
357
+ <Card.Content>$1.2M — up 12% from last month.</Card.Content>
341
358
  <Card.Footer>
342
359
  <Button>Details</Button>
343
360
  </Card.Footer>
@@ -365,13 +382,15 @@ A design system works best when the rules for customization are explicit. Tasty
365
382
  2. **Use modProps** — control component states through typed props instead of `mods`:
366
383
 
367
384
  ```tsx
368
- <Button isLoading size="large">Submit</Button>
385
+ <Button isLoading size="large">
386
+ Submit
387
+ </Button>
369
388
  ```
370
389
 
371
390
  3. **Pass tokens** — inject runtime values through the `tokens` prop for per-instance customization:
372
391
 
373
392
  ```tsx
374
- <ProgressBar tokens={{ '$progress': `${percent}%` }} />
393
+ <ProgressBar tokens={{ $progress: `${percent}%` }} />
375
394
  ```
376
395
 
377
396
  4. **Create styled wrappers** — extend a component's styles with `tasty(Base, { styles })`: