@tenphi/tasty 0.0.0-snapshot.a7fb1f5 → 0.0.0-snapshot.a8a2a5d

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 (387) hide show
  1. package/README.md +453 -360
  2. package/dist/babel-types-BOABQvEI.d.ts +16 -0
  3. package/dist/chunks/async-storage-CzSKAyrI.js +36 -0
  4. package/dist/chunks/async-storage-CzSKAyrI.js.map +1 -0
  5. package/dist/chunks/build-config-DQkT3Wru.js +59 -0
  6. package/dist/chunks/build-config-DQkT3Wru.js.map +1 -0
  7. package/dist/chunks/collector-Df9zcabl.js +209 -0
  8. package/dist/chunks/collector-Df9zcabl.js.map +1 -0
  9. package/dist/chunks/config-engine-C7OUmM1J.js +269 -0
  10. package/dist/chunks/config-engine-C7OUmM1J.js.map +1 -0
  11. package/dist/chunks/config-file-BX3F_61U.js +24 -0
  12. package/dist/chunks/config-file-BX3F_61U.js.map +1 -0
  13. package/dist/chunks/css-definitions-BkdTqT7G.js +896 -0
  14. package/dist/chunks/css-definitions-BkdTqT7G.js.map +1 -0
  15. package/dist/chunks/css-resources-C0zT36nQ.js +141 -0
  16. package/dist/chunks/css-resources-C0zT36nQ.js.map +1 -0
  17. package/dist/{debug.js → chunks/debug-CwGMB2RI.js} +197 -149
  18. package/dist/chunks/debug-CwGMB2RI.js.map +1 -0
  19. package/dist/chunks/dsl-BAwiOznp.js +1442 -0
  20. package/dist/chunks/dsl-BAwiOznp.js.map +1 -0
  21. package/dist/chunks/hydration-DEmoq1sQ.js +39 -0
  22. package/dist/chunks/hydration-DEmoq1sQ.js.map +1 -0
  23. package/dist/chunks/react-runtime-B8YqpFx7.js +678 -0
  24. package/dist/chunks/react-runtime-B8YqpFx7.js.map +1 -0
  25. package/dist/chunks/runtime-engine-CHNH2nGy.js +2418 -0
  26. package/dist/chunks/runtime-engine-CHNH2nGy.js.map +1 -0
  27. package/dist/chunks/runtime-state-BxLKsQzs.js +150 -0
  28. package/dist/chunks/runtime-state-BxLKsQzs.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-CYgOs2mp.js} +58 -58
  30. package/dist/chunks/shared-utils-CYgOs2mp.js.map +1 -0
  31. package/dist/chunks/style-engine-DkKH-TqL.js +5573 -0
  32. package/dist/chunks/style-engine-DkKH-TqL.js.map +1 -0
  33. package/dist/chunks/zero-engine-C-0ar_PT.js +308 -0
  34. package/dist/chunks/zero-engine-C-0ar_PT.js.map +1 -0
  35. package/dist/collector-BN6hCWIx.d.ts +160 -0
  36. package/dist/config-Chmu-PnP.d.ts +1349 -0
  37. package/dist/core/index.d.ts +5 -34
  38. package/dist/core/index.js +9 -27
  39. package/dist/hydrate-CTh8SGd9.d.ts +20 -0
  40. package/dist/index-szujmf6W.d.ts +1848 -0
  41. package/dist/index.d.ts +5 -51
  42. package/dist/index.js +11 -36
  43. package/dist/merge-styles-Cx25bpax.d.ts +4 -0
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +5 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +8 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +8 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +8 -0
  51. package/dist/ssr/astro-middleware-extract.js +8 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +15 -0
  54. package/dist/ssr/astro-middleware-static.js +6 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +16 -0
  57. package/dist/ssr/astro-middleware.js +6 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -14
  60. package/dist/ssr/astro.js +205 -50
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +1 -0
  64. package/dist/ssr/index.d.ts +15 -4
  65. package/dist/ssr/index.js +7 -8
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +63 -0
  68. package/dist/ssr/next-config.js +122 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +13 -12
  71. package/dist/ssr/next.js +33 -48
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +86 -5
  74. package/dist/static/index.js +29 -3
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +1 -4
  77. package/dist/static/inject.js +1 -2
  78. package/dist/static/inject.js.map +1 -1
  79. package/dist/types-DbMN-Yyn.d.ts +1545 -0
  80. package/dist/zero/babel.d.ts +12 -123
  81. package/dist/zero/babel.js +125 -151
  82. package/dist/zero/babel.js.map +1 -1
  83. package/dist/zero/index.d.ts +130 -3
  84. package/dist/zero/index.js +24 -3
  85. package/dist/zero/index.js.map +1 -0
  86. package/dist/zero/next.d.ts +5 -7
  87. package/dist/zero/next.js +4 -40
  88. package/dist/zero/next.js.map +1 -1
  89. package/docs/README.md +23 -12
  90. package/docs/adoption.md +72 -37
  91. package/docs/ai-agents.md +259 -0
  92. package/docs/comparison.md +83 -54
  93. package/docs/configuration.md +712 -81
  94. package/docs/debug.md +39 -24
  95. package/docs/design-system.md +186 -41
  96. package/docs/dsl.md +740 -197
  97. package/docs/getting-started.md +132 -52
  98. package/docs/injector.md +184 -92
  99. package/docs/llms.txt +31 -0
  100. package/docs/methodology.md +107 -50
  101. package/docs/migration-v3.md +285 -0
  102. package/docs/pipeline.md +768 -0
  103. package/docs/plugins.md +333 -0
  104. package/docs/react-api.md +746 -0
  105. package/docs/runtime-benchmarks.md +388 -0
  106. package/docs/ssr.md +399 -117
  107. package/docs/styles.md +234 -49
  108. package/docs/tasty-static.md +298 -118
  109. package/harness/dev.harnesspm/rules/usage.md +12 -0
  110. package/harness/dev.harnesspm/scripts/render.mjs +320 -0
  111. package/harness/dev.harnesspm/scripts/styles.mjs +299 -0
  112. package/harness/plugin.json +20 -0
  113. package/package.json +159 -44
  114. package/tasty.config.ts +7 -0
  115. package/dist/_virtual/_rolldown/runtime.js +0 -7
  116. package/dist/chunks/cacheKey.d.ts +0 -1
  117. package/dist/chunks/cacheKey.js +0 -77
  118. package/dist/chunks/cacheKey.js.map +0 -1
  119. package/dist/chunks/definitions.d.ts +0 -37
  120. package/dist/chunks/definitions.js +0 -258
  121. package/dist/chunks/definitions.js.map +0 -1
  122. package/dist/chunks/index.d.ts +0 -1
  123. package/dist/chunks/renderChunk.d.ts +0 -1
  124. package/dist/chunks/renderChunk.js +0 -59
  125. package/dist/chunks/renderChunk.js.map +0 -1
  126. package/dist/compute-styles.d.ts +0 -31
  127. package/dist/compute-styles.js +0 -357
  128. package/dist/compute-styles.js.map +0 -1
  129. package/dist/config.d.ts +0 -366
  130. package/dist/config.js +0 -502
  131. package/dist/config.js.map +0 -1
  132. package/dist/counter-style/index.js +0 -51
  133. package/dist/counter-style/index.js.map +0 -1
  134. package/dist/debug.d.ts +0 -89
  135. package/dist/debug.js.map +0 -1
  136. package/dist/font-face/index.js +0 -63
  137. package/dist/font-face/index.js.map +0 -1
  138. package/dist/hooks/index.d.ts +0 -7
  139. package/dist/hooks/useCounterStyle.d.ts +0 -50
  140. package/dist/hooks/useCounterStyle.js +0 -45
  141. package/dist/hooks/useCounterStyle.js.map +0 -1
  142. package/dist/hooks/useFontFace.d.ts +0 -43
  143. package/dist/hooks/useFontFace.js +0 -69
  144. package/dist/hooks/useFontFace.js.map +0 -1
  145. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  146. package/dist/hooks/useGlobalStyles.js +0 -77
  147. package/dist/hooks/useGlobalStyles.js.map +0 -1
  148. package/dist/hooks/useKeyframes.d.ts +0 -56
  149. package/dist/hooks/useKeyframes.js +0 -63
  150. package/dist/hooks/useKeyframes.js.map +0 -1
  151. package/dist/hooks/useProperty.d.ts +0 -79
  152. package/dist/hooks/useProperty.js +0 -108
  153. package/dist/hooks/useProperty.js.map +0 -1
  154. package/dist/hooks/useRawCSS.d.ts +0 -53
  155. package/dist/hooks/useRawCSS.js +0 -34
  156. package/dist/hooks/useRawCSS.js.map +0 -1
  157. package/dist/hooks/useStyles.d.ts +0 -40
  158. package/dist/hooks/useStyles.js +0 -29
  159. package/dist/hooks/useStyles.js.map +0 -1
  160. package/dist/injector/index.d.ts +0 -187
  161. package/dist/injector/index.js +0 -192
  162. package/dist/injector/index.js.map +0 -1
  163. package/dist/injector/injector.d.ts +0 -195
  164. package/dist/injector/injector.js +0 -587
  165. package/dist/injector/injector.js.map +0 -1
  166. package/dist/injector/sheet-manager.d.ts +0 -132
  167. package/dist/injector/sheet-manager.js +0 -697
  168. package/dist/injector/sheet-manager.js.map +0 -1
  169. package/dist/injector/types.d.ts +0 -235
  170. package/dist/keyframes/index.js +0 -206
  171. package/dist/keyframes/index.js.map +0 -1
  172. package/dist/parser/classify.js +0 -319
  173. package/dist/parser/classify.js.map +0 -1
  174. package/dist/parser/const.js +0 -60
  175. package/dist/parser/const.js.map +0 -1
  176. package/dist/parser/lru.js +0 -109
  177. package/dist/parser/lru.js.map +0 -1
  178. package/dist/parser/parser.d.ts +0 -25
  179. package/dist/parser/parser.js +0 -115
  180. package/dist/parser/parser.js.map +0 -1
  181. package/dist/parser/tokenizer.js +0 -69
  182. package/dist/parser/tokenizer.js.map +0 -1
  183. package/dist/parser/types.d.ts +0 -51
  184. package/dist/parser/types.js +0 -46
  185. package/dist/parser/types.js.map +0 -1
  186. package/dist/pipeline/conditions.d.ts +0 -134
  187. package/dist/pipeline/conditions.js +0 -406
  188. package/dist/pipeline/conditions.js.map +0 -1
  189. package/dist/pipeline/exclusive.js +0 -230
  190. package/dist/pipeline/exclusive.js.map +0 -1
  191. package/dist/pipeline/index.d.ts +0 -55
  192. package/dist/pipeline/index.js +0 -708
  193. package/dist/pipeline/index.js.map +0 -1
  194. package/dist/pipeline/materialize.js +0 -1103
  195. package/dist/pipeline/materialize.js.map +0 -1
  196. package/dist/pipeline/parseStateKey.d.ts +0 -15
  197. package/dist/pipeline/parseStateKey.js +0 -446
  198. package/dist/pipeline/parseStateKey.js.map +0 -1
  199. package/dist/pipeline/simplify.js +0 -515
  200. package/dist/pipeline/simplify.js.map +0 -1
  201. package/dist/pipeline/warnings.js +0 -18
  202. package/dist/pipeline/warnings.js.map +0 -1
  203. package/dist/plugins/index.d.ts +0 -2
  204. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  205. package/dist/plugins/okhsl-plugin.js +0 -97
  206. package/dist/plugins/okhsl-plugin.js.map +0 -1
  207. package/dist/plugins/types.d.ts +0 -76
  208. package/dist/properties/index.js +0 -222
  209. package/dist/properties/index.js.map +0 -1
  210. package/dist/properties/property-type-resolver.d.ts +0 -24
  211. package/dist/properties/property-type-resolver.js +0 -90
  212. package/dist/properties/property-type-resolver.js.map +0 -1
  213. package/dist/ssr/async-storage.d.ts +0 -17
  214. package/dist/ssr/async-storage.js +0 -34
  215. package/dist/ssr/async-storage.js.map +0 -1
  216. package/dist/ssr/collect-auto-properties.js +0 -39
  217. package/dist/ssr/collect-auto-properties.js.map +0 -1
  218. package/dist/ssr/collector.d.ts +0 -102
  219. package/dist/ssr/collector.js +0 -219
  220. package/dist/ssr/collector.js.map +0 -1
  221. package/dist/ssr/format-global-rules.js +0 -22
  222. package/dist/ssr/format-global-rules.js.map +0 -1
  223. package/dist/ssr/format-keyframes.js +0 -69
  224. package/dist/ssr/format-keyframes.js.map +0 -1
  225. package/dist/ssr/format-property.js +0 -49
  226. package/dist/ssr/format-property.js.map +0 -1
  227. package/dist/ssr/format-rules.js +0 -73
  228. package/dist/ssr/format-rules.js.map +0 -1
  229. package/dist/ssr/hydrate.d.ts +0 -22
  230. package/dist/ssr/hydrate.js +0 -49
  231. package/dist/ssr/hydrate.js.map +0 -1
  232. package/dist/ssr/ssr-collector-ref.js +0 -12
  233. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  234. package/dist/states/index.d.ts +0 -49
  235. package/dist/states/index.js +0 -170
  236. package/dist/states/index.js.map +0 -1
  237. package/dist/static/tastyStatic.d.ts +0 -46
  238. package/dist/static/tastyStatic.js +0 -30
  239. package/dist/static/tastyStatic.js.map +0 -1
  240. package/dist/static/types.d.ts +0 -49
  241. package/dist/static/types.js +0 -24
  242. package/dist/static/types.js.map +0 -1
  243. package/dist/styles/border.d.ts +0 -25
  244. package/dist/styles/border.js +0 -120
  245. package/dist/styles/border.js.map +0 -1
  246. package/dist/styles/color.d.ts +0 -14
  247. package/dist/styles/color.js +0 -26
  248. package/dist/styles/color.js.map +0 -1
  249. package/dist/styles/const.js +0 -17
  250. package/dist/styles/const.js.map +0 -1
  251. package/dist/styles/createStyle.js +0 -79
  252. package/dist/styles/createStyle.js.map +0 -1
  253. package/dist/styles/dimension.js +0 -109
  254. package/dist/styles/dimension.js.map +0 -1
  255. package/dist/styles/directional.js +0 -133
  256. package/dist/styles/directional.js.map +0 -1
  257. package/dist/styles/display.d.ts +0 -30
  258. package/dist/styles/display.js +0 -73
  259. package/dist/styles/display.js.map +0 -1
  260. package/dist/styles/fade.d.ts +0 -15
  261. package/dist/styles/fade.js +0 -62
  262. package/dist/styles/fade.js.map +0 -1
  263. package/dist/styles/fill.d.ts +0 -42
  264. package/dist/styles/fill.js +0 -51
  265. package/dist/styles/fill.js.map +0 -1
  266. package/dist/styles/flow.d.ts +0 -16
  267. package/dist/styles/flow.js +0 -12
  268. package/dist/styles/flow.js.map +0 -1
  269. package/dist/styles/gap.d.ts +0 -31
  270. package/dist/styles/gap.js +0 -38
  271. package/dist/styles/gap.js.map +0 -1
  272. package/dist/styles/height.d.ts +0 -17
  273. package/dist/styles/height.js +0 -19
  274. package/dist/styles/height.js.map +0 -1
  275. package/dist/styles/index.d.ts +0 -1
  276. package/dist/styles/index.js +0 -8
  277. package/dist/styles/index.js.map +0 -1
  278. package/dist/styles/inset.d.ts +0 -24
  279. package/dist/styles/inset.js +0 -34
  280. package/dist/styles/inset.js.map +0 -1
  281. package/dist/styles/list.d.ts +0 -16
  282. package/dist/styles/list.js +0 -100
  283. package/dist/styles/list.js.map +0 -1
  284. package/dist/styles/margin.d.ts +0 -24
  285. package/dist/styles/margin.js +0 -32
  286. package/dist/styles/margin.js.map +0 -1
  287. package/dist/styles/outline.d.ts +0 -29
  288. package/dist/styles/outline.js +0 -55
  289. package/dist/styles/outline.js.map +0 -1
  290. package/dist/styles/padding.d.ts +0 -24
  291. package/dist/styles/padding.js +0 -32
  292. package/dist/styles/padding.js.map +0 -1
  293. package/dist/styles/placement.d.ts +0 -37
  294. package/dist/styles/placement.js +0 -74
  295. package/dist/styles/placement.js.map +0 -1
  296. package/dist/styles/predefined.d.ts +0 -71
  297. package/dist/styles/predefined.js +0 -237
  298. package/dist/styles/predefined.js.map +0 -1
  299. package/dist/styles/preset.d.ts +0 -52
  300. package/dist/styles/preset.js +0 -127
  301. package/dist/styles/preset.js.map +0 -1
  302. package/dist/styles/radius.d.ts +0 -12
  303. package/dist/styles/radius.js +0 -83
  304. package/dist/styles/radius.js.map +0 -1
  305. package/dist/styles/scrollMargin.d.ts +0 -24
  306. package/dist/styles/scrollMargin.js +0 -32
  307. package/dist/styles/scrollMargin.js.map +0 -1
  308. package/dist/styles/scrollbar.d.ts +0 -25
  309. package/dist/styles/scrollbar.js +0 -51
  310. package/dist/styles/scrollbar.js.map +0 -1
  311. package/dist/styles/shadow.d.ts +0 -14
  312. package/dist/styles/shadow.js +0 -25
  313. package/dist/styles/shadow.js.map +0 -1
  314. package/dist/styles/shared.js +0 -17
  315. package/dist/styles/shared.js.map +0 -1
  316. package/dist/styles/transition.d.ts +0 -14
  317. package/dist/styles/transition.js +0 -159
  318. package/dist/styles/transition.js.map +0 -1
  319. package/dist/styles/types.d.ts +0 -564
  320. package/dist/styles/width.d.ts +0 -17
  321. package/dist/styles/width.js +0 -19
  322. package/dist/styles/width.js.map +0 -1
  323. package/dist/tasty.d.ts +0 -134
  324. package/dist/tasty.js +0 -243
  325. package/dist/tasty.js.map +0 -1
  326. package/dist/types.d.ts +0 -184
  327. package/dist/utils/cache-wrapper.js +0 -21
  328. package/dist/utils/cache-wrapper.js.map +0 -1
  329. package/dist/utils/case-converter.js +0 -8
  330. package/dist/utils/case-converter.js.map +0 -1
  331. package/dist/utils/color-math.d.ts +0 -46
  332. package/dist/utils/color-math.js +0 -749
  333. package/dist/utils/color-math.js.map +0 -1
  334. package/dist/utils/color-space.d.ts +0 -5
  335. package/dist/utils/color-space.js +0 -228
  336. package/dist/utils/color-space.js.map +0 -1
  337. package/dist/utils/colors.d.ts +0 -5
  338. package/dist/utils/colors.js +0 -10
  339. package/dist/utils/colors.js.map +0 -1
  340. package/dist/utils/css-types.d.ts +0 -7
  341. package/dist/utils/dotize.d.ts +0 -26
  342. package/dist/utils/dotize.js +0 -122
  343. package/dist/utils/dotize.js.map +0 -1
  344. package/dist/utils/filter-base-props.d.ts +0 -15
  345. package/dist/utils/filter-base-props.js +0 -45
  346. package/dist/utils/filter-base-props.js.map +0 -1
  347. package/dist/utils/get-display-name.d.ts +0 -7
  348. package/dist/utils/get-display-name.js +0 -10
  349. package/dist/utils/get-display-name.js.map +0 -1
  350. package/dist/utils/has-keys.js +0 -13
  351. package/dist/utils/has-keys.js.map +0 -1
  352. package/dist/utils/is-dev-env.js +0 -19
  353. package/dist/utils/is-dev-env.js.map +0 -1
  354. package/dist/utils/is-valid-element-type.js +0 -15
  355. package/dist/utils/is-valid-element-type.js.map +0 -1
  356. package/dist/utils/merge-styles.d.ts +0 -7
  357. package/dist/utils/merge-styles.js.map +0 -1
  358. package/dist/utils/mod-attrs.d.ts +0 -6
  359. package/dist/utils/mod-attrs.js +0 -20
  360. package/dist/utils/mod-attrs.js.map +0 -1
  361. package/dist/utils/process-tokens.d.ts +0 -17
  362. package/dist/utils/process-tokens.js +0 -83
  363. package/dist/utils/process-tokens.js.map +0 -1
  364. package/dist/utils/resolve-recipes.d.ts +0 -17
  365. package/dist/utils/resolve-recipes.js +0 -146
  366. package/dist/utils/resolve-recipes.js.map +0 -1
  367. package/dist/utils/selector-transform.js +0 -32
  368. package/dist/utils/selector-transform.js.map +0 -1
  369. package/dist/utils/string.js +0 -8
  370. package/dist/utils/string.js.map +0 -1
  371. package/dist/utils/styles.d.ts +0 -99
  372. package/dist/utils/styles.js +0 -220
  373. package/dist/utils/styles.js.map +0 -1
  374. package/dist/utils/typography.d.ts +0 -47
  375. package/dist/utils/typography.js +0 -51
  376. package/dist/utils/typography.js.map +0 -1
  377. package/dist/utils/warnings.d.ts +0 -16
  378. package/dist/utils/warnings.js +0 -16
  379. package/dist/utils/warnings.js.map +0 -1
  380. package/dist/zero/css-writer.d.ts +0 -45
  381. package/dist/zero/css-writer.js +0 -73
  382. package/dist/zero/css-writer.js.map +0 -1
  383. package/dist/zero/extractor.d.ts +0 -24
  384. package/dist/zero/extractor.js +0 -266
  385. package/dist/zero/extractor.js.map +0 -1
  386. package/docs/PIPELINE.md +0 -519
  387. package/docs/runtime.md +0 -572
@@ -0,0 +1,678 @@
1
+ import { n as isSelector, t as mergeStyles } from "./shared-utils-CYgOs2mp.js";
2
+ import { K as parseFunctionName, N as hashString, O as makeCounterStyleName, S as formatFontFaceRule, W as formatFunctionRule, _ as formatCounterStyleRule, b as fontFaceContentHash, i as formatKeyframesCSS, k as makeKeyframeName, m as resolveSelectorKeyframes, n as formatGlobalRules, o as formatPropertyCSS, q as registerFunctionPolyfill } from "./css-definitions-BkdTqT7G.js";
3
+ import { b as renderStyles, i as baseStylePropsRegistry, q as isFunctionsPolyfillEnabled, s as BASE_STYLES } from "./style-engine-DkKH-TqL.js";
4
+ import { u as getGlobalKeyframes } from "./runtime-state-BxLKsQzs.js";
5
+ import { $ as openBatchWindow, B as getGlobalInjector, F as touch, H as getNamePrefix, M as keyframes, O as injectGlobal, X as closeBatchWindow, c as hasKeys, d as checkRequestScope, f as getRSCCache, h as queueRSCCSS, i as modAttrs, k as injectRawCSS, l as collectAutoInferredProperties, m as pushRSCCSS, n as createClientState, o as computeStyles, p as getStyleTarget, r as processTokens, s as resolveRecipes, t as depsEqual, tt as propHandlerRegistry, u as collectAutoInferredPropertiesRSC, z as getConfig } from "./runtime-engine-CHNH2nGy.js";
6
+ import React, { Fragment, createElement, forwardRef } from "react";
7
+ // src/utils/get-display-name.ts
8
+ const DEFAULT_NAME = "Anonymous";
9
+ function nameOf(type) {
10
+ if (typeof type === "string") return type;
11
+ if (!type || typeof type !== "function" && typeof type !== "object") return;
12
+ const { displayName, name, render, type: inner } = type;
13
+ if (displayName) return displayName;
14
+ if (typeof type === "function") return name || void 0;
15
+ return nameOf(render) ?? nameOf(inner);
16
+ }
17
+ function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
18
+ return nameOf(Component) ?? fallbackName;
19
+ }
20
+ // src/utils/is-valid-element-type.ts
21
+ function isValidElementType(value) {
22
+ if (typeof value === "string" || typeof value === "function") return true;
23
+ if (typeof value === "object" && value !== null) return typeof value.$$typeof === "symbol";
24
+ return false;
25
+ }
26
+ // src/tasty.tsx
27
+ function handleIsProperty(props, isProperty, targetAttribute, dataAttribute) {
28
+ if (isProperty in props) {
29
+ props[targetAttribute] = props[isProperty];
30
+ delete props[isProperty];
31
+ }
32
+ if (!(dataAttribute in props) && props[targetAttribute]) props[dataAttribute] = "";
33
+ }
34
+ function handleIsProperties(props) {
35
+ handleIsProperty(props, "isDisabled", "disabled", "data-disabled");
36
+ handleIsProperty(props, "isHidden", "hidden", "data-hidden");
37
+ handleIsProperty(props, "isChecked", "checked", "data-checked");
38
+ }
39
+ function createSubElement(elementName, definition) {
40
+ const config = typeof definition === "string" ? { as: definition } : definition;
41
+ const tag = config.as ?? "div";
42
+ const defaultQa = config.qa;
43
+ const defaultQaVal = config.qaVal;
44
+ const SubElement = forwardRef((props, ref) => {
45
+ const { qa, qaVal, mods, tokens, isDisabled, isHidden, isChecked, theme, className, style, ...htmlProps } = props;
46
+ let modDataAttrs;
47
+ if (mods) modDataAttrs = modAttrs(mods);
48
+ const tokenStyle = tokens ? processTokens(tokens) : void 0;
49
+ let mergedStyle;
50
+ if (tokenStyle || style) mergedStyle = tokenStyle && style ? {
51
+ ...tokenStyle,
52
+ ...style
53
+ } : tokenStyle ?? style;
54
+ const elementProps = {
55
+ "data-element": elementName,
56
+ "data-qa": qa ?? defaultQa,
57
+ "data-qaval": qaVal ?? defaultQaVal,
58
+ "data-theme": theme,
59
+ ...modDataAttrs || {},
60
+ ...htmlProps,
61
+ className,
62
+ style: mergedStyle,
63
+ isDisabled: isDisabled ?? htmlProps.disabled,
64
+ isHidden: isHidden ?? htmlProps.hidden,
65
+ isChecked: isChecked ?? htmlProps.checked,
66
+ ref
67
+ };
68
+ handleIsProperties(elementProps);
69
+ if (elementProps["data-qa"] === void 0) delete elementProps["data-qa"];
70
+ if (elementProps["data-qaval"] === void 0) delete elementProps["data-qaval"];
71
+ if (elementProps["data-theme"] === void 0) delete elementProps["data-theme"];
72
+ return createElement(tag, elementProps);
73
+ });
74
+ SubElement.displayName = `SubElement(${elementName})`;
75
+ return SubElement;
76
+ }
77
+ function createSubElements(elements) {
78
+ const subElements = {};
79
+ for (const [name, definition] of Object.entries(elements)) subElements[name] = createSubElement(name, definition);
80
+ return subElements;
81
+ }
82
+ const REACT_STATICS = /* @__PURE__ */ new Set([
83
+ "$$typeof",
84
+ "render",
85
+ "type",
86
+ "compare",
87
+ "displayName",
88
+ "defaultProps",
89
+ "propTypes",
90
+ "contextType",
91
+ "contextTypes",
92
+ "childContextTypes",
93
+ "getDerivedStateFromProps",
94
+ "getDerivedStateFromError"
95
+ ]);
96
+ function hoistComponentStatics(target, source) {
97
+ for (const key of Object.keys(source)) {
98
+ if (REACT_STATICS.has(key) || key in target) continue;
99
+ const value = source[key];
100
+ if (typeof value !== "string" && isValidElementType(value)) target[key] = value;
101
+ }
102
+ }
103
+ function buildVariantStylesMap(defaultStyles, variants) {
104
+ let baseStyles = defaultStyles;
105
+ let extensionStyles;
106
+ if (defaultStyles) for (const key of Object.keys(defaultStyles)) {
107
+ if (isSelector(key)) continue;
108
+ const value = defaultStyles[key];
109
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && !("" in value)) {
110
+ if (!extensionStyles) {
111
+ baseStyles = { ...defaultStyles };
112
+ extensionStyles = {};
113
+ }
114
+ extensionStyles[key] = value;
115
+ delete baseStyles[key];
116
+ }
117
+ }
118
+ const variantStylesMap = {};
119
+ for (const [variant, variantStyles] of Object.entries(variants)) variantStylesMap[variant] = extensionStyles ? mergeStyles(baseStyles, variantStyles, extensionStyles) : mergeStyles(baseStyles, variantStyles);
120
+ if (!variantStylesMap["default"]) variantStylesMap["default"] = defaultStyles;
121
+ return variantStylesMap;
122
+ }
123
+ function getMergedStyles(cache, base, extra) {
124
+ let entry = cache.get(extra);
125
+ if (!entry || entry.base !== base) {
126
+ entry = {
127
+ base,
128
+ styles: mergeStyles(base, extra)
129
+ };
130
+ cache.set(extra, entry);
131
+ }
132
+ return entry;
133
+ }
134
+ function takeProps(props, keys) {
135
+ let taken;
136
+ for (const key of keys) if (key in props) {
137
+ if (!taken) taken = {};
138
+ taken[key] = props[key];
139
+ delete props[key];
140
+ }
141
+ return taken;
142
+ }
143
+ function takeTokenProps(props, mapping) {
144
+ let tokens;
145
+ for (const [propName, tokenKey] of mapping) if (propName in props) {
146
+ if (!tokens) tokens = {};
147
+ tokens[tokenKey] = props[propName];
148
+ delete props[propName];
149
+ }
150
+ return tokens;
151
+ }
152
+ function getModPropsKeys(def) {
153
+ return Array.isArray(def) ? def : Object.keys(def);
154
+ }
155
+ function buildTokenPropsMapping(def) {
156
+ if (Array.isArray(def)) return def.map((propName) => {
157
+ if (propName.endsWith("Color") && propName.length > 5) return [propName, `#${propName.slice(0, -5)}`];
158
+ return [propName, `$${propName}`];
159
+ });
160
+ return Object.entries(def);
161
+ }
162
+ function tasty(Component, options) {
163
+ if (isValidElementType(Component)) return tastyWrap(Component, options);
164
+ return tastyElement(Component);
165
+ }
166
+ function tastyWrap(Component, options) {
167
+ const { as: extendTag, element: extendElement, styleProps, modProps: modPropsDef, tokenProps: tokenPropsDef, variants, variant: defaultVariant, elements, ...defaultProps } = options ?? {};
168
+ const defaultStyles = defaultProps.styles;
169
+ const variantStylesMap = variants ? buildVariantStylesMap(defaultStyles, variants) : void 0;
170
+ const fallbackVariant = defaultVariant ?? "default";
171
+ const stylePropNames = styleProps;
172
+ const modPropsKeys = modPropsDef ? getModPropsKeys(modPropsDef) : void 0;
173
+ const tokenPropsMapping = tokenPropsDef ? buildTokenPropsMapping(tokenPropsDef) : void 0;
174
+ const propsWithStyles = ["styles"];
175
+ for (const prop of Object.keys(defaultProps)) if (prop.endsWith("Styles")) propsWithStyles.push(prop);
176
+ const mergedCache = /* @__PURE__ */ new WeakMap();
177
+ const _WrappedComponent = forwardRef((props, ref) => {
178
+ const { as, element, ...restProps } = props;
179
+ const propStyles = stylePropNames ? takeProps(restProps, stylePropNames) : void 0;
180
+ const propMods = modPropsKeys ? takeProps(restProps, modPropsKeys) : void 0;
181
+ const propTokens = tokenPropsMapping ? takeTokenProps(restProps, tokenPropsMapping) : void 0;
182
+ const variant = restProps.variant ?? defaultVariant;
183
+ const baseStyles = variantStylesMap ? variantStylesMap[variant || fallbackVariant] ?? variantStylesMap[fallbackVariant] ?? variantStylesMap["default"] : defaultStyles;
184
+ const mergedStylesMap = {};
185
+ for (const prop of propsWithStyles) {
186
+ const restValue = restProps[prop];
187
+ const defaultValue = prop === "styles" ? baseStyles : defaultProps[prop];
188
+ mergedStylesMap[prop] = restValue != null && defaultValue != null ? getMergedStyles(mergedCache, defaultValue, restValue).styles : restValue ?? defaultValue;
189
+ }
190
+ if (propStyles) mergedStylesMap.styles = mergeStyles(mergedStylesMap.styles, propStyles);
191
+ const elementProps = {
192
+ ...defaultProps,
193
+ ...restProps,
194
+ ...mergedStylesMap,
195
+ as: as ?? extendTag,
196
+ element: element || extendElement,
197
+ ref
198
+ };
199
+ if (variant !== void 0) elementProps.variant = variant;
200
+ if (propMods) elementProps.mods = {
201
+ ...elementProps.mods,
202
+ ...propMods
203
+ };
204
+ if (propTokens) elementProps.tokens = {
205
+ ...elementProps.tokens,
206
+ ...propTokens
207
+ };
208
+ return createElement(Component, elementProps);
209
+ });
210
+ _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(Component, defaultProps.qa ?? extendTag ?? "Anonymous")})`;
211
+ hoistComponentStatics(_WrappedComponent, Component);
212
+ if (elements) Object.assign(_WrappedComponent, createSubElements(elements));
213
+ return _WrappedComponent;
214
+ }
215
+ function tastyElement(tastyOptions) {
216
+ const { as: originalAs = "div", element: defaultElement, styles: defaultStyles, styleProps, modProps: modPropsDef, tokenProps: tokenPropsDef, variants, variant: defaultVariant, tokens: defaultTokens, elements, ...defaultProps } = tastyOptions;
217
+ const variantStylesMap = variants ? buildVariantStylesMap(defaultStyles, variants) : void 0;
218
+ const fallbackStyles = variantStylesMap ? variantStylesMap[defaultVariant ?? "default"] ?? variantStylesMap["default"] : defaultStyles;
219
+ const { qa: defaultQa, qaVal: defaultQaVal, ...otherDefaultProps } = defaultProps;
220
+ const ownPropsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
221
+ let propsToCheck = ownPropsToCheck;
222
+ let propsToCheckVersion = -1;
223
+ const modPropsKeys = modPropsDef ? getModPropsKeys(modPropsDef) : void 0;
224
+ const tokenPropsMapping = tokenPropsDef ? buildTokenPropsMapping(tokenPropsDef) : void 0;
225
+ let classNameCache = /* @__PURE__ */ new Map();
226
+ let mergedCache = /* @__PURE__ */ new WeakMap();
227
+ let cacheInjector;
228
+ let cacheEvictions = 0;
229
+ const STABLE_STYLES = { stableStyles: true };
230
+ const _TastyComponent = forwardRef((incomingProps, ref) => {
231
+ const applyPropHandlers = propHandlerRegistry.apply;
232
+ const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, theme, ...otherProps } = applyPropHandlers ? applyPropHandlers(incomingProps) : incomingProps;
233
+ const styles = rawStyles;
234
+ let propStyles = null;
235
+ if (propsToCheckVersion !== baseStylePropsRegistry.version) {
236
+ const promoted = baseStylePropsRegistry.list;
237
+ propsToCheck = promoted.length === 0 ? ownPropsToCheck : ownPropsToCheck.concat(promoted);
238
+ propsToCheckVersion = baseStylePropsRegistry.version;
239
+ }
240
+ for (const prop of propsToCheck) {
241
+ const key = prop;
242
+ if (key in otherProps) {
243
+ if (!propStyles) propStyles = {};
244
+ const value = otherProps[key];
245
+ propStyles[key] = value;
246
+ delete otherProps[key];
247
+ }
248
+ }
249
+ const propMods = modPropsKeys ? takeProps(otherProps, modPropsKeys) : void 0;
250
+ const propTokens = tokenPropsMapping ? takeTokenProps(otherProps, tokenPropsMapping) : void 0;
251
+ const baseStyles = variantStylesMap ? variant && variantStylesMap[variant] || fallbackStyles : defaultStyles;
252
+ const hasInstanceStyles = !!styles && hasKeys(styles);
253
+ const useFactoryCache = typeof document !== "undefined";
254
+ if (useFactoryCache) {
255
+ const injector = getGlobalInjector();
256
+ if (injector !== cacheInjector || injector.evictions !== cacheEvictions) {
257
+ classNameCache = /* @__PURE__ */ new Map();
258
+ mergedCache = /* @__PURE__ */ new WeakMap();
259
+ cacheInjector = injector;
260
+ cacheEvictions = injector.evictions;
261
+ }
262
+ }
263
+ let allStyles;
264
+ let generatedClassName;
265
+ let mergedEntry;
266
+ if (propStyles) allStyles = mergeStyles(baseStyles, styles, propStyles);
267
+ else if (hasInstanceStyles) {
268
+ if (useFactoryCache) {
269
+ mergedEntry = getMergedStyles(mergedCache, baseStyles, styles);
270
+ allStyles = mergedEntry.styles;
271
+ generatedClassName = mergedEntry.className;
272
+ } else allStyles = mergeStyles(baseStyles, styles);
273
+ } else {
274
+ allStyles = baseStyles;
275
+ if (useFactoryCache) generatedClassName = classNameCache.get(baseStyles);
276
+ }
277
+ let rscCSS;
278
+ if (generatedClassName !== void 0) touch(generatedClassName);
279
+ else {
280
+ const result = computeStyles(allStyles, !useFactoryCache && allStyles === baseStyles ? STABLE_STYLES : void 0);
281
+ generatedClassName = result.className;
282
+ rscCSS = result.css;
283
+ if (mergedEntry) mergedEntry.className = generatedClassName;
284
+ else if (useFactoryCache && allStyles === baseStyles) classNameCache.set(allStyles, generatedClassName);
285
+ }
286
+ let mergedTokens;
287
+ if (defaultTokens || tokens || propTokens) {
288
+ if (!defaultTokens && !propTokens) mergedTokens = tokens;
289
+ else if (!tokens && !propTokens) mergedTokens = defaultTokens;
290
+ else mergedTokens = {
291
+ ...defaultTokens,
292
+ ...tokens,
293
+ ...propTokens
294
+ };
295
+ }
296
+ const processedTokenStyle = processTokens(mergedTokens);
297
+ let mergedStyle;
298
+ if (processedTokenStyle || style) {
299
+ if (!processedTokenStyle) mergedStyle = style;
300
+ else if (!style) mergedStyle = processedTokenStyle;
301
+ else mergedStyle = {
302
+ ...processedTokenStyle,
303
+ ...style
304
+ };
305
+ }
306
+ const mergedMods = propMods ? {
307
+ ...mods,
308
+ ...propMods
309
+ } : mods;
310
+ let modDataAttrs;
311
+ if (mergedMods) modDataAttrs = modAttrs(mergedMods);
312
+ let finalClassName = generatedClassName;
313
+ if (userClassName) finalClassName = finalClassName ? `${userClassName} ${finalClassName}` : userClassName;
314
+ const elementProps = {
315
+ "data-element": element || defaultElement,
316
+ "data-qa": qa || defaultQa,
317
+ "data-qaval": qaVal || defaultQaVal,
318
+ "data-theme": theme,
319
+ ...otherDefaultProps,
320
+ ...modDataAttrs || {},
321
+ ...otherProps,
322
+ className: finalClassName,
323
+ style: mergedStyle,
324
+ ref
325
+ };
326
+ handleIsProperties(elementProps);
327
+ if (elementProps["data-theme"] === void 0) delete elementProps["data-theme"];
328
+ const el = createElement(as ?? originalAs, elementProps);
329
+ if (rscCSS) {
330
+ checkRequestScope();
331
+ const nonce = getConfig().nonce;
332
+ return createElement(Fragment, null, createElement("style", {
333
+ "data-tasty-rsc": "",
334
+ nonce,
335
+ dangerouslySetInnerHTML: { __html: rscCSS }
336
+ }), el);
337
+ }
338
+ return el;
339
+ });
340
+ _TastyComponent.displayName = `TastyComponent(${defaultProps.qa || originalAs})`;
341
+ if (elements) return Object.assign(_TastyComponent, createSubElements(elements));
342
+ return _TastyComponent;
343
+ }
344
+ const Element = /* @__PURE__ */ tasty({});
345
+ // src/ssr/context.ts
346
+ let _ctx;
347
+ function getTastySSRContext() {
348
+ if (!_ctx) _ctx = React.createContext(null);
349
+ return _ctx;
350
+ }
351
+ // src/hooks/useStyles.ts
352
+ const useContextCollector = typeof React.useContext === "function" ? () => React.useContext(getTastySSRContext()) : () => null;
353
+ function useStyles(styles, options) {
354
+ const result = computeStyles(styles, {
355
+ ssrCollector: useContextCollector(),
356
+ root: options?.root
357
+ });
358
+ if (result.css) {
359
+ checkRequestScope();
360
+ queueRSCCSS(getRSCCache(), result.css);
361
+ return { className: result.className };
362
+ }
363
+ return result;
364
+ }
365
+ // src/hooks/useGlobalStyles.ts
366
+ const getClientGlobalSlots = /* @__PURE__ */ createClientState(() => /* @__PURE__ */ new Map());
367
+ const noop = () => {};
368
+ function useGlobalStyles(selector, styles, options) {
369
+ if (!styles) return;
370
+ if (!selector) {
371
+ if (process.env.NODE_ENV !== "production") console.warn("[Tasty] useGlobalStyles: selector is required and cannot be empty. Styles will not be injected.");
372
+ return;
373
+ }
374
+ const target = getStyleTarget();
375
+ const slots = target.mode === "client" ? getClientGlobalSlots(options?.root ?? document) : null;
376
+ const slotKey = options?.id ?? selector;
377
+ const stylesKey = slots ? JSON.stringify(styles) : "";
378
+ const existing = slots?.get(slotKey);
379
+ if (existing && existing.stylesKey === stylesKey) return;
380
+ const resolvedStyles = resolveRecipes(styles);
381
+ const rendered = renderStyles(resolvedStyles, selector);
382
+ if (rendered.length === 0) {
383
+ if (slots) {
384
+ existing?.dispose();
385
+ slots.set(slotKey, {
386
+ stylesKey,
387
+ dispose: noop
388
+ });
389
+ }
390
+ return;
391
+ }
392
+ const { rules: styleResults, keyframes } = resolveSelectorKeyframes(resolvedStyles, rendered, getGlobalKeyframes());
393
+ if (target.mode === "ssr") {
394
+ target.collector.collectInternals();
395
+ if (keyframes) for (const [name, steps] of keyframes) target.collector.collectKeyframes(name, formatKeyframesCSS(name, steps));
396
+ const css = formatGlobalRules(styleResults);
397
+ if (css) {
398
+ const key = options?.id ? `global:${options.id}` : `global:${selector}:${hashString(css)}`;
399
+ target.collector.collectGlobalStyles(key, css, options?.id != null);
400
+ }
401
+ if (getConfig().autoPropertyTypes !== false) collectAutoInferredProperties(styleResults, target.collector, resolvedStyles);
402
+ return;
403
+ }
404
+ if (target.mode === "rsc") {
405
+ if (keyframes) for (const [name, steps] of keyframes) pushRSCCSS(target.cache, `__kf:${name}`, formatKeyframesCSS(name, steps));
406
+ const css = formatGlobalRules(styleResults);
407
+ if (css) {
408
+ const key = options?.id ? `__global:${options.id}` : `__global:${selector}:${hashString(css)}`;
409
+ pushRSCCSS(target.cache, key, css, options?.id != null);
410
+ }
411
+ if (getConfig().autoPropertyTypes !== false) collectAutoInferredPropertiesRSC(styleResults, target.cache, resolvedStyles);
412
+ return;
413
+ }
414
+ if (slots) {
415
+ const releaseKeyframes = holdKeyframes(keyframes, options?.root);
416
+ existing?.dispose();
417
+ const { dispose } = injectGlobal(styleResults, { root: options?.root });
418
+ slots.set(slotKey, {
419
+ stylesKey,
420
+ dispose: () => {
421
+ dispose();
422
+ releaseKeyframes();
423
+ }
424
+ });
425
+ }
426
+ }
427
+ function holdKeyframes(keyframes, root) {
428
+ if (!keyframes) return noop;
429
+ const injector = getGlobalInjector();
430
+ const disposers = [...keyframes].map(([name, steps]) => injector.keyframes(steps, {
431
+ name,
432
+ root,
433
+ distinctByName: true
434
+ }).dispose);
435
+ return () => {
436
+ for (const dispose of disposers) dispose();
437
+ };
438
+ }
439
+ // src/hooks/useRawCSS.ts
440
+ const getClientState$1 = /* @__PURE__ */ createClientState(() => ({
441
+ entries: /* @__PURE__ */ new Map(),
442
+ dedup: /* @__PURE__ */ new Set(),
443
+ deps: /* @__PURE__ */ new Map()
444
+ }));
445
+ function useRawCSS(cssOrFactory, depsOrOptions, options) {
446
+ const isFactory = typeof cssOrFactory === "function";
447
+ const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
448
+ const opts = isFactory ? options : depsOrOptions;
449
+ const id = opts?.id;
450
+ const target = getStyleTarget();
451
+ const state = target.mode === "client" ? getClientState$1(opts?.root ?? document) : null;
452
+ if (isFactory && deps && id && state) {
453
+ const cachedDeps = state.deps.get(id);
454
+ if (cachedDeps && depsEqual(cachedDeps, deps)) return;
455
+ }
456
+ const css = isFactory ? cssOrFactory() : cssOrFactory;
457
+ if (!css.trim()) return;
458
+ if (target.mode !== "client") {
459
+ const key = `${target.mode === "rsc" ? "__" : ""}raw:${id || hashString(css)}`;
460
+ const replace = id != null;
461
+ if (target.mode === "ssr") target.collector.collectRawCSS(key, css, replace);
462
+ else pushRSCCSS(target.cache, key, css, replace);
463
+ return;
464
+ }
465
+ if (!state) return;
466
+ if (id) {
467
+ const existing = state.entries.get(id);
468
+ if (existing) {
469
+ if (existing.css === css) return;
470
+ existing.dispose();
471
+ }
472
+ const { dispose } = injectRawCSS(css, opts);
473
+ state.entries.set(id, {
474
+ css,
475
+ dispose
476
+ });
477
+ if (deps) state.deps.set(id, deps);
478
+ } else {
479
+ const contentKey = hashString(css);
480
+ if (state.dedup.has(contentKey)) return;
481
+ state.dedup.add(contentKey);
482
+ injectRawCSS(css, opts);
483
+ }
484
+ }
485
+ // src/hooks/useKeyframes.ts
486
+ const getClientState = /* @__PURE__ */ createClientState(() => ({
487
+ contentToName: /* @__PURE__ */ new Map(),
488
+ namedSlots: /* @__PURE__ */ new Map(),
489
+ factoryDeps: /* @__PURE__ */ new Map()
490
+ }));
491
+ function useKeyframes(stepsOrFactory, depsOrOptions, options) {
492
+ const isFactory = typeof stepsOrFactory === "function";
493
+ const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
494
+ const opts = isFactory ? options : depsOrOptions;
495
+ const target = getStyleTarget();
496
+ const clientState = target.mode === "client" ? getClientState(opts?.root ?? document) : null;
497
+ if (isFactory && deps && opts?.name && clientState) {
498
+ const cached = clientState.factoryDeps.get(opts.name);
499
+ if (cached && depsEqual(cached.deps, deps)) return cached.name;
500
+ }
501
+ const steps = isFactory ? stepsOrFactory() : stepsOrFactory;
502
+ if (!steps || Object.keys(steps).length === 0) return "";
503
+ if (target.mode === "ssr") {
504
+ const actualName = target.collector.allocateKeyframeName(opts?.name);
505
+ const css = formatKeyframesCSS(actualName, steps);
506
+ target.collector.collectKeyframes(actualName, css);
507
+ return actualName;
508
+ }
509
+ if (target.mode === "rsc") {
510
+ const serializedContent = JSON.stringify(steps);
511
+ const key = `__kf:${opts?.name ?? ""}:${serializedContent}`;
512
+ const existingName = target.cache.generatedNames.get(key);
513
+ if (existingName) return existingName;
514
+ const actualName = opts?.name ?? makeKeyframeName(getNamePrefix(), hashString(serializedContent));
515
+ const css = formatKeyframesCSS(actualName, steps);
516
+ pushRSCCSS(target.cache, key, css);
517
+ target.cache.generatedNames.set(key, actualName);
518
+ return actualName;
519
+ }
520
+ const state = clientState ?? getClientState(opts?.root ?? document);
521
+ const serializedContent = JSON.stringify(steps);
522
+ const cacheKey = `${opts?.name ?? ""}:${serializedContent}`;
523
+ const cachedName = state.contentToName.get(cacheKey);
524
+ if (cachedName) return cachedName;
525
+ const providedName = opts?.name;
526
+ if (providedName) {
527
+ const slot = state.namedSlots.get(providedName);
528
+ if (slot && slot.cacheKey !== cacheKey) {
529
+ slot.dispose();
530
+ state.contentToName.delete(slot.cacheKey);
531
+ state.namedSlots.delete(providedName);
532
+ }
533
+ }
534
+ const result = keyframes(steps, {
535
+ name: providedName,
536
+ root: opts?.root
537
+ });
538
+ const name = result.toString();
539
+ state.contentToName.set(cacheKey, name);
540
+ if (providedName) {
541
+ state.namedSlots.set(providedName, {
542
+ cacheKey,
543
+ dispose: result.dispose
544
+ });
545
+ if (deps) state.factoryDeps.set(providedName, {
546
+ deps,
547
+ name
548
+ });
549
+ }
550
+ return name;
551
+ }
552
+ // src/hooks/useProperty.ts
553
+ function useProperty(name, options) {
554
+ if (!name) {
555
+ if (process.env.NODE_ENV !== "production") console.warn(`[Tasty] useProperty: property name is required`);
556
+ return;
557
+ }
558
+ const target = getStyleTarget();
559
+ if (target.mode === "ssr") {
560
+ target.collector.collectInternals();
561
+ const css = formatPropertyCSS(name, {
562
+ syntax: options?.syntax,
563
+ inherits: options?.inherits,
564
+ initialValue: options?.initialValue
565
+ });
566
+ if (css) target.collector.collectProperty(name, css);
567
+ return;
568
+ }
569
+ if (target.mode === "rsc") {
570
+ const css = formatPropertyCSS(name, {
571
+ syntax: options?.syntax,
572
+ inherits: options?.inherits,
573
+ initialValue: options?.initialValue
574
+ });
575
+ if (css) pushRSCCSS(target.cache, `__prop:${name}`, css);
576
+ return;
577
+ }
578
+ const injector = getGlobalInjector();
579
+ if (injector.isPropertyDefined(name, { root: options?.root })) return;
580
+ injector.property(name, {
581
+ syntax: options?.syntax,
582
+ inherits: options?.inherits,
583
+ initialValue: options?.initialValue,
584
+ root: options?.root
585
+ });
586
+ }
587
+ // src/hooks/useFontFace.ts
588
+ function useFontFace(family, input, options) {
589
+ if (!family) return;
590
+ const descriptors = Array.isArray(input) ? input : [input];
591
+ const target = getStyleTarget();
592
+ if (target.mode === "ssr") {
593
+ for (const desc of descriptors) {
594
+ const hash = fontFaceContentHash(family, desc);
595
+ const css = formatFontFaceRule(family, desc);
596
+ target.collector.collectFontFace(hash, css);
597
+ }
598
+ return;
599
+ }
600
+ if (target.mode === "rsc") {
601
+ for (const desc of descriptors) {
602
+ const hash = fontFaceContentHash(family, desc);
603
+ const css = formatFontFaceRule(family, desc);
604
+ pushRSCCSS(target.cache, `__ff:${hash}`, css);
605
+ }
606
+ return;
607
+ }
608
+ const injector = getGlobalInjector();
609
+ for (const desc of descriptors) injector.fontFace(family, desc, { root: options?.root });
610
+ }
611
+ // src/hooks/useCounterStyle.ts
612
+ let clientCounterStyleCounter = 0;
613
+ const getClientContentToName = /* @__PURE__ */ createClientState(() => /* @__PURE__ */ new Map());
614
+ function useCounterStyle(descriptors, options) {
615
+ if (!descriptors || !descriptors.system) return "";
616
+ const target = getStyleTarget();
617
+ if (target.mode === "ssr") {
618
+ const actualName = target.collector.allocateCounterStyleName(options?.name);
619
+ const css = formatCounterStyleRule(actualName, descriptors);
620
+ target.collector.collectCounterStyle(actualName, css);
621
+ return actualName;
622
+ }
623
+ if (target.mode === "rsc") {
624
+ const serializedContent = JSON.stringify(descriptors);
625
+ const key = `__cs:${options?.name ?? ""}:${serializedContent}`;
626
+ const existingName = target.cache.generatedNames.get(key);
627
+ if (existingName) return existingName;
628
+ const actualName = options?.name ?? makeCounterStyleName(getNamePrefix(), hashString(serializedContent));
629
+ const css = formatCounterStyleRule(actualName, descriptors);
630
+ pushRSCCSS(target.cache, key, css);
631
+ target.cache.generatedNames.set(key, actualName);
632
+ return actualName;
633
+ }
634
+ const contentToName = getClientContentToName(options?.root ?? document);
635
+ const serializedContent = JSON.stringify(descriptors);
636
+ const cacheKey = `${options?.name ?? ""}:${serializedContent}`;
637
+ const existingName = contentToName.get(cacheKey);
638
+ if (existingName) return existingName;
639
+ const name = options?.name ?? makeCounterStyleName(getNamePrefix(), String(clientCounterStyleCounter++));
640
+ contentToName.set(cacheKey, name);
641
+ getGlobalInjector().counterStyle(name, descriptors, { root: options?.root });
642
+ return name;
643
+ }
644
+ // src/hooks/useFunction.ts
645
+ function useFunction(name, definition, options) {
646
+ if (!name) {
647
+ if (process.env.NODE_ENV !== "production") console.warn(`[Tasty] useFunction: function name is required`);
648
+ return;
649
+ }
650
+ if (isFunctionsPolyfillEnabled()) {
651
+ registerFunctionPolyfill(name, definition);
652
+ return;
653
+ }
654
+ const target = getStyleTarget();
655
+ if (target.mode === "ssr") {
656
+ target.collector.collectInternals();
657
+ const css = formatFunctionRule(name, definition);
658
+ if (css) target.collector.collectFunction(parseFunctionName(name), css);
659
+ return;
660
+ }
661
+ if (target.mode === "rsc") {
662
+ const css = formatFunctionRule(name, definition);
663
+ if (css) pushRSCCSS(target.cache, `__func:${parseFunctionName(name)}`, css);
664
+ return;
665
+ }
666
+ getGlobalInjector().func(name, definition, { root: options?.root });
667
+ }
668
+ // src/batch-provider.tsx
669
+ function TastyBatchProvider({ children }) {
670
+ openBatchWindow();
671
+ React.useInsertionEffect(() => {
672
+ closeBatchWindow();
673
+ });
674
+ return children;
675
+ }
676
+ export { useProperty as a, useGlobalStyles as c, Element as d, tasty as f, useFontFace as i, useStyles as l, useFunction as n, useKeyframes as o, getDisplayName as p, useCounterStyle as r, useRawCSS as s, TastyBatchProvider as t, getTastySSRContext as u };
677
+
678
+ //# sourceMappingURL=react-runtime-B8YqpFx7.js.map