@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,1263 @@
1
+ import { Dt as SheetInfo, Et as RuleInfo, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, St as PropertyDefinition, Tt as RootRegistry, b as Styles, bt as KeyframesResult, dt as FunctionDefinition, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as UnitHandler, kt as StyleRule, lt as FontFaceDescriptors, mt as GCOptions, n as StyleResult, nt as StyleDetails, ot as CacheMetrics, pt as GCConfig, st as CounterStyleDescriptors, ut as FontFaceInput, v as RecipeStyles, wt as RawCSSResult, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-Cd45t5NM.js";
2
+
3
+ //#region src/prop-handlers.d.ts
4
+ /**
5
+ * Props middleware for tasty components.
6
+ *
7
+ * A prop handler receives a component's props and returns them, changed or not.
8
+ * That makes it the extension point for props that are *not* style properties:
9
+ * it can read a custom prop, strip it so it never reaches the DOM, and fold its
10
+ * meaning into `styles`, `mods`, `tokens`, `variant`, or `as`.
11
+ *
12
+ * ```ts
13
+ * configure({
14
+ * propHandlers: {
15
+ * glaze: (props) => {
16
+ * const { glaze, ...rest } = props;
17
+ * if (!glaze) return rest;
18
+ * return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
19
+ * },
20
+ * },
21
+ * });
22
+ * ```
23
+ *
24
+ * Handlers run on every render of every tasty component, so the registry is a
25
+ * pre-composed chain that is `null` while nothing is registered — the cost when
26
+ * unused is one property load and one branch.
27
+ */
28
+ /** Props object handed to a prop handler. Deliberately untyped: handlers see everything. */
29
+ type PropHandlerProps = Record<string, unknown>;
30
+ /**
31
+ * Props middleware: props in, props out. Returning nothing means "unchanged".
32
+ *
33
+ * Must be a **pure function** and must not mutate its input. Style values are
34
+ * cached by object identity, so mutating a value object in place produces a stale
35
+ * class name and stale CSS. Return fresh (ideally frozen, ideally memoized)
36
+ * objects instead.
37
+ */
38
+ type PropHandler = (props: PropHandlerProps) => PropHandlerProps | void | null;
39
+ /**
40
+ * How a prop handler is declared. The map key is both its name and, by default,
41
+ * the prop that triggers it.
42
+ *
43
+ * - `fn` — triggered when a prop matching the key is present
44
+ * - `['glaze', fn]` — triggered by the named prop
45
+ * - `[['glaze', 'tone'], fn]` — triggered by any of them
46
+ * - `['*', fn]` — unconditional; runs on every render of every component
47
+ */
48
+ type PropHandlerDefinition = PropHandler | [string, PropHandler] | [string[], PropHandler];
49
+ //#endregion
50
+ //#region src/injector/sheet-manager.d.ts
51
+ declare class SheetManager {
52
+ private rootRegistries;
53
+ /** Strong set of active roots so background GC can iterate them all */
54
+ private activeRoots;
55
+ private config;
56
+ /** Dedicated style elements for raw CSS per root */
57
+ private rawStyleElements;
58
+ /** Constructable sheets for raw CSS in adopted mode */
59
+ private rawConstructableSheets;
60
+ /** Tracking for raw CSS blocks per root */
61
+ private rawCSSBlocks;
62
+ /** Counter for generating unique raw CSS IDs */
63
+ private rawCSSCounter;
64
+ constructor(config: StyleInjectorConfig);
65
+ /**
66
+ * Resolve the underlying CSSStyleSheet from a SheetInfo,
67
+ * abstracting away adopted vs style-element modes.
68
+ */
69
+ getCSSSheet(sheetInfo: SheetInfo): CSSStyleSheet | null;
70
+ /**
71
+ * Record an inserted rule text at its rule index (text mode only).
72
+ *
73
+ * `textRules` mirrors the sheet's rule order. `textContent` cannot be edited
74
+ * rule-by-rule the way CSSOM can, so keeping the texts is what makes
75
+ * deletion possible at all in this mode.
76
+ */
77
+ private trackTextRule;
78
+ /**
79
+ * Remove rule indices from a text-mode sheet and rewrite the element's text.
80
+ * Returns the indices that were actually removed.
81
+ */
82
+ private deleteTextRules;
83
+ /**
84
+ * Determine the injection mode for a root.
85
+ * ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
86
+ */
87
+ private detectInjectionMode;
88
+ /**
89
+ * Get or create registry for a root (Document or ShadowRoot)
90
+ */
91
+ getRegistry(root: Document | ShadowRoot): RootRegistry;
92
+ /** Return all roots with active registries (for background GC sweep). */
93
+ getActiveRoots(): Iterable<Document | ShadowRoot>;
94
+ /** Check whether any roots have active registries. */
95
+ hasActiveRoots(): boolean;
96
+ /** Remove registries for ShadowRoots whose host has been detached from the DOM. */
97
+ pruneDisconnectedRoots(): void;
98
+ /**
99
+ * Create a new stylesheet for the registry.
100
+ * In adopted mode (ShadowRoot), creates a constructable CSSStyleSheet and
101
+ * pushes it to adoptedStyleSheets. Otherwise creates a <style> element.
102
+ */
103
+ createSheet(registry: RootRegistry, root: Document | ShadowRoot): SheetInfo;
104
+ /**
105
+ * Create a style element and append to document
106
+ */
107
+ private createStyleElement;
108
+ /**
109
+ * Insert CSS rules as a single block
110
+ */
111
+ insertRule(registry: RootRegistry, flattenedRules: StyleRule[], className: string, root: Document | ShadowRoot): RuleInfo | null;
112
+ /**
113
+ * Insert global CSS rules
114
+ */
115
+ insertGlobalRule(registry: RootRegistry, flattenedRules: StyleRule[], globalKey: string, root: Document | ShadowRoot): RuleInfo | null;
116
+ /**
117
+ * Delete a global CSS rule by key
118
+ */
119
+ deleteGlobalRule(registry: RootRegistry, globalKey: string): void;
120
+ /**
121
+ * Adjust rule indices after deletion to account for shifting
122
+ */
123
+ private adjustIndicesAfterDeletion;
124
+ /**
125
+ * Delete a CSS rule from the sheet
126
+ */
127
+ deleteRule(registry: RootRegistry, ruleInfo: RuleInfo): void;
128
+ /**
129
+ * Find a sheet with available space or return null
130
+ */
131
+ private findAvailableSheet;
132
+ /**
133
+ * Find an available rule index in the sheet
134
+ */
135
+ findAvailableRuleIndex(sheet: SheetInfo): number;
136
+ /**
137
+ * Probe whether the underlying CSS engine supports `@property` at-rules.
138
+ * Result is cached per registry on `registry.atPropertySupported`.
139
+ *
140
+ * The probe inserts and immediately deletes a minimal known-valid rule
141
+ * (`@property --__tasty_probe__ { syntax: "*"; inherits: true; }`).
142
+ * Engines that lack `@property` support (jsdom, happy-dom) reject any
143
+ * `@property` rule including this one, so a probe failure is a reliable
144
+ * signal that further `@property` rejections are environmental noise and
145
+ * not user-authored bugs.
146
+ *
147
+ * The probe is intentionally a separate operation from the user's failing
148
+ * insertion: we don't want to leak `--__tasty_probe__` into the sheet, so
149
+ * on success we delete the probe rule immediately, leaving `ruleCount`
150
+ * and `cssRules.length` unchanged.
151
+ */
152
+ private engineSupportsAtProperty;
153
+ /**
154
+ * Force cleanup of unused styles
155
+ */
156
+ forceCleanup(registry: RootRegistry): void;
157
+ /**
158
+ * Perform bulk cleanup of all unused styles (refCount = 0).
159
+ */
160
+ private performBulkCleanup;
161
+ /**
162
+ * Get total number of rules across all sheets
163
+ */
164
+ getTotalRuleCount(registry: RootRegistry): number;
165
+ /**
166
+ * Get CSS text from all sheets (for SSR)
167
+ */
168
+ getCSSText(registry: RootRegistry): string;
169
+ /**
170
+ * Get cache performance metrics
171
+ */
172
+ getMetrics(registry: RootRegistry): CacheMetrics | null;
173
+ /**
174
+ * Reset cache performance metrics
175
+ */
176
+ resetMetrics(registry: RootRegistry): void;
177
+ /**
178
+ * Convert keyframes steps to CSS string.
179
+ * Public so the SSR collector can format keyframes without DOM access.
180
+ * Returns both the CSS text and a combined declarations string for property type scanning.
181
+ */
182
+ stepsToCSS(steps: KeyframesSteps): {
183
+ css: string;
184
+ declarations: string;
185
+ };
186
+ /**
187
+ * Insert keyframes rule.
188
+ * Returns the KeyframesInfo and the raw declarations string for property type scanning.
189
+ */
190
+ insertKeyframes(registry: RootRegistry, steps: KeyframesSteps, name: string, root: Document | ShadowRoot): {
191
+ info: KeyframesInfo;
192
+ declarations: string;
193
+ } | null;
194
+ /**
195
+ * Delete keyframes rule
196
+ */
197
+ deleteKeyframes(registry: RootRegistry, info: KeyframesInfo): void;
198
+ /**
199
+ * Clean up resources for a root
200
+ */
201
+ cleanup(root: Document | ShadowRoot): void;
202
+ /**
203
+ * Check if a root uses adopted injection mode.
204
+ */
205
+ private isAdoptedMode;
206
+ /**
207
+ * Get or create a constructable CSSStyleSheet for raw CSS in adopted mode.
208
+ * The raw sheet is prepended to adoptedStyleSheets so it precedes tasty rules.
209
+ */
210
+ private getOrCreateRawAdoptedSheet;
211
+ /**
212
+ * Get or create a dedicated style element for raw CSS
213
+ * Raw CSS is kept separate from tasty-managed sheets to avoid index conflicts
214
+ */
215
+ private getOrCreateRawStyleElement;
216
+ /**
217
+ * Inject raw CSS text directly without parsing
218
+ * Returns a dispose function to remove the injected CSS
219
+ */
220
+ injectRawCSS(css: string, root: Document | ShadowRoot): RawCSSResult;
221
+ /**
222
+ * Rebuild the raw CSS constructable sheet from all tracked blocks.
223
+ */
224
+ private rebuildRawAdoptedSheet;
225
+ /**
226
+ * Remove a raw CSS block by ID
227
+ */
228
+ private disposeRawCSS;
229
+ /**
230
+ * Get the raw CSS content
231
+ */
232
+ getRawCSSText(root: Document | ShadowRoot): string;
233
+ }
234
+ //#endregion
235
+ //#region src/injector/injector.d.ts
236
+ declare class StyleInjector {
237
+ private sheetManager;
238
+ private config;
239
+ private globalRuleCounter;
240
+ private pendingGCHandle;
241
+ private namePrefix;
242
+ private classRegex;
243
+ private rscClassRegex;
244
+ /** @internal — exposed for debug utilities only */
245
+ get _sheetManager(): SheetManager;
246
+ /**
247
+ * Whether sheet writes should be queued instead of applied immediately.
248
+ *
249
+ * Only ever true on the client: SSR collects CSS as text and the RSC path
250
+ * returns it as strings, so neither has a live sheet to batch writes against.
251
+ *
252
+ * In the default `true` mode a write is only queued inside an open batch
253
+ * window — a commit in which `<TastyBatchProvider>` rendered and will
254
+ * therefore flush in its insertion effect, before any layout effect can
255
+ * measure. Everything else falls through to a synchronous write, so enabling
256
+ * the flag cannot make a `useLayoutEffect` read an unstyled element.
257
+ * `'always'` drops the gate and accepts that trade for wider coverage.
258
+ */
259
+ private get batching();
260
+ /**
261
+ * Apply a sheet write now, or queue it when batching is on.
262
+ * Returns the queue handle when deferred, so the caller can cancel it if it
263
+ * disposes before the flush.
264
+ */
265
+ private writeSheet;
266
+ /**
267
+ * Insert a global (non-class) rule, honouring batching.
268
+ *
269
+ * `onApplied` records the caller's dedupe bookkeeping. When the write is
270
+ * queued it runs eagerly, so a repeat call before the flush bails out instead
271
+ * of queueing the same rule twice — the same reasoning as
272
+ * `insertPropertyRule`'s eager marking. When written synchronously it runs
273
+ * only on success, preserving the existing retry-on-failure behaviour.
274
+ */
275
+ private writeGlobalRule;
276
+ constructor(config?: StyleInjectorConfig);
277
+ /**
278
+ * Generate a deterministic class name from a cache key using content hash.
279
+ * The same cache key always produces the same class name across environments
280
+ * with the same `namePrefix`.
281
+ */
282
+ private generateClassName;
283
+ /**
284
+ * Check if `className` was hydrated from server-rendered styles and,
285
+ * if so, wire the cacheKey mapping. Returns true on hit.
286
+ */
287
+ private tryHydratedHit;
288
+ /**
289
+ * Allocate a className for a cacheKey without injecting styles yet.
290
+ * This allows separating className allocation (render phase) from style injection (insertion phase).
291
+ */
292
+ allocateClassName(cacheKey: string, options?: {
293
+ root?: Document | ShadowRoot;
294
+ }): {
295
+ className: string;
296
+ isNewAllocation: boolean;
297
+ };
298
+ /**
299
+ * Inject styles from StyleResult objects
300
+ */
301
+ inject(rules: StyleResult[], options?: {
302
+ root?: Document | ShadowRoot;
303
+ cacheKey?: string;
304
+ }): InjectResult;
305
+ /**
306
+ * Inject global styles (rules without a generated tasty class selector)
307
+ * This ensures we don't reserve a tasty class name (t{number}) for global rules,
308
+ * which could otherwise collide with element-level styles and break lookups.
309
+ */
310
+ injectGlobal(rules: StyleResult[], options?: {
311
+ root?: Document | ShadowRoot;
312
+ }): GlobalInjectResult;
313
+ /**
314
+ * Inject raw CSS text directly without parsing
315
+ * This is a low-overhead alternative to createGlobalStyle for raw CSS
316
+ * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking
317
+ */
318
+ injectRawCSS(css: string, options?: {
319
+ root?: Document | ShadowRoot;
320
+ }): RawCSSResult;
321
+ /**
322
+ * Get raw CSS text for SSR
323
+ */
324
+ getRawCSSText(options?: {
325
+ root?: Document | ShadowRoot;
326
+ }): string;
327
+ /**
328
+ * Increment refCount for an already-injected cacheKey and return a dispose.
329
+ * Used by useStyles on cache hits (hydration or runtime reuse) where
330
+ * the pipeline was skipped but refCount tracking is still needed.
331
+ * Returns null if the cacheKey is not found.
332
+ */
333
+ trackRef(cacheKey: string, options?: {
334
+ root?: Document | ShadowRoot;
335
+ }): InjectResult | null;
336
+ /**
337
+ * Dispose of a className (decrements refCount only).
338
+ */
339
+ private dispose;
340
+ /**
341
+ * Force bulk cleanup of unused styles
342
+ */
343
+ cleanup(root?: Document | ShadowRoot): void;
344
+ /**
345
+ * Get CSS text from all sheets (for SSR)
346
+ */
347
+ getCSSText(options?: {
348
+ root?: Document | ShadowRoot;
349
+ }): string;
350
+ /**
351
+ * Get CSS only for the provided tasty classNames (e.g., ["t0","t3"])
352
+ */
353
+ getCSSTextForClasses(classNames: Iterable<string>, options?: {
354
+ root?: Document | ShadowRoot;
355
+ }): string;
356
+ /**
357
+ * Get cache performance metrics
358
+ */
359
+ getMetrics(options?: {
360
+ root?: Document | ShadowRoot;
361
+ }): CacheMetrics | null;
362
+ /**
363
+ * Reset cache performance metrics
364
+ */
365
+ resetMetrics(options?: {
366
+ root?: Document | ShadowRoot;
367
+ }): void;
368
+ /**
369
+ * Define a CSS @property custom property.
370
+ *
371
+ * Accepts tasty token syntax for the property name:
372
+ * - `$name` → defines `--name`
373
+ * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
374
+ * - `--name` → defines `--name` (legacy format)
375
+ *
376
+ * Example:
377
+ * @property --rotation { syntax: "<angle>"; inherits: false; initial-value: 45deg; }
378
+ *
379
+ * Note: No caching or dispose — this defines a global property.
380
+ *
381
+ * If the same property is registered with different options, a warning is emitted
382
+ * but the original definition is preserved (CSS @property cannot be redefined).
383
+ */
384
+ property(name: string, options?: PropertyDefinition & {
385
+ root?: Document | ShadowRoot;
386
+ }): void;
387
+ /**
388
+ * Build and insert a single `@property` rule into the given registry.
389
+ * No-op if the property was already injected.
390
+ */
391
+ private insertPropertyRule;
392
+ /**
393
+ * Check whether a given @property name was already injected by this injector.
394
+ *
395
+ * Accepts tasty token syntax:
396
+ * - `$name` → checks `--name`
397
+ * - `#name` → checks `--name-color`
398
+ * - `--name` → checks `--name` (legacy format)
399
+ */
400
+ isPropertyDefined(name: string, options?: {
401
+ root?: Document | ShadowRoot;
402
+ }): boolean;
403
+ /**
404
+ * Inject a CSS @font-face rule.
405
+ *
406
+ * Permanent and global — no dispose or ref-counting.
407
+ * Deduplicates by content hash (family + descriptors).
408
+ */
409
+ fontFace(family: string, descriptors: FontFaceDescriptors, options?: {
410
+ root?: Document | ShadowRoot;
411
+ }): void;
412
+ /**
413
+ * Inject a CSS @counter-style rule.
414
+ *
415
+ * Permanent and global — no dispose or ref-counting. Deduplicates by name.
416
+ * By default a definition overrides a previously injected one of the same
417
+ * name. Pass `weak: true` for global `configure()` definitions, which must
418
+ * never clobber an existing rule (so component-local definitions win
419
+ * regardless of injection order).
420
+ */
421
+ counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
422
+ root?: Document | ShadowRoot;
423
+ weak?: boolean;
424
+ }): void;
425
+ /**
426
+ * Inject a CSS @function rule (custom function).
427
+ *
428
+ * Permanent and global — no dispose or ref-counting. Deduplicates by function
429
+ * name. By default a definition overrides a previously injected one of the
430
+ * same name. Pass `weak: true` for global `configure()` definitions, which
431
+ * must never clobber an existing rule (so component-local definitions win
432
+ * regardless of injection order).
433
+ */
434
+ func(name: string, definition: FunctionDefinition, options?: {
435
+ root?: Document | ShadowRoot;
436
+ weak?: boolean;
437
+ }): void;
438
+ /**
439
+ * Inject keyframes and return object with toString() and dispose()
440
+ *
441
+ * Keyframes are cached by content (steps). If the same content is injected
442
+ * multiple times with different provided names, the first injected name is reused.
443
+ *
444
+ * If the same name is provided with different content (collision), a unique
445
+ * name is generated to avoid overwriting the existing keyframes.
446
+ */
447
+ keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
448
+ root?: Document | ShadowRoot;
449
+ name?: string;
450
+ }): KeyframesResult;
451
+ /**
452
+ * Dispose keyframes
453
+ */
454
+ private disposeKeyframes;
455
+ /**
456
+ * Record a render-time usage hit for one or more classNames.
457
+ * Handles space-separated multi-chunk classNames.
458
+ * When the global touch counter reaches `touchInterval`, schedules a GC
459
+ * via `requestIdleCallback`.
460
+ * No-op on the server.
461
+ */
462
+ touch(className: string, options?: {
463
+ root?: Document | ShadowRoot;
464
+ }): void;
465
+ /**
466
+ * Schedule a GC via `requestIdleCallback` (or synchronously as fallback).
467
+ * Runs GC on all active roots. Avoids double-scheduling via `pendingGCHandle`.
468
+ */
469
+ private scheduleGC;
470
+ /**
471
+ * Synchronous garbage collection.
472
+ *
473
+ * 1. Quick upper-bound check: skip if unused count can't exceed capacity.
474
+ * 2. Scans the DOM for live tasty classNames (safety guard).
475
+ * 3. With `force: true`: deletes all unused entries inline.
476
+ * Without `force`: collects unused, sorts oldest-first, evicts over capacity.
477
+ *
478
+ * @returns Number of styles evicted.
479
+ */
480
+ gc(options?: GCOptions): number;
481
+ /**
482
+ * Destroy all resources for a root
483
+ */
484
+ destroy(root?: Document | ShadowRoot): void;
485
+ }
486
+ //#endregion
487
+ //#region src/functions/index.d.ts
488
+ /**
489
+ * A parse-time function: receives the parsed (comma-separated) argument groups
490
+ * and returns a CSS value string. This is the JS flavor of the unified
491
+ * `functions` config (bare-name keys), distinct from declarative `@function`
492
+ * definitions (`$$`-prefixed keys).
493
+ */
494
+ type ParseFunction = (groups: StyleDetails[]) => string;
495
+ /**
496
+ * The unified `functions` map: keys are either bare names (parse functions,
497
+ * value is a function) or `$$name`/`$name`/`--name` (declarative CSS functions,
498
+ * value is a {@link FunctionDefinition} object).
499
+ */
500
+ type FunctionsConfig = Record<string, FunctionDefinition | ParseFunction>;
501
+ //#endregion
502
+ //#region src/utils/color-space.d.ts
503
+ /**
504
+ * Color handling that survives into the emitted CSS.
505
+ *
506
+ * Tasty does not rewrite a color into a particular color space: opacity is
507
+ * applied with CSS relative color syntax, which reads the channels off whatever
508
+ * the browser resolves a value to, so a color is emitted exactly as authored.
509
+ * What is left here is how an alpha gets applied, and the one distinction that
510
+ * matters — replacing a token's alpha versus composing onto an inherited one.
511
+ */
512
+ /**
513
+ * The color space a `#name` token's value used to be rewritten into.
514
+ *
515
+ * @deprecated Kept for the `colorSpace` config option, which no longer has any
516
+ * effect. Colors are emitted as authored and opacity is always applied in
517
+ * `oklch` through relative color syntax.
518
+ */
519
+ type ColorSpace = 'rgb' | 'hsl' | 'oklch';
520
+ //#endregion
521
+ //#region src/utils/typography.d.ts
522
+ /**
523
+ * A typography token value: plain value or a state map for responsive/theme-aware presets.
524
+ *
525
+ * @example
526
+ * // Plain value
527
+ * fontWeight: '400'
528
+ * // State map
529
+ * fontWeight: { '': '400', '@dark': '300' }
530
+ */
531
+ type TypographyTokenValue = string | number | Record<string, string | number | undefined | null | '@inherit'>;
532
+ /**
533
+ * Typography preset configuration.
534
+ * Each preset defines font properties that get expanded into CSS custom properties.
535
+ * All fields accept plain values or state maps for responsive/theme-aware tokens.
536
+ *
537
+ * Use with `generateTypographyTokens()` to create typography tokens for your design system.
538
+ */
539
+ interface TypographyPreset {
540
+ fontSize: TypographyTokenValue;
541
+ lineHeight: TypographyTokenValue;
542
+ letterSpacing?: TypographyTokenValue;
543
+ fontWeight: TypographyTokenValue;
544
+ boldFontWeight?: TypographyTokenValue;
545
+ iconSize?: TypographyTokenValue;
546
+ textTransform?: TypographyTokenValue;
547
+ fontFamily?: TypographyTokenValue;
548
+ fontStyle?: TypographyTokenValue;
549
+ }
550
+ /**
551
+ * Generate typography tokens with $ prefix for CSS custom properties.
552
+ *
553
+ * Each preset generates the following CSS custom properties:
554
+ * - `${name}-font-size`
555
+ * - `${name}-line-height`
556
+ * - `${name}-letter-spacing`
557
+ * - `${name}-font-weight`
558
+ * - `${name}-bold-font-weight` (if defined)
559
+ * - `${name}-icon-size` (if defined)
560
+ * - `${name}-text-transform` (if defined)
561
+ * - `${name}-font-family` (if defined)
562
+ * - `${name}-font-style` (if defined)
563
+ *
564
+ * @param presets - Typography presets object
565
+ * @returns ConfigTokens object with $ prefixed keys
566
+ *
567
+ * @example
568
+ * const customTokens = generateTypographyTokens({
569
+ * myHeading: { fontSize: '24px', lineHeight: '32px', fontWeight: '700' },
570
+ * body: { fontSize: '16px', lineHeight: '24px', fontWeight: '400' },
571
+ * });
572
+ */
573
+ declare function generateTypographyTokens(presets: Record<string, TypographyPreset>): ConfigTokens;
574
+ //#endregion
575
+ //#region src/plugins/types.d.ts
576
+ /**
577
+ * A tasty plugin that extends the style system with custom functions, units, states, or handlers.
578
+ */
579
+ interface TastyPlugin {
580
+ /** Unique name for the plugin (used for debugging and conflict detection) */
581
+ name: string;
582
+ /**
583
+ * Custom functions (unified map). Bare keys map to parse functions
584
+ * `(groups) => string`; `$$name` keys map to declarative CSS `@function`
585
+ * definitions. See {@link FunctionsConfig}.
586
+ */
587
+ functions?: FunctionsConfig;
588
+ /** Custom units that transform numeric values (e.g., `2x` → `calc(2 * var(--gap))`) */
589
+ units?: Record<string, string | UnitHandler>;
590
+ /** Custom state aliases (e.g., `'@mobile': '@media(w < 768px)'`) */
591
+ states?: Record<string, string>;
592
+ /**
593
+ * Custom style handlers that transform style properties into CSS declarations.
594
+ * Handlers replace built-in handlers for the same style name.
595
+ * @example
596
+ * ```ts
597
+ * handlers: {
598
+ * // Simple handler - lookup style inferred from key
599
+ * fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
600
+ * // Multi-property handler
601
+ * spacing: [['gap', 'padding'], ({ gap, padding }) => ({ ... })],
602
+ * }
603
+ * ```
604
+ */
605
+ handlers?: Record<string, StyleHandlerDefinition>;
606
+ /**
607
+ * Props middleware for every tasty component — props in, props out. The
608
+ * extension point for props that are not style properties: read a custom prop,
609
+ * strip it so it never reaches the DOM, and fold its meaning into `styles`,
610
+ * `mods`, `tokens`, `variant`, or `as`.
611
+ *
612
+ * Must be pure and must not mutate its input.
613
+ * See {@link TastyConfig.propHandlers}.
614
+ * @example
615
+ * ```ts
616
+ * propHandlers: {
617
+ * glaze: (props) => {
618
+ * const { glaze, ...rest } = props;
619
+ * if (!glaze) return rest;
620
+ * return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
621
+ * },
622
+ * }
623
+ * ```
624
+ */
625
+ propHandlers?: Record<string, PropHandlerDefinition>;
626
+ /**
627
+ * Style properties exposed as top-level props on every tasty component, in
628
+ * addition to the built-in base styles.
629
+ * See {@link TastyConfig.baseStyleProps}.
630
+ */
631
+ baseStyleProps?: readonly string[];
632
+ /**
633
+ * Design tokens injected as CSS custom properties on `:root`.
634
+ * Values are parsed through the Tasty DSL. Supports state maps.
635
+ * - `$name` → `--name` CSS custom property
636
+ * - `#name` → `--name-color`
637
+ */
638
+ tokens?: ConfigTokens;
639
+ /** Predefined tokens replaced during style parsing (`$name` or `#name`) */
640
+ replaceTokens?: Record<`$${string}` | `#${string}`, string | number>;
641
+ /**
642
+ * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
643
+ * Recipe values are flat tasty styles (no sub-element keys).
644
+ * @example
645
+ * ```ts
646
+ * recipes: {
647
+ * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
648
+ * elevated: { shadow: '2x 2x 4x #shadow' },
649
+ * }
650
+ * ```
651
+ */
652
+ recipes?: Record<string, RecipeStyles>;
653
+ /**
654
+ * Typography presets — shorthand for `generateTypographyTokens()`.
655
+ * Generated tokens are merged under explicit `tokens` (tokens win on conflict).
656
+ */
657
+ presets?: Record<string, TypographyPreset>;
658
+ /**
659
+ * Global Tasty styles keyed by CSS selector.
660
+ * Supports the full Tasty style syntax.
661
+ */
662
+ globalStyles?: Record<string, Styles>;
663
+ /**
664
+ * Global CSS `@property` definitions. A plugin whose handler or prop handler
665
+ * emits a custom property usually wants one, so the property animates and
666
+ * inherits correctly instead of being treated as an untyped string.
667
+ * See {@link TastyConfig.properties}.
668
+ */
669
+ properties?: Record<string, PropertyDefinition>;
670
+ /** Global keyframes, injected only when referenced. See {@link TastyConfig.keyframes}. */
671
+ keyframes?: Record<string, KeyframesSteps>;
672
+ /** Global `@font-face` definitions. See {@link TastyConfig.fontFaces}. */
673
+ fontFaces?: Record<string, FontFaceInput>;
674
+ /** Global `@counter-style` definitions. See {@link TastyConfig.counterStyles}. */
675
+ counterStyles?: Record<string, CounterStyleDescriptors>;
676
+ }
677
+ /**
678
+ * A factory function that creates a TastyPlugin.
679
+ * Can optionally accept configuration options.
680
+ *
681
+ * @example
682
+ * ```ts
683
+ * // Plugin without options
684
+ * const okhslPlugin: TastyPluginFactory = () => ({
685
+ * name: 'okhsl',
686
+ * functions: { okhsl: okhslFunction },
687
+ * });
688
+ *
689
+ * // Plugin with options
690
+ * const debugPlugin: TastyPluginFactory<{ verbose: boolean }> = (options) => ({
691
+ * name: 'debug',
692
+ * functions: { debug: createDebugFunc(options.verbose) },
693
+ * });
694
+ * ```
695
+ */
696
+ type TastyPluginFactory<TOptions = void> = TOptions extends void ? () => TastyPlugin : (options: TOptions) => TastyPlugin;
697
+ //#endregion
698
+ //#region src/config.d.ts
699
+ /**
700
+ * Configuration options for the Tasty style system
701
+ */
702
+ interface TastyConfig {
703
+ /** CSP nonce for style elements */
704
+ nonce?: string;
705
+ /** Maximum rules per stylesheet (default: 8192) */
706
+ maxRulesPerSheet?: number;
707
+ /** Force text injection mode, auto-detected in test environments (default: auto) */
708
+ forceTextInjection?: boolean;
709
+ /** Enable development mode features: performance metrics and debug info (default: auto) */
710
+ devMode?: boolean;
711
+ /**
712
+ * Global predefined states for advanced state mapping.
713
+ * These are state aliases that can be used in any component.
714
+ * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
715
+ */
716
+ states?: Record<string, string>;
717
+ /**
718
+ * Parser LRU cache size (default: 1000).
719
+ * Larger values improve performance for apps with many unique style values.
720
+ */
721
+ parserCacheSize?: number;
722
+ /**
723
+ * Custom units for the style parser (merged with built-in units).
724
+ * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
725
+ * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
726
+ */
727
+ units?: Record<string, string | UnitHandler>;
728
+ /**
729
+ * Custom functions (merged with existing). A single map holds both flavors,
730
+ * discriminated by value type:
731
+ *
732
+ * - **Bare key + function value** — a parse-time function that processes the
733
+ * parsed argument groups and returns a CSS value. Called as `name(...)`.
734
+ * - **`$$name` key + object value** — a declarative CSS `@function`
735
+ * definition. Called as `$$name(...)` (→ native `--name(...)`).
736
+ *
737
+ * A key whose prefix does not match its value type (object under a bare key,
738
+ * or function under a `$$` key) is ignored with a dev warning.
739
+ *
740
+ * @example
741
+ * ```ts
742
+ * configure({
743
+ * functions: {
744
+ * double: (groups) => `calc(2 * ${groups[0].output})`, // parse function
745
+ * $$negative: { args: ['$value'], result: '(-1 * $value)' }, // CSS function
746
+ * },
747
+ * });
748
+ * ```
749
+ */
750
+ functions?: FunctionsConfig;
751
+ /**
752
+ * @deprecated No longer has any effect; will be removed in the next major.
753
+ * Setting it warns in development.
754
+ *
755
+ * A `#name` token's value used to be rewritten into this color space so an
756
+ * opacity suffix had numeric channels to write an alpha into. Opacity now uses
757
+ * relative color syntax — `oklch(from var(--name-color) l c h / .5)` — which
758
+ * has the browser read the channels, so a color is emitted exactly as
759
+ * authored and there is nothing left for the setting to decide.
760
+ *
761
+ * To address a token's channels yourself, write relative color syntax against
762
+ * the token: `oklch(from var(--brand-color) calc(l * 1.2) c h)`. It works on
763
+ * every `<color>`, including the ones no conversion could evaluate.
764
+ */
765
+ colorSpace?: ColorSpace;
766
+ /**
767
+ * Automatically infer and register CSS @property declarations
768
+ * from custom property values found in styles, keyframes, and global config.
769
+ * Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
770
+ * When false, only explicitly declared @property are registered.
771
+ * @default true
772
+ */
773
+ autoPropertyTypes?: boolean;
774
+ /**
775
+ * Defer stylesheet writes and apply them in one batch instead of performing
776
+ * one `insertRule()` per component during render.
777
+ *
778
+ * Each `insertRule()` on a live sheet invalidates style for that sheet's
779
+ * scope. When components inject during React's render phase while other
780
+ * components read layout in the same pass, the two interleave and the browser
781
+ * is forced to recalculate style between every injection. Batching collapses
782
+ * that into one invalidation per flush.
783
+ *
784
+ * - `false` (default) — inject synchronously, one write per component.
785
+ * - `true` — batch, but only inside a *batch window*: a commit in which
786
+ * `<TastyBatchProvider>` rendered and will therefore flush in its
787
+ * `useInsertionEffect`, before any `useLayoutEffect` runs. Any injection
788
+ * outside a window — a deep update the provider did not re-render for, an
789
+ * injection from a layout effect, an event handler, an async callback — is
790
+ * written straight through. Enabling this can never make a layout effect
791
+ * measure an unstyled element. Requires `<TastyBatchProvider>`; without it
792
+ * nothing is batched (and dev mode says so once).
793
+ * - `'always'` — batch every injection, flushing on a microtask when no
794
+ * window is open. Wins on more commits, but a `useLayoutEffect` that
795
+ * measures a freshly mounted element can read its unstyled box, because
796
+ * microtasks run after the layout phase. Paint is unaffected: microtasks
797
+ * always drain before the browser paints.
798
+ *
799
+ * No effect during SSR or RSC: styles are collected as text there, the
800
+ * runtime injector never runs, and the provider is inert without a
801
+ * `document`. No effect on zero-runtime `tastyStatic` styles either — those
802
+ * are extracted at build time and never reach the injector.
803
+ *
804
+ * @default false
805
+ * @example
806
+ * ```tsx
807
+ * configure({ batchInjection: true });
808
+ *
809
+ * <TastyBatchProvider>
810
+ * <App />
811
+ * </TastyBatchProvider>
812
+ * ```
813
+ */
814
+ batchInjection?: boolean | 'always';
815
+ /**
816
+ * Garbage collection configuration for unused styles.
817
+ * GC is triggered by touch count: every `touchInterval` touches, the
818
+ * oldest unused styles are evicted when their count exceeds `capacity`.
819
+ * @example
820
+ * ```ts
821
+ * configure({
822
+ * gc: { touchInterval: 1000, capacity: 1000 },
823
+ * });
824
+ * ```
825
+ */
826
+ gc?: GCConfig;
827
+ /**
828
+ * Prefix prepended to every generated identifier (class names,
829
+ * keyframe names, counter-style names). The hash is appended verbatim,
830
+ * so include any separator inside the prefix itself (e.g. `'myapp-'`).
831
+ *
832
+ * Discriminator letters are inserted between the prefix and the hash
833
+ * for non-class names so the three kinds stay visually distinct:
834
+ * - class: `${namePrefix}${hash}` — e.g. `t1a2b3`
835
+ * - keyframe: `${namePrefix}k${hash}` — e.g. `tk1a2b3`
836
+ * - counter-style: `${namePrefix}c${hash}` — e.g. `tc1a2b3`
837
+ *
838
+ * The runtime, SSR, and RSC paths must agree on this value or
839
+ * hydration will mismatch. The zero-runtime build path defaults to
840
+ * `'ts'` (overridable via the same option) so its classes can't
841
+ * collide with runtime classes when both are loaded on the same page.
842
+ *
843
+ * Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. Locked once styles
844
+ * have been generated.
845
+ *
846
+ * @default 't'
847
+ */
848
+ namePrefix?: string;
849
+ /**
850
+ * Plugins that extend tasty with custom functions, units, or states.
851
+ * Plugins are processed in order, with later plugins overriding earlier ones.
852
+ * @example
853
+ * ```ts
854
+ * import { okhslPlugin } from '@tenphi/tasty';
855
+ *
856
+ * configure({
857
+ * plugins: [okhslPlugin()],
858
+ * });
859
+ * ```
860
+ */
861
+ plugins?: TastyPlugin[];
862
+ /**
863
+ * Global keyframes definitions that can be referenced by animation names in styles.
864
+ * Keys are animation names, values are keyframes step definitions.
865
+ * Keyframes are only injected when actually used in styles.
866
+ * @example
867
+ * ```ts
868
+ * configure({
869
+ * keyframes: {
870
+ * fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } },
871
+ * pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } },
872
+ * },
873
+ * });
874
+ * ```
875
+ */
876
+ keyframes?: Record<string, KeyframesSteps>;
877
+ /**
878
+ * Global CSS @property definitions for custom properties.
879
+ * Keys use tasty token syntax ($name for properties, #name for colors).
880
+ *
881
+ * Tasty ships with `DEFAULT_PROPERTIES` (e.g. `$gap`, `$radius`, `#white`,
882
+ * `#black`, `#clear`, `#border`, etc.) that are always included.
883
+ * Properties you specify here are merged on top, so you can override any
884
+ * default by using the same key.
885
+ *
886
+ * For color tokens (#name), `syntax: '<color>'` is auto-set and
887
+ * `initialValue` defaults to `'transparent'` if not specified.
888
+ *
889
+ * @example
890
+ * ```ts
891
+ * configure({
892
+ * properties: {
893
+ * '$rotation': { syntax: '<angle>', initialValue: '0deg' },
894
+ * '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
895
+ * '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
896
+ * // Override a default property:
897
+ * '$gap': { syntax: '<length>', inherits: true, initialValue: '8px' },
898
+ * },
899
+ * });
900
+ *
901
+ * // Now use in styles - properties are registered when component renders:
902
+ * const Spinner = tasty({
903
+ * styles: {
904
+ * transform: 'rotate($rotation)',
905
+ * transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
906
+ * },
907
+ * });
908
+ * ```
909
+ */
910
+ properties?: Record<string, PropertyDefinition>;
911
+ /**
912
+ * Global @font-face definitions.
913
+ * Keys are font-family names, values are descriptors or arrays of descriptors
914
+ * (for multiple weights/styles of the same family).
915
+ * Injected eagerly when styles are first generated.
916
+ * @example
917
+ * ```ts
918
+ * configure({
919
+ * fontFaces: {
920
+ * 'Brand Sans': [
921
+ * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
922
+ * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
923
+ * ],
924
+ * Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' },
925
+ * },
926
+ * });
927
+ * ```
928
+ */
929
+ fontFaces?: Record<string, FontFaceInput>;
930
+ /**
931
+ * Global @counter-style definitions.
932
+ * Keys are counter-style names, values are descriptor objects.
933
+ * Injected eagerly when styles are first generated.
934
+ * @example
935
+ * ```ts
936
+ * configure({
937
+ * counterStyles: {
938
+ * thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
939
+ * },
940
+ * });
941
+ * ```
942
+ */
943
+ counterStyles?: Record<string, CounterStyleDescriptors>;
944
+ /**
945
+ * Opt-in polyfills for not-yet-baseline CSS features. Each key toggles a
946
+ * feature polyfill; all default to `false`.
947
+ *
948
+ * - `functions` — polyfill CSS `@function` by inlining every `$$name(...)`
949
+ * call into plain CSS (calc/var/color-mix) at parse time instead of
950
+ * emitting the native `@function` at-rule. Enables `@function` usage in
951
+ * browsers that don't support it yet (Firefox/Safari). Note this is the
952
+ * `functions` *feature toggle*, distinct from the top-level `functions`
953
+ * definitions map.
954
+ *
955
+ * @example
956
+ * ```ts
957
+ * configure({ polyfills: { functions: true } });
958
+ * ```
959
+ */
960
+ polyfills?: {
961
+ functions?: boolean;
962
+ };
963
+ /**
964
+ * Custom style handlers that transform style properties into CSS declarations.
965
+ * Handlers replace built-in handlers for the same style name.
966
+ * @example
967
+ * ```ts
968
+ * import { styleHandlers } from '@tenphi/tasty';
969
+ *
970
+ * configure({
971
+ * handlers: {
972
+ * // Override fill with custom behavior
973
+ * fill: ({ fill }) => {
974
+ * if (fill?.startsWith('gradient:')) {
975
+ * return { background: fill.slice(9) };
976
+ * }
977
+ * return styleHandlers.fill({ fill });
978
+ * },
979
+ * // Add new custom style
980
+ * elevation: ({ elevation }) => {
981
+ * const level = parseInt(elevation) || 1;
982
+ * return {
983
+ * 'box-shadow': `0 ${level * 2}px ${level * 4}px rgba(0,0,0,0.1)`,
984
+ * 'z-index': String(level * 100),
985
+ * };
986
+ * },
987
+ * },
988
+ * });
989
+ * ```
990
+ */
991
+ handlers?: Record<string, StyleHandlerDefinition>;
992
+ /**
993
+ * Props middleware for every tasty component. A prop handler receives the
994
+ * component's props and returns them, changed or not — the extension point for
995
+ * props that are not style properties.
996
+ *
997
+ * The map key is the handler's name and, by default, the prop that triggers it.
998
+ * Use `['*', fn]` for an unconditional handler, or `[['a', 'b'], fn]` to trigger
999
+ * on any of several props.
1000
+ *
1001
+ * Handlers must be pure and must not mutate their input: style values are cached
1002
+ * by object identity, so mutating one in place yields stale CSS. Memoize the
1003
+ * styles you build per input value.
1004
+ *
1005
+ * Not applicable to zero-runtime mode — `tastyStatic()` takes styles objects, not
1006
+ * props, so there is nothing for middleware to run on. Components rendered
1007
+ * through `tasty()` are unaffected and keep the runtime injector.
1008
+ *
1009
+ * @example
1010
+ * ```ts
1011
+ * configure({
1012
+ * propHandlers: {
1013
+ * glaze: (props) => {
1014
+ * const { glaze, ...rest } = props;
1015
+ * if (!glaze) return rest;
1016
+ * return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
1017
+ * },
1018
+ * },
1019
+ * });
1020
+ *
1021
+ * <Element glaze="purple" />
1022
+ * ```
1023
+ */
1024
+ propHandlers?: Record<string, PropHandlerDefinition>;
1025
+ /**
1026
+ * Style properties exposed as top-level props on **every** tasty component, in
1027
+ * addition to the built-in base styles, without each component listing them in
1028
+ * `styleProps`.
1029
+ *
1030
+ * Augment `TastyBaseStylePropNames` to type them. Each name costs one property
1031
+ * check per render of every component, so keep the list short; the effect is
1032
+ * app-global and cannot be scoped to a subtree.
1033
+ *
1034
+ * @example
1035
+ * ```ts
1036
+ * configure({ baseStyleProps: ['radius', 'shadow'] });
1037
+ *
1038
+ * <Card radius="1r" shadow />
1039
+ * ```
1040
+ */
1041
+ baseStyleProps?: readonly string[];
1042
+ /**
1043
+ * Design tokens injected as CSS custom properties on `:root`.
1044
+ * Values are parsed through the Tasty DSL. Supports state maps
1045
+ * for responsive/theme-aware tokens.
1046
+ *
1047
+ * - `$name` keys become `--name` CSS custom properties
1048
+ * - `#name` keys become `--name-color` properties
1049
+ *
1050
+ * Tokens are injected once when the first style is rendered.
1051
+ *
1052
+ * @example
1053
+ * ```ts
1054
+ * configure({
1055
+ * tokens: {
1056
+ * '$gap': '4px',
1057
+ * '#primary': {
1058
+ * '': '#purple',
1059
+ * '@dark': '#light-purple',
1060
+ * },
1061
+ * },
1062
+ * });
1063
+ * ```
1064
+ */
1065
+ tokens?: ConfigTokens;
1066
+ /**
1067
+ * Predefined tokens that are replaced during style parsing (parse-time substitution).
1068
+ * Use `$name` for custom properties and `#name` for color tokens.
1069
+ * Values are substituted inline before CSS generation, unlike `tokens` which
1070
+ * inject CSS custom properties on `:root`.
1071
+ *
1072
+ * For color tokens (#name), boolean `true` is converted to `transparent`.
1073
+ *
1074
+ * @example
1075
+ * ```ts
1076
+ * configure({
1077
+ * replaceTokens: {
1078
+ * $spacing: '2x',
1079
+ * '#accent': '#purple',
1080
+ * '#overlay': true, // → transparent
1081
+ * },
1082
+ * });
1083
+ *
1084
+ * // Now use in styles - tokens are replaced at parse time:
1085
+ * const Card = tasty({
1086
+ * styles: {
1087
+ * padding: '$spacing', // → calc(2 * var(--gap))
1088
+ * fill: '#accent', // → var(--purple-color)
1089
+ * },
1090
+ * });
1091
+ * ```
1092
+ */
1093
+ replaceTokens?: Record<`$${string}`, string | number | boolean> & Record<`#${string}`, string | number | boolean>;
1094
+ /**
1095
+ * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
1096
+ * Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
1097
+ * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@property`.
1098
+ *
1099
+ * Components reference recipes via: `recipe: 'name1 name2'` in their styles.
1100
+ * Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
1101
+ * Use `none` to skip base recipes: `recipe: 'none / post1'`.
1102
+ * Resolution order: `base_recipes → component styles → post_recipes`.
1103
+ *
1104
+ * Recipes cannot reference other recipes.
1105
+ *
1106
+ * @example
1107
+ * ```ts
1108
+ * configure({
1109
+ * recipes: {
1110
+ * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
1111
+ * elevated: { shadow: '2x 2x 4x #shadow' },
1112
+ * },
1113
+ * });
1114
+ *
1115
+ * // Usage in styles:
1116
+ * const Card = tasty({
1117
+ * styles: {
1118
+ * recipe: 'card elevated',
1119
+ * color: '#text', // Overrides recipe values
1120
+ * },
1121
+ * });
1122
+ * ```
1123
+ */
1124
+ recipes?: Record<string, RecipeStyles>;
1125
+ /**
1126
+ * Typography presets — shorthand for `generateTypographyTokens()`.
1127
+ * Accepts the same input and internally generates typography tokens
1128
+ * that are merged into `tokens`. Explicit `tokens` override preset-generated ones.
1129
+ *
1130
+ * @example
1131
+ * ```ts
1132
+ * configure({
1133
+ * presets: {
1134
+ * h1: { fontSize: '32px', lineHeight: '1.2', fontWeight: '700' },
1135
+ * t2: { fontSize: '16px', lineHeight: '1.5', fontWeight: '400' },
1136
+ * },
1137
+ * tokens: {
1138
+ * // Overrides the preset-generated $t2-font-weight
1139
+ * '$t2-font-weight': { '': '400', '@dark': '300' },
1140
+ * },
1141
+ * });
1142
+ * ```
1143
+ */
1144
+ presets?: Record<string, TypographyPreset>;
1145
+ /**
1146
+ * Global Tasty styles keyed by CSS selector.
1147
+ * Each entry applies the full Tasty style syntax (style properties,
1148
+ * tokens, state maps, selector-based sub-styling) to the given selector.
1149
+ * Injected alongside `:root` tokens when the first style is rendered.
1150
+ *
1151
+ * @example
1152
+ * ```ts
1153
+ * configure({
1154
+ * globalStyles: {
1155
+ * body: { fill: '#surface', color: '#text', preset: 't2', margin: 0 },
1156
+ * html: { overflow: 'hidden' },
1157
+ * },
1158
+ * });
1159
+ * ```
1160
+ */
1161
+ globalStyles?: Record<string, Styles>;
1162
+ }
1163
+ declare const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
1164
+ declare global {
1165
+ interface Window {
1166
+ [GLOBAL_INJECTOR_KEY]?: StyleInjector;
1167
+ }
1168
+ var __TASTY_GLOBAL_INJECTOR__: StyleInjector | undefined;
1169
+ }
1170
+ /**
1171
+ * Detect if we're running in a test environment
1172
+ */
1173
+ declare function isTestEnvironment(): boolean;
1174
+ /**
1175
+ * Check if styles have been generated (configuration is locked)
1176
+ */
1177
+ declare function hasStylesGenerated(): boolean;
1178
+ /**
1179
+ * Check if any global keyframes are configured.
1180
+ * Uses a pre-computed flag to avoid Object.keys() allocation on every call.
1181
+ */
1182
+ declare function hasGlobalKeyframes(): boolean;
1183
+ /**
1184
+ * Get global keyframes configuration.
1185
+ * Returns null if no keyframes configured (fast path for zero-overhead).
1186
+ */
1187
+ declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
1188
+ /**
1189
+ * Get global font-face configuration.
1190
+ * Returns null if no font faces configured.
1191
+ * Reads from globalThis first for cross-module SSR support.
1192
+ */
1193
+ declare function getGlobalFontFaces(): Record<string, FontFaceInput> | null;
1194
+ /**
1195
+ * Get global counter-style configuration.
1196
+ * Returns null if no counter styles configured.
1197
+ * Reads from globalThis first for cross-module SSR support.
1198
+ */
1199
+ declare function getGlobalCounterStyles(): Record<string, CounterStyleDescriptors> | null;
1200
+ /**
1201
+ * Get global @function configuration.
1202
+ * Returns null if no functions configured.
1203
+ * Reads from globalThis first for cross-module SSR support.
1204
+ */
1205
+ declare function getGlobalFunctions(): Record<string, FunctionDefinition> | null;
1206
+ /**
1207
+ * Check if any global recipes are configured.
1208
+ * Fast path: returns false if no recipes were ever set.
1209
+ */
1210
+ declare function hasGlobalRecipes(): boolean;
1211
+ /**
1212
+ * Get global recipes configuration.
1213
+ * Returns null if no recipes configured (fast path for zero-overhead).
1214
+ */
1215
+ declare function getGlobalRecipes(): Record<string, RecipeStyles> | null;
1216
+ /**
1217
+ * Check if configuration is locked (styles have been generated)
1218
+ */
1219
+ declare function isConfigLocked(): boolean;
1220
+ /**
1221
+ * Configure the Tasty style system.
1222
+ *
1223
+ * Must be called BEFORE any styles are generated (before first render that uses tasty).
1224
+ * After styles are generated, configuration is locked and calls to configure() will
1225
+ * emit a warning and be ignored.
1226
+ *
1227
+ * @example
1228
+ * ```ts
1229
+ * import { configure } from '@tenphi/tasty';
1230
+ *
1231
+ * // Configure before app renders
1232
+ * configure({
1233
+ * nonce: 'abc123',
1234
+ * states: {
1235
+ * '@mobile': '@media(w < 768px)',
1236
+ * '@dark': '@root(theme=dark)',
1237
+ * },
1238
+ * });
1239
+ * ```
1240
+ */
1241
+ declare function configure(config?: Partial<TastyConfig>): void;
1242
+ /**
1243
+ * Get the current configuration.
1244
+ * If not configured, returns default configuration.
1245
+ */
1246
+ declare function getConfig(): TastyConfig;
1247
+ /**
1248
+ * Get the configured prefix used for every generated identifier
1249
+ * (class names, keyframe names, counter-style names).
1250
+ *
1251
+ * Falls back to the default prefix (`'t'`) when `configure()` has not
1252
+ * been called yet — this matches the auto-configuration behavior used
1253
+ * by the rest of the system.
1254
+ */
1255
+ declare function getNamePrefix(): string;
1256
+ /**
1257
+ * Reset configuration (for testing only).
1258
+ * Clears the global injector and allows reconfiguration.
1259
+ */
1260
+ declare function resetConfig(): void;
1261
+ //#endregion
1262
+ export { ParseFunction as C, PropHandlerDefinition as D, PropHandler as E, PropHandlerProps as O, FunctionsConfig as S, SheetManager as T, TastyPluginFactory as _, getGlobalFontFaces as a, generateTypographyTokens as b, getGlobalRecipes as c, hasGlobalRecipes as d, hasStylesGenerated as f, TastyPlugin as g, resetConfig as h, getGlobalCounterStyles as i, getNamePrefix as l, isTestEnvironment as m, configure as n, getGlobalFunctions as o, isConfigLocked as p, getConfig as r, getGlobalKeyframes as s, TastyConfig as t, hasGlobalKeyframes as u, TypographyPreset as v, StyleInjector as w, ColorSpace as x, TypographyTokenValue as y };
1263
+ //# sourceMappingURL=config-YsxGv4tq.d.ts.map