@tenphi/tasty 0.0.0-snapshot.002b1b3

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 (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +637 -0
  3. package/dist/async-storage-B7_o6FKt.js +44 -0
  4. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  5. package/dist/collector-LuU1vZ68.d.ts +98 -0
  6. package/dist/collector-MOYY2SOr.js +230 -0
  7. package/dist/collector-MOYY2SOr.js.map +1 -0
  8. package/dist/config-A237aY9H.js +10235 -0
  9. package/dist/config-A237aY9H.js.map +1 -0
  10. package/dist/config-vuCRkBWX.d.ts +884 -0
  11. package/dist/context-CkSg-kDT.js +24 -0
  12. package/dist/context-CkSg-kDT.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -0
  14. package/dist/core/index.js +6 -0
  15. package/dist/core-BkKav78f.js +1592 -0
  16. package/dist/core-BkKav78f.js.map +1 -0
  17. package/dist/css-writer-Cos9tQRM.js +329 -0
  18. package/dist/css-writer-Cos9tQRM.js.map +1 -0
  19. package/dist/format-global-rules-Dbc_1tc3.js +22 -0
  20. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  21. package/dist/format-rules-C2oiTsEO.js +143 -0
  22. package/dist/format-rules-C2oiTsEO.js.map +1 -0
  23. package/dist/hydrate-miFzWIKR.js +45 -0
  24. package/dist/hydrate-miFzWIKR.js.map +1 -0
  25. package/dist/index-CJMXAAO5.d.ts +1602 -0
  26. package/dist/index-dUtwpOux.d.ts +1266 -0
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.js +732 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-DDtNo_hl.js +587 -0
  31. package/dist/keyframes-DDtNo_hl.js.map +1 -0
  32. package/dist/merge-styles-CtDJMhpJ.d.ts +7 -0
  33. package/dist/merge-styles-D_HbBOlq.js +144 -0
  34. package/dist/merge-styles-D_HbBOlq.js.map +1 -0
  35. package/dist/resolve-recipes-B7-823LL.js +144 -0
  36. package/dist/resolve-recipes-B7-823LL.js.map +1 -0
  37. package/dist/ssr/astro-client.d.ts +1 -0
  38. package/dist/ssr/astro-client.js +19 -0
  39. package/dist/ssr/astro-client.js.map +1 -0
  40. package/dist/ssr/astro-middleware.d.ts +15 -0
  41. package/dist/ssr/astro-middleware.js +19 -0
  42. package/dist/ssr/astro-middleware.js.map +1 -0
  43. package/dist/ssr/astro.d.ts +97 -0
  44. package/dist/ssr/astro.js +149 -0
  45. package/dist/ssr/astro.js.map +1 -0
  46. package/dist/ssr/index.d.ts +44 -0
  47. package/dist/ssr/index.js +10 -0
  48. package/dist/ssr/index.js.map +1 -0
  49. package/dist/ssr/next.d.ts +46 -0
  50. package/dist/ssr/next.js +75 -0
  51. package/dist/ssr/next.js.map +1 -0
  52. package/dist/static/index.d.ts +91 -0
  53. package/dist/static/index.js +50 -0
  54. package/dist/static/index.js.map +1 -0
  55. package/dist/static/inject.d.ts +5 -0
  56. package/dist/static/inject.js +17 -0
  57. package/dist/static/inject.js.map +1 -0
  58. package/dist/zero/babel.d.ts +81 -0
  59. package/dist/zero/babel.js +466 -0
  60. package/dist/zero/babel.js.map +1 -0
  61. package/dist/zero/index.d.ts +67 -0
  62. package/dist/zero/index.js +2 -0
  63. package/dist/zero/next.d.ts +86 -0
  64. package/dist/zero/next.js +143 -0
  65. package/dist/zero/next.js.map +1 -0
  66. package/docs/README.md +31 -0
  67. package/docs/adoption.md +298 -0
  68. package/docs/comparison.md +419 -0
  69. package/docs/configuration.md +394 -0
  70. package/docs/debug.md +320 -0
  71. package/docs/design-system.md +436 -0
  72. package/docs/dsl.md +688 -0
  73. package/docs/getting-started.md +217 -0
  74. package/docs/injector.md +544 -0
  75. package/docs/methodology.md +616 -0
  76. package/docs/pipeline.md +673 -0
  77. package/docs/react-api.md +557 -0
  78. package/docs/ssr.md +442 -0
  79. package/docs/styles.md +596 -0
  80. package/docs/tasty-static.md +532 -0
  81. package/package.json +222 -0
  82. package/tasty.config.ts +15 -0
@@ -0,0 +1,1266 @@
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 @properties are used.
54
+ * @default true
55
+ */
56
+ autoPropertyTypes?: boolean;
57
+ /** Garbage collection configuration for unused styles */
58
+ gc?: GCConfig;
59
+ }
60
+ /**
61
+ * Per-className usage tracking for GC.
62
+ */
63
+ interface StyleUsage {
64
+ lastTouchedAt: number;
65
+ }
66
+ /**
67
+ * Configuration for the style garbage collector.
68
+ *
69
+ * GC is triggered by touch count rather than timers: every `touchInterval`
70
+ * touches, an idle callback is scheduled to evict unused styles above
71
+ * `capacity`, oldest first.
72
+ */
73
+ interface GCConfig {
74
+ /**
75
+ * Number of touch events between GC cycles.
76
+ * @default 1000
77
+ */
78
+ touchInterval?: number;
79
+ /**
80
+ * Maximum number of unused styles to retain.
81
+ * GC evicts the oldest unused styles when this limit is exceeded.
82
+ * Actively referenced styles (refCount > 0) and DOM-live styles
83
+ * do not count against this limit.
84
+ * @default 1000
85
+ */
86
+ capacity?: number;
87
+ }
88
+ /**
89
+ * Per-call options for gc().
90
+ */
91
+ interface GCOptions {
92
+ root?: Document | ShadowRoot;
93
+ /** Bypass capacity threshold and remove ALL unused styles. */
94
+ force?: boolean;
95
+ }
96
+ interface RuleInfo {
97
+ className: string;
98
+ ruleIndex: number;
99
+ sheetIndex: number;
100
+ /** Dev-only: full CSS texts inserted for this class; omitted in production */
101
+ cssText?: string[];
102
+ /** Inclusive end index of the contiguous block of inserted rules for this className */
103
+ endRuleIndex?: number;
104
+ /** NEW: exact indices of all inserted rules for this className */
105
+ indices?: number[];
106
+ }
107
+ type InjectionMode = 'style-element' | 'adopted';
108
+ interface SheetInfo {
109
+ /** HTMLStyleElement used in style-element mode; null in adopted mode. */
110
+ sheet: HTMLStyleElement | null;
111
+ /** Constructable CSSStyleSheet used in adopted mode (ShadowRoot targets) */
112
+ constructableSheet?: CSSStyleSheet;
113
+ ruleCount: number;
114
+ holes: number[];
115
+ }
116
+ interface CleanupStats {
117
+ timestamp: number;
118
+ classesDeleted: number;
119
+ cssSize: number;
120
+ rulesDeleted: number;
121
+ }
122
+ interface CacheMetrics {
123
+ hits: number;
124
+ misses: number;
125
+ bulkCleanups: number;
126
+ totalInsertions: number;
127
+ totalUnused: number;
128
+ stylesCleanedUp: number;
129
+ cleanupHistory: CleanupStats[];
130
+ startTime: number;
131
+ unusedHits?: number;
132
+ }
133
+ interface RootRegistry {
134
+ sheets: SheetInfo[];
135
+ refCounts: Map<string, number>;
136
+ rules: Map<string, RuleInfo>;
137
+ /** Cache key to className mapping to avoid dual storage of RuleInfo objects */
138
+ cacheKeyToClassName: Map<string, string>;
139
+ /** Deduplication set of fully materialized CSS rules inserted into sheets */
140
+ ruleTextSet: Set<string>;
141
+ /** Performance metrics (optional) */
142
+ metrics?: CacheMetrics;
143
+ /** Keyframes cache by content hash -> entry */
144
+ keyframesCache: Map<string, KeyframesCacheEntry>;
145
+ /** Keyframes name to content hash mapping for collision detection */
146
+ keyframesNameToContent: Map<string, string>;
147
+ /** Counter for generating keyframes names like k0, k1, k2... */
148
+ keyframesCounter: number;
149
+ /** Map of injected @property names to their normalized declarations for tracking */
150
+ injectedProperties: Map<string, string>;
151
+ /** Content hashes of injected @font-face rules for deduplication */
152
+ injectedFontFaces: Set<string>;
153
+ /** Names of injected @counter-style rules for deduplication */
154
+ injectedCounterStyles: Set<string>;
155
+ /** Global rules tracking for index adjustment */
156
+ globalRules: Map<string, RuleInfo>;
157
+ /** Resolver for auto-inferring @property types from declaration values */
158
+ propertyTypeResolver: PropertyTypeResolver;
159
+ /** Per-className usage tracking for GC */
160
+ usageMap: Map<string, StyleUsage>;
161
+ /** Touch counter for scheduling GC (per-root) */
162
+ touchCount: number;
163
+ /** How many entries from `window.__TASTY__` have been synced into this registry */
164
+ serverClassSyncIndex: number;
165
+ /** Whether `<style data-tasty-rsc>` tags have been scanned for class names */
166
+ rscStylesScanned: boolean;
167
+ /** Whether this root uses adoptedStyleSheets or <style> elements */
168
+ injectionMode: InjectionMode;
169
+ }
170
+ type StyleRule = StyleResult;
171
+ interface KeyframesInfo {
172
+ name: string;
173
+ sheetIndex: number;
174
+ ruleIndex: number;
175
+ /** Dev-only: full CSS text of the @keyframes rule; omitted in production */
176
+ cssText?: string;
177
+ }
178
+ type KeyframeStep = string | Record<string, string | number>;
179
+ type KeyframesSteps = Record<string, KeyframeStep>;
180
+ interface KeyframesResult {
181
+ toString(): string;
182
+ dispose: () => void;
183
+ }
184
+ interface KeyframesCacheEntry {
185
+ name: string;
186
+ refCount: number;
187
+ info: KeyframesInfo;
188
+ }
189
+ /**
190
+ * Definition for a CSS @property at-rule.
191
+ * Used to define custom property syntax, inheritance, and initial value.
192
+ */
193
+ interface PropertyDefinition {
194
+ /** CSS syntax string (e.g., '<color>', '<angle>', '<number>') */
195
+ syntax?: string;
196
+ /** Whether the property inherits (default: true) */
197
+ inherits?: boolean;
198
+ /** Initial value for the property */
199
+ initialValue?: string | number;
200
+ }
201
+ /**
202
+ * Descriptors for a CSS @font-face at-rule.
203
+ */
204
+ interface FontFaceDescriptors {
205
+ /** Required. URL(s) to the font file(s). */
206
+ src: string;
207
+ /** Font weight or range. Default: 'normal'. */
208
+ fontWeight?: string | number;
209
+ /** Font style. Default: 'normal'. */
210
+ fontStyle?: 'normal' | 'italic' | 'oblique' | (string & {});
211
+ /** Font stretch. Default: 'normal'. */
212
+ fontStretch?: string;
213
+ /** Loading behavior. Default: 'auto'. */
214
+ fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
215
+ /** Unicode range to cover. */
216
+ unicodeRange?: string;
217
+ /** Ascent metric override. */
218
+ ascentOverride?: string;
219
+ /** Descent metric override. */
220
+ descentOverride?: string;
221
+ /** Line gap metric override. */
222
+ lineGapOverride?: string;
223
+ /** Size adjustment factor. */
224
+ sizeAdjust?: string;
225
+ /** OpenType feature settings. */
226
+ fontFeatureSettings?: string;
227
+ /** Font variation axis settings. */
228
+ fontVariationSettings?: string;
229
+ }
230
+ /** Single descriptor or array of descriptors for multiple weights/styles. */
231
+ type FontFaceInput = FontFaceDescriptors | FontFaceDescriptors[];
232
+ /**
233
+ * Descriptors for a CSS @counter-style at-rule.
234
+ */
235
+ interface CounterStyleDescriptors {
236
+ /** Required. Numbering algorithm. */
237
+ system: 'cyclic' | 'numeric' | 'alphabetic' | 'symbolic' | 'additive' | 'fixed' | (string & {});
238
+ /** Symbols for non-additive systems. */
239
+ symbols?: string;
240
+ /** Symbol-value pairs for additive system. */
241
+ additiveSymbols?: string;
242
+ /** String prepended to the marker. Default: "". */
243
+ prefix?: string;
244
+ /** String appended to the marker. Default: ". ". */
245
+ suffix?: string;
246
+ /** Negative-value wrapping (e.g., '"(" ")"'). */
247
+ negative?: string;
248
+ /** Counter range (e.g., 'infinite infinite'). */
249
+ range?: string;
250
+ /** Minimum marker width and pad symbol (e.g., '3 "0"'). */
251
+ pad?: string;
252
+ /** Fallback counter style name. */
253
+ fallback?: string;
254
+ /** Speech synthesis hint. */
255
+ speakAs?: string;
256
+ }
257
+ interface RawCSSResult {
258
+ dispose: () => void;
259
+ }
260
+ //#endregion
261
+ //#region src/utils/css-types.d.ts
262
+ interface CSSProperties extends Properties<string | number> {}
263
+ //#endregion
264
+ //#region src/parser/types.d.ts
265
+ declare enum Bucket {
266
+ Color = 0,
267
+ Value = 1,
268
+ Mod = 2
269
+ }
270
+ /**
271
+ * A part within a group, representing a slash-separated segment.
272
+ * For example, in `'2px solid #red / 4px'`, there are two parts:
273
+ * - Part 0: `2px solid #red`
274
+ * - Part 1: `4px`
275
+ */
276
+ interface StyleDetailsPart {
277
+ mods: string[];
278
+ values: string[];
279
+ colors: string[];
280
+ all: string[];
281
+ output: string;
282
+ }
283
+ /**
284
+ * A group of style details, representing a comma-separated segment.
285
+ * Contains aggregated values from all parts for backward compatibility,
286
+ * plus the structured `parts` array for handlers that need slash separation.
287
+ */
288
+ interface StyleDetails {
289
+ input: string;
290
+ output: string;
291
+ /** Aggregated mods from all parts (backward compatible) */
292
+ mods: string[];
293
+ /** Aggregated values from all parts (backward compatible) */
294
+ values: string[];
295
+ /** Aggregated colors from all parts (backward compatible) */
296
+ colors: string[];
297
+ /** Aggregated all tokens from all parts (backward compatible) */
298
+ all: string[];
299
+ /** Slash-separated parts within this group */
300
+ parts: StyleDetailsPart[];
301
+ }
302
+ interface ProcessedStyle {
303
+ output: string;
304
+ groups: StyleDetails[];
305
+ }
306
+ type UnitHandler = (scalar: number) => string;
307
+ interface ParserOptions {
308
+ funcs?: Record<string, (parsed: StyleDetails[]) => string>;
309
+ units?: Record<string, string | UnitHandler>;
310
+ cacheSize?: number;
311
+ }
312
+ //#endregion
313
+ //#region src/parser/parser.d.ts
314
+ declare class StyleParser {
315
+ private opts;
316
+ private cache;
317
+ constructor(opts?: ParserOptions);
318
+ process(src: string): ProcessedStyle;
319
+ setFuncs(funcs: Required<ParserOptions>['funcs']): void;
320
+ setUnits(units: Required<ParserOptions>['units']): void;
321
+ updateOptions(patch: Partial<ParserOptions>): void;
322
+ /**
323
+ * Clear the parser cache.
324
+ * Call this when external state that affects parsing results has changed
325
+ * (e.g., predefined tokens).
326
+ */
327
+ clearCache(): void;
328
+ /**
329
+ * Get the current units configuration.
330
+ */
331
+ getUnits(): ParserOptions['units'];
332
+ }
333
+ //#endregion
334
+ //#region src/utils/color-math.d.ts
335
+ /**
336
+ * Consolidated color conversion math.
337
+ *
338
+ * Single source of truth for all color space conversions used across the
339
+ * library: sRGB gamma, HSL, OKLab, OKLCH, OKHSL, hex parsing, named
340
+ * colors, and CSS string converters.
341
+ *
342
+ * This module has zero internal imports — it is a leaf dependency.
343
+ *
344
+ * Reference: https://bottosson.github.io/posts/oklab/
345
+ */
346
+ type Vec3 = [number, number, number];
347
+ /**
348
+ * HSL to RGB.
349
+ * Algorithm from CSS Color 4 spec.
350
+ *
351
+ * @param h - Hue in degrees (0-360)
352
+ * @param s - Saturation (0-1)
353
+ * @param l - Lightness (0-1)
354
+ * @returns RGB values in 0-255 range (may have fractional values)
355
+ */
356
+ declare function hslToRgbValues(h: number, s: number, l: number): Vec3;
357
+ declare function getNamedColorHex(): Map<string, string>;
358
+ /**
359
+ * Convert hex color string to `rgb()` CSS string.
360
+ * Supports 3, 4, 6, and 8 character hex values (with or without `#`).
361
+ */
362
+ declare function hexToRgb(hex: string): string | null;
363
+ /**
364
+ * Extract RGB values from an `rgb()`/`rgba()` string.
365
+ * Supports comma-separated, space-separated, fractional, percentage,
366
+ * and slash alpha notation.
367
+ *
368
+ * @returns Array of RGB values (0-255 range), converting percentages as needed.
369
+ */
370
+ declare function getRgbValuesFromRgbaString(str: string): number[];
371
+ /**
372
+ * Convert any recognized color string to an `rgb()` CSS string.
373
+ * Handles hex, `okhsl()`, `hsl()`/`hsla()`, named CSS colors,
374
+ * and `rgb()`/`rgba()` pass-through.
375
+ */
376
+ declare function strToRgb(color: string, _ignoreAlpha?: boolean): string | null | undefined;
377
+ //#endregion
378
+ //#region src/utils/styles.d.ts
379
+ type StyleValue<T = string> = T | boolean | number | null | undefined;
380
+ /**
381
+ * Normalize a color token value.
382
+ * - Boolean `true` is converted to `'transparent'`
383
+ * - Boolean `false` returns `null` (signals the token should be skipped)
384
+ * - Other values are returned as-is
385
+ *
386
+ * @param value - The raw token value
387
+ * @returns Normalized value or null if the token should be skipped
388
+ */
389
+ declare function normalizeColorTokenValue<T>(value: T | boolean): T | 'transparent' | null;
390
+ type StyleValueStateMap<T = string> = Record<string, StyleValue<T> | '@inherit'>;
391
+ /**
392
+ * Combined type for style values that can be either a direct value or a state map.
393
+ * Use this for component props that accept style values.
394
+ */
395
+ type StylePropValue<T = string> = StyleValue<T> | StyleValueStateMap<T>;
396
+ type CSSMap = {
397
+ $?: string | string[];
398
+ } & Record<string, string | string[]>;
399
+ type StyleHandlerResult = CSSMap | CSSMap[] | null | void;
400
+ type RawStyleHandler = (value: StyleValueStateMap) => StyleHandlerResult;
401
+ type StyleHandler = RawStyleHandler & {
402
+ __lookupStyles: string[];
403
+ };
404
+ /**
405
+ * Handler definition forms for configure() and plugins.
406
+ * - Function only: lookup styles inferred from key name
407
+ * - Single property tuple: ['styleName', handler]
408
+ * - Multi-property tuple: [['style1', 'style2'], handler]
409
+ */
410
+ type StyleHandlerDefinition = RawStyleHandler | [string, RawStyleHandler] | [string[], RawStyleHandler];
411
+ interface ParsedColor {
412
+ color?: string;
413
+ name?: string;
414
+ opacity?: number;
415
+ }
416
+ type StyleMap = Record<string, StyleValue | StyleValueStateMap>;
417
+ declare const CUSTOM_UNITS: {
418
+ r: string;
419
+ cr: string;
420
+ bw: string;
421
+ ow: string;
422
+ x: string;
423
+ sf: (num: number) => string;
424
+ };
425
+ declare const DIRECTIONS: string[];
426
+ declare function customFunc(name: string, fn: (groups: StyleDetails[]) => string): void;
427
+ /**
428
+ * Get the global StyleParser instance.
429
+ * Used by configure() to apply parser configuration.
430
+ */
431
+ declare function getGlobalParser(): StyleParser;
432
+ /**
433
+ * Get the current custom functions registry.
434
+ * Used by configure() to merge with new functions.
435
+ */
436
+ declare function getGlobalFuncs(): Record<string, (groups: StyleDetails[]) => string>;
437
+ /**
438
+ * Set global predefined tokens.
439
+ * Called from configure() after processing token values.
440
+ * Merges with existing tokens (new tokens override existing ones with same key).
441
+ * Keys are normalized to lowercase (parser lowercases input before classification).
442
+ * @internal
443
+ */
444
+ declare function setGlobalPredefinedTokens(tokens: Record<string, string>): void;
445
+ /**
446
+ * Get the current global predefined tokens.
447
+ * Returns null if no tokens are configured.
448
+ */
449
+ declare function getGlobalPredefinedTokens(): Record<string, string> | null;
450
+ /**
451
+ * Reset global predefined tokens.
452
+ * Used for testing.
453
+ * @internal
454
+ */
455
+ declare function resetGlobalPredefinedTokens(): void;
456
+ /**
457
+ *
458
+ * @param {String} value
459
+ * @param {Number} mode
460
+ * @returns {Object<String,String|Array>}
461
+ */
462
+ declare function parseStyle(value: StyleValue): ProcessedStyle;
463
+ /**
464
+ * Parse color. Find it value, name and opacity.
465
+ * Optimized to avoid heavy parseStyle calls for simple color patterns.
466
+ */
467
+ declare function parseColor(val: string, ignoreError?: boolean): ParsedColor;
468
+ declare function filterMods(mods: string[], allowedMods: string[]): string[];
469
+ declare function stringifyStyles(styles: unknown): string;
470
+ //#endregion
471
+ //#region src/styles/types.d.ts
472
+ /**
473
+ * Extensible interface for named color tokens.
474
+ * Augment this interface to register project-specific color names
475
+ * for autocomplete in `fill`, `color`, `svgFill`, and other color style props.
476
+ *
477
+ * @example
478
+ * ```typescript
479
+ * declare module '@tenphi/tasty' {
480
+ * interface TastyNamedColors {
481
+ * primary: true;
482
+ * danger: true;
483
+ * }
484
+ * }
485
+ * ```
486
+ */
487
+ interface TastyNamedColors {}
488
+ type NamedColorKey = Extract<keyof TastyNamedColors, string>;
489
+ type NamedColor = [NamedColorKey] extends [never] ? string : NamedColorKey;
490
+ /**
491
+ * Extensible interface for typography preset names.
492
+ * Augment this interface to register project-specific preset names for autocomplete.
493
+ *
494
+ * @example
495
+ * ```typescript
496
+ * declare module '@tenphi/tasty' {
497
+ * interface TastyPresetNames {
498
+ * h1: true;
499
+ * t3: true;
500
+ * }
501
+ * }
502
+ * ```
503
+ */
504
+ interface TastyPresetNames {}
505
+ type PresetNameKey = Extract<keyof TastyPresetNames, string>;
506
+ type PresetName = [PresetNameKey] extends [never] ? string : PresetNameKey;
507
+ type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
508
+ type OpaquePercentage = '' | `.${Digit}` | `.${Digit}${Digit}` | '.100';
509
+ type ColorValue = `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `hsl(${string})` | `okhsl(${string})` | `oklch(${string})` | (string & {});
510
+ type NoType = false | null | undefined;
511
+ 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'> {
512
+ /**
513
+ * @deprecated Use `flow` style instead.
514
+ */
515
+ flexDirection: CSSProperties['flexDirection'];
516
+ /**
517
+ * @deprecated Use `placeContent`, `placeItems`, `gridColumns`, `gridRows`, and `gridTemplate` styles instead.
518
+ */
519
+ grid: CSSProperties['grid'];
520
+ /**
521
+ * @deprecated Use `flexShrink`, `flexGrow`, and `flexBasis` styles instead.
522
+ */
523
+ flex: CSSProperties['flex'];
524
+ /**
525
+ * Set the background color of the element. Shortcut for `background-color` with enhanced support for Tasty color tokens and syntaxes.
526
+ *
527
+ * Supports double-color syntax: the second color is applied as a foreground overlay via a CSS custom property.
528
+ *
529
+ * Examples:
530
+ * - `fill="#purple.10"` // purple background with 10% opacity
531
+ * - `fill="#danger"` // danger theme color
532
+ * - `fill="rgb(255 128 0)"` // custom RGB color
533
+ * - `fill="rgb(255 128 0 / 0.5)"` // RGB with opacity
534
+ * - `fill="hsl(200 100% 50%)"` // HSL color
535
+ * - `fill="okhsl(200 100% 50%)"` // perceptually uniform OKHSL color
536
+ * - `fill="oklch(0.7 0.15 200)"` // OKLCH color
537
+ * - `fill="#primary #secondary"` // double color (second as foreground overlay)
538
+ * - `fill={true}` // default fill color
539
+ */
540
+ fill?: ColorValue | boolean;
541
+ /**
542
+ * @deprecated Use `fill` instead.
543
+ */
544
+ backgroundColor?: CSSProperties['backgroundColor'];
545
+ /**
546
+ * Set the background image of the element. Shortcut for `background-image` with enhanced support for Tasty tokens.
547
+ *
548
+ * Examples:
549
+ * - `image="url(/path/to/image.png)"` // image from URL
550
+ * - `image="linear-gradient(to right, #purple, #danger)"` // gradient
551
+ */
552
+ image?: CSSProperties['backgroundImage'];
553
+ /**
554
+ * @deprecated Use `image` instead.
555
+ */
556
+ backgroundImage?: CSSProperties['backgroundImage'];
557
+ /**
558
+ * @deprecated Use separate background styles (`fill`, `image`, `backgroundSize`, etc.) instead.
559
+ * When set, overrides all other background-related styles.
560
+ */
561
+ background?: CSSProperties['background'];
562
+ /**
563
+ * Set the fill color of SVG elements. Outputs the native CSS `fill` property with enhanced support for Tasty color tokens and syntaxes.
564
+ *
565
+ * Examples:
566
+ * - `svgFill="#purple.10"` // purple fill with 10% opacity
567
+ * - `svgFill="#danger"` // danger theme color
568
+ * - `svgFill="rgb(255 128 0)"` // custom RGB color
569
+ * - `svgFill="hsl(200 100% 50%)"` // HSL color
570
+ * - `svgFill="okhsl(200 100% 50%)"` // OKHSL color
571
+ * - `svgFill="oklch(0.7 0.15 200)"` // OKLCH color
572
+ * - `svgFill="currentColor"` // inherit from parent color
573
+ */
574
+ svgFill?: ColorValue;
575
+ /**
576
+ * Set the text (current) color of the element. Shortcut for `color` with enhanced support for Tasty color tokens and syntaxes.
577
+ *
578
+ * Examples:
579
+ * - `color="#purple"` // purple text color
580
+ * - `color="#danger.6"` // danger color with 60% opacity
581
+ * - `color="rgb(255 128 0)"` // custom RGB color
582
+ * - `color="hsl(200 100% 50%)"` // HSL color
583
+ * - `color="okhsl(200 100% 50%)"` // OKHSL color
584
+ * - `color="oklch(0.7 0.15 200)"` // OKLCH color
585
+ * - `color="red"` // CSS color name
586
+ * - `color={true}` // currentColor
587
+ */
588
+ color?: ColorValue | boolean;
589
+ /**
590
+ * The fade style applies gradient-based fading masks to the edges of an element. Replaces complex CSS mask gradients with a simple, declarative API.
591
+ *
592
+ * Syntax: `[width] [directions] [#from-color] [#to-color]`
593
+ *
594
+ * Multiple groups can be separated by commas to specify different colors per direction.
595
+ *
596
+ * Color tokens (optional):
597
+ * - First color: transparent start of gradient (default: `rgb(0 0 0 / 0)`)
598
+ * - Second color: opaque end of gradient (default: `rgb(0 0 0 / 1)`)
599
+ *
600
+ * Examples:
601
+ * - `fade="top"` // fade only top edge with default width
602
+ * - `fade="2x left right"` // fade left and right edges with 2x width
603
+ * - `fade="1x top"` // fade only top edge with 1x width
604
+ * - `fade="3x 1x top bottom"` // top: 3x width, bottom: 1x width
605
+ * - `fade="2x #transparent #dark"` // custom colors for gradient mask
606
+ * - `fade="1x top #clear #solid"` // top edge with custom mask colors
607
+ * - `fade="top #red #blue, bottom #green #yellow"` // different colors per direction
608
+ * - `fade="2x top #a #b, 1x bottom #c #d"` // different widths and colors per direction
609
+ */
610
+ fade?: 'top' | 'right' | 'bottom' | 'left' | string;
611
+ /**
612
+ * Scrollbar styling using standard CSS properties (`scrollbar-width`, `scrollbar-color`, `scrollbar-gutter`).
613
+ *
614
+ * Syntax: `[width] [modifiers...] [thumb-color] [track-color]`
615
+ *
616
+ * Width values: `thin` (default), `auto`, `none`
617
+ * Modifiers: `stable`, `both-edges`, `always`
618
+ *
619
+ * Examples:
620
+ * - `scrollbar={true}` // thin scrollbar, default colors
621
+ * - `scrollbar="thin #purple.40 #dark.04"`
622
+ * - `scrollbar="auto #red #blue"`
623
+ * - `scrollbar="none"`
624
+ * - `scrollbar="always #primary.50 #white.02"`
625
+ * - `scrollbar="thin stable #red #blue"`
626
+ */
627
+ scrollbar?: string | boolean;
628
+ /**
629
+ * Set font weight for bold texts.
630
+ */
631
+ boldFontWeight?: number;
632
+ /**
633
+ * The gap style is a powerful, cross-layout shorthand for spacing between child elements. Works with flex, grid, and block layouts.
634
+ *
635
+ * For flex/grid: sets native `gap` property
636
+ * For block layouts: emulated using margin on children
637
+ *
638
+ * Examples:
639
+ * - `gap="2x"` // gap: 2x (or margin-bottom: 2x for block)
640
+ * - `gap="1x 2x"` // row gap: 1x, column gap: 2x
641
+ * - `gap={true}` // default gap (1x)
642
+ */
643
+ gap?: CSSProperties['gap'] | string | boolean;
644
+ /**
645
+ * Shorthand for element padding. Supports custom units, directional modifiers, and design-system-driven defaults.
646
+ *
647
+ * Examples:
648
+ * - `padding="2x 1x"` // top/bottom: 2x, left/right: 1x
649
+ * - `padding="2x top"` // only top padding: 2x
650
+ * - `padding="1x left right"` // left and right padding: 1x
651
+ * - `padding={true}` // default padding on all sides
652
+ */
653
+ padding?: CSSProperties['padding'] | string | boolean;
654
+ /**
655
+ * Shorthand for element margin. Supports custom units, directional modifiers, and design-system-driven defaults.
656
+ *
657
+ * Examples:
658
+ * - `margin="2x 1x"` // top/bottom: 2x, left/right: 1x
659
+ * - `margin="2x top"` // only top margin: 2x
660
+ * - `margin="1x left right"` // left and right margin: 1x
661
+ * - `margin={true}` // default margin on all sides
662
+ */
663
+ margin?: CSSProperties['margin'] | string | boolean;
664
+ /**
665
+ * Concise shorthand for setting element width, including min-width and max-width. Supports custom units and advanced sizing keywords.
666
+ *
667
+ * Syntax: `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
668
+ *
669
+ * Modifiers: `min`, `max`
670
+ * Keywords: `stretch`, `max-content`, `min-content`, `fit-content`
671
+ *
672
+ * Examples:
673
+ * - `width="10x"` // width: 10x
674
+ * - `width="1x 10x"` // min-width: 1x; max-width: 10x
675
+ * - `width="min 2x"` // min-width: 2x
676
+ * - `width="stretch"` // width: stretch (fill-available)
677
+ * - `width={true}` // width: auto
678
+ */
679
+ width?: CSSProperties['width'] | string | boolean;
680
+ /**
681
+ * Concise shorthand for setting element height, including min-height and max-height. Supports custom units and advanced sizing keywords.
682
+ *
683
+ * Syntax: `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
684
+ *
685
+ * Modifiers: `min`, `max`
686
+ * Keywords: `stretch`, `max-content`, `min-content`, `fit-content`
687
+ *
688
+ * Examples:
689
+ * - `height="100px"` // height: 100px
690
+ * - `height="1x 5x 10x"` // min-height: 1x; height: 5x; max-height: 10x
691
+ * - `height="min 2x"` // min-height: 2x
692
+ * - `height={true}` // height: auto
693
+ */
694
+ height?: CSSProperties['height'] | string | boolean;
695
+ /**
696
+ * Shorthand for border width, style, and color. Supports directional modifiers and design-system defaults.
697
+ *
698
+ * Syntax: `[width] [style] [color] [directions]` | `[directions]` | `true`
699
+ *
700
+ * Multiple groups can be separated by commas. Later groups override earlier groups for conflicting directions.
701
+ *
702
+ * Examples:
703
+ * - `border={true}` // default border on all sides (1bw solid)
704
+ * - `border="2bw dashed #purple"` // 2bw dashed purple border
705
+ * - `border="2bw top"` // only top border: 2bw solid
706
+ * - `border="dotted #danger left right"` // left/right: 1bw dotted danger
707
+ * - `border="1bw #red, 2bw #blue top"` // all sides red 1bw, top overridden to blue 2bw
708
+ * - `border="1bw, dashed top bottom, #purple left right"` // base 1bw, dashed on top/bottom, purple on left/right
709
+ */
710
+ border?: CSSProperties['border'] | string | boolean;
711
+ /**
712
+ * Powerful shorthand for CSS transitions using semantic names and design tokens. Supports grouped transitions for common UI effects.
713
+ *
714
+ * Semantic names: `fade`, `fill`, `border`, `radius`, `shadow`, `preset`, `gap`, `theme`
715
+ * Multiple transitions: separated by commas
716
+ *
717
+ * Examples:
718
+ * - `transition="fill 0.2s, radius 0.3s"` // transitions background-color and border-radius
719
+ * - `transition="fade 0.15s ease-in"` // transitions mask with easing
720
+ * - `transition="theme 0.3s"` // transitions all theme-related properties
721
+ * - `transition="preset 0.2s"` // transitions typography properties
722
+ */
723
+ transition?: CSSProperties['transition'] | string;
724
+ /**
725
+ * Whether the element is hidden using `display: none`. Boolean shortcut for conditional element visibility.
726
+ *
727
+ * Examples:
728
+ * - `hide={true}` // display: none
729
+ * - `hide={false}` // element remains visible
730
+ */
731
+ hide?: boolean;
732
+ /**
733
+ * The shadow style adds shadow effects around an element's frame. Supports multiple effects separated by commas with X/Y offsets, blur, spread radius, and color.
734
+ *
735
+ * Examples:
736
+ * - `shadow="1x .5x .5x #dark.50"` // custom shadow with Tasty units and colors
737
+ * - `shadow="0 1x 2x #dark.20"` // standard shadow syntax
738
+ * - `shadow={true}` // default shadow from design system
739
+ */
740
+ shadow?: string | boolean;
741
+ /**
742
+ * The radius style rounds the corners of an element's outer border edge. Supports custom units, advanced shapes, and directional modifiers.
743
+ *
744
+ * Syntax: `[value] [modifiers]` | `[shape]` | `true`
745
+ *
746
+ * Shapes: `round` (fully rounded), `ellipse` (50%), `leaf`, `backleaf` (asymmetric), `inherit` (inherit from parent)
747
+ * Directional modifiers: `top`, `right`, `bottom`, `left`
748
+ *
749
+ * Examples:
750
+ * - `radius="2r"` // border-radius: calc(var(--radius) * 2)
751
+ * - `radius={true}` // default radius (1r)
752
+ * - `radius="round"` // fully rounded (9999rem)
753
+ * - `radius="leaf"` // asymmetric leaf shape
754
+ * - `radius="1r top"` // round only top corners
755
+ * - `radius="inherit"` // inherit border-radius from parent
756
+ * - `radius="inherit right"` // inherit only right corners (uses longhand properties)
757
+ */
758
+ radius?: 'round' | 'ellipse' | 'leaf' | 'backleaf' | 'inherit' | string | true;
759
+ /**
760
+ * The flow style is a unified shorthand for controlling layout direction and wrapping in both flex and grid containers. Replaces `flexDirection` and `gridAutoFlow`.
761
+ *
762
+ * For flex: sets `flex-flow` (direction + wrapping)
763
+ * For grid: sets `grid-auto-flow` (direction + density)
764
+ * For block: determines gap direction (row/column)
765
+ *
766
+ * Syntax: `[direction] [wrap|dense]`
767
+ *
768
+ * Examples:
769
+ * - `flow="row wrap"` // flex-flow: row wrap
770
+ * - `flow="column dense"` // grid-auto-flow: column dense
771
+ * - `flow="row"` // primary axis direction
772
+ */
773
+ flow?: CSSProperties['flexFlow'] | CSSProperties['gridAutoFlow'] | string;
774
+ /**
775
+ * The gridAreas style specifies named grid areas, establishing cells in the grid and assigning them names.
776
+ *
777
+ * Examples:
778
+ * - `gridAreas='"header header" "sidebar content" "footer footer"'`
779
+ */
780
+ gridAreas?: CSSProperties['gridTemplateAreas'];
781
+ /**
782
+ * The gridColumns style defines line names and track sizing functions of grid columns.
783
+ *
784
+ * Examples:
785
+ * - `gridColumns="1fr 2fr 1fr"` // three columns with flex ratios
786
+ * - `gridColumns={3}` // three equal columns (shorthand)
787
+ * - `gridColumns="repeat(auto-fit, minmax(200px, 1fr))"` // responsive columns
788
+ */
789
+ gridColumns?: CSSProperties['gridTemplateColumns'] | number;
790
+ /**
791
+ * The gridRows style defines line names and track sizing functions of grid rows.
792
+ *
793
+ * Examples:
794
+ * - `gridRows="auto 1fr auto"` // header, content, footer layout
795
+ * - `gridRows={4}` // four equal rows (shorthand)
796
+ * - `gridRows="repeat(3, 100px)"` // three 100px rows
797
+ */
798
+ gridRows?: CSSProperties['gridTemplateRows'] | number;
799
+ /**
800
+ * The gridTemplate style is a shorthand property for defining grid columns, rows, and areas simultaneously.
801
+ *
802
+ * Examples:
803
+ * - `gridTemplate='"header header" auto "content sidebar" 1fr / 2fr 1fr'`
804
+ */
805
+ gridTemplate?: CSSProperties['gridTemplate'];
806
+ /**
807
+ * The font style specifies a prioritized list of font family names with design-system-driven defaults and fallbacks.
808
+ *
809
+ * Examples:
810
+ * - `font="monospace"` // monospace font stack
811
+ * - `font="Helvetica, Arial, sans-serif"` // custom font list
812
+ * - `font={true}` // default design system font
813
+ */
814
+ font?: CSSProperties['fontFamily'] | boolean;
815
+ /**
816
+ * The outline style sets the outline for the element.
817
+ *
818
+ * Syntax: `[width] [style] [color] / [offset]` | `true`
819
+ *
820
+ * Examples:
821
+ * - `outline="2ow dashed #purple"` // 2ow dashed purple outline
822
+ * - `outline="2ow #danger / 1x"` // 2ow solid danger outline, 1x offset
823
+ * - `outline={true}` // default outline (1ow solid)
824
+ */
825
+ outline?: string | boolean;
826
+ /**
827
+ * The outline offset style sets the offset of the outline.
828
+ *
829
+ * Examples:
830
+ * - `outlineOffset="4px"` // 4px offset
831
+ * - `outlineOffset="1x"` // 1x (8px) offset
832
+ */
833
+ outlineOffset?: string | number;
834
+ /**
835
+ * The preset style sets base text settings according to named presets. Affects `font-size`, `line-height`, `letter-spacing`, `font-weight`, and `text-transform`.
836
+ *
837
+ * Syntax: `name`, `name / modifier`, or `modifier` (shorthand, name defaults to `inherit`).
838
+ * Preset names are project-specific. Augment `TastyPresetNames` to register them for autocomplete.
839
+ *
840
+ * Examples:
841
+ * - `preset="h1"` // heading 1 typography
842
+ * - `preset="h2 / strong"` // bold heading 2
843
+ * - `preset="bold"` // inherit with bold (shorthand)
844
+ * - `preset="t3"` // text size 3
845
+ */
846
+ preset?: PresetName | (string & {});
847
+ /**
848
+ * Shorthand for `align-items` and `align-content`. Sets both properties for unified vertical alignment in flex/grid layouts.
849
+ *
850
+ * Examples:
851
+ * - `align="center"` // align-items: center; align-content: center
852
+ * - `align="flex-start"` // align both to start
853
+ * - `align="space-between"` // distribute space between items
854
+ */
855
+ align?: CSSProperties['alignItems'] | CSSProperties['alignContent'];
856
+ /**
857
+ * Shorthand for `justify-items` and `justify-content`. Sets both properties for unified horizontal alignment in flex/grid layouts.
858
+ *
859
+ * Examples:
860
+ * - `justify="center"` // justify-items: center; justify-content: center
861
+ * - `justify="space-between"` // distribute space between items
862
+ * - `justify="flex-end"` // align both to end
863
+ */
864
+ justify?: CSSProperties['justifyItems'] | CSSProperties['justifyContent'];
865
+ /**
866
+ * Shorthand for all placement properties. Sets all 4 longhands: align-items, justify-items, align-content, justify-content.
867
+ *
868
+ * Examples:
869
+ * - `place="center"` // all 4 longhands: center
870
+ * - `place="start end"` // align-*: start; justify-*: end
871
+ * - `place="stretch"` // all 4 longhands: stretch
872
+ */
873
+ place?: CSSProperties['placeItems'] | CSSProperties['placeContent'] | string;
874
+ /**
875
+ * Sets `place-content` property for aligning and distributing content in grid/flex containers.
876
+ *
877
+ * Examples:
878
+ * - `placeContent="center"` // center content in both axes
879
+ * - `placeContent="space-between"` // distribute content with space between
880
+ */
881
+ placeContent?: CSSProperties['placeContent'];
882
+ /**
883
+ * Sets `place-items` property for aligning items in grid/flex containers.
884
+ *
885
+ * Examples:
886
+ * - `placeItems="center"` // center items in both axes
887
+ * - `placeItems="start end"` // start on block axis, end on inline axis
888
+ */
889
+ placeItems?: CSSProperties['placeItems'];
890
+ /**
891
+ * Shorthand for scroll-margin on all sides. Supports custom units and directional modifiers.
892
+ *
893
+ * Examples:
894
+ * - `scrollMargin="2x"` // scroll-margin on all sides: 2x
895
+ * - `scrollMargin="2x top"` // only top scroll-margin: 2x
896
+ * - `scrollMargin={true}` // default scroll-margin on all sides
897
+ */
898
+ scrollMargin?: CSSProperties['scrollMargin'] | string | boolean;
899
+ scrollMarginTop?: string | number | boolean;
900
+ scrollMarginRight?: string | number | boolean;
901
+ scrollMarginBottom?: string | number | boolean;
902
+ scrollMarginLeft?: string | number | boolean;
903
+ scrollMarginBlock?: string | number | boolean;
904
+ scrollMarginInline?: string | number | boolean;
905
+ /**
906
+ * Shorthand for `top`, `right`, `bottom`, and `left` offsets. Supports custom units, directional modifiers, and positioning.
907
+ *
908
+ * Examples:
909
+ * - `inset="0"` // all sides: 0
910
+ * - `inset="2x top"` // only top offset: 2x
911
+ * - `inset="1x left right"` // left and right offsets: 1x
912
+ * - `inset={true}` // all sides: 0
913
+ */
914
+ inset?: 'top' | 'right' | 'bottom' | 'left' | string | CSSProperties['inset'];
915
+ /**
916
+ * Local keyframes definitions for this component.
917
+ * Keys are animation names, values are keyframes step definitions.
918
+ * Local keyframes override global keyframes with the same name.
919
+ *
920
+ * Examples:
921
+ * - `'@keyframes': { fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } } }`
922
+ * - `'@keyframes': { pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } } }`
923
+ */
924
+ '@keyframes'?: Record<string, KeyframesSteps>;
925
+ /**
926
+ * CSS @property definitions for custom properties using tasty token syntax.
927
+ * Properties are registered once and are permanent (never removed).
928
+ *
929
+ * Token formats:
930
+ * - `$name` for regular properties → `--name` (requires syntax to be specified)
931
+ * - `#name` for color properties → `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
932
+ *
933
+ * Examples:
934
+ * - `'@properties': { '$rotation': { syntax: '<angle>', inherits: false, initialValue: '45deg' } }`
935
+ * - `'@properties': { '#theme': { initialValue: 'purple' } }` // syntax: '<color>' is auto-set
936
+ */
937
+ '@properties'?: Record<string, PropertyDefinition>;
938
+ /**
939
+ * Local @font-face definitions for this component.
940
+ * Keys are font-family names, values are descriptors or arrays of descriptors
941
+ * (for multiple weights/styles of the same family).
942
+ *
943
+ * Examples:
944
+ * - `'@fontFace': { Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' } }`
945
+ * - `'@fontFace': { 'Brand Sans': [{ src: '...', fontWeight: 400 }, { src: '...', fontWeight: 700 }] }`
946
+ */
947
+ '@fontFace'?: Record<string, FontFaceInput>;
948
+ /**
949
+ * Local @counter-style definitions for this component.
950
+ * Keys are counter-style names, values are descriptor objects.
951
+ *
952
+ * Examples:
953
+ * - `'@counterStyle': { thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' } }`
954
+ */
955
+ '@counterStyle'?: Record<string, CounterStyleDescriptors>;
956
+ /**
957
+ * Apply one or more predefined style recipes by name.
958
+ * Recipes are defined globally via `configure({ recipes: { ... } })`.
959
+ * Multiple recipes are space-separated. Use `/` to separate base recipes
960
+ * (applied before component styles) from post recipes (applied after, via mergeStyles).
961
+ * Use `none` to explicitly skip base recipes.
962
+ *
963
+ * Examples:
964
+ * - `recipe: 'card'` // Apply the 'card' recipe
965
+ * - `recipe: 'card elevated'` // Apply 'card' then 'elevated', then component styles
966
+ * - `recipe: 'reset input / input-autofill'` // Base recipes, then post recipe
967
+ * - `recipe: 'none / disabled'` // No base recipes, only post recipe
968
+ * - `recipe: ''` // Clear recipes from base styles when extending
969
+ */
970
+ recipe?: string;
971
+ }
972
+ type SuffixForSelector = '&' | '.' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
973
+ type Selector = `${SuffixForSelector}${string}`;
974
+ type NotSelector = Exclude<string, Selector | keyof StylesInterface>;
975
+ /** Special style keys that should not be wrapped in StyleValue/StyleValueStateMap */
976
+ type SpecialStyleKeys = '@keyframes' | '@properties' | '@fontFace' | '@counterStyle' | 'recipe';
977
+ type StylesWithoutSelectors = { [key in keyof StylesInterface as key extends SpecialStyleKeys ? never : key]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]> };
978
+ /**
979
+ * Index signature for recipe-specific arbitrary keys.
980
+ * Supports local predefined states (`@name`), vendor-prefixed CSS properties (`-webkit-*`),
981
+ * CSS custom properties (`$name`), and color tokens (`#name`).
982
+ * Unlike StylesIndexSignature, does NOT allow sub-element selectors (recipes are flat).
983
+ */
984
+ type RecipeIndexSignature = Record<string, StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined>>;
985
+ /**
986
+ * Style type for recipe definitions.
987
+ * Like StylesWithoutSelectors but also allows `@keyframes`, `@properties`,
988
+ * local predefined states, and vendor-prefixed CSS properties.
989
+ * Excludes `recipe` to prevent recursive references.
990
+ */
991
+ type RecipeStyles = StylesWithoutSelectors & RecipeIndexSignature & {
992
+ '@keyframes'?: StylesInterface['@keyframes'];
993
+ '@properties'?: StylesInterface['@properties'];
994
+ '@fontFace'?: StylesInterface['@fontFace'];
995
+ '@counterStyle'?: StylesInterface['@counterStyle'];
996
+ };
997
+ /** Special properties that are not regular style values */
998
+ interface SpecialStyleProperties {
999
+ '@keyframes'?: StylesInterface['@keyframes'];
1000
+ '@properties'?: StylesInterface['@properties'];
1001
+ '@fontFace'?: StylesInterface['@fontFace'];
1002
+ '@counterStyle'?: StylesInterface['@counterStyle'];
1003
+ recipe?: StylesInterface['recipe'];
1004
+ }
1005
+ /** Index signature for arbitrary style keys (sub-elements, CSS variables, etc.) */
1006
+ interface StylesIndexSignature {
1007
+ [key: string]: StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined> | Styles | false | StylesInterface['@keyframes'] | StylesInterface['@properties'] | StylesInterface['@fontFace'] | StylesInterface['@counterStyle'];
1008
+ /**
1009
+ * Selector combinator: `undefined` (descendant, default), `'>'` (child), `'+'` (adjacent), `'~'` (sibling).
1010
+ * Can chain with capitalized names: `'> Body > Row >'`. Spaces required around combinators.
1011
+ */
1012
+ $?: string;
1013
+ }
1014
+ type Styles = StylesWithoutSelectors & SpecialStyleProperties & StylesIndexSignature;
1015
+ /**
1016
+ * Value type for design tokens passed to `configure({ tokens })`.
1017
+ * Can be a direct value or a state map for responsive/theme-aware tokens.
1018
+ */
1019
+ type ConfigTokenValue = string | number | boolean | Record<string, string | number | boolean | undefined | null | '@inherit'>;
1020
+ /**
1021
+ * Design tokens injected as CSS custom properties on `:root`.
1022
+ * Keys must start with `$` (value tokens) or `#` (color tokens).
1023
+ *
1024
+ * - `$name` keys become `--name` CSS custom properties
1025
+ * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
1026
+ */
1027
+ type ConfigTokens = Record<`$${string}` | `#${string}`, ConfigTokenValue>;
1028
+ //#endregion
1029
+ //#region src/pipeline/conditions.d.ts
1030
+ /**
1031
+ * ConditionNode Types and Helpers
1032
+ *
1033
+ * Core data structures for representing style conditions as an abstract syntax tree.
1034
+ * Used throughout the pipeline for parsing, simplification, and CSS generation.
1035
+ */
1036
+ /**
1037
+ * Base interface for all state conditions (leaf nodes)
1038
+ */
1039
+ interface BaseStateCondition {
1040
+ kind: 'state';
1041
+ negated: boolean;
1042
+ raw: string;
1043
+ uniqueId: string;
1044
+ }
1045
+ /**
1046
+ * Modifier condition: [data-attr] or [data-attr="value"]
1047
+ */
1048
+ interface ModifierCondition extends BaseStateCondition {
1049
+ type: 'modifier';
1050
+ attribute: string;
1051
+ value?: string;
1052
+ operator?: '=' | '^=' | '$=' | '*=';
1053
+ }
1054
+ /**
1055
+ * Pseudo-class condition: :hover, :focus-visible
1056
+ */
1057
+ interface PseudoCondition extends BaseStateCondition {
1058
+ type: 'pseudo';
1059
+ pseudo: string;
1060
+ }
1061
+ /**
1062
+ * Numeric bound for dimension queries
1063
+ */
1064
+ interface NumericBound {
1065
+ value: string;
1066
+ valueNumeric: number | null;
1067
+ inclusive: boolean;
1068
+ }
1069
+ /**
1070
+ * Media query condition
1071
+ */
1072
+ interface MediaCondition extends BaseStateCondition {
1073
+ type: 'media';
1074
+ subtype: 'dimension' | 'feature' | 'type';
1075
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
1076
+ lowerBound?: NumericBound;
1077
+ upperBound?: NumericBound;
1078
+ feature?: string;
1079
+ featureValue?: string;
1080
+ mediaType?: 'print' | 'screen' | 'all' | 'speech';
1081
+ }
1082
+ /**
1083
+ * Container query condition
1084
+ */
1085
+ interface ContainerCondition extends BaseStateCondition {
1086
+ type: 'container';
1087
+ subtype: 'dimension' | 'style' | 'raw';
1088
+ containerName?: string;
1089
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
1090
+ lowerBound?: NumericBound;
1091
+ upperBound?: NumericBound;
1092
+ property?: string;
1093
+ propertyValue?: string;
1094
+ rawCondition?: string;
1095
+ }
1096
+ /**
1097
+ * Root state condition: @root(theme=dark)
1098
+ */
1099
+ interface RootCondition extends BaseStateCondition {
1100
+ type: 'root';
1101
+ innerCondition: ConditionNode;
1102
+ }
1103
+ /**
1104
+ * Parent state condition: @parent(hovered), @parent(theme=dark, >)
1105
+ */
1106
+ interface ParentCondition extends BaseStateCondition {
1107
+ type: 'parent';
1108
+ innerCondition: ConditionNode;
1109
+ direct: boolean;
1110
+ }
1111
+ /**
1112
+ * Own state condition: @own(hovered)
1113
+ */
1114
+ interface OwnCondition extends BaseStateCondition {
1115
+ type: 'own';
1116
+ innerCondition: ConditionNode;
1117
+ }
1118
+ /**
1119
+ * Starting style condition: @starting
1120
+ */
1121
+ interface StartingCondition extends BaseStateCondition {
1122
+ type: 'starting';
1123
+ }
1124
+ /**
1125
+ * Supports query condition: @supports(display: grid), @supports($, :has(*))
1126
+ */
1127
+ interface SupportsCondition extends BaseStateCondition {
1128
+ type: 'supports';
1129
+ subtype: 'feature' | 'selector';
1130
+ condition: string;
1131
+ }
1132
+ /**
1133
+ * Union of all state condition types
1134
+ */
1135
+ type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
1136
+ /**
1137
+ * Compound node: combines conditions with AND/OR
1138
+ */
1139
+ interface CompoundCondition {
1140
+ kind: 'compound';
1141
+ operator: 'AND' | 'OR';
1142
+ children: ConditionNode[];
1143
+ }
1144
+ /**
1145
+ * True condition (matches everything)
1146
+ */
1147
+ interface TrueCondition {
1148
+ kind: 'true';
1149
+ }
1150
+ /**
1151
+ * False condition (matches nothing - skip this rule)
1152
+ */
1153
+ interface FalseCondition {
1154
+ kind: 'false';
1155
+ }
1156
+ /**
1157
+ * Union of all condition node types
1158
+ */
1159
+ type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
1160
+ //#endregion
1161
+ //#region src/states/index.d.ts
1162
+ /**
1163
+ * Parsed advanced state information
1164
+ */
1165
+ interface ParsedAdvancedState {
1166
+ type: 'media' | 'container' | 'root' | 'parent' | 'own' | 'starting' | 'predefined' | 'modifier';
1167
+ condition: string;
1168
+ containerName?: string;
1169
+ raw: string;
1170
+ mediaType?: string;
1171
+ }
1172
+ /**
1173
+ * Context for state parsing operations
1174
+ */
1175
+ interface StateParserContext {
1176
+ localPredefinedStates: Record<string, string>;
1177
+ globalPredefinedStates: Record<string, string>;
1178
+ isSubElement?: boolean;
1179
+ }
1180
+ /**
1181
+ * At-rule context for CSS generation
1182
+ */
1183
+ interface AtRuleContext {
1184
+ media?: string[];
1185
+ container?: {
1186
+ name?: string;
1187
+ condition: string;
1188
+ }[];
1189
+ startingStyle?: boolean;
1190
+ rootStates?: string[];
1191
+ negatedRootStates?: string[];
1192
+ }
1193
+ /**
1194
+ * Configure global predefined states
1195
+ */
1196
+ declare function setGlobalPredefinedStates(states: Record<string, string>): void;
1197
+ /**
1198
+ * Get global predefined states
1199
+ */
1200
+ declare function getGlobalPredefinedStates(): Record<string, string>;
1201
+ /**
1202
+ * Create a state parser context from styles
1203
+ */
1204
+ declare function createStateParserContext(styles?: Styles, isSubElement?: boolean): StateParserContext;
1205
+ //#endregion
1206
+ //#region src/pipeline/parseStateKey.d.ts
1207
+ interface ParseStateKeyOptions {
1208
+ context?: StateParserContext;
1209
+ isSubElement?: boolean;
1210
+ }
1211
+ /**
1212
+ * Parse a state key string into a ConditionNode
1213
+ */
1214
+ declare function parseStateKey(stateKey: string, options?: ParseStateKeyOptions): ConditionNode;
1215
+ //#endregion
1216
+ //#region src/pipeline/index.d.ts
1217
+ /**
1218
+ * Matches the old StyleResult interface for backward compatibility
1219
+ */
1220
+ interface StyleResult {
1221
+ selector: string;
1222
+ declarations: string;
1223
+ atRules?: string[];
1224
+ needsClassName?: boolean;
1225
+ rootPrefix?: string;
1226
+ /** When true, declarations are wrapped in @starting-style { ... } inside the selector rule */
1227
+ startingStyle?: boolean;
1228
+ }
1229
+ /**
1230
+ * Matches the old RenderResult interface for backward compatibility
1231
+ */
1232
+ interface RenderResult {
1233
+ rules: StyleResult[];
1234
+ className?: string;
1235
+ }
1236
+ /**
1237
+ * Check if a key is a CSS selector
1238
+ */
1239
+ declare function isSelector(key: string): boolean;
1240
+ /**
1241
+ * Options for renderStyles when using direct selector mode.
1242
+ */
1243
+ interface RenderStylesOptions {
1244
+ /**
1245
+ * Whether to double the class selector for increased specificity.
1246
+ * When true, `.myClass` becomes `.myClass.myClass` for higher specificity.
1247
+ *
1248
+ * @default false - User-provided selectors are not doubled.
1249
+ *
1250
+ * Note: This only applies when a classNameOrSelector is provided.
1251
+ * When renderStyles returns RenderResult with needsClassName=true,
1252
+ * the injector handles doubling automatically.
1253
+ */
1254
+ doubleSelector?: boolean;
1255
+ }
1256
+ /**
1257
+ * Render styles to CSS rules.
1258
+ *
1259
+ * When called without classNameOrSelector, returns RenderResult with needsClassName=true.
1260
+ * When called with a selector/className string, returns StyleResult[] for direct injection.
1261
+ */
1262
+ declare function renderStyles(styles?: Styles, classNameOrSelector?: undefined, options?: undefined, pipelineCacheKey?: string): RenderResult;
1263
+ declare function renderStyles(styles: Styles | undefined, classNameOrSelector: string, options?: RenderStylesOptions): StyleResult[];
1264
+ //#endregion
1265
+ export { strToRgb as $, RawStyleHandler as A, getGlobalFuncs as B, SuffixForSelector as C, RawCSSResult as Ct, CUSTOM_UNITS as D, StyleInjectorConfig as Dt, CSSMap as E, SheetInfo as Et, StylePropValue as F, parseStyle as G, getGlobalPredefinedTokens as H, StyleValue as I, stringifyStyles as J, resetGlobalPredefinedTokens as K, StyleValueStateMap as L, StyleHandlerDefinition as M, StyleHandlerResult as N, DIRECTIONS as O, StyleRule as Ot, StyleMap as P, hslToRgbValues as Q, customFunc as R, StylesWithoutSelectors as S, PropertyDefinition as St, TastyPresetNames as T, RuleInfo as Tt, normalizeColorTokenValue as U, getGlobalParser as V, parseColor as W, getRgbValuesFromRgbaString as X, getNamedColorHex as Y, hexToRgb as Z, NotSelector as _, InjectionMode as _t, ParseStateKeyOptions as a, StyleDetailsPart as at, Styles as b, KeyframesResult as bt, ParsedAdvancedState as c, CacheMetrics as ct, getGlobalPredefinedStates as d, FontFaceDescriptors as dt, StyleParser as et, setGlobalPredefinedStates as f, FontFaceInput as ft, NoType as g, InjectResult as gt, ConfigTokens as h, GlobalInjectResult as ht, renderStyles as i, StyleDetails as it, StyleHandler as j, ParsedColor as k, StyleUsage as kt, StateParserContext as l, CounterStyleDescriptors as lt, ConfigTokenValue as m, GCOptions as mt, StyleResult as n, ParserOptions as nt, parseStateKey as o, UnitHandler as ot, ConditionNode as p, GCConfig as pt, setGlobalPredefinedTokens as q, isSelector as r, ProcessedStyle as rt, AtRuleContext as s, CSSProperties as st, RenderResult as t, Bucket as tt, createStateParserContext as u, DisposeFunction as ut, RecipeStyles as v, KeyframesCacheEntry as vt, TastyNamedColors as w, RootRegistry as wt, StylesInterface as x, KeyframesSteps as xt, Selector as y, KeyframesInfo as yt, filterMods as z };
1266
+ //# sourceMappingURL=index-dUtwpOux.d.ts.map