@vizejs/ui 0.387.0 → 0.388.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 (411) hide show
  1. package/dist/alert-BX93FNvj.d.mts +92 -0
  2. package/dist/alert-DvhiFK_R.mjs +92 -0
  3. package/dist/alert-dialog-D9tqXQ_Q.mjs +176 -0
  4. package/dist/alert-dialog.d.mts +2 -0
  5. package/dist/alert-dialog.mjs +3 -0
  6. package/dist/alert.d.mts +2 -0
  7. package/dist/alert.mjs +2 -0
  8. package/dist/announcer-CW079p2E.mjs +258 -0
  9. package/dist/announcer-DGr2Iz0i.d.mts +6829 -0
  10. package/dist/announcer.d.mts +2 -0
  11. package/dist/announcer.mjs +2 -0
  12. package/dist/aspect-ratio-DDqVT6Hg.d.mts +62 -0
  13. package/dist/aspect-ratio-_HLW6_5i.mjs +63 -0
  14. package/dist/aspect-ratio.d.mts +2 -0
  15. package/dist/aspect-ratio.mjs +2 -0
  16. package/dist/avatar-6fQfQ-1x.mjs +195 -0
  17. package/dist/avatar.d.mts +2 -0
  18. package/dist/avatar.mjs +2 -0
  19. package/dist/badge-BTOyu4i6.mjs +53 -0
  20. package/dist/badge.d.mts +2 -0
  21. package/dist/badge.mjs +2 -0
  22. package/dist/banner-CYiSiZJW.mjs +288 -0
  23. package/dist/banner.d.mts +2 -0
  24. package/dist/banner.mjs +2 -0
  25. package/dist/block-ui-Bd2m1m3K.mjs +111 -0
  26. package/dist/block-ui.d.mts +2 -0
  27. package/dist/block-ui.mjs +2 -0
  28. package/dist/blockquote-eTqp3b_r.mjs +65 -0
  29. package/dist/blockquote.d.mts +2 -0
  30. package/dist/blockquote.mjs +2 -0
  31. package/dist/breadcrumb-BvuPBfkj.mjs +212 -0
  32. package/dist/breadcrumb-Cdyh20z-.d.mts +202 -0
  33. package/dist/breadcrumb.d.mts +2 -0
  34. package/dist/breadcrumb.mjs +2 -0
  35. package/dist/{button-DYg1mIIq.d.mts → button-Dye0M41O.d.mts} +3 -3
  36. package/dist/{button-DT8AKlds.mjs → button-VVxUavbS.mjs} +6 -6
  37. package/dist/button-group-C_mR0Jfw.d.mts +137 -0
  38. package/dist/button-group-DyQbTCnY.mjs +418 -0
  39. package/dist/button-group.d.mts +2 -0
  40. package/dist/button-group.mjs +2 -0
  41. package/dist/button.d.mts +1 -1
  42. package/dist/button.mjs +2 -2
  43. package/dist/callout-DAu-98Ti.mjs +277 -0
  44. package/dist/callout.d.mts +2 -0
  45. package/dist/callout.mjs +2 -0
  46. package/dist/card-D94n04s5.mjs +66 -0
  47. package/dist/card.d.mts +2 -0
  48. package/dist/card.mjs +2 -0
  49. package/dist/catalog.d.mts +2112 -302
  50. package/dist/catalog.mjs +3831 -433
  51. package/dist/{checkbox-BgIvwjyC.mjs → checkbox-bM5y7vH8.mjs} +8 -8
  52. package/dist/checkbox.d.mts +1 -1
  53. package/dist/checkbox.mjs +2 -2
  54. package/dist/cluster-BWF028Xt.d.mts +133 -0
  55. package/dist/cluster-BydJTp9X.mjs +149 -0
  56. package/dist/cluster.d.mts +2 -0
  57. package/dist/cluster.mjs +2 -0
  58. package/dist/code-D93YXaeJ.mjs +66 -0
  59. package/dist/code.d.mts +2 -0
  60. package/dist/code.mjs +2 -0
  61. package/dist/collapsible-Cra5y_if.mjs +269 -0
  62. package/dist/collapsible.d.mts +2 -0
  63. package/dist/collapsible.mjs +2 -0
  64. package/dist/{collection-B_dFZOHO.d.mts → collection-BaPf8lgw.d.mts} +3 -3
  65. package/dist/{collection-eHN150dT.mjs → collection-Cncgrq4U.mjs} +5 -5
  66. package/dist/collection.d.mts +1 -1
  67. package/dist/collection.mjs +1 -1
  68. package/dist/command-CAH0yrMT.d.mts +105 -0
  69. package/dist/command.d.mts +2 -0
  70. package/dist/command.mjs +123 -0
  71. package/dist/{composite-navigation-Skx3LZsv.mjs → composite-navigation-D6WKS_BY.mjs} +4 -4
  72. package/dist/{composite-navigation-QINW9GLy.d.mts → composite-navigation-i7ocwmio.d.mts} +4 -4
  73. package/dist/composite-navigation.d.mts +1 -1
  74. package/dist/composite-navigation.mjs +1 -1
  75. package/dist/container-5lSCSbeX.mjs +113 -0
  76. package/dist/container-CYSiwCA-.d.mts +99 -0
  77. package/dist/container.d.mts +2 -0
  78. package/dist/container.mjs +2 -0
  79. package/dist/context-7SpwFHtK.d.mts +25 -0
  80. package/dist/context.d.mts +1 -24
  81. package/dist/context.mjs +1 -1
  82. package/dist/{controllable-state-BtoxKahh.d.mts → controllable-state-CZZF9Pw5.d.mts} +1 -1
  83. package/dist/controllable-state.d.mts +1 -1
  84. package/dist/controllable-state.mjs +1 -1
  85. package/dist/copy-button-BH2em7nG.mjs +212 -0
  86. package/dist/copy-button.d.mts +2 -0
  87. package/dist/copy-button.mjs +2 -0
  88. package/dist/{id-BV9AJ3cm.d.mts → deterministic-id-DYQJ7KzM.d.mts} +2 -35
  89. package/dist/{id-mziSyAse.mjs → deterministic-id-yMq4HfmS.mjs} +3 -46
  90. package/dist/dialog-trigger-ppGKikEP.mjs +717 -0
  91. package/dist/dialog.d.mts +2 -0
  92. package/dist/dialog.mjs +2 -0
  93. package/dist/{dismissable-layer-4icKahVs.d.mts → dismissable-layer-CTWSFZwj.d.mts} +2 -2
  94. package/dist/{dismissable-layer-CwG1gtdz.mjs → dismissable-layer-CpS07KUV.mjs} +3 -3
  95. package/dist/dismissable-layer.d.mts +1 -1
  96. package/dist/dismissable-layer.mjs +1 -1
  97. package/dist/drag-and-drop-BjYgWGcG.mjs +918 -0
  98. package/dist/drag-and-drop-CagE25Kt.d.mts +47 -0
  99. package/dist/drag-and-drop-controller-types-DoTSR_aM.d.mts +304 -0
  100. package/dist/drag-and-drop.d.mts +3 -0
  101. package/dist/drag-and-drop.mjs +2 -0
  102. package/dist/empty-state-DtyOxCA4.mjs +73 -0
  103. package/dist/empty-state.d.mts +2 -0
  104. package/dist/empty-state.mjs +2 -0
  105. package/dist/error-summary-6Xis_769.d.mts +65 -0
  106. package/dist/error-summary-DMe4IlM9.mjs +209 -0
  107. package/dist/error-summary-types-5ePaC9O3.d.mts +74 -0
  108. package/dist/error-summary.d.mts +3 -0
  109. package/dist/error-summary.mjs +2 -0
  110. package/dist/field-CBs2-Z9B.mjs +254 -0
  111. package/dist/field-WWPaJT1x.d.mts +235 -0
  112. package/dist/field-wiring-9Fy-G1rf.d.mts +14 -0
  113. package/dist/field-wiring-runtime-fQ3GoLuG.mjs +64 -0
  114. package/dist/field-wiring-types-Bfyis5hO.d.mts +73 -0
  115. package/dist/field-wiring.d.mts +3 -0
  116. package/dist/field-wiring.mjs +2 -0
  117. package/dist/field.d.mts +2 -0
  118. package/dist/field.mjs +2 -0
  119. package/dist/{focus-CAWi_I-0.mjs → focus-XxVWOwbs.mjs} +3 -3
  120. package/dist/{focus-K6dOifoZ.d.mts → focus-eObxGOtP.d.mts} +2 -2
  121. package/dist/{focus-guards-Bt0C-0qS.d.mts → focus-guards-BZa7vm6O.d.mts} +2 -2
  122. package/dist/{focus-guards-DhMPQAT8.mjs → focus-guards-DSxiemx7.mjs} +4 -4
  123. package/dist/focus-guards.d.mts +1 -1
  124. package/dist/focus-guards.mjs +1 -1
  125. package/dist/{focus-scope-CavhKWx0.d.mts → focus-scope-CsnioDR4.d.mts} +3 -3
  126. package/dist/{focus-scope-dom-DBwNEWxG.mjs → focus-scope-dom-L_EC5GsX.mjs} +2 -2
  127. package/dist/{focus-scope-D9U1aj67.mjs → focus-scope-mEg8UoeE.mjs} +5 -5
  128. package/dist/focus-scope.d.mts +1 -1
  129. package/dist/focus-scope.mjs +1 -1
  130. package/dist/focus.d.mts +1 -1
  131. package/dist/focus.mjs +1 -1
  132. package/dist/form-1V2V30Sv.d.mts +20 -0
  133. package/dist/form-runtime-CcMDY0Iq.mjs +166 -0
  134. package/dist/form-types-DXwZRLcs.d.mts +183 -0
  135. package/dist/form.d.mts +3 -0
  136. package/dist/form.mjs +2 -0
  137. package/dist/fullscreen-button-NTbC4R0W.mjs +276 -0
  138. package/dist/fullscreen-button.d.mts +2 -0
  139. package/dist/fullscreen-button.mjs +2 -0
  140. package/dist/grid-BSM9h2dL.d.mts +154 -0
  141. package/dist/grid-DeC4Wn7Y.mjs +157 -0
  142. package/dist/grid.d.mts +2 -0
  143. package/dist/grid.mjs +2 -0
  144. package/dist/heading-DToVOKV3.mjs +86 -0
  145. package/dist/heading.d.mts +2 -0
  146. package/dist/heading.mjs +2 -0
  147. package/dist/history-BDgNOjcV.mjs +304 -0
  148. package/dist/history-BkcOSOWb.d.mts +157 -0
  149. package/dist/history.d.mts +2 -0
  150. package/dist/history.mjs +2 -0
  151. package/dist/{hover-BXwwbSaO.d.mts → hover-ZiPRiZkb.d.mts} +2 -2
  152. package/dist/hover.d.mts +1 -1
  153. package/dist/hover.mjs +1 -1
  154. package/dist/icon-DhTTndMu.mjs +233 -0
  155. package/dist/icon-button-BuXquME1.mjs +188 -0
  156. package/dist/icon-button.d.mts +2 -0
  157. package/dist/icon-button.mjs +2 -0
  158. package/dist/icon.d.mts +2 -0
  159. package/dist/icon.mjs +2 -0
  160. package/dist/id-BYG8aXPF.mjs +47 -0
  161. package/dist/id-Ba8FHjAo.d.mts +34 -0
  162. package/dist/id.d.mts +2 -1
  163. package/dist/id.mjs +3 -2
  164. package/dist/index.d.mts +74 -24
  165. package/dist/index.mjs +113 -21
  166. package/dist/{inert-outside-tuHRmaqJ.d.mts → inert-outside-B6KdwAHY.d.mts} +2 -2
  167. package/dist/{inert-outside-CyqtoKQ4.mjs → inert-outside-DOufBTyy.mjs} +4 -4
  168. package/dist/inert-outside.d.mts +1 -1
  169. package/dist/inert-outside.mjs +1 -1
  170. package/dist/input-Blyx59CR.mjs +256 -0
  171. package/dist/input-C0fgeRnS.d.mts +159 -0
  172. package/dist/input.d.mts +2 -0
  173. package/dist/input.mjs +2 -0
  174. package/dist/{interaction-modality-DOZK0BpZ.mjs → interaction-modality-BHnjtU4S.mjs} +3 -3
  175. package/dist/{interaction-modality-jgHKjPFB.d.mts → interaction-modality-BTiZ7j98.d.mts} +2 -2
  176. package/dist/interaction-modality.d.mts +1 -1
  177. package/dist/interaction-modality.mjs +1 -1
  178. package/dist/kbd-sJdXIdIm.mjs +66 -0
  179. package/dist/kbd.d.mts +2 -0
  180. package/dist/kbd.mjs +2 -0
  181. package/dist/link-DDaCjrI5.mjs +154 -0
  182. package/dist/link-MbRDN6wJ.d.mts +94 -0
  183. package/dist/link.d.mts +2 -0
  184. package/dist/link.mjs +2 -0
  185. package/dist/list-DjyCLVfG.mjs +66 -0
  186. package/dist/list.d.mts +2 -0
  187. package/dist/list.mjs +2 -0
  188. package/dist/listbox-IaqaoiRn.mjs +549 -0
  189. package/dist/listbox.d.mts +2 -0
  190. package/dist/listbox.mjs +2 -0
  191. package/dist/live-region-DYSpwCTk.mjs +48 -0
  192. package/dist/live-region-G1iobPK5.d.mts +67 -0
  193. package/dist/live-region-runtime-DVUch8Lu.mjs +62 -0
  194. package/dist/live-region.d.mts +2 -0
  195. package/dist/live-region.mjs +3 -0
  196. package/dist/locale-DzWqhJZs.mjs +206 -0
  197. package/dist/locale.d.mts +2 -0
  198. package/dist/locale.mjs +2 -0
  199. package/dist/{long-press-cll6z2K9.d.mts → long-press-DyYxp191.d.mts} +3 -3
  200. package/dist/{long-press-Dsul69gk.mjs → long-press-yJk5zK0j.mjs} +4 -4
  201. package/dist/long-press.d.mts +1 -1
  202. package/dist/long-press.mjs +1 -1
  203. package/dist/measure-4I0YOAXD.d.mts +97 -0
  204. package/dist/measure-runtime-C4qYJp3_.mjs +170 -0
  205. package/dist/measure.d.mts +2 -0
  206. package/dist/measure.mjs +2 -0
  207. package/dist/media-pdf.d.mts +1 -1
  208. package/dist/media-pdf.mjs +1 -1
  209. package/dist/media-source.d.mts +1 -1
  210. package/dist/media-source.mjs +1 -1
  211. package/dist/media.d.mts +1 -1
  212. package/dist/media.mjs +1 -1
  213. package/dist/meter-B3m17_8g.d.mts +174 -0
  214. package/dist/meter-BwOXVWH8.mjs +243 -0
  215. package/dist/meter.d.mts +2 -0
  216. package/dist/meter.mjs +2 -0
  217. package/dist/motion-OdERKfZR.mjs +174 -0
  218. package/dist/motion-iUSBdWaI.d.mts +98 -0
  219. package/dist/motion.d.mts +2 -0
  220. package/dist/motion.mjs +2 -0
  221. package/dist/{move-BOmXDYbh.d.mts → move-BJGaV7Y9.d.mts} +2 -2
  222. package/dist/move-internal-BM_7g70h.mjs +172 -0
  223. package/dist/move.d.mts +1 -1
  224. package/dist/move.mjs +216 -1
  225. package/dist/native-select-H9qvaqQH.mjs +309 -0
  226. package/dist/native-select.d.mts +2 -0
  227. package/dist/native-select.mjs +2 -0
  228. package/dist/pagination-Bs4SBSE4.mjs +791 -0
  229. package/dist/pagination.d.mts +2 -0
  230. package/dist/pagination.mjs +2 -0
  231. package/dist/{pdf-source-zu1LkCeE.mjs → pdf-source-B5JSDKkQ.mjs} +1 -1
  232. package/dist/{pdf-source-BYFK2Pks.d.mts → pdf-source-adS6ZSmR.d.mts} +1 -1
  233. package/dist/pointer-grace-CAFcO4om.d.mts +57 -0
  234. package/dist/pointer-grace-DI0G3oRJ.mjs +162 -0
  235. package/dist/pointer-grace.d.mts +2 -0
  236. package/dist/pointer-grace.mjs +2 -0
  237. package/dist/popover-DeENBKXE.mjs +714 -0
  238. package/dist/popover.d.mts +2 -0
  239. package/dist/popover.mjs +2 -0
  240. package/dist/portal-DeHaLxGL.mjs +114 -0
  241. package/dist/portal-DhWXejr1.d.mts +71 -0
  242. package/dist/portal.d.mts +2 -0
  243. package/dist/portal.mjs +2 -0
  244. package/dist/positioner-BYJVA3Uy.d.mts +477 -0
  245. package/dist/positioner-BYmQk86M.mjs +38 -0
  246. package/dist/positioner-DaPo2YxM.mjs +708 -0
  247. package/dist/positioner.d.mts +2 -0
  248. package/dist/positioner.mjs +3 -0
  249. package/dist/presence-Bhv1qtvn.d.mts +57 -0
  250. package/dist/presence-CTG1EV3w.mjs +62 -0
  251. package/dist/presence-runtime-CYwCafSh.mjs +105 -0
  252. package/dist/presence-types-CRB4HbML.d.mts +45 -0
  253. package/dist/presence.d.mts +3 -0
  254. package/dist/presence.mjs +3 -0
  255. package/dist/{press-N_mE3Mgx.mjs → press-BjLm6bKg.mjs} +6 -6
  256. package/dist/press-R0_juZq2.d.mts +14 -0
  257. package/dist/{press-event-Cd2OPpmw.mjs → press-event-xlWYF9py.mjs} +1 -1
  258. package/dist/{press-types-CNqStzJf.d.mts → press-types-DfTNpqby.d.mts} +1 -1
  259. package/dist/press.d.mts +2 -13
  260. package/dist/press.mjs +1 -1
  261. package/dist/{primitive-C8jW7DLd.d.mts → primitive-BE2mdUcw.d.mts} +2 -2
  262. package/dist/{primitive-BX31dogp.mjs → primitive-beb2EEOc.mjs} +5 -5
  263. package/dist/primitive.d.mts +1 -1
  264. package/dist/primitive.mjs +2 -2
  265. package/dist/print-button-FqD5HqTV.mjs +206 -0
  266. package/dist/print-button.d.mts +2 -0
  267. package/dist/print-button.mjs +2 -0
  268. package/dist/progress--vbV2wTx.mjs +145 -0
  269. package/dist/progress-C4PlKwWq.d.mts +128 -0
  270. package/dist/progress-bar-BqS94auR.mjs +301 -0
  271. package/dist/progress-bar.d.mts +2 -0
  272. package/dist/progress-bar.mjs +2 -0
  273. package/dist/progress.d.mts +2 -0
  274. package/dist/progress.mjs +2 -0
  275. package/dist/radio-group-DbTmWcxl.mjs +317 -0
  276. package/dist/radio-group.d.mts +2 -0
  277. package/dist/radio-group.mjs +2 -0
  278. package/dist/rating-BjKLGPP6.mjs +569 -0
  279. package/dist/rating-souDdL9t.d.mts +273 -0
  280. package/dist/rating.d.mts +2 -0
  281. package/dist/rating.mjs +2 -0
  282. package/dist/scroll-area-BRSwoi9w.mjs +338 -0
  283. package/dist/scroll-area.d.mts +2 -0
  284. package/dist/scroll-area.mjs +2 -0
  285. package/dist/{scroll-lock-Ckbmm0-J.mjs → scroll-lock-BcmK0baN.mjs} +4 -4
  286. package/dist/{scroll-lock-BgVtX4wT.d.mts → scroll-lock-OfSQnfi0.d.mts} +2 -2
  287. package/dist/scroll-lock.d.mts +1 -1
  288. package/dist/scroll-lock.mjs +1 -1
  289. package/dist/search-field-70Kr2616.mjs +319 -0
  290. package/dist/search-field-Biw9vApG.d.mts +158 -0
  291. package/dist/search-field.d.mts +2 -0
  292. package/dist/search-field.mjs +2 -0
  293. package/dist/separator-CnNDqbdR.d.mts +59 -0
  294. package/dist/separator-DDj3tEAz.mjs +66 -0
  295. package/dist/separator.d.mts +2 -0
  296. package/dist/separator.mjs +2 -0
  297. package/dist/share-button-DfvUDFC-.mjs +243 -0
  298. package/dist/share-button.d.mts +2 -0
  299. package/dist/share-button.mjs +2 -0
  300. package/dist/shortcut-CvA_o0_F.mjs +631 -0
  301. package/dist/shortcut-DAZJ9LEd.d.mts +231 -0
  302. package/dist/shortcut.d.mts +2 -0
  303. package/dist/shortcut.mjs +2 -0
  304. package/dist/skeleton-BYXXcwTH.mjs +101 -0
  305. package/dist/skeleton-CQW-Tsnt.d.mts +99 -0
  306. package/dist/skeleton.d.mts +2 -0
  307. package/dist/skeleton.mjs +2 -0
  308. package/dist/skip-link-BUp9HXXt.mjs +164 -0
  309. package/dist/skip-link-DHDrtnP2.d.mts +98 -0
  310. package/dist/skip-link.d.mts +2 -0
  311. package/dist/skip-link.mjs +2 -0
  312. package/dist/slider-BiZSZLDp.mjs +475 -0
  313. package/dist/slider-CYBbxeNy.d.mts +246 -0
  314. package/dist/slider.d.mts +2 -0
  315. package/dist/slider.mjs +2 -0
  316. package/dist/sortable-BntjgYra.mjs +499 -0
  317. package/dist/sortable-DQl92bwo.d.mts +206 -0
  318. package/dist/sortable.d.mts +2 -0
  319. package/dist/sortable.mjs +2 -0
  320. package/dist/spacer-Bc0dInvi.mjs +117 -0
  321. package/dist/spacer-DFstG4G-.d.mts +105 -0
  322. package/dist/spacer.d.mts +2 -0
  323. package/dist/spacer.mjs +2 -0
  324. package/dist/{spatial-navigation-CHj9mDZH.d.mts → spatial-navigation-BPVJGSiJ.d.mts} +3 -3
  325. package/dist/{spatial-navigation-D6-UDavU.mjs → spatial-navigation-DwcUYMyc.mjs} +2 -2
  326. package/dist/spatial-navigation.d.mts +1 -1
  327. package/dist/spatial-navigation.mjs +1 -1
  328. package/dist/spinner-JnRs8fp-.d.mts +155 -0
  329. package/dist/spinner-bizL-oOg.mjs +200 -0
  330. package/dist/spinner.d.mts +2 -0
  331. package/dist/spinner.mjs +2 -0
  332. package/dist/stack-C7DOIxo-.mjs +137 -0
  333. package/dist/stack-CPtBckZB.d.mts +127 -0
  334. package/dist/stack.d.mts +2 -0
  335. package/dist/stack.mjs +2 -0
  336. package/dist/status-light-BGWgQRRf.mjs +125 -0
  337. package/dist/status-light.d.mts +2 -0
  338. package/dist/status-light.mjs +2 -0
  339. package/dist/stepper-CwX6BZaN.mjs +912 -0
  340. package/dist/stepper.d.mts +2 -0
  341. package/dist/stepper.mjs +2 -0
  342. package/dist/style.css +1 -1
  343. package/dist/surface-C2fnxL3g.mjs +102 -0
  344. package/dist/surface.d.mts +2 -0
  345. package/dist/surface.mjs +2 -0
  346. package/dist/switch-Ck5YmfXb.mjs +197 -0
  347. package/dist/switch.d.mts +2 -0
  348. package/dist/switch.mjs +2 -0
  349. package/dist/table-BxU7htxc.mjs +349 -0
  350. package/dist/table-Ce3yWwlH.d.mts +415 -0
  351. package/dist/table.d.mts +2 -0
  352. package/dist/table.mjs +2 -0
  353. package/dist/tabs-DSXIomI_.mjs +595 -0
  354. package/dist/tabs.d.mts +2 -0
  355. package/dist/tabs.mjs +2 -0
  356. package/dist/text-BVeNKPiv.mjs +76 -0
  357. package/dist/text.d.mts +2 -0
  358. package/dist/text.mjs +2 -0
  359. package/dist/textarea-4eIDNcvv.d.mts +175 -0
  360. package/dist/textarea-BZimEPBR.mjs +279 -0
  361. package/dist/textarea.d.mts +2 -0
  362. package/dist/textarea.mjs +2 -0
  363. package/dist/theme-C8Crmb8V.mjs +139 -0
  364. package/dist/theme-CNK06Pja.d.mts +38 -0
  365. package/dist/theme-constants-DAwnxG-P.mjs +29 -0
  366. package/dist/theme-preset-atelier.css +1 -0
  367. package/dist/theme-preset-headless.css +1 -0
  368. package/dist/theme-preset-high-contrast.css +1 -0
  369. package/dist/theme-preset-midnight.css +1 -0
  370. package/dist/theme-preset-paper.css +1 -0
  371. package/dist/theme-preset-play.css +1 -0
  372. package/dist/theme-preset-signal.css +1 -0
  373. package/dist/theme-scope.d.mts +25 -0
  374. package/dist/theme-scope.mjs +89 -0
  375. package/dist/theme-types-CkIa4Sa3.d.mts +71 -0
  376. package/dist/theme.css +1 -0
  377. package/dist/theme.d.mts +3 -0
  378. package/dist/theme.mjs +3 -0
  379. package/dist/toggle-CBTXzwze.mjs +141 -0
  380. package/dist/toggle-group-DO7eGEs3.d.mts +147 -0
  381. package/dist/toggle-group-DybU9N7k.mjs +523 -0
  382. package/dist/toggle-group.d.mts +2 -0
  383. package/dist/toggle-group.mjs +2 -0
  384. package/dist/toggle.d.mts +2 -0
  385. package/dist/toggle.mjs +2 -0
  386. package/dist/toolbar-CIU1bor0.d.mts +259 -0
  387. package/dist/toolbar-CXE8YCX-.mjs +425 -0
  388. package/dist/toolbar.d.mts +2 -0
  389. package/dist/toolbar.mjs +2 -0
  390. package/dist/tooltip-Cgii5xMx.mjs +485 -0
  391. package/dist/tooltip.d.mts +2 -0
  392. package/dist/tooltip.mjs +2 -0
  393. package/dist/transition-BmgFyzA6.mjs +168 -0
  394. package/dist/transition-BtIWNEFU.d.mts +82 -0
  395. package/dist/transition.d.mts +2 -0
  396. package/dist/transition.mjs +2 -0
  397. package/dist/{typeahead-B7KDxE_u.mjs → typeahead-DZSBI5m5.mjs} +2 -2
  398. package/dist/{typeahead-BbgUB2Bj.d.mts → typeahead-Dl6w5PAN.d.mts} +3 -3
  399. package/dist/typeahead.d.mts +1 -1
  400. package/dist/typeahead.mjs +1 -1
  401. package/dist/virtualizer-BlxKjT3W.mjs +793 -0
  402. package/dist/virtualizer-D9qfT4wS.d.mts +349 -0
  403. package/dist/virtualizer.d.mts +2 -0
  404. package/dist/virtualizer.mjs +2 -0
  405. package/dist/{visually-hidden-BOqfqBFt.d.mts → visually-hidden-CUr9BX0K.d.mts} +1 -1
  406. package/dist/{visually-hidden-BwDOx5yf.mjs → visually-hidden-SDjRJYRK.mjs} +5 -5
  407. package/dist/visually-hidden.d.mts +1 -1
  408. package/dist/visually-hidden.mjs +2 -2
  409. package/package.json +426 -7
  410. package/dist/checkbox-DP3_ko7D.d.mts +0 -61
  411. package/dist/move-BVvMHzxr.mjs +0 -386
@@ -0,0 +1,918 @@
1
+ import { c as surfaceErrors, i as pointerTypeOf, t as capture } from "./move-internal-BM_7g70h.mjs";
2
+ import { a as isPrimaryPointer, n as disableTextSelection, r as eventElement } from "./press-event-xlWYF9py.mjs";
3
+ import { getCurrentScope, onScopeDispose, shallowReadonly, shallowRef, toValue } from "vue";
4
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-announce.ts
5
+ const visuallyHiddenStyles = [
6
+ ["border", "0"],
7
+ ["clip-path", "inset(50%)"],
8
+ ["height", "1px"],
9
+ ["margin", "-1px"],
10
+ ["overflow", "hidden"],
11
+ ["padding", "0"],
12
+ ["position", "fixed"],
13
+ ["white-space", "nowrap"],
14
+ ["width", "1px"]
15
+ ];
16
+ /** Create a lazily mounted `role="status"` live region for drag announcements. */
17
+ function createDragLiveRegion() {
18
+ let element = null;
19
+ return Object.freeze({
20
+ announce(document, message) {
21
+ if (!element || !element.isConnected || element.ownerDocument !== document) {
22
+ element?.remove();
23
+ element = document.createElement("div");
24
+ element.setAttribute("role", "status");
25
+ element.setAttribute("aria-live", "assertive");
26
+ element.setAttribute("aria-atomic", "true");
27
+ element.setAttribute("data-vize-ui", "drag-and-drop-live");
28
+ for (const [property, value] of visuallyHiddenStyles) element.style.setProperty(property, value);
29
+ document.body.append(element);
30
+ }
31
+ element.textContent = element.textContent === message ? `${message} ` : message;
32
+ },
33
+ dispose() {
34
+ element?.remove();
35
+ element = null;
36
+ }
37
+ });
38
+ }
39
+ function position(context) {
40
+ return context.targetIndex !== null && context.targetCount !== null ? `, drop target ${context.targetIndex} of ${context.targetCount}` : "";
41
+ }
42
+ /** Built-in English announcement builders; consumers override to localize. */
43
+ const defaultDragAnnouncements = Object.freeze({
44
+ grab: (context) => context.pointerType === "keyboard" ? `Picked up ${context.sourceLabel}. Use the arrow keys to choose a drop target, Enter to drop, Escape to cancel.` : `Picked up ${context.sourceLabel}.`,
45
+ move: (context) => context.targetLabel === null ? null : `Over ${context.targetLabel}${position(context)}.`,
46
+ drop: (context) => context.targetLabel === null ? `${context.sourceLabel} released without a drop target.` : `Dropped ${context.sourceLabel} on ${context.targetLabel}.`,
47
+ cancel: (context) => `Drag canceled. ${context.sourceLabel} was not moved.`
48
+ });
49
+ //#endregion
50
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-internal.ts
51
+ const invalidOptionDiagnostic = "VIZE_UI_DRAG_AND_DROP_OPTION";
52
+ const dropEdges = new Set([
53
+ "bottom",
54
+ "inside",
55
+ "left",
56
+ "right",
57
+ "top"
58
+ ]);
59
+ /** Resolve and validate a reactive boolean option for JavaScript consumers. */
60
+ function readBoolean(value, name, defaultValue = false) {
61
+ const resolved = toValue(value);
62
+ if (resolved === void 0) return defaultValue;
63
+ if (typeof resolved !== "boolean") throw new TypeError(`${invalidOptionDiagnostic}: ${name} must resolve to a boolean`);
64
+ return resolved;
65
+ }
66
+ /** Resolve a finite non-negative pixel distance with an explicit default. */
67
+ function readDistance(value, name, defaultValue, minimum = 0) {
68
+ const resolved = toValue(value) ?? defaultValue;
69
+ if (typeof resolved !== "number" || !Number.isFinite(resolved) || resolved < minimum) throw new TypeError(`${invalidOptionDiagnostic}: ${name} must resolve to a finite number >= ${minimum}`);
70
+ return resolved;
71
+ }
72
+ /** Resolve an announcement label falling back to the owning key. */
73
+ function readLabel(value, key) {
74
+ const resolved = toValue(value) ?? key;
75
+ if (typeof resolved !== "string") throw new TypeError(`${invalidOptionDiagnostic}: label must resolve to a string`);
76
+ return resolved;
77
+ }
78
+ /** Validate one callback slot eagerly so setup failures never install listeners. */
79
+ function validateCallbacks(options, names) {
80
+ for (const name of names) {
81
+ const callback = options[name];
82
+ if (callback !== void 0 && typeof callback !== "function") throw new TypeError(`${invalidOptionDiagnostic}: ${name} must be a function`);
83
+ }
84
+ }
85
+ /** Validate a registration key and its uniqueness inside one controller. */
86
+ function validateKey(key, existing) {
87
+ if (typeof key !== "string" || key.length === 0) throw new TypeError(`${invalidOptionDiagnostic}: key must be a non-empty string`);
88
+ if (existing.has(key)) throw new TypeError(`${invalidOptionDiagnostic}: duplicate key "${key}"`);
89
+ return key;
90
+ }
91
+ /** Validate the closed drop-edge union without accepting mistyped JavaScript. */
92
+ function validateEdges(edges) {
93
+ if (edges === void 0) return ["inside"];
94
+ if (!Array.isArray(edges) || edges.length === 0 || edges.some((edge) => !dropEdges.has(edge))) throw new TypeError(`${invalidOptionDiagnostic}: edges must be a non-empty array of drop edges`);
95
+ return [...edges];
96
+ }
97
+ /** Normalize a measured rectangle, rejecting rects that cannot own a drop. */
98
+ function normalizeRect(rect) {
99
+ if (!rect) return null;
100
+ const { top, left, right, bottom } = rect;
101
+ if (![
102
+ top,
103
+ left,
104
+ right,
105
+ bottom
106
+ ].every(Number.isFinite)) return null;
107
+ if (right < left || bottom < top) return null;
108
+ return {
109
+ top,
110
+ left,
111
+ right,
112
+ bottom
113
+ };
114
+ }
115
+ /** Measure one element through its override or the live layout. */
116
+ function measureRect(element, getRect) {
117
+ if (getRect) return normalizeRect(getRect());
118
+ if (!element || typeof element.getBoundingClientRect !== "function") return null;
119
+ return normalizeRect(element.getBoundingClientRect());
120
+ }
121
+ /** Whether a client point lies inside an axis-aligned rectangle. */
122
+ function containsPoint(rect, point) {
123
+ return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;
124
+ }
125
+ /** Chebyshev distance gate deciding when an armed pointer becomes a session. */
126
+ function exceedsDistance(origin, point, threshold) {
127
+ return Math.max(Math.abs(point.x - origin.x), Math.abs(point.y - origin.y)) >= threshold;
128
+ }
129
+ /**
130
+ * Resolve the drop edge for a point inside a rectangle.
131
+ *
132
+ * When `"inside"` is allowed together with directional edges, the central half
133
+ * of each constrained axis resolves to `"inside"`; otherwise the nearest
134
+ * allowed edge on the dominant axis wins.
135
+ */
136
+ function resolveEdge(rect, point, edges) {
137
+ const allowed = new Set(edges);
138
+ const width = Math.max(rect.right - rect.left, 1);
139
+ const height = Math.max(rect.bottom - rect.top, 1);
140
+ const relativeX = (point.x - rect.left) / width - .5;
141
+ const relativeY = (point.y - rect.top) / height - .5;
142
+ const horizontal = allowed.has("left") || allowed.has("right");
143
+ const vertical = allowed.has("top") || allowed.has("bottom");
144
+ if (allowed.has("inside")) {
145
+ if ((!horizontal || Math.abs(relativeX) <= .25) && (!vertical || Math.abs(relativeY) <= .25) || !horizontal && !vertical) return "inside";
146
+ }
147
+ const preferHorizontal = horizontal && (!vertical || Math.abs(relativeX) >= Math.abs(relativeY));
148
+ const axisEdges = preferHorizontal ? ["left", "right"] : ["top", "bottom"];
149
+ const negative = preferHorizontal ? relativeX < 0 : relativeY < 0;
150
+ const preferred = negative ? axisEdges[0] : axisEdges[1];
151
+ const opposite = negative ? axisEdges[1] : axisEdges[0];
152
+ if (allowed.has(preferred)) return preferred;
153
+ if (allowed.has(opposite)) return opposite;
154
+ return edges[0] ?? "inside";
155
+ }
156
+ /** Build indicator geometry: a placeholder rect plus a collapsed edge line. */
157
+ function indicatorFor(targetKey, edge, rect) {
158
+ let line = null;
159
+ if (rect && edge !== "inside") if (edge === "top") line = {
160
+ ...rect,
161
+ bottom: rect.top
162
+ };
163
+ else if (edge === "bottom") line = {
164
+ ...rect,
165
+ top: rect.bottom
166
+ };
167
+ else if (edge === "left") line = {
168
+ ...rect,
169
+ right: rect.left
170
+ };
171
+ else line = {
172
+ ...rect,
173
+ left: rect.right
174
+ };
175
+ return Object.freeze({
176
+ targetKey,
177
+ edge,
178
+ rect,
179
+ line
180
+ });
181
+ }
182
+ /** Sort elements into document order, treating detached elements as later. */
183
+ function compareDocumentOrder(left, right) {
184
+ if (left === right) return 0;
185
+ const position = left.compareDocumentPosition(right);
186
+ if (position & 4) return -1;
187
+ if (position & 2) return 1;
188
+ return 0;
189
+ }
190
+ /**
191
+ * Overlay-safe hit test: measured rectangles are compared directly, so drag
192
+ * previews and overlays can never mask a target. Nested ownership prefers the
193
+ * innermost target by DOM containment, then the smallest area.
194
+ */
195
+ function hitTest(candidates, point) {
196
+ const containing = candidates.filter((candidate) => containsPoint(candidate.rect, point));
197
+ let winner = null;
198
+ let winnerDepth = -1;
199
+ let winnerArea = Number.POSITIVE_INFINITY;
200
+ for (const candidate of containing) {
201
+ const depth = containing.filter((other) => other !== candidate && other.element !== null && candidate.element !== null && other.element.contains(candidate.element)).length;
202
+ const area = (candidate.rect.right - candidate.rect.left) * (candidate.rect.bottom - candidate.rect.top);
203
+ if (depth > winnerDepth || depth === winnerDepth && area < winnerArea) {
204
+ winner = candidate;
205
+ winnerDepth = depth;
206
+ winnerArea = area;
207
+ }
208
+ }
209
+ return winner;
210
+ }
211
+ /** Build a frozen lifecycle snapshot for controller-level callbacks. */
212
+ function createDragEvent(type, pointerType, sourceKey, payload, targetKey, edge, point, originalEvent, isCanceled = false) {
213
+ return Object.freeze({
214
+ type,
215
+ pointerType,
216
+ sourceKey,
217
+ payload,
218
+ targetKey,
219
+ edge,
220
+ x: point?.x ?? null,
221
+ y: point?.y ?? null,
222
+ originalEvent,
223
+ isCanceled
224
+ });
225
+ }
226
+ /** Build a frozen target-scoped snapshot for drop-target callbacks. */
227
+ function createDropTargetEvent(type, targetKey, sourceKey, pointerType, payload, edge, point, originalEvent) {
228
+ return Object.freeze({
229
+ type,
230
+ targetKey,
231
+ sourceKey,
232
+ pointerType,
233
+ payload,
234
+ edge,
235
+ x: point?.x ?? null,
236
+ y: point?.y ?? null,
237
+ originalEvent
238
+ });
239
+ }
240
+ //#endregion
241
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-autoscroll.ts
242
+ function isScrollable(element) {
243
+ return Boolean(element && "scrollTop" in element && typeof element.scrollTop === "number");
244
+ }
245
+ /**
246
+ * Create an edge-proximity auto-scroller for one controller.
247
+ *
248
+ * Each pointer sample applies one immediate scroll step; while a sample stays
249
+ * inside a threshold band, an animation-frame loop keeps scrolling so a held
250
+ * pointer near an edge continues to advance the container.
251
+ */
252
+ function createDragAutoScroller(options) {
253
+ if (!options) return Object.freeze({
254
+ update: () => void 0,
255
+ stop: () => void 0
256
+ });
257
+ let lastPoint = null;
258
+ let frame = null;
259
+ const step = () => {
260
+ const point = lastPoint;
261
+ const container = toValue(options.container);
262
+ if (!point || !isScrollable(container)) return false;
263
+ const rect = measureRect(container, options.getRect);
264
+ if (!rect) return false;
265
+ const threshold = readDistance(options.threshold, "autoScroll.threshold", 48, Number.MIN_VALUE);
266
+ const speed = readDistance(options.speed, "autoScroll.speed", 16, Number.MIN_VALUE);
267
+ const along = (distance) => distance < threshold ? Math.ceil((threshold - Math.max(distance, 0)) / threshold * speed) : 0;
268
+ const nearLeft = along(point.x - rect.left);
269
+ const nearTop = along(point.y - rect.top);
270
+ const deltaX = nearLeft > 0 ? -nearLeft : along(rect.right - point.x);
271
+ const deltaY = nearTop > 0 ? -nearTop : along(rect.bottom - point.y);
272
+ if (deltaX === 0 && deltaY === 0) return false;
273
+ container.scrollLeft += deltaX;
274
+ container.scrollTop += deltaY;
275
+ return true;
276
+ };
277
+ const loop = () => {
278
+ frame = null;
279
+ if (!step()) return;
280
+ const raf = globalThis.requestAnimationFrame;
281
+ if (typeof raf === "function") frame = raf(loop);
282
+ };
283
+ return Object.freeze({
284
+ update(point) {
285
+ lastPoint = point;
286
+ const engaged = step();
287
+ const raf = globalThis.requestAnimationFrame;
288
+ if (engaged && frame === null && typeof raf === "function") frame = raf(loop);
289
+ },
290
+ stop() {
291
+ lastPoint = null;
292
+ if (frame !== null && typeof globalThis.cancelAnimationFrame === "function") globalThis.cancelAnimationFrame(frame);
293
+ frame = null;
294
+ }
295
+ });
296
+ }
297
+ //#endregion
298
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-keyboard.ts
299
+ function keyboardStep(core, options, event, action) {
300
+ const sess = core.getSession();
301
+ if (!sess) return;
302
+ if (action === "drop") {
303
+ core.finishSession(event, false);
304
+ return;
305
+ }
306
+ const errors = [];
307
+ const ordered = core.orderedTargets(sess.payload);
308
+ if (ordered.length === 0) core.updateOver(sess, null, null, event, errors);
309
+ else {
310
+ const currentIndex = ordered.findIndex((candidate) => candidate.key === sess.targetKey);
311
+ let nextIndex = 0;
312
+ if (action === "last") nextIndex = ordered.length - 1;
313
+ else if (action === "next") nextIndex = (currentIndex + 1) % ordered.length;
314
+ else if (action === "previous") nextIndex = currentIndex <= 0 ? ordered.length - 1 : currentIndex - 1;
315
+ const next = ordered[nextIndex];
316
+ if (next) {
317
+ const edges = next.record.readEdges();
318
+ const edge = edges.includes("inside") ? "inside" : edges[0] ?? "inside";
319
+ core.updateOver(sess, next, edge, event, errors);
320
+ const move = createDragEvent("dragmove", sess.pointerType, sess.sourceKey, sess.payload, sess.targetKey, sess.edge, null, event);
321
+ capture(errors, () => options.onDragMove?.(move));
322
+ }
323
+ }
324
+ surfaceErrors(errors, "Drag callbacks failed");
325
+ }
326
+ function keyboardGrab(core, options, event, key) {
327
+ const record = core.sources.get(key);
328
+ if (!record || event.altKey || event.ctrlKey || event.metaKey || event.isComposing) return;
329
+ if (readBoolean(options.isDisabled, "isDisabled") || readBoolean(record.options.isDisabled, "isDisabled") || !readBoolean(record.options.keyboard, "keyboard", true)) return;
330
+ const host = eventElement(event);
331
+ if (!host || event.target !== host) return;
332
+ const payload = toValue(record.options.payload) ?? null;
333
+ if (core.orderedTargets(payload).length === 0) return;
334
+ event.preventDefault();
335
+ event.stopPropagation();
336
+ const errors = [];
337
+ const sess = core.beginSession("keyboard", key, event, null, errors);
338
+ keyboardStep(core, options, event, "first");
339
+ if (core.getSession() === sess) {
340
+ const combined = [core.buildMessage("grab", sess), core.buildMessage("move", sess)].filter((part) => part !== null).join(" ");
341
+ if (combined) capture(errors, () => core.announceMessage(sess, combined));
342
+ }
343
+ surfaceErrors(errors, "Drag callbacks failed");
344
+ }
345
+ /** Handle one keydown from a source handle: grab, navigate, drop, or cancel. */
346
+ function handleSourceKeydown(core, options, event, key) {
347
+ const session = core.getSession();
348
+ if (session?.pointerType === "keyboard" && session.sourceKey === key) {
349
+ switch (event.key) {
350
+ case "ArrowDown":
351
+ case "ArrowRight":
352
+ keyboardStep(core, options, event, "next");
353
+ break;
354
+ case "ArrowUp":
355
+ case "ArrowLeft":
356
+ keyboardStep(core, options, event, "previous");
357
+ break;
358
+ case "Home":
359
+ keyboardStep(core, options, event, "first");
360
+ break;
361
+ case "End":
362
+ keyboardStep(core, options, event, "last");
363
+ break;
364
+ case "Enter":
365
+ case " ":
366
+ keyboardStep(core, options, event, "drop");
367
+ break;
368
+ case "Escape":
369
+ core.finishSession(event, true);
370
+ break;
371
+ case "Tab":
372
+ core.finishSession(event, true);
373
+ return;
374
+ default: return;
375
+ }
376
+ event.preventDefault();
377
+ event.stopPropagation();
378
+ } else if (!session && !core.getContact() && (event.key === "Enter" || event.key === " ")) keyboardGrab(core, options, event, key);
379
+ }
380
+ //#endregion
381
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-listeners.ts
382
+ function clientPoint(event, contactId) {
383
+ if ("clientX" in event && "clientY" in event) {
384
+ const x = Number(event.clientX);
385
+ const y = Number(event.clientY);
386
+ if (Number.isFinite(x) && Number.isFinite(y)) return {
387
+ x,
388
+ y
389
+ };
390
+ }
391
+ if ("changedTouches" in event) {
392
+ const touch = Array.from(event.changedTouches).find(({ identifier }) => contactId === null || identifier === contactId);
393
+ if (touch) return {
394
+ x: touch.clientX,
395
+ y: touch.clientY
396
+ };
397
+ }
398
+ return null;
399
+ }
400
+ /** Install and exhaustively clean up the document listeners for one session. */
401
+ function installDragListeners(document, source, context) {
402
+ const removals = [];
403
+ const listen = (owner, type, callback, capturePhase = true) => {
404
+ owner.addEventListener(type, callback, capturePhase);
405
+ removals.push(() => owner.removeEventListener(type, callback, capturePhase));
406
+ };
407
+ const move = (event) => {
408
+ const point = clientPoint(event, context.getContactId());
409
+ if (point) context.onPoint(event, point);
410
+ };
411
+ const end = (event, canceled) => {
412
+ if (source === "pointer" && event.pointerId !== context.getContactId()) return;
413
+ if (source === "mouse" && event.button !== 0) return;
414
+ if (source === "touch" && !clientPoint(event, context.getContactId())) return;
415
+ context.onFinish(event, canceled);
416
+ };
417
+ const matchesPointer = (event) => source !== "pointer" || event.pointerId === context.getContactId();
418
+ try {
419
+ if (source === "pointer") {
420
+ listen(document, "pointermove", (event) => {
421
+ if (matchesPointer(event)) move(event);
422
+ });
423
+ listen(document, "pointerup", (event) => end(event, false));
424
+ listen(document, "pointercancel", (event) => end(event, true));
425
+ } else if (source === "mouse") {
426
+ listen(document, "mousemove", move);
427
+ listen(document, "mouseup", (event) => end(event, false));
428
+ } else {
429
+ listen(document, "touchmove", move);
430
+ listen(document, "touchend", (event) => end(event, false));
431
+ listen(document, "touchcancel", (event) => end(event, true));
432
+ }
433
+ listen(document, "keydown", (event) => {
434
+ if (event.key === "Escape") {
435
+ event.preventDefault();
436
+ event.stopPropagation();
437
+ context.onFinish(event, true);
438
+ }
439
+ });
440
+ listen(document, "dragstart", (event) => context.onFinish(event, true));
441
+ listen(document, "visibilitychange", () => {
442
+ if (document.visibilityState === "hidden") context.onFinish(null, true);
443
+ });
444
+ if (document.defaultView) listen(document.defaultView, "blur", (event) => context.onFinish(event, true), false);
445
+ } catch (error) {
446
+ const errors = [error];
447
+ for (const remove of removals.reverse()) capture(errors, remove);
448
+ surfaceErrors(errors, "Drag listener setup failed");
449
+ throw error;
450
+ }
451
+ let released = false;
452
+ return () => {
453
+ if (released) return;
454
+ released = true;
455
+ const errors = [];
456
+ for (const remove of removals) capture(errors, remove);
457
+ surfaceErrors(errors, "Drag listener cleanup failed");
458
+ };
459
+ }
460
+ //#endregion
461
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-session.ts
462
+ /** Shared mutable session state and settlement logic for one controller. */
463
+ function createSessionCore(options, liveRegion, autoScroller) {
464
+ const announcements = {
465
+ ...defaultDragAnnouncements,
466
+ ...options.announcements
467
+ };
468
+ const sources = /* @__PURE__ */ new Map();
469
+ const targets = /* @__PURE__ */ new Map();
470
+ const dragging = shallowRef(false);
471
+ const activeSourceKey = shallowRef(null);
472
+ const activeTargetKey = shallowRef(null);
473
+ const indicator = shallowRef(null);
474
+ let contact = null;
475
+ let session = null;
476
+ const orderedTargets = (payload) => {
477
+ const list = [];
478
+ for (const [key, record] of targets) {
479
+ if (readBoolean(record.options.isDisabled, "isDisabled")) continue;
480
+ if (record.options.accepts && !record.options.accepts(payload)) continue;
481
+ const element = toValue(record.options.element) ?? null;
482
+ list.push({
483
+ key,
484
+ record,
485
+ element,
486
+ rect: measureRect(element, record.options.getRect)
487
+ });
488
+ }
489
+ return list.sort((left, right) => left.element && right.element ? compareDocumentOrder(left.element, right.element) : 0);
490
+ };
491
+ const resolveDocument = (sess) => {
492
+ const sourceElement = toValue(sources.get(sess.sourceKey)?.options.element);
493
+ if (sourceElement) return sourceElement.ownerDocument;
494
+ return typeof document === "undefined" ? null : document;
495
+ };
496
+ const buildMessage = (phase, sess) => {
497
+ const currentKey = sess.targetKey;
498
+ const target = currentKey === null ? void 0 : targets.get(currentKey);
499
+ const ordered = orderedTargets(sess.payload);
500
+ const index = ordered.findIndex((candidate) => candidate.key === currentKey);
501
+ const context = {
502
+ pointerType: sess.pointerType,
503
+ sourceKey: sess.sourceKey,
504
+ sourceLabel: readLabel(sources.get(sess.sourceKey)?.options.label, sess.sourceKey),
505
+ payload: sess.payload,
506
+ targetKey: currentKey,
507
+ targetLabel: target && currentKey !== null ? readLabel(target.options.label, currentKey) : null,
508
+ targetIndex: index >= 0 ? index + 1 : null,
509
+ targetCount: ordered.length > 0 ? ordered.length : null,
510
+ edge: sess.edge
511
+ };
512
+ const builder = announcements[phase];
513
+ return builder(context) ?? null;
514
+ };
515
+ const announceMessage = (sess, message) => {
516
+ const owner = resolveDocument(sess);
517
+ if (owner && message) liveRegion.announce(owner, message);
518
+ };
519
+ const speak = (phase, sess) => {
520
+ announceMessage(sess, buildMessage(phase, sess));
521
+ };
522
+ const targetEvent = (type, key, sess, edge, event) => createDropTargetEvent(type, key, sess.sourceKey, sess.pointerType, sess.payload, edge, sess.point, event);
523
+ const updateOver = (sess, hit, edge, event, errors) => {
524
+ const previousKey = sess.targetKey;
525
+ if (previousKey !== null && previousKey !== (hit?.key ?? null)) {
526
+ const previous = targets.get(previousKey);
527
+ if (previous) {
528
+ previous.over.value = false;
529
+ const leave = targetEvent("dropleave", previousKey, sess, null, event);
530
+ capture(errors, () => previous.options.onLeave?.(leave));
531
+ }
532
+ }
533
+ if (!hit || edge === null) {
534
+ sess.targetKey = null;
535
+ sess.edge = null;
536
+ activeTargetKey.value = null;
537
+ indicator.value = null;
538
+ return;
539
+ }
540
+ const entered = previousKey !== hit.key;
541
+ const edgeChanged = !entered && sess.edge !== edge;
542
+ sess.targetKey = hit.key;
543
+ sess.edge = edge;
544
+ activeTargetKey.value = hit.key;
545
+ indicator.value = indicatorFor(hit.key, edge, hit.rect);
546
+ if (entered) {
547
+ hit.record.over.value = true;
548
+ const enter = targetEvent("dropenter", hit.key, sess, edge, event);
549
+ capture(errors, () => hit.record.options.onEnter?.(enter));
550
+ capture(errors, () => speak("move", sess));
551
+ } else {
552
+ const move = targetEvent("dropmove", hit.key, sess, edge, event);
553
+ capture(errors, () => hit.record.options.onMove?.(move));
554
+ if (edgeChanged) capture(errors, () => speak("move", sess));
555
+ }
556
+ };
557
+ const beginSession = (pointerType, key, event, point, errors) => {
558
+ const record = sources.get(key);
559
+ const payload = toValue(record?.options.payload) ?? null;
560
+ const started = {
561
+ sourceKey: key,
562
+ pointerType,
563
+ payload,
564
+ targetKey: null,
565
+ edge: null,
566
+ point
567
+ };
568
+ session = started;
569
+ dragging.value = true;
570
+ activeSourceKey.value = key;
571
+ if (record) record.dragging.value = true;
572
+ if (pointerType !== "keyboard") capture(errors, () => speak("grab", started));
573
+ const start = createDragEvent("dragstart", pointerType, key, payload, null, null, point, event);
574
+ capture(errors, () => options.onDragStart?.(start));
575
+ return started;
576
+ };
577
+ const finishSession = (event, isCanceled, silent = false) => {
578
+ const currentContact = contact;
579
+ const currentSession = session;
580
+ if (!currentContact && !currentSession) return false;
581
+ contact = null;
582
+ session = null;
583
+ const errors = [];
584
+ if (currentContact) {
585
+ capture(errors, currentContact.releaseListeners);
586
+ capture(errors, currentContact.restoreSelection);
587
+ }
588
+ autoScroller.stop();
589
+ if (currentSession) {
590
+ const record = sources.get(currentSession.sourceKey);
591
+ const overKey = currentSession.targetKey;
592
+ const target = overKey === null ? void 0 : targets.get(overKey);
593
+ if (target) target.over.value = false;
594
+ dragging.value = false;
595
+ activeSourceKey.value = null;
596
+ activeTargetKey.value = null;
597
+ indicator.value = null;
598
+ if (record) record.dragging.value = false;
599
+ if (!silent) {
600
+ if (isCanceled) {
601
+ if (target && overKey !== null) {
602
+ const leave = targetEvent("dropleave", overKey, currentSession, null, event);
603
+ capture(errors, () => target.options.onLeave?.(leave));
604
+ }
605
+ capture(errors, () => speak("cancel", currentSession));
606
+ } else {
607
+ if (target && overKey !== null) {
608
+ const drop = targetEvent("drop", overKey, currentSession, currentSession.edge, event);
609
+ capture(errors, () => target.options.onDrop?.(drop));
610
+ }
611
+ capture(errors, () => speak("drop", currentSession));
612
+ }
613
+ const end = createDragEvent("dragend", currentSession.pointerType, currentSession.sourceKey, currentSession.payload, isCanceled ? null : overKey, isCanceled ? null : currentSession.edge, currentSession.point, event, isCanceled);
614
+ capture(errors, () => options.onDragEnd?.(end));
615
+ }
616
+ }
617
+ surfaceErrors(errors, "Drag settlement failed");
618
+ return true;
619
+ };
620
+ return {
621
+ sources,
622
+ targets,
623
+ dragging,
624
+ activeSourceKey,
625
+ activeTargetKey,
626
+ indicator,
627
+ getContact: () => contact,
628
+ setContact: (next) => {
629
+ contact = next;
630
+ },
631
+ getSession: () => session,
632
+ orderedTargets,
633
+ buildMessage,
634
+ announceMessage,
635
+ updateOver,
636
+ beginSession,
637
+ finishSession
638
+ };
639
+ }
640
+ //#endregion
641
+ //#region src/families/interaction/drag-and-drop/drag-and-drop-transfer.ts
642
+ const invalidTransferDiagnostic = "VIZE_UI_DRAG_AND_DROP_TRANSFER";
643
+ /** Structured data-transfer format written next to the plain-text projection. */
644
+ const DRAG_TRANSFER_TYPE = "application/vnd.vize-ui.drag+json";
645
+ function validatePayload(payload) {
646
+ if (!payload || typeof payload.kind !== "string" || payload.kind.length === 0 || !("data" in payload)) throw new TypeError(`${invalidTransferDiagnostic}: payload must carry a kind and data`);
647
+ if (payload.plainText !== void 0 && typeof payload.plainText !== "string") throw new TypeError(`${invalidTransferDiagnostic}: plainText must be a string`);
648
+ }
649
+ /**
650
+ * Serialize one typed payload onto a `DataTransfer`.
651
+ *
652
+ * The structured payload is written under {@link DRAG_TRANSFER_TYPE}; the
653
+ * optional `plainText` projection is mirrored to `text/plain` so external
654
+ * applications receive a meaningful representation.
655
+ */
656
+ function writeDragTransfer(dataTransfer, payload) {
657
+ validatePayload(payload);
658
+ dataTransfer.setData(DRAG_TRANSFER_TYPE, JSON.stringify({
659
+ kind: payload.kind,
660
+ data: payload.data
661
+ }));
662
+ if (payload.plainText !== void 0) dataTransfer.setData("text/plain", payload.plainText);
663
+ }
664
+ /**
665
+ * Deserialize a typed payload from a `DataTransfer`.
666
+ *
667
+ * @returns The structured payload, or `null` when the transfer does not carry
668
+ * a well-formed {@link DRAG_TRANSFER_TYPE} entry.
669
+ */
670
+ function readDragTransfer(dataTransfer) {
671
+ const serialized = dataTransfer.getData(DRAG_TRANSFER_TYPE);
672
+ if (!serialized) return null;
673
+ let parsed;
674
+ try {
675
+ parsed = JSON.parse(serialized);
676
+ } catch {
677
+ return null;
678
+ }
679
+ if (!parsed || typeof parsed !== "object") return null;
680
+ const { kind, data } = parsed;
681
+ if (typeof kind !== "string" || kind.length === 0 || !("data" in parsed)) return null;
682
+ const plainText = dataTransfer.getData("text/plain");
683
+ return Object.freeze(plainText ? {
684
+ kind,
685
+ data,
686
+ plainText
687
+ } : {
688
+ kind,
689
+ data
690
+ });
691
+ }
692
+ /**
693
+ * Serialize one typed payload onto a clipboard event during `copy` or `cut`.
694
+ *
695
+ * The event's default action is prevented so the written data wins.
696
+ *
697
+ * @returns `true` when the event exposed writable clipboard data.
698
+ */
699
+ function writeClipboardTransfer(event, payload) {
700
+ validatePayload(payload);
701
+ const dataTransfer = event.clipboardData;
702
+ if (!dataTransfer) return false;
703
+ event.preventDefault();
704
+ writeDragTransfer(dataTransfer, payload);
705
+ return true;
706
+ }
707
+ /**
708
+ * Deserialize a typed payload from a clipboard event during `paste`.
709
+ *
710
+ * @returns The structured payload, or `null` when the clipboard does not carry
711
+ * a well-formed {@link DRAG_TRANSFER_TYPE} entry.
712
+ */
713
+ function readClipboardTransfer(event) {
714
+ const dataTransfer = event.clipboardData;
715
+ return dataTransfer ? readDragTransfer(dataTransfer) : null;
716
+ }
717
+ //#endregion
718
+ //#region src/families/interaction/drag-and-drop/drag-and-drop.ts
719
+ const disposedDiagnostic = "VIZE_UI_DRAG_AND_DROP_DISPOSED";
720
+ const setupDiagnostic = "VIZE_UI_DRAG_AND_DROP_SETUP";
721
+ /** Create an SSR-safe pointer, touch, and keyboard drag-and-drop coordinator. */
722
+ function createDragAndDrop(options = {}) {
723
+ validateCallbacks(options, [
724
+ "onDragStart",
725
+ "onDragMove",
726
+ "onDragEnd"
727
+ ]);
728
+ if (typeof options.startDistance !== "function") readDistance(options.startDistance, "startDistance", 4);
729
+ const liveRegion = createDragLiveRegion();
730
+ const autoScroller = createDragAutoScroller(options.autoScroll);
731
+ const core = createSessionCore(options, liveRegion, autoScroller);
732
+ let disposed = false;
733
+ let lastTouchTime = Number.NEGATIVE_INFINITY;
734
+ const pointerPoint = (event, point) => {
735
+ const contact = core.getContact();
736
+ if (disposed || !contact) return;
737
+ if (readBoolean(options.isDisabled, "isDisabled") || readBoolean(core.sources.get(contact.sourceKey)?.options.isDisabled, "isDisabled")) {
738
+ core.finishSession(event, true);
739
+ return;
740
+ }
741
+ const errors = [];
742
+ let session = core.getSession();
743
+ if (!session) {
744
+ const threshold = readDistance(options.startDistance, "startDistance", 4);
745
+ if (!exceedsDistance(contact.origin, point, threshold)) return;
746
+ session = core.beginSession(contact.pointerType, contact.sourceKey, event, point, errors);
747
+ }
748
+ event.preventDefault();
749
+ session.point = point;
750
+ const hit = hitTest(core.orderedTargets(session.payload).filter((candidate) => candidate.rect !== null), point);
751
+ core.updateOver(session, hit, hit ? resolveEdge(hit.rect, point, hit.record.readEdges()) : null, event, errors);
752
+ if (core.getSession() === session) {
753
+ const move = createDragEvent("dragmove", session.pointerType, session.sourceKey, session.payload, session.targetKey, session.edge, point, event);
754
+ capture(errors, () => options.onDragMove?.(move));
755
+ }
756
+ autoScroller.update(point);
757
+ surfaceErrors(errors, "Drag callbacks failed");
758
+ };
759
+ const armPointer = (event, source, pointerType, contactId, origin, key) => {
760
+ if (disposed || core.getContact() || core.getSession()) return;
761
+ if (readBoolean(options.isDisabled, "isDisabled") || readBoolean(core.sources.get(key)?.options.isDisabled, "isDisabled")) return;
762
+ const host = eventElement(event);
763
+ if (!host) return;
764
+ event.preventDefault();
765
+ event.stopPropagation();
766
+ let releaseListeners = () => void 0;
767
+ let restoreSelection = () => void 0;
768
+ try {
769
+ releaseListeners = installDragListeners(host.ownerDocument, source, {
770
+ getContactId: () => core.getContact()?.contactId ?? null,
771
+ onPoint: pointerPoint,
772
+ onFinish: (finishEvent, canceled) => core.finishSession(finishEvent, canceled)
773
+ });
774
+ restoreSelection = disableTextSelection(host);
775
+ } catch (error) {
776
+ const errors = [error];
777
+ capture(errors, releaseListeners);
778
+ capture(errors, restoreSelection);
779
+ surfaceErrors(errors, "Drag start cleanup failed");
780
+ throw error;
781
+ }
782
+ core.setContact({
783
+ sourceKey: key,
784
+ source,
785
+ contactId,
786
+ origin,
787
+ pointerType,
788
+ releaseListeners,
789
+ restoreSelection
790
+ });
791
+ };
792
+ const buildSourceProps = (key) => Object.freeze({
793
+ onDragstart(event) {
794
+ if (core.getContact()?.sourceKey === key || core.getSession()?.sourceKey === key) core.finishSession(event, true);
795
+ },
796
+ onFocusout(event) {
797
+ const session = core.getSession();
798
+ if (session?.pointerType === "keyboard" && session.sourceKey === key) core.finishSession(event, true);
799
+ },
800
+ onKeydown(event) {
801
+ if (!disposed) handleSourceKeydown(core, options, event, key);
802
+ },
803
+ onMousedown(event) {
804
+ if (event.button !== 0 || event.view && "PointerEvent" in event.view) return;
805
+ const elapsed = event.timeStamp - lastTouchTime;
806
+ if (elapsed >= 0 && elapsed < 800) return;
807
+ armPointer(event, "mouse", "mouse", null, {
808
+ x: event.clientX,
809
+ y: event.clientY
810
+ }, key);
811
+ },
812
+ onPointerdown(event) {
813
+ if (!isPrimaryPointer(event)) return;
814
+ const origin = {
815
+ x: event.clientX,
816
+ y: event.clientY
817
+ };
818
+ armPointer(event, "pointer", pointerTypeOf(event), event.pointerId, origin, key);
819
+ },
820
+ onTouchstart(event) {
821
+ lastTouchTime = event.timeStamp;
822
+ if (event.view && "PointerEvent" in event.view || event.changedTouches.length !== 1) return;
823
+ const touch = event.changedTouches.item(0);
824
+ if (touch) {
825
+ const origin = {
826
+ x: touch.clientX,
827
+ y: touch.clientY
828
+ };
829
+ armPointer(event, "touch", "touch", touch.identifier, origin, key);
830
+ }
831
+ }
832
+ });
833
+ return Object.freeze({
834
+ isDragging: shallowReadonly(core.dragging),
835
+ sourceKey: shallowReadonly(core.activeSourceKey),
836
+ targetKey: shallowReadonly(core.activeTargetKey),
837
+ indicator: shallowReadonly(core.indicator),
838
+ registerSource(sourceOptions) {
839
+ if (disposed) throw new Error(`${disposedDiagnostic}: the controller has been disposed`);
840
+ const key = validateKey(sourceOptions.key, core.sources);
841
+ const record = {
842
+ options: sourceOptions,
843
+ dragging: shallowRef(false)
844
+ };
845
+ core.sources.set(key, record);
846
+ return Object.freeze({
847
+ key,
848
+ isDragging: shallowReadonly(record.dragging),
849
+ sourceProps: buildSourceProps(key),
850
+ dispose: () => {
851
+ if (core.sources.get(key) !== record) return;
852
+ if (core.getContact()?.sourceKey === key || core.getSession()?.sourceKey === key) core.finishSession(null, true);
853
+ core.sources.delete(key);
854
+ }
855
+ });
856
+ },
857
+ registerTarget(targetOptions) {
858
+ if (disposed) throw new Error(`${disposedDiagnostic}: the controller has been disposed`);
859
+ const key = validateKey(targetOptions.key, core.targets);
860
+ validateCallbacks(targetOptions, [
861
+ "accepts",
862
+ "getRect",
863
+ "onDrop",
864
+ "onEnter",
865
+ "onLeave",
866
+ "onMove"
867
+ ]);
868
+ if (Array.isArray(targetOptions.edges)) validateEdges(targetOptions.edges);
869
+ const record = {
870
+ options: targetOptions,
871
+ readEdges: () => validateEdges(toValue(targetOptions.edges)),
872
+ over: shallowRef(false)
873
+ };
874
+ core.targets.set(key, record);
875
+ return Object.freeze({
876
+ key,
877
+ isOver: shallowReadonly(record.over),
878
+ dispose: () => {
879
+ if (core.targets.get(key) !== record) return;
880
+ core.targets.delete(key);
881
+ const session = core.getSession();
882
+ if (session?.targetKey === key) {
883
+ record.over.value = false;
884
+ session.targetKey = null;
885
+ session.edge = null;
886
+ core.activeTargetKey.value = null;
887
+ core.indicator.value = null;
888
+ }
889
+ }
890
+ });
891
+ },
892
+ announce(message) {
893
+ if (disposed || typeof message !== "string" || message.length === 0) return;
894
+ if (typeof document !== "undefined") liveRegion.announce(document, message);
895
+ },
896
+ cancel: () => {
897
+ if (disposed) throw new Error(`${disposedDiagnostic}: the controller has been disposed`);
898
+ return core.finishSession(null, true);
899
+ },
900
+ dispose: () => {
901
+ if (disposed) return;
902
+ disposed = true;
903
+ const errors = [];
904
+ capture(errors, () => core.finishSession(null, true, true));
905
+ capture(errors, liveRegion.dispose);
906
+ surfaceErrors(errors, "Drag disposal failed");
907
+ }
908
+ });
909
+ }
910
+ /** Create a drag-and-drop coordinator disposed with the current effect scope. */
911
+ function useDragAndDrop(options = {}) {
912
+ if (!getCurrentScope()) throw new Error(`${setupDiagnostic}: use inside component setup or an active effect scope`);
913
+ const controller = createDragAndDrop(options);
914
+ onScopeDispose(controller.dispose);
915
+ return controller;
916
+ }
917
+ //#endregion
918
+ export { readDragTransfer as a, compareDocumentOrder as c, readBoolean as d, readLabel as f, defaultDragAnnouncements as h, readClipboardTransfer as i, indicatorFor as l, validateKey as m, useDragAndDrop as n, writeClipboardTransfer as o, validateCallbacks as p, DRAG_TRANSFER_TYPE as r, writeDragTransfer as s, createDragAndDrop as t, measureRect as u };