@astryx-vue/core 0.37.0 → 0.39.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 (366) hide show
  1. package/dist/AlertDialog/index.js +1 -1
  2. package/dist/{AlertDialog-DwITRN1M.js → AlertDialog-DnylRSpj.js} +9 -9
  3. package/dist/AppShell/index.js +1 -1
  4. package/dist/{AppShell-ClZ2Y8cu.js → AppShell-lv3WDlCi.js} +7 -7
  5. package/dist/Avatar/index.js +1 -1
  6. package/dist/{Avatar-CpWBsTqf.js → Avatar-BY-EWaJM.js} +1 -1
  7. package/dist/AvatarGroup/index.d.ts +1 -1
  8. package/dist/AvatarGroup/index.js +1 -1
  9. package/dist/{AvatarGroup-DhSPWemf.js → AvatarGroup-BSsARmYE.js} +1 -1
  10. package/dist/Banner/index.d.ts +1 -1
  11. package/dist/Banner/index.js +1 -1
  12. package/dist/{Banner-DeauKxQw.js → Banner-CqIYLEcx.js} +2 -2
  13. package/dist/BottomSheet/index.js +2 -2
  14. package/dist/{BottomSheet-CDxV1Rkx.js → BottomSheet-6W3izQzr.js} +1 -1
  15. package/dist/{BottomSheet-Cr6FacYP.js → BottomSheet-D37eNqz5.js} +10 -10
  16. package/dist/Breadcrumbs/index.d.ts +2 -2
  17. package/dist/Breadcrumbs/index.js +2 -2
  18. package/dist/{Breadcrumbs-DaxgM0-F.js → Breadcrumbs-BEzCPnoe.js} +2 -2
  19. package/dist/Button/index.js +1 -1
  20. package/dist/{Button-V6i-PeBt.js → Button-DGIfLwqj.js} +5 -5
  21. package/dist/ButtonGroup/index.d.ts +1 -1
  22. package/dist/ButtonGroup/index.js +1 -1
  23. package/dist/{ButtonGroup-CEDeeGkY.js → ButtonGroup-CaQ7bir4.js} +2 -2
  24. package/dist/Calendar/index.d.ts +1 -1
  25. package/dist/Calendar/index.js +2 -2
  26. package/dist/{Calendar-CUMnYIhe.js → Calendar-CfhOlgQJ.js} +2 -2
  27. package/dist/Carousel/index.d.ts +1 -1
  28. package/dist/Carousel/index.js +1 -1
  29. package/dist/{Carousel-5NYWpta1.js → Carousel-DmeW51vC.js} +2 -2
  30. package/dist/Chat/index.d.ts +1 -1
  31. package/dist/Chat/index.js +1 -1
  32. package/dist/{Chat-BRtDKajd.js → Chat-whrqE8Zj.js} +11 -11
  33. package/dist/CheckboxInput/index.d.ts +1 -1
  34. package/dist/CheckboxInput/index.js +1 -1
  35. package/dist/{CheckboxInput-ixAs3zkT.js → CheckboxInput-CHO4Jz0m.js} +6 -6
  36. package/dist/CheckboxList/index.d.ts +1 -1
  37. package/dist/CheckboxList/index.js +1 -1
  38. package/dist/{CheckboxListItem-DoWYdLf-.js → CheckboxListItem-C4dmrC_w.js} +5 -5
  39. package/dist/Citation/index.js +1 -1
  40. package/dist/{Citation-Ijf06x0V.js → Citation-DXMQVSi5.js} +1 -1
  41. package/dist/ClickableCard/index.d.ts +1 -1
  42. package/dist/ClickableCard/index.js +1 -1
  43. package/dist/{ClickableCard-DuOcbNlt.js → ClickableCard-DYcn-IFI.js} +1 -1
  44. package/dist/Code/index.js +2 -2
  45. package/dist/{Code-qHt8uZqb.js → Code-D80SHrJx.js} +4 -3
  46. package/dist/{CodeBlock-2zigEFFD.js → CodeBlock-vhMVY90M.js} +4 -4
  47. package/dist/Collapsible/index.js +1 -1
  48. package/dist/{Collapsible-DfVihLCR.js → Collapsible-CaKmR3yE.js} +4 -4
  49. package/dist/CommandPalette/index.js +1 -1
  50. package/dist/{CommandPalette-CWaKVNGZ.js → CommandPalette-C-iXk7EB.js} +7 -7
  51. package/dist/ComplexSelector/index.d.ts +1 -1
  52. package/dist/ComplexSelector/index.js +1 -1
  53. package/dist/{ComplexSelector-D2QRdM57.js → ComplexSelector-BsdtBmd0.js} +5 -5
  54. package/dist/{ComponentIcon-Dw4xQxg3.js → ComponentIcon-B67QcA-d.js} +2 -2
  55. package/dist/ContextMenu/index.d.ts +2 -2
  56. package/dist/ContextMenu/index.js +2 -2
  57. package/dist/{ContextMenu-D-G53u7B.js → ContextMenu-GZkN9lf1.js} +10 -10
  58. package/dist/DateInput/index.d.ts +1 -1
  59. package/dist/DateInput/index.js +1 -1
  60. package/dist/{DateInput-BHSp4fZS.js → DateInput-Cb6eLrbU.js} +11 -11
  61. package/dist/DateRangeInput/index.d.ts +1 -1
  62. package/dist/DateRangeInput/index.js +1 -1
  63. package/dist/{DateRangeInput-DP1QWK_6.js → DateRangeInput-BUFeQYJ6.js} +7 -7
  64. package/dist/DateTimeInput/index.d.ts +1 -1
  65. package/dist/DateTimeInput/index.js +1 -1
  66. package/dist/{DateTimeInput-Bgx9lgWb.js → DateTimeInput-r-MOwLs4.js} +9 -9
  67. package/dist/Dialog/index.js +3 -3
  68. package/dist/{Dialog-DCKT1dWC.js → Dialog-BP2KWnEi.js} +2 -2
  69. package/dist/{Dialog-DRQrtKHT.js → Dialog-BUl1lqE6.js} +1 -1
  70. package/dist/{DialogHeader-C3Mc580J.js → DialogHeader-CPhEYbZ1.js} +2 -2
  71. package/dist/Drawer/index.d.ts +1 -1
  72. package/dist/Drawer/index.js +1 -1
  73. package/dist/{Drawer-CnFTUjln.js → Drawer-C0ntt2L9.js} +3 -3
  74. package/dist/DropdownMenu/index.d.ts +2 -2
  75. package/dist/DropdownMenu/index.js +2 -2
  76. package/dist/{DropdownMenu-DU_Rw88D.js → DropdownMenu-CSWLdtI4.js} +12 -12
  77. package/dist/{DropdownMenuRadioItem.vue-BDDI4EZK.d.ts → DropdownMenuRadioItem.vue-BFCbIBfb.d.ts} +1 -1
  78. package/dist/EmptyState/index.js +1 -1
  79. package/dist/{EmptyState-DU7uOI2G.js → EmptyState-BUmLBchw.js} +2 -2
  80. package/dist/Field/index.js +3 -3
  81. package/dist/{Field-CZndbiqR.js → Field-BYAHZ4s7.js} +2 -2
  82. package/dist/{FieldIcon-BU1ZWAuo.js → FieldIcon-C6A69-um.js} +1 -1
  83. package/dist/{FieldInfoTip-Ii7lSYS8.js → FieldInfoTip-6IHEEEJL.js} +2 -2
  84. package/dist/{FieldLabel-ru3qavED.js → FieldLabel-CHaeZROf.js} +2 -2
  85. package/dist/FieldStatus/index.js +1 -1
  86. package/dist/{FieldStatus-DmCWPT6U.js → FieldStatus-QjwGygl3.js} +1 -1
  87. package/dist/FileInput/index.js +1 -1
  88. package/dist/{FileInput-BtVTN7LN.js → FileInput-DD3DvIT0.js} +6 -6
  89. package/dist/Heading/index.d.ts +1 -1
  90. package/dist/Heading/index.js +1 -1
  91. package/dist/{Heading-BZ0ydu2s.js → Heading-SdObK_xM.js} +1 -1
  92. package/dist/HoverCard/index.d.ts +1 -1
  93. package/dist/HoverCard/index.js +1 -1
  94. package/dist/{HoverCard-BhHZE9q6.js → HoverCard-B7hrl0Qz.js} +4 -4
  95. package/dist/Icon/index.js +2 -2
  96. package/dist/{Icon-Dk0jccgU.js → Icon-BUSj1-Th.js} +1 -1
  97. package/dist/{Icon-M1Rlknd0.js → Icon-CYXC4iYF.js} +1 -1
  98. package/dist/IconButton/index.js +1 -1
  99. package/dist/{IconButton-4BXILpv-.js → IconButton-CzU-cz_H.js} +1 -1
  100. package/dist/Indicator/index.d.ts +2 -2
  101. package/dist/Indicator/index.js +1 -1
  102. package/dist/InfoTip/index.d.ts +1 -1
  103. package/dist/InfoTip/index.js +1 -1
  104. package/dist/{InfoTip-D2MzKXZH.js → InfoTip-Ckhg715K.js} +3 -3
  105. package/dist/{InputClearButton-Cm5Q3KK2.js → InputClearButton-Btjd5Lnk.js} +2 -2
  106. package/dist/InputGroup/index.js +1 -1
  107. package/dist/{InputGroup-CjB_XpEy.js → InputGroup-C388xPHC.js} +1 -1
  108. package/dist/InternationalizationProvider/index.d.ts +1 -1
  109. package/dist/InternationalizationProvider/index.js +1 -1
  110. package/dist/{InternationalizationProvider-yLbf4Wi_.js → InternationalizationProvider-BkJ8Z7ox.js} +1 -1
  111. package/dist/{Item-CKYsTbM4.js → Item-DrV3f4fe.js} +12 -28
  112. package/dist/{LayerContentBoundary-D67fobWl.js → LayerContentBoundary-iYtfCpG9.js} +1 -1
  113. package/dist/Layout/index.js +2 -2
  114. package/dist/{Layout-BDS2ZN6C.js → Layout-DTSKNAzq.js} +1 -1
  115. package/dist/{LayoutPanel-D56PBM4I.js → LayoutPanel-CH4HZGLR.js} +1 -1
  116. package/dist/Lightbox/index.js +1 -1
  117. package/dist/{Lightbox-CnTXrgq6.js → Lightbox-CQhmsbhy.js} +3 -3
  118. package/dist/Link/index.d.ts +1 -1
  119. package/dist/Link/index.js +1 -1
  120. package/dist/{Link-BnM830Xa.js → Link-BsmxrY3Y.js} +3 -3
  121. package/dist/List/index.d.ts +2 -2
  122. package/dist/List/index.js +3 -2
  123. package/dist/{ListItem-B1ztelEC.js → ListItem-BEc2EF1u.js} +86 -65
  124. package/dist/Markdown/index.d.ts +1 -1
  125. package/dist/Markdown/index.js +1 -1
  126. package/dist/{Markdown-JjZLAFq2.js → Markdown-BkL2wt7F.js} +4 -4
  127. package/dist/{MediaTheme-CBkEmVe4.js → MediaTheme-BavxpAJt.js} +5 -77
  128. package/dist/MobileNav/index.js +1 -1
  129. package/dist/{MobileNavToggle-CjlgmcSf.js → MobileNavToggle-CiY__Fy9.js} +2 -2
  130. package/dist/MoreMenu/index.d.ts +1 -1
  131. package/dist/MoreMenu/index.js +1 -1
  132. package/dist/{MoreMenu-CGTbwTyw.js → MoreMenu-pvuN9vfu.js} +9 -9
  133. package/dist/MultiSelector/index.d.ts +1 -1
  134. package/dist/MultiSelector/index.js +1 -1
  135. package/dist/{MultiSelector-DUQMNBoZ.js → MultiSelector-sD97taHQ.js} +11 -11
  136. package/dist/{NavDisclosure-BpYjtYo5.js → NavDisclosure-l2h8R_ub.js} +10 -3
  137. package/dist/{NavHeadingSurface-CK9zMjFC.js → NavHeadingSurface-C3QJ64vm.js} +4 -2
  138. package/dist/NavItem/index.js +1 -1
  139. package/dist/{NavItem-DTO-BEfc.js → NavItem-BbnusKbo.js} +1 -1
  140. package/dist/NavMenu/index.d.ts +1 -1
  141. package/dist/NavMenu/index.js +3 -3
  142. package/dist/{NavMenu-BflnhBtX.js → NavMenu-BRWghdCF.js} +2 -2
  143. package/dist/{NavMenuItem-CrFrczWe.js → NavMenuItem-BtYmdZGe.js} +3 -3
  144. package/dist/NumberInput/index.d.ts +1 -1
  145. package/dist/NumberInput/index.js +1 -1
  146. package/dist/{NumberInput-vWUcgJU8.js → NumberInput-B3Y_NOui.js} +6 -6
  147. package/dist/Outline/index.js +1 -1
  148. package/dist/{Outline-D4DJTfKp.js → Outline-DGntLLCe.js} +2 -2
  149. package/dist/OverflowList/index.d.ts +1 -1
  150. package/dist/OverflowList/index.js +1 -1
  151. package/dist/{OverflowList-D9Ua6e3-.js → OverflowList-DJBaY3B_.js} +2 -2
  152. package/dist/Overlay/index.d.ts +1 -1
  153. package/dist/Pagination/index.js +1 -1
  154. package/dist/{Pagination-DBikmHyn.js → Pagination-BJKFuELz.js} +3 -3
  155. package/dist/{PanGestureRecognizer-C-gk9mOy.js → PanGestureRecognizer-K-I6ORwh.js} +3 -3
  156. package/dist/{PickerWheel-sIOSfcfO.js → PickerWheel-J5F_ecWb.js} +15 -15
  157. package/dist/Popover/index.d.ts +2 -2
  158. package/dist/Popover/index.js +1 -1
  159. package/dist/{Popover-CTCWhA_K.js → Popover-CVZnqsUy.js} +10 -10
  160. package/dist/PowerSearch/index.d.ts +1 -1
  161. package/dist/PowerSearch/index.js +1 -1
  162. package/dist/{PowerSearch-CTNFHNnr.js → PowerSearch-BHTHVINR.js} +30 -30
  163. package/dist/{PressTracker-CPRIrG4f.js → PressTracker-Byalgid0.js} +3 -3
  164. package/dist/ProgressBar/index.js +1 -1
  165. package/dist/{ProgressBar-B2ds3imd.js → ProgressBar-DJ79DNQq.js} +4 -4
  166. package/dist/Radio/index.d.ts +1 -1
  167. package/dist/Radio/index.js +1 -1
  168. package/dist/{RadioGroup-OLFNjvKt.js → RadioGroup-CvMj98z_.js} +6 -6
  169. package/dist/RadioList/index.d.ts +1 -1
  170. package/dist/RadioList/index.js +1 -1
  171. package/dist/{RadioListItem-BAEF0vc8.js → RadioListItem-CptY2wdB.js} +1 -1
  172. package/dist/Resizable/index.d.ts +1 -1
  173. package/dist/Resizable/index.js +1 -1
  174. package/dist/{ResizeHandle-Bd4TdK7E.js → ResizeHandle-ruXeaXUT.js} +2 -2
  175. package/dist/ScrollableArea/index.d.ts +1 -1
  176. package/dist/SegmentedControl/index.js +1 -1
  177. package/dist/{SegmentedControl-C0xXOVTv.js → SegmentedControl-DMxIY7uq.js} +10 -10
  178. package/dist/SelectableCard/index.d.ts +1 -1
  179. package/dist/SelectableCard/index.js +1 -1
  180. package/dist/{SelectableCard-B2QbpWiT.js → SelectableCard-BSgi3FJf.js} +1 -1
  181. package/dist/Selector/index.d.ts +1 -1
  182. package/dist/Selector/index.js +1 -1
  183. package/dist/{Selector-BvxQXUYr.js → Selector-DhKtSP71.js} +9 -9
  184. package/dist/SideNav/index.d.ts +1 -1
  185. package/dist/SideNav/index.js +2 -2
  186. package/dist/{SideNav-D8jQrwtL.js → SideNav-DOXNxEIp.js} +11 -11
  187. package/dist/Slider/index.js +1 -1
  188. package/dist/{Slider-Bd5fxqRa.js → Slider-D5GYcH4S.js} +13 -13
  189. package/dist/Spinner/index.js +1 -1
  190. package/dist/{Spinner-D1adu3uH.js → Spinner-lLOYfbOY.js} +1 -1
  191. package/dist/Stack/index.d.ts +1 -1
  192. package/dist/StatusDot/index.js +1 -1
  193. package/dist/{StatusDot-Jw676Z_6.js → StatusDot-DOf6Q4MC.js} +1 -1
  194. package/dist/Stepper/index.js +1 -1
  195. package/dist/{Stepper-3oMdVe0c.js → Stepper-0ycdCwND.js} +2 -2
  196. package/dist/Switch/index.d.ts +1 -1
  197. package/dist/Switch/index.js +1 -1
  198. package/dist/{Switch-COKmqJQU.js → Switch-DDHf_9iJ.js} +15 -15
  199. package/dist/TabList/index.js +1 -1
  200. package/dist/{TabList-DjRutwar.js → TabList-BnLUktgm.js} +4 -4
  201. package/dist/Table/index.d.ts +1 -1
  202. package/dist/Table/index.js +1 -1
  203. package/dist/{Table-3GiSElIS.js → Table-B49mlc0R.js} +17 -17
  204. package/dist/Text/index.d.ts +1 -1
  205. package/dist/Text/index.js +1 -1
  206. package/dist/{Text-bvai__ae.js → Text-CILdp7jE.js} +1 -1
  207. package/dist/TextArea/index.d.ts +1 -1
  208. package/dist/TextArea/index.js +1 -1
  209. package/dist/{TextArea-BtBC4IoD.js → TextArea-BSB5WIpK.js} +7 -7
  210. package/dist/TextInput/index.d.ts +1 -1
  211. package/dist/TextInput/index.js +1 -1
  212. package/dist/{TextInput-cotkU2bC.js → TextInput-Ck-6Mtbt.js} +7 -7
  213. package/dist/Theme/index.d.ts +3 -3
  214. package/dist/Theme/index.js +3 -3
  215. package/dist/{Theme-CwruhtLu.js → Theme-B_kAJHy2.js} +111 -23
  216. package/dist/Thumbnail/index.js +1 -1
  217. package/dist/{Thumbnail-oqrKH-co.js → Thumbnail-Tg50Msul.js} +6 -6
  218. package/dist/{TimeField-BYuUKUNq.js → TimeField-CLD_j1tX.js} +8 -8
  219. package/dist/TimeInput/index.d.ts +1 -1
  220. package/dist/TimeInput/index.js +1 -1
  221. package/dist/{TimeInput-Bqo_oHMl.js → TimeInput-DuijuQMd.js} +2 -2
  222. package/dist/Timer/index.d.ts +1 -1
  223. package/dist/Timer/index.js +1 -1
  224. package/dist/{Timer-CO-JNJTI.js → Timer-DOoFQEBD.js} +1 -1
  225. package/dist/Timestamp/index.d.ts +1 -1
  226. package/dist/Timestamp/index.js +1 -1
  227. package/dist/{Timestamp-CfzqAAX2.js → Timestamp-D8fyTuhk.js} +5 -5
  228. package/dist/Toast/index.js +1 -1
  229. package/dist/{Toast-BSay0eZw.js → Toast-51l_F_YA.js} +7 -6
  230. package/dist/ToggleButton/index.d.ts +1 -1
  231. package/dist/ToggleButton/index.js +1 -1
  232. package/dist/{ToggleButton-Ditxp2jT.js → ToggleButton-_fEU63Nz.js} +3 -3
  233. package/dist/Token/index.d.ts +1 -1
  234. package/dist/Token/index.js +1 -1
  235. package/dist/{Token-Dk6MPUkH.js → Token-Di7w9Cvr.js} +2 -2
  236. package/dist/Tokenizer/index.js +1 -1
  237. package/dist/{Tokenizer-D-wBxbBE.js → Tokenizer-wWybLovw.js} +16 -16
  238. package/dist/Toolbar/index.d.ts +1 -1
  239. package/dist/Tooltip/index.d.ts +1 -1
  240. package/dist/Tooltip/index.js +2 -2
  241. package/dist/{Tooltip-BdG9g6c6.js → Tooltip-DPiEYfao.js} +1 -1
  242. package/dist/TopNav/index.d.ts +1 -1
  243. package/dist/TopNav/index.js +1 -1
  244. package/dist/{TopNav-D7jH9iwk.js → TopNav-GvK-XIRl.js} +8 -8
  245. package/dist/TreeList/index.js +1 -1
  246. package/dist/{TreeList-Dnx-uco3.js → TreeList-CfELZwbQ.js} +6 -6
  247. package/dist/Typeahead/index.js +2 -2
  248. package/dist/{Typeahead-Cx086Mmv.js → Typeahead-DtNM4311.js} +8 -8
  249. package/dist/{VelocityTracker-CPFBHDpy.js → VelocityTracker-CWqXCLNe.js} +1 -1
  250. package/dist/{accessibleName-CHrrgpAy.js → accessibleName-CYV4uRm9.js} +5 -5
  251. package/dist/{adaptationTypes-D874ONPJ.d.ts → adaptationTypes-D5HrfPSt.d.ts} +9 -0
  252. package/dist/{animator-Bptiubcx.js → animator-i7djdtNK.js} +3 -3
  253. package/dist/{assertOptions-Byu4Yqfg.js → assertOptions-BOwrrTT-.js} +1 -1
  254. package/dist/{boxHold-D1G2s1tG.js → boxHold-ig0sUg95.js} +1 -1
  255. package/dist/colorMode-DVs86FF2.js +49 -0
  256. package/dist/{compactDefinition-CMTR5KqU.d.ts → compactDefinition-BPg0hR8Q.d.ts} +1 -1
  257. package/dist/{compactDefinition-BeFUKEFg.js → compactDefinition-D32f2O_H.js} +1 -1
  258. package/dist/composables/index.d.ts +3 -2
  259. package/dist/composables/index.js +12 -12
  260. package/dist/{composables-CpG7bhuQ.js → composables-D5840uKi.js} +2425 -204
  261. package/dist/{context-Dweha8vW.js → context-CLCiYDtY.js} +3 -2
  262. package/dist/context-CwV8eyUd.js +12 -0
  263. package/dist/contrast-B0fsdq4U.js +75 -0
  264. package/dist/createReorderable-Bw3Q9mUd.d.ts +55 -0
  265. package/dist/{decay-TluwbMlP.js → decay-DGF4-sPB.js} +1 -1
  266. package/dist/{geometry-BRW7FETc.js → geometry-BBqUriul.js} +1 -1
  267. package/dist/{gestures-yKyyMqeQ.js → gestures-CP1MX1rx.js} +1 -1
  268. package/dist/{haptics-BEgivjBd.js → haptics-By_893U8.js} +3 -3
  269. package/dist/{index-DvCLTiDV.d.ts → index-4_uuTfaY.d.ts} +1 -1
  270. package/dist/{index-tXYy8MJ0.d.ts → index-BIcmTipH.d.ts} +1 -1
  271. package/dist/{index-BB9acgK8.d.ts → index-BgT6mH3U.d.ts} +1 -1
  272. package/dist/{index-BhpRhww0.d.ts → index-Bk2SsmEu.d.ts} +3 -3
  273. package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
  274. package/dist/{index-CZ29Xu_E.d.ts → index-Bwh8O-v8.d.ts} +1 -1
  275. package/dist/{index-sUMua5pp.d.ts → index-BzaRSOA3.d.ts} +28 -1
  276. package/dist/{index-BIQZa2BD.d.ts → index-CAP19BZD.d.ts} +9 -0
  277. package/dist/index-CDZhxbEp.d.ts +44 -0
  278. package/dist/{index-CQi9WGWE.d.ts → index-CEdoNcHF.d.ts} +1 -1
  279. package/dist/{index-DjSQLT53.d.ts → index-COqeB2ug.d.ts} +1 -1
  280. package/dist/{index-DkYOGpsC.d.ts → index-CTo75wH5.d.ts} +1 -1
  281. package/dist/{index-CilCxEvD.d.ts → index-CqvIpZ-t.d.ts} +2 -2
  282. package/dist/{index-OP4ntESa.d.ts → index-DLPSlnXP.d.ts} +1 -1
  283. package/dist/{index-CGRtGORf.d.ts → index-DXGoFpRN.d.ts} +52 -2
  284. package/dist/{index-B44fLswd.d.ts → index-DYabo8TI.d.ts} +2 -2
  285. package/dist/{index-Dk50Zh3F.d.ts → index-DofC9Rll.d.ts} +2 -2
  286. package/dist/{index-hwP1oWCA.d.ts → index-EyFu5eSZ.d.ts} +3 -3
  287. package/dist/{index-EUzmHHm6.d.ts → index-WBF_zxXX.d.ts} +2 -2
  288. package/dist/{index-BA8exXNP.d.ts → index-X4S7_dmq.d.ts} +1 -1
  289. package/dist/{index-B7Rd2RuL.d.ts → index-ZXDolNI1.d.ts} +44 -44
  290. package/dist/{index-CtYlR9Cu.d.ts → index-rdwI-mcm.d.ts} +1 -1
  291. package/dist/{index-C89cIh4E.d.ts → index-waTkqxTz.d.ts} +1 -1
  292. package/dist/index.d.ts +33 -30
  293. package/dist/index.js +125 -123
  294. package/dist/inertClone-BUK-k6-n.js +83 -0
  295. package/dist/itemSlots-BxUu7hje.js +54 -0
  296. package/dist/keyboard-hint-DZrL82bU.js +48 -0
  297. package/dist/{landing-CrVewjeb.js → landing-DjJvKu3c.js} +1 -1
  298. package/dist/{layerDepth-DRfWATFr.js → layerDepth-C4altnV8.js} +1 -1
  299. package/dist/{lazyBottomSheet-C6Rw8yoX.js → lazyBottomSheet-DUPKYGf1.js} +1 -1
  300. package/dist/{linearEasing-VHwy6xl_.js → linearEasing-CDsqxyiS.js} +1 -1
  301. package/dist/{loadCatalog-CdEXyPYj.d.ts → loadCatalog-S2AgQN51.d.ts} +40 -1
  302. package/dist/{loadCatalog-CKntEldg.js → loadCatalog-baFZaTpj.js} +76 -5
  303. package/dist/locale/index.d.ts +3 -3
  304. package/dist/locale/index.js +5 -5
  305. package/dist/{locale-CHA0DNw5.js → locale-BIyfn-cf.js} +1 -1
  306. package/dist/motionTokenDefaults-EFzpiAF5.js +38 -0
  307. package/dist/palette/index.d.ts +3 -0
  308. package/dist/palette/index.js +2 -0
  309. package/dist/palette-DlNBLR8U.js +2114 -0
  310. package/dist/{position-DwHfneha.js → position-CkZfFubr.js} +1 -1
  311. package/dist/{presentationHold-ZKixVLcz.js → presentationHold-Bjjux3fp.js} +1 -1
  312. package/dist/{pressGesture-CfBgXWRM.js → pressGesture-ZTBGwYpT.js} +1 -1
  313. package/dist/{pressSlot-B6TvGkSO.js → pressSlot-zlwhNl9N.js} +1 -1
  314. package/dist/{projection-qPcLQcwK.js → projection-DzrWyxL1.js} +1 -1
  315. package/dist/{reducedMotion-D8-U7XFT.js → reducedMotion-BHRhHfWB.js} +2 -2
  316. package/dist/reorderTypes-CvmAkO-R.js +55 -0
  317. package/dist/{reportChange-CUo2YNPB.js → reportChange-wIeU3q3y.js} +3 -3
  318. package/dist/{resizableChannel-DpbFJbto.js → resizableChannel-b7iQNnCj.js} +4 -4
  319. package/dist/{resolveMotion-DftkGFw6.js → resolveMotion-BCM4CX-R.js} +2 -2
  320. package/dist/{resolveSnapPoint-A4dhS5jj.js → resolveSnapPoint-D1yU-Z-K.js} +1 -1
  321. package/dist/{rideKeyboard-BCzVooOd.js → rideKeyboard-BKGLLMuU.js} +2 -2
  322. package/dist/{roles-DWH31Bn3.js → roles-D6hLs7Rg.js} +1 -1
  323. package/dist/{rubberBand-DDd5ElTe.js → rubberBand-C-2erWWl.js} +1 -1
  324. package/dist/scrollingAncestor-DMWTn_Ih.js +36 -0
  325. package/dist/{springs-CPk0tpwL.js → springs-B5hVbZta.js} +1 -1
  326. package/dist/{stillPointerGate-BU1CKW7m.js → stillPointerGate-DXFzBeMy.js} +1 -1
  327. package/dist/{themeTiming-BJziEh4O.js → themeTiming-DOf0j6SM.js} +3 -2
  328. package/dist/{tokenReferences-sKpv-7_O.js → tokenReferences-CdmofltU.js} +1 -38
  329. package/dist/{tooltipFocusRules-GGASOH_U.js → tooltipFocusRules-R21SPfWy.js} +2 -2
  330. package/dist/{tooltipTriggerRules-DIaGdkD_.js → tooltipTriggerRules-CoGD2lVn.js} +1 -1
  331. package/dist/{transientCopy-VAsg2a46.js → transientCopy--76J3N2f.js} +2 -83
  332. package/dist/{triggerVariant-DPuBmzpp.js → triggerVariant-CRQoD-4F.js} +1 -1
  333. package/dist/{types-BHHT6Bho.d.ts → types-D9mwL8sz.d.ts} +25 -0
  334. package/dist/{types-D97oBk6c.d.ts → types-DTlpQo7j.d.ts} +1 -1
  335. package/dist/types-DypDQlbk.d.ts +176 -0
  336. package/dist/{useActionGroupTracking-C-nLjHyn.js → useActionGroupTracking-DB5xIxPW.js} +3 -3
  337. package/dist/{useAnimatedLayout-Dq-cttfe.js → useAnimatedLayout-CXjd5pjG.js} +1 -1
  338. package/dist/{useChatStreamScroll-3mJvbNtI.js → useChatStreamScroll-BQpGHGAr.js} +1 -1
  339. package/dist/{useDismiss-CegXF2Zo.js → useDismiss-yu_sIa7a.js} +33 -2
  340. package/dist/{useGestureRecognizer-Di-YKr93.js → useGestureRecognizer-BKzTWKYx.js} +1 -1
  341. package/dist/{useHeldPresentation-CaIKTwUh.js → useHeldPresentation-0Z0Untra.js} +1 -1
  342. package/dist/{useIndicator-PFDBNOvX.js → useIndicator-Co1ERlg-.js} +2 -2
  343. package/dist/{useInputStatusIcon-CXP2kRSe.js → useInputStatusIcon-DJfhmCiH.js} +2 -2
  344. package/dist/{useMediaQuery-BzXGT1Aw.js → useMediaQuery-DKnSDG3S.js} +1 -1
  345. package/dist/{useMenuHover-DoBatZeD.js → useMenuHover-Dahcf3qo.js} +1 -1
  346. package/dist/{useMenuPress-kjmot8Bn.js → useMenuPress-DrrOBqjM.js} +1 -1
  347. package/dist/{useMobileKeyboard-BDPV51xl.js → useMobileKeyboard-Cibxl8ZC.js} +5 -39
  348. package/dist/{usePressFeedback-CF4ISMfb.js → usePressFeedback-BEY9kk8T.js} +3 -3
  349. package/dist/{useResizable-7-uUaJ7x.js → useResizable-CJQAV_tU.js} +6 -6
  350. package/dist/useResolvedColorMode-CyZjLvfj.js +159 -0
  351. package/dist/{useTooltip-DCp4sTM1.js → useTooltip-B2RrDbtI.js} +4 -4
  352. package/dist/{useTouchHitArea-CkHMLZ34.js → useTouchHitArea-DvKV21NY.js} +1 -1
  353. package/dist/{useTouchTriggerInternal-C_mowlpv.js → useTouchTriggerInternal-Obcx-oKN.js} +1 -1
  354. package/dist/{useTruncationTooltip-Du80jGdE.js → useTruncationTooltip-RUl8qSGz.js} +3 -3
  355. package/dist/{useTypeaheadMenuConfig-B14t0HGE.js → useTypeaheadMenuConfig-0glQWHQd.js} +2 -2
  356. package/package.json +5 -1
  357. package/styles/list-reorder.css +137 -0
  358. package/styles/nav-menu.css +5 -0
  359. package/styles/side-nav.css +7 -4
  360. package/styles/top-nav.css +7 -4
  361. package/styles.css +1 -0
  362. package/dist/context-Cws_tXTr.js +0 -7
  363. package/dist/keyboard-hint-KWx0-7kD.js +0 -7
  364. package/dist/useResolvedColorMode-Df97_9w_.js +0 -78
  365. package/dist/{Calendar-B6TZYEge.js → Calendar-DbAQvHgy.js} +1 -1
  366. package/dist/{index-BqhgeAT4.d.ts → index-5FGt4HsB.d.ts} +1 -1
@@ -1,28 +1,41 @@
1
- import { a as registerMotionTable, d as toSpring } from "./roles-DWH31Bn3.js";
2
- import { c as solveSpring } from "./linearEasing-VHwy6xl_.js";
3
- import { i as UIKIT_LONG_PRESS, l as registerScrollTable, s as UIKIT_TAP, u as scroll } from "./gestures-yKyyMqeQ.js";
4
- import { o as pushLayer } from "./layerDepth-DRfWATFr.js";
5
- import { t as useMediaQuery } from "./useMediaQuery-BzXGT1Aw.js";
6
- import { c as motionNow } from "./cssValues-Cr6PhYTx.js";
7
- import { n as createMotionEngine, r as SETTLE_THRESHOLD } from "./animator-Bptiubcx.js";
1
+ import { a as subscribeInput } from "./inputStream-DmPkJ1aU.js";
2
+ import { n as useTouchHitArea } from "./useTouchHitArea-DvKV21NY.js";
3
+ import { a as registerMotionTable, f as toSpring, u as durationBounceOf } from "./roles-D6hLs7Rg.js";
4
+ import { c as solveSpring } from "./linearEasing-CDsqxyiS.js";
5
+ import { i as UIKIT_LONG_PRESS, l as registerScrollTable, r as UIKIT_GESTURES, s as UIKIT_TAP, u as scroll } from "./gestures-CP1MX1rx.js";
6
+ import { r as useResolvedLayerTeleport } from "./useLayerMountTarget-zwZQglr2.js";
7
+ import { o as pushLayer } from "./layerDepth-C4altnV8.js";
8
+ import { t as useCoarsePointer } from "./useCoarsePointer-GItEMrjX.js";
9
+ import { t as useMediaQuery } from "./useMediaQuery-DKnSDG3S.js";
10
+ import { c as motionNow, s as isIdentityText } from "./cssValues-Cr6PhYTx.js";
11
+ import { n as createMotionEngine, r as SETTLE_THRESHOLD, t as animatorFor } from "./animator-i7djdtNK.js";
12
+ import { n as isDevBuild } from "./devBuild-G249YcdZ.js";
8
13
  import { t as devWarn } from "./useDevWarning-B2fsk2B-.js";
9
- import { t as resolveMotion } from "./resolveMotion-DftkGFw6.js";
10
- import { t as solveDecay } from "./decay-TluwbMlP.js";
11
- import { o as registerSpringsTable, s as springs } from "./springs-CPk0tpwL.js";
12
- import { c as MANIPULATION, i as getGestureHost, l as isActive, r as travel } from "./geometry-BRW7FETc.js";
13
- import { n as GestureRecognizer, t as PanGestureRecognizer } from "./PanGestureRecognizer-C-gk9mOy.js";
14
+ import { t as resolveMotion } from "./resolveMotion-BCM4CX-R.js";
15
+ import { t as solveDecay } from "./decay-DGF4-sPB.js";
16
+ import { o as registerSpringsTable, s as springs } from "./springs-B5hVbZta.js";
17
+ import { c as MANIPULATION, i as getGestureHost, l as isActive, r as travel } from "./geometry-BBqUriul.js";
18
+ import { n as GestureRecognizer, t as PanGestureRecognizer } from "./PanGestureRecognizer-K-I6ORwh.js";
14
19
  import { i as locksSelectionFor, n as lockSelection } from "./selectionLock-BM8XEZQD.js";
15
- import { t as resolveSnapPoint } from "./resolveSnapPoint-A4dhS5jj.js";
16
- import { t as useAttachment } from "./useAttachment-CGiD9rt6.js";
20
+ import { t as VelocityTracker } from "./VelocityTracker-CWqXCLNe.js";
21
+ import { t as resolveSnapPoint } from "./resolveSnapPoint-D1yU-Z-K.js";
17
22
  import { o as useComponentMessages } from "./context-B8IEFCDR.js";
18
- import { t as _sfc_main$1 } from "./Kbd-CbD993ig.js";
19
- import { t as keyboardHintMessages } from "./keyboard-hint-KWx0-7kD.js";
23
+ import { n as listMessages, t as keyboardHintMessages } from "./keyboard-hint-DZrL82bU.js";
24
+ import { l as useListContext, r as useItemLabelId } from "./itemSlots-BxUu7hje.js";
25
+ import { t as useAnnounce } from "./announce-GU01Oix2.js";
26
+ import { t as _sfc_main$5 } from "./Kbd-CbD993ig.js";
27
+ import { n as paintedBackground, t as inertClone } from "./inertClone-BUK-k6-n.js";
28
+ import { t as nearestScroller } from "./scrollingAncestor-DMWTn_Ih.js";
29
+ import { a as markLeaving, n as isLeaving, t as REORDER_ENGINE } from "./reorderTypes-CvmAkO-R.js";
30
+ import { t as useAttachment } from "./useAttachment-CGiD9rt6.js";
20
31
  import { n as observeResize } from "./sharedResizeObserver-BekhnB3E.js";
21
32
  import { r as makeSnapPaging, s as snapPages } from "./snapPagingValue-B5hfph1H.js";
22
- import { t as useTouchTriggerInternal } from "./useTouchTriggerInternal-C_mowlpv.js";
23
- import { Fragment, computed, createBlock, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, getCurrentScope, h, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, ref, renderList, toDisplayString, toValue, unref, vShow, watch, withDirectives } from "vue";
24
- import "../styles/indicator-focus-ring.css";
33
+ import { t as useTouchTriggerInternal } from "./useTouchTriggerInternal-Obcx-oKN.js";
34
+ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, getCurrentScope, h, mergeProps, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, toValue, unref, useId, useTemplateRef, vShow, watch, watchEffect, withCtx, withDirectives, withModifiers } from "vue";
35
+ import "../styles/layer.css";
36
+ import "../styles/list-reorder.css";
25
37
  import "../styles/keyboard-hint.css";
38
+ import "../styles/indicator-focus-ring.css";
26
39
  //#region src/motion/coast.ts
27
40
  /** A curve that holds `end` from `duration` on. */
28
41
  function settling(duration, end, at, velocity) {
@@ -704,97 +717,2380 @@ function createSnapDrag(element, options) {
704
717
  ...flight.passed ? {} : { onPass },
705
718
  velocity: 0
706
719
  });
707
- if (drag != null) drag.startIndex = nearest(startPoint ?? drag.start);
708
- return;
720
+ if (drag != null) drag.startIndex = nearest(startPoint ?? drag.start);
721
+ return;
722
+ }
723
+ targetIndex = nearest(startPoint ?? position());
724
+ if (drag != null) drag.startIndex = targetIndex;
725
+ },
726
+ snapPoints() {
727
+ return points;
728
+ },
729
+ animator,
730
+ position,
731
+ finishSettle() {
732
+ const finish = finishCompositor;
733
+ if (compositor == null || finish == null) return;
734
+ compositor.stop();
735
+ finish();
736
+ },
737
+ destroy() {
738
+ if (destroyed) return;
739
+ destroyed = true;
740
+ pan.destroy();
741
+ holdCompositor();
742
+ animator.stop();
743
+ animator.dispose();
744
+ }
745
+ };
746
+ }
747
+ //#endregion
748
+ //#region src/dragToSnapPoints/createDragToSnapPoints.ts
749
+ /**
750
+ * @file createDragToSnapPoints.ts
751
+ * @input An element and its snap points
752
+ * @output The public snap-point drag: `createDragToSnapPoints`, its options
753
+ * and handle. Also re-exports createSnapDrag and its types (the drag under
754
+ * it, with the options only Core passes), which no package entry exports.
755
+ * @position Public entry point, re-exported from the package through
756
+ * composables/createDragToSnapPoints.ts, and wrapped by
757
+ * `useDragToSnapPoints`. Importing it does no DOM work.
758
+ *
759
+ * SYNC: When modified, update:
760
+ * - createDragToSnapPoints.test.ts
761
+ * - ../composables/useDragToSnapPoints.ts
762
+ * - the use-drag-to-snap-points docs
763
+ */
764
+ /**
765
+ * Lets a drag move `element` along `axis` and settles it on `snapPoints` at
766
+ * the release, then calls `onSettle(index)`.
767
+ *
768
+ * The release settles on the nearest snap point. A release faster than
769
+ * `flickThreshold` carries to the next one in its direction. A release that
770
+ * moves back toward the drag's start returns to the snap point it started
771
+ * from. The settle springs from the release velocity. Under Reduce Motion,
772
+ * the release cross-fades after a touch drag or on a coarse primary pointer,
773
+ * and lands at once elsewhere. `settleTo(index)` settles without a drag, for
774
+ * the keyboard.
775
+ *
776
+ * @example
777
+ * ```ts
778
+ * const snap = createDragToSnapPoints(drawer, {
779
+ * axis: 'y',
780
+ * snapPoints: [0, 240, 480],
781
+ * onSettle: index => console.log('settled on', index),
782
+ * })
783
+ * button.addEventListener('click', () => snap.settleTo(0))
784
+ * // Later:
785
+ * snap.destroy()
786
+ * ```
787
+ */
788
+ function createDragToSnapPoints(element, options) {
789
+ const { axis, flickThreshold, onSettle } = options;
790
+ if (!options.snapPoints.some((point) => Number.isFinite(point))) {
791
+ devWarn("createDragToSnapPoints", "snapPoints is empty, so the drag does nothing.");
792
+ return {
793
+ settleTo() {},
794
+ destroy() {}
795
+ };
796
+ }
797
+ const snap = createSnapDrag(element, {
798
+ axis,
799
+ snapPoints: options.snapPoints,
800
+ ...flickThreshold != null ? { flickThreshold } : {},
801
+ onSettle
802
+ });
803
+ return {
804
+ settleTo(index) {
805
+ snap.settleTo(index);
806
+ },
807
+ destroy() {
808
+ snap.destroy();
809
+ }
810
+ };
811
+ }
812
+ //#endregion
813
+ //#region src/List/reorder/reorderMarks.ts
814
+ /**
815
+ * @file reorderMarks.ts
816
+ * @input A reorderable List's element, its rows and its handles
817
+ * @output The private data attributes of the reorder: a handle
818
+ * (`data-astryx-list-reorder`), the list while it reorders
819
+ * (`data-astryx-reordering`), its insertion line
820
+ * (`data-astryx-reorder-line`), the dimmed source row
821
+ * (`data-astryx-reorder-source`) and the preview copy
822
+ * (`data-astryx-reorder-preview`)
823
+ * @position List reorder internals: only this file writes these names.
824
+ * styles/list.css reads them. Not exported from the package root.
825
+ */
826
+ const LIST_REORDER = "data-astryx-list-reorder";
827
+ const REORDERING = "data-astryx-reordering";
828
+ const REORDER_LINE = "data-astryx-reorder-line";
829
+ const REORDER_SOURCE = "data-astryx-reorder-source";
830
+ const REORDER_PREVIEW = "data-astryx-reorder-preview";
831
+ /** Bound on a reorder handle. */
832
+ const listReorderHandleAttrs = { [LIST_REORDER]: "" };
833
+ function closestReorderHandle(target) {
834
+ return target.closest(`[${LIST_REORDER}]`);
835
+ }
836
+ function reorderHandlesIn(root) {
837
+ return Array.from(root.querySelectorAll(`[${LIST_REORDER}]`));
838
+ }
839
+ /**
840
+ * The list reorders: a drag or a reorder mode move owns its next commit, and
841
+ * its handles show the grabbing cursor.
842
+ */
843
+ function markReordering(list) {
844
+ list.setAttribute(REORDERING, "");
845
+ }
846
+ function clearReordering(list) {
847
+ list.removeAttribute(REORDERING);
848
+ }
849
+ function isReordering(list) {
850
+ return list.hasAttribute(REORDERING);
851
+ }
852
+ /** The list's insertion line (its `::after`) shows. */
853
+ function showReorderLine(list) {
854
+ list.setAttribute(REORDER_LINE, "");
855
+ }
856
+ function hideReorderLine(list) {
857
+ list.removeAttribute(REORDER_LINE);
858
+ }
859
+ /** The dragged row, dimmed in its place while its preview moves. */
860
+ function markReorderSource(row) {
861
+ row.setAttribute(REORDER_SOURCE, "");
862
+ }
863
+ function clearReorderSource(row) {
864
+ row.removeAttribute(REORDER_SOURCE);
865
+ }
866
+ /** The copy of the dragged row that follows the pointer. */
867
+ function markReorderPreview(element) {
868
+ element.setAttribute(REORDER_PREVIEW, "");
869
+ }
870
+ //#endregion
871
+ //#region src/List/reorder/reorderState.ts
872
+ function messagesFrom(list) {
873
+ return {
874
+ place: (label, position, total, previous, next) => previous == null ? list.reorderPlaceTop(label, position, total, next ?? "") : next == null ? list.reorderPlaceEnd(label, position, total, previous) : list.reorderPlace(label, position, total, previous, next),
875
+ refused: list.reorderRefused,
876
+ itemAt: list.reorderItemAt,
877
+ modeDone: list.reorderModeDone,
878
+ pickedUp: list.reorderPickedUp,
879
+ dropped: list.reorderDropped,
880
+ cancelled: list.reorderCancelled
881
+ };
882
+ }
883
+ /** A handle the session has not read yet: named by its row's label. */
884
+ const UNREAD_HANDLE_NAME = {
885
+ position: null,
886
+ labelShowsNoName: false
887
+ };
888
+ function gestureStateOf(state) {
889
+ switch (state) {
890
+ case "began":
891
+ case "changed":
892
+ case "ended":
893
+ case "cancelled": return state;
894
+ case "failed": return "cancelled";
895
+ case "possible": return null;
896
+ }
897
+ }
898
+ //#endregion
899
+ //#region src/List/reorder/ListReorderHandle.vue
900
+ const _hoisted_1$4 = [
901
+ "id",
902
+ "data-row-align",
903
+ "aria-label",
904
+ "aria-labelledby",
905
+ "aria-describedby",
906
+ "aria-disabled",
907
+ "aria-pressed"
908
+ ];
909
+ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
910
+ name: "AstryxListReorderHandle",
911
+ __name: "ListReorderHandle",
912
+ props: {
913
+ label: {},
914
+ itemKey: {},
915
+ rowLabel: {},
916
+ rowLabelledBy: {},
917
+ isDisabled: {
918
+ type: Boolean,
919
+ default: false
920
+ },
921
+ rowAlign: {}
922
+ },
923
+ setup(__props) {
924
+ /**
925
+ * 可重排行末尾的手柄:一个切换按钮。鼠标按住拖过 4px、手指按住片刻后拖,都会拖动这一行;
926
+ * 点一下(或空格、回车)进入重排模式,`aria-pressed` 表示模式开着。
927
+ *
928
+ * 名字跟着行走:行有自己的名字时叫「调整「名字」的顺序」;借行的标签元素命名时只写动词,
929
+ * 后半句由 `aria-labelledby` 指过去;行没有能读的名字时按位置叫「调整第 N 项的顺序」。
930
+ */
931
+ const props = __props;
932
+ const button = useTemplateRef("button");
933
+ const list = useListContext();
934
+ const controller = computed(() => list?.reorder.value?.session);
935
+ const messages = useComponentMessages({ list: listMessages });
936
+ const labelId = useItemLabelId();
937
+ const verbId = `astryx-list-reorder-verb-${useId()}`;
938
+ const text = computed(() => (props.label ?? "").replace(/\s+/g, " ").trim());
939
+ const callerLabel = computed(() => props.rowLabel?.trim() || null);
940
+ const labelledBy = computed(() => callerLabel.value != null ? void 0 : props.rowLabelledBy ?? labelId.value ?? void 0);
941
+ const isNamed = computed(() => callerLabel.value != null || labelledBy.value != null || text.value !== "");
942
+ const byLabel = computed(() => labelId.value != null && labelledBy.value === labelId.value);
943
+ function labelText() {
944
+ const id = labelId.value;
945
+ return ((id == null ? null : button.value?.ownerDocument.getElementById(id) ?? null)?.textContent ?? "").replace(/\s+/g, " ").trim();
946
+ }
947
+ const version = shallowRef(0);
948
+ function bump() {
949
+ version.value += 1;
950
+ }
951
+ onMounted(() => {
952
+ watch(() => [controller.value, props.itemKey], ([session, key], _previous, onCleanup) => {
953
+ if (session == null) return;
954
+ onCleanup(session.registerHandle(button.value, key));
955
+ }, {
956
+ immediate: true,
957
+ flush: "post"
958
+ });
959
+ watch(() => [
960
+ controller.value,
961
+ callerLabel.value,
962
+ text.value,
963
+ labelId.value,
964
+ byLabel.value,
965
+ isNamed.value
966
+ ], ([session, caller, shownText, id, isByLabel, named], _previous, onCleanup) => {
967
+ if (session == null) return;
968
+ const handle = button.value;
969
+ const spoken = caller ?? (shownText !== "" ? shownText : labelText());
970
+ const unname = session.registerName(handle, spoken);
971
+ const unlabel = session.registerHandleLabel(handle, isByLabel ? id : null, named);
972
+ onCleanup(() => {
973
+ unname();
974
+ unlabel();
975
+ });
976
+ }, {
977
+ immediate: true,
978
+ flush: "post"
979
+ });
980
+ watch(controller, (session, _previous, onCleanup) => {
981
+ if (session == null) return;
982
+ const offNames = session.subscribeHandleNames(bump);
983
+ const offMode = session.subscribeMode(bump);
984
+ bump();
985
+ onCleanup(() => {
986
+ offNames();
987
+ offMode();
988
+ });
989
+ }, { immediate: true });
990
+ watch(() => [controller.value, props.isDisabled], ([session, disabled], _previous, onCleanup) => {
991
+ const handle = button.value;
992
+ if (session == null || disabled) return;
993
+ onCleanup(() => session.release(handle));
994
+ }, { immediate: true });
995
+ });
996
+ const shown = computed(() => {
997
+ version.value;
998
+ return controller.value?.handleNameOf(button.value) ?? UNREAD_HANDLE_NAME;
999
+ });
1000
+ const isPressed = computed(() => {
1001
+ version.value;
1002
+ return controller.value?.isInMode(button.value) ?? false;
1003
+ });
1004
+ const labelShowsName = computed(() => byLabel.value && !shown.value.labelShowsNoName);
1005
+ const byPlace = computed(() => byLabel.value ? !labelShowsName.value : !isNamed.value);
1006
+ const shownLabelledBy = computed(() => byLabel.value && !labelShowsName.value ? void 0 : labelledBy.value);
1007
+ const name = computed(() => {
1008
+ const list = messages.value.list;
1009
+ if (byPlace.value && shown.value.position != null) return list.reorderHandleAt(shown.value.position);
1010
+ if (callerLabel.value != null) return list.reorderHandle(callerLabel.value);
1011
+ if (labelledBy.value != null) return list.reorderHandleVerb;
1012
+ return text.value !== "" ? list.reorderHandle(text.value) : void 0;
1013
+ });
1014
+ useTouchHitArea(button, computed(() => controller.value != null && !props.isDisabled));
1015
+ function onClick() {
1016
+ const session = controller.value;
1017
+ if (session != null && !session.takeDrag(button.value) && !props.isDisabled) session.toggleMode(button.value);
1018
+ }
1019
+ function onKeyDown(event) {
1020
+ if (!props.isDisabled) controller.value?.keyDown(button.value, event);
1021
+ }
1022
+ function onBlur(event) {
1023
+ controller.value?.blur(button.value, event.relatedTarget);
1024
+ }
1025
+ /** 手指长按手柄不弹出菜单:那是拖动的开始。 */
1026
+ function onContextMenu(event) {
1027
+ if (event.pointerType === "touch") {
1028
+ event.preventDefault();
1029
+ event.stopPropagation();
1030
+ }
1031
+ }
1032
+ return (_ctx, _cache) => {
1033
+ return controller.value ? (openBlock(), createElementBlock("button", mergeProps({
1034
+ key: 0,
1035
+ id: shownLabelledBy.value == null ? void 0 : verbId,
1036
+ ref_key: "button",
1037
+ ref: button,
1038
+ type: "button",
1039
+ class: "astryx-list-reorder-handle astryx-touch-hit-area"
1040
+ }, unref(listReorderHandleAttrs), {
1041
+ "data-astryx-pressable": "",
1042
+ "data-row-align": __props.rowAlign,
1043
+ "aria-label": name.value,
1044
+ "aria-labelledby": shownLabelledBy.value == null ? void 0 : `${verbId} ${shownLabelledBy.value}`,
1045
+ "aria-describedby": controller.value.hintId,
1046
+ "aria-disabled": __props.isDisabled || void 0,
1047
+ "aria-pressed": isPressed.value,
1048
+ onClick,
1049
+ onKeydown: onKeyDown,
1050
+ onBlur,
1051
+ onPointerdown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
1052
+ onTouchstartPassive: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
1053
+ onContextmenu: onContextMenu
1054
+ }), null, 16, _hoisted_1$4)) : createCommentVNode("v-if", true);
1055
+ };
1056
+ }
1057
+ });
1058
+ //#endregion
1059
+ //#region src/List/reorder/ListReorderHintButton.vue
1060
+ const _hoisted_1$3 = ["data-text", "aria-label"];
1061
+ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1062
+ __name: "ListReorderHintButton",
1063
+ props: {
1064
+ label: {},
1065
+ isText: { type: Boolean }
1066
+ },
1067
+ emits: ["press"],
1068
+ setup(__props, { emit: __emit }) {
1069
+ /**
1070
+ * 重排模式提示里的一个按钮。不进 Tab 顺序,按下时不抢焦点(焦点留在手柄上),
1071
+ * 粗指针下有放大的热区。
1072
+ */
1073
+ const emit = __emit;
1074
+ const button = useTemplateRef("button");
1075
+ useTouchHitArea(button, true);
1076
+ return (_ctx, _cache) => {
1077
+ return openBlock(), createElementBlock("button", {
1078
+ ref_key: "button",
1079
+ ref: button,
1080
+ type: "button",
1081
+ tabindex: "-1",
1082
+ class: "astryx-list-reorder-hint__button astryx-touch-hit-area",
1083
+ "data-text": __props.isText || void 0,
1084
+ "aria-label": __props.label,
1085
+ onPointerdown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
1086
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
1087
+ onClick: _cache[2] || (_cache[2] = ($event) => emit("press"))
1088
+ }, [renderSlot(_ctx.$slots, "default")], 40, _hoisted_1$3);
1089
+ };
1090
+ }
1091
+ });
1092
+ //#endregion
1093
+ //#region src/List/reorder/ListReorderModeHint.vue
1094
+ const _hoisted_1$2 = { class: "astryx-keyboard-hint__keys" };
1095
+ const GAP = 8;
1096
+ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
1097
+ __name: "ListReorderModeHint",
1098
+ props: { controller: {} },
1099
+ setup(__props) {
1100
+ /**
1101
+ * 重排模式的提示:挂在手柄下方、起始边对齐,和键盘提示同一种外观,但里面是按钮。
1102
+ * 「上移」「下移」和「完成」让只用点按的人也能一格一格挪。
1103
+ * 按钮不进 Tab 顺序,按下时不抢焦点,焦点留在手柄上。Escape 结束模式。
1104
+ */
1105
+ const props = __props;
1106
+ /** 提示和手柄之间的距离,px(spacing-2)。 */
1107
+ const messages = useComponentMessages({ list: listMessages });
1108
+ const target = shallowRef(null);
1109
+ const sentinel = useTemplateRef("sentinel");
1110
+ const hint = useTemplateRef("hint");
1111
+ const teleportTarget = useResolvedLayerTeleport(sentinel);
1112
+ const position = shallowRef({
1113
+ top: 0,
1114
+ insetInlineStart: 0
1115
+ });
1116
+ const style = computed(() => ({
1117
+ top: `${position.value.top}px`,
1118
+ insetInlineStart: `${position.value.insetInlineStart}px`
1119
+ }));
1120
+ function place() {
1121
+ const anchor = target.value;
1122
+ if (anchor == null) return;
1123
+ const rect = anchor.getBoundingClientRect();
1124
+ const view = anchor.ownerDocument.defaultView;
1125
+ const isRtl = getComputedStyle(anchor).direction === "rtl";
1126
+ position.value = {
1127
+ top: rect.bottom + GAP,
1128
+ insetInlineStart: isRtl ? (view?.innerWidth ?? 0) - rect.right : rect.left
1129
+ };
1130
+ }
1131
+ let unsubscribeMode = null;
1132
+ let unregisterLayer = null;
1133
+ const token = {};
1134
+ onMounted(() => {
1135
+ const read = () => {
1136
+ target.value = props.controller.modeTarget;
1137
+ };
1138
+ read();
1139
+ unsubscribeMode = props.controller.subscribeMode(read);
1140
+ window.addEventListener("scroll", place, true);
1141
+ window.addEventListener("resize", place);
1142
+ });
1143
+ watch(target, (anchor) => {
1144
+ unregisterLayer?.();
1145
+ unregisterLayer = null;
1146
+ if (anchor == null) return;
1147
+ place();
1148
+ unregisterLayer = pushLayer({
1149
+ token,
1150
+ getTrigger: () => target.value,
1151
+ getContainer: () => hint.value ?? null,
1152
+ dismissOnPointerOutside: false,
1153
+ dismissOnEscape: "close",
1154
+ onDismiss: () => props.controller.endMode()
1155
+ });
1156
+ }, { flush: "post" });
1157
+ watch(hint, (element) => props.controller.setHintElement(element ?? null), { flush: "post" });
1158
+ onBeforeUnmount(() => {
1159
+ unsubscribeMode?.();
1160
+ unregisterLayer?.();
1161
+ props.controller.setHintElement(null);
1162
+ window.removeEventListener("scroll", place, true);
1163
+ window.removeEventListener("resize", place);
1164
+ });
1165
+ function step(delta) {
1166
+ props.controller.step(target.value, delta);
1167
+ }
1168
+ return (_ctx, _cache) => {
1169
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("span", {
1170
+ ref_key: "sentinel",
1171
+ ref: sentinel,
1172
+ hidden: ""
1173
+ }, null, 512), target.value ? (openBlock(), createBlock(Teleport, {
1174
+ key: 0,
1175
+ to: unref(teleportTarget)
1176
+ }, [createElementVNode("span", {
1177
+ ref_key: "hint",
1178
+ ref: hint,
1179
+ class: "astryx-layer astryx-keyboard-hint astryx-list-reorder-hint",
1180
+ style: normalizeStyle(style.value)
1181
+ }, [createElementVNode("span", _hoisted_1$2, [
1182
+ createVNode(_sfc_main$3, {
1183
+ label: unref(messages).list.reorderMoveUp,
1184
+ onPress: _cache[0] || (_cache[0] = ($event) => step(-1))
1185
+ }, {
1186
+ default: withCtx(() => [createVNode(_sfc_main$5, {
1187
+ keys: "up",
1188
+ "aria-hidden": "true"
1189
+ })]),
1190
+ _: 1
1191
+ }, 8, ["label"]),
1192
+ createVNode(_sfc_main$3, {
1193
+ label: unref(messages).list.reorderMoveDown,
1194
+ onPress: _cache[1] || (_cache[1] = ($event) => step(1))
1195
+ }, {
1196
+ default: withCtx(() => [createVNode(_sfc_main$5, {
1197
+ keys: "down",
1198
+ "aria-hidden": "true"
1199
+ })]),
1200
+ _: 1
1201
+ }, 8, ["label"]),
1202
+ createVNode(_sfc_main$3, {
1203
+ "is-text": "",
1204
+ onPress: _cache[2] || (_cache[2] = ($event) => __props.controller.endMode())
1205
+ }, {
1206
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).list.reorderDone), 1)]),
1207
+ _: 1
1208
+ })
1209
+ ])], 4)], 8, ["to"])) : createCommentVNode("v-if", true)], 64);
1210
+ };
1211
+ }
1212
+ });
1213
+ //#endregion
1214
+ //#region src/List/reorder/ListReorderHost.vue
1215
+ const _hoisted_1$1 = ["id"];
1216
+ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
1217
+ __name: "ListReorderHost",
1218
+ props: { reorder: {} },
1219
+ setup(__props) {
1220
+ /**
1221
+ * 一个可重排 List 的会话宿主,List 把它渲染在列表元素旁边。
1222
+ * 每次渲染把回调、文案和呈现方式交给会话;挂上鼠标、触摸和命名的监听;
1223
+ * 记下这个会话挂在哪个可重排对象上(`start` 靠它找列表);卸载时收掉会话。
1224
+ * 还渲染手柄共用的隐藏说明和重排模式的提示。
1225
+ */
1226
+ const props = __props;
1227
+ const controller = computed(() => props.reorder.session);
1228
+ const announce = useAnnounce();
1229
+ const messages = useComponentMessages({ list: listMessages });
1230
+ const isTouch = useCoarsePointer();
1231
+ watchEffect(() => {
1232
+ controller.value.configure({
1233
+ options: props.reorder.options,
1234
+ announce,
1235
+ messages: messagesFrom(messages.value.list),
1236
+ presentation: isTouch.value ? "uikit" : "theme"
1237
+ });
1238
+ }, { flush: "sync" });
1239
+ onMounted(() => {
1240
+ watch(controller, (session, _previous, onCleanup) => {
1241
+ const detachMouse = session.attachMouse();
1242
+ const detachNames = session.attachNames();
1243
+ onCleanup(() => {
1244
+ detachMouse();
1245
+ detachNames();
1246
+ session.dispose();
1247
+ });
1248
+ }, {
1249
+ immediate: true,
1250
+ flush: "post"
1251
+ });
1252
+ watch(() => [controller.value, props.reorder.options.startedBy ?? props.reorder.options], ([session, startedBy], _previous, onCleanup) => onCleanup(mountSession(startedBy, session)), {
1253
+ immediate: true,
1254
+ flush: "post"
1255
+ });
1256
+ watch(() => [controller.value, isTouch.value], ([session, touch], _previous, onCleanup) => onCleanup(session.attachTouch(touch)), {
1257
+ immediate: true,
1258
+ flush: "post"
1259
+ });
1260
+ });
1261
+ return (_ctx, _cache) => {
1262
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("span", {
1263
+ id: controller.value.hintId,
1264
+ hidden: ""
1265
+ }, toDisplayString(unref(messages).list.reorderHint), 9, _hoisted_1$1), createVNode(_sfc_main$2, { controller: controller.value }, null, 8, ["controller"])], 64);
1266
+ };
1267
+ }
1268
+ });
1269
+ //#endregion
1270
+ //#region src/List/reorder/ListReorderRowName.ts
1271
+ var ListReorderRowName_default = defineComponent({
1272
+ name: "AstryxListReorderRowName",
1273
+ props: {
1274
+ row: {
1275
+ type: Function,
1276
+ required: true
1277
+ },
1278
+ label: {
1279
+ type: String,
1280
+ default: ""
1281
+ }
1282
+ },
1283
+ setup(props) {
1284
+ const list = useListContext();
1285
+ const controller = computed(() => list?.reorder.value?.session);
1286
+ const text = computed(() => props.label.replace(/\s+/g, " ").trim());
1287
+ onMounted(() => {
1288
+ watch(() => [controller.value, text.value], ([session, name], _previous, onCleanup) => {
1289
+ if (session != null) onCleanup(session.registerName(props.row(), name));
1290
+ }, {
1291
+ immediate: true,
1292
+ flush: "post"
1293
+ });
1294
+ });
1295
+ return () => null;
1296
+ }
1297
+ });
1298
+ //#endregion
1299
+ //#region src/utils/rowMotion.ts
1300
+ /** The running motion of each element, per property, until it rests. */
1301
+ const motions = /* @__PURE__ */ new WeakMap();
1302
+ /** Whether a motion started here still runs on the element. */
1303
+ function isMoving(element) {
1304
+ return (motions.get(element)?.size ?? 0) > 0;
1305
+ }
1306
+ /**
1307
+ * The motion running on the element's `property`, started here, with the
1308
+ * spring it runs on; undefined once it rests.
1309
+ */
1310
+ function motionOf(element, property = "y") {
1311
+ return motions.get(element)?.get(property);
1312
+ }
1313
+ function track(element, properties, handle, spring) {
1314
+ let running = motions.get(element);
1315
+ if (running == null) {
1316
+ running = /* @__PURE__ */ new Map();
1317
+ motions.set(element, running);
1318
+ }
1319
+ const motion = {
1320
+ handle,
1321
+ spring
1322
+ };
1323
+ for (const property of properties) running.set(property, motion);
1324
+ const record = running;
1325
+ handle.finished.then(() => {
1326
+ for (const property of properties) if (record.get(property) === motion) record.delete(property);
1327
+ });
1328
+ return handle;
1329
+ }
1330
+ /**
1331
+ * Starts a spring on the element's shared animator and records it, so a
1332
+ * later move reads its curve (`motionOf`). For a drop, or a slide to make
1333
+ * room.
1334
+ */
1335
+ function animateRow(element, to, spring, options) {
1336
+ return track(element, Object.keys(to), animatorFor(element).animate(to, {
1337
+ spring,
1338
+ velocity: options.velocity
1339
+ }, { at: options.at }), spring);
1340
+ }
1341
+ /**
1342
+ * Clears the element's identity inline values once it rests, so a resting
1343
+ * row carries no `translate`. A transform makes it a containing block for
1344
+ * fixed descendants. The animator stays: other code may hold it, and its
1345
+ * state still reads the resting value. Nothing is cleared while a newer
1346
+ * motion runs on the element.
1347
+ */
1348
+ function releaseMotion(element, ...properties) {
1349
+ if (isMoving(element)) return;
1350
+ for (const property of properties) if (isIdentityText(property, element.style.getPropertyValue(property))) element.style.removeProperty(property);
1351
+ }
1352
+ /**
1353
+ * Where a row's `y` is on screen at `at`: its shared animator's value, which
1354
+ * the drag writes directly (`set`) as well as through springs.
1355
+ */
1356
+ function shownY(element, at) {
1357
+ return animatorFor(element).get("y", at);
1358
+ }
1359
+ /**
1360
+ * Puts a row at rest at 0 at once. A row already at rest there takes no
1361
+ * write: the animator's `set` reads the row's style back after its write.
1362
+ */
1363
+ function settleAtRest(element, value, moving) {
1364
+ if (value !== 0 || moving) animatorFor(element).set({ y: 0 });
1365
+ releaseMotion(element, "translate");
1366
+ }
1367
+ /**
1368
+ * Whether the row's label element names it: it shows text, or holds an icon
1369
+ * or image with an accessible name of its own.
1370
+ */
1371
+ function namesRow(element) {
1372
+ if (element == null) return false;
1373
+ return (element.textContent ?? "").trim() !== "" || element.querySelector("[aria-label]:not([aria-label=\"\"]), [aria-labelledby], img[alt]:not([alt=\"\"])") != null;
1374
+ }
1375
+ /** What a label element's change that can rename its row looks like. */
1376
+ const LABEL_WATCH = {
1377
+ subtree: true,
1378
+ childList: true,
1379
+ characterData: true,
1380
+ attributes: true,
1381
+ attributeFilter: [
1382
+ "aria-label",
1383
+ "aria-labelledby",
1384
+ "alt"
1385
+ ]
1386
+ };
1387
+ /** Watches `element` with `init`; returns the release. */
1388
+ function observeMutations(element, init, callback) {
1389
+ if (typeof MutationObserver === "undefined") return () => {};
1390
+ const observer = new MutationObserver(callback);
1391
+ observer.observe(element, init);
1392
+ return () => observer.disconnect();
1393
+ }
1394
+ /**
1395
+ * The list's rows: its element children. A removed row put back for its exit
1396
+ * holds no place in the order, so it is left out (`markLeaving`).
1397
+ */
1398
+ function rowsOf(list) {
1399
+ return Array.from(list.children).filter((child) => child instanceof HTMLElement && !isLeaving(child));
1400
+ }
1401
+ /** A List's rows: its element children. */
1402
+ const CHILD_ROWS = {
1403
+ read: rowsOf,
1404
+ holds: (element, container) => element.parentElement === container
1405
+ };
1406
+ /**
1407
+ * Which rows bound the drop range: the rows that cannot move at either end
1408
+ * of the list, each run of them. One in the middle is passed like any other
1409
+ * row; it only has no handle.
1410
+ */
1411
+ function boundsOf(movable) {
1412
+ const bounds = movable.map(() => false);
1413
+ for (let index = 0; index < movable.length && !movable[index]; index += 1) bounds[index] = true;
1414
+ for (let index = movable.length - 1; index >= 0 && !movable[index]; index -= 1) bounds[index] = true;
1415
+ return bounds;
1416
+ }
1417
+ function sameOrder(a, b) {
1418
+ return a.length === b.length && a.every((element, index) => element === b[index]);
1419
+ }
1420
+ /**
1421
+ * An element the drag draws over the list: no row to the list's order or its
1422
+ * layout updates (`markLeaving`), inert and hidden from assistive technology.
1423
+ */
1424
+ function overlay(element) {
1425
+ markLeaving(element);
1426
+ element.setAttribute("aria-hidden", "true");
1427
+ element.inert = true;
1428
+ Object.assign(element.style, {
1429
+ position: "absolute",
1430
+ margin: "0",
1431
+ pointerEvents: "none",
1432
+ zIndex: "2",
1433
+ translate: "0px 0px"
1434
+ });
1435
+ return element;
1436
+ }
1437
+ /**
1438
+ * A copy of `row` that takes no part in the page (`inertClone`). It has no
1439
+ * ids, names or form, so a copied checked radio leaves the row's checked. A
1440
+ * row holding a canvas that reads back empty is not copied: its bare box is.
1441
+ */
1442
+ function previewCopyOf(row) {
1443
+ const copy = inertClone(row);
1444
+ if (copy != null) return copy;
1445
+ const box = row.cloneNode(false);
1446
+ for (const name of [
1447
+ "id",
1448
+ "data-testid",
1449
+ "name",
1450
+ "for",
1451
+ "autofocus"
1452
+ ]) box.removeAttribute(name);
1453
+ return box;
1454
+ }
1455
+ /**
1456
+ * Makes `preview`, a copy of the dragged row, its preview at its place, with
1457
+ * the same reduced emphasis as the row and no elevation. It only writes.
1458
+ */
1459
+ function previewOf(preview, top, span, background) {
1460
+ markReorderPreview(preview);
1461
+ overlay(preview);
1462
+ Object.assign(preview.style, {
1463
+ top: `${top}px`,
1464
+ insetInlineStart: `${span.start}px`,
1465
+ inlineSize: `${span.size}px`,
1466
+ boxSizing: "border-box",
1467
+ boxShadow: "none",
1468
+ opacity: "0.6",
1469
+ willChange: "translate"
1470
+ });
1471
+ if (background != null) preview.style.backgroundColor = background;
1472
+ return preview;
1473
+ }
1474
+ /** The list's custom properties that place its insertion line. */
1475
+ const LINE_Y = "--astryx-reorder-line-y";
1476
+ const LINE_START = "--astryx-reorder-line-start";
1477
+ const LINE_SIZE = "--astryx-reorder-line-size";
1478
+ /** A row's layout top inside the list (transforms ignored). */
1479
+ function layoutTop(row, list) {
1480
+ const base = row.offsetParent === list ? 0 : list.offsetTop;
1481
+ return row.offsetTop - base;
1482
+ }
1483
+ /** A row's layout left inside the list (transforms ignored). */
1484
+ function layoutLeft(row, list) {
1485
+ const base = row.offsetParent === list ? 0 : list.offsetLeft;
1486
+ return row.offsetLeft - base;
1487
+ }
1488
+ /**
1489
+ * An extent that starts `left` px from the list's left edge, as an inline
1490
+ * start and size. In right-to-left, the start counts from the right edge.
1491
+ */
1492
+ function inlineSpanOf(left, size, list) {
1493
+ return {
1494
+ start: getComputedStyle(list).direction === "rtl" ? list.clientWidth - left - size : left,
1495
+ size
1496
+ };
1497
+ }
1498
+ /**
1499
+ * The span of `row` in `list`'s coordinates, read before anything in the
1500
+ * frame writes a style. The list may not be the row's offset parent yet.
1501
+ */
1502
+ function lineSpanOf(row, list) {
1503
+ return inlineSpanOf(layoutLeft(row, list), row.offsetWidth, list);
1504
+ }
1505
+ /**
1506
+ * The preview's span: `row`'s, from the list's padding edge, where the
1507
+ * preview sits once the list is positioned. Read before the drag writes.
1508
+ */
1509
+ function previewSpanOf(row, list) {
1510
+ const border = row.offsetParent === list ? 0 : list.clientLeft;
1511
+ return inlineSpanOf(layoutLeft(row, list) - border, row.offsetWidth, list);
1512
+ }
1513
+ /**
1514
+ * Shows the list's insertion line (its `::after`) across `span`, centred on
1515
+ * `center` in list coordinates. It only writes, so a crossing lays nothing
1516
+ * out.
1517
+ */
1518
+ function showLine(list, span, center) {
1519
+ list.style.setProperty(LINE_START, `${span.start}px`);
1520
+ list.style.setProperty(LINE_SIZE, `${span.size}px`);
1521
+ list.style.setProperty(LINE_Y, `${center - 1}px`);
1522
+ showReorderLine(list);
1523
+ }
1524
+ /** Hides the list's insertion line and clears what placed it. */
1525
+ function hideLine(list) {
1526
+ hideReorderLine(list);
1527
+ for (const property of [
1528
+ LINE_Y,
1529
+ LINE_START,
1530
+ LINE_SIZE
1531
+ ]) list.style.removeProperty(property);
1532
+ }
1533
+ /**
1534
+ * Where the insertion line's centre sits for the dragged row at `position`.
1535
+ * It sits in the gap before the row it would land above, or after the one it
1536
+ * would land below. Null at its own place: nothing moves.
1537
+ */
1538
+ function lineCenter(geometry, dragged, position) {
1539
+ if (position === dragged) return null;
1540
+ const target = geometry.rows[position];
1541
+ return position < dragged ? target.top - geometry.gap / 2 : target.top + target.height + geometry.gap / 2;
1542
+ }
1543
+ function isTransparent(color) {
1544
+ return color === "" || color === "transparent" || /^rgba\(.*,\s*0\)$/.test(color) || /\/\s*0\)$/.test(color);
1545
+ }
1546
+ /** The element autoscroll writes to and its visible band in the viewport. */
1547
+ function scrollerOf(list) {
1548
+ const doc = list.ownerDocument;
1549
+ const element = nearestScroller(list);
1550
+ if (element !== (doc.scrollingElement ?? doc.documentElement)) {
1551
+ const top = element.getBoundingClientRect().top + element.clientTop;
1552
+ return {
1553
+ element,
1554
+ top,
1555
+ bottom: top + element.clientHeight,
1556
+ max: element.scrollHeight - element.clientHeight,
1557
+ position: element.scrollTop
1558
+ };
1559
+ }
1560
+ const height = doc.defaultView?.innerHeight ?? element.clientHeight;
1561
+ return {
1562
+ element,
1563
+ top: 0,
1564
+ bottom: height,
1565
+ max: Math.max(0, element.scrollHeight - height),
1566
+ position: element.scrollTop
1567
+ };
1568
+ }
1569
+ //#endregion
1570
+ //#region src/motion/uikit/reorder.ts
1571
+ /**
1572
+ * @file reorder.ts
1573
+ * @input `scroll` (the content-touch delay) and `UIKIT_GESTURES` (the pan
1574
+ * hysteresis)
1575
+ * @output Exports `reorder`: the values of a UIKit table's edit-mode reorder
1576
+ * that a reorder plays. They are the reorder control's claim and the edge
1577
+ * autoscroll. Neither is a spring or a curve. The rows' glides play the
1578
+ * shared settle role (`springs.settle`)
1579
+ * @position The reorder domain of the UIKit constants table (motion/uikit).
1580
+ * Read by List/reorderModel.ts, List/listReorderEngine.tsx and
1581
+ * List/ListReorderTouch.ts
1582
+ *
1583
+ * Measured on a `UITableView` in editing mode with reorder controls only, in
1584
+ * an instrumented UIKit app on the iOS 26.2 simulator. The table had 40 rows
1585
+ * of 44 pt, with two of 88 pt in the second run. Every animation, offset and
1586
+ * recognizer state was logged per frame while real HID touches dragged the
1587
+ * reorder control. Some findings need no value below. There is no lift: a
1588
+ * held or dragged row changes neither scale, opacity, z position nor shadow.
1589
+ * The dragged row follows the finger one to one with the grab offset kept.
1590
+ * The drop goes to the current drop position with no velocity projection,
1591
+ * and no haptic plays. UIKit's rows also slide out of the way during a drag,
1592
+ * on springDuration 0.3 s with bounce 0. That is 0.03 s shorter per point of
1593
+ * autoscroll step. Its drop springs from rest on a springDuration of 0.3 s
1594
+ * times min(1, the distance left / half the row's height). Astryx's reorder
1595
+ * departs from both by its design record. The rows stay still behind an
1596
+ * insertion cue until the drop, and every glide plays the shared settle
1597
+ * role. So neither is a value here.
1598
+ *
1599
+ * Every leaf carries one or more `@source` (apple-docs | wwdc | webkit |
1600
+ * measured | GUESS). GUESS values also carry the `@measure` task that will
1601
+ * confirm or replace them (MEASUREMENTS.md, M-RO rows). uikit.test.ts
1602
+ * enforces both. Durations are in ms. Lengths are in points, one CSS px
1603
+ * each.
1604
+ *
1605
+ * Plain data, with no side effect on import.
1606
+ */
1607
+ const reorder = {
1608
+ claim: {
1609
+ /**
1610
+ * A still touch on the reorder control claims the drag after the scroll
1611
+ * view's content-touch delay. Once it has passed, the table stops
1612
+ * scrolling: `isScrollEnabled` turns false.
1613
+ * @source measured: UIKit lab, iOS 26.2 sim iPhone 17 Pro, table reorder
1614
+ * (isScrollEnabled false 148–149 ms after touch-down on the reorder
1615
+ * control), Oct 23 2026
1616
+ */
1617
+ delayMs: scroll.delaysContentTouchesMs,
1618
+ /**
1619
+ * Travel before the claim that hands the touch to the scroll view. A flick
1620
+ * that starts on the reorder control scrolls the table with momentum, and
1621
+ * the row does not move. The scroll view's pan begins at its hysteresis.
1622
+ * @source measured: UIKit lab, iOS 26.2 sim iPhone 17 Pro, table reorder
1623
+ * (a 120 pt flick in 80 ms from the reorder control scrolled the table.
1624
+ * The row stayed), Oct 23 2026
1625
+ */
1626
+ allowableMovement: UIKIT_GESTURES.pan.hysteresis.value
1627
+ },
1628
+ autoscroll: {
1629
+ /**
1630
+ * Autoscroll is a timer: the offset moves by a whole number of points
1631
+ * every 20 ms (50 Hz), constant at a given depth.
1632
+ * @source measured: UIKit lab, iOS 26.2 sim iPhone 17 Pro, table reorder
1633
+ * autoscroll (contentOffset per tick), Oct 23 2026
1634
+ */
1635
+ tickMs: 20,
1636
+ /**
1637
+ * The depths of the samples: how far the dragged row's edge (not the
1638
+ * finger) is past the scroll view's edge, negative inside. Between
1639
+ * samples the step is interpolated and rounded to a whole point. Deeper
1640
+ * than the last sample it stays at the last (the row is clamped with its
1641
+ * centre on the edge there).
1642
+ * @source measured: UIKit lab, iOS 26.2 sim iPhone 17 Pro, table reorder
1643
+ * autoscroll with 44 pt rows (bottom edge. The top edge agreed within a
1644
+ * point: 2 at 4 inside, 9 at 20 beyond), Oct 23 2026
1645
+ */
1646
+ depths: [
1647
+ -3,
1648
+ 6,
1649
+ 8,
1650
+ 10,
1651
+ 12,
1652
+ 16,
1653
+ 20,
1654
+ 22
1655
+ ],
1656
+ /**
1657
+ * Points per tick at each of `depths`: 100 pt/s at the start, 500 pt/s at
1658
+ * the deepest.
1659
+ * @source measured: UIKit lab, iOS 26.2 sim iPhone 17 Pro, table reorder
1660
+ * autoscroll with 44 pt rows, Oct 23 2026
1661
+ */
1662
+ stepsPt: [
1663
+ 2,
1664
+ 2,
1665
+ 3,
1666
+ 3,
1667
+ 4,
1668
+ 6,
1669
+ 8,
1670
+ 10
1671
+ ],
1672
+ /**
1673
+ * How far inside the edge autoscroll starts, at the first sample's step.
1674
+ * There is none with the row's edge 12 pt inside, and 2 pt per tick at
1675
+ * 3 pt inside.
1676
+ * @source GUESS — a point inside the measured bracket (12 to 3 pt)
1677
+ * @measure M-RO26
1678
+ */
1679
+ startInset: 8
1680
+ }
1681
+ };
1682
+ //#endregion
1683
+ //#region src/utils/edgeAutoscroll.ts
1684
+ /** An edge autoscroll; idle until `update` finds a step. */
1685
+ function edgeAutoscroll(options) {
1686
+ const { intervalMs, immediate = false, catchUp = false } = options;
1687
+ const now = options.now ?? (() => performance.now());
1688
+ let timer = null;
1689
+ let base = 0;
1690
+ let ticks = 0;
1691
+ const stop = () => {
1692
+ if (timer != null) {
1693
+ clearInterval(timer);
1694
+ timer = null;
1695
+ }
1696
+ };
1697
+ const tick = (onClock) => {
1698
+ const step = options.step();
1699
+ if (step === 0) {
1700
+ stop();
1701
+ return;
1702
+ }
1703
+ let count = 1;
1704
+ if (catchUp && onClock) {
1705
+ const due = Math.floor((now() - base) / intervalMs);
1706
+ count = Math.max(1, Math.min(2, due - ticks));
1707
+ ticks = Math.max(ticks + count, due);
1708
+ }
1709
+ if (options.apply(step * count) === 0) stop();
1710
+ };
1711
+ return {
1712
+ update() {
1713
+ if (options.step() === 0) {
1714
+ stop();
1715
+ return;
1716
+ }
1717
+ if (timer != null) return;
1718
+ base = now();
1719
+ ticks = 0;
1720
+ timer = setInterval(tick, intervalMs, true);
1721
+ if (immediate) tick(false);
1722
+ },
1723
+ stop,
1724
+ get isRunning() {
1725
+ return timer != null;
1726
+ }
1727
+ };
1728
+ }
1729
+ //#endregion
1730
+ //#region src/List/reorder/reorderModel.ts
1731
+ /**
1732
+ * @file reorderModel.ts
1733
+ * @input A list's row geometry (layout tops and heights inside the list) and
1734
+ * the reorder values of the UIKit constants table (motion/uikit/reorder.ts)
1735
+ * @output Pure functions of a reorder's drag. They give the position a
1736
+ * dragged row proposes, where the insertion cue goes. They also give the
1737
+ * movable range that a fixed row at either end of the list bounds, the
1738
+ * autoscroll step and the tracking clamp
1739
+ * @position List internals. List/reorder/reorderController.ts drives a drag with
1740
+ * them. No DOM, no React: unit tested against the UIKit lab measurements
1741
+ *
1742
+ * The rows stay still during a drag while an insertion cue marks the drop
1743
+ * position. So the model proposes drop positions and moves no row. A row
1744
+ * below the dragged row changes places once the dragged row's centre passes
1745
+ * that row's far edge less the dragged row's height. It never changes before
1746
+ * that row's near edge. A row above mirrors it. Boundaries sit in the middle
1747
+ * of a gap, with no hysteresis. Measured on UIKit (iOS 26.2): a 44 pt row
1748
+ * moving down past 44 and 88 pt rows and back over them. Two cases stay a
1749
+ * GUESS until M-RO27 measures them (motion/MEASUREMENTS.md). They are a
1750
+ * short row moving up past a taller row above its place, and a tall row
1751
+ * moving past a shorter one. Autoscroll moves a whole number of points per
1752
+ * tick. It moves more the deeper the dragged row's edge is past the scroll
1753
+ * view's edge (measured).
1754
+ */
1755
+ /**
1756
+ * The positions `dragged` can take: all of them but those of the fixed rows that
1757
+ * end the list. A run of fixed rows at either end bounds the range. A fixed row
1758
+ * in the middle is passed over, as reorder mode's keys pass it.
1759
+ */
1760
+ function movableRange(rows, dragged) {
1761
+ let start = 0;
1762
+ while (start < dragged && rows[start].isFixed) start += 1;
1763
+ let end = rows.length - 1;
1764
+ while (end > dragged && rows[end].isFixed) end -= 1;
1765
+ return {
1766
+ start,
1767
+ end
1768
+ };
1769
+ }
1770
+ /**
1771
+ * The position the dragged row proposes for its centre, in list coordinates.
1772
+ * The insertion cue goes there. A row below it changes places once the centre
1773
+ * passes that row's far edge less the dragged row's height. For equal rows,
1774
+ * that is the neighbour's near edge, half a row. For a 44 pt row passing an
1775
+ * 88 pt row below its place, it is that row's height (both measured). A row
1776
+ * above mirrors it (GUESS for unequal rows, M-RO27). Either way the centre
1777
+ * must first pass the neighbour's near edge. So a tall row never starts past
1778
+ * a short neighbour: its centre travels at least half its own height (GUESS,
1779
+ * M-RO27). Boundaries sit in the middle of a gap.
1780
+ */
1781
+ function dropPosition(geometry, dragged, center) {
1782
+ const { rows, gap } = geometry;
1783
+ const height = rows[dragged].height;
1784
+ let position = 0;
1785
+ for (let index = 0; index < rows.length; index += 1) {
1786
+ if (index === dragged) continue;
1787
+ const { top, height: rowHeight } = rows[index];
1788
+ if ((index < dragged ? Math.min(top + height, top + rowHeight) + gap / 2 : Math.max(top + rowHeight - height, top) - gap / 2) < center) position += 1;
1789
+ }
1790
+ const { start, end } = movableRange(rows, dragged);
1791
+ return Math.min(end, Math.max(start, position));
1792
+ }
1793
+ /**
1794
+ * Points per autoscroll tick with the dragged row's edge `depth` points past
1795
+ * the scroll edge (negative inside). There are none further inside than the
1796
+ * start inset. Then UIKit's measured steps apply, interpolated and rounded.
1797
+ */
1798
+ function autoscrollStep(depth) {
1799
+ const { depths, stepsPt, startInset } = reorder.autoscroll;
1800
+ if (depth < -startInset) return 0;
1801
+ if (depth <= depths[0]) return stepsPt[0];
1802
+ const last = depths.length - 1;
1803
+ if (depth >= depths[last]) return stepsPt[last];
1804
+ let index = 1;
1805
+ while (depths[index] < depth) index += 1;
1806
+ const d0 = depths[index - 1];
1807
+ const d1 = depths[index];
1808
+ const s0 = stepsPt[index - 1];
1809
+ const s1 = stepsPt[index];
1810
+ return Math.round(s0 + (s1 - s0) * (depth - d0) / (d1 - d0));
1811
+ }
1812
+ /**
1813
+ * The dragged row's top. At the scroller's visible edge the row stops with its
1814
+ * centre on the edge, as UIKit stops a row on the table's edge. At the list's
1815
+ * own end it stops with its edge there. So a row never hangs over the content
1816
+ * after an embedded list, such as a TransferList's next panel.
1817
+ */
1818
+ function clampTop(top, height, bounds) {
1819
+ const min = Math.max(bounds.scrollTop - height / 2, bounds.listTop);
1820
+ const max = Math.min(bounds.scrollBottom - height / 2, bounds.listBottom - height);
1821
+ return Math.min(max, Math.max(min, top));
1822
+ }
1823
+ //#endregion
1824
+ //#region src/composables/internal/devWarnings.ts
1825
+ /** 每个 key 只警告一次,key 默认就是消息本身。生产构建里什么也不做。 */
1826
+ function createDevWarnings() {
1827
+ const warned = /* @__PURE__ */ new Set();
1828
+ return (component, message, key = message) => {
1829
+ if (!isDevBuild() || warned.has(key)) return;
1830
+ warned.add(key);
1831
+ devWarn(component, message);
1832
+ };
1833
+ }
1834
+ //#endregion
1835
+ //#region src/List/reorder/reorderBase.ts
1836
+ var ReorderBase = class {
1837
+ getList;
1838
+ hintId;
1839
+ rows;
1840
+ options = null;
1841
+ announce = () => {};
1842
+ messages = null;
1843
+ /** `uikit` glides the rows (touch presentation); `theme` puts them at once. */
1844
+ presentation = "theme";
1845
+ keys = /* @__PURE__ */ new Map();
1846
+ names = /* @__PURE__ */ new Map();
1847
+ modeHandle = null;
1848
+ modeListeners = /* @__PURE__ */ new Set();
1849
+ hintElement = null;
1850
+ draggedHandle = null;
1851
+ committedMove = null;
1852
+ moveFallback = null;
1853
+ modeLine = null;
1854
+ /** The way the mode's last move went: the line marks the edge it came in by. */
1855
+ lastStep = null;
1856
+ claimFocusUntil = 0;
1857
+ session = null;
1858
+ pending = null;
1859
+ fallback = null;
1860
+ focusRow = null;
1861
+ announcement = null;
1862
+ announcementFallback = null;
1863
+ endMouse = null;
1864
+ warn = createDevWarnings();
1865
+ constructor(getList, hintId, rows = CHILD_ROWS) {
1866
+ this.getList = getList;
1867
+ this.hintId = hintId;
1868
+ this.rows = rows;
1869
+ }
1870
+ configure(configuration) {
1871
+ this.options = configuration.options;
1872
+ this.announce = configuration.announce;
1873
+ this.messages = configuration.messages;
1874
+ this.presentation = configuration.presentation;
1875
+ }
1876
+ get animates() {
1877
+ return this.presentation === "uikit";
1878
+ }
1879
+ /**
1880
+ * Whether a press of this pointer drags at once (past the slop) rather
1881
+ * than after a hold: a mouse, and a pen outside touch presentation.
1882
+ */
1883
+ dragsAtOnce(pointerType) {
1884
+ return pointerType === "mouse" || pointerType === "pen" && this.presentation !== "uikit";
1885
+ }
1886
+ registerHandle(handle, key) {
1887
+ if (handle == null) return () => {};
1888
+ this.keys.set(handle, key);
1889
+ return () => {
1890
+ if (this.keys.get(handle) === key) {
1891
+ this.keys.delete(handle);
1892
+ if (this.modeHandle === handle) this.setMode(null);
1893
+ }
1894
+ };
1895
+ }
1896
+ /** Names a row (or its handle) for the announcements. */
1897
+ registerName(row, name) {
1898
+ if (row == null) return () => {};
1899
+ this.names.set(row, name);
1900
+ return () => {
1901
+ if (this.names.get(row) === name) this.names.delete(row);
1902
+ };
1903
+ }
1904
+ handleIn(row) {
1905
+ for (const handle of reorderHandlesIn(row)) if (this.keys.has(handle)) return handle;
1906
+ return null;
1907
+ }
1908
+ keyOf(row) {
1909
+ const handle = this.handleIn(row);
1910
+ return handle == null ? void 0 : this.keys.get(handle);
1911
+ }
1912
+ /** The enabled handle of this list that holds `target`. */
1913
+ handleOf(target) {
1914
+ const list = this.getList();
1915
+ if (list == null || !(target instanceof Element)) return null;
1916
+ const handle = closestReorderHandle(target);
1917
+ return handle != null && this.keys.has(handle) && list.contains(handle) && handle.getAttribute("aria-disabled") !== "true" ? handle : null;
1918
+ }
1919
+ /** The row of this list that holds `element`. */
1920
+ rowOf(element) {
1921
+ const list = this.getList();
1922
+ if (list == null) return null;
1923
+ let node = element;
1924
+ while (node != null && !this.rows.holds(node, list)) node = node.parentElement;
1925
+ return node instanceof HTMLElement ? node : null;
1926
+ }
1927
+ nameOf(row, index) {
1928
+ const handle = row == null ? null : this.handleIn(row);
1929
+ const name = (handle == null ? null : this.names.get(handle)) ?? (row == null ? null : this.names.get(row)) ?? "";
1930
+ return name !== "" ? name : this.messages?.itemAt(index + 1) ?? "";
1931
+ }
1932
+ isInMode(handle) {
1933
+ return handle != null && this.modeHandle === handle;
1934
+ }
1935
+ subscribeMode = (listener) => {
1936
+ this.modeListeners.add(listener);
1937
+ return () => {
1938
+ this.modeListeners.delete(listener);
1939
+ };
1940
+ };
1941
+ /** The handle reorder mode runs on, the hint's anchor. */
1942
+ get modeTarget() {
1943
+ return this.modeHandle;
1944
+ }
1945
+ setHintElement(element) {
1946
+ this.hintElement = element;
1947
+ }
1948
+ setMode(handle) {
1949
+ if (this.modeHandle === handle) return;
1950
+ this.modeHandle = handle;
1951
+ this.lastStep = null;
1952
+ this.clearModeLine();
1953
+ const list = this.getList();
1954
+ if (handle != null && list != null) this.placeModeLine(list);
1955
+ for (const listener of [...this.modeListeners]) listener();
1956
+ }
1957
+ placeModeLine(list) {
1958
+ this.measureModeLine(list)();
1959
+ }
1960
+ /**
1961
+ * Reads where reorder mode's line goes and returns its write. It marks the
1962
+ * edge its row came in by: above it until the first move down.
1963
+ */
1964
+ measureModeLine(list) {
1965
+ const row = this.rowOf(this.modeHandle);
1966
+ if (row == null) return () => this.clearModeLine();
1967
+ const step = this.lastStep ?? -1;
1968
+ const rows = this.rows.read(list);
1969
+ const index = rows.indexOf(row);
1970
+ const top = layoutTop(row, list);
1971
+ const bottom = top + row.offsetHeight;
1972
+ const neighbour = rows[index + step];
1973
+ const gap = neighbour == null ? 0 : step < 0 ? Math.max(0, top - (layoutTop(neighbour, list) + neighbour.offsetHeight)) : Math.max(0, layoutTop(neighbour, list) - bottom);
1974
+ const center = step < 0 ? top - gap / 2 : bottom + gap / 2;
1975
+ const span = lineSpanOf(row, list);
1976
+ const isNewList = this.modeLine?.list !== list;
1977
+ const isStatic = isNewList && getComputedStyle(list).position === "static";
1978
+ return () => {
1979
+ if (isNewList) {
1980
+ this.clearModeLine();
1981
+ const listPosition = list.style.position;
1982
+ if (isStatic) list.style.position = "relative";
1983
+ this.modeLine = {
1984
+ list,
1985
+ listPosition
1986
+ };
1987
+ }
1988
+ showLine(list, span, center);
1989
+ };
1990
+ }
1991
+ clearModeLine() {
1992
+ const modeLine = this.modeLine;
1993
+ if (modeLine == null) return;
1994
+ this.modeLine = null;
1995
+ hideLine(modeLine.list);
1996
+ modeLine.list.style.position = modeLine.listPosition;
1997
+ }
1998
+ };
1999
+ //#endregion
2000
+ //#region src/List/reorder/reorderNames.ts
2001
+ var ReorderNames = class extends ReorderBase {
2002
+ handleLabels = /* @__PURE__ */ new Map();
2003
+ handleNames = /* @__PURE__ */ new Map();
2004
+ nameListeners = /* @__PURE__ */ new Set();
2005
+ namesWatch = null;
2006
+ namesQueued = false;
2007
+ warnedNameless = /* @__PURE__ */ new WeakSet();
2008
+ namelessCount = 0;
2009
+ /**
2010
+ * Records what names `handle`: the id of its row's label element, or
2011
+ * whether the row's caller named it (`aria-label`, `aria-labelledby`).
2012
+ */
2013
+ registerHandleLabel(handle, labelId, isNamed) {
2014
+ if (handle == null) return () => {};
2015
+ const label = {
2016
+ labelId,
2017
+ isNamed
2018
+ };
2019
+ this.handleLabels.set(handle, label);
2020
+ this.queueNames();
2021
+ return () => {
2022
+ if (this.handleLabels.get(handle) === label) {
2023
+ this.handleLabels.delete(handle);
2024
+ this.queueNames();
2025
+ }
2026
+ };
2027
+ }
2028
+ handleNameOf(handle) {
2029
+ return (handle == null ? null : this.handleNames.get(handle)) ?? UNREAD_HANDLE_NAME;
2030
+ }
2031
+ subscribeHandleNames = (listener) => {
2032
+ this.nameListeners.add(listener);
2033
+ return () => {
2034
+ this.nameListeners.delete(listener);
2035
+ };
2036
+ };
2037
+ /** Watches the list's rows and the handles' labels; returns the release. */
2038
+ attachNames() {
2039
+ const list = this.getList();
2040
+ if (list == null) return () => {};
2041
+ const watch = {
2042
+ list,
2043
+ unwatchRows: observeMutations(list, { childList: true }, this.onNamesMutation),
2044
+ labels: /* @__PURE__ */ new Map()
2045
+ };
2046
+ this.namesWatch = watch;
2047
+ this.refreshNames();
2048
+ return () => {
2049
+ watch.unwatchRows();
2050
+ for (const unwatch of watch.labels.values()) unwatch();
2051
+ watch.labels.clear();
2052
+ if (this.namesWatch === watch) this.namesWatch = null;
2053
+ };
2054
+ }
2055
+ onNamesMutation = () => {
2056
+ this.refreshNames();
2057
+ };
2058
+ queueNames() {
2059
+ if (this.namesQueued) return;
2060
+ this.namesQueued = true;
2061
+ queueMicrotask(() => {
2062
+ this.namesQueued = false;
2063
+ this.refreshNames();
2064
+ });
2065
+ }
2066
+ refreshNames() {
2067
+ const list = this.getList();
2068
+ if (list == null) return;
2069
+ const places = new Map(this.rows.read(list).map((row, index) => [row, index + 1]));
2070
+ const watch = this.namesWatch;
2071
+ if (watch != null && watch.list !== list) {
2072
+ watch.unwatchRows();
2073
+ watch.list = list;
2074
+ watch.unwatchRows = observeMutations(list, { childList: true }, this.onNamesMutation);
2075
+ }
2076
+ const watched = /* @__PURE__ */ new Set();
2077
+ let changed = false;
2078
+ for (const handle of this.keys.keys()) {
2079
+ const label = this.handleLabels.get(handle);
2080
+ const element = label?.labelId == null ? null : list.ownerDocument.getElementById(label.labelId);
2081
+ if (element != null && watch != null) {
2082
+ watched.add(element);
2083
+ if (!watch.labels.has(element)) watch.labels.set(element, observeMutations(element, LABEL_WATCH, this.onNamesMutation));
2084
+ }
2085
+ const labelShowsNoName = label?.labelId != null && !namesRow(element);
2086
+ const byPlace = label != null && (label.labelId != null ? labelShowsNoName : !label.isNamed);
2087
+ const row = byPlace ? this.rowOf(handle) : null;
2088
+ const position = row == null ? null : places.get(row) ?? null;
2089
+ const previous = this.handleNameOf(handle);
2090
+ if (previous.position !== position || previous.labelShowsNoName !== labelShowsNoName) {
2091
+ this.handleNames.set(handle, {
2092
+ position,
2093
+ labelShowsNoName
2094
+ });
2095
+ changed = true;
2096
+ }
2097
+ if (byPlace && position != null && !this.warnedNameless.has(handle)) {
2098
+ this.warnedNameless.add(handle);
2099
+ this.namelessCount += 1;
2100
+ this.warn("ListItem", "A reorderable row has no accessible name, so its reorder handle is named after its place (\"Reorder item N\"). Give the row a text label or an aria-label.", `nameless-row-${this.namelessCount}`);
2101
+ }
2102
+ }
2103
+ for (const handle of this.handleNames.keys()) if (!this.keys.has(handle)) {
2104
+ this.handleNames.delete(handle);
2105
+ changed = true;
2106
+ }
2107
+ for (const [element, unwatch] of watch?.labels ?? []) if (!watched.has(element)) {
2108
+ unwatch();
2109
+ watch?.labels.delete(element);
2110
+ }
2111
+ if (changed) for (const listener of [...this.nameListeners]) listener();
2112
+ }
2113
+ };
2114
+ //#endregion
2115
+ //#region src/List/reorder/reorderDrag.ts
2116
+ var ReorderDrag = class extends ReorderNames {
2117
+ gesture(row, event) {
2118
+ switch (event.state) {
2119
+ case "began":
2120
+ if (row != null) this.begin(row, event.y);
2121
+ break;
2122
+ case "changed":
2123
+ this.track(event.y);
2124
+ break;
2125
+ case "ended":
2126
+ this.drop(event.velocity ?? 0);
2127
+ break;
2128
+ case "cancelled": this.cancel();
2129
+ }
2130
+ }
2131
+ /**
2132
+ * Picks `row` up at pointer `y`: its preview copy goes over it, it dims in
2133
+ * place, and every row gets a translate the drop can glide.
2134
+ */
2135
+ begin(row, y) {
2136
+ const list = this.getList();
2137
+ if (list == null || this.session != null) return false;
2138
+ if (this.modeHandle != null) this.endMode();
2139
+ this.flushPending();
2140
+ const rows = this.rows.read(list);
2141
+ const dragged = rows.indexOf(row);
2142
+ const movable = rows.map((element) => this.handleIn(element) != null);
2143
+ if (dragged < 0 || !movable[dragged]) return false;
2144
+ const at = motionNow();
2145
+ const tops = rows.map((element) => layoutTop(element, list));
2146
+ const heights = rows.map((element) => element.offsetHeight);
2147
+ const lineSpan = lineSpanOf(row, list);
2148
+ const previewSpan = previewSpanOf(row, list);
2149
+ const isStatic = getComputedStyle(list).position === "static";
2150
+ const bounds = boundsOf(movable);
2151
+ const geometry = {
2152
+ rows: rows.map((_element, index) => ({
2153
+ top: tops[index],
2154
+ height: heights[index],
2155
+ isFixed: bounds[index]
2156
+ })),
2157
+ gap: rows.length > 1 ? Math.max(0, tops[1] - tops[0] - heights[0]) : 0
2158
+ };
2159
+ const shown = shownY(row, at);
2160
+ const origin = row.getBoundingClientRect().top - shown - tops[dragged];
2161
+ const scroller = scrollerOf(list);
2162
+ const restore = {
2163
+ zIndex: row.style.zIndex,
2164
+ backgroundColor: row.style.backgroundColor,
2165
+ opacity: row.style.opacity,
2166
+ counterIncrement: row.style.counterIncrement,
2167
+ listPosition: list.style.position,
2168
+ rows
2169
+ };
2170
+ const background = isTransparent(getComputedStyle(row).backgroundColor) ? paintedBackground(list) : null;
2171
+ const copy = previewCopyOf(row);
2172
+ for (const element of rows) if (element.style.translate === "") element.style.translate = "0px 0px";
2173
+ if (isStatic) list.style.position = "relative";
2174
+ const preview = previewOf(copy, tops[dragged], previewSpan, background);
2175
+ row.before(preview);
2176
+ row.style.counterIncrement = "none";
2177
+ markReorderSource(row);
2178
+ row.style.opacity = "0.6";
2179
+ markReordering(list);
2180
+ const session = {
2181
+ list,
2182
+ rows,
2183
+ tops,
2184
+ geometry,
2185
+ dragged,
2186
+ lineSpan,
2187
+ position: dragged,
2188
+ offsets: rows.map((element, index) => index === dragged ? 0 : shownY(element, at)),
2189
+ origin,
2190
+ grabOffset: y - (origin + tops[dragged] + shown),
2191
+ scroller,
2192
+ scrolled: 0,
2193
+ lastY: y,
2194
+ edge: edgeAutoscroll({
2195
+ intervalMs: reorder.autoscroll.tickMs,
2196
+ catchUp: true,
2197
+ now: motionNow,
2198
+ step: () => this.edgeStep(session),
2199
+ apply: (delta) => this.scrollBy(session, delta)
2200
+ }),
2201
+ step: 0,
2202
+ restore,
2203
+ preview,
2204
+ previewOffset: 0,
2205
+ scrollStale: false,
2206
+ ownScroll: false,
2207
+ wrote: true,
2208
+ foldArmed: false,
2209
+ stopScrollWatch: () => {}
2210
+ };
2211
+ this.session = session;
2212
+ session.stopScrollWatch = this.watchScroll(session);
2213
+ this.moveTo(dragged);
2214
+ this.track(y);
2215
+ this.announce(this.messages?.pickedUp(dragged + 1, rows.length) ?? "", "polite");
2216
+ return true;
2217
+ }
2218
+ /** The dragged row's top on screen for pointer `y`, kept inside the list and the scroller. */
2219
+ draggedTop(session, y) {
2220
+ const { geometry, dragged, scroller } = session;
2221
+ const row = geometry.rows[dragged];
2222
+ const first = geometry.rows[0];
2223
+ const last = geometry.rows[geometry.rows.length - 1];
2224
+ const origin = session.origin - session.scrolled;
2225
+ return clampTop(y - session.grabOffset, row.height, {
2226
+ scrollTop: scroller.top,
2227
+ scrollBottom: scroller.bottom,
2228
+ listTop: origin + first.top,
2229
+ listBottom: origin + last.top + last.height
2230
+ });
2231
+ }
2232
+ track(y) {
2233
+ const session = this.session;
2234
+ if (session == null) return;
2235
+ if (session.scrollStale) this.syncScroll(session);
2236
+ session.lastY = y;
2237
+ session.wrote = true;
2238
+ const { geometry, dragged } = session;
2239
+ const row = geometry.rows[dragged];
2240
+ const origin = session.origin - session.scrolled;
2241
+ const top = this.draggedTop(session, y);
2242
+ const offset = top - (origin + row.top);
2243
+ if (offset !== session.previewOffset) {
2244
+ session.previewOffset = offset;
2245
+ animatorFor(session.preview).set({ y: offset });
2246
+ }
2247
+ const position = dropPosition(geometry, dragged, top + row.height / 2 - origin);
2248
+ if (position !== session.position) this.moveTo(position);
2249
+ this.autoscroll(top, row.height);
2250
+ }
2251
+ moveTo(position) {
2252
+ const session = this.session;
2253
+ if (session == null) return;
2254
+ session.position = position;
2255
+ const center = lineCenter(session.geometry, session.dragged, position);
2256
+ if (center == null) hideLine(session.list);
2257
+ else showLine(session.list, session.lineSpan, center);
2258
+ }
2259
+ /** The autoscroll step for the dragged row at `top`: down past the bottom edge, up past the top. */
2260
+ stepFor(session, top, height) {
2261
+ const { scroller } = session;
2262
+ let step = 0;
2263
+ if (scroller.position < scroller.max) step = autoscrollStep(top + height - scroller.bottom);
2264
+ if (step === 0 && scroller.position > 0) step = -autoscrollStep(scroller.top - top);
2265
+ return step;
2266
+ }
2267
+ autoscroll(top, height) {
2268
+ const session = this.session;
2269
+ if (session == null) return;
2270
+ session.step = Math.abs(this.stepFor(session, top, height));
2271
+ session.edge.update();
2272
+ }
2273
+ edgeStep(session) {
2274
+ if (this.session !== session) return 0;
2275
+ if (session.scrollStale) this.syncScroll(session);
2276
+ const { geometry, dragged } = session;
2277
+ const top = this.draggedTop(session, session.lastY);
2278
+ return this.stepFor(session, top, geometry.rows[dragged].height);
2279
+ }
2280
+ scrollBy(session, delta) {
2281
+ if (this.session !== session) return 0;
2282
+ const { scroller } = session;
2283
+ const next = Math.min(scroller.max, Math.max(0, scroller.position + delta));
2284
+ const moved = next - scroller.position;
2285
+ if (moved === 0) return 0;
2286
+ scroller.element.scrollTop = next;
2287
+ session.scrolled += moved;
2288
+ scroller.position = next;
2289
+ session.ownScroll = true;
2290
+ requestAnimationFrame(() => {
2291
+ session.ownScroll = false;
2292
+ });
2293
+ this.track(session.lastY);
2294
+ return moved;
2295
+ }
2296
+ /**
2297
+ * Follows a scroll the drag did not write: of its scroller, or of a box
2298
+ * around it (the page, an outer scroller) that moves the scroller.
2299
+ */
2300
+ watchScroll(session) {
2301
+ const doc = session.list.ownerDocument;
2302
+ const view = doc.defaultView;
2303
+ if (view == null) return () => {};
2304
+ const { element } = session.scroller;
2305
+ const own = element === (doc.scrollingElement ?? doc.documentElement) ? doc : element;
2306
+ const isAround = (target) => own !== doc && (target === doc || target instanceof Element && target !== element && target.contains(element));
2307
+ return subscribeInput(view, "scroll", (event) => {
2308
+ const { target } = event;
2309
+ if (target == null || this.session !== session || target !== own && !isAround(target)) return;
2310
+ if (target === own && session.ownScroll) {
2311
+ session.ownScroll = false;
2312
+ return;
2313
+ }
2314
+ session.scrollStale = true;
2315
+ this.armFold(session);
2316
+ });
2317
+ }
2318
+ /**
2319
+ * Folds a scroll into the drag in a frame where the pointer wrote nothing:
2320
+ * a still pointer over a scrolling list keeps its row under it.
2321
+ */
2322
+ armFold(session) {
2323
+ if (session.foldArmed) return;
2324
+ session.foldArmed = true;
2325
+ requestAnimationFrame(() => {
2326
+ session.wrote = false;
2327
+ requestAnimationFrame(() => this.foldInFrame(session));
2328
+ });
2329
+ }
2330
+ foldInFrame(session) {
2331
+ session.foldArmed = false;
2332
+ if (this.session !== session || !session.scrollStale) return;
2333
+ if (session.wrote) {
2334
+ session.wrote = false;
2335
+ session.foldArmed = true;
2336
+ requestAnimationFrame(() => this.foldInFrame(session));
2337
+ return;
2338
+ }
2339
+ this.track(session.lastY);
2340
+ }
2341
+ syncScroll(session) {
2342
+ session.scrollStale = false;
2343
+ const { scroller } = session;
2344
+ const { element } = scroller;
2345
+ const position = element.scrollTop;
2346
+ session.scrolled += position - scroller.position;
2347
+ scroller.position = position;
2348
+ const doc = element.ownerDocument;
2349
+ if (element === (doc.scrollingElement ?? doc.documentElement)) return;
2350
+ const top = element.getBoundingClientRect().top + element.clientTop;
2351
+ const moved = scroller.top - top;
2352
+ session.scrolled += moved;
2353
+ scroller.top = top;
2354
+ scroller.bottom -= moved;
2355
+ }
2356
+ stopAutoscroll(session) {
2357
+ session.edge.stop();
2358
+ session.step = 0;
2359
+ }
2360
+ };
2361
+ //#endregion
2362
+ //#region src/gestures/LongPressGestureRecognizer.ts
2363
+ var LongPressGestureRecognizer = class extends GestureRecognizer {
2364
+ get kind() {
2365
+ return "longPress";
2366
+ }
2367
+ /** Internal. The host's brand: a long press keeps the callout and selection off (recognizerInternals). */
2368
+ get family() {
2369
+ return "longPress";
2370
+ }
2371
+ minimumPressDuration;
2372
+ allowableMovement;
2373
+ numberOfTapsRequired;
2374
+ numberOfTouchesRequired;
2375
+ tapsDone = 0;
2376
+ /** The taps phase's current tap: when it landed and its most fingers. */
2377
+ tapStartedAt = null;
2378
+ tapMostTouches = 0;
2379
+ isPressTimerArmed = false;
2380
+ /** When the gesture began, on the event clock. */
2381
+ beganAt = null;
2382
+ constructor(options = {}) {
2383
+ super({
2384
+ ...options,
2385
+ selectionLock: options.selectionLock !== void 0 ? options.selectionLock : (options.minimumPressDuration ?? UIKIT_LONG_PRESS.minimumPressDuration.value) > 0 ? lockSelection : null
2386
+ });
2387
+ this.minimumPressDuration = options.minimumPressDuration ?? UIKIT_LONG_PRESS.minimumPressDuration.value;
2388
+ this.allowableMovement = options.allowableMovement ?? UIKIT_LONG_PRESS.allowableMovement.value;
2389
+ this.numberOfTapsRequired = options.numberOfTapsRequired ?? 0;
2390
+ this.numberOfTouchesRequired = options.numberOfTouchesRequired ?? 1;
2391
+ }
2392
+ isInvolved() {
2393
+ return super.isInvolved() || this.tapsDone > 0;
2394
+ }
2395
+ get nativeTouchBehavior() {
2396
+ return MANIPULATION;
2397
+ }
2398
+ acceptsTouch(touch) {
2399
+ if (isActive(this.state)) return false;
2400
+ return super.acceptsTouch(touch);
2401
+ }
2402
+ touchesBegan(_touches, event) {
2403
+ if (this.numberOfTouches > this.numberOfTouchesRequired) {
2404
+ this.setState("failed");
2405
+ return;
2406
+ }
2407
+ if (this.tapsDone > 0) this.clearTimer();
2408
+ if (this.tapsDone < this.numberOfTapsRequired) {
2409
+ this.tapStartedAt ??= event.time;
2410
+ this.tapMostTouches = Math.max(this.tapMostTouches, this.numberOfTouches);
2411
+ }
2412
+ if (this.numberOfTouches === this.numberOfTouchesRequired && this.tapsDone >= this.numberOfTapsRequired) {
2413
+ if (this.minimumPressDuration <= 0) {
2414
+ this.beganAt = event.time;
2415
+ this.setState("began");
2416
+ return;
2417
+ }
2418
+ this.isPressTimerArmed = true;
2419
+ this.setTimer(event.time + this.minimumPressDuration, () => {
2420
+ this.isPressTimerArmed = false;
2421
+ if (this.state === "possible" && this.numberOfTouches === this.numberOfTouchesRequired) {
2422
+ this.beganAt = this.now();
2423
+ this.setState("began");
2424
+ }
2425
+ });
2426
+ }
2427
+ }
2428
+ touchesMoved(touches) {
2429
+ if (this.state === "possible") {
2430
+ if (touches.some((touch) => travel(touch) > this.allowableMovement)) this.setState("failed");
2431
+ return;
2432
+ }
2433
+ if (isActive(this.state)) this.setState("changed");
2434
+ }
2435
+ touchesEnded(touches, event) {
2436
+ if (isActive(this.state)) {
2437
+ this.setState("ended");
2438
+ return;
2439
+ }
2440
+ if (this.isPressTimerArmed || this.tapsDone >= this.numberOfTapsRequired) {
2441
+ this.setState("failed");
2442
+ return;
2443
+ }
2444
+ if (this.numberOfTouches - touches.length > 0) return;
2445
+ const heldFor = event.time - (this.tapStartedAt ?? event.time);
2446
+ const fingers = this.tapMostTouches;
2447
+ this.tapStartedAt = null;
2448
+ this.tapMostTouches = 0;
2449
+ if (heldFor > UIKIT_TAP.maximumTapDuration.value || fingers !== this.numberOfTouchesRequired) {
2450
+ this.setState("failed");
2451
+ return;
2452
+ }
2453
+ this.tapsDone += 1;
2454
+ this.setTimer(event.time + UIKIT_TAP.maximumIntervalBetweenTaps.value, () => {
2455
+ this.setState("failed");
2456
+ });
2457
+ }
2458
+ reset() {
2459
+ this.tapsDone = 0;
2460
+ this.tapStartedAt = null;
2461
+ this.tapMostTouches = 0;
2462
+ this.isPressTimerArmed = false;
2463
+ this.beganAt = null;
2464
+ }
2465
+ };
2466
+ //#endregion
2467
+ //#region src/List/reorder/reorderTouch.ts
2468
+ /**
2469
+ * Holds `list`'s handles for a drag: a still touch claims it after the
2470
+ * scroll view's content-touch delay, and travel before that hands the touch
2471
+ * to the scroller. Returns the release.
2472
+ */
2473
+ function attachTouchHold(list, pointerTypes, receives, onGesture, isOnHandle) {
2474
+ const host = getGestureHost(list.ownerDocument);
2475
+ const recognizer = new LongPressGestureRecognizer({
2476
+ name: "List.reorder",
2477
+ minimumPressDuration: reorder.claim.delayMs,
2478
+ allowableMovement: reorder.claim.allowableMovement,
2479
+ allowedPointerTypes: pointerTypes,
2480
+ shouldReceiveTouch: (_recognizer, touch) => receives(touch.target),
2481
+ shouldBegin: () => host.fingersDown() <= 1
2482
+ });
2483
+ const unlisten = recognizer.addListener(onGesture);
2484
+ const detach = host.attach(list, recognizer, { manageStyle: false });
2485
+ const unlock = lockSelectionWhileHeld(list, pointerTypes, isOnHandle);
2486
+ return () => {
2487
+ detach();
2488
+ unlisten();
2489
+ unlock();
2490
+ };
2491
+ }
2492
+ /**
2493
+ * A hold on a handle selects no text and shows no callout, from the press:
2494
+ * the hold has not claimed the drag yet when the browser would select.
2495
+ */
2496
+ function lockSelectionWhileHeld(list, pointerTypes, isOnHandle) {
2497
+ const view = list.ownerDocument.defaultView;
2498
+ if (view == null) return () => {};
2499
+ const held = /* @__PURE__ */ new Map();
2500
+ const release = (event) => {
2501
+ held.get(event.pointerId)?.();
2502
+ held.delete(event.pointerId);
2503
+ };
2504
+ const unsubscribe = [
2505
+ subscribeInput(view, "pointerdown", (event) => {
2506
+ if (locksSelectionFor(event.pointerType) && pointerTypes.includes(event.pointerType) && isOnHandle(event.target)) {
2507
+ release(event);
2508
+ held.set(event.pointerId, lockSelection([list], event.target));
2509
+ }
2510
+ }),
2511
+ subscribeInput(view, "pointerup", release),
2512
+ subscribeInput(view, "pointercancel", release)
2513
+ ];
2514
+ return () => {
2515
+ for (const stop of unsubscribe) stop();
2516
+ for (const unlockHeld of held.values()) unlockHeld();
2517
+ held.clear();
2518
+ };
2519
+ }
2520
+ /** Gives the row's translate back to its stylesheet once it arrives. */
2521
+ function releaseOnArrival(element, arrived) {
2522
+ arrived.then((done) => {
2523
+ if (done) releaseMotion(element, "translate");
2524
+ });
2525
+ }
2526
+ /** The rows' motion: every glide plays the shared settle role. */
2527
+ const touchMotion = {
2528
+ /** The settle spring, as the list's theme and reduced motion resolve it. */
2529
+ glideBase(list) {
2530
+ registerSpringsTable();
2531
+ return durationBounceOf(toSpring(resolveMotion(list, springs.settle)));
2532
+ },
2533
+ /** The dropped row: from where it was let go, with the release velocity. */
2534
+ glide(element, shift, spring, at, velocity) {
2535
+ animatorFor(element).rebase({ y: shift }, { at });
2536
+ releaseOnArrival(element, animateRow(element, { y: 0 }, spring, {
2537
+ at,
2538
+ velocity: { y: velocity }
2539
+ }).finished);
2540
+ },
2541
+ /** A row back to its place. */
2542
+ home(element, spring, at, fromRest) {
2543
+ releaseOnArrival(element, animateRow(element, { y: 0 }, spring, {
2544
+ at,
2545
+ velocity: fromRest ? { y: 0 } : void 0
2546
+ }).finished);
2547
+ },
2548
+ /** A row that makes room: its running spring, if any, continues. */
2549
+ follow(element, shift, spring, at) {
2550
+ const running = motionOf(element, "y")?.spring ?? spring;
2551
+ animatorFor(element).rebase({ y: shift }, { at });
2552
+ releaseOnArrival(element, animateRow(element, { y: 0 }, running, { at }).finished);
2553
+ }
2554
+ };
2555
+ //#endregion
2556
+ //#region src/List/reorder/reorderDrop.ts
2557
+ var ReorderDrop = class extends ReorderDrag {
2558
+ drop(velocity) {
2559
+ const session = this.session;
2560
+ if (session == null) return;
2561
+ if (session.scrollStale) this.track(session.lastY);
2562
+ this.session = null;
2563
+ this.stopAutoscroll(session);
2564
+ session.stopScrollWatch();
2565
+ const { geometry, dragged, position, rows, list } = session;
2566
+ const element = rows[dragged];
2567
+ const droppedTop = geometry.rows[dragged].top + shownY(session.preview, motionNow());
2568
+ this.clearOverlays(session);
2569
+ const dropped = this.messages?.dropped(position + 1, rows.length) ?? "";
2570
+ const key = this.keyOf(element);
2571
+ const options = this.options;
2572
+ if (position === dragged || options == null || key == null) {
2573
+ if (position === dragged) {
2574
+ this.announce(dropped, "polite");
2575
+ clearReordering(list);
2576
+ this.restWhenDone(element, session.restore);
2577
+ } else this.springBack(list, rows, dragged, session.restore);
2578
+ return;
2579
+ }
2580
+ this.announceWhenCommitted({
2581
+ row: element,
2582
+ to: position,
2583
+ landed: () => dropped,
2584
+ kept: this.messages?.cancelled(dragged + 1, rows.length) ?? "",
2585
+ politeness: "polite"
2586
+ });
2587
+ this.pending = {
2588
+ list,
2589
+ rows,
2590
+ tops: session.tops,
2591
+ dragged,
2592
+ droppedTop,
2593
+ velocity,
2594
+ restore: session.restore
2595
+ };
2596
+ options.onReorder({
2597
+ key,
2598
+ to: position
2599
+ });
2600
+ this.fallback = setTimeout(() => {
2601
+ this.fallback = null;
2602
+ this.refuse();
2603
+ }, 0);
2604
+ }
2605
+ cancel() {
2606
+ const session = this.session;
2607
+ if (session == null) return;
2608
+ this.session = null;
2609
+ this.stopAutoscroll(session);
2610
+ session.stopScrollWatch();
2611
+ this.clearOverlays(session);
2612
+ this.springBack(session.list, session.rows, session.dragged, session.restore);
2613
+ this.announce(this.messages?.cancelled(session.dragged + 1, session.rows.length) ?? "");
2614
+ }
2615
+ clearOverlays(session) {
2616
+ session.preview.remove();
2617
+ hideLine(session.list);
2618
+ const row = session.rows[session.dragged];
2619
+ clearReorderSource(row);
2620
+ row.style.opacity = session.restore.opacity;
2621
+ row.style.counterIncrement = session.restore.counterIncrement;
2622
+ session.list.style.position = session.restore.listPosition;
2623
+ }
2624
+ springBack(list, rows, dragged, restore) {
2625
+ const at = motionNow();
2626
+ const away = rows.filter((element) => Math.abs(shownY(element, at)) >= .5 || isMoving(element));
2627
+ const spring = this.animates && away.length > 0 ? touchMotion.glideBase(list) : null;
2628
+ for (const element of away) {
2629
+ if (spring == null) {
2630
+ animatorFor(element).set({ y: 0 });
2631
+ releaseMotion(element, "translate");
2632
+ continue;
2633
+ }
2634
+ touchMotion.home(element, spring, at, false);
2635
+ }
2636
+ clearReordering(list);
2637
+ this.restWhenDone(rows[dragged], restore);
2638
+ }
2639
+ refuse() {
2640
+ const pending = this.pending;
2641
+ if (pending == null) return;
2642
+ if (!sameOrder(this.rows.read(pending.list), pending.rows)) return;
2643
+ this.pending = null;
2644
+ this.springBack(pending.list, pending.rows, pending.dragged, pending.restore);
2645
+ }
2646
+ /** Gives the row its own styles back once its glide arrives. */
2647
+ restWhenDone(element, restore) {
2648
+ const settle = () => {
2649
+ if (this.session?.rows[this.session.dragged] === element) return;
2650
+ const running = motionOf(element, "y");
2651
+ if (running != null) {
2652
+ running.handle.finished.then(settle);
2653
+ return;
2654
+ }
2655
+ element.style.zIndex = restore.zIndex;
2656
+ element.style.backgroundColor = restore.backgroundColor;
2657
+ for (const row of restore.rows) releaseMotion(row, "translate");
2658
+ };
2659
+ settle();
2660
+ }
2661
+ flushPending() {
2662
+ if (this.pending == null) return;
2663
+ if (this.fallback != null) {
2664
+ clearTimeout(this.fallback);
2665
+ this.fallback = null;
2666
+ }
2667
+ this.refuse();
2668
+ this.pending = null;
2669
+ }
2670
+ ownsCommit() {
2671
+ const list = this.getList();
2672
+ return list != null && isReordering(list);
2673
+ }
2674
+ commit() {
2675
+ const list = this.getList();
2676
+ if (list == null) return;
2677
+ if (this.keys.size === 0 && this.options != null && this.options.isReorderable == null && list.children.length > 0) this.warn("List", "`reorderable` is set, but no ListItem has an `itemKey`: give each row the key its moves report.");
2678
+ const session = this.session;
2679
+ if (session != null && !sameOrder(this.rows.read(list), session.rows)) this.cancel();
2680
+ const pending = this.pending;
2681
+ if (pending != null && !sameOrder(this.rows.read(list), pending.rows)) {
2682
+ this.pending = null;
2683
+ if (this.fallback != null) {
2684
+ clearTimeout(this.fallback);
2685
+ this.fallback = null;
2686
+ }
2687
+ this.rebase(pending);
2688
+ }
2689
+ const announcement = this.announcement;
2690
+ if (announcement != null && this.rows.read(list).indexOf(announcement.row) === announcement.to) {
2691
+ this.announcement = null;
2692
+ if (this.announcementFallback != null) {
2693
+ clearTimeout(this.announcementFallback);
2694
+ this.announcementFallback = null;
2695
+ }
2696
+ this.announce(announcement.landed(), announcement.politeness);
2697
+ }
2698
+ const move = this.committedMove;
2699
+ let slide = null;
2700
+ if (move != null && !sameOrder(this.rows.read(list), move.rows)) {
2701
+ this.committedMove = null;
2702
+ if (this.moveFallback != null) {
2703
+ clearTimeout(this.moveFallback);
2704
+ this.moveFallback = null;
2705
+ }
2706
+ slide = this.slideCommitted(move);
2707
+ }
2708
+ if (this.announcement == null) {
2709
+ const placeLine = this.measureModeLine(list);
2710
+ this.restoreFocus();
2711
+ slide?.();
2712
+ placeLine();
2713
+ } else slide?.();
2714
+ }
2715
+ /** Reads a committed reorder-mode move and returns its glides. */
2716
+ slideCommitted(move) {
2717
+ const { list } = move;
2718
+ const at = motionNow();
2719
+ const shifts = move.rows.map((element, index) => this.rows.holds(element, list) ? move.tops[index] - layoutTop(element, list) : 0);
2720
+ const spring = shifts.some((shift) => Math.abs(shift) >= .5) ? touchMotion.glideBase(list) : null;
2721
+ return () => {
2722
+ for (const [index, element] of move.rows.entries()) {
2723
+ const shift = shifts[index];
2724
+ if (spring == null || Math.abs(shift) < .5) continue;
2725
+ touchMotion.follow(element, shift, spring, at);
2726
+ }
2727
+ clearReordering(list);
2728
+ };
2729
+ }
2730
+ /**
2731
+ * The drop's commit: each row starts from its old place (the dropped row
2732
+ * from where it was let go) and glides to its new one.
2733
+ */
2734
+ rebase(pending) {
2735
+ const { list } = pending;
2736
+ const at = motionNow();
2737
+ const rows = pending.rows.map((element, index) => {
2738
+ if (!this.rows.holds(element, list)) return null;
2739
+ return {
2740
+ element,
2741
+ index,
2742
+ shift: (index === pending.dragged ? pending.droppedTop : pending.tops[index]) - layoutTop(element, list),
2743
+ value: shownY(element, at),
2744
+ moving: isMoving(element)
2745
+ };
2746
+ });
2747
+ const settles = (row) => Math.abs(row.value + row.shift) < .5 && !row.moving;
2748
+ const glides = (row) => !settles(row) && Math.abs(row.shift) >= .5;
2749
+ const spring = this.animates && rows.some((row) => row != null && glides(row)) ? touchMotion.glideBase(list) : null;
2750
+ for (const row of rows) {
2751
+ if (row == null) continue;
2752
+ const { element, index, shift, value, moving } = row;
2753
+ if (settles(row)) {
2754
+ settleAtRest(element, value, moving);
2755
+ continue;
2756
+ }
2757
+ if (!glides(row)) continue;
2758
+ if (spring != null && index === pending.dragged) touchMotion.glide(element, shift, spring, at, pending.velocity);
2759
+ else if (spring != null) touchMotion.follow(element, shift, spring, at);
2760
+ else settleAtRest(element, value, moving);
2761
+ }
2762
+ clearReordering(list);
2763
+ this.restWhenDone(pending.rows[pending.dragged], pending.restore);
2764
+ }
2765
+ /**
2766
+ * Announces once the move lands: at the commit that puts the row at `to`,
2767
+ * or what was kept if no such commit comes.
2768
+ */
2769
+ announceWhenCommitted(announcement) {
2770
+ this.announcement = announcement;
2771
+ if (this.announcementFallback != null) clearTimeout(this.announcementFallback);
2772
+ this.announcementFallback = setTimeout(() => {
2773
+ this.announcementFallback = null;
2774
+ const pending = this.announcement;
2775
+ if (pending != null) {
2776
+ this.announcement = null;
2777
+ this.announce(pending.kept, pending.politeness);
2778
+ }
2779
+ this.restoreFocus();
2780
+ }, 0);
2781
+ }
2782
+ /** Keeps focus on the mode's handle once its row has moved. */
2783
+ restoreFocus() {
2784
+ const row = this.focusRow;
2785
+ if (row == null) return;
2786
+ this.focusRow = null;
2787
+ const handle = this.handleIn(row);
2788
+ const active = row.ownerDocument.activeElement;
2789
+ if (handle === this.modeHandle) row.scrollIntoView?.({
2790
+ block: "nearest",
2791
+ inline: "nearest"
2792
+ });
2793
+ if (handle instanceof HTMLElement && handle === this.modeHandle && (active == null || active === row.ownerDocument.body || this.hintElement?.contains(active) === true)) handle.focus({ preventScroll: true });
2794
+ }
2795
+ };
2796
+ //#endregion
2797
+ //#region src/List/reorder/reorderController.ts
2798
+ var ListReorderController = class extends ReorderDrop {
2799
+ Host = _sfc_main$1;
2800
+ Handle = _sfc_main$4;
2801
+ RowName = ListReorderRowName_default;
2802
+ /** Starts reorder mode on `handle`, or ends it there. */
2803
+ toggleMode(handle) {
2804
+ if (handle == null || this.session != null) return;
2805
+ if (this.modeHandle === handle) {
2806
+ this.endMode();
2807
+ return;
2808
+ }
2809
+ if (this.handleOf(handle) === handle) {
2810
+ this.setMode(handle);
2811
+ if (handle.ownerDocument.activeElement !== handle) handle.focus({ preventScroll: true });
2812
+ }
2813
+ }
2814
+ endMode() {
2815
+ const handle = this.modeHandle;
2816
+ const list = this.getList();
2817
+ const row = this.rowOf(handle);
2818
+ const active = handle?.ownerDocument.activeElement;
2819
+ if (handle != null && active != null && this.hintElement?.contains(active)) handle.focus({ preventScroll: true });
2820
+ this.setMode(null);
2821
+ if (list == null || row == null) return;
2822
+ const rows = this.rows.read(list);
2823
+ const index = rows.indexOf(row);
2824
+ this.announce(this.messages?.modeDone(this.nameOf(row, index), index + 1, rows.length) ?? "");
2825
+ }
2826
+ /** Reorder mode for the item with `key`, from the app's own UI. */
2827
+ startByKey(key) {
2828
+ if (this.session != null) return true;
2829
+ for (const [handle, handleKey] of this.keys) if (handleKey === key && handle instanceof HTMLElement && this.handleOf(handle) === handle) {
2830
+ this.setMode(handle);
2831
+ handle.focus({ preventScroll: true });
2832
+ this.rowOf(handle)?.scrollIntoView?.({
2833
+ block: "nearest",
2834
+ inline: "nearest"
2835
+ });
2836
+ this.claimFocusUntil = performance.now() + 150;
2837
+ return true;
2838
+ }
2839
+ return false;
2840
+ }
2841
+ /** Whether `handle`'s click ends a drag; reading it clears it. */
2842
+ takeDrag(handle) {
2843
+ const dragged = handle != null && this.draggedHandle === handle;
2844
+ this.draggedHandle = null;
2845
+ return dragged;
2846
+ }
2847
+ /** The mouse's and fine pen's drag: past `MOUSE_DRAG_SLOP`. Returns the release. */
2848
+ attachMouse() {
2849
+ const list = this.getList();
2850
+ if (list == null) return () => {};
2851
+ const onPointerDown = (event) => {
2852
+ if (!this.dragsAtOnce(event.pointerType) || event.button !== 0) return;
2853
+ const handle = this.handleOf(event.target);
2854
+ if (handle == null) return;
2855
+ this.endMouse?.();
2856
+ this.draggedHandle = null;
2857
+ const { pointerId, clientX: x, clientY: y } = event;
2858
+ let isDragging = false;
2859
+ const velocity = new VelocityTracker();
2860
+ velocity.add(x, y, event.timeStamp);
2861
+ const listening = new AbortController();
2862
+ const end = () => {
2863
+ listening.abort();
2864
+ if (handle.hasPointerCapture?.(pointerId)) handle.releasePointerCapture(pointerId);
2865
+ if (this.endMouse === end) this.endMouse = null;
2866
+ };
2867
+ const onMove = (move) => {
2868
+ if (move.pointerId !== pointerId) return;
2869
+ velocity.add(move.clientX, move.clientY, move.timeStamp);
2870
+ if (!isDragging) {
2871
+ if (Math.hypot(move.clientX - x, move.clientY - y) < 4) return;
2872
+ isDragging = true;
2873
+ this.draggedHandle = handle;
2874
+ this.gesture(this.rowOf(handle), {
2875
+ state: "began",
2876
+ y
2877
+ });
2878
+ }
2879
+ this.gesture(null, {
2880
+ state: "changed",
2881
+ y: move.clientY
2882
+ });
2883
+ };
2884
+ const onUp = (up) => {
2885
+ if (up.pointerId !== pointerId) return;
2886
+ end();
2887
+ if (isDragging) {
2888
+ velocity.add(up.clientX, up.clientY, up.timeStamp);
2889
+ this.gesture(null, {
2890
+ state: "ended",
2891
+ y: up.clientY,
2892
+ velocity: velocity.velocity(up.timeStamp).y
2893
+ });
2894
+ }
2895
+ };
2896
+ const onCancel = (cancel) => {
2897
+ if (cancel.pointerId !== pointerId) return;
2898
+ end();
2899
+ if (isDragging) this.gesture(null, {
2900
+ state: "cancelled",
2901
+ y: cancel.clientY
2902
+ });
2903
+ };
2904
+ const { signal } = listening;
2905
+ list.addEventListener("pointermove", onMove, { signal });
2906
+ list.addEventListener("pointerup", onUp, { signal });
2907
+ list.addEventListener("pointercancel", onCancel, { signal });
2908
+ list.addEventListener("lostpointercapture", onCancel, { signal });
2909
+ handle.setPointerCapture?.(pointerId);
2910
+ this.endMouse = end;
2911
+ };
2912
+ list.addEventListener("pointerdown", onPointerDown, true);
2913
+ return () => {
2914
+ this.endMouse?.();
2915
+ list.removeEventListener("pointerdown", onPointerDown, true);
2916
+ };
2917
+ }
2918
+ /** The finger's drag, and a coarse pen's: after a still hold. Returns the release. */
2919
+ attachTouch(isCoarsePointer) {
2920
+ const list = this.getList();
2921
+ if (list == null) return () => {};
2922
+ let held = null;
2923
+ const velocity = new VelocityTracker();
2924
+ return attachTouchHold(list, isCoarsePointer ? ["touch", "pen"] : ["touch"], (target) => {
2925
+ const handle = this.handleOf(target);
2926
+ if (handle != null) held = handle;
2927
+ return handle != null;
2928
+ }, (recognizer) => {
2929
+ const state = gestureStateOf(recognizer.state);
2930
+ if (state === "began") {
2931
+ this.draggedHandle = held;
2932
+ velocity.reset();
709
2933
  }
710
- targetIndex = nearest(startPoint ?? position());
711
- if (drag != null) drag.startIndex = targetIndex;
712
- },
713
- snapPoints() {
714
- return points;
715
- },
716
- animator,
717
- position,
718
- finishSettle() {
719
- const finish = finishCompositor;
720
- if (compositor == null || finish == null) return;
721
- compositor.stop();
722
- finish();
723
- },
724
- destroy() {
725
- if (destroyed) return;
726
- destroyed = true;
727
- pan.destroy();
728
- holdCompositor();
729
- animator.stop();
730
- animator.dispose();
2934
+ const touch = recognizer.trackedTouches[0];
2935
+ if (touch != null && state != null && state !== "cancelled") velocity.add(touch.x, touch.y, touch.time);
2936
+ if (state != null) this.gesture(state === "began" ? this.rowOf(held) : null, {
2937
+ state,
2938
+ y: recognizer.location().y,
2939
+ velocity: state === "ended" && touch != null ? velocity.velocity(touch.time).y : void 0
2940
+ });
2941
+ }, (target) => this.handleOf(target) != null);
2942
+ }
2943
+ /** A handle that goes away or turns disabled ends its drag and its mode. */
2944
+ release(handle) {
2945
+ if (handle == null) return;
2946
+ if (this.session != null && this.draggedHandle === handle) {
2947
+ this.endMouse?.();
2948
+ this.cancel();
2949
+ }
2950
+ if (this.modeHandle === handle) this.setMode(null);
2951
+ }
2952
+ keyDown(handle, event) {
2953
+ if (handle == null || handle !== this.modeHandle || event.altKey || event.ctrlKey || event.metaKey) return;
2954
+ switch (event.key) {
2955
+ case "Escape":
2956
+ event.preventDefault();
2957
+ event.stopPropagation();
2958
+ this.endMode();
2959
+ return;
2960
+ case "ArrowUp":
2961
+ case "ArrowDown":
2962
+ event.preventDefault();
2963
+ this.step(handle, event.key === "ArrowUp" ? -1 : 1);
2964
+ }
2965
+ }
2966
+ /** Moves the mode's row a place up or down, committed at once. */
2967
+ step(handle, delta) {
2968
+ const list = this.getList();
2969
+ const options = this.options;
2970
+ const row = this.rowOf(handle);
2971
+ const key = row == null ? void 0 : this.keyOf(row);
2972
+ if (list == null || options == null || row == null || key == null || handle !== this.modeHandle || this.session != null) return;
2973
+ const rows = this.rows.read(list);
2974
+ const index = rows.indexOf(row);
2975
+ const to = index + delta;
2976
+ if (to < 0 || to >= rows.length) return;
2977
+ if (boundsOf(rows.map((element) => this.handleIn(element) != null))[to]) {
2978
+ this.announce(this.messages?.refused(this.nameOf(rows[to], to)) ?? "");
2979
+ return;
731
2980
  }
2981
+ this.focusRow = row;
2982
+ this.lastStep = delta;
2983
+ this.announceWhenCommitted({
2984
+ row,
2985
+ to,
2986
+ landed: () => this.placeIn(this.rows.read(list), to),
2987
+ kept: this.placeIn(rows, index),
2988
+ politeness: void 0
2989
+ });
2990
+ if (this.animates) {
2991
+ this.committedMove = {
2992
+ list,
2993
+ rows,
2994
+ tops: rows.map((element) => layoutTop(element, list))
2995
+ };
2996
+ markReordering(list);
2997
+ if (this.moveFallback != null) clearTimeout(this.moveFallback);
2998
+ this.moveFallback = setTimeout(() => {
2999
+ this.moveFallback = null;
3000
+ if (this.committedMove != null) {
3001
+ this.committedMove = null;
3002
+ if (this.session == null && this.pending == null) clearReordering(list);
3003
+ }
3004
+ }, 0);
3005
+ }
3006
+ options.onReorder({
3007
+ key,
3008
+ to
3009
+ });
3010
+ }
3011
+ placeIn(order, at) {
3012
+ const name = (index) => this.nameOf(order[index], index);
3013
+ return this.messages?.place(name(at), at + 1, order.length, at > 0 ? name(at - 1) : null, at < order.length - 1 ? name(at + 1) : null) ?? "";
3014
+ }
3015
+ /**
3016
+ * Keeps focus on a handle `start` just put in reorder mode: a closing menu
3017
+ * hands focus back to its trigger.
3018
+ */
3019
+ blur(handle, next) {
3020
+ if (next instanceof Node && this.hintElement?.contains(next)) return;
3021
+ if (handle != null && handle === this.modeHandle && performance.now() < this.claimFocusUntil) setTimeout(() => {
3022
+ if (this.modeHandle === handle) handle.focus({ preventScroll: true });
3023
+ }, 0);
3024
+ }
3025
+ dispose() {
3026
+ this.endMouse?.();
3027
+ this.setMode(null);
3028
+ this.cancel();
3029
+ if (this.moveFallback != null) {
3030
+ clearTimeout(this.moveFallback);
3031
+ this.moveFallback = null;
3032
+ }
3033
+ this.committedMove = null;
3034
+ if (this.fallback != null) {
3035
+ clearTimeout(this.fallback);
3036
+ this.fallback = null;
3037
+ }
3038
+ this.pending = null;
3039
+ if (this.announcementFallback != null) {
3040
+ clearTimeout(this.announcementFallback);
3041
+ this.announcementFallback = null;
3042
+ }
3043
+ this.announcement = null;
3044
+ }
3045
+ };
3046
+ //#endregion
3047
+ //#region src/List/reorder/listReorderEngine.ts
3048
+ /** The sessions each object's options are mounted on, oldest first. */
3049
+ const sessionsByOptions = /* @__PURE__ */ new WeakMap();
3050
+ /** Records `controller` as mounted for `options`; returns the unmount. */
3051
+ function mountSession(options, controller) {
3052
+ const sessions = sessionsByOptions.get(options) ?? [];
3053
+ sessionsByOptions.set(options, [...sessions.filter((session) => session !== controller), controller]);
3054
+ return () => {
3055
+ const rest = (sessionsByOptions.get(options) ?? []).filter((session) => session !== controller);
3056
+ if (rest.length > 0) sessionsByOptions.set(options, rest);
3057
+ else sessionsByOptions.delete(options);
732
3058
  };
733
3059
  }
3060
+ const listReorderEngine = {
3061
+ createSession: (getList, hintId, rows) => new ListReorderController(getList, hintId, rows),
3062
+ start: (options, key) => {
3063
+ const sessions = sessionsByOptions.get(options) ?? [];
3064
+ if (sessions.length > 1) devWarn("createReorderable", "`start` was called on an object passed to more than one collection: it starts reorder mode in the one mounted last.");
3065
+ const session = sessions.at(-1);
3066
+ if (session == null || !session.startByKey(key)) devWarn("createReorderable", `\`start(${String(key)})\` found no mounted item with that key that can be reordered, so it did nothing.`);
3067
+ }
3068
+ };
734
3069
  //#endregion
735
- //#region src/dragToSnapPoints/createDragToSnapPoints.ts
736
- /**
737
- * @file createDragToSnapPoints.ts
738
- * @input An element and its snap points
739
- * @output The public snap-point drag: `createDragToSnapPoints`, its options
740
- * and handle. Also re-exports createSnapDrag and its types (the drag under
741
- * it, with the options only Core passes), which no package entry exports.
742
- * @position Public entry point, re-exported from the package through
743
- * composables/createDragToSnapPoints.ts, and wrapped by
744
- * `useDragToSnapPoints`. Importing it does no DOM work.
745
- *
746
- * SYNC: When modified, update:
747
- * - createDragToSnapPoints.test.ts
748
- * - ../composables/useDragToSnapPoints.ts
749
- * - the use-drag-to-snap-points docs
750
- */
3070
+ //#region src/reorderable/createReorderable.ts
751
3071
  /**
752
- * Lets a drag move `element` along `axis` and settles it on `snapPoints` at
753
- * the release, then calls `onSettle(index)`.
754
- *
755
- * The release settles on the nearest snap point. A release faster than
756
- * `flickThreshold` carries to the next one in its direction. A release that
757
- * moves back toward the drag's start returns to the snap point it started
758
- * from. The settle springs from the release velocity. Under Reduce Motion,
759
- * the release cross-fades after a touch drag or on a coarse primary pointer,
760
- * and lands at once elsewhere. `settleTo(index)` settles without a drag, for
761
- * the keyboard.
3072
+ * Makes a collection's items reorderable: by dragging a row's handle, and by
3073
+ * the keyboard in reorder mode. Create it once per collection (in `setup`)
3074
+ * and pass it to the List's `reorderable`.
762
3075
  *
763
3076
  * @example
764
3077
  * ```ts
765
- * const snap = createDragToSnapPoints(drawer, {
766
- * axis: 'y',
767
- * snapPoints: [0, 240, 480],
768
- * onSettle: index => console.log('settled on', index),
3078
+ * const reorderable = createReorderable<string>({
3079
+ * onReorder: ({ key, to }) => {
3080
+ * const next = items.value.filter(item => item.id !== key)
3081
+ * next.splice(to, 0, items.value.find(item => item.id === key)!)
3082
+ * items.value = next
3083
+ * },
769
3084
  * })
770
- * button.addEventListener('click', () => snap.settleTo(0))
771
- * // Later:
772
- * snap.destroy()
773
3085
  * ```
774
3086
  */
775
- function createDragToSnapPoints(element, options) {
776
- const { axis, flickThreshold, onSettle } = options;
777
- if (!options.snapPoints.some((point) => Number.isFinite(point))) {
778
- devWarn("createDragToSnapPoints", "snapPoints is empty, so the drag does nothing.");
779
- return {
780
- settleTo() {},
781
- destroy() {}
782
- };
783
- }
784
- const snap = createSnapDrag(element, {
785
- axis,
786
- snapPoints: options.snapPoints,
787
- ...flickThreshold != null ? { flickThreshold } : {},
788
- onSettle
789
- });
790
- return {
791
- settleTo(index) {
792
- snap.settleTo(index);
793
- },
794
- destroy() {
795
- snap.destroy();
796
- }
3087
+ function createReorderable(options) {
3088
+ const internals = {
3089
+ options,
3090
+ [REORDER_ENGINE]: listReorderEngine,
3091
+ start: (key) => listReorderEngine.start(internals.options, key)
797
3092
  };
3093
+ return internals;
798
3094
  }
799
3095
  //#endregion
800
3096
  //#region src/composables/useAnimator.ts
@@ -1455,7 +3751,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
1455
3751
  "aria-hidden": "true",
1456
3752
  style: normalizeStyle(style.value)
1457
3753
  }, [createElementVNode("span", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(keys.value, (key) => {
1458
- return openBlock(), createBlock(_sfc_main$1, {
3754
+ return openBlock(), createBlock(_sfc_main$5, {
1459
3755
  key,
1460
3756
  keys: key
1461
3757
  }, null, 8, ["keys"]);
@@ -1675,6 +3971,36 @@ function usePanGesture(target, options) {
1675
3971
  }, () => options.axis);
1676
3972
  }
1677
3973
  //#endregion
3974
+ //#region src/composables/useReorderable.ts
3975
+ /**
3976
+ * @file useReorderable.ts
3977
+ * @input 应用的 `onReorder` 和可选的 `isReorderable`,可以是 ref 或 getter
3978
+ * @output `useReorderable`:在 `setup` 里建一个可重排对象,交给 List 的 `reorderable`
3979
+ * @position 公开组合式函数,`createReorderable` 的组件内写法
3980
+ */
3981
+ /**
3982
+ * 让一个集合的行可以重排:拖行末的手柄,或者进入重排模式后用方向键挪。
3983
+ * 在 `setup` 里调用一次,把返回值交给 List 的 `reorderable`,每个 ListItem 带上 `itemKey`。
3984
+ * 每次调用都读 `options` 的最新值,所以传 ref 或 getter 时换掉回调不用重建。
3985
+ *
3986
+ * @example
3987
+ * ```ts
3988
+ * const reorderable = useReorderable<string>({
3989
+ * onReorder: ({ key, to }) => {
3990
+ * const next = items.value.filter(item => item.id !== key)
3991
+ * next.splice(to, 0, items.value.find(item => item.id === key)!)
3992
+ * items.value = next
3993
+ * },
3994
+ * })
3995
+ * ```
3996
+ */
3997
+ function useReorderable(options) {
3998
+ return createReorderable({
3999
+ onReorder: (move) => toValue(options).onReorder(move),
4000
+ isReorderable: (key) => toValue(options).isReorderable?.(key) ?? true
4001
+ });
4002
+ }
4003
+ //#endregion
1678
4004
  //#region src/motion/uikit/paging.ts
1679
4005
  /**
1680
4006
  * @file paging.ts
@@ -1864,111 +4190,6 @@ function registerPagingTable() {
1864
4190
  }
1865
4191
  registerPagingTable();
1866
4192
  //#endregion
1867
- //#region src/gestures/LongPressGestureRecognizer.ts
1868
- var LongPressGestureRecognizer = class extends GestureRecognizer {
1869
- get kind() {
1870
- return "longPress";
1871
- }
1872
- /** Internal. The host's brand: a long press keeps the callout and selection off (recognizerInternals). */
1873
- get family() {
1874
- return "longPress";
1875
- }
1876
- minimumPressDuration;
1877
- allowableMovement;
1878
- numberOfTapsRequired;
1879
- numberOfTouchesRequired;
1880
- tapsDone = 0;
1881
- /** The taps phase's current tap: when it landed and its most fingers. */
1882
- tapStartedAt = null;
1883
- tapMostTouches = 0;
1884
- isPressTimerArmed = false;
1885
- /** When the gesture began, on the event clock. */
1886
- beganAt = null;
1887
- constructor(options = {}) {
1888
- super({
1889
- ...options,
1890
- selectionLock: options.selectionLock !== void 0 ? options.selectionLock : (options.minimumPressDuration ?? UIKIT_LONG_PRESS.minimumPressDuration.value) > 0 ? lockSelection : null
1891
- });
1892
- this.minimumPressDuration = options.minimumPressDuration ?? UIKIT_LONG_PRESS.minimumPressDuration.value;
1893
- this.allowableMovement = options.allowableMovement ?? UIKIT_LONG_PRESS.allowableMovement.value;
1894
- this.numberOfTapsRequired = options.numberOfTapsRequired ?? 0;
1895
- this.numberOfTouchesRequired = options.numberOfTouchesRequired ?? 1;
1896
- }
1897
- isInvolved() {
1898
- return super.isInvolved() || this.tapsDone > 0;
1899
- }
1900
- get nativeTouchBehavior() {
1901
- return MANIPULATION;
1902
- }
1903
- acceptsTouch(touch) {
1904
- if (isActive(this.state)) return false;
1905
- return super.acceptsTouch(touch);
1906
- }
1907
- touchesBegan(_touches, event) {
1908
- if (this.numberOfTouches > this.numberOfTouchesRequired) {
1909
- this.setState("failed");
1910
- return;
1911
- }
1912
- if (this.tapsDone > 0) this.clearTimer();
1913
- if (this.tapsDone < this.numberOfTapsRequired) {
1914
- this.tapStartedAt ??= event.time;
1915
- this.tapMostTouches = Math.max(this.tapMostTouches, this.numberOfTouches);
1916
- }
1917
- if (this.numberOfTouches === this.numberOfTouchesRequired && this.tapsDone >= this.numberOfTapsRequired) {
1918
- if (this.minimumPressDuration <= 0) {
1919
- this.beganAt = event.time;
1920
- this.setState("began");
1921
- return;
1922
- }
1923
- this.isPressTimerArmed = true;
1924
- this.setTimer(event.time + this.minimumPressDuration, () => {
1925
- this.isPressTimerArmed = false;
1926
- if (this.state === "possible" && this.numberOfTouches === this.numberOfTouchesRequired) {
1927
- this.beganAt = this.now();
1928
- this.setState("began");
1929
- }
1930
- });
1931
- }
1932
- }
1933
- touchesMoved(touches) {
1934
- if (this.state === "possible") {
1935
- if (touches.some((touch) => travel(touch) > this.allowableMovement)) this.setState("failed");
1936
- return;
1937
- }
1938
- if (isActive(this.state)) this.setState("changed");
1939
- }
1940
- touchesEnded(touches, event) {
1941
- if (isActive(this.state)) {
1942
- this.setState("ended");
1943
- return;
1944
- }
1945
- if (this.isPressTimerArmed || this.tapsDone >= this.numberOfTapsRequired) {
1946
- this.setState("failed");
1947
- return;
1948
- }
1949
- if (this.numberOfTouches - touches.length > 0) return;
1950
- const heldFor = event.time - (this.tapStartedAt ?? event.time);
1951
- const fingers = this.tapMostTouches;
1952
- this.tapStartedAt = null;
1953
- this.tapMostTouches = 0;
1954
- if (heldFor > UIKIT_TAP.maximumTapDuration.value || fingers !== this.numberOfTouchesRequired) {
1955
- this.setState("failed");
1956
- return;
1957
- }
1958
- this.tapsDone += 1;
1959
- this.setTimer(event.time + UIKIT_TAP.maximumIntervalBetweenTaps.value, () => {
1960
- this.setState("failed");
1961
- });
1962
- }
1963
- reset() {
1964
- this.tapsDone = 0;
1965
- this.tapStartedAt = null;
1966
- this.tapMostTouches = 0;
1967
- this.isPressTimerArmed = false;
1968
- this.beganAt = null;
1969
- }
1970
- };
1971
- //#endregion
1972
4193
  //#region src/composables/internal/snapPagingCatcher.ts
1973
4194
  /**
1974
4195
  * 翻页途中「接住」这一行的识别器:一个零时长、不认领触摸的长按。它从不认领
@@ -2561,4 +4782,4 @@ function useTouchTrigger(options) {
2561
4782
  };
2562
4783
  }
2563
4784
  //#endregion
2564
- export { useContainerReveal as _, usePanGesture as a, createPanGesture as b, useIndicatorFocusRing as c, useImageMode as d, useGridRovingFocus as f, useControllableState as g, useDragToSnapPoints as h, useSnapPaging as i, imageModeFromPixels as l, useEntryAnimation as m, snapToGraphemeBoundary as n, useLinkify as o, useGridFocus as p, useStreamingText as r, useKeyboardHint as s, useTouchTrigger as t, perceptualLightness as u, useAnimator as v, createAnimator as x, createDragToSnapPoints as y };
4785
+ export { createAnimator as C, createPanGesture as S, useControllableState as _, useReorderable as a, createReorderable as b, useKeyboardHint as c, perceptualLightness as d, useImageMode as f, useDragToSnapPoints as g, useEntryAnimation as h, useSnapPaging as i, useIndicatorFocusRing as l, useGridFocus as m, snapToGraphemeBoundary as n, usePanGesture as o, useGridRovingFocus as p, useStreamingText as r, useLinkify as s, useTouchTrigger as t, imageModeFromPixels as u, useContainerReveal as v, createDragToSnapPoints as x, useAnimator as y };