@tenphi/tasty 0.0.0-snapshot.fafcbfe → 0.0.0-snapshot.fdb16ea

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