@yahoo/uds-v5-wip 1.60.0 → 1.61.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 (563) hide show
  1. package/dist/codegen/dist/loader/getLoaderArtifacts.js +2 -0
  2. package/dist/config/dist/Props.d.ts +161 -25
  3. package/dist/config/dist/bindRender.d.ts +16 -0
  4. package/dist/config/dist/bindRender.js +310 -0
  5. package/dist/config/dist/className.d.ts +54 -0
  6. package/dist/config/dist/className.js +77 -0
  7. package/dist/config/dist/component-config.d.ts +674 -161
  8. package/dist/config/dist/component-config.js +163 -0
  9. package/dist/config/dist/component-refs.d.ts +41 -18
  10. package/dist/config/dist/createConfig.d.ts +140 -59
  11. package/dist/config/dist/createConfig.js +95 -217
  12. package/dist/config/dist/createStyler.d.ts +35 -0
  13. package/dist/config/dist/createStyler.js +93 -0
  14. package/dist/config/dist/defineComponent.d.ts +297 -4
  15. package/dist/config/dist/defineComponent.js +264 -2
  16. package/dist/config/dist/defineCompositeStyle.d.ts +93 -0
  17. package/dist/config/dist/defineCompositeStyle.js +18 -0
  18. package/dist/config/dist/defineMotionConfig.d.ts +152 -0
  19. package/dist/config/dist/definePreview.d.ts +45 -0
  20. package/dist/config/dist/definePreview.js +35 -0
  21. package/dist/config/dist/defineStyleProp.d.ts +199 -3
  22. package/dist/config/dist/defineStyleProp.js +3 -2
  23. package/dist/config/dist/index.d.ts +20 -11
  24. package/dist/config/dist/index.js +8 -4
  25. package/dist/config/dist/merge-utils.js +51 -0
  26. package/dist/config/dist/propertyAcceptedTypes.d.ts +19 -0
  27. package/dist/config/dist/refs.d.ts +85 -0
  28. package/dist/config/dist/refs.js +92 -47
  29. package/dist/config/dist/resolveCompoundProps.d.ts +65 -0
  30. package/dist/config/dist/resolveCompoundProps.js +120 -0
  31. package/dist/config/dist/resolveStyleProp.d.ts +72 -3
  32. package/dist/config/dist/resolveStyleProp.js +68 -43
  33. package/dist/config/dist/runtime-registry.js +30 -2
  34. package/dist/config/dist/serialize.d.ts +8 -34
  35. package/dist/config/dist/serialize.js +10 -71
  36. package/dist/config/dist/sniffTokenType.d.ts +7 -0
  37. package/dist/config/dist/sniffTokenType.js +67 -0
  38. package/dist/config/dist/style-prop-runtime.d.ts +75 -1
  39. package/dist/config/dist/style-prop-runtime.js +390 -0
  40. package/dist/config/dist/types/css-properties.d.ts +223 -0
  41. package/dist/config/dist/types/css-values.d.ts +2 -1
  42. package/dist/config/dist/types.d.ts +14 -3
  43. package/dist/config.d.ts +21 -1560
  44. package/dist/config.js +15 -20
  45. package/dist/loader/dist/_virtual/_rolldown/runtime.js +1 -2
  46. package/dist/loader/dist/index.d.ts +2 -0
  47. package/dist/loader/dist/index.js +3 -0
  48. package/dist/loader/dist/loader/artifacts.js +2 -2
  49. package/dist/loader/dist/loader/babel-utils.js +1 -29
  50. package/dist/loader/dist/loader/internal-meta.js +38 -1
  51. package/dist/loader/dist/loader/lower-new-api-primitive.js +176 -14
  52. package/dist/loader/dist/loader.d.ts +29 -1
  53. package/dist/loader/dist/loader.js +71 -309
  54. package/dist/loader/dist/next.d.ts +2 -1
  55. package/dist/loader/dist/transform-runner.js +14 -0
  56. package/dist/loader/dist/unplugin.d.ts +27 -0
  57. package/dist/loader/dist/unplugin.js +52 -0
  58. package/dist/plugin.d.ts +2 -2
  59. package/dist/plugin.js +3 -2
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +3 -51
  62. package/dist/components/accordion.config.d.ts +0 -2
  63. package/dist/components/accordion.config.js +0 -2
  64. package/dist/components/accordion.d.ts +0 -2
  65. package/dist/components/accordion.js +0 -2
  66. package/dist/components/alert.config.d.ts +0 -2
  67. package/dist/components/alert.config.js +0 -2
  68. package/dist/components/alert.d.ts +0 -2
  69. package/dist/components/alert.js +0 -2
  70. package/dist/components/anchor.config.d.ts +0 -2
  71. package/dist/components/anchor.config.js +0 -2
  72. package/dist/components/anchor.d.ts +0 -2
  73. package/dist/components/anchor.js +0 -2
  74. package/dist/components/article.d.ts +0 -2
  75. package/dist/components/article.js +0 -2
  76. package/dist/components/aside.d.ts +0 -2
  77. package/dist/components/aside.js +0 -2
  78. package/dist/components/avatar-group.config.d.ts +0 -2
  79. package/dist/components/avatar-group.config.js +0 -2
  80. package/dist/components/avatar-group.d.ts +0 -2
  81. package/dist/components/avatar-group.js +0 -2
  82. package/dist/components/avatar.config.d.ts +0 -2
  83. package/dist/components/avatar.config.js +0 -2
  84. package/dist/components/avatar.d.ts +0 -2
  85. package/dist/components/avatar.js +0 -2
  86. package/dist/components/badge.config.d.ts +0 -2
  87. package/dist/components/badge.config.js +0 -2
  88. package/dist/components/badge.d.ts +0 -2
  89. package/dist/components/badge.js +0 -2
  90. package/dist/components/box.d.ts +0 -2
  91. package/dist/components/box.js +0 -2
  92. package/dist/components/breadcrumb.config.d.ts +0 -2
  93. package/dist/components/breadcrumb.config.js +0 -2
  94. package/dist/components/breadcrumb.d.ts +0 -2
  95. package/dist/components/breadcrumb.js +0 -2
  96. package/dist/components/button.config.d.ts +0 -2
  97. package/dist/components/button.config.js +0 -2
  98. package/dist/components/button.d.ts +0 -2
  99. package/dist/components/button.js +0 -2
  100. package/dist/components/card.config.d.ts +0 -2
  101. package/dist/components/card.config.js +0 -2
  102. package/dist/components/card.d.ts +0 -2
  103. package/dist/components/card.js +0 -2
  104. package/dist/components/collapsible.config.d.ts +0 -2
  105. package/dist/components/collapsible.config.js +0 -2
  106. package/dist/components/collapsible.d.ts +0 -2
  107. package/dist/components/collapsible.js +0 -2
  108. package/dist/components/command.config.d.ts +0 -2
  109. package/dist/components/command.config.js +0 -2
  110. package/dist/components/command.d.ts +0 -2
  111. package/dist/components/command.js +0 -2
  112. package/dist/components/control-color.config.d.ts +0 -2
  113. package/dist/components/control-color.config.js +0 -2
  114. package/dist/components/control-color.d.ts +0 -2
  115. package/dist/components/control-color.js +0 -2
  116. package/dist/components/control-curve.config.d.ts +0 -2
  117. package/dist/components/control-curve.config.js +0 -2
  118. package/dist/components/control-curve.d.ts +0 -2
  119. package/dist/components/control-curve.js +0 -2
  120. package/dist/components/control-folder.config.d.ts +0 -2
  121. package/dist/components/control-folder.config.js +0 -2
  122. package/dist/components/control-folder.d.ts +0 -2
  123. package/dist/components/control-folder.js +0 -2
  124. package/dist/components/control-group.config.d.ts +0 -2
  125. package/dist/components/control-group.config.js +0 -2
  126. package/dist/components/control-group.d.ts +0 -2
  127. package/dist/components/control-group.js +0 -2
  128. package/dist/components/control-knob.config.d.ts +0 -2
  129. package/dist/components/control-knob.config.js +0 -2
  130. package/dist/components/control-knob.d.ts +0 -2
  131. package/dist/components/control-knob.js +0 -2
  132. package/dist/components/control-panel.config.d.ts +0 -2
  133. package/dist/components/control-panel.config.js +0 -2
  134. package/dist/components/control-panel.d.ts +0 -2
  135. package/dist/components/control-panel.js +0 -2
  136. package/dist/components/control-select.config.d.ts +0 -2
  137. package/dist/components/control-select.config.js +0 -2
  138. package/dist/components/control-select.d.ts +0 -2
  139. package/dist/components/control-select.js +0 -2
  140. package/dist/components/control-slider.config.d.ts +0 -2
  141. package/dist/components/control-slider.config.js +0 -2
  142. package/dist/components/control-slider.d.ts +0 -2
  143. package/dist/components/control-slider.js +0 -2
  144. package/dist/components/control-spring.config.d.ts +0 -2
  145. package/dist/components/control-spring.config.js +0 -2
  146. package/dist/components/control-spring.d.ts +0 -2
  147. package/dist/components/control-spring.js +0 -2
  148. package/dist/components/control-stepper.config.d.ts +0 -2
  149. package/dist/components/control-stepper.config.js +0 -2
  150. package/dist/components/control-stepper.d.ts +0 -2
  151. package/dist/components/control-stepper.js +0 -2
  152. package/dist/components/control-toggle.config.d.ts +0 -2
  153. package/dist/components/control-toggle.config.js +0 -2
  154. package/dist/components/control-toggle.d.ts +0 -2
  155. package/dist/components/control-toggle.js +0 -2
  156. package/dist/components/dist/_slots.js +0 -8
  157. package/dist/components/dist/accordion.config.d.ts +0 -431
  158. package/dist/components/dist/accordion.config.js +0 -81
  159. package/dist/components/dist/accordion.d.ts +0 -453
  160. package/dist/components/dist/accordion.js +0 -60
  161. package/dist/components/dist/alert.config.d.ts +0 -219
  162. package/dist/components/dist/alert.config.js +0 -54
  163. package/dist/components/dist/alert.d.ts +0 -230
  164. package/dist/components/dist/alert.js +0 -16
  165. package/dist/components/dist/anchor.config.d.ts +0 -250
  166. package/dist/components/dist/anchor.config.js +0 -22
  167. package/dist/components/dist/anchor.d.ts +0 -261
  168. package/dist/components/dist/anchor.js +0 -9
  169. package/dist/components/dist/article.d.ts +0 -11
  170. package/dist/components/dist/article.js +0 -9
  171. package/dist/components/dist/aside.d.ts +0 -11
  172. package/dist/components/dist/aside.js +0 -9
  173. package/dist/components/dist/avatar-group.config.d.ts +0 -315
  174. package/dist/components/dist/avatar-group.config.js +0 -33
  175. package/dist/components/dist/avatar-group.d.ts +0 -329
  176. package/dist/components/dist/avatar-group.js +0 -39
  177. package/dist/components/dist/avatar.config.d.ts +0 -197
  178. package/dist/components/dist/avatar.config.js +0 -49
  179. package/dist/components/dist/avatar.d.ts +0 -211
  180. package/dist/components/dist/avatar.js +0 -20
  181. package/dist/components/dist/badge.config.d.ts +0 -477
  182. package/dist/components/dist/badge.config.js +0 -99
  183. package/dist/components/dist/badge.d.ts +0 -489
  184. package/dist/components/dist/badge.js +0 -16
  185. package/dist/components/dist/box.d.ts +0 -14
  186. package/dist/components/dist/box.js +0 -9
  187. package/dist/components/dist/breadcrumb.config.d.ts +0 -390
  188. package/dist/components/dist/breadcrumb.config.js +0 -43
  189. package/dist/components/dist/breadcrumb.d.ts +0 -420
  190. package/dist/components/dist/breadcrumb.js +0 -119
  191. package/dist/components/dist/button.config.d.ts +0 -381
  192. package/dist/components/dist/button.config.js +0 -91
  193. package/dist/components/dist/button.d.ts +0 -403
  194. package/dist/components/dist/button.js +0 -35
  195. package/dist/components/dist/card.config.d.ts +0 -336
  196. package/dist/components/dist/card.config.js +0 -33
  197. package/dist/components/dist/card.d.ts +0 -352
  198. package/dist/components/dist/card.js +0 -27
  199. package/dist/components/dist/collapsible.config.d.ts +0 -45
  200. package/dist/components/dist/collapsible.config.js +0 -46
  201. package/dist/components/dist/collapsible.d.ts +0 -61
  202. package/dist/components/dist/collapsible.js +0 -38
  203. package/dist/components/dist/command.config.d.ts +0 -1613
  204. package/dist/components/dist/command.config.js +0 -170
  205. package/dist/components/dist/command.d.ts +0 -1722
  206. package/dist/components/dist/command.js +0 -341
  207. package/dist/components/dist/control-color.config.d.ts +0 -979
  208. package/dist/components/dist/control-color.config.js +0 -81
  209. package/dist/components/dist/control-color.d.ts +0 -995
  210. package/dist/components/dist/control-color.js +0 -64
  211. package/dist/components/dist/control-curve.config.d.ts +0 -18
  212. package/dist/components/dist/control-curve.config.js +0 -14
  213. package/dist/components/dist/control-curve.d.ts +0 -35
  214. package/dist/components/dist/control-curve.js +0 -81
  215. package/dist/components/dist/control-folder.config.d.ts +0 -177
  216. package/dist/components/dist/control-folder.config.js +0 -47
  217. package/dist/components/dist/control-folder.d.ts +0 -194
  218. package/dist/components/dist/control-folder.js +0 -41
  219. package/dist/components/dist/control-group.config.d.ts +0 -859
  220. package/dist/components/dist/control-group.config.js +0 -80
  221. package/dist/components/dist/control-group.d.ts +0 -881
  222. package/dist/components/dist/control-group.js +0 -89
  223. package/dist/components/dist/control-knob.config.d.ts +0 -792
  224. package/dist/components/dist/control-knob.config.js +0 -67
  225. package/dist/components/dist/control-knob.d.ts +0 -819
  226. package/dist/components/dist/control-knob.js +0 -148
  227. package/dist/components/dist/control-panel.config.d.ts +0 -402
  228. package/dist/components/dist/control-panel.config.js +0 -38
  229. package/dist/components/dist/control-panel.d.ts +0 -415
  230. package/dist/components/dist/control-panel.js +0 -22
  231. package/dist/components/dist/control-select.config.d.ts +0 -1176
  232. package/dist/components/dist/control-select.config.js +0 -102
  233. package/dist/components/dist/control-select.d.ts +0 -1200
  234. package/dist/components/dist/control-select.js +0 -63
  235. package/dist/components/dist/control-slider.config.d.ts +0 -104
  236. package/dist/components/dist/control-slider.config.js +0 -98
  237. package/dist/components/dist/control-slider.d.ts +0 -127
  238. package/dist/components/dist/control-slider.js +0 -87
  239. package/dist/components/dist/control-spring.config.d.ts +0 -417
  240. package/dist/components/dist/control-spring.config.js +0 -36
  241. package/dist/components/dist/control-spring.d.ts +0 -439
  242. package/dist/components/dist/control-spring.js +0 -136
  243. package/dist/components/dist/control-stepper.config.d.ts +0 -1084
  244. package/dist/components/dist/control-stepper.config.js +0 -108
  245. package/dist/components/dist/control-stepper.d.ts +0 -1104
  246. package/dist/components/dist/control-stepper.js +0 -109
  247. package/dist/components/dist/control-toggle.config.d.ts +0 -407
  248. package/dist/components/dist/control-toggle.config.js +0 -26
  249. package/dist/components/dist/control-toggle.d.ts +0 -420
  250. package/dist/components/dist/control-toggle.js +0 -36
  251. package/dist/components/dist/createSlot.d.ts +0 -8
  252. package/dist/components/dist/createSlot.js +0 -89
  253. package/dist/components/dist/dropdown.config.d.ts +0 -920
  254. package/dist/components/dist/dropdown.config.js +0 -107
  255. package/dist/components/dist/dropdown.d.ts +0 -950
  256. package/dist/components/dist/dropdown.js +0 -92
  257. package/dist/components/dist/empty-state.config.d.ts +0 -396
  258. package/dist/components/dist/empty-state.config.js +0 -53
  259. package/dist/components/dist/empty-state.d.ts +0 -416
  260. package/dist/components/dist/empty-state.js +0 -33
  261. package/dist/components/dist/footer.d.ts +0 -11
  262. package/dist/components/dist/footer.js +0 -9
  263. package/dist/components/dist/grid.d.ts +0 -41
  264. package/dist/components/dist/grid.js +0 -34
  265. package/dist/components/dist/header.d.ts +0 -11
  266. package/dist/components/dist/header.js +0 -9
  267. package/dist/components/dist/hstack.d.ts +0 -15
  268. package/dist/components/dist/hstack.js +0 -21
  269. package/dist/components/dist/image.d.ts +0 -19
  270. package/dist/components/dist/image.js +0 -9
  271. package/dist/components/dist/input.config.d.ts +0 -58
  272. package/dist/components/dist/input.config.js +0 -42
  273. package/dist/components/dist/input.d.ts +0 -67
  274. package/dist/components/dist/input.js +0 -14
  275. package/dist/components/dist/item.config.d.ts +0 -351
  276. package/dist/components/dist/item.config.js +0 -83
  277. package/dist/components/dist/item.d.ts +0 -374
  278. package/dist/components/dist/item.js +0 -51
  279. package/dist/components/dist/list.d.ts +0 -19
  280. package/dist/components/dist/list.js +0 -21
  281. package/dist/components/dist/main.d.ts +0 -11
  282. package/dist/components/dist/main.js +0 -9
  283. package/dist/components/dist/modal.config.d.ts +0 -397
  284. package/dist/components/dist/modal.config.js +0 -92
  285. package/dist/components/dist/modal.d.ts +0 -433
  286. package/dist/components/dist/modal.js +0 -125
  287. package/dist/components/dist/nav-header.config.d.ts +0 -158
  288. package/dist/components/dist/nav-header.config.js +0 -26
  289. package/dist/components/dist/nav-header.d.ts +0 -173
  290. package/dist/components/dist/nav-header.js +0 -23
  291. package/dist/components/dist/nav.d.ts +0 -11
  292. package/dist/components/dist/nav.js +0 -9
  293. package/dist/components/dist/preset-bar.config.d.ts +0 -192
  294. package/dist/components/dist/preset-bar.config.js +0 -39
  295. package/dist/components/dist/preset-bar.d.ts +0 -215
  296. package/dist/components/dist/preset-bar.js +0 -71
  297. package/dist/components/dist/presets/index.d.ts +0 -17674
  298. package/dist/components/dist/presets/index.js +0 -97
  299. package/dist/components/dist/pressable.d.ts +0 -11
  300. package/dist/components/dist/pressable.js +0 -9
  301. package/dist/components/dist/progress.config.d.ts +0 -296
  302. package/dist/components/dist/progress.config.js +0 -35
  303. package/dist/components/dist/progress.d.ts +0 -311
  304. package/dist/components/dist/progress.js +0 -43
  305. package/dist/components/dist/section.d.ts +0 -11
  306. package/dist/components/dist/section.js +0 -9
  307. package/dist/components/dist/select.config.d.ts +0 -31
  308. package/dist/components/dist/select.config.js +0 -25
  309. package/dist/components/dist/select.d.ts +0 -45
  310. package/dist/components/dist/select.js +0 -13
  311. package/dist/components/dist/sheet.config.d.ts +0 -245
  312. package/dist/components/dist/sheet.config.js +0 -99
  313. package/dist/components/dist/sheet.d.ts +0 -267
  314. package/dist/components/dist/sheet.js +0 -53
  315. package/dist/components/dist/sidebar.config.d.ts +0 -1651
  316. package/dist/components/dist/sidebar.config.js +0 -217
  317. package/dist/components/dist/sidebar.d.ts +0 -1825
  318. package/dist/components/dist/sidebar.js +0 -492
  319. package/dist/components/dist/skeleton.config.d.ts +0 -16
  320. package/dist/components/dist/skeleton.config.js +0 -10
  321. package/dist/components/dist/skeleton.d.ts +0 -27
  322. package/dist/components/dist/skeleton.js +0 -16
  323. package/dist/components/dist/slider.config.d.ts +0 -44
  324. package/dist/components/dist/slider.config.js +0 -40
  325. package/dist/components/dist/slider.d.ts +0 -70
  326. package/dist/components/dist/slider.js +0 -247
  327. package/dist/components/dist/spinner.config.d.ts +0 -34
  328. package/dist/components/dist/spinner.config.js +0 -24
  329. package/dist/components/dist/spinner.d.ts +0 -42
  330. package/dist/components/dist/spinner.js +0 -29
  331. package/dist/components/dist/svg.d.ts +0 -21
  332. package/dist/components/dist/svg.js +0 -17
  333. package/dist/components/dist/switch.config.d.ts +0 -353
  334. package/dist/components/dist/switch.config.js +0 -47
  335. package/dist/components/dist/switch.d.ts +0 -370
  336. package/dist/components/dist/switch.js +0 -32
  337. package/dist/components/dist/table.d.ts +0 -36
  338. package/dist/components/dist/table.js +0 -29
  339. package/dist/components/dist/tabs.config.d.ts +0 -611
  340. package/dist/components/dist/tabs.config.js +0 -56
  341. package/dist/components/dist/tabs.d.ts +0 -632
  342. package/dist/components/dist/tabs.js +0 -77
  343. package/dist/components/dist/text.config.d.ts +0 -306
  344. package/dist/components/dist/text.config.js +0 -149
  345. package/dist/components/dist/text.d.ts +0 -205
  346. package/dist/components/dist/text.js +0 -12
  347. package/dist/components/dist/textarea.config.d.ts +0 -352
  348. package/dist/components/dist/textarea.config.js +0 -57
  349. package/dist/components/dist/textarea.d.ts +0 -362
  350. package/dist/components/dist/textarea.js +0 -9
  351. package/dist/components/dist/toast.config.d.ts +0 -335
  352. package/dist/components/dist/toast.config.js +0 -145
  353. package/dist/components/dist/toast.d.ts +0 -426
  354. package/dist/components/dist/toast.js +0 -159
  355. package/dist/components/dist/tooltip.config.d.ts +0 -193
  356. package/dist/components/dist/tooltip.config.js +0 -40
  357. package/dist/components/dist/tooltip.d.ts +0 -206
  358. package/dist/components/dist/tooltip.js +0 -28
  359. package/dist/components/dist/vstack.d.ts +0 -15
  360. package/dist/components/dist/vstack.js +0 -20
  361. package/dist/components/dropdown.config.d.ts +0 -2
  362. package/dist/components/dropdown.config.js +0 -2
  363. package/dist/components/dropdown.d.ts +0 -2
  364. package/dist/components/dropdown.js +0 -2
  365. package/dist/components/empty-state.config.d.ts +0 -2
  366. package/dist/components/empty-state.config.js +0 -2
  367. package/dist/components/empty-state.d.ts +0 -2
  368. package/dist/components/empty-state.js +0 -2
  369. package/dist/components/footer.d.ts +0 -2
  370. package/dist/components/footer.js +0 -2
  371. package/dist/components/grid.d.ts +0 -2
  372. package/dist/components/grid.js +0 -2
  373. package/dist/components/header.d.ts +0 -2
  374. package/dist/components/header.js +0 -2
  375. package/dist/components/hstack.d.ts +0 -2
  376. package/dist/components/hstack.js +0 -2
  377. package/dist/components/image.d.ts +0 -2
  378. package/dist/components/image.js +0 -2
  379. package/dist/components/input.config.d.ts +0 -2
  380. package/dist/components/input.config.js +0 -2
  381. package/dist/components/input.d.ts +0 -2
  382. package/dist/components/input.js +0 -2
  383. package/dist/components/item.config.d.ts +0 -2
  384. package/dist/components/item.config.js +0 -2
  385. package/dist/components/item.d.ts +0 -2
  386. package/dist/components/item.js +0 -2
  387. package/dist/components/list.d.ts +0 -2
  388. package/dist/components/list.js +0 -2
  389. package/dist/components/main.d.ts +0 -2
  390. package/dist/components/main.js +0 -2
  391. package/dist/components/modal.config.d.ts +0 -2
  392. package/dist/components/modal.config.js +0 -2
  393. package/dist/components/modal.d.ts +0 -2
  394. package/dist/components/modal.js +0 -2
  395. package/dist/components/nav-header.config.d.ts +0 -2
  396. package/dist/components/nav-header.config.js +0 -2
  397. package/dist/components/nav-header.d.ts +0 -2
  398. package/dist/components/nav-header.js +0 -2
  399. package/dist/components/nav.d.ts +0 -2
  400. package/dist/components/nav.js +0 -2
  401. package/dist/components/preset-bar.config.d.ts +0 -2
  402. package/dist/components/preset-bar.config.js +0 -2
  403. package/dist/components/preset-bar.d.ts +0 -2
  404. package/dist/components/preset-bar.js +0 -2
  405. package/dist/components/presets/index.d.ts +0 -44
  406. package/dist/components/presets/index.js +0 -44
  407. package/dist/components/pressable.d.ts +0 -2
  408. package/dist/components/pressable.js +0 -2
  409. package/dist/components/progress.config.d.ts +0 -2
  410. package/dist/components/progress.config.js +0 -2
  411. package/dist/components/progress.d.ts +0 -2
  412. package/dist/components/progress.js +0 -2
  413. package/dist/components/section.d.ts +0 -2
  414. package/dist/components/section.js +0 -2
  415. package/dist/components/select.config.d.ts +0 -2
  416. package/dist/components/select.config.js +0 -2
  417. package/dist/components/select.d.ts +0 -2
  418. package/dist/components/select.js +0 -2
  419. package/dist/components/sheet.config.d.ts +0 -2
  420. package/dist/components/sheet.config.js +0 -2
  421. package/dist/components/sheet.d.ts +0 -2
  422. package/dist/components/sheet.js +0 -2
  423. package/dist/components/sidebar.config.d.ts +0 -2
  424. package/dist/components/sidebar.config.js +0 -2
  425. package/dist/components/sidebar.d.ts +0 -2
  426. package/dist/components/sidebar.js +0 -2
  427. package/dist/components/skeleton.config.d.ts +0 -2
  428. package/dist/components/skeleton.config.js +0 -2
  429. package/dist/components/skeleton.d.ts +0 -2
  430. package/dist/components/skeleton.js +0 -2
  431. package/dist/components/slider.config.d.ts +0 -2
  432. package/dist/components/slider.config.js +0 -2
  433. package/dist/components/slider.d.ts +0 -2
  434. package/dist/components/slider.js +0 -2
  435. package/dist/components/spinner.config.d.ts +0 -2
  436. package/dist/components/spinner.config.js +0 -2
  437. package/dist/components/spinner.d.ts +0 -2
  438. package/dist/components/spinner.js +0 -2
  439. package/dist/components/svg.d.ts +0 -2
  440. package/dist/components/svg.js +0 -2
  441. package/dist/components/switch.config.d.ts +0 -2
  442. package/dist/components/switch.config.js +0 -2
  443. package/dist/components/switch.d.ts +0 -2
  444. package/dist/components/switch.js +0 -2
  445. package/dist/components/table.d.ts +0 -2
  446. package/dist/components/table.js +0 -2
  447. package/dist/components/tabs.config.d.ts +0 -2
  448. package/dist/components/tabs.config.js +0 -2
  449. package/dist/components/tabs.d.ts +0 -2
  450. package/dist/components/tabs.js +0 -2
  451. package/dist/components/text.config.d.ts +0 -2
  452. package/dist/components/text.config.js +0 -2
  453. package/dist/components/text.d.ts +0 -2
  454. package/dist/components/text.js +0 -2
  455. package/dist/components/textarea.config.d.ts +0 -2
  456. package/dist/components/textarea.config.js +0 -2
  457. package/dist/components/textarea.d.ts +0 -2
  458. package/dist/components/textarea.js +0 -2
  459. package/dist/components/toast.config.d.ts +0 -2
  460. package/dist/components/toast.config.js +0 -2
  461. package/dist/components/toast.d.ts +0 -2
  462. package/dist/components/toast.js +0 -2
  463. package/dist/components/tooltip.config.d.ts +0 -2
  464. package/dist/components/tooltip.config.js +0 -2
  465. package/dist/components/tooltip.d.ts +0 -2
  466. package/dist/components/tooltip.js +0 -2
  467. package/dist/components/vstack.d.ts +0 -2
  468. package/dist/components/vstack.js +0 -2
  469. package/dist/config/dist/component-resolution.js +0 -78
  470. package/dist/config/dist/consts/defaultColors.d.ts +0 -253
  471. package/dist/config/dist/consts/defaultColors.js +0 -252
  472. package/dist/config/dist/createComponent.d.ts +0 -1
  473. package/dist/config/dist/createComponent.js +0 -1
  474. package/dist/config/dist/preset-merge.js +0 -192
  475. package/dist/config/dist/propertyGroups.d.ts +0 -1
  476. package/dist/config/dist/propertyGroups.js +0 -414
  477. package/dist/config/dist/resolveTokenTypes.d.ts +0 -1
  478. package/dist/config/dist/resolveTokenTypes.js +0 -149
  479. package/dist/config-utils/dist/componentConfig.d.ts +0 -10
  480. package/dist/config-utils/dist/componentConfig.js +0 -11
  481. package/dist/config-utils.d.ts +0 -2
  482. package/dist/config-utils.js +0 -2
  483. package/dist/core/dist/color-opacity-map.js +0 -33
  484. package/dist/core/dist/compositeStyles.d.ts +0 -21
  485. package/dist/core/dist/compositeStyles.js +0 -51
  486. package/dist/core/dist/configurable-prop-helpers.d.ts +0 -31
  487. package/dist/core/dist/configurable-prop-helpers.js +0 -61
  488. package/dist/core/dist/createComponent.boundaries.js +0 -192
  489. package/dist/core/dist/createComponent.d.ts +0 -56
  490. package/dist/core/dist/createComponent.js +0 -67
  491. package/dist/core/dist/createComponentExample.d.ts +0 -41
  492. package/dist/core/dist/createComponentExample.js +0 -27
  493. package/dist/core/dist/createProvider.d.ts +0 -12
  494. package/dist/core/dist/createProvider.js +0 -24
  495. package/dist/core/dist/generated/stylePropsTwMap.d.ts +0 -1700
  496. package/dist/core/dist/generated/stylePropsTwMap.js +0 -570
  497. package/dist/core/dist/getComponentStyles.d.ts +0 -49
  498. package/dist/core/dist/getComponentStyles.js +0 -85
  499. package/dist/core/dist/getStyles.d.ts +0 -42
  500. package/dist/core/dist/getStyles.js +0 -300
  501. package/dist/core/dist/index.d.ts +0 -13
  502. package/dist/core/dist/index.js +0 -13
  503. package/dist/core/dist/modifier-mappings.d.ts +0 -12
  504. package/dist/core/dist/modifier-mappings.js +0 -61
  505. package/dist/core/dist/resolveMotionState.d.ts +0 -4
  506. package/dist/core/dist/resolveMotionState.js +0 -17
  507. package/dist/core/dist/resolveProps.boundaries.js +0 -131
  508. package/dist/core/dist/style-prop-data.d.ts +0 -32
  509. package/dist/core/dist/style-prop-data.js +0 -1257
  510. package/dist/core/dist/transformPreset.d.ts +0 -17
  511. package/dist/core/dist/transformPreset.js +0 -28
  512. package/dist/core/dist/withDefaultStyleProps.d.ts +0 -43
  513. package/dist/core/dist/withDefaultStyleProps.js +0 -18
  514. package/dist/core.d.ts +0 -14
  515. package/dist/core.js +0 -15
  516. package/dist/createSlot.d.ts +0 -2
  517. package/dist/createSlot.js +0 -2
  518. package/dist/fixtures.d.ts +0 -4
  519. package/dist/fixtures.js +0 -5
  520. package/dist/foundational-presets/dist/_virtual/_rolldown/runtime.js +0 -13
  521. package/dist/foundational-presets/dist/defaultPreset.d.ts +0 -1557
  522. package/dist/foundational-presets/dist/defaultPreset.js +0 -615
  523. package/dist/foundational-presets/dist/index.d.ts +0 -1
  524. package/dist/foundational-presets/dist/index.js +0 -1
  525. package/dist/foundational-presets/dist/motion.d.ts +0 -12
  526. package/dist/foundational-presets/dist/motion.js +0 -10
  527. package/dist/foundational-presets/dist/style-props.js +0 -1445
  528. package/dist/loader/dist/loader/create-component-data.js +0 -33
  529. package/dist/loader/dist/loader/create-component-lowering.js +0 -454
  530. package/dist/loader/dist/loader/data-attr-transform.js +0 -191
  531. package/dist/loader/dist/loader/dynamic-style-codegen.js +0 -97
  532. package/dist/loader/dist/loader/motion-transform.js +0 -717
  533. package/dist/loader/dist/loader/style-transform.js +0 -670
  534. package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -203
  535. package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -25
  536. package/dist/loader/dist/node_modules/react/cjs/react.development.js +0 -762
  537. package/dist/loader/dist/node_modules/react/cjs/react.production.js +0 -351
  538. package/dist/loader/dist/node_modules/react/index.js +0 -10
  539. package/dist/loader/dist/node_modules/react/jsx-runtime.js +0 -10
  540. package/dist/loader/dist/packages/core/dist/color-opacity-map.js +0 -33
  541. package/dist/loader/dist/packages/core/dist/compositeStyles.js +0 -43
  542. package/dist/loader/dist/packages/core/dist/createComponent.js +0 -6
  543. package/dist/loader/dist/packages/core/dist/createProvider.js +0 -7
  544. package/dist/loader/dist/packages/core/dist/generated/stylePropsTwMap.js +0 -570
  545. package/dist/loader/dist/packages/core/dist/getComponentStyles.js +0 -2
  546. package/dist/loader/dist/packages/core/dist/getStyles.js +0 -60
  547. package/dist/loader/dist/packages/core/dist/index.js +0 -6
  548. package/dist/loader/dist/packages/core/dist/modifier-mappings.js +0 -61
  549. package/dist/loader/dist/packages/core/dist/style-prop-data.js +0 -1257
  550. package/dist/loader/dist/packages/core/dist/withDefaultStyleProps.js +0 -1
  551. package/dist/presets/dist/defaultPreset.d.ts +0 -6
  552. package/dist/presets/dist/defaultPreset.js +0 -51
  553. package/dist/presets/dist/index.d.ts +0 -1
  554. package/dist/presets/dist/index.js +0 -1
  555. package/dist/presets/motion.d.ts +0 -2
  556. package/dist/presets/motion.js +0 -2
  557. package/dist/presets.d.ts +0 -2
  558. package/dist/presets.js +0 -3
  559. package/dist/styles.d.ts +0 -4
  560. package/dist/styles.js +0 -5
  561. package/dist/transformPreset.d.ts +0 -2
  562. package/dist/transformPreset.js +0 -3
  563. /package/dist/{config/dist/component-resolution.d.ts → loader/dist/transform-runner.d.ts} +0 -0
@@ -1,717 +0,0 @@
1
- import * as t from "@babel/types";
2
- //#region ../loader/dist/loader/motion-transform.js
3
- function isRecord(value) {
4
- return typeof value === "object" && value !== null;
5
- }
6
- function isIntrinsicJsxTagName(name) {
7
- return /^[a-z]/.test(name);
8
- }
9
- function getCustomSlotMotion(manifest, slotInfo) {
10
- const component = manifest?.components[slotInfo.componentName];
11
- if (!component || component.type !== "custom") return null;
12
- const slotMotion = component.motion?.[slotInfo.slotName];
13
- if (!isRecord(slotMotion)) return null;
14
- if (slotMotion.runtime === "css") return null;
15
- return slotMotion;
16
- }
17
- function hasAnimatePresenceAncestor(nodePath) {
18
- let current = nodePath.parentPath;
19
- while (current) {
20
- if (current.node?.type === "JSXElement" && current.node.openingElement?.name?.type === "JSXIdentifier" && current.node.openingElement.name.name === "AnimatePresence") return true;
21
- current = current.parentPath;
22
- }
23
- return false;
24
- }
25
- /**
26
- * Ensure the motion element has a `key` attribute.
27
- * AnimatePresence requires a `key` on its direct children to track exit animations.
28
- * If no `key` exists, inject `key="exit-motion"` as a stable identifier.
29
- */
30
- function ensureKeyOnMotionElement(openingElementPath) {
31
- const attributes = openingElementPath.node.attributes;
32
- if (!attributes.some((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === "key")) attributes.unshift(t.jsxAttribute(t.jsxIdentifier("key"), t.stringLiteral("exit-motion")));
33
- }
34
- /**
35
- * Build an `<AnimatePresence initial={false}>{expression}</AnimatePresence>` JSX wrapper.
36
- */
37
- function buildAnimatePresenceJsxWrapper(expression) {
38
- return t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier("AnimatePresence"), [t.jsxAttribute(t.jsxIdentifier("initial"), t.jsxExpressionContainer(t.booleanLiteral(false)))], false), t.jsxClosingElement(t.jsxIdentifier("AnimatePresence")), [t.jsxExpressionContainer(expression)], false);
39
- }
40
- /**
41
- * Check if a node path is a direct argument of a CallExpression
42
- * (e.g. the first arg of `createPortal(expr, container)`).
43
- */
44
- function isCallExpressionArg(nodePath) {
45
- const parent = nodePath.parentPath;
46
- if (!parent || parent.node?.type !== "CallExpression") return false;
47
- return parent.node.arguments.includes(nodePath.node);
48
- }
49
- /**
50
- * Auto-wrap a conditionally rendered motion element with `<AnimatePresence initial={false}>`.
51
- *
52
- * Detects three patterns from the JSXElement parent of the opening element:
53
- * - `{condition && <motion.div ...>}` (LogicalExpression with &&)
54
- * - `{condition ? <motion.div ...> : null}` (ConditionalExpression with null/false alternate)
55
- * - `{items.map(cb => <motion.div ...>)}` (CallExpression with .map())
56
- *
57
- * Also ensures the motion element has a `key` attribute, which AnimatePresence
58
- * requires to track children for exit animations.
59
- *
60
- * Returns true if wrapping was applied.
61
- */
62
- function wrapParentConditionalWithAnimatePresence(nodePath) {
63
- const jsxElementPath = nodePath.parentPath;
64
- if (!jsxElementPath || jsxElementPath.node?.type !== "JSXElement") return false;
65
- if (hasAnimatePresenceAncestor(jsxElementPath)) return false;
66
- const parentPath = jsxElementPath.parentPath;
67
- if (!parentPath) return false;
68
- const parentNode = parentPath.node;
69
- let expressionContainerPath = null;
70
- if (parentNode?.type === "LogicalExpression" && parentNode.operator === "&&" && parentNode.right === jsxElementPath.node) expressionContainerPath = parentPath.parentPath;
71
- if (parentNode?.type === "ConditionalExpression" && parentNode.consequent === jsxElementPath.node) {
72
- const alternate = parentNode.alternate;
73
- if (alternate?.type === "NullLiteral" || alternate?.type === "BooleanLiteral" && alternate.value === false || alternate?.type === "Identifier" && alternate.name === "null") expressionContainerPath = parentPath.parentPath;
74
- }
75
- if (!expressionContainerPath) expressionContainerPath = findMapExpressionContainer(jsxElementPath);
76
- ensureKeyOnMotionElement(nodePath);
77
- if (expressionContainerPath?.node?.type === "JSXExpressionContainer") {
78
- const originalExpression = expressionContainerPath.node.expression;
79
- expressionContainerPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
80
- return true;
81
- }
82
- if (parentPath && isCallExpressionArg(parentPath)) {
83
- const originalExpression = t.cloneNode(parentPath.node, true);
84
- parentPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
85
- return true;
86
- }
87
- return false;
88
- }
89
- /**
90
- * Find the JSXExpressionContainer ancestor of a `.map()` call that returns
91
- * the given JSX element.
92
- *
93
- * Walks up from the JSXElement through:
94
- * JSXElement → (optional ParenthesizedExpression) → ArrowFunctionExpression body
95
- * OR JSXElement → ReturnStatement → BlockStatement → ArrowFunctionExpression/FunctionExpression
96
- * → CallExpression(.map) argument → CallExpression → JSXExpressionContainer
97
- */
98
- function findMapExpressionContainer(jsxElementPath) {
99
- let current = jsxElementPath;
100
- while (current.parentPath?.node?.type === "ParenthesizedExpression") current = current.parentPath;
101
- let callbackPath = current.parentPath;
102
- if (callbackPath?.node?.type === "ArrowFunctionExpression" && callbackPath.node.body === current.node) {} else {
103
- if (current.parentPath?.node?.type !== "ReturnStatement") return null;
104
- const blockPath = current.parentPath.parentPath;
105
- if (blockPath?.node?.type !== "BlockStatement") return null;
106
- callbackPath = blockPath.parentPath;
107
- if (callbackPath?.node?.type !== "ArrowFunctionExpression" && callbackPath?.node?.type !== "FunctionExpression") return null;
108
- }
109
- const callExprPath = callbackPath.parentPath;
110
- if (callExprPath?.node?.type !== "CallExpression") return null;
111
- const callee = callExprPath.node.callee;
112
- if (callee?.type !== "MemberExpression" || callee.property?.type !== "Identifier" || callee.property.name !== "map") return null;
113
- const containerPath = callExprPath.parentPath;
114
- if (containerPath?.node?.type === "JSXExpressionContainer") return containerPath;
115
- return null;
116
- }
117
- /**
118
- * Convert a jsxs callee to its jsx (single-child) equivalent.
119
- * e.g. identifier `jsxs` → `jsx`, member `_runtime.jsxs` → `_runtime.jsx`
120
- */
121
- function toSingleChildJsxCallee(callee) {
122
- const cloned = t.cloneNode(callee, true);
123
- if (t.isIdentifier(cloned) && cloned.name.endsWith("s")) {
124
- cloned.name = cloned.name.slice(0, -1);
125
- return cloned;
126
- }
127
- if ((t.isMemberExpression(cloned) || t.isOptionalMemberExpression(cloned)) && t.isIdentifier(cloned.property) && cloned.property.name.endsWith("s")) {
128
- cloned.property = t.identifier(cloned.property.name.slice(0, -1));
129
- return cloned;
130
- }
131
- return cloned;
132
- }
133
- /**
134
- * Auto-wrap a compiled JSX call expression that has exit motion with AnimatePresence.
135
- *
136
- * Detects three patterns:
137
- * - `condition && _jsx(motion.div, ...)` (LogicalExpression with &&)
138
- * - `condition ? _jsx(motion.div, ...) : null` (ConditionalExpression with null/false)
139
- * - `items.map(cb => _jsx(motion.div, ...))` (CallExpression with .map())
140
- *
141
- * Wraps the expression with: `_jsx(AnimatePresence, { initial: false, children: ... })`
142
- */
143
- function wrapCompiledConditionalWithAnimatePresence(nodePath, jsxCallee) {
144
- const parentPath = nodePath.parentPath;
145
- if (!parentPath) return false;
146
- const parentNode = parentPath.node;
147
- let targetPath = null;
148
- if (parentNode?.type === "LogicalExpression" && parentNode.operator === "&&" && parentNode.right === nodePath.node) targetPath = parentPath;
149
- if (parentNode?.type === "ConditionalExpression" && parentNode.consequent === nodePath.node) {
150
- const alternate = parentNode.alternate;
151
- if (alternate?.type === "NullLiteral" || alternate?.type === "BooleanLiteral" && alternate.value === false || alternate?.type === "Identifier" && alternate.name === "null") targetPath = parentPath;
152
- }
153
- if (!targetPath) targetPath = findCompiledMapCallExpression(nodePath);
154
- if (!targetPath) return false;
155
- const singleChildCallee = toSingleChildJsxCallee(jsxCallee);
156
- const originalExpression = t.cloneNode(targetPath.node, true);
157
- const animatePresenceCall = t.callExpression(singleChildCallee, [t.identifier("AnimatePresence"), t.objectExpression([t.objectProperty(t.identifier("initial"), t.booleanLiteral(false)), t.objectProperty(t.identifier("children"), originalExpression)])]);
158
- targetPath.replaceWith(animatePresenceCall);
159
- return true;
160
- }
161
- /**
162
- * Find the .map() CallExpression ancestor of a compiled JSX call.
163
- *
164
- * Walks up from _jsx(motion.div, ...) through:
165
- * CallExpression → ArrowFunctionExpression body (or ReturnStatement → BlockStatement → fn)
166
- * → CallExpression(.map) argument → CallExpression(.map)
167
- */
168
- function findCompiledMapCallExpression(nodePath) {
169
- let callbackPath = nodePath.parentPath;
170
- if (callbackPath?.node?.type === "ArrowFunctionExpression" && callbackPath.node.body === nodePath.node) {} else {
171
- if (nodePath.parentPath?.node?.type !== "ReturnStatement") return null;
172
- const blockPath = nodePath.parentPath.parentPath;
173
- if (blockPath?.node?.type !== "BlockStatement") return null;
174
- callbackPath = blockPath.parentPath;
175
- if (callbackPath?.node?.type !== "ArrowFunctionExpression" && callbackPath?.node?.type !== "FunctionExpression") return null;
176
- }
177
- const mapCallPath = callbackPath.parentPath;
178
- if (mapCallPath?.node?.type !== "CallExpression") return null;
179
- const callee = mapCallPath.node.callee;
180
- if (callee?.type !== "MemberExpression" || callee.property?.type !== "Identifier" || callee.property.name !== "map") return null;
181
- return mapCallPath;
182
- }
183
- /**
184
- * Check if a custom component in the manifest has any slot with exit motion.
185
- */
186
- function componentHasExitMotion(manifest, componentName) {
187
- const component = manifest?.components[componentName];
188
- if (!component || !component.motion) return false;
189
- for (const slotMotion of Object.values(component.motion)) if (isRecord(slotMotion) && slotMotion.exit !== void 0) return true;
190
- return false;
191
- }
192
- /**
193
- * Auto-wrap a custom component with exit motion in AnimatePresence when used
194
- * inside a conditional or .map() pattern.
195
- *
196
- * Unlike `wrapParentConditionalWithAnimatePresence` (which works on slot elements
197
- * inside createComponent), this works on custom component JSX usage sites
198
- * (e.g. `<Toast>` inside a createProvider or any other context).
199
- *
200
- * Returns true if wrapping was applied.
201
- */
202
- function wrapCustomComponentWithAnimatePresence(nodePath) {
203
- const jsxElementPath = nodePath.parentPath;
204
- if (!jsxElementPath || jsxElementPath.node?.type !== "JSXElement") return false;
205
- if (hasAnimatePresenceAncestor(jsxElementPath)) return false;
206
- const parentPath = jsxElementPath.parentPath;
207
- if (!parentPath) return false;
208
- const parentNode = parentPath.node;
209
- let expressionContainerPath = null;
210
- if (parentNode?.type === "LogicalExpression" && parentNode.operator === "&&" && parentNode.right === jsxElementPath.node) expressionContainerPath = parentPath.parentPath;
211
- if (parentNode?.type === "ConditionalExpression" && parentNode.consequent === jsxElementPath.node) {
212
- const alternate = parentNode.alternate;
213
- if (alternate?.type === "NullLiteral" || alternate?.type === "BooleanLiteral" && alternate.value === false || alternate?.type === "Identifier" && alternate.name === "null") expressionContainerPath = parentPath.parentPath;
214
- }
215
- if (!expressionContainerPath) expressionContainerPath = findMapExpressionContainer(jsxElementPath);
216
- if (expressionContainerPath?.node?.type === "JSXExpressionContainer") {
217
- const originalExpression = expressionContainerPath.node.expression;
218
- expressionContainerPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
219
- return true;
220
- }
221
- if (parentPath && isCallExpressionArg(parentPath)) {
222
- const originalExpression = t.cloneNode(parentPath.node, true);
223
- parentPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
224
- return true;
225
- }
226
- return false;
227
- }
228
- function ensureMotionWrappedJsxElement(nodePath) {
229
- const nameNode = nodePath.node.name;
230
- if (nameNode.type !== "JSXIdentifier") return false;
231
- if (!isIntrinsicJsxTagName(nameNode.name)) return false;
232
- const intrinsicTagName = nameNode.name;
233
- nodePath.node.name = t.jsxMemberExpression(t.jsxIdentifier("motion"), t.jsxIdentifier(intrinsicTagName));
234
- const parent = nodePath.parent;
235
- if (parent.type === "JSXElement" && parent.closingElement) {
236
- if (parent.closingElement.name.type === "JSXIdentifier") parent.closingElement.name = t.jsxMemberExpression(t.jsxIdentifier("motion"), t.jsxIdentifier(intrinsicTagName));
237
- }
238
- return true;
239
- }
240
- function setJsxAttributeIfMissing(nodePath, key, value) {
241
- if (value === void 0) return false;
242
- if (nodePath.node.attributes.some((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === key)) return false;
243
- nodePath.node.attributes.push(t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(t.valueToNode(value))));
244
- return true;
245
- }
246
- /**
247
- * Check if a value is an InterpolateMarker object.
248
- */
249
- function isInterpolateMarker(value) {
250
- return typeof value === "object" && value !== null && value.__type === "interpolate";
251
- }
252
- /**
253
- * Check if a state map contains any InterpolateMarker values.
254
- */
255
- function hasInterpolateMarkers(stateMap) {
256
- for (const stateKeyframe of Object.values(stateMap)) {
257
- if (!stateKeyframe || typeof stateKeyframe !== "object") continue;
258
- for (const value of Object.values(stateKeyframe)) if (isInterpolateMarker(value)) return true;
259
- }
260
- return false;
261
- }
262
- /**
263
- * Extract data-attribute conditional keyframes from inside `slotMotion.animate`.
264
- * Looks for any key matching `data-*` (e.g. `'data-state'`, `'data-side'`).
265
- * Returns `{ attr, stateMap }` for the first match, or null if none found.
266
- */
267
- function extractDataAttrModifiers(slotMotion) {
268
- const animate = slotMotion.animate;
269
- if (!animate || typeof animate !== "object") return null;
270
- for (const [key, value] of Object.entries(animate)) if (key.startsWith("data-") && value && typeof value === "object") return {
271
- attr: key,
272
- stateMap: value
273
- };
274
- return null;
275
- }
276
- /**
277
- * Get the base animate object with all `data-*` keys removed.
278
- */
279
- function getBaseAnimate(animate) {
280
- if (!animate || typeof animate !== "object") return {};
281
- const base = {};
282
- for (const [key, value] of Object.entries(animate)) if (!key.startsWith("data-")) base[key] = value;
283
- return base;
284
- }
285
- /**
286
- * Track hoisted motion states constants to be injected at module scope.
287
- * Each entry maps a unique variable name to its states config object.
288
- */
289
- const hoistedMotionStates = /* @__PURE__ */ new Map();
290
- /**
291
- * Get the hoisted motion states map for injection into the AST.
292
- * Called by the loader after traversal to inject const declarations.
293
- */
294
- function getHoistedMotionStates() {
295
- return hoistedMotionStates;
296
- }
297
- /**
298
- * Clear hoisted motion states (call at start of each file transform).
299
- */
300
- function clearHoistedMotionStates() {
301
- hoistedMotionStates.clear();
302
- }
303
- let motionStatesCounter = 0;
304
- /**
305
- * Build an animate expression that wraps state keyframes with resolveMotionState.
306
- *
307
- * For a ternary data-state={expanded ? 'expanded' : 'collapsed'} with interpolate markers:
308
- * animate={__rms(expanded ? __states.expanded : __states.collapsed, index)}
309
- *
310
- * Without interpolate markers (plain keyframes), produces direct keyframe objects:
311
- * animate={expanded ? { rotate: 180 } : { rotate: 0 }}
312
- */
313
- function buildInterpolateAnimateExpr(stateExpr, _stateMap, stateValues, statesVarName, indexExpr, _baseAnimate) {
314
- let stateKeyframeExpr;
315
- if (stateExpr.type === "ConditionalExpression" && stateExpr.consequent.type === "StringLiteral" && stateExpr.alternate.type === "StringLiteral" && stateValues.length === 2) stateKeyframeExpr = t.conditionalExpression(stateExpr.test, t.memberExpression(t.identifier(statesVarName), t.identifier(stateExpr.consequent.value)), t.memberExpression(t.identifier(statesVarName), t.identifier(stateExpr.alternate.value)));
316
- else if (stateExpr.type === "StringLiteral") stateKeyframeExpr = t.memberExpression(t.identifier(statesVarName), t.identifier(stateExpr.value));
317
- else {
318
- let result = t.memberExpression(t.identifier(statesVarName), t.identifier(stateValues[0]));
319
- for (const sv of [...stateValues].reverse()) result = t.conditionalExpression(t.binaryExpression("===", stateExpr, t.stringLiteral(sv)), t.memberExpression(t.identifier(statesVarName), t.identifier(sv)), result);
320
- stateKeyframeExpr = result;
321
- }
322
- return t.callExpression(t.identifier("__rms"), [stateKeyframeExpr, indexExpr]);
323
- }
324
- /**
325
- * Transform data-attribute modifiers on a slot element.
326
- *
327
- * When the motion config has:
328
- * `animate: { 'data-state': { open: { rotate: 180 }, closed: { rotate: 0 } } }`
329
- * and the element has `data-state={isOpen ? 'open' : 'closed'}`, the loader:
330
- * 1. Keeps the data attribute (still needed for CSS modifiers)
331
- * 2. Extracts the condition from the ternary expression
332
- * 3. Generates: `animate={isOpen ? { rotate: 180 } : { rotate: 0 }}`
333
- * 4. Sets `initial={false}` to prevent animation on first render
334
- *
335
- * When state keyframes contain InterpolateMarker objects, the loader:
336
- * 1. Finds `data-motion-index` on the element for the index expression
337
- * 2. Hoists state keyframes as a module-scope constant
338
- * 3. Generates: `animate={__rms(stateKeyframe, index)}`
339
- * 4. Removes `data-motion-index` from DOM attributes
340
- * 5. Adds `@uds/core` import for `resolveMotionState`
341
- *
342
- * Returns `{ applied, needsResolveMotionStateImport }`.
343
- */
344
- function transformDataModifiers(nodePath, slotMotion) {
345
- const dataAttrInfo = extractDataAttrModifiers(slotMotion);
346
- if (!dataAttrInfo) return {
347
- applied: false,
348
- needsResolveMotionStateImport: false
349
- };
350
- const { attr: dataAttrName, stateMap } = dataAttrInfo;
351
- const stateValues = Object.keys(stateMap);
352
- if (stateValues.length === 0) return {
353
- applied: false,
354
- needsResolveMotionStateImport: false
355
- };
356
- const attributes = nodePath.node.attributes;
357
- const attrIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === dataAttrName);
358
- if (attrIndex === -1) return {
359
- applied: false,
360
- needsResolveMotionStateImport: false
361
- };
362
- const attr = attributes[attrIndex];
363
- if (attr.type !== "JSXAttribute") return {
364
- applied: false,
365
- needsResolveMotionStateImport: false
366
- };
367
- const needsInterpolation = hasInterpolateMarkers(stateMap);
368
- let animateExpr = null;
369
- let needsResolveMotionStateImport = false;
370
- const baseAnimate = getBaseAnimate(slotMotion.animate);
371
- let stateExpr = null;
372
- if (attr.value?.type === "JSXExpressionContainer" && attr.value.expression.type !== "JSXEmptyExpression") stateExpr = attr.value.expression;
373
- else if (attr.value?.type === "StringLiteral") stateExpr = t.stringLiteral(attr.value.value);
374
- if (!stateExpr) return {
375
- applied: false,
376
- needsResolveMotionStateImport: false
377
- };
378
- if (needsInterpolation) {
379
- const indexAttrIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === "data-motion-index");
380
- if (indexAttrIndex === -1) return {
381
- applied: false,
382
- needsResolveMotionStateImport: false
383
- };
384
- const indexAttr = attributes[indexAttrIndex];
385
- let indexExpr = null;
386
- if (indexAttr.value?.type === "JSXExpressionContainer" && indexAttr.value.expression.type !== "JSXEmptyExpression") indexExpr = indexAttr.value.expression;
387
- else if (indexAttr.value?.type === "StringLiteral") indexExpr = t.numericLiteral(Number.parseInt(indexAttr.value.value, 10));
388
- if (!indexExpr) return {
389
- applied: false,
390
- needsResolveMotionStateImport: false
391
- };
392
- const statesVarName = `__motion_states_${motionStatesCounter++}`;
393
- hoistedMotionStates.set(statesVarName, stateMap);
394
- animateExpr = buildInterpolateAnimateExpr(stateExpr, stateMap, stateValues, statesVarName, indexExpr, baseAnimate);
395
- needsResolveMotionStateImport = true;
396
- attributes.splice(indexAttrIndex, 1);
397
- } else {
398
- if (stateExpr.type === "StringLiteral") {
399
- const staticValue = stateExpr.value;
400
- animateExpr = stateMap[staticValue] ? t.valueToNode(stateMap[staticValue]) : t.valueToNode(baseAnimate);
401
- } else if (stateExpr.type === "ConditionalExpression" && stateValues.length === 2) {
402
- const { test, consequent, alternate } = stateExpr;
403
- const consequentValue = consequent.type === "StringLiteral" ? consequent.value : null;
404
- const alternateValue = alternate.type === "StringLiteral" ? alternate.value : null;
405
- if (consequentValue && alternateValue && stateMap[consequentValue] !== void 0 && stateMap[alternateValue] !== void 0) animateExpr = t.conditionalExpression(test, t.valueToNode(stateMap[consequentValue]), t.valueToNode(stateMap[alternateValue]));
406
- }
407
- if (!animateExpr) {
408
- let result = t.valueToNode(baseAnimate);
409
- for (const stateValue of [...stateValues].reverse()) result = t.conditionalExpression(t.binaryExpression("===", stateExpr, t.stringLiteral(stateValue)), t.valueToNode(stateMap[stateValue]), result);
410
- animateExpr = result;
411
- }
412
- }
413
- if (!animateExpr) return {
414
- applied: false,
415
- needsResolveMotionStateImport: false
416
- };
417
- const existingAnimateIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === "animate");
418
- const animateAttr = t.jsxAttribute(t.jsxIdentifier("animate"), t.jsxExpressionContainer(animateExpr));
419
- if (existingAnimateIndex !== -1) attributes[existingAnimateIndex] = animateAttr;
420
- else attributes.push(animateAttr);
421
- const existingInitialIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === "initial");
422
- const initialValue = slotMotion.initial ? t.valueToNode(slotMotion.initial) : t.booleanLiteral(false);
423
- const initialAttr = t.jsxAttribute(t.jsxIdentifier("initial"), t.jsxExpressionContainer(initialValue));
424
- if (existingInitialIndex !== -1) attributes[existingInitialIndex] = initialAttr;
425
- else attributes.push(initialAttr);
426
- return {
427
- applied: true,
428
- needsResolveMotionStateImport
429
- };
430
- }
431
- /**
432
- * Detect and transform a boolean-toggle `animate` attribute on a slot element.
433
- *
434
- * When a component author writes `animate={expression}` where the expression
435
- * is NOT an ObjectExpression (e.g. `animate={isOpen}`), and the slot motion
436
- * config has both `initial` and `animate`, the expression is treated as a
437
- * boolean toggle condition. The loader transforms it to:
438
- *
439
- * initial={false}
440
- * animate={expression ? configAnimate : configInitial}
441
- *
442
- * This lets the component author signal *when* to toggle between states,
443
- * while the config defines *what* those states are.
444
- *
445
- * Returns true if the toggle transform was applied.
446
- */
447
- function transformToggleAnimate(nodePath, slotMotion) {
448
- if (!slotMotion.initial || !slotMotion.animate) return false;
449
- const animateAttrIndex = nodePath.node.attributes.findIndex((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === "animate");
450
- if (animateAttrIndex === -1) return false;
451
- const animateAttr = nodePath.node.attributes[animateAttrIndex];
452
- if (animateAttr.type !== "JSXAttribute") return false;
453
- let conditionExpr = null;
454
- if (animateAttr.value?.type === "JSXExpressionContainer" && animateAttr.value.expression.type !== "JSXEmptyExpression") {
455
- const expr = animateAttr.value.expression;
456
- if (expr.type === "ObjectExpression") return false;
457
- conditionExpr = expr;
458
- }
459
- if (!conditionExpr) return false;
460
- animateAttr.value = t.jsxExpressionContainer(t.conditionalExpression(conditionExpr, t.valueToNode(slotMotion.animate), t.valueToNode(slotMotion.initial)));
461
- const initialAttrIndex = nodePath.node.attributes.findIndex((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === "initial");
462
- const initialFalseAttr = t.jsxAttribute(t.jsxIdentifier("initial"), t.jsxExpressionContainer(t.booleanLiteral(false)));
463
- if (initialAttrIndex !== -1) nodePath.node.attributes[initialAttrIndex] = initialFalseAttr;
464
- else nodePath.node.attributes.push(initialFalseAttr);
465
- return true;
466
- }
467
- function applySlotMotionToElement(nodePath, slotMotion, options) {
468
- if (!ensureMotionWrappedJsxElement(nodePath)) return {
469
- transformed: false,
470
- needsResolveMotionStateImport: false
471
- };
472
- if (options?.injectAttributes === false) return {
473
- transformed: true,
474
- needsResolveMotionStateImport: false
475
- };
476
- const dataModResult = transformDataModifiers(nodePath, slotMotion);
477
- const hasDataModifier = dataModResult.applied;
478
- const needsResolveMotionStateImport = dataModResult.needsResolveMotionStateImport;
479
- const isToggle = !hasDataModifier && transformToggleAnimate(nodePath, slotMotion);
480
- let transformed = hasDataModifier || isToggle;
481
- if (!hasDataModifier && !isToggle) {
482
- transformed = setJsxAttributeIfMissing(nodePath, "initial", slotMotion.initial) || transformed;
483
- const baseAnimate = getBaseAnimate(slotMotion.animate);
484
- transformed = setJsxAttributeIfMissing(nodePath, "animate", Object.keys(baseAnimate).length > 0 ? baseAnimate : slotMotion.animate) || transformed;
485
- }
486
- transformed = setJsxAttributeIfMissing(nodePath, "exit", slotMotion.exit) || transformed;
487
- transformed = setJsxAttributeIfMissing(nodePath, "transition", slotMotion.transition) || transformed;
488
- transformed = setJsxAttributeIfMissing(nodePath, "whileHover", slotMotion.whileHover) || transformed;
489
- transformed = setJsxAttributeIfMissing(nodePath, "whileTap", slotMotion.whileTap) || transformed;
490
- transformed = setJsxAttributeIfMissing(nodePath, "drag", slotMotion.drag) || transformed;
491
- transformed = setJsxAttributeIfMissing(nodePath, "dragConstraints", slotMotion.dragConstraints) || transformed;
492
- transformed = setJsxAttributeIfMissing(nodePath, "dragElastic", slotMotion.dragElastic) || transformed;
493
- transformed = setJsxAttributeIfMissing(nodePath, "dragSnapToOrigin", slotMotion.dragSnapToOrigin) || transformed;
494
- transformed = setJsxAttributeIfMissing(nodePath, "layout", slotMotion.layout) || transformed;
495
- return {
496
- transformed,
497
- needsResolveMotionStateImport
498
- };
499
- }
500
- /**
501
- * Handle motion transforms on a JSX opening element.
502
- * Returns true if the element was transformed.
503
- */
504
- function handleMotionOnElement(nodePath, manifest, customComponents, primitiveComponents, importsToAdd) {
505
- const nameNode = nodePath.node.name;
506
- if (nameNode.type !== "JSXIdentifier") return false;
507
- const componentName = nameNode.name;
508
- const motionAttrIndex = nodePath.node.attributes.findIndex((attr) => attr.type === "JSXAttribute" && attr.name.name === "motion");
509
- if (motionAttrIndex === -1) return false;
510
- if (!manifest) return false;
511
- if (primitiveComponents.has(componentName)) {
512
- const motionAttr = nodePath.node.attributes[motionAttrIndex];
513
- if (motionAttr.type !== "JSXAttribute") return false;
514
- const valueNode = motionAttr.value;
515
- if (!valueNode) return false;
516
- let presetName = null;
517
- if (valueNode.type === "StringLiteral") presetName = valueNode.value;
518
- else if (valueNode.type === "JSXExpressionContainer" && valueNode.expression.type !== "JSXEmptyExpression") if (valueNode.expression.type === "StringLiteral") presetName = valueNode.expression.value;
519
- else {
520
- swapMotionComponent(nodePath, {
521
- componentName: `${componentName}WithInlineMotion`,
522
- importPath: `.uds/motion-components/${componentName}WithInlineMotion`
523
- }, importsToAdd);
524
- return true;
525
- }
526
- if (!presetName) return false;
527
- const presetInfo = manifest.presets[presetName];
528
- if (!presetInfo) return false;
529
- nodePath.node.attributes.splice(motionAttrIndex, 1);
530
- if (presetInfo.runtime === "css") injectMotionCssClass(nodePath, presetName);
531
- else {
532
- const compInfo = manifest.components[componentName]?.presets[presetName];
533
- if (!compInfo) return false;
534
- swapMotionComponent(nodePath, compInfo, importsToAdd);
535
- }
536
- return true;
537
- }
538
- if (customComponents?.has(componentName)) {
539
- const motionAttr = nodePath.node.attributes[motionAttrIndex];
540
- if (motionAttr.type !== "JSXAttribute") return false;
541
- const valueNode = motionAttr.value;
542
- if (!valueNode || valueNode.type !== "StringLiteral") return false;
543
- const presetName = valueNode.value;
544
- const presetInfo = manifest.presets[presetName];
545
- if (!presetInfo) return false;
546
- nodePath.node.attributes.splice(motionAttrIndex, 1);
547
- if (presetInfo.runtime === "css") injectCustomComponentCssClass(nodePath, presetName);
548
- return true;
549
- }
550
- return false;
551
- }
552
- /**
553
- * Inject a `motion-{presetName}` CSS class into the className of a JSX element.
554
- */
555
- function injectMotionCssClass(nodePath, presetName) {
556
- const classNameAttr = nodePath.node.attributes.find((attr) => attr.type === "JSXAttribute" && attr.name.name === "className");
557
- if (classNameAttr && classNameAttr.type === "JSXAttribute") {
558
- if (classNameAttr.value?.type === "StringLiteral") classNameAttr.value.value += ` motion-${presetName}`;
559
- else if (classNameAttr.value?.type === "JSXExpressionContainer" && classNameAttr.value.expression.type !== "JSXEmptyExpression") {
560
- const existingExpr = classNameAttr.value.expression;
561
- classNameAttr.value = t.jsxExpressionContainer(t.templateLiteral([t.templateElement({
562
- raw: "",
563
- cooked: ""
564
- }), t.templateElement({
565
- raw: ` motion-${presetName}`,
566
- cooked: ` motion-${presetName}`
567
- }, true)], [existingExpr]));
568
- }
569
- } else nodePath.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("className"), t.stringLiteral(`motion-${presetName}`)));
570
- }
571
- /**
572
- * Inject a `motion-{presetName}` class into a custom component's internal class prop.
573
- */
574
- function injectCustomComponentCssClass(nodePath, presetName) {
575
- const classNameAttr = nodePath.node.attributes.find((attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === "data-uds-class");
576
- if (classNameAttr) {
577
- if (classNameAttr.value?.type === "StringLiteral") classNameAttr.value.value += ` motion-${presetName}`;
578
- else if (classNameAttr.value?.type === "JSXExpressionContainer" && classNameAttr.value.expression.type !== "JSXEmptyExpression") {
579
- const existingExpr = classNameAttr.value.expression;
580
- classNameAttr.value = t.jsxExpressionContainer(t.templateLiteral([t.templateElement({
581
- raw: "",
582
- cooked: ""
583
- }), t.templateElement({
584
- raw: ` motion-${presetName}`,
585
- cooked: ` motion-${presetName}`
586
- }, true)], [existingExpr]));
587
- }
588
- } else nodePath.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("data-uds-class"), t.stringLiteral(`motion-${presetName}`)));
589
- }
590
- /**
591
- * Swap a JSX component to a generated motion wrapper component (JS runtime).
592
- */
593
- function swapMotionComponent(nodePath, compInfo, importsToAdd) {
594
- const nameNode = nodePath.node.name;
595
- nameNode.name = compInfo.componentName;
596
- const parent = nodePath.parent;
597
- if (parent.type === "JSXElement" && parent.closingElement) {
598
- const closingName = parent.closingElement.name;
599
- if (closingName.type === "JSXIdentifier") closingName.name = compInfo.componentName;
600
- }
601
- importsToAdd.set(compInfo.componentName, compInfo.importPath);
602
- }
603
- function hasCompiledProp(propsArg, key) {
604
- return propsArg.properties.some((prop) => prop.type === "ObjectProperty" && (prop.key.type === "Identifier" && prop.key.name === key || prop.key.type === "StringLiteral" && prop.key.value === key));
605
- }
606
- /**
607
- * Find a compiled prop by key and return its value node.
608
- */
609
- function getCompiledPropValue(propsArg, key) {
610
- for (const prop of propsArg.properties) {
611
- if (prop.type !== "ObjectProperty") continue;
612
- if (prop.key.type === "Identifier" && prop.key.name === key || prop.key.type === "StringLiteral" && prop.key.value === key) return prop.value;
613
- }
614
- return null;
615
- }
616
- /**
617
- * Handle data-attribute modifiers in compiled JSX.
618
- * Finds the matching data-* prop, extracts the condition, and builds
619
- * a ternary animate expression.
620
- */
621
- function handleCompiledDataAttrModifiers(propsArg, slotMotion) {
622
- const dataAttrInfo = extractDataAttrModifiers(slotMotion);
623
- if (!dataAttrInfo) return {
624
- applied: false,
625
- needsResolveMotionStateImport: false
626
- };
627
- const { attr: dataAttrName, stateMap } = dataAttrInfo;
628
- const stateValues = Object.keys(stateMap);
629
- if (stateValues.length === 0) return {
630
- applied: false,
631
- needsResolveMotionStateImport: false
632
- };
633
- const dataStateValue = getCompiledPropValue(propsArg, dataAttrName);
634
- if (!dataStateValue) return {
635
- applied: false,
636
- needsResolveMotionStateImport: false
637
- };
638
- const needsInterpolation = hasInterpolateMarkers(stateMap);
639
- let animateExpr = null;
640
- let needsResolveMotionStateImport = false;
641
- if (needsInterpolation) {
642
- const indexValue = getCompiledPropValue(propsArg, "data-motion-index");
643
- if (!indexValue) return {
644
- applied: false,
645
- needsResolveMotionStateImport: false
646
- };
647
- const statesVarName = `__motion_states_${motionStatesCounter++}`;
648
- hoistedMotionStates.set(statesVarName, stateMap);
649
- animateExpr = buildInterpolateAnimateExpr(dataStateValue, stateMap, stateValues, statesVarName, indexValue, {});
650
- needsResolveMotionStateImport = true;
651
- propsArg.properties = propsArg.properties.filter((prop) => {
652
- if (prop.type !== "ObjectProperty") return true;
653
- return (prop.key.type === "Identifier" ? prop.key.name : prop.key.type === "StringLiteral" ? prop.key.value : null) !== "data-motion-index";
654
- });
655
- } else {
656
- const baseAnimate = getBaseAnimate(slotMotion.animate);
657
- if (dataStateValue.type === "ConditionalExpression" && stateValues.length === 2) {
658
- const { test, consequent, alternate } = dataStateValue;
659
- const consequentValue = consequent.type === "StringLiteral" ? consequent.value : null;
660
- const alternateValue = alternate.type === "StringLiteral" ? alternate.value : null;
661
- if (consequentValue && alternateValue && stateMap[consequentValue] !== void 0 && stateMap[alternateValue] !== void 0) animateExpr = t.conditionalExpression(test, t.valueToNode(stateMap[consequentValue]), t.valueToNode(stateMap[alternateValue]));
662
- }
663
- if (!animateExpr) {
664
- let result = t.valueToNode(baseAnimate);
665
- for (const stateValue of [...stateValues].reverse()) result = t.conditionalExpression(t.binaryExpression("===", dataStateValue, t.stringLiteral(stateValue)), t.valueToNode(stateMap[stateValue]), result);
666
- animateExpr = result;
667
- }
668
- }
669
- if (!animateExpr) return {
670
- applied: false,
671
- needsResolveMotionStateImport: false
672
- };
673
- const initialValue = slotMotion.initial ? t.valueToNode(slotMotion.initial) : t.booleanLiteral(false);
674
- propsArg.properties.push(t.objectProperty(t.identifier("animate"), animateExpr), t.objectProperty(t.identifier("initial"), initialValue));
675
- return {
676
- applied: true,
677
- needsResolveMotionStateImport
678
- };
679
- }
680
- function applySlotMotionToCompiledJsx(args, propsArg, slotMotion) {
681
- const tagArg = args[0];
682
- let transformed = false;
683
- let canApplyMotionProps = false;
684
- let needsResolveMotionStateImport = false;
685
- if (tagArg?.type === "StringLiteral" && isIntrinsicJsxTagName(tagArg.value)) {
686
- args[0] = t.memberExpression(t.identifier("motion"), t.identifier(tagArg.value));
687
- transformed = true;
688
- canApplyMotionProps = true;
689
- } else if (tagArg?.type === "MemberExpression" && tagArg.object?.type === "Identifier" && tagArg.object.name === "motion") canApplyMotionProps = true;
690
- if (!canApplyMotionProps) return {
691
- transformed: false,
692
- needsMotionImport: false,
693
- hasExit: false,
694
- needsResolveMotionStateImport: false
695
- };
696
- const dataModResult = handleCompiledDataAttrModifiers(propsArg, slotMotion);
697
- const hasDataStateModifier = dataModResult.applied;
698
- if (dataModResult.needsResolveMotionStateImport) needsResolveMotionStateImport = true;
699
- for (const [key, value] of Object.entries(slotMotion)) {
700
- if (key === "runtime" || value === void 0 || hasCompiledProp(propsArg, key)) continue;
701
- propsArg.properties.push(t.objectProperty(t.identifier(key), t.valueToNode(value)));
702
- transformed = true;
703
- }
704
- if (hasDataStateModifier) transformed = true;
705
- const hasExit = slotMotion.exit !== void 0;
706
- if (hasExit) {
707
- if (args.length < 3) args.push(t.stringLiteral("exit-motion"));
708
- }
709
- return {
710
- transformed,
711
- needsMotionImport: transformed,
712
- hasExit,
713
- needsResolveMotionStateImport
714
- };
715
- }
716
- //#endregion
717
- export { applySlotMotionToCompiledJsx, applySlotMotionToElement, clearHoistedMotionStates, componentHasExitMotion, getCustomSlotMotion, getHoistedMotionStates, handleMotionOnElement, wrapCompiledConditionalWithAnimatePresence, wrapCustomComponentWithAnimatePresence, wrapParentConditionalWithAnimatePresence };