@tenphi/tasty 0.0.0-snapshot.bbd10c7 → 0.0.0-snapshot.bbfcd75

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