@tenphi/tasty 0.0.0-snapshot.6ea31ec → 0.0.0-snapshot.6ef148e

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 (345) hide show
  1. package/README.md +40 -28
  2. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +16 -6
  3. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/{ssr/collector.js → collector-D0cgyN6N.js} +62 -39
  5. package/dist/collector-D0cgyN6N.js.map +1 -0
  6. package/dist/{ssr/collector.d.ts → collector-yqgjGje7.d.ts} +29 -17
  7. package/dist/config-V0XC9iz_.d.ts +958 -0
  8. package/dist/config-_cYm9LPl.js +11034 -0
  9. package/dist/config-_cYm9LPl.js.map +1 -0
  10. package/dist/context-CA8YKeMn.js +24 -0
  11. package/dist/context-CA8YKeMn.js.map +1 -0
  12. package/dist/core/index.d.ts +5 -33
  13. package/dist/core/index.js +6 -26
  14. package/dist/core-DdjoZG0r.js +1612 -0
  15. package/dist/core-DdjoZG0r.js.map +1 -0
  16. package/dist/{zero/extractor.js → css-writer-DTUwLjgD.js} +98 -13
  17. package/dist/css-writer-DTUwLjgD.js.map +1 -0
  18. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
  19. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  20. package/dist/format-rules-Bu_qoamZ.js +143 -0
  21. package/dist/format-rules-Bu_qoamZ.js.map +1 -0
  22. package/dist/hydrate-CKk-rgmY.js +45 -0
  23. package/dist/hydrate-CKk-rgmY.js.map +1 -0
  24. package/dist/index-BjnGYI5D.d.ts +1786 -0
  25. package/dist/index-tRick_JW.d.ts +1306 -0
  26. package/dist/index.d.ts +5 -50
  27. package/dist/index.js +803 -35
  28. package/dist/index.js.map +1 -0
  29. package/dist/keyframes-5LJYS8_P.js +595 -0
  30. package/dist/keyframes-5LJYS8_P.js.map +1 -0
  31. package/dist/{utils/merge-styles.js → merge-styles-Blrs8kLM.js} +3 -4
  32. package/dist/merge-styles-Blrs8kLM.js.map +1 -0
  33. package/dist/{utils/merge-styles.d.ts → merge-styles-DDss7wRH.d.ts} +3 -3
  34. package/dist/{utils/resolve-recipes.js → resolve-recipes-DR5cSG3X.js} +4 -6
  35. package/dist/resolve-recipes-DR5cSG3X.js.map +1 -0
  36. package/dist/ssr/astro-client.js +19 -0
  37. package/dist/ssr/astro-client.js.map +1 -0
  38. package/dist/ssr/astro-middleware.d.ts +15 -0
  39. package/dist/ssr/astro-middleware.js +19 -0
  40. package/dist/ssr/astro-middleware.js.map +1 -0
  41. package/dist/ssr/astro.d.ts +78 -10
  42. package/dist/ssr/astro.js +113 -30
  43. package/dist/ssr/astro.js.map +1 -1
  44. package/dist/ssr/index.d.ts +44 -5
  45. package/dist/ssr/index.js +6 -7
  46. package/dist/ssr/index.js.map +1 -1
  47. package/dist/ssr/next.d.ts +6 -6
  48. package/dist/ssr/next.js +16 -10
  49. package/dist/ssr/next.js.map +1 -1
  50. package/dist/static/index.d.ts +91 -5
  51. package/dist/static/index.js +49 -3
  52. package/dist/static/index.js.map +1 -0
  53. package/dist/static/inject.js.map +1 -1
  54. package/dist/zero/babel.d.ts +8 -110
  55. package/dist/zero/babel.js +57 -21
  56. package/dist/zero/babel.js.map +1 -1
  57. package/dist/zero/index.d.ts +67 -3
  58. package/dist/zero/index.js +1 -2
  59. package/dist/zero/next.js.map +1 -1
  60. package/docs/README.md +5 -4
  61. package/docs/adoption.md +5 -3
  62. package/docs/ai-agents.md +206 -0
  63. package/docs/comparison.md +24 -25
  64. package/docs/configuration.md +113 -1
  65. package/docs/debug.md +11 -9
  66. package/docs/design-system.md +22 -10
  67. package/docs/dsl.md +147 -21
  68. package/docs/getting-started.md +10 -10
  69. package/docs/injector.md +58 -27
  70. package/docs/methodology.md +78 -3
  71. package/docs/pipeline.md +744 -0
  72. package/docs/{runtime.md → react-api.md} +148 -33
  73. package/docs/ssr.md +142 -82
  74. package/docs/styles.md +44 -8
  75. package/docs/tasty-static.md +29 -2
  76. package/package.json +30 -13
  77. package/tasty.config.ts +2 -0
  78. package/dist/_virtual/_rolldown/runtime.js +0 -7
  79. package/dist/chunks/cacheKey.js +0 -77
  80. package/dist/chunks/cacheKey.js.map +0 -1
  81. package/dist/chunks/definitions.d.ts +0 -37
  82. package/dist/chunks/definitions.js +0 -258
  83. package/dist/chunks/definitions.js.map +0 -1
  84. package/dist/chunks/index.d.ts +0 -1
  85. package/dist/chunks/renderChunk.d.ts +0 -1
  86. package/dist/chunks/renderChunk.js +0 -59
  87. package/dist/chunks/renderChunk.js.map +0 -1
  88. package/dist/config.d.ts +0 -366
  89. package/dist/config.js +0 -503
  90. package/dist/config.js.map +0 -1
  91. package/dist/counter-style/index.js +0 -51
  92. package/dist/counter-style/index.js.map +0 -1
  93. package/dist/debug.d.ts +0 -89
  94. package/dist/debug.js +0 -453
  95. package/dist/debug.js.map +0 -1
  96. package/dist/font-face/index.js +0 -63
  97. package/dist/font-face/index.js.map +0 -1
  98. package/dist/hooks/index.d.ts +0 -7
  99. package/dist/hooks/resolve-ssr-collector.js +0 -14
  100. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  101. package/dist/hooks/useCounterStyle.d.ts +0 -50
  102. package/dist/hooks/useCounterStyle.js +0 -46
  103. package/dist/hooks/useCounterStyle.js.map +0 -1
  104. package/dist/hooks/useFontFace.d.ts +0 -43
  105. package/dist/hooks/useFontFace.js +0 -70
  106. package/dist/hooks/useFontFace.js.map +0 -1
  107. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  108. package/dist/hooks/useGlobalStyles.js +0 -78
  109. package/dist/hooks/useGlobalStyles.js.map +0 -1
  110. package/dist/hooks/useKeyframes.d.ts +0 -56
  111. package/dist/hooks/useKeyframes.js +0 -64
  112. package/dist/hooks/useKeyframes.js.map +0 -1
  113. package/dist/hooks/useProperty.d.ts +0 -79
  114. package/dist/hooks/useProperty.js +0 -109
  115. package/dist/hooks/useProperty.js.map +0 -1
  116. package/dist/hooks/useRawCSS.d.ts +0 -53
  117. package/dist/hooks/useRawCSS.js +0 -35
  118. package/dist/hooks/useRawCSS.js.map +0 -1
  119. package/dist/hooks/useStyles.d.ts +0 -45
  120. package/dist/hooks/useStyles.js +0 -237
  121. package/dist/hooks/useStyles.js.map +0 -1
  122. package/dist/injector/index.d.ts +0 -183
  123. package/dist/injector/index.js +0 -179
  124. package/dist/injector/index.js.map +0 -1
  125. package/dist/injector/injector.d.ts +0 -166
  126. package/dist/injector/injector.js +0 -464
  127. package/dist/injector/injector.js.map +0 -1
  128. package/dist/injector/sheet-manager.d.ts +0 -136
  129. package/dist/injector/sheet-manager.js +0 -733
  130. package/dist/injector/sheet-manager.js.map +0 -1
  131. package/dist/injector/types.d.ts +0 -204
  132. package/dist/keyframes/index.js +0 -206
  133. package/dist/keyframes/index.js.map +0 -1
  134. package/dist/parser/classify.js +0 -319
  135. package/dist/parser/classify.js.map +0 -1
  136. package/dist/parser/const.js +0 -60
  137. package/dist/parser/const.js.map +0 -1
  138. package/dist/parser/lru.js +0 -109
  139. package/dist/parser/lru.js.map +0 -1
  140. package/dist/parser/parser.d.ts +0 -25
  141. package/dist/parser/parser.js +0 -115
  142. package/dist/parser/parser.js.map +0 -1
  143. package/dist/parser/tokenizer.js +0 -69
  144. package/dist/parser/tokenizer.js.map +0 -1
  145. package/dist/parser/types.d.ts +0 -51
  146. package/dist/parser/types.js +0 -46
  147. package/dist/parser/types.js.map +0 -1
  148. package/dist/pipeline/conditions.d.ts +0 -134
  149. package/dist/pipeline/conditions.js +0 -406
  150. package/dist/pipeline/conditions.js.map +0 -1
  151. package/dist/pipeline/exclusive.js +0 -230
  152. package/dist/pipeline/exclusive.js.map +0 -1
  153. package/dist/pipeline/index.d.ts +0 -55
  154. package/dist/pipeline/index.js +0 -708
  155. package/dist/pipeline/index.js.map +0 -1
  156. package/dist/pipeline/materialize.js +0 -1103
  157. package/dist/pipeline/materialize.js.map +0 -1
  158. package/dist/pipeline/parseStateKey.d.ts +0 -15
  159. package/dist/pipeline/parseStateKey.js +0 -446
  160. package/dist/pipeline/parseStateKey.js.map +0 -1
  161. package/dist/pipeline/simplify.js +0 -515
  162. package/dist/pipeline/simplify.js.map +0 -1
  163. package/dist/pipeline/warnings.js +0 -18
  164. package/dist/pipeline/warnings.js.map +0 -1
  165. package/dist/plugins/index.d.ts +0 -2
  166. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  167. package/dist/plugins/okhsl-plugin.js +0 -97
  168. package/dist/plugins/okhsl-plugin.js.map +0 -1
  169. package/dist/plugins/types.d.ts +0 -76
  170. package/dist/properties/index.js +0 -222
  171. package/dist/properties/index.js.map +0 -1
  172. package/dist/properties/property-type-resolver.d.ts +0 -24
  173. package/dist/properties/property-type-resolver.js +0 -90
  174. package/dist/properties/property-type-resolver.js.map +0 -1
  175. package/dist/ssr/async-storage.d.ts +0 -17
  176. package/dist/ssr/async-storage.js.map +0 -1
  177. package/dist/ssr/collect-auto-properties.js +0 -39
  178. package/dist/ssr/collect-auto-properties.js.map +0 -1
  179. package/dist/ssr/collector.js.map +0 -1
  180. package/dist/ssr/context.d.ts +0 -8
  181. package/dist/ssr/context.js +0 -13
  182. package/dist/ssr/context.js.map +0 -1
  183. package/dist/ssr/format-global-rules.js.map +0 -1
  184. package/dist/ssr/format-keyframes.js +0 -69
  185. package/dist/ssr/format-keyframes.js.map +0 -1
  186. package/dist/ssr/format-property.js +0 -49
  187. package/dist/ssr/format-property.js.map +0 -1
  188. package/dist/ssr/format-rules.js +0 -73
  189. package/dist/ssr/format-rules.js.map +0 -1
  190. package/dist/ssr/hydrate.d.ts +0 -22
  191. package/dist/ssr/hydrate.js +0 -49
  192. package/dist/ssr/hydrate.js.map +0 -1
  193. package/dist/ssr/ssr-collector-ref.js +0 -12
  194. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  195. package/dist/states/index.d.ts +0 -49
  196. package/dist/states/index.js +0 -170
  197. package/dist/states/index.js.map +0 -1
  198. package/dist/static/tastyStatic.d.ts +0 -46
  199. package/dist/static/tastyStatic.js +0 -30
  200. package/dist/static/tastyStatic.js.map +0 -1
  201. package/dist/static/types.d.ts +0 -49
  202. package/dist/static/types.js +0 -24
  203. package/dist/static/types.js.map +0 -1
  204. package/dist/styles/border.d.ts +0 -25
  205. package/dist/styles/border.js +0 -105
  206. package/dist/styles/border.js.map +0 -1
  207. package/dist/styles/color.d.ts +0 -14
  208. package/dist/styles/color.js +0 -26
  209. package/dist/styles/color.js.map +0 -1
  210. package/dist/styles/const.js +0 -17
  211. package/dist/styles/const.js.map +0 -1
  212. package/dist/styles/createStyle.js +0 -79
  213. package/dist/styles/createStyle.js.map +0 -1
  214. package/dist/styles/dimension.js +0 -109
  215. package/dist/styles/dimension.js.map +0 -1
  216. package/dist/styles/directional.js +0 -125
  217. package/dist/styles/directional.js.map +0 -1
  218. package/dist/styles/display.d.ts +0 -30
  219. package/dist/styles/display.js +0 -73
  220. package/dist/styles/display.js.map +0 -1
  221. package/dist/styles/fade.d.ts +0 -15
  222. package/dist/styles/fade.js +0 -62
  223. package/dist/styles/fade.js.map +0 -1
  224. package/dist/styles/fill.d.ts +0 -42
  225. package/dist/styles/fill.js +0 -51
  226. package/dist/styles/fill.js.map +0 -1
  227. package/dist/styles/flow.d.ts +0 -16
  228. package/dist/styles/flow.js +0 -12
  229. package/dist/styles/flow.js.map +0 -1
  230. package/dist/styles/gap.d.ts +0 -31
  231. package/dist/styles/gap.js +0 -38
  232. package/dist/styles/gap.js.map +0 -1
  233. package/dist/styles/height.d.ts +0 -17
  234. package/dist/styles/height.js +0 -19
  235. package/dist/styles/height.js.map +0 -1
  236. package/dist/styles/index.d.ts +0 -1
  237. package/dist/styles/index.js +0 -8
  238. package/dist/styles/index.js.map +0 -1
  239. package/dist/styles/inset.d.ts +0 -24
  240. package/dist/styles/inset.js +0 -34
  241. package/dist/styles/inset.js.map +0 -1
  242. package/dist/styles/list.d.ts +0 -16
  243. package/dist/styles/list.js +0 -100
  244. package/dist/styles/list.js.map +0 -1
  245. package/dist/styles/margin.d.ts +0 -24
  246. package/dist/styles/margin.js +0 -32
  247. package/dist/styles/margin.js.map +0 -1
  248. package/dist/styles/outline.d.ts +0 -29
  249. package/dist/styles/outline.js +0 -55
  250. package/dist/styles/outline.js.map +0 -1
  251. package/dist/styles/padding.d.ts +0 -24
  252. package/dist/styles/padding.js +0 -32
  253. package/dist/styles/padding.js.map +0 -1
  254. package/dist/styles/placement.d.ts +0 -37
  255. package/dist/styles/placement.js +0 -74
  256. package/dist/styles/placement.js.map +0 -1
  257. package/dist/styles/predefined.d.ts +0 -71
  258. package/dist/styles/predefined.js +0 -237
  259. package/dist/styles/predefined.js.map +0 -1
  260. package/dist/styles/preset.d.ts +0 -52
  261. package/dist/styles/preset.js +0 -127
  262. package/dist/styles/preset.js.map +0 -1
  263. package/dist/styles/radius.d.ts +0 -12
  264. package/dist/styles/radius.js +0 -73
  265. package/dist/styles/radius.js.map +0 -1
  266. package/dist/styles/scrollMargin.d.ts +0 -24
  267. package/dist/styles/scrollMargin.js +0 -32
  268. package/dist/styles/scrollMargin.js.map +0 -1
  269. package/dist/styles/scrollbar.d.ts +0 -25
  270. package/dist/styles/scrollbar.js +0 -51
  271. package/dist/styles/scrollbar.js.map +0 -1
  272. package/dist/styles/shadow.d.ts +0 -14
  273. package/dist/styles/shadow.js +0 -25
  274. package/dist/styles/shadow.js.map +0 -1
  275. package/dist/styles/shared.js +0 -17
  276. package/dist/styles/shared.js.map +0 -1
  277. package/dist/styles/transition.d.ts +0 -14
  278. package/dist/styles/transition.js +0 -159
  279. package/dist/styles/transition.js.map +0 -1
  280. package/dist/styles/types.d.ts +0 -564
  281. package/dist/styles/width.d.ts +0 -17
  282. package/dist/styles/width.js +0 -19
  283. package/dist/styles/width.js.map +0 -1
  284. package/dist/tasty.d.ts +0 -119
  285. package/dist/tasty.js +0 -231
  286. package/dist/tasty.js.map +0 -1
  287. package/dist/types.d.ts +0 -184
  288. package/dist/utils/cache-wrapper.js +0 -21
  289. package/dist/utils/cache-wrapper.js.map +0 -1
  290. package/dist/utils/case-converter.js +0 -8
  291. package/dist/utils/case-converter.js.map +0 -1
  292. package/dist/utils/color-math.d.ts +0 -46
  293. package/dist/utils/color-math.js +0 -749
  294. package/dist/utils/color-math.js.map +0 -1
  295. package/dist/utils/color-space.d.ts +0 -5
  296. package/dist/utils/color-space.js +0 -228
  297. package/dist/utils/color-space.js.map +0 -1
  298. package/dist/utils/colors.d.ts +0 -5
  299. package/dist/utils/colors.js +0 -10
  300. package/dist/utils/colors.js.map +0 -1
  301. package/dist/utils/css-types.d.ts +0 -7
  302. package/dist/utils/dotize.d.ts +0 -26
  303. package/dist/utils/dotize.js +0 -122
  304. package/dist/utils/dotize.js.map +0 -1
  305. package/dist/utils/filter-base-props.d.ts +0 -15
  306. package/dist/utils/filter-base-props.js +0 -45
  307. package/dist/utils/filter-base-props.js.map +0 -1
  308. package/dist/utils/get-display-name.d.ts +0 -7
  309. package/dist/utils/get-display-name.js +0 -10
  310. package/dist/utils/get-display-name.js.map +0 -1
  311. package/dist/utils/has-keys.js +0 -13
  312. package/dist/utils/has-keys.js.map +0 -1
  313. package/dist/utils/is-dev-env.js +0 -19
  314. package/dist/utils/is-dev-env.js.map +0 -1
  315. package/dist/utils/is-valid-element-type.js +0 -15
  316. package/dist/utils/is-valid-element-type.js.map +0 -1
  317. package/dist/utils/merge-styles.js.map +0 -1
  318. package/dist/utils/mod-attrs.d.ts +0 -6
  319. package/dist/utils/mod-attrs.js +0 -20
  320. package/dist/utils/mod-attrs.js.map +0 -1
  321. package/dist/utils/process-tokens.d.ts +0 -21
  322. package/dist/utils/process-tokens.js +0 -90
  323. package/dist/utils/process-tokens.js.map +0 -1
  324. package/dist/utils/resolve-recipes.d.ts +0 -17
  325. package/dist/utils/resolve-recipes.js.map +0 -1
  326. package/dist/utils/selector-transform.js +0 -32
  327. package/dist/utils/selector-transform.js.map +0 -1
  328. package/dist/utils/string.js +0 -8
  329. package/dist/utils/string.js.map +0 -1
  330. package/dist/utils/styles.d.ts +0 -99
  331. package/dist/utils/styles.js +0 -220
  332. package/dist/utils/styles.js.map +0 -1
  333. package/dist/utils/typography.d.ts +0 -47
  334. package/dist/utils/typography.js +0 -51
  335. package/dist/utils/typography.js.map +0 -1
  336. package/dist/utils/warnings.d.ts +0 -16
  337. package/dist/utils/warnings.js +0 -16
  338. package/dist/utils/warnings.js.map +0 -1
  339. package/dist/zero/css-writer.d.ts +0 -45
  340. package/dist/zero/css-writer.js +0 -73
  341. package/dist/zero/css-writer.js.map +0 -1
  342. package/dist/zero/extractor.d.ts +0 -24
  343. package/dist/zero/extractor.js.map +0 -1
  344. package/docs/PIPELINE.md +0 -519
  345. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
@@ -0,0 +1,958 @@
1
+ import { Ct as RawCSSResult, Dt as StyleInjectorConfig, Et as SheetInfo, M as StyleHandlerDefinition, Ot as StyleRule, St as PropertyDefinition, Tt as RuleInfo, b as Styles, bt as KeyframesResult, ct as CacheMetrics, dt as FontFaceDescriptors, ft as FontFaceInput, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as StyleDetails, lt as CounterStyleDescriptors, mt as GCOptions, n as StyleResult, ot as UnitHandler, pt as GCConfig, v as RecipeStyles, wt as RootRegistry, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-tRick_JW.js";
2
+
3
+ //#region src/injector/sheet-manager.d.ts
4
+ declare class SheetManager {
5
+ private rootRegistries;
6
+ /** Strong set of active roots so background GC can iterate them all */
7
+ private activeRoots;
8
+ private config;
9
+ /** Dedicated style elements for raw CSS per root */
10
+ private rawStyleElements;
11
+ /** Constructable sheets for raw CSS in adopted mode */
12
+ private rawConstructableSheets;
13
+ /** Tracking for raw CSS blocks per root */
14
+ private rawCSSBlocks;
15
+ /** Counter for generating unique raw CSS IDs */
16
+ private rawCSSCounter;
17
+ constructor(config: StyleInjectorConfig);
18
+ /**
19
+ * Resolve the underlying CSSStyleSheet from a SheetInfo,
20
+ * abstracting away adopted vs style-element modes.
21
+ */
22
+ getCSSSheet(sheetInfo: SheetInfo): CSSStyleSheet | null;
23
+ /**
24
+ * Record an inserted rule text at its rule index (text mode only).
25
+ *
26
+ * `textRules` mirrors the sheet's rule order. `textContent` cannot be edited
27
+ * rule-by-rule the way CSSOM can, so keeping the texts is what makes
28
+ * deletion possible at all in this mode.
29
+ */
30
+ private trackTextRule;
31
+ /**
32
+ * Remove rule indices from a text-mode sheet and rewrite the element's text.
33
+ * Returns the indices that were actually removed.
34
+ */
35
+ private deleteTextRules;
36
+ /**
37
+ * Determine the injection mode for a root.
38
+ * ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
39
+ */
40
+ private detectInjectionMode;
41
+ /**
42
+ * Get or create registry for a root (Document or ShadowRoot)
43
+ */
44
+ getRegistry(root: Document | ShadowRoot): RootRegistry;
45
+ /** Return all roots with active registries (for background GC sweep). */
46
+ getActiveRoots(): Iterable<Document | ShadowRoot>;
47
+ /** Check whether any roots have active registries. */
48
+ hasActiveRoots(): boolean;
49
+ /** Remove registries for ShadowRoots whose host has been detached from the DOM. */
50
+ pruneDisconnectedRoots(): void;
51
+ /**
52
+ * Create a new stylesheet for the registry.
53
+ * In adopted mode (ShadowRoot), creates a constructable CSSStyleSheet and
54
+ * pushes it to adoptedStyleSheets. Otherwise creates a <style> element.
55
+ */
56
+ createSheet(registry: RootRegistry, root: Document | ShadowRoot): SheetInfo;
57
+ /**
58
+ * Create a style element and append to document
59
+ */
60
+ private createStyleElement;
61
+ /**
62
+ * Insert CSS rules as a single block
63
+ */
64
+ insertRule(registry: RootRegistry, flattenedRules: StyleRule[], className: string, root: Document | ShadowRoot): RuleInfo | null;
65
+ /**
66
+ * Insert global CSS rules
67
+ */
68
+ insertGlobalRule(registry: RootRegistry, flattenedRules: StyleRule[], globalKey: string, root: Document | ShadowRoot): RuleInfo | null;
69
+ /**
70
+ * Delete a global CSS rule by key
71
+ */
72
+ deleteGlobalRule(registry: RootRegistry, globalKey: string): void;
73
+ /**
74
+ * Adjust rule indices after deletion to account for shifting
75
+ */
76
+ private adjustIndicesAfterDeletion;
77
+ /**
78
+ * Delete a CSS rule from the sheet
79
+ */
80
+ deleteRule(registry: RootRegistry, ruleInfo: RuleInfo): void;
81
+ /**
82
+ * Find a sheet with available space or return null
83
+ */
84
+ private findAvailableSheet;
85
+ /**
86
+ * Find an available rule index in the sheet
87
+ */
88
+ findAvailableRuleIndex(sheet: SheetInfo): number;
89
+ /**
90
+ * Probe whether the underlying CSS engine supports `@property` at-rules.
91
+ * Result is cached per registry on `registry.atPropertySupported`.
92
+ *
93
+ * The probe inserts and immediately deletes a minimal known-valid rule
94
+ * (`@property --__tasty_probe__ { syntax: "*"; inherits: true; }`).
95
+ * Engines that lack `@property` support (jsdom, happy-dom) reject any
96
+ * `@property` rule including this one, so a probe failure is a reliable
97
+ * signal that further `@property` rejections are environmental noise and
98
+ * not user-authored bugs.
99
+ *
100
+ * The probe is intentionally a separate operation from the user's failing
101
+ * insertion: we don't want to leak `--__tasty_probe__` into the sheet, so
102
+ * on success we delete the probe rule immediately, leaving `ruleCount`
103
+ * and `cssRules.length` unchanged.
104
+ */
105
+ private engineSupportsAtProperty;
106
+ /**
107
+ * Force cleanup of unused styles
108
+ */
109
+ forceCleanup(registry: RootRegistry): void;
110
+ /**
111
+ * Perform bulk cleanup of all unused styles (refCount = 0).
112
+ */
113
+ private performBulkCleanup;
114
+ /**
115
+ * Get total number of rules across all sheets
116
+ */
117
+ getTotalRuleCount(registry: RootRegistry): number;
118
+ /**
119
+ * Get CSS text from all sheets (for SSR)
120
+ */
121
+ getCssText(registry: RootRegistry): string;
122
+ /**
123
+ * Get cache performance metrics
124
+ */
125
+ getMetrics(registry: RootRegistry): CacheMetrics | null;
126
+ /**
127
+ * Reset cache performance metrics
128
+ */
129
+ resetMetrics(registry: RootRegistry): void;
130
+ /**
131
+ * Convert keyframes steps to CSS string.
132
+ * Public so the SSR collector can format keyframes without DOM access.
133
+ * Returns both the CSS text and a combined declarations string for property type scanning.
134
+ */
135
+ stepsToCSS(steps: KeyframesSteps): {
136
+ css: string;
137
+ declarations: string;
138
+ };
139
+ /**
140
+ * Insert keyframes rule.
141
+ * Returns the KeyframesInfo and the raw declarations string for property type scanning.
142
+ */
143
+ insertKeyframes(registry: RootRegistry, steps: KeyframesSteps, name: string, root: Document | ShadowRoot): {
144
+ info: KeyframesInfo;
145
+ declarations: string;
146
+ } | null;
147
+ /**
148
+ * Delete keyframes rule
149
+ */
150
+ deleteKeyframes(registry: RootRegistry, info: KeyframesInfo): void;
151
+ /**
152
+ * Clean up resources for a root
153
+ */
154
+ cleanup(root: Document | ShadowRoot): void;
155
+ /**
156
+ * Check if a root uses adopted injection mode.
157
+ */
158
+ private isAdoptedMode;
159
+ /**
160
+ * Get or create a constructable CSSStyleSheet for raw CSS in adopted mode.
161
+ * The raw sheet is prepended to adoptedStyleSheets so it precedes tasty rules.
162
+ */
163
+ private getOrCreateRawAdoptedSheet;
164
+ /**
165
+ * Get or create a dedicated style element for raw CSS
166
+ * Raw CSS is kept separate from tasty-managed sheets to avoid index conflicts
167
+ */
168
+ private getOrCreateRawStyleElement;
169
+ /**
170
+ * Inject raw CSS text directly without parsing
171
+ * Returns a dispose function to remove the injected CSS
172
+ */
173
+ injectRawCSS(css: string, root: Document | ShadowRoot): RawCSSResult;
174
+ /**
175
+ * Rebuild the raw CSS constructable sheet from all tracked blocks.
176
+ */
177
+ private rebuildRawAdoptedSheet;
178
+ /**
179
+ * Remove a raw CSS block by ID
180
+ */
181
+ private disposeRawCSS;
182
+ /**
183
+ * Get the raw CSS content
184
+ */
185
+ getRawCSSText(root: Document | ShadowRoot): string;
186
+ }
187
+ //#endregion
188
+ //#region src/injector/injector.d.ts
189
+ declare class StyleInjector {
190
+ private sheetManager;
191
+ private config;
192
+ private globalRuleCounter;
193
+ private pendingGCHandle;
194
+ private namePrefix;
195
+ private classRegex;
196
+ private rscClassRegex;
197
+ /** @internal — exposed for debug utilities only */
198
+ get _sheetManager(): SheetManager;
199
+ constructor(config?: StyleInjectorConfig);
200
+ /**
201
+ * Generate a deterministic class name from a cache key using content hash.
202
+ * The same cache key always produces the same class name across environments
203
+ * with the same `namePrefix`.
204
+ */
205
+ private generateClassName;
206
+ /**
207
+ * Check if `className` was hydrated from server-rendered styles and,
208
+ * if so, wire the cacheKey mapping. Returns true on hit.
209
+ */
210
+ private tryHydratedHit;
211
+ /**
212
+ * Allocate a className for a cacheKey without injecting styles yet.
213
+ * This allows separating className allocation (render phase) from style injection (insertion phase).
214
+ */
215
+ allocateClassName(cacheKey: string, options?: {
216
+ root?: Document | ShadowRoot;
217
+ }): {
218
+ className: string;
219
+ isNewAllocation: boolean;
220
+ };
221
+ /**
222
+ * Inject styles from StyleResult objects
223
+ */
224
+ inject(rules: StyleResult[], options?: {
225
+ root?: Document | ShadowRoot;
226
+ cacheKey?: string;
227
+ }): InjectResult;
228
+ /**
229
+ * Inject global styles (rules without a generated tasty class selector)
230
+ * This ensures we don't reserve a tasty class name (t{number}) for global rules,
231
+ * which could otherwise collide with element-level styles and break lookups.
232
+ */
233
+ injectGlobal(rules: StyleResult[], options?: {
234
+ root?: Document | ShadowRoot;
235
+ }): GlobalInjectResult;
236
+ /**
237
+ * Inject raw CSS text directly without parsing
238
+ * This is a low-overhead alternative to createGlobalStyle for raw CSS
239
+ * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking
240
+ */
241
+ injectRawCSS(css: string, options?: {
242
+ root?: Document | ShadowRoot;
243
+ }): RawCSSResult;
244
+ /**
245
+ * Get raw CSS text for SSR
246
+ */
247
+ getRawCSSText(options?: {
248
+ root?: Document | ShadowRoot;
249
+ }): string;
250
+ /**
251
+ * Increment refCount for an already-injected cacheKey and return a dispose.
252
+ * Used by useStyles on cache hits (hydration or runtime reuse) where
253
+ * the pipeline was skipped but refCount tracking is still needed.
254
+ * Returns null if the cacheKey is not found.
255
+ */
256
+ trackRef(cacheKey: string, options?: {
257
+ root?: Document | ShadowRoot;
258
+ }): InjectResult | null;
259
+ /**
260
+ * Dispose of a className (decrements refCount only).
261
+ */
262
+ private dispose;
263
+ /**
264
+ * Force bulk cleanup of unused styles
265
+ */
266
+ cleanup(root?: Document | ShadowRoot): void;
267
+ /**
268
+ * Get CSS text from all sheets (for SSR)
269
+ */
270
+ getCssText(options?: {
271
+ root?: Document | ShadowRoot;
272
+ }): string;
273
+ /**
274
+ * Get CSS only for the provided tasty classNames (e.g., ["t0","t3"])
275
+ */
276
+ getCssTextForClasses(classNames: Iterable<string>, options?: {
277
+ root?: Document | ShadowRoot;
278
+ }): string;
279
+ /**
280
+ * Get cache performance metrics
281
+ */
282
+ getMetrics(options?: {
283
+ root?: Document | ShadowRoot;
284
+ }): CacheMetrics | null;
285
+ /**
286
+ * Reset cache performance metrics
287
+ */
288
+ resetMetrics(options?: {
289
+ root?: Document | ShadowRoot;
290
+ }): void;
291
+ /**
292
+ * Define a CSS @property custom property.
293
+ *
294
+ * Accepts tasty token syntax for the property name:
295
+ * - `$name` → defines `--name`
296
+ * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
297
+ * - `--name` → defines `--name` (legacy format)
298
+ *
299
+ * Example:
300
+ * @property --rotation { syntax: "<angle>"; inherits: false; initial-value: 45deg; }
301
+ *
302
+ * Note: No caching or dispose — this defines a global property.
303
+ *
304
+ * If the same property is registered with different options, a warning is emitted
305
+ * but the original definition is preserved (CSS @property cannot be redefined).
306
+ */
307
+ property(name: string, options?: PropertyDefinition & {
308
+ root?: Document | ShadowRoot;
309
+ }): void;
310
+ /**
311
+ * Build and insert a single `@property` rule into the given registry.
312
+ * No-op if the property was already injected.
313
+ */
314
+ private insertPropertyRule;
315
+ /**
316
+ * Check whether a given @property name was already injected by this injector.
317
+ *
318
+ * Accepts tasty token syntax:
319
+ * - `$name` → checks `--name`
320
+ * - `#name` → checks `--name-color`
321
+ * - `--name` → checks `--name` (legacy format)
322
+ */
323
+ isPropertyDefined(name: string, options?: {
324
+ root?: Document | ShadowRoot;
325
+ }): boolean;
326
+ /**
327
+ * Inject a CSS @font-face rule.
328
+ *
329
+ * Permanent and global — no dispose or ref-counting.
330
+ * Deduplicates by content hash (family + descriptors).
331
+ */
332
+ fontFace(family: string, descriptors: FontFaceDescriptors, options?: {
333
+ root?: Document | ShadowRoot;
334
+ }): void;
335
+ /**
336
+ * Inject a CSS @counter-style rule.
337
+ *
338
+ * Permanent and global — no dispose or ref-counting.
339
+ * Deduplicates by name (first definition wins).
340
+ */
341
+ counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
342
+ root?: Document | ShadowRoot;
343
+ }): void;
344
+ /**
345
+ * Inject keyframes and return object with toString() and dispose()
346
+ *
347
+ * Keyframes are cached by content (steps). If the same content is injected
348
+ * multiple times with different provided names, the first injected name is reused.
349
+ *
350
+ * If the same name is provided with different content (collision), a unique
351
+ * name is generated to avoid overwriting the existing keyframes.
352
+ */
353
+ keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
354
+ root?: Document | ShadowRoot;
355
+ name?: string;
356
+ }): KeyframesResult;
357
+ /**
358
+ * Dispose keyframes
359
+ */
360
+ private disposeKeyframes;
361
+ /**
362
+ * Record a render-time usage hit for one or more classNames.
363
+ * Handles space-separated multi-chunk classNames.
364
+ * When the global touch counter reaches `touchInterval`, schedules a GC
365
+ * via `requestIdleCallback`.
366
+ * No-op on the server.
367
+ */
368
+ touch(className: string, options?: {
369
+ root?: Document | ShadowRoot;
370
+ }): void;
371
+ /**
372
+ * Schedule a GC via `requestIdleCallback` (or synchronously as fallback).
373
+ * Runs GC on all active roots. Avoids double-scheduling via `pendingGCHandle`.
374
+ */
375
+ private scheduleGC;
376
+ /**
377
+ * Synchronous garbage collection.
378
+ *
379
+ * 1. Quick upper-bound check: skip if unused count can't exceed capacity.
380
+ * 2. Scans the DOM for live tasty classNames (safety guard).
381
+ * 3. With `force: true`: deletes all unused entries inline.
382
+ * Without `force`: collects unused, sorts oldest-first, evicts over capacity.
383
+ *
384
+ * @returns Number of styles evicted.
385
+ */
386
+ gc(options?: GCOptions): number;
387
+ /**
388
+ * Destroy all resources for a root
389
+ */
390
+ destroy(root?: Document | ShadowRoot): void;
391
+ }
392
+ //#endregion
393
+ //#region src/utils/color-space.d.ts
394
+ type ColorSpace = 'rgb' | 'hsl' | 'oklch';
395
+ //#endregion
396
+ //#region src/utils/typography.d.ts
397
+ /**
398
+ * A typography token value: plain value or a state map for responsive/theme-aware presets.
399
+ *
400
+ * @example
401
+ * // Plain value
402
+ * fontWeight: '400'
403
+ * // State map
404
+ * fontWeight: { '': '400', '@dark': '300' }
405
+ */
406
+ type TypographyTokenValue = string | number | Record<string, string | number | undefined | null | '@inherit'>;
407
+ /**
408
+ * Typography preset configuration.
409
+ * Each preset defines font properties that get expanded into CSS custom properties.
410
+ * All fields accept plain values or state maps for responsive/theme-aware tokens.
411
+ *
412
+ * Use with `generateTypographyTokens()` to create typography tokens for your design system.
413
+ */
414
+ interface TypographyPreset {
415
+ fontSize: TypographyTokenValue;
416
+ lineHeight: TypographyTokenValue;
417
+ letterSpacing?: TypographyTokenValue;
418
+ fontWeight: TypographyTokenValue;
419
+ boldFontWeight?: TypographyTokenValue;
420
+ iconSize?: TypographyTokenValue;
421
+ textTransform?: TypographyTokenValue;
422
+ fontFamily?: TypographyTokenValue;
423
+ fontStyle?: TypographyTokenValue;
424
+ }
425
+ /**
426
+ * Generate typography tokens with $ prefix for CSS custom properties.
427
+ *
428
+ * Each preset generates the following CSS custom properties:
429
+ * - `${name}-font-size`
430
+ * - `${name}-line-height`
431
+ * - `${name}-letter-spacing`
432
+ * - `${name}-font-weight`
433
+ * - `${name}-bold-font-weight` (if defined)
434
+ * - `${name}-icon-size` (if defined)
435
+ * - `${name}-text-transform` (if defined)
436
+ * - `${name}-font-family` (if defined)
437
+ * - `${name}-font-style` (if defined)
438
+ *
439
+ * @param presets - Typography presets object
440
+ * @returns ConfigTokens object with $ prefixed keys
441
+ *
442
+ * @example
443
+ * const customTokens = generateTypographyTokens({
444
+ * myHeading: { fontSize: '24px', lineHeight: '32px', fontWeight: '700' },
445
+ * body: { fontSize: '16px', lineHeight: '24px', fontWeight: '400' },
446
+ * });
447
+ */
448
+ declare function generateTypographyTokens(presets: Record<string, TypographyPreset>): ConfigTokens;
449
+ //#endregion
450
+ //#region src/plugins/types.d.ts
451
+ /**
452
+ * A tasty plugin that extends the style system with custom functions, units, states, or handlers.
453
+ */
454
+ interface TastyPlugin {
455
+ /** Unique name for the plugin (used for debugging and conflict detection) */
456
+ name: string;
457
+ /** Custom functions that transform parsed style groups into CSS values */
458
+ funcs?: Record<string, (groups: StyleDetails[]) => string>;
459
+ /** Custom units that transform numeric values (e.g., `2x` → `calc(2 * var(--gap))`) */
460
+ units?: Record<string, string | UnitHandler>;
461
+ /** Custom state aliases (e.g., `'@mobile': '@media(w < 768px)'`) */
462
+ states?: Record<string, string>;
463
+ /**
464
+ * Custom style handlers that transform style properties into CSS declarations.
465
+ * Handlers replace built-in handlers for the same style name.
466
+ * @example
467
+ * ```ts
468
+ * handlers: {
469
+ * // Simple handler - lookup style inferred from key
470
+ * fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
471
+ * // Multi-property handler
472
+ * spacing: [['gap', 'padding'], ({ gap, padding }) => ({ ... })],
473
+ * }
474
+ * ```
475
+ */
476
+ handlers?: Record<string, StyleHandlerDefinition>;
477
+ /**
478
+ * Design tokens injected as CSS custom properties on `:root`.
479
+ * Values are parsed through the Tasty DSL. Supports state maps.
480
+ * - `$name` → `--name` CSS custom property
481
+ * - `#name` → `--name-color` and `--name-color-{colorSpace}`
482
+ */
483
+ tokens?: ConfigTokens;
484
+ /** Predefined tokens replaced during style parsing (`$name` or `#name`) */
485
+ replaceTokens?: Record<`$${string}` | `#${string}`, string | number>;
486
+ /**
487
+ * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
488
+ * Recipe values are flat tasty styles (no sub-element keys).
489
+ * @example
490
+ * ```ts
491
+ * recipes: {
492
+ * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
493
+ * elevated: { shadow: '2x 2x 4x #shadow' },
494
+ * }
495
+ * ```
496
+ */
497
+ recipes?: Record<string, RecipeStyles>;
498
+ /**
499
+ * Typography presets — shorthand for `generateTypographyTokens()`.
500
+ * Generated tokens are merged under explicit `tokens` (tokens win on conflict).
501
+ */
502
+ presets?: Record<string, TypographyPreset>;
503
+ /**
504
+ * Global Tasty styles keyed by CSS selector.
505
+ * Supports the full Tasty style syntax.
506
+ */
507
+ globalStyles?: Record<string, Styles>;
508
+ }
509
+ /**
510
+ * A factory function that creates a TastyPlugin.
511
+ * Can optionally accept configuration options.
512
+ *
513
+ * @example
514
+ * ```ts
515
+ * // Plugin without options
516
+ * const okhslPlugin: TastyPluginFactory = () => ({
517
+ * name: 'okhsl',
518
+ * funcs: { okhsl: okhslFunc },
519
+ * });
520
+ *
521
+ * // Plugin with options
522
+ * const debugPlugin: TastyPluginFactory<{ verbose: boolean }> = (options) => ({
523
+ * name: 'debug',
524
+ * funcs: { debug: createDebugFunc(options.verbose) },
525
+ * });
526
+ * ```
527
+ */
528
+ type TastyPluginFactory<TOptions = void> = TOptions extends void ? () => TastyPlugin : (options: TOptions) => TastyPlugin;
529
+ //#endregion
530
+ //#region src/config.d.ts
531
+ /**
532
+ * Configuration options for the Tasty style system
533
+ */
534
+ interface TastyConfig {
535
+ /** CSP nonce for style elements */
536
+ nonce?: string;
537
+ /** Maximum rules per stylesheet (default: 8192) */
538
+ maxRulesPerSheet?: number;
539
+ /** Force text injection mode, auto-detected in test environments (default: auto) */
540
+ forceTextInjection?: boolean;
541
+ /** Enable development mode features: performance metrics and debug info (default: auto) */
542
+ devMode?: boolean;
543
+ /**
544
+ * Global predefined states for advanced state mapping.
545
+ * These are state aliases that can be used in any component.
546
+ * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
547
+ */
548
+ states?: Record<string, string>;
549
+ /**
550
+ * Parser LRU cache size (default: 1000).
551
+ * Larger values improve performance for apps with many unique style values.
552
+ */
553
+ parserCacheSize?: number;
554
+ /**
555
+ * Custom units for the style parser (merged with built-in units).
556
+ * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
557
+ * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
558
+ */
559
+ units?: Record<string, string | UnitHandler>;
560
+ /**
561
+ * Custom functions for the style parser (merged with existing).
562
+ * Functions process parsed style groups and return CSS values.
563
+ * @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
564
+ */
565
+ funcs?: Record<string, (groups: StyleDetails[]) => string>;
566
+ /**
567
+ * Color space used for decomposed color token companion variables.
568
+ * Controls the CSS function and suffix for alpha composition.
569
+ *
570
+ * - `'rgb'` — suffix `-rgb`, e.g. `rgb(var(--name-color-rgb) / .5)`
571
+ * - `'hsl'` — suffix `-hsl`, e.g. `hsl(var(--name-color-hsl) / .5)`
572
+ * - `'oklch'` — suffix `-oklch`, e.g. `oklch(var(--name-color-oklch) / .5)`
573
+ *
574
+ * @default 'oklch'
575
+ */
576
+ colorSpace?: ColorSpace;
577
+ /**
578
+ * Automatically infer and register CSS @property declarations
579
+ * from custom property values found in styles, keyframes, and global config.
580
+ * Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
581
+ * When false, only explicitly declared @properties are registered.
582
+ * @default true
583
+ */
584
+ autoPropertyTypes?: boolean;
585
+ /**
586
+ * Garbage collection configuration for unused styles.
587
+ * GC is triggered by touch count: every `touchInterval` touches, the
588
+ * oldest unused styles are evicted when their count exceeds `capacity`.
589
+ * @example
590
+ * ```ts
591
+ * configure({
592
+ * gc: { touchInterval: 1000, capacity: 1000 },
593
+ * });
594
+ * ```
595
+ */
596
+ gc?: GCConfig;
597
+ /**
598
+ * Prefix prepended to every generated identifier (class names,
599
+ * keyframe names, counter-style names). The hash is appended verbatim,
600
+ * so include any separator inside the prefix itself (e.g. `'myapp-'`).
601
+ *
602
+ * Discriminator letters are inserted between the prefix and the hash
603
+ * for non-class names so the three kinds stay visually distinct:
604
+ * - class: `${namePrefix}${hash}` — e.g. `t1a2b3`
605
+ * - keyframe: `${namePrefix}k${hash}` — e.g. `tk1a2b3`
606
+ * - counter-style: `${namePrefix}c${hash}` — e.g. `tc1a2b3`
607
+ *
608
+ * The runtime, SSR, and RSC paths must agree on this value or
609
+ * hydration will mismatch. The zero-runtime build path defaults to
610
+ * `'ts'` (overridable via the same option) so its classes can't
611
+ * collide with runtime classes when both are loaded on the same page.
612
+ *
613
+ * Must match `^[a-zA-Z][a-zA-Z0-9_-]{0,31}$`. Locked once styles
614
+ * have been generated.
615
+ *
616
+ * @default 't'
617
+ */
618
+ namePrefix?: string;
619
+ /**
620
+ * Plugins that extend tasty with custom functions, units, or states.
621
+ * Plugins are processed in order, with later plugins overriding earlier ones.
622
+ * @example
623
+ * ```ts
624
+ * import { okhslPlugin } from '@tenphi/tasty';
625
+ *
626
+ * configure({
627
+ * plugins: [okhslPlugin()],
628
+ * });
629
+ * ```
630
+ */
631
+ plugins?: TastyPlugin[];
632
+ /**
633
+ * Global keyframes definitions that can be referenced by animation names in styles.
634
+ * Keys are animation names, values are keyframes step definitions.
635
+ * Keyframes are only injected when actually used in styles.
636
+ * @example
637
+ * ```ts
638
+ * configure({
639
+ * keyframes: {
640
+ * fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } },
641
+ * pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } },
642
+ * },
643
+ * });
644
+ * ```
645
+ */
646
+ keyframes?: Record<string, KeyframesSteps>;
647
+ /**
648
+ * Global CSS @property definitions for custom properties.
649
+ * Keys use tasty token syntax ($name for properties, #name for colors).
650
+ *
651
+ * Tasty ships with `DEFAULT_PROPERTIES` (e.g. `$gap`, `$radius`, `#white`,
652
+ * `#black`, `#clear`, `#border`, etc.) that are always included.
653
+ * Properties you specify here are merged on top, so you can override any
654
+ * default by using the same key.
655
+ *
656
+ * For color tokens (#name), `syntax: '<color>'` is auto-set and
657
+ * `initialValue` defaults to `'transparent'` if not specified.
658
+ *
659
+ * @example
660
+ * ```ts
661
+ * configure({
662
+ * properties: {
663
+ * '$rotation': { syntax: '<angle>', initialValue: '0deg' },
664
+ * '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
665
+ * '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
666
+ * // Override a default property:
667
+ * '$gap': { syntax: '<length>', inherits: true, initialValue: '8px' },
668
+ * },
669
+ * });
670
+ *
671
+ * // Now use in styles - properties are registered when component renders:
672
+ * const Spinner = tasty({
673
+ * styles: {
674
+ * transform: 'rotate($rotation)',
675
+ * transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
676
+ * },
677
+ * });
678
+ * ```
679
+ */
680
+ properties?: Record<string, PropertyDefinition>;
681
+ /**
682
+ * Global @font-face definitions.
683
+ * Keys are font-family names, values are descriptors or arrays of descriptors
684
+ * (for multiple weights/styles of the same family).
685
+ * Injected eagerly when styles are first generated.
686
+ * @example
687
+ * ```ts
688
+ * configure({
689
+ * fontFace: {
690
+ * 'Brand Sans': [
691
+ * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
692
+ * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
693
+ * ],
694
+ * Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' },
695
+ * },
696
+ * });
697
+ * ```
698
+ */
699
+ fontFace?: Record<string, FontFaceInput>;
700
+ /**
701
+ * Global @counter-style definitions.
702
+ * Keys are counter-style names, values are descriptor objects.
703
+ * Injected eagerly when styles are first generated.
704
+ * @example
705
+ * ```ts
706
+ * configure({
707
+ * counterStyle: {
708
+ * thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
709
+ * },
710
+ * });
711
+ * ```
712
+ */
713
+ counterStyle?: Record<string, CounterStyleDescriptors>;
714
+ /**
715
+ * Custom style handlers that transform style properties into CSS declarations.
716
+ * Handlers replace built-in handlers for the same style name.
717
+ * @example
718
+ * ```ts
719
+ * import { styleHandlers } from '@tenphi/tasty';
720
+ *
721
+ * configure({
722
+ * handlers: {
723
+ * // Override fill with custom behavior
724
+ * fill: ({ fill }) => {
725
+ * if (fill?.startsWith('gradient:')) {
726
+ * return { background: fill.slice(9) };
727
+ * }
728
+ * return styleHandlers.fill({ fill });
729
+ * },
730
+ * // Add new custom style
731
+ * elevation: ({ elevation }) => {
732
+ * const level = parseInt(elevation) || 1;
733
+ * return {
734
+ * 'box-shadow': `0 ${level * 2}px ${level * 4}px rgba(0,0,0,0.1)`,
735
+ * 'z-index': String(level * 100),
736
+ * };
737
+ * },
738
+ * },
739
+ * });
740
+ * ```
741
+ */
742
+ handlers?: Record<string, StyleHandlerDefinition>;
743
+ /**
744
+ * Design tokens injected as CSS custom properties on `:root`.
745
+ * Values are parsed through the Tasty DSL. Supports state maps
746
+ * for responsive/theme-aware tokens.
747
+ *
748
+ * - `$name` keys become `--name` CSS custom properties
749
+ * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
750
+ *
751
+ * Tokens are injected once when the first style is rendered.
752
+ *
753
+ * @example
754
+ * ```ts
755
+ * configure({
756
+ * tokens: {
757
+ * '$gap': '4px',
758
+ * '#primary': {
759
+ * '': '#purple',
760
+ * '@dark': '#light-purple',
761
+ * },
762
+ * },
763
+ * });
764
+ * ```
765
+ */
766
+ tokens?: ConfigTokens;
767
+ /**
768
+ * Predefined tokens that are replaced during style parsing (parse-time substitution).
769
+ * Use `$name` for custom properties and `#name` for color tokens.
770
+ * Values are substituted inline before CSS generation, unlike `tokens` which
771
+ * inject CSS custom properties on `:root`.
772
+ *
773
+ * For color tokens (#name), boolean `true` is converted to `transparent`.
774
+ *
775
+ * @example
776
+ * ```ts
777
+ * configure({
778
+ * replaceTokens: {
779
+ * $spacing: '2x',
780
+ * '#accent': '#purple',
781
+ * '#overlay': true, // → transparent
782
+ * },
783
+ * });
784
+ *
785
+ * // Now use in styles - tokens are replaced at parse time:
786
+ * const Card = tasty({
787
+ * styles: {
788
+ * padding: '$spacing', // → calc(2 * var(--gap))
789
+ * fill: '#accent', // → var(--purple-color)
790
+ * },
791
+ * });
792
+ * ```
793
+ */
794
+ replaceTokens?: Record<`$${string}`, string | number | boolean> & Record<`#${string}`, string | number | boolean>;
795
+ /**
796
+ * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
797
+ * Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
798
+ * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@properties`.
799
+ *
800
+ * Components reference recipes via: `recipe: 'name1 name2'` in their styles.
801
+ * Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
802
+ * Use `none` to skip base recipes: `recipe: 'none / post1'`.
803
+ * Resolution order: `base_recipes → component styles → post_recipes`.
804
+ *
805
+ * Recipes cannot reference other recipes.
806
+ *
807
+ * @example
808
+ * ```ts
809
+ * configure({
810
+ * recipes: {
811
+ * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
812
+ * elevated: { shadow: '2x 2x 4x #shadow' },
813
+ * },
814
+ * });
815
+ *
816
+ * // Usage in styles:
817
+ * const Card = tasty({
818
+ * styles: {
819
+ * recipe: 'card elevated',
820
+ * color: '#text', // Overrides recipe values
821
+ * },
822
+ * });
823
+ * ```
824
+ */
825
+ recipes?: Record<string, RecipeStyles>;
826
+ /**
827
+ * Typography presets — shorthand for `generateTypographyTokens()`.
828
+ * Accepts the same input and internally generates typography tokens
829
+ * that are merged into `tokens`. Explicit `tokens` override preset-generated ones.
830
+ *
831
+ * @example
832
+ * ```ts
833
+ * configure({
834
+ * presets: {
835
+ * h1: { fontSize: '32px', lineHeight: '1.2', fontWeight: '700' },
836
+ * t2: { fontSize: '16px', lineHeight: '1.5', fontWeight: '400' },
837
+ * },
838
+ * tokens: {
839
+ * // Overrides the preset-generated $t2-font-weight
840
+ * '$t2-font-weight': { '': '400', '@dark': '300' },
841
+ * },
842
+ * });
843
+ * ```
844
+ */
845
+ presets?: Record<string, TypographyPreset>;
846
+ /**
847
+ * Global Tasty styles keyed by CSS selector.
848
+ * Each entry applies the full Tasty style syntax (style properties,
849
+ * tokens, state maps, selector-based sub-styling) to the given selector.
850
+ * Injected alongside `:root` tokens when the first style is rendered.
851
+ *
852
+ * @example
853
+ * ```ts
854
+ * configure({
855
+ * globalStyles: {
856
+ * body: { fill: '#surface', color: '#text', preset: 't2', margin: 0 },
857
+ * html: { overflow: 'hidden' },
858
+ * },
859
+ * });
860
+ * ```
861
+ */
862
+ globalStyles?: Record<string, Styles>;
863
+ }
864
+ declare const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
865
+ declare global {
866
+ interface Window {
867
+ [GLOBAL_INJECTOR_KEY]?: StyleInjector;
868
+ }
869
+ var __TASTY_GLOBAL_INJECTOR__: StyleInjector | undefined;
870
+ }
871
+ /**
872
+ * Detect if we're running in a test environment
873
+ */
874
+ declare function isTestEnvironment(): boolean;
875
+ /**
876
+ * Check if styles have been generated (configuration is locked)
877
+ */
878
+ declare function hasStylesGenerated(): boolean;
879
+ /**
880
+ * Check if any global keyframes are configured.
881
+ * Uses a pre-computed flag to avoid Object.keys() allocation on every call.
882
+ */
883
+ declare function hasGlobalKeyframes(): boolean;
884
+ /**
885
+ * Get global keyframes configuration.
886
+ * Returns null if no keyframes configured (fast path for zero-overhead).
887
+ */
888
+ declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
889
+ /**
890
+ * Get global font-face configuration.
891
+ * Returns null if no font faces configured.
892
+ * Reads from globalThis first for cross-module SSR support.
893
+ */
894
+ declare function getGlobalFontFace(): Record<string, FontFaceInput> | null;
895
+ /**
896
+ * Get global counter-style configuration.
897
+ * Returns null if no counter styles configured.
898
+ * Reads from globalThis first for cross-module SSR support.
899
+ */
900
+ declare function getGlobalCounterStyle(): Record<string, CounterStyleDescriptors> | null;
901
+ /**
902
+ * Check if any global recipes are configured.
903
+ * Fast path: returns false if no recipes were ever set.
904
+ */
905
+ declare function hasGlobalRecipes(): boolean;
906
+ /**
907
+ * Get global recipes configuration.
908
+ * Returns null if no recipes configured (fast path for zero-overhead).
909
+ */
910
+ declare function getGlobalRecipes(): Record<string, RecipeStyles> | null;
911
+ /**
912
+ * Check if configuration is locked (styles have been generated)
913
+ */
914
+ declare function isConfigLocked(): boolean;
915
+ /**
916
+ * Configure the Tasty style system.
917
+ *
918
+ * Must be called BEFORE any styles are generated (before first render that uses tasty).
919
+ * After styles are generated, configuration is locked and calls to configure() will
920
+ * emit a warning and be ignored.
921
+ *
922
+ * @example
923
+ * ```ts
924
+ * import { configure } from '@tenphi/tasty';
925
+ *
926
+ * // Configure before app renders
927
+ * configure({
928
+ * nonce: 'abc123',
929
+ * states: {
930
+ * '@mobile': '@media(w < 768px)',
931
+ * '@dark': '@root(theme=dark)',
932
+ * },
933
+ * });
934
+ * ```
935
+ */
936
+ declare function configure(config?: Partial<TastyConfig>): void;
937
+ /**
938
+ * Get the current configuration.
939
+ * If not configured, returns default configuration.
940
+ */
941
+ declare function getConfig(): TastyConfig;
942
+ /**
943
+ * Get the configured prefix used for every generated identifier
944
+ * (class names, keyframe names, counter-style names).
945
+ *
946
+ * Falls back to the default prefix (`'t'`) when `configure()` has not
947
+ * been called yet — this matches the auto-configuration behavior used
948
+ * by the rest of the system.
949
+ */
950
+ declare function getNamePrefix(): string;
951
+ /**
952
+ * Reset configuration (for testing only).
953
+ * Clears the global injector and allows reconfiguration.
954
+ */
955
+ declare function resetConfig(): void;
956
+ //#endregion
957
+ export { SheetManager as S, TypographyPreset as _, getGlobalFontFace as a, ColorSpace as b, getNamePrefix as c, hasStylesGenerated as d, isConfigLocked as f, TastyPluginFactory as g, TastyPlugin as h, getGlobalCounterStyle as i, hasGlobalKeyframes as l, resetConfig as m, configure as n, getGlobalKeyframes as o, isTestEnvironment as p, getConfig as r, getGlobalRecipes as s, TastyConfig as t, hasGlobalRecipes as u, TypographyTokenValue as v, StyleInjector as x, generateTypographyTokens as y };
958
+ //# sourceMappingURL=config-V0XC9iz_.d.ts.map