@tenphi/tasty 0.0.0-snapshot.bbd10c7 → 0.0.0-snapshot.bbfcd75

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 (370) hide show
  1. package/README.md +196 -140
  2. package/dist/babel-Zs1Q03qt.d.ts +83 -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-CUQVwdWF.js +42 -0
  6. package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
  7. package/dist/chunks/collector-B0LTHw6Z.js +208 -0
  8. package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
  9. package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
  10. package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
  11. package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
  12. package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
  13. package/dist/chunks/css-resources-BN8apgxt.js +142 -0
  14. package/dist/chunks/css-resources-BN8apgxt.js.map +1 -0
  15. package/dist/{debug.js → chunks/debug-C9LeNVoJ.js} +187 -139
  16. package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
  17. package/dist/chunks/dsl-C5yuAn41.js +1373 -0
  18. package/dist/chunks/dsl-C5yuAn41.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-O-OUrKLH.js +557 -0
  22. package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
  23. package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
  24. package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
  25. package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
  26. package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-DWA4LjIa.js} +55 -55
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/style-engine-C1ECBZxR.js +5131 -0
  30. package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-B6EnYcXY.js} +89 -82
  32. package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
  33. package/dist/collector-hl5KNH7k.d.ts +165 -0
  34. package/dist/config-DWL1ZYue.d.ts +1358 -0
  35. package/dist/core/index.d.ts +5 -34
  36. package/dist/core/index.js +9 -27
  37. package/dist/index-D9N9GV24.d.ts +1947 -0
  38. package/dist/index.d.ts +5 -51
  39. package/dist/index.js +11 -36
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-C_oMoJVd.d.ts} +3 -3
  41. package/dist/ssr/astro-client.js +6 -0
  42. package/dist/ssr/astro-client.js.map +1 -0
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  44. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  45. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  46. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  47. package/dist/ssr/astro-middleware-extract.js +9 -0
  48. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  49. package/dist/ssr/astro-middleware-static.d.ts +18 -0
  50. package/dist/ssr/astro-middleware-static.js +7 -0
  51. package/dist/ssr/astro-middleware-static.js.map +1 -0
  52. package/dist/ssr/astro-middleware.d.ts +19 -0
  53. package/dist/ssr/astro-middleware.js +7 -0
  54. package/dist/ssr/astro-middleware.js.map +1 -0
  55. package/dist/ssr/astro.d.ts +117 -11
  56. package/dist/ssr/astro.js +204 -48
  57. package/dist/ssr/astro.js.map +1 -1
  58. package/dist/ssr/index.d.ts +37 -4
  59. package/dist/ssr/index.js +6 -6
  60. package/dist/ssr/index.js.map +1 -1
  61. package/dist/ssr/next-config.d.ts +66 -0
  62. package/dist/ssr/next-config.js +124 -0
  63. package/dist/ssr/next-config.js.map +1 -0
  64. package/dist/ssr/next.d.ts +14 -5
  65. package/dist/ssr/next.js +31 -46
  66. package/dist/ssr/next.js.map +1 -1
  67. package/dist/static/index.d.ts +91 -5
  68. package/dist/static/index.js +31 -3
  69. package/dist/static/index.js.map +1 -0
  70. package/dist/static/inject.js.map +1 -1
  71. package/dist/types-jKZNpias.d.ts +1616 -0
  72. package/dist/zero/babel.d.ts +2 -182
  73. package/dist/zero/babel.js +82 -113
  74. package/dist/zero/babel.js.map +1 -1
  75. package/dist/zero/index.d.ts +81 -3
  76. package/dist/zero/index.js +2 -3
  77. package/dist/zero/next.d.ts +1 -1
  78. package/dist/zero/next.js +0 -31
  79. package/dist/zero/next.js.map +1 -1
  80. package/docs/README.md +20 -12
  81. package/docs/adoption.md +59 -32
  82. package/docs/ai-agents.md +229 -0
  83. package/docs/comparison.md +76 -48
  84. package/docs/configuration.md +566 -69
  85. package/docs/debug.md +37 -23
  86. package/docs/design-system.md +63 -32
  87. package/docs/dsl.md +527 -179
  88. package/docs/getting-started.md +62 -41
  89. package/docs/injector.md +157 -51
  90. package/docs/methodology.md +69 -37
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +744 -0
  93. package/docs/plugins.md +353 -0
  94. package/docs/{runtime.md → react-api.md} +176 -67
  95. package/docs/runtime-benchmarks.md +377 -0
  96. package/docs/ssr.md +350 -94
  97. package/docs/styles.md +108 -27
  98. package/docs/tasty-static.md +149 -87
  99. package/package.json +121 -23
  100. package/tasty.config.ts +6 -0
  101. package/dist/_virtual/_rolldown/runtime.js +0 -7
  102. package/dist/chunks/cacheKey.js +0 -77
  103. package/dist/chunks/cacheKey.js.map +0 -1
  104. package/dist/chunks/definitions.d.ts +0 -37
  105. package/dist/chunks/definitions.js +0 -258
  106. package/dist/chunks/definitions.js.map +0 -1
  107. package/dist/chunks/index.d.ts +0 -1
  108. package/dist/chunks/renderChunk.d.ts +0 -1
  109. package/dist/chunks/renderChunk.js +0 -59
  110. package/dist/chunks/renderChunk.js.map +0 -1
  111. package/dist/compute-styles.d.ts +0 -31
  112. package/dist/compute-styles.js +0 -356
  113. package/dist/compute-styles.js.map +0 -1
  114. package/dist/config.d.ts +0 -372
  115. package/dist/config.js +0 -507
  116. package/dist/config.js.map +0 -1
  117. package/dist/counter-style/index.js +0 -51
  118. package/dist/counter-style/index.js.map +0 -1
  119. package/dist/debug.d.ts +0 -89
  120. package/dist/debug.js.map +0 -1
  121. package/dist/font-face/index.js +0 -63
  122. package/dist/font-face/index.js.map +0 -1
  123. package/dist/hooks/index.d.ts +0 -7
  124. package/dist/hooks/useCounterStyle.d.ts +0 -50
  125. package/dist/hooks/useCounterStyle.js +0 -45
  126. package/dist/hooks/useCounterStyle.js.map +0 -1
  127. package/dist/hooks/useFontFace.d.ts +0 -43
  128. package/dist/hooks/useFontFace.js +0 -69
  129. package/dist/hooks/useFontFace.js.map +0 -1
  130. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  131. package/dist/hooks/useGlobalStyles.js +0 -77
  132. package/dist/hooks/useGlobalStyles.js.map +0 -1
  133. package/dist/hooks/useKeyframes.d.ts +0 -56
  134. package/dist/hooks/useKeyframes.js +0 -63
  135. package/dist/hooks/useKeyframes.js.map +0 -1
  136. package/dist/hooks/useProperty.d.ts +0 -79
  137. package/dist/hooks/useProperty.js +0 -108
  138. package/dist/hooks/useProperty.js.map +0 -1
  139. package/dist/hooks/useRawCSS.d.ts +0 -53
  140. package/dist/hooks/useRawCSS.js +0 -34
  141. package/dist/hooks/useRawCSS.js.map +0 -1
  142. package/dist/hooks/useStyles.d.ts +0 -40
  143. package/dist/hooks/useStyles.js +0 -29
  144. package/dist/hooks/useStyles.js.map +0 -1
  145. package/dist/injector/index.d.ts +0 -166
  146. package/dist/injector/index.js +0 -166
  147. package/dist/injector/index.js.map +0 -1
  148. package/dist/injector/injector.d.ts +0 -166
  149. package/dist/injector/injector.js +0 -464
  150. package/dist/injector/injector.js.map +0 -1
  151. package/dist/injector/sheet-manager.d.ts +0 -136
  152. package/dist/injector/sheet-manager.js +0 -733
  153. package/dist/injector/sheet-manager.js.map +0 -1
  154. package/dist/injector/types.d.ts +0 -204
  155. package/dist/keyframes/index.js +0 -206
  156. package/dist/keyframes/index.js.map +0 -1
  157. package/dist/parser/classify.js +0 -319
  158. package/dist/parser/classify.js.map +0 -1
  159. package/dist/parser/const.js +0 -60
  160. package/dist/parser/const.js.map +0 -1
  161. package/dist/parser/lru.js +0 -109
  162. package/dist/parser/lru.js.map +0 -1
  163. package/dist/parser/parser.d.ts +0 -25
  164. package/dist/parser/parser.js +0 -115
  165. package/dist/parser/parser.js.map +0 -1
  166. package/dist/parser/tokenizer.js +0 -69
  167. package/dist/parser/tokenizer.js.map +0 -1
  168. package/dist/parser/types.d.ts +0 -51
  169. package/dist/parser/types.js +0 -46
  170. package/dist/parser/types.js.map +0 -1
  171. package/dist/pipeline/conditions.d.ts +0 -134
  172. package/dist/pipeline/conditions.js +0 -406
  173. package/dist/pipeline/conditions.js.map +0 -1
  174. package/dist/pipeline/exclusive.js +0 -230
  175. package/dist/pipeline/exclusive.js.map +0 -1
  176. package/dist/pipeline/index.d.ts +0 -55
  177. package/dist/pipeline/index.js +0 -708
  178. package/dist/pipeline/index.js.map +0 -1
  179. package/dist/pipeline/materialize.js +0 -1103
  180. package/dist/pipeline/materialize.js.map +0 -1
  181. package/dist/pipeline/parseStateKey.d.ts +0 -15
  182. package/dist/pipeline/parseStateKey.js +0 -446
  183. package/dist/pipeline/parseStateKey.js.map +0 -1
  184. package/dist/pipeline/simplify.js +0 -515
  185. package/dist/pipeline/simplify.js.map +0 -1
  186. package/dist/pipeline/warnings.js +0 -18
  187. package/dist/pipeline/warnings.js.map +0 -1
  188. package/dist/plugins/index.d.ts +0 -2
  189. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  190. package/dist/plugins/okhsl-plugin.js +0 -97
  191. package/dist/plugins/okhsl-plugin.js.map +0 -1
  192. package/dist/plugins/types.d.ts +0 -76
  193. package/dist/properties/index.js +0 -222
  194. package/dist/properties/index.js.map +0 -1
  195. package/dist/properties/property-type-resolver.d.ts +0 -24
  196. package/dist/properties/property-type-resolver.js +0 -90
  197. package/dist/properties/property-type-resolver.js.map +0 -1
  198. package/dist/ssr/async-storage.d.ts +0 -17
  199. package/dist/ssr/async-storage.js +0 -34
  200. package/dist/ssr/async-storage.js.map +0 -1
  201. package/dist/ssr/collect-auto-properties.js +0 -39
  202. package/dist/ssr/collect-auto-properties.js.map +0 -1
  203. package/dist/ssr/collector.d.ts +0 -102
  204. package/dist/ssr/collector.js +0 -219
  205. package/dist/ssr/collector.js.map +0 -1
  206. package/dist/ssr/format-global-rules.js +0 -22
  207. package/dist/ssr/format-global-rules.js.map +0 -1
  208. package/dist/ssr/format-keyframes.js +0 -69
  209. package/dist/ssr/format-keyframes.js.map +0 -1
  210. package/dist/ssr/format-property.js +0 -49
  211. package/dist/ssr/format-property.js.map +0 -1
  212. package/dist/ssr/format-rules.js +0 -73
  213. package/dist/ssr/format-rules.js.map +0 -1
  214. package/dist/ssr/hydrate.d.ts +0 -22
  215. package/dist/ssr/hydrate.js +0 -49
  216. package/dist/ssr/hydrate.js.map +0 -1
  217. package/dist/ssr/ssr-collector-ref.js +0 -12
  218. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  219. package/dist/states/index.d.ts +0 -49
  220. package/dist/states/index.js +0 -170
  221. package/dist/states/index.js.map +0 -1
  222. package/dist/static/tastyStatic.d.ts +0 -46
  223. package/dist/static/tastyStatic.js +0 -30
  224. package/dist/static/tastyStatic.js.map +0 -1
  225. package/dist/static/types.d.ts +0 -49
  226. package/dist/static/types.js +0 -24
  227. package/dist/static/types.js.map +0 -1
  228. package/dist/styles/border.d.ts +0 -25
  229. package/dist/styles/border.js +0 -120
  230. package/dist/styles/border.js.map +0 -1
  231. package/dist/styles/color.d.ts +0 -14
  232. package/dist/styles/color.js +0 -26
  233. package/dist/styles/color.js.map +0 -1
  234. package/dist/styles/const.js +0 -17
  235. package/dist/styles/const.js.map +0 -1
  236. package/dist/styles/createStyle.js +0 -79
  237. package/dist/styles/createStyle.js.map +0 -1
  238. package/dist/styles/dimension.js +0 -109
  239. package/dist/styles/dimension.js.map +0 -1
  240. package/dist/styles/directional.js +0 -133
  241. package/dist/styles/directional.js.map +0 -1
  242. package/dist/styles/display.d.ts +0 -30
  243. package/dist/styles/display.js +0 -73
  244. package/dist/styles/display.js.map +0 -1
  245. package/dist/styles/fade.d.ts +0 -15
  246. package/dist/styles/fade.js +0 -62
  247. package/dist/styles/fade.js.map +0 -1
  248. package/dist/styles/fill.d.ts +0 -42
  249. package/dist/styles/fill.js +0 -51
  250. package/dist/styles/fill.js.map +0 -1
  251. package/dist/styles/flow.d.ts +0 -16
  252. package/dist/styles/flow.js +0 -12
  253. package/dist/styles/flow.js.map +0 -1
  254. package/dist/styles/gap.d.ts +0 -31
  255. package/dist/styles/gap.js +0 -38
  256. package/dist/styles/gap.js.map +0 -1
  257. package/dist/styles/height.d.ts +0 -17
  258. package/dist/styles/height.js +0 -19
  259. package/dist/styles/height.js.map +0 -1
  260. package/dist/styles/index.d.ts +0 -1
  261. package/dist/styles/index.js +0 -8
  262. package/dist/styles/index.js.map +0 -1
  263. package/dist/styles/inset.d.ts +0 -24
  264. package/dist/styles/inset.js +0 -34
  265. package/dist/styles/inset.js.map +0 -1
  266. package/dist/styles/list.d.ts +0 -16
  267. package/dist/styles/list.js +0 -100
  268. package/dist/styles/list.js.map +0 -1
  269. package/dist/styles/margin.d.ts +0 -24
  270. package/dist/styles/margin.js +0 -32
  271. package/dist/styles/margin.js.map +0 -1
  272. package/dist/styles/outline.d.ts +0 -29
  273. package/dist/styles/outline.js +0 -55
  274. package/dist/styles/outline.js.map +0 -1
  275. package/dist/styles/padding.d.ts +0 -24
  276. package/dist/styles/padding.js +0 -32
  277. package/dist/styles/padding.js.map +0 -1
  278. package/dist/styles/placement.d.ts +0 -37
  279. package/dist/styles/placement.js +0 -74
  280. package/dist/styles/placement.js.map +0 -1
  281. package/dist/styles/predefined.d.ts +0 -71
  282. package/dist/styles/predefined.js +0 -237
  283. package/dist/styles/predefined.js.map +0 -1
  284. package/dist/styles/preset.d.ts +0 -52
  285. package/dist/styles/preset.js +0 -127
  286. package/dist/styles/preset.js.map +0 -1
  287. package/dist/styles/radius.d.ts +0 -12
  288. package/dist/styles/radius.js +0 -83
  289. package/dist/styles/radius.js.map +0 -1
  290. package/dist/styles/scrollMargin.d.ts +0 -24
  291. package/dist/styles/scrollMargin.js +0 -32
  292. package/dist/styles/scrollMargin.js.map +0 -1
  293. package/dist/styles/scrollbar.d.ts +0 -25
  294. package/dist/styles/scrollbar.js +0 -51
  295. package/dist/styles/scrollbar.js.map +0 -1
  296. package/dist/styles/shadow.d.ts +0 -14
  297. package/dist/styles/shadow.js +0 -25
  298. package/dist/styles/shadow.js.map +0 -1
  299. package/dist/styles/shared.js +0 -17
  300. package/dist/styles/shared.js.map +0 -1
  301. package/dist/styles/transition.d.ts +0 -14
  302. package/dist/styles/transition.js +0 -159
  303. package/dist/styles/transition.js.map +0 -1
  304. package/dist/styles/types.d.ts +0 -564
  305. package/dist/styles/width.d.ts +0 -17
  306. package/dist/styles/width.js +0 -19
  307. package/dist/styles/width.js.map +0 -1
  308. package/dist/tasty.d.ts +0 -134
  309. package/dist/tasty.js +0 -240
  310. package/dist/tasty.js.map +0 -1
  311. package/dist/types.d.ts +0 -184
  312. package/dist/utils/cache-wrapper.js +0 -21
  313. package/dist/utils/cache-wrapper.js.map +0 -1
  314. package/dist/utils/case-converter.js +0 -8
  315. package/dist/utils/case-converter.js.map +0 -1
  316. package/dist/utils/color-math.d.ts +0 -46
  317. package/dist/utils/color-math.js +0 -749
  318. package/dist/utils/color-math.js.map +0 -1
  319. package/dist/utils/color-space.d.ts +0 -5
  320. package/dist/utils/color-space.js +0 -228
  321. package/dist/utils/color-space.js.map +0 -1
  322. package/dist/utils/colors.d.ts +0 -5
  323. package/dist/utils/colors.js +0 -10
  324. package/dist/utils/colors.js.map +0 -1
  325. package/dist/utils/css-types.d.ts +0 -7
  326. package/dist/utils/dotize.d.ts +0 -26
  327. package/dist/utils/dotize.js +0 -122
  328. package/dist/utils/dotize.js.map +0 -1
  329. package/dist/utils/filter-base-props.d.ts +0 -15
  330. package/dist/utils/filter-base-props.js +0 -45
  331. package/dist/utils/filter-base-props.js.map +0 -1
  332. package/dist/utils/get-display-name.d.ts +0 -7
  333. package/dist/utils/get-display-name.js +0 -10
  334. package/dist/utils/get-display-name.js.map +0 -1
  335. package/dist/utils/has-keys.js +0 -13
  336. package/dist/utils/has-keys.js.map +0 -1
  337. package/dist/utils/is-dev-env.js +0 -19
  338. package/dist/utils/is-dev-env.js.map +0 -1
  339. package/dist/utils/is-valid-element-type.js +0 -15
  340. package/dist/utils/is-valid-element-type.js.map +0 -1
  341. package/dist/utils/merge-styles.js.map +0 -1
  342. package/dist/utils/mod-attrs.d.ts +0 -6
  343. package/dist/utils/mod-attrs.js +0 -20
  344. package/dist/utils/mod-attrs.js.map +0 -1
  345. package/dist/utils/process-tokens.d.ts +0 -17
  346. package/dist/utils/process-tokens.js +0 -83
  347. package/dist/utils/process-tokens.js.map +0 -1
  348. package/dist/utils/resolve-recipes.d.ts +0 -17
  349. package/dist/utils/resolve-recipes.js +0 -146
  350. package/dist/utils/resolve-recipes.js.map +0 -1
  351. package/dist/utils/selector-transform.js +0 -32
  352. package/dist/utils/selector-transform.js.map +0 -1
  353. package/dist/utils/string.js +0 -8
  354. package/dist/utils/string.js.map +0 -1
  355. package/dist/utils/styles.d.ts +0 -99
  356. package/dist/utils/styles.js +0 -220
  357. package/dist/utils/styles.js.map +0 -1
  358. package/dist/utils/typography.d.ts +0 -47
  359. package/dist/utils/typography.js +0 -51
  360. package/dist/utils/typography.js.map +0 -1
  361. package/dist/utils/warnings.d.ts +0 -16
  362. package/dist/utils/warnings.js +0 -16
  363. package/dist/utils/warnings.js.map +0 -1
  364. package/dist/zero/css-writer.d.ts +0 -45
  365. package/dist/zero/css-writer.js +0 -73
  366. package/dist/zero/css-writer.js.map +0 -1
  367. package/dist/zero/extractor.d.ts +0 -24
  368. package/dist/zero/extractor.js.map +0 -1
  369. package/docs/PIPELINE.md +0 -519
  370. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
@@ -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(\n props: Record<string, unknown>,\n opts: PropsFilterOptions = {},\n): Record<string, unknown> {\n const { propNames, eventProps } = opts;\n const filteredProps: Record<string, unknown> = {};\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,EACJ;CACzB,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,gBAAyC,EAAE;AAEjD,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,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":";;;AAKA,MAAM,UAAU,UAAU;AAE1B,MAAM,gBAAgB;;;;AAKtB,SAAS,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U,CAAC,OAAO,WAAW;GACjE,MAAM,kBAAkB,IAAI,IAAI,CAAC,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEtE,QAAK,MAAM,OAAO,iBAAiB;IACjC,MAAM,WAAW,YAAY;AAE7B,QAAI,aAAa,SAAS,aAAa,KACrC,QAAO,aAAa;aACX,aAAa,KAAA,EACtB,cAAa,OAAO,OAAO;aAClB,SACT,cAAa,OAAO,sBAClB,OAAO,MACP,SACD;;AAKL,QAAK,MAAM,OAAO,OAAO,KAAK,UAAU,EAAE;AACxC,QAAI,WAAW,IAAI,CAAE;IAErB,MAAM,WAAW,UAAU;AAE3B,QAAI,aAAa,KAAA,EACf,KAAI,OAAO,OACT,cAAa,OAAO,OAAO;QAE3B,QAAO,aAAa;aAEb,aAAa,KACtB,QAAO,aAAa;aACX,WAAW,SAAS,CAC5B,cAAyC,OAAO,gBAC/C,OAAO,MACP,SACD;;AAIL,YAAS;;AAGX;;AAGF,QAAO"}
@@ -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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les } 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,146 +0,0 @@
1
- import { isDevEnv } from "./is-dev-env.js";
2
- import { isSelector } from "../pipeline/index.js";
3
- import { getGlobalRecipes } from "../config.js";
4
- import { mergeStyles } from "./merge-styles.js";
5
- //#region src/utils/resolve-recipes.ts
6
- /**
7
- * Recipe resolution utility.
8
- *
9
- * Resolves `recipe` style properties by looking up predefined recipe styles
10
- * from global configuration and merging them with the component's own styles.
11
- *
12
- * Resolution order per level (top-level and each sub-element independently):
13
- * base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2
14
- *
15
- * The `/` separator splits base recipes (before component styles)
16
- * from post recipes (after component styles). All merges use mergeStyles
17
- * semantics: primitives and state maps with '' key fully replace;
18
- * state maps without '' key extend the existing value.
19
- *
20
- * Returns the same object reference if no recipes are present (zero overhead).
21
- */
22
- const devMode = isDevEnv();
23
- /**
24
- * Parse a recipe string into base and post recipe name groups.
25
- *
26
- * Syntax: `'base1 base2 / post1 post2'`
27
- * - Names are space-separated within each group
28
- * - `/` separates base (before component) from post (after component) groups
29
- * - `/` is optional; if absent, all names are base
30
- * - `none` as the sole base value means "no base recipes"
31
- *
32
- * Returns `{ base: null, post: null }` if the string is empty or invalid.
33
- */
34
- function parseRecipeNames(value) {
35
- const empty = {
36
- base: null,
37
- post: null
38
- };
39
- if (typeof value !== "string") return empty;
40
- const trimmed = value.trim();
41
- if (trimmed === "") return empty;
42
- const slashIndex = trimmed.indexOf("/");
43
- if (slashIndex === -1) {
44
- if (trimmed === "none") return empty;
45
- return {
46
- base: splitNames(trimmed),
47
- post: null
48
- };
49
- }
50
- const basePart = trimmed.slice(0, slashIndex);
51
- const postPart = trimmed.slice(slashIndex + 1);
52
- return {
53
- base: basePart.trim() === "none" ? null : splitNames(basePart),
54
- post: splitNames(postPart)
55
- };
56
- }
57
- function splitNames(s) {
58
- const names = s.split(/\s+/).filter(Boolean);
59
- return names.length > 0 ? names : null;
60
- }
61
- /**
62
- * Collect merged styles for a list of recipe names.
63
- * Each recipe is flat-spread on top of the previous.
64
- */
65
- function collectRecipeStyles(names, recipes) {
66
- let merged = {};
67
- for (const name of names) {
68
- const recipeStyles = recipes[name];
69
- if (!recipeStyles) {
70
- if (devMode) console.warn(`[Tasty] Recipe "${name}" not found. Make sure it is defined in configure({ recipes: { ... } }).`);
71
- continue;
72
- }
73
- merged = {
74
- ...merged,
75
- ...recipeStyles
76
- };
77
- }
78
- return merged;
79
- }
80
- /**
81
- * Resolve recipe references in a flat styles object (no sub-elements).
82
- * Returns null if no `recipe` key is present.
83
- *
84
- * Resolution: base recipes → component styles → post recipes (all via mergeStyles)
85
- */
86
- function resolveRecipesForLevel(styles, recipes) {
87
- if (!("recipe" in styles)) return null;
88
- const { base, post } = parseRecipeNames(styles.recipe);
89
- const { recipe: _recipe, ...allRest } = styles;
90
- const flatStyles = {};
91
- const selectorStyles = {};
92
- for (const key of Object.keys(allRest)) if (isSelector(key)) selectorStyles[key] = allRest[key];
93
- else flatStyles[key] = allRest[key];
94
- if (!base && !post) return allRest;
95
- let result;
96
- if (base) result = mergeStyles(collectRecipeStyles(base, recipes), flatStyles);
97
- else result = { ...flatStyles };
98
- if (post) {
99
- const postStyles = collectRecipeStyles(post, recipes);
100
- result = mergeStyles(result, postStyles);
101
- }
102
- for (const key of Object.keys(selectorStyles)) result[key] = selectorStyles[key];
103
- return result;
104
- }
105
- /**
106
- * Resolve all `recipe` style properties in a styles object.
107
- *
108
- * Handles both top-level and sub-element recipe references.
109
- * Returns the same object reference if no recipes are present anywhere
110
- * (zero overhead for the common case).
111
- *
112
- * @param styles - The styles object potentially containing `recipe` keys
113
- * @returns Resolved styles with recipe values merged in, or the original object if unchanged
114
- */
115
- function resolveRecipes(styles) {
116
- const recipes = getGlobalRecipes();
117
- if (!recipes) return styles;
118
- let changed = false;
119
- const topResolved = resolveRecipesForLevel(styles, recipes);
120
- let result;
121
- if (topResolved) {
122
- changed = true;
123
- result = topResolved;
124
- } else result = styles;
125
- const keys = Object.keys(result);
126
- for (const key of keys) {
127
- if (!isSelector(key)) continue;
128
- const subStyles = result[key];
129
- if (!subStyles || typeof subStyles !== "object" || Array.isArray(subStyles)) continue;
130
- const subRecord = subStyles;
131
- if (!("recipe" in subRecord)) continue;
132
- const subResolved = resolveRecipesForLevel(subRecord, recipes);
133
- if (subResolved) {
134
- if (!changed) {
135
- changed = true;
136
- result = { ...styles };
137
- }
138
- result[key] = subResolved;
139
- }
140
- }
141
- return changed ? result : styles;
142
- }
143
- //#endregion
144
- export { resolveRecipes };
145
-
146
- //# sourceMappingURL=resolve-recipes.js.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,OA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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"}