@tenphi/tasty 0.0.0-snapshot.1c5dff6 → 0.0.0-snapshot.1f1c00a

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 (331) hide show
  1. package/README.md +377 -238
  2. package/dist/babel-rZcEwPLM.d.ts +82 -0
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CL4eRu2z.js +42 -0
  6. package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
  7. package/dist/chunks/collector-D2ARGT2L.js +208 -0
  8. package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
  9. package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
  10. package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
  11. package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
  12. package/dist/chunks/css-definitions-DotDkIXt.js.map +1 -0
  13. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  15. package/dist/chunks/debug-D8pg9RGI.js +502 -0
  16. package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
  17. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  18. package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-BpxlOTbO.js +562 -0
  22. package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
  23. package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
  24. package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
  25. package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
  26. package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
  28. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  29. package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
  30. package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-gJrKBRiw.js} +126 -66
  32. package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
  33. package/dist/collector-w4mBj5gd.d.ts +164 -0
  34. package/dist/config-CZWCzBr6.d.ts +1349 -0
  35. package/dist/core/index.d.ts +5 -33
  36. package/dist/core/index.js +9 -26
  37. package/dist/index-G9JuwM9p.d.ts +1920 -0
  38. package/dist/index.d.ts +5 -48
  39. package/dist/index.js +11 -33
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-VXwJ0Frr.d.ts} +3 -4
  41. package/dist/ssr/astro-client.d.ts +1 -0
  42. package/dist/ssr/astro-client.js +6 -0
  43. package/dist/ssr/astro-client.js.map +1 -0
  44. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  45. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  46. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract.js +9 -0
  49. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  50. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  51. package/dist/ssr/astro-middleware-static.js +7 -0
  52. package/dist/ssr/astro-middleware-static.js.map +1 -0
  53. package/dist/ssr/astro-middleware.d.ts +18 -0
  54. package/dist/ssr/astro-middleware.js +7 -0
  55. package/dist/ssr/astro-middleware.js.map +1 -0
  56. package/dist/ssr/astro.d.ts +127 -0
  57. package/dist/ssr/astro.js +221 -0
  58. package/dist/ssr/astro.js.map +1 -0
  59. package/dist/ssr/index.d.ts +36 -0
  60. package/dist/ssr/index.js +10 -0
  61. package/dist/ssr/index.js.map +1 -0
  62. package/dist/ssr/next-config.d.ts +64 -0
  63. package/dist/ssr/next-config.js +128 -0
  64. package/dist/ssr/next-config.js.map +1 -0
  65. package/dist/ssr/next.d.ts +46 -0
  66. package/dist/ssr/next.js +60 -0
  67. package/dist/ssr/next.js.map +1 -0
  68. package/dist/static/index.d.ts +90 -5
  69. package/dist/static/index.js +31 -4
  70. package/dist/static/index.js.map +1 -0
  71. package/dist/static/inject.d.ts +4 -0
  72. package/dist/static/inject.js +17 -0
  73. package/dist/static/inject.js.map +1 -0
  74. package/dist/types-JEY8PVYP.d.ts +1567 -0
  75. package/dist/zero/babel.d.ts +2 -113
  76. package/dist/zero/babel.js +230 -106
  77. package/dist/zero/babel.js.map +1 -1
  78. package/dist/zero/index.d.ts +80 -3
  79. package/dist/zero/index.js +2 -4
  80. package/dist/zero/next.d.ts +57 -33
  81. package/dist/zero/next.js +93 -59
  82. package/dist/zero/next.js.map +1 -1
  83. package/docs/README.md +39 -0
  84. package/docs/adoption.md +323 -0
  85. package/docs/ai-agents.md +250 -0
  86. package/docs/comparison.md +448 -0
  87. package/docs/configuration.md +684 -56
  88. package/docs/debug.md +170 -343
  89. package/docs/design-system.md +455 -0
  90. package/docs/dsl.md +1065 -0
  91. package/docs/getting-started.md +240 -0
  92. package/docs/injector.md +159 -53
  93. package/docs/methodology.md +648 -0
  94. package/docs/migration-v3.md +285 -0
  95. package/docs/pipeline.md +765 -0
  96. package/docs/plugins.md +353 -0
  97. package/docs/react-api.md +683 -0
  98. package/docs/runtime-benchmarks.md +388 -0
  99. package/docs/ssr.md +610 -0
  100. package/docs/styles.md +211 -63
  101. package/docs/tasty-static.md +273 -67
  102. package/package.json +182 -58
  103. package/tasty.config.ts +6 -0
  104. package/dist/_virtual/_rolldown/runtime.js +0 -8
  105. package/dist/chunks/cacheKey.js +0 -70
  106. package/dist/chunks/cacheKey.js.map +0 -1
  107. package/dist/chunks/definitions.d.ts +0 -37
  108. package/dist/chunks/definitions.js +0 -260
  109. package/dist/chunks/definitions.js.map +0 -1
  110. package/dist/chunks/renderChunk.js +0 -61
  111. package/dist/chunks/renderChunk.js.map +0 -1
  112. package/dist/config.d.ts +0 -288
  113. package/dist/config.js +0 -403
  114. package/dist/config.js.map +0 -1
  115. package/dist/debug.d.ts +0 -204
  116. package/dist/debug.js +0 -733
  117. package/dist/debug.js.map +0 -1
  118. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  119. package/dist/hooks/useGlobalStyles.js +0 -56
  120. package/dist/hooks/useGlobalStyles.js.map +0 -1
  121. package/dist/hooks/useKeyframes.d.ts +0 -56
  122. package/dist/hooks/useKeyframes.js +0 -54
  123. package/dist/hooks/useKeyframes.js.map +0 -1
  124. package/dist/hooks/useProperty.d.ts +0 -79
  125. package/dist/hooks/useProperty.js +0 -91
  126. package/dist/hooks/useProperty.js.map +0 -1
  127. package/dist/hooks/useRawCSS.d.ts +0 -53
  128. package/dist/hooks/useRawCSS.js +0 -28
  129. package/dist/hooks/useRawCSS.js.map +0 -1
  130. package/dist/hooks/useStyles.d.ts +0 -40
  131. package/dist/hooks/useStyles.js +0 -169
  132. package/dist/hooks/useStyles.js.map +0 -1
  133. package/dist/injector/index.d.ts +0 -157
  134. package/dist/injector/index.js +0 -154
  135. package/dist/injector/index.js.map +0 -1
  136. package/dist/injector/injector.d.ts +0 -139
  137. package/dist/injector/injector.js +0 -417
  138. package/dist/injector/injector.js.map +0 -1
  139. package/dist/injector/sheet-manager.d.ts +0 -135
  140. package/dist/injector/sheet-manager.js +0 -728
  141. package/dist/injector/sheet-manager.js.map +0 -1
  142. package/dist/injector/types.d.ts +0 -144
  143. package/dist/keyframes/index.js +0 -206
  144. package/dist/keyframes/index.js.map +0 -1
  145. package/dist/parser/classify.js +0 -319
  146. package/dist/parser/classify.js.map +0 -1
  147. package/dist/parser/const.js +0 -33
  148. package/dist/parser/const.js.map +0 -1
  149. package/dist/parser/lru.js +0 -109
  150. package/dist/parser/lru.js.map +0 -1
  151. package/dist/parser/parser.d.ts +0 -25
  152. package/dist/parser/parser.js +0 -116
  153. package/dist/parser/parser.js.map +0 -1
  154. package/dist/parser/tokenizer.js +0 -69
  155. package/dist/parser/tokenizer.js.map +0 -1
  156. package/dist/parser/types.d.ts +0 -51
  157. package/dist/parser/types.js +0 -46
  158. package/dist/parser/types.js.map +0 -1
  159. package/dist/pipeline/conditions.d.ts +0 -134
  160. package/dist/pipeline/conditions.js +0 -406
  161. package/dist/pipeline/conditions.js.map +0 -1
  162. package/dist/pipeline/exclusive.js +0 -231
  163. package/dist/pipeline/exclusive.js.map +0 -1
  164. package/dist/pipeline/index.d.ts +0 -53
  165. package/dist/pipeline/index.js +0 -660
  166. package/dist/pipeline/index.js.map +0 -1
  167. package/dist/pipeline/materialize.js +0 -856
  168. package/dist/pipeline/materialize.js.map +0 -1
  169. package/dist/pipeline/parseStateKey.d.ts +0 -15
  170. package/dist/pipeline/parseStateKey.js +0 -451
  171. package/dist/pipeline/parseStateKey.js.map +0 -1
  172. package/dist/pipeline/simplify.js +0 -516
  173. package/dist/pipeline/simplify.js.map +0 -1
  174. package/dist/pipeline/warnings.js +0 -18
  175. package/dist/pipeline/warnings.js.map +0 -1
  176. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  177. package/dist/plugins/okhsl-plugin.js +0 -371
  178. package/dist/plugins/okhsl-plugin.js.map +0 -1
  179. package/dist/plugins/types.d.ts +0 -69
  180. package/dist/properties/index.js +0 -221
  181. package/dist/properties/index.js.map +0 -1
  182. package/dist/properties/property-type-resolver.d.ts +0 -24
  183. package/dist/properties/property-type-resolver.js +0 -83
  184. package/dist/properties/property-type-resolver.js.map +0 -1
  185. package/dist/states/index.d.ts +0 -49
  186. package/dist/states/index.js +0 -416
  187. package/dist/states/index.js.map +0 -1
  188. package/dist/static/tastyStatic.d.ts +0 -46
  189. package/dist/static/tastyStatic.js +0 -31
  190. package/dist/static/tastyStatic.js.map +0 -1
  191. package/dist/static/types.d.ts +0 -49
  192. package/dist/static/types.js +0 -24
  193. package/dist/static/types.js.map +0 -1
  194. package/dist/styles/align.d.ts +0 -15
  195. package/dist/styles/align.js +0 -14
  196. package/dist/styles/align.js.map +0 -1
  197. package/dist/styles/border.d.ts +0 -25
  198. package/dist/styles/border.js +0 -114
  199. package/dist/styles/border.js.map +0 -1
  200. package/dist/styles/color.d.ts +0 -14
  201. package/dist/styles/color.js +0 -23
  202. package/dist/styles/color.js.map +0 -1
  203. package/dist/styles/createStyle.js +0 -77
  204. package/dist/styles/createStyle.js.map +0 -1
  205. package/dist/styles/dimension.js +0 -97
  206. package/dist/styles/dimension.js.map +0 -1
  207. package/dist/styles/display.d.ts +0 -37
  208. package/dist/styles/display.js +0 -67
  209. package/dist/styles/display.js.map +0 -1
  210. package/dist/styles/fade.d.ts +0 -15
  211. package/dist/styles/fade.js +0 -58
  212. package/dist/styles/fade.js.map +0 -1
  213. package/dist/styles/fill.d.ts +0 -42
  214. package/dist/styles/fill.js +0 -52
  215. package/dist/styles/fill.js.map +0 -1
  216. package/dist/styles/flow.d.ts +0 -16
  217. package/dist/styles/flow.js +0 -12
  218. package/dist/styles/flow.js.map +0 -1
  219. package/dist/styles/gap.d.ts +0 -31
  220. package/dist/styles/gap.js +0 -37
  221. package/dist/styles/gap.js.map +0 -1
  222. package/dist/styles/height.d.ts +0 -17
  223. package/dist/styles/height.js +0 -20
  224. package/dist/styles/height.js.map +0 -1
  225. package/dist/styles/index.d.ts +0 -2
  226. package/dist/styles/index.js +0 -9
  227. package/dist/styles/index.js.map +0 -1
  228. package/dist/styles/inset.d.ts +0 -52
  229. package/dist/styles/inset.js +0 -150
  230. package/dist/styles/inset.js.map +0 -1
  231. package/dist/styles/justify.d.ts +0 -15
  232. package/dist/styles/justify.js +0 -14
  233. package/dist/styles/justify.js.map +0 -1
  234. package/dist/styles/list.d.ts +0 -16
  235. package/dist/styles/list.js +0 -98
  236. package/dist/styles/list.js.map +0 -1
  237. package/dist/styles/margin.d.ts +0 -24
  238. package/dist/styles/margin.js +0 -104
  239. package/dist/styles/margin.js.map +0 -1
  240. package/dist/styles/outline.d.ts +0 -29
  241. package/dist/styles/outline.js +0 -65
  242. package/dist/styles/outline.js.map +0 -1
  243. package/dist/styles/padding.d.ts +0 -24
  244. package/dist/styles/padding.js +0 -104
  245. package/dist/styles/padding.js.map +0 -1
  246. package/dist/styles/predefined.d.ts +0 -73
  247. package/dist/styles/predefined.js +0 -241
  248. package/dist/styles/predefined.js.map +0 -1
  249. package/dist/styles/preset.d.ts +0 -47
  250. package/dist/styles/preset.js +0 -126
  251. package/dist/styles/preset.js.map +0 -1
  252. package/dist/styles/radius.d.ts +0 -14
  253. package/dist/styles/radius.js +0 -51
  254. package/dist/styles/radius.js.map +0 -1
  255. package/dist/styles/scrollbar.d.ts +0 -23
  256. package/dist/styles/scrollbar.js +0 -34
  257. package/dist/styles/scrollbar.js.map +0 -1
  258. package/dist/styles/shadow.d.ts +0 -14
  259. package/dist/styles/shadow.js +0 -24
  260. package/dist/styles/shadow.js.map +0 -1
  261. package/dist/styles/styledScrollbar.d.ts +0 -47
  262. package/dist/styles/styledScrollbar.js +0 -38
  263. package/dist/styles/styledScrollbar.js.map +0 -1
  264. package/dist/styles/transition.d.ts +0 -14
  265. package/dist/styles/transition.js +0 -158
  266. package/dist/styles/transition.js.map +0 -1
  267. package/dist/styles/types.d.ts +0 -498
  268. package/dist/styles/width.d.ts +0 -17
  269. package/dist/styles/width.js +0 -20
  270. package/dist/styles/width.js.map +0 -1
  271. package/dist/tasty.d.ts +0 -982
  272. package/dist/tasty.js +0 -206
  273. package/dist/tasty.js.map +0 -1
  274. package/dist/tokens/typography.d.ts +0 -19
  275. package/dist/tokens/typography.js +0 -237
  276. package/dist/tokens/typography.js.map +0 -1
  277. package/dist/types.d.ts +0 -184
  278. package/dist/utils/cache-wrapper.js +0 -26
  279. package/dist/utils/cache-wrapper.js.map +0 -1
  280. package/dist/utils/case-converter.js +0 -8
  281. package/dist/utils/case-converter.js.map +0 -1
  282. package/dist/utils/colors.d.ts +0 -5
  283. package/dist/utils/colors.js +0 -9
  284. package/dist/utils/colors.js.map +0 -1
  285. package/dist/utils/css-types.d.ts +0 -7
  286. package/dist/utils/dotize.d.ts +0 -26
  287. package/dist/utils/dotize.js +0 -122
  288. package/dist/utils/dotize.js.map +0 -1
  289. package/dist/utils/filter-base-props.d.ts +0 -15
  290. package/dist/utils/filter-base-props.js +0 -45
  291. package/dist/utils/filter-base-props.js.map +0 -1
  292. package/dist/utils/get-display-name.d.ts +0 -7
  293. package/dist/utils/get-display-name.js +0 -10
  294. package/dist/utils/get-display-name.js.map +0 -1
  295. package/dist/utils/hsl-to-rgb.js +0 -38
  296. package/dist/utils/hsl-to-rgb.js.map +0 -1
  297. package/dist/utils/is-dev-env.js +0 -19
  298. package/dist/utils/is-dev-env.js.map +0 -1
  299. package/dist/utils/is-valid-element-type.js +0 -15
  300. package/dist/utils/is-valid-element-type.js.map +0 -1
  301. package/dist/utils/merge-styles.js.map +0 -1
  302. package/dist/utils/mod-attrs.d.ts +0 -8
  303. package/dist/utils/mod-attrs.js +0 -21
  304. package/dist/utils/mod-attrs.js.map +0 -1
  305. package/dist/utils/okhsl-to-rgb.js +0 -296
  306. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  307. package/dist/utils/process-tokens.d.ts +0 -31
  308. package/dist/utils/process-tokens.js +0 -171
  309. package/dist/utils/process-tokens.js.map +0 -1
  310. package/dist/utils/resolve-recipes.d.ts +0 -17
  311. package/dist/utils/resolve-recipes.js +0 -147
  312. package/dist/utils/resolve-recipes.js.map +0 -1
  313. package/dist/utils/selector-transform.js +0 -32
  314. package/dist/utils/selector-transform.js.map +0 -1
  315. package/dist/utils/string.js +0 -8
  316. package/dist/utils/string.js.map +0 -1
  317. package/dist/utils/styles.d.ts +0 -177
  318. package/dist/utils/styles.js +0 -730
  319. package/dist/utils/styles.js.map +0 -1
  320. package/dist/utils/typography.d.ts +0 -36
  321. package/dist/utils/typography.js +0 -53
  322. package/dist/utils/typography.js.map +0 -1
  323. package/dist/utils/warnings.d.ts +0 -16
  324. package/dist/utils/warnings.js +0 -16
  325. package/dist/utils/warnings.js.map +0 -1
  326. package/dist/zero/css-writer.d.ts +0 -45
  327. package/dist/zero/css-writer.js +0 -74
  328. package/dist/zero/css-writer.js.map +0 -1
  329. package/dist/zero/extractor.d.ts +0 -24
  330. package/dist/zero/extractor.js.map +0 -1
  331. package/docs/usage.md +0 -695
@@ -0,0 +1,1567 @@
1
+ import { Properties } from "csstype";
2
+ //#region src/utils/css-types.d.ts
3
+ interface CSSProperties extends Properties<string | number> {}
4
+ //#endregion
5
+ //#region src/parser/types.d.ts
6
+ /**
7
+ * A part within a group, representing a slash-separated segment.
8
+ * For example, in `'2px solid #red / 4px'`, there are two parts:
9
+ * - Part 0: `2px solid #red`
10
+ * - Part 1: `4px`
11
+ */
12
+ interface StyleDetailsPart {
13
+ mods: string[];
14
+ values: string[];
15
+ colors: string[];
16
+ all: string[];
17
+ output: string;
18
+ }
19
+ /**
20
+ * A group of style details, representing a comma-separated segment.
21
+ * Contains aggregated values from all parts for backward compatibility,
22
+ * plus the structured `parts` array for handlers that need slash separation.
23
+ */
24
+ interface StyleDetails {
25
+ input: string;
26
+ output: string;
27
+ /** Aggregated mods from all parts (backward compatible) */
28
+ mods: string[];
29
+ /** Aggregated values from all parts (backward compatible) */
30
+ values: string[];
31
+ /** Aggregated colors from all parts (backward compatible) */
32
+ colors: string[];
33
+ /** Aggregated all tokens from all parts (backward compatible) */
34
+ all: string[];
35
+ /** Slash-separated parts within this group */
36
+ parts: StyleDetailsPart[];
37
+ }
38
+ interface ProcessedStyle {
39
+ output: string;
40
+ groups: StyleDetails[];
41
+ }
42
+ type UnitHandler = (scalar: number) => string;
43
+ interface ParserOptions {
44
+ functions?: Record<string, (parsed: StyleDetails[]) => string>;
45
+ units?: Record<string, string | UnitHandler>;
46
+ cacheSize?: number;
47
+ }
48
+ //#endregion
49
+ //#region src/parser/parser.d.ts
50
+ declare class StyleParser {
51
+ private opts;
52
+ private cache;
53
+ constructor(opts?: ParserOptions);
54
+ process(src: string): ProcessedStyle;
55
+ setFunctions(functions: Required<ParserOptions>['functions']): void;
56
+ setUnits(units: Required<ParserOptions>['units']): void;
57
+ updateOptions(patch: Partial<ParserOptions>): void;
58
+ /**
59
+ * Clear the parser cache.
60
+ * Call this when external state that affects parsing results has changed
61
+ * (e.g., predefined tokens).
62
+ */
63
+ clearCache(): void;
64
+ /**
65
+ * Get the current units configuration.
66
+ */
67
+ getUnits(): ParserOptions['units'];
68
+ }
69
+ //#endregion
70
+ //#region src/utils/styles.d.ts
71
+ type StyleValue<T = string> = T | boolean | number | null | undefined;
72
+ /**
73
+ * Normalize a color token value.
74
+ * - Boolean `true` is converted to `'transparent'`
75
+ * - Boolean `false` returns `null` (signals the token should be skipped)
76
+ * - Other values are returned as-is
77
+ *
78
+ * @param value - The raw token value
79
+ * @returns Normalized value or null if the token should be skipped
80
+ */
81
+ declare function normalizeColorTokenValue<T>(value: T | boolean): T | 'transparent' | null;
82
+ type StyleValueStateMap<T = string> = Record<string, StyleValue<T> | '@inherit'>;
83
+ /**
84
+ * Combined type for style values that can be either a direct value or a state map.
85
+ * Use this for component props that accept style values.
86
+ */
87
+ type StylePropValue<T = string> = StyleValue<T> | StyleValueStateMap<T>;
88
+ /**
89
+ * One dependency value as a style handler receives it: already resolved for a
90
+ * single state, but still the **raw authored DSL string** (`'2x'`, `'#purple.5'`).
91
+ * Handlers parse it themselves via {@link parseStyle} / {@link parseColor}.
92
+ */
93
+ type ResolvedStyleValue = StyleValue<string>;
94
+ /**
95
+ * The dependency map a handler receives — one resolved value per style name in
96
+ * its `__lookupStyles`.
97
+ */
98
+ type StyleHandlerProps<TDeps extends string = string> = Partial<Record<TDeps, ResolvedStyleValue>>;
99
+ /**
100
+ * One set of CSS declarations returned by a style handler.
101
+ *
102
+ * Keys are **kebab-case** CSS property names (`'background-color'`, not
103
+ * `backgroundColor`) or `--custom-property` names. Values are stringified, so
104
+ * numbers are accepted. `$` is reserved as a selector suffix.
105
+ */
106
+ type CSSMap = {
107
+ /** Selector suffix (or suffixes) these declarations apply to, e.g. `'& > *'`. */
108
+ $?: string | string[];
109
+ } & Record<string, string | number | (string | number)[] | undefined>;
110
+ type StyleHandlerResult = CSSMap | CSSMap[] | null | void;
111
+ type RawStyleHandler<TProps extends object = StyleHandlerProps> = (props: TProps) => StyleHandlerResult;
112
+ type StyleHandler<TProps extends object = StyleHandlerProps> = RawStyleHandler<TProps> & {
113
+ __lookupStyles: string[];
114
+ };
115
+ /**
116
+ * The handler type used by the registry (`STYLE_HANDLER_MAP`), with parameter
117
+ * variance erased.
118
+ *
119
+ * Handlers declare narrow, hand-written dependency types — `({ fill }: { fill?:
120
+ * string }) => …` — which under `strictFunctionTypes` are not assignable to a
121
+ * wider parameter type. The registry stores handlers of many different dependency
122
+ * shapes together, so it needs the erased form. Prefer {@link StyleHandler} (or
123
+ * {@link defineHandler}) when writing a handler; this type is for code that
124
+ * inspects the registry.
125
+ */
126
+ type AnyStyleHandler = ((props: any) => StyleHandlerResult) & {
127
+ __lookupStyles: string[];
128
+ };
129
+ /**
130
+ * Handler definition forms for configure() and plugins.
131
+ * - Function only: lookup styles inferred from key name
132
+ * - Single property tuple: ['styleName', handler]
133
+ * - Multi-property tuple: [['style1', 'style2'], handler]
134
+ *
135
+ * Use {@link defineHandler} to have the dependency names inferred into the
136
+ * handler's parameter type instead of annotating it by hand.
137
+ */
138
+ type StyleHandlerDefinition<TDeps extends string = string> = RawStyleHandler<StyleHandlerProps<TDeps>> | [TDeps, RawStyleHandler<StyleHandlerProps<TDeps>>] | [readonly TDeps[], RawStyleHandler<StyleHandlerProps<TDeps>>];
139
+ interface ParsedColor {
140
+ color?: string;
141
+ name?: string;
142
+ opacity?: number;
143
+ }
144
+ type StyleMap = Record<string, StyleValue | StyleValueStateMap>;
145
+ declare const CUSTOM_UNITS: {
146
+ r: string;
147
+ cr: string;
148
+ bw: string;
149
+ ow: string;
150
+ x: string;
151
+ sf: (num: number) => string;
152
+ };
153
+ declare const DIRECTIONS: string[];
154
+ /**
155
+ * Get the global StyleParser instance.
156
+ * Used by configure() to apply parser configuration.
157
+ */
158
+ declare function getGlobalParser(): StyleParser;
159
+ /**
160
+ * Get the current global predefined tokens.
161
+ * Returns null if no tokens are configured.
162
+ */
163
+ declare function getGlobalPredefinedTokens(): Record<string, string> | null;
164
+ /**
165
+ *
166
+ * @param {String} value
167
+ * @param {Number} mode
168
+ * @returns {Object<String,String|Array>}
169
+ */
170
+ declare function parseStyle(value: StyleValue): ProcessedStyle;
171
+ /**
172
+ * Parse color. Find it value, name and opacity.
173
+ * Optimized to avoid heavy parseStyle calls for simple color patterns.
174
+ */
175
+ declare function parseColor(val: string, ignoreError?: boolean): ParsedColor;
176
+ declare function filterMods(mods: string[], allowedMods: readonly string[]): string[];
177
+ declare function stringifyStyles(styles: unknown): string;
178
+ //#endregion
179
+ //#region src/styles/types.d.ts
180
+ /**
181
+ * Extensible interface for named color tokens.
182
+ * Augment this interface to register project-specific color names
183
+ * for autocomplete in `fill`, `color`, `svgFill`, and other color style props.
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * declare module '@tenphi/tasty' {
188
+ * interface TastyNamedColors {
189
+ * primary: true;
190
+ * danger: true;
191
+ * }
192
+ * }
193
+ * ```
194
+ */
195
+ interface TastyNamedColors {}
196
+ type NamedColorKey = Extract<keyof TastyNamedColors, string>;
197
+ type NamedColor = [NamedColorKey] extends [never] ? string : NamedColorKey;
198
+ /**
199
+ * Extensible interface for typography preset names.
200
+ * Augment this interface to register project-specific preset names for autocomplete.
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * declare module '@tenphi/tasty' {
205
+ * interface TastyPresetNames {
206
+ * h1: true;
207
+ * t3: true;
208
+ * }
209
+ * }
210
+ * ```
211
+ */
212
+ interface TastyPresetNames {}
213
+ type PresetNameKey = Extract<keyof TastyPresetNames, string>;
214
+ type PresetName = [PresetNameKey] extends [never] ? string : PresetNameKey;
215
+ type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
216
+ type OpaquePercentage = '' | `.${Digit}` | `.${Digit}${Digit}` | '.100';
217
+ type ColorValue = `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `hsl(${string})` | `okhsl(${string})` | `oklch(${string})` | (string & {});
218
+ type NoType = false | null | undefined;
219
+ 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'> {
220
+ overscrollBehaviorBlock?: CSSProperties['overscrollBehaviorBlock'] | 'chain';
221
+ overscrollBehaviorInline?: CSSProperties['overscrollBehaviorInline'] | 'chain';
222
+ overscrollBehaviorX?: CSSProperties['overscrollBehaviorX'] | 'chain';
223
+ overscrollBehaviorY?: CSSProperties['overscrollBehaviorY'] | 'chain';
224
+ /**
225
+ * @deprecated Use `flow` style instead.
226
+ */
227
+ flexDirection: CSSProperties['flexDirection'];
228
+ /**
229
+ * @deprecated Use `placeContent`, `placeItems`, `gridColumns`, `gridRows`, and `gridTemplate` styles instead.
230
+ */
231
+ grid: CSSProperties['grid'];
232
+ /**
233
+ * @deprecated Use `flexShrink`, `flexGrow`, and `flexBasis` styles instead.
234
+ */
235
+ flex: CSSProperties['flex'];
236
+ /**
237
+ * Set the background color of the element. Shortcut for `background-color` with enhanced support for Tasty color tokens and syntaxes.
238
+ *
239
+ * Supports double-color syntax: the second color is applied as a foreground overlay via a CSS custom property.
240
+ *
241
+ * Examples:
242
+ * - `fill="#purple.10"` // purple background with 10% opacity
243
+ * - `fill="#danger"` // danger theme color
244
+ * - `fill="rgb(255 128 0)"` // custom RGB color
245
+ * - `fill="rgb(255 128 0 / 0.5)"` // RGB with opacity
246
+ * - `fill="hsl(200 100% 50%)"` // HSL color
247
+ * - `fill="okhsl(200 100% 50%)"` // perceptually uniform OKHSL color
248
+ * - `fill="oklch(0.7 0.15 200)"` // OKLCH color
249
+ * - `fill="#primary #secondary"` // double color (second as foreground overlay)
250
+ * - `fill={true}` // default fill color
251
+ */
252
+ fill?: ColorValue | boolean;
253
+ /**
254
+ * @deprecated Use `fill` instead.
255
+ */
256
+ backgroundColor?: CSSProperties['backgroundColor'];
257
+ /**
258
+ * Set the background image of the element. Shortcut for `background-image` with enhanced support for Tasty tokens.
259
+ *
260
+ * Examples:
261
+ * - `image="url(/path/to/image.png)"` // image from URL
262
+ * - `image="linear-gradient(to right, #purple, #danger)"` // gradient
263
+ */
264
+ image?: CSSProperties['backgroundImage'];
265
+ /**
266
+ * @deprecated Use `image` instead.
267
+ */
268
+ backgroundImage?: CSSProperties['backgroundImage'];
269
+ /**
270
+ * @deprecated Use separate background styles (`fill`, `image`, `backgroundSize`, etc.) instead.
271
+ * When set, overrides all other background-related styles.
272
+ */
273
+ background?: CSSProperties['background'];
274
+ /**
275
+ * Set the fill color of SVG elements. Outputs the native CSS `fill` property with enhanced support for Tasty color tokens and syntaxes.
276
+ *
277
+ * Examples:
278
+ * - `svgFill="#purple.10"` // purple fill with 10% opacity
279
+ * - `svgFill="#danger"` // danger theme color
280
+ * - `svgFill="rgb(255 128 0)"` // custom RGB color
281
+ * - `svgFill="hsl(200 100% 50%)"` // HSL color
282
+ * - `svgFill="okhsl(200 100% 50%)"` // OKHSL color
283
+ * - `svgFill="oklch(0.7 0.15 200)"` // OKLCH color
284
+ * - `svgFill="currentColor"` // inherit from parent color
285
+ */
286
+ svgFill?: ColorValue;
287
+ /**
288
+ * Set the text (current) color of the element. Shortcut for `color` with enhanced support for Tasty color tokens and syntaxes.
289
+ *
290
+ * Examples:
291
+ * - `color="#purple"` // purple text color
292
+ * - `color="#danger.6"` // danger color with 60% opacity
293
+ * - `color="rgb(255 128 0)"` // custom RGB color
294
+ * - `color="hsl(200 100% 50%)"` // HSL color
295
+ * - `color="okhsl(200 100% 50%)"` // OKHSL color
296
+ * - `color="oklch(0.7 0.15 200)"` // OKLCH color
297
+ * - `color="red"` // CSS color name
298
+ * - `color={true}` // currentColor
299
+ */
300
+ color?: ColorValue | boolean;
301
+ /**
302
+ * The fade style applies gradient-based fading masks to the edges of an element. Replaces complex CSS mask gradients with a simple, declarative API.
303
+ *
304
+ * Syntax: `[width] [direction...] [#from-color] [#to-color]`
305
+ *
306
+ * Multiple groups can be separated by commas to specify different widths and
307
+ * colors per direction. A group that names edges takes a single width, applied
308
+ * to every edge it names; a group that names none covers all four edges and
309
+ * keeps plain CSS shorthand order.
310
+ *
311
+ * Color tokens (optional):
312
+ * - First color: transparent start of gradient (default: `rgb(0 0 0 / 0)`)
313
+ * - Second color: opaque end of gradient (default: `rgb(0 0 0 / 1)`)
314
+ *
315
+ * Examples:
316
+ * - `fade="top"` // fade only top edge with default width
317
+ * - `fade="2x left right"` // fade left and right edges with 2x width
318
+ * - `fade={true}` // all edges at the design-system default width
319
+ * - `fade="1x top"` // fade only top edge with 1x width
320
+ * - `fade="3x 1x"` // all edges: top/bottom 3x, left/right 1x
321
+ * - `fade="3x top, 1x bottom"` // top: 3x width, bottom: 1x width
322
+ * - `fade="2x #transparent #dark"` // custom colors for gradient mask
323
+ * - `fade="1x top #clear #solid"` // top edge with custom mask colors
324
+ * - `fade="top #red #blue, bottom #green #yellow"` // different colors per direction
325
+ * - `fade="2x top #a #b, 1x bottom #c #d"` // different widths and colors per direction
326
+ */
327
+ fade?: 'top' | 'right' | 'bottom' | 'left' | string | boolean;
328
+ /**
329
+ * Scrollbar styling using standard CSS properties (`scrollbar-width`, `scrollbar-color`, `scrollbar-gutter`).
330
+ *
331
+ * Syntax: `[width] [modifiers...] [thumb-color] [track-color]`
332
+ *
333
+ * Width values: `thin` (default), `auto`, `none`
334
+ * Modifiers: `stable`, `both-edges`, `always`
335
+ *
336
+ * Examples:
337
+ * - `scrollbar={true}` // thin scrollbar, default colors
338
+ * - `scrollbar="thin #purple.40 #dark.04"`
339
+ * - `scrollbar="auto #red #blue"`
340
+ * - `scrollbar="none"`
341
+ * - `scrollbar="always #primary.50 #white.02"`
342
+ * - `scrollbar="thin stable #red #blue"`
343
+ */
344
+ scrollbar?: string | boolean;
345
+ /**
346
+ * Set font weight for bold texts.
347
+ */
348
+ boldFontWeight?: number;
349
+ /**
350
+ * The gap style is a powerful, cross-layout shorthand for spacing between child elements. Works with flex, grid, and block layouts.
351
+ *
352
+ * For flex/grid: sets native `gap` property
353
+ * For block layouts: emulated using margin on children
354
+ *
355
+ * Examples:
356
+ * - `gap="2x"` // gap: 2x (or margin-bottom: 2x for block)
357
+ * - `gap="1x 2x"` // row gap: 1x, column gap: 2x
358
+ * - `gap={true}` // default gap (1x)
359
+ */
360
+ gap?: CSSProperties['gap'] | string | boolean;
361
+ /**
362
+ * Shorthand for element padding. Supports custom units, directional modifiers, and design-system-driven defaults.
363
+ *
364
+ * A group that names directions takes a single value, applied to every
365
+ * direction it names — use comma groups for per-side values.
366
+ *
367
+ * Examples:
368
+ * - `padding="2x 1x"` // top/bottom: 2x, left/right: 1x
369
+ * - `padding="2x top"` // only top padding: 2x
370
+ * - `padding="1x left right"` // left and right padding: 1x
371
+ * - `padding="2x top, 4x right"` // top: 2x, right: 4x, bottom/left: 0
372
+ * - `padding={true}` // default padding on all sides
373
+ */
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;
379
+ /**
380
+ * Shorthand for element margin. Supports custom units, directional modifiers, and design-system-driven defaults.
381
+ *
382
+ * A group that names directions takes a single value, applied to every
383
+ * direction it names — use comma groups for per-side values.
384
+ *
385
+ * Examples:
386
+ * - `margin="2x 1x"` // top/bottom: 2x, left/right: 1x
387
+ * - `margin="2x top"` // only top margin: 2x
388
+ * - `margin="1x left right"` // left and right margin: 1x
389
+ * - `margin="2x top, 4x right"` // top: 2x, right: 4x, bottom/left: 0
390
+ * - `margin={true}` // default margin on all sides
391
+ */
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;
397
+ /**
398
+ * Concise shorthand for setting element width, including min-width and max-width. Supports custom units and advanced sizing keywords.
399
+ *
400
+ * Syntax: `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
401
+ *
402
+ * Modifiers: `min`, `max`
403
+ * Keywords: `stretch`, `max-content`, `min-content`, `fit-content`
404
+ *
405
+ * Examples:
406
+ * - `width="10x"` // width: 10x
407
+ * - `width="1x 10x"` // min-width: 1x; max-width: 10x
408
+ * - `width="min 2x"` // min-width: 2x
409
+ * - `width="stretch"` // width: stretch (fill-available)
410
+ * - `width={true}` // width: auto
411
+ */
412
+ width?: CSSProperties['width'] | string | boolean;
413
+ /**
414
+ * Concise shorthand for setting element height, including min-height and max-height. Supports custom units and advanced sizing keywords.
415
+ *
416
+ * Syntax: `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
417
+ *
418
+ * Modifiers: `min`, `max`
419
+ * Keywords: `stretch`, `max-content`, `min-content`, `fit-content`
420
+ *
421
+ * Examples:
422
+ * - `height="100px"` // height: 100px
423
+ * - `height="1x 5x 10x"` // min-height: 1x; height: 5x; max-height: 10x
424
+ * - `height="min 2x"` // min-height: 2x
425
+ * - `height={true}` // height: auto
426
+ */
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;
438
+ /**
439
+ * Shorthand for border width, style, and color. Supports directional modifiers and design-system defaults.
440
+ *
441
+ * Syntax: `[width] [style] [color] [directions]` | `[directions]` | `true`
442
+ *
443
+ * Multiple groups can be separated by commas. Later groups override earlier groups for conflicting directions.
444
+ *
445
+ * Examples:
446
+ * - `border={true}` // default border on all sides (1bw solid)
447
+ * - `border="2bw dashed #purple"` // 2bw dashed purple border
448
+ * - `border="2bw top"` // only top border: 2bw solid
449
+ * - `border="dotted #danger left right"` // left/right: 1bw dotted danger
450
+ * - `border="1bw #red, 2bw #blue top"` // all sides red 1bw, top overridden to blue 2bw
451
+ * - `border="1bw, dashed top bottom, #purple left right"` // base 1bw, dashed on top/bottom, purple on left/right
452
+ * - `border="1bw $my-style"` // custom property in the style slot
453
+ *
454
+ * A `$name` reference fills the first free slot — width, then style, then
455
+ * color. Colors are authored as `#name`; to point the color slot at a raw
456
+ * custom property directly, name it `$name-color`.
457
+ */
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;
463
+ /**
464
+ * Powerful shorthand for CSS transitions using semantic names and design tokens. Supports grouped transitions for common UI effects.
465
+ *
466
+ * Semantic names: `fade`, `fill`, `border`, `radius`, `shadow`, `preset`, `gap`, `theme`
467
+ * Multiple transitions: separated by commas
468
+ *
469
+ * Examples:
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
474
+ */
475
+ transition?: CSSProperties['transition'] | string;
476
+ /**
477
+ * Whether the element is hidden using `display: none`. Boolean shortcut for conditional element visibility.
478
+ *
479
+ * Examples:
480
+ * - `hide={true}` // display: none
481
+ * - `hide={false}` // element remains visible
482
+ */
483
+ hide?: boolean;
484
+ /**
485
+ * 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.
486
+ *
487
+ * Examples:
488
+ * - `shadow="1x .5x .5x #dark.50"` // custom shadow with Tasty units and colors
489
+ * - `shadow="0 1x 2x #dark.20"` // standard shadow syntax
490
+ * - `shadow={true}` // default shadow from design system
491
+ */
492
+ shadow?: string | boolean;
493
+ /**
494
+ * The radius style rounds the corners of an element's outer border edge. Supports custom units, advanced shapes, and directional modifiers.
495
+ *
496
+ * Syntax: `[value] [modifiers]` | `[shape]` | `true`
497
+ *
498
+ * Shapes: `round` (fully rounded), `ellipse` (50%), `leaf`, `backleaf` (asymmetric), `inherit` (inherit from parent)
499
+ * Edge modifiers: `top`, `right`, `bottom`, `left` — the corner pair along that edge
500
+ * Corner modifiers: `top-left`, `top-right`, `bottom-right`, `bottom-left` — a single corner
501
+ *
502
+ * Examples:
503
+ * - `radius="2r"` // border-radius: calc(var(--radius) * 2)
504
+ * - `radius={true}` // default radius (1r)
505
+ * - `radius="round"` // fully rounded (9999rem)
506
+ * - `radius="leaf"` // asymmetric leaf shape
507
+ * - `radius="1r top"` // round both top corners
508
+ * - `radius="top-right"` // round only the top-right corner (1r)
509
+ * - `radius="4px top-left"` // round only the top-left corner
510
+ * - `radius="inherit"` // inherit border-radius from parent
511
+ * - `radius="inherit right"` // inherit only right corners (uses longhand properties)
512
+ */
513
+ radius?: 'round' | 'ellipse' | 'leaf' | 'backleaf' | 'inherit' | string | true;
514
+ /**
515
+ * The flow style is a unified shorthand for controlling layout direction and wrapping in both flex and grid containers. Replaces `flexDirection` and `gridAutoFlow`.
516
+ *
517
+ * For flex: sets `flex-flow` (direction + wrapping)
518
+ * For grid: sets `grid-auto-flow` (direction + density)
519
+ * For block: determines gap direction (row/column)
520
+ *
521
+ * Syntax: `[direction] [wrap|dense]`
522
+ *
523
+ * Examples:
524
+ * - `flow="row wrap"` // flex-flow: row wrap
525
+ * - `flow="column dense"` // grid-auto-flow: column dense
526
+ * - `flow="row"` // primary axis direction
527
+ */
528
+ flow?: CSSProperties['flexFlow'] | CSSProperties['gridAutoFlow'] | string;
529
+ /**
530
+ * The gridAreas style specifies named grid areas, establishing cells in the grid and assigning them names.
531
+ *
532
+ * Examples:
533
+ * - `gridAreas='"header header" "sidebar content" "footer footer"'`
534
+ */
535
+ gridAreas?: CSSProperties['gridTemplateAreas'];
536
+ /**
537
+ * The gridColumns style defines line names and track sizing functions of grid columns.
538
+ *
539
+ * Examples:
540
+ * - `gridColumns="1fr 2fr 1fr"` // three columns with flex ratios
541
+ * - `gridColumns={3}` // three equal columns (shorthand)
542
+ * - `gridColumns="repeat(auto-fit, minmax(200px, 1fr))"` // responsive columns
543
+ */
544
+ gridColumns?: CSSProperties['gridTemplateColumns'] | number;
545
+ /**
546
+ * The gridRows style defines line names and track sizing functions of grid rows.
547
+ *
548
+ * Examples:
549
+ * - `gridRows="auto 1fr auto"` // header, content, footer layout
550
+ * - `gridRows={4}` // four equal rows (shorthand)
551
+ * - `gridRows="repeat(3, 100px)"` // three 100px rows
552
+ */
553
+ gridRows?: CSSProperties['gridTemplateRows'] | number;
554
+ /**
555
+ * The gridTemplate style is a shorthand property for defining grid columns, rows, and areas simultaneously.
556
+ *
557
+ * Examples:
558
+ * - `gridTemplate='"header header" auto "content sidebar" 1fr / 2fr 1fr'`
559
+ */
560
+ gridTemplate?: CSSProperties['gridTemplate'];
561
+ /**
562
+ * The font style specifies a prioritized list of font family names with design-system-driven defaults and fallbacks.
563
+ *
564
+ * Examples:
565
+ * - `font="monospace"` // monospace font stack
566
+ * - `font="Helvetica, Arial, sans-serif"` // custom font list
567
+ * - `font={true}` // default design system font
568
+ */
569
+ font?: CSSProperties['fontFamily'] | boolean;
570
+ /**
571
+ * The outline style sets the outline for the element.
572
+ *
573
+ * Syntax: `[width] [style] [color] / [offset]` | `true`
574
+ *
575
+ * Examples:
576
+ * - `outline="2ow dashed #purple"` // 2ow dashed purple outline
577
+ * - `outline="2ow #danger / 1x"` // 2ow solid danger outline, 1x offset
578
+ * - `outline={true}` // default outline (1ow solid)
579
+ * - `outline="2ow $my-style"` // custom property in the style slot
580
+ *
581
+ * A `$name` reference fills the first free slot — width, then style, then
582
+ * color. Colors are authored as `#name`; to point the color slot at a raw
583
+ * custom property directly, name it `$name-color`.
584
+ */
585
+ outline?: string | boolean;
586
+ /**
587
+ * The outline offset style sets the offset of the outline.
588
+ *
589
+ * Examples:
590
+ * - `outlineOffset="4px"` // 4px offset
591
+ * - `outlineOffset="1x"` // 1x (8px) offset
592
+ */
593
+ outlineOffset?: string | number;
594
+ /**
595
+ * The preset style sets base text settings according to named presets. Affects `font-size`, `line-height`, `letter-spacing`, `font-weight`, and `text-transform`.
596
+ *
597
+ * Syntax: `name`, `name / modifier...`, or `modifier...` (shorthand, name defaults to `inherit`).
598
+ * Multiple modifiers are space-separated and combine freely (e.g. `strong italic tight`).
599
+ * Preset names are project-specific. Augment `TastyPresetNames` to register them for autocomplete.
600
+ *
601
+ * Examples:
602
+ * - `preset="h1"` // heading 1 typography
603
+ * - `preset="h2 / strong"` // bold heading 2
604
+ * - `preset="h2 / strong italic"` // bold + italic heading 2
605
+ * - `preset="t2 / strong tight"` // bold text 2 with tight line-height
606
+ * - `preset="bold"` // inherit with bold (shorthand)
607
+ * - `preset="bold italic"` // inherit with bold + italic (shorthand)
608
+ * - `preset="t3"` // text size 3
609
+ */
610
+ preset?: PresetName | (string & {});
611
+ /**
612
+ * Shorthand for `align-items` and `align-content`. Sets both properties for unified vertical alignment in flex/grid layouts.
613
+ *
614
+ * Examples:
615
+ * - `align="center"` // align-items: center; align-content: center
616
+ * - `align="flex-start"` // align both to start
617
+ * - `align="space-between"` // distribute space between items
618
+ */
619
+ align?: CSSProperties['alignItems'] | CSSProperties['alignContent'];
620
+ /**
621
+ * Shorthand for `justify-items` and `justify-content`. Sets both properties for unified horizontal alignment in flex/grid layouts.
622
+ *
623
+ * Examples:
624
+ * - `justify="center"` // justify-items: center; justify-content: center
625
+ * - `justify="space-between"` // distribute space between items
626
+ * - `justify="flex-end"` // align both to end
627
+ */
628
+ justify?: CSSProperties['justifyItems'] | CSSProperties['justifyContent'];
629
+ /**
630
+ * Shorthand for all placement properties. Sets all 4 longhands: align-items, justify-items, align-content, justify-content.
631
+ *
632
+ * Examples:
633
+ * - `place="center"` // all 4 longhands: center
634
+ * - `place="start end"` // align-*: start; justify-*: end
635
+ * - `place="stretch"` // all 4 longhands: stretch
636
+ */
637
+ place?: CSSProperties['placeItems'] | CSSProperties['placeContent'] | string;
638
+ /**
639
+ * Sets `place-content` property for aligning and distributing content in grid/flex containers.
640
+ *
641
+ * Examples:
642
+ * - `placeContent="center"` // center content in both axes
643
+ * - `placeContent="space-between"` // distribute content with space between
644
+ */
645
+ placeContent?: CSSProperties['placeContent'];
646
+ /**
647
+ * Sets `place-items` property for aligning items in grid/flex containers.
648
+ *
649
+ * Examples:
650
+ * - `placeItems="center"` // center items in both axes
651
+ * - `placeItems="start end"` // start on block axis, end on inline axis
652
+ */
653
+ placeItems?: CSSProperties['placeItems'];
654
+ /**
655
+ * Shorthand for scroll-margin on all sides. Supports custom units and directional modifiers.
656
+ *
657
+ * Examples:
658
+ * - `scrollMargin="2x"` // scroll-margin on all sides: 2x
659
+ * - `scrollMargin="2x top"` // only top scroll-margin: 2x
660
+ * - `scrollMargin="2x top, 4x bottom"` // top: 2x, bottom: 4x
661
+ * - `scrollMargin={true}` // default scroll-margin on all sides
662
+ */
663
+ scrollMargin?: CSSProperties['scrollMargin'] | string | boolean;
664
+ scrollMarginTop?: string | number | boolean;
665
+ scrollMarginRight?: string | number | boolean;
666
+ scrollMarginBottom?: string | number | boolean;
667
+ scrollMarginLeft?: 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;
685
+ /**
686
+ * Shorthand for `top`, `right`, `bottom`, and `left` offsets. Supports custom units, directional modifiers, and positioning.
687
+ *
688
+ * Examples:
689
+ * - `inset="0"` // all sides: 0
690
+ * - `inset="2x top"` // only top offset: 2x
691
+ * - `inset="1x left right"` // left and right offsets: 1x
692
+ * - `inset="2x top, 4x right"` // top: 2x, right: 4x, bottom/left: auto
693
+ * - `inset="bottom dock"` // bottom-anchored, full width: auto 0 0 0
694
+ * - `inset={true}` // all sides: 0
695
+ *
696
+ * A group that names directions takes a single value, applied to every
697
+ * direction it names — use comma groups for per-side values.
698
+ *
699
+ * The `dock` modifier pins the named edge and spans its full length, applying
700
+ * the value to the two perpendicular sides as well. `dock` is the one case
701
+ * where a directional group takes two values: the second applies to those
702
+ * spanned sides, so `inset="2x 4x bottom dock"` pins the bottom at `2x` and
703
+ * insets the sides by `4x`. Without `dock` a second value is ignored.
704
+ */
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;
710
+ /**
711
+ * Local keyframes definitions for this component.
712
+ * Keys are animation names, values are keyframes step definitions.
713
+ * Local keyframes override global keyframes with the same name.
714
+ *
715
+ * Examples:
716
+ * - `'@keyframes': { fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } } }`
717
+ * - `'@keyframes': { pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } } }`
718
+ */
719
+ '@keyframes'?: Record<string, KeyframesSteps>;
720
+ /**
721
+ * CSS @property definitions for custom properties using tasty token syntax.
722
+ * Properties are registered once and are permanent (never removed).
723
+ *
724
+ * Token formats:
725
+ * - `$name` for regular properties → `--name` (requires syntax to be specified)
726
+ * - `#name` for color properties → `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
727
+ *
728
+ * Examples:
729
+ * - `'@property': { '$rotation': { syntax: '<angle>', inherits: false, initialValue: '45deg' } }`
730
+ * - `'@property': { '#theme': { initialValue: 'purple' } }` // syntax: '<color>' is auto-set
731
+ */
732
+ '@property'?: Record<string, PropertyDefinition>;
733
+ /**
734
+ * Local @font-face definitions for this component.
735
+ * Keys are font-family names, values are descriptors or arrays of descriptors
736
+ * (for multiple weights/styles of the same family).
737
+ *
738
+ * Examples:
739
+ * - `'@font-face': { Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' } }`
740
+ * - `'@font-face': { 'Brand Sans': [{ src: '...', fontWeight: 400 }, { src: '...', fontWeight: 700 }] }`
741
+ */
742
+ '@font-face'?: Record<string, FontFaceInput>;
743
+ /**
744
+ * Local @counter-style definitions for this component.
745
+ * Keys are counter-style names, values are descriptor objects.
746
+ *
747
+ * Examples:
748
+ * - `'@counter-style': { thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' } }`
749
+ */
750
+ '@counter-style'?: Record<string, CounterStyleDescriptors>;
751
+ /**
752
+ * Local @function definitions (CSS custom functions) for this component.
753
+ * Keys are function names using `$$name` (the literal callable `--name`),
754
+ * matching the call site `$$name(...)`. Values are function definitions.
755
+ *
756
+ * Local variables are declared directly as `$name` keys on the descriptor;
757
+ * `result`, local-var values, and parameter defaults are parsed through the
758
+ * Tasty DSL (units, color tokens, auto-calc, fallbacks).
759
+ *
760
+ * Examples:
761
+ * - `'@function': { '$$negative': { args: ['$value'], result: '(-1 * $value)' } }`
762
+ * - `'@function': { '$$shadow': { args: { '$color': { syntax: '<color>', default: 'inherit' } }, returns: '<color>', '$offset': '2px', result: '$offset $offset ($color, black)' } }`
763
+ */
764
+ '@function'?: Record<string, FunctionDefinition>;
765
+ /**
766
+ * Apply one or more predefined style recipes by name.
767
+ * Recipes are defined globally via `configure({ recipes: { ... } })`.
768
+ * Multiple recipes are space-separated. Use `/` to separate base recipes
769
+ * (applied before component styles) from post recipes (applied after, via mergeStyles).
770
+ * Use `none` to explicitly skip base recipes.
771
+ *
772
+ * Examples:
773
+ * - `recipe: 'card'` // Apply the 'card' recipe
774
+ * - `recipe: 'card elevated'` // Apply 'card' then 'elevated', then component styles
775
+ * - `recipe: 'reset input / input-autofill'` // Base recipes, then post recipe
776
+ * - `recipe: 'none / disabled'` // No base recipes, only post recipe
777
+ * - `recipe: ''` // Clear recipes from base styles when extending
778
+ */
779
+ recipe?: string;
780
+ }
781
+ 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';
782
+ type Selector = `${SuffixForSelector}${string}`;
783
+ type NotSelector = Exclude<string, Selector | keyof StylesInterface>;
784
+ /** Special style keys that should not be wrapped in StyleValue/StyleValueStateMap */
785
+ type SpecialStyleKeys = '@keyframes' | '@property' | '@font-face' | '@counter-style' | '@function' | 'recipe';
786
+ type StylesWithoutSelectors = { [key in keyof StylesInterface as key extends SpecialStyleKeys ? never : key]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>; };
787
+ /**
788
+ * Index signature for recipe-specific arbitrary keys.
789
+ * Supports local predefined states (`@name`), vendor-prefixed CSS properties (`-webkit-*`),
790
+ * CSS custom properties (`$name`), and color tokens (`#name`).
791
+ * Unlike StylesIndexSignature, does NOT allow sub-element selectors (recipes are flat).
792
+ */
793
+ type RecipeIndexSignature = Record<string, StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined>>;
794
+ /**
795
+ * Style type for recipe definitions.
796
+ * Like StylesWithoutSelectors but also allows `@keyframes`, `@property`,
797
+ * local predefined states, and vendor-prefixed CSS properties.
798
+ * Excludes `recipe` to prevent recursive references.
799
+ */
800
+ type RecipeStyles = StylesWithoutSelectors & RecipeIndexSignature & {
801
+ '@keyframes'?: StylesInterface['@keyframes'];
802
+ '@property'?: StylesInterface['@property'];
803
+ '@font-face'?: StylesInterface['@font-face'];
804
+ '@counter-style'?: StylesInterface['@counter-style'];
805
+ '@function'?: StylesInterface['@function'];
806
+ };
807
+ /** Special properties that are not regular style values */
808
+ interface SpecialStyleProperties {
809
+ '@keyframes'?: StylesInterface['@keyframes'];
810
+ '@property'?: StylesInterface['@property'];
811
+ '@font-face'?: StylesInterface['@font-face'];
812
+ '@counter-style'?: StylesInterface['@counter-style'];
813
+ '@function'?: StylesInterface['@function'];
814
+ recipe?: StylesInterface['recipe'];
815
+ }
816
+ /** Index signature for arbitrary style keys (sub-elements, CSS variables, etc.) */
817
+ interface StylesIndexSignature {
818
+ [key: string]: StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined> | Styles | false | StylesInterface['@keyframes'] | StylesInterface['@property'] | StylesInterface['@font-face'] | StylesInterface['@counter-style'] | StylesInterface['@function'];
819
+ /**
820
+ * Selector combinator: `undefined` (descendant, default), `'>'` (child), `'+'` (adjacent), `'~'` (sibling).
821
+ * Can chain with capitalized names: `'> Body > Row >'`. Spaces required around combinators.
822
+ */
823
+ $?: string;
824
+ }
825
+ type Styles = StylesWithoutSelectors & SpecialStyleProperties & StylesIndexSignature;
826
+ /**
827
+ * Value type for design tokens passed to `configure({ tokens })`.
828
+ * Can be a direct value or a state map for responsive/theme-aware tokens.
829
+ */
830
+ type ConfigTokenValue = string | number | boolean | Record<string, string | number | boolean | undefined | null | '@inherit'>;
831
+ /**
832
+ * Design tokens injected as CSS custom properties on `:root`.
833
+ * Keys must start with `$` (value tokens) or `#` (color tokens).
834
+ *
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.
1068
+ */
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[];
1071
+ //#endregion
1072
+ //#region src/properties/property-type-resolver.d.ts
1073
+ /**
1074
+ * PropertyTypeResolver
1075
+ *
1076
+ * Automatically infers CSS @property types from custom property values.
1077
+ * Supports deferred resolution for var() reference chains of arbitrary depth.
1078
+ */
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;
1092
+ }
1093
+ //#endregion
1094
+ //#region src/injector/batch.d.ts
1095
+ /**
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`, ...).
1147
+ */
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;
1155
+ }
1156
+ /** Whether any write is still waiting to hit a stylesheet. */
1157
+ declare function hasPendingStyleWrites(): boolean;
1158
+ /**
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.
1165
+ */
1166
+ declare function flushStyles(): void;
1167
+ /**
1168
+ * Drop every pending write without applying it. Test helper — production code
1169
+ * should call `flushStyles()` instead.
1170
+ */
1171
+ declare function resetStyleBatch(): void;
1172
+ //#endregion
1173
+ //#region src/injector/types.d.ts
1174
+ declare global {
1175
+ interface Window {
1176
+ __TASTY__?: string[];
1177
+ }
1178
+ }
1179
+ interface InjectResult {
1180
+ className: string;
1181
+ dispose: () => void;
1182
+ }
1183
+ interface GlobalInjectResult {
1184
+ dispose: () => void;
1185
+ }
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';
1221
+ }
1222
+ /**
1223
+ * Per-className usage tracking for GC.
1224
+ */
1225
+ /**
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.
1229
+ */
1230
+ interface StyleUsage {
1231
+ lastTouchedAt: number;
1232
+ }
1233
+ /**
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.
1239
+ */
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;
1266
+ }
1267
+ /**
1268
+ * Per-call options for inject().
1269
+ */
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;
1282
+ }
1283
+ /**
1284
+ * Per-call options for gc().
1285
+ */
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;
1423
+ }
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;
1431
+ }
1432
+ type KeyframeStep = string | Record<string, string | number>;
1433
+ type KeyframesSteps = Record<string, KeyframeStep>;
1434
+ interface KeyframesResult {
1435
+ toString(): string;
1436
+ dispose: () => void;
1437
+ }
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;
1448
+ }
1449
+ /**
1450
+ * Definition for a CSS @property at-rule.
1451
+ * Used to define custom property syntax, inheritance, and initial value.
1452
+ */
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;
1460
+ }
1461
+ /**
1462
+ * Options for registering a CSS `@property`.
1463
+ * Extends {@link PropertyDefinition} with an optional injection root.
1464
+ */
1465
+ interface PropertyOptions extends PropertyDefinition {
1466
+ /** Shadow root or document to inject into */
1467
+ root?: Document | ShadowRoot;
1468
+ }
1469
+ /**
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.
1475
+ */
1476
+ type FunctionParameter = true | string | {
1477
+ syntax?: string;
1478
+ default?: string | number;
1479
+ };
1480
+ /**
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
+ * ```
1492
+ */
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;
1505
+ }
1506
+ /**
1507
+ * Descriptors for a CSS @font-face at-rule.
1508
+ */
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;
1534
+ }
1535
+ /** Single descriptor or array of descriptors for multiple weights/styles. */
1536
+ type FontFaceInput = FontFaceDescriptors | FontFaceDescriptors[];
1537
+ /**
1538
+ * Descriptors for a CSS @counter-style at-rule.
1539
+ */
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;
1561
+ }
1562
+ interface RawCSSResult {
1563
+ dispose: () => void;
1564
+ }
1565
+ //#endregion
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-JEY8PVYP.d.ts.map