@astryx-vue/core 0.2.3 → 0.2.4

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 (303) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -0
  2. package/dist/AlertDialog/index.js +1 -1
  3. package/dist/{AlertDialog-ovx4cBjM.js → AlertDialog-B6UeBCE7.js} +2 -2
  4. package/dist/AppShell/index.d.ts +1 -1
  5. package/dist/AppShell/index.js +1 -1
  6. package/dist/{AppShell-Dd-D4bA2.js → AppShell-CeBmB0Q9.js} +2 -2
  7. package/dist/Avatar/index.d.ts +1 -1
  8. package/dist/Avatar/index.js +1 -1
  9. package/dist/{Avatar-jmHInHwj.js → Avatar-BB4Z4LF1.js} +10 -4
  10. package/dist/AvatarGroup/index.d.ts +1 -1
  11. package/dist/Banner/index.d.ts +1 -1
  12. package/dist/BottomSheet/index.d.ts +2 -2
  13. package/dist/BottomSheet/index.js +3 -2
  14. package/dist/{BottomSheet-Dg95HB1s.js → BottomSheet-BV6vfgGu.js} +82 -22
  15. package/dist/BottomSheet-o7xw-TOi.js +153 -0
  16. package/dist/Breadcrumbs/index.d.ts +2 -2
  17. package/dist/Breadcrumbs/index.js +2 -2
  18. package/dist/{Breadcrumbs-CWGfgLNK.js → Breadcrumbs-D6G7f5WL.js} +1 -1
  19. package/dist/Button/index.d.ts +1 -1
  20. package/dist/ButtonGroup/index.d.ts +1 -1
  21. package/dist/Calendar/index.d.ts +1 -1
  22. package/dist/Calendar/index.js +1 -1
  23. package/dist/{Calendar-CnOsSjMY.js → Calendar-DmTeM7PO.js} +2 -2
  24. package/dist/Card/index.d.ts +1 -1
  25. package/dist/Carousel/index.js +1 -1
  26. package/dist/{Carousel-JA7ilqI_.js → Carousel-CIKrcA2r.js} +1 -1
  27. package/dist/Chat/index.d.ts +1 -1
  28. package/dist/Chat/index.js +1 -1
  29. package/dist/{Chat-C7WrCOE4.js → Chat-BFox3u9D.js} +1 -1
  30. package/dist/CheckboxInput/index.d.ts +1 -1
  31. package/dist/CheckboxList/index.d.ts +1 -1
  32. package/dist/CheckboxList/index.js +1 -1
  33. package/dist/{CheckboxList-CnCGnkZk.js → CheckboxList-BlPf7vPe.js} +4 -4
  34. package/dist/Citation/index.js +1 -1
  35. package/dist/{Citation-CtwrU33I.js → Citation-BG-vg9ia.js} +1 -1
  36. package/dist/ClickableCard/index.d.ts +1 -1
  37. package/dist/Code/index.d.ts +3 -3
  38. package/dist/Code/index.js +4 -4
  39. package/dist/{Code-BvefYRpx.js → Code-XnPuGxey.js} +1 -1
  40. package/dist/{CodeBlock-BZGzYeoL.js → CodeBlock-B2pnEOJY.js} +145 -15
  41. package/dist/Collapsible/index.d.ts +1 -1
  42. package/dist/CommandPalette/index.js +1 -1
  43. package/dist/{CommandPalette-BNbM9T9y.js → CommandPalette-DKgHzmJk.js} +10 -10
  44. package/dist/ComplexSelector/index.js +1 -1
  45. package/dist/{ComplexSelector-LtbLlrcj.js → ComplexSelector-Dv44FFhN.js} +1 -1
  46. package/dist/ContextMenu/index.d.ts +2 -2
  47. package/dist/ContextMenu/index.js +2 -2
  48. package/dist/{ContextMenu-DVQl0xL5.js → ContextMenu-BeJO5HYx.js} +4 -369
  49. package/dist/DateInput/index.d.ts +1 -1
  50. package/dist/DateInput/index.js +1 -1
  51. package/dist/{DateInput-zm8sNc0t.js → DateInput-D4XFAEMp.js} +3 -3
  52. package/dist/DateRangeInput/index.d.ts +1 -1
  53. package/dist/DateRangeInput/index.js +1 -1
  54. package/dist/{DateRangeInput-DlVFzrf7.js → DateRangeInput-Cp6AZfew.js} +2 -2
  55. package/dist/DateTimeInput/index.d.ts +1 -1
  56. package/dist/DateTimeInput/index.js +1 -1
  57. package/dist/{DateTimeInput-C7Z-p6Yd.js → DateTimeInput-B6MPPp76.js} +3 -3
  58. package/dist/Dialog/index.d.ts +1 -1
  59. package/dist/Divider/index.d.ts +1 -1
  60. package/dist/DropdownMenu/index.d.ts +2 -2
  61. package/dist/DropdownMenu/index.js +3 -3
  62. package/dist/{DropdownMenu-BoZChdev.js → DropdownMenu--lnUeJEG.js} +3 -3
  63. package/dist/{DropdownMenu-u1psFjis.js → DropdownMenu-6E9jFdFe.js} +4 -4
  64. package/dist/{DropdownMenuRadioItem.vue-uVM0FD2f.d.ts → DropdownMenuRadioItem.vue-CXEURBcq.d.ts} +1 -1
  65. package/dist/EmptyState/index.js +1 -1
  66. package/dist/{EmptyState-CUJdTYKV.js → EmptyState-0RWymQUS.js} +2 -2
  67. package/dist/FileInput/index.d.ts +1 -1
  68. package/dist/FileInput/index.js +1 -1
  69. package/dist/{FileInput-QdlZn7qK.js → FileInput-DuNwdbAo.js} +1 -1
  70. package/dist/Grid/index.d.ts +1 -1
  71. package/dist/Heading/index.d.ts +2 -2
  72. package/dist/Heading/index.js +1 -1
  73. package/dist/Heading-B9C3LZlS.js +94 -0
  74. package/dist/Indicator/index.d.ts +2 -2
  75. package/dist/InputGroup/index.d.ts +1 -1
  76. package/dist/Item-DrYJL1TG.js +590 -0
  77. package/dist/Lightbox/index.js +1 -1
  78. package/dist/{Lightbox-BSzfqZ-u.js → Lightbox-Br3o0SyQ.js} +1 -1
  79. package/dist/Link/index.d.ts +3 -2
  80. package/dist/Link/index.js +1 -1
  81. package/dist/Link-DCZ6922-.js +196 -0
  82. package/dist/List/index.d.ts +3 -3
  83. package/dist/List/index.js +2 -2
  84. package/dist/{ListItem-pGxvn6QJ.js → ListItem-CcRHWuEm.js} +8 -2
  85. package/dist/Markdown/index.d.ts +2 -2
  86. package/dist/Markdown/index.js +2 -2
  87. package/dist/{Markdown-B6tSqenv.js → Markdown-Bz0R3kNj.js} +274 -30
  88. package/dist/MetadataList/index.js +1 -1
  89. package/dist/{MetadataList-aN1tRn6W.js → MetadataList-CFaocx6j.js} +1 -1
  90. package/dist/MobileNav/index.js +1 -1
  91. package/dist/{MobileNavToggle-fqcSafkc.js → MobileNavToggle-Dh3uLivq.js} +1 -1
  92. package/dist/MoreMenu/index.d.ts +1 -1
  93. package/dist/MoreMenu/index.js +1 -1
  94. package/dist/{MoreMenu-B3brqdK_.js → MoreMenu-B95nRSe8.js} +2 -2
  95. package/dist/MultiSelector/index.d.ts +1 -1
  96. package/dist/MultiSelector/index.js +1 -1
  97. package/dist/{MultiSelector-BD5PMgez.js → MultiSelector-DuF5TECE.js} +4 -4
  98. package/dist/{NavDisclosure-DbYLDXK0.js → NavDisclosure-C6sPZ89n.js} +4 -1
  99. package/dist/NavHeadingSurface-Cb3x9iDx.js +287 -0
  100. package/dist/NavItem/index.d.ts +1 -1
  101. package/dist/NavMenu/index.d.ts +2 -2
  102. package/dist/NavMenu/index.js +4 -3
  103. package/dist/NavMenu-ClIgMaxE.js +176 -0
  104. package/dist/{NavMenuItem-DrwIMHKO.js → NavMenuItem-E7S8gBh-.js} +1 -1
  105. package/dist/NumberInput/index.d.ts +1 -1
  106. package/dist/NumberInput/index.js +1 -1
  107. package/dist/{NumberInput-CBeU4lEl.js → NumberInput-B4IL3s_8.js} +1 -1
  108. package/dist/Outline/index.js +1 -1
  109. package/dist/{Outline--HVMSB6i.js → Outline-DBUuchi9.js} +1 -1
  110. package/dist/OverflowList/index.d.ts +1 -1
  111. package/dist/OverflowList/index.js +1 -1
  112. package/dist/{OverflowList-FMh7r-r_.js → OverflowList-aDd_oem0.js} +3 -3
  113. package/dist/Pagination/index.d.ts +1 -1
  114. package/dist/Pagination/index.js +1 -1
  115. package/dist/{Pagination-DlIvESjx.js → Pagination-CNe9F6Fl.js} +181 -45
  116. package/dist/Popover/index.d.ts +1 -1
  117. package/dist/PowerSearch/index.d.ts +1 -1
  118. package/dist/PowerSearch/index.js +1 -1
  119. package/dist/{PowerSearch-CMG7Rb69.js → PowerSearch-C6U8Sq1Y.js} +13 -13
  120. package/dist/ProgressBar/index.d.ts +2 -2
  121. package/dist/ProgressBar/index.js +1 -1
  122. package/dist/{ProgressBar-DO9Chic6.js → ProgressBar-DF6WZNCI.js} +45 -6
  123. package/dist/Radio/index.d.ts +1 -1
  124. package/dist/RadioList/index.d.ts +1 -1
  125. package/dist/Resizable/index.js +1 -1
  126. package/dist/{Resizable-CXpvj1TZ.js → ResizeHandle-DYy0e3v9.js} +1 -1
  127. package/dist/ScrollableArea/index.d.ts +1 -1
  128. package/dist/SegmentedControl/index.d.ts +1 -1
  129. package/dist/SelectableCard/index.d.ts +1 -1
  130. package/dist/Selector/index.d.ts +1 -1
  131. package/dist/Selector/index.js +1 -1
  132. package/dist/{Selector-BpPnuWH3.js → Selector-5N-hq2nF.js} +3 -3
  133. package/dist/SideNav/index.d.ts +2 -2
  134. package/dist/SideNav/index.js +1 -1
  135. package/dist/{SideNav-D4TupqgE.js → SideNav-CT9lfspi.js} +225 -229
  136. package/dist/Stack/index.d.ts +1 -1
  137. package/dist/Stepper/index.d.ts +1 -1
  138. package/dist/Stepper/index.js +1 -1
  139. package/dist/{Stepper-H-6-T5Ps.js → Stepper-BqhVCgC-.js} +1 -1
  140. package/dist/Switch/index.d.ts +1 -1
  141. package/dist/TabList/index.d.ts +1 -1
  142. package/dist/Table/index.js +1 -1
  143. package/dist/{Table-nqA_njNz.js → Table-CsdH8fCB.js} +4 -4
  144. package/dist/Text/index.d.ts +3 -3
  145. package/dist/Text/index.js +1 -1
  146. package/dist/Text-DIzZw6FA.js +86 -0
  147. package/dist/TextArea/index.d.ts +1 -1
  148. package/dist/TextInput/index.d.ts +1 -1
  149. package/dist/Theme/index.d.ts +3 -3
  150. package/dist/Theme/index.js +2 -2
  151. package/dist/Theme-CtaUWo4g.js +1246 -0
  152. package/dist/Thumbnail/index.js +1 -1
  153. package/dist/{Thumbnail-CXb3m_Hv.js → Thumbnail-BnQwX1cQ.js} +2 -2
  154. package/dist/{TimeField-B3cndWb0.js → TimeField-Biiuv0hB.js} +1 -1
  155. package/dist/TimeInput/index.d.ts +1 -1
  156. package/dist/TimeInput/index.js +1 -1
  157. package/dist/{TimeInput-BHQ_LKGm.js → TimeInput-C9gptCOK.js} +1 -1
  158. package/dist/Timer/index.d.ts +1 -1
  159. package/dist/Timer/index.js +1 -1
  160. package/dist/{Timer-B7GV6hqd.js → Timer-kxzQx3tp.js} +1 -1
  161. package/dist/Timestamp/index.d.ts +1 -1
  162. package/dist/Timestamp/index.js +1 -1
  163. package/dist/{Timestamp-Cfuxbb3i.js → Timestamp-D7bd_nF3.js} +2 -2
  164. package/dist/ToggleButton/index.d.ts +1 -1
  165. package/dist/Token/index.d.ts +1 -1
  166. package/dist/Token/index.js +1 -1
  167. package/dist/{Token-CdVLH0_H.js → Token-D2GsI_Ei.js} +1 -1
  168. package/dist/Tokenizer/index.js +1 -1
  169. package/dist/{Tokenizer-DlD-S_8-.js → Tokenizer-rwzamZg4.js} +3 -3
  170. package/dist/Toolbar/index.d.ts +1 -1
  171. package/dist/Tooltip/index.d.ts +1 -1
  172. package/dist/Tooltip/index.js +1 -1
  173. package/dist/{Tooltip-mp0NMh_Y.js → Tooltip-C2fh9anJ.js} +23 -8
  174. package/dist/TopNav/index.d.ts +1 -1
  175. package/dist/TopNav/index.js +1 -1
  176. package/dist/{TopNav-DzV874G7.js → TopNav-arWFLTBM.js} +112 -42
  177. package/dist/TreeList/index.js +1 -1
  178. package/dist/{TreeList-DEwvlZRV.js → TreeList-C9xvMpJZ.js} +1 -1
  179. package/dist/Typeahead/index.d.ts +2 -2
  180. package/dist/Typeahead/index.js +3 -2
  181. package/dist/Typeahead-_V11btpv.js +499 -0
  182. package/dist/{TypeaheadMenu-CGvo0Tud.js → TypeaheadMenu-BEObzonz.js} +46 -10
  183. package/dist/composables/index.d.ts +2 -2
  184. package/dist/composables/index.js +4 -4
  185. package/dist/composables-CWw6t-RJ.js +520 -0
  186. package/dist/{context-DmOLCubj.js → context-CPh7kE-a.js} +58 -10
  187. package/dist/{index-BRfR0lhb.d.ts → index-12QYAbiz.d.ts} +1 -1
  188. package/dist/{index-DMQG6kdM.d.ts → index-6yB8BtEu.d.ts} +2 -2
  189. package/dist/{index-f4NGT-e2.d.ts → index-B4OOtNP8.d.ts} +3 -3
  190. package/dist/index-BBtJt5_A.d.ts +26 -0
  191. package/dist/{index-Ch6BbxCP.d.ts → index-BH9PzQ1F.d.ts} +13 -8
  192. package/dist/{index-MPcg1Pm4.d.ts → index-BKr7yvVv.d.ts} +1 -1
  193. package/dist/{index-D_UEJIU5.d.ts → index-BPwD6aBv.d.ts} +1 -1
  194. package/dist/{index-D1Twv_fL.d.ts → index-BcZI402h.d.ts} +4 -4
  195. package/dist/{index-C8wDPDcP.d.ts → index-Bi49IrAJ.d.ts} +50 -8
  196. package/dist/{index-B1x05arQ.d.ts → index-BlOIC_AM.d.ts} +1 -1
  197. package/dist/{index-C5p2NeCr.d.ts → index-Blm197N_.d.ts} +11 -2
  198. package/dist/{index-Bu3oXIIS.d.ts → index-BmmdzwT9.d.ts} +6 -0
  199. package/dist/{index-BMn9ghAX.d.ts → index-Bu0Zd1uw.d.ts} +3 -3
  200. package/dist/{index-Ctu32CLv.d.ts → index-BxhJqiZ7.d.ts} +2 -2
  201. package/dist/{index-CA6RbRWx.d.ts → index-By2mSzUA.d.ts} +1 -1
  202. package/dist/{index-HV6W3xCx.d.ts → index-Byar3h1e.d.ts} +1 -1
  203. package/dist/{index-LIyvJTW3.d.ts → index-C3GaPqvJ.d.ts} +84 -8
  204. package/dist/{index-DAiGhkNZ.d.ts → index-CFIXnk5D.d.ts} +1 -1
  205. package/dist/{index-ViSV0RBx.d.ts → index-CI9kyg74.d.ts} +12 -2
  206. package/dist/{index-C-QpeUlQ.d.ts → index-CNjbOgty.d.ts} +2 -2
  207. package/dist/{index-BB5yVIN-.d.ts → index-CUCcYKxl.d.ts} +3 -3
  208. package/dist/{index-Ca8VIE4l.d.ts → index-CVn0GBdB.d.ts} +1 -1
  209. package/dist/{index-xfkEuGLY.d.ts → index-CZeoAr0a.d.ts} +2 -2
  210. package/dist/{index-C2sfHfBw.d.ts → index-D-ezcKaY.d.ts} +3 -3
  211. package/dist/{index-BcJBLWJ0.d.ts → index-DA52oIdw.d.ts} +2 -2
  212. package/dist/{index-D7-WTV6I.d.ts → index-D_nYxnNv.d.ts} +1 -1
  213. package/dist/{index-Cm_TiLXU.d.ts → index-Dgg0bHVM.d.ts} +7 -3
  214. package/dist/index-DxR1FChm.d.ts +158 -0
  215. package/dist/{index-BTAgQRP0.d.ts → index-EtZgovdH.d.ts} +169 -81
  216. package/dist/{index-B9f1rUEv.d.ts → index-XuAAcYiP.d.ts} +1 -1
  217. package/dist/{index-D0TlUOtG.d.ts → index-YmSe1ujk.d.ts} +76 -3
  218. package/dist/{index-BMrggCw-.d.ts → index-bvr3WHvs.d.ts} +1 -1
  219. package/dist/{index-CDDMDHJM.d.ts → index-c67ca7eJ.d.ts} +1 -1
  220. package/dist/{index-D8o50qOE.d.ts → index-cL3q7O4R.d.ts} +32 -3
  221. package/dist/{index-CGZ2xi3r.d.ts → index-eshFLli0.d.ts} +40 -3
  222. package/dist/{index-DkVEBdWa.d.ts → index-fa72tWIU.d.ts} +2 -2
  223. package/dist/{index-COxy6LEW.d.ts → index-gW0HW02U.d.ts} +1 -1
  224. package/dist/{index-foQMNKZO.d.ts → index-hCpxKePE.d.ts} +49 -3
  225. package/dist/{index-DxsKyAxq.d.ts → index-vizlhXVs.d.ts} +131 -2
  226. package/dist/{index-DfgHJE7H.d.ts → index-z3uLM1O6.d.ts} +153 -24
  227. package/dist/index.d.ts +81 -80
  228. package/dist/index.js +118 -115
  229. package/dist/locale/index.d.ts +2 -2
  230. package/dist/locale/index.js +3 -3
  231. package/dist/locale-sLw5Caia.js +917 -0
  232. package/dist/{searchResultMessage-DN0HeRRB.js → searchResultMessage-CCnq-_ce.js} +1 -1
  233. package/dist/syntaxTheme-CwVEcVDk.d.ts +57 -0
  234. package/dist/{syntaxTheme-ClpWALZX.js → syntaxTheme-R7xnu5x5.js} +24 -3
  235. package/dist/{types-Bt-lSgYX.d.ts → types-D9nP_X-c.d.ts} +14 -1
  236. package/dist/{types-CAZY4Xua.d.ts → types-DGYHIu4I.d.ts} +30 -1
  237. package/dist/types-D_J66aPN.d.ts +85 -0
  238. package/dist/types-gKsEkk2g.d.ts +320 -0
  239. package/dist/{useMenuDrillIn-OaEwjK44.js → useMenuDrillIn-BgjJcY3K.js} +1 -1
  240. package/dist/useMenuPress-DUmEy4TB.js +425 -0
  241. package/dist/{composables-DDI08XFF.js → useResizable-B3ahKLoZ.js} +73 -248
  242. package/dist/useTruncation-B5qXQzAP.js +53 -0
  243. package/locales/SOURCE.json +37 -0
  244. package/locales/af-ZA.json +1482 -0
  245. package/locales/ar-SA.json +1482 -0
  246. package/locales/ca-ES.json +1482 -0
  247. package/locales/cs-CZ.json +1482 -0
  248. package/locales/da-DK.json +1482 -0
  249. package/locales/de-DE.json +1482 -0
  250. package/locales/el-GR.json +1482 -0
  251. package/locales/en.json +1646 -0
  252. package/locales/es-ES.json +1482 -0
  253. package/locales/fi-FI.json +1482 -0
  254. package/locales/fr-FR.json +1482 -0
  255. package/locales/he-IL.json +1482 -0
  256. package/locales/hu-HU.json +1482 -0
  257. package/locales/it-IT.json +1482 -0
  258. package/locales/ja-JP.json +1482 -0
  259. package/locales/ko-KR.json +1482 -0
  260. package/locales/nl-NL.json +1482 -0
  261. package/locales/no-NO.json +1482 -0
  262. package/locales/pl-PL.json +1482 -0
  263. package/locales/pt-BR.json +1482 -0
  264. package/locales/pt-PT.json +1482 -0
  265. package/locales/ro-RO.json +1482 -0
  266. package/locales/ru-RU.json +1482 -0
  267. package/locales/sr-SP.json +1482 -0
  268. package/locales/sv-SE.json +1482 -0
  269. package/locales/tr-TR.json +1482 -0
  270. package/locales/uk-UA.json +1482 -0
  271. package/locales/vi-VN.json +1482 -0
  272. package/locales/zh-CN.json +1482 -0
  273. package/locales/zh-TW.json +1482 -0
  274. package/package.json +3 -1
  275. package/styles/bottom-sheet.css +27 -0
  276. package/styles/code.css +62 -0
  277. package/styles/container-reveal.css +104 -0
  278. package/styles/heading.css +47 -0
  279. package/styles/keyboard-hint.css +28 -0
  280. package/styles/link.css +34 -0
  281. package/styles/list.css +88 -1
  282. package/styles/markdown.css +12 -0
  283. package/styles/pagination.css +30 -0
  284. package/styles/progress-bar.css +49 -0
  285. package/styles/side-nav.css +36 -1
  286. package/styles/text.css +18 -0
  287. package/styles/top-nav.css +145 -6
  288. package/styles/typeahead.css +24 -0
  289. package/styles.css +2 -0
  290. package/dist/Heading-Dugosn6j.js +0 -43
  291. package/dist/Item-C1z6gXn8.js +0 -289
  292. package/dist/Link-DqdQZ37C.js +0 -141
  293. package/dist/Text-BHVghsWo.js +0 -53
  294. package/dist/Theme-CejS9MHm.js +0 -447
  295. package/dist/Typeahead-DQ3tmqYe.js +0 -375
  296. package/dist/index-Bqb_Fyju.d.ts +0 -80
  297. package/dist/index-Dg3ZmwEg.d.ts +0 -75
  298. package/dist/locale-CCwVnyMZ.js +0 -42
  299. package/dist/syntaxTheme-Bcs1YMF7.d.ts +0 -38
  300. package/dist/types-jmqqnkKA.d.ts +0 -163
  301. package/dist/useHotkeys-dABSK1o9.js +0 -80
  302. package/dist/useLongPress-Cyxwa73s.js +0 -60
  303. package/dist/{index-BXkNZF3q.d.ts → index-IdK2g5B4.d.ts} +2 -2
@@ -0,0 +1,425 @@
1
+ import { onBeforeUnmount, toValue } from "vue";
2
+ //#region src/composables/useLongPress.ts
3
+ const DEFAULT_DELAY_MS = 500;
4
+ const DEFAULT_MOVE_CANCEL_PX = 10;
5
+ /**
6
+ * 对应原版 Astryx 的 `hooks/useLongPress`。
7
+ *
8
+ * Detect a single-finger long press.
9
+ *
10
+ * iOS Safari never synthesizes a `contextmenu` event for a held finger, so a
11
+ * long press is the only touch affordance that can open a cursor-positioned
12
+ * surface. The press is cancelled when the finger travels past the tolerance,
13
+ * lifts, or the touch is cancelled.
14
+ */
15
+ function useLongPress(options) {
16
+ const delayMs = options.delayMs ?? DEFAULT_DELAY_MS;
17
+ const moveCancelPx = options.moveCancelPx ?? DEFAULT_MOVE_CANCEL_PX;
18
+ let timer = null;
19
+ let origin = null;
20
+ function cancel() {
21
+ if (timer != null) {
22
+ clearTimeout(timer);
23
+ timer = null;
24
+ }
25
+ origin = null;
26
+ }
27
+ function start(point) {
28
+ if (toValue(options.isDisabled)) return;
29
+ cancel();
30
+ origin = {
31
+ x: point.x,
32
+ y: point.y
33
+ };
34
+ timer = setTimeout(() => {
35
+ const from = origin;
36
+ timer = null;
37
+ if (from == null) return;
38
+ options.onLongPress({
39
+ x: from.x,
40
+ y: from.y
41
+ });
42
+ }, delayMs);
43
+ }
44
+ function moveTo(point) {
45
+ if (origin == null) return false;
46
+ if (Math.abs(point.x - origin.x) > moveCancelPx || Math.abs(point.y - origin.y) > moveCancelPx) {
47
+ cancel();
48
+ return false;
49
+ }
50
+ return true;
51
+ }
52
+ onBeforeUnmount(cancel);
53
+ return {
54
+ cancel,
55
+ moveTo,
56
+ start
57
+ };
58
+ }
59
+ //#endregion
60
+ //#region src/ContextMenu/menuNav.ts
61
+ /**
62
+ * Roles a menu row can carry. The selectable roles sit alongside the plain
63
+ * one so every row is reachable by arrow keys, typeahead, and Enter/Space.
64
+ */
65
+ const MENU_ITEM_ROLES = /* @__PURE__ */ new Set([
66
+ "menuitem",
67
+ "menuitemradio",
68
+ "menuitemcheckbox"
69
+ ]);
70
+ /** Selector for the activatable rows of one menu level. */
71
+ const MENU_ITEM_SELECTOR = [...MENU_ITEM_ROLES].map((role) => `[role="${role}"]:not([aria-disabled="true"])`).join(",");
72
+ /** Selector for any menu level, used to scope a level's rows and key events. */
73
+ const MENU_BOUNDARY_SELECTOR = "[role=\"menu\"]";
74
+ /**
75
+ * Whether a click carries a modifier or a non-primary button. On a row that is
76
+ * a link the browser gives such a click a meaning of its own, which the row
77
+ * must leave alone.
78
+ */
79
+ function isModifiedClick(event) {
80
+ return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || (event.button ?? 0) !== 0;
81
+ }
82
+ /**
83
+ * Activate a row from the keyboard: a synthesized click that carries the key's
84
+ * modifiers, so a modified Enter on a link row opens the way a modified click
85
+ * would. `detail` stays 0, the mark of a non-pointer activation.
86
+ */
87
+ function activateMenuItem(row, key) {
88
+ row.dispatchEvent(new MouseEvent("click", {
89
+ altKey: key.altKey,
90
+ bubbles: true,
91
+ cancelable: true,
92
+ composed: true,
93
+ ctrlKey: key.ctrlKey,
94
+ metaKey: key.metaKey,
95
+ shiftKey: key.shiftKey
96
+ }));
97
+ }
98
+ function isDisabledRow(row) {
99
+ return row.getAttribute("aria-disabled") === "true" || row.hasAttribute("disabled");
100
+ }
101
+ function isHiddenWithin(row, container) {
102
+ let current = row;
103
+ while (current != null && current !== container) {
104
+ if (current.hidden || current.getAttribute("aria-hidden") === "true") return true;
105
+ current = current.parentElement;
106
+ }
107
+ return false;
108
+ }
109
+ const TYPEAHEAD_RESET_MS = 750;
110
+ /**
111
+ * Roving focus, typeahead, and activation for one menu level.
112
+ *
113
+ * Both the menu panel and every submenu flyout own one of these, so a nested
114
+ * level keeps its own highlight, its own typeahead buffer, and its own keys
115
+ * without coordinating with its parent.
116
+ */
117
+ function useMenuNav(options) {
118
+ const { menuRef, onClose } = options;
119
+ let typeaheadBuffer = "";
120
+ let typeaheadTimer;
121
+ function resetTypeahead() {
122
+ typeaheadBuffer = "";
123
+ if (typeaheadTimer != null) {
124
+ clearTimeout(typeaheadTimer);
125
+ typeaheadTimer = void 0;
126
+ }
127
+ }
128
+ function getItems() {
129
+ const menu = menuRef.value;
130
+ if (menu == null) return [];
131
+ return Array.from(menu.querySelectorAll(MENU_ITEM_SELECTOR)).filter((row) => !isHiddenWithin(row, menu)).filter((row) => row.closest(MENU_BOUNDARY_SELECTOR) === menu);
132
+ }
133
+ function ownsEvent(event) {
134
+ const menu = menuRef.value;
135
+ const target = event.target;
136
+ if (menu == null || !(target instanceof Element)) return true;
137
+ return target.closest(MENU_BOUNDARY_SELECTOR) === menu;
138
+ }
139
+ function getCurrentIndex(items) {
140
+ const active = menuRef.value?.ownerDocument.activeElement ?? null;
141
+ return items.findIndex((row) => row === active || row.contains(active));
142
+ }
143
+ function findEnabledIndex(items, start, step, wrap) {
144
+ const count = items.length;
145
+ if (count === 0) return -1;
146
+ let index = start;
147
+ for (let i = 0; i < count; i++) {
148
+ if (index < 0 || index >= count) {
149
+ if (!wrap) return -1;
150
+ index = (index + count) % count;
151
+ }
152
+ const row = items[index];
153
+ if (row != null && !isDisabledRow(row)) return index;
154
+ index += step;
155
+ }
156
+ return -1;
157
+ }
158
+ function focusIndex(items, index) {
159
+ const row = items[index];
160
+ if (row == null) return false;
161
+ row.focus();
162
+ return true;
163
+ }
164
+ function focusFirst() {
165
+ const items = getItems();
166
+ return focusIndex(items, findEnabledIndex(items, 0, 1, false));
167
+ }
168
+ function focusLast() {
169
+ const items = getItems();
170
+ return focusIndex(items, findEnabledIndex(items, items.length - 1, -1, false));
171
+ }
172
+ function moveBy(direction) {
173
+ const items = getItems();
174
+ if (items.length === 0) return false;
175
+ const current = getCurrentIndex(items);
176
+ return focusIndex(items, findEnabledIndex(items, current === -1 ? direction === 1 ? 0 : items.length - 1 : current + direction, direction, true));
177
+ }
178
+ /**
179
+ * PageDown / PageUp move by the rows a viewport shows, never wrapping; in a
180
+ * menu that does not scroll they act as End and Home.
181
+ */
182
+ function focusPage(direction) {
183
+ const menu = menuRef.value;
184
+ const all = getItems();
185
+ const active = all.map((row, index) => isDisabledRow(row) ? -1 : index).filter((index) => index !== -1);
186
+ if (menu == null || active.length === 0) return false;
187
+ if (menu.clientHeight === 0 || menu.scrollHeight <= menu.clientHeight) return direction === 1 ? focusLast() : focusFirst();
188
+ const rowHeight = all[active[0]]?.getBoundingClientRect().height ?? 0;
189
+ const perPage = rowHeight > 0 ? Math.max(1, Math.floor(menu.clientHeight / rowHeight)) : active.length;
190
+ const position = active.indexOf(getCurrentIndex(all));
191
+ const from = position === -1 ? direction === 1 ? -1 : active.length : position;
192
+ return focusIndex(all, active[Math.max(0, Math.min(active.length - 1, from + direction * perPage))]);
193
+ }
194
+ /**
195
+ * Typeahead over the rows' label elements. Repeated presses of the same
196
+ * character cycle through the matches instead of filtering deeper.
197
+ */
198
+ function handleTypeahead(event) {
199
+ const isSpaceMidType = event.key === " " && typeaheadBuffer.length > 0;
200
+ if (!(event.key.length === 1 && !event.ctrlKey && !event.metaKey && event.key !== " ") && !isSpaceMidType) return false;
201
+ const items = getItems();
202
+ const labels = items.map((row) => row.querySelector(`[data-menu-item-label]`)?.textContent ?? row.textContent);
203
+ if (labels.length === 0) return false;
204
+ const char = event.key.toLowerCase();
205
+ const nextBuffer = typeaheadBuffer.length > 0 && [...typeaheadBuffer].every((entry) => entry === char) ? char : typeaheadBuffer + char;
206
+ typeaheadBuffer = nextBuffer;
207
+ if (typeaheadTimer != null) clearTimeout(typeaheadTimer);
208
+ typeaheadTimer = setTimeout(resetTypeahead, TYPEAHEAD_RESET_MS);
209
+ const current = getCurrentIndex(items);
210
+ const hasCurrent = current >= 0;
211
+ const start = hasCurrent ? current : 0;
212
+ const offset = hasCurrent && nextBuffer.length === 1 ? 1 : 0;
213
+ for (let i = 0; i < labels.length; i++) {
214
+ const index = (start + offset + i + labels.length) % labels.length;
215
+ if (isDisabledRow(items[index])) continue;
216
+ const label = labels[index];
217
+ if (label != null && label.trim().toLowerCase().startsWith(nextBuffer)) {
218
+ focusIndex(items, index);
219
+ return true;
220
+ }
221
+ }
222
+ return true;
223
+ }
224
+ function handleKeyDown(event) {
225
+ if (event.defaultPrevented || event.isComposing || event.ctrlKey || event.metaKey || event.altKey) return;
226
+ if (!ownsEvent(event)) return;
227
+ if (event.key === "Enter" || event.key === " ") {
228
+ event.preventDefault();
229
+ if (event.repeat) return;
230
+ const active = menuRef.value?.ownerDocument.activeElement;
231
+ if (active instanceof HTMLElement && MENU_ITEM_ROLES.has(active.getAttribute("role") ?? "")) activateMenuItem(active, event);
232
+ return;
233
+ }
234
+ if (event.key === "Tab") {
235
+ onClose("tab");
236
+ return;
237
+ }
238
+ if (event.key === "Escape") {
239
+ event.preventDefault();
240
+ onClose("escape");
241
+ return;
242
+ }
243
+ if (handleTypeahead(event)) {
244
+ event.preventDefault();
245
+ return;
246
+ }
247
+ if (event.key === "ArrowDown" && moveBy(1)) {
248
+ event.preventDefault();
249
+ return;
250
+ }
251
+ if (event.key === "ArrowUp" && moveBy(-1)) {
252
+ event.preventDefault();
253
+ return;
254
+ }
255
+ if (event.key === "Home" && focusFirst()) {
256
+ event.preventDefault();
257
+ return;
258
+ }
259
+ if (event.key === "End" && focusLast()) {
260
+ event.preventDefault();
261
+ return;
262
+ }
263
+ if (event.key === "PageDown" && focusPage(1)) {
264
+ event.preventDefault();
265
+ return;
266
+ }
267
+ if (event.key === "PageUp" && focusPage(-1)) event.preventDefault();
268
+ }
269
+ return {
270
+ focusFirst,
271
+ handleKeyDown,
272
+ resetTypeahead
273
+ };
274
+ }
275
+ //#endregion
276
+ //#region src/ContextMenu/useMenuPress.ts
277
+ /** How long after a tracked release the browser's own click is still swallowed. */
278
+ const STRAY_CLICK_MS = 400;
279
+ let swallower = null;
280
+ function disarmStrayClick() {
281
+ if (swallower == null) return;
282
+ swallower.isArmed = false;
283
+ if (swallower.timer != null) {
284
+ clearTimeout(swallower.timer);
285
+ swallower.timer = null;
286
+ }
287
+ }
288
+ function onWindowClickCapture(event) {
289
+ if (swallower == null || !swallower.isArmed) return;
290
+ if (event.detail === 0) return;
291
+ event.preventDefault();
292
+ event.stopImmediatePropagation();
293
+ disarmStrayClick();
294
+ }
295
+ /**
296
+ * Swallow the browser's compatibility click for a gesture the press model
297
+ * already acted on. The listener sits on the window in the capture phase, so
298
+ * it runs ahead of any listener the application or the row itself installed.
299
+ */
300
+ function armStrayClick(doc) {
301
+ const view = doc.defaultView;
302
+ if (view == null) return;
303
+ if (swallower == null || swallower.doc !== doc) {
304
+ if (swallower != null) {
305
+ swallower.doc.defaultView?.removeEventListener("click", onWindowClickCapture, true);
306
+ swallower.doc.removeEventListener("pointerdown", disarmStrayClick, true);
307
+ }
308
+ view.addEventListener("click", onWindowClickCapture, true);
309
+ doc.addEventListener("pointerdown", disarmStrayClick, true);
310
+ swallower = {
311
+ doc,
312
+ isArmed: false,
313
+ timer: null
314
+ };
315
+ }
316
+ disarmStrayClick();
317
+ swallower.isArmed = true;
318
+ swallower.timer = setTimeout(disarmStrayClick, STRAY_CLICK_MS);
319
+ }
320
+ /** Forget an armed swallower. Called when a surface unmounts and in tests. */
321
+ function resetMenuPress() {
322
+ disarmStrayClick();
323
+ }
324
+ /**
325
+ * The press model of a painted menu surface.
326
+ *
327
+ * A finger's pointer events stay with the element it landed on, so the gesture
328
+ * is tracked at the document level by `pointerId`:
329
+ *
330
+ * - The highlight follows the finger.
331
+ * - The row under the RELEASE acts, the way its own click would, carrying the
332
+ * release's modifiers; the browser's own click for that gesture is swallowed
333
+ * so the row never acts twice.
334
+ * - A finger released outside leaves the menu open; a mouse released outside
335
+ * dismisses it.
336
+ * - `pointercancel` and a second pointer end the gesture with nothing acting.
337
+ */
338
+ function useMenuPress(options) {
339
+ const { menuRef, isEnabled, onDismiss } = options;
340
+ let trackedId = null;
341
+ let trackedIsMouse = false;
342
+ let highlighted = null;
343
+ let doc = null;
344
+ function isRowInsideMenu(row) {
345
+ const menu = menuRef.value;
346
+ return row instanceof HTMLElement && menu != null && menu.contains(row) && row.closest("[role=\"menu\"]") === menu;
347
+ }
348
+ function rowFromEvent(event) {
349
+ const hit = doc?.elementFromPoint?.(event.clientX, event.clientY) ?? null;
350
+ const fromPoint = hit instanceof Element ? hit.closest(MENU_ITEM_SELECTOR) : null;
351
+ if (fromPoint != null && isRowInsideMenu(fromPoint)) return fromPoint;
352
+ const target = event.target;
353
+ const fromTarget = target instanceof Element ? target.closest(MENU_ITEM_SELECTOR) : null;
354
+ return fromTarget != null && isRowInsideMenu(fromTarget) ? fromTarget : null;
355
+ }
356
+ function isEventInsideMenu(event) {
357
+ const menu = menuRef.value;
358
+ if (menu == null) return false;
359
+ const hit = doc?.elementFromPoint?.(event.clientX, event.clientY) ?? null;
360
+ if (hit instanceof Node && menu.contains(hit)) return true;
361
+ const target = event.target;
362
+ return target instanceof Node && menu.contains(target);
363
+ }
364
+ function highlight(row) {
365
+ if (row === highlighted) return;
366
+ highlighted = row;
367
+ row?.focus({ preventScroll: true });
368
+ }
369
+ function onDocumentPointerMove(event) {
370
+ if (event.pointerId !== trackedId) return;
371
+ const row = rowFromEvent(event);
372
+ if (row != null) highlight(row);
373
+ }
374
+ function onDocumentPointerUp(event) {
375
+ if (event.pointerId !== trackedId) return;
376
+ const row = rowFromEvent(event);
377
+ endGesture();
378
+ if (row == null) return;
379
+ if (doc != null) armStrayClick(doc);
380
+ activateMenuItem(row, event);
381
+ }
382
+ function onDocumentPointerCancel(event) {
383
+ if (event.pointerId !== trackedId) return;
384
+ endGesture();
385
+ }
386
+ function onDocumentMouseUp(event) {
387
+ const isInside = isEventInsideMenu(event);
388
+ endGesture();
389
+ if (!isInside) onDismiss();
390
+ }
391
+ function endGesture() {
392
+ const current = doc;
393
+ if (current != null) {
394
+ current.removeEventListener("pointermove", onDocumentPointerMove, true);
395
+ current.removeEventListener("pointerup", onDocumentPointerUp, true);
396
+ current.removeEventListener("pointercancel", onDocumentPointerCancel, true);
397
+ current.removeEventListener("mouseup", onDocumentMouseUp, true);
398
+ }
399
+ trackedId = null;
400
+ trackedIsMouse = false;
401
+ highlighted = null;
402
+ }
403
+ function onPointerDown(event) {
404
+ if (!isEnabled()) return;
405
+ if (trackedId != null) endGesture();
406
+ const target = event.target;
407
+ const row = target instanceof Element ? target.closest(MENU_ITEM_SELECTOR) : null;
408
+ if (row == null || !isRowInsideMenu(row)) return;
409
+ highlighted = row;
410
+ trackedId = event.pointerId;
411
+ trackedIsMouse = event.pointerType === "mouse";
412
+ doc = menuRef.value?.ownerDocument ?? null;
413
+ if (trackedIsMouse) {
414
+ doc?.addEventListener("mouseup", onDocumentMouseUp, true);
415
+ return;
416
+ }
417
+ doc?.addEventListener("pointermove", onDocumentPointerMove, true);
418
+ doc?.addEventListener("pointerup", onDocumentPointerUp, true);
419
+ doc?.addEventListener("pointercancel", onDocumentPointerCancel, true);
420
+ }
421
+ onBeforeUnmount(endGesture);
422
+ return { onPointerDown };
423
+ }
424
+ //#endregion
425
+ export { useLongPress as a, useMenuNav as i, useMenuPress as n, isModifiedClick as r, resetMenuPress as t };