@tenphi/tasty 0.0.0-snapshot.2f41cf6 → 0.0.0-snapshot.2f4e31d

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 (130) hide show
  1. package/README.md +440 -372
  2. package/dist/babel-types-Dc5zghyE.d.ts +18 -0
  3. package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
  4. package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
  5. package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
  6. package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
  7. package/dist/{collector-BMEQCkCn.js → chunks/collector-Cb8ah2JF.js} +68 -101
  8. package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
  9. package/dist/chunks/config-engine-CMYFZYQh.js +272 -0
  10. package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
  11. package/dist/chunks/config-file-DlZXJMj8.js +25 -0
  12. package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
  13. package/dist/chunks/css-definitions-B4aWBkH3.js +910 -0
  14. package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
  15. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  16. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  17. package/dist/chunks/debug-D2Pu7Xhy.js +502 -0
  18. package/dist/chunks/debug-D2Pu7Xhy.js.map +1 -0
  19. package/dist/chunks/dsl-CsFl9LGn.js +1458 -0
  20. package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
  21. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  22. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  23. package/dist/chunks/react-runtime-DHiopXCu.js +691 -0
  24. package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
  25. package/dist/chunks/runtime-engine-NGCofNXy.js +2435 -0
  26. package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
  27. package/dist/chunks/runtime-state-lZjMbvwV.js +152 -0
  28. package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
  29. package/dist/{merge-styles-3il_ClCF.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
  30. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  31. package/dist/chunks/style-engine-DnkV_4Jg.js +5602 -0
  32. package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
  33. package/dist/{css-writer-BSv8PrEX.js → chunks/zero-engine-DcwaCvFs.js} +95 -136
  34. package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
  35. package/dist/{collector-osfWTeRd.d.ts → collector-D2OT6I2G.d.ts} +64 -8
  36. package/dist/{config-BoZDUHW5.d.ts → config-C4ftFxgI.d.ts} +514 -92
  37. package/dist/core/index.d.ts +5 -5
  38. package/dist/core/index.js +9 -6
  39. package/dist/hydrate-CRyjjAyl.d.ts +22 -0
  40. package/dist/{index-D-OA_O6i.d.ts → index-DxQNRj50.d.ts} +718 -502
  41. package/dist/index.d.ts +5 -5
  42. package/dist/index.js +11 -732
  43. package/dist/{merge-styles-BMWcH6MF.d.ts → merge-styles-D39qBtox.d.ts} +2 -3
  44. package/dist/ssr/astro-client.d.ts +1 -1
  45. package/dist/ssr/astro-client.js +1 -14
  46. package/dist/ssr/astro-client.js.map +1 -1
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  51. package/dist/ssr/astro-middleware-extract.js +9 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  54. package/dist/ssr/astro-middleware-static.js +7 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +11 -8
  57. package/dist/ssr/astro-middleware.js +2 -14
  58. package/dist/ssr/astro-middleware.js.map +1 -1
  59. package/dist/ssr/astro.d.ts +40 -10
  60. package/dist/ssr/astro.js +163 -91
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +2 -0
  64. package/dist/ssr/index.d.ts +5 -32
  65. package/dist/ssr/index.js +6 -6
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +64 -0
  68. package/dist/ssr/next-config.js +123 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +9 -9
  71. package/dist/ssr/next.js +29 -44
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +8 -9
  74. package/dist/static/index.js +4 -22
  75. package/dist/static/index.js.map +1 -1
  76. package/dist/static/inject.d.ts +1 -2
  77. package/dist/static/inject.js.map +1 -1
  78. package/dist/{index-tcHuMPFt.d.ts → types-CYQIhUg1.d.ts} +883 -600
  79. package/dist/zero/babel.d.ts +12 -20
  80. package/dist/zero/babel.js +97 -156
  81. package/dist/zero/babel.js.map +1 -1
  82. package/dist/zero/index.d.ts +76 -7
  83. package/dist/zero/index.js +25 -2
  84. package/dist/zero/index.js.map +1 -0
  85. package/dist/zero/next.d.ts +4 -5
  86. package/dist/zero/next.js +3 -38
  87. package/dist/zero/next.js.map +1 -1
  88. package/docs/README.md +20 -9
  89. package/docs/adoption.md +69 -36
  90. package/docs/ai-agents.md +259 -0
  91. package/docs/comparison.md +77 -47
  92. package/docs/configuration.md +617 -98
  93. package/docs/debug.md +28 -15
  94. package/docs/design-system.md +154 -33
  95. package/docs/dsl.md +715 -194
  96. package/docs/getting-started.md +130 -50
  97. package/docs/injector.md +160 -69
  98. package/docs/methodology.md +82 -51
  99. package/docs/migration-v3.md +285 -0
  100. package/docs/pipeline.md +102 -33
  101. package/docs/plugins.md +333 -0
  102. package/docs/react-api.md +215 -50
  103. package/docs/runtime-benchmarks.md +388 -0
  104. package/docs/ssr.md +310 -118
  105. package/docs/styles.md +225 -42
  106. package/docs/tasty-static.md +289 -136
  107. package/package.json +141 -45
  108. package/tasty.config.ts +6 -0
  109. package/dist/async-storage-B7_o6FKt.js +0 -44
  110. package/dist/async-storage-B7_o6FKt.js.map +0 -1
  111. package/dist/collector-BMEQCkCn.js.map +0 -1
  112. package/dist/config-eiremPHv.js +0 -10559
  113. package/dist/config-eiremPHv.js.map +0 -1
  114. package/dist/context-CkSg-kDT.js +0 -24
  115. package/dist/context-CkSg-kDT.js.map +0 -1
  116. package/dist/core-Dm9EkOA_.js +0 -1598
  117. package/dist/core-Dm9EkOA_.js.map +0 -1
  118. package/dist/css-writer-BSv8PrEX.js.map +0 -1
  119. package/dist/format-global-rules-Dbc_1tc3.js +0 -22
  120. package/dist/format-global-rules-Dbc_1tc3.js.map +0 -1
  121. package/dist/format-rules-DcFFQceU.js +0 -143
  122. package/dist/format-rules-DcFFQceU.js.map +0 -1
  123. package/dist/hydrate-B6SjFHhj.js +0 -45
  124. package/dist/hydrate-B6SjFHhj.js.map +0 -1
  125. package/dist/index.js.map +0 -1
  126. package/dist/keyframes-DJ8Geo4L.js +0 -595
  127. package/dist/keyframes-DJ8Geo4L.js.map +0 -1
  128. package/dist/merge-styles-3il_ClCF.js.map +0 -1
  129. package/dist/resolve-recipes-B3MSkfFQ.js +0 -144
  130. package/dist/resolve-recipes-B3MSkfFQ.js.map +0 -1
@@ -1,5 +1,61 @@
1
- import { Ct as RawCSSResult, Dt as StyleInjectorConfig, Et as SheetInfo, M as StyleHandlerDefinition, Ot as StyleRule, St as PropertyDefinition, Tt as RuleInfo, b as Styles, bt as KeyframesResult, ct as CacheMetrics, dt as FontFaceDescriptors, ft as FontFaceInput, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as StyleDetails, lt as CounterStyleDescriptors, mt as GCOptions, n as StyleResult, ot as UnitHandler, pt as GCConfig, v as RecipeStyles, wt as RootRegistry, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-tcHuMPFt.js";
2
-
1
+ import { C as SheetInfo, Et as StyleDetails, M as StyleResult, Ot as UnitHandler, S as RuleInfo, T as StyleRule, W as ConfigTokens, Y as Styles, _ as KeyframesSteps, a as FontFaceInput, b as RawCSSResult, c as GCConfig, d as InjectOptions, f as InjectResult, g as KeyframesResult, h as KeyframesInfo, i as FontFaceDescriptors, l as GCOptions, lt as StyleHandlerDefinition, n as CounterStyleDescriptors, o as FunctionDefinition, q as RecipeStyles, t as CacheMetrics, u as GlobalInjectResult, v as PropertyDefinition, w as StyleInjectorConfig, x as RootRegistry } from "./types-CYQIhUg1.js";
2
+ //#region src/config-resources.d.ts
3
+ declare function getGlobalFontFaces(): Record<string, FontFaceInput> | null;
4
+ declare function getGlobalCounterStyles(): Record<string, CounterStyleDescriptors> | null;
5
+ declare function getGlobalFunctions(): Record<string, FunctionDefinition> | null;
6
+ /**
7
+ * Get global keyframes configuration.
8
+ * Returns null if no keyframes configured (fast path for zero-overhead).
9
+ */
10
+ declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
11
+ //#endregion
12
+ //#region src/prop-handlers.d.ts
13
+ /**
14
+ * Props middleware for tasty components.
15
+ *
16
+ * A prop handler receives a component's props and returns them, changed or not.
17
+ * That makes it the extension point for props that are *not* style properties:
18
+ * it can read a custom prop, strip it so it never reaches the DOM, and fold its
19
+ * meaning into `styles`, `mods`, `tokens`, `variant`, or `as`.
20
+ *
21
+ * ```ts
22
+ * configure({
23
+ * propHandlers: {
24
+ * glaze: (props) => {
25
+ * const { glaze, ...rest } = props;
26
+ * if (!glaze) return rest;
27
+ * return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
28
+ * },
29
+ * },
30
+ * });
31
+ * ```
32
+ *
33
+ * Handlers run on every render of every tasty component, so the registry is a
34
+ * pre-composed chain that is `null` while nothing is registered — the cost when
35
+ * unused is one property load and one branch.
36
+ */
37
+ /** Props object handed to a prop handler. Deliberately untyped: handlers see everything. */
38
+ type PropHandlerProps = Record<string, unknown>;
39
+ /**
40
+ * Props middleware: props in, props out. Returning nothing means "unchanged".
41
+ *
42
+ * Must be a **pure function** and must not mutate its input. Style values are
43
+ * cached by object identity, so mutating a value object in place produces a stale
44
+ * class name and stale CSS. Return fresh (ideally frozen, ideally memoized)
45
+ * objects instead.
46
+ */
47
+ type PropHandler = (props: PropHandlerProps) => PropHandlerProps | void | null;
48
+ /**
49
+ * How a prop handler is declared. The map key is both its name and, by default,
50
+ * the prop that triggers it.
51
+ *
52
+ * - `fn` — triggered when a prop matching the key is present
53
+ * - `['glaze', fn]` — triggered by the named prop
54
+ * - `[['glaze', 'tone'], fn]` — triggered by any of them
55
+ * - `['*', fn]` — unconditional; runs on every render of every component
56
+ */
57
+ type PropHandlerDefinition = PropHandler | [string, PropHandler] | [string[], PropHandler];
58
+ //#endregion
3
59
  //#region src/injector/sheet-manager.d.ts
4
60
  declare class SheetManager {
5
61
  private rootRegistries;
@@ -20,6 +76,19 @@ declare class SheetManager {
20
76
  * abstracting away adopted vs style-element modes.
21
77
  */
22
78
  getCSSSheet(sheetInfo: SheetInfo): CSSStyleSheet | null;
79
+ /**
80
+ * Record an inserted rule text at its rule index (text mode only).
81
+ *
82
+ * `textRules` mirrors the sheet's rule order. `textContent` cannot be edited
83
+ * rule-by-rule the way CSSOM can, so keeping the texts is what makes
84
+ * deletion possible at all in this mode.
85
+ */
86
+ private trackTextRule;
87
+ /**
88
+ * Remove rule indices from a text-mode sheet and rewrite the element's text.
89
+ * Returns the indices that were actually removed.
90
+ */
91
+ private deleteTextRules;
23
92
  /**
24
93
  * Determine the injection mode for a root.
25
94
  * ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
@@ -45,6 +114,8 @@ declare class SheetManager {
45
114
  * Create a style element and append to document
46
115
  */
47
116
  private createStyleElement;
117
+ /** Append a rule to a text-mode sheet while preserving its index mirror. */
118
+ private appendTextRule;
48
119
  /**
49
120
  * Insert CSS rules as a single block
50
121
  */
@@ -91,21 +162,29 @@ declare class SheetManager {
91
162
  */
92
163
  private engineSupportsAtProperty;
93
164
  /**
94
- * Force cleanup of unused styles
95
- */
96
- forceCleanup(registry: RootRegistry): void;
97
- /**
98
- * Perform bulk cleanup of all unused styles (refCount = 0).
165
+ * Delete the given classes: their rules leave the sheets and every registry
166
+ * entry pointing at them is dropped.
167
+ *
168
+ * Deciding *what* is unused belongs to `StyleInjector.gc()`, which owns the
169
+ * DOM scan and the capacity policy. This only re-checks that each class is
170
+ * still safe to delete, and reports how many were.
171
+ *
172
+ * @returns Number of classes actually deleted.
99
173
  */
100
- private performBulkCleanup;
174
+ deleteClasses(registry: RootRegistry, classNames: Iterable<string>): number;
101
175
  /**
102
176
  * Get total number of rules across all sheets
103
177
  */
104
178
  getTotalRuleCount(registry: RootRegistry): number;
105
179
  /**
106
- * Get CSS text from all sheets (for SSR)
180
+ * The CSS of one managed sheet, or `null` when it holds none this can read —
181
+ * an empty style element, or a sheet the engine refuses to hand over.
107
182
  */
108
- getCssText(registry: RootRegistry): string;
183
+ private readSheetCSS;
184
+ /**
185
+ * Get the CSS text of every sheet in `registry`.
186
+ */
187
+ getCSSText(registry: RootRegistry): string;
109
188
  /**
110
189
  * Get cache performance metrics
111
190
  */
@@ -169,6 +248,28 @@ declare class SheetManager {
169
248
  /**
170
249
  * Get the raw CSS content
171
250
  */
251
+ /**
252
+ * The CSS this injector owns in `root`, one entry per sheet, in the order the
253
+ * engine applies them.
254
+ *
255
+ * `getCSSText()` walks the managed sheets only, and raw CSS has its own —
256
+ * which sits before, after, or *between* them depending on how it got there:
257
+ * prepended to `adoptedStyleSheets`, or wherever in `<head>` the first raw
258
+ * injection happened to land, with every managed sheet opened afterwards
259
+ * following it. Reporting a fixed order would describe the opposite winner
260
+ * from the live page whenever two rules of equal specificity meet, so the raw
261
+ * sheet is spliced in at the position the DOM actually gives it.
262
+ */
263
+ getOwnedCSSInOrder(registry: RootRegistry, root: Document | ShadowRoot): string[];
264
+ /**
265
+ * Top-level rules in the raw sheet.
266
+ *
267
+ * Read from the sheet the engine parsed, not from the text: a raw block is
268
+ * one string but any number of rules, and one rule — `@keyframes`, `@media` —
269
+ * can contain any number of blocks, so counting braces answers neither
270
+ * question.
271
+ */
272
+ getRawRuleCount(root: Document | ShadowRoot): number;
172
273
  getRawCSSText(root: Document | ShadowRoot): string;
173
274
  }
174
275
  //#endregion
@@ -177,12 +278,51 @@ declare class StyleInjector {
177
278
  private sheetManager;
178
279
  private config;
179
280
  private globalRuleCounter;
180
- private pendingGCHandle;
281
+ /** Cancels the scheduled sweep, whichever timer scheduled it. */
282
+ private cancelPendingGC;
181
283
  private namePrefix;
182
284
  private classRegex;
183
285
  private rscClassRegex;
286
+ /**
287
+ * Bumped whenever class rules are deleted — by `gc()`, `cleanup()` or
288
+ * `destroy()` — so a cache of class names handed out earlier, such as a
289
+ * `tasty()` factory's, knows they may no longer have rules behind them.
290
+ */
291
+ evictions: number;
184
292
  /** @internal — exposed for debug utilities only */
185
293
  get _sheetManager(): SheetManager;
294
+ /** Register inferable custom properties used by a set of declarations. */
295
+ private inferProperties;
296
+ /**
297
+ * Whether sheet writes should be queued instead of applied immediately.
298
+ *
299
+ * Only ever true on the client: SSR collects CSS as text and the RSC path
300
+ * returns it as strings, so neither has a live sheet to batch writes against.
301
+ *
302
+ * In the default `true` mode a write is only queued inside an open batch
303
+ * window — a commit in which `<TastyBatchProvider>` rendered and will
304
+ * therefore flush in its insertion effect, before any layout effect can
305
+ * measure. Everything else falls through to a synchronous write, so enabling
306
+ * the flag cannot make a `useLayoutEffect` read an unstyled element.
307
+ * `'always'` drops the gate and accepts that trade for wider coverage.
308
+ */
309
+ private get batching();
310
+ /**
311
+ * Apply a sheet write now, or queue it when batching is on.
312
+ * Returns the queue handle when deferred, so the caller can cancel it if it
313
+ * disposes before the flush.
314
+ */
315
+ private writeSheet;
316
+ /**
317
+ * Insert a global (non-class) rule, honouring batching.
318
+ *
319
+ * `onApplied` records the caller's dedupe bookkeeping. When the write is
320
+ * queued it runs eagerly, so a repeat call before the flush bails out instead
321
+ * of queueing the same rule twice — the same reasoning as
322
+ * `insertPropertyRule`'s eager marking. When written synchronously it runs
323
+ * only on success, preserving the existing retry-on-failure behaviour.
324
+ */
325
+ private writeGlobalRule;
186
326
  constructor(config?: StyleInjectorConfig);
187
327
  /**
188
328
  * Generate a deterministic class name from a cache key using content hash.
@@ -205,13 +345,15 @@ declare class StyleInjector {
205
345
  className: string;
206
346
  isNewAllocation: boolean;
207
347
  };
348
+ /**
349
+ * Hand a class that is already injected — or queued for a batched write — to
350
+ * another caller: record the reference, write nothing.
351
+ */
352
+ private reuseInjected;
208
353
  /**
209
354
  * Inject styles from StyleResult objects
210
355
  */
211
- inject(rules: StyleResult[], options?: {
212
- root?: Document | ShadowRoot;
213
- cacheKey?: string;
214
- }): InjectResult;
356
+ inject(rules: StyleResult[], options?: InjectOptions): InjectResult;
215
357
  /**
216
358
  * Inject global styles (rules without a generated tasty class selector)
217
359
  * This ensures we don't reserve a tasty class name (t{number}) for global rules,
@@ -235,32 +377,55 @@ declare class StyleInjector {
235
377
  root?: Document | ShadowRoot;
236
378
  }): string;
237
379
  /**
238
- * Increment refCount for an already-injected cacheKey and return a dispose.
239
- * Used by useStyles on cache hits (hydration or runtime reuse) where
240
- * the pipeline was skipped but refCount tracking is still needed.
241
- * Returns null if the cacheKey is not found.
380
+ * Take a reference on local `@keyframes`, under the deterministic names the
381
+ * caller resolved.
382
+ *
383
+ * One reference per distinct set of steps, shared by every class that ends up
384
+ * animating it, so a repeat render takes nothing further. Ownership is
385
+ * assigned by `ownKeyframes()` once the rules exist to be inspected.
386
+ */
387
+ holdKeyframes(steps: Record<string, KeyframesSteps>, names: Map<string, string>, options?: {
388
+ root?: Document | ShadowRoot;
389
+ }): Map<string, string>;
390
+ /**
391
+ * Record that `className` animates these keyframes, so the reference is
392
+ * released when the last such class is collected.
393
+ *
394
+ * Only classes whose rules actually reference the animation should be here:
395
+ * a class that merely rendered alongside one would otherwise keep the
396
+ * keyframes alive for as long as it lives.
397
+ */
398
+ ownKeyframes(key: string, className: string, options?: {
399
+ root?: Document | ShadowRoot;
400
+ }): void;
401
+ /**
402
+ * Pin an already-injected cacheKey and return the handle that releases it.
403
+ * For callers that skipped the pipeline on a cache hit but still need the
404
+ * class held. Returns null if the cacheKey is not found.
242
405
  */
243
406
  trackRef(cacheKey: string, options?: {
244
407
  root?: Document | ShadowRoot;
245
408
  }): InjectResult | null;
246
409
  /**
247
- * Dispose of a className (decrements refCount only).
410
+ * Release one pin on a className. At zero pins the class is not deleted — it
411
+ * stays cached and collectible, and `gc()` decides when it actually goes.
248
412
  */
249
- private dispose;
413
+ private unpin;
250
414
  /**
251
- * Force bulk cleanup of unused styles
415
+ * Remove every style that is neither in the DOM nor referenced by an
416
+ * outstanding `inject()` handle, ignoring the GC capacity threshold.
252
417
  */
253
418
  cleanup(root?: Document | ShadowRoot): void;
254
419
  /**
255
- * Get CSS text from all sheets (for SSR)
420
+ * Get the CSS text of every sheet for `root`. Needs a DOM.
256
421
  */
257
- getCssText(options?: {
422
+ getCSSText(options?: {
258
423
  root?: Document | ShadowRoot;
259
424
  }): string;
260
425
  /**
261
426
  * Get CSS only for the provided tasty classNames (e.g., ["t0","t3"])
262
427
  */
263
- getCssTextForClasses(classNames: Iterable<string>, options?: {
428
+ getCSSTextForClasses(classNames: Iterable<string>, options?: {
264
429
  root?: Document | ShadowRoot;
265
430
  }): string;
266
431
  /**
@@ -322,11 +487,28 @@ declare class StyleInjector {
322
487
  /**
323
488
  * Inject a CSS @counter-style rule.
324
489
  *
325
- * Permanent and global — no dispose or ref-counting.
326
- * Deduplicates by name (first definition wins).
490
+ * Permanent and global — no dispose or ref-counting. Deduplicates by name.
491
+ * By default a definition overrides a previously injected one of the same
492
+ * name. Pass `weak: true` for global `configure()` definitions, which must
493
+ * never clobber an existing rule (so component-local definitions win
494
+ * regardless of injection order).
327
495
  */
328
496
  counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
329
497
  root?: Document | ShadowRoot;
498
+ weak?: boolean;
499
+ }): void;
500
+ /**
501
+ * Inject a CSS @function rule (custom function).
502
+ *
503
+ * Permanent and global — no dispose or ref-counting. Deduplicates by function
504
+ * name. By default a definition overrides a previously injected one of the
505
+ * same name. Pass `weak: true` for global `configure()` definitions, which
506
+ * must never clobber an existing rule (so component-local definitions win
507
+ * regardless of injection order).
508
+ */
509
+ func(name: string, definition: FunctionDefinition, options?: {
510
+ root?: Document | ShadowRoot;
511
+ weak?: boolean;
330
512
  }): void;
331
513
  /**
332
514
  * Inject keyframes and return object with toString() and dispose()
@@ -340,33 +522,82 @@ declare class StyleInjector {
340
522
  keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
341
523
  root?: Document | ShadowRoot;
342
524
  name?: string;
525
+ /**
526
+ * Give this name its own rule even if another name already carries
527
+ * the same steps. Without it two names with identical steps share
528
+ * one rule under whichever name arrived first — fine when the caller
529
+ * only wants the animation, wrong when the name has to be the one it
530
+ * asked for.
531
+ */
532
+ distinctByName?: boolean;
343
533
  }): KeyframesResult;
344
534
  /**
345
535
  * Dispose keyframes
346
536
  */
347
537
  private disposeKeyframes;
348
538
  /**
349
- * Record a render-time usage hit for one or more classNames.
350
- * Handles space-separated multi-chunk classNames.
351
- * When the global touch counter reaches `touchInterval`, schedules a GC
352
- * via `requestIdleCallback`.
353
- * No-op on the server.
539
+ * Count a render, and schedule a collection pass every `touchInterval` of
540
+ * them. Nothing else: what a class is worth keeping is decided by the sweep's
541
+ * own DOM scan, so rendering does not track usage at all.
542
+ *
543
+ * @deprecated The class name is ignored — pass anything, or stop calling it.
544
+ * Collection no longer records per-class usage, and scheduling does not need
545
+ * to know which class was rendered. A class handed back by `inject()` is
546
+ * marked wanted there, which is what reuse actually goes through.
354
547
  */
355
- touch(className: string, options?: {
548
+ touch(_className: string, options?: {
356
549
  root?: Document | ShadowRoot;
357
550
  }): void;
358
551
  /**
359
- * Schedule a GC via `requestIdleCallback` (or synchronously as fallback).
360
- * Runs GC on all active roots. Avoids double-scheduling via `pendingGCHandle`.
552
+ * Schedule a GC in idle time. Runs GC on all active roots, and avoids
553
+ * double-scheduling.
554
+ *
555
+ * Idle only. Without `requestIdleCallback` nothing is collected
556
+ * automatically: running the sweep inline here would put it inside the render
557
+ * that touched the class, and collection is never urgent enough for that.
361
558
  */
362
559
  private scheduleGC;
560
+ /**
561
+ * The one definition of "unused": this injector owns the class's rules, no
562
+ * element in `root` carries it, and nobody pinned it.
563
+ *
564
+ * `gc()` evicts from this set, `getMetrics()` counts it, and `tastyDebug`
565
+ * reports it — all through here, so the three can never disagree about what
566
+ * "unused" means. Entries carry their last `touch()` so callers can drop the
567
+ * oldest first; a class that was never touched sorts as oldest.
568
+ */
569
+ /**
570
+ * Everything the injector holds falls into one of five bands, and only the
571
+ * last of them is ever deleted:
572
+ *
573
+ * 1. rendered — some element carries the class right now
574
+ * 2. not ours — queued for a batched write, pre-allocated, or server-rendered
575
+ * 3. hot — nothing carries it, but that was noticed less than `grace` ago
576
+ * 4. cached — cold, but within `capacity` when ordered by when it went cold
577
+ * 5. the rest
578
+ *
579
+ * This returns bands 4 and 5 together, most recently cold first; `gc()` draws
580
+ * the capacity line through them. Band 3 is what makes collection safe
581
+ * without a commit signal: a render can resolve a class and commit it a
582
+ * little later, and during that gap nothing on the page carries it.
583
+ */
584
+ private collectUnused;
585
+ /**
586
+ * Class names this injector holds CSS for that nothing renders and nobody
587
+ * pinned — exactly what `gc({ force: true })` would delete. Unordered.
588
+ */
589
+ getUnusedClasses(options?: {
590
+ root?: Document | ShadowRoot;
591
+ }): string[];
363
592
  /**
364
593
  * Synchronous garbage collection.
365
594
  *
366
- * 1. Quick upper-bound check: skip if unused count can't exceed capacity.
367
- * 2. Scans the DOM for live tasty classNames (safety guard).
368
- * 3. With `force: true`: deletes all unused entries inline.
369
- * Without `force`: collects unused, sorts oldest-first, evicts over capacity.
595
+ * 1. Quick upper-bound check: skip if the registry is smaller than capacity.
596
+ * 2. Scans the DOM for live tasty classNames — the DOM, not a ref count, is
597
+ * what says a class rendered by a component is still in use.
598
+ * 3. With `force: true`: deletes every unused class.
599
+ * Without `force`: keeps the `capacity` most recently touched and deletes
600
+ * the rest, oldest first.
370
601
  *
371
602
  * @returns Number of styles evicted.
372
603
  */
@@ -377,7 +608,37 @@ declare class StyleInjector {
377
608
  destroy(root?: Document | ShadowRoot): void;
378
609
  }
379
610
  //#endregion
611
+ //#region src/functions/index.d.ts
612
+ /**
613
+ * A parse-time function: receives the parsed (comma-separated) argument groups
614
+ * and returns a CSS value string. This is the JS flavor of the unified
615
+ * `functions` config (bare-name keys), distinct from declarative `@function`
616
+ * definitions (`$$`-prefixed keys).
617
+ */
618
+ type ParseFunction = (groups: StyleDetails[]) => string;
619
+ /**
620
+ * The unified `functions` map: keys are either bare names (parse functions,
621
+ * value is a function) or `$$name`/`$name`/`--name` (declarative CSS functions,
622
+ * value is a {@link FunctionDefinition} object).
623
+ */
624
+ type FunctionsConfig = Record<string, FunctionDefinition | ParseFunction>;
625
+ //#endregion
380
626
  //#region src/utils/color-space.d.ts
627
+ /**
628
+ * Color handling that survives into the emitted CSS.
629
+ *
630
+ * Tasty does not rewrite a color into a particular color space: opacity is
631
+ * applied with `color-mix()`, which the browser resolves against whatever a
632
+ * value turns out to be, so a color is emitted exactly as authored. What is left
633
+ * here is how an alpha gets applied.
634
+ */
635
+ /**
636
+ * The color space a `#name` token's value used to be rewritten into.
637
+ *
638
+ * @deprecated Kept for the `colorSpace` config option, which no longer has any
639
+ * effect. Colors are emitted as authored and opacity is always applied in
640
+ * `oklab` through `color-mix()`.
641
+ */
381
642
  type ColorSpace = 'rgb' | 'hsl' | 'oklch';
382
643
  //#endregion
383
644
  //#region src/utils/typography.d.ts
@@ -441,9 +702,13 @@ declare function generateTypographyTokens(presets: Record<string, TypographyPres
441
702
  interface TastyPlugin {
442
703
  /** Unique name for the plugin (used for debugging and conflict detection) */
443
704
  name: string;
444
- /** Custom functions that transform parsed style groups into CSS values */
445
- funcs?: Record<string, (groups: StyleDetails[]) => string>;
446
- /** Custom units that transform numeric values (e.g., `2x` → `calc(2 * var(--gap))`) */
705
+ /**
706
+ * Custom functions (unified map). Bare keys map to parse functions
707
+ * `(groups) => string`; `$$name` keys map to declarative CSS `@function`
708
+ * definitions. See {@link FunctionsConfig}.
709
+ */
710
+ functions?: FunctionsConfig;
711
+ /** Custom units that scale numeric values (e.g., `x: '8px'` makes `2x` → `16px`) */
447
712
  units?: Record<string, string | UnitHandler>;
448
713
  /** Custom state aliases (e.g., `'@mobile': '@media(w < 768px)'`) */
449
714
  states?: Record<string, string>;
@@ -461,11 +726,37 @@ interface TastyPlugin {
461
726
  * ```
462
727
  */
463
728
  handlers?: Record<string, StyleHandlerDefinition>;
729
+ /**
730
+ * Props middleware for every tasty component — props in, props out. The
731
+ * extension point for props that are not style properties: read a custom prop,
732
+ * strip it so it never reaches the DOM, and fold its meaning into `styles`,
733
+ * `mods`, `tokens`, `variant`, or `as`.
734
+ *
735
+ * Must be pure and must not mutate its input.
736
+ * See {@link TastyConfig.propHandlers}.
737
+ * @example
738
+ * ```ts
739
+ * propHandlers: {
740
+ * glaze: (props) => {
741
+ * const { glaze, ...rest } = props;
742
+ * if (!glaze) return rest;
743
+ * return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
744
+ * },
745
+ * }
746
+ * ```
747
+ */
748
+ propHandlers?: Record<string, PropHandlerDefinition>;
749
+ /**
750
+ * Style properties exposed as top-level props on every tasty component, in
751
+ * addition to the built-in base styles.
752
+ * See {@link TastyConfig.baseStyleProps}.
753
+ */
754
+ baseStyleProps?: readonly string[];
464
755
  /**
465
756
  * Design tokens injected as CSS custom properties on `:root`.
466
757
  * Values are parsed through the Tasty DSL. Supports state maps.
467
758
  * - `$name` → `--name` CSS custom property
468
- * - `#name` → `--name-color` and `--name-color-{colorSpace}`
759
+ * - `#name` → `--name-color`
469
760
  */
470
761
  tokens?: ConfigTokens;
471
762
  /** Predefined tokens replaced during style parsing (`$name` or `#name`) */
@@ -492,6 +783,19 @@ interface TastyPlugin {
492
783
  * Supports the full Tasty style syntax.
493
784
  */
494
785
  globalStyles?: Record<string, Styles>;
786
+ /**
787
+ * Global CSS `@property` definitions. A plugin whose handler or prop handler
788
+ * emits a custom property usually wants one, so the property animates and
789
+ * inherits correctly instead of being treated as an untyped string.
790
+ * See {@link TastyConfig.properties}.
791
+ */
792
+ properties?: Record<string, PropertyDefinition>;
793
+ /** Global keyframes, injected only when referenced. See {@link TastyConfig.keyframes}. */
794
+ keyframes?: Record<string, KeyframesSteps>;
795
+ /** Global `@font-face` definitions. See {@link TastyConfig.fontFaces}. */
796
+ fontFaces?: Record<string, FontFaceInput>;
797
+ /** Global `@counter-style` definitions. See {@link TastyConfig.counterStyles}. */
798
+ counterStyles?: Record<string, CounterStyleDescriptors>;
495
799
  }
496
800
  /**
497
801
  * A factory function that creates a TastyPlugin.
@@ -502,13 +806,13 @@ interface TastyPlugin {
502
806
  * // Plugin without options
503
807
  * const okhslPlugin: TastyPluginFactory = () => ({
504
808
  * name: 'okhsl',
505
- * funcs: { okhsl: okhslFunc },
809
+ * functions: { okhsl: okhslFunction },
506
810
  * });
507
811
  *
508
812
  * // Plugin with options
509
813
  * const debugPlugin: TastyPluginFactory<{ verbose: boolean }> = (options) => ({
510
814
  * name: 'debug',
511
- * funcs: { debug: createDebugFunc(options.verbose) },
815
+ * functions: { debug: createDebugFunc(options.verbose) },
512
816
  * });
513
817
  * ```
514
818
  */
@@ -540,35 +844,101 @@ interface TastyConfig {
540
844
  parserCacheSize?: number;
541
845
  /**
542
846
  * Custom units for the style parser (merged with built-in units).
543
- * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
544
- * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
847
+ * A unit scales its value by the number in front of it: the built-in
848
+ * `x: '8px'` makes `2x` → `16px`, and `u: 'var(--u)'` would make `2u` →
849
+ * `calc(2 * var(--u))`. A function receives the number and returns the CSS.
850
+ * Native CSS units (`px`, `em`, `vw`, …) need no entry: one with the same
851
+ * name replaces them.
852
+ * @example { u: 'var(--u)', col: (n) => `${n * 80}px` }
545
853
  */
546
854
  units?: Record<string, string | UnitHandler>;
547
855
  /**
548
- * Custom functions for the style parser (merged with existing).
549
- * Functions process parsed style groups and return CSS values.
550
- * @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
856
+ * Custom functions (merged with existing). A single map holds both flavors,
857
+ * discriminated by value type:
858
+ *
859
+ * - **Bare key + function value** — a parse-time function that processes the
860
+ * parsed argument groups and returns a CSS value. Called as `name(...)`.
861
+ * - **`$$name` key + object value** — a declarative CSS `@function`
862
+ * definition. Called as `$$name(...)` (→ native `--name(...)`).
863
+ *
864
+ * A key whose prefix does not match its value type (object under a bare key,
865
+ * or function under a `$$` key) is ignored with a dev warning.
866
+ *
867
+ * @example
868
+ * ```ts
869
+ * configure({
870
+ * functions: {
871
+ * double: (groups) => `calc(2 * ${groups[0].output})`, // parse function
872
+ * $$negative: { args: ['$value'], result: '(-1 * $value)' }, // CSS function
873
+ * },
874
+ * });
875
+ * ```
551
876
  */
552
- funcs?: Record<string, (groups: StyleDetails[]) => string>;
877
+ functions?: FunctionsConfig;
553
878
  /**
554
- * Color space used for decomposed color token companion variables.
555
- * Controls the CSS function and suffix for alpha composition.
879
+ * @deprecated No longer has any effect; will be removed in the next major.
880
+ * Setting it warns in development.
556
881
  *
557
- * - `'rgb'` — suffix `-rgb`, e.g. `rgb(var(--name-color-rgb) / .5)`
558
- * - `'hsl'` — suffix `-hsl`, e.g. `hsl(var(--name-color-hsl) / .5)`
559
- * - `'oklch'` — suffix `-oklch`, e.g. `oklch(var(--name-color-oklch) / .5)`
882
+ * A `#name` token's value used to be rewritten into this color space so an
883
+ * opacity suffix had numeric channels to write an alpha into. Opacity now uses
884
+ * `color-mix(in oklab, var(--name-color) 50%, transparent)`, which the
885
+ * browser resolves against any color, so a color is emitted exactly as
886
+ * authored and there is nothing left for the setting to decide.
560
887
  *
561
- * @default 'oklch'
888
+ * To address a token's channels yourself, write relative color syntax against
889
+ * the token: `oklch(from var(--brand-color) calc(l * 1.2) c h)`. It works on
890
+ * every `<color>`, including the ones no conversion could evaluate.
562
891
  */
563
892
  colorSpace?: ColorSpace;
564
893
  /**
565
894
  * Automatically infer and register CSS @property declarations
566
895
  * from custom property values found in styles, keyframes, and global config.
567
896
  * Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
568
- * When false, only explicitly declared @properties are registered.
897
+ * When false, only explicitly declared @property are registered.
569
898
  * @default true
570
899
  */
571
900
  autoPropertyTypes?: boolean;
901
+ /**
902
+ * Defer stylesheet writes and apply them in one batch instead of performing
903
+ * one `insertRule()` per component during render.
904
+ *
905
+ * Each `insertRule()` on a live sheet invalidates style for that sheet's
906
+ * scope. When components inject during React's render phase while other
907
+ * components read layout in the same pass, the two interleave and the browser
908
+ * is forced to recalculate style between every injection. Batching collapses
909
+ * that into one invalidation per flush.
910
+ *
911
+ * - `false` (default) — inject synchronously, one write per component.
912
+ * - `true` — batch, but only inside a *batch window*: a commit in which
913
+ * `<TastyBatchProvider>` rendered and will therefore flush in its
914
+ * `useInsertionEffect`, before any `useLayoutEffect` runs. Any injection
915
+ * outside a window — a deep update the provider did not re-render for, an
916
+ * injection from a layout effect, an event handler, an async callback — is
917
+ * written straight through. Enabling this can never make a layout effect
918
+ * measure an unstyled element. Requires `<TastyBatchProvider>`; without it
919
+ * nothing is batched (and dev mode says so once).
920
+ * - `'always'` — batch every injection, flushing on a microtask when no
921
+ * window is open. Wins on more commits, but a `useLayoutEffect` that
922
+ * measures a freshly mounted element can read its unstyled box, because
923
+ * microtasks run after the layout phase. Paint is unaffected: microtasks
924
+ * always drain before the browser paints.
925
+ *
926
+ * No effect during SSR or RSC: styles are collected as text there, the
927
+ * runtime injector never runs, and the provider is inert without a
928
+ * `document`. No effect on zero-runtime `tastyStatic` styles either — those
929
+ * are extracted at build time and never reach the injector.
930
+ *
931
+ * @default false
932
+ * @example
933
+ * ```tsx
934
+ * configure({ batchInjection: true });
935
+ *
936
+ * <TastyBatchProvider>
937
+ * <App />
938
+ * </TastyBatchProvider>
939
+ * ```
940
+ */
941
+ batchInjection?: boolean | 'always';
572
942
  /**
573
943
  * Garbage collection configuration for unused styles.
574
944
  * GC is triggered by touch count: every `touchInterval` touches, the
@@ -597,7 +967,7 @@ interface TastyConfig {
597
967
  * `'ts'` (overridable via the same option) so its classes can't
598
968
  * collide with runtime classes when both are loaded on the same page.
599
969
  *
600
- * Must match `^[a-zA-Z][a-zA-Z0-9_-]{0,31}$`. Locked once styles
970
+ * Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. Locked once styles
601
971
  * have been generated.
602
972
  *
603
973
  * @default 't'
@@ -636,7 +1006,7 @@ interface TastyConfig {
636
1006
  * Keys use tasty token syntax ($name for properties, #name for colors).
637
1007
  *
638
1008
  * Tasty ships with `DEFAULT_PROPERTIES` (e.g. `$gap`, `$radius`, `#white`,
639
- * `#black`, `#clear`, `#border`, etc.) that are always included.
1009
+ * `#black`, `#border`, etc.) that are always included.
640
1010
  * Properties you specify here are merged on top, so you can override any
641
1011
  * default by using the same key.
642
1012
  *
@@ -659,7 +1029,7 @@ interface TastyConfig {
659
1029
  * const Spinner = tasty({
660
1030
  * styles: {
661
1031
  * transform: 'rotate($rotation)',
662
- * transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
1032
+ * transition: '$$rotation $transition', // outputs: --rotation var(--transition)
663
1033
  * },
664
1034
  * });
665
1035
  * ```
@@ -673,7 +1043,7 @@ interface TastyConfig {
673
1043
  * @example
674
1044
  * ```ts
675
1045
  * configure({
676
- * fontFace: {
1046
+ * fontFaces: {
677
1047
  * 'Brand Sans': [
678
1048
  * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
679
1049
  * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
@@ -683,7 +1053,7 @@ interface TastyConfig {
683
1053
  * });
684
1054
  * ```
685
1055
  */
686
- fontFace?: Record<string, FontFaceInput>;
1056
+ fontFaces?: Record<string, FontFaceInput>;
687
1057
  /**
688
1058
  * Global @counter-style definitions.
689
1059
  * Keys are counter-style names, values are descriptor objects.
@@ -691,13 +1061,32 @@ interface TastyConfig {
691
1061
  * @example
692
1062
  * ```ts
693
1063
  * configure({
694
- * counterStyle: {
1064
+ * counterStyles: {
695
1065
  * thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
696
1066
  * },
697
1067
  * });
698
1068
  * ```
699
1069
  */
700
- counterStyle?: Record<string, CounterStyleDescriptors>;
1070
+ counterStyles?: Record<string, CounterStyleDescriptors>;
1071
+ /**
1072
+ * Opt-in polyfills for not-yet-baseline CSS features. Each key toggles a
1073
+ * feature polyfill; all default to `false`.
1074
+ *
1075
+ * - `functions` — polyfill CSS `@function` by inlining every `$$name(...)`
1076
+ * call into plain CSS (calc/var/color-mix) at parse time instead of
1077
+ * emitting the native `@function` at-rule. Enables `@function` usage in
1078
+ * browsers that don't support it yet (Firefox/Safari). Note this is the
1079
+ * `functions` *feature toggle*, distinct from the top-level `functions`
1080
+ * definitions map.
1081
+ *
1082
+ * @example
1083
+ * ```ts
1084
+ * configure({ polyfills: { functions: true } });
1085
+ * ```
1086
+ */
1087
+ polyfills?: {
1088
+ functions?: boolean;
1089
+ };
701
1090
  /**
702
1091
  * Custom style handlers that transform style properties into CSS declarations.
703
1092
  * Handlers replace built-in handlers for the same style name.
@@ -727,13 +1116,63 @@ interface TastyConfig {
727
1116
  * ```
728
1117
  */
729
1118
  handlers?: Record<string, StyleHandlerDefinition>;
1119
+ /**
1120
+ * Props middleware for every tasty component. A prop handler receives the
1121
+ * component's props and returns them, changed or not — the extension point for
1122
+ * props that are not style properties.
1123
+ *
1124
+ * The map key is the handler's name and, by default, the prop that triggers it.
1125
+ * Use `['*', fn]` for an unconditional handler, or `[['a', 'b'], fn]` to trigger
1126
+ * on any of several props.
1127
+ *
1128
+ * Handlers must be pure and must not mutate their input: style values are cached
1129
+ * by object identity, so mutating one in place yields stale CSS. Memoize the
1130
+ * styles you build per input value.
1131
+ *
1132
+ * Not applicable to zero-runtime mode — `tastyStatic()` takes styles objects, not
1133
+ * props, so there is nothing for middleware to run on. Components rendered
1134
+ * through `tasty()` are unaffected and keep the runtime injector.
1135
+ *
1136
+ * @example
1137
+ * ```ts
1138
+ * configure({
1139
+ * propHandlers: {
1140
+ * glaze: (props) => {
1141
+ * const { glaze, ...rest } = props;
1142
+ * if (!glaze) return rest;
1143
+ * return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
1144
+ * },
1145
+ * },
1146
+ * });
1147
+ *
1148
+ * <Element glaze="purple" />
1149
+ * ```
1150
+ */
1151
+ propHandlers?: Record<string, PropHandlerDefinition>;
1152
+ /**
1153
+ * Style properties exposed as top-level props on **every** tasty component, in
1154
+ * addition to the built-in base styles, without each component listing them in
1155
+ * `styleProps`.
1156
+ *
1157
+ * Augment `TastyBaseStylePropNames` to type them. Each name costs one property
1158
+ * check per render of every component, so keep the list short; the effect is
1159
+ * app-global and cannot be scoped to a subtree.
1160
+ *
1161
+ * @example
1162
+ * ```ts
1163
+ * configure({ baseStyleProps: ['radius', 'shadow'] });
1164
+ *
1165
+ * <Card radius="1r" shadow />
1166
+ * ```
1167
+ */
1168
+ baseStyleProps?: readonly string[];
730
1169
  /**
731
1170
  * Design tokens injected as CSS custom properties on `:root`.
732
1171
  * Values are parsed through the Tasty DSL. Supports state maps
733
1172
  * for responsive/theme-aware tokens.
734
1173
  *
735
1174
  * - `$name` keys become `--name` CSS custom properties
736
- * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
1175
+ * - `#name` keys become `--name-color` properties
737
1176
  *
738
1177
  * Tokens are injected once when the first style is rendered.
739
1178
  *
@@ -757,6 +1196,10 @@ interface TastyConfig {
757
1196
  * Values are substituted inline before CSS generation, unlike `tokens` which
758
1197
  * inject CSS custom properties on `:root`.
759
1198
  *
1199
+ * Includes `'#clear': 'transparent'` by default. Aliases resolving to
1200
+ * `transparent` ignore opacity suffixes, including custom-property opacity.
1201
+ * Explicit replaceTokens entries can override the defaults.
1202
+ *
760
1203
  * For color tokens (#name), boolean `true` is converted to `transparent`.
761
1204
  *
762
1205
  * @example
@@ -772,7 +1215,7 @@ interface TastyConfig {
772
1215
  * // Now use in styles - tokens are replaced at parse time:
773
1216
  * const Card = tasty({
774
1217
  * styles: {
775
- * padding: '$spacing', // → calc(2 * var(--gap))
1218
+ * padding: '$spacing', // → 16px
776
1219
  * fill: '#accent', // → var(--purple-color)
777
1220
  * },
778
1221
  * });
@@ -782,7 +1225,7 @@ interface TastyConfig {
782
1225
  /**
783
1226
  * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
784
1227
  * Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
785
- * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@properties`.
1228
+ * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@property`.
786
1229
  *
787
1230
  * Components reference recipes via: `recipe: 'name1 name2'` in their styles.
788
1231
  * Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
@@ -859,32 +1302,11 @@ declare global {
859
1302
  * Detect if we're running in a test environment
860
1303
  */
861
1304
  declare function isTestEnvironment(): boolean;
862
- /**
863
- * Check if styles have been generated (configuration is locked)
864
- */
865
- declare function hasStylesGenerated(): boolean;
866
1305
  /**
867
1306
  * Check if any global keyframes are configured.
868
- * Uses a pre-computed flag to avoid Object.keys() allocation on every call.
1307
+ * Storage only ever holds a non-empty record, so no Object.keys() is needed.
869
1308
  */
870
1309
  declare function hasGlobalKeyframes(): boolean;
871
- /**
872
- * Get global keyframes configuration.
873
- * Returns null if no keyframes configured (fast path for zero-overhead).
874
- */
875
- declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
876
- /**
877
- * Get global font-face configuration.
878
- * Returns null if no font faces configured.
879
- * Reads from globalThis first for cross-module SSR support.
880
- */
881
- declare function getGlobalFontFace(): Record<string, FontFaceInput> | null;
882
- /**
883
- * Get global counter-style configuration.
884
- * Returns null if no counter styles configured.
885
- * Reads from globalThis first for cross-module SSR support.
886
- */
887
- declare function getGlobalCounterStyle(): Record<string, CounterStyleDescriptors> | null;
888
1310
  /**
889
1311
  * Check if any global recipes are configured.
890
1312
  * Fast path: returns false if no recipes were ever set.
@@ -941,5 +1363,5 @@ declare function getNamePrefix(): string;
941
1363
  */
942
1364
  declare function resetConfig(): void;
943
1365
  //#endregion
944
- export { SheetManager as S, TypographyPreset as _, getGlobalFontFace as a, ColorSpace as b, getNamePrefix as c, hasStylesGenerated as d, isConfigLocked as f, TastyPluginFactory as g, TastyPlugin as h, getGlobalCounterStyle as i, hasGlobalKeyframes as l, resetConfig as m, configure as n, getGlobalKeyframes as o, isTestEnvironment as p, getConfig as r, getGlobalRecipes as s, TastyConfig as t, hasGlobalRecipes as u, TypographyTokenValue as v, StyleInjector as x, generateTypographyTokens as y };
945
- //# sourceMappingURL=config-BoZDUHW5.d.ts.map
1366
+ export { PropHandlerProps as C, getGlobalKeyframes as D, getGlobalFunctions as E, PropHandlerDefinition as S, getGlobalFontFaces as T, FunctionsConfig as _, getNamePrefix as a, SheetManager as b, isConfigLocked as c, TastyPlugin as d, TastyPluginFactory as f, ColorSpace as g, generateTypographyTokens as h, getGlobalRecipes as i, isTestEnvironment as l, TypographyTokenValue as m, configure as n, hasGlobalKeyframes as o, TypographyPreset as p, getConfig as r, hasGlobalRecipes as s, TastyConfig as t, resetConfig as u, ParseFunction as v, getGlobalCounterStyles as w, PropHandler as x, StyleInjector as y };
1367
+ //# sourceMappingURL=config-C4ftFxgI.d.ts.map