@tenphi/tasty 0.0.0-snapshot.c8bdaeb → 0.0.0-snapshot.cae4fee

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