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

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