@tenphi/tasty 0.0.0-snapshot.275370e → 0.0.0-snapshot.27b6708

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 (356) hide show
  1. package/README.md +175 -109
  2. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +2 -2
  3. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/babel-BUQGeOXA.d.ts +83 -0
  5. package/dist/{ssr/collector.js → collector-DTahQUiV.js} +97 -28
  6. package/dist/collector-DTahQUiV.js.map +1 -0
  7. package/dist/{ssr/collector.d.ts → collector-DUaHCcTS.d.ts} +54 -7
  8. package/dist/config-B5kHzuNz.js +12269 -0
  9. package/dist/config-B5kHzuNz.js.map +1 -0
  10. package/dist/config-YsxGv4tq.d.ts +1263 -0
  11. package/dist/{ssr/context.js → context-CA8YKeMn.js} +11 -3
  12. package/dist/context-CA8YKeMn.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -34
  14. package/dist/core/index.js +6 -27
  15. package/dist/core-Dr4u1NVD.js +1566 -0
  16. package/dist/core-Dr4u1NVD.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-B-J87ncv.js} +148 -24
  18. package/dist/css-writer-B-J87ncv.js.map +1 -0
  19. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
  20. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  21. package/dist/{ssr/format-rules.js → format-rules-DKOA-6qu.js} +59 -2
  22. package/dist/format-rules-DKOA-6qu.js.map +1 -0
  23. package/dist/{ssr/hydrate.js → hydrate-OeMX99We.js} +3 -11
  24. package/dist/hydrate-OeMX99We.js.map +1 -0
  25. package/dist/index-Cd45t5NM.d.ts +1521 -0
  26. package/dist/index-PqN-DIpn.d.ts +1911 -0
  27. package/dist/index.d.ts +5 -51
  28. package/dist/index.js +922 -36
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-CV8azJf3.js +493 -0
  31. package/dist/keyframes-CV8azJf3.js.map +1 -0
  32. package/dist/{utils/merge-styles.d.ts → merge-styles-CU7JbEwg.d.ts} +3 -3
  33. package/dist/{utils/merge-styles.js → merge-styles-oklji0KB.js} +3 -4
  34. package/dist/merge-styles-oklji0KB.js.map +1 -0
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-DTG81rzl.js} +4 -6
  36. package/dist/resolve-recipes-DTG81rzl.js.map +1 -0
  37. package/dist/ssr/astro-client.js +1 -1
  38. package/dist/ssr/astro-client.js.map +1 -1
  39. package/dist/ssr/astro-middleware-static.d.ts +16 -0
  40. package/dist/ssr/astro-middleware-static.js +18 -0
  41. package/dist/ssr/astro-middleware-static.js.map +1 -0
  42. package/dist/ssr/astro-middleware.d.ts +8 -6
  43. package/dist/ssr/astro-middleware.js +10 -10
  44. package/dist/ssr/astro-middleware.js.map +1 -1
  45. package/dist/ssr/astro.d.ts +2 -17
  46. package/dist/ssr/astro.js +29 -21
  47. package/dist/ssr/astro.js.map +1 -1
  48. package/dist/ssr/index.d.ts +37 -4
  49. package/dist/ssr/index.js +5 -5
  50. package/dist/ssr/index.js.map +1 -1
  51. package/dist/ssr/next.d.ts +2 -3
  52. package/dist/ssr/next.js +7 -8
  53. package/dist/ssr/next.js.map +1 -1
  54. package/dist/static/index.d.ts +91 -5
  55. package/dist/static/index.js +49 -3
  56. package/dist/static/index.js.map +1 -0
  57. package/dist/static/inject.js.map +1 -1
  58. package/dist/zero/babel.d.ts +2 -81
  59. package/dist/zero/babel.js +45 -29
  60. package/dist/zero/babel.js.map +1 -1
  61. package/dist/zero/index.d.ts +81 -3
  62. package/dist/zero/index.js +2 -3
  63. package/dist/zero/next.d.ts +1 -1
  64. package/dist/zero/next.js +1 -1
  65. package/dist/zero/next.js.map +1 -1
  66. package/docs/README.md +13 -7
  67. package/docs/adoption.md +53 -28
  68. package/docs/ai-agents.md +224 -0
  69. package/docs/comparison.md +59 -30
  70. package/docs/configuration.md +498 -69
  71. package/docs/debug.md +18 -16
  72. package/docs/design-system.md +43 -24
  73. package/docs/dsl.md +510 -177
  74. package/docs/getting-started.md +55 -34
  75. package/docs/injector.md +60 -7
  76. package/docs/methodology.md +68 -36
  77. package/docs/migration-v3.md +285 -0
  78. package/docs/pipeline.md +741 -0
  79. package/docs/plugins.md +349 -0
  80. package/docs/react-api.md +162 -38
  81. package/docs/ssr.md +45 -35
  82. package/docs/styles.md +65 -16
  83. package/docs/tasty-static.md +25 -8
  84. package/package.json +44 -21
  85. package/tasty.config.ts +6 -0
  86. package/dist/_virtual/_rolldown/runtime.js +0 -7
  87. package/dist/chunks/cacheKey.d.ts +0 -1
  88. package/dist/chunks/cacheKey.js +0 -77
  89. package/dist/chunks/cacheKey.js.map +0 -1
  90. package/dist/chunks/definitions.d.ts +0 -37
  91. package/dist/chunks/definitions.js +0 -258
  92. package/dist/chunks/definitions.js.map +0 -1
  93. package/dist/chunks/index.d.ts +0 -1
  94. package/dist/chunks/renderChunk.d.ts +0 -1
  95. package/dist/chunks/renderChunk.js +0 -59
  96. package/dist/chunks/renderChunk.js.map +0 -1
  97. package/dist/compute-styles.d.ts +0 -31
  98. package/dist/compute-styles.js +0 -322
  99. package/dist/compute-styles.js.map +0 -1
  100. package/dist/config.d.ts +0 -407
  101. package/dist/config.js +0 -591
  102. package/dist/config.js.map +0 -1
  103. package/dist/counter-style/index.js +0 -51
  104. package/dist/counter-style/index.js.map +0 -1
  105. package/dist/debug.d.ts +0 -89
  106. package/dist/debug.js +0 -453
  107. package/dist/debug.js.map +0 -1
  108. package/dist/font-face/index.js +0 -63
  109. package/dist/font-face/index.js.map +0 -1
  110. package/dist/hooks/index.d.ts +0 -7
  111. package/dist/hooks/useCounterStyle.d.ts +0 -36
  112. package/dist/hooks/useCounterStyle.js +0 -65
  113. package/dist/hooks/useCounterStyle.js.map +0 -1
  114. package/dist/hooks/useFontFace.d.ts +0 -45
  115. package/dist/hooks/useFontFace.js +0 -66
  116. package/dist/hooks/useFontFace.js.map +0 -1
  117. package/dist/hooks/useGlobalStyles.d.ts +0 -46
  118. package/dist/hooks/useGlobalStyles.js +0 -88
  119. package/dist/hooks/useGlobalStyles.js.map +0 -1
  120. package/dist/hooks/useKeyframes.d.ts +0 -58
  121. package/dist/hooks/useKeyframes.js +0 -55
  122. package/dist/hooks/useKeyframes.js.map +0 -1
  123. package/dist/hooks/useProperty.d.ts +0 -81
  124. package/dist/hooks/useProperty.js +0 -96
  125. package/dist/hooks/useProperty.js.map +0 -1
  126. package/dist/hooks/useRawCSS.d.ts +0 -22
  127. package/dist/hooks/useRawCSS.js +0 -103
  128. package/dist/hooks/useRawCSS.js.map +0 -1
  129. package/dist/hooks/useStyles.d.ts +0 -40
  130. package/dist/hooks/useStyles.js +0 -31
  131. package/dist/hooks/useStyles.js.map +0 -1
  132. package/dist/injector/index.d.ts +0 -182
  133. package/dist/injector/index.js +0 -185
  134. package/dist/injector/index.js.map +0 -1
  135. package/dist/injector/injector.d.ts +0 -198
  136. package/dist/injector/injector.js +0 -651
  137. package/dist/injector/injector.js.map +0 -1
  138. package/dist/injector/sheet-manager.d.ts +0 -132
  139. package/dist/injector/sheet-manager.js +0 -699
  140. package/dist/injector/sheet-manager.js.map +0 -1
  141. package/dist/injector/types.d.ts +0 -235
  142. package/dist/keyframes/index.js +0 -206
  143. package/dist/keyframes/index.js.map +0 -1
  144. package/dist/parser/classify.js +0 -319
  145. package/dist/parser/classify.js.map +0 -1
  146. package/dist/parser/const.js +0 -60
  147. package/dist/parser/const.js.map +0 -1
  148. package/dist/parser/lru.js +0 -109
  149. package/dist/parser/lru.js.map +0 -1
  150. package/dist/parser/parser.d.ts +0 -25
  151. package/dist/parser/parser.js +0 -115
  152. package/dist/parser/parser.js.map +0 -1
  153. package/dist/parser/tokenizer.js +0 -69
  154. package/dist/parser/tokenizer.js.map +0 -1
  155. package/dist/parser/types.d.ts +0 -51
  156. package/dist/parser/types.js +0 -46
  157. package/dist/parser/types.js.map +0 -1
  158. package/dist/pipeline/conditions.d.ts +0 -134
  159. package/dist/pipeline/conditions.js +0 -406
  160. package/dist/pipeline/conditions.js.map +0 -1
  161. package/dist/pipeline/exclusive.js +0 -285
  162. package/dist/pipeline/exclusive.js.map +0 -1
  163. package/dist/pipeline/index.d.ts +0 -55
  164. package/dist/pipeline/index.js +0 -708
  165. package/dist/pipeline/index.js.map +0 -1
  166. package/dist/pipeline/materialize.js +0 -1157
  167. package/dist/pipeline/materialize.js.map +0 -1
  168. package/dist/pipeline/parseStateKey.d.ts +0 -15
  169. package/dist/pipeline/parseStateKey.js +0 -446
  170. package/dist/pipeline/parseStateKey.js.map +0 -1
  171. package/dist/pipeline/simplify.js +0 -690
  172. package/dist/pipeline/simplify.js.map +0 -1
  173. package/dist/pipeline/warnings.js +0 -18
  174. package/dist/pipeline/warnings.js.map +0 -1
  175. package/dist/plugins/index.d.ts +0 -2
  176. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  177. package/dist/plugins/okhsl-plugin.js +0 -97
  178. package/dist/plugins/okhsl-plugin.js.map +0 -1
  179. package/dist/plugins/types.d.ts +0 -87
  180. package/dist/properties/index.js +0 -222
  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 -90
  184. package/dist/properties/property-type-resolver.js.map +0 -1
  185. package/dist/rsc-cache.js +0 -79
  186. package/dist/rsc-cache.js.map +0 -1
  187. package/dist/ssr/async-storage.d.ts +0 -17
  188. package/dist/ssr/async-storage.js.map +0 -1
  189. package/dist/ssr/collect-auto-properties.js +0 -58
  190. package/dist/ssr/collect-auto-properties.js.map +0 -1
  191. package/dist/ssr/collector.js.map +0 -1
  192. package/dist/ssr/context.js.map +0 -1
  193. package/dist/ssr/format-global-rules.js.map +0 -1
  194. package/dist/ssr/format-keyframes.js +0 -69
  195. package/dist/ssr/format-keyframes.js.map +0 -1
  196. package/dist/ssr/format-property.js +0 -49
  197. package/dist/ssr/format-property.js.map +0 -1
  198. package/dist/ssr/format-rules.js.map +0 -1
  199. package/dist/ssr/hydrate.d.ts +0 -29
  200. package/dist/ssr/hydrate.js.map +0 -1
  201. package/dist/ssr/ssr-collector-ref.js +0 -29
  202. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  203. package/dist/states/index.d.ts +0 -49
  204. package/dist/states/index.js +0 -170
  205. package/dist/states/index.js.map +0 -1
  206. package/dist/static/tastyStatic.d.ts +0 -46
  207. package/dist/static/tastyStatic.js +0 -30
  208. package/dist/static/tastyStatic.js.map +0 -1
  209. package/dist/static/types.d.ts +0 -49
  210. package/dist/static/types.js +0 -24
  211. package/dist/static/types.js.map +0 -1
  212. package/dist/styles/border.d.ts +0 -25
  213. package/dist/styles/border.js +0 -120
  214. package/dist/styles/border.js.map +0 -1
  215. package/dist/styles/color.d.ts +0 -14
  216. package/dist/styles/color.js +0 -26
  217. package/dist/styles/color.js.map +0 -1
  218. package/dist/styles/const.js +0 -17
  219. package/dist/styles/const.js.map +0 -1
  220. package/dist/styles/createStyle.js +0 -79
  221. package/dist/styles/createStyle.js.map +0 -1
  222. package/dist/styles/dimension.js +0 -109
  223. package/dist/styles/dimension.js.map +0 -1
  224. package/dist/styles/directional.js +0 -133
  225. package/dist/styles/directional.js.map +0 -1
  226. package/dist/styles/display.d.ts +0 -30
  227. package/dist/styles/display.js +0 -73
  228. package/dist/styles/display.js.map +0 -1
  229. package/dist/styles/fade.d.ts +0 -15
  230. package/dist/styles/fade.js +0 -62
  231. package/dist/styles/fade.js.map +0 -1
  232. package/dist/styles/fill.d.ts +0 -42
  233. package/dist/styles/fill.js +0 -51
  234. package/dist/styles/fill.js.map +0 -1
  235. package/dist/styles/flow.d.ts +0 -16
  236. package/dist/styles/flow.js +0 -12
  237. package/dist/styles/flow.js.map +0 -1
  238. package/dist/styles/gap.d.ts +0 -31
  239. package/dist/styles/gap.js +0 -38
  240. package/dist/styles/gap.js.map +0 -1
  241. package/dist/styles/height.d.ts +0 -17
  242. package/dist/styles/height.js +0 -19
  243. package/dist/styles/height.js.map +0 -1
  244. package/dist/styles/index.d.ts +0 -1
  245. package/dist/styles/index.js +0 -8
  246. package/dist/styles/index.js.map +0 -1
  247. package/dist/styles/inset.d.ts +0 -24
  248. package/dist/styles/inset.js +0 -34
  249. package/dist/styles/inset.js.map +0 -1
  250. package/dist/styles/list.d.ts +0 -16
  251. package/dist/styles/list.js +0 -100
  252. package/dist/styles/list.js.map +0 -1
  253. package/dist/styles/margin.d.ts +0 -24
  254. package/dist/styles/margin.js +0 -32
  255. package/dist/styles/margin.js.map +0 -1
  256. package/dist/styles/outline.d.ts +0 -29
  257. package/dist/styles/outline.js +0 -55
  258. package/dist/styles/outline.js.map +0 -1
  259. package/dist/styles/padding.d.ts +0 -24
  260. package/dist/styles/padding.js +0 -32
  261. package/dist/styles/padding.js.map +0 -1
  262. package/dist/styles/placement.d.ts +0 -37
  263. package/dist/styles/placement.js +0 -74
  264. package/dist/styles/placement.js.map +0 -1
  265. package/dist/styles/predefined.d.ts +0 -71
  266. package/dist/styles/predefined.js +0 -237
  267. package/dist/styles/predefined.js.map +0 -1
  268. package/dist/styles/preset.d.ts +0 -52
  269. package/dist/styles/preset.js +0 -127
  270. package/dist/styles/preset.js.map +0 -1
  271. package/dist/styles/radius.d.ts +0 -12
  272. package/dist/styles/radius.js +0 -83
  273. package/dist/styles/radius.js.map +0 -1
  274. package/dist/styles/scrollMargin.d.ts +0 -24
  275. package/dist/styles/scrollMargin.js +0 -32
  276. package/dist/styles/scrollMargin.js.map +0 -1
  277. package/dist/styles/scrollbar.d.ts +0 -25
  278. package/dist/styles/scrollbar.js +0 -51
  279. package/dist/styles/scrollbar.js.map +0 -1
  280. package/dist/styles/shadow.d.ts +0 -14
  281. package/dist/styles/shadow.js +0 -25
  282. package/dist/styles/shadow.js.map +0 -1
  283. package/dist/styles/shared.js +0 -17
  284. package/dist/styles/shared.js.map +0 -1
  285. package/dist/styles/transition.d.ts +0 -14
  286. package/dist/styles/transition.js +0 -159
  287. package/dist/styles/transition.js.map +0 -1
  288. package/dist/styles/types.d.ts +0 -564
  289. package/dist/styles/width.d.ts +0 -17
  290. package/dist/styles/width.js +0 -19
  291. package/dist/styles/width.js.map +0 -1
  292. package/dist/tasty.d.ts +0 -134
  293. package/dist/tasty.js +0 -248
  294. package/dist/tasty.js.map +0 -1
  295. package/dist/types.d.ts +0 -184
  296. package/dist/utils/cache-wrapper.js +0 -21
  297. package/dist/utils/cache-wrapper.js.map +0 -1
  298. package/dist/utils/case-converter.js +0 -8
  299. package/dist/utils/case-converter.js.map +0 -1
  300. package/dist/utils/color-math.d.ts +0 -46
  301. package/dist/utils/color-math.js +0 -749
  302. package/dist/utils/color-math.js.map +0 -1
  303. package/dist/utils/color-space.d.ts +0 -5
  304. package/dist/utils/color-space.js +0 -228
  305. package/dist/utils/color-space.js.map +0 -1
  306. package/dist/utils/colors.d.ts +0 -5
  307. package/dist/utils/colors.js +0 -10
  308. package/dist/utils/colors.js.map +0 -1
  309. package/dist/utils/css-types.d.ts +0 -7
  310. package/dist/utils/deps-equal.js +0 -15
  311. package/dist/utils/deps-equal.js.map +0 -1
  312. package/dist/utils/dotize.d.ts +0 -26
  313. package/dist/utils/dotize.js +0 -122
  314. package/dist/utils/dotize.js.map +0 -1
  315. package/dist/utils/filter-base-props.d.ts +0 -15
  316. package/dist/utils/filter-base-props.js +0 -45
  317. package/dist/utils/filter-base-props.js.map +0 -1
  318. package/dist/utils/get-display-name.d.ts +0 -7
  319. package/dist/utils/get-display-name.js +0 -10
  320. package/dist/utils/get-display-name.js.map +0 -1
  321. package/dist/utils/has-keys.js +0 -13
  322. package/dist/utils/has-keys.js.map +0 -1
  323. package/dist/utils/hash.js +0 -14
  324. package/dist/utils/hash.js.map +0 -1
  325. package/dist/utils/is-dev-env.js +0 -19
  326. package/dist/utils/is-dev-env.js.map +0 -1
  327. package/dist/utils/is-valid-element-type.js +0 -15
  328. package/dist/utils/is-valid-element-type.js.map +0 -1
  329. package/dist/utils/merge-styles.js.map +0 -1
  330. package/dist/utils/mod-attrs.d.ts +0 -6
  331. package/dist/utils/mod-attrs.js +0 -20
  332. package/dist/utils/mod-attrs.js.map +0 -1
  333. package/dist/utils/process-tokens.d.ts +0 -17
  334. package/dist/utils/process-tokens.js +0 -83
  335. package/dist/utils/process-tokens.js.map +0 -1
  336. package/dist/utils/resolve-recipes.d.ts +0 -17
  337. package/dist/utils/resolve-recipes.js.map +0 -1
  338. package/dist/utils/selector-transform.js +0 -32
  339. package/dist/utils/selector-transform.js.map +0 -1
  340. package/dist/utils/string.js +0 -8
  341. package/dist/utils/string.js.map +0 -1
  342. package/dist/utils/styles.d.ts +0 -99
  343. package/dist/utils/styles.js +0 -220
  344. package/dist/utils/styles.js.map +0 -1
  345. package/dist/utils/typography.d.ts +0 -58
  346. package/dist/utils/typography.js +0 -51
  347. package/dist/utils/typography.js.map +0 -1
  348. package/dist/utils/warnings.d.ts +0 -16
  349. package/dist/utils/warnings.js +0 -16
  350. package/dist/utils/warnings.js.map +0 -1
  351. package/dist/zero/css-writer.d.ts +0 -45
  352. package/dist/zero/css-writer.js +0 -73
  353. package/dist/zero/css-writer.js.map +0 -1
  354. package/dist/zero/extractor.d.ts +0 -24
  355. package/dist/zero/extractor.js.map +0 -1
  356. package/docs/PIPELINE.md +0 -519
@@ -0,0 +1,1521 @@
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/batch.d.ts
26
+ /**
27
+ * Deferred CSSOM writes ("batched injection").
28
+ *
29
+ * Every `insertRule()` on a live stylesheet invalidates style for the sheet's
30
+ * scope, so Blink recalculates style the next time anything reads layout or
31
+ * computed style. When components inject during React's render phase and other
32
+ * components read layout in the same pass, the two interleave:
33
+ *
34
+ * inject -> read (forced recalc) -> inject -> read (forced recalc) -> ...
35
+ *
36
+ * Batching moves every sheet write out from between those reads. Writes are
37
+ * queued in FIFO order and drained in one go, so the tree is invalidated once
38
+ * per flush instead of once per component.
39
+ *
40
+ * ## Ordering
41
+ *
42
+ * A single queue holds *all* writes — component rules, global rules, keyframes,
43
+ * `@property`, `@font-face`, `@counter-style`, `@function` and raw CSS. Draining
44
+ * it in insertion order keeps the sheet byte-identical to unbatched output,
45
+ * which matters because equal-specificity rules resolve by document order.
46
+ *
47
+ * ## Batch windows — why queuing is safe
48
+ *
49
+ * Deferring a write past React's layout phase would let a `useLayoutEffect`
50
+ * measure an element whose rules are not in the sheet yet, reading the unstyled
51
+ * box. `<TastyBatchProvider>` closes that hole by opening a *window* during its
52
+ * render and closing it — flushing — in its `useInsertionEffect`, which React
53
+ * runs in the mutation phase, before any layout effect:
54
+ *
55
+ * provider renders -> window OPEN
56
+ * children render -> injections queued
57
+ * provider insertionEffect -> FLUSH, window CLOSED
58
+ * layout effects run -> rules are in the sheet
59
+ *
60
+ * So in the default (`batchInjection: true`) mode a write is only ever queued
61
+ * inside a commit whose flush is already guaranteed by that same commit. Every
62
+ * injection outside a window — a deep update the provider did not re-render
63
+ * for, a `useLayoutEffect` that injects, an event handler, an async callback —
64
+ * is written straight through, exactly as with batching off.
65
+ *
66
+ * `batchInjection: 'always'` opts out of the gate and queues unconditionally.
67
+ * That wins on more commits, at the cost of the measurement hazard above.
68
+ *
69
+ * ## Flush points (earliest wins)
70
+ *
71
+ * 1. `<TastyBatchProvider>`'s `useInsertionEffect` — closes the window.
72
+ * 2. A microtask — a backstop for a render that was aborted or suspended and
73
+ * therefore never reached its insertion effect. An aborted render mounts
74
+ * nothing, so nothing can measure what it queued. Microtasks also always
75
+ * drain before paint, so styles are never visually missing.
76
+ * 3. `flushStyles()` — explicit, and called internally by every injector read
77
+ * API (`getCSSText`, `cleanup`, `gc`, `destroy`, ...).
78
+ */
79
+ interface QueuedWrite {
80
+ /** Perform the deferred sheet write. */
81
+ run: () => void;
82
+ /** Set when the owner disposed before the write happened. */
83
+ cancelled: boolean;
84
+ /** Set once the write has been applied (or skipped as cancelled). */
85
+ done: boolean;
86
+ }
87
+ /** Whether any write is still waiting to hit a stylesheet. */
88
+ declare function hasPendingStyleWrites(): boolean;
89
+ /**
90
+ * Drain every pending sheet write, in insertion order.
91
+ *
92
+ * Safe to call when the queue is empty (the common case, so the guard comes
93
+ * first) and safe to call re-entrantly: a nested `flushStyles()` is a no-op,
94
+ * and work a draining write triggers is written in place by
95
+ * `enqueueStyleWrite` rather than queued behind the rest of the batch.
96
+ */
97
+ declare function flushStyles(): void;
98
+ /**
99
+ * Drop every pending write without applying it. Test helper — production code
100
+ * should call `flushStyles()` instead.
101
+ */
102
+ declare function resetStyleBatch(): void;
103
+ //#endregion
104
+ //#region src/injector/types.d.ts
105
+ declare global {
106
+ interface Window {
107
+ __TASTY__?: string[];
108
+ }
109
+ }
110
+ interface InjectResult {
111
+ className: string;
112
+ dispose: () => void;
113
+ }
114
+ interface GlobalInjectResult {
115
+ dispose: () => void;
116
+ }
117
+ type DisposeFunction = () => void;
118
+ interface StyleInjectorConfig {
119
+ nonce?: string;
120
+ maxRulesPerSheet?: number;
121
+ forceTextInjection?: boolean;
122
+ /** Enable development mode features: performance metrics and debug information storage */
123
+ devMode?: boolean;
124
+ /**
125
+ * Global predefined states for advanced state mapping.
126
+ * These are state aliases that can be used in any component.
127
+ * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
128
+ */
129
+ states?: Record<string, string>;
130
+ /**
131
+ * Automatically infer and register CSS @property declarations
132
+ * from custom property values. When false, only explicit @property are used.
133
+ * @default true
134
+ */
135
+ autoPropertyTypes?: boolean;
136
+ /** Garbage collection configuration for unused styles */
137
+ gc?: GCConfig;
138
+ /**
139
+ * Prefix prepended to every generated identifier.
140
+ * Mirrors the `namePrefix` field on the public `TastyConfig` so that
141
+ * standalone injector consumers can configure it directly.
142
+ * @default 't'
143
+ */
144
+ namePrefix?: string;
145
+ /**
146
+ * Defer stylesheet writes and apply them in one batch instead of one
147
+ * `insertRule()` per component. Mirrors `batchInjection` on the public
148
+ * `TastyConfig`.
149
+ * @default false
150
+ */
151
+ batchInjection?: boolean | 'always';
152
+ }
153
+ /**
154
+ * Per-className usage tracking for GC.
155
+ */
156
+ interface StyleUsage {
157
+ lastTouchedAt: number;
158
+ }
159
+ /**
160
+ * Configuration for the style garbage collector.
161
+ *
162
+ * GC is triggered by touch count rather than timers: every `touchInterval`
163
+ * touches, an idle callback is scheduled to evict unused styles above
164
+ * `capacity`, oldest first.
165
+ */
166
+ interface GCConfig {
167
+ /**
168
+ * Number of touch events between GC cycles.
169
+ * @default 1000
170
+ */
171
+ touchInterval?: number;
172
+ /**
173
+ * Maximum number of unused styles to retain.
174
+ * GC evicts the oldest unused styles when this limit is exceeded.
175
+ * Actively referenced styles (refCount > 0) and DOM-live styles
176
+ * do not count against this limit.
177
+ * @default 1000
178
+ */
179
+ capacity?: number;
180
+ }
181
+ /**
182
+ * Per-call options for gc().
183
+ */
184
+ interface GCOptions {
185
+ root?: Document | ShadowRoot;
186
+ /** Bypass capacity threshold and remove ALL unused styles. */
187
+ force?: boolean;
188
+ }
189
+ interface RuleInfo {
190
+ className: string;
191
+ ruleIndex: number;
192
+ sheetIndex: number;
193
+ /** Dev-only: full CSS texts inserted for this class; omitted in production */
194
+ cssText?: string[];
195
+ /** Inclusive end index of the contiguous block of inserted rules for this className */
196
+ endRuleIndex?: number;
197
+ /** NEW: exact indices of all inserted rules for this className */
198
+ indices?: number[];
199
+ }
200
+ type InjectionMode = 'style-element' | 'adopted';
201
+ interface SheetInfo {
202
+ /** HTMLStyleElement used in style-element mode; null in adopted mode. */
203
+ sheet: HTMLStyleElement | null;
204
+ /** Constructable CSSStyleSheet used in adopted mode (ShadowRoot targets) */
205
+ constructableSheet?: CSSStyleSheet;
206
+ ruleCount: number;
207
+ holes: number[];
208
+ /**
209
+ * True when this sheet is written through `textContent` instead of CSSOM.
210
+ * Decided once at sheet creation so a sheet is never half CSSOM / half text.
211
+ */
212
+ textMode?: boolean;
213
+ /**
214
+ * Inserted rule texts in rule-index order. Maintained only in text mode —
215
+ * it is what makes deletion possible there, since `textContent` cannot be
216
+ * edited rule-by-rule and has to be rebuilt.
217
+ */
218
+ textRules?: string[];
219
+ }
220
+ interface CleanupStats {
221
+ timestamp: number;
222
+ classesDeleted: number;
223
+ cssSize: number;
224
+ rulesDeleted: number;
225
+ }
226
+ interface CacheMetrics {
227
+ hits: number;
228
+ misses: number;
229
+ bulkCleanups: number;
230
+ totalInsertions: number;
231
+ totalUnused: number;
232
+ stylesCleanedUp: number;
233
+ cleanupHistory: CleanupStats[];
234
+ startTime: number;
235
+ unusedHits?: number;
236
+ }
237
+ interface RootRegistry {
238
+ sheets: SheetInfo[];
239
+ refCounts: Map<string, number>;
240
+ rules: Map<string, RuleInfo>;
241
+ /** Cache key to className mapping to avoid dual storage of RuleInfo objects */
242
+ cacheKeyToClassName: Map<string, string>;
243
+ /** Deduplication set of fully materialized CSS rules inserted into sheets */
244
+ ruleTextSet: Set<string>;
245
+ /** Performance metrics (optional) */
246
+ metrics?: CacheMetrics;
247
+ /** Keyframes cache by content hash -> entry */
248
+ keyframesCache: Map<string, KeyframesCacheEntry>;
249
+ /** Keyframes name to content hash mapping for collision detection */
250
+ keyframesNameToContent: Map<string, string>;
251
+ /** Counter for generating keyframes names like k0, k1, k2... */
252
+ keyframesCounter: number;
253
+ /** Map of injected @property names to their normalized declarations for tracking */
254
+ injectedProperties: Map<string, string>;
255
+ /** Content hashes of injected @font-face rules for deduplication */
256
+ injectedFontFaces: Set<string>;
257
+ /**
258
+ * Injected @counter-style rules. Maps the name to whether it was injected
259
+ * "strong" (`true`, the default — overrides) or "weak" (`false`, global
260
+ * `configure()` definitions that never clobber an existing rule).
261
+ */
262
+ injectedCounterStyles: Map<string, boolean>;
263
+ /**
264
+ * Injected @function rules. Maps the CSS function name to whether it was
265
+ * injected "strong" (`true`, the default — overrides) or "weak" (`false`,
266
+ * global `configure()` definitions that never clobber an existing rule).
267
+ */
268
+ injectedFunctions: Map<string, boolean>;
269
+ /** Global rules tracking for index adjustment */
270
+ globalRules: Map<string, RuleInfo>;
271
+ /** Resolver for auto-inferring @property types from declaration values */
272
+ propertyTypeResolver: PropertyTypeResolver;
273
+ /** Per-className usage tracking for GC */
274
+ usageMap: Map<string, StyleUsage>;
275
+ /** Touch counter for scheduling GC (per-root) */
276
+ touchCount: number;
277
+ /**
278
+ * Millisecond that `touchedTick` refers to. `touch()` only ever stamps
279
+ * `lastTouchedAt` with the current millisecond, so a repeat touch of the same
280
+ * class name inside one millisecond is a no-op worth skipping.
281
+ */
282
+ touchTick: number;
283
+ /** Class-name strings already touched during `touchTick`. */
284
+ touchedTick: Set<string>;
285
+ /** How many entries from `window.__TASTY__` have been synced into this registry */
286
+ serverClassSyncIndex: number;
287
+ /** Whether `<style data-tasty-rsc>` tags have been scanned for class names */
288
+ rscStylesScanned: boolean;
289
+ /** Whether this root uses adoptedStyleSheets or <style> elements */
290
+ injectionMode: InjectionMode;
291
+ /**
292
+ * Lazy feature-test for `@property` support, cached per registry.
293
+ * - `undefined`: not yet probed.
294
+ * - `true`: engine supports `@property`; rejections indicate user-authored
295
+ * invalid rules and should warn.
296
+ * - `false`: engine doesn't support `@property` (e.g., jsdom); rejections
297
+ * are expected and warnings are suppressed.
298
+ */
299
+ atPropertySupported?: boolean;
300
+ }
301
+ type StyleRule = StyleResult;
302
+ interface KeyframesInfo {
303
+ name: string;
304
+ sheetIndex: number;
305
+ ruleIndex: number;
306
+ /** Dev-only: full CSS text of the @keyframes rule; omitted in production */
307
+ cssText?: string;
308
+ }
309
+ type KeyframeStep = string | Record<string, string | number>;
310
+ type KeyframesSteps = Record<string, KeyframeStep>;
311
+ interface KeyframesResult {
312
+ toString(): string;
313
+ dispose: () => void;
314
+ }
315
+ interface KeyframesCacheEntry {
316
+ name: string;
317
+ refCount: number;
318
+ info: KeyframesInfo;
319
+ /**
320
+ * Queued sheet write, when `batchInjection` deferred the insertion. Present
321
+ * only between `keyframes()` and the flush; disposing in that window cancels
322
+ * the write instead of deleting a rule that was never inserted.
323
+ */
324
+ pending?: QueuedWrite;
325
+ }
326
+ /**
327
+ * Definition for a CSS @property at-rule.
328
+ * Used to define custom property syntax, inheritance, and initial value.
329
+ */
330
+ interface PropertyDefinition {
331
+ /** CSS syntax string (e.g., '<color>', '<angle>', '<number>') */
332
+ syntax?: string;
333
+ /** Whether the property inherits (default: true) */
334
+ inherits?: boolean;
335
+ /** Initial value for the property */
336
+ initialValue?: string | number;
337
+ }
338
+ /**
339
+ * Options for registering a CSS `@property`.
340
+ * Extends {@link PropertyDefinition} with an optional injection root.
341
+ */
342
+ interface PropertyOptions extends PropertyDefinition {
343
+ /** Shadow root or document to inject into */
344
+ root?: Document | ShadowRoot;
345
+ }
346
+ /**
347
+ * A single parameter for a CSS @function at-rule.
348
+ *
349
+ * - `true` — a bare parameter with no type or default.
350
+ * - `string` — a CSS type shorthand (e.g. `'<length>'`, `'<color>'`).
351
+ * - object — full form with optional `syntax` (type) and `default` value.
352
+ */
353
+ type FunctionParameter = true | string | {
354
+ syntax?: string;
355
+ default?: string | number;
356
+ };
357
+ /**
358
+ * Definition for a CSS @function at-rule (custom function).
359
+ *
360
+ * The descriptor body reads like a mini styles object: any `$name` key declares
361
+ * a local variable (`--name`) whose value is parsed through the Tasty DSL.
362
+ * `result` is the only required field.
363
+ *
364
+ * @example
365
+ * ```ts
366
+ * // @function --negative(--value) { result: calc(-1 * var(--value)); }
367
+ * { args: ['$value'], result: '(-1 * $value)' }
368
+ * ```
369
+ */
370
+ interface FunctionDefinition {
371
+ /**
372
+ * Ordered parameters. Array form lists bare parameter names (`['$value']`);
373
+ * object form maps each parameter name to its type/default.
374
+ */
375
+ args?: string[] | Record<string, FunctionParameter>;
376
+ /** Optional return type, e.g. `'<color>'`. */
377
+ returns?: string;
378
+ /** The `result:` descriptor value (parsed through the Tasty DSL). Required. */
379
+ result: string;
380
+ /** Local variables: any `$name` key declares `--name` in the body. */
381
+ [localVar: `$${string}`]: string | number | undefined;
382
+ }
383
+ /**
384
+ * Descriptors for a CSS @font-face at-rule.
385
+ */
386
+ interface FontFaceDescriptors {
387
+ /** Required. URL(s) to the font file(s). */
388
+ src: string;
389
+ /** Font weight or range. Default: 'normal'. */
390
+ fontWeight?: string | number;
391
+ /** Font style. Default: 'normal'. */
392
+ fontStyle?: 'normal' | 'italic' | 'oblique' | (string & {});
393
+ /** Font stretch. Default: 'normal'. */
394
+ fontStretch?: string;
395
+ /** Loading behavior. Default: 'auto'. */
396
+ fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
397
+ /** Unicode range to cover. */
398
+ unicodeRange?: string;
399
+ /** Ascent metric override. */
400
+ ascentOverride?: string;
401
+ /** Descent metric override. */
402
+ descentOverride?: string;
403
+ /** Line gap metric override. */
404
+ lineGapOverride?: string;
405
+ /** Size adjustment factor. */
406
+ sizeAdjust?: string;
407
+ /** OpenType feature settings. */
408
+ fontFeatureSettings?: string;
409
+ /** Font variation axis settings. */
410
+ fontVariationSettings?: string;
411
+ }
412
+ /** Single descriptor or array of descriptors for multiple weights/styles. */
413
+ type FontFaceInput = FontFaceDescriptors | FontFaceDescriptors[];
414
+ /**
415
+ * Descriptors for a CSS @counter-style at-rule.
416
+ */
417
+ interface CounterStyleDescriptors {
418
+ /** Required. Numbering algorithm. */
419
+ system: 'cyclic' | 'numeric' | 'alphabetic' | 'symbolic' | 'additive' | 'fixed' | (string & {});
420
+ /** Symbols for non-additive systems. */
421
+ symbols?: string;
422
+ /** Symbol-value pairs for additive system. */
423
+ additiveSymbols?: string;
424
+ /** String prepended to the marker. Default: "". */
425
+ prefix?: string;
426
+ /** String appended to the marker. Default: ". ". */
427
+ suffix?: string;
428
+ /** Negative-value wrapping (e.g., '"(" ")"'). */
429
+ negative?: string;
430
+ /** Counter range (e.g., 'infinite infinite'). */
431
+ range?: string;
432
+ /** Minimum marker width and pad symbol (e.g., '3 "0"'). */
433
+ pad?: string;
434
+ /** Fallback counter style name. */
435
+ fallback?: string;
436
+ /** Speech synthesis hint. */
437
+ speakAs?: string;
438
+ }
439
+ interface RawCSSResult {
440
+ dispose: () => void;
441
+ }
442
+ //#endregion
443
+ //#region src/utils/css-types.d.ts
444
+ interface CSSProperties extends Properties<string | number> {}
445
+ //#endregion
446
+ //#region src/parser/types.d.ts
447
+ /**
448
+ * A part within a group, representing a slash-separated segment.
449
+ * For example, in `'2px solid #red / 4px'`, there are two parts:
450
+ * - Part 0: `2px solid #red`
451
+ * - Part 1: `4px`
452
+ */
453
+ interface StyleDetailsPart {
454
+ mods: string[];
455
+ values: string[];
456
+ colors: string[];
457
+ all: string[];
458
+ output: string;
459
+ }
460
+ /**
461
+ * A group of style details, representing a comma-separated segment.
462
+ * Contains aggregated values from all parts for backward compatibility,
463
+ * plus the structured `parts` array for handlers that need slash separation.
464
+ */
465
+ interface StyleDetails {
466
+ input: string;
467
+ output: string;
468
+ /** Aggregated mods from all parts (backward compatible) */
469
+ mods: string[];
470
+ /** Aggregated values from all parts (backward compatible) */
471
+ values: string[];
472
+ /** Aggregated colors from all parts (backward compatible) */
473
+ colors: string[];
474
+ /** Aggregated all tokens from all parts (backward compatible) */
475
+ all: string[];
476
+ /** Slash-separated parts within this group */
477
+ parts: StyleDetailsPart[];
478
+ }
479
+ interface ProcessedStyle {
480
+ output: string;
481
+ groups: StyleDetails[];
482
+ }
483
+ type UnitHandler = (scalar: number) => string;
484
+ interface ParserOptions {
485
+ functions?: Record<string, (parsed: StyleDetails[]) => string>;
486
+ units?: Record<string, string | UnitHandler>;
487
+ cacheSize?: number;
488
+ }
489
+ //#endregion
490
+ //#region src/parser/parser.d.ts
491
+ declare class StyleParser {
492
+ private opts;
493
+ private cache;
494
+ constructor(opts?: ParserOptions);
495
+ process(src: string): ProcessedStyle;
496
+ setFunctions(functions: Required<ParserOptions>['functions']): void;
497
+ setUnits(units: Required<ParserOptions>['units']): void;
498
+ updateOptions(patch: Partial<ParserOptions>): void;
499
+ /**
500
+ * Clear the parser cache.
501
+ * Call this when external state that affects parsing results has changed
502
+ * (e.g., predefined tokens).
503
+ */
504
+ clearCache(): void;
505
+ /**
506
+ * Get the current units configuration.
507
+ */
508
+ getUnits(): ParserOptions['units'];
509
+ }
510
+ //#endregion
511
+ //#region src/utils/color-math.d.ts
512
+ /**
513
+ * Consolidated color conversion math.
514
+ *
515
+ * Single source of truth for all color space conversions used across the
516
+ * library: sRGB gamma, HSL, OKLab, OKLCH, OKHSL, hex parsing, named
517
+ * colors, and CSS string converters.
518
+ *
519
+ * This module has zero internal imports — it is a leaf dependency.
520
+ *
521
+ * Reference: https://bottosson.github.io/posts/oklab/
522
+ */
523
+ type Vec3 = [number, number, number];
524
+ /**
525
+ * sRGB gamma to linear. Only the sRGB-to-OKLab direction needs it, so this is
526
+ * test-only for the same reason as {@link srgbToOkhsl} — the forward path goes
527
+ * through {@link srgbLinearToGamma} instead.
528
+ */
529
+ /**
530
+ * HSL to RGB.
531
+ * Algorithm from CSS Color 4 spec.
532
+ *
533
+ * @param h - Hue in degrees (0-360)
534
+ * @param s - Saturation (0-1)
535
+ * @param l - Lightness (0-1)
536
+ * @returns RGB values in 0-255 range (may have fractional values)
537
+ */
538
+ declare function hslToRgbValues(h: number, s: number, l: number): Vec3;
539
+ declare function getNamedColorHex(): Map<string, string>;
540
+ /**
541
+ * Convert hex color string to `rgb()` CSS string.
542
+ * Supports 3, 4, 6, and 8 character hex values (with or without `#`).
543
+ */
544
+ declare function hexToRgb(hex: string): string | null;
545
+ /**
546
+ * Extract RGB values from an `rgb()`/`rgba()` string.
547
+ * Supports comma-separated, space-separated, fractional, percentage,
548
+ * and slash alpha notation.
549
+ *
550
+ * @returns Array of RGB values (0-255 range), converting percentages as needed.
551
+ */
552
+ declare function getRgbValuesFromRgbaString(str: string): number[];
553
+ /**
554
+ * Convert any recognized color string to an `rgb()` CSS string.
555
+ * Handles hex, `okhsl()`, `okhst()`, `hsl()`/`hsla()`, named CSS colors,
556
+ * and `rgb()`/`rgba()` pass-through.
557
+ */
558
+ declare function strToRgb(color: string, _ignoreAlpha?: boolean): string | null | undefined;
559
+ //#endregion
560
+ //#region src/utils/styles.d.ts
561
+ type StyleValue<T = string> = T | boolean | number | null | undefined;
562
+ /**
563
+ * Normalize a color token value.
564
+ * - Boolean `true` is converted to `'transparent'`
565
+ * - Boolean `false` returns `null` (signals the token should be skipped)
566
+ * - Other values are returned as-is
567
+ *
568
+ * @param value - The raw token value
569
+ * @returns Normalized value or null if the token should be skipped
570
+ */
571
+ declare function normalizeColorTokenValue<T>(value: T | boolean): T | 'transparent' | null;
572
+ type StyleValueStateMap<T = string> = Record<string, StyleValue<T> | '@inherit'>;
573
+ /**
574
+ * Combined type for style values that can be either a direct value or a state map.
575
+ * Use this for component props that accept style values.
576
+ */
577
+ type StylePropValue<T = string> = StyleValue<T> | StyleValueStateMap<T>;
578
+ /**
579
+ * One dependency value as a style handler receives it: already resolved for a
580
+ * single state, but still the **raw authored DSL string** (`'2x'`, `'#purple.5'`).
581
+ * Handlers parse it themselves via {@link parseStyle} / {@link parseColor}.
582
+ */
583
+ type ResolvedStyleValue = StyleValue<string>;
584
+ /**
585
+ * The dependency map a handler receives — one resolved value per style name in
586
+ * its `__lookupStyles`.
587
+ */
588
+ type StyleHandlerProps<TDeps extends string = string> = Partial<Record<TDeps, ResolvedStyleValue>>;
589
+ /**
590
+ * One set of CSS declarations returned by a style handler.
591
+ *
592
+ * Keys are **kebab-case** CSS property names (`'background-color'`, not
593
+ * `backgroundColor`) or `--custom-property` names. Values are stringified, so
594
+ * numbers are accepted. `$` is reserved as a selector suffix.
595
+ */
596
+ type CSSMap = {
597
+ /** Selector suffix (or suffixes) these declarations apply to, e.g. `'& > *'`. */$?: string | string[];
598
+ } & Record<string, string | number | (string | number)[] | undefined>;
599
+ type StyleHandlerResult = CSSMap | CSSMap[] | null | void;
600
+ type RawStyleHandler<TProps extends object = StyleHandlerProps> = (props: TProps) => StyleHandlerResult;
601
+ type StyleHandler<TProps extends object = StyleHandlerProps> = RawStyleHandler<TProps> & {
602
+ __lookupStyles: string[];
603
+ };
604
+ /**
605
+ * The handler type used by the registry (`STYLE_HANDLER_MAP`), with parameter
606
+ * variance erased.
607
+ *
608
+ * Handlers declare narrow, hand-written dependency types — `({ fill }: { fill?:
609
+ * string }) => …` — which under `strictFunctionTypes` are not assignable to a
610
+ * wider parameter type. The registry stores handlers of many different dependency
611
+ * shapes together, so it needs the erased form. Prefer {@link StyleHandler} (or
612
+ * {@link defineHandler}) when writing a handler; this type is for code that
613
+ * inspects the registry.
614
+ */
615
+ type AnyStyleHandler = ((props: any) => StyleHandlerResult) & {
616
+ __lookupStyles: string[];
617
+ };
618
+ /**
619
+ * Handler definition forms for configure() and plugins.
620
+ * - Function only: lookup styles inferred from key name
621
+ * - Single property tuple: ['styleName', handler]
622
+ * - Multi-property tuple: [['style1', 'style2'], handler]
623
+ *
624
+ * Use {@link defineHandler} to have the dependency names inferred into the
625
+ * handler's parameter type instead of annotating it by hand.
626
+ */
627
+ type StyleHandlerDefinition<TDeps extends string = string> = RawStyleHandler<StyleHandlerProps<TDeps>> | [TDeps, RawStyleHandler<StyleHandlerProps<TDeps>>] | [readonly TDeps[], RawStyleHandler<StyleHandlerProps<TDeps>>];
628
+ interface ParsedColor {
629
+ color?: string;
630
+ name?: string;
631
+ opacity?: number;
632
+ }
633
+ type StyleMap = Record<string, StyleValue | StyleValueStateMap>;
634
+ declare const CUSTOM_UNITS: {
635
+ r: string;
636
+ cr: string;
637
+ bw: string;
638
+ ow: string;
639
+ x: string;
640
+ sf: (num: number) => string;
641
+ };
642
+ declare const DIRECTIONS: string[];
643
+ /**
644
+ * Get the global StyleParser instance.
645
+ * Used by configure() to apply parser configuration.
646
+ */
647
+ declare function getGlobalParser(): StyleParser;
648
+ /**
649
+ * Get the current global predefined tokens.
650
+ * Returns null if no tokens are configured.
651
+ */
652
+ declare function getGlobalPredefinedTokens(): Record<string, string> | null;
653
+ /**
654
+ *
655
+ * @param {String} value
656
+ * @param {Number} mode
657
+ * @returns {Object<String,String|Array>}
658
+ */
659
+ declare function parseStyle(value: StyleValue): ProcessedStyle;
660
+ /**
661
+ * Parse color. Find it value, name and opacity.
662
+ * Optimized to avoid heavy parseStyle calls for simple color patterns.
663
+ */
664
+ declare function parseColor(val: string, ignoreError?: boolean): ParsedColor;
665
+ declare function filterMods(mods: string[], allowedMods: string[]): string[];
666
+ declare function stringifyStyles(styles: unknown): string;
667
+ //#endregion
668
+ //#region src/styles/types.d.ts
669
+ /**
670
+ * Extensible interface for named color tokens.
671
+ * Augment this interface to register project-specific color names
672
+ * for autocomplete in `fill`, `color`, `svgFill`, and other color style props.
673
+ *
674
+ * @example
675
+ * ```typescript
676
+ * declare module '@tenphi/tasty' {
677
+ * interface TastyNamedColors {
678
+ * primary: true;
679
+ * danger: true;
680
+ * }
681
+ * }
682
+ * ```
683
+ */
684
+ interface TastyNamedColors {}
685
+ type NamedColorKey = Extract<keyof TastyNamedColors, string>;
686
+ type NamedColor = [NamedColorKey] extends [never] ? string : NamedColorKey;
687
+ /**
688
+ * Extensible interface for typography preset names.
689
+ * Augment this interface to register project-specific preset names for autocomplete.
690
+ *
691
+ * @example
692
+ * ```typescript
693
+ * declare module '@tenphi/tasty' {
694
+ * interface TastyPresetNames {
695
+ * h1: true;
696
+ * t3: true;
697
+ * }
698
+ * }
699
+ * ```
700
+ */
701
+ interface TastyPresetNames {}
702
+ type PresetNameKey = Extract<keyof TastyPresetNames, string>;
703
+ type PresetName = [PresetNameKey] extends [never] ? string : PresetNameKey;
704
+ type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
705
+ type OpaquePercentage = '' | `.${Digit}` | `.${Digit}${Digit}` | '.100';
706
+ type ColorValue = `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `hsl(${string})` | `okhsl(${string})` | `oklch(${string})` | (string & {});
707
+ type NoType = false | null | undefined;
708
+ 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'> {
709
+ /**
710
+ * @deprecated Use `flow` style instead.
711
+ */
712
+ flexDirection: CSSProperties['flexDirection'];
713
+ /**
714
+ * @deprecated Use `placeContent`, `placeItems`, `gridColumns`, `gridRows`, and `gridTemplate` styles instead.
715
+ */
716
+ grid: CSSProperties['grid'];
717
+ /**
718
+ * @deprecated Use `flexShrink`, `flexGrow`, and `flexBasis` styles instead.
719
+ */
720
+ flex: CSSProperties['flex'];
721
+ /**
722
+ * Set the background color of the element. Shortcut for `background-color` with enhanced support for Tasty color tokens and syntaxes.
723
+ *
724
+ * Supports double-color syntax: the second color is applied as a foreground overlay via a CSS custom property.
725
+ *
726
+ * Examples:
727
+ * - `fill="#purple.10"` // purple background with 10% opacity
728
+ * - `fill="#danger"` // danger theme color
729
+ * - `fill="rgb(255 128 0)"` // custom RGB color
730
+ * - `fill="rgb(255 128 0 / 0.5)"` // RGB with opacity
731
+ * - `fill="hsl(200 100% 50%)"` // HSL color
732
+ * - `fill="okhsl(200 100% 50%)"` // perceptually uniform OKHSL color
733
+ * - `fill="oklch(0.7 0.15 200)"` // OKLCH color
734
+ * - `fill="#primary #secondary"` // double color (second as foreground overlay)
735
+ * - `fill={true}` // default fill color
736
+ */
737
+ fill?: ColorValue | boolean;
738
+ /**
739
+ * @deprecated Use `fill` instead.
740
+ */
741
+ backgroundColor?: CSSProperties['backgroundColor'];
742
+ /**
743
+ * Set the background image of the element. Shortcut for `background-image` with enhanced support for Tasty tokens.
744
+ *
745
+ * Examples:
746
+ * - `image="url(/path/to/image.png)"` // image from URL
747
+ * - `image="linear-gradient(to right, #purple, #danger)"` // gradient
748
+ */
749
+ image?: CSSProperties['backgroundImage'];
750
+ /**
751
+ * @deprecated Use `image` instead.
752
+ */
753
+ backgroundImage?: CSSProperties['backgroundImage'];
754
+ /**
755
+ * @deprecated Use separate background styles (`fill`, `image`, `backgroundSize`, etc.) instead.
756
+ * When set, overrides all other background-related styles.
757
+ */
758
+ background?: CSSProperties['background'];
759
+ /**
760
+ * Set the fill color of SVG elements. Outputs the native CSS `fill` property with enhanced support for Tasty color tokens and syntaxes.
761
+ *
762
+ * Examples:
763
+ * - `svgFill="#purple.10"` // purple fill with 10% opacity
764
+ * - `svgFill="#danger"` // danger theme color
765
+ * - `svgFill="rgb(255 128 0)"` // custom RGB color
766
+ * - `svgFill="hsl(200 100% 50%)"` // HSL color
767
+ * - `svgFill="okhsl(200 100% 50%)"` // OKHSL color
768
+ * - `svgFill="oklch(0.7 0.15 200)"` // OKLCH color
769
+ * - `svgFill="currentColor"` // inherit from parent color
770
+ */
771
+ svgFill?: ColorValue;
772
+ /**
773
+ * Set the text (current) color of the element. Shortcut for `color` with enhanced support for Tasty color tokens and syntaxes.
774
+ *
775
+ * Examples:
776
+ * - `color="#purple"` // purple text color
777
+ * - `color="#danger.6"` // danger color with 60% opacity
778
+ * - `color="rgb(255 128 0)"` // custom RGB color
779
+ * - `color="hsl(200 100% 50%)"` // HSL color
780
+ * - `color="okhsl(200 100% 50%)"` // OKHSL color
781
+ * - `color="oklch(0.7 0.15 200)"` // OKLCH color
782
+ * - `color="red"` // CSS color name
783
+ * - `color={true}` // currentColor
784
+ */
785
+ color?: ColorValue | boolean;
786
+ /**
787
+ * The fade style applies gradient-based fading masks to the edges of an element. Replaces complex CSS mask gradients with a simple, declarative API.
788
+ *
789
+ * Syntax: `[width] [direction...] [#from-color] [#to-color]`
790
+ *
791
+ * Multiple groups can be separated by commas to specify different widths and
792
+ * colors per direction. A group that names edges takes a single width, applied
793
+ * to every edge it names; a group that names none covers all four edges and
794
+ * keeps plain CSS shorthand order.
795
+ *
796
+ * Color tokens (optional):
797
+ * - First color: transparent start of gradient (default: `rgb(0 0 0 / 0)`)
798
+ * - Second color: opaque end of gradient (default: `rgb(0 0 0 / 1)`)
799
+ *
800
+ * Examples:
801
+ * - `fade="top"` // fade only top edge with default width
802
+ * - `fade="2x left right"` // fade left and right edges with 2x width
803
+ * - `fade={true}` // all edges at the design-system default width
804
+ * - `fade="1x top"` // fade only top edge with 1x width
805
+ * - `fade="3x 1x"` // all edges: top/bottom 3x, left/right 1x
806
+ * - `fade="3x top, 1x bottom"` // top: 3x width, bottom: 1x width
807
+ * - `fade="2x #transparent #dark"` // custom colors for gradient mask
808
+ * - `fade="1x top #clear #solid"` // top edge with custom mask colors
809
+ * - `fade="top #red #blue, bottom #green #yellow"` // different colors per direction
810
+ * - `fade="2x top #a #b, 1x bottom #c #d"` // different widths and colors per direction
811
+ */
812
+ fade?: 'top' | 'right' | 'bottom' | 'left' | string | boolean;
813
+ /**
814
+ * Scrollbar styling using standard CSS properties (`scrollbar-width`, `scrollbar-color`, `scrollbar-gutter`).
815
+ *
816
+ * Syntax: `[width] [modifiers...] [thumb-color] [track-color]`
817
+ *
818
+ * Width values: `thin` (default), `auto`, `none`
819
+ * Modifiers: `stable`, `both-edges`, `always`
820
+ *
821
+ * Examples:
822
+ * - `scrollbar={true}` // thin scrollbar, default colors
823
+ * - `scrollbar="thin #purple.40 #dark.04"`
824
+ * - `scrollbar="auto #red #blue"`
825
+ * - `scrollbar="none"`
826
+ * - `scrollbar="always #primary.50 #white.02"`
827
+ * - `scrollbar="thin stable #red #blue"`
828
+ */
829
+ scrollbar?: string | boolean;
830
+ /**
831
+ * Set font weight for bold texts.
832
+ */
833
+ boldFontWeight?: number;
834
+ /**
835
+ * The gap style is a powerful, cross-layout shorthand for spacing between child elements. Works with flex, grid, and block layouts.
836
+ *
837
+ * For flex/grid: sets native `gap` property
838
+ * For block layouts: emulated using margin on children
839
+ *
840
+ * Examples:
841
+ * - `gap="2x"` // gap: 2x (or margin-bottom: 2x for block)
842
+ * - `gap="1x 2x"` // row gap: 1x, column gap: 2x
843
+ * - `gap={true}` // default gap (1x)
844
+ */
845
+ gap?: CSSProperties['gap'] | string | boolean;
846
+ /**
847
+ * Shorthand for element padding. Supports custom units, directional modifiers, and design-system-driven defaults.
848
+ *
849
+ * A group that names directions takes a single value, applied to every
850
+ * direction it names — use comma groups for per-side values.
851
+ *
852
+ * Examples:
853
+ * - `padding="2x 1x"` // top/bottom: 2x, left/right: 1x
854
+ * - `padding="2x top"` // only top padding: 2x
855
+ * - `padding="1x left right"` // left and right padding: 1x
856
+ * - `padding="2x top, 4x right"` // top: 2x, right: 4x, bottom/left: 0
857
+ * - `padding={true}` // default padding on all sides
858
+ */
859
+ padding?: CSSProperties['padding'] | string | boolean;
860
+ /**
861
+ * Shorthand for element margin. Supports custom units, directional modifiers, and design-system-driven defaults.
862
+ *
863
+ * A group that names directions takes a single value, applied to every
864
+ * direction it names — use comma groups for per-side values.
865
+ *
866
+ * Examples:
867
+ * - `margin="2x 1x"` // top/bottom: 2x, left/right: 1x
868
+ * - `margin="2x top"` // only top margin: 2x
869
+ * - `margin="1x left right"` // left and right margin: 1x
870
+ * - `margin="2x top, 4x right"` // top: 2x, right: 4x, bottom/left: 0
871
+ * - `margin={true}` // default margin on all sides
872
+ */
873
+ margin?: CSSProperties['margin'] | string | boolean;
874
+ /**
875
+ * Concise shorthand for setting element width, including min-width and max-width. Supports custom units and advanced sizing keywords.
876
+ *
877
+ * Syntax: `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
878
+ *
879
+ * Modifiers: `min`, `max`
880
+ * Keywords: `stretch`, `max-content`, `min-content`, `fit-content`
881
+ *
882
+ * Examples:
883
+ * - `width="10x"` // width: 10x
884
+ * - `width="1x 10x"` // min-width: 1x; max-width: 10x
885
+ * - `width="min 2x"` // min-width: 2x
886
+ * - `width="stretch"` // width: stretch (fill-available)
887
+ * - `width={true}` // width: auto
888
+ */
889
+ width?: CSSProperties['width'] | string | boolean;
890
+ /**
891
+ * Concise shorthand for setting element height, including min-height and max-height. Supports custom units and advanced sizing keywords.
892
+ *
893
+ * Syntax: `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
894
+ *
895
+ * Modifiers: `min`, `max`
896
+ * Keywords: `stretch`, `max-content`, `min-content`, `fit-content`
897
+ *
898
+ * Examples:
899
+ * - `height="100px"` // height: 100px
900
+ * - `height="1x 5x 10x"` // min-height: 1x; height: 5x; max-height: 10x
901
+ * - `height="min 2x"` // min-height: 2x
902
+ * - `height={true}` // height: auto
903
+ */
904
+ height?: CSSProperties['height'] | string | boolean;
905
+ /**
906
+ * Shorthand for border width, style, and color. Supports directional modifiers and design-system defaults.
907
+ *
908
+ * Syntax: `[width] [style] [color] [directions]` | `[directions]` | `true`
909
+ *
910
+ * Multiple groups can be separated by commas. Later groups override earlier groups for conflicting directions.
911
+ *
912
+ * Examples:
913
+ * - `border={true}` // default border on all sides (1bw solid)
914
+ * - `border="2bw dashed #purple"` // 2bw dashed purple border
915
+ * - `border="2bw top"` // only top border: 2bw solid
916
+ * - `border="dotted #danger left right"` // left/right: 1bw dotted danger
917
+ * - `border="1bw #red, 2bw #blue top"` // all sides red 1bw, top overridden to blue 2bw
918
+ * - `border="1bw, dashed top bottom, #purple left right"` // base 1bw, dashed on top/bottom, purple on left/right
919
+ * - `border="1bw $my-style"` // custom property in the style slot
920
+ *
921
+ * A `$name` reference fills the first free slot — width, then style, then
922
+ * color. Colors are authored as `#name`; to point the color slot at a raw
923
+ * custom property directly, name it `$name-color`.
924
+ */
925
+ border?: CSSProperties['border'] | string | boolean;
926
+ /**
927
+ * Powerful shorthand for CSS transitions using semantic names and design tokens. Supports grouped transitions for common UI effects.
928
+ *
929
+ * Semantic names: `fade`, `fill`, `border`, `radius`, `shadow`, `preset`, `gap`, `theme`
930
+ * Multiple transitions: separated by commas
931
+ *
932
+ * Examples:
933
+ * - `transition="fill 0.2s, radius 0.3s"` // transitions background-color and border-radius
934
+ * - `transition="fade 0.15s ease-in"` // transitions mask with easing
935
+ * - `transition="theme 0.3s"` // transitions all theme-related properties
936
+ * - `transition="preset 0.2s"` // transitions typography properties
937
+ */
938
+ transition?: CSSProperties['transition'] | string;
939
+ /**
940
+ * Whether the element is hidden using `display: none`. Boolean shortcut for conditional element visibility.
941
+ *
942
+ * Examples:
943
+ * - `hide={true}` // display: none
944
+ * - `hide={false}` // element remains visible
945
+ */
946
+ hide?: boolean;
947
+ /**
948
+ * 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.
949
+ *
950
+ * Examples:
951
+ * - `shadow="1x .5x .5x #dark.50"` // custom shadow with Tasty units and colors
952
+ * - `shadow="0 1x 2x #dark.20"` // standard shadow syntax
953
+ * - `shadow={true}` // default shadow from design system
954
+ */
955
+ shadow?: string | boolean;
956
+ /**
957
+ * The radius style rounds the corners of an element's outer border edge. Supports custom units, advanced shapes, and directional modifiers.
958
+ *
959
+ * Syntax: `[value] [modifiers]` | `[shape]` | `true`
960
+ *
961
+ * Shapes: `round` (fully rounded), `ellipse` (50%), `leaf`, `backleaf` (asymmetric), `inherit` (inherit from parent)
962
+ * Edge modifiers: `top`, `right`, `bottom`, `left` — the corner pair along that edge
963
+ * Corner modifiers: `top-left`, `top-right`, `bottom-right`, `bottom-left` — a single corner
964
+ *
965
+ * Examples:
966
+ * - `radius="2r"` // border-radius: calc(var(--radius) * 2)
967
+ * - `radius={true}` // default radius (1r)
968
+ * - `radius="round"` // fully rounded (9999rem)
969
+ * - `radius="leaf"` // asymmetric leaf shape
970
+ * - `radius="1r top"` // round both top corners
971
+ * - `radius="top-right"` // round only the top-right corner (1r)
972
+ * - `radius="4px top-left"` // round only the top-left corner
973
+ * - `radius="inherit"` // inherit border-radius from parent
974
+ * - `radius="inherit right"` // inherit only right corners (uses longhand properties)
975
+ */
976
+ radius?: 'round' | 'ellipse' | 'leaf' | 'backleaf' | 'inherit' | string | true;
977
+ /**
978
+ * The flow style is a unified shorthand for controlling layout direction and wrapping in both flex and grid containers. Replaces `flexDirection` and `gridAutoFlow`.
979
+ *
980
+ * For flex: sets `flex-flow` (direction + wrapping)
981
+ * For grid: sets `grid-auto-flow` (direction + density)
982
+ * For block: determines gap direction (row/column)
983
+ *
984
+ * Syntax: `[direction] [wrap|dense]`
985
+ *
986
+ * Examples:
987
+ * - `flow="row wrap"` // flex-flow: row wrap
988
+ * - `flow="column dense"` // grid-auto-flow: column dense
989
+ * - `flow="row"` // primary axis direction
990
+ */
991
+ flow?: CSSProperties['flexFlow'] | CSSProperties['gridAutoFlow'] | string;
992
+ /**
993
+ * The gridAreas style specifies named grid areas, establishing cells in the grid and assigning them names.
994
+ *
995
+ * Examples:
996
+ * - `gridAreas='"header header" "sidebar content" "footer footer"'`
997
+ */
998
+ gridAreas?: CSSProperties['gridTemplateAreas'];
999
+ /**
1000
+ * The gridColumns style defines line names and track sizing functions of grid columns.
1001
+ *
1002
+ * Examples:
1003
+ * - `gridColumns="1fr 2fr 1fr"` // three columns with flex ratios
1004
+ * - `gridColumns={3}` // three equal columns (shorthand)
1005
+ * - `gridColumns="repeat(auto-fit, minmax(200px, 1fr))"` // responsive columns
1006
+ */
1007
+ gridColumns?: CSSProperties['gridTemplateColumns'] | number;
1008
+ /**
1009
+ * The gridRows style defines line names and track sizing functions of grid rows.
1010
+ *
1011
+ * Examples:
1012
+ * - `gridRows="auto 1fr auto"` // header, content, footer layout
1013
+ * - `gridRows={4}` // four equal rows (shorthand)
1014
+ * - `gridRows="repeat(3, 100px)"` // three 100px rows
1015
+ */
1016
+ gridRows?: CSSProperties['gridTemplateRows'] | number;
1017
+ /**
1018
+ * The gridTemplate style is a shorthand property for defining grid columns, rows, and areas simultaneously.
1019
+ *
1020
+ * Examples:
1021
+ * - `gridTemplate='"header header" auto "content sidebar" 1fr / 2fr 1fr'`
1022
+ */
1023
+ gridTemplate?: CSSProperties['gridTemplate'];
1024
+ /**
1025
+ * The font style specifies a prioritized list of font family names with design-system-driven defaults and fallbacks.
1026
+ *
1027
+ * Examples:
1028
+ * - `font="monospace"` // monospace font stack
1029
+ * - `font="Helvetica, Arial, sans-serif"` // custom font list
1030
+ * - `font={true}` // default design system font
1031
+ */
1032
+ font?: CSSProperties['fontFamily'] | boolean;
1033
+ /**
1034
+ * The outline style sets the outline for the element.
1035
+ *
1036
+ * Syntax: `[width] [style] [color] / [offset]` | `true`
1037
+ *
1038
+ * Examples:
1039
+ * - `outline="2ow dashed #purple"` // 2ow dashed purple outline
1040
+ * - `outline="2ow #danger / 1x"` // 2ow solid danger outline, 1x offset
1041
+ * - `outline={true}` // default outline (1ow solid)
1042
+ * - `outline="2ow $my-style"` // custom property in the style slot
1043
+ *
1044
+ * A `$name` reference fills the first free slot — width, then style, then
1045
+ * color. Colors are authored as `#name`; to point the color slot at a raw
1046
+ * custom property directly, name it `$name-color`.
1047
+ */
1048
+ outline?: string | boolean;
1049
+ /**
1050
+ * The outline offset style sets the offset of the outline.
1051
+ *
1052
+ * Examples:
1053
+ * - `outlineOffset="4px"` // 4px offset
1054
+ * - `outlineOffset="1x"` // 1x (8px) offset
1055
+ */
1056
+ outlineOffset?: string | number;
1057
+ /**
1058
+ * The preset style sets base text settings according to named presets. Affects `font-size`, `line-height`, `letter-spacing`, `font-weight`, and `text-transform`.
1059
+ *
1060
+ * Syntax: `name`, `name / modifier...`, or `modifier...` (shorthand, name defaults to `inherit`).
1061
+ * Multiple modifiers are space-separated and combine freely (e.g. `strong italic tight`).
1062
+ * Preset names are project-specific. Augment `TastyPresetNames` to register them for autocomplete.
1063
+ *
1064
+ * Examples:
1065
+ * - `preset="h1"` // heading 1 typography
1066
+ * - `preset="h2 / strong"` // bold heading 2
1067
+ * - `preset="h2 / strong italic"` // bold + italic heading 2
1068
+ * - `preset="t2 / strong tight"` // bold text 2 with tight line-height
1069
+ * - `preset="bold"` // inherit with bold (shorthand)
1070
+ * - `preset="bold italic"` // inherit with bold + italic (shorthand)
1071
+ * - `preset="t3"` // text size 3
1072
+ */
1073
+ preset?: PresetName | (string & {});
1074
+ /**
1075
+ * Shorthand for `align-items` and `align-content`. Sets both properties for unified vertical alignment in flex/grid layouts.
1076
+ *
1077
+ * Examples:
1078
+ * - `align="center"` // align-items: center; align-content: center
1079
+ * - `align="flex-start"` // align both to start
1080
+ * - `align="space-between"` // distribute space between items
1081
+ */
1082
+ align?: CSSProperties['alignItems'] | CSSProperties['alignContent'];
1083
+ /**
1084
+ * Shorthand for `justify-items` and `justify-content`. Sets both properties for unified horizontal alignment in flex/grid layouts.
1085
+ *
1086
+ * Examples:
1087
+ * - `justify="center"` // justify-items: center; justify-content: center
1088
+ * - `justify="space-between"` // distribute space between items
1089
+ * - `justify="flex-end"` // align both to end
1090
+ */
1091
+ justify?: CSSProperties['justifyItems'] | CSSProperties['justifyContent'];
1092
+ /**
1093
+ * Shorthand for all placement properties. Sets all 4 longhands: align-items, justify-items, align-content, justify-content.
1094
+ *
1095
+ * Examples:
1096
+ * - `place="center"` // all 4 longhands: center
1097
+ * - `place="start end"` // align-*: start; justify-*: end
1098
+ * - `place="stretch"` // all 4 longhands: stretch
1099
+ */
1100
+ place?: CSSProperties['placeItems'] | CSSProperties['placeContent'] | string;
1101
+ /**
1102
+ * Sets `place-content` property for aligning and distributing content in grid/flex containers.
1103
+ *
1104
+ * Examples:
1105
+ * - `placeContent="center"` // center content in both axes
1106
+ * - `placeContent="space-between"` // distribute content with space between
1107
+ */
1108
+ placeContent?: CSSProperties['placeContent'];
1109
+ /**
1110
+ * Sets `place-items` property for aligning items in grid/flex containers.
1111
+ *
1112
+ * Examples:
1113
+ * - `placeItems="center"` // center items in both axes
1114
+ * - `placeItems="start end"` // start on block axis, end on inline axis
1115
+ */
1116
+ placeItems?: CSSProperties['placeItems'];
1117
+ /**
1118
+ * Shorthand for scroll-margin on all sides. Supports custom units and directional modifiers.
1119
+ *
1120
+ * Examples:
1121
+ * - `scrollMargin="2x"` // scroll-margin on all sides: 2x
1122
+ * - `scrollMargin="2x top"` // only top scroll-margin: 2x
1123
+ * - `scrollMargin="2x top, 4x bottom"` // top: 2x, bottom: 4x
1124
+ * - `scrollMargin={true}` // default scroll-margin on all sides
1125
+ */
1126
+ scrollMargin?: CSSProperties['scrollMargin'] | string | boolean;
1127
+ scrollMarginTop?: string | number | boolean;
1128
+ scrollMarginRight?: string | number | boolean;
1129
+ scrollMarginBottom?: string | number | boolean;
1130
+ scrollMarginLeft?: string | number | boolean;
1131
+ scrollMarginBlock?: string | number | boolean;
1132
+ scrollMarginInline?: string | number | boolean;
1133
+ /**
1134
+ * Shorthand for `top`, `right`, `bottom`, and `left` offsets. Supports custom units, directional modifiers, and positioning.
1135
+ *
1136
+ * Examples:
1137
+ * - `inset="0"` // all sides: 0
1138
+ * - `inset="2x top"` // only top offset: 2x
1139
+ * - `inset="1x left right"` // left and right offsets: 1x
1140
+ * - `inset="2x top, 4x right"` // top: 2x, right: 4x, bottom/left: auto
1141
+ * - `inset="bottom dock"` // bottom-anchored, full width: auto 0 0 0
1142
+ * - `inset={true}` // all sides: 0
1143
+ *
1144
+ * A group that names directions takes a single value, applied to every
1145
+ * direction it names — use comma groups for per-side values.
1146
+ *
1147
+ * The `dock` modifier pins the named edge and spans its full length, applying
1148
+ * the value to the two perpendicular sides as well. `dock` is the one case
1149
+ * where a directional group takes two values: the second applies to those
1150
+ * spanned sides, so `inset="2x 4x bottom dock"` pins the bottom at `2x` and
1151
+ * insets the sides by `4x`. Without `dock` a second value is ignored.
1152
+ */
1153
+ inset?: 'top' | 'right' | 'bottom' | 'left' | 'dock' | string | CSSProperties['inset'];
1154
+ /**
1155
+ * Local keyframes definitions for this component.
1156
+ * Keys are animation names, values are keyframes step definitions.
1157
+ * Local keyframes override global keyframes with the same name.
1158
+ *
1159
+ * Examples:
1160
+ * - `'@keyframes': { fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } } }`
1161
+ * - `'@keyframes': { pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } } }`
1162
+ */
1163
+ '@keyframes'?: Record<string, KeyframesSteps>;
1164
+ /**
1165
+ * CSS @property definitions for custom properties using tasty token syntax.
1166
+ * Properties are registered once and are permanent (never removed).
1167
+ *
1168
+ * Token formats:
1169
+ * - `$name` for regular properties → `--name` (requires syntax to be specified)
1170
+ * - `#name` for color properties → `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
1171
+ *
1172
+ * Examples:
1173
+ * - `'@property': { '$rotation': { syntax: '<angle>', inherits: false, initialValue: '45deg' } }`
1174
+ * - `'@property': { '#theme': { initialValue: 'purple' } }` // syntax: '<color>' is auto-set
1175
+ */
1176
+ '@property'?: Record<string, PropertyDefinition>;
1177
+ /**
1178
+ * Local @font-face definitions for this component.
1179
+ * Keys are font-family names, values are descriptors or arrays of descriptors
1180
+ * (for multiple weights/styles of the same family).
1181
+ *
1182
+ * Examples:
1183
+ * - `'@font-face': { Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' } }`
1184
+ * - `'@font-face': { 'Brand Sans': [{ src: '...', fontWeight: 400 }, { src: '...', fontWeight: 700 }] }`
1185
+ */
1186
+ '@font-face'?: Record<string, FontFaceInput>;
1187
+ /**
1188
+ * Local @counter-style definitions for this component.
1189
+ * Keys are counter-style names, values are descriptor objects.
1190
+ *
1191
+ * Examples:
1192
+ * - `'@counter-style': { thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' } }`
1193
+ */
1194
+ '@counter-style'?: Record<string, CounterStyleDescriptors>;
1195
+ /**
1196
+ * Local @function definitions (CSS custom functions) for this component.
1197
+ * Keys are function names using `$$name` (the literal callable `--name`),
1198
+ * matching the call site `$$name(...)`. Values are function definitions.
1199
+ *
1200
+ * Local variables are declared directly as `$name` keys on the descriptor;
1201
+ * `result`, local-var values, and parameter defaults are parsed through the
1202
+ * Tasty DSL (units, color tokens, auto-calc, fallbacks).
1203
+ *
1204
+ * Examples:
1205
+ * - `'@function': { '$$negative': { args: ['$value'], result: '(-1 * $value)' } }`
1206
+ * - `'@function': { '$$shadow': { args: { '$color': { syntax: '<color>', default: 'inherit' } }, returns: '<color>', '$offset': '2px', result: '$offset $offset ($color, black)' } }`
1207
+ */
1208
+ '@function'?: Record<string, FunctionDefinition>;
1209
+ /**
1210
+ * Apply one or more predefined style recipes by name.
1211
+ * Recipes are defined globally via `configure({ recipes: { ... } })`.
1212
+ * Multiple recipes are space-separated. Use `/` to separate base recipes
1213
+ * (applied before component styles) from post recipes (applied after, via mergeStyles).
1214
+ * Use `none` to explicitly skip base recipes.
1215
+ *
1216
+ * Examples:
1217
+ * - `recipe: 'card'` // Apply the 'card' recipe
1218
+ * - `recipe: 'card elevated'` // Apply 'card' then 'elevated', then component styles
1219
+ * - `recipe: 'reset input / input-autofill'` // Base recipes, then post recipe
1220
+ * - `recipe: 'none / disabled'` // No base recipes, only post recipe
1221
+ * - `recipe: ''` // Clear recipes from base styles when extending
1222
+ */
1223
+ recipe?: string;
1224
+ }
1225
+ 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';
1226
+ type Selector = `${SuffixForSelector}${string}`;
1227
+ type NotSelector = Exclude<string, Selector | keyof StylesInterface>;
1228
+ /** Special style keys that should not be wrapped in StyleValue/StyleValueStateMap */
1229
+ type SpecialStyleKeys = '@keyframes' | '@property' | '@font-face' | '@counter-style' | '@function' | 'recipe';
1230
+ type StylesWithoutSelectors = { [key in keyof StylesInterface as key extends SpecialStyleKeys ? never : key]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]> };
1231
+ /**
1232
+ * Index signature for recipe-specific arbitrary keys.
1233
+ * Supports local predefined states (`@name`), vendor-prefixed CSS properties (`-webkit-*`),
1234
+ * CSS custom properties (`$name`), and color tokens (`#name`).
1235
+ * Unlike StylesIndexSignature, does NOT allow sub-element selectors (recipes are flat).
1236
+ */
1237
+ type RecipeIndexSignature = Record<string, StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined>>;
1238
+ /**
1239
+ * Style type for recipe definitions.
1240
+ * Like StylesWithoutSelectors but also allows `@keyframes`, `@property`,
1241
+ * local predefined states, and vendor-prefixed CSS properties.
1242
+ * Excludes `recipe` to prevent recursive references.
1243
+ */
1244
+ type RecipeStyles = StylesWithoutSelectors & RecipeIndexSignature & {
1245
+ '@keyframes'?: StylesInterface['@keyframes'];
1246
+ '@property'?: StylesInterface['@property'];
1247
+ '@font-face'?: StylesInterface['@font-face'];
1248
+ '@counter-style'?: StylesInterface['@counter-style'];
1249
+ '@function'?: StylesInterface['@function'];
1250
+ };
1251
+ /** Special properties that are not regular style values */
1252
+ interface SpecialStyleProperties {
1253
+ '@keyframes'?: StylesInterface['@keyframes'];
1254
+ '@property'?: StylesInterface['@property'];
1255
+ '@font-face'?: StylesInterface['@font-face'];
1256
+ '@counter-style'?: StylesInterface['@counter-style'];
1257
+ '@function'?: StylesInterface['@function'];
1258
+ recipe?: StylesInterface['recipe'];
1259
+ }
1260
+ /** Index signature for arbitrary style keys (sub-elements, CSS variables, etc.) */
1261
+ interface StylesIndexSignature {
1262
+ [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'];
1263
+ /**
1264
+ * Selector combinator: `undefined` (descendant, default), `'>'` (child), `'+'` (adjacent), `'~'` (sibling).
1265
+ * Can chain with capitalized names: `'> Body > Row >'`. Spaces required around combinators.
1266
+ */
1267
+ $?: string;
1268
+ }
1269
+ type Styles = StylesWithoutSelectors & SpecialStyleProperties & StylesIndexSignature;
1270
+ /**
1271
+ * Value type for design tokens passed to `configure({ tokens })`.
1272
+ * Can be a direct value or a state map for responsive/theme-aware tokens.
1273
+ */
1274
+ type ConfigTokenValue = string | number | boolean | Record<string, string | number | boolean | undefined | null | '@inherit'>;
1275
+ /**
1276
+ * Design tokens injected as CSS custom properties on `:root`.
1277
+ * Keys must start with `$` (value tokens) or `#` (color tokens).
1278
+ *
1279
+ * - `$name` keys become `--name` CSS custom properties
1280
+ * - `#name` keys become `--name-color` properties
1281
+ */
1282
+ type ConfigTokens = Record<`$${string}` | `#${string}`, ConfigTokenValue>;
1283
+ //#endregion
1284
+ //#region src/pipeline/conditions.d.ts
1285
+ /**
1286
+ * ConditionNode Types and Helpers
1287
+ *
1288
+ * Core data structures for representing style conditions as an abstract syntax tree.
1289
+ * Used throughout the pipeline for parsing, simplification, and CSS generation.
1290
+ */
1291
+ /**
1292
+ * Base interface for all state conditions (leaf nodes)
1293
+ */
1294
+ interface BaseStateCondition {
1295
+ kind: 'state';
1296
+ negated: boolean;
1297
+ raw: string;
1298
+ uniqueId: string;
1299
+ }
1300
+ /**
1301
+ * Modifier condition: [data-attr] or [data-attr="value"]
1302
+ */
1303
+ interface ModifierCondition extends BaseStateCondition {
1304
+ type: 'modifier';
1305
+ attribute: string;
1306
+ value?: string;
1307
+ operator?: '=' | '^=' | '$=' | '*=';
1308
+ }
1309
+ /**
1310
+ * Pseudo-class condition: :hover, :focus-visible
1311
+ */
1312
+ interface PseudoCondition extends BaseStateCondition {
1313
+ type: 'pseudo';
1314
+ pseudo: string;
1315
+ }
1316
+ /**
1317
+ * Numeric bound for dimension queries
1318
+ */
1319
+ interface NumericBound {
1320
+ value: string;
1321
+ valueNumeric: number | null;
1322
+ inclusive: boolean;
1323
+ }
1324
+ /**
1325
+ * Media query condition
1326
+ */
1327
+ interface MediaCondition extends BaseStateCondition {
1328
+ type: 'media';
1329
+ subtype: 'dimension' | 'feature' | 'type';
1330
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
1331
+ lowerBound?: NumericBound;
1332
+ upperBound?: NumericBound;
1333
+ feature?: string;
1334
+ featureValue?: string;
1335
+ mediaType?: 'print' | 'screen' | 'all' | 'speech';
1336
+ }
1337
+ /**
1338
+ * Container query condition
1339
+ */
1340
+ interface ContainerCondition extends BaseStateCondition {
1341
+ type: 'container';
1342
+ subtype: 'dimension' | 'style' | 'raw';
1343
+ containerName?: string;
1344
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
1345
+ lowerBound?: NumericBound;
1346
+ upperBound?: NumericBound;
1347
+ property?: string;
1348
+ propertyValue?: string;
1349
+ rawCondition?: string;
1350
+ }
1351
+ /**
1352
+ * Root state condition: @root(theme=dark)
1353
+ */
1354
+ interface RootCondition extends BaseStateCondition {
1355
+ type: 'root';
1356
+ innerCondition: ConditionNode;
1357
+ }
1358
+ /**
1359
+ * Parent state condition: @parent(hovered), @parent(theme=dark, >)
1360
+ */
1361
+ interface ParentCondition extends BaseStateCondition {
1362
+ type: 'parent';
1363
+ innerCondition: ConditionNode;
1364
+ direct: boolean;
1365
+ }
1366
+ /**
1367
+ * Own state condition: @own(hovered)
1368
+ */
1369
+ interface OwnCondition extends BaseStateCondition {
1370
+ type: 'own';
1371
+ innerCondition: ConditionNode;
1372
+ }
1373
+ /**
1374
+ * Starting style condition: @starting
1375
+ */
1376
+ interface StartingCondition extends BaseStateCondition {
1377
+ type: 'starting';
1378
+ }
1379
+ /**
1380
+ * Supports query condition: @supports(display: grid), @supports($, :has(*))
1381
+ */
1382
+ interface SupportsCondition extends BaseStateCondition {
1383
+ type: 'supports';
1384
+ subtype: 'feature' | 'selector';
1385
+ condition: string;
1386
+ }
1387
+ /**
1388
+ * Union of all state condition types
1389
+ */
1390
+ type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
1391
+ /**
1392
+ * Compound node: combines conditions with AND/OR
1393
+ */
1394
+ interface CompoundCondition {
1395
+ kind: 'compound';
1396
+ operator: 'AND' | 'OR';
1397
+ children: ConditionNode[];
1398
+ }
1399
+ /**
1400
+ * True condition (matches everything)
1401
+ */
1402
+ interface TrueCondition {
1403
+ kind: 'true';
1404
+ }
1405
+ /**
1406
+ * False condition (matches nothing - skip this rule)
1407
+ */
1408
+ interface FalseCondition {
1409
+ kind: 'false';
1410
+ }
1411
+ /**
1412
+ * Union of all condition node types
1413
+ */
1414
+ type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
1415
+ //#endregion
1416
+ //#region src/states/index.d.ts
1417
+ /**
1418
+ * Parsed advanced state information
1419
+ */
1420
+ interface ParsedAdvancedState {
1421
+ type: 'media' | 'container' | 'root' | 'parent' | 'own' | 'starting' | 'predefined' | 'modifier';
1422
+ condition: string;
1423
+ containerName?: string;
1424
+ raw: string;
1425
+ mediaType?: string;
1426
+ }
1427
+ /**
1428
+ * Context for state parsing operations
1429
+ */
1430
+ interface StateParserContext {
1431
+ localPredefinedStates: Record<string, string>;
1432
+ globalPredefinedStates: Record<string, string>;
1433
+ isSubElement?: boolean;
1434
+ }
1435
+ /**
1436
+ * At-rule context for CSS generation
1437
+ */
1438
+ interface AtRuleContext {
1439
+ media?: string[];
1440
+ container?: {
1441
+ name?: string;
1442
+ condition: string;
1443
+ }[];
1444
+ startingStyle?: boolean;
1445
+ rootStates?: string[];
1446
+ negatedRootStates?: string[];
1447
+ }
1448
+ /**
1449
+ * Configure global predefined states
1450
+ */
1451
+ declare function setGlobalPredefinedStates(states: Record<string, string>): void;
1452
+ /**
1453
+ * Get global predefined states
1454
+ */
1455
+ declare function getGlobalPredefinedStates(): Record<string, string>;
1456
+ /**
1457
+ * Create a state parser context from styles
1458
+ */
1459
+ declare function createStateParserContext(styles?: Styles, isSubElement?: boolean): StateParserContext;
1460
+ //#endregion
1461
+ //#region src/pipeline/parseStateKey.d.ts
1462
+ interface ParseStateKeyOptions {
1463
+ context?: StateParserContext;
1464
+ isSubElement?: boolean;
1465
+ }
1466
+ /**
1467
+ * Parse a state key string into a ConditionNode
1468
+ */
1469
+ declare function parseStateKey(stateKey: string, options?: ParseStateKeyOptions): ConditionNode;
1470
+ //#endregion
1471
+ //#region src/pipeline/index.d.ts
1472
+ /**
1473
+ * Matches the old StyleResult interface for backward compatibility
1474
+ */
1475
+ interface StyleResult {
1476
+ selector: string;
1477
+ declarations: string;
1478
+ atRules?: string[];
1479
+ needsClassName?: boolean;
1480
+ rootPrefix?: string;
1481
+ /** When true, declarations are wrapped in @starting-style { ... } inside the selector rule */
1482
+ startingStyle?: boolean;
1483
+ }
1484
+ /**
1485
+ * Matches the old RenderResult interface for backward compatibility
1486
+ */
1487
+ interface RenderResult {
1488
+ rules: StyleResult[];
1489
+ className?: string;
1490
+ }
1491
+ /**
1492
+ * Check if a key is a CSS selector
1493
+ */
1494
+ declare function isSelector(key: string): boolean;
1495
+ /**
1496
+ * Options for renderStyles when using direct selector mode.
1497
+ */
1498
+ interface RenderStylesOptions {
1499
+ /**
1500
+ * Whether to double the class selector for increased specificity.
1501
+ * When true, `.myClass` becomes `.myClass.myClass` for higher specificity.
1502
+ *
1503
+ * @default false - User-provided selectors are not doubled.
1504
+ *
1505
+ * Note: This only applies when a classNameOrSelector is provided.
1506
+ * When renderStyles returns RenderResult with needsClassName=true,
1507
+ * the injector handles doubling automatically.
1508
+ */
1509
+ doubleSelector?: boolean;
1510
+ }
1511
+ /**
1512
+ * Render styles to CSS rules.
1513
+ *
1514
+ * When called without classNameOrSelector, returns RenderResult with needsClassName=true.
1515
+ * When called with a selector/className string, returns StyleResult[] for direct injection.
1516
+ */
1517
+ declare function renderStyles(styles?: Styles, classNameOrSelector?: undefined, options?: undefined, pipelineCacheKey?: string): RenderResult;
1518
+ declare function renderStyles(styles: Styles | undefined, classNameOrSelector: string, options?: RenderStylesOptions): StyleResult[];
1519
+ //#endregion
1520
+ export { StyleParser as $, ParsedColor as A, StyleUsage as At, StyleValueStateMap as B, SuffixForSelector as C, PropertyOptions as Ct, CSSMap as D, SheetInfo as Dt, AnyStyleHandler as E, RuleInfo as Et, StyleHandlerProps as F, parseColor as G, getGlobalParser as H, StyleHandlerResult as I, getNamedColorHex as J, parseStyle as K, StyleMap as L, ResolvedStyleValue as M, flushStyles as Mt, StyleHandler as N, hasPendingStyleWrites as Nt, CUSTOM_UNITS as O, StyleInjectorConfig as Ot, StyleHandlerDefinition as P, resetStyleBatch as Pt, strToRgb as Q, StylePropValue as R, StylesWithoutSelectors as S, PropertyDefinition as St, TastyPresetNames as T, RootRegistry as Tt, getGlobalPredefinedTokens as U, filterMods as V, normalizeColorTokenValue as W, hexToRgb as X, getRgbValuesFromRgbaString as Y, hslToRgbValues as Z, NotSelector as _, InjectionMode as _t, ParseStateKeyOptions as a, CSSProperties as at, Styles as b, KeyframesResult as bt, ParsedAdvancedState as c, DisposeFunction as ct, getGlobalPredefinedStates as d, FunctionDefinition as dt, ParserOptions as et, setGlobalPredefinedStates as f, FunctionParameter as ft, NoType as g, InjectResult as gt, ConfigTokens as h, GlobalInjectResult as ht, renderStyles as i, UnitHandler as it, RawStyleHandler as j, QueuedWrite as jt, DIRECTIONS as k, StyleRule as kt, StateParserContext as l, FontFaceDescriptors as lt, ConfigTokenValue as m, GCOptions as mt, StyleResult as n, StyleDetails as nt, parseStateKey as o, CacheMetrics as ot, ConditionNode as p, GCConfig as pt, stringifyStyles as q, isSelector as r, StyleDetailsPart as rt, AtRuleContext as s, CounterStyleDescriptors as st, RenderResult as t, ProcessedStyle as tt, createStateParserContext as u, FontFaceInput as ut, RecipeStyles as v, KeyframesCacheEntry as vt, TastyNamedColors as w, RawCSSResult as wt, StylesInterface as x, KeyframesSteps as xt, Selector as y, KeyframesInfo as yt, StyleValue as z };
1521
+ //# sourceMappingURL=index-Cd45t5NM.d.ts.map