@tenphi/tasty 0.0.0-snapshot.27699f6 → 0.0.0-snapshot.27b6708
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.
- package/README.md +171 -107
- package/dist/{async-storage-B7_o6FKt.js → async-storage-DKK-wTD4.js} +1 -1
- package/dist/{async-storage-B7_o6FKt.js.map → async-storage-DKK-wTD4.js.map} +1 -1
- package/dist/babel-BUQGeOXA.d.ts +83 -0
- package/dist/{collector-QwpPODsy.js → collector-DTahQUiV.js} +97 -23
- package/dist/collector-DTahQUiV.js.map +1 -0
- package/dist/{collector-LuU1vZ68.d.ts → collector-DUaHCcTS.d.ts} +54 -7
- package/dist/{config-rrijM-U2.js → config-B5kHzuNz.js} +5144 -3012
- package/dist/config-B5kHzuNz.js.map +1 -0
- package/dist/{config-vuCRkBWX.d.ts → config-YsxGv4tq.d.ts} +412 -33
- package/dist/{context-CkSg-kDT.js → context-CA8YKeMn.js} +1 -1
- package/dist/{context-CkSg-kDT.js.map → context-CA8YKeMn.js.map} +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-BvTG0J_M.js → core-Dr4u1NVD.js} +162 -188
- package/dist/core-Dr4u1NVD.js.map +1 -0
- package/dist/{css-writer-C7HJGEmN.js → css-writer-B-J87ncv.js} +78 -17
- package/dist/css-writer-B-J87ncv.js.map +1 -0
- package/dist/{format-global-rules-Dbc_1tc3.js → format-global-rules-DklyaXv-.js} +1 -1
- package/dist/{format-global-rules-Dbc_1tc3.js.map → format-global-rules-DklyaXv-.js.map} +1 -1
- package/dist/{format-rules-BvokPr1L.js → format-rules-DKOA-6qu.js} +4 -17
- package/dist/format-rules-DKOA-6qu.js.map +1 -0
- package/dist/{hydrate-Dsv7Pwon.js → hydrate-OeMX99We.js} +3 -11
- package/dist/{hydrate-Dsv7Pwon.js.map → hydrate-OeMX99We.js.map} +1 -1
- package/dist/{index-dUtwpOux.d.ts → index-Cd45t5NM.d.ts} +319 -64
- package/dist/{index-ZRxZWzlj.d.ts → index-PqN-DIpn.d.ts} +498 -189
- package/dist/index.d.ts +5 -5
- package/dist/index.js +253 -63
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-DDqRjwa9.js → keyframes-CV8azJf3.js} +97 -191
- package/dist/keyframes-CV8azJf3.js.map +1 -0
- package/dist/{merge-styles-CtDJMhpJ.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
- package/dist/{merge-styles-B8jV6zu3.js → merge-styles-oklji0KB.js} +2 -2
- package/dist/{merge-styles-B8jV6zu3.js.map → merge-styles-oklji0KB.js.map} +1 -1
- package/dist/{resolve-recipes-BnTZz2I_.js → resolve-recipes-DTG81rzl.js} +3 -3
- package/dist/{resolve-recipes-BnTZz2I_.js.map → resolve-recipes-DTG81rzl.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-static.d.ts +16 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +8 -6
- package/dist/ssr/astro-middleware.js +10 -10
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +2 -17
- package/dist/ssr/astro.js +29 -21
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -9
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +2 -3
- package/dist/ssr/next.js +6 -7
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -81
- package/dist/zero/babel.js +39 -27
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +16 -2
- package/dist/zero/index.js +2 -2
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +12 -6
- package/docs/adoption.md +53 -28
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +59 -30
- package/docs/configuration.md +498 -69
- package/docs/debug.md +7 -7
- package/docs/design-system.md +43 -24
- package/docs/dsl.md +510 -178
- package/docs/getting-started.md +55 -34
- package/docs/injector.md +58 -5
- package/docs/methodology.md +68 -36
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +93 -25
- package/docs/plugins.md +349 -0
- package/docs/react-api.md +162 -38
- package/docs/ssr.md +45 -35
- package/docs/styles.md +65 -16
- package/docs/tasty-static.md +25 -8
- package/package.json +43 -21
- package/tasty.config.ts +6 -0
- package/dist/collector-QwpPODsy.js.map +0 -1
- package/dist/config-rrijM-U2.js.map +0 -1
- package/dist/core-BvTG0J_M.js.map +0 -1
- package/dist/css-writer-C7HJGEmN.js.map +0 -1
- package/dist/format-rules-BvokPr1L.js.map +0 -1
- package/dist/keyframes-DDqRjwa9.js.map +0 -1
package/docs/styles.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Style Properties Reference
|
|
2
2
|
|
|
3
|
-
All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and custom functions. Values are parsed through the Tasty engine automatically.
|
|
3
|
+
All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and [custom functions](dsl.md#functions-function) (`$$negative(10px)`). Values are parsed through the Tasty engine automatically.
|
|
4
4
|
|
|
5
5
|
The properties documented below have **custom handlers** with enhanced syntax. They should be **preferred** over their raw CSS equivalents because they:
|
|
6
6
|
|
|
@@ -100,18 +100,23 @@ For flex/grid layouts, outputs native `gap`. For block layouts, emulates gap usi
|
|
|
100
100
|
|
|
101
101
|
Element padding with directional modifiers and multi-group support. Use **comma-separated groups** to set a base value and then override specific directions.
|
|
102
102
|
|
|
103
|
-
**Syntax:** `[value]` | `[
|
|
103
|
+
**Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
|
|
104
104
|
|
|
105
105
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
106
106
|
|
|
107
107
|
**Output modifier:** `longhand` — forces output as individual CSS longhand properties (`padding-top`, `padding-right`, `padding-bottom`, `padding-left`) instead of the `padding` shorthand. Useful when children need to selectively inherit individual directions.
|
|
108
108
|
|
|
109
|
+
**One value per directional group.** A group that names direction modifiers takes **exactly one** value, applied to every direction it names. For different values per side, use comma-separated groups: `padding: '2x top, 4x right'`. Writing `padding: '2x 4x top right'` ignores `4x` and warns in development — the parser keeps values and modifiers in separate buckets, so their interleaving in the source is not recoverable and `'2x 4x top right'`, `'2x top 4x right'` and `'top 2x right 4x'` are all the same input.
|
|
110
|
+
|
|
111
|
+
A group that names *no* direction keeps plain CSS shorthand order, which is unambiguous and unchanged.
|
|
112
|
+
|
|
109
113
|
| Value | Effect |
|
|
110
114
|
|-------|--------|
|
|
111
115
|
| `"2x"` | All sides `2x` |
|
|
112
116
|
| `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
|
|
113
117
|
| `"2x top"` | Top `2x`, right/bottom/left `0` |
|
|
114
118
|
| `"1x left right"` | Left and right `1x`, top/bottom `0` |
|
|
119
|
+
| `"2x top, 4x right"` | Top `2x`, right `4x`, bottom/left `0` |
|
|
115
120
|
| `"1x, 2x top"` | All sides `1x`, then top overridden to `2x` |
|
|
116
121
|
| `"1x, 2x top bottom"` | Left/right `1x`, top/bottom `2x` |
|
|
117
122
|
| `"2x longhand"` | All sides `2x`, output as 4 individual `padding-*` properties |
|
|
@@ -128,17 +133,20 @@ Individual props `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`, `
|
|
|
128
133
|
|
|
129
134
|
Element margin. Same syntax, modifiers, and multi-group support as `padding`.
|
|
130
135
|
|
|
131
|
-
**Syntax:** `[value]` | `[
|
|
136
|
+
**Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
|
|
132
137
|
|
|
133
138
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
134
139
|
|
|
135
140
|
**Output modifier:** `longhand` — forces output as individual CSS longhand properties (`margin-top`, etc.) instead of the `margin` shorthand.
|
|
136
141
|
|
|
142
|
+
The [one-value-per-directional-group rule](#padding) from `padding` applies here too.
|
|
143
|
+
|
|
137
144
|
| Value | Effect |
|
|
138
145
|
|-------|--------|
|
|
139
146
|
| `"2x"` | All sides `2x` |
|
|
140
147
|
| `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
|
|
141
148
|
| `"2x top"` | Top `2x`, right/bottom/left `0` |
|
|
149
|
+
| `"2x top, 4x right"` | Top `2x`, right `4x`, bottom/left `0` |
|
|
142
150
|
| `"auto left right, 1x top bottom"` | Left/right `auto`, top/bottom `1x` |
|
|
143
151
|
| `true` | All sides `1x` |
|
|
144
152
|
| Number | Converted to `px` |
|
|
@@ -191,10 +199,23 @@ Separate `minHeight` and `maxHeight` props are supported and override values fro
|
|
|
191
199
|
|
|
192
200
|
Positioning offsets with directional modifiers and multi-group support. Same directional syntax as `padding`.
|
|
193
201
|
|
|
194
|
-
**Syntax:** `[value]` | `[
|
|
202
|
+
**Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
|
|
195
203
|
|
|
196
204
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
197
205
|
|
|
206
|
+
The [one-value-per-directional-group rule](#padding) from `padding` applies here too, with `dock`
|
|
207
|
+
as the single exception.
|
|
208
|
+
|
|
209
|
+
**`dock` modifier:** pins the named edge and spans its full length, by also applying the value
|
|
210
|
+
to the two perpendicular sides. `inset: 'bottom dock'` gives `inset: auto 0 0 0` — anchored to
|
|
211
|
+
the bottom, full width. Without a direction, `dock` fills every side.
|
|
212
|
+
|
|
213
|
+
`dock` is the one place a directional group takes **two** values: the first insets the named
|
|
214
|
+
edge, the second the sides it spans. `inset: '2x 4x bottom dock'` pins the bottom at `2x` and
|
|
215
|
+
insets the sides by `4x`. A third value, or a second value without `dock`, is ignored and warns
|
|
216
|
+
in development. With several directions the first value applies to each named edge and the
|
|
217
|
+
second to every side they span.
|
|
218
|
+
|
|
198
219
|
**Output modifier:** `longhand` — forces output as individual CSS properties (`top`, `right`, `bottom`, `left`) instead of the `inset` shorthand.
|
|
199
220
|
|
|
200
221
|
| Value | Effect |
|
|
@@ -205,6 +226,11 @@ Positioning offsets with directional modifiers and multi-group support. Same dir
|
|
|
205
226
|
| `"0, 2x top"` | All sides `0`, then top overridden to `2x` |
|
|
206
227
|
| `"0 longhand"` | All sides `0`, output as individual `top`/`right`/`bottom`/`left` |
|
|
207
228
|
| `true` | All sides `0` |
|
|
229
|
+
| `"bottom dock"` | Bottom/left/right `0`, top `auto` — bottom-anchored, full width |
|
|
230
|
+
| `"right dock"` | Right/top/bottom `0`, left `auto` — right-anchored, full height |
|
|
231
|
+
| `"2x bottom dock"` | Bottom/left/right `2x`, top `auto` |
|
|
232
|
+
| `"2x 4x bottom dock"` | Bottom `2x`, left/right `4x`, top `auto` |
|
|
233
|
+
| `"dock"` | All sides `0` |
|
|
208
234
|
|
|
209
235
|
Later comma-separated groups override earlier groups for conflicting directions.
|
|
210
236
|
|
|
@@ -228,6 +254,7 @@ Background color with design token support. Preferred over `backgroundColor` and
|
|
|
228
254
|
| `"#purple.10"` | Token color at 10% opacity |
|
|
229
255
|
| `"#surface #primary.10"` | Background `#surface` with `#primary.10` overlay (two colors enable smooth transitions between both) |
|
|
230
256
|
| `"rgb(255 128 0)"` | CSS color value |
|
|
257
|
+
| `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
231
258
|
| `true` | Default fill color |
|
|
232
259
|
|
|
233
260
|
When two colors are provided, the first sets the background color and the second is applied as an overlay gradient layer. This enables independent CSS transitions on each color. The overlay is only applied when no explicit `image` or `backgroundImage` is set.
|
|
@@ -260,9 +287,17 @@ Text color with design token support.
|
|
|
260
287
|
| `"#current"` | Current inherited color |
|
|
261
288
|
| `"#current.5"` | Current inherited color at 50% opacity |
|
|
262
289
|
| `"(#primary, #secondary)"` | Fallback: use `#primary`, fall back to `#secondary` |
|
|
290
|
+
| `"light-dark(#dark, #light)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
263
291
|
| `true` | `currentColor` |
|
|
264
292
|
|
|
265
|
-
|
|
293
|
+
Also sets `$current-color` to the same color, for anything that needs the
|
|
294
|
+
inherited color as a color rather than as the `currentcolor` keyword. Every color
|
|
295
|
+
publishes it, not just a named token, so a reader below always takes the nearest
|
|
296
|
+
`color` rather than the nearest *token* color. A value that already reads the
|
|
297
|
+
inherited color — `#current` itself, a `#current` fade, a bare `currentColor` —
|
|
298
|
+
is not republished: resolving it a second time one level down would fade it
|
|
299
|
+
twice, and the variable into itself is a self-reference. `#current` does not go
|
|
300
|
+
through it; it is the keyword.
|
|
266
301
|
|
|
267
302
|
### `svgFill`
|
|
268
303
|
|
|
@@ -270,7 +305,7 @@ SVG fill color. Same color token syntax as `fill` and `color`. Outputs the nativ
|
|
|
270
305
|
|
|
271
306
|
```jsx
|
|
272
307
|
svgFill="#purple.10"
|
|
273
|
-
svgFill="
|
|
308
|
+
svgFill="#current"
|
|
274
309
|
```
|
|
275
310
|
|
|
276
311
|
---
|
|
@@ -319,7 +354,11 @@ Border radius with shape presets and directional modifiers.
|
|
|
319
354
|
| `"backleaf"` | Asymmetric: round, sharp, round, sharp |
|
|
320
355
|
| `"inherit"` | Inherit border-radius from parent |
|
|
321
356
|
|
|
322
|
-
**
|
|
357
|
+
**Edge modifiers:** `top`, `right`, `bottom`, `left` — rounds the *pair* of corners along that edge.
|
|
358
|
+
|
|
359
|
+
**Corner modifiers:** `top-left`, `top-right`, `bottom-right`, `bottom-left` — rounds a single corner.
|
|
360
|
+
Use these when an edge modifier would round one corner too many. Edge and corner modifiers combine
|
|
361
|
+
(`radius: 'top bottom-right'`).
|
|
323
362
|
|
|
324
363
|
**Output modifier:** `longhand` — forces output as individual CSS longhand properties (`border-top-left-radius`, `border-top-right-radius`, `border-bottom-right-radius`, `border-bottom-left-radius`) instead of the `border-radius` shorthand. Useful when children need to selectively inherit individual corners via `radius: 'inherit left'`.
|
|
325
364
|
|
|
@@ -334,6 +373,9 @@ Border radius with shape presets and directional modifiers.
|
|
|
334
373
|
| `"1r longhand"` | All corners `1r`, output as 4 individual `border-*-radius` properties |
|
|
335
374
|
| `"inherit"` | All corners inherit from parent (`border-radius: inherit`) |
|
|
336
375
|
| `"inherit right"` | Right corners inherit from parent (uses longhand properties) |
|
|
376
|
+
| `"top-right"` | Top-right corner `1r`, every other corner `0` |
|
|
377
|
+
| `"4px top-left"` | Top-left corner `4px`, every other corner `0` |
|
|
378
|
+
| `"top bottom-right"` | Both top corners and bottom-right `1r`, bottom-left `0` |
|
|
337
379
|
|
|
338
380
|
### `outline`
|
|
339
381
|
|
|
@@ -378,11 +420,11 @@ Multiple shadows: `shadow="1x 1x 2x #dark.20, inset 0 0 4x #dark.10"`
|
|
|
378
420
|
|
|
379
421
|
Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style, and text-transform from named design tokens.
|
|
380
422
|
|
|
381
|
-
**Syntax:** `name`, `name / modifier
|
|
423
|
+
**Syntax:** `name`, `name / modifier...`, or `modifier...` (shorthand)
|
|
382
424
|
|
|
383
425
|
Preset names are project-specific (e.g. `h1`–`h6`, `t1`–`t4`, `p1`–`p4`). Register them for autocomplete by augmenting `TastyPresetNames`.
|
|
384
426
|
|
|
385
|
-
Use `/` to separate the preset name from
|
|
427
|
+
Use `/` to separate the preset name from one or more space-separated modifiers. When modifiers are used alone (without a name), the preset name defaults to `inherit`. Modifiers can be combined freely because they target different properties.
|
|
386
428
|
|
|
387
429
|
**Modifiers:**
|
|
388
430
|
|
|
@@ -394,11 +436,13 @@ Use `/` to separate the preset name from a modifier. When a modifier is used alo
|
|
|
394
436
|
| `tight` | Sets line-height equal to font-size |
|
|
395
437
|
|
|
396
438
|
```jsx
|
|
397
|
-
preset="h1"
|
|
398
|
-
preset="h2 / strong"
|
|
399
|
-
preset="
|
|
400
|
-
preset="
|
|
401
|
-
preset="
|
|
439
|
+
preset="h1" // heading 1
|
|
440
|
+
preset="h2 / strong" // bold heading 2
|
|
441
|
+
preset="h2 / strong italic" // bold + italic heading 2
|
|
442
|
+
preset="t3 / italic" // italic text 3
|
|
443
|
+
preset="t2 / strong tight" // bold text 2 with tight line-height
|
|
444
|
+
preset="bold" // inherit preset with bold (shorthand)
|
|
445
|
+
preset="bold italic" // inherit preset with bold + italic (shorthand)
|
|
402
446
|
```
|
|
403
447
|
|
|
404
448
|
Individual typography props (`fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform`) can be used alongside `preset` to override specific values, but using `preset` alone is recommended.
|
|
@@ -550,15 +594,20 @@ Scrollbar styling using CSS standard properties (`scrollbar-width`, `scrollbar-c
|
|
|
550
594
|
|
|
551
595
|
Gradient-based edge fading using CSS masks. Use **comma-separated groups** to set different widths and colors per direction.
|
|
552
596
|
|
|
553
|
-
**Syntax:** `[width] [
|
|
597
|
+
**Syntax:** `[width] [direction...] [#from-color] [#to-color]` — comma-separated for multiple groups
|
|
554
598
|
|
|
555
599
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
556
600
|
|
|
601
|
+
A group that names edges takes a **single** width, applied to every edge it names — different
|
|
602
|
+
widths per edge come from comma groups. A group that names no edge covers all four and keeps
|
|
603
|
+
plain CSS shorthand order, like `padding`. See the [`padding` rule](#padding).
|
|
604
|
+
|
|
557
605
|
| Value | Effect |
|
|
558
606
|
|-------|--------|
|
|
559
607
|
| `"top"` | Fade top edge, default width (`2x`), all other edges unfaded |
|
|
560
608
|
| `"2x left right"` | Fade left and right edges with `2x` width, top/bottom unfaded |
|
|
561
|
-
| `"3x 1x
|
|
609
|
+
| `"3x 1x"` | All edges faded — top/bottom `3x`, left/right `1x` (CSS shorthand order) |
|
|
610
|
+
| `"3x top, 1x bottom"` | Fade top with `3x` width, bottom with `1x` width |
|
|
562
611
|
| `"2x #transparent #dark"` | All edges faded with `2x` width, from `#transparent` to `#dark` |
|
|
563
612
|
| `"top #a #b, bottom #c #d"` | Top fades from `#a` to `#b`, bottom fades from `#c` to `#d` |
|
|
564
613
|
|
package/docs/tasty-static.md
CHANGED
|
@@ -20,7 +20,7 @@ The zero-runtime mode is part of the main `@tenphi/tasty` package but requires a
|
|
|
20
20
|
| `@babel/core` | >= 7.24 | Babel plugin (`@tenphi/tasty/babel-plugin`) |
|
|
21
21
|
| `@babel/helper-plugin-utils` | >= 7.24 | Babel plugin |
|
|
22
22
|
| `@babel/types` | >= 7.24 | Babel plugin |
|
|
23
|
-
| `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/next`) when using `configFile` option |
|
|
23
|
+
| `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/zero/next`) when using `configFile` option |
|
|
24
24
|
|
|
25
25
|
All of these are declared as optional peer dependencies of `@tenphi/tasty`. Install only what your setup requires:
|
|
26
26
|
|
|
@@ -168,16 +168,32 @@ module.exports = {
|
|
|
168
168
|
| `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
|
|
169
169
|
| `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
|
|
170
170
|
| `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
|
|
171
|
-
| `config.
|
|
172
|
-
| `config.
|
|
171
|
+
| `config.fontFaces` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
|
|
172
|
+
| `config.counterStyles` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
|
|
173
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.
|
|
174
|
+
| `config.functions` | `Record<string, FunctionDefinition \| Function>` | — | Custom functions (merged). Bare keys → parse functions; `$$name` keys → declarative CSS `@function` definitions |
|
|
175
|
+
| `config.polyfills` | `{ functions?: boolean }` | `{}` | Opt-in polyfills. `functions: true` inlines `@function` calls into plain CSS at build time |
|
|
175
176
|
| `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
|
|
176
177
|
| `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
|
|
177
178
|
| `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
|
|
178
179
|
| `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
|
|
179
180
|
| `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
|
|
180
181
|
| `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
|
|
182
|
+
| `config.namePrefix` | `string` | `'ts'` | Prefix prepended to every generated identifier. Defaults to `'ts'` so static classes never collide with runtime (`'t'`) classes. See [Configuration: Name prefix](configuration.md#name-prefix). |
|
|
183
|
+
|
|
184
|
+
### Coexisting with runtime tasty
|
|
185
|
+
|
|
186
|
+
When a page mixes `tastyStatic` with runtime `tasty`, both must use **different** `namePrefix` values. The defaults handle this automatically (`'t'` for runtime, `'ts'` for zero-runtime). If you customize one, customize the other:
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
// tasty-zero.config.ts (Babel plugin)
|
|
190
|
+
export default { namePrefix: 'mbs' };
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
// app entry (runtime configure)
|
|
195
|
+
configure({ namePrefix: 'mb' });
|
|
196
|
+
```
|
|
181
197
|
|
|
182
198
|
---
|
|
183
199
|
|
|
@@ -221,7 +237,7 @@ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automa
|
|
|
221
237
|
|
|
222
238
|
```typescript
|
|
223
239
|
// next.config.ts
|
|
224
|
-
import { withTastyZero } from '@tenphi/tasty/next';
|
|
240
|
+
import { withTastyZero } from '@tenphi/tasty/zero/next';
|
|
225
241
|
|
|
226
242
|
export default withTastyZero({
|
|
227
243
|
output: 'public/tasty.css',
|
|
@@ -380,7 +396,7 @@ With Next.js:
|
|
|
380
396
|
|
|
381
397
|
```typescript
|
|
382
398
|
// next.config.ts
|
|
383
|
-
import { withTastyZero } from '@tenphi/tasty/next';
|
|
399
|
+
import { withTastyZero } from '@tenphi/tasty/zero/next';
|
|
384
400
|
|
|
385
401
|
export default withTastyZero({
|
|
386
402
|
mode: 'inject',
|
|
@@ -496,12 +512,12 @@ For dynamic styling needs, combine with regular CSS or CSS variables:
|
|
|
496
512
|
```tsx
|
|
497
513
|
const card = tastyStatic({
|
|
498
514
|
padding: '4x',
|
|
499
|
-
fill: '
|
|
515
|
+
fill: '($card-bg, #white)',
|
|
500
516
|
});
|
|
501
517
|
|
|
502
518
|
<div
|
|
503
519
|
className={card}
|
|
504
|
-
style={{ '--card-bg': isActive ? '
|
|
520
|
+
style={{ '--card-bg': isActive ? 'var(--purple-color)' : 'var(--white-color)' }}
|
|
505
521
|
/>
|
|
506
522
|
```
|
|
507
523
|
|
|
@@ -530,3 +546,4 @@ const card = tastyStatic({
|
|
|
530
546
|
- [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
|
|
531
547
|
- [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
|
|
532
548
|
- [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
|
|
549
|
+
- [Plugins & Extension Points](plugins.md) — Which extension points work at build time (`functions`, `units`, `states`, `handlers`, `recipes`) and which do not (`propHandlers` — `tastyStatic()` takes styles objects, not props)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/tasty",
|
|
3
|
-
"version": "0.0.0-snapshot.
|
|
3
|
+
"version": "0.0.0-snapshot.27b6708",
|
|
4
4
|
"description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"import": "./dist/zero/index.js",
|
|
33
33
|
"default": "./dist/zero/index.js"
|
|
34
34
|
},
|
|
35
|
-
"./next": {
|
|
35
|
+
"./zero/next": {
|
|
36
36
|
"types": "./dist/zero/next.d.ts",
|
|
37
37
|
"import": "./dist/zero/next.js",
|
|
38
38
|
"default": "./dist/zero/next.js"
|
|
@@ -62,6 +62,16 @@
|
|
|
62
62
|
"import": "./dist/ssr/astro-client.js",
|
|
63
63
|
"default": "./dist/ssr/astro-client.js"
|
|
64
64
|
},
|
|
65
|
+
"./ssr/astro-middleware": {
|
|
66
|
+
"types": "./dist/ssr/astro-middleware.d.ts",
|
|
67
|
+
"import": "./dist/ssr/astro-middleware.js",
|
|
68
|
+
"default": "./dist/ssr/astro-middleware.js"
|
|
69
|
+
},
|
|
70
|
+
"./ssr/astro-middleware-static": {
|
|
71
|
+
"types": "./dist/ssr/astro-middleware-static.d.ts",
|
|
72
|
+
"import": "./dist/ssr/astro-middleware-static.js",
|
|
73
|
+
"default": "./dist/ssr/astro-middleware-static.js"
|
|
74
|
+
},
|
|
65
75
|
"./tasty.config": "./tasty.config.ts"
|
|
66
76
|
},
|
|
67
77
|
"files": [
|
|
@@ -73,7 +83,9 @@
|
|
|
73
83
|
"./dist/ssr/index.js",
|
|
74
84
|
"./dist/ssr/next.js",
|
|
75
85
|
"./dist/ssr/astro.js",
|
|
76
|
-
"./dist/ssr/astro-client.js"
|
|
86
|
+
"./dist/ssr/astro-client.js",
|
|
87
|
+
"./dist/ssr/astro-middleware.js",
|
|
88
|
+
"./dist/ssr/astro-middleware-static.js"
|
|
77
89
|
],
|
|
78
90
|
"engines": {
|
|
79
91
|
"node": ">=20"
|
|
@@ -81,6 +93,9 @@
|
|
|
81
93
|
"scripts": {
|
|
82
94
|
"build": "tsdown",
|
|
83
95
|
"test": "vitest run",
|
|
96
|
+
"test:node": "vitest run --project node",
|
|
97
|
+
"test:browser": "vitest run --project browser",
|
|
98
|
+
"test:setup": "playwright install chromium",
|
|
84
99
|
"test:watch": "vitest",
|
|
85
100
|
"test:coverage": "vitest run --coverage",
|
|
86
101
|
"typecheck": "tsc --noEmit",
|
|
@@ -89,11 +104,14 @@
|
|
|
89
104
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
90
105
|
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
91
106
|
"size": "size-limit",
|
|
92
|
-
"bench": "vitest bench",
|
|
107
|
+
"bench": "vitest bench --project node",
|
|
108
|
+
"bench:browser": "vitest bench --project browser",
|
|
93
109
|
"prepublishOnly": "pnpm run build",
|
|
94
110
|
"changeset": "changeset",
|
|
95
111
|
"version": "changeset version",
|
|
96
112
|
"release": "changeset publish",
|
|
113
|
+
"knip": "knip",
|
|
114
|
+
"check:test-only": "node scripts/check-test-only-code.mjs",
|
|
97
115
|
"hygiene": "pnpm lint && pnpm format:check && pnpm typecheck",
|
|
98
116
|
"hygiene:fix": "pnpm lint:fix && pnpm format && pnpm typecheck"
|
|
99
117
|
},
|
|
@@ -123,6 +141,7 @@
|
|
|
123
141
|
"@babel/helper-plugin-utils": "^7.24.0",
|
|
124
142
|
"@babel/types": "^7.24.0",
|
|
125
143
|
"jiti": "^2.6.1",
|
|
144
|
+
"next": ">=14.0.0",
|
|
126
145
|
"react": "^18.0.0 || ^19.0.0"
|
|
127
146
|
},
|
|
128
147
|
"peerDependenciesMeta": {
|
|
@@ -140,6 +159,9 @@
|
|
|
140
159
|
},
|
|
141
160
|
"jiti": {
|
|
142
161
|
"optional": true
|
|
162
|
+
},
|
|
163
|
+
"next": {
|
|
164
|
+
"optional": true
|
|
143
165
|
}
|
|
144
166
|
},
|
|
145
167
|
"dependencies": {
|
|
@@ -147,54 +169,54 @@
|
|
|
147
169
|
},
|
|
148
170
|
"devDependencies": {
|
|
149
171
|
"@babel/core": "^7.24.0",
|
|
150
|
-
"@
|
|
172
|
+
"@babel/helper-plugin-utils": "^7.24.0",
|
|
173
|
+
"@babel/types": "^7.24.0",
|
|
174
|
+
"@changesets/changelog-github": "^0.7.0",
|
|
151
175
|
"@changesets/cli": "^2.29.8",
|
|
152
176
|
"@eslint/js": "^10.0.1",
|
|
153
177
|
"@size-limit/esbuild": "^12.0.0",
|
|
154
178
|
"@size-limit/file": "^12.0.0",
|
|
179
|
+
"@tenphi/eslint-plugin-tasty": "^0.11.3",
|
|
155
180
|
"@testing-library/jest-dom": "^6.9.1",
|
|
156
181
|
"@testing-library/react": "^16.3.2",
|
|
157
182
|
"@types/babel__core": "^7.20.5",
|
|
158
183
|
"@types/babel__helper-plugin-utils": "^7.10.3",
|
|
159
184
|
"@types/node": "^25.3.2",
|
|
160
185
|
"@types/react": "^19.0.0",
|
|
161
|
-
"@vitest/
|
|
186
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
162
187
|
"eslint": "^10.0.0",
|
|
163
188
|
"eslint-config-prettier": "^10.1.8",
|
|
164
|
-
"
|
|
165
|
-
"
|
|
189
|
+
"jiti": "^2.6.1",
|
|
190
|
+
"knip": "^5.61.3",
|
|
191
|
+
"next": "^16.0.0",
|
|
192
|
+
"playwright": "^1.62.1",
|
|
166
193
|
"prettier": "^3.8.1",
|
|
167
194
|
"react": "^19.0.0",
|
|
168
195
|
"size-limit": "^12.0.0",
|
|
169
|
-
"tsdown": "^0.
|
|
196
|
+
"tsdown": "^0.22.0",
|
|
170
197
|
"typescript": "^6.0.2",
|
|
171
198
|
"typescript-eslint": "^8.56.0",
|
|
172
|
-
"vitest": "^4.
|
|
173
|
-
},
|
|
174
|
-
"pnpm": {
|
|
175
|
-
"onlyBuiltDependencies": [
|
|
176
|
-
"esbuild"
|
|
177
|
-
]
|
|
199
|
+
"vitest": "^4.1.10"
|
|
178
200
|
},
|
|
179
|
-
"packageManager": "pnpm@
|
|
201
|
+
"packageManager": "pnpm@11.0.8",
|
|
180
202
|
"size-limit": [
|
|
181
203
|
{
|
|
182
204
|
"name": "main (import *)",
|
|
183
205
|
"path": "dist/index.js",
|
|
184
206
|
"import": "*",
|
|
185
|
-
"limit": "
|
|
207
|
+
"limit": "56.6 kB"
|
|
186
208
|
},
|
|
187
209
|
{
|
|
188
210
|
"name": "core (import *)",
|
|
189
211
|
"path": "dist/core/index.js",
|
|
190
212
|
"import": "*",
|
|
191
|
-
"limit": "
|
|
213
|
+
"limit": "53.65 kB"
|
|
192
214
|
},
|
|
193
215
|
{
|
|
194
216
|
"name": "static",
|
|
195
217
|
"path": "dist/static/index.js",
|
|
196
218
|
"import": "*",
|
|
197
|
-
"limit": "
|
|
219
|
+
"limit": "16.8 kB"
|
|
198
220
|
},
|
|
199
221
|
{
|
|
200
222
|
"name": "zero",
|
|
@@ -205,7 +227,7 @@
|
|
|
205
227
|
"path",
|
|
206
228
|
"crypto"
|
|
207
229
|
],
|
|
208
|
-
"limit": "
|
|
230
|
+
"limit": "31.25 kB"
|
|
209
231
|
},
|
|
210
232
|
{
|
|
211
233
|
"name": "babel-plugin",
|
|
@@ -216,7 +238,7 @@
|
|
|
216
238
|
"path",
|
|
217
239
|
"crypto"
|
|
218
240
|
],
|
|
219
|
-
"limit": "
|
|
241
|
+
"limit": "49.35 kB"
|
|
220
242
|
}
|
|
221
243
|
]
|
|
222
244
|
}
|
package/tasty.config.ts
CHANGED
|
@@ -3,6 +3,7 @@ export default {
|
|
|
3
3
|
'#white',
|
|
4
4
|
'#black',
|
|
5
5
|
'#current',
|
|
6
|
+
'#clear',
|
|
6
7
|
'$gap',
|
|
7
8
|
'$radius',
|
|
8
9
|
'$border-width',
|
|
@@ -11,4 +12,9 @@ export default {
|
|
|
11
12
|
'$sharp-radius',
|
|
12
13
|
'$bold-font-weight',
|
|
13
14
|
],
|
|
15
|
+
styles: ['viewTransitionName'],
|
|
16
|
+
// This repo imports its own API relatively, so the plugin's default
|
|
17
|
+
// `@tenphi/tasty` import tracking never matches. List the local entry points so
|
|
18
|
+
// `tasty({ styles })` call sites are actually linted.
|
|
19
|
+
importSources: ['@tenphi/tasty', './tasty', '../tasty', './src/tasty'],
|
|
14
20
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector-QwpPODsy.js","names":[],"sources":["../src/ssr/collector.ts"],"sourcesContent":["/**\n * ServerStyleCollector — server-safe style collector for SSR.\n *\n * Accumulates CSS rules and cache metadata during server rendering.\n * This is the server-side counterpart to StyleInjector: it allocates\n * hash-based class names (`t${hash}`), formats CSS rules into text,\n * and tracks rendered class names for lightweight client transfer.\n *\n * One instance is created per HTTP request. Concurrent requests\n * each get their own collector (via AsyncLocalStorage or React context).\n */\n\nimport {\n getEffectiveProperties,\n getGlobalStyles,\n getGlobalCounterStyle,\n getGlobalFontFace,\n getGlobalConfigTokens,\n} from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport { renderStyles } from '../pipeline';\nimport type { StyleResult } from '../pipeline';\nimport { hashString } from '../utils/hash';\nimport { formatPropertyCSS } from './format-property';\nimport { formatGlobalRules } from './format-global-rules';\nimport { formatRules } from './format-rules';\n\nfunction generateClassName(cacheKey: string): string {\n return `t${hashString(cacheKey)}`;\n}\n\nexport class ServerStyleCollector {\n private chunks = new Map<string, string>();\n private cacheKeyToClassName = new Map<string, string>();\n private flushedKeys = new Set<string>();\n private propertyRules = new Map<string, string>();\n private flushedPropertyKeys = new Set<string>();\n private keyframeRules = new Map<string, string>();\n private flushedKeyframeKeys = new Set<string>();\n private globalStyles = new Map<string, string>();\n private flushedGlobalKeys = new Set<string>();\n private rawCSS = new Map<string, string>();\n private flushedRawKeys = new Set<string>();\n private fontFaceRules = new Map<string, string>();\n private flushedFontFaceKeys = new Set<string>();\n private counterStyleRules = new Map<string, string>();\n private flushedCounterStyleKeys = new Set<string>();\n private keyframesCounter = 0;\n private counterStyleCounter = 0;\n private internalsCollected = false;\n\n /**\n * Collect internal @property rules and :root token defaults.\n * Mirrors markStylesGenerated() from the client-side injector.\n * Called automatically on first chunk collection; idempotent.\n *\n * Internals are always emitted here — the RSC path deliberately\n * defers to SSR so that tokens appear exactly once per page in\n * <style data-tasty-ssr> (avoiding duplication of large token sets).\n */\n collectInternals(): void {\n if (this.internalsCollected) return;\n this.internalsCollected = true;\n\n for (const [token, definition] of Object.entries(\n getEffectiveProperties(),\n )) {\n const css = formatPropertyCSS(token, definition);\n if (css) {\n this.collectProperty(`__prop:${token}`, css);\n }\n }\n\n const tokenStyles = getGlobalConfigTokens();\n if (tokenStyles && Object.keys(tokenStyles).length > 0) {\n const tokenRules = renderStyles(tokenStyles, ':root') as StyleResult[];\n if (tokenRules.length > 0) {\n const css = formatGlobalRules(tokenRules);\n if (css) {\n this.collectGlobalStyles('__global:tokens', css);\n }\n }\n }\n\n const globalFF = getGlobalFontFace();\n if (globalFF) {\n for (const [family, input] of Object.entries(globalFF)) {\n const descriptors = Array.isArray(input) ? input : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n this.collectFontFace(hash, css);\n }\n }\n }\n\n const globalCS = getGlobalCounterStyle();\n if (globalCS) {\n for (const [name, descriptors] of Object.entries(globalCS)) {\n const css = formatCounterStyleRule(name, descriptors);\n this.collectCounterStyle(name, css);\n }\n }\n\n const globalStyles = getGlobalStyles();\n if (globalStyles) {\n for (const [selector, styles] of Object.entries(globalStyles)) {\n if (Object.keys(styles).length > 0) {\n const rules = renderStyles(styles, selector) as StyleResult[];\n if (rules.length > 0) {\n const css = formatGlobalRules(rules);\n if (css) {\n this.collectGlobalStyles(`__global:styles:${selector}`, css);\n }\n }\n }\n }\n }\n }\n\n /**\n * Allocate a className for a cache key, server-side.\n * Mirrors StyleInjector.allocateClassName but without DOM access.\n */\n allocateClassName(cacheKey: string): {\n className: string;\n isNewAllocation: boolean;\n } {\n const existing = this.cacheKeyToClassName.get(cacheKey);\n if (existing) {\n return { className: existing, isNewAllocation: false };\n }\n\n const className = generateClassName(cacheKey);\n this.cacheKeyToClassName.set(cacheKey, className);\n\n return { className, isNewAllocation: true };\n }\n\n /**\n * Record CSS rules for a chunk.\n * Called by useStyles during server render.\n */\n collectChunk(\n cacheKey: string,\n className: string,\n rules: StyleResult[],\n ): void {\n if (this.chunks.has(cacheKey)) return;\n const css = formatRules(rules, className);\n if (css) {\n this.chunks.set(cacheKey, css);\n }\n }\n\n /**\n * Record a @property rule. Deduplicated by name.\n */\n collectProperty(name: string, css: string): void {\n if (!this.propertyRules.has(name)) {\n this.propertyRules.set(name, css);\n }\n }\n\n /**\n * Record a @keyframes rule. Deduplicated by name.\n */\n collectKeyframes(name: string, css: string): void {\n if (!this.keyframeRules.has(name)) {\n this.keyframeRules.set(name, css);\n }\n }\n\n /**\n * Allocate a keyframe name for SSR. Uses provided name or generates one.\n */\n allocateKeyframeName(providedName?: string): string {\n return providedName ?? `k${this.keyframesCounter++}`;\n }\n\n /**\n * Record a @font-face rule. Deduplicated by key (content hash).\n */\n collectFontFace(key: string, css: string): void {\n if (!this.fontFaceRules.has(key)) {\n this.fontFaceRules.set(key, css);\n }\n }\n\n /**\n * Record a @counter-style rule. Deduplicated by name.\n */\n collectCounterStyle(name: string, css: string): void {\n if (!this.counterStyleRules.has(name)) {\n this.counterStyleRules.set(name, css);\n }\n }\n\n /**\n * Allocate a counter-style name for SSR. Uses provided name or generates one.\n */\n allocateCounterStyleName(providedName?: string): string {\n return providedName ?? `cs${this.counterStyleCounter++}`;\n }\n\n /**\n * Record global styles (from useGlobalStyles). Deduplicated by key.\n */\n collectGlobalStyles(key: string, css: string): void {\n if (!this.globalStyles.has(key)) {\n this.globalStyles.set(key, css);\n }\n }\n\n /**\n * Record raw CSS text (from useRawCSS). Deduplicated by key.\n */\n collectRawCSS(key: string, css: string): void {\n if (!this.rawCSS.has(key)) {\n this.rawCSS.set(key, css);\n }\n }\n\n /**\n * Extract all CSS collected so far as a single string.\n * Includes @property and @keyframes rules.\n * Used for non-streaming SSR (renderToString).\n */\n getCSS(): string {\n const parts: string[] = [];\n\n for (const css of this.propertyRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.fontFaceRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.counterStyleRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.rawCSS.values()) {\n parts.push(css);\n }\n\n for (const css of this.globalStyles.values()) {\n parts.push(css);\n }\n\n for (const css of this.chunks.values()) {\n parts.push(css);\n }\n\n for (const css of this.keyframeRules.values()) {\n parts.push(css);\n }\n\n return parts.join('\\n');\n }\n\n /**\n * Flush only newly collected CSS since the last flush.\n * Used for streaming SSR (renderToPipeableStream + useServerInsertedHTML).\n */\n flushCSS(): string {\n const parts: string[] = [];\n\n for (const [name, css] of this.propertyRules) {\n if (!this.flushedPropertyKeys.has(name)) {\n parts.push(css);\n this.flushedPropertyKeys.add(name);\n }\n }\n\n for (const [key, css] of this.fontFaceRules) {\n if (!this.flushedFontFaceKeys.has(key)) {\n parts.push(css);\n this.flushedFontFaceKeys.add(key);\n }\n }\n\n for (const [key, css] of this.counterStyleRules) {\n if (!this.flushedCounterStyleKeys.has(key)) {\n parts.push(css);\n this.flushedCounterStyleKeys.add(key);\n }\n }\n\n for (const [key, css] of this.rawCSS) {\n if (!this.flushedRawKeys.has(key)) {\n parts.push(css);\n this.flushedRawKeys.add(key);\n }\n }\n\n for (const [key, css] of this.globalStyles) {\n if (!this.flushedGlobalKeys.has(key)) {\n parts.push(css);\n this.flushedGlobalKeys.add(key);\n }\n }\n\n for (const [key, css] of this.chunks) {\n if (!this.flushedKeys.has(key)) {\n parts.push(css);\n this.flushedKeys.add(key);\n }\n }\n\n for (const [name, css] of this.keyframeRules) {\n if (!this.flushedKeyframeKeys.has(name)) {\n parts.push(css);\n this.flushedKeyframeKeys.add(name);\n }\n }\n\n return parts.join('\\n');\n }\n\n private flushedClassNames = new Set<string>();\n\n /**\n * Return class names rendered since the last call (for streaming).\n * Used to emit lightweight class-list scripts for client hydration.\n */\n getRenderedClassNames(): string[] {\n const names: string[] = [];\n for (const className of this.cacheKeyToClassName.values()) {\n if (!this.flushedClassNames.has(className)) {\n this.flushedClassNames.add(className);\n names.push(className);\n }\n }\n return names;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,SAAS,kBAAkB,UAA0B;AACnD,QAAO,IAAI,WAAW,SAAS;;AAGjC,IAAa,uBAAb,MAAkC;CAChC,yBAAiB,IAAI,KAAqB;CAC1C,sCAA8B,IAAI,KAAqB;CACvD,8BAAsB,IAAI,KAAa;CACvC,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,+BAAuB,IAAI,KAAqB;CAChD,oCAA4B,IAAI,KAAa;CAC7C,yBAAiB,IAAI,KAAqB;CAC1C,iCAAyB,IAAI,KAAa;CAC1C,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,oCAA4B,IAAI,KAAqB;CACrD,0CAAkC,IAAI,KAAa;CACnD,mBAA2B;CAC3B,sBAA8B;CAC9B,qBAA6B;;;;;;;;;;CAW7B,mBAAyB;AACvB,MAAI,KAAK,mBAAoB;AAC7B,OAAK,qBAAqB;AAE1B,OAAK,MAAM,CAAC,OAAO,eAAe,OAAO,QACvC,wBAAwB,CACzB,EAAE;GACD,MAAM,MAAM,kBAAkB,OAAO,WAAW;AAChD,OAAI,IACF,MAAK,gBAAgB,UAAU,SAAS,IAAI;;EAIhD,MAAM,c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