@tenphi/tasty 2.0.3 → 2.1.0

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 (323) hide show
  1. package/dist/{ssr/async-storage.js → async-storage-B7_o6FKt.js} +2 -2
  2. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  3. package/dist/{ssr/collector.js → collector-DrgDE7QB.js} +5 -10
  4. package/dist/collector-DrgDE7QB.js.map +1 -0
  5. package/dist/{ssr/collector.d.ts → collector-LuU1vZ68.d.ts} +3 -3
  6. package/dist/config-_aQ_PZ-P.js +10131 -0
  7. package/dist/config-_aQ_PZ-P.js.map +1 -0
  8. package/dist/config-vuCRkBWX.d.ts +884 -0
  9. package/dist/{ssr/context.js → context-CkSg-kDT.js} +11 -3
  10. package/dist/context-CkSg-kDT.js.map +1 -0
  11. package/dist/core/index.d.ts +5 -34
  12. package/dist/core/index.js +6 -27
  13. package/dist/core-BqO8pplb.js +1592 -0
  14. package/dist/core-BqO8pplb.js.map +1 -0
  15. package/dist/{zero/extractor.js → css-writer-D--REwtp.js} +74 -11
  16. package/dist/css-writer-D--REwtp.js.map +1 -0
  17. package/dist/{ssr/format-global-rules.js → format-global-rules-Dbc_1tc3.js} +2 -2
  18. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  19. package/dist/format-rules-xwteB7a1.js +143 -0
  20. package/dist/format-rules-xwteB7a1.js.map +1 -0
  21. package/dist/{ssr/hydrate.js → hydrate-BvPT4ndL.js} +3 -3
  22. package/dist/hydrate-BvPT4ndL.js.map +1 -0
  23. package/dist/index-ZRxZWzlj.d.ts +1602 -0
  24. package/dist/{styles/types.d.ts → index-dUtwpOux.d.ts} +707 -5
  25. package/dist/index.d.ts +5 -51
  26. package/dist/index.js +732 -36
  27. package/dist/index.js.map +1 -0
  28. package/dist/keyframes-ClPFWy33.js +587 -0
  29. package/dist/keyframes-ClPFWy33.js.map +1 -0
  30. package/dist/{utils/merge-styles.js → merge-styles-BUQsEpbv.js} +3 -4
  31. package/dist/merge-styles-BUQsEpbv.js.map +1 -0
  32. package/dist/{utils/merge-styles.d.ts → merge-styles-CtDJMhpJ.d.ts} +3 -3
  33. package/dist/{utils/resolve-recipes.js → resolve-recipes-C0-AMzCz.js} +4 -6
  34. package/dist/resolve-recipes-C0-AMzCz.js.map +1 -0
  35. package/dist/ssr/astro-client.js +1 -1
  36. package/dist/ssr/astro.js +4 -4
  37. package/dist/ssr/index.d.ts +44 -4
  38. package/dist/ssr/index.js +4 -4
  39. package/dist/ssr/next.d.ts +1 -1
  40. package/dist/ssr/next.js +6 -6
  41. package/dist/ssr/next.js.map +1 -1
  42. package/dist/static/index.d.ts +91 -5
  43. package/dist/static/index.js +49 -3
  44. package/dist/static/index.js.map +1 -0
  45. package/dist/zero/babel.d.ts +1 -1
  46. package/dist/zero/babel.js +10 -6
  47. package/dist/zero/babel.js.map +1 -1
  48. package/dist/zero/index.d.ts +67 -3
  49. package/dist/zero/index.js +1 -2
  50. package/docs/injector.md +2 -2
  51. package/package.json +10 -9
  52. package/dist/_virtual/_rolldown/runtime.js +0 -7
  53. package/dist/chunks/cacheKey.d.ts +0 -1
  54. package/dist/chunks/cacheKey.js +0 -77
  55. package/dist/chunks/cacheKey.js.map +0 -1
  56. package/dist/chunks/definitions.d.ts +0 -37
  57. package/dist/chunks/definitions.js +0 -258
  58. package/dist/chunks/definitions.js.map +0 -1
  59. package/dist/chunks/index.d.ts +0 -1
  60. package/dist/chunks/renderChunk.d.ts +0 -1
  61. package/dist/chunks/renderChunk.js +0 -59
  62. package/dist/chunks/renderChunk.js.map +0 -1
  63. package/dist/compute-styles.d.ts +0 -31
  64. package/dist/compute-styles.js +0 -322
  65. package/dist/compute-styles.js.map +0 -1
  66. package/dist/config.d.ts +0 -407
  67. package/dist/config.js +0 -591
  68. package/dist/config.js.map +0 -1
  69. package/dist/counter-style/index.js +0 -51
  70. package/dist/counter-style/index.js.map +0 -1
  71. package/dist/debug.d.ts +0 -89
  72. package/dist/debug.js +0 -453
  73. package/dist/debug.js.map +0 -1
  74. package/dist/font-face/index.js +0 -63
  75. package/dist/font-face/index.js.map +0 -1
  76. package/dist/hooks/index.d.ts +0 -7
  77. package/dist/hooks/useCounterStyle.d.ts +0 -36
  78. package/dist/hooks/useCounterStyle.js +0 -65
  79. package/dist/hooks/useCounterStyle.js.map +0 -1
  80. package/dist/hooks/useFontFace.d.ts +0 -45
  81. package/dist/hooks/useFontFace.js +0 -66
  82. package/dist/hooks/useFontFace.js.map +0 -1
  83. package/dist/hooks/useGlobalStyles.d.ts +0 -46
  84. package/dist/hooks/useGlobalStyles.js +0 -88
  85. package/dist/hooks/useGlobalStyles.js.map +0 -1
  86. package/dist/hooks/useKeyframes.d.ts +0 -58
  87. package/dist/hooks/useKeyframes.js +0 -55
  88. package/dist/hooks/useKeyframes.js.map +0 -1
  89. package/dist/hooks/useProperty.d.ts +0 -81
  90. package/dist/hooks/useProperty.js +0 -96
  91. package/dist/hooks/useProperty.js.map +0 -1
  92. package/dist/hooks/useRawCSS.d.ts +0 -22
  93. package/dist/hooks/useRawCSS.js +0 -103
  94. package/dist/hooks/useRawCSS.js.map +0 -1
  95. package/dist/hooks/useStyles.d.ts +0 -40
  96. package/dist/hooks/useStyles.js +0 -31
  97. package/dist/hooks/useStyles.js.map +0 -1
  98. package/dist/injector/index.d.ts +0 -182
  99. package/dist/injector/index.js +0 -185
  100. package/dist/injector/index.js.map +0 -1
  101. package/dist/injector/injector.d.ts +0 -198
  102. package/dist/injector/injector.js +0 -651
  103. package/dist/injector/injector.js.map +0 -1
  104. package/dist/injector/sheet-manager.d.ts +0 -132
  105. package/dist/injector/sheet-manager.js +0 -699
  106. package/dist/injector/sheet-manager.js.map +0 -1
  107. package/dist/injector/types.d.ts +0 -235
  108. package/dist/keyframes/index.js +0 -206
  109. package/dist/keyframes/index.js.map +0 -1
  110. package/dist/parser/classify.js +0 -319
  111. package/dist/parser/classify.js.map +0 -1
  112. package/dist/parser/const.js +0 -60
  113. package/dist/parser/const.js.map +0 -1
  114. package/dist/parser/lru.js +0 -109
  115. package/dist/parser/lru.js.map +0 -1
  116. package/dist/parser/parser.d.ts +0 -25
  117. package/dist/parser/parser.js +0 -115
  118. package/dist/parser/parser.js.map +0 -1
  119. package/dist/parser/tokenizer.js +0 -69
  120. package/dist/parser/tokenizer.js.map +0 -1
  121. package/dist/parser/types.d.ts +0 -51
  122. package/dist/parser/types.js +0 -46
  123. package/dist/parser/types.js.map +0 -1
  124. package/dist/pipeline/conditions.d.ts +0 -134
  125. package/dist/pipeline/conditions.js +0 -406
  126. package/dist/pipeline/conditions.js.map +0 -1
  127. package/dist/pipeline/exclusive.js +0 -389
  128. package/dist/pipeline/exclusive.js.map +0 -1
  129. package/dist/pipeline/index.d.ts +0 -55
  130. package/dist/pipeline/index.js +0 -749
  131. package/dist/pipeline/index.js.map +0 -1
  132. package/dist/pipeline/materialize-contradictions.js +0 -125
  133. package/dist/pipeline/materialize-contradictions.js.map +0 -1
  134. package/dist/pipeline/materialize.js +0 -1038
  135. package/dist/pipeline/materialize.js.map +0 -1
  136. package/dist/pipeline/parseStateKey.d.ts +0 -15
  137. package/dist/pipeline/parseStateKey.js +0 -446
  138. package/dist/pipeline/parseStateKey.js.map +0 -1
  139. package/dist/pipeline/simplify.js +0 -725
  140. package/dist/pipeline/simplify.js.map +0 -1
  141. package/dist/pipeline/warnings.js +0 -18
  142. package/dist/pipeline/warnings.js.map +0 -1
  143. package/dist/plugins/index.d.ts +0 -2
  144. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  145. package/dist/plugins/okhsl-plugin.js +0 -97
  146. package/dist/plugins/okhsl-plugin.js.map +0 -1
  147. package/dist/plugins/types.d.ts +0 -87
  148. package/dist/properties/index.js +0 -222
  149. package/dist/properties/index.js.map +0 -1
  150. package/dist/properties/property-type-resolver.d.ts +0 -24
  151. package/dist/properties/property-type-resolver.js +0 -90
  152. package/dist/properties/property-type-resolver.js.map +0 -1
  153. package/dist/rsc-cache.js +0 -79
  154. package/dist/rsc-cache.js.map +0 -1
  155. package/dist/ssr/async-storage.d.ts +0 -17
  156. package/dist/ssr/async-storage.js.map +0 -1
  157. package/dist/ssr/collect-auto-properties.js +0 -58
  158. package/dist/ssr/collect-auto-properties.js.map +0 -1
  159. package/dist/ssr/collector.js.map +0 -1
  160. package/dist/ssr/context.js.map +0 -1
  161. package/dist/ssr/format-global-rules.js.map +0 -1
  162. package/dist/ssr/format-keyframes.js +0 -69
  163. package/dist/ssr/format-keyframes.js.map +0 -1
  164. package/dist/ssr/format-property.js +0 -49
  165. package/dist/ssr/format-property.js.map +0 -1
  166. package/dist/ssr/format-rules.js +0 -73
  167. package/dist/ssr/format-rules.js.map +0 -1
  168. package/dist/ssr/hydrate.d.ts +0 -29
  169. package/dist/ssr/hydrate.js.map +0 -1
  170. package/dist/ssr/ssr-collector-ref.js +0 -29
  171. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  172. package/dist/states/index.d.ts +0 -49
  173. package/dist/states/index.js +0 -170
  174. package/dist/states/index.js.map +0 -1
  175. package/dist/static/tastyStatic.d.ts +0 -46
  176. package/dist/static/tastyStatic.js +0 -30
  177. package/dist/static/tastyStatic.js.map +0 -1
  178. package/dist/static/types.d.ts +0 -49
  179. package/dist/static/types.js +0 -24
  180. package/dist/static/types.js.map +0 -1
  181. package/dist/styles/border.d.ts +0 -25
  182. package/dist/styles/border.js +0 -120
  183. package/dist/styles/border.js.map +0 -1
  184. package/dist/styles/color.d.ts +0 -14
  185. package/dist/styles/color.js +0 -26
  186. package/dist/styles/color.js.map +0 -1
  187. package/dist/styles/const.js +0 -17
  188. package/dist/styles/const.js.map +0 -1
  189. package/dist/styles/createStyle.js +0 -79
  190. package/dist/styles/createStyle.js.map +0 -1
  191. package/dist/styles/dimension.js +0 -109
  192. package/dist/styles/dimension.js.map +0 -1
  193. package/dist/styles/directional.js +0 -133
  194. package/dist/styles/directional.js.map +0 -1
  195. package/dist/styles/display.d.ts +0 -30
  196. package/dist/styles/display.js +0 -73
  197. package/dist/styles/display.js.map +0 -1
  198. package/dist/styles/fade.d.ts +0 -15
  199. package/dist/styles/fade.js +0 -62
  200. package/dist/styles/fade.js.map +0 -1
  201. package/dist/styles/fill.d.ts +0 -42
  202. package/dist/styles/fill.js +0 -51
  203. package/dist/styles/fill.js.map +0 -1
  204. package/dist/styles/flow.d.ts +0 -16
  205. package/dist/styles/flow.js +0 -12
  206. package/dist/styles/flow.js.map +0 -1
  207. package/dist/styles/gap.d.ts +0 -31
  208. package/dist/styles/gap.js +0 -38
  209. package/dist/styles/gap.js.map +0 -1
  210. package/dist/styles/height.d.ts +0 -17
  211. package/dist/styles/height.js +0 -19
  212. package/dist/styles/height.js.map +0 -1
  213. package/dist/styles/index.d.ts +0 -1
  214. package/dist/styles/index.js +0 -8
  215. package/dist/styles/index.js.map +0 -1
  216. package/dist/styles/inset.d.ts +0 -24
  217. package/dist/styles/inset.js +0 -34
  218. package/dist/styles/inset.js.map +0 -1
  219. package/dist/styles/list.d.ts +0 -16
  220. package/dist/styles/list.js +0 -100
  221. package/dist/styles/list.js.map +0 -1
  222. package/dist/styles/margin.d.ts +0 -24
  223. package/dist/styles/margin.js +0 -32
  224. package/dist/styles/margin.js.map +0 -1
  225. package/dist/styles/outline.d.ts +0 -29
  226. package/dist/styles/outline.js +0 -55
  227. package/dist/styles/outline.js.map +0 -1
  228. package/dist/styles/padding.d.ts +0 -24
  229. package/dist/styles/padding.js +0 -32
  230. package/dist/styles/padding.js.map +0 -1
  231. package/dist/styles/placement.d.ts +0 -37
  232. package/dist/styles/placement.js +0 -74
  233. package/dist/styles/placement.js.map +0 -1
  234. package/dist/styles/predefined.d.ts +0 -71
  235. package/dist/styles/predefined.js +0 -237
  236. package/dist/styles/predefined.js.map +0 -1
  237. package/dist/styles/preset.d.ts +0 -52
  238. package/dist/styles/preset.js +0 -127
  239. package/dist/styles/preset.js.map +0 -1
  240. package/dist/styles/radius.d.ts +0 -12
  241. package/dist/styles/radius.js +0 -83
  242. package/dist/styles/radius.js.map +0 -1
  243. package/dist/styles/scrollMargin.d.ts +0 -24
  244. package/dist/styles/scrollMargin.js +0 -32
  245. package/dist/styles/scrollMargin.js.map +0 -1
  246. package/dist/styles/scrollbar.d.ts +0 -25
  247. package/dist/styles/scrollbar.js +0 -51
  248. package/dist/styles/scrollbar.js.map +0 -1
  249. package/dist/styles/shadow.d.ts +0 -14
  250. package/dist/styles/shadow.js +0 -25
  251. package/dist/styles/shadow.js.map +0 -1
  252. package/dist/styles/shared.js +0 -17
  253. package/dist/styles/shared.js.map +0 -1
  254. package/dist/styles/transition.d.ts +0 -14
  255. package/dist/styles/transition.js +0 -159
  256. package/dist/styles/transition.js.map +0 -1
  257. package/dist/styles/width.d.ts +0 -17
  258. package/dist/styles/width.js +0 -19
  259. package/dist/styles/width.js.map +0 -1
  260. package/dist/tasty.d.ts +0 -134
  261. package/dist/tasty.js +0 -248
  262. package/dist/tasty.js.map +0 -1
  263. package/dist/types.d.ts +0 -184
  264. package/dist/utils/cache-wrapper.js +0 -21
  265. package/dist/utils/cache-wrapper.js.map +0 -1
  266. package/dist/utils/case-converter.js +0 -8
  267. package/dist/utils/case-converter.js.map +0 -1
  268. package/dist/utils/color-math.d.ts +0 -46
  269. package/dist/utils/color-math.js +0 -749
  270. package/dist/utils/color-math.js.map +0 -1
  271. package/dist/utils/color-space.d.ts +0 -5
  272. package/dist/utils/color-space.js +0 -228
  273. package/dist/utils/color-space.js.map +0 -1
  274. package/dist/utils/colors.d.ts +0 -5
  275. package/dist/utils/colors.js +0 -10
  276. package/dist/utils/colors.js.map +0 -1
  277. package/dist/utils/css-types.d.ts +0 -7
  278. package/dist/utils/deps-equal.js +0 -15
  279. package/dist/utils/deps-equal.js.map +0 -1
  280. package/dist/utils/dotize.d.ts +0 -26
  281. package/dist/utils/dotize.js +0 -122
  282. package/dist/utils/dotize.js.map +0 -1
  283. package/dist/utils/filter-base-props.d.ts +0 -15
  284. package/dist/utils/filter-base-props.js +0 -45
  285. package/dist/utils/filter-base-props.js.map +0 -1
  286. package/dist/utils/get-display-name.d.ts +0 -7
  287. package/dist/utils/get-display-name.js +0 -10
  288. package/dist/utils/get-display-name.js.map +0 -1
  289. package/dist/utils/has-keys.js +0 -13
  290. package/dist/utils/has-keys.js.map +0 -1
  291. package/dist/utils/hash.js +0 -14
  292. package/dist/utils/hash.js.map +0 -1
  293. package/dist/utils/is-dev-env.js +0 -19
  294. package/dist/utils/is-dev-env.js.map +0 -1
  295. package/dist/utils/is-valid-element-type.js +0 -15
  296. package/dist/utils/is-valid-element-type.js.map +0 -1
  297. package/dist/utils/merge-styles.js.map +0 -1
  298. package/dist/utils/mod-attrs.d.ts +0 -6
  299. package/dist/utils/mod-attrs.js +0 -20
  300. package/dist/utils/mod-attrs.js.map +0 -1
  301. package/dist/utils/process-tokens.d.ts +0 -17
  302. package/dist/utils/process-tokens.js +0 -83
  303. package/dist/utils/process-tokens.js.map +0 -1
  304. package/dist/utils/resolve-recipes.d.ts +0 -17
  305. package/dist/utils/resolve-recipes.js.map +0 -1
  306. package/dist/utils/selector-transform.js +0 -32
  307. package/dist/utils/selector-transform.js.map +0 -1
  308. package/dist/utils/string.js +0 -8
  309. package/dist/utils/string.js.map +0 -1
  310. package/dist/utils/styles.d.ts +0 -99
  311. package/dist/utils/styles.js +0 -220
  312. package/dist/utils/styles.js.map +0 -1
  313. package/dist/utils/typography.d.ts +0 -58
  314. package/dist/utils/typography.js +0 -51
  315. package/dist/utils/typography.js.map +0 -1
  316. package/dist/utils/warnings.d.ts +0 -16
  317. package/dist/utils/warnings.js +0 -16
  318. package/dist/utils/warnings.js.map +0 -1
  319. package/dist/zero/css-writer.d.ts +0 -45
  320. package/dist/zero/css-writer.js +0 -73
  321. package/dist/zero/css-writer.js.map +0 -1
  322. package/dist/zero/extractor.d.ts +0 -24
  323. package/dist/zero/extractor.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,36 +1,732 @@
1
- import { getNamedColorHex, getRgbValuesFromRgbaString, hexToRgb, hslToRgbValues, strToRgb } from "./utils/color-math.js";
2
- import { Bucket } from "./parser/types.js";
3
- import { StyleParser } from "./parser/parser.js";
4
- import { okhslFunc, okhslPlugin } from "./plugins/okhsl-plugin.js";
5
- import { CUSTOM_UNITS, DIRECTIONS, customFunc, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, normalizeColorTokenValue, parseColor, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, stringifyStyles } from "./utils/styles.js";
6
- import { deprecationWarning, warn } from "./utils/warnings.js";
7
- import { styleHandlers } from "./styles/predefined.js";
8
- import { SheetManager } from "./injector/sheet-manager.js";
9
- import { StyleInjector } from "./injector/injector.js";
10
- import { createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
11
- import { parseStateKey } from "./pipeline/parseStateKey.js";
12
- import { isSelector, renderStyles } from "./pipeline/index.js";
13
- import { generateTypographyTokens } from "./utils/typography.js";
14
- import { configure, getConfig, getGlobalCounterStyle, getGlobalFontFace, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "./config.js";
15
- import { CHUNK_NAMES, STYLE_TO_CHUNK, categorizeStyleKeys } from "./chunks/definitions.js";
16
- import { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES } from "./styles/list.js";
17
- import { cleanup, counterStyle, createInjector, destroy, fontFace, gc, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property, touch } from "./injector/index.js";
18
- import { mergeStyles } from "./utils/merge-styles.js";
19
- import { resolveRecipes } from "./utils/resolve-recipes.js";
20
- import { computeStyles } from "./compute-styles.js";
21
- import { filterBaseProps } from "./utils/filter-base-props.js";
22
- import { color } from "./utils/colors.js";
23
- import { _modAttrs } from "./utils/mod-attrs.js";
24
- import { dotize } from "./utils/dotize.js";
25
- import { processTokens } from "./utils/process-tokens.js";
26
- import { tastyDebug } from "./debug.js";
27
- import { getDisplayName } from "./utils/get-display-name.js";
28
- import { Element, tasty } from "./tasty.js";
29
- import { useStyles } from "./hooks/useStyles.js";
30
- import { useGlobalStyles } from "./hooks/useGlobalStyles.js";
31
- import { useRawCSS } from "./hooks/useRawCSS.js";
32
- import { useKeyframes } from "./hooks/useKeyframes.js";
33
- import { useProperty } from "./hooks/useProperty.js";
34
- import { useFontFace } from "./hooks/useFontFace.js";
35
- import { useCounterStyle } from "./hooks/useCounterStyle.js";
36
- export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, DIMENSION_STYLES, DIRECTIONS, Element, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, categorizeStyleKeys, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
1
+ import { $ as parseStyle, B as deprecationWarning, D as getGlobalPredefinedStates, F as formatFontFaceRule, G as DIRECTIONS, J as getGlobalFuncs, K as customFunc, L as SheetManager, O as setGlobalPredefinedStates, P as fontFaceContentHash, Q as parseColor, S as parseStateKey, St as strToRgb, V as warn, W as CUSTOM_UNITS, X as getGlobalPredefinedTokens, Y as getGlobalParser, Z as normalizeColorTokenValue, _ as resetConfig, a as getGlobalCounterStyle, at as StyleParser, b as isSelector, bt as hexToRgb, c as getGlobalKeyframes, ct as hashString, d as hasGlobalKeyframes, et as resetGlobalPredefinedTokens, f as hasGlobalRecipes, h as isTestEnvironment, it as okhslPlugin, j as formatCounterStyleRule, k as StyleInjector, l as getGlobalRecipes, m as isConfigLocked, n as getConfig, nt as stringifyStyles, o as getGlobalFontFace, ot as Bucket, p as hasStylesGenerated, q as filterMods, rt as okhslFunc, s as getGlobalInjector, t as configure, tt as setGlobalPredefinedTokens, v as generateTypographyTokens, vt as getNamedColorHex, w as createStateParserContext, x as renderStyles, xt as hslToRgbValues, yt as getRgbValuesFromRgbaString, z as styleHandlers } from "./config-_aQ_PZ-P.js";
2
+ import { d as categorizeStyleKeys, l as CHUNK_NAMES, u as STYLE_TO_CHUNK } from "./keyframes-ClPFWy33.js";
3
+ import { A as property, B as DIMENSION_STYLES, C as getRawCSSText, D as injector, E as injectRawCSS, F as BLOCK_INNER_STYLES, G as TEXT_STYLES, H as INNER_STYLES, I as BLOCK_OUTER_STYLES, L as BLOCK_STYLES, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, P as BASE_STYLES, R as COLOR_STYLES, S as getIsTestEnvironment, T as injectGlobal, U as OUTER_STYLES, V as FLOW_STYLES, W as POSITION_STYLES, _ as destroy, a as color, b as getCssText, c as hasKeys, d as collectAutoInferredPropertiesRSC, f as getStyleTarget, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, l as formatKeyframesCSS, m as cleanup, n as processTokens, o as filterBaseProps, p as pushRSCCSS, r as dotize, s as computeStyles, t as tastyDebug, u as collectAutoInferredProperties, v as fontFace, w as inject, x as getCssTextForNode, y as gc, z as CONTAINER_STYLES } from "./core-BqO8pplb.js";
4
+ import { n as formatPropertyCSS } from "./format-rules-xwteB7a1.js";
5
+ import { t as mergeStyles } from "./merge-styles-BUQsEpbv.js";
6
+ import { t as resolveRecipes } from "./resolve-recipes-C0-AMzCz.js";
7
+ import { t as getTastySSRContext } from "./context-CkSg-kDT.js";
8
+ import { t as formatGlobalRules } from "./format-global-rules-Dbc_1tc3.js";
9
+ import { Fragment, createElement, forwardRef, useContext } from "react";
10
+ //#region src/utils/get-display-name.ts
11
+ const DEFAULT_NAME = "Anonymous";
12
+ function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
13
+ if (typeof Component === "function") return Component.displayName ?? Component.name ?? fallbackName;
14
+ return fallbackName;
15
+ }
16
+ //#endregion
17
+ //#region src/utils/is-valid-element-type.ts
18
+ /**
19
+ * Lightweight replacement for `react-is`'s isValidElementType.
20
+ * Detects string tags, function/class components, and React exotic types
21
+ * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.
22
+ */
23
+ function isValidElementType(value) {
24
+ if (typeof value === "string" || typeof value === "function") return true;
25
+ if (typeof value === "object" && value !== null) return typeof value.$$typeof === "symbol";
26
+ return false;
27
+ }
28
+ //#endregion
29
+ //#region src/tasty.tsx
30
+ /**
31
+ * Precalculated entries for performance optimization
32
+ */
33
+ const IS_PROPERTIES_ENTRIES = Object.entries({
34
+ isDisabled: "disabled",
35
+ isHidden: "hidden",
36
+ isChecked: "checked"
37
+ });
38
+ /**
39
+ * Helper function to handle is* properties consistently
40
+ * Transforms is* props to HTML attributes and adds corresponding data-* attributes
41
+ */
42
+ function handleIsProperties(props) {
43
+ for (const [isProperty, targetAttribute] of IS_PROPERTIES_ENTRIES) {
44
+ if (isProperty in props) {
45
+ props[targetAttribute] = props[isProperty];
46
+ delete props[isProperty];
47
+ }
48
+ const dataAttribute = `data-${targetAttribute}`;
49
+ if (!(dataAttribute in props) && props[targetAttribute]) props[dataAttribute] = "";
50
+ }
51
+ }
52
+ /**
53
+ * Creates a sub-element component for compound component patterns.
54
+ * Sub-elements are lightweight components with data-element attribute for CSS targeting.
55
+ */
56
+ function createSubElement(elementName, definition) {
57
+ const config = typeof definition === "string" ? { as: definition } : definition;
58
+ const tag = config.as ?? "div";
59
+ const defaultQa = config.qa;
60
+ const defaultQaVal = config.qaVal;
61
+ const SubElement = forwardRef((props, ref) => {
62
+ const { qa, qaVal, mods, tokens, isDisabled, isHidden, isChecked, className, style, ...htmlProps } = props;
63
+ let modDataAttrs;
64
+ if (mods) modDataAttrs = _modAttrs(mods);
65
+ const tokenStyle = tokens ? processTokens(tokens) : void 0;
66
+ let mergedStyle;
67
+ if (tokenStyle || style) mergedStyle = tokenStyle && style ? {
68
+ ...tokenStyle,
69
+ ...style
70
+ } : tokenStyle ?? style;
71
+ const elementProps = {
72
+ "data-element": elementName,
73
+ "data-qa": qa ?? defaultQa,
74
+ "data-qaval": qaVal ?? defaultQaVal,
75
+ ...modDataAttrs || {},
76
+ ...htmlProps,
77
+ className,
78
+ style: mergedStyle,
79
+ isDisabled,
80
+ isHidden,
81
+ isChecked,
82
+ ref
83
+ };
84
+ handleIsProperties(elementProps);
85
+ if (elementProps["data-qa"] === void 0) delete elementProps["data-qa"];
86
+ if (elementProps["data-qaval"] === void 0) delete elementProps["data-qaval"];
87
+ return createElement(tag, elementProps);
88
+ });
89
+ SubElement.displayName = `SubElement(${elementName})`;
90
+ return SubElement;
91
+ }
92
+ /**
93
+ * Pre-compute the mapping from prop name to token key at component-creation time.
94
+ * Array form: `'progress'` -> `'$progress'`, `'accentColor'` -> `'#accent'`.
95
+ * Object form: entries used as-is.
96
+ */
97
+ function buildTokenPropsMapping(def) {
98
+ if (Array.isArray(def)) return def.map((propName) => {
99
+ if (propName.endsWith("Color") && propName.length > 5) return [propName, `#${propName.slice(0, -5)}`];
100
+ return [propName, `$${propName}`];
101
+ });
102
+ return Object.entries(def);
103
+ }
104
+ function tasty(Component, options) {
105
+ if (isValidElementType(Component)) return tastyWrap(Component, options);
106
+ return tastyElement(Component);
107
+ }
108
+ function tastyWrap(Component, options) {
109
+ const { as: extendTag, element: extendElement, ...defaultProps } = options ?? {};
110
+ const propsWithStyles = ["styles"].concat(Object.keys(defaultProps).filter((prop) => prop.endsWith("Styles")));
111
+ const _WrappedComponent = forwardRef((props, ref) => {
112
+ const { as, element, ...restProps } = props;
113
+ const mergedStylesMap = propsWithStyles.reduce((map, prop) => {
114
+ const restValue = restProps[prop];
115
+ const defaultValue = defaultProps[prop];
116
+ if (restValue != null && defaultValue != null) map[prop] = mergeStyles(defaultValue, restValue);
117
+ else map[prop] = restValue ?? defaultValue;
118
+ return map;
119
+ }, {});
120
+ return createElement(Component, {
121
+ ...defaultProps,
122
+ ...restProps,
123
+ ...mergedStylesMap,
124
+ as: as ?? extendTag,
125
+ element: element || extendElement,
126
+ ref
127
+ });
128
+ });
129
+ _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(Component, defaultProps.qa ?? extendTag ?? "Anonymous")})`;
130
+ return _WrappedComponent;
131
+ }
132
+ function tastyElement(tastyOptions) {
133
+ const { as: originalAs = "div", element: defaultElement, styles: defaultStyles, styleProps, modProps: modPropsDef, tokenProps: tokenPropsDef, variants, tokens: defaultTokens, elements, ...defaultProps } = tastyOptions;
134
+ let variantStylesMap;
135
+ if (variants) {
136
+ let baseStyles = defaultStyles;
137
+ let extensionStyles;
138
+ if (defaultStyles) for (const key of Object.keys(defaultStyles)) {
139
+ if (isSelector(key)) continue;
140
+ const value = defaultStyles[key];
141
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && !("" in value)) {
142
+ if (!extensionStyles) {
143
+ baseStyles = { ...defaultStyles };
144
+ extensionStyles = {};
145
+ }
146
+ extensionStyles[key] = value;
147
+ delete baseStyles[key];
148
+ }
149
+ }
150
+ variantStylesMap = Object.entries(variants).reduce((map, [variant, variantStyles]) => {
151
+ map[variant] = extensionStyles ? mergeStyles(baseStyles, variantStyles, extensionStyles) : mergeStyles(baseStyles, variantStyles);
152
+ return map;
153
+ }, {});
154
+ if (!variantStylesMap["default"]) variantStylesMap["default"] = defaultStyles;
155
+ }
156
+ const { qa: defaultQa, qaVal: defaultQaVal, ...otherDefaultProps } = defaultProps ?? {};
157
+ const propsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
158
+ const modPropsKeys = modPropsDef ? Array.isArray(modPropsDef) ? modPropsDef : Object.keys(modPropsDef) : void 0;
159
+ const tokenPropsMapping = tokenPropsDef ? buildTokenPropsMapping(tokenPropsDef) : void 0;
160
+ const classNameCache = /* @__PURE__ */ new Map();
161
+ const _TastyComponent = forwardRef((allProps, ref) => {
162
+ const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, ...otherProps } = allProps;
163
+ let styles = rawStyles;
164
+ let propStyles = null;
165
+ for (const prop of propsToCheck) {
166
+ const key = prop;
167
+ if (key in otherProps) {
168
+ if (!propStyles) propStyles = {};
169
+ const value = otherProps[key];
170
+ propStyles[key] = value;
171
+ delete otherProps[key];
172
+ }
173
+ }
174
+ if (!styles || styles && !hasKeys(styles)) styles = void 0;
175
+ let propMods;
176
+ if (modPropsKeys) {
177
+ for (const key of modPropsKeys) if (key in otherProps) {
178
+ if (!propMods) propMods = {};
179
+ propMods[key] = otherProps[key];
180
+ delete otherProps[key];
181
+ }
182
+ }
183
+ let propTokens;
184
+ if (tokenPropsMapping) {
185
+ for (const [propName, tokenKey] of tokenPropsMapping) if (propName in otherProps) {
186
+ if (!propTokens) propTokens = {};
187
+ propTokens[tokenKey] = otherProps[propName];
188
+ delete otherProps[propName];
189
+ }
190
+ }
191
+ const baseStyles = variantStylesMap ? variantStylesMap[variant || "default"] ?? variantStylesMap["default"] : defaultStyles;
192
+ const hasInstanceStyles = styles && hasKeys(styles);
193
+ const hasPropStyles = propStyles && hasKeys(propStyles);
194
+ const allStyles = hasInstanceStyles || hasPropStyles ? mergeStyles(baseStyles, styles, propStyles) : baseStyles;
195
+ const useFactoryCache = typeof document !== "undefined";
196
+ let stylesResult;
197
+ if (useFactoryCache && allStyles === baseStyles && classNameCache.has(allStyles)) {
198
+ stylesResult = { className: classNameCache.get(allStyles) };
199
+ touch(stylesResult.className);
200
+ } else {
201
+ stylesResult = computeStyles(allStyles);
202
+ if (useFactoryCache && allStyles === baseStyles) classNameCache.set(allStyles, stylesResult.className);
203
+ }
204
+ let mergedTokens;
205
+ if (defaultTokens || tokens || propTokens) if (!defaultTokens && !propTokens) mergedTokens = tokens;
206
+ else if (!tokens && !propTokens) mergedTokens = defaultTokens;
207
+ else mergedTokens = {
208
+ ...defaultTokens,
209
+ ...tokens,
210
+ ...propTokens
211
+ };
212
+ const processedTokenStyle = processTokens(mergedTokens);
213
+ let mergedStyle;
214
+ if (processedTokenStyle || style) if (!processedTokenStyle) mergedStyle = style;
215
+ else if (!style) mergedStyle = processedTokenStyle;
216
+ else mergedStyle = {
217
+ ...processedTokenStyle,
218
+ ...style
219
+ };
220
+ const mergedMods = propMods ? {
221
+ ...mods,
222
+ ...propMods
223
+ } : mods;
224
+ let modDataAttrs;
225
+ if (mergedMods) modDataAttrs = _modAttrs(mergedMods);
226
+ const finalClassName = [userClassName || "", stylesResult.className].filter(Boolean).join(" ");
227
+ const elementProps = {
228
+ "data-element": element || defaultElement,
229
+ "data-qa": qa || defaultQa,
230
+ "data-qaval": qaVal || defaultQaVal,
231
+ ...otherDefaultProps,
232
+ ...modDataAttrs || {},
233
+ ...otherProps,
234
+ className: finalClassName,
235
+ style: mergedStyle,
236
+ ref
237
+ };
238
+ handleIsProperties(elementProps);
239
+ const el = createElement(as ?? originalAs, elementProps);
240
+ if (stylesResult.css) {
241
+ const nonce = getConfig().nonce;
242
+ return createElement(Fragment, null, createElement("style", {
243
+ "data-tasty-rsc": "",
244
+ nonce,
245
+ dangerouslySetInnerHTML: { __html: stylesResult.css }
246
+ }), el);
247
+ }
248
+ return el;
249
+ });
250
+ _TastyComponent.displayName = `TastyComponent(${defaultProps.qa || originalAs})`;
251
+ if (elements) {
252
+ const subElements = Object.entries(elements).reduce((acc, [name, definition]) => {
253
+ acc[name] = createSubElement(name, definition);
254
+ return acc;
255
+ }, {});
256
+ return Object.assign(_TastyComponent, subElements);
257
+ }
258
+ return _TastyComponent;
259
+ }
260
+ const Element = tasty({});
261
+ //#endregion
262
+ //#region src/hooks/useStyles.ts
263
+ /**
264
+ * Hook to generate CSS classes from Tasty styles.
265
+ * Thin wrapper around `computeStyles()` that adds React context-based
266
+ * SSR collector discovery for backward compatibility with TastyRegistry.
267
+ *
268
+ * For hook-free usage (e.g. in server components), use `computeStyles()` directly.
269
+ *
270
+ * @example
271
+ * ```tsx
272
+ * function MyComponent() {
273
+ * const { className } = useStyles({
274
+ * padding: '2x',
275
+ * fill: '#purple',
276
+ * radius: '1r',
277
+ * });
278
+ *
279
+ * return <div className={className}>Styled content</div>;
280
+ * }
281
+ * ```
282
+ */
283
+ function useStyles(styles, options) {
284
+ return computeStyles(styles, {
285
+ ssrCollector: useContext(getTastySSRContext()),
286
+ root: options?.root
287
+ });
288
+ }
289
+ //#endregion
290
+ //#region src/hooks/useGlobalStyles.ts
291
+ const clientGlobalEntries = /* @__PURE__ */ new Map();
292
+ /**
293
+ * Inject global styles for a given selector.
294
+ * Useful for styling elements by selector without generating classNames.
295
+ *
296
+ * SSR-aware: when a ServerStyleCollector is available, CSS is collected
297
+ * during the render phase instead of being injected into the DOM.
298
+ *
299
+ * Works in all environments: client, SSR with collector, and React Server Components.
300
+ *
301
+ * Injected styles are permanent — they are not cleaned up on component unmount.
302
+ * Use the `id` option for update tracking when styles change over the
303
+ * component lifecycle.
304
+ *
305
+ * @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
306
+ * @param styles - Tasty styles object
307
+ * @param options - Optional settings including `id` for update tracking
308
+ *
309
+ * @example
310
+ * ```tsx
311
+ * function MyComponent() {
312
+ * useGlobalStyles('.card', {
313
+ * padding: '2x',
314
+ * radius: '1r',
315
+ * fill: '#white',
316
+ * });
317
+ *
318
+ * return <div className="card">Content</div>;
319
+ * }
320
+ * ```
321
+ */
322
+ function useGlobalStyles(selector, styles, options) {
323
+ if (!styles) return;
324
+ if (!selector) {
325
+ console.warn("[Tasty] useGlobalStyles: selector is required and cannot be empty. Styles will not be injected.");
326
+ return;
327
+ }
328
+ const target = getStyleTarget();
329
+ if (target.mode === "client") {
330
+ const slotKey = options?.id ?? selector;
331
+ const stylesKey = JSON.stringify(styles);
332
+ const existing = clientGlobalEntries.get(slotKey);
333
+ if (existing && existing.stylesKey === stylesKey) return;
334
+ }
335
+ const resolvedStyles = resolveRecipes(styles);
336
+ const styleResults = renderStyles(resolvedStyles, selector);
337
+ if (styleResults.length === 0) return;
338
+ if (target.mode === "ssr") {
339
+ target.collector.collectInternals();
340
+ const css = formatGlobalRules(styleResults);
341
+ if (css) {
342
+ const key = options?.id ? `global:${options.id}` : `global:${selector}:${hashString(css)}`;
343
+ target.collector.collectGlobalStyles(key, css);
344
+ }
345
+ if (getConfig().autoPropertyTypes !== false) collectAutoInferredProperties(styleResults, target.collector, resolvedStyles);
346
+ return;
347
+ }
348
+ if (target.mode === "rsc") {
349
+ const css = formatGlobalRules(styleResults);
350
+ if (css) {
351
+ const key = options?.id ? `__global:${options.id}` : `__global:${selector}:${hashString(css)}`;
352
+ pushRSCCSS(target.cache, key, css);
353
+ }
354
+ if (getConfig().autoPropertyTypes !== false) collectAutoInferredPropertiesRSC(styleResults, target.cache, resolvedStyles);
355
+ return;
356
+ }
357
+ const slotKey = options?.id ?? selector;
358
+ const existing = clientGlobalEntries.get(slotKey);
359
+ if (existing) existing.dispose();
360
+ const { dispose } = injectGlobal(styleResults, { root: options?.root });
361
+ clientGlobalEntries.set(slotKey, {
362
+ stylesKey: JSON.stringify(styles),
363
+ dispose
364
+ });
365
+ }
366
+ //#endregion
367
+ //#region src/utils/deps-equal.ts
368
+ /**
369
+ * Shallow comparison of two dependency arrays using Object.is semantics.
370
+ * Returns true when both arrays have the same length and every element
371
+ * at the same index is identical.
372
+ */
373
+ function depsEqual(a, b) {
374
+ if (a.length !== b.length) return false;
375
+ for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false;
376
+ return true;
377
+ }
378
+ //#endregion
379
+ //#region src/hooks/useRawCSS.ts
380
+ const clientEntries = /* @__PURE__ */ new Map();
381
+ const clientContentDedup = /* @__PURE__ */ new Set();
382
+ const factoryDepsCache$1 = /* @__PURE__ */ new Map();
383
+ /**
384
+ * Inject raw CSS text directly without parsing.
385
+ * This is a low-overhead alternative for injecting global CSS that doesn't need tasty processing.
386
+ *
387
+ * The CSS is inserted into a separate style element (data-tasty-raw) to avoid conflicts
388
+ * with tasty's chunked style sheets.
389
+ *
390
+ * Works in all environments: client, SSR with collector, and React Server Components.
391
+ *
392
+ * Injected styles are permanent — they are not cleaned up on component unmount.
393
+ * Use the `id` option for update tracking when styles change over the
394
+ * component lifecycle.
395
+ *
396
+ * @example Static CSS string
397
+ * ```tsx
398
+ * function GlobalStyles() {
399
+ * useRawCSS(`
400
+ * body {
401
+ * margin: 0;
402
+ * padding: 0;
403
+ * font-family: sans-serif;
404
+ * }
405
+ * `);
406
+ *
407
+ * return null;
408
+ * }
409
+ * ```
410
+ *
411
+ * @example Factory function with dependencies
412
+ * ```tsx
413
+ * function ThemeStyles({ theme }: { theme: 'light' | 'dark' }) {
414
+ * useRawCSS(() => `
415
+ * :root {
416
+ * --bg-color: ${theme === 'dark' ? '#1a1a1a' : '#ffffff'};
417
+ * --text-color: ${theme === 'dark' ? '#ffffff' : '#1a1a1a'};
418
+ * }
419
+ * `, [theme], { id: 'theme-vars' });
420
+ *
421
+ * return null;
422
+ * }
423
+ * ```
424
+ *
425
+ * @example With options
426
+ * ```tsx
427
+ * function ShadowStyles({ shadowRoot }) {
428
+ * useRawCSS(() => `.scoped { color: red; }`, [], { root: shadowRoot });
429
+ * return null;
430
+ * }
431
+ * ```
432
+ */
433
+ function useRawCSS(cssOrFactory, depsOrOptions, options) {
434
+ const isFactory = typeof cssOrFactory === "function";
435
+ const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
436
+ const opts = isFactory ? options : depsOrOptions;
437
+ const target = getStyleTarget();
438
+ if (isFactory && deps && opts?.id && target.mode === "client") {
439
+ const cachedDeps = factoryDepsCache$1.get(opts.id);
440
+ if (cachedDeps && depsEqual(cachedDeps, deps)) return;
441
+ }
442
+ const css = isFactory ? cssOrFactory() : cssOrFactory;
443
+ if (!css.trim()) return;
444
+ if (target.mode === "ssr") {
445
+ const key = opts?.id ? `raw:${opts.id}` : `raw:${hashString(css)}`;
446
+ target.collector.collectRawCSS(key, css);
447
+ return;
448
+ }
449
+ if (target.mode === "rsc") {
450
+ const key = opts?.id ? `__raw:${opts.id}` : `__raw:${hashString(css)}`;
451
+ pushRSCCSS(target.cache, key, css);
452
+ return;
453
+ }
454
+ const id = opts?.id;
455
+ if (id) {
456
+ const existing = clientEntries.get(id);
457
+ if (existing) {
458
+ if (existing.contentKey === css) return;
459
+ existing.dispose();
460
+ }
461
+ const { dispose } = injectRawCSS(css, opts);
462
+ clientEntries.set(id, {
463
+ contentKey: css,
464
+ dispose
465
+ });
466
+ if (deps) factoryDepsCache$1.set(id, deps);
467
+ } else {
468
+ const contentKey = hashString(css);
469
+ if (clientContentDedup.has(contentKey)) return;
470
+ clientContentDedup.add(contentKey);
471
+ injectRawCSS(css, opts);
472
+ }
473
+ }
474
+ //#endregion
475
+ //#region src/hooks/useKeyframes.ts
476
+ const clientContentToName$1 = /* @__PURE__ */ new Map();
477
+ const factoryDepsCache = /* @__PURE__ */ new Map();
478
+ function useKeyframes(stepsOrFactory, depsOrOptions, options) {
479
+ const isFactory = typeof stepsOrFactory === "function";
480
+ const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
481
+ const opts = isFactory ? options : depsOrOptions;
482
+ const target = getStyleTarget();
483
+ if (isFactory && deps && opts?.name && target.mode === "client") {
484
+ const cached = factoryDepsCache.get(opts.name);
485
+ if (cached && depsEqual(cached.deps, deps)) return cached.name;
486
+ }
487
+ const steps = isFactory ? stepsOrFactory() : stepsOrFactory;
488
+ if (!steps || Object.keys(steps).length === 0) return "";
489
+ if (target.mode === "ssr") {
490
+ const actualName = target.collector.allocateKeyframeName(opts?.name);
491
+ const css = formatKeyframesCSS(actualName, steps);
492
+ target.collector.collectKeyframes(actualName, css);
493
+ return actualName;
494
+ }
495
+ if (target.mode === "rsc") {
496
+ const serializedContent = JSON.stringify(steps);
497
+ const key = `__kf:${opts?.name ?? ""}:${serializedContent}`;
498
+ const existingName = target.cache.generatedNames.get(key);
499
+ if (existingName) return existingName;
500
+ const actualName = opts?.name ?? `k${hashString(serializedContent)}`;
501
+ const css = formatKeyframesCSS(actualName, steps);
502
+ pushRSCCSS(target.cache, key, css);
503
+ target.cache.generatedNames.set(key, actualName);
504
+ return actualName;
505
+ }
506
+ const serializedContent = JSON.stringify(steps);
507
+ const cacheKey = `${opts?.name ?? ""}:${serializedContent}`;
508
+ const cachedName = clientContentToName$1.get(cacheKey);
509
+ if (cachedName) return cachedName;
510
+ const name = keyframes(steps, {
511
+ name: opts?.name,
512
+ root: opts?.root
513
+ }).toString();
514
+ clientContentToName$1.set(cacheKey, name);
515
+ if (deps && opts?.name) factoryDepsCache.set(opts.name, {
516
+ deps,
517
+ name
518
+ });
519
+ return name;
520
+ }
521
+ //#endregion
522
+ //#region src/hooks/useProperty.ts
523
+ /**
524
+ * Register a CSS @property custom property.
525
+ * This enables advanced features like animating custom properties.
526
+ *
527
+ * Note: @property rules are global and persistent once defined.
528
+ * The function ensures the property is only registered once per root.
529
+ *
530
+ * Accepts tasty token syntax for the property name:
531
+ * - `$name` → defines `--name`
532
+ * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
533
+ * - `--name` → defines `--name` (legacy format)
534
+ *
535
+ * Works in all environments: client, SSR with collector, and React Server Components.
536
+ *
537
+ * @param name - The property token ($name, #name) or CSS property name (--name)
538
+ * @param options - Property configuration
539
+ *
540
+ * @example Basic property with token syntax
541
+ * ```tsx
542
+ * function Spinner() {
543
+ * useProperty('$rotation', {
544
+ * syntax: '<angle>',
545
+ * inherits: false,
546
+ * initialValue: '0deg',
547
+ * });
548
+ *
549
+ * return <div className="spinner" />;
550
+ * }
551
+ * ```
552
+ *
553
+ * @example Color property with token syntax (auto-sets syntax)
554
+ * ```tsx
555
+ * function MyComponent() {
556
+ * useProperty('#theme', {
557
+ * initialValue: 'red', // syntax: '<color>' is auto-set
558
+ * });
559
+ *
560
+ * // Now --theme-color can be animated with CSS transitions
561
+ * return <div style={{ '--theme-color': 'blue' } as React.CSSProperties}>Colored</div>;
562
+ * }
563
+ * ```
564
+ *
565
+ * @example Legacy format (still supported)
566
+ * ```tsx
567
+ * function ResizableBox() {
568
+ * useProperty('--box-size', {
569
+ * syntax: '<length>',
570
+ * initialValue: '100px',
571
+ * });
572
+ *
573
+ * return <div style={{ width: 'var(--box-size)' }} />;
574
+ * }
575
+ * ```
576
+ */
577
+ function useProperty(name, options) {
578
+ if (!name) {
579
+ console.warn(`[Tasty] useProperty: property name is required`);
580
+ return;
581
+ }
582
+ const target = getStyleTarget();
583
+ if (target.mode === "ssr") {
584
+ target.collector.collectInternals();
585
+ const css = formatPropertyCSS(name, {
586
+ syntax: options?.syntax,
587
+ inherits: options?.inherits,
588
+ initialValue: options?.initialValue
589
+ });
590
+ if (css) target.collector.collectProperty(name, css);
591
+ return;
592
+ }
593
+ if (target.mode === "rsc") {
594
+ const css = formatPropertyCSS(name, {
595
+ syntax: options?.syntax,
596
+ inherits: options?.inherits,
597
+ initialValue: options?.initialValue
598
+ });
599
+ if (css) pushRSCCSS(target.cache, `__prop:${name}`, css);
600
+ return;
601
+ }
602
+ const injector = getGlobalInjector();
603
+ if (injector.isPropertyDefined(name, { root: options?.root })) return;
604
+ injector.property(name, {
605
+ syntax: options?.syntax,
606
+ inherits: options?.inherits,
607
+ initialValue: options?.initialValue,
608
+ root: options?.root
609
+ });
610
+ }
611
+ //#endregion
612
+ //#region src/hooks/useFontFace.ts
613
+ /**
614
+ * Inject CSS @font-face rules.
615
+ * Permanent — no cleanup on unmount. Deduplicates by content hash.
616
+ *
617
+ * Works in all environments: client, SSR with collector, and React Server Components.
618
+ *
619
+ * @param family - The font-family name
620
+ * @param input - Single descriptor object or array of descriptors (for multiple weights/styles)
621
+ * @param options - Optional settings (e.g. Shadow DOM root)
622
+ *
623
+ * @example Single weight
624
+ * ```tsx
625
+ * function App() {
626
+ * useFontFace('Brand Sans', {
627
+ * src: 'url("/fonts/brand-sans.woff2") format("woff2")',
628
+ * fontWeight: '400 700',
629
+ * fontDisplay: 'swap',
630
+ * });
631
+ *
632
+ * return <div style={{ fontFamily: '"Brand Sans", sans-serif' }}>Hello</div>;
633
+ * }
634
+ * ```
635
+ *
636
+ * @example Multiple weights
637
+ * ```tsx
638
+ * function App() {
639
+ * useFontFace('Brand Sans', [
640
+ * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
641
+ * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
642
+ * ]);
643
+ *
644
+ * return <div style={{ fontFamily: '"Brand Sans", sans-serif' }}>Hello</div>;
645
+ * }
646
+ * ```
647
+ */
648
+ function useFontFace(family, input, options) {
649
+ if (!family) return;
650
+ const descriptors = Array.isArray(input) ? input : [input];
651
+ const target = getStyleTarget();
652
+ if (target.mode === "ssr") {
653
+ for (const desc of descriptors) {
654
+ const hash = fontFaceContentHash(family, desc);
655
+ const css = formatFontFaceRule(family, desc);
656
+ target.collector.collectFontFace(hash, css);
657
+ }
658
+ return;
659
+ }
660
+ if (target.mode === "rsc") {
661
+ for (const desc of descriptors) {
662
+ const hash = fontFaceContentHash(family, desc);
663
+ const css = formatFontFaceRule(family, desc);
664
+ pushRSCCSS(target.cache, `__ff:${hash}`, css);
665
+ }
666
+ return;
667
+ }
668
+ const injector = getGlobalInjector();
669
+ for (const desc of descriptors) injector.fontFace(family, desc, { root: options?.root });
670
+ }
671
+ //#endregion
672
+ //#region src/hooks/useCounterStyle.ts
673
+ let clientCounterStyleCounter = 0;
674
+ const clientContentToName = /* @__PURE__ */ new Map();
675
+ /**
676
+ * Inject a CSS @counter-style rule and return the generated name.
677
+ * Permanent — no cleanup on unmount. Deduplicates by name.
678
+ *
679
+ * Works in all environments: client, SSR with collector, and React Server Components.
680
+ *
681
+ * @example Basic usage
682
+ * ```tsx
683
+ * function EmojiList() {
684
+ * const styleName = useCounterStyle({
685
+ * system: 'cyclic',
686
+ * symbols: '"👍"',
687
+ * suffix: '" "',
688
+ * }, { name: 'thumbs' });
689
+ *
690
+ * return (
691
+ * <ol style={{ listStyleType: styleName }}>
692
+ * <li>First</li>
693
+ * <li>Second</li>
694
+ * </ol>
695
+ * );
696
+ * }
697
+ * ```
698
+ *
699
+ */
700
+ function useCounterStyle(descriptors, options) {
701
+ if (!descriptors || !descriptors.system) return "";
702
+ const target = getStyleTarget();
703
+ if (target.mode === "ssr") {
704
+ const actualName = target.collector.allocateCounterStyleName(options?.name);
705
+ const css = formatCounterStyleRule(actualName, descriptors);
706
+ target.collector.collectCounterStyle(actualName, css);
707
+ return actualName;
708
+ }
709
+ if (target.mode === "rsc") {
710
+ const serializedContent = JSON.stringify(descriptors);
711
+ const key = `__cs:${options?.name ?? ""}:${serializedContent}`;
712
+ const existingName = target.cache.generatedNames.get(key);
713
+ if (existingName) return existingName;
714
+ const actualName = options?.name ?? `cs${hashString(serializedContent)}`;
715
+ const css = formatCounterStyleRule(actualName, descriptors);
716
+ pushRSCCSS(target.cache, key, css);
717
+ target.cache.generatedNames.set(key, actualName);
718
+ return actualName;
719
+ }
720
+ const serializedContent = JSON.stringify(descriptors);
721
+ const cacheKey = `${options?.name ?? ""}:${serializedContent}`;
722
+ const existingName = clientContentToName.get(cacheKey);
723
+ if (existingName) return existingName;
724
+ const name = options?.name ?? `cs${clientCounterStyleCounter++}`;
725
+ clientContentToName.set(cacheKey, name);
726
+ getGlobalInjector().counterStyle(name, descriptors, { root: options?.root });
727
+ return name;
728
+ }
729
+ //#endregion
730
+ export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DIMENSION_STYLES, DIRECTIONS, Element, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
731
+
732
+ //# sourceMappingURL=index.js.map