@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
@@ -1,45 +0,0 @@
1
- //#region src/utils/filter-base-props.ts
2
- const DOMPropNames = new Set(["id"]);
3
- const BasePropNames = new Set([
4
- "role",
5
- "as",
6
- "element",
7
- "css",
8
- "qa",
9
- "mods",
10
- "qaVal",
11
- "hidden",
12
- "isHidden",
13
- "disabled",
14
- "isDisabled",
15
- "children",
16
- "style",
17
- "className",
18
- "href",
19
- "target",
20
- "tabIndex"
21
- ]);
22
- const ignoreEventPropsNames = new Set([
23
- "onPress",
24
- "onHoverStart",
25
- "onHoverEnd",
26
- "onPressStart",
27
- "onPressEnd"
28
- ]);
29
- const propRe = /^((data-).*)$/;
30
- const eventRe = /^on[A-Z].+$/;
31
- /**
32
- * Filters out all props that aren't valid DOM props or defined via override prop obj.
33
- * @param props - The component props to be filtered.
34
- * @param opts - Props to override.
35
- */
36
- function filterBaseProps(props, opts = {}) {
37
- const { propNames, eventProps } = opts;
38
- const filteredProps = {};
39
- for (const prop in props) if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || BasePropNames.has(prop) || prop.startsWith("aria-") || eventProps && eventRe.test(prop) && !ignoreEventPropsNames.has(prop) || propNames?.has(prop) || propRe.test(prop))) filteredProps[prop] = props[prop];
40
- return filteredProps;
41
- }
42
- //#endregion
43
- export { filterBaseProps };
44
-
45
- //# sourceMappingURL=filter-base-props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter-base-props.js","names":[],"sources":["../../src/utils/filter-base-props.ts"],"sourcesContent":["const DOMPropNames = new Set(['id']);\n\nconst BasePropNames = new Set([\n 'role',\n 'as',\n 'element',\n 'css',\n 'qa',\n 'mods',\n 'qaVal',\n 'hidden',\n 'isHidden',\n 'disabled',\n 'isDisabled',\n 'children',\n 'style',\n 'className',\n 'href',\n 'target',\n 'tabIndex',\n]);\n\nconst ignoreEventPropsNames = new Set([\n 'onPress',\n 'onHoverStart',\n 'onHoverEnd',\n 'onPressStart',\n 'onPressEnd',\n]);\n\nconst propRe = /^((data-).*)$/;\nconst eventRe = /^on[A-Z].+$/;\n\ninterface PropsFilterOptions {\n // @deprecated\n labelable?: boolean;\n propNames?: Set<string>;\n eventProps?: boolean;\n}\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterBaseProps<T extends object>(\n props: T,\n opts: PropsFilterOptions = {},\n): Partial<T> {\n const { propNames, eventProps } = opts;\n const filteredProps: Partial<T> = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) &&\n (DOMPropNames.has(prop) ||\n BasePropNames.has(prop) ||\n // Always preserve any ARIA attributes to maintain accessibility support.\n prop.startsWith('aria-') ||\n (eventProps &&\n eventRe.test(prop) &&\n !ignoreEventPropsNames.has(prop)) ||\n propNames?.has(prop) ||\n propRe.test(prop))\n ) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n"],"mappings":";AAAA,MAAM,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC;AAEpC,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,SAAS;AACf,MAAM,UAAU;;;;;;AAchB,SAAgB,gBACd,OACA,OAA2B,EAAE,EACjB;CACZ,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,gBAA4B,EAAE;AAEpC,MAAK,MAAM,QAAQ,MACjB,KACE,OAAO,UAAU,eAAe,KAAK,OAAO,KAAK,KAChD,aAAa,IAAI,KAAK,IACrB,cAAc,IAAI,KAAK,IAEvB,KAAK,WAAW,QAAQ,IACvB,cACC,QAAQ,KAAK,KAAK,IAClB,CAAC,sBAAsB,IAAI,KAAK,IAClC,WAAW,IAAI,KAAK,IACpB,OAAO,KAAK,KAAK,EAEnB,eAAc,QAAQ,MAAM;AAIhC,QAAO"}
@@ -1,7 +0,0 @@
1
- import { ElementType } from "react";
2
-
3
- //#region src/utils/get-display-name.d.ts
4
- declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
5
- //#endregion
6
- export { getDisplayName };
7
- //# sourceMappingURL=get-display-name.d.ts.map
@@ -1,10 +0,0 @@
1
- //#region src/utils/get-display-name.ts
2
- const DEFAULT_NAME = "Anonymous";
3
- function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
4
- if (typeof Component === "function") return Component.displayName ?? Component.name ?? fallbackName;
5
- return fallbackName;
6
- }
7
- //#endregion
8
- export { getDisplayName };
9
-
10
- //# sourceMappingURL=get-display-name.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-display-name.js","names":[],"sources":["../../src/utils/get-display-name.ts"],"sourcesContent":["import type { ElementType } from 'react';\n\nconst DEFAULT_NAME = 'Anonymous';\n\nexport function getDisplayName<T>(\n Component: ElementType<T>,\n fallbackName = DEFAULT_NAME,\n): string {\n if (typeof Component === 'function') {\n return Component.displayName ?? Component.name ?? fallbackName;\n }\n\n return fallbackName;\n}\n"],"mappings":";AAEA,MAAM,eAAe;AAErB,SAAgB,eACd,WACA,eAAe,cACP;AACR,KAAI,OAAO,cAAc,WACvB,QAAO,UAAU,eAAe,UAAU,QAAQ;AAGpD,QAAO"}
@@ -1,13 +0,0 @@
1
- //#region src/utils/has-keys.ts
2
- /**
3
- * Check if an object has any own enumerable keys.
4
- * Avoids the array allocation of Object.keys(obj).length > 0.
5
- */
6
- function hasKeys(obj) {
7
- for (const _ in obj) return true;
8
- return false;
9
- }
10
- //#endregion
11
- export { hasKeys };
12
-
13
- //# sourceMappingURL=has-keys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has-keys.js","names":[],"sources":["../../src/utils/has-keys.ts"],"sourcesContent":["/**\n * Check if an object has any own enumerable keys.\n * Avoids the array allocation of Object.keys(obj).length > 0.\n */\nexport function hasKeys(obj: object): boolean {\n for (const _ in obj) return true;\n return false;\n}\n"],"mappings":";;;;;AAIA,SAAgB,QAAQ,KAAsB;AAC5C,MAAK,MAAM,KAAK,IAAK,QAAO;AAC5B,QAAO"}
@@ -1,14 +0,0 @@
1
- //#region src/utils/hash.ts
2
- /**
3
- * Fast string hash (djb2) for deduplication keys.
4
- * Not cryptographic — just collision-resistant enough for cache keys.
5
- */
6
- function hashString(str) {
7
- let hash = 5381;
8
- for (let i = 0; i < str.length; i++) hash = (hash << 5) + hash + str.charCodeAt(i) | 0;
9
- return (hash >>> 0).toString(36);
10
- }
11
- //#endregion
12
- export { hashString };
13
-
14
- //# sourceMappingURL=hash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.js","names":[],"sources":["../../src/utils/hash.ts"],"sourcesContent":["/**\n * Fast string hash (djb2) for deduplication keys.\n * Not cryptographic — just collision-resistant enough for cache keys.\n */\nexport function hashString(str: string): string {\n let hash = 5381;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) + hash + str.charCodeAt(i)) | 0;\n }\n return (hash >>> 0).toString(36);\n}\n"],"mappings":";;;;;AAIA,SAAgB,WAAW,KAAqB;CAC9C,IAAI,OAAO;AACX,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,IAC9B,SAAS,QAAQ,KAAK,OAAO,IAAI,WAAW,EAAE,GAAI;AAEpD,SAAQ,SAAS,GAAG,SAAS,GAAG"}
@@ -1,19 +0,0 @@
1
- //#region src/utils/is-dev-env.ts
2
- /**
3
- * Check if we're in a development environment at runtime
4
- * Uses bracket notation to avoid bundler compilation
5
- * Also checks for TASTY_DEBUG localStorage setting
6
- */
7
- function isDevEnv() {
8
- if (typeof window !== "undefined" && window.localStorage) try {
9
- const forceTastyDebug = window.localStorage.getItem("TASTY_DEBUG");
10
- if (forceTastyDebug !== null && forceTastyDebug.toLowerCase() === "true") return true;
11
- } catch {}
12
- if (typeof process === "undefined") return false;
13
- const nodeEnv = "development";
14
- return nodeEnv !== "test" && nodeEnv !== "production";
15
- }
16
- //#endregion
17
- export { isDevEnv };
18
-
19
- //# sourceMappingURL=is-dev-env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-dev-env.js","names":[],"sources":["../../src/utils/is-dev-env.ts"],"sourcesContent":["/**\n * Check if we're in a development environment at runtime\n * Uses bracket notation to avoid bundler compilation\n * Also checks for TASTY_DEBUG localStorage setting\n */\nexport function isDevEnv(): boolean {\n // Check localStorage for DEBUG_TASTY setting (browser environment)\n if (typeof window !== 'undefined' && window.localStorage) {\n try {\n const forceTastyDebug = window.localStorage.getItem('TASTY_DEBUG');\n if (\n forceTastyDebug !== null &&\n forceTastyDebug.toLowerCase() === 'true'\n ) {\n return true;\n }\n } catch {\n // localStorage might not be available (private browsing, etc.)\n // Continue with other checks\n }\n }\n\n // Check NODE_ENV for Node.js environments\n if (typeof process === 'undefined') return false;\n\n // Use bracket notation to avoid bundler replacement\n const nodeEnv = process.env?.['NODE_ENV'];\n return nodeEnv !== 'test' && nodeEnv !== 'production';\n}\n"],"mappings":";;;;;;AAKA,SAAgB,WAAoB;AAElC,KAAI,OAAO,WAAW,eAAe,OAAO,aAC1C,KAAI;EACF,MAAM,kBAAkB,OAAO,aAAa,QAAQ,cAAc;AAClE,MACE,oBAAoB,QACpB,gBAAgB,aAAa,KAAK,OAElC,QAAO;SAEH;AAOV,KAAI,OAAO,YAAY,YAAa,QAAO;CAG3C,MAAM,UAAA;AACN,QAAO,YAAY,UAAU,YAAY"}
@@ -1,15 +0,0 @@
1
- //#region src/utils/is-valid-element-type.ts
2
- /**
3
- * Lightweight replacement for `react-is`'s isValidElementType.
4
- * Detects string tags, function/class components, and React exotic types
5
- * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.
6
- */
7
- function isValidElementType(value) {
8
- if (typeof value === "string" || typeof value === "function") return true;
9
- if (typeof value === "object" && value !== null) return typeof value.$$typeof === "symbol";
10
- return false;
11
- }
12
- //#endregion
13
- export { isValidElementType };
14
-
15
- //# sourceMappingURL=is-valid-element-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-valid-element-type.js","names":[],"sources":["../../src/utils/is-valid-element-type.ts"],"sourcesContent":["/**\n * Lightweight replacement for `react-is`'s isValidElementType.\n * Detects string tags, function/class components, and React exotic types\n * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.\n */\nexport function isValidElementType(value: unknown): boolean {\n if (typeof value === 'string' || typeof value === 'function') {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n return typeof (value as { $$typeof?: unknown }).$$typeof === 'symbol';\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,mBAAmB,OAAyB;AAC1D,KAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAChD,QAAO;AAGT,KAAI,OAAO,UAAU,YAAY,UAAU,KACzC,QAAO,OAAQ,MAAiC,aAAa;AAG/D,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-styles.js","names":[],"sources":["../../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- import { ModValue } from "../types.js";
2
- //#region src/utils/mod-attrs.d.ts
3
- declare const _modAttrs: (firstArg: Record<string, ModValue> | undefined, secondArg?: unknown) => Record<string, string> | null;
4
- //#endregion
5
- export { _modAttrs };
6
- //# sourceMappingURL=mod-attrs.d.ts.map
@@ -1,20 +0,0 @@
1
- import { camelToKebab } from "./case-converter.js";
2
- import { cacheWrapper } from "./cache-wrapper.js";
3
- //#region src/utils/mod-attrs.ts
4
- function modAttrs(map) {
5
- return map ? Object.keys(map).reduce((attrs, key) => {
6
- const value = map[key];
7
- if (value == null || value === false) return attrs;
8
- const attrName = `data-${camelToKebab(key)}`;
9
- if (value === true) attrs[attrName] = "";
10
- else if (typeof value === "string") attrs[attrName] = value;
11
- else if (typeof value === "number") attrs[attrName] = String(value);
12
- else console.warn(`Tasty: Invalid mod value for "${key}". Expected boolean, string, or number, got ${typeof value}`);
13
- return attrs;
14
- }, {}) : null;
15
- }
16
- const _modAttrs = cacheWrapper(modAttrs);
17
- //#endregion
18
- export { _modAttrs };
19
-
20
- //# sourceMappingURL=mod-attrs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod-attrs.js","names":[],"sources":["../../src/utils/mod-attrs.ts"],"sourcesContent":["/**\n * Generate data DOM attributes from modifier map.\n */\nimport type { AllBaseProps } from '../types';\n\nimport { cacheWrapper } from './cache-wrapper';\nimport { camelToKebab } from './case-converter';\n\nfunction modAttrs(map: AllBaseProps['mods']): Record<string, string> | null {\n return map\n ? Object.keys(map).reduce(\n (attrs, key) => {\n const value = map[key];\n\n // Skip null, undefined, false\n if (value == null || value === false) {\n return attrs;\n }\n\n const attrName = `data-${camelToKebab(key)}`;\n\n if (value === true) {\n // Boolean true: data-{name}=\"\"\n attrs[attrName] = '';\n } else if (typeof value === 'string') {\n // String value: data-{name}=\"value\"\n attrs[attrName] = value;\n } else if (typeof value === 'number') {\n // Number: convert to string\n attrs[attrName] = String(value);\n } else {\n // Reject other types (objects, arrays, functions)\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Tasty: Invalid mod value for \"${key}\". Expected boolean, string, or number, got ${typeof value}`,\n );\n }\n }\n\n return attrs;\n },\n {} as Record<string, string>,\n )\n : null;\n}\n\nconst _modAttrs = cacheWrapper(modAttrs);\n\nexport { _modAttrs as modAttrs };\n"],"mappings":";;;AAQA,SAAS,SAAS,KAA0D;AAC1E,QAAO,MACH,OAAO,KAAK,IAAI,CAAC,QACd,OAAO,QAAQ;EACd,MAAM,QAAQ,IAAI;AAGlB,MAAI,SAAS,QAAQ,UAAU,MAC7B,QAAO;EAGT,MAAM,WAAW,QAAQ,aAAa,IAAI;AAE1C,MAAI,UAAU,KAEZ,OAAM,YAAY;WACT,OAAO,UAAU,SAE1B,OAAM,YAAY;WACT,OAAO,UAAU,SAE1B,OAAM,YAAY,OAAO,MAAM;MAI7B,SAAQ,KACN,iCAAiC,IAAI,8CAA8C,OAAO,QAC3F;AAIL,SAAO;IAET,EAAE,CACH,GACD;;AAGN,MAAM,YAAY,aAAa,SAAS"}
@@ -1,17 +0,0 @@
1
- import { CSSProperties } from "./css-types.js";
2
- import { hslToRgbValues } from "./color-math.js";
3
- import { Tokens } from "../types.js";
4
-
5
- //#region src/utils/process-tokens.d.ts
6
- /**
7
- * Process tokens object into inline style properties.
8
- * - $name -> --name with parsed value
9
- * - #name -> --name-color AND --name-color-{colorSpace} with parsed values
10
- *
11
- * @param tokens - The tokens object to process
12
- * @returns CSSProperties object or undefined if no tokens to process
13
- */
14
- declare function processTokens(tokens: Tokens | undefined): CSSProperties | undefined;
15
- //#endregion
16
- export { processTokens };
17
- //# sourceMappingURL=process-tokens.d.ts.map
@@ -1,83 +0,0 @@
1
- import "./color-math.js";
2
- import { getColorSpaceComponents, getColorSpaceSuffix } from "./color-space.js";
3
- import { normalizeColorTokenValue, parseStyle } from "./styles.js";
4
- //#region src/utils/process-tokens.ts
5
- /**
6
- * Extract color components in the configured color space.
7
- * Returns a CSS variable reference for token colors, or decomposed
8
- * components as a space-separated string.
9
- */
10
- function extractColorSpaceValue(colorValue, parsedOutput) {
11
- const suffix = getColorSpaceSuffix();
12
- const varMatch = parsedOutput.match(/var\(--([a-z0-9-]+)-color\)/);
13
- if (varMatch) return `var(--${varMatch[1]}-color-${suffix})`;
14
- const components = getColorSpaceComponents(colorValue);
15
- if (components !== colorValue) return components;
16
- const componentsFromParsed = getColorSpaceComponents(parsedOutput);
17
- if (componentsFromParsed !== parsedOutput) return componentsFromParsed;
18
- return parsedOutput;
19
- }
20
- /**
21
- * Check if a value is a valid token value (string, number, or boolean - not object).
22
- * Returns false for `false` values (they mean "skip this token").
23
- */
24
- function isValidTokenValue(value) {
25
- if (value === void 0 || value === null || value === false) return false;
26
- if (typeof value === "object") {
27
- console.warn("Tasty: Object values are not allowed in tokens prop. Tokens do not support state-based styling. Use a primitive value instead.");
28
- return false;
29
- }
30
- return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
31
- }
32
- /**
33
- * Process a single token value through the tasty parser.
34
- * Numbers are converted to strings; 0 stays as "0".
35
- */
36
- function processTokenValue(value) {
37
- if (typeof value === "number") {
38
- if (value === 0) return "0";
39
- return parseStyle(String(value)).output;
40
- }
41
- return parseStyle(value).output;
42
- }
43
- /**
44
- * Process tokens object into inline style properties.
45
- * - $name -> --name with parsed value
46
- * - #name -> --name-color AND --name-color-{colorSpace} with parsed values
47
- *
48
- * @param tokens - The tokens object to process
49
- * @returns CSSProperties object or undefined if no tokens to process
50
- */
51
- function processTokens(tokens) {
52
- if (!tokens) return;
53
- const keys = Object.keys(tokens);
54
- if (keys.length === 0) return;
55
- let result;
56
- for (const key of keys) {
57
- const value = tokens[key];
58
- if (!isValidTokenValue(value)) continue;
59
- if (key.startsWith("$")) {
60
- const propName = `--${key.slice(1)}`;
61
- const processedValue = processTokenValue(value === true ? "" : value);
62
- if (!result) result = {};
63
- result[propName] = processedValue;
64
- } else if (key.startsWith("#")) {
65
- const colorName = key.slice(1);
66
- const suffix = getColorSpaceSuffix();
67
- const effectiveValue = normalizeColorTokenValue(value);
68
- if (effectiveValue === null) continue;
69
- const originalValue = typeof effectiveValue === "number" ? String(effectiveValue) : effectiveValue;
70
- const lowerValue = originalValue.toLowerCase();
71
- const processedValue = processTokenValue(effectiveValue);
72
- if (!result) result = {};
73
- result[`--${colorName}-color`] = processedValue;
74
- if (/^#current(?:\.|$)/i.test(lowerValue)) continue;
75
- result[`--${colorName}-color-${suffix}`] = extractColorSpaceValue(originalValue, processedValue);
76
- }
77
- }
78
- return result;
79
- }
80
- //#endregion
81
- export { processTokens };
82
-
83
- //# sourceMappingURL=process-tokens.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-tokens.js","names":[],"sources":["../../src/utils/process-tokens.ts"],"sourcesContent":["import type { Tokens, TokenValue } from '../types';\n\nimport type { CSSProperties } from './css-types';\n\nimport { getColorSpaceComponents, getColorSpaceSuffix } from './color-space';\nimport { normalizeColorTokenValue, parseStyle } from './styles';\n\nexport { hslToRgbValues } from './color-math';\n\nconst devMode = process.env.NODE_ENV !== 'production';\n\n/**\n * Extract color components in the configured color space.\n * Returns a CSS variable reference for token colors, or decomposed\n * components as a space-separated string.\n */\nfunction extractColorSpaceValue(\n colorValue: string,\n parsedOutput: string,\n): string {\n const suffix = getColorSpaceSuffix();\n\n // If the parsed output references a color variable, use the companion variant\n const varMatch = parsedOutput.match(/var\\(--([a-z0-9-]+)-color\\)/);\n if (varMatch) {\n return `var(--${varMatch[1]}-color-${suffix})`;\n }\n\n // Try the original color value first, then parsed output\n const components = getColorSpaceComponents(colorValue);\n if (components !== colorValue) return components;\n\n const componentsFromParsed = getColorSpaceComponents(parsedOutput);\n if (componentsFromParsed !== parsedOutput) return componentsFromParsed;\n\n // Fallback: return the parsed output\n return parsedOutput;\n}\n\n/**\n * Check if a value is a valid token value (string, number, or boolean - not object).\n * Returns false for `false` values (they mean \"skip this token\").\n */\nfunction isValidTokenValue(\n value: unknown,\n): value is Exclude<TokenValue, undefined | null | false> {\n if (value === undefined || value === null || value === false) {\n return false;\n }\n\n if (typeof value === 'object') {\n if (devMode) {\n console.warn(\n 'Tasty: Object values are not allowed in tokens prop. ' +\n 'Tokens do not support state-based styling. Use a primitive value instead.',\n );\n }\n return false;\n }\n\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n}\n\n/**\n * Process a single token value through the tasty parser.\n * Numbers are converted to strings; 0 stays as \"0\".\n */\nfunction processTokenValue(value: string | number): string {\n if (typeof value === 'number') {\n // 0 should remain as \"0\", not converted to any unit\n if (value === 0) {\n return '0';\n }\n return parseStyle(String(value)).output;\n }\n return parseStyle(value).output;\n}\n\n/**\n * Process tokens object into inline style properties.\n * - $name -> --name with parsed value\n * - #name -> --name-color AND --name-color-{colorSpace} with parsed values\n *\n * @param tokens - The tokens object to process\n * @returns CSSProperties object or undefined if no tokens to process\n */\nexport function processTokens(\n tokens: Tokens | undefined,\n): CSSProperties | undefined {\n if (!tokens) {\n return undefined;\n }\n\n const keys = Object.keys(tokens);\n if (keys.length === 0) {\n return undefined;\n }\n\n let result: Record<string, string> | undefined;\n\n for (const key of keys) {\n const value = tokens[key as keyof Tokens];\n\n // Skip undefined/null values\n if (!isValidTokenValue(value)) {\n continue;\n }\n\n if (key.startsWith('$')) {\n // Custom property token: $name -> --name\n const propName = `--${key.slice(1)}`;\n // Boolean true for custom properties converts to empty string (valid CSS value)\n const effectiveValue = value === true ? '' : value;\n const processedValue = processTokenValue(effectiveValue);\n\n if (!result) result = {};\n result[propName] = processedValue;\n } else if (key.startsWith('#')) {\n const colorName = key.slice(1);\n const suffix = getColorSpaceSuffix();\n\n // Normalize color token value (true → 'transparent', false is already filtered by isValidTokenValue)\n const effectiveValue = normalizeColorTokenValue(value);\n // Skip if normalized to null (shouldn't happen since false is filtered by isValidTokenValue)\n if (effectiveValue === null) continue;\n\n const originalValue =\n typeof effectiveValue === 'number'\n ? String(effectiveValue)\n : effectiveValue;\n const lowerValue = originalValue.toLowerCase();\n const processedValue = processTokenValue(effectiveValue);\n\n if (!result) result = {};\n result[`--${colorName}-color`] = processedValue;\n\n // Skip component generation for #current values (currentcolor is dynamic, cannot decompose)\n if (/^#current(?:\\.|$)/i.test(lowerValue)) {\n continue;\n }\n\n result[`--${colorName}-color-${suffix}`] = extractColorSpaceValue(\n originalValue,\n processedValue,\n );\n }\n }\n\n return result as CSSProperties | undefined;\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAS,uBACP,YACA,cACQ;CACR,MAAM,SAAS,qBAAqB;CAGpC,MAAM,WAAW,aAAa,MAAM,8BAA8B;AAClE,KAAI,SACF,QAAO,SAAS,SAAS,GAAG,SAAS,OAAO;CAI9C,MAAM,aAAa,wBAAwB,WAAW;AACtD,KAAI,eAAe,WAAY,QAAO;CAEtC,MAAM,uBAAuB,wBAAwB,aAAa;AAClE,KAAI,yBAAyB,aAAc,QAAO;AAGlD,QAAO;;;;;;AAOT,SAAS,kBACP,OACwD;AACxD,KAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,MACrD,QAAO;AAGT,KAAI,OAAO,UAAU,UAAU;AAE3B,UAAQ,KACN,iIAED;AAEH,SAAO;;AAGT,QACE,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU;;;;;;AAQrB,SAAS,kBAAkB,OAAgC;AACzD,KAAI,OAAO,UAAU,UAAU;AAE7B,MAAI,UAAU,EACZ,QAAO;AAET,SAAO,WAAW,OAAO,MAAM,CAAC,CAAC;;AAEnC,QAAO,WAAW,MAAM,CAAC;;;;;;;;;;AAW3B,SAAgB,cACd,QAC2B;AAC3B,KAAI,CAAC,OACH;CAGF,MAAM,OAAO,OAAO,KAAK,OAAO;AAChC,KAAI,KAAK,WAAW,EAClB;CAGF,IAAI;AAEJ,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,QAAQ,OAAO;AAGrB,MAAI,CAAC,kBAAkB,MAAM,CAC3B;AAGF,MAAI,IAAI,WAAW,IAAI,EAAE;GAEvB,MAAM,WAAW,KAAK,IAAI,MAAM,EAAE;GAGlC,MAAM,iBAAiB,kBADA,UAAU,OAAO,KAAK,MACW;AAExD,OAAI,CAAC,OAAQ,UAAS,EAAE;AACxB,UAAO,YAAY;aACV,IAAI,WAAW,IAAI,EAAE;GAC9B,MAAM,YAAY,IAAI,MAAM,EAAE;GAC9B,MAAM,SAAS,qBAAqB;GAGpC,MAAM,iBAAiB,yBAAyB,MAAM;AAEtD,OAAI,mBAAmB,KAAM;GAE7B,MAAM,gBACJ,OAAO,mBAAmB,WACtB,OAAO,eAAe,GACtB;GACN,MAAM,aAAa,cAAc,aAAa;GAC9C,MAAM,iBAAiB,kBAAkB,eAAe;AAExD,OAAI,CAAC,OAAQ,UAAS,EAAE;AACxB,UAAO,KAAK,UAAU,WAAW;AAGjC,OAAI,qBAAqB,KAAK,WAAW,CACvC;AAGF,UAAO,KAAK,UAAU,SAAS,YAAY,uBACzC,eACA,eACD;;;AAIL,QAAO"}
@@ -1,17 +0,0 @@
1
- import { Styles } from "../styles/types.js";
2
-
3
- //#region src/utils/resolve-recipes.d.ts
4
- /**
5
- * Resolve all `recipe` style properties in a styles object.
6
- *
7
- * Handles both top-level and sub-element recipe references.
8
- * Returns the same object reference if no recipes are present anywhere
9
- * (zero overhead for the common case).
10
- *
11
- * @param styles - The styles object potentially containing `recipe` keys
12
- * @returns Resolved styles with recipe values merged in, or the original object if unchanged
13
- */
14
- declare function resolveRecipes(styles: Styles): Styles;
15
- //#endregion
16
- export { resolveRecipes };
17
- //# sourceMappingURL=resolve-recipes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-recipes.js","names":[],"sources":["../../src/utils/resolve-recipes.ts"],"sourcesContent":["/**\n * Recipe resolution utility.\n *\n * Resolves `recipe` style properties by looking up predefined recipe styles\n * from global configuration and merging them with the component's own styles.\n *\n * Resolution order per level (top-level and each sub-element independently):\n * base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2\n *\n * The `/` separator splits base recipes (before component styles)\n * from post recipes (after component styles). All merges use mergeStyles\n * semantics: primitives and state maps with '' key fully replace;\n * state maps without '' key extend the existing value.\n *\n * Returns the same object reference if no recipes are present (zero overhead).\n */\n\nimport { getGlobalRecipes } from '../config';\nimport { isSelector } from '../pipeline';\nimport type { RecipeStyles, Styles } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { mergeStyles } from './merge-styles';\n\nconst devMode = isDevEnv();\n\ninterface ParsedRecipeGroups {\n base: string[] | null;\n post: string[] | null;\n}\n\n/**\n * Parse a recipe string into base and post recipe name groups.\n *\n * Syntax: `'base1 base2 / post1 post2'`\n * - Names are space-separated within each group\n * - `/` separates base (before component) from post (after component) groups\n * - `/` is optional; if absent, all names are base\n * - `none` as the sole base value means \"no base recipes\"\n *\n * Returns `{ base: null, post: null }` if the string is empty or invalid.\n */\nfunction parseRecipeNames(value: unknown): ParsedRecipeGroups {\n const empty: ParsedRecipeGroups = { base: null, post: null };\n\n if (typeof value !== 'string') return empty;\n const trimmed = value.trim();\n if (trimmed === '') return empty;\n\n const slashIndex = trimmed.indexOf('/');\n\n if (slashIndex === -1) {\n if (trimmed === 'none') return empty;\n const names = splitNames(trimmed);\n return { base: names, post: null };\n }\n\n const basePart = trimmed.slice(0, slashIndex);\n const postPart = trimmed.slice(slashIndex + 1);\n\n return {\n base: basePart.trim() === 'none' ? null : splitNames(basePart),\n post: splitNames(postPart),\n };\n}\n\nfunction splitNames(s: string): string[] | null {\n const names = s.split(/\\s+/).filter(Boolean);\n return names.length > 0 ? names : null;\n}\n\n/**\n * Collect merged styles for a list of recipe names.\n * Each recipe is flat-spread on top of the previous.\n */\nfunction collectRecipeStyles(\n names: string[],\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> {\n let merged: Record<string, unknown> = {};\n\n for (const name of names) {\n const recipeStyles = recipes[name];\n\n if (!recipeStyles) {\n if (devMode) {\n console.warn(\n `[Tasty] Recipe \"${name}\" not found. ` +\n `Make sure it is defined in configure({ recipes: { ... } }).`,\n );\n }\n continue;\n }\n\n merged = { ...merged, ...(recipeStyles as Record<string, unknown>) };\n }\n\n return merged;\n}\n\n/**\n * Resolve recipe references in a flat styles object (no sub-elements).\n * Returns null if no `recipe` key is present.\n *\n * Resolution: base recipes → component styles → post recipes (all via mergeStyles)\n */\nfunction resolveRecipesForLevel(\n styles: Record<string, unknown>,\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> | null {\n if (!('recipe' in styles)) return null;\n\n const { base, post } = parseRecipeNames(styles.recipe);\n\n // Separate selector keys (sub-elements) from flat style properties.\n // mergeStyles handles selectors with its own semantics (e.g. false = delete),\n // but at this level we only want recipe merging on flat properties.\n\n const { recipe: _recipe, ...allRest } = styles;\n const flatStyles: Record<string, unknown> = {};\n const selectorStyles: Record<string, unknown> = {};\n\n for (const key of Object.keys(allRest)) {\n if (isSelector(key)) {\n selectorStyles[key] = allRest[key];\n } else {\n flatStyles[key] = allRest[key];\n }\n }\n\n if (!base && !post) {\n return allRest;\n }\n\n // 1. Merge base recipes, then component styles on top (via mergeStyles)\n let result: Record<string, unknown>;\n\n if (base) {\n const baseStyles = collectRecipeStyles(base, recipes);\n result = mergeStyles(baseStyles as Styles, flatStyles as Styles) as Record<\n string,\n unknown\n >;\n } else {\n result = { ...flatStyles };\n }\n\n // 2. Apply post recipes via mergeStyles (state map extend semantics)\n if (post) {\n const postStyles = collectRecipeStyles(post, recipes);\n result = mergeStyles(result as Styles, postStyles as Styles) as Record<\n string,\n unknown\n >;\n }\n\n // Re-attach selector keys unchanged\n for (const key of Object.keys(selectorStyles)) {\n result[key] = selectorStyles[key];\n }\n\n return result;\n}\n\n/**\n * Resolve all `recipe` style properties in a styles object.\n *\n * Handles both top-level and sub-element recipe references.\n * Returns the same object reference if no recipes are present anywhere\n * (zero overhead for the common case).\n *\n * @param styles - The styles object potentially containing `recipe` keys\n * @returns Resolved styles with recipe values merged in, or the original object if unchanged\n */\nexport function resolveRecipes(styles: Styles): Styles {\n const recipes = getGlobalRecipes();\n\n // Fast path: no recipes configured globally\n if (!recipes) return styles;\n\n let changed = false;\n\n // Resolve top-level recipe\n const topResolved = resolveRecipesForLevel(\n styles as Record<string, unknown>,\n recipes,\n );\n\n let result: Record<string, unknown>;\n\n if (topResolved) {\n changed = true;\n result = topResolved;\n } else {\n // Keep reference; a shallow copy is deferred until a sub-element actually changes\n result = styles as Record<string, unknown>;\n }\n\n // Resolve sub-element recipes\n const keys = Object.keys(result);\n\n for (const key of keys) {\n if (!isSelector(key)) continue;\n\n const subStyles = result[key];\n\n if (\n !subStyles ||\n typeof subStyles !== 'object' ||\n Array.isArray(subStyles)\n ) {\n continue;\n }\n\n const subRecord = subStyles as Record<string, unknown>;\n\n if (!('recipe' in subRecord)) continue;\n\n const subResolved = resolveRecipesForLevel(subRecord, recipes);\n\n if (subResolved) {\n if (!changed) {\n // First change in sub-elements -- need to shallow-copy the top level\n changed = true;\n result = { ...(styles as Record<string, unknown>) };\n }\n result[key] = subResolved;\n }\n }\n\n return changed ? (result as Styles) : styles;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,UAAU,UAAU;;;;;;;;;;;;AAkB1B,SAAS,iBAAiB,OAAoC;CAC5D,MAAM,QAA4B;EAAE,MAAM;EAAM,MAAM;EAAM;AAE5D,KAAI,OAAO,UAAU,SAAU,QAAO;CACtC,MAAM,UAAU,MAAM,MAAM;AAC5B,KAAI,YAAY,GAAI,QAAO;CAE3B,MAAM,aAAa,QAAQ,QAAQ,IAAI;AAEvC,KAAI,eAAe,IAAI;AACrB,MAAI,YAAY,OAAQ,QAAO;AAE/B,SAAO;GAAE,MADK,WAAW,QAAQ;GACX,MAAM;GAAM;;CAGpC,MAAM,WAAW,QAAQ,MAAM,GAAG,WAAW;CAC7C,MAAM,WAAW,QAAQ,MAAM,aAAa,EAAE;AAE9C,QAAO;EACL,MAAM,SAAS,MAAM,KAAK,SAAS,OAAO,WAAW,SAAS;EAC9D,MAAM,WAAW,SAAS;EAC3B;;AAGH,SAAS,WAAW,GAA4B;CAC9C,MAAM,QAAQ,EAAE,MAAM,MAAM,CAAC,OAAO,QAAQ;AAC5C,QAAO,MAAM,SAAS,IAAI,QAAQ;;;;;;AAOpC,SAAS,oBACP,OACA,SACyB;CACzB,IAAI,SAAkC,EAAE;AAExC,MAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,eAAe,QAAQ;AAE7B,MAAI,CAAC,cAAc;AACjB,OAAI,QACF,SAAQ,KACN,mBAAmB,KAAK,0EAEzB;AAEH;;AAGF,WAAS;GAAE,GAAG;GAAQ,GAAI;GAA0C;;AAGtE,QAAO;;;;;;;;AAST,SAAS,uBACP,QACA,SACgC;AAChC,KAAI,EAAE,YAAY,QAAS,QAAO;CAElC,MAAM,EAAE,MAAM,SAAS,iBAAiB,OAAO,OAAO;CAMtD,MAAM,EAAE,QAAQ,SAAS,GAAG,YAAY;CACxC,MAAM,aAAsC,EAAE;CAC9C,MAAM,iBAA0C,EAAE;AAElD,MAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,CACpC,KAAI,WAAW,IAAI,CACjB,gBAAe,OAAO,QAAQ;KAE9B,YAAW,OAAO,QAAQ;AAI9B,KAAI,CAAC,QAAQ,CAAC,KACZ,QAAO;CAIT,IAAI;AAEJ,KAAI,KAEF,UAAS,YADU,oBAAoB,MAAM,QAAQ,EACV,WAAqB;KAKhE,UAAS,EAAE,GAAG,YAAY;AAI5B,KAAI,MAAM;EACR,MAAM,aAAa,oBAAoB,MAAM,QAAQ;AACrD,WAAS,YAAY,QAAkB,WAAqB;;AAO9D,MAAK,MAAM,OAAO,OAAO,KAAK,eAAe,CAC3C,QAAO,OAAO,eAAe;AAG/B,QAAO;;;;;;;;;;;;AAaT,SAAgB,eAAe,QAAwB;CACrD,MAAM,UAAU,kBAAkB;AAGlC,KAAI,CAAC,QAAS,QAAO;CAErB,IAAI,UAAU;CAGd,MAAM,cAAc,uBAClB,QACA,QACD;CAED,IAAI;AAEJ,KAAI,aAAa;AACf,YAAU;AACV,WAAS;OAGT,UAAS;CAIX,MAAM,OAAO,OAAO,KAAK,OAAO;AAEhC,MAAK,MAAM,OAAO,MAAM;AACtB,MAAI,CAAC,WAAW,IAAI,CAAE;EAEtB,MAAM,YAAY,OAAO;AAEzB,MACE,CAAC,aACD,OAAO,cAAc,YACrB,MAAM,QAAQ,UAAU,CAExB;EAGF,MAAM,YAAY;AAElB,MAAI,EAAE,YAAY,WAAY;EAE9B,MAAM,cAAc,uBAAuB,WAAW,QAAQ;AAE9D,MAAI,aAAa;AACf,OAAI,CAAC,SAAS;AAEZ,cAAU;AACV,aAAS,EAAE,GAAI,QAAoC;;AAErD,UAAO,OAAO;;;AAIlB,QAAO,UAAW,SAAoB"}
@@ -1,32 +0,0 @@
1
- //#region src/utils/selector-transform.ts
2
- /**
3
- * Shared utility for transforming capitalized PascalCase element names
4
- * in CSS selector content to `[data-element="..."]` attribute selectors.
5
- *
6
- * Lowercase words are treated as HTML tags and left unchanged.
7
- */
8
- /**
9
- * Matches a capitalized PascalCase word at the start of the string
10
- * or after a CSS combinator/separator character.
11
- */
12
- const ELEMENT_NAME_RE = /(^|[\s>+~,(])([A-Z][a-zA-Z0-9]*)/g;
13
- /**
14
- * Replace capitalized PascalCase words with `[data-element="Name"]` selectors.
15
- *
16
- * @example
17
- * transformSelectorContent('> Field + input:checked')
18
- * // → '> [data-element="Field"] + input:checked'
19
- *
20
- * transformSelectorContent('Body > Row')
21
- * // → '[data-element="Body"] > [data-element="Row"]'
22
- *
23
- * transformSelectorContent('button')
24
- * // → 'button' (lowercase = HTML tag, unchanged)
25
- */
26
- function transformSelectorContent(content) {
27
- return content.replace(ELEMENT_NAME_RE, (_, prefix, name) => `${prefix}[data-element="${name}"]`);
28
- }
29
- //#endregion
30
- export { transformSelectorContent };
31
-
32
- //# sourceMappingURL=selector-transform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selector-transform.js","names":[],"sources":["../../src/utils/selector-transform.ts"],"sourcesContent":["/**\n * Shared utility for transforming capitalized PascalCase element names\n * in CSS selector content to `[data-element=\"...\"]` attribute selectors.\n *\n * Lowercase words are treated as HTML tags and left unchanged.\n */\n\n/**\n * Matches a capitalized PascalCase word at the start of the string\n * or after a CSS combinator/separator character.\n */\nconst ELEMENT_NAME_RE = /(^|[\\s>+~,(])([A-Z][a-zA-Z0-9]*)/g;\n\n/**\n * Replace capitalized PascalCase words with `[data-element=\"Name\"]` selectors.\n *\n * @example\n * transformSelectorContent('> Field + input:checked')\n * // → '> [data-element=\"Field\"] + input:checked'\n *\n * transformSelectorContent('Body > Row')\n * // → '[data-element=\"Body\"] > [data-element=\"Row\"]'\n *\n * transformSelectorContent('button')\n * // → 'button' (lowercase = HTML tag, unchanged)\n */\nexport function transformSelectorContent(content: string): string {\n return content.replace(\n ELEMENT_NAME_RE,\n (_, prefix, name) => `${prefix}[data-element=\"${name}\"]`,\n );\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,kBAAkB;;;;;;;;;;;;;;AAexB,SAAgB,yBAAyB,SAAyB;AAChE,QAAO,QAAQ,QACb,kBACC,GAAG,QAAQ,SAAS,GAAG,OAAO,iBAAiB,KAAK,IACtD"}
@@ -1,8 +0,0 @@
1
- //#region src/utils/string.ts
2
- function toSnakeCase(str) {
3
- return str.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`);
4
- }
5
- //#endregion
6
- export { toSnakeCase };
7
-
8
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","names":[],"sources":["../../src/utils/string.ts"],"sourcesContent":["export function toSnakeCase(str: string): string {\n return str.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`);\n}\n"],"mappings":";AAAA,SAAgB,YAAY,KAAqB;AAC/C,QAAO,IAAI,QAAQ,WAAW,MAAM,IAAI,EAAE,aAAa,GAAG"}
@@ -1,99 +0,0 @@
1
- import { ProcessedStyle, StyleDetails } from "../parser/types.js";
2
- import { StyleParser } from "../parser/parser.js";
3
- import { getNamedColorHex, getRgbValuesFromRgbaString, hexToRgb, strToRgb } from "./color-math.js";
4
-
5
- //#region src/utils/styles.d.ts
6
- type StyleValue<T = string> = T | boolean | number | null | undefined;
7
- /**
8
- * Normalize a color token value.
9
- * - Boolean `true` is converted to `'transparent'`
10
- * - Boolean `false` returns `null` (signals the token should be skipped)
11
- * - Other values are returned as-is
12
- *
13
- * @param value - The raw token value
14
- * @returns Normalized value or null if the token should be skipped
15
- */
16
- declare function normalizeColorTokenValue<T>(value: T | boolean): T | 'transparent' | null;
17
- type StyleValueStateMap<T = string> = Record<string, StyleValue<T> | '@inherit'>;
18
- /**
19
- * Combined type for style values that can be either a direct value or a state map.
20
- * Use this for component props that accept style values.
21
- */
22
- type StylePropValue<T = string> = StyleValue<T> | StyleValueStateMap<T>;
23
- type CSSMap = {
24
- $?: string | string[];
25
- } & Record<string, string | string[]>;
26
- type StyleHandlerResult = CSSMap | CSSMap[] | null | void;
27
- type RawStyleHandler = (value: StyleValueStateMap) => StyleHandlerResult;
28
- type StyleHandler = RawStyleHandler & {
29
- __lookupStyles: string[];
30
- };
31
- /**
32
- * Handler definition forms for configure() and plugins.
33
- * - Function only: lookup styles inferred from key name
34
- * - Single property tuple: ['styleName', handler]
35
- * - Multi-property tuple: [['style1', 'style2'], handler]
36
- */
37
- type StyleHandlerDefinition = RawStyleHandler | [string, RawStyleHandler] | [string[], RawStyleHandler];
38
- interface ParsedColor {
39
- color?: string;
40
- name?: string;
41
- opacity?: number;
42
- }
43
- type StyleMap = Record<string, StyleValue | StyleValueStateMap>;
44
- declare const CUSTOM_UNITS: {
45
- r: string;
46
- cr: string;
47
- bw: string;
48
- ow: string;
49
- x: string;
50
- sf: (num: number) => string;
51
- };
52
- declare const DIRECTIONS: string[];
53
- declare function customFunc(name: string, fn: (groups: StyleDetails[]) => string): void;
54
- /**
55
- * Get the global StyleParser instance.
56
- * Used by configure() to apply parser configuration.
57
- */
58
- declare function getGlobalParser(): StyleParser;
59
- /**
60
- * Get the current custom functions registry.
61
- * Used by configure() to merge with new functions.
62
- */
63
- declare function getGlobalFuncs(): Record<string, (groups: StyleDetails[]) => string>;
64
- /**
65
- * Set global predefined tokens.
66
- * Called from configure() after processing token values.
67
- * Merges with existing tokens (new tokens override existing ones with same key).
68
- * Keys are normalized to lowercase (parser lowercases input before classification).
69
- * @internal
70
- */
71
- declare function setGlobalPredefinedTokens(tokens: Record<string, string>): void;
72
- /**
73
- * Get the current global predefined tokens.
74
- * Returns null if no tokens are configured.
75
- */
76
- declare function getGlobalPredefinedTokens(): Record<string, string> | null;
77
- /**
78
- * Reset global predefined tokens.
79
- * Used for testing.
80
- * @internal
81
- */
82
- declare function resetGlobalPredefinedTokens(): void;
83
- /**
84
- *
85
- * @param {String} value
86
- * @param {Number} mode
87
- * @returns {Object<String,String|Array>}
88
- */
89
- declare function parseStyle(value: StyleValue): ProcessedStyle;
90
- /**
91
- * Parse color. Find it value, name and opacity.
92
- * Optimized to avoid heavy parseStyle calls for simple color patterns.
93
- */
94
- declare function parseColor(val: string, ignoreError?: boolean): ParsedColor;
95
- declare function filterMods(mods: string[], allowedMods: string[]): string[];
96
- declare function stringifyStyles(styles: unknown): string;
97
- //#endregion
98
- export { CSSMap, CUSTOM_UNITS, DIRECTIONS, ParsedColor, RawStyleHandler, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleMap, StylePropValue, StyleValue, StyleValueStateMap, customFunc, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, normalizeColorTokenValue, parseColor, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, stringifyStyles };
99
- //# sourceMappingURL=styles.d.ts.map