@tenphi/tasty 0.0.0-snapshot.4edfcbd → 0.0.0-snapshot.4fb5b7d

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