@tenphi/tasty 0.0.0-snapshot.1c5dff6 → 0.0.0-snapshot.1f1c00a

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 (331) hide show
  1. package/README.md +377 -238
  2. package/dist/babel-rZcEwPLM.d.ts +82 -0
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CL4eRu2z.js +42 -0
  6. package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
  7. package/dist/chunks/collector-D2ARGT2L.js +208 -0
  8. package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
  9. package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
  10. package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
  11. package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
  12. package/dist/chunks/css-definitions-DotDkIXt.js.map +1 -0
  13. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  15. package/dist/chunks/debug-D8pg9RGI.js +502 -0
  16. package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
  17. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  18. package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-BpxlOTbO.js +562 -0
  22. package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
  23. package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
  24. package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
  25. package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
  26. package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
  28. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  29. package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
  30. package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-gJrKBRiw.js} +126 -66
  32. package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
  33. package/dist/collector-w4mBj5gd.d.ts +164 -0
  34. package/dist/config-CZWCzBr6.d.ts +1349 -0
  35. package/dist/core/index.d.ts +5 -33
  36. package/dist/core/index.js +9 -26
  37. package/dist/index-G9JuwM9p.d.ts +1920 -0
  38. package/dist/index.d.ts +5 -48
  39. package/dist/index.js +11 -33
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-VXwJ0Frr.d.ts} +3 -4
  41. package/dist/ssr/astro-client.d.ts +1 -0
  42. package/dist/ssr/astro-client.js +6 -0
  43. package/dist/ssr/astro-client.js.map +1 -0
  44. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  45. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  46. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract.js +9 -0
  49. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  50. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  51. package/dist/ssr/astro-middleware-static.js +7 -0
  52. package/dist/ssr/astro-middleware-static.js.map +1 -0
  53. package/dist/ssr/astro-middleware.d.ts +18 -0
  54. package/dist/ssr/astro-middleware.js +7 -0
  55. package/dist/ssr/astro-middleware.js.map +1 -0
  56. package/dist/ssr/astro.d.ts +127 -0
  57. package/dist/ssr/astro.js +221 -0
  58. package/dist/ssr/astro.js.map +1 -0
  59. package/dist/ssr/index.d.ts +36 -0
  60. package/dist/ssr/index.js +10 -0
  61. package/dist/ssr/index.js.map +1 -0
  62. package/dist/ssr/next-config.d.ts +64 -0
  63. package/dist/ssr/next-config.js +128 -0
  64. package/dist/ssr/next-config.js.map +1 -0
  65. package/dist/ssr/next.d.ts +46 -0
  66. package/dist/ssr/next.js +60 -0
  67. package/dist/ssr/next.js.map +1 -0
  68. package/dist/static/index.d.ts +90 -5
  69. package/dist/static/index.js +31 -4
  70. package/dist/static/index.js.map +1 -0
  71. package/dist/static/inject.d.ts +4 -0
  72. package/dist/static/inject.js +17 -0
  73. package/dist/static/inject.js.map +1 -0
  74. package/dist/types-JEY8PVYP.d.ts +1567 -0
  75. package/dist/zero/babel.d.ts +2 -113
  76. package/dist/zero/babel.js +230 -106
  77. package/dist/zero/babel.js.map +1 -1
  78. package/dist/zero/index.d.ts +80 -3
  79. package/dist/zero/index.js +2 -4
  80. package/dist/zero/next.d.ts +57 -33
  81. package/dist/zero/next.js +93 -59
  82. package/dist/zero/next.js.map +1 -1
  83. package/docs/README.md +39 -0
  84. package/docs/adoption.md +323 -0
  85. package/docs/ai-agents.md +250 -0
  86. package/docs/comparison.md +448 -0
  87. package/docs/configuration.md +684 -56
  88. package/docs/debug.md +170 -343
  89. package/docs/design-system.md +455 -0
  90. package/docs/dsl.md +1065 -0
  91. package/docs/getting-started.md +240 -0
  92. package/docs/injector.md +159 -53
  93. package/docs/methodology.md +648 -0
  94. package/docs/migration-v3.md +285 -0
  95. package/docs/pipeline.md +765 -0
  96. package/docs/plugins.md +353 -0
  97. package/docs/react-api.md +683 -0
  98. package/docs/runtime-benchmarks.md +388 -0
  99. package/docs/ssr.md +610 -0
  100. package/docs/styles.md +211 -63
  101. package/docs/tasty-static.md +273 -67
  102. package/package.json +182 -58
  103. package/tasty.config.ts +6 -0
  104. package/dist/_virtual/_rolldown/runtime.js +0 -8
  105. package/dist/chunks/cacheKey.js +0 -70
  106. package/dist/chunks/cacheKey.js.map +0 -1
  107. package/dist/chunks/definitions.d.ts +0 -37
  108. package/dist/chunks/definitions.js +0 -260
  109. package/dist/chunks/definitions.js.map +0 -1
  110. package/dist/chunks/renderChunk.js +0 -61
  111. package/dist/chunks/renderChunk.js.map +0 -1
  112. package/dist/config.d.ts +0 -288
  113. package/dist/config.js +0 -403
  114. package/dist/config.js.map +0 -1
  115. package/dist/debug.d.ts +0 -204
  116. package/dist/debug.js +0 -733
  117. package/dist/debug.js.map +0 -1
  118. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  119. package/dist/hooks/useGlobalStyles.js +0 -56
  120. package/dist/hooks/useGlobalStyles.js.map +0 -1
  121. package/dist/hooks/useKeyframes.d.ts +0 -56
  122. package/dist/hooks/useKeyframes.js +0 -54
  123. package/dist/hooks/useKeyframes.js.map +0 -1
  124. package/dist/hooks/useProperty.d.ts +0 -79
  125. package/dist/hooks/useProperty.js +0 -91
  126. package/dist/hooks/useProperty.js.map +0 -1
  127. package/dist/hooks/useRawCSS.d.ts +0 -53
  128. package/dist/hooks/useRawCSS.js +0 -28
  129. package/dist/hooks/useRawCSS.js.map +0 -1
  130. package/dist/hooks/useStyles.d.ts +0 -40
  131. package/dist/hooks/useStyles.js +0 -169
  132. package/dist/hooks/useStyles.js.map +0 -1
  133. package/dist/injector/index.d.ts +0 -157
  134. package/dist/injector/index.js +0 -154
  135. package/dist/injector/index.js.map +0 -1
  136. package/dist/injector/injector.d.ts +0 -139
  137. package/dist/injector/injector.js +0 -417
  138. package/dist/injector/injector.js.map +0 -1
  139. package/dist/injector/sheet-manager.d.ts +0 -135
  140. package/dist/injector/sheet-manager.js +0 -728
  141. package/dist/injector/sheet-manager.js.map +0 -1
  142. package/dist/injector/types.d.ts +0 -144
  143. package/dist/keyframes/index.js +0 -206
  144. package/dist/keyframes/index.js.map +0 -1
  145. package/dist/parser/classify.js +0 -319
  146. package/dist/parser/classify.js.map +0 -1
  147. package/dist/parser/const.js +0 -33
  148. package/dist/parser/const.js.map +0 -1
  149. package/dist/parser/lru.js +0 -109
  150. package/dist/parser/lru.js.map +0 -1
  151. package/dist/parser/parser.d.ts +0 -25
  152. package/dist/parser/parser.js +0 -116
  153. package/dist/parser/parser.js.map +0 -1
  154. package/dist/parser/tokenizer.js +0 -69
  155. package/dist/parser/tokenizer.js.map +0 -1
  156. package/dist/parser/types.d.ts +0 -51
  157. package/dist/parser/types.js +0 -46
  158. package/dist/parser/types.js.map +0 -1
  159. package/dist/pipeline/conditions.d.ts +0 -134
  160. package/dist/pipeline/conditions.js +0 -406
  161. package/dist/pipeline/conditions.js.map +0 -1
  162. package/dist/pipeline/exclusive.js +0 -231
  163. package/dist/pipeline/exclusive.js.map +0 -1
  164. package/dist/pipeline/index.d.ts +0 -53
  165. package/dist/pipeline/index.js +0 -660
  166. package/dist/pipeline/index.js.map +0 -1
  167. package/dist/pipeline/materialize.js +0 -856
  168. package/dist/pipeline/materialize.js.map +0 -1
  169. package/dist/pipeline/parseStateKey.d.ts +0 -15
  170. package/dist/pipeline/parseStateKey.js +0 -451
  171. package/dist/pipeline/parseStateKey.js.map +0 -1
  172. package/dist/pipeline/simplify.js +0 -516
  173. package/dist/pipeline/simplify.js.map +0 -1
  174. package/dist/pipeline/warnings.js +0 -18
  175. package/dist/pipeline/warnings.js.map +0 -1
  176. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  177. package/dist/plugins/okhsl-plugin.js +0 -371
  178. package/dist/plugins/okhsl-plugin.js.map +0 -1
  179. package/dist/plugins/types.d.ts +0 -69
  180. package/dist/properties/index.js +0 -221
  181. package/dist/properties/index.js.map +0 -1
  182. package/dist/properties/property-type-resolver.d.ts +0 -24
  183. package/dist/properties/property-type-resolver.js +0 -83
  184. package/dist/properties/property-type-resolver.js.map +0 -1
  185. package/dist/states/index.d.ts +0 -49
  186. package/dist/states/index.js +0 -416
  187. package/dist/states/index.js.map +0 -1
  188. package/dist/static/tastyStatic.d.ts +0 -46
  189. package/dist/static/tastyStatic.js +0 -31
  190. package/dist/static/tastyStatic.js.map +0 -1
  191. package/dist/static/types.d.ts +0 -49
  192. package/dist/static/types.js +0 -24
  193. package/dist/static/types.js.map +0 -1
  194. package/dist/styles/align.d.ts +0 -15
  195. package/dist/styles/align.js +0 -14
  196. package/dist/styles/align.js.map +0 -1
  197. package/dist/styles/border.d.ts +0 -25
  198. package/dist/styles/border.js +0 -114
  199. package/dist/styles/border.js.map +0 -1
  200. package/dist/styles/color.d.ts +0 -14
  201. package/dist/styles/color.js +0 -23
  202. package/dist/styles/color.js.map +0 -1
  203. package/dist/styles/createStyle.js +0 -77
  204. package/dist/styles/createStyle.js.map +0 -1
  205. package/dist/styles/dimension.js +0 -97
  206. package/dist/styles/dimension.js.map +0 -1
  207. package/dist/styles/display.d.ts +0 -37
  208. package/dist/styles/display.js +0 -67
  209. package/dist/styles/display.js.map +0 -1
  210. package/dist/styles/fade.d.ts +0 -15
  211. package/dist/styles/fade.js +0 -58
  212. package/dist/styles/fade.js.map +0 -1
  213. package/dist/styles/fill.d.ts +0 -42
  214. package/dist/styles/fill.js +0 -52
  215. package/dist/styles/fill.js.map +0 -1
  216. package/dist/styles/flow.d.ts +0 -16
  217. package/dist/styles/flow.js +0 -12
  218. package/dist/styles/flow.js.map +0 -1
  219. package/dist/styles/gap.d.ts +0 -31
  220. package/dist/styles/gap.js +0 -37
  221. package/dist/styles/gap.js.map +0 -1
  222. package/dist/styles/height.d.ts +0 -17
  223. package/dist/styles/height.js +0 -20
  224. package/dist/styles/height.js.map +0 -1
  225. package/dist/styles/index.d.ts +0 -2
  226. package/dist/styles/index.js +0 -9
  227. package/dist/styles/index.js.map +0 -1
  228. package/dist/styles/inset.d.ts +0 -52
  229. package/dist/styles/inset.js +0 -150
  230. package/dist/styles/inset.js.map +0 -1
  231. package/dist/styles/justify.d.ts +0 -15
  232. package/dist/styles/justify.js +0 -14
  233. package/dist/styles/justify.js.map +0 -1
  234. package/dist/styles/list.d.ts +0 -16
  235. package/dist/styles/list.js +0 -98
  236. package/dist/styles/list.js.map +0 -1
  237. package/dist/styles/margin.d.ts +0 -24
  238. package/dist/styles/margin.js +0 -104
  239. package/dist/styles/margin.js.map +0 -1
  240. package/dist/styles/outline.d.ts +0 -29
  241. package/dist/styles/outline.js +0 -65
  242. package/dist/styles/outline.js.map +0 -1
  243. package/dist/styles/padding.d.ts +0 -24
  244. package/dist/styles/padding.js +0 -104
  245. package/dist/styles/padding.js.map +0 -1
  246. package/dist/styles/predefined.d.ts +0 -73
  247. package/dist/styles/predefined.js +0 -241
  248. package/dist/styles/predefined.js.map +0 -1
  249. package/dist/styles/preset.d.ts +0 -47
  250. package/dist/styles/preset.js +0 -126
  251. package/dist/styles/preset.js.map +0 -1
  252. package/dist/styles/radius.d.ts +0 -14
  253. package/dist/styles/radius.js +0 -51
  254. package/dist/styles/radius.js.map +0 -1
  255. package/dist/styles/scrollbar.d.ts +0 -23
  256. package/dist/styles/scrollbar.js +0 -34
  257. package/dist/styles/scrollbar.js.map +0 -1
  258. package/dist/styles/shadow.d.ts +0 -14
  259. package/dist/styles/shadow.js +0 -24
  260. package/dist/styles/shadow.js.map +0 -1
  261. package/dist/styles/styledScrollbar.d.ts +0 -47
  262. package/dist/styles/styledScrollbar.js +0 -38
  263. package/dist/styles/styledScrollbar.js.map +0 -1
  264. package/dist/styles/transition.d.ts +0 -14
  265. package/dist/styles/transition.js +0 -158
  266. package/dist/styles/transition.js.map +0 -1
  267. package/dist/styles/types.d.ts +0 -498
  268. package/dist/styles/width.d.ts +0 -17
  269. package/dist/styles/width.js +0 -20
  270. package/dist/styles/width.js.map +0 -1
  271. package/dist/tasty.d.ts +0 -982
  272. package/dist/tasty.js +0 -206
  273. package/dist/tasty.js.map +0 -1
  274. package/dist/tokens/typography.d.ts +0 -19
  275. package/dist/tokens/typography.js +0 -237
  276. package/dist/tokens/typography.js.map +0 -1
  277. package/dist/types.d.ts +0 -184
  278. package/dist/utils/cache-wrapper.js +0 -26
  279. package/dist/utils/cache-wrapper.js.map +0 -1
  280. package/dist/utils/case-converter.js +0 -8
  281. package/dist/utils/case-converter.js.map +0 -1
  282. package/dist/utils/colors.d.ts +0 -5
  283. package/dist/utils/colors.js +0 -9
  284. package/dist/utils/colors.js.map +0 -1
  285. package/dist/utils/css-types.d.ts +0 -7
  286. package/dist/utils/dotize.d.ts +0 -26
  287. package/dist/utils/dotize.js +0 -122
  288. package/dist/utils/dotize.js.map +0 -1
  289. package/dist/utils/filter-base-props.d.ts +0 -15
  290. package/dist/utils/filter-base-props.js +0 -45
  291. package/dist/utils/filter-base-props.js.map +0 -1
  292. package/dist/utils/get-display-name.d.ts +0 -7
  293. package/dist/utils/get-display-name.js +0 -10
  294. package/dist/utils/get-display-name.js.map +0 -1
  295. package/dist/utils/hsl-to-rgb.js +0 -38
  296. package/dist/utils/hsl-to-rgb.js.map +0 -1
  297. package/dist/utils/is-dev-env.js +0 -19
  298. package/dist/utils/is-dev-env.js.map +0 -1
  299. package/dist/utils/is-valid-element-type.js +0 -15
  300. package/dist/utils/is-valid-element-type.js.map +0 -1
  301. package/dist/utils/merge-styles.js.map +0 -1
  302. package/dist/utils/mod-attrs.d.ts +0 -8
  303. package/dist/utils/mod-attrs.js +0 -21
  304. package/dist/utils/mod-attrs.js.map +0 -1
  305. package/dist/utils/okhsl-to-rgb.js +0 -296
  306. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  307. package/dist/utils/process-tokens.d.ts +0 -31
  308. package/dist/utils/process-tokens.js +0 -171
  309. package/dist/utils/process-tokens.js.map +0 -1
  310. package/dist/utils/resolve-recipes.d.ts +0 -17
  311. package/dist/utils/resolve-recipes.js +0 -147
  312. package/dist/utils/resolve-recipes.js.map +0 -1
  313. package/dist/utils/selector-transform.js +0 -32
  314. package/dist/utils/selector-transform.js.map +0 -1
  315. package/dist/utils/string.js +0 -8
  316. package/dist/utils/string.js.map +0 -1
  317. package/dist/utils/styles.d.ts +0 -177
  318. package/dist/utils/styles.js +0 -730
  319. package/dist/utils/styles.js.map +0 -1
  320. package/dist/utils/typography.d.ts +0 -36
  321. package/dist/utils/typography.js +0 -53
  322. package/dist/utils/typography.js.map +0 -1
  323. package/dist/utils/warnings.d.ts +0 -16
  324. package/dist/utils/warnings.js +0 -16
  325. package/dist/utils/warnings.js.map +0 -1
  326. package/dist/zero/css-writer.d.ts +0 -45
  327. package/dist/zero/css-writer.js +0 -74
  328. package/dist/zero/css-writer.js.map +0 -1
  329. package/dist/zero/extractor.d.ts +0 -24
  330. package/dist/zero/extractor.js.map +0 -1
  331. package/docs/usage.md +0 -695
@@ -0,0 +1,562 @@
1
+ import { n as isSelector, t as mergeStyles } from "./shared-utils-y-HjvPN4.js";
2
+ import { D as makeKeyframeName, E as makeCounterStyleName, U as parseFunctionName, V as formatFunctionRule, W as registerFunctionPolyfill, a as formatPropertyCSS, b as formatFontFaceRule, h as formatCounterStyleRule, i as formatKeyframesCSS, j as hashString, n as formatGlobalRules, v as fontFaceContentHash } from "./css-definitions-DotDkIXt.js";
3
+ import { W as isFunctionsPolyfillEnabled, b as renderStyles, i as baseStylePropsRegistry, s as BASE_STYLES } from "./style-engine-BBbBuSkT.js";
4
+ import { $ as propHandlerRegistry, B as getNamePrefix, E as injectRawCSS, I as getConfig, J as closeBatchWindow, L as getGlobalInjector, M as touch, T as injectGlobal, Z as openBatchWindow, c as hasKeys, d as getStyleTarget, f as pushRSCCSS, i as modAttrs, k as keyframes, l as collectAutoInferredProperties, n as createClientState, o as computeStyles, r as processTokens, s as resolveRecipes, t as depsEqual, u as collectAutoInferredPropertiesRSC } from "./runtime-engine-CKFXUH-A.js";
5
+ import { Fragment, createContext, createElement, forwardRef, useContext, useInsertionEffect } from "react";
6
+ //#region src/utils/get-display-name.ts
7
+ const DEFAULT_NAME = "Anonymous";
8
+ function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
9
+ if (typeof Component === "function") return Component.displayName ?? Component.name ?? fallbackName;
10
+ return fallbackName;
11
+ }
12
+ //#endregion
13
+ //#region src/utils/is-valid-element-type.ts
14
+ function isValidElementType(value) {
15
+ if (typeof value === "string" || typeof value === "function") return true;
16
+ if (typeof value === "object" && value !== null) return typeof value.$$typeof === "symbol";
17
+ return false;
18
+ }
19
+ //#endregion
20
+ //#region src/tasty.tsx
21
+ function handleIsProperty(props, isProperty, targetAttribute, dataAttribute) {
22
+ if (isProperty in props) {
23
+ props[targetAttribute] = props[isProperty];
24
+ delete props[isProperty];
25
+ }
26
+ if (!(dataAttribute in props) && props[targetAttribute]) props[dataAttribute] = "";
27
+ }
28
+ function handleIsProperties(props) {
29
+ handleIsProperty(props, "isDisabled", "disabled", "data-disabled");
30
+ handleIsProperty(props, "isHidden", "hidden", "data-hidden");
31
+ handleIsProperty(props, "isChecked", "checked", "data-checked");
32
+ }
33
+ function createSubElement(elementName, definition) {
34
+ const config = typeof definition === "string" ? { as: definition } : definition;
35
+ const tag = config.as ?? "div";
36
+ const defaultQa = config.qa;
37
+ const defaultQaVal = config.qaVal;
38
+ const SubElement = forwardRef((props, ref) => {
39
+ const { qa, qaVal, mods, tokens, isDisabled, isHidden, isChecked, className, style, ...htmlProps } = props;
40
+ let modDataAttrs;
41
+ if (mods) modDataAttrs = modAttrs(mods);
42
+ const tokenStyle = tokens ? processTokens(tokens) : void 0;
43
+ let mergedStyle;
44
+ if (tokenStyle || style) mergedStyle = tokenStyle && style ? {
45
+ ...tokenStyle,
46
+ ...style
47
+ } : tokenStyle ?? style;
48
+ const elementProps = {
49
+ "data-element": elementName,
50
+ "data-qa": qa ?? defaultQa,
51
+ "data-qaval": qaVal ?? defaultQaVal,
52
+ ...modDataAttrs || {},
53
+ ...htmlProps,
54
+ className,
55
+ style: mergedStyle,
56
+ isDisabled: isDisabled ?? htmlProps.disabled,
57
+ isHidden: isHidden ?? htmlProps.hidden,
58
+ isChecked: isChecked ?? htmlProps.checked,
59
+ ref
60
+ };
61
+ handleIsProperties(elementProps);
62
+ if (elementProps["data-qa"] === void 0) delete elementProps["data-qa"];
63
+ if (elementProps["data-qaval"] === void 0) delete elementProps["data-qaval"];
64
+ return createElement(tag, elementProps);
65
+ });
66
+ SubElement.displayName = `SubElement(${elementName})`;
67
+ return SubElement;
68
+ }
69
+ function buildTokenPropsMapping(def) {
70
+ if (Array.isArray(def)) return def.map((propName) => {
71
+ if (propName.endsWith("Color") && propName.length > 5) return [propName, `#${propName.slice(0, -5)}`];
72
+ return [propName, `$${propName}`];
73
+ });
74
+ return Object.entries(def);
75
+ }
76
+ function tasty(Component, options) {
77
+ if (isValidElementType(Component)) return tastyWrap(Component, options);
78
+ return tastyElement(Component);
79
+ }
80
+ function tastyWrap(Component, options) {
81
+ const { as: extendTag, element: extendElement, styleProps: _styleProps, modProps: _modProps, tokenProps: _tokenProps, variants: _variants, elements: _elements, ...defaultProps } = options ?? {};
82
+ const propsWithStyles = ["styles"];
83
+ for (const prop of Object.keys(defaultProps)) if (prop.endsWith("Styles")) propsWithStyles.push(prop);
84
+ const _WrappedComponent = forwardRef((props, ref) => {
85
+ const { as, element, ...restProps } = props;
86
+ const mergedStylesMap = {};
87
+ for (const prop of propsWithStyles) {
88
+ const restValue = restProps[prop];
89
+ const defaultValue = defaultProps[prop];
90
+ mergedStylesMap[prop] = restValue != null && defaultValue != null ? mergeStyles(defaultValue, restValue) : restValue ?? defaultValue;
91
+ }
92
+ const elementProps = {
93
+ ...defaultProps,
94
+ ...restProps,
95
+ ...mergedStylesMap,
96
+ as: as ?? extendTag,
97
+ element: element || extendElement,
98
+ ref
99
+ };
100
+ return createElement(Component, elementProps);
101
+ });
102
+ _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(Component, defaultProps.qa ?? extendTag ?? "Anonymous")})`;
103
+ return _WrappedComponent;
104
+ }
105
+ function tastyElement(tastyOptions) {
106
+ const { as: originalAs = "div", element: defaultElement, styles: defaultStyles, styleProps, modProps: modPropsDef, tokenProps: tokenPropsDef, variants, tokens: defaultTokens, elements, ...defaultProps } = tastyOptions;
107
+ let variantStylesMap;
108
+ if (variants) {
109
+ let baseStyles = defaultStyles;
110
+ let extensionStyles;
111
+ if (defaultStyles) for (const key of Object.keys(defaultStyles)) {
112
+ if (isSelector(key)) continue;
113
+ const value = defaultStyles[key];
114
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && !("" in value)) {
115
+ if (!extensionStyles) {
116
+ baseStyles = { ...defaultStyles };
117
+ extensionStyles = {};
118
+ }
119
+ extensionStyles[key] = value;
120
+ delete baseStyles[key];
121
+ }
122
+ }
123
+ variantStylesMap = {};
124
+ for (const [variant, variantStyles] of Object.entries(variants)) variantStylesMap[variant] = extensionStyles ? mergeStyles(baseStyles, variantStyles, extensionStyles) : mergeStyles(baseStyles, variantStyles);
125
+ if (!variantStylesMap["default"]) variantStylesMap["default"] = defaultStyles;
126
+ }
127
+ const { qa: defaultQa, qaVal: defaultQaVal, ...otherDefaultProps } = defaultProps;
128
+ const ownPropsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
129
+ let propsToCheck = ownPropsToCheck;
130
+ let propsToCheckVersion = -1;
131
+ const modPropsKeys = modPropsDef ? Array.isArray(modPropsDef) ? modPropsDef : Object.keys(modPropsDef) : void 0;
132
+ const tokenPropsMapping = tokenPropsDef ? buildTokenPropsMapping(tokenPropsDef) : void 0;
133
+ const classNameCache = /* @__PURE__ */ new Map();
134
+ const STABLE_STYLES = { stableStyles: true };
135
+ const _TastyComponent = forwardRef((incomingProps, ref) => {
136
+ const applyPropHandlers = propHandlerRegistry.apply;
137
+ const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, theme, ...otherProps } = applyPropHandlers ? applyPropHandlers(incomingProps) : incomingProps;
138
+ const styles = rawStyles;
139
+ let propStyles = null;
140
+ if (propsToCheckVersion !== baseStylePropsRegistry.version) {
141
+ const promoted = baseStylePropsRegistry.list;
142
+ propsToCheck = promoted.length === 0 ? ownPropsToCheck : ownPropsToCheck.concat(promoted);
143
+ propsToCheckVersion = baseStylePropsRegistry.version;
144
+ }
145
+ for (const prop of propsToCheck) {
146
+ const key = prop;
147
+ if (key in otherProps) {
148
+ if (!propStyles) propStyles = {};
149
+ const value = otherProps[key];
150
+ propStyles[key] = value;
151
+ delete otherProps[key];
152
+ }
153
+ }
154
+ let propMods;
155
+ if (modPropsKeys) {
156
+ for (const key of modPropsKeys) if (key in otherProps) {
157
+ if (!propMods) propMods = {};
158
+ propMods[key] = otherProps[key];
159
+ delete otherProps[key];
160
+ }
161
+ }
162
+ let propTokens;
163
+ if (tokenPropsMapping) {
164
+ for (const [propName, tokenKey] of tokenPropsMapping) if (propName in otherProps) {
165
+ if (!propTokens) propTokens = {};
166
+ propTokens[tokenKey] = otherProps[propName];
167
+ delete otherProps[propName];
168
+ }
169
+ }
170
+ const baseStyles = variantStylesMap ? variantStylesMap[variant || "default"] ?? variantStylesMap["default"] : defaultStyles;
171
+ const allStyles = styles && hasKeys(styles) || !!propStyles ? mergeStyles(baseStyles, styles, propStyles) : baseStyles;
172
+ const useFactoryCache = typeof document !== "undefined";
173
+ let generatedClassName = useFactoryCache && allStyles === baseStyles ? classNameCache.get(allStyles) : void 0;
174
+ let rscCSS;
175
+ if (generatedClassName !== void 0) touch(generatedClassName);
176
+ else {
177
+ const result = computeStyles(allStyles, !useFactoryCache && allStyles === baseStyles ? STABLE_STYLES : void 0);
178
+ generatedClassName = result.className;
179
+ rscCSS = result.css;
180
+ if (useFactoryCache && allStyles === baseStyles) classNameCache.set(allStyles, generatedClassName);
181
+ }
182
+ let mergedTokens;
183
+ if (defaultTokens || tokens || propTokens) {
184
+ if (!defaultTokens && !propTokens) mergedTokens = tokens;
185
+ else if (!tokens && !propTokens) mergedTokens = defaultTokens;
186
+ else mergedTokens = {
187
+ ...defaultTokens,
188
+ ...tokens,
189
+ ...propTokens
190
+ };
191
+ }
192
+ const processedTokenStyle = processTokens(mergedTokens);
193
+ let mergedStyle;
194
+ if (processedTokenStyle || style) {
195
+ if (!processedTokenStyle) mergedStyle = style;
196
+ else if (!style) mergedStyle = processedTokenStyle;
197
+ else mergedStyle = {
198
+ ...processedTokenStyle,
199
+ ...style
200
+ };
201
+ }
202
+ const mergedMods = propMods ? {
203
+ ...mods,
204
+ ...propMods
205
+ } : mods;
206
+ let modDataAttrs;
207
+ if (mergedMods) modDataAttrs = modAttrs(mergedMods);
208
+ let finalClassName = generatedClassName;
209
+ if (userClassName) finalClassName = finalClassName ? `${userClassName} ${finalClassName}` : userClassName;
210
+ const elementProps = {
211
+ "data-element": element || defaultElement,
212
+ "data-qa": qa || defaultQa,
213
+ "data-qaval": qaVal || defaultQaVal,
214
+ "data-theme": theme,
215
+ ...otherDefaultProps,
216
+ ...modDataAttrs || {},
217
+ ...otherProps,
218
+ className: finalClassName,
219
+ style: mergedStyle,
220
+ ref
221
+ };
222
+ handleIsProperties(elementProps);
223
+ if (elementProps["data-theme"] === void 0) delete elementProps["data-theme"];
224
+ const el = createElement(as ?? originalAs, elementProps);
225
+ if (rscCSS) {
226
+ const nonce = getConfig().nonce;
227
+ return createElement(Fragment, null, createElement("style", {
228
+ "data-tasty-rsc": "",
229
+ nonce,
230
+ dangerouslySetInnerHTML: { __html: rscCSS }
231
+ }), el);
232
+ }
233
+ return el;
234
+ });
235
+ _TastyComponent.displayName = `TastyComponent(${defaultProps.qa || originalAs})`;
236
+ if (elements) {
237
+ const subElements = {};
238
+ for (const [name, definition] of Object.entries(elements)) subElements[name] = createSubElement(name, definition);
239
+ return Object.assign(_TastyComponent, subElements);
240
+ }
241
+ return _TastyComponent;
242
+ }
243
+ const Element = /* @__PURE__ */ tasty({});
244
+ //#endregion
245
+ //#region src/ssr/context.ts
246
+ let _ctx;
247
+ function getTastySSRContext() {
248
+ if (!_ctx) _ctx = createContext(null);
249
+ return _ctx;
250
+ }
251
+ //#endregion
252
+ //#region src/hooks/useStyles.ts
253
+ function useStyles(styles, options) {
254
+ return computeStyles(styles, {
255
+ ssrCollector: useContext(getTastySSRContext()),
256
+ root: options?.root
257
+ });
258
+ }
259
+ //#endregion
260
+ //#region src/hooks/useGlobalStyles.ts
261
+ const getClientGlobalSlots = /* @__PURE__ */ createClientState(() => /* @__PURE__ */ new Map());
262
+ const noop = () => {};
263
+ function useGlobalStyles(selector, styles, options) {
264
+ if (!styles) return;
265
+ if (!selector) {
266
+ if (process.env.NODE_ENV !== "production") console.warn("[Tasty] useGlobalStyles: selector is required and cannot be empty. Styles will not be injected.");
267
+ return;
268
+ }
269
+ const target = getStyleTarget();
270
+ const slots = target.mode === "client" ? getClientGlobalSlots(options?.root ?? document) : null;
271
+ const slotKey = options?.id ?? selector;
272
+ const stylesKey = slots ? JSON.stringify(styles) : "";
273
+ const existing = slots?.get(slotKey);
274
+ if (existing && existing.stylesKey === stylesKey) return;
275
+ const resolvedStyles = resolveRecipes(styles);
276
+ const styleResults = renderStyles(resolvedStyles, selector);
277
+ if (styleResults.length === 0) {
278
+ if (slots) {
279
+ existing?.dispose();
280
+ slots.set(slotKey, {
281
+ stylesKey,
282
+ dispose: noop
283
+ });
284
+ }
285
+ return;
286
+ }
287
+ if (target.mode === "ssr") {
288
+ target.collector.collectInternals();
289
+ const css = formatGlobalRules(styleResults);
290
+ if (css) {
291
+ const key = options?.id ? `global:${options.id}` : `global:${selector}:${hashString(css)}`;
292
+ target.collector.collectGlobalStyles(key, css, options?.id != null);
293
+ }
294
+ if (getConfig().autoPropertyTypes !== false) collectAutoInferredProperties(styleResults, target.collector, resolvedStyles);
295
+ return;
296
+ }
297
+ if (target.mode === "rsc") {
298
+ const css = formatGlobalRules(styleResults);
299
+ if (css) {
300
+ const key = options?.id ? `__global:${options.id}` : `__global:${selector}:${hashString(css)}`;
301
+ pushRSCCSS(target.cache, key, css, options?.id != null);
302
+ }
303
+ if (getConfig().autoPropertyTypes !== false) collectAutoInferredPropertiesRSC(styleResults, target.cache, resolvedStyles);
304
+ return;
305
+ }
306
+ if (slots) {
307
+ existing?.dispose();
308
+ const { dispose } = injectGlobal(styleResults, { root: options?.root });
309
+ slots.set(slotKey, {
310
+ stylesKey,
311
+ dispose
312
+ });
313
+ }
314
+ }
315
+ //#endregion
316
+ //#region src/hooks/useRawCSS.ts
317
+ const getClientState$1 = /* @__PURE__ */ createClientState(() => ({
318
+ entries: /* @__PURE__ */ new Map(),
319
+ dedup: /* @__PURE__ */ new Set(),
320
+ deps: /* @__PURE__ */ new Map()
321
+ }));
322
+ function useRawCSS(cssOrFactory, depsOrOptions, options) {
323
+ const isFactory = typeof cssOrFactory === "function";
324
+ const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
325
+ const opts = isFactory ? options : depsOrOptions;
326
+ const id = opts?.id;
327
+ const target = getStyleTarget();
328
+ const state = target.mode === "client" ? getClientState$1(opts?.root ?? document) : null;
329
+ if (isFactory && deps && id && state) {
330
+ const cachedDeps = state.deps.get(id);
331
+ if (cachedDeps && depsEqual(cachedDeps, deps)) return;
332
+ }
333
+ const css = isFactory ? cssOrFactory() : cssOrFactory;
334
+ if (!css.trim()) return;
335
+ if (target.mode !== "client") {
336
+ const key = `${target.mode === "rsc" ? "__" : ""}raw:${id || hashString(css)}`;
337
+ const replace = id != null;
338
+ if (target.mode === "ssr") target.collector.collectRawCSS(key, css, replace);
339
+ else pushRSCCSS(target.cache, key, css, replace);
340
+ return;
341
+ }
342
+ if (!state) return;
343
+ if (id) {
344
+ const existing = state.entries.get(id);
345
+ if (existing) {
346
+ if (existing.css === css) return;
347
+ existing.dispose();
348
+ }
349
+ const { dispose } = injectRawCSS(css, opts);
350
+ state.entries.set(id, {
351
+ css,
352
+ dispose
353
+ });
354
+ if (deps) state.deps.set(id, deps);
355
+ } else {
356
+ const contentKey = hashString(css);
357
+ if (state.dedup.has(contentKey)) return;
358
+ state.dedup.add(contentKey);
359
+ injectRawCSS(css, opts);
360
+ }
361
+ }
362
+ //#endregion
363
+ //#region src/hooks/useKeyframes.ts
364
+ const getClientState = /* @__PURE__ */ createClientState(() => ({
365
+ contentToName: /* @__PURE__ */ new Map(),
366
+ namedSlots: /* @__PURE__ */ new Map(),
367
+ factoryDeps: /* @__PURE__ */ new Map()
368
+ }));
369
+ function useKeyframes(stepsOrFactory, depsOrOptions, options) {
370
+ const isFactory = typeof stepsOrFactory === "function";
371
+ const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
372
+ const opts = isFactory ? options : depsOrOptions;
373
+ const target = getStyleTarget();
374
+ const clientState = target.mode === "client" ? getClientState(opts?.root ?? document) : null;
375
+ if (isFactory && deps && opts?.name && clientState) {
376
+ const cached = clientState.factoryDeps.get(opts.name);
377
+ if (cached && depsEqual(cached.deps, deps)) return cached.name;
378
+ }
379
+ const steps = isFactory ? stepsOrFactory() : stepsOrFactory;
380
+ if (!steps || Object.keys(steps).length === 0) return "";
381
+ if (target.mode === "ssr") {
382
+ const actualName = target.collector.allocateKeyframeName(opts?.name);
383
+ const css = formatKeyframesCSS(actualName, steps);
384
+ target.collector.collectKeyframes(actualName, css);
385
+ return actualName;
386
+ }
387
+ if (target.mode === "rsc") {
388
+ const serializedContent = JSON.stringify(steps);
389
+ const key = `__kf:${opts?.name ?? ""}:${serializedContent}`;
390
+ const existingName = target.cache.generatedNames.get(key);
391
+ if (existingName) return existingName;
392
+ const actualName = opts?.name ?? makeKeyframeName(getNamePrefix(), hashString(serializedContent));
393
+ const css = formatKeyframesCSS(actualName, steps);
394
+ pushRSCCSS(target.cache, key, css);
395
+ target.cache.generatedNames.set(key, actualName);
396
+ return actualName;
397
+ }
398
+ const state = clientState ?? getClientState(opts?.root ?? document);
399
+ const serializedContent = JSON.stringify(steps);
400
+ const cacheKey = `${opts?.name ?? ""}:${serializedContent}`;
401
+ const cachedName = state.contentToName.get(cacheKey);
402
+ if (cachedName) return cachedName;
403
+ const providedName = opts?.name;
404
+ if (providedName) {
405
+ const slot = state.namedSlots.get(providedName);
406
+ if (slot && slot.cacheKey !== cacheKey) {
407
+ slot.dispose();
408
+ state.contentToName.delete(slot.cacheKey);
409
+ state.namedSlots.delete(providedName);
410
+ }
411
+ }
412
+ const result = keyframes(steps, {
413
+ name: providedName,
414
+ root: opts?.root
415
+ });
416
+ const name = result.toString();
417
+ state.contentToName.set(cacheKey, name);
418
+ if (providedName) {
419
+ state.namedSlots.set(providedName, {
420
+ cacheKey,
421
+ dispose: result.dispose
422
+ });
423
+ if (deps) state.factoryDeps.set(providedName, {
424
+ deps,
425
+ name
426
+ });
427
+ }
428
+ return name;
429
+ }
430
+ //#endregion
431
+ //#region src/hooks/useProperty.ts
432
+ function useProperty(name, options) {
433
+ if (!name) {
434
+ if (process.env.NODE_ENV !== "production") console.warn(`[Tasty] useProperty: property name is required`);
435
+ return;
436
+ }
437
+ const target = getStyleTarget();
438
+ if (target.mode === "ssr") {
439
+ target.collector.collectInternals();
440
+ const css = formatPropertyCSS(name, {
441
+ syntax: options?.syntax,
442
+ inherits: options?.inherits,
443
+ initialValue: options?.initialValue
444
+ });
445
+ if (css) target.collector.collectProperty(name, css);
446
+ return;
447
+ }
448
+ if (target.mode === "rsc") {
449
+ const css = formatPropertyCSS(name, {
450
+ syntax: options?.syntax,
451
+ inherits: options?.inherits,
452
+ initialValue: options?.initialValue
453
+ });
454
+ if (css) pushRSCCSS(target.cache, `__prop:${name}`, css);
455
+ return;
456
+ }
457
+ const injector = getGlobalInjector();
458
+ if (injector.isPropertyDefined(name, { root: options?.root })) return;
459
+ injector.property(name, {
460
+ syntax: options?.syntax,
461
+ inherits: options?.inherits,
462
+ initialValue: options?.initialValue,
463
+ root: options?.root
464
+ });
465
+ }
466
+ //#endregion
467
+ //#region src/hooks/useFontFace.ts
468
+ function useFontFace(family, input, options) {
469
+ if (!family) return;
470
+ const descriptors = Array.isArray(input) ? input : [input];
471
+ const target = getStyleTarget();
472
+ if (target.mode === "ssr") {
473
+ for (const desc of descriptors) {
474
+ const hash = fontFaceContentHash(family, desc);
475
+ const css = formatFontFaceRule(family, desc);
476
+ target.collector.collectFontFace(hash, css);
477
+ }
478
+ return;
479
+ }
480
+ if (target.mode === "rsc") {
481
+ for (const desc of descriptors) {
482
+ const hash = fontFaceContentHash(family, desc);
483
+ const css = formatFontFaceRule(family, desc);
484
+ pushRSCCSS(target.cache, `__ff:${hash}`, css);
485
+ }
486
+ return;
487
+ }
488
+ const injector = getGlobalInjector();
489
+ for (const desc of descriptors) injector.fontFace(family, desc, { root: options?.root });
490
+ }
491
+ //#endregion
492
+ //#region src/hooks/useCounterStyle.ts
493
+ let clientCounterStyleCounter = 0;
494
+ const getClientContentToName = /* @__PURE__ */ createClientState(() => /* @__PURE__ */ new Map());
495
+ function useCounterStyle(descriptors, options) {
496
+ if (!descriptors || !descriptors.system) return "";
497
+ const target = getStyleTarget();
498
+ if (target.mode === "ssr") {
499
+ const actualName = target.collector.allocateCounterStyleName(options?.name);
500
+ const css = formatCounterStyleRule(actualName, descriptors);
501
+ target.collector.collectCounterStyle(actualName, css);
502
+ return actualName;
503
+ }
504
+ if (target.mode === "rsc") {
505
+ const serializedContent = JSON.stringify(descriptors);
506
+ const key = `__cs:${options?.name ?? ""}:${serializedContent}`;
507
+ const existingName = target.cache.generatedNames.get(key);
508
+ if (existingName) return existingName;
509
+ const actualName = options?.name ?? makeCounterStyleName(getNamePrefix(), hashString(serializedContent));
510
+ const css = formatCounterStyleRule(actualName, descriptors);
511
+ pushRSCCSS(target.cache, key, css);
512
+ target.cache.generatedNames.set(key, actualName);
513
+ return actualName;
514
+ }
515
+ const contentToName = getClientContentToName(options?.root ?? document);
516
+ const serializedContent = JSON.stringify(descriptors);
517
+ const cacheKey = `${options?.name ?? ""}:${serializedContent}`;
518
+ const existingName = contentToName.get(cacheKey);
519
+ if (existingName) return existingName;
520
+ const name = options?.name ?? makeCounterStyleName(getNamePrefix(), String(clientCounterStyleCounter++));
521
+ contentToName.set(cacheKey, name);
522
+ getGlobalInjector().counterStyle(name, descriptors, { root: options?.root });
523
+ return name;
524
+ }
525
+ //#endregion
526
+ //#region src/hooks/useFunction.ts
527
+ function useFunction(name, definition, options) {
528
+ if (!name) {
529
+ if (process.env.NODE_ENV !== "production") console.warn(`[Tasty] useFunction: function name is required`);
530
+ return;
531
+ }
532
+ if (isFunctionsPolyfillEnabled()) {
533
+ registerFunctionPolyfill(name, definition);
534
+ return;
535
+ }
536
+ const target = getStyleTarget();
537
+ if (target.mode === "ssr") {
538
+ target.collector.collectInternals();
539
+ const css = formatFunctionRule(name, definition);
540
+ if (css) target.collector.collectFunction(parseFunctionName(name), css);
541
+ return;
542
+ }
543
+ if (target.mode === "rsc") {
544
+ const css = formatFunctionRule(name, definition);
545
+ if (css) pushRSCCSS(target.cache, `__func:${parseFunctionName(name)}`, css);
546
+ return;
547
+ }
548
+ getGlobalInjector().func(name, definition, { root: options?.root });
549
+ }
550
+ //#endregion
551
+ //#region src/batch-provider.tsx
552
+ function TastyBatchProvider({ children }) {
553
+ openBatchWindow();
554
+ useInsertionEffect(() => {
555
+ closeBatchWindow();
556
+ });
557
+ return children;
558
+ }
559
+ //#endregion
560
+ 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 };
561
+
562
+ //# sourceMappingURL=react-runtime-BpxlOTbO.js.map