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

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