@astryx-vue/core 0.36.1 → 0.37.0

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