@astryx-vue/core 0.36.0 → 0.36.1

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 (252) hide show
  1. package/dist/AlertDialog/index.js +1 -1
  2. package/dist/{AlertDialog-rndlABEe.js → AlertDialog-C4oB89RV.js} +5 -5
  3. package/dist/AppShell/index.js +1 -1
  4. package/dist/{AppShell-eVrOpRqn.js → AppShell-CU12SF6s.js} +2 -2
  5. package/dist/AvatarGroup/index.d.ts +1 -1
  6. package/dist/AvatarGroup/index.js +1 -1
  7. package/dist/{AvatarGroup-BEBUEhxF.js → AvatarGroup-DhSPWemf.js} +1 -1
  8. package/dist/Banner/index.d.ts +1 -1
  9. package/dist/Banner/index.js +1 -1
  10. package/dist/{Banner-CVBNGDsD.js → Banner-DeauKxQw.js} +1 -1
  11. package/dist/BottomSheet/index.d.ts +1 -1
  12. package/dist/BottomSheet/index.js +2 -2
  13. package/dist/BottomSheet-Chr9yCIL.js +4353 -0
  14. package/dist/{BottomSheet-B3qXtKQj.js → BottomSheet-DCLOhzZP.js} +1 -1
  15. package/dist/Breadcrumbs/index.js +2 -2
  16. package/dist/{Breadcrumbs-B-w_yw-n.js → Breadcrumbs-BfjWIfgO.js} +1 -1
  17. package/dist/Button/index.js +1 -1
  18. package/dist/{Button-DTdlisqJ.js → Button-V6i-PeBt.js} +2 -2
  19. package/dist/ButtonGroup/index.d.ts +1 -1
  20. package/dist/ButtonGroup/index.js +1 -1
  21. package/dist/{ButtonGroup-Bjzs-HAG.js → ButtonGroup-CEDeeGkY.js} +2 -2
  22. package/dist/Calendar/index.d.ts +1 -1
  23. package/dist/Carousel/index.d.ts +1 -1
  24. package/dist/Carousel/index.js +1 -1
  25. package/dist/{Carousel-DjySyeDR.js → Carousel-5NYWpta1.js} +1 -1
  26. package/dist/Center/index.d.ts +1 -1
  27. package/dist/Chat/index.d.ts +1 -1
  28. package/dist/Chat/index.js +1 -1
  29. package/dist/{Chat-DQ6BGAvP.js → Chat-f9HzZe5y.js} +2 -2
  30. package/dist/CheckboxInput/index.d.ts +1 -1
  31. package/dist/CheckboxInput/index.js +1 -1
  32. package/dist/{CheckboxInput-DSW8yq92.js → CheckboxInput-ixAs3zkT.js} +4 -4
  33. package/dist/CheckboxList/index.d.ts +1 -1
  34. package/dist/CheckboxList/index.js +1 -1
  35. package/dist/{CheckboxListItem-B2E2O1AE.js → CheckboxListItem-DoWYdLf-.js} +4 -4
  36. package/dist/ClickableCard/index.d.ts +1 -1
  37. package/dist/ClickableCard/index.js +1 -1
  38. package/dist/{ClickableCard-D4EGX9Dh.js → ClickableCard-DuOcbNlt.js} +1 -1
  39. package/dist/Code/index.js +2 -2
  40. package/dist/{Code-BqqB2kUM.js → Code-qHt8uZqb.js} +1 -1
  41. package/dist/{CodeBlock-D7ZJQV5Q.js → CodeBlock-2zigEFFD.js} +1 -1
  42. package/dist/Collapsible/index.js +1 -1
  43. package/dist/{Collapsible-C5xSG7oP.js → Collapsible-Dxp-BWv-.js} +1 -1
  44. package/dist/CommandPalette/index.js +1 -1
  45. package/dist/{CommandPalette-BUNdrxrB.js → CommandPalette-PyPfsPLY.js} +2 -2
  46. package/dist/ComplexSelector/index.js +1 -1
  47. package/dist/{ComplexSelector-m9wi7E0j.js → ComplexSelector-B07QdP_p.js} +2 -2
  48. package/dist/ContextMenu/index.d.ts +1 -1
  49. package/dist/ContextMenu/index.js +2 -2
  50. package/dist/{ContextMenu-BEHfVIAq.js → ContextMenu-B6NH9NBS.js} +3 -3
  51. package/dist/DateInput/index.d.ts +1 -1
  52. package/dist/DateInput/index.js +1 -1
  53. package/dist/{DateInput-CHeetz7k.js → DateInput-TrPijW9a.js} +4 -4
  54. package/dist/DateRangeInput/index.d.ts +1 -1
  55. package/dist/DateRangeInput/index.js +1 -1
  56. package/dist/{DateRangeInput-D524C1wc.js → DateRangeInput-bKPzsoHA.js} +3 -3
  57. package/dist/DateTimeInput/index.d.ts +1 -1
  58. package/dist/DateTimeInput/index.js +1 -1
  59. package/dist/{DateTimeInput-sEJ-bSXg.js → DateTimeInput-5jZPqFu2.js} +5 -5
  60. package/dist/Dialog/index.js +3 -3
  61. package/dist/{Dialog-nyLGClca.js → Dialog-CDAicnpK.js} +1 -1
  62. package/dist/{Dialog-DS3xE1B7.js → Dialog-dm_qZ9NI.js} +1 -1
  63. package/dist/{DialogHeader-u_AaZpyZ.js → DialogHeader-CQfcOIfF.js} +2 -2
  64. package/dist/Drawer/index.d.ts +1 -1
  65. package/dist/Drawer/index.js +1 -1
  66. package/dist/{Drawer-DqUdaZFh.js → Drawer-DKSqpR2p.js} +2 -2
  67. package/dist/DropdownMenu/index.js +2 -2
  68. package/dist/{DropdownMenu-DlAON5Jf.js → DropdownMenu-C-SLsVSO.js} +6 -6
  69. package/dist/Field/index.js +3 -3
  70. package/dist/{Field-YNS4XxpR.js → Field-CZndbiqR.js} +1 -1
  71. package/dist/{FieldInfoTip-DFlIBJlR.js → FieldInfoTip-Ii7lSYS8.js} +1 -1
  72. package/dist/{FieldLabel-i0gos7hU.js → FieldLabel-ru3qavED.js} +1 -1
  73. package/dist/FileInput/index.js +1 -1
  74. package/dist/{FileInput-DYVzAtvz.js → FileInput-BtVTN7LN.js} +3 -3
  75. package/dist/IconButton/index.js +1 -1
  76. package/dist/{IconButton-DXt8DtsN.js → IconButton-4BXILpv-.js} +1 -1
  77. package/dist/InfoTip/index.d.ts +1 -1
  78. package/dist/InfoTip/index.js +1 -1
  79. package/dist/{InfoTip--fZOD0ux.js → InfoTip-D2MzKXZH.js} +1 -1
  80. package/dist/{InputClearButton-LF0iVTVF.js → InputClearButton-Cm5Q3KK2.js} +1 -1
  81. package/dist/InputGroup/index.d.ts +1 -1
  82. package/dist/InputGroup/index.js +1 -1
  83. package/dist/{InputGroup-D4CPVzo0.js → InputGroup-CjB_XpEy.js} +1 -1
  84. package/dist/{Item-BKISM91o.js → Item-CKYsTbM4.js} +1 -1
  85. package/dist/Layout/index.js +2 -2
  86. package/dist/{Layout-BwSvAsLi.js → Layout-CpFgVnlQ.js} +1 -1
  87. package/dist/{LayoutPanel-CmzJQpnL.js → LayoutPanel-Dhm0Hubb.js} +1 -1
  88. package/dist/Lightbox/index.js +1 -1
  89. package/dist/{Lightbox-B32Yh8Uy.js → Lightbox-BSzyDGkK.js} +1 -1
  90. package/dist/Link/index.d.ts +1 -1
  91. package/dist/Link/index.js +1 -1
  92. package/dist/{Link-DSXyw9MW.js → Link-BnM830Xa.js} +1 -1
  93. package/dist/List/index.d.ts +1 -1
  94. package/dist/List/index.js +2 -2
  95. package/dist/{ListItem-D3iEhvU2.js → ListItem-B1ztelEC.js} +2 -2
  96. package/dist/Markdown/index.d.ts +1 -1
  97. package/dist/Markdown/index.js +1 -1
  98. package/dist/{Markdown-BY5Bju8w.js → Markdown-JjZLAFq2.js} +2 -2
  99. package/dist/MobileNav/index.js +1 -1
  100. package/dist/{MobileNavToggle-sC6GPVKQ.js → MobileNavToggle-C1_IinAo.js} +1 -1
  101. package/dist/MoreMenu/index.d.ts +1 -1
  102. package/dist/MoreMenu/index.js +1 -1
  103. package/dist/{MoreMenu-CcavOuxV.js → MoreMenu-DbYO8V7N.js} +4 -4
  104. package/dist/MultiSelector/index.d.ts +1 -1
  105. package/dist/MultiSelector/index.js +1 -1
  106. package/dist/{MultiSelector-Diu5zHbP.js → MultiSelector-CthCkW-w.js} +4 -4
  107. package/dist/NavItem/index.d.ts +1 -1
  108. package/dist/NavItem/index.js +1 -1
  109. package/dist/{NavItem-DlW8noR6.js → NavItem-DTO-BEfc.js} +1 -1
  110. package/dist/NavMenu/index.js +2 -2
  111. package/dist/{NavMenu-J2kmtb1B.js → NavMenu-g8ZVhLMG.js} +1 -1
  112. package/dist/{NavMenuItem-DItNRTDZ.js → NavMenuItem-DJg9jfHm.js} +2 -2
  113. package/dist/NumberInput/index.d.ts +1 -1
  114. package/dist/NumberInput/index.js +1 -1
  115. package/dist/{NumberInput-vhm5TQon.js → NumberInput-BM52uE72.js} +3 -3
  116. package/dist/Outline/index.js +1 -1
  117. package/dist/{Outline-CVIDd0fN.js → Outline-D4DJTfKp.js} +1 -1
  118. package/dist/OverflowList/index.d.ts +1 -1
  119. package/dist/OverflowList/index.js +1 -1
  120. package/dist/{OverflowList-DjWWBOkx.js → OverflowList-nW6GCEsY.js} +1 -1
  121. package/dist/Overlay/index.d.ts +1 -1
  122. package/dist/Pagination/index.d.ts +1 -1
  123. package/dist/Pagination/index.js +1 -1
  124. package/dist/{Pagination-DKsePQjC.js → Pagination-DFZivDZZ.js} +2 -2
  125. package/dist/{PanGestureRecognizer-C7hNunjF.js → PanGestureRecognizer-C-gk9mOy.js} +1 -1
  126. package/dist/{PickerWheel-Bf7xe6g6.js → PickerWheel-sIOSfcfO.js} +5 -5
  127. package/dist/Popover/index.d.ts +1 -1
  128. package/dist/Popover/index.js +1 -1
  129. package/dist/{Popover-CKgepPJ6.js → Popover-IvZGq1LC.js} +3 -3
  130. package/dist/PowerSearch/index.d.ts +1 -1
  131. package/dist/PowerSearch/index.js +1 -1
  132. package/dist/{PowerSearch-mYkORxjD.js → PowerSearch-CQdyB8_N.js} +19 -19
  133. package/dist/{PressTracker-DL75qEq_.js → PressTracker-CPRIrG4f.js} +2 -2
  134. package/dist/ProgressBar/index.d.ts +1 -1
  135. package/dist/Radio/index.d.ts +1 -1
  136. package/dist/Radio/index.js +1 -1
  137. package/dist/{RadioGroup-C-S-SnbH.js → RadioGroup-OLFNjvKt.js} +4 -4
  138. package/dist/RadioList/index.d.ts +1 -1
  139. package/dist/RadioList/index.js +1 -1
  140. package/dist/{RadioListItem-DzKVK4DZ.js → RadioListItem-BAEF0vc8.js} +1 -1
  141. package/dist/Resizable/index.js +1 -1
  142. package/dist/{ResizeHandle-CaZEB4Py.js → ResizeHandle-Bd4TdK7E.js} +1 -1
  143. package/dist/ScrollableArea/index.d.ts +1 -1
  144. package/dist/SegmentedControl/index.js +1 -1
  145. package/dist/{SegmentedControl-Bp7dpEjn.js → SegmentedControl-C0xXOVTv.js} +8 -8
  146. package/dist/SelectableCard/index.d.ts +1 -1
  147. package/dist/SelectableCard/index.js +1 -1
  148. package/dist/{SelectableCard-DPWaUCGZ.js → SelectableCard-B2QbpWiT.js} +1 -1
  149. package/dist/Selector/index.d.ts +1 -1
  150. package/dist/Selector/index.js +1 -1
  151. package/dist/{Selector-CJmeuWhN.js → Selector-icOfE3ja.js} +2 -2
  152. package/dist/SideNav/index.d.ts +1 -1
  153. package/dist/SideNav/index.js +1 -1
  154. package/dist/{SideNav-D-AQqNPx.js → SideNav-ZZ5zCQz0.js} +4 -4
  155. package/dist/Slider/index.js +1 -1
  156. package/dist/{Slider-DU-Yl3fd.js → Slider-Bd5fxqRa.js} +7 -7
  157. package/dist/Stack/index.d.ts +1 -1
  158. package/dist/Stepper/index.d.ts +1 -1
  159. package/dist/Stepper/index.js +1 -1
  160. package/dist/{Stepper-67SsxUne.js → Stepper-3oMdVe0c.js} +1 -1
  161. package/dist/Switch/index.d.ts +1 -1
  162. package/dist/Switch/index.js +1 -1
  163. package/dist/{Switch-C6qaebkX.js → Switch-COKmqJQU.js} +8 -8
  164. package/dist/TabList/index.d.ts +1 -1
  165. package/dist/TabList/index.js +1 -1
  166. package/dist/{TabList-TbJ6y1gN.js → TabList-C-HBxmkc.js} +2 -2
  167. package/dist/Table/index.d.ts +1 -1
  168. package/dist/Table/index.js +1 -1
  169. package/dist/{Table-DG_GVUF4.js → Table-aMqVf_iH.js} +9 -9
  170. package/dist/TextArea/index.d.ts +1 -1
  171. package/dist/TextArea/index.js +1 -1
  172. package/dist/{TextArea-D6EtmxTk.js → TextArea-YJtL9Fi6.js} +4 -4
  173. package/dist/TextInput/index.d.ts +1 -1
  174. package/dist/TextInput/index.js +1 -1
  175. package/dist/{TextInput-AngvgtdT.js → TextInput-CuPxOApN.js} +4 -4
  176. package/dist/Thumbnail/index.js +1 -1
  177. package/dist/{Thumbnail-DExkxw8a.js → Thumbnail-oqrKH-co.js} +2 -2
  178. package/dist/{TimeField-D5M2UxST.js → TimeField-DNxPI2cM.js} +3 -3
  179. package/dist/TimeInput/index.d.ts +1 -1
  180. package/dist/TimeInput/index.js +1 -1
  181. package/dist/{TimeInput-CvjvLrIh.js → TimeInput-PJdyNX0T.js} +2 -2
  182. package/dist/Timer/index.d.ts +1 -1
  183. package/dist/Timestamp/index.d.ts +1 -1
  184. package/dist/Timestamp/index.js +1 -1
  185. package/dist/{Timestamp-CeSb1A8c.js → Timestamp-CfzqAAX2.js} +1 -1
  186. package/dist/Toast/index.js +1 -1
  187. package/dist/{Toast-B2Fq-JYA.js → Toast-W6aKxXlF.js} +3 -3
  188. package/dist/ToggleButton/index.d.ts +1 -1
  189. package/dist/ToggleButton/index.js +1 -1
  190. package/dist/{ToggleButton-Bn8yLHbh.js → ToggleButton-Ditxp2jT.js} +3 -3
  191. package/dist/Token/index.js +1 -1
  192. package/dist/{Token-Dpxh42Mw.js → Token-Dk6MPUkH.js} +1 -1
  193. package/dist/Tokenizer/index.js +1 -1
  194. package/dist/{Tokenizer-B3EnI98V.js → Tokenizer-CdyoUaoZ.js} +7 -7
  195. package/dist/Toolbar/index.d.ts +1 -1
  196. package/dist/TopNav/index.d.ts +1 -1
  197. package/dist/TopNav/index.js +1 -1
  198. package/dist/{TopNav-D7mzM7pu.js → TopNav-CxAm5bN5.js} +3 -3
  199. package/dist/TreeList/index.d.ts +1 -1
  200. package/dist/TreeList/index.js +1 -1
  201. package/dist/{TreeList-BmeXFFqr.js → TreeList-Dnx-uco3.js} +1 -1
  202. package/dist/Typeahead/index.js +1 -1
  203. package/dist/{Typeahead-kLp9UG-Q.js → Typeahead-Cx086Mmv.js} +3 -3
  204. package/dist/{accessibleName-Zr1_WoBg.js → accessibleName-CN1vKvS_.js} +1 -1
  205. package/dist/{boxHold-Bh1fTcXx.js → boxHold-D1G2s1tG.js} +4 -4
  206. package/dist/{browserClickWait-CiUtuWNK.js → browserClickWait-Cb550_M2.js} +2 -2
  207. package/dist/{clickGuard-Bd-jBj_G.js → clickGuard-BkegH2NW.js} +1 -1
  208. package/dist/composables/index.js +6 -6
  209. package/dist/{composables-Bb1xEruY.js → composables-CpG7bhuQ.js} +3 -3
  210. package/dist/{geometry-0e0f5Mjv.js → geometry-BRW7FETc.js} +6 -195
  211. package/dist/{haptics-DIfaJavG.js → haptics-BEgivjBd.js} +2 -2
  212. package/dist/{holdEntranceInput-DWqsAYll.js → holdEntranceInput-CROBPhuO.js} +1 -1
  213. package/dist/{index-DXKtwGqX.d.ts → index-B27k2e77.d.ts} +39 -39
  214. package/dist/{index-ZbNwGVkS.d.ts → index-BKnyTWPM.d.ts} +1 -1
  215. package/dist/{index-maTGrWjF.d.ts → index-BenG-F5d.d.ts} +1 -1
  216. package/dist/{index-ZKBj_1nu.d.ts → index-BfFpUr1B.d.ts} +1 -1
  217. package/dist/{index-BB9acgK8.d.ts → index-BgT6mH3U.d.ts} +1 -1
  218. package/dist/{index-DlFmIGsl.d.ts → index-BufuCsTx.d.ts} +4 -4
  219. package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
  220. package/dist/{index-mK1ICsVg.d.ts → index-C3JmGujU.d.ts} +1 -1
  221. package/dist/{index-CKnr0JlT.d.ts → index-C4S65SAW.d.ts} +1 -1
  222. package/dist/{index-COgrQZIL.d.ts → index-CdvmnNMH.d.ts} +1 -1
  223. package/dist/{index-CEdv6aN_.d.ts → index-CilCxEvD.d.ts} +2 -2
  224. package/dist/{index-DVX2jlTQ.d.ts → index-JE1HrzdJ.d.ts} +2 -2
  225. package/dist/{index-BA8exXNP.d.ts → index-X4S7_dmq.d.ts} +1 -1
  226. package/dist/{index-0RIgvtdm.d.ts → index-ZXrvTM3A.d.ts} +2 -2
  227. package/dist/{index-BKYQ4e7M.d.ts → index-rr6Rns7h.d.ts} +3 -3
  228. package/dist/{index-Ak1b0V24.d.ts → index-tdOyqA_U.d.ts} +1 -1
  229. package/dist/{index-BCAgC3fu.d.ts → index-x7g2WHHx.d.ts} +4 -4
  230. package/dist/index.d.ts +17 -17
  231. package/dist/index.js +85 -85
  232. package/dist/inputAge-C-SoLwpD.js +42 -0
  233. package/dist/{inputHold-CvjeOOWT.js → inputHold-B53XZ8if.js} +2 -2
  234. package/dist/{inputHoldState-Cg1r8Ib7.js → inputHoldState-Bav14W7v.js} +1 -1
  235. package/dist/{inputStream-DkMWPYac.js → inputStream-DmPkJ1aU.js} +24 -1
  236. package/dist/{lazyBottomSheet-DlHcPsAT.js → lazyBottomSheet-DlrpPOl8.js} +1 -1
  237. package/dist/{resizableChannel-CaaqGvXj.js → resizableChannel-DpbFJbto.js} +1 -1
  238. package/dist/{scrollView-DcPpdCrj.js → scrollView-BGBtu5JP.js} +2 -42
  239. package/dist/selectionRanges-DB5jesLz.js +194 -0
  240. package/dist/{springs-DjAn_oV5.js → springs-CPk0tpwL.js} +1 -1
  241. package/dist/{useActionGroupTracking-DjIdPbfL.js → useActionGroupTracking-C-nLjHyn.js} +3 -2
  242. package/dist/{useChatStreamScroll-DEp17Yq9.js → useChatStreamScroll-DWhnCSP1.js} +1 -1
  243. package/dist/{useGestureRecognizer-DDd-6Km-.js → useGestureRecognizer-Di-YKr93.js} +1 -1
  244. package/dist/{useInputStatusIcon-m6l4qBmA.js → useInputStatusIcon-CXP2kRSe.js} +1 -1
  245. package/dist/{useMenuEntranceHold-C4LOzKIS.js → useMenuEntranceHold-DMHMzaRW.js} +1 -1
  246. package/dist/{useMenuPress-BDPqPten.js → useMenuPress-zOinmIFS.js} +3 -3
  247. package/dist/{usePressFeedback-D2mWzgoJ.js → usePressFeedback-CF4ISMfb.js} +3 -2
  248. package/dist/{useResizable-Bwv-j_9N.js → useResizable-7-uUaJ7x.js} +2 -2
  249. package/dist/{useTouchHitArea-DL9D10Rq.js → useTouchHitArea-CkHMLZ34.js} +1 -1
  250. package/package.json +1 -1
  251. package/styles/bottom-sheet.css +16 -0
  252. package/dist/BottomSheet-C6vet4pm.js +0 -1896
@@ -1,1896 +0,0 @@
1
- import { c as isHTMLElement, l as isNode, n as deepActiveElement, t as containsAlongFlatTree } from "./flatTree-BB4yPMNL.js";
2
- import { u as scroll } from "./gestures-yKyyMqeQ.js";
3
- import { r as resetLayerScopedContext } from "./scopedProvide-C-Df7c15.js";
4
- import { r as provideNestedLayerMountTarget } from "./mount-7R_s-bHB.js";
5
- import { i as isTopLayer, n as useLayerDepth, o as pushLayer, t as provideLayerDepth } from "./layerDepth-DRfWATFr.js";
6
- import { t as isImeKeyEvent } from "./ime-VY8-80S8.js";
7
- import { t as useMediaQuery } from "./useMediaQuery-BzXGT1Aw.js";
8
- import { n as defaultPrefersReducedMotion } from "./cssValues-Cr6PhYTx.js";
9
- import { r as SETTLE_THRESHOLD, t as animatorFor } from "./animator-Bptiubcx.js";
10
- import { n as resolveMoveTiming } from "./resolveMotion-DftkGFw6.js";
11
- import { o as springs } from "./springs-DjAn_oV5.js";
12
- import { t as VelocityTracker } from "./VelocityTracker-CPFBHDpy.js";
13
- import { t as resolveSnapPoint } from "./resolveSnapPoint-A4dhS5jj.js";
14
- import { t as focusForLastInput } from "./focusReturn-DfZS7TCp.js";
15
- import { t as useFocusTrap } from "./useFocusTrap-DcjriBe1.js";
16
- import { t as rubberBand } from "./rubberBand-DDd5ElTe.js";
17
- import { t as useRestoreFocus } from "./useRestoreFocus-DS7uQWok.js";
18
- import { t as attachScrollKeyboardDelegation } from "./scrollKeyboardDelegation-DZ4t5PvC.js";
19
- import { t as useScrollLock } from "./scrollLock-CoVg9lLU.js";
20
- import { n as restoreLayerFocus, r as trackLayerFocus, t as isLayerFocusStranded } from "./layerFocusReturn-CEvrMbxH.js";
21
- import { t as createModalOutletHandle } from "./modalOutlet-Drr9a16b.js";
22
- import { o as provideLayoutContainer } from "./context-D-Hwh-Jf.js";
23
- import { t as useScrollbars } from "./useScrollbars-Ch0xqJWO.js";
24
- import { t as bottomSheetEscapeKey } from "./escape-DzSxSmez.js";
25
- import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, inject, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, onUpdated, openBlock, provide, ref, renderSlot, shallowRef, toValue, unref, useAttrs, useModel, useTemplateRef, watch, withCtx } from "vue";
26
- import "../styles/bottom-sheet.css";
27
- //#region \0rolldown/runtime.js
28
- var __defProp = Object.defineProperty;
29
- var __exportAll = (all, no_symbols) => {
30
- let target = {};
31
- for (var name in all) __defProp(target, name, {
32
- get: all[name],
33
- enumerable: true
34
- });
35
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
36
- return target;
37
- };
38
- //#endregion
39
- //#region src/layer/inputHoldKeptInside.ts
40
- /** 焦点留在退场浮层里时,还放行的键。 */
41
- const KEPT_INSIDE_KEYS = /* @__PURE__ */ new Set(["Tab"]);
42
- const WATCHED_ATTRIBUTES = [
43
- "disabled",
44
- "hidden",
45
- "inert"
46
- ];
47
- /**
48
- * 退场期间挡住 `layer`,页面照常可用:浮层让所有指针穿过去,不加挡板。
49
- * 焦点还在里面时,内容照样露给辅助技术,但除了 Tab 什么键、什么点击都到不了它;
50
- * 焦点一离开(或者本来就不在里面),浮层自己变成 `inert` + `aria-hidden`,
51
- * 直到暂挡结束。放开之后,排在放开前的焦点检查不再改动浮层。返回提前放开的函数。
52
- */
53
- function holdKeptInside(layer, until) {
54
- const doc = layer.ownerDocument;
55
- const style = isHTMLElement(layer) ? layer.style : null;
56
- const previousPointerEvents = style?.pointerEvents ?? "";
57
- if (style != null) style.pointerEvents = "none";
58
- const wasInert = layer.hasAttribute("inert");
59
- const previousAriaHidden = layer.getAttribute("aria-hidden");
60
- let isInert = false;
61
- let isReleased = false;
62
- const stops = [];
63
- const hasFocusInside = () => {
64
- const focused = deepActiveElement(doc);
65
- return focused != null && containsAlongFlatTree(layer, focused);
66
- };
67
- const stopWatching = () => {
68
- for (const stop of stops.splice(0)) stop();
69
- };
70
- const makeInert = () => {
71
- if (isInert || isReleased) return;
72
- isInert = true;
73
- stopWatching();
74
- layer.setAttribute("inert", "");
75
- layer.setAttribute("aria-hidden", "true");
76
- };
77
- if (!hasFocusInside()) makeInert();
78
- else {
79
- const isInLayer = (event) => {
80
- const target = typeof event.composedPath === "function" ? event.composedPath()[0] : event.target;
81
- return isNode(target) && containsAlongFlatTree(layer, target);
82
- };
83
- const stopActivation = (event) => {
84
- if (isInLayer(event)) {
85
- event.preventDefault();
86
- event.stopImmediatePropagation();
87
- }
88
- };
89
- const stopKey = (event) => {
90
- if (!KEPT_INSIDE_KEYS.has(event.key)) stopActivation(event);
91
- };
92
- const captures = [
93
- ["click", stopActivation],
94
- ["keydown", stopKey],
95
- ["keyup", stopKey]
96
- ];
97
- for (const [type, listener] of captures) {
98
- doc.addEventListener(type, listener, { capture: true });
99
- stops.push(() => doc.removeEventListener(type, listener, { capture: true }));
100
- }
101
- const makeInertIfFocusLeft = () => {
102
- if (!hasFocusInside()) makeInert();
103
- };
104
- const onFocusOut = () => queueMicrotask(makeInertIfFocusLeft);
105
- layer.addEventListener("focusout", onFocusOut);
106
- stops.push(() => layer.removeEventListener("focusout", onFocusOut));
107
- if (typeof MutationObserver !== "undefined") {
108
- const observer = new MutationObserver(makeInertIfFocusLeft);
109
- observer.observe(layer, {
110
- childList: true,
111
- subtree: true,
112
- attributeFilter: WATCHED_ATTRIBUTES
113
- });
114
- stops.push(() => observer.disconnect());
115
- }
116
- }
117
- const release = () => {
118
- if (isReleased) return;
119
- isReleased = true;
120
- stopWatching();
121
- if (style != null) style.pointerEvents = previousPointerEvents;
122
- if (isInert) {
123
- if (!wasInert) layer.removeAttribute("inert");
124
- if (previousAriaHidden == null) layer.removeAttribute("aria-hidden");
125
- else layer.setAttribute("aria-hidden", previousAriaHidden);
126
- }
127
- };
128
- const end = "finished" in until ? until.finished : until;
129
- Promise.resolve(end).then(release, release);
130
- return release;
131
- }
132
- //#endregion
133
- //#region src/BottomSheet/sheetDragExit.ts
134
- /** How many more frames a drag's close looks for its scrim's fade to adopt. */
135
- const MAX_SCRIM_FADE_ADOPT_FRAMES = 3;
136
- /** Without Web Animations the animator jumps to its end, so the stylesheet's exit runs instead. */
137
- function supportsWebAnimations() {
138
- return typeof Element !== "undefined" && typeof Element.prototype.animate === "function";
139
- }
140
- /**
141
- * How a drag's close plays: the close spring's move from where the finger
142
- * left the sheet, timed as the shared animator times it, and its progress
143
- * toward the point where the sheet leaves view. The surface reaches below the
144
- * screen (the reserve), so it leaves view before the spring settles, and the
145
- * scrim is clear by then.
146
- */
147
- function dragExitFade(element, exit) {
148
- const viewportHeight = element.ownerDocument.defaultView?.innerHeight ?? 0;
149
- const shown = Math.max(0, viewportHeight - element.getBoundingClientRect().top);
150
- return resolveMoveTiming(element, springs.sheetDismissSwipe, {
151
- from: 0,
152
- to: exit.distance,
153
- velocity: exit.velocity,
154
- epsilon: SETTLE_THRESHOLD.y
155
- }, Math.min(exit.distance, shown));
156
- }
157
- /** The running fade that clears the scrim behind `panel`, if any. */
158
- function clearingScrimFade(panel) {
159
- const dialog = panel.closest("dialog");
160
- const doc = panel.ownerDocument;
161
- if (dialog == null || typeof doc.getAnimations !== "function") return void 0;
162
- const fades = doc.getAnimations().filter((animation) => {
163
- const effect = animation.effect;
164
- return effect?.target === dialog && animation.transitionProperty === "opacity" && Number(effect.getKeyframes().at(-1)?.opacity) === 0;
165
- });
166
- const onBackdrop = fades.filter((fade) => fade.effect.pseudoElement === "::backdrop");
167
- return (onBackdrop.length > 0 ? onBackdrop : fades.filter((fade) => !fade.effect.pseudoElement)).at(-1);
168
- }
169
- /**
170
- * Plays a touch drag's close on the shared animator with the dismiss swipe's
171
- * spring, from the release speed. The scrim's CSS fade takes the close's start
172
- * time, so the two end together. Returns the cleanup: a reopen during the
173
- * exit takes the sheet back from where it is.
174
- */
175
- function playDragExit(element, exit, callbacks) {
176
- const handle = animatorFor(element).animate({ y: exit.distance }, {
177
- spring: springs.sheetDismissSwipe,
178
- velocity: { y: exit.velocity }
179
- });
180
- let isCurrent = true;
181
- let isFinished = false;
182
- let frame = null;
183
- handle.started.then((start) => {
184
- const adopt = (framesLeft) => {
185
- frame = null;
186
- if (!isCurrent) return;
187
- const fade = clearingScrimFade(element);
188
- if (fade != null) fade.startTime = start;
189
- else if (framesLeft > 0 && typeof requestAnimationFrame === "function") frame = requestAnimationFrame(() => adopt(framesLeft - 1));
190
- };
191
- adopt(MAX_SCRIM_FADE_ADOPT_FRAMES);
192
- });
193
- handle.finished.then(() => {
194
- isFinished = true;
195
- callbacks.onSettled();
196
- if (isCurrent) callbacks.complete();
197
- });
198
- return () => {
199
- isCurrent = false;
200
- if (frame != null) cancelAnimationFrame(frame);
201
- if (!isFinished) handle.retarget({ y: 0 });
202
- };
203
- }
204
- /** A hidden sheet can stay mounted, so the exit's offset goes back to 0. */
205
- function resetDragExit(element) {
206
- animatorFor(element).set({ y: 0 });
207
- }
208
- //#endregion
209
- //#region src/BottomSheet/sheetTransition.ts
210
- const BACKSTOP_BUFFER_MS = 50;
211
- function parseTransitionTime(value) {
212
- const normalized = value.trim();
213
- if (!/^-?(?:\d+|\d*\.\d+)(?:ms|s)$/.test(normalized)) return null;
214
- const time = Number.parseFloat(normalized);
215
- return normalized.endsWith("ms") ? time : time * 1e3;
216
- }
217
- /** Longest transition duration + delay that applies to `property`, in ms. */
218
- function transitionMsFor(element, property) {
219
- const style = getComputedStyle(element);
220
- const properties = (style.transitionProperty || "").split(",").map((value) => value.trim());
221
- const durations = (style.transitionDuration || "").split(",").map(parseTransitionTime);
222
- const delays = (style.transitionDelay || "").split(",").map((value) => parseTransitionTime(value) ?? 0);
223
- return properties.reduce((longest, name, index) => {
224
- if (name !== property && name !== "all") return longest;
225
- const duration = durations[index % durations.length];
226
- if (duration == null) return longest;
227
- return Math.max(longest, duration + (delays[index % delays.length] ?? 0));
228
- }, 0);
229
- }
230
- /** Whether a CSS transition of `property` still runs on `element`. */
231
- function hasRunningTransition(element, property) {
232
- return (element.getAnimations?.() ?? []).some((animation) => animation.transitionProperty === property && (animation.playState === "running" || animation.playState === "paused"));
233
- }
234
- /**
235
- * Calls `complete` when `element` finishes transitioning `property`: on the
236
- * matching `transitionend`/`transitioncancel`, or on a timer backstop so a
237
- * missed event can never strand the caller. Without a resolved duration — the
238
- * case in a stylesheet-free test environment — it completes immediately.
239
- */
240
- function waitForTransition(element, property, complete) {
241
- if (element == null) {
242
- complete();
243
- return () => {};
244
- }
245
- let done = false;
246
- let timer = null;
247
- let backstopMs = 0;
248
- let onTransitionEnd = () => {};
249
- const finish = () => {
250
- if (done) return;
251
- done = true;
252
- if (timer != null) clearTimeout(timer);
253
- element.removeEventListener("transitionend", onTransitionEnd);
254
- element.removeEventListener("transitioncancel", onTransitionEnd);
255
- complete();
256
- };
257
- onTransitionEnd = (event) => {
258
- if (event.target !== element || event.propertyName !== property) return;
259
- if (event.type === "transitioncancel" && hasRunningTransition(element, property)) {
260
- if (timer != null) {
261
- clearTimeout(timer);
262
- timer = setTimeout(finish, backstopMs);
263
- }
264
- return;
265
- }
266
- finish();
267
- };
268
- const duration = transitionMsFor(element, property);
269
- if (duration <= 0) {
270
- finish();
271
- return () => {};
272
- }
273
- element.addEventListener("transitionend", onTransitionEnd);
274
- element.addEventListener("transitioncancel", onTransitionEnd);
275
- backstopMs = duration + BACKSTOP_BUFFER_MS;
276
- timer = setTimeout(finish, backstopMs);
277
- return () => {
278
- if (timer != null) clearTimeout(timer);
279
- element.removeEventListener("transitionend", onTransitionEnd);
280
- element.removeEventListener("transitioncancel", onTransitionEnd);
281
- };
282
- }
283
- /** Scrim opacity at the peek stop: dimmed, never clear, because the sheet stays modal. */
284
- const MIN_PEEK_SCRIM_OPACITY = .3;
285
- const SNAP_POINT_PATTERN = /^(\d+(?:\.\d+)?|\.\d+)(px|%)$/i;
286
- function parseSnapPoint(point, viewportPx) {
287
- if (typeof point === "number") return Number.isFinite(point) && point > 0 && point <= 1 ? point * viewportPx : null;
288
- const match = SNAP_POINT_PATTERN.exec(point.trim());
289
- if (match === null) return null;
290
- const value = Number.parseFloat(match[1]);
291
- if (!(value > 0)) return null;
292
- return match[2].toLowerCase() === "%" ? value / 100 * viewportPx : value;
293
- }
294
- /** Resolves snap points to candidate visible heights in px, dropping unusable ones. */
295
- function resolveSnapPoints(points, viewportPx) {
296
- const heights = [];
297
- for (const point of points) {
298
- const height = parseSnapPoint(point, viewportPx);
299
- if (height !== null) heights.push(height);
300
- }
301
- return heights;
302
- }
303
- /**
304
- * Resting offsets from fully open, ascending and de-duplicated. `0` is always
305
- * the first stop; only heights shorter than the sheet become collapsed stops;
306
- * offsets closer than `dedupPx` collapse to the taller one.
307
- */
308
- function computeDetentOffsets(sheetHeight, detentHeights, dedupPx = 48) {
309
- const ascending = [0, ...detentHeights.filter((height) => height > 0 && height < sheetHeight).map((height) => sheetHeight - height)].sort((a, b) => a - b);
310
- const deduped = [];
311
- for (const offset of ascending) {
312
- const last = deduped[deduped.length - 1];
313
- if (last === void 0 || offset - last >= dedupPx) deduped.push(offset);
314
- }
315
- return deduped;
316
- }
317
- /** Nearest value in `offsets` to `value`; `offsets` must not be empty. */
318
- function nearestOffset(value, offsets) {
319
- return offsets.reduce((best, offset) => Math.abs(offset - value) < Math.abs(best - value) ? offset : best, offsets[0]);
320
- }
321
- /**
322
- * The peek stop's offset, or `null` when this sheet has no peek. A peek is the
323
- * shortest stop and a sliver: a sheet that keeps the full layout height and
324
- * slides below the viewport instead of reflowing its content into a sliver.
325
- */
326
- function peekOffsetFor(offsets, visibleSheetHeight) {
327
- if (offsets.length < 2 || visibleSheetHeight <= 0) return null;
328
- const shortest = offsets[offsets.length - 1];
329
- return visibleSheetHeight - shortest <= .25 * visibleSheetHeight ? shortest : null;
330
- }
331
- /**
332
- * Scrim opacity (1 = fully opaque) for a drag or settle `offset`. It stays
333
- * opaque down to the shortest working stop and only thins past it, onto a peek
334
- * or out through the dismissal overshoot.
335
- */
336
- function scrimOpacityForOffset(offset, offsets, dismissOffset, peekOffset) {
337
- const hasPeek = peekOffset !== null;
338
- const fadeStart = hasPeek ? offsets[offsets.length - 2] : offsets[offsets.length - 1];
339
- const fadeEnd = hasPeek ? peekOffset : dismissOffset;
340
- const floor = hasPeek ? MIN_PEEK_SCRIM_OPACITY : 0;
341
- if (offset <= fadeStart) return 1;
342
- if (offset >= fadeEnd) return floor;
343
- return 1 - (1 - floor) * ((offset - fadeStart) / (fadeEnd - fadeStart));
344
- }
345
- /**
346
- * Settle target for a released drag, restricted to the drag direction so a
347
- * committed drag never snaps back past where it started. `dir`: 1 = dragged
348
- * down, -1 = up, 0 = neither.
349
- */
350
- function resolveSettleOffset(value, offsets, dir, baseOffset) {
351
- let candidates = offsets;
352
- if (dir > 0) {
353
- const downward = offsets.filter((offset) => offset >= baseOffset);
354
- if (downward.length > 0) candidates = downward;
355
- } else if (dir < 0) {
356
- const upward = offsets.filter((offset) => offset <= baseOffset);
357
- if (upward.length > 0) candidates = upward;
358
- }
359
- return nearestOffset(value, candidates);
360
- }
361
- /** The visible height of the sheet at a resting `offset`. */
362
- function visibleHeightForOffset(sheetHeight, offset, offscreenBlockEndInset) {
363
- return Math.max(0, sheetHeight - offscreenBlockEndInset - offset);
364
- }
365
- /** On a touch device the reserve covers a pull of the whole viewport: 40% of it. */
366
- const RESERVE_VIEWPORT_SHARE = .4;
367
- /** Below the shortest stop, a slow mouse drag past this share of its height dismisses. */
368
- const DISMISS_OVERSHOOT_RATIO = .4;
369
- /** Within this many px of a stop the live drag eases toward it. */
370
- const MAGNET_RANGE = 40;
371
- /** A mouse's or a pen's stretch past fully open: a resisted fraction, capped at MIN_RESERVE. */
372
- const OVERSCROLL_RESISTANCE = .35;
373
- /** The reserve a sheet keeps on a touch device whose layout viewport is `viewportHeight` tall. */
374
- function sheetReserve(viewportHeight) {
375
- return Math.max(48, Math.ceil(viewportHeight * RESERVE_VIEWPORT_SHARE));
376
- }
377
- /**
378
- * Whether a gesture that lands on `target` began inside another layer rendered
379
- * in this sheet's content: a `<dialog>` between the target and the body.
380
- * A sheet or Dialog opened from inside a sheet renders its dialog as a
381
- * descendant of the host's body, so its pointer and touch events bubble
382
- * through the host's listeners. That gesture is the layer's own: the host
383
- * neither arms a drag on it nor takes the pointer for it.
384
- *
385
- * A control that pans vertically on its own (a picker wheel, marked
386
- * `data-astryx-owns-pan`) keeps its gesture the same way: a downward drag on
387
- * it turns its rows and never pulls the sheet.
388
- */
389
- function isInsideNestedLayer(target, body) {
390
- for (let element = target instanceof Element ? target : null; element != null && element !== body; element = element.parentElement) if (element.localName === "dialog" || element.hasAttribute("data-astryx-owns-pan")) return true;
391
- return false;
392
- }
393
- function magnetize(value, targets) {
394
- if (targets.length === 0) return value;
395
- let nearest = targets[0];
396
- for (const target of targets) if (Math.abs(target - value) < Math.abs(nearest - value)) nearest = target;
397
- const distance = Math.abs(value - nearest);
398
- if (distance >= MAGNET_RANGE) return value;
399
- const t = distance / MAGNET_RANGE;
400
- return value + (nearest - value) * (1 - t * t);
401
- }
402
- /**
403
- * The offset a drag shows for the raw offset `raw` under the finger. Past
404
- * fully open, a finger stretches on UIKit's rubber band over the visible
405
- * height and never past the reserve; a mouse or a pen moves a resisted
406
- * fraction capped at MIN_RESERVE. Past the shortest stop nothing pulls, so it
407
- * never fights a drag to close. Between stops, the drag eases into a stop
408
- * within MAGNET_RANGE.
409
- */
410
- function stretchedOffset(raw, offsets, context) {
411
- if (raw < 0) return context.pointerType === "touch" ? Math.max(-context.reserve, rubberBand(raw, context.height - context.reserve, scroll.rubberBand.coefficient)) : Math.max(-48, raw * OVERSCROLL_RESISTANCE);
412
- if (raw > (offsets[offsets.length - 1] ?? 0)) return raw;
413
- return magnetize(raw, offsets);
414
- }
415
- function renderedBlockEndPadding(element) {
416
- const value = Number.parseFloat(getComputedStyle(element).paddingBlockEnd);
417
- return Number.isFinite(value) ? value : 0;
418
- }
419
- /** How much further the body could scroll on its own, ignoring the inset this hook adds. */
420
- function naturalEndGapFor(body) {
421
- if (!body) return 0;
422
- const inset = renderedBlockEndPadding(body);
423
- return Math.max(0, body.scrollHeight - body.clientHeight - inset) - body.scrollTop;
424
- }
425
- function hapticTick() {
426
- if (typeof navigator === "undefined" || typeof navigator.vibrate !== "function") return;
427
- if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
428
- navigator.vibrate(8);
429
- }
430
- /** Offset past which a slow mouse or pen drag dismisses instead of snapping back. */
431
- function dismissTravelFor(height, offsets, reserve) {
432
- const maxOffset = offsets[offsets.length - 1] ?? 0;
433
- return maxOffset + visibleHeightForOffset(height, maxOffset, reserve) * DISMISS_OVERSHOOT_RATIO;
434
- }
435
- //#endregion
436
- //#region src/BottomSheet/sheetScrollChain.ts
437
- /**
438
- * The boxes a touch on the sheet's body can scroll, and the edges they sit at.
439
- *
440
- * The body is where the sheet listens, but it is not always what scrolls: a
441
- * host can pin a header and footer around a scrolling middle, or lay a
442
- * scrolling grid inside the sheet. The browser scrolls the innermost box that
443
- * has room and then chains outward, so a pull belongs to the sheet only when
444
- * every box in the chain sits at the edge the pull opposes.
445
- */
446
- /** A box a finger or a wheel can scroll along the block axis. */
447
- function isBlockScroller(element) {
448
- if (element.scrollHeight - element.clientHeight <= 1) return false;
449
- const { overflowY } = getComputedStyle(element);
450
- return overflowY === "auto" || overflowY === "scroll";
451
- }
452
- /** Every scroller between `target` and `body`, innermost first, then the body itself. */
453
- function scrollChainUnder(target, body) {
454
- const chain = [];
455
- for (let element = target instanceof Element ? target : null; element != null && element !== body; element = element.parentElement) if (element instanceof HTMLElement && isBlockScroller(element)) chain.push(element);
456
- chain.push(body);
457
- return chain;
458
- }
459
- /** Nothing in the chain can scroll up any further, so a pull down is the sheet's. */
460
- function chainAtTop(chain) {
461
- return chain.every((element) => element.scrollTop <= 0);
462
- }
463
- /** Nothing in the chain can scroll down any further, so a pull up is the sheet's. */
464
- function chainAtBottom(chain) {
465
- return chain.every((element) => element.scrollTop + element.clientHeight >= element.scrollHeight - 1);
466
- }
467
- /** Whether any box in the chain has content to scroll. */
468
- function chainScrolls(chain) {
469
- return chain.some((element) => element.scrollHeight - element.clientHeight > 1);
470
- }
471
- /**
472
- * iOS rubber-bands a scroller past its end even under `overscroll-behavior:
473
- * contain`. While the content sits at its end mid-pull, `none` holds it still,
474
- * so only the sheet moves. Returns the undo.
475
- */
476
- function holdAtEnd(chain) {
477
- const previous = chain.map((element) => element.style.overscrollBehaviorY);
478
- for (const element of chain) element.style.overscrollBehaviorY = "none";
479
- return () => {
480
- chain.forEach((element, index) => {
481
- element.style.overscrollBehaviorY = previous[index] ?? "";
482
- });
483
- };
484
- }
485
- //#endregion
486
- //#region src/BottomSheet/sheetPointerArm.ts
487
- /**
488
- * The handle's drag for every pointer, and the body's pull down at its top for
489
- * a mouse or a pen. A finger's pull on the body belongs to the touch listeners
490
- * alone, so a touch-down never arms here.
491
- */
492
- function createSheetPointerArm(drive) {
493
- let arm = null;
494
- function reset() {
495
- arm = null;
496
- }
497
- /** A second pointer is a pinch. The browser keeps the zoom; the sheet lets go. */
498
- function yieldToPinch(pointerId) {
499
- const active = drive.dragPointerId();
500
- if (active == null || active === pointerId) return false;
501
- drive.cancel();
502
- return true;
503
- }
504
- function onPointerMove(event) {
505
- if (drive.dragPointerId() != null) {
506
- if (drive.isTouchDrag() || yieldToPinch(event.pointerId)) return;
507
- if (event.cancelable) event.preventDefault();
508
- drive.move(event.clientY, event.timeStamp);
509
- return;
510
- }
511
- const armed = arm;
512
- if (armed == null || armed.pointerId !== event.pointerId) return;
513
- const delta = event.clientY - armed.startY;
514
- armed.tracker.add(0, event.clientY, event.timeStamp);
515
- if (delta > 8 && chainAtTop(armed.scrollers)) {
516
- arm = null;
517
- drive.begin({
518
- pointerId: armed.pointerId,
519
- pointerType: armed.pointerType,
520
- startY: armed.startY,
521
- tracker: armed.tracker
522
- }, event.clientY, event.timeStamp);
523
- if (event.cancelable) event.preventDefault();
524
- drive.move(event.clientY, event.timeStamp);
525
- } else if (delta < 0) {
526
- arm = null;
527
- drive.detach();
528
- }
529
- }
530
- function onPointerUp(event) {
531
- const active = drive.dragPointerId();
532
- if (active != null && (active !== event.pointerId || drive.isTouchDrag())) return;
533
- arm = null;
534
- if (active == null) {
535
- drive.detach();
536
- return;
537
- }
538
- drive.end(event.clientY, event.timeStamp);
539
- }
540
- function onPointerCancel(event) {
541
- const active = drive.dragPointerId();
542
- if (active != null && (active !== event.pointerId || drive.isTouchDrag())) return;
543
- drive.cancel();
544
- }
545
- function onHandlePointerDown(event) {
546
- if (event.button != null && event.button !== 0) return;
547
- if (yieldToPinch(event.pointerId)) return;
548
- drive.attach();
549
- const tracker = new VelocityTracker();
550
- drive.begin({
551
- pointerId: event.pointerId,
552
- pointerType: event.pointerType,
553
- startY: event.clientY,
554
- tracker
555
- }, event.clientY, event.timeStamp);
556
- if (event.cancelable) event.preventDefault();
557
- }
558
- function onBodyPointerDown(event) {
559
- if (yieldToPinch(event.pointerId)) return;
560
- arm = null;
561
- if (event.pointerType === "touch" || event.button != null && event.button !== 0) return;
562
- const body = drive.body();
563
- if (!body || isInsideNestedLayer(event.target, body)) return;
564
- const scrollers = scrollChainUnder(event.target, body);
565
- if (!chainAtTop(scrollers)) return;
566
- const tracker = new VelocityTracker();
567
- tracker.add(0, event.clientY, event.timeStamp);
568
- arm = {
569
- pointerId: event.pointerId,
570
- pointerType: event.pointerType,
571
- startY: event.clientY,
572
- scrollers,
573
- tracker
574
- };
575
- drive.attach();
576
- }
577
- return {
578
- onPointerMove,
579
- onPointerUp,
580
- onPointerCancel,
581
- onHandlePointerDown,
582
- onBodyPointerDown,
583
- reset
584
- };
585
- }
586
- //#endregion
587
- //#region src/BottomSheet/sheetPointerSession.ts
588
- /** Window pointer listeners, the body's non-passive touch listeners, and the interruptions that cancel a drag. */
589
- function createSheetPointerSession(handlers) {
590
- let body = null;
591
- let listening = false;
592
- function attach() {
593
- if (listening || typeof window === "undefined") return;
594
- listening = true;
595
- window.addEventListener("pointermove", handlers.onPointerMove);
596
- window.addEventListener("pointerup", handlers.onPointerUp);
597
- window.addEventListener("pointercancel", handlers.onPointerCancel);
598
- }
599
- function detach() {
600
- if (!listening || typeof window === "undefined") return;
601
- listening = false;
602
- window.removeEventListener("pointermove", handlers.onPointerMove);
603
- window.removeEventListener("pointerup", handlers.onPointerUp);
604
- window.removeEventListener("pointercancel", handlers.onPointerCancel);
605
- }
606
- function unbind(element) {
607
- element.removeEventListener("touchstart", handlers.onTouchStart);
608
- element.removeEventListener("touchmove", handlers.onTouchMove);
609
- element.removeEventListener("touchend", handlers.onTouchEnd);
610
- element.removeEventListener("touchcancel", handlers.onTouchEnd);
611
- }
612
- function setBody(element) {
613
- if (body != null) unbind(body);
614
- body = element;
615
- if (element == null) return;
616
- element.addEventListener("touchstart", handlers.onTouchStart, { passive: true });
617
- element.addEventListener("touchmove", handlers.onTouchMove, { passive: false });
618
- element.addEventListener("touchend", handlers.onTouchEnd);
619
- element.addEventListener("touchcancel", handlers.onTouchEnd);
620
- }
621
- function onVisibilityChange() {
622
- if (document.visibilityState === "hidden") handlers.onInterrupt();
623
- }
624
- function destroy() {
625
- detach();
626
- setBody(null);
627
- if (typeof window === "undefined") return;
628
- window.removeEventListener("blur", handlers.onInterrupt);
629
- document.removeEventListener("visibilitychange", onVisibilityChange);
630
- }
631
- if (typeof window !== "undefined") {
632
- window.addEventListener("blur", handlers.onInterrupt);
633
- document.addEventListener("visibilitychange", onVisibilityChange);
634
- }
635
- return {
636
- attach,
637
- detach,
638
- setBody,
639
- destroy
640
- };
641
- }
642
- //#endregion
643
- //#region src/motion/uikit/sheet.ts
644
- /**
645
- * @file sheet.ts
646
- * @input Nothing; data only
647
- * @output Exports `sheet`, the sheet's release constants. They say when
648
- * UISheetPresentationController counts a release as a flick and how near a
649
- * detent a flick counts as on it. They also give how far ahead a release is
650
- * projected, and the speed below which it is not
651
- * @position The sheet domain of the UIKit constants table (motion/uikit).
652
- * Its springs are `springs.sheetPresent`, `.sheetDismiss`, `.sheetDetent`,
653
- * `.sheetReleaseFast` and `.sheetDismissSwipe`
654
- *
655
- * Read from UIKit with a `[.medium(), .large()]` sheet in an injected host
656
- * app. Speeds are in pt/s (CSS px/s).
657
- */
658
- const sheet = { release: {
659
- /**
660
- * Release speed (pt/s, in either direction) from which UIKit's sheet
661
- * counts a release as a flick. A sheet's flick goes at least to the next
662
- * position beyond where it is in its direction (`detentTolerance`). It
663
- * goes on past it when its projection passes it. The same speed
664
- * switches UIKit's settle from `springs.sheetDetent` (critically damped)
665
- * to `springs.sheetReleaseFast` (80 % damping). An interactive dismissal
666
- * at it takes `springs.sheetDismissSwipe`. Inside the measured bracket.
667
- * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
668
- * iPhone 17 Pro, Oct 23 and Oct 24 2026. Of 134 drag releases, 55 had
669
- * their CASpringAnimation read. Every one up to 996.7 pt/s had damping
670
- * 36.515 (ζ 1), and every one from 1028.3 pt/s on had 29.212 (ζ 0.8).
671
- * So the switch lies in (996.7, 1028.3]. With a 0.1 s projection, all
672
- * 134 outcomes fit a flick threshold from 997 to 1028 pt/s.
673
- */
674
- fastSpeed: 1008,
675
- /**
676
- * How far ahead a release is projected, as seconds of its velocity.
677
- * UIKit's sheet projects a release to `offset + velocity × this`, and the
678
- * dismissed position (fully off screen) counts as one of its positions.
679
- * A slow release settles on the position nearest this landing. A flick
680
- * goes to the first position at or past it. Inside the measured bracket.
681
- * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
682
- * iPhone 17 Pro, Oct 23 to Oct 25 2026. There were 164 drag releases
683
- * of a [.medium(), .large()] sheet, from 0 to 4000 pt/s. Each gave the
684
- * offset and velocity of its last drag update and the detent it
685
- * settled on. With `fastSpeed`'s flick branch and no projection below
686
- * 250 pt/s, every release fits any value from 0.092 to 0.104 s.
687
- */
688
- projectionSeconds: .1,
689
- /**
690
- * Release speed (pt/s) below which a release is not projected: the sheet
691
- * settles on the position nearest where it was let go. Core cancels a
692
- * release that moves back toward its start before this applies. Inside
693
- * the measured bracket.
694
- * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
695
- * iPhone 17 Pro, Oct 25 2026. There were 30 releases of drags from the
696
- * medium detent. Each went past the midpoint toward large, or most of
697
- * the way to gone, then turned back. Each one let go at up to 244 pt/s
698
- * settled on the position nearest where it was let go. From 250.6 pt/s
699
- * on, the projection decided. So the switch lies in (244, 250.6].
700
- */
701
- minProjectionSpeed: 250,
702
- /**
703
- * How close to a position (pt) a flick's offset counts as on it, so the
704
- * next position beyond is the one after it. Inside the measured bracket.
705
- * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
706
- * iPhone 17 Pro, Oct 24 2026. Two flicks released exactly on the medium
707
- * detent went on to the next position in their direction. One released
708
- * 6.7 pt above it, moving down, stopped at medium. So any value from 0
709
- * to 6.6 pt fits.
710
- */
711
- detentTolerance: 1
712
- } };
713
- //#endregion
714
- //#region src/BottomSheet/sheetRelease.ts
715
- const PROJECTION_FACTOR = .998 / .0020000000000000018;
716
- /** A mouse or pen release shorter than this is judged where it was let go. */
717
- const PROJECTION_MIN_TRAVEL = 48;
718
- /**
719
- * A touch release takes UIKit's sheet values, with closed counted as one more
720
- * position. It is projected 0.1 s ahead, a release under 250 px/s is not
721
- * projected, and from 1008 px/s it is a flick that lands on the first position
722
- * at or past its projection. A release moving back toward where the drag
723
- * began cancels to that stop.
724
- */
725
- function resolveTouchRelease(input) {
726
- const { offsets, height, offset, velocity } = input;
727
- const maxOffset = offsets[offsets.length - 1] ?? 0;
728
- const shortestHeight = visibleHeightForOffset(height, maxOffset, input.reserve);
729
- const { fastSpeed, minProjectionSpeed, projectionSeconds, detentTolerance } = sheet.release;
730
- const points = [...offsets, maxOffset + shortestHeight];
731
- const { index } = resolveSnapPoint({
732
- points,
733
- position: offset,
734
- velocity: velocity * 1e3,
735
- flickThreshold: input.travel > 8 ? fastSpeed : Number.POSITIVE_INFINITY,
736
- tolerance: detentTolerance,
737
- flickPastProjection: true,
738
- projection: {
739
- seconds: projectionSeconds,
740
- minSpeed: minProjectionSpeed
741
- },
742
- start: input.baseOffset
743
- });
744
- if (index === points.length - 1) return {
745
- kind: "close",
746
- exit: {
747
- distance: Math.max(0, height - offset),
748
- velocity: velocity * 1e3
749
- }
750
- };
751
- return {
752
- kind: "settle",
753
- target: points[index] ?? maxOffset
754
- };
755
- }
756
- /**
757
- * A mouse or pen release coasts on the scroll view's deceleration. One that
758
- * would coast past the dismiss line closes the sheet; any other settles on
759
- * the stop nearest where it would come to rest, in the drag's direction.
760
- */
761
- function resolvePointerRelease(input) {
762
- const { offsets, offset } = input;
763
- const maxOffset = offsets[offsets.length - 1] ?? 0;
764
- const projected = input.travel > PROJECTION_MIN_TRAVEL ? offset + input.velocity * PROJECTION_FACTOR : offset;
765
- if (input.dir > 0 && projected > dismissTravelFor(input.height, offsets, input.reserve)) return {
766
- kind: "close",
767
- exit: null
768
- };
769
- return {
770
- kind: "settle",
771
- target: resolveSettleOffset(Math.min(Math.max(projected, 0), maxOffset), offsets, input.dir, input.baseOffset)
772
- };
773
- }
774
- /** Where a drag's release takes the sheet: a stop to settle on, or the close. */
775
- function resolveSheetRelease(input) {
776
- return input.isTouch ? resolveTouchRelease(input) : resolvePointerRelease(input);
777
- }
778
- //#endregion
779
- //#region src/BottomSheet/sheetTouchArm.ts
780
- /**
781
- * Travel past the point where a scroll ran out of content before the sheet
782
- * takes the rest of the pull: continuous with the scroll, yet a swipe that
783
- * merely comes to rest on the last pixel starts no drag on jitter.
784
- */
785
- const CONTENT_END_HANDOFF_SLOP = 4;
786
- /** An Apple Pencil raises touch events marked `stylus`; its drag is a pen's. */
787
- function touchPointerType(touch) {
788
- return touch.touchType === "stylus" ? "pen" : "touch";
789
- }
790
- function findTouch(event, id) {
791
- return id == null ? void 0 : Array.from(event.changedTouches).find((touch) => touch.identifier === id);
792
- }
793
- /**
794
- * The body's touch path. Non-passive `touchmove` is the reliable scroll-to-drag
795
- * hand-off on touch: cancelling a move at a scroll edge stops the native
796
- * scroll and drives the sheet instead. Every touch on the body is tracked,
797
- * not only one that begins at an edge, because a swipe that starts mid-content
798
- * and scrolls to the end has to hand off too.
799
- */
800
- function createSheetTouchArm(drive) {
801
- let arm = null;
802
- function releaseContentHold() {
803
- if (arm?.releaseContentHold != null) {
804
- arm.releaseContentHold();
805
- arm.releaseContentHold = null;
806
- }
807
- }
808
- function reset() {
809
- releaseContentHold();
810
- arm = null;
811
- }
812
- function promote(armed, touch, startY, timeStamp) {
813
- drive.begin({
814
- pointerId: armed.id,
815
- pointerType: touchPointerType(touch),
816
- startY,
817
- tracker: armed.tracker
818
- }, touch.clientY, timeStamp);
819
- drive.move(touch.clientY, timeStamp);
820
- }
821
- function onTouchStart(event) {
822
- const body = event.currentTarget;
823
- if (event.touches.length > 1) {
824
- reset();
825
- drive.yieldToPinch();
826
- return;
827
- }
828
- reset();
829
- const touch = event.changedTouches[0];
830
- if (!touch || isInsideNestedLayer(event.target, body)) return;
831
- const scrollers = scrollChainUnder(event.target, body);
832
- const bottom = chainAtBottom(scrollers) && (drive.activeOffset() > 0 || !chainScrolls(scrollers));
833
- const tracker = new VelocityTracker();
834
- tracker.add(0, touch.clientY, event.timeStamp);
835
- arm = {
836
- id: touch.identifier,
837
- startX: touch.clientX,
838
- startY: touch.clientY,
839
- scrollers,
840
- top: chainAtTop(scrollers),
841
- bottom,
842
- contentEndY: null,
843
- promotedAtContentEnd: false,
844
- releaseContentHold: null,
845
- tracker
846
- };
847
- }
848
- function moveDrag(event) {
849
- const touch = findTouch(event, drive.dragPointerId());
850
- if (!touch) return;
851
- const armed = arm;
852
- if (armed?.promotedAtContentEnd && armed.contentEndY != null) {
853
- if (touch.clientY >= armed.contentEndY) {
854
- armed.contentEndY = null;
855
- armed.promotedAtContentEnd = false;
856
- releaseContentHold();
857
- drive.cancel();
858
- return;
859
- }
860
- drive.move(touch.clientY, event.timeStamp);
861
- return;
862
- }
863
- if (event.cancelable) event.preventDefault();
864
- drive.move(touch.clientY, event.timeStamp);
865
- }
866
- function onTouchMove(event) {
867
- if (event.touches.length > 1) {
868
- reset();
869
- drive.yieldToPinch();
870
- return;
871
- }
872
- if (drive.dragPointerId() != null) {
873
- moveDrag(event);
874
- return;
875
- }
876
- const armed = arm;
877
- const touch = findTouch(event, armed?.id);
878
- if (armed == null || !touch) return;
879
- const delta = touch.clientY - armed.startY;
880
- armed.tracker.add(0, touch.clientY, event.timeStamp);
881
- const opposesTop = armed.top && delta > 0 && chainAtTop(armed.scrollers);
882
- const opposesBottom = armed.bottom && delta < 0 && chainAtBottom(armed.scrollers);
883
- const sideways = Math.abs(touch.clientX - armed.startX);
884
- const isMostlyVertical = Math.abs(delta) > sideways;
885
- if ((opposesTop || opposesBottom) && Math.abs(delta) >= 5 && isMostlyVertical && event.cancelable) event.preventDefault();
886
- if (isMostlyVertical && (opposesTop && delta > 8 || opposesBottom && delta < -8)) {
887
- if (event.cancelable) event.preventDefault();
888
- reset();
889
- promote(armed, touch, armed.startY, event.timeStamp);
890
- return;
891
- }
892
- if (Math.max(Math.abs(delta), sideways) > 8 && (armed.top || armed.bottom)) {
893
- if (!isMostlyVertical) {
894
- reset();
895
- return;
896
- }
897
- armed.top = false;
898
- armed.bottom = false;
899
- }
900
- if (armed.top && delta <= -5 && !chainAtBottom(armed.scrollers)) armed.top = false;
901
- if (armed.bottom && delta >= 5 && !chainAtTop(armed.scrollers)) armed.bottom = false;
902
- if (chainAtBottom(armed.scrollers)) {
903
- if (armed.contentEndY == null) {
904
- armed.contentEndY = touch.clientY;
905
- armed.releaseContentHold ??= holdAtEnd(armed.scrollers);
906
- } else if (armed.contentEndY - touch.clientY >= CONTENT_END_HANDOFF_SLOP) {
907
- armed.promotedAtContentEnd = true;
908
- promote(armed, touch, armed.contentEndY, event.timeStamp);
909
- }
910
- } else {
911
- armed.contentEndY = null;
912
- releaseContentHold();
913
- }
914
- }
915
- function onTouchEnd(event) {
916
- reset();
917
- const pointerId = drive.dragPointerId();
918
- if (pointerId == null) return;
919
- const touch = findTouch(event, pointerId);
920
- if (touch) drive.end(touch.clientY, event.timeStamp);
921
- else if (event.touches.length === 0) drive.cancel();
922
- }
923
- return {
924
- onTouchStart,
925
- onTouchMove,
926
- onTouchEnd,
927
- reset
928
- };
929
- }
930
- //#endregion
931
- //#region src/BottomSheet/useSheetGestures.ts
932
- /** Drag, snap, and settle behavior of the sheet panel. */
933
- function useSheetGestures(options) {
934
- const { panel, body, isOpen, canDismiss, reserve, getSnapHeights, onScrimOpacity, onSnap, onDismiss } = options;
935
- const isDragging = ref(false);
936
- const isReconciling = ref(false);
937
- const isOverflowing = ref(false);
938
- const dragOffset = ref(0);
939
- const settledOffset = ref(0);
940
- const settledLayoutOffset = ref(0);
941
- const scrollPreservationInset = ref(0);
942
- const scrimOpacity = ref(1);
943
- const sheetHeight = ref(0);
944
- const heldClose = ref(null);
945
- const dragExit = ref(null);
946
- const isDismissedByTouchDrag = ref(false);
947
- let dragState = null;
948
- /** The scrim of the stop a drag's close left, until the host answers the close. */
949
- let pendingDismissal = null;
950
- let reconcileToken = 0;
951
- let observer = null;
952
- let session;
953
- const activeOffset = computed(() => isDragging.value ? dragOffset.value : settledOffset.value);
954
- /** Dragging above the base stop restores the full layout height below the viewport. */
955
- const layoutOffset = computed(() => {
956
- if (heldClose.value != null) return heldClose.value.layoutOffset;
957
- if (isDragging.value) return dragOffset.value < settledOffset.value ? 0 : settledLayoutOffset.value;
958
- return settledLayoutOffset.value;
959
- });
960
- function measureNaturalHeight() {
961
- const element = panel.value;
962
- if (!element) return 0;
963
- const inlineHeight = element.style.height;
964
- if (inlineHeight === "") return element.getBoundingClientRect().height;
965
- element.style.height = "";
966
- const height = element.getBoundingClientRect().height;
967
- element.style.height = inlineHeight;
968
- return height;
969
- }
970
- function resolveDetents() {
971
- const measured = measureNaturalHeight();
972
- if (measured > 0) sheetHeight.value = measured;
973
- const height = measured > 0 ? measured : sheetHeight.value;
974
- const inset = reserve.value;
975
- const visible = visibleHeightForOffset(height, 0, inset);
976
- const offsets = computeDetentOffsets(visible, getSnapHeights());
977
- return {
978
- height,
979
- offsets,
980
- peekOffset: peekOffsetFor(offsets, visible),
981
- reserve: inset
982
- };
983
- }
984
- function scrimFor(offset, detents) {
985
- return scrimOpacityForOffset(offset, detents.offsets, dismissTravelFor(detents.height, detents.offsets, detents.reserve), detents.peekOffset);
986
- }
987
- function reportScrim(opacity) {
988
- scrimOpacity.value = opacity;
989
- onScrimOpacity(opacity);
990
- }
991
- async function reconcileLayout(targetLayoutOffset) {
992
- const token = ++reconcileToken;
993
- isReconciling.value = true;
994
- await nextTick();
995
- if (token !== reconcileToken) return;
996
- settledLayoutOffset.value = targetLayoutOffset;
997
- await nextTick();
998
- if (token !== reconcileToken) return;
999
- isReconciling.value = false;
1000
- scrollPreservationInset.value = 0;
1001
- }
1002
- function settleAt(target, fromOffset, detents) {
1003
- const targetLayoutOffset = target === detents.peekOffset ? 0 : target;
1004
- settledOffset.value = target;
1005
- scrollPreservationInset.value = Math.max(0, fromOffset - targetLayoutOffset - naturalEndGapFor(body.value));
1006
- reportScrim(scrimFor(target, detents));
1007
- onSnap(visibleHeightForOffset(detents.height, target, detents.reserve));
1008
- if (target !== fromOffset) hapticTick();
1009
- if (targetLayoutOffset === settledLayoutOffset.value && !isReconciling.value) return;
1010
- reconcileLayout(targetLayoutOffset);
1011
- }
1012
- function clearDragClose() {
1013
- pendingDismissal = null;
1014
- heldClose.value = null;
1015
- dragExit.value = null;
1016
- isDismissedByTouchDrag.value = false;
1017
- }
1018
- /**
1019
- * Asks the host to close. The sheet holds where the finger left it, so the
1020
- * exit starts from there. The host answers in its next render: a host that
1021
- * keeps the sheet open sends it back to its stop, the scrim with it.
1022
- */
1023
- function closeSheet(exit, state) {
1024
- if (!canDismiss.value) {
1025
- settleAt(state.offsets[state.offsets.length - 1] ?? 0, state.baseOffset, state);
1026
- return;
1027
- }
1028
- heldClose.value = {
1029
- offset: dragOffset.value,
1030
- layoutOffset: layoutOffset.value
1031
- };
1032
- isDismissedByTouchDrag.value = state.pointerType === "touch";
1033
- dragExit.value = exit;
1034
- const request = { restingScrim: scrimFor(state.baseOffset, state) };
1035
- pendingDismissal = request;
1036
- onDismiss();
1037
- nextTick(() => {
1038
- if (pendingDismissal !== request) return;
1039
- pendingDismissal = null;
1040
- if (!isOpen.value) return;
1041
- clearDragClose();
1042
- reportScrim(request.restingScrim);
1043
- });
1044
- }
1045
- function beginDrag(start, clientY, timeStamp) {
1046
- clearDragClose();
1047
- start.tracker.add(0, clientY, timeStamp);
1048
- dragState = {
1049
- ...resolveDetents(),
1050
- ...start,
1051
- baseOffset: settledOffset.value
1052
- };
1053
- dragOffset.value = settledOffset.value;
1054
- isDragging.value = true;
1055
- }
1056
- function moveDrag(clientY, timeStamp) {
1057
- const state = dragState;
1058
- if (!state) return;
1059
- state.tracker.add(0, clientY, timeStamp);
1060
- const shown = stretchedOffset(state.baseOffset + clientY - state.startY, state.offsets, state);
1061
- dragOffset.value = shown;
1062
- reportScrim(scrimFor(shown, state));
1063
- }
1064
- function endDrag(clientY, timeStamp) {
1065
- const state = dragState;
1066
- dragState = null;
1067
- session.detach();
1068
- if (!state) return;
1069
- const delta = clientY - state.startY;
1070
- if (state.tracker.lastSample?.y !== clientY) state.tracker.add(0, clientY, timeStamp);
1071
- const release = resolveSheetRelease({
1072
- offset: Math.max(0, state.baseOffset + delta),
1073
- velocity: state.tracker.velocity(timeStamp).y / 1e3,
1074
- height: state.height || 1,
1075
- dir: Math.sign(delta),
1076
- travel: Math.abs(delta),
1077
- baseOffset: state.baseOffset,
1078
- offsets: state.offsets,
1079
- reserve: state.reserve,
1080
- isTouch: state.pointerType === "touch"
1081
- });
1082
- if (release.kind === "close") closeSheet(release.exit, state);
1083
- isDragging.value = false;
1084
- if (release.kind === "settle") settleAt(release.target, state.baseOffset, state);
1085
- }
1086
- /** The drag in flight returns to its stop; the arms keep tracking their contacts. */
1087
- function dropDrag() {
1088
- const state = dragState;
1089
- dragState = null;
1090
- session.detach();
1091
- if (!state) return;
1092
- isDragging.value = false;
1093
- dragOffset.value = state.baseOffset;
1094
- settledOffset.value = state.baseOffset;
1095
- reportScrim(scrimFor(state.baseOffset, state));
1096
- }
1097
- const dragPointerId = () => dragState?.pointerId ?? null;
1098
- const touchArm = createSheetTouchArm({
1099
- activeOffset: () => activeOffset.value,
1100
- dragPointerId: () => dragState?.viaTouch ? dragState.pointerId : null,
1101
- begin: (start, clientY, timeStamp) => beginDrag({
1102
- ...start,
1103
- viaTouch: true
1104
- }, clientY, timeStamp),
1105
- move: moveDrag,
1106
- end: endDrag,
1107
- cancel: dropDrag,
1108
- yieldToPinch: cancelDrag
1109
- });
1110
- const pointerArm = createSheetPointerArm({
1111
- body: () => body.value,
1112
- dragPointerId,
1113
- isTouchDrag: () => dragState?.viaTouch ?? false,
1114
- attach: () => session.attach(),
1115
- detach: () => session.detach(),
1116
- begin: (start, clientY, timeStamp) => beginDrag({
1117
- ...start,
1118
- viaTouch: false
1119
- }, clientY, timeStamp),
1120
- move: moveDrag,
1121
- end: endDrag,
1122
- cancel: cancelDrag
1123
- });
1124
- /** Every arm and any drag in flight let go: the sheet returns to its stop. */
1125
- function cancelDrag() {
1126
- pointerArm.reset();
1127
- touchArm.reset();
1128
- dropDrag();
1129
- }
1130
- function updateOverflow() {
1131
- const element = body.value;
1132
- isOverflowing.value = element != null && (element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
1133
- }
1134
- function recordSheetHeight(height) {
1135
- if (isDragging.value || settledLayoutOffset.value > 0 || isReconciling.value) return;
1136
- if (height > 0) sheetHeight.value = height;
1137
- }
1138
- session = createSheetPointerSession({
1139
- onPointerMove: pointerArm.onPointerMove,
1140
- onPointerUp: pointerArm.onPointerUp,
1141
- onPointerCancel: pointerArm.onPointerCancel,
1142
- onTouchStart: touchArm.onTouchStart,
1143
- onTouchMove: touchArm.onTouchMove,
1144
- onTouchEnd: touchArm.onTouchEnd,
1145
- onInterrupt: () => cancelDrag()
1146
- });
1147
- watch(panel, (element) => {
1148
- observer?.disconnect();
1149
- observer = null;
1150
- if (!element) return;
1151
- if (typeof ResizeObserver === "undefined") {
1152
- recordSheetHeight(element.getBoundingClientRect().height);
1153
- return;
1154
- }
1155
- observer = new ResizeObserver((entries) => {
1156
- const entry = entries[entries.length - 1];
1157
- recordSheetHeight(entry?.borderBoxSize?.[0]?.blockSize ?? element.getBoundingClientRect().height);
1158
- updateOverflow();
1159
- });
1160
- observer.observe(element);
1161
- }, { immediate: true });
1162
- watch(body, (element) => {
1163
- session.setBody(element);
1164
- updateOverflow();
1165
- }, { immediate: true });
1166
- watch(isOpen, (open) => {
1167
- ++reconcileToken;
1168
- cancelDrag();
1169
- isReconciling.value = false;
1170
- scrollPreservationInset.value = 0;
1171
- if (!open) {
1172
- pendingDismissal = null;
1173
- return;
1174
- }
1175
- clearDragClose();
1176
- dragOffset.value = 0;
1177
- settledOffset.value = 0;
1178
- settledLayoutOffset.value = 0;
1179
- scrimOpacity.value = 1;
1180
- if (typeof ResizeObserver === "undefined") nextTick(() => recordSheetHeight(panel.value?.getBoundingClientRect().height ?? 0));
1181
- });
1182
- watch(canDismiss, (allowed) => {
1183
- if (!allowed) cancelDrag();
1184
- });
1185
- onBeforeUnmount(() => {
1186
- session.destroy();
1187
- observer?.disconnect();
1188
- observer = null;
1189
- });
1190
- return {
1191
- isDragging,
1192
- isReconciling,
1193
- isOverflowing,
1194
- panelTransform: computed(() => {
1195
- const translation = (heldClose.value?.offset ?? activeOffset.value) - layoutOffset.value;
1196
- return translation !== 0 ? `translateY(${translation}px)` : void 0;
1197
- }),
1198
- panelHeight: computed(() => {
1199
- if (layoutOffset.value <= 0 || sheetHeight.value <= 0) return void 0;
1200
- return `${Math.max(0, sheetHeight.value - layoutOffset.value)}px`;
1201
- }),
1202
- scrollPreservationInset,
1203
- scrimOpacity,
1204
- dragExit,
1205
- isDismissedByTouchDrag,
1206
- onHandlePointerDown: pointerArm.onHandlePointerDown,
1207
- onBodyPointerDown: pointerArm.onBodyPointerDown,
1208
- updateOverflow
1209
- };
1210
- }
1211
- //#endregion
1212
- //#region src/BottomSheet/useSheetReserve.ts
1213
- const BLOCK_SIZE_PROPERTIES = [
1214
- "height",
1215
- "min-height",
1216
- "max-height",
1217
- "block-size",
1218
- "min-block-size",
1219
- "max-block-size"
1220
- ];
1221
- function camelCase(property) {
1222
- return property.replace(/-([a-z])/g, (_match, letter) => letter.toUpperCase());
1223
- }
1224
- /** Whether an inline `style` binding sets any block size. */
1225
- function styleSetsBlockSize(style) {
1226
- if (Array.isArray(style)) return style.some(styleSetsBlockSize);
1227
- if (typeof style === "string") return BLOCK_SIZE_PROPERTIES.some((property) => new RegExp(`(^|;)\\s*${property}\\s*:`, "i").test(style));
1228
- if (style == null || typeof style !== "object") return false;
1229
- const record = style;
1230
- return BLOCK_SIZE_PROPERTIES.some((property) => record[property] != null || record[camelCase(property)] != null);
1231
- }
1232
- /**
1233
- * Whether the caller sizes the sheet through its fallthrough attributes: an
1234
- * inline block size, or any class, whose rules can size it too. Nothing
1235
- * extends such a sheet by the reserve.
1236
- */
1237
- function isSizedByCaller(attrs) {
1238
- const className = attrs.class;
1239
- return (Array.isArray(className) ? className.length > 0 : className != null && className !== "" && !(typeof className === "object" && Object.keys(className).length === 0)) || styleSetsBlockSize(attrs.style);
1240
- }
1241
- /**
1242
- * How far the sheet's surface reaches below the screen. Only a finger
1243
- * stretches the sheet past MIN_RESERVE, so a device with a touch pointer keeps
1244
- * 40% of the layout viewport while the sheet is presented, enough that a pull
1245
- * past the top never shows the page under it. A device without one, and a
1246
- * sheet the caller sizes, keep MIN_RESERVE.
1247
- */
1248
- function useSheetReserve(isPresented, isSized) {
1249
- const hasTouchPointer = useMediaQuery("(any-pointer: coarse)");
1250
- const viewportHeight = shallowRef(0);
1251
- const tracksViewport = computed(() => isPresented.value && hasTouchPointer.value && !isSized());
1252
- watch(tracksViewport, (tracks, _previous, onCleanup) => {
1253
- if (!tracks || typeof window === "undefined") {
1254
- viewportHeight.value = 0;
1255
- return;
1256
- }
1257
- const read = () => {
1258
- viewportHeight.value = window.innerHeight;
1259
- };
1260
- read();
1261
- window.addEventListener("resize", read);
1262
- onCleanup(() => window.removeEventListener("resize", read));
1263
- }, { immediate: true });
1264
- return computed(() => viewportHeight.value > 0 ? sheetReserve(viewportHeight.value) : 48);
1265
- }
1266
- //#endregion
1267
- //#region src/BottomSheet/BottomSheetPanel.vue
1268
- const _hoisted_1$1 = [
1269
- "data-state",
1270
- "data-height",
1271
- "data-dragging",
1272
- "data-reconciling",
1273
- "data-exit"
1274
- ];
1275
- const _hoisted_2$1 = [
1276
- "data-keyboard",
1277
- "tabindex",
1278
- "role",
1279
- "aria-label"
1280
- ];
1281
- const _hoisted_3$1 = ["data-padding"];
1282
- const _sfc_main$1 = /*@__PURE__*/ defineComponent({
1283
- name: "AstryxBottomSheetPanel",
1284
- __name: "BottomSheetPanel",
1285
- props: {
1286
- state: {},
1287
- label: {},
1288
- height: { default: "capped" },
1289
- padding: { default: void 0 },
1290
- snapPoints: { default: void 0 },
1291
- isSwipeDismissAllowed: {
1292
- type: Boolean,
1293
- default: true
1294
- }
1295
- },
1296
- emits: [
1297
- "dismiss",
1298
- "scrimOpacity",
1299
- "motionStart",
1300
- "motionComplete",
1301
- "snap",
1302
- "scrimFade"
1303
- ],
1304
- setup(__props, { expose: __expose, emit: __emit }) {
1305
- const props = __props;
1306
- const emit = __emit;
1307
- resetLayerScopedContext();
1308
- provideLayerDepth();
1309
- provideLayoutContainer("bottom-sheet");
1310
- const HEIGHT_BUDGETS = {
1311
- hug: "92dvh",
1312
- capped: "62dvh",
1313
- tall: "92dvh"
1314
- };
1315
- const panel = useTemplateRef("panel");
1316
- const body = useTemplateRef("body");
1317
- const content = useTemplateRef("content");
1318
- useScrollbars(body);
1319
- const isInteractive = computed(() => props.state === "open");
1320
- const attrs = useAttrs();
1321
- const reserve = useSheetReserve(computed(() => props.state !== "hidden"), () => isSizedByCaller(attrs));
1322
- const heightKind = computed(() => {
1323
- const height = props.height;
1324
- return height === "hug" || height === "capped" || height === "tall" ? height : "custom";
1325
- });
1326
- const budget = computed(() => {
1327
- const height = props.height;
1328
- if (typeof height === "string" && height in HEIGHT_BUDGETS) return HEIGHT_BUDGETS[height];
1329
- return typeof height === "number" ? `${height}px` : height;
1330
- });
1331
- const gestures = useSheetGestures({
1332
- panel,
1333
- body,
1334
- isOpen: isInteractive,
1335
- canDismiss: computed(() => props.isSwipeDismissAllowed),
1336
- reserve,
1337
- getSnapHeights: () => {
1338
- const points = props.snapPoints;
1339
- if (!points?.length || typeof window === "undefined") return [];
1340
- return resolveSnapPoints(points, window.innerHeight);
1341
- },
1342
- onScrimOpacity: (opacity) => emit("scrimOpacity", opacity),
1343
- onSnap: (visibleHeight) => emit("snap", visibleHeight),
1344
- onDismiss: () => emit("dismiss")
1345
- });
1346
- const isCrossFade = computed(() => gestures.isDismissedByTouchDrag.value && defaultPrefersReducedMotion());
1347
- const playedDragExit = computed(() => {
1348
- const exit = gestures.dragExit.value;
1349
- return exit != null && !isCrossFade.value && !defaultPrefersReducedMotion() && supportsWebAnimations() ? exit : null;
1350
- });
1351
- const holdsDragClose = computed(() => gestures.dragExit.value != null && (playedDragExit.value != null || isCrossFade.value));
1352
- watch(playedDragExit, (exit) => {
1353
- emit("scrimFade", exit != null && panel.value != null ? dragExitFade(panel.value, exit) : null);
1354
- }, { flush: "sync" });
1355
- const panelStyle = computed(() => {
1356
- const style = {
1357
- "--_sheet-budget": budget.value,
1358
- "--_sheet-reserve": `${reserve.value}px`
1359
- };
1360
- if (isInteractive.value) {
1361
- style.transform = gestures.panelTransform.value;
1362
- style.height = gestures.panelHeight.value;
1363
- } else if (props.state === "exiting") {
1364
- style.height = gestures.panelHeight.value;
1365
- if (holdsDragClose.value) style.transform = gestures.panelTransform.value ?? "translateY(0px)";
1366
- }
1367
- return style;
1368
- });
1369
- const bodyStyle = computed(() => {
1370
- const inset = gestures.scrollPreservationInset.value;
1371
- return inset > 0 ? { paddingBlockEnd: `${inset}px` } : void 0;
1372
- });
1373
- const overflowTabStop = computed(() => isInteractive.value && gestures.isOverflowing.value);
1374
- let cancelMotionWait = null;
1375
- /** The element a swipe's close moved on the animator, until the sheet is hidden. */
1376
- let dragExitElement = null;
1377
- function waitForMotion(motion) {
1378
- cancelMotionWait?.();
1379
- emit("motionStart", motion);
1380
- const complete = () => {
1381
- cancelMotionWait = null;
1382
- emit("motionComplete", motion);
1383
- };
1384
- const element = panel.value;
1385
- const exit = playedDragExit.value;
1386
- if (motion === "exiting" && exit != null && element != null) {
1387
- dragExitElement = element;
1388
- cancelMotionWait = playDragExit(element, exit, {
1389
- onSettled: () => emit("scrimFade", null),
1390
- complete
1391
- });
1392
- return;
1393
- }
1394
- cancelMotionWait = waitForTransition(element, motion === "exiting" && isCrossFade.value ? "opacity" : "transform", complete);
1395
- }
1396
- watch(() => props.state, (state) => {
1397
- if (state === "open" || state === "exiting") {
1398
- waitForMotion(state === "open" ? "entering" : "exiting");
1399
- return;
1400
- }
1401
- cancelMotionWait?.();
1402
- cancelMotionWait = null;
1403
- if (dragExitElement != null) {
1404
- resetDragExit(dragExitElement);
1405
- dragExitElement = null;
1406
- }
1407
- }, { flush: "post" });
1408
- onMounted(() => {
1409
- gestures.updateOverflow();
1410
- });
1411
- onUpdated(() => {
1412
- gestures.updateOverflow();
1413
- });
1414
- watch([body, content], ([viewport, box], _previous, onCleanup) => {
1415
- if (viewport == null || box == null) return;
1416
- onCleanup(attachScrollKeyboardDelegation(viewport, box));
1417
- });
1418
- __expose({
1419
- element: computed(() => panel.value ?? null),
1420
- focus: (options) => panel.value?.focus(options),
1421
- blur: () => panel.value?.blur()
1422
- });
1423
- return (_ctx, _cache) => {
1424
- return openBlock(), createElementBlock("div", {
1425
- ref_key: "panel",
1426
- ref: panel,
1427
- class: "astryx-bottom-sheet astryx-layer",
1428
- "data-state": __props.state,
1429
- "data-height": heightKind.value,
1430
- "data-dragging": unref(gestures).isDragging.value || void 0,
1431
- "data-reconciling": unref(gestures).isReconciling.value || void 0,
1432
- "data-exit": __props.state === "exiting" && isCrossFade.value ? "fade" : void 0,
1433
- style: normalizeStyle(panelStyle.value),
1434
- tabindex: "-1"
1435
- }, [createElementVNode("div", {
1436
- class: "astryx-bottom-sheet__handle astryx-bottom-sheet-handle",
1437
- "aria-hidden": "true",
1438
- onPointerdown: _cache[0] || (_cache[0] = (...args) => unref(gestures).onHandlePointerDown && unref(gestures).onHandlePointerDown(...args))
1439
- }, [..._cache[2] || (_cache[2] = [createElementVNode("div", { class: "astryx-bottom-sheet__handle-pill" }, null, -1)])], 32), createElementVNode("div", {
1440
- ref_key: "body",
1441
- ref: body,
1442
- class: "astryx-bottom-sheet__body",
1443
- "data-keyboard": __props.height === "tall" ? "tall" : void 0,
1444
- tabindex: overflowTabStop.value ? 0 : void 0,
1445
- role: overflowTabStop.value ? "group" : void 0,
1446
- "aria-label": overflowTabStop.value ? __props.label : void 0,
1447
- style: normalizeStyle(bodyStyle.value),
1448
- onPointerdown: _cache[1] || (_cache[1] = (...args) => unref(gestures).onBodyPointerDown && unref(gestures).onBodyPointerDown(...args))
1449
- }, [createElementVNode("div", {
1450
- ref_key: "content",
1451
- ref: content,
1452
- class: "astryx-bottom-sheet__content",
1453
- "data-padding": __props.padding
1454
- }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_3$1)], 44, _hoisted_2$1)], 12, _hoisted_1$1);
1455
- };
1456
- }
1457
- });
1458
- //#endregion
1459
- //#region src/BottomSheet/focusSheetPanel.ts
1460
- /**
1461
- * 抽屉里第一个可以接住焦点的 `data-autofocus` 元素拿到焦点。
1462
- *
1463
- * 抽屉里再开的抽屉或对话框,它的元素属于那一层;inert 的、看不见的、聚焦不上的都跳过。
1464
- * 返回有没有找到。
1465
- */
1466
- function focusFirstEligibleAutofocus(panel) {
1467
- const dialog = panel.closest("dialog");
1468
- for (const candidate of panel.querySelectorAll("[data-autofocus]")) {
1469
- if (candidate.closest("dialog") !== dialog || candidate.closest("[inert]") != null || typeof candidate.checkVisibility === "function" && !candidate.checkVisibility()) continue;
1470
- candidate.focus({ preventScroll: true });
1471
- if (candidate.ownerDocument.activeElement === candidate) return true;
1472
- }
1473
- return false;
1474
- }
1475
- /**
1476
- * 抽屉打开时把焦点放到该去的地方。
1477
- *
1478
- * 原生对话框打开时会按自己的规矩聚焦(Chromium 落在面板上,Firefox 落在第一个控件上),
1479
- * 那不是使用者的选择:只要有可聚焦的 `data-autofocus` 元素,它就盖过原生的落点,所有浏览器一致。
1480
- * 没有的话,焦点已经在抽屉里就不动;不在里面且这一层要接管焦点(模态的),就落在面板上。
1481
- */
1482
- function focusSheetOnOpen(panel, takesPanelFocus) {
1483
- if (panel == null) return;
1484
- const active = panel.ownerDocument.activeElement;
1485
- const isInsidePanel = active != null && panel.contains(active) && active.closest("dialog") === panel.closest("dialog");
1486
- if (isInsidePanel && active.hasAttribute("data-autofocus")) return;
1487
- if (focusFirstEligibleAutofocus(panel)) return;
1488
- if (!isInsidePanel && takesPanelFocus) panel.focus({ preventScroll: true });
1489
- }
1490
- //#endregion
1491
- //#region src/BottomSheet/switcher.ts
1492
- const bottomSheetSwitcherKey = Symbol("astryx-bottom-sheet-switcher");
1493
- //#endregion
1494
- //#region src/BottomSheet/useSheetLayerDismiss.ts
1495
- /**
1496
- * 把底部面板登记进全页关闭栈。
1497
- *
1498
- * 点在外面不关:遮罩点击由对话框自己认,非模态时页面还要能点。
1499
- * Escape 只打最上面一层。退出动画还在屏幕上时继续占着栈,按键不会漏到后面。
1500
- */
1501
- function useSheetLayerDismiss(options) {
1502
- const depth = useLayerDepth();
1503
- const token = {};
1504
- let stop = null;
1505
- function sync() {
1506
- stop?.();
1507
- stop = null;
1508
- if (!options.isActive.value) return;
1509
- stop = pushLayer({
1510
- token,
1511
- depth,
1512
- getContainer: options.getContainer,
1513
- dismissOnPointerOutside: false,
1514
- dismissOnEscape: options.escape.value,
1515
- isPresent: options.isPresent,
1516
- onDismiss: options.onDismiss
1517
- });
1518
- }
1519
- watch([options.isActive, options.escape], sync, { immediate: true });
1520
- onScopeDispose(() => {
1521
- stop?.();
1522
- stop = null;
1523
- });
1524
- return { isTop: () => options.isActive.value && isTopLayer(token) };
1525
- }
1526
- //#endregion
1527
- //#region src/BottomSheet/BottomSheet.vue
1528
- var BottomSheet_exports = /* @__PURE__ */ __exportAll({ default: () => _sfc_main });
1529
- const _hoisted_1 = ["inert"];
1530
- const _hoisted_2 = {
1531
- key: 1,
1532
- class: "astryx-bottom-sheet-inline"
1533
- };
1534
- const _hoisted_3 = {
1535
- key: 0,
1536
- class: "astryx-bottom-sheet__positioner astryx-bottom-sheet__positioner--inline"
1537
- };
1538
- const _hoisted_4 = [
1539
- "data-settled",
1540
- "aria-label",
1541
- "aria-labelledby",
1542
- "aria-modal",
1543
- "role"
1544
- ];
1545
- const _hoisted_5 = { class: "astryx-bottom-sheet__positioner" };
1546
- const _hoisted_6 = {
1547
- ref: "layerHost",
1548
- class: "astryx-bottom-sheet__layer-host"
1549
- };
1550
- const _sfc_main = /*@__PURE__*/ defineComponent({
1551
- name: "AstryxBottomSheet",
1552
- inheritAttrs: false,
1553
- __name: "BottomSheet",
1554
- props: /*@__PURE__*/ mergeModels({
1555
- isOpen: { type: Boolean },
1556
- label: {},
1557
- sheetId: {},
1558
- isInline: {
1559
- type: Boolean,
1560
- default: false
1561
- },
1562
- height: { default: "capped" },
1563
- snapPoints: { default: void 0 },
1564
- padding: { default: void 0 },
1565
- purpose: { default: "info" },
1566
- hasScrim: {
1567
- type: Boolean,
1568
- default: true
1569
- },
1570
- finalFocusRef: { default: null }
1571
- }, {
1572
- "isOpen": {
1573
- type: Boolean,
1574
- default: false
1575
- },
1576
- "isOpenModifiers": {}
1577
- }),
1578
- emits: /*@__PURE__*/ mergeModels([
1579
- "openChange",
1580
- "update:isOpen",
1581
- "motionStart",
1582
- "motionComplete",
1583
- "snap"
1584
- ], ["update:isOpen"]),
1585
- setup(__props, { expose: __expose, emit: __emit }) {
1586
- const props = __props;
1587
- const emit = __emit;
1588
- const isOpen = useModel(__props, "isOpen");
1589
- const switcher = inject(bottomSheetSwitcherKey, null);
1590
- const isEscapeAllowed = inject(bottomSheetEscapeKey, () => true);
1591
- provide(bottomSheetEscapeKey, () => true);
1592
- const hosted = computed(() => switcher != null && props.sheetId != null);
1593
- const retained = computed(() => {
1594
- if (!hosted.value || switcher == null) return false;
1595
- return switcher.retainedId.value === props.sheetId && switcher.activeId.value !== props.sheetId;
1596
- });
1597
- const open = computed(() => {
1598
- if (!hosted.value || props.sheetId == null) return isOpen.value;
1599
- return switcher?.activeId.value === props.sheetId || switcher?.retainedId.value === props.sheetId;
1600
- });
1601
- const attrs = useAttrs();
1602
- const dialog = useTemplateRef("dialog");
1603
- provideNestedLayerMountTarget(useTemplateRef("layerHost"));
1604
- const panel = useTemplateRef("panel");
1605
- const isPresented = ref(false);
1606
- const scrimOpacity = ref(1);
1607
- const isModalShown = ref(false);
1608
- const isSettled = ref(getCurrentInstance()?.vnode.el != null && isOpen.value && !hosted.value && !props.isInline);
1609
- const panelState = computed(() => {
1610
- if (retained.value) return "exiting";
1611
- if (open.value) return "open";
1612
- if (props.isInline || hosted.value) return "hidden";
1613
- return isPresented.value ? "exiting" : "hidden";
1614
- });
1615
- const isDismissible = computed(() => props.purpose === "info");
1616
- const isSwipeDismissAllowed = computed(() => props.purpose === "info" && !props.isInline);
1617
- const scrimFade = ref(null);
1618
- const isClosing = computed(() => !isOpen.value && isPresented.value);
1619
- const dialogStyle = computed(() => ({
1620
- "--_sheet-scrim-opacity": isClosing.value ? "0" : String(scrimOpacity.value),
1621
- "--_sheet-scrim-duration": scrimFade.value == null ? void 0 : `${scrimFade.value.durationMs}ms`,
1622
- "--_sheet-scrim-easing": scrimFade.value?.easing
1623
- }));
1624
- useFocusTrap({
1625
- container: computed(() => panelElement()),
1626
- isEnabled: computed(() => !hosted.value && isOpen.value && props.hasScrim)
1627
- });
1628
- useRestoreFocus({
1629
- isEnabled: computed(() => !props.isInline && !hosted.value),
1630
- shouldRestore: isOpen,
1631
- preventScroll: true
1632
- });
1633
- /** The dialog carries the accessible name; the panel keeps every other attribute. */
1634
- const dialogLabel = computed(() => {
1635
- if (attrs["aria-labelledby"] != null) return void 0;
1636
- return attrs["aria-label"] ?? props.label;
1637
- });
1638
- const labelledBy = computed(() => attrs["aria-labelledby"]);
1639
- function panelAttrs() {
1640
- const { "aria-label": _label, "aria-labelledby": _labelledBy, ...rest } = attrs;
1641
- return rest;
1642
- }
1643
- const isScrollLocked = ref(false);
1644
- useScrollLock(isScrollLocked);
1645
- function lockScroll() {
1646
- if (typeof document === "undefined") return;
1647
- isScrollLocked.value = true;
1648
- }
1649
- function unlockScroll() {
1650
- if (typeof document === "undefined") return;
1651
- isScrollLocked.value = false;
1652
- }
1653
- function panelElement() {
1654
- return panel.value?.element ?? null;
1655
- }
1656
- function focusPanel() {
1657
- if (typeof document === "undefined") return;
1658
- focusSheetOnOpen(panelElement(), props.hasScrim);
1659
- }
1660
- let focusRecord = null;
1661
- const modalOutlet = createModalOutletHandle();
1662
- function openSheet() {
1663
- if (props.isInline || typeof document === "undefined") return;
1664
- const dialogElement = dialog.value;
1665
- if (!dialogElement) return;
1666
- isPresented.value = true;
1667
- if (!dialogElement.open) {
1668
- focusRecord?.stop();
1669
- focusRecord = trackLayerFocus({ getLayer: () => dialog.value });
1670
- if (props.hasScrim) {
1671
- dialogElement.showModal();
1672
- isModalShown.value = true;
1673
- if (!hosted.value) modalOutlet.attach(dialogElement);
1674
- } else dialogElement.show();
1675
- }
1676
- if (props.hasScrim) lockScroll();
1677
- focusPanel();
1678
- }
1679
- function closeSheet() {
1680
- modalOutlet.detach();
1681
- dialog.value?.close();
1682
- unlockScroll();
1683
- isPresented.value = false;
1684
- isModalShown.value = false;
1685
- focusRecord?.stop();
1686
- focusRecord = null;
1687
- const target = toValue(props.finalFocusRef);
1688
- if (target?.isConnected) focusForLastInput(target, { preventScroll: true });
1689
- }
1690
- const layer = useSheetLayerDismiss({
1691
- isActive: computed(() => !hosted.value && !props.isInline && (isOpen.value || isPresented.value)),
1692
- escape: computed(() => {
1693
- if (!isOpen.value || props.purpose === "required" || !isEscapeAllowed()) return "block";
1694
- if (!props.hasScrim) return "ignore";
1695
- return "close";
1696
- }),
1697
- getContainer: () => dialog.value ?? null,
1698
- isPresent: () => dialog.value?.open ?? false,
1699
- onDismiss: () => {
1700
- if (!isOpen.value || props.purpose === "required") return;
1701
- requestClose();
1702
- }
1703
- });
1704
- function requestClose() {
1705
- if (hosted.value && props.sheetId != null) {
1706
- if (switcher?.activeId.value === props.sheetId) switcher.setActive(null);
1707
- emit("openChange", false);
1708
- return;
1709
- }
1710
- isOpen.value = false;
1711
- emit("openChange", false);
1712
- }
1713
- function dismissOnEscape() {
1714
- if (props.purpose === "required" || !isEscapeAllowed()) return;
1715
- requestClose();
1716
- }
1717
- function onKeydown(event) {
1718
- if (event.key !== "Escape" || !layer.isTop()) return;
1719
- event.preventDefault();
1720
- if (isImeKeyEvent(event)) return;
1721
- dismissOnEscape();
1722
- }
1723
- function onCancel(event) {
1724
- if (event.target !== dialog.value) return;
1725
- event.preventDefault();
1726
- if (!layer.isTop()) return;
1727
- dismissOnEscape();
1728
- }
1729
- function onDialogClick(event) {
1730
- if (event.target !== event.currentTarget) return;
1731
- if (props.hasScrim && isDismissible.value) requestClose();
1732
- }
1733
- function onPanelMotionComplete(motion) {
1734
- emit("motionComplete", motion);
1735
- if (motion === "exiting") closeSheet();
1736
- }
1737
- watch(isOpen, (value) => {
1738
- if (hosted.value || !value) return;
1739
- openSheet();
1740
- }, { flush: "post" });
1741
- watch(isOpen, (value) => {
1742
- if (value) {
1743
- scrimOpacity.value = 1;
1744
- return;
1745
- }
1746
- isSettled.value = false;
1747
- isModalShown.value = false;
1748
- });
1749
- const isExiting = computed(() => !hosted.value && !props.isInline && !isOpen.value && isPresented.value);
1750
- let releaseExitHold = null;
1751
- watch(isExiting, (exiting) => {
1752
- releaseExitHold?.();
1753
- releaseExitHold = null;
1754
- const element = dialog.value;
1755
- if (exiting && element != null) releaseExitHold = holdKeptInside(element, new Promise(() => {}));
1756
- }, { flush: "post" });
1757
- onMounted(() => {
1758
- if (hosted.value && props.sheetId != null) {
1759
- switcher?.register(props.sheetId, {
1760
- getElement: () => panelElement(),
1761
- label: () => props.label,
1762
- purpose: () => props.purpose
1763
- });
1764
- return;
1765
- }
1766
- if (isOpen.value) openSheet();
1767
- });
1768
- onBeforeUnmount(() => {
1769
- const record = focusRecord;
1770
- focusRecord = null;
1771
- if (record != null) {
1772
- const wasStranded = isLayerFocusStranded(record, dialog.value);
1773
- queueMicrotask(() => {
1774
- if (wasStranded) restoreLayerFocus(record, {
1775
- layer: null,
1776
- name: "BottomSheet"
1777
- });
1778
- record.stop();
1779
- });
1780
- }
1781
- releaseExitHold?.();
1782
- releaseExitHold = null;
1783
- modalOutlet.detach();
1784
- if (props.sheetId != null) switcher?.unregister(props.sheetId);
1785
- unlockScroll();
1786
- });
1787
- __expose({
1788
- element: computed(() => panelElement()),
1789
- focus: (options) => panelElement()?.focus(options),
1790
- blur: () => panelElement()?.blur()
1791
- });
1792
- return (_ctx, _cache) => {
1793
- return hosted.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [open.value ? (openBlock(), createElementBlock("div", {
1794
- key: 0,
1795
- class: normalizeClass(["astryx-bottom-sheet__positioner", retained.value ? "astryx-bottom-sheet__positioner--retained" : "astryx-bottom-sheet__positioner--active"]),
1796
- style: normalizeStyle(retained.value ? { "--_sheet-align": `${unref(switcher)?.alignmentOffset.value ?? 0}px` } : void 0),
1797
- inert: retained.value || void 0
1798
- }, [createVNode(_sfc_main$1, mergeProps({
1799
- ref_key: "panel",
1800
- ref: panel
1801
- }, panelAttrs(), {
1802
- state: panelState.value,
1803
- label: __props.label,
1804
- height: __props.height,
1805
- padding: __props.padding,
1806
- "snap-points": __props.snapPoints,
1807
- "is-swipe-dismiss-allowed": __props.purpose === "info",
1808
- onDismiss: requestClose,
1809
- onSnap: _cache[0] || (_cache[0] = ($event) => emit("snap", $event)),
1810
- onMotionStart: _cache[1] || (_cache[1] = ($event) => emit("motionStart", $event)),
1811
- onMotionComplete: _cache[2] || (_cache[2] = ($event) => emit("motionComplete", $event))
1812
- }), {
1813
- default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1814
- _: 3
1815
- }, 16, [
1816
- "state",
1817
- "label",
1818
- "height",
1819
- "padding",
1820
- "snap-points",
1821
- "is-swipe-dismiss-allowed"
1822
- ])], 14, _hoisted_1)) : createCommentVNode("v-if", true)], 64)) : __props.isInline ? (openBlock(), createElementBlock("div", _hoisted_2, [isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(_sfc_main$1, mergeProps({
1823
- ref_key: "panel",
1824
- ref: panel
1825
- }, panelAttrs(), {
1826
- state: panelState.value,
1827
- label: __props.label,
1828
- height: __props.height,
1829
- padding: __props.padding,
1830
- "snap-points": __props.snapPoints,
1831
- "is-swipe-dismiss-allowed": false,
1832
- onSnap: _cache[3] || (_cache[3] = ($event) => emit("snap", $event))
1833
- }), {
1834
- default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1835
- _: 3
1836
- }, 16, [
1837
- "state",
1838
- "label",
1839
- "height",
1840
- "padding",
1841
- "snap-points"
1842
- ])])) : createCommentVNode("v-if", true)])) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" eslint-disable-next-line vue-a11y/no-static-element-interactions -- 点在 dialog 自身上等于点遮罩;键盘走原生 cancel 和下面的 keydown。 "), createElementVNode("dialog", {
1843
- ref_key: "dialog",
1844
- ref: dialog,
1845
- class: normalizeClass(["astryx-bottom-sheet-dialog", {
1846
- "astryx-bottom-sheet-dialog--scrim": __props.hasScrim,
1847
- "astryx-bottom-sheet-dialog--closing": isClosing.value
1848
- }]),
1849
- "data-settled": isSettled.value || void 0,
1850
- "aria-label": dialogLabel.value,
1851
- "aria-labelledby": labelledBy.value,
1852
- "aria-modal": __props.hasScrim && isModalShown.value ? "true" : void 0,
1853
- role: __props.purpose === "required" ? "alertdialog" : void 0,
1854
- style: normalizeStyle(dialogStyle.value),
1855
- onCancel,
1856
- onClick: onDialogClick,
1857
- onKeydown
1858
- }, [
1859
- createElementVNode("div", _hoisted_5, [createVNode(_sfc_main$1, mergeProps({
1860
- ref_key: "panel",
1861
- ref: panel
1862
- }, panelAttrs(), {
1863
- state: panelState.value,
1864
- label: __props.label,
1865
- height: __props.height,
1866
- padding: __props.padding,
1867
- "snap-points": __props.snapPoints,
1868
- "is-swipe-dismiss-allowed": isSwipeDismissAllowed.value,
1869
- onDismiss: requestClose,
1870
- onScrimOpacity: _cache[4] || (_cache[4] = ($event) => scrimOpacity.value = $event),
1871
- onScrimFade: _cache[5] || (_cache[5] = ($event) => scrimFade.value = $event),
1872
- onSnap: _cache[6] || (_cache[6] = ($event) => emit("snap", $event)),
1873
- onMotionStart: _cache[7] || (_cache[7] = ($event) => emit("motionStart", $event)),
1874
- onMotionComplete: onPanelMotionComplete
1875
- }), {
1876
- default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1877
- _: 3
1878
- }, 16, [
1879
- "state",
1880
- "label",
1881
- "height",
1882
- "padding",
1883
- "snap-points",
1884
- "is-swipe-dismiss-allowed"
1885
- ])]),
1886
- _cache[8] || (_cache[8] = createElementVNode("div", {
1887
- class: "astryx-bottom-sheet__edge-tint",
1888
- "aria-hidden": "true"
1889
- }, null, -1)),
1890
- createElementVNode("div", _hoisted_6, null, 512)
1891
- ], 46, _hoisted_4)], 2112));
1892
- };
1893
- }
1894
- });
1895
- //#endregion
1896
- export { focusSheetOnOpen as a, bottomSheetSwitcherKey as i, _sfc_main as n, useSheetLayerDismiss as r, BottomSheet_exports as t };