@tenphi/tasty 0.0.0-snapshot.e4609d6 → 0.0.0-snapshot.e4e4347

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 (129) hide show
  1. package/README.md +436 -394
  2. package/dist/babel-types-BKDTT4--.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-5d8WlQbq.js +60 -0
  6. package/dist/chunks/build-config-5d8WlQbq.js.map +1 -0
  7. package/dist/{collector-BpkjNQDo.js → chunks/collector-CjCak4iE.js} +25 -119
  8. package/dist/chunks/collector-CjCak4iE.js.map +1 -0
  9. package/dist/chunks/config-engine-uOFYZidB.js +272 -0
  10. package/dist/chunks/config-engine-uOFYZidB.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-ubrHP97m.js +910 -0
  14. package/dist/chunks/css-definitions-ubrHP97m.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-CJ31U_WE.js +502 -0
  18. package/dist/chunks/debug-CJ31U_WE.js.map +1 -0
  19. package/dist/chunks/dsl-DYSJc1-T.js +1383 -0
  20. package/dist/chunks/dsl-DYSJc1-T.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-CyyCI02N.js +689 -0
  24. package/dist/chunks/react-runtime-CyyCI02N.js.map +1 -0
  25. package/dist/chunks/runtime-engine-BQmOu5-W.js +2432 -0
  26. package/dist/chunks/runtime-engine-BQmOu5-W.js.map +1 -0
  27. package/dist/chunks/runtime-state-DEsyUMU-.js +152 -0
  28. package/dist/chunks/runtime-state-DEsyUMU-.js.map +1 -0
  29. package/dist/{merge-styles-B0lMso5W.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-BX2LshDZ.js +5466 -0
  32. package/dist/chunks/style-engine-BX2LshDZ.js.map +1 -0
  33. package/dist/{css-writer-BHjTF0YN.js → chunks/zero-engine-Dw0P4yGM.js} +65 -145
  34. package/dist/chunks/zero-engine-Dw0P4yGM.js.map +1 -0
  35. package/dist/{collector-D8o4Wdq-.d.ts → collector-CTU-nl0g.d.ts} +23 -4
  36. package/dist/{config-De8L9NWM.d.ts → config-CcxqSZI2.d.ts} +274 -78
  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-DzGxoeyN.d.ts → index-xtey-KDu.d.ts} +350 -253
  41. package/dist/index.d.ts +5 -5
  42. package/dist/index.js +11 -867
  43. package/dist/{merge-styles-DLm4wdnb.d.ts → merge-styles-DSkVc6CD.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 +3 -2
  54. package/dist/ssr/astro-middleware-static.js +0 -11
  55. package/dist/ssr/astro-middleware-static.js.map +1 -1
  56. package/dist/ssr/astro-middleware.d.ts +3 -2
  57. package/dist/ssr/astro-middleware.js +0 -12
  58. package/dist/ssr/astro-middleware.js.map +1 -1
  59. package/dist/ssr/astro.d.ts +40 -6
  60. package/dist/ssr/astro.js +157 -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 +2 -0
  64. package/dist/ssr/index.d.ts +5 -25
  65. package/dist/ssr/index.js +5 -5
  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 -8
  71. package/dist/ssr/next.js +29 -43
  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/{index-KUYya3x7.d.ts → types-DJEM_BOJ.d.ts} +741 -590
  78. package/dist/zero/babel.d.ts +67 -2
  79. package/dist/zero/babel.js +77 -140
  80. package/dist/zero/babel.js.map +1 -1
  81. package/dist/zero/index.d.ts +62 -8
  82. package/dist/zero/index.js +24 -2
  83. package/dist/zero/index.js.map +1 -0
  84. package/dist/zero/next.d.ts +4 -5
  85. package/dist/zero/next.js +3 -38
  86. package/dist/zero/next.js.map +1 -1
  87. package/docs/README.md +16 -8
  88. package/docs/adoption.md +69 -36
  89. package/docs/ai-agents.md +118 -86
  90. package/docs/comparison.md +77 -47
  91. package/docs/configuration.md +434 -108
  92. package/docs/debug.md +21 -8
  93. package/docs/design-system.md +152 -31
  94. package/docs/dsl.md +483 -211
  95. package/docs/getting-started.md +130 -50
  96. package/docs/injector.md +117 -68
  97. package/docs/methodology.md +81 -50
  98. package/docs/migration-v3.md +52 -52
  99. package/docs/pipeline.md +54 -30
  100. package/docs/plugins.md +59 -75
  101. package/docs/react-api.md +135 -53
  102. package/docs/runtime-benchmarks.md +388 -0
  103. package/docs/ssr.md +285 -101
  104. package/docs/styles.md +128 -33
  105. package/docs/tasty-static.md +272 -135
  106. package/package.json +119 -34
  107. package/dist/async-storage-DKK-wTD4.js +0 -44
  108. package/dist/async-storage-DKK-wTD4.js.map +0 -1
  109. package/dist/babel-R2qT7yLN.d.ts +0 -83
  110. package/dist/collector-BpkjNQDo.js.map +0 -1
  111. package/dist/config-DOCuTykY.js +0 -12315
  112. package/dist/config-DOCuTykY.js.map +0 -1
  113. package/dist/context-CA8YKeMn.js +0 -24
  114. package/dist/context-CA8YKeMn.js.map +0 -1
  115. package/dist/core-p6iTbQnn.js +0 -1550
  116. package/dist/core-p6iTbQnn.js.map +0 -1
  117. package/dist/css-writer-BHjTF0YN.js.map +0 -1
  118. package/dist/format-global-rules-DklyaXv-.js +0 -22
  119. package/dist/format-global-rules-DklyaXv-.js.map +0 -1
  120. package/dist/format-rules-Cb0YIjyS.js +0 -143
  121. package/dist/format-rules-Cb0YIjyS.js.map +0 -1
  122. package/dist/hydrate-xnaB3SDm.js +0 -37
  123. package/dist/hydrate-xnaB3SDm.js.map +0 -1
  124. package/dist/index.js.map +0 -1
  125. package/dist/keyframes-DiXjNoBZ.js +0 -424
  126. package/dist/keyframes-DiXjNoBZ.js.map +0 -1
  127. package/dist/merge-styles-B0lMso5W.js.map +0 -1
  128. package/dist/resolve-recipes-C9nAuwgR.js +0 -144
  129. package/dist/resolve-recipes-C9nAuwgR.js.map +0 -1
@@ -1,345 +1,4 @@
1
1
  import { Properties } from "csstype";
2
-
3
- //#region src/properties/property-type-resolver.d.ts
4
- /**
5
- * PropertyTypeResolver
6
- *
7
- * Automatically infers CSS @property types from custom property values.
8
- * Supports deferred resolution for var() reference chains of arbitrary depth.
9
- */
10
- declare class PropertyTypeResolver {
11
- /** propName → the prop it depends on */
12
- private pendingDeps;
13
- /** propName → list of props waiting on it */
14
- private reverseDeps;
15
- /**
16
- * Scan CSS declarations and auto-register @property for custom properties
17
- * whose types can be inferred from their values.
18
- */
19
- scanDeclarations(declarations: string, isPropertyDefined: (name: string) => boolean, registerProperty: (name: string, syntax: string, initialValue: string) => void): void;
20
- private addDependency;
21
- private resolve;
22
- private isComplexValue;
23
- }
24
- //#endregion
25
- //#region src/injector/types.d.ts
26
- declare global {
27
- interface Window {
28
- __TASTY__?: string[];
29
- }
30
- }
31
- interface InjectResult {
32
- className: string;
33
- dispose: () => void;
34
- }
35
- interface GlobalInjectResult {
36
- dispose: () => void;
37
- }
38
- type DisposeFunction = () => void;
39
- interface StyleInjectorConfig {
40
- nonce?: string;
41
- maxRulesPerSheet?: number;
42
- forceTextInjection?: boolean;
43
- /** Enable development mode features: performance metrics and debug information storage */
44
- devMode?: boolean;
45
- /**
46
- * Global predefined states for advanced state mapping.
47
- * These are state aliases that can be used in any component.
48
- * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
49
- */
50
- states?: Record<string, string>;
51
- /**
52
- * Automatically infer and register CSS @property declarations
53
- * from custom property values. When false, only explicit @property are used.
54
- * @default true
55
- */
56
- autoPropertyTypes?: boolean;
57
- /** Garbage collection configuration for unused styles */
58
- gc?: GCConfig;
59
- /**
60
- * Prefix prepended to every generated identifier.
61
- * Mirrors the `namePrefix` field on the public `TastyConfig` so that
62
- * standalone injector consumers can configure it directly.
63
- * @default 't'
64
- */
65
- namePrefix?: string;
66
- }
67
- /**
68
- * Per-className usage tracking for GC.
69
- */
70
- interface StyleUsage {
71
- lastTouchedAt: number;
72
- }
73
- /**
74
- * Configuration for the style garbage collector.
75
- *
76
- * GC is triggered by touch count rather than timers: every `touchInterval`
77
- * touches, an idle callback is scheduled to evict unused styles above
78
- * `capacity`, oldest first.
79
- */
80
- interface GCConfig {
81
- /**
82
- * Number of touch events between GC cycles.
83
- * @default 1000
84
- */
85
- touchInterval?: number;
86
- /**
87
- * Maximum number of unused styles to retain.
88
- * GC evicts the oldest unused styles when this limit is exceeded.
89
- * Actively referenced styles (refCount > 0) and DOM-live styles
90
- * do not count against this limit.
91
- * @default 1000
92
- */
93
- capacity?: number;
94
- }
95
- /**
96
- * Per-call options for gc().
97
- */
98
- interface GCOptions {
99
- root?: Document | ShadowRoot;
100
- /** Bypass capacity threshold and remove ALL unused styles. */
101
- force?: boolean;
102
- }
103
- interface RuleInfo {
104
- className: string;
105
- ruleIndex: number;
106
- sheetIndex: number;
107
- /** Dev-only: full CSS texts inserted for this class; omitted in production */
108
- cssText?: string[];
109
- /** Inclusive end index of the contiguous block of inserted rules for this className */
110
- endRuleIndex?: number;
111
- /** NEW: exact indices of all inserted rules for this className */
112
- indices?: number[];
113
- }
114
- type InjectionMode = 'style-element' | 'adopted';
115
- interface SheetInfo {
116
- /** HTMLStyleElement used in style-element mode; null in adopted mode. */
117
- sheet: HTMLStyleElement | null;
118
- /** Constructable CSSStyleSheet used in adopted mode (ShadowRoot targets) */
119
- constructableSheet?: CSSStyleSheet;
120
- ruleCount: number;
121
- holes: number[];
122
- /**
123
- * True when this sheet is written through `textContent` instead of CSSOM.
124
- * Decided once at sheet creation so a sheet is never half CSSOM / half text.
125
- */
126
- textMode?: boolean;
127
- /**
128
- * Inserted rule texts in rule-index order. Maintained only in text mode —
129
- * it is what makes deletion possible there, since `textContent` cannot be
130
- * edited rule-by-rule and has to be rebuilt.
131
- */
132
- textRules?: string[];
133
- }
134
- interface CleanupStats {
135
- timestamp: number;
136
- classesDeleted: number;
137
- cssSize: number;
138
- rulesDeleted: number;
139
- }
140
- interface CacheMetrics {
141
- hits: number;
142
- misses: number;
143
- bulkCleanups: number;
144
- totalInsertions: number;
145
- totalUnused: number;
146
- stylesCleanedUp: number;
147
- cleanupHistory: CleanupStats[];
148
- startTime: number;
149
- unusedHits?: number;
150
- }
151
- interface RootRegistry {
152
- sheets: SheetInfo[];
153
- refCounts: Map<string, number>;
154
- rules: Map<string, RuleInfo>;
155
- /** Cache key to className mapping to avoid dual storage of RuleInfo objects */
156
- cacheKeyToClassName: Map<string, string>;
157
- /** Deduplication set of fully materialized CSS rules inserted into sheets */
158
- ruleTextSet: Set<string>;
159
- /** Performance metrics (optional) */
160
- metrics?: CacheMetrics;
161
- /** Keyframes cache by content hash -> entry */
162
- keyframesCache: Map<string, KeyframesCacheEntry>;
163
- /** Keyframes name to content hash mapping for collision detection */
164
- keyframesNameToContent: Map<string, string>;
165
- /** Counter for generating keyframes names like k0, k1, k2... */
166
- keyframesCounter: number;
167
- /** Map of injected @property names to their normalized declarations for tracking */
168
- injectedProperties: Map<string, string>;
169
- /** Content hashes of injected @font-face rules for deduplication */
170
- injectedFontFaces: Set<string>;
171
- /**
172
- * Injected @counter-style rules. Maps the name to whether it was injected
173
- * "strong" (`true`, the default — overrides) or "weak" (`false`, global
174
- * `configure()` definitions that never clobber an existing rule).
175
- */
176
- injectedCounterStyles: Map<string, boolean>;
177
- /**
178
- * Injected @function rules. Maps the CSS function name to whether it was
179
- * injected "strong" (`true`, the default — overrides) or "weak" (`false`,
180
- * global `configure()` definitions that never clobber an existing rule).
181
- */
182
- injectedFunctions: Map<string, boolean>;
183
- /** Global rules tracking for index adjustment */
184
- globalRules: Map<string, RuleInfo>;
185
- /** Resolver for auto-inferring @property types from declaration values */
186
- propertyTypeResolver: PropertyTypeResolver;
187
- /** Per-className usage tracking for GC */
188
- usageMap: Map<string, StyleUsage>;
189
- /** Touch counter for scheduling GC (per-root) */
190
- touchCount: number;
191
- /** How many entries from `window.__TASTY__` have been synced into this registry */
192
- serverClassSyncIndex: number;
193
- /** Whether `<style data-tasty-rsc>` tags have been scanned for class names */
194
- rscStylesScanned: boolean;
195
- /** Whether this root uses adoptedStyleSheets or <style> elements */
196
- injectionMode: InjectionMode;
197
- /**
198
- * Lazy feature-test for `@property` support, cached per registry.
199
- * - `undefined`: not yet probed.
200
- * - `true`: engine supports `@property`; rejections indicate user-authored
201
- * invalid rules and should warn.
202
- * - `false`: engine doesn't support `@property` (e.g., jsdom); rejections
203
- * are expected and warnings are suppressed.
204
- */
205
- atPropertySupported?: boolean;
206
- }
207
- type StyleRule = StyleResult;
208
- interface KeyframesInfo {
209
- name: string;
210
- sheetIndex: number;
211
- ruleIndex: number;
212
- /** Dev-only: full CSS text of the @keyframes rule; omitted in production */
213
- cssText?: string;
214
- }
215
- type KeyframeStep = string | Record<string, string | number>;
216
- type KeyframesSteps = Record<string, KeyframeStep>;
217
- interface KeyframesResult {
218
- toString(): string;
219
- dispose: () => void;
220
- }
221
- interface KeyframesCacheEntry {
222
- name: string;
223
- refCount: number;
224
- info: KeyframesInfo;
225
- }
226
- /**
227
- * Definition for a CSS @property at-rule.
228
- * Used to define custom property syntax, inheritance, and initial value.
229
- */
230
- interface PropertyDefinition {
231
- /** CSS syntax string (e.g., '<color>', '<angle>', '<number>') */
232
- syntax?: string;
233
- /** Whether the property inherits (default: true) */
234
- inherits?: boolean;
235
- /** Initial value for the property */
236
- initialValue?: string | number;
237
- }
238
- /**
239
- * Options for registering a CSS `@property`.
240
- * Extends {@link PropertyDefinition} with an optional injection root.
241
- */
242
- interface PropertyOptions extends PropertyDefinition {
243
- /** Shadow root or document to inject into */
244
- root?: Document | ShadowRoot;
245
- }
246
- /**
247
- * A single parameter for a CSS @function at-rule.
248
- *
249
- * - `true` — a bare parameter with no type or default.
250
- * - `string` — a CSS type shorthand (e.g. `'<length>'`, `'<color>'`).
251
- * - object — full form with optional `syntax` (type) and `default` value.
252
- */
253
- type FunctionParameter = true | string | {
254
- syntax?: string;
255
- default?: string | number;
256
- };
257
- /**
258
- * Definition for a CSS @function at-rule (custom function).
259
- *
260
- * The descriptor body reads like a mini styles object: any `$name` key declares
261
- * a local variable (`--name`) whose value is parsed through the Tasty DSL.
262
- * `result` is the only required field.
263
- *
264
- * @example
265
- * ```ts
266
- * // @function --negative(--value) { result: calc(-1 * var(--value)); }
267
- * { args: ['$value'], result: '(-1 * $value)' }
268
- * ```
269
- */
270
- interface FunctionDefinition {
271
- /**
272
- * Ordered parameters. Array form lists bare parameter names (`['$value']`);
273
- * object form maps each parameter name to its type/default.
274
- */
275
- args?: string[] | Record<string, FunctionParameter>;
276
- /** Optional return type, e.g. `'<color>'`. */
277
- returns?: string;
278
- /** The `result:` descriptor value (parsed through the Tasty DSL). Required. */
279
- result: string;
280
- /** Local variables: any `$name` key declares `--name` in the body. */
281
- [localVar: `$${string}`]: string | number | undefined;
282
- }
283
- /**
284
- * Descriptors for a CSS @font-face at-rule.
285
- */
286
- interface FontFaceDescriptors {
287
- /** Required. URL(s) to the font file(s). */
288
- src: string;
289
- /** Font weight or range. Default: 'normal'. */
290
- fontWeight?: string | number;
291
- /** Font style. Default: 'normal'. */
292
- fontStyle?: 'normal' | 'italic' | 'oblique' | (string & {});
293
- /** Font stretch. Default: 'normal'. */
294
- fontStretch?: string;
295
- /** Loading behavior. Default: 'auto'. */
296
- fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
297
- /** Unicode range to cover. */
298
- unicodeRange?: string;
299
- /** Ascent metric override. */
300
- ascentOverride?: string;
301
- /** Descent metric override. */
302
- descentOverride?: string;
303
- /** Line gap metric override. */
304
- lineGapOverride?: string;
305
- /** Size adjustment factor. */
306
- sizeAdjust?: string;
307
- /** OpenType feature settings. */
308
- fontFeatureSettings?: string;
309
- /** Font variation axis settings. */
310
- fontVariationSettings?: string;
311
- }
312
- /** Single descriptor or array of descriptors for multiple weights/styles. */
313
- type FontFaceInput = FontFaceDescriptors | FontFaceDescriptors[];
314
- /**
315
- * Descriptors for a CSS @counter-style at-rule.
316
- */
317
- interface CounterStyleDescriptors {
318
- /** Required. Numbering algorithm. */
319
- system: 'cyclic' | 'numeric' | 'alphabetic' | 'symbolic' | 'additive' | 'fixed' | (string & {});
320
- /** Symbols for non-additive systems. */
321
- symbols?: string;
322
- /** Symbol-value pairs for additive system. */
323
- additiveSymbols?: string;
324
- /** String prepended to the marker. Default: "". */
325
- prefix?: string;
326
- /** String appended to the marker. Default: ". ". */
327
- suffix?: string;
328
- /** Negative-value wrapping (e.g., '"(" ")"'). */
329
- negative?: string;
330
- /** Counter range (e.g., 'infinite infinite'). */
331
- range?: string;
332
- /** Minimum marker width and pad symbol (e.g., '3 "0"'). */
333
- pad?: string;
334
- /** Fallback counter style name. */
335
- fallback?: string;
336
- /** Speech synthesis hint. */
337
- speakAs?: string;
338
- }
339
- interface RawCSSResult {
340
- dispose: () => void;
341
- }
342
- //#endregion
343
2
  //#region src/utils/css-types.d.ts
344
3
  interface CSSProperties extends Properties<string | number> {}
345
4
  //#endregion
@@ -408,50 +67,6 @@ declare class StyleParser {
408
67
  getUnits(): ParserOptions['units'];
409
68
  }
410
69
  //#endregion
411
- //#region src/utils/color-math.d.ts
412
- /**
413
- * Consolidated color conversion math.
414
- *
415
- * Single source of truth for all color space conversions used across the
416
- * library: sRGB gamma, HSL, OKLab, OKLCH, OKHSL, hex parsing, named
417
- * colors, and CSS string converters.
418
- *
419
- * This module has zero internal imports — it is a leaf dependency.
420
- *
421
- * Reference: https://bottosson.github.io/posts/oklab/
422
- */
423
- type Vec3 = [number, number, number];
424
- /**
425
- * HSL to RGB.
426
- * Algorithm from CSS Color 4 spec.
427
- *
428
- * @param h - Hue in degrees (0-360)
429
- * @param s - Saturation (0-1)
430
- * @param l - Lightness (0-1)
431
- * @returns RGB values in 0-255 range (may have fractional values)
432
- */
433
- declare function hslToRgbValues(h: number, s: number, l: number): Vec3;
434
- declare function getNamedColorHex(): Map<string, string>;
435
- /**
436
- * Convert hex color string to `rgb()` CSS string.
437
- * Supports 3, 4, 6, and 8 character hex values (with or without `#`).
438
- */
439
- declare function hexToRgb(hex: string): string | null;
440
- /**
441
- * Extract RGB values from an `rgb()`/`rgba()` string.
442
- * Supports comma-separated, space-separated, fractional, percentage,
443
- * and slash alpha notation.
444
- *
445
- * @returns Array of RGB values (0-255 range), converting percentages as needed.
446
- */
447
- declare function getRgbValuesFromRgbaString(str: string): number[];
448
- /**
449
- * Convert any recognized color string to an `rgb()` CSS string.
450
- * Handles hex, `okhsl()`, `okhst()`, `hsl()`/`hsla()`, named CSS colors,
451
- * and `rgb()`/`rgba()` pass-through.
452
- */
453
- declare function strToRgb(color: string, _ignoreAlpha?: boolean): string | null | undefined;
454
- //#endregion
455
70
  //#region src/utils/styles.d.ts
456
71
  type StyleValue<T = string> = T | boolean | number | null | undefined;
457
72
  /**
@@ -489,7 +104,8 @@ type StyleHandlerProps<TDeps extends string = string> = Partial<Record<TDeps, Re
489
104
  * numbers are accepted. `$` is reserved as a selector suffix.
490
105
  */
491
106
  type CSSMap = {
492
- /** Selector suffix (or suffixes) these declarations apply to, e.g. `'& > *'`. */$?: string | string[];
107
+ /** Selector suffix (or suffixes) these declarations apply to, e.g. `'& > *'`. */
108
+ $?: string | string[];
493
109
  } & Record<string, string | number | (string | number)[] | undefined>;
494
110
  type StyleHandlerResult = CSSMap | CSSMap[] | null | void;
495
111
  type RawStyleHandler<TProps extends object = StyleHandlerProps> = (props: TProps) => StyleHandlerResult;
@@ -541,10 +157,9 @@ declare const DIRECTIONS: string[];
541
157
  */
542
158
  declare function getGlobalParser(): StyleParser;
543
159
  /**
544
- * Get the current global predefined tokens.
545
- * Returns null if no tokens are configured.
160
+ * Get the current global predefined tokens, including built-in defaults.
546
161
  */
547
- declare function getGlobalPredefinedTokens(): Record<string, string> | null;
162
+ declare function getGlobalPredefinedTokens(): Record<string, string>;
548
163
  /**
549
164
  *
550
165
  * @param {String} value
@@ -557,7 +172,7 @@ declare function parseStyle(value: StyleValue): ProcessedStyle;
557
172
  * Optimized to avoid heavy parseStyle calls for simple color patterns.
558
173
  */
559
174
  declare function parseColor(val: string, ignoreError?: boolean): ParsedColor;
560
- declare function filterMods(mods: string[], allowedMods: string[]): string[];
175
+ declare function filterMods(mods: string[], allowedMods: readonly string[]): string[];
561
176
  declare function stringifyStyles(styles: unknown): string;
562
177
  //#endregion
563
178
  //#region src/styles/types.d.ts
@@ -600,7 +215,11 @@ type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
600
215
  type OpaquePercentage = '' | `.${Digit}` | `.${Digit}${Digit}` | '.100';
601
216
  type ColorValue = `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `hsl(${string})` | `okhsl(${string})` | `oklch(${string})` | (string & {});
602
217
  type NoType = false | null | undefined;
603
- interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font' | 'outline' | 'type' | 'gap' | 'padding' | 'margin' | 'width' | 'height' | 'border' | 'transition' | 'placeContent' | 'placeItems' | 'scrollMargin' | 'scrollMarginTop' | 'scrollMarginRight' | 'scrollMarginBottom' | 'scrollMarginLeft' | 'scrollMarginBlock' | 'scrollMarginInline'> {
218
+ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font' | 'outline' | 'type' | 'gap' | 'padding' | 'margin' | 'width' | 'height' | 'blockSize' | 'inlineSize' | 'border' | 'transition' | 'placeContent' | 'placeItems' | 'scrollMargin' | 'scrollMarginTop' | 'scrollMarginRight' | 'scrollMarginBottom' | 'scrollMarginLeft' | 'scrollPadding' | 'scrollPaddingTop' | 'scrollPaddingRight' | 'scrollPaddingBottom' | 'scrollPaddingLeft' | 'overscrollBehaviorBlock' | 'overscrollBehaviorInline' | 'overscrollBehaviorX' | 'overscrollBehaviorY'> {
219
+ overscrollBehaviorBlock?: CSSProperties['overscrollBehaviorBlock'] | 'chain';
220
+ overscrollBehaviorInline?: CSSProperties['overscrollBehaviorInline'] | 'chain';
221
+ overscrollBehaviorX?: CSSProperties['overscrollBehaviorX'] | 'chain';
222
+ overscrollBehaviorY?: CSSProperties['overscrollBehaviorY'] | 'chain';
604
223
  /**
605
224
  * @deprecated Use `flow` style instead.
606
225
  */
@@ -627,7 +246,8 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
627
246
  * - `fill="okhsl(200 100% 50%)"` // perceptually uniform OKHSL color
628
247
  * - `fill="oklch(0.7 0.15 200)"` // OKLCH color
629
248
  * - `fill="#primary #secondary"` // double color (second as foreground overlay)
630
- * - `fill={true}` // default fill color
249
+ *
250
+ * `fill={false}` sets no fill. `fill={true}` names no color and is ignored.
631
251
  */
632
252
  fill?: ColorValue | boolean;
633
253
  /**
@@ -752,6 +372,10 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
752
372
  * - `padding={true}` // default padding on all sides
753
373
  */
754
374
  padding?: CSSProperties['padding'] | string | boolean;
375
+ /** Logical block-axis padding with `start`/`end` modifiers. */
376
+ blockPadding?: CSSProperties['paddingBlock'] | string | boolean;
377
+ /** Logical inline-axis padding with `start`/`end` modifiers. */
378
+ inlinePadding?: CSSProperties['paddingInline'] | string | boolean;
755
379
  /**
756
380
  * Shorthand for element margin. Supports custom units, directional modifiers, and design-system-driven defaults.
757
381
  *
@@ -766,6 +390,10 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
766
390
  * - `margin={true}` // default margin on all sides
767
391
  */
768
392
  margin?: CSSProperties['margin'] | string | boolean;
393
+ /** Logical block-axis margin with `start`/`end` modifiers. */
394
+ blockMargin?: CSSProperties['marginBlock'] | string | boolean;
395
+ /** Logical inline-axis margin with `start`/`end` modifiers. */
396
+ inlineMargin?: CSSProperties['marginInline'] | string | boolean;
769
397
  /**
770
398
  * Concise shorthand for setting element width, including min-width and max-width. Supports custom units and advanced sizing keywords.
771
399
  *
@@ -797,6 +425,16 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
797
425
  * - `height={true}` // height: auto
798
426
  */
799
427
  height?: CSSProperties['height'] | string | boolean;
428
+ /**
429
+ * Logical block size with the same enhanced min/max/fixed syntax as `width`.
430
+ * Emits native `block-size`, `min-block-size`, and `max-block-size` declarations.
431
+ */
432
+ blockSize?: CSSProperties['blockSize'] | string | boolean;
433
+ /**
434
+ * Logical inline size with the same enhanced min/max/fixed syntax as `width`.
435
+ * Emits native `inline-size`, `min-inline-size`, and `max-inline-size` declarations.
436
+ */
437
+ inlineSize?: CSSProperties['inlineSize'] | string | boolean;
800
438
  /**
801
439
  * Shorthand for border width, style, and color. Supports directional modifiers and design-system defaults.
802
440
  *
@@ -818,6 +456,10 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
818
456
  * custom property directly, name it `$name-color`.
819
457
  */
820
458
  border?: CSSProperties['border'] | string | boolean;
459
+ /** Logical block-axis border with `start`/`end` modifiers. */
460
+ blockBorder?: CSSProperties['borderBlock'] | string | boolean;
461
+ /** Logical inline-axis border with `start`/`end` modifiers. */
462
+ inlineBorder?: CSSProperties['borderInline'] | string | boolean;
821
463
  /**
822
464
  * Powerful shorthand for CSS transitions using semantic names and design tokens. Supports grouped transitions for common UI effects.
823
465
  *
@@ -825,10 +467,10 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
825
467
  * Multiple transitions: separated by commas
826
468
  *
827
469
  * Examples:
828
- * - `transition="fill 0.2s, radius 0.3s"` // transitions background-color and border-radius
829
- * - `transition="fade 0.15s ease-in"` // transitions mask with easing
830
- * - `transition="theme 0.3s"` // transitions all theme-related properties
831
- * - `transition="preset 0.2s"` // transitions typography properties
470
+ * - `transition="fill, radius"` // transitions background-color and border-radius
471
+ * - `transition="fade $transition ease-in"` // transitions mask with explicit timing token
472
+ * - `transition="theme"` // transitions all theme-related properties
473
+ * - `transition="preset"` // transitions typography properties
832
474
  */
833
475
  transition?: CSSProperties['transition'] | string;
834
476
  /**
@@ -858,7 +500,7 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
858
500
  * Corner modifiers: `top-left`, `top-right`, `bottom-right`, `bottom-left` — a single corner
859
501
  *
860
502
  * Examples:
861
- * - `radius="2r"` // border-radius: calc(var(--radius) * 2)
503
+ * - `radius="2r"` // border-radius: 12px
862
504
  * - `radius={true}` // default radius (1r)
863
505
  * - `radius="round"` // fully rounded (9999rem)
864
506
  * - `radius="leaf"` // asymmetric leaf shape
@@ -1023,8 +665,23 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
1023
665
  scrollMarginRight?: string | number | boolean;
1024
666
  scrollMarginBottom?: string | number | boolean;
1025
667
  scrollMarginLeft?: string | number | boolean;
1026
- scrollMarginBlock?: string | number | boolean;
1027
- scrollMarginInline?: string | number | boolean;
668
+ /** Logical block-axis scroll margin with `start`/`end` modifiers. */
669
+ blockScrollMargin?: CSSProperties['scrollMarginBlock'] | string | boolean;
670
+ /** Logical inline-axis scroll margin with `start`/`end` modifiers. */
671
+ inlineScrollMargin?: CSSProperties['scrollMarginInline'] | string | boolean;
672
+ /**
673
+ * Shorthand for physical scroll padding. Supports custom units and the same
674
+ * physical direction modifiers as `padding`.
675
+ */
676
+ scrollPadding?: CSSProperties['scrollPadding'] | string | boolean;
677
+ scrollPaddingTop?: string | number | boolean;
678
+ scrollPaddingRight?: string | number | boolean;
679
+ scrollPaddingBottom?: string | number | boolean;
680
+ scrollPaddingLeft?: string | number | boolean;
681
+ /** Logical block-axis scroll padding with `start`/`end` modifiers. */
682
+ blockScrollPadding?: CSSProperties['scrollPaddingBlock'] | string | boolean;
683
+ /** Logical inline-axis scroll padding with `start`/`end` modifiers. */
684
+ inlineScrollPadding?: CSSProperties['scrollPaddingInline'] | string | boolean;
1028
685
  /**
1029
686
  * Shorthand for `top`, `right`, `bottom`, and `left` offsets. Supports custom units, directional modifiers, and positioning.
1030
687
  *
@@ -1046,6 +703,10 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
1046
703
  * insets the sides by `4x`. Without `dock` a second value is ignored.
1047
704
  */
1048
705
  inset?: 'top' | 'right' | 'bottom' | 'left' | 'dock' | string | CSSProperties['inset'];
706
+ /** Logical block-axis inset with `start`/`end` modifiers. */
707
+ blockInset?: CSSProperties['insetBlock'] | string | boolean;
708
+ /** Logical inline-axis inset with `start`/`end` modifiers. */
709
+ inlineInset?: CSSProperties['insetInline'] | string | boolean;
1049
710
  /**
1050
711
  * Local keyframes definitions for this component.
1051
712
  * Keys are animation names, values are keyframes step definitions.
@@ -1122,7 +783,7 @@ type Selector = `${SuffixForSelector}${string}`;
1122
783
  type NotSelector = Exclude<string, Selector | keyof StylesInterface>;
1123
784
  /** Special style keys that should not be wrapped in StyleValue/StyleValueStateMap */
1124
785
  type SpecialStyleKeys = '@keyframes' | '@property' | '@font-face' | '@counter-style' | '@function' | 'recipe';
1125
- type StylesWithoutSelectors = { [key in keyof StylesInterface as key extends SpecialStyleKeys ? never : key]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]> };
786
+ type StylesWithoutSelectors = { [key in keyof StylesInterface as key extends SpecialStyleKeys ? never : key]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>; };
1126
787
  /**
1127
788
  * Index signature for recipe-specific arbitrary keys.
1128
789
  * Supports local predefined states (`@name`), vendor-prefixed CSS properties (`-webkit-*`),
@@ -1171,246 +832,736 @@ type ConfigTokenValue = string | number | boolean | Record<string, string | numb
1171
832
  * Design tokens injected as CSS custom properties on `:root`.
1172
833
  * Keys must start with `$` (value tokens) or `#` (color tokens).
1173
834
  *
1174
- * - `$name` keys become `--name` CSS custom properties
1175
- * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
835
+ * - `$name` keys become `--name` CSS custom properties
836
+ * - `#name` keys become `--name-color` properties
837
+ */
838
+ type ConfigTokens = Record<`$${string}` | `#${string}`, ConfigTokenValue>;
839
+ //#endregion
840
+ //#region src/pipeline/conditions.d.ts
841
+ /**
842
+ * ConditionNode Types and Helpers
843
+ *
844
+ * Core data structures for representing style conditions as an abstract syntax tree.
845
+ * Used throughout the pipeline for parsing, simplification, and CSS generation.
846
+ */
847
+ /**
848
+ * Base interface for all state conditions (leaf nodes)
849
+ */
850
+ interface BaseStateCondition {
851
+ kind: 'state';
852
+ negated: boolean;
853
+ raw: string;
854
+ uniqueId: string;
855
+ }
856
+ /**
857
+ * Modifier condition: [data-attr] or [data-attr="value"]
858
+ */
859
+ interface ModifierCondition extends BaseStateCondition {
860
+ type: 'modifier';
861
+ attribute: string;
862
+ value?: string;
863
+ operator?: '=' | '^=' | '$=' | '*=';
864
+ }
865
+ /**
866
+ * Pseudo-class condition: :hover, :focus-visible
867
+ */
868
+ interface PseudoCondition extends BaseStateCondition {
869
+ type: 'pseudo';
870
+ pseudo: string;
871
+ }
872
+ /**
873
+ * Numeric bound for dimension queries
874
+ */
875
+ interface NumericBound {
876
+ value: string;
877
+ valueNumeric: number | null;
878
+ inclusive: boolean;
879
+ }
880
+ /**
881
+ * Media query condition
882
+ */
883
+ interface MediaCondition extends BaseStateCondition {
884
+ type: 'media';
885
+ subtype: 'dimension' | 'feature' | 'type';
886
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
887
+ lowerBound?: NumericBound;
888
+ upperBound?: NumericBound;
889
+ feature?: string;
890
+ featureValue?: string;
891
+ mediaType?: 'print' | 'screen' | 'all' | 'speech';
892
+ }
893
+ /**
894
+ * Container query condition
895
+ */
896
+ interface ContainerCondition extends BaseStateCondition {
897
+ type: 'container';
898
+ subtype: 'dimension' | 'style' | 'raw';
899
+ containerName?: string;
900
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
901
+ lowerBound?: NumericBound;
902
+ upperBound?: NumericBound;
903
+ property?: string;
904
+ propertyValue?: string;
905
+ rawCondition?: string;
906
+ }
907
+ /**
908
+ * Root state condition: @root(theme=dark)
909
+ */
910
+ interface RootCondition extends BaseStateCondition {
911
+ type: 'root';
912
+ innerCondition: ConditionNode;
913
+ }
914
+ /**
915
+ * Parent state condition: @parent(hovered), @parent(theme=dark, >)
916
+ */
917
+ interface ParentCondition extends BaseStateCondition {
918
+ type: 'parent';
919
+ innerCondition: ConditionNode;
920
+ direct: boolean;
921
+ }
922
+ /**
923
+ * Own state condition: @own(hovered)
924
+ */
925
+ interface OwnCondition extends BaseStateCondition {
926
+ type: 'own';
927
+ innerCondition: ConditionNode;
928
+ }
929
+ /**
930
+ * Starting style condition: @starting
931
+ */
932
+ interface StartingCondition extends BaseStateCondition {
933
+ type: 'starting';
934
+ }
935
+ /**
936
+ * Supports query condition: @supports(display: grid), @supports($, :has(*))
937
+ */
938
+ interface SupportsCondition extends BaseStateCondition {
939
+ type: 'supports';
940
+ subtype: 'feature' | 'selector';
941
+ condition: string;
942
+ }
943
+ /**
944
+ * Union of all state condition types
945
+ */
946
+ type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
947
+ /**
948
+ * Compound node: combines conditions with AND/OR
949
+ */
950
+ interface CompoundCondition {
951
+ kind: 'compound';
952
+ operator: 'AND' | 'OR';
953
+ children: ConditionNode[];
954
+ }
955
+ /**
956
+ * True condition (matches everything)
957
+ */
958
+ interface TrueCondition {
959
+ kind: 'true';
960
+ }
961
+ /**
962
+ * False condition (matches nothing - skip this rule)
963
+ */
964
+ interface FalseCondition {
965
+ kind: 'false';
966
+ }
967
+ /**
968
+ * Union of all condition node types
969
+ */
970
+ type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
971
+ //#endregion
972
+ //#region src/states/index.d.ts
973
+ /**
974
+ * Parsed advanced state information
975
+ */
976
+ interface ParsedAdvancedState {
977
+ type: 'media' | 'container' | 'root' | 'parent' | 'own' | 'starting' | 'predefined' | 'modifier';
978
+ condition: string;
979
+ containerName?: string;
980
+ raw: string;
981
+ mediaType?: string;
982
+ }
983
+ /**
984
+ * Context for state parsing operations
985
+ */
986
+ interface StateParserContext {
987
+ localPredefinedStates: Record<string, string>;
988
+ globalPredefinedStates: Record<string, string>;
989
+ isSubElement?: boolean;
990
+ }
991
+ /**
992
+ * At-rule context for CSS generation
993
+ */
994
+ interface AtRuleContext {
995
+ media?: string[];
996
+ container?: {
997
+ name?: string;
998
+ condition: string;
999
+ }[];
1000
+ startingStyle?: boolean;
1001
+ rootStates?: string[];
1002
+ negatedRootStates?: string[];
1003
+ }
1004
+ /**
1005
+ * Configure global predefined states
1006
+ */
1007
+ declare function setGlobalPredefinedStates(states: Record<string, string>): void;
1008
+ /**
1009
+ * Get global predefined states
1010
+ */
1011
+ declare function getGlobalPredefinedStates(): Record<string, string>;
1012
+ /**
1013
+ * Create a state parser context from styles
1014
+ */
1015
+ declare function createStateParserContext(styles?: Styles, isSubElement?: boolean): StateParserContext;
1016
+ //#endregion
1017
+ //#region src/pipeline/parseStateKey.d.ts
1018
+ interface ParseStateKeyOptions {
1019
+ context?: StateParserContext;
1020
+ isSubElement?: boolean;
1021
+ }
1022
+ /**
1023
+ * Parse a state key string into a ConditionNode
1024
+ */
1025
+ declare function parseStateKey(stateKey: string, options?: ParseStateKeyOptions): ConditionNode;
1026
+ //#endregion
1027
+ //#region src/pipeline/index.d.ts
1028
+ /**
1029
+ * Matches the old StyleResult interface for backward compatibility
1030
+ */
1031
+ interface StyleResult {
1032
+ selector: string;
1033
+ declarations: string;
1034
+ atRules?: string[];
1035
+ needsClassName?: boolean;
1036
+ rootPrefix?: string;
1037
+ /** When true, declarations are wrapped in @starting-style { ... } inside the selector rule */
1038
+ startingStyle?: boolean;
1039
+ }
1040
+ /**
1041
+ * Matches the old RenderResult interface for backward compatibility
1042
+ */
1043
+ interface RenderResult {
1044
+ rules: StyleResult[];
1045
+ className?: string;
1046
+ }
1047
+ /**
1048
+ * Options for renderStyles when using direct selector mode.
1049
+ */
1050
+ interface RenderStylesOptions {
1051
+ /**
1052
+ * Whether to double the class selector for increased specificity.
1053
+ * When true, `.myClass` becomes `.myClass.myClass` for higher specificity.
1054
+ *
1055
+ * @default false - User-provided selectors are not doubled.
1056
+ *
1057
+ * Note: This only applies when a classNameOrSelector is provided.
1058
+ * When renderStyles returns RenderResult with needsClassName=true,
1059
+ * the injector handles doubling automatically.
1060
+ */
1061
+ doubleSelector?: boolean;
1062
+ }
1063
+ /**
1064
+ * Render styles to CSS rules.
1065
+ *
1066
+ * When called without classNameOrSelector, returns RenderResult with needsClassName=true.
1067
+ * When called with a selector/className string, returns StyleResult[] for direct injection.
1176
1068
  */
1177
- type ConfigTokens = Record<`$${string}` | `#${string}`, ConfigTokenValue>;
1069
+ declare function renderStyles(styles?: Styles, classNameOrSelector?: undefined, options?: undefined, pipelineCacheKey?: string): RenderResult;
1070
+ declare function renderStyles(styles: Styles | undefined, classNameOrSelector: string, options?: RenderStylesOptions): StyleResult[];
1178
1071
  //#endregion
1179
- //#region src/pipeline/conditions.d.ts
1072
+ //#region src/properties/property-type-resolver.d.ts
1180
1073
  /**
1181
- * ConditionNode Types and Helpers
1074
+ * PropertyTypeResolver
1182
1075
  *
1183
- * Core data structures for representing style conditions as an abstract syntax tree.
1184
- * Used throughout the pipeline for parsing, simplification, and CSS generation.
1185
- */
1186
- /**
1187
- * Base interface for all state conditions (leaf nodes)
1076
+ * Automatically infers CSS @property types from custom property values.
1077
+ * Supports deferred resolution for var() reference chains of arbitrary depth.
1188
1078
  */
1189
- interface BaseStateCondition {
1190
- kind: 'state';
1191
- negated: boolean;
1192
- raw: string;
1193
- uniqueId: string;
1079
+ declare class PropertyTypeResolver {
1080
+ /** propName → the prop it depends on */
1081
+ private pendingDeps;
1082
+ /** propName → list of props waiting on it */
1083
+ private reverseDeps;
1084
+ /**
1085
+ * Scan CSS declarations and auto-register @property for custom properties
1086
+ * whose types can be inferred from their values.
1087
+ */
1088
+ scanDeclarations(declarations: string, isPropertyDefined: (name: string) => boolean, registerProperty: (name: string, syntax: string, initialValue: string) => void): void;
1089
+ private addDependency;
1090
+ private resolve;
1091
+ private isComplexValue;
1194
1092
  }
1093
+ //#endregion
1094
+ //#region src/injector/batch.d.ts
1195
1095
  /**
1196
- * Modifier condition: [data-attr] or [data-attr="value"]
1096
+ * Deferred CSSOM writes ("batched injection").
1097
+ *
1098
+ * Every `insertRule()` on a live stylesheet invalidates style for the sheet's
1099
+ * scope, so Blink recalculates style the next time anything reads layout or
1100
+ * computed style. When components inject during React's render phase and other
1101
+ * components read layout in the same pass, the two interleave:
1102
+ *
1103
+ * inject -> read (forced recalc) -> inject -> read (forced recalc) -> ...
1104
+ *
1105
+ * Batching moves every sheet write out from between those reads. Writes are
1106
+ * queued in FIFO order and drained in one go, so the tree is invalidated once
1107
+ * per flush instead of once per component.
1108
+ *
1109
+ * ## Ordering
1110
+ *
1111
+ * A single queue holds *all* writes — component rules, global rules, keyframes,
1112
+ * `@property`, `@font-face`, `@counter-style`, `@function` and raw CSS. Draining
1113
+ * it in insertion order keeps the sheet byte-identical to unbatched output,
1114
+ * which matters because equal-specificity rules resolve by document order.
1115
+ *
1116
+ * ## Batch windows — why queuing is safe
1117
+ *
1118
+ * Deferring a write past React's layout phase would let a `useLayoutEffect`
1119
+ * measure an element whose rules are not in the sheet yet, reading the unstyled
1120
+ * box. `<TastyBatchProvider>` closes that hole by opening a *window* during its
1121
+ * render and closing it — flushing — in its `useInsertionEffect`, which React
1122
+ * runs in the mutation phase, before any layout effect:
1123
+ *
1124
+ * provider renders -> window OPEN
1125
+ * children render -> injections queued
1126
+ * provider insertionEffect -> FLUSH, window CLOSED
1127
+ * layout effects run -> rules are in the sheet
1128
+ *
1129
+ * So in the default (`batchInjection: true`) mode a write is only ever queued
1130
+ * inside a commit whose flush is already guaranteed by that same commit. Every
1131
+ * injection outside a window — a deep update the provider did not re-render
1132
+ * for, a `useLayoutEffect` that injects, an event handler, an async callback —
1133
+ * is written straight through, exactly as with batching off.
1134
+ *
1135
+ * `batchInjection: 'always'` opts out of the gate and queues unconditionally.
1136
+ * That wins on more commits, at the cost of the measurement hazard above.
1137
+ *
1138
+ * ## Flush points (earliest wins)
1139
+ *
1140
+ * 1. `<TastyBatchProvider>`'s `useInsertionEffect` — closes the window.
1141
+ * 2. A microtask — a backstop for a render that was aborted or suspended and
1142
+ * therefore never reached its insertion effect. An aborted render mounts
1143
+ * nothing, so nothing can measure what it queued. Microtasks also always
1144
+ * drain before paint, so styles are never visually missing.
1145
+ * 3. `flushStyles()` — explicit, and called internally by every injector read
1146
+ * API (`getCSSText`, `cleanup`, `gc`, `destroy`, ...).
1197
1147
  */
1198
- interface ModifierCondition extends BaseStateCondition {
1199
- type: 'modifier';
1200
- attribute: string;
1201
- value?: string;
1202
- operator?: '=' | '^=' | '$=' | '*=';
1148
+ interface QueuedWrite {
1149
+ /** Perform the deferred sheet write. */
1150
+ run: () => void;
1151
+ /** Set when the owner disposed before the write happened. */
1152
+ cancelled: boolean;
1153
+ /** Set once the write has been applied (or skipped as cancelled). */
1154
+ done: boolean;
1203
1155
  }
1156
+ /** Whether any write is still waiting to hit a stylesheet. */
1157
+ declare function hasPendingStyleWrites(): boolean;
1204
1158
  /**
1205
- * Pseudo-class condition: :hover, :focus-visible
1159
+ * Drain every pending sheet write, in insertion order.
1160
+ *
1161
+ * Safe to call when the queue is empty (the common case, so the guard comes
1162
+ * first) and safe to call re-entrantly: a nested `flushStyles()` is a no-op,
1163
+ * and work a draining write triggers is written in place by
1164
+ * `enqueueStyleWrite` rather than queued behind the rest of the batch.
1206
1165
  */
1207
- interface PseudoCondition extends BaseStateCondition {
1208
- type: 'pseudo';
1209
- pseudo: string;
1210
- }
1166
+ declare function flushStyles(): void;
1211
1167
  /**
1212
- * Numeric bound for dimension queries
1168
+ * Drop every pending write without applying it. Test helper — production code
1169
+ * should call `flushStyles()` instead.
1213
1170
  */
1214
- interface NumericBound {
1215
- value: string;
1216
- valueNumeric: number | null;
1217
- inclusive: boolean;
1171
+ declare function resetStyleBatch(): void;
1172
+ //#endregion
1173
+ //#region src/injector/types.d.ts
1174
+ declare global {
1175
+ interface Window {
1176
+ __TASTY__?: string[];
1177
+ }
1218
1178
  }
1219
- /**
1220
- * Media query condition
1221
- */
1222
- interface MediaCondition extends BaseStateCondition {
1223
- type: 'media';
1224
- subtype: 'dimension' | 'feature' | 'type';
1225
- dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
1226
- lowerBound?: NumericBound;
1227
- upperBound?: NumericBound;
1228
- feature?: string;
1229
- featureValue?: string;
1230
- mediaType?: 'print' | 'screen' | 'all' | 'speech';
1179
+ interface InjectResult {
1180
+ className: string;
1181
+ dispose: () => void;
1231
1182
  }
1232
- /**
1233
- * Container query condition
1234
- */
1235
- interface ContainerCondition extends BaseStateCondition {
1236
- type: 'container';
1237
- subtype: 'dimension' | 'style' | 'raw';
1238
- containerName?: string;
1239
- dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
1240
- lowerBound?: NumericBound;
1241
- upperBound?: NumericBound;
1242
- property?: string;
1243
- propertyValue?: string;
1244
- rawCondition?: string;
1183
+ interface GlobalInjectResult {
1184
+ dispose: () => void;
1245
1185
  }
1246
- /**
1247
- * Root state condition: @root(theme=dark)
1248
- */
1249
- interface RootCondition extends BaseStateCondition {
1250
- type: 'root';
1251
- innerCondition: ConditionNode;
1186
+ type DisposeFunction = () => void;
1187
+ interface StyleInjectorConfig {
1188
+ nonce?: string;
1189
+ maxRulesPerSheet?: number;
1190
+ forceTextInjection?: boolean;
1191
+ /** Enable development mode features: performance metrics and debug information storage */
1192
+ devMode?: boolean;
1193
+ /**
1194
+ * Global predefined states for advanced state mapping.
1195
+ * These are state aliases that can be used in any component.
1196
+ * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
1197
+ */
1198
+ states?: Record<string, string>;
1199
+ /**
1200
+ * Automatically infer and register CSS @property declarations
1201
+ * from custom property values. When false, only explicit @property are used.
1202
+ * @default true
1203
+ */
1204
+ autoPropertyTypes?: boolean;
1205
+ /** Garbage collection configuration for unused styles */
1206
+ gc?: GCConfig;
1207
+ /**
1208
+ * Prefix prepended to every generated identifier.
1209
+ * Mirrors the `namePrefix` field on the public `TastyConfig` so that
1210
+ * standalone injector consumers can configure it directly.
1211
+ * @default 't'
1212
+ */
1213
+ namePrefix?: string;
1214
+ /**
1215
+ * Defer stylesheet writes and apply them in one batch instead of one
1216
+ * `insertRule()` per component. Mirrors `batchInjection` on the public
1217
+ * `TastyConfig`.
1218
+ * @default false
1219
+ */
1220
+ batchInjection?: boolean | 'always';
1252
1221
  }
1253
1222
  /**
1254
- * Parent state condition: @parent(hovered), @parent(theme=dark, >)
1223
+ * Per-className usage tracking for GC.
1255
1224
  */
1256
- interface ParentCondition extends BaseStateCondition {
1257
- type: 'parent';
1258
- innerCondition: ConditionNode;
1259
- direct: boolean;
1260
- }
1261
1225
  /**
1262
- * Own state condition: @own(hovered)
1226
+ * @deprecated Nothing reads this any more. Collection asks the DOM what is
1227
+ * rendered rather than tracking usage per class, so there is no usage record
1228
+ * to describe. Kept so existing imports keep type-checking.
1263
1229
  */
1264
- interface OwnCondition extends BaseStateCondition {
1265
- type: 'own';
1266
- innerCondition: ConditionNode;
1230
+ interface StyleUsage {
1231
+ lastTouchedAt: number;
1267
1232
  }
1268
1233
  /**
1269
- * Starting style condition: @starting
1234
+ * Configuration for the style garbage collector.
1235
+ *
1236
+ * GC is triggered by touch count rather than timers: every `touchInterval`
1237
+ * touches, an idle callback is scheduled to evict unused styles above
1238
+ * `capacity`, oldest first.
1270
1239
  */
1271
- interface StartingCondition extends BaseStateCondition {
1272
- type: 'starting';
1240
+ interface GCConfig {
1241
+ /**
1242
+ * How long a class is left alone after collection first notices nothing is
1243
+ * carrying it, in milliseconds (default 10,000).
1244
+ *
1245
+ * Rendering is not commit-aware: a render can resolve a class and commit it a
1246
+ * little later, and in between nothing on the page carries it. Rather than
1247
+ * try to tell that apart from a class that is finished — which cannot be done
1248
+ * from outside React — collection simply does not touch anything that was in
1249
+ * use recently. A render would have to stay pending for the whole window to
1250
+ * lose its rules, and it gets them back on its next render.
1251
+ */
1252
+ grace?: number;
1253
+ /**
1254
+ * Number of touch events between automatic GC cycles.
1255
+ * @default 1000
1256
+ */
1257
+ touchInterval?: number;
1258
+ /**
1259
+ * Maximum number of unused styles to retain.
1260
+ * GC evicts the oldest unused styles when this limit is exceeded.
1261
+ * Pinned styles and DOM-live styles
1262
+ * do not count against this limit.
1263
+ * @default 1000
1264
+ */
1265
+ capacity?: number;
1273
1266
  }
1274
1267
  /**
1275
- * Supports query condition: @supports(display: grid), @supports($, :has(*))
1268
+ * Per-call options for inject().
1276
1269
  */
1277
- interface SupportsCondition extends BaseStateCondition {
1278
- type: 'supports';
1279
- subtype: 'feature' | 'selector';
1280
- condition: string;
1270
+ interface InjectOptions {
1271
+ root?: Document | ShadowRoot;
1272
+ /** Reuse the class already injected for this key instead of writing again. */
1273
+ cacheKey?: string;
1274
+ /**
1275
+ * Pin the injected class (default `true`). A pinned class is never evicted by
1276
+ * `gc()`, and the returned `dispose()` releases the pin. Pass `false` when the
1277
+ * caller keeps no handle and the DOM is the only record that the class is in
1278
+ * use — the render path does this, because a hook-free render has no unmount
1279
+ * signal to dispose on.
1280
+ */
1281
+ pin?: boolean;
1281
1282
  }
1282
1283
  /**
1283
- * Union of all state condition types
1284
- */
1285
- type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
1286
- /**
1287
- * Compound node: combines conditions with AND/OR
1284
+ * Per-call options for gc().
1288
1285
  */
1289
- interface CompoundCondition {
1290
- kind: 'compound';
1291
- operator: 'AND' | 'OR';
1292
- children: ConditionNode[];
1286
+ interface GCOptions {
1287
+ root?: Document | ShadowRoot;
1288
+ /** Bypass capacity threshold and remove ALL unused styles. */
1289
+ force?: boolean;
1290
+ }
1291
+ interface RuleInfo {
1292
+ className: string;
1293
+ ruleIndex: number;
1294
+ sheetIndex: number;
1295
+ /** Dev-only: full CSS texts inserted for this class; omitted in production */
1296
+ cssText?: string[];
1297
+ /** Inclusive end index of the contiguous block of inserted rules for this className */
1298
+ endRuleIndex?: number;
1299
+ /** NEW: exact indices of all inserted rules for this className */
1300
+ indices?: number[];
1301
+ }
1302
+ type InjectionMode = 'style-element' | 'adopted';
1303
+ interface SheetInfo {
1304
+ /** HTMLStyleElement used in style-element mode; null in adopted mode. */
1305
+ sheet: HTMLStyleElement | null;
1306
+ /** Constructable CSSStyleSheet used in adopted mode (ShadowRoot targets) */
1307
+ constructableSheet?: CSSStyleSheet;
1308
+ ruleCount: number;
1309
+ holes: number[];
1310
+ /**
1311
+ * True when this sheet is written through `textContent` instead of CSSOM.
1312
+ * Decided once at sheet creation so a sheet is never half CSSOM / half text.
1313
+ */
1314
+ textMode?: boolean;
1315
+ /**
1316
+ * Inserted rule texts in rule-index order. Maintained only in text mode —
1317
+ * it is what makes deletion possible there, since `textContent` cannot be
1318
+ * edited rule-by-rule and has to be rebuilt.
1319
+ */
1320
+ textRules?: string[];
1321
+ }
1322
+ interface CleanupStats {
1323
+ timestamp: number;
1324
+ classesDeleted: number;
1325
+ cssSize: number;
1326
+ rulesDeleted: number;
1327
+ }
1328
+ interface CacheMetrics {
1329
+ hits: number;
1330
+ misses: number;
1331
+ bulkCleanups: number;
1332
+ totalInsertions: number;
1333
+ totalUnused: number;
1334
+ stylesCleanedUp: number;
1335
+ cleanupHistory: CleanupStats[];
1336
+ startTime: number;
1337
+ unusedHits?: number;
1338
+ }
1339
+ interface RootRegistry {
1340
+ sheets: SheetInfo[];
1341
+ /** className -> outstanding `inject()` references; 0 means nobody holds a handle */
1342
+ pinCounts: Map<string, number>;
1343
+ rules: Map<string, RuleInfo>;
1344
+ /** Cache key to className mapping to avoid dual storage of RuleInfo objects */
1345
+ cacheKeyToClassName: Map<string, string>;
1346
+ /** Deduplication set of fully materialized CSS rules inserted into sheets */
1347
+ ruleTextSet: Set<string>;
1348
+ /** Performance metrics (optional) */
1349
+ metrics?: CacheMetrics;
1350
+ /** Keyframes cache by content hash -> entry */
1351
+ keyframesCache: Map<string, KeyframesCacheEntry>;
1352
+ /** Keyframes name to content hash mapping for collision detection */
1353
+ keyframesNameToContent: Map<string, string>;
1354
+ /** Counter for generating keyframes names like k0, k1, k2... */
1355
+ keyframesCounter: number;
1356
+ /** Map of injected @property names to their normalized declarations for tracking */
1357
+ injectedProperties: Map<string, string>;
1358
+ /** Content hashes of injected @font-face rules for deduplication */
1359
+ injectedFontFaces: Set<string>;
1360
+ /**
1361
+ * Injected @counter-style rules. Maps the name to whether it was injected
1362
+ * "strong" (`true`, the default — overrides) or "weak" (`false`, global
1363
+ * `configure()` definitions that never clobber an existing rule).
1364
+ */
1365
+ injectedCounterStyles: Map<string, boolean>;
1366
+ /**
1367
+ * Injected @function rules. Maps the CSS function name to whether it was
1368
+ * injected "strong" (`true`, the default — overrides) or "weak" (`false`,
1369
+ * global `configure()` definitions that never clobber an existing rule).
1370
+ */
1371
+ injectedFunctions: Map<string, boolean>;
1372
+ /** Global rules tracking for index adjustment */
1373
+ globalRules: Map<string, RuleInfo>;
1374
+ /** Resolver for auto-inferring @property types from declaration values */
1375
+ propertyTypeResolver: PropertyTypeResolver;
1376
+ /**
1377
+ * className -> when the class was first noticed to be carrying nothing:
1378
+ * injection, or the first sweep that looked and did not find it on an
1379
+ * element. Cleared the moment a sweep finds it rendered again.
1380
+ *
1381
+ * Deliberately "when it was noticed", not "when it stopped being rendered".
1382
+ * Nothing observes the moment an element leaves, so a class that unmounted
1383
+ * just before a sweep and one that unmounted just after the previous sweep
1384
+ * would otherwise be treated differently — and the first would lose its
1385
+ * grace window entirely. Starting the clock at the sighting gives every
1386
+ * class the same full window, whenever it actually went.
1387
+ *
1388
+ * Written only by the sweep's own DOM scan and at injection, so rendering
1389
+ * never pays for it.
1390
+ */
1391
+ unusedSince: Map<string, number>;
1392
+ /**
1393
+ * Local `@keyframes` a class animates, by the name they were authored under.
1394
+ *
1395
+ * One reference is held per distinct set of steps, however many renders ask
1396
+ * for it, and the classes that animate it own that reference between them.
1397
+ * The last of them to be deleted releases it, so keyframes cannot outlive
1398
+ * every rule that referred to them, and repeat renders cannot pile up
1399
+ * references nobody gives back.
1400
+ */
1401
+ localKeyframes: Map<string, {
1402
+ name: string;
1403
+ dispose: () => void;
1404
+ owners: Set<string>;
1405
+ }>;
1406
+ /** Renders since the last scheduled sweep (per-root) */
1407
+ touchCount: number;
1408
+ /** How many entries from `window.__TASTY__` have been synced into this registry */
1409
+ serverClassSyncIndex: number;
1410
+ /** Whether `<style data-tasty-rsc>` tags have been scanned for class names */
1411
+ rscStylesScanned: boolean;
1412
+ /** Whether this root uses adoptedStyleSheets or <style> elements */
1413
+ injectionMode: InjectionMode;
1414
+ /**
1415
+ * Lazy feature-test for `@property` support, cached per registry.
1416
+ * - `undefined`: not yet probed.
1417
+ * - `true`: engine supports `@property`; rejections indicate user-authored
1418
+ * invalid rules and should warn.
1419
+ * - `false`: engine doesn't support `@property` (e.g., jsdom); rejections
1420
+ * are expected and warnings are suppressed.
1421
+ */
1422
+ atPropertySupported?: boolean;
1293
1423
  }
1294
- /**
1295
- * True condition (matches everything)
1296
- */
1297
- interface TrueCondition {
1298
- kind: 'true';
1424
+ type StyleRule = StyleResult;
1425
+ interface KeyframesInfo {
1426
+ name: string;
1427
+ sheetIndex: number;
1428
+ ruleIndex: number;
1429
+ /** Dev-only: full CSS text of the @keyframes rule; omitted in production */
1430
+ cssText?: string;
1299
1431
  }
1300
- /**
1301
- * False condition (matches nothing - skip this rule)
1302
- */
1303
- interface FalseCondition {
1304
- kind: 'false';
1432
+ type KeyframeStep = string | Record<string, string | number>;
1433
+ type KeyframesSteps = Record<string, KeyframeStep>;
1434
+ interface KeyframesResult {
1435
+ toString(): string;
1436
+ dispose: () => void;
1305
1437
  }
1306
- /**
1307
- * Union of all condition node types
1308
- */
1309
- type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
1310
- //#endregion
1311
- //#region src/states/index.d.ts
1312
- /**
1313
- * Parsed advanced state information
1314
- */
1315
- interface ParsedAdvancedState {
1316
- type: 'media' | 'container' | 'root' | 'parent' | 'own' | 'starting' | 'predefined' | 'modifier';
1317
- condition: string;
1318
- containerName?: string;
1319
- raw: string;
1320
- mediaType?: string;
1438
+ interface KeyframesCacheEntry {
1439
+ name: string;
1440
+ refCount: number;
1441
+ info: KeyframesInfo;
1442
+ /**
1443
+ * Queued sheet write, when `batchInjection` deferred the insertion. Present
1444
+ * only between `keyframes()` and the flush; disposing in that window cancels
1445
+ * the write instead of deleting a rule that was never inserted.
1446
+ */
1447
+ pending?: QueuedWrite;
1321
1448
  }
1322
1449
  /**
1323
- * Context for state parsing operations
1450
+ * Definition for a CSS @property at-rule.
1451
+ * Used to define custom property syntax, inheritance, and initial value.
1324
1452
  */
1325
- interface StateParserContext {
1326
- localPredefinedStates: Record<string, string>;
1327
- globalPredefinedStates: Record<string, string>;
1328
- isSubElement?: boolean;
1453
+ interface PropertyDefinition {
1454
+ /** CSS syntax string (e.g., '<color>', '<angle>', '<number>') */
1455
+ syntax?: string;
1456
+ /** Whether the property inherits (default: true) */
1457
+ inherits?: boolean;
1458
+ /** Initial value for the property */
1459
+ initialValue?: string | number;
1329
1460
  }
1330
1461
  /**
1331
- * At-rule context for CSS generation
1462
+ * Options for registering a CSS `@property`.
1463
+ * Extends {@link PropertyDefinition} with an optional injection root.
1332
1464
  */
1333
- interface AtRuleContext {
1334
- media?: string[];
1335
- container?: {
1336
- name?: string;
1337
- condition: string;
1338
- }[];
1339
- startingStyle?: boolean;
1340
- rootStates?: string[];
1341
- negatedRootStates?: string[];
1465
+ interface PropertyOptions extends PropertyDefinition {
1466
+ /** Shadow root or document to inject into */
1467
+ root?: Document | ShadowRoot;
1342
1468
  }
1343
1469
  /**
1344
- * Configure global predefined states
1345
- */
1346
- declare function setGlobalPredefinedStates(states: Record<string, string>): void;
1347
- /**
1348
- * Get global predefined states
1470
+ * A single parameter for a CSS @function at-rule.
1471
+ *
1472
+ * - `true` — a bare parameter with no type or default.
1473
+ * - `string` — a CSS type shorthand (e.g. `'<length>'`, `'<color>'`).
1474
+ * - object — full form with optional `syntax` (type) and `default` value.
1349
1475
  */
1350
- declare function getGlobalPredefinedStates(): Record<string, string>;
1476
+ type FunctionParameter = true | string | {
1477
+ syntax?: string;
1478
+ default?: string | number;
1479
+ };
1351
1480
  /**
1352
- * Create a state parser context from styles
1481
+ * Definition for a CSS @function at-rule (custom function).
1482
+ *
1483
+ * The descriptor body reads like a mini styles object: any `$name` key declares
1484
+ * a local variable (`--name`) whose value is parsed through the Tasty DSL.
1485
+ * `result` is the only required field.
1486
+ *
1487
+ * @example
1488
+ * ```ts
1489
+ * // @function --negative(--value) { result: calc(-1 * var(--value)); }
1490
+ * { args: ['$value'], result: '(-1 * $value)' }
1491
+ * ```
1353
1492
  */
1354
- declare function createStateParserContext(styles?: Styles, isSubElement?: boolean): StateParserContext;
1355
- //#endregion
1356
- //#region src/pipeline/parseStateKey.d.ts
1357
- interface ParseStateKeyOptions {
1358
- context?: StateParserContext;
1359
- isSubElement?: boolean;
1493
+ interface FunctionDefinition {
1494
+ /**
1495
+ * Ordered parameters. Array form lists bare parameter names (`['$value']`);
1496
+ * object form maps each parameter name to its type/default.
1497
+ */
1498
+ args?: string[] | Record<string, FunctionParameter>;
1499
+ /** Optional return type, e.g. `'<color>'`. */
1500
+ returns?: string;
1501
+ /** The `result:` descriptor value (parsed through the Tasty DSL). Required. */
1502
+ result: string;
1503
+ /** Local variables: any `$name` key declares `--name` in the body. */
1504
+ [localVar: `$${string}`]: string | number | undefined;
1360
1505
  }
1361
1506
  /**
1362
- * Parse a state key string into a ConditionNode
1363
- */
1364
- declare function parseStateKey(stateKey: string, options?: ParseStateKeyOptions): ConditionNode;
1365
- //#endregion
1366
- //#region src/pipeline/index.d.ts
1367
- /**
1368
- * Matches the old StyleResult interface for backward compatibility
1507
+ * Descriptors for a CSS @font-face at-rule.
1369
1508
  */
1370
- interface StyleResult {
1371
- selector: string;
1372
- declarations: string;
1373
- atRules?: string[];
1374
- needsClassName?: boolean;
1375
- rootPrefix?: string;
1376
- /** When true, declarations are wrapped in @starting-style { ... } inside the selector rule */
1377
- startingStyle?: boolean;
1509
+ interface FontFaceDescriptors {
1510
+ /** Required. URL(s) to the font file(s). */
1511
+ src: string;
1512
+ /** Font weight or range. Default: 'normal'. */
1513
+ fontWeight?: string | number;
1514
+ /** Font style. Default: 'normal'. */
1515
+ fontStyle?: 'normal' | 'italic' | 'oblique' | (string & {});
1516
+ /** Font stretch. Default: 'normal'. */
1517
+ fontStretch?: string;
1518
+ /** Loading behavior. Default: 'auto'. */
1519
+ fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
1520
+ /** Unicode range to cover. */
1521
+ unicodeRange?: string;
1522
+ /** Ascent metric override. */
1523
+ ascentOverride?: string;
1524
+ /** Descent metric override. */
1525
+ descentOverride?: string;
1526
+ /** Line gap metric override. */
1527
+ lineGapOverride?: string;
1528
+ /** Size adjustment factor. */
1529
+ sizeAdjust?: string;
1530
+ /** OpenType feature settings. */
1531
+ fontFeatureSettings?: string;
1532
+ /** Font variation axis settings. */
1533
+ fontVariationSettings?: string;
1378
1534
  }
1535
+ /** Single descriptor or array of descriptors for multiple weights/styles. */
1536
+ type FontFaceInput = FontFaceDescriptors | FontFaceDescriptors[];
1379
1537
  /**
1380
- * Matches the old RenderResult interface for backward compatibility
1538
+ * Descriptors for a CSS @counter-style at-rule.
1381
1539
  */
1382
- interface RenderResult {
1383
- rules: StyleResult[];
1384
- className?: string;
1540
+ interface CounterStyleDescriptors {
1541
+ /** Required. Numbering algorithm. */
1542
+ system: 'cyclic' | 'numeric' | 'alphabetic' | 'symbolic' | 'additive' | 'fixed' | (string & {});
1543
+ /** Symbols for non-additive systems. */
1544
+ symbols?: string;
1545
+ /** Symbol-value pairs for additive system. */
1546
+ additiveSymbols?: string;
1547
+ /** String prepended to the marker. Default: "". */
1548
+ prefix?: string;
1549
+ /** String appended to the marker. Default: ". ". */
1550
+ suffix?: string;
1551
+ /** Negative-value wrapping (e.g., '"(" ")"'). */
1552
+ negative?: string;
1553
+ /** Counter range (e.g., 'infinite infinite'). */
1554
+ range?: string;
1555
+ /** Minimum marker width and pad symbol (e.g., '3 "0"'). */
1556
+ pad?: string;
1557
+ /** Fallback counter style name. */
1558
+ fallback?: string;
1559
+ /** Speech synthesis hint. */
1560
+ speakAs?: string;
1385
1561
  }
1386
- /**
1387
- * Check if a key is a CSS selector
1388
- */
1389
- declare function isSelector(key: string): boolean;
1390
- /**
1391
- * Options for renderStyles when using direct selector mode.
1392
- */
1393
- interface RenderStylesOptions {
1394
- /**
1395
- * Whether to double the class selector for increased specificity.
1396
- * When true, `.myClass` becomes `.myClass.myClass` for higher specificity.
1397
- *
1398
- * @default false - User-provided selectors are not doubled.
1399
- *
1400
- * Note: This only applies when a classNameOrSelector is provided.
1401
- * When renderStyles returns RenderResult with needsClassName=true,
1402
- * the injector handles doubling automatically.
1403
- */
1404
- doubleSelector?: boolean;
1562
+ interface RawCSSResult {
1563
+ dispose: () => void;
1405
1564
  }
1406
- /**
1407
- * Render styles to CSS rules.
1408
- *
1409
- * When called without classNameOrSelector, returns RenderResult with needsClassName=true.
1410
- * When called with a selector/className string, returns StyleResult[] for direct injection.
1411
- */
1412
- declare function renderStyles(styles?: Styles, classNameOrSelector?: undefined, options?: undefined, pipelineCacheKey?: string): RenderResult;
1413
- declare function renderStyles(styles: Styles | undefined, classNameOrSelector: string, options?: RenderStylesOptions): StyleResult[];
1414
1565
  //#endregion
1415
- export { StyleParser as $, ParsedColor as A, StyleUsage as At, StyleValueStateMap as B, SuffixForSelector as C, PropertyOptions as Ct, CSSMap as D, SheetInfo as Dt, AnyStyleHandler as E, RuleInfo as Et, StyleHandlerProps as F, parseColor as G, getGlobalParser as H, StyleHandlerResult as I, getNamedColorHex as J, parseStyle as K, StyleMap as L, ResolvedStyleValue as M, StyleHandler as N, CUSTOM_UNITS as O, StyleInjectorConfig as Ot, StyleHandlerDefinition as P, strToRgb as Q, StylePropValue as R, StylesWithoutSelectors as S, PropertyDefinition as St, TastyPresetNames as T, RootRegistry as Tt, getGlobalPredefinedTokens as U, filterMods as V, normalizeColorTokenValue as W, hexToRgb as X, getRgbValuesFromRgbaString as Y, hslToRgbValues as Z, NotSelector as _, InjectionMode as _t, ParseStateKeyOptions as a, CSSProperties as at, Styles as b, KeyframesResult as bt, ParsedAdvancedState as c, DisposeFunction as ct, getGlobalPredefinedStates as d, FunctionDefinition as dt, ParserOptions as et, setGlobalPredefinedStates as f, FunctionParameter as ft, NoType as g, InjectResult as gt, ConfigTokens as h, GlobalInjectResult as ht, renderStyles as i, UnitHandler as it, RawStyleHandler as j, DIRECTIONS as k, StyleRule as kt, StateParserContext as l, FontFaceDescriptors as lt, ConfigTokenValue as m, GCOptions as mt, StyleResult as n, StyleDetails as nt, parseStateKey as o, CacheMetrics as ot, ConditionNode as p, GCConfig as pt, stringifyStyles as q, isSelector as r, StyleDetailsPart as rt, AtRuleContext as s, CounterStyleDescriptors as st, RenderResult as t, ProcessedStyle as tt, createStateParserContext as u, FontFaceInput as ut, RecipeStyles as v, KeyframesCacheEntry as vt, TastyNamedColors as w, RawCSSResult as wt, StylesInterface as x, KeyframesSteps as xt, Selector as y, KeyframesInfo as yt, StyleValue as z };
1416
- //# sourceMappingURL=index-KUYya3x7.d.ts.map
1566
+ export { TastyNamedColors as $, resetStyleBatch as A, getGlobalPredefinedStates as B, SheetInfo as C, StyleParser as Ct, QueuedWrite as D, StyleDetailsPart as Dt, StyleUsage as E, StyleDetails as Et, parseStateKey as F, NoType as G, ConditionNode as H, AtRuleContext as I, Selector as J, NotSelector as K, ParsedAdvancedState as L, StyleResult as M, renderStyles as N, flushStyles as O, UnitHandler as Ot, ParseStateKeyOptions as P, SuffixForSelector as Q, StateParserContext as R, RuleInfo as S, stringifyStyles as St, StyleRule as T, ProcessedStyle as Tt, ConfigTokenValue as U, setGlobalPredefinedStates as V, ConfigTokens as W, StylesInterface as X, Styles as Y, StylesWithoutSelectors as Z, KeyframesSteps as _, getGlobalParser as _t, FontFaceInput as a, ParsedColor as at, RawCSSResult as b, parseColor as bt, GCConfig as c, StyleHandler as ct, InjectOptions as d, StyleHandlerResult as dt, TastyPresetNames as et, InjectResult as f, StyleMap as ft, KeyframesResult as g, filterMods as gt, KeyframesInfo as h, StyleValueStateMap as ht, FontFaceDescriptors as i, DIRECTIONS as it, RenderResult as j, hasPendingStyleWrites as k, CSSProperties as kt, GCOptions as l, StyleHandlerDefinition as lt, KeyframesCacheEntry as m, StyleValue as mt, CounterStyleDescriptors as n, CSSMap as nt, FunctionDefinition as o, RawStyleHandler as ot, InjectionMode as p, StylePropValue as pt, RecipeStyles as q, DisposeFunction as r, CUSTOM_UNITS as rt, FunctionParameter as s, ResolvedStyleValue as st, CacheMetrics as t, AnyStyleHandler as tt, GlobalInjectResult as u, StyleHandlerProps as ut, PropertyDefinition as v, getGlobalPredefinedTokens as vt, StyleInjectorConfig as w, ParserOptions as wt, RootRegistry as x, parseStyle as xt, PropertyOptions as y, normalizeColorTokenValue as yt, createStateParserContext as z };
1567
+ //# sourceMappingURL=types-DJEM_BOJ.d.ts.map