@tenphi/tasty 3.1.0 → 3.3.0

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 (54) hide show
  1. package/README.md +1 -0
  2. package/dist/{babel-R2qT7yLN.d.ts → babel-BUQGeOXA.d.ts} +2 -2
  3. package/dist/{collector-D7yzmG5G.js → collector-BNQJyxFh.js} +3 -3
  4. package/dist/{collector-D7yzmG5G.js.map → collector-BNQJyxFh.js.map} +1 -1
  5. package/dist/{collector-D8o4Wdq-.d.ts → collector-DUaHCcTS.d.ts} +2 -2
  6. package/dist/{config-De8L9NWM.d.ts → config-YsxGv4tq.d.ts} +101 -10
  7. package/dist/{config-CwQ-fAsp.js → config-zkrtb424.js} +739 -960
  8. package/dist/config-zkrtb424.js.map +1 -0
  9. package/dist/core/index.d.ts +5 -5
  10. package/dist/core/index.js +6 -6
  11. package/dist/{core-CqSh853z.js → core-Bf48Z1I-.js} +57 -41
  12. package/dist/core-Bf48Z1I-.js.map +1 -0
  13. package/dist/{css-writer-dS1srTkS.js → css-writer-B-SvwNbq.js} +3 -3
  14. package/dist/{css-writer-dS1srTkS.js.map → css-writer-B-SvwNbq.js.map} +1 -1
  15. package/dist/{format-rules-CaW4lJGg.js → format-rules-Co21uwA3.js} +5 -20
  16. package/dist/format-rules-Co21uwA3.js.map +1 -0
  17. package/dist/{hydrate-uFv9kx7G.js → hydrate-D38TyhAG.js} +2 -2
  18. package/dist/{hydrate-uFv9kx7G.js.map → hydrate-D38TyhAG.js.map} +1 -1
  19. package/dist/{index-KUYya3x7.d.ts → index-Cd45t5NM.d.ts} +108 -3
  20. package/dist/{index-DzGxoeyN.d.ts → index-DhhUI0yi.d.ts} +63 -12
  21. package/dist/index.d.ts +5 -5
  22. package/dist/index.js +62 -8
  23. package/dist/index.js.map +1 -1
  24. package/dist/{keyframes-DaZhjqkd.js → keyframes-mDAB6pLf.js} +2 -2
  25. package/dist/{keyframes-DaZhjqkd.js.map → keyframes-mDAB6pLf.js.map} +1 -1
  26. package/dist/{merge-styles-H8LFJ5HY.js → merge-styles-CFwtEHzv.js} +2 -2
  27. package/dist/{merge-styles-H8LFJ5HY.js.map → merge-styles-CFwtEHzv.js.map} +1 -1
  28. package/dist/{merge-styles-DLm4wdnb.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
  29. package/dist/{resolve-recipes-aN94fjqS.js → resolve-recipes-B8pIVinB.js} +3 -3
  30. package/dist/{resolve-recipes-aN94fjqS.js.map → resolve-recipes-B8pIVinB.js.map} +1 -1
  31. package/dist/ssr/astro-client.js +1 -1
  32. package/dist/ssr/astro.js +3 -3
  33. package/dist/ssr/index.d.ts +1 -1
  34. package/dist/ssr/index.js +3 -3
  35. package/dist/ssr/next.d.ts +1 -1
  36. package/dist/ssr/next.js +4 -4
  37. package/dist/static/index.d.ts +2 -2
  38. package/dist/static/index.js +1 -1
  39. package/dist/zero/babel.d.ts +1 -1
  40. package/dist/zero/babel.js +4 -4
  41. package/dist/zero/index.d.ts +1 -1
  42. package/dist/zero/index.js +1 -1
  43. package/dist/zero/next.d.ts +1 -1
  44. package/docs/configuration.md +195 -15
  45. package/docs/dsl.md +28 -6
  46. package/docs/injector.md +11 -0
  47. package/docs/methodology.md +1 -1
  48. package/docs/pipeline.md +1 -4
  49. package/docs/react-api.md +1 -1
  50. package/docs/styles.md +6 -1
  51. package/package.json +7 -6
  52. package/dist/config-CwQ-fAsp.js.map +0 -1
  53. package/dist/core-CqSh853z.js.map +0 -1
  54. package/dist/format-rules-CaW4lJGg.js.map +0 -1
@@ -71,32 +71,212 @@ These docs use `data-schema="dark"` in examples. If your app already standardize
71
71
  | `globalStyles` | `Record<string, Styles>` | - | Global Tasty styles keyed by CSS selector |
72
72
  | `plugins` | `TastyPlugin[]` | - | Plugins that bundle any of the above (processed in order; later override earlier, and direct config wins over all). See [Plugins](plugins.md) |
73
73
  | `gc` | `GCConfig` | - | Garbage-collection tuning for unused styles (`{ touchInterval, capacity }`) |
74
- | `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | `'oklch'` | Color space for decomposed color token companion variables |
74
+ | `batchInjection` | `boolean \| 'always'` | `false` | Defer stylesheet writes and apply them in one batch. See [Batched injection](#batched-injection) |
75
+ | `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | - | **Deprecated** — no longer has any effect. See [Color space](#color-space) |
75
76
  | `namePrefix` | `string` | `'t'` (runtime) / `'ts'` (zero-runtime) | Prefix prepended to every generated identifier (class, keyframe, counter-style names). Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. See [Name prefix](#name-prefix). |
76
77
 
77
78
  ---
78
79
 
80
+ ## Batched Injection
81
+
82
+ Every `insertRule()` on a live stylesheet invalidates style for that sheet's
83
+ scope. Components inject during React's render phase, and if anything else reads
84
+ layout in the same pass, the two interleave:
85
+
86
+ ```
87
+ inject -> read (forced style recalc) -> inject -> read (forced recalc) -> ...
88
+ ```
89
+
90
+ A UI kit that measures during render — popovers, autosizing inputs, virtualized
91
+ lists — can turn one mount into a dozen full-tree recalculations. `batchInjection`
92
+ queues the writes instead and applies them together, so the tree is invalidated
93
+ once per flush.
94
+
95
+ ```tsx
96
+ import { configure, TastyBatchProvider } from '@tenphi/tasty';
97
+
98
+ configure({ batchInjection: true });
99
+
100
+ createRoot(el).render(
101
+ <TastyBatchProvider>
102
+ <App />
103
+ </TastyBatchProvider>,
104
+ );
105
+ ```
106
+
107
+ ### Why the provider is required
108
+
109
+ Deferring a write past React's layout phase would let a `useLayoutEffect`
110
+ measure an element whose rules are not in the sheet yet and read its *unstyled*
111
+ box — a wrong number, not a stale one, so it never self-corrects.
112
+
113
+ `TastyBatchProvider` closes that hole. It opens a *batch window* during its
114
+ render and closes it — flushing — in `useInsertionEffect`, which React runs in
115
+ the mutation phase, before any layout effect:
116
+
117
+ ```
118
+ provider renders -> window OPEN
119
+ children render -> injections queued
120
+ provider insertionEffect -> FLUSH, window CLOSED
121
+ layout effects run -> rules are in the sheet
122
+ ```
123
+
124
+ With `batchInjection: true` a write is only ever queued inside such a window, so
125
+ turning the flag on can make injection cheaper but can never make a measurement
126
+ wrong. Injections outside a window are written straight through, exactly as with
127
+ batching off:
128
+
129
+ - a deep update that did not re-render the provider
130
+ - an injection from a layout effect, an event handler or an async callback
131
+ - SSR and RSC, where there is no live sheet at all
132
+
133
+ Mount the provider as high in the tree as you can: batching applies to the
134
+ commits it takes part in.
135
+
136
+ ### Modes
137
+
138
+ | Value | Behaviour |
139
+ |-------|-----------|
140
+ | `false` (default) | One `insertRule()` per component, synchronously. |
141
+ | `true` | Batch inside a provider window only. Cannot affect measurement. Without the provider nothing is batched, and dev mode says so once. |
142
+ | `'always'` | Batch every injection, flushing on a microtask when no window is open. Covers more commits; a `useLayoutEffect` measuring a freshly mounted element can read its unstyled box. Paint is unaffected — microtasks always drain before the browser paints. |
143
+
144
+ ### Ordering
145
+
146
+ All writes share one FIFO queue — component rules, global rules, raw CSS,
147
+ `@property`, `@keyframes`, `@font-face`, `@counter-style` and `@function`.
148
+ Draining it in insertion order keeps the sheet byte-identical to unbatched
149
+ output, which matters because equal-specificity rules resolve by document order.
150
+
151
+ ### SSR, RSC and zero-runtime
152
+
153
+ **Server render — nothing to batch, safe to leave enabled.** SSR and RSC collect
154
+ CSS as text through `ServerStyleCollector`; the runtime injector never runs
155
+ there, so `batchInjection` changes nothing either way. `<TastyBatchProvider>`
156
+ renders its children and does nothing else: the window it opens is a no-op
157
+ without a `document`, and the `useInsertionEffect` that would close it never
158
+ fires on the server. Configure the flag once in shared code — no environment
159
+ branching needed.
160
+
161
+ **Hydration — the better your SSR coverage, the less there is to batch.**
162
+ `hydrateTastyClasses()` (wired up for you by `@tenphi/tasty/ssr/next` and the
163
+ Astro integration) pre-populates the injector from `window.__TASTY__`, so
164
+ hydrating a server-rendered class is a cache hit that produces no sheet write at
165
+ all. Batching pays off on what SSR could not cover: client-only routes, styles
166
+ that first appear after hydration (a `styles` prop that changes on interaction, a
167
+ modal or popover mounting), and dynamic tokens.
168
+
169
+ **Astro islands — one provider per island, or `'always'`.** Every island is its
170
+ own React root, so a provider inside one island does not open a window for
171
+ another. With `batchInjection: true`, wrap each island root that renders enough
172
+ tasty components to be worth it. `'always'` needs no provider and covers every
173
+ island, at the cost of the measurement hazard above. Either way, an island that
174
+ only re-hydrates server-rendered classes has nothing to batch.
175
+
176
+ **Zero-runtime (`tastyStatic`) — unaffected.** Build-time extraction never
177
+ touches the injector: the babel plugin emits either a CSS file import or an
178
+ `injectCSS()` call from `@tenphi/tasty/static/inject`, which appends text to a
179
+ single `<style data-tasty-static>` element. `batchInjection` only defers CSSOM
180
+ writes made by the runtime injector, so extracted styles are unchanged. In an app
181
+ that mixes both, it still applies to the runtime half.
182
+
183
+ ### `flushStyles()`
184
+
185
+ Applies every pending write immediately. Every injector read API calls it for
186
+ you — `getCSSText`, `getCSSTextForClasses`, `getCSSTextForNode`,
187
+ `getRawCSSText`, `isPropertyDefined`, `getMetrics`, `cleanup`, `gc` and
188
+ `destroy` — so a read never observes a partial sheet.
189
+ Call it directly before measuring in code that runs outside a batch window under
190
+ `'always'`:
191
+
192
+ ```tsx
193
+ import { flushStyles } from '@tenphi/tasty';
194
+
195
+ useLayoutEffect(() => {
196
+ flushStyles();
197
+ const { width } = ref.current.getBoundingClientRect();
198
+ }, []);
199
+ ```
200
+
201
+ `hasPendingStyleWrites()` reports whether anything is queued, and
202
+ `resetStyleBatch()` drops the queue without applying it (tests only).
203
+
204
+ ---
205
+
79
206
  ## Color Space
80
207
 
81
- Controls the CSS color space used for decomposed color token companion variables. When you define `#name` color tokens, tasty generates both `--name-color` (the color) and `--name-color-{suffix}` (its channels, decomposed).
208
+ > **Deprecated.** `configure({ colorSpace })` no longer has any effect and will
209
+ > be removed in the next major. Setting it warns in development.
210
+
211
+ A `#name` token's value used to be rewritten into a configured color space, so
212
+ `#brand: '#ff8800'` declared `--brand-color: oklch(0.75 0.16 55)`. That existed
213
+ to serve the opacity suffix, which needed numeric channels to write an alpha
214
+ into. Opacity now uses CSS relative color syntax —
215
+ `oklch(from var(--brand-color) l c h / .5)` — which has the browser read the
216
+ channels, so there is nothing left for the setting to decide.
217
+
218
+ A color is emitted exactly as authored:
82
219
 
83
220
  ```jsx
84
- configure({
85
- colorSpace: 'oklch', // default
86
- });
221
+ configure({ tokens: { '#brand': '#ff8800' } });
222
+ // --brand-color: #ff8800
87
223
  ```
88
224
 
89
- | Color Space | Suffix | Components Format | Channel Reference |
90
- |---|---|---|---|
91
- | `rgb` | `-rgb` | `255 128 0` | `rgb(var(--name-color-rgb))` |
92
- | `hsl` | `-hsl` | `300 100% 25%` | `hsl(var(--name-color-hsl))` |
93
- | `oklch` | `-oklch` | `0.42 0.16 328` | `oklch(var(--name-color-oklch))` |
225
+ That holds for every form: a hex literal, a native color function, a bare CSS
226
+ color name, a `color-mix()`, a `light-dark()`, a fallback chain. A `#token`
227
+ reference still resolves to its `var()` chain, and a plugin color function such
228
+ as `okhsl()` is still resolved by the parser to the color it denotes.
229
+
230
+ To address a token's channels, use relative color syntax against the token:
231
+
232
+ ```css
233
+ background: oklch(from var(--brand-color) calc(l * 1.2) c h);
234
+ ```
94
235
 
95
- The `oklch` color space is the default because it provides perceptually uniform color manipulation reaching for a channel to shift lightness or hue produces more natural-looking results.
236
+ This works on any `<color>`, including the ones no build-time conversion could
237
+ have evaluated — and it is what the [opacity suffix](dsl.md#color-tokens--opacity)
238
+ itself uses. Its space is always `oklch`, which is unbounded, so a wide-gamut
239
+ color survives a round trip a narrower space would clamp.
96
240
 
97
- The companion is there so you can *address the channels*: shift a lightness, animate a hue, build a derived color. It is not how the [opacity suffix](dsl.md#color-tokens--opacity) works — that sets the alpha on `--name-color` itself with relative color syntax, so it needs nothing from the companion and works on any color.
241
+ ### Migrating off `colorSpace`
242
+
243
+ Drop the option. If you relied on the uniform output format, nothing in Tasty
244
+ needs it — author your tokens in the space you want them emitted in, since the
245
+ value now passes through untouched:
246
+
247
+ ```jsx
248
+ // before: any input, normalized to the configured space on the way out
249
+ configure({ colorSpace: 'oklch', tokens: { '#brand': '#ff8800' } });
250
+
251
+ // after: author it in the space you want
252
+ configure({ tokens: { '#brand': 'oklch(0.75 0.16 55)' } });
253
+ ```
254
+
255
+ ### Migrating off the channel companions
256
+
257
+ A `#name` token used to declare a second variable beside `--name-color` holding
258
+ its channels decomposed, suffixed with the configured space —
259
+ `--brand-color-oklch: 0.75 0.16 55` — and a `color` style emitted
260
+ `--current-color-{space}` beside `--current-color`. Both are gone, for the same
261
+ reason: they existed so an opacity suffix had channels to write an alpha into.
262
+
263
+ These were never part of the public API, but they were visible in the emitted
264
+ CSS, so hand-authored CSS may reference one. Address the token itself instead:
265
+
266
+ ```css
267
+ /* before */
268
+ color: oklch(var(--brand-color-oklch) / 0.5);
269
+ background: oklch(var(--brand-color-oklch));
270
+
271
+ /* after */
272
+ color: oklch(from var(--brand-color) l c h / 0.5);
273
+ background: var(--brand-color);
274
+ ```
98
275
 
99
- A color the engine cannot evaluate at build time a `color-mix()`, a `light-dark()`, a `color()` in a space it has no conversion for — has no channels to decompose, so its companion is expressed *by reference* using CSS relative color syntax (`--name-color-oklch: from color-mix(…) l c h`). Reading a channel off it still works; the browser resolves them.
276
+ The replacement is strictly more capablethe companion could only be
277
+ decomposed for a color the engine could evaluate at build time, while relative
278
+ color syntax works on every `<color>`, including a `color-mix()`, a
279
+ `light-dark()`, and a variable Tasty never defined.
100
280
 
101
281
  ---
102
282
 
@@ -167,7 +347,7 @@ configure({
167
347
  ```
168
348
 
169
349
  - `$name` keys become `--name` CSS custom properties
170
- - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties (suffix depends on `colorSpace`, default `oklch`)
350
+ - `#name` keys become `--name-color` custom properties
171
351
  - Names keep their case, since CSS custom properties are case-sensitive: `$myVar` is `--myVar` and is referenced as `$myVar`. A leading capital is not supported and folds — `$Foo` and `#Purple` become `--foo` and `--purple-color` — so start names lowercase. Kebab-case (`$my-var`) remains the convention.
172
352
 
173
353
  Tokens are automatically emitted in all rendering modes: runtime (client), SSR, and zero-runtime (Babel plugin).
@@ -289,7 +469,7 @@ See [Functions (`@function`)](dsl.md#functions-function) for inline usage inside
289
469
 
290
470
  ### Custom color functions
291
471
 
292
- A parse function whose output is an already-supported color (`rgb`, `hsl`, `#…`, `oklch`, …) is treated as a **color function**: it works everywhere a color is accepted — style values, `#token.alpha` opacity injection, token decomposition into the configured color space, and `parseColor` — with no extra registration. This is the same mechanism the built-in `okhsl`/`okhst` plugins use; they are ordinary plugins registered by default.
472
+ A parse function whose output is an already-supported color (`rgb`, `hsl`, `#…`, `oklch`, …) is treated as a **color function**: it works everywhere a color is accepted — style values, `#token.alpha` opacity injection, and `parseColor` — with no extra registration. This is the same mechanism the built-in `okhsl`/`okhst` plugins use; they are ordinary plugins registered by default.
293
473
 
294
474
  ```ts
295
475
  import { configure, createColorFunc } from '@tenphi/tasty';
package/docs/dsl.md CHANGED
@@ -134,7 +134,7 @@ color: '#purple', // Full opacity
134
134
  color: '#purple.5', // 50% opacity
135
135
  color: '#purple.05', // 5% opacity
136
136
  color: '#purple.$fade', // Opacity from a custom property
137
- fill: '#current', // → currentcolor
137
+ fill: '#current', // → var(--current-color)
138
138
  color: '(#primary, #secondary)', // Fallback syntax
139
139
  ```
140
140
 
@@ -151,9 +151,9 @@ these:
151
151
 
152
152
  - a token holding a `color-mix()`, a `light-dark()`, or a `color()` in a space
153
153
  Tasty cannot convert — none of which have channels to decompose
154
- - `#current`, which resolves to `currentcolor`
154
+ - `#current`, which resolves to the color the element inherits
155
155
  - a `--name-color` variable declared in your own CSS, with no Tasty token
156
- definition and no companion variable behind it
156
+ definition behind it
157
157
 
158
158
  Two properties follow from writing the alpha slot rather than compositing:
159
159
 
@@ -163,6 +163,28 @@ Two properties follow from writing the alpha slot rather than compositing:
163
163
  `/ var(--fade)` unchanged, so it works whether `$fade` holds `.5` or `50%` —
164
164
  which is what `--*-opacity` properties are registered to accept.
165
165
 
166
+ ### Why `#current` is a variable
167
+
168
+ `#current` emits `var(--current-color)`, not the `currentcolor` keyword. The
169
+ `color` style publishes `--current-color` alongside every color it sets, and the
170
+ property is registered with `initial-value: currentcolor` — so where nothing has
171
+ published it, the variable resolves against each element's own inherited color
172
+ and is indistinguishable from the keyword.
173
+
174
+ The difference shows when a token is *defined* as `#current` and then faded:
175
+
176
+ ```jsx
177
+ { '#ink': '#current', fill: '#ink.5' }
178
+ // --ink-color: var(--current-color) → a concrete color where one was published
179
+ // fill: oklch(from var(--ink-color) l c h / .5)
180
+ ```
181
+
182
+ Relative color syntax accepts a concrete origin from Safari 16.4, while
183
+ `oklch(from currentcolor …)` needs Safari 18. Resolving through the variable is
184
+ what keeps that token fadeable on the wider floor. Where no `color` style
185
+ published the variable, the origin is the keyword again and the Safari 18 floor
186
+ applies to that case alone.
187
+
166
188
  ### `#current` composes instead
167
189
 
168
190
  `#current` is the one exception, and the difference is deliberate. A token *names*
@@ -182,9 +204,9 @@ step. Because a `color-mix()` percentage cannot be a `<number>`, an opacity
182
204
  custom property used as `#current.$fade` must hold a unitless number; a token
183
205
  accepts either form.
184
206
 
185
- The space is always `oklch`, whatever [`colorSpace`](configuration.md#color-space)
186
- is set to: it is unbounded, so a wide-gamut color survives a round trip that a
187
- gamut-limited space would clamp.
207
+ The space is always `oklch`: it is unbounded, so a wide-gamut color survives a
208
+ round trip that a gamut-limited space would clamp. Nothing configures this
209
+ see [Color space](configuration.md#color-space).
188
210
 
189
211
  ---
190
212
 
package/docs/injector.md CHANGED
@@ -300,6 +300,17 @@ const styleRule: StyleResult = {
300
300
  };
301
301
  ```
302
302
 
303
+ ### Batched Injection
304
+
305
+ `configure({ batchInjection: true })` queues every sheet write — component
306
+ rules, global rules, raw CSS and at-rules — into one FIFO and applies them
307
+ together, so the document is style-invalidated once per flush instead of once per
308
+ component. `<TastyBatchProvider>` flushes in `useInsertionEffect`, before any
309
+ layout effect, so a queued write can never be observed by a measurement. See
310
+ [Batched injection](configuration.md#batched-injection) for the modes and the
311
+ ordering guarantee. `flushStyles()` applies pending writes on demand; every read
312
+ API here calls it for you.
313
+
303
314
  ### Deduplication & Performance
304
315
 
305
316
  ```typescript
@@ -275,7 +275,7 @@ const ProgressBar = tasty({
275
275
 
276
276
  // Conversion:
277
277
  // 'progress' → $progress → --progress
278
- // 'accentColor' → #accent → --accent-color + --accent-color-oklch
278
+ // 'accentColor' → #accent → --accent-color
279
279
  ```
280
280
 
281
281
  #### Object form
package/docs/pipeline.md CHANGED
@@ -683,7 +683,7 @@ The default entry's exclusive is `!hovered & !@media(dark)` — no top-level OR,
683
683
 
684
684
  ### Stages 4–5: Compute combinations and call handler
685
685
 
686
- Single style, three snapshots; the `color` handler emits `color` plus `--current-color*` variables.
686
+ Single style, three snapshots; the `color` handler emits `color` plus a `--current-color` variable.
687
687
 
688
688
  ### Stage 6: Merge by value
689
689
 
@@ -697,20 +697,17 @@ Using `renderStyles(styles, '.t1')` (the class is doubled — `.t1.t1` — so Ta
697
697
  .t1[data-hovered] {
698
698
  color: var(--highlight-color);
699
699
  --current-color: var(--highlight-color);
700
- --current-color-oklch: var(--highlight-color-oklch);
701
700
  }
702
701
  @media (prefers-color-scheme: dark) {
703
702
  .t1:not([data-hovered]) {
704
703
  color: var(--dark-color);
705
704
  --current-color: var(--dark-color);
706
- --current-color-oklch: var(--dark-color-oklch);
707
705
  }
708
706
  }
709
707
  @media (not (prefers-color-scheme: dark)) {
710
708
  .t1:not([data-hovered]) {
711
709
  color: var(--white-color);
712
710
  --current-color: var(--white-color);
713
- --current-color-oklch: var(--white-color-oklch);
714
711
  }
715
712
  }
716
713
  ```
package/docs/react-api.md CHANGED
@@ -224,7 +224,7 @@ const ProgressBar = tasty({
224
224
 
225
225
  <ProgressBar progress="75%" accentColor="#purple" />
226
226
  // 'progress' → $progress → --progress
227
- // 'accentColor' → #accent → --accent-color + --accent-color-oklch
227
+ // 'accentColor' → #accent → --accent-color
228
228
  ```
229
229
 
230
230
  ### Object form
package/docs/styles.md CHANGED
@@ -290,7 +290,12 @@ Text color with design token support.
290
290
  | `"light-dark(#dark, #light)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
291
291
  | `true` | `currentColor` |
292
292
 
293
- When set to a named color token, also sets `$current-color` and `$current-color-{colorSpace}` custom properties for downstream use (suffix depends on the configured `colorSpace`, default `oklch`). An opacity suffix does not move the companion: `color="#purple.5"` still reports `#purple`'s channels, since components carry no alpha.
293
+ Also sets `$current-color` to the same color, which is what `#current` resolves
294
+ through. Every color publishes it, not just a named token, so a descendant's
295
+ `#current` always reads the nearest `color` rather than the nearest *token*
296
+ color. A value that already reads the inherited color — `#current` itself, a
297
+ `#current` fade, a bare `currentColor` — is not republished: that would be a
298
+ self-reference, or would resolve a second time one level down.
294
299
 
295
300
  ### `svgFill`
296
301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/tasty",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
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",
@@ -178,19 +178,19 @@
178
178
  "name": "main (import *)",
179
179
  "path": "dist/index.js",
180
180
  "import": "*",
181
- "limit": "58 kB"
181
+ "limit": "56.6 kB"
182
182
  },
183
183
  {
184
184
  "name": "core (import *)",
185
185
  "path": "dist/core/index.js",
186
186
  "import": "*",
187
- "limit": "55 kB"
187
+ "limit": "53.65 kB"
188
188
  },
189
189
  {
190
190
  "name": "static",
191
191
  "path": "dist/static/index.js",
192
192
  "import": "*",
193
- "limit": "19.25 kB"
193
+ "limit": "16.8 kB"
194
194
  },
195
195
  {
196
196
  "name": "zero",
@@ -201,7 +201,7 @@
201
201
  "path",
202
202
  "crypto"
203
203
  ],
204
- "limit": "33.75 kB"
204
+ "limit": "31.25 kB"
205
205
  },
206
206
  {
207
207
  "name": "babel-plugin",
@@ -212,7 +212,7 @@
212
212
  "path",
213
213
  "crypto"
214
214
  ],
215
- "limit": "51.25 kB"
215
+ "limit": "49.35 kB"
216
216
  }
217
217
  ],
218
218
  "scripts": {
@@ -235,6 +235,7 @@
235
235
  "version": "changeset version",
236
236
  "release": "changeset publish",
237
237
  "knip": "knip",
238
+ "check:test-only": "node scripts/check-test-only-code.mjs",
238
239
  "hygiene": "pnpm lint && pnpm format:check && pnpm typecheck",
239
240
  "hygiene:fix": "pnpm lint:fix && pnpm format && pnpm typecheck"
240
241
  }