@astryx-vue/core 0.30.0 → 0.30.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.
- package/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-D_lrpZz_.js → AlertDialog-B_p1yL3k.js} +7 -7
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-CxUmt6hX.js → AppShell-D3KZSLvb.js} +5 -5
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-DT5RbxDa.js → AvatarGroup-Dd-yDDNz.js} +2 -2
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-Ctg1puM6.js → Banner-DKmvoMxD.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.js +2 -2
- package/dist/{BottomSheet-CmNOXlZO.js → BottomSheet-Btf8Yn8k.js} +845 -276
- package/dist/{BottomSheet-_K41Oliv.js → BottomSheet-CQGtoh2x.js} +1 -1
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-CdGqhFKU.js → Breadcrumbs-D6825HQI.js} +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-CvHeZGf1.js → Button-DdPty46q.js} +2 -2
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/ButtonGroup/index.js +1 -1
- package/dist/{ButtonGroup-CUN_rC57.js → ButtonGroup-oI99JAyN.js} +3 -3
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-CbdHb8MD.js → Carousel-BNr79JpP.js} +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-B7ccEmTR.js → Chat-BadS0fEx.js} +2 -2
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-5r6VWqId.js → CheckboxInput-CzP8gP3v.js} +3 -3
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxListItem-CKeQzQ0W.js → CheckboxListItem-CxBjpX3d.js} +4 -4
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/ClickableCard/index.js +1 -1
- package/dist/{ClickableCard-ChmOwgYq.js → ClickableCard-B86P2aiM.js} +1 -1
- package/dist/Code/index.js +1 -1
- package/dist/{CodeBlock-4i1vvmOc.js → CodeBlock-Cgm4uOhG.js} +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-B2vrr_YP.js → Collapsible-CfTN722D.js} +3 -3
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-BMwvTjff.js → CommandPalette-BgVwGtdA.js} +2 -2
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-B4iFyilD.js → ComplexSelector-DqWJVx7H.js} +2 -2
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-DquYeIEF.js → ContextMenu-C9dJGu3M.js} +3 -3
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-MNNyi4XK.js → DateInput-CGKaozkw.js} +3 -3
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-DOHntScL.js → DateRangeInput-BVHXgzXz.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-BaghFHW6.js → DateTimeInput-DRm3lekJ.js} +5 -5
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-Ctha_b_L.js → Dialog-BN-NycQr.js} +1 -1
- package/dist/{Dialog-CGf64DqF.js → Dialog-Dt0gNuMT.js} +1 -1
- package/dist/{DialogHeader-BxTV37GT.js → DialogHeader-CSH2_5v-.js} +2 -2
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-DAnc2ut9.js → Drawer-PeMgE4iA.js} +2 -2
- package/dist/DropdownMenu/index.js +3 -3
- package/dist/{DropdownMenu-BPi0pm0w.js → DropdownMenu-C9bvYZPt.js} +5 -5
- package/dist/{DropdownMenu-DuSVFQoS.js → DropdownMenu-_lQQyQCn.js} +6 -6
- package/dist/Field/index.js +3 -3
- package/dist/{Field-d5R_kRMv.js → Field-D-fRqyso.js} +1 -1
- package/dist/{FieldInfoTip-BhKtjq3g.js → FieldInfoTip-Bstp5Lvd.js} +1 -1
- package/dist/{FieldLabel-BHNpYFx7.js → FieldLabel-lV_qLaGp.js} +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-BCg4HROm.js → FileInput-CTNnDIkm.js} +3 -3
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-BZgU_THt.js → IconButton-DPezhVBA.js} +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-E2-OzKti.js → InfoTip-B4BFfLtT.js} +1 -1
- package/dist/{InputClearButton-B62_uexC.js → InputClearButton-CxU3iv-5.js} +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-DKBqRYFf.js → InputGroup-CraWGK6Y.js} +1 -1
- package/dist/{Item-C8UAQwFQ.js → Item-C9u_kQUO.js} +15 -14
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-Bou1gTfv.js → Lightbox-BNUG9CQ1.js} +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-CaJ5lmKk.js → Link-Bwgpn-di.js} +1 -1
- package/dist/List/index.js +2 -2
- package/dist/{ListItem-BlrEngDO.js → ListItem-_lOmngHp.js} +2 -2
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-BE6vdvPG.js → Markdown-BlEi5UGN.js} +2 -2
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-D5yGMHU4.js → MobileNavToggle-wVa9dzH1.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-CNzTagqr.js → MoreMenu-MmvMRWv5.js} +3 -3
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-MGEiRi1W.js → MultiSelector-DXrKQLmq.js} +4 -4
- package/dist/NavItem/index.js +1 -1
- package/dist/{NavItem-kj9FbbFS.js → NavItem-D4xHjSTo.js} +1 -1
- package/dist/NavMenu/index.js +2 -2
- package/dist/{NavMenu-ZN5cqCxO.js → NavMenu-NCg3VjAQ.js} +2 -2
- package/dist/{NavMenuItem-xm3e0V8q.js → NavMenuItem-Bla6fYVl.js} +3 -3
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-D4ECOHh_.js → NumberInput-DicgvFte.js} +3 -3
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-DI9MZnuQ.js → Outline-DlO_97b4.js} +3 -3
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-m1tf_fR1.js → OverflowList-BYYz3ePw.js} +1 -1
- package/dist/Overlay/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BdjxuxM3.js → Pagination-DM_W9Ue-.js} +3 -3
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-DEj8xWN-.js → Popover-CxReY-4u.js} +5 -5
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-BJDFietK.js → PowerSearch-BwUWZG3p.js} +19 -19
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-B3UoJrOA.js → RadioGroup-CsJYGjyx.js} +3 -3
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioListItem-CD7kUGlN.js → RadioListItem-Yc3K82YE.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.js +1 -1
- package/dist/{SegmentedControl-DGd6JlaD.js → SegmentedControl-C-F5dkcG.js} +2 -2
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/SelectableCard/index.js +1 -1
- package/dist/{SelectableCard-GRWYx3iD.js → SelectableCard-CwfpgsS8.js} +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-BD0u-5Fy.js → Selector-bH99g1vj.js} +2 -2
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +2 -2
- package/dist/{SideNav-DoqCLRiX.js → SideNav-C1ZxusAB.js} +6 -6
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-DHR7HZ7N.js → Slider-Bq_7Nskr.js} +2 -2
- package/dist/Stepper/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-CCuggsov.js → Stepper-CWluGqBs.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-CnFC7jGw.js → Switch-DTPvMAxd.js} +2 -2
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-fMlX8m6n.js → TabList-C4i7UZkp.js} +3 -3
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-DoKmVdhZ.js → Table-ClHIgsKO.js} +13 -13
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-y9mmYAIy.js → TextArea-J2_wct0p.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-BLGEh7vE.js → TextInput-Da1TYd57.js} +4 -4
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-Dm8krgGF.js → Thumbnail-1LsaJ4_m.js} +2 -2
- package/dist/{TimeField-DS30hnty.js → TimeField-i5ESA500.js} +2 -2
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-DcY4b3dg.js → TimeInput-frnKZo1M.js} +2 -2
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-BhBuBHu8.js → Timestamp-SseS_qtf.js} +1 -1
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-CnLk7LzS.js → Toast-tAq4S96S.js} +149 -20
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-B9IJcpdJ.js → ToggleButton-B6hBzeVl.js} +3 -3
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-C7Dt5ygK.js → Token-DTGUCgpn.js} +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-D7ZCTbnf.js → Tokenizer-iFZAuIwu.js} +7 -7
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Toolbar/index.js +1 -1
- package/dist/{Toolbar-DSWH8ll4.js → Toolbar-BHkPxDxA.js} +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-CK_F6Ud5.js → TopNav-CcIayfsW.js} +4 -4
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-Dh0uAj2B.js → TreeList-Da_OKrv_.js} +4 -4
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-Cs-46obm.js → Typeahead-BD6xXNKh.js} +3 -3
- package/dist/VelocityTracker-DgjmootV.js +165 -0
- package/dist/{animator-BGq5a6vT.js → animator-CEHDYTfQ.js} +29 -173
- package/dist/{batch-BhaAWUIt.js → batch-D2a2MsSW.js} +4 -19
- package/dist/bezier-Dko5MnTp.js +37 -0
- package/dist/{clickGuard-FrlnECMp.js → clickGuard-C3VmOLhI.js} +2 -1
- package/dist/composables/index.js +7 -7
- package/dist/composables-Bs0O_SRd.js +2548 -0
- package/dist/{context-jtpQfR6F.js → context-NKb_prrS.js} +2 -2
- package/dist/{edge-CJIswPTX.js → edge-tj-cLZYh.js} +1 -1
- package/dist/{edgeRide-Drk4V-MC.js → edgeRide-DcUqLXE2.js} +4 -4
- package/dist/{handle-BazRxHwq.js → handle-CwxCHapJ.js} +1 -1
- package/dist/{holdEntranceInput-DMCOeRqu.js → holdEntranceInput-DgimbgGm.js} +1 -1
- package/dist/{index-BVeTS-R5.d.ts → index-3qz8Qztx.d.ts} +4 -4
- package/dist/{index-Q1oG9yIT.d.ts → index-B-3EGjfQ.d.ts} +2 -2
- package/dist/{index-C1e8LNx2.d.ts → index-BjqoHLMq.d.ts} +1 -1
- package/dist/{index-DQ3akoRZ.d.ts → index-Bu4R0WZA.d.ts} +3 -3
- package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
- package/dist/{index-BL9fE6gs.d.ts → index-Cw4CUe06.d.ts} +5 -5
- package/dist/{index-CUuUoX3h.d.ts → index-JE1HrzdJ.d.ts} +3 -3
- package/dist/{index-hUa5oQ5O.d.ts → index-m3DOxOw6.d.ts} +42 -42
- package/dist/index.d.ts +9 -9
- package/dist/index.js +85 -85
- package/dist/{inputHold-BmChuR9x.js → inputHold-DW2LYHb5.js} +4 -4
- package/dist/{inputHoldState-pblUT4oh.js → inputHoldState-xntIqr5W.js} +2 -1
- package/dist/{inputStream-LZdK8luP.js → inputStream-bPd9eB2b.js} +2 -49
- package/dist/isRtlElement-NHuH48AA.js +23 -0
- package/dist/{landing-CBaXCGEg.js → landing-Bi7X7w_7.js} +3 -3
- package/dist/{lazyBottomSheet-Cmd-WMEE.js → lazyBottomSheet-BVZ1yH8g.js} +1 -1
- package/dist/{timing-CSHWQbTJ.js → linearEasing-ScK9LqAY.js} +30 -1
- package/dist/{bezier-Df-yGuNZ.js → presentation-Cy_yf56y.js} +2 -39
- package/dist/{pressFeedback-DVR5V1b6.js → pressFeedback-9dqGYjxv.js} +2 -2
- package/dist/{resolveMotion-CurhYTVC.js → resolveMotion-1cwESYvK.js} +202 -1
- package/dist/resolveSnapPoint-DdZyBkT4.js +717 -0
- package/dist/{flatTree-BB4yPMNL.js → sharedRealm-H1OrlP0V.js} +49 -1
- package/dist/{themeTiming-BFDOPRjK.js → themeTiming-NUkH9HsU.js} +1 -1
- package/dist/{touchHold-CFJlSClt.js → touchHold-DXtx7npm.js} +1 -1
- package/dist/{useActionGroupTracking-C6BzQzvp.js → useActionGroupTracking-CLFF7FI2.js} +2 -2
- package/dist/{useAnimatedLayout-DC2l3WrE.js → useAnimatedLayout-DWWc31RR.js} +1 -1
- package/dist/{composables-BTRbNgmR.js → useAttachment-BuNyeUXy.js} +44 -3464
- package/dist/{useChatStreamScroll-Cv51kRT0.js → useChatStreamScroll-CuMzkXgD.js} +1 -1
- package/dist/{useInputStatusIcon-BngSzjVd.js → useInputStatusIcon-BqV6YzTV.js} +1 -1
- package/dist/{useListFocus-CkHfsZp0.js → useListFocus-Ccd_HU9T.js} +2 -23
- package/dist/{useMenuDrillIn-BQx6lQMz.js → useMenuDrillIn-Cj6MM77J.js} +1 -1
- package/dist/{useMenuEntranceHold-buV5S9yk.js → useMenuEntranceHold-HznOwIry.js} +1 -1
- package/dist/{useMenuHover-CfQtWMg-.js → useMenuHover-DoBatZeD.js} +1 -1
- package/dist/{useMenuPress-DU6pAIHy.js → useMenuPress-DcwVUsQO.js} +3 -3
- package/dist/{usePressFeedback-BhNcuxQv.js → usePressFeedback-DHdmAsMp.js} +1 -1
- package/dist/{useTouchHitArea-CNZyA18Y.js → useTouchHitArea-SY1ITxSJ.js} +2 -2
- package/package.json +1 -1
- package/styles/bottom-sheet.css +28 -8
- package/dist/{index-D8lv2BiD.d.ts → index-BqhgeAT4.d.ts} +1 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as deepActiveElement, h as isNode, m as isHTMLElement, s as containsAlongFlatTree } from "./sharedRealm-H1OrlP0V.js";
|
|
2
|
+
import { i as defaultPrefersReducedMotion, n as resolveMoveTiming } from "./resolveMotion-1cwESYvK.js";
|
|
3
|
+
import { p as scroll } from "./pressGesture-BzIBmKF2.js";
|
|
2
4
|
import { r as resetLayerScopedContext } from "./scopedProvide-C-Df7c15.js";
|
|
3
5
|
import { r as provideNestedLayerMountTarget } from "./mount-7R_s-bHB.js";
|
|
4
6
|
import { i as isTopLayer, n as useLayerDepth, o as pushLayer, s as isImeKeyEvent, t as provideLayerDepth } from "./layerDepth-D3Rh8T5C.js";
|
|
7
|
+
import { t as useMediaQuery } from "./useMediaQuery-BzXGT1Aw.js";
|
|
8
|
+
import { r as SETTLE_THRESHOLD, t as animatorFor } from "./animator-CEHDYTfQ.js";
|
|
9
|
+
import { r as springs, t as resolveSnapPoint } from "./resolveSnapPoint-DdZyBkT4.js";
|
|
10
|
+
import { t as VelocityTracker } from "./VelocityTracker-DgjmootV.js";
|
|
5
11
|
import { t as focusForLastInput } from "./focusReturn-DfZS7TCp.js";
|
|
6
12
|
import { t as useFocusTrap } from "./useFocusTrap-BD9POtMp.js";
|
|
7
13
|
import { t as useRestoreFocus } from "./useRestoreFocus-DS7uQWok.js";
|
|
@@ -12,7 +18,7 @@ import { t as createModalOutletHandle } from "./modalOutlet-Drr9a16b.js";
|
|
|
12
18
|
import { o as provideLayoutContainer } from "./context-D-Hwh-Jf.js";
|
|
13
19
|
import { t as useScrollbars } from "./useScrollbars-Ch0xqJWO.js";
|
|
14
20
|
import { t as bottomSheetEscapeKey } from "./escape-DzSxSmez.js";
|
|
15
|
-
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, inject, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, onUpdated, openBlock, provide, ref, renderSlot, toValue, unref, useAttrs, useModel, useTemplateRef, watch, withCtx } from "vue";
|
|
21
|
+
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";
|
|
16
22
|
import "../styles/bottom-sheet.css";
|
|
17
23
|
//#region \0rolldown/runtime.js
|
|
18
24
|
var __defProp = Object.defineProperty;
|
|
@@ -120,6 +126,82 @@ function holdKeptInside(layer, until) {
|
|
|
120
126
|
return release;
|
|
121
127
|
}
|
|
122
128
|
//#endregion
|
|
129
|
+
//#region src/BottomSheet/sheetDragExit.ts
|
|
130
|
+
/** How many more frames a drag's close looks for its scrim's fade to adopt. */
|
|
131
|
+
const MAX_SCRIM_FADE_ADOPT_FRAMES = 3;
|
|
132
|
+
/** Without Web Animations the animator jumps to its end, so the stylesheet's exit runs instead. */
|
|
133
|
+
function supportsWebAnimations() {
|
|
134
|
+
return typeof Element !== "undefined" && typeof Element.prototype.animate === "function";
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* How a drag's close plays: the close spring's move from where the finger
|
|
138
|
+
* left the sheet, timed as the shared animator times it, and its progress
|
|
139
|
+
* toward the point where the sheet leaves view. The surface reaches below the
|
|
140
|
+
* screen (the reserve), so it leaves view before the spring settles, and the
|
|
141
|
+
* scrim is clear by then.
|
|
142
|
+
*/
|
|
143
|
+
function dragExitFade(element, exit) {
|
|
144
|
+
const viewportHeight = element.ownerDocument.defaultView?.innerHeight ?? 0;
|
|
145
|
+
const shown = Math.max(0, viewportHeight - element.getBoundingClientRect().top);
|
|
146
|
+
return resolveMoveTiming(element, springs.sheetDismissSwipe, {
|
|
147
|
+
from: 0,
|
|
148
|
+
to: exit.distance,
|
|
149
|
+
velocity: exit.velocity,
|
|
150
|
+
epsilon: SETTLE_THRESHOLD.y
|
|
151
|
+
}, Math.min(exit.distance, shown));
|
|
152
|
+
}
|
|
153
|
+
/** The running fade that clears the scrim behind `panel`, if any. */
|
|
154
|
+
function clearingScrimFade(panel) {
|
|
155
|
+
const dialog = panel.closest("dialog");
|
|
156
|
+
const doc = panel.ownerDocument;
|
|
157
|
+
if (dialog == null || typeof doc.getAnimations !== "function") return void 0;
|
|
158
|
+
const fades = doc.getAnimations().filter((animation) => {
|
|
159
|
+
const effect = animation.effect;
|
|
160
|
+
return effect?.target === dialog && animation.transitionProperty === "opacity" && Number(effect.getKeyframes().at(-1)?.opacity) === 0;
|
|
161
|
+
});
|
|
162
|
+
const onBackdrop = fades.filter((fade) => fade.effect.pseudoElement === "::backdrop");
|
|
163
|
+
return (onBackdrop.length > 0 ? onBackdrop : fades.filter((fade) => !fade.effect.pseudoElement)).at(-1);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Plays a touch drag's close on the shared animator with the dismiss swipe's
|
|
167
|
+
* spring, from the release speed. The scrim's CSS fade takes the close's start
|
|
168
|
+
* time, so the two end together. Returns the cleanup: a reopen during the
|
|
169
|
+
* exit takes the sheet back from where it is.
|
|
170
|
+
*/
|
|
171
|
+
function playDragExit(element, exit, callbacks) {
|
|
172
|
+
const handle = animatorFor(element).animate({ y: exit.distance }, {
|
|
173
|
+
spring: springs.sheetDismissSwipe,
|
|
174
|
+
velocity: { y: exit.velocity }
|
|
175
|
+
});
|
|
176
|
+
let isCurrent = true;
|
|
177
|
+
let isFinished = false;
|
|
178
|
+
let frame = null;
|
|
179
|
+
handle.started.then((start) => {
|
|
180
|
+
const adopt = (framesLeft) => {
|
|
181
|
+
frame = null;
|
|
182
|
+
if (!isCurrent) return;
|
|
183
|
+
const fade = clearingScrimFade(element);
|
|
184
|
+
if (fade != null) fade.startTime = start;
|
|
185
|
+
else if (framesLeft > 0 && typeof requestAnimationFrame === "function") frame = requestAnimationFrame(() => adopt(framesLeft - 1));
|
|
186
|
+
};
|
|
187
|
+
adopt(MAX_SCRIM_FADE_ADOPT_FRAMES);
|
|
188
|
+
});
|
|
189
|
+
handle.finished.then(() => {
|
|
190
|
+
isFinished = true;
|
|
191
|
+
callbacks.onSettled();
|
|
192
|
+
if (isCurrent) callbacks.complete();
|
|
193
|
+
});
|
|
194
|
+
return () => {
|
|
195
|
+
isCurrent = false;
|
|
196
|
+
if (frame != null) cancelAnimationFrame(frame);
|
|
197
|
+
if (!isFinished) handle.retarget({ y: 0 });
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** A hidden sheet can stay mounted, so the exit's offset goes back to 0. */
|
|
201
|
+
function resetDragExit(element) {
|
|
202
|
+
animatorFor(element).set({ y: 0 });
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
123
205
|
//#region src/BottomSheet/sheetTransition.ts
|
|
124
206
|
const BACKSTOP_BUFFER_MS = 50;
|
|
125
207
|
function parseTransitionTime(value) {
|
|
@@ -276,14 +358,49 @@ function resolveSettleOffset(value, offsets, dir, baseOffset) {
|
|
|
276
358
|
function visibleHeightForOffset(sheetHeight, offset, offscreenBlockEndInset) {
|
|
277
359
|
return Math.max(0, sheetHeight - offscreenBlockEndInset - offset);
|
|
278
360
|
}
|
|
279
|
-
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/motion/rubberBand.ts
|
|
363
|
+
/**
|
|
364
|
+
* @file rubberBand.ts
|
|
365
|
+
* @input An overflow past an edge, the scroll view's dimension and UIKit's
|
|
366
|
+
* rubber-band coefficient
|
|
367
|
+
* @output Exports `rubberBand` (finger overflow → displayed overflow), its
|
|
368
|
+
* inverse, its slope, and the clamp/unclamp pair over a [min, max] range
|
|
369
|
+
* @position Pure math; no DOM, no React
|
|
370
|
+
*
|
|
371
|
+
* UIScrollView resists a drag past its content edge with
|
|
372
|
+
* b = (1 − 1 ÷ (x·c ÷ d + 1))·d
|
|
373
|
+
* where x is how far the finger has gone past the edge, d the scroll view's
|
|
374
|
+
* size on that axis and c = 0.55 (uikit/scroll.ts records the sources). The
|
|
375
|
+
* displayed overflow b approaches d but never reaches it, and its slope at
|
|
376
|
+
* the edge is c: the first points of overflow move at 55 % of the finger.
|
|
377
|
+
*
|
|
378
|
+
* The inverse matters for spec:AST-094 FR6 (a finger catches any animation
|
|
379
|
+
* mid-flight): a finger that lands on content still bouncing back has to
|
|
380
|
+
* resume the drag from the finger position that would produce the overflow
|
|
381
|
+
* on screen, or the content jumps.
|
|
382
|
+
*/
|
|
383
|
+
/**
|
|
384
|
+
* Displayed overflow for a finger `overflow` past the edge (signed: the sign
|
|
385
|
+
* is kept). `dimension` is the scroll view's size on the axis.
|
|
386
|
+
*/
|
|
387
|
+
function rubberBand(overflow, dimension, coefficient = scroll.rubberBand.coefficient) {
|
|
388
|
+
if (!(dimension > 0)) return 0;
|
|
389
|
+
const banded = (1 - 1 / (Math.abs(overflow) * coefficient / dimension + 1)) * dimension;
|
|
390
|
+
return overflow < 0 ? -banded : banded;
|
|
391
|
+
}
|
|
392
|
+
/** On a touch device the reserve covers a pull of the whole viewport: 40% of it. */
|
|
393
|
+
const RESERVE_VIEWPORT_SHARE = .4;
|
|
394
|
+
/** Below the shortest stop, a slow mouse drag past this share of its height dismisses. */
|
|
280
395
|
const DISMISS_OVERSHOOT_RATIO = .4;
|
|
281
396
|
/** Within this many px of a stop the live drag eases toward it. */
|
|
282
397
|
const MAGNET_RANGE = 40;
|
|
283
|
-
/**
|
|
398
|
+
/** A mouse's or a pen's stretch past fully open: a resisted fraction, capped at MIN_RESERVE. */
|
|
284
399
|
const OVERSCROLL_RESISTANCE = .35;
|
|
285
|
-
|
|
286
|
-
|
|
400
|
+
/** The reserve a sheet keeps on a touch device whose layout viewport is `viewportHeight` tall. */
|
|
401
|
+
function sheetReserve(viewportHeight) {
|
|
402
|
+
return Math.max(48, Math.ceil(viewportHeight * RESERVE_VIEWPORT_SHARE));
|
|
403
|
+
}
|
|
287
404
|
/**
|
|
288
405
|
* Whether a gesture that lands on `target` began inside another layer rendered
|
|
289
406
|
* in this sheet's content: a `<dialog>` between the target and the body.
|
|
@@ -296,10 +413,6 @@ function isInsideNestedLayer(target, body) {
|
|
|
296
413
|
for (let element = target instanceof Element ? target : null; element != null && element !== body; element = element.parentElement) if (element.localName === "dialog") return true;
|
|
297
414
|
return false;
|
|
298
415
|
}
|
|
299
|
-
/** Scroll edges a body gesture may arm on, or `null` when the gesture belongs to a nested layer. */
|
|
300
|
-
function armingEdges(body, target) {
|
|
301
|
-
return isInsideNestedLayer(target, body) ? null : blockScrollEdges(body, target);
|
|
302
|
-
}
|
|
303
416
|
function magnetize(value, targets) {
|
|
304
417
|
if (targets.length === 0) return value;
|
|
305
418
|
let nearest = targets[0];
|
|
@@ -309,6 +422,19 @@ function magnetize(value, targets) {
|
|
|
309
422
|
const t = distance / MAGNET_RANGE;
|
|
310
423
|
return value + (nearest - value) * (1 - t * t);
|
|
311
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* The offset a drag shows for the raw offset `raw` under the finger. Past
|
|
427
|
+
* fully open, a finger stretches on UIKit's rubber band over the visible
|
|
428
|
+
* height and never past the reserve; a mouse or a pen moves a resisted
|
|
429
|
+
* fraction capped at MIN_RESERVE. Past the shortest stop nothing pulls, so it
|
|
430
|
+
* never fights a drag to close. Between stops, the drag eases into a stop
|
|
431
|
+
* within MAGNET_RANGE.
|
|
432
|
+
*/
|
|
433
|
+
function stretchedOffset(raw, offsets, context) {
|
|
434
|
+
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);
|
|
435
|
+
if (raw > (offsets[offsets.length - 1] ?? 0)) return raw;
|
|
436
|
+
return magnetize(raw, offsets);
|
|
437
|
+
}
|
|
312
438
|
function renderedBlockEndPadding(element) {
|
|
313
439
|
const value = Number.parseFloat(getComputedStyle(element).paddingBlockEnd);
|
|
314
440
|
return Number.isFinite(value) ? value : 0;
|
|
@@ -324,57 +450,165 @@ function hapticTick() {
|
|
|
324
450
|
if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
|
|
325
451
|
navigator.vibrate(8);
|
|
326
452
|
}
|
|
327
|
-
/**
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
t: startT
|
|
332
|
-
};
|
|
333
|
-
const elapsed = lastT - first.t;
|
|
334
|
-
return elapsed > 0 ? (lastY - first.y) / elapsed : 0;
|
|
453
|
+
/** Offset past which a slow mouse or pen drag dismisses instead of snapping back. */
|
|
454
|
+
function dismissTravelFor(height, offsets, reserve) {
|
|
455
|
+
const maxOffset = offsets[offsets.length - 1] ?? 0;
|
|
456
|
+
return maxOffset + visibleHeightForOffset(height, maxOffset, reserve) * DISMISS_OVERSHOOT_RATIO;
|
|
335
457
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/BottomSheet/sheetScrollChain.ts
|
|
460
|
+
/**
|
|
461
|
+
* The boxes a touch on the sheet's body can scroll, and the edges they sit at.
|
|
462
|
+
*
|
|
463
|
+
* The body is where the sheet listens, but it is not always what scrolls: a
|
|
464
|
+
* host can pin a header and footer around a scrolling middle, or lay a
|
|
465
|
+
* scrolling grid inside the sheet. The browser scrolls the innermost box that
|
|
466
|
+
* has room and then chains outward, so a pull belongs to the sheet only when
|
|
467
|
+
* every box in the chain sits at the edge the pull opposes.
|
|
468
|
+
*/
|
|
469
|
+
/** A box a finger or a wheel can scroll along the block axis. */
|
|
470
|
+
function isBlockScroller(element) {
|
|
471
|
+
if (element.scrollHeight - element.clientHeight <= 1) return false;
|
|
472
|
+
const { overflowY } = getComputedStyle(element);
|
|
473
|
+
return overflowY === "auto" || overflowY === "scroll";
|
|
344
474
|
}
|
|
345
|
-
/**
|
|
346
|
-
function
|
|
347
|
-
const
|
|
348
|
-
|
|
475
|
+
/** Every scroller between `target` and `body`, innermost first, then the body itself. */
|
|
476
|
+
function scrollChainUnder(target, body) {
|
|
477
|
+
const chain = [];
|
|
478
|
+
for (let element = target instanceof Element ? target : null; element != null && element !== body; element = element.parentElement) if (element instanceof HTMLElement && isBlockScroller(element)) chain.push(element);
|
|
479
|
+
chain.push(body);
|
|
480
|
+
return chain;
|
|
349
481
|
}
|
|
350
|
-
|
|
351
|
-
|
|
482
|
+
/** Nothing in the chain can scroll up any further, so a pull down is the sheet's. */
|
|
483
|
+
function chainAtTop(chain) {
|
|
484
|
+
return chain.every((element) => element.scrollTop <= 0);
|
|
485
|
+
}
|
|
486
|
+
/** Nothing in the chain can scroll down any further, so a pull up is the sheet's. */
|
|
487
|
+
function chainAtBottom(chain) {
|
|
488
|
+
return chain.every((element) => element.scrollTop + element.clientHeight >= element.scrollHeight - 1);
|
|
489
|
+
}
|
|
490
|
+
/** Whether any box in the chain has content to scroll. */
|
|
491
|
+
function chainScrolls(chain) {
|
|
492
|
+
return chain.some((element) => element.scrollHeight - element.clientHeight > 1);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* iOS rubber-bands a scroller past its end even under `overscroll-behavior:
|
|
496
|
+
* contain`. While the content sits at its end mid-pull, `none` holds it still,
|
|
497
|
+
* so only the sheet moves. Returns the undo.
|
|
498
|
+
*/
|
|
499
|
+
function holdAtEnd(chain) {
|
|
500
|
+
const previous = chain.map((element) => element.style.overscrollBehaviorY);
|
|
501
|
+
for (const element of chain) element.style.overscrollBehaviorY = "none";
|
|
502
|
+
return () => {
|
|
503
|
+
chain.forEach((element, index) => {
|
|
504
|
+
element.style.overscrollBehaviorY = previous[index] ?? "";
|
|
505
|
+
});
|
|
506
|
+
};
|
|
352
507
|
}
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/BottomSheet/sheetPointerArm.ts
|
|
353
510
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
511
|
+
* The handle's drag for every pointer, and the body's pull down at its top for
|
|
512
|
+
* a mouse or a pen. A finger's pull on the body belongs to the touch listeners
|
|
513
|
+
* alone, so a touch-down never arms here.
|
|
357
514
|
*/
|
|
358
|
-
function
|
|
359
|
-
let
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
515
|
+
function createSheetPointerArm(drive) {
|
|
516
|
+
let arm = null;
|
|
517
|
+
function reset() {
|
|
518
|
+
arm = null;
|
|
519
|
+
}
|
|
520
|
+
/** A second pointer is a pinch. The browser keeps the zoom; the sheet lets go. */
|
|
521
|
+
function yieldToPinch(pointerId) {
|
|
522
|
+
const active = drive.dragPointerId();
|
|
523
|
+
if (active == null || active === pointerId) return false;
|
|
524
|
+
drive.cancel();
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
function onPointerMove(event) {
|
|
528
|
+
if (drive.dragPointerId() != null) {
|
|
529
|
+
if (drive.isTouchDrag() || yieldToPinch(event.pointerId)) return;
|
|
530
|
+
if (event.cancelable) event.preventDefault();
|
|
531
|
+
drive.move(event.clientY, event.timeStamp);
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const armed = arm;
|
|
535
|
+
if (armed == null || armed.pointerId !== event.pointerId) return;
|
|
536
|
+
const delta = event.clientY - armed.startY;
|
|
537
|
+
armed.tracker.add(0, event.clientY, event.timeStamp);
|
|
538
|
+
if (delta > 8 && chainAtTop(armed.scrollers)) {
|
|
539
|
+
arm = null;
|
|
540
|
+
drive.begin({
|
|
541
|
+
pointerId: armed.pointerId,
|
|
542
|
+
pointerType: armed.pointerType,
|
|
543
|
+
startY: armed.startY,
|
|
544
|
+
tracker: armed.tracker
|
|
545
|
+
}, event.clientY, event.timeStamp);
|
|
546
|
+
if (event.cancelable) event.preventDefault();
|
|
547
|
+
drive.move(event.clientY, event.timeStamp);
|
|
548
|
+
} else if (delta < 0) {
|
|
549
|
+
arm = null;
|
|
550
|
+
drive.detach();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function onPointerUp(event) {
|
|
554
|
+
const active = drive.dragPointerId();
|
|
555
|
+
if (active != null && (active !== event.pointerId || drive.isTouchDrag())) return;
|
|
556
|
+
arm = null;
|
|
557
|
+
if (active == null) {
|
|
558
|
+
drive.detach();
|
|
559
|
+
return;
|
|
366
560
|
}
|
|
367
|
-
|
|
368
|
-
|
|
561
|
+
drive.end(event.clientY, event.timeStamp);
|
|
562
|
+
}
|
|
563
|
+
function onPointerCancel(event) {
|
|
564
|
+
const active = drive.dragPointerId();
|
|
565
|
+
if (active != null && (active !== event.pointerId || drive.isTouchDrag())) return;
|
|
566
|
+
drive.cancel();
|
|
567
|
+
}
|
|
568
|
+
function onHandlePointerDown(event) {
|
|
569
|
+
if (event.button != null && event.button !== 0) return;
|
|
570
|
+
if (yieldToPinch(event.pointerId)) return;
|
|
571
|
+
drive.attach();
|
|
572
|
+
const tracker = new VelocityTracker();
|
|
573
|
+
drive.begin({
|
|
574
|
+
pointerId: event.pointerId,
|
|
575
|
+
pointerType: event.pointerType,
|
|
576
|
+
startY: event.clientY,
|
|
577
|
+
tracker
|
|
578
|
+
}, event.clientY, event.timeStamp);
|
|
579
|
+
if (event.cancelable) event.preventDefault();
|
|
580
|
+
}
|
|
581
|
+
function onBodyPointerDown(event) {
|
|
582
|
+
if (yieldToPinch(event.pointerId)) return;
|
|
583
|
+
arm = null;
|
|
584
|
+
if (event.pointerType === "touch" || event.button != null && event.button !== 0) return;
|
|
585
|
+
const body = drive.body();
|
|
586
|
+
if (!body || isInsideNestedLayer(event.target, body)) return;
|
|
587
|
+
const scrollers = scrollChainUnder(event.target, body);
|
|
588
|
+
if (!chainAtTop(scrollers)) return;
|
|
589
|
+
const tracker = new VelocityTracker();
|
|
590
|
+
tracker.add(0, event.clientY, event.timeStamp);
|
|
591
|
+
arm = {
|
|
592
|
+
pointerId: event.pointerId,
|
|
593
|
+
pointerType: event.pointerType,
|
|
594
|
+
startY: event.clientY,
|
|
595
|
+
scrollers,
|
|
596
|
+
tracker
|
|
597
|
+
};
|
|
598
|
+
drive.attach();
|
|
369
599
|
}
|
|
370
600
|
return {
|
|
371
|
-
|
|
372
|
-
|
|
601
|
+
onPointerMove,
|
|
602
|
+
onPointerUp,
|
|
603
|
+
onPointerCancel,
|
|
604
|
+
onHandlePointerDown,
|
|
605
|
+
onBodyPointerDown,
|
|
606
|
+
reset
|
|
373
607
|
};
|
|
374
608
|
}
|
|
375
609
|
//#endregion
|
|
376
610
|
//#region src/BottomSheet/sheetPointerSession.ts
|
|
377
|
-
/** Window pointer listeners
|
|
611
|
+
/** Window pointer listeners, the body's non-passive touch listeners, and the interruptions that cancel a drag. */
|
|
378
612
|
function createSheetPointerSession(handlers) {
|
|
379
613
|
let body = null;
|
|
380
614
|
let listening = false;
|
|
@@ -407,12 +641,20 @@ function createSheetPointerSession(handlers) {
|
|
|
407
641
|
element.addEventListener("touchend", handlers.onTouchEnd);
|
|
408
642
|
element.addEventListener("touchcancel", handlers.onTouchEnd);
|
|
409
643
|
}
|
|
644
|
+
function onVisibilityChange() {
|
|
645
|
+
if (document.visibilityState === "hidden") handlers.onInterrupt();
|
|
646
|
+
}
|
|
410
647
|
function destroy() {
|
|
411
648
|
detach();
|
|
412
649
|
setBody(null);
|
|
413
|
-
if (typeof window
|
|
650
|
+
if (typeof window === "undefined") return;
|
|
651
|
+
window.removeEventListener("blur", handlers.onInterrupt);
|
|
652
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
653
|
+
}
|
|
654
|
+
if (typeof window !== "undefined") {
|
|
655
|
+
window.addEventListener("blur", handlers.onInterrupt);
|
|
656
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
414
657
|
}
|
|
415
|
-
if (typeof window !== "undefined") window.addEventListener("blur", handlers.onWindowBlur);
|
|
416
658
|
return {
|
|
417
659
|
attach,
|
|
418
660
|
detach,
|
|
@@ -421,10 +663,298 @@ function createSheetPointerSession(handlers) {
|
|
|
421
663
|
};
|
|
422
664
|
}
|
|
423
665
|
//#endregion
|
|
666
|
+
//#region src/motion/uikit/sheet.ts
|
|
667
|
+
/**
|
|
668
|
+
* @file sheet.ts
|
|
669
|
+
* @input Nothing; data only
|
|
670
|
+
* @output Exports `sheet`, the sheet's release constants. They say when
|
|
671
|
+
* UISheetPresentationController counts a release as a flick and how near a
|
|
672
|
+
* detent a flick counts as on it. They also give how far ahead a release is
|
|
673
|
+
* projected, and the speed below which it is not
|
|
674
|
+
* @position The sheet domain of the UIKit constants table (motion/uikit).
|
|
675
|
+
* Its springs are `springs.sheetPresent`, `.sheetDismiss`, `.sheetDetent`,
|
|
676
|
+
* `.sheetReleaseFast` and `.sheetDismissSwipe`
|
|
677
|
+
*
|
|
678
|
+
* Read from UIKit with a `[.medium(), .large()]` sheet in an injected host
|
|
679
|
+
* app. Speeds are in pt/s (CSS px/s).
|
|
680
|
+
*/
|
|
681
|
+
const sheet = { release: {
|
|
682
|
+
/**
|
|
683
|
+
* Release speed (pt/s, in either direction) from which UIKit's sheet
|
|
684
|
+
* counts a release as a flick. A sheet's flick goes at least to the next
|
|
685
|
+
* position beyond where it is in its direction (`detentTolerance`). It
|
|
686
|
+
* goes on past it when its projection passes it. The same speed
|
|
687
|
+
* switches UIKit's settle from `springs.sheetDetent` (critically damped)
|
|
688
|
+
* to `springs.sheetReleaseFast` (80 % damping). An interactive dismissal
|
|
689
|
+
* at it takes `springs.sheetDismissSwipe`. Inside the measured bracket.
|
|
690
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
691
|
+
* iPhone 17 Pro, Oct 23 and Oct 24 2026. Of 134 drag releases, 55 had
|
|
692
|
+
* their CASpringAnimation read. Every one up to 996.7 pt/s had damping
|
|
693
|
+
* 36.515 (ζ 1), and every one from 1028.3 pt/s on had 29.212 (ζ 0.8).
|
|
694
|
+
* So the switch lies in (996.7, 1028.3]. With a 0.1 s projection, all
|
|
695
|
+
* 134 outcomes fit a flick threshold from 997 to 1028 pt/s.
|
|
696
|
+
*/
|
|
697
|
+
fastSpeed: 1008,
|
|
698
|
+
/**
|
|
699
|
+
* How far ahead a release is projected, as seconds of its velocity.
|
|
700
|
+
* UIKit's sheet projects a release to `offset + velocity × this`, and the
|
|
701
|
+
* dismissed position (fully off screen) counts as one of its positions.
|
|
702
|
+
* A slow release settles on the position nearest this landing. A flick
|
|
703
|
+
* goes to the first position at or past it. Inside the measured bracket.
|
|
704
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
705
|
+
* iPhone 17 Pro, Oct 23 to Oct 25 2026. There were 164 drag releases
|
|
706
|
+
* of a [.medium(), .large()] sheet, from 0 to 4000 pt/s. Each gave the
|
|
707
|
+
* offset and velocity of its last drag update and the detent it
|
|
708
|
+
* settled on. With `fastSpeed`'s flick branch and no projection below
|
|
709
|
+
* 250 pt/s, every release fits any value from 0.092 to 0.104 s.
|
|
710
|
+
*/
|
|
711
|
+
projectionSeconds: .1,
|
|
712
|
+
/**
|
|
713
|
+
* Release speed (pt/s) below which a release is not projected: the sheet
|
|
714
|
+
* settles on the position nearest where it was let go. Core cancels a
|
|
715
|
+
* release that moves back toward its start before this applies. Inside
|
|
716
|
+
* the measured bracket.
|
|
717
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
718
|
+
* iPhone 17 Pro, Oct 25 2026. There were 30 releases of drags from the
|
|
719
|
+
* medium detent. Each went past the midpoint toward large, or most of
|
|
720
|
+
* the way to gone, then turned back. Each one let go at up to 244 pt/s
|
|
721
|
+
* settled on the position nearest where it was let go. From 250.6 pt/s
|
|
722
|
+
* on, the projection decided. So the switch lies in (244, 250.6].
|
|
723
|
+
*/
|
|
724
|
+
minProjectionSpeed: 250,
|
|
725
|
+
/**
|
|
726
|
+
* How close to a position (pt) a flick's offset counts as on it, so the
|
|
727
|
+
* next position beyond is the one after it. Inside the measured bracket.
|
|
728
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
729
|
+
* iPhone 17 Pro, Oct 24 2026. Two flicks released exactly on the medium
|
|
730
|
+
* detent went on to the next position in their direction. One released
|
|
731
|
+
* 6.7 pt above it, moving down, stopped at medium. So any value from 0
|
|
732
|
+
* to 6.6 pt fits.
|
|
733
|
+
*/
|
|
734
|
+
detentTolerance: 1
|
|
735
|
+
} };
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/BottomSheet/sheetRelease.ts
|
|
738
|
+
const PROJECTION_FACTOR = .998 / .0020000000000000018;
|
|
739
|
+
/** A mouse or pen release shorter than this is judged where it was let go. */
|
|
740
|
+
const PROJECTION_MIN_TRAVEL = 48;
|
|
741
|
+
/**
|
|
742
|
+
* A touch release takes UIKit's sheet values, with closed counted as one more
|
|
743
|
+
* position. It is projected 0.1 s ahead, a release under 250 px/s is not
|
|
744
|
+
* projected, and from 1008 px/s it is a flick that lands on the first position
|
|
745
|
+
* at or past its projection. A release moving back toward where the drag
|
|
746
|
+
* began cancels to that stop.
|
|
747
|
+
*/
|
|
748
|
+
function resolveTouchRelease(input) {
|
|
749
|
+
const { offsets, height, offset, velocity } = input;
|
|
750
|
+
const maxOffset = offsets[offsets.length - 1] ?? 0;
|
|
751
|
+
const shortestHeight = visibleHeightForOffset(height, maxOffset, input.reserve);
|
|
752
|
+
const { fastSpeed, minProjectionSpeed, projectionSeconds, detentTolerance } = sheet.release;
|
|
753
|
+
const points = [...offsets, maxOffset + shortestHeight];
|
|
754
|
+
const { index } = resolveSnapPoint({
|
|
755
|
+
points,
|
|
756
|
+
position: offset,
|
|
757
|
+
velocity: velocity * 1e3,
|
|
758
|
+
flickThreshold: input.travel > 8 ? fastSpeed : Number.POSITIVE_INFINITY,
|
|
759
|
+
tolerance: detentTolerance,
|
|
760
|
+
flickPastProjection: true,
|
|
761
|
+
projection: {
|
|
762
|
+
seconds: projectionSeconds,
|
|
763
|
+
minSpeed: minProjectionSpeed
|
|
764
|
+
},
|
|
765
|
+
start: input.baseOffset
|
|
766
|
+
});
|
|
767
|
+
if (index === points.length - 1) return {
|
|
768
|
+
kind: "close",
|
|
769
|
+
exit: {
|
|
770
|
+
distance: Math.max(0, height - offset),
|
|
771
|
+
velocity: velocity * 1e3
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
return {
|
|
775
|
+
kind: "settle",
|
|
776
|
+
target: points[index] ?? maxOffset
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* A mouse or pen release coasts on the scroll view's deceleration. One that
|
|
781
|
+
* would coast past the dismiss line closes the sheet; any other settles on
|
|
782
|
+
* the stop nearest where it would come to rest, in the drag's direction.
|
|
783
|
+
*/
|
|
784
|
+
function resolvePointerRelease(input) {
|
|
785
|
+
const { offsets, offset } = input;
|
|
786
|
+
const maxOffset = offsets[offsets.length - 1] ?? 0;
|
|
787
|
+
const projected = input.travel > PROJECTION_MIN_TRAVEL ? offset + input.velocity * PROJECTION_FACTOR : offset;
|
|
788
|
+
if (input.dir > 0 && projected > dismissTravelFor(input.height, offsets, input.reserve)) return {
|
|
789
|
+
kind: "close",
|
|
790
|
+
exit: null
|
|
791
|
+
};
|
|
792
|
+
return {
|
|
793
|
+
kind: "settle",
|
|
794
|
+
target: resolveSettleOffset(Math.min(Math.max(projected, 0), maxOffset), offsets, input.dir, input.baseOffset)
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
/** Where a drag's release takes the sheet: a stop to settle on, or the close. */
|
|
798
|
+
function resolveSheetRelease(input) {
|
|
799
|
+
return input.isTouch ? resolveTouchRelease(input) : resolvePointerRelease(input);
|
|
800
|
+
}
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region src/BottomSheet/sheetTouchArm.ts
|
|
803
|
+
/**
|
|
804
|
+
* Travel past the point where a scroll ran out of content before the sheet
|
|
805
|
+
* takes the rest of the pull: continuous with the scroll, yet a swipe that
|
|
806
|
+
* merely comes to rest on the last pixel starts no drag on jitter.
|
|
807
|
+
*/
|
|
808
|
+
const CONTENT_END_HANDOFF_SLOP = 4;
|
|
809
|
+
/** An Apple Pencil raises touch events marked `stylus`; its drag is a pen's. */
|
|
810
|
+
function touchPointerType(touch) {
|
|
811
|
+
return touch.touchType === "stylus" ? "pen" : "touch";
|
|
812
|
+
}
|
|
813
|
+
function findTouch(event, id) {
|
|
814
|
+
return id == null ? void 0 : Array.from(event.changedTouches).find((touch) => touch.identifier === id);
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* The body's touch path. Non-passive `touchmove` is the reliable scroll-to-drag
|
|
818
|
+
* hand-off on touch: cancelling a move at a scroll edge stops the native
|
|
819
|
+
* scroll and drives the sheet instead. Every touch on the body is tracked,
|
|
820
|
+
* not only one that begins at an edge, because a swipe that starts mid-content
|
|
821
|
+
* and scrolls to the end has to hand off too.
|
|
822
|
+
*/
|
|
823
|
+
function createSheetTouchArm(drive) {
|
|
824
|
+
let arm = null;
|
|
825
|
+
function releaseContentHold() {
|
|
826
|
+
if (arm?.releaseContentHold != null) {
|
|
827
|
+
arm.releaseContentHold();
|
|
828
|
+
arm.releaseContentHold = null;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
function reset() {
|
|
832
|
+
releaseContentHold();
|
|
833
|
+
arm = null;
|
|
834
|
+
}
|
|
835
|
+
function promote(armed, touch, startY, timeStamp) {
|
|
836
|
+
drive.begin({
|
|
837
|
+
pointerId: armed.id,
|
|
838
|
+
pointerType: touchPointerType(touch),
|
|
839
|
+
startY,
|
|
840
|
+
tracker: armed.tracker
|
|
841
|
+
}, touch.clientY, timeStamp);
|
|
842
|
+
drive.move(touch.clientY, timeStamp);
|
|
843
|
+
}
|
|
844
|
+
function onTouchStart(event) {
|
|
845
|
+
const body = event.currentTarget;
|
|
846
|
+
if (event.touches.length > 1) {
|
|
847
|
+
reset();
|
|
848
|
+
drive.yieldToPinch();
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
reset();
|
|
852
|
+
const touch = event.changedTouches[0];
|
|
853
|
+
if (!touch || isInsideNestedLayer(event.target, body)) return;
|
|
854
|
+
const scrollers = scrollChainUnder(event.target, body);
|
|
855
|
+
const bottom = chainAtBottom(scrollers) && (drive.activeOffset() > 0 || !chainScrolls(scrollers));
|
|
856
|
+
const tracker = new VelocityTracker();
|
|
857
|
+
tracker.add(0, touch.clientY, event.timeStamp);
|
|
858
|
+
arm = {
|
|
859
|
+
id: touch.identifier,
|
|
860
|
+
startX: touch.clientX,
|
|
861
|
+
startY: touch.clientY,
|
|
862
|
+
scrollers,
|
|
863
|
+
top: chainAtTop(scrollers),
|
|
864
|
+
bottom,
|
|
865
|
+
contentEndY: null,
|
|
866
|
+
promotedAtContentEnd: false,
|
|
867
|
+
releaseContentHold: null,
|
|
868
|
+
tracker
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
function moveDrag(event) {
|
|
872
|
+
const touch = findTouch(event, drive.dragPointerId());
|
|
873
|
+
if (!touch) return;
|
|
874
|
+
const armed = arm;
|
|
875
|
+
if (armed?.promotedAtContentEnd && armed.contentEndY != null) {
|
|
876
|
+
if (touch.clientY >= armed.contentEndY) {
|
|
877
|
+
armed.contentEndY = null;
|
|
878
|
+
armed.promotedAtContentEnd = false;
|
|
879
|
+
releaseContentHold();
|
|
880
|
+
drive.cancel();
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
drive.move(touch.clientY, event.timeStamp);
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
if (event.cancelable) event.preventDefault();
|
|
887
|
+
drive.move(touch.clientY, event.timeStamp);
|
|
888
|
+
}
|
|
889
|
+
function onTouchMove(event) {
|
|
890
|
+
if (event.touches.length > 1) {
|
|
891
|
+
reset();
|
|
892
|
+
drive.yieldToPinch();
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
if (drive.dragPointerId() != null) {
|
|
896
|
+
moveDrag(event);
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
const armed = arm;
|
|
900
|
+
const touch = findTouch(event, armed?.id);
|
|
901
|
+
if (armed == null || !touch) return;
|
|
902
|
+
const delta = touch.clientY - armed.startY;
|
|
903
|
+
armed.tracker.add(0, touch.clientY, event.timeStamp);
|
|
904
|
+
const opposesTop = armed.top && delta > 0 && chainAtTop(armed.scrollers);
|
|
905
|
+
const opposesBottom = armed.bottom && delta < 0 && chainAtBottom(armed.scrollers);
|
|
906
|
+
const sideways = Math.abs(touch.clientX - armed.startX);
|
|
907
|
+
const isMostlyVertical = Math.abs(delta) > sideways;
|
|
908
|
+
if ((opposesTop || opposesBottom) && Math.abs(delta) >= 5 && isMostlyVertical && event.cancelable) event.preventDefault();
|
|
909
|
+
if (isMostlyVertical && (opposesTop && delta > 8 || opposesBottom && delta < -8)) {
|
|
910
|
+
if (event.cancelable) event.preventDefault();
|
|
911
|
+
reset();
|
|
912
|
+
promote(armed, touch, armed.startY, event.timeStamp);
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
if (Math.max(Math.abs(delta), sideways) > 8 && (armed.top || armed.bottom)) {
|
|
916
|
+
if (!isMostlyVertical) {
|
|
917
|
+
reset();
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
armed.top = false;
|
|
921
|
+
armed.bottom = false;
|
|
922
|
+
}
|
|
923
|
+
if (armed.top && delta <= -5 && !chainAtBottom(armed.scrollers)) armed.top = false;
|
|
924
|
+
if (armed.bottom && delta >= 5 && !chainAtTop(armed.scrollers)) armed.bottom = false;
|
|
925
|
+
if (chainAtBottom(armed.scrollers)) {
|
|
926
|
+
if (armed.contentEndY == null) {
|
|
927
|
+
armed.contentEndY = touch.clientY;
|
|
928
|
+
armed.releaseContentHold ??= holdAtEnd(armed.scrollers);
|
|
929
|
+
} else if (armed.contentEndY - touch.clientY >= CONTENT_END_HANDOFF_SLOP) {
|
|
930
|
+
armed.promotedAtContentEnd = true;
|
|
931
|
+
promote(armed, touch, armed.contentEndY, event.timeStamp);
|
|
932
|
+
}
|
|
933
|
+
} else {
|
|
934
|
+
armed.contentEndY = null;
|
|
935
|
+
releaseContentHold();
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function onTouchEnd(event) {
|
|
939
|
+
reset();
|
|
940
|
+
const pointerId = drive.dragPointerId();
|
|
941
|
+
if (pointerId == null) return;
|
|
942
|
+
const touch = findTouch(event, pointerId);
|
|
943
|
+
if (touch) drive.end(touch.clientY, event.timeStamp);
|
|
944
|
+
else if (event.touches.length === 0) drive.cancel();
|
|
945
|
+
}
|
|
946
|
+
return {
|
|
947
|
+
onTouchStart,
|
|
948
|
+
onTouchMove,
|
|
949
|
+
onTouchEnd,
|
|
950
|
+
reset
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
//#endregion
|
|
424
954
|
//#region src/BottomSheet/useSheetGestures.ts
|
|
425
955
|
/** Drag, snap, and settle behavior of the sheet panel. */
|
|
426
956
|
function useSheetGestures(options) {
|
|
427
|
-
const { panel, body, isOpen, canDismiss, getSnapHeights, onScrimOpacity, onSnap, onDismiss } = options;
|
|
957
|
+
const { panel, body, isOpen, canDismiss, reserve, getSnapHeights, onScrimOpacity, onSnap, onDismiss } = options;
|
|
428
958
|
const isDragging = ref(false);
|
|
429
959
|
const isReconciling = ref(false);
|
|
430
960
|
const isOverflowing = ref(false);
|
|
@@ -434,13 +964,22 @@ function useSheetGestures(options) {
|
|
|
434
964
|
const scrollPreservationInset = ref(0);
|
|
435
965
|
const scrimOpacity = ref(1);
|
|
436
966
|
const sheetHeight = ref(0);
|
|
967
|
+
const heldClose = ref(null);
|
|
968
|
+
const dragExit = ref(null);
|
|
969
|
+
const isDismissedByTouchDrag = ref(false);
|
|
437
970
|
let dragState = null;
|
|
438
|
-
|
|
439
|
-
let
|
|
971
|
+
/** The scrim of the stop a drag's close left, until the host answers the close. */
|
|
972
|
+
let pendingDismissal = null;
|
|
440
973
|
let reconcileToken = 0;
|
|
441
974
|
let observer = null;
|
|
442
975
|
let session;
|
|
443
976
|
const activeOffset = computed(() => isDragging.value ? dragOffset.value : settledOffset.value);
|
|
977
|
+
/** Dragging above the base stop restores the full layout height below the viewport. */
|
|
978
|
+
const layoutOffset = computed(() => {
|
|
979
|
+
if (heldClose.value != null) return heldClose.value.layoutOffset;
|
|
980
|
+
if (isDragging.value) return dragOffset.value < settledOffset.value ? 0 : settledLayoutOffset.value;
|
|
981
|
+
return settledLayoutOffset.value;
|
|
982
|
+
});
|
|
444
983
|
function measureNaturalHeight() {
|
|
445
984
|
const element = panel.value;
|
|
446
985
|
if (!element) return 0;
|
|
@@ -455,14 +994,23 @@ function useSheetGestures(options) {
|
|
|
455
994
|
const measured = measureNaturalHeight();
|
|
456
995
|
if (measured > 0) sheetHeight.value = measured;
|
|
457
996
|
const height = measured > 0 ? measured : sheetHeight.value;
|
|
458
|
-
const
|
|
997
|
+
const inset = reserve.value;
|
|
998
|
+
const visible = visibleHeightForOffset(height, 0, inset);
|
|
459
999
|
const offsets = computeDetentOffsets(visible, getSnapHeights());
|
|
460
1000
|
return {
|
|
461
1001
|
height,
|
|
462
1002
|
offsets,
|
|
463
|
-
peekOffset: peekOffsetFor(offsets, visible)
|
|
1003
|
+
peekOffset: peekOffsetFor(offsets, visible),
|
|
1004
|
+
reserve: inset
|
|
464
1005
|
};
|
|
465
1006
|
}
|
|
1007
|
+
function scrimFor(offset, detents) {
|
|
1008
|
+
return scrimOpacityForOffset(offset, detents.offsets, dismissTravelFor(detents.height, detents.offsets, detents.reserve), detents.peekOffset);
|
|
1009
|
+
}
|
|
1010
|
+
function reportScrim(opacity) {
|
|
1011
|
+
scrimOpacity.value = opacity;
|
|
1012
|
+
onScrimOpacity(opacity);
|
|
1013
|
+
}
|
|
466
1014
|
async function reconcileLayout(targetLayoutOffset) {
|
|
467
1015
|
const token = ++reconcileToken;
|
|
468
1016
|
isReconciling.value = true;
|
|
@@ -476,248 +1024,163 @@ function useSheetGestures(options) {
|
|
|
476
1024
|
}
|
|
477
1025
|
function settleAt(target, fromOffset, detents) {
|
|
478
1026
|
const targetLayoutOffset = target === detents.peekOffset ? 0 : target;
|
|
479
|
-
const dismissOffset = dismissTravelFor(detents.height, detents.offsets);
|
|
480
1027
|
settledOffset.value = target;
|
|
481
1028
|
scrollPreservationInset.value = Math.max(0, fromOffset - targetLayoutOffset - naturalEndGapFor(body.value));
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
onSnap(visibleHeightForOffset(detents.height, target, 48));
|
|
1029
|
+
reportScrim(scrimFor(target, detents));
|
|
1030
|
+
onSnap(visibleHeightForOffset(detents.height, target, detents.reserve));
|
|
485
1031
|
if (target !== fromOffset) hapticTick();
|
|
486
1032
|
if (targetLayoutOffset === settledLayoutOffset.value && !isReconciling.value) return;
|
|
487
1033
|
reconcileLayout(targetLayoutOffset);
|
|
488
1034
|
}
|
|
489
|
-
function
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
1035
|
+
function clearDragClose() {
|
|
1036
|
+
pendingDismissal = null;
|
|
1037
|
+
heldClose.value = null;
|
|
1038
|
+
dragExit.value = null;
|
|
1039
|
+
isDismissedByTouchDrag.value = false;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Asks the host to close. The sheet holds where the finger left it, so the
|
|
1043
|
+
* exit starts from there. The host answers in its next render: a host that
|
|
1044
|
+
* keeps the sheet open sends it back to its stop, the scrim with it.
|
|
1045
|
+
*/
|
|
1046
|
+
function closeSheet(exit, state) {
|
|
1047
|
+
if (!canDismiss.value) {
|
|
1048
|
+
settleAt(state.offsets[state.offsets.length - 1] ?? 0, state.baseOffset, state);
|
|
496
1049
|
return;
|
|
497
1050
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
state.
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
1051
|
+
heldClose.value = {
|
|
1052
|
+
offset: dragOffset.value,
|
|
1053
|
+
layoutOffset: layoutOffset.value
|
|
1054
|
+
};
|
|
1055
|
+
isDismissedByTouchDrag.value = state.pointerType === "touch";
|
|
1056
|
+
dragExit.value = exit;
|
|
1057
|
+
const request = { restingScrim: scrimFor(state.baseOffset, state) };
|
|
1058
|
+
pendingDismissal = request;
|
|
1059
|
+
onDismiss();
|
|
1060
|
+
nextTick(() => {
|
|
1061
|
+
if (pendingDismissal !== request) return;
|
|
1062
|
+
pendingDismissal = null;
|
|
1063
|
+
if (!isOpen.value) return;
|
|
1064
|
+
clearDragClose();
|
|
1065
|
+
reportScrim(request.restingScrim);
|
|
509
1066
|
});
|
|
510
|
-
state.travel = Math.max(state.travel, Math.abs(delta));
|
|
511
|
-
state.dir = delta === 0 ? 0 : Math.sign(delta);
|
|
512
|
-
const next = dragOffsetFrom(state.baseOffset, delta, state.offsets);
|
|
513
|
-
state.rawOffset = next.raw;
|
|
514
|
-
dragOffset.value = next.shown;
|
|
515
|
-
scrimOpacity.value = scrimOpacityForOffset(next.raw, state.offsets, dismissTravelFor(state.height, state.offsets), state.peekOffset);
|
|
516
|
-
onScrimOpacity(scrimOpacity.value);
|
|
517
1067
|
}
|
|
518
|
-
function beginDrag(
|
|
1068
|
+
function beginDrag(start, clientY, timeStamp) {
|
|
1069
|
+
clearDragClose();
|
|
1070
|
+
start.tracker.add(0, clientY, timeStamp);
|
|
519
1071
|
dragState = {
|
|
520
1072
|
...resolveDetents(),
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
startT: timeStamp,
|
|
524
|
-
lastY: clientY,
|
|
525
|
-
lastT: timeStamp,
|
|
526
|
-
samples: [{
|
|
527
|
-
y: clientY,
|
|
528
|
-
t: timeStamp
|
|
529
|
-
}],
|
|
530
|
-
baseOffset: settledOffset.value,
|
|
531
|
-
baseLayoutOffset: settledLayoutOffset.value,
|
|
532
|
-
rawOffset: settledOffset.value,
|
|
533
|
-
dir: 0,
|
|
534
|
-
travel: 0
|
|
1073
|
+
...start,
|
|
1074
|
+
baseOffset: settledOffset.value
|
|
535
1075
|
};
|
|
536
1076
|
dragOffset.value = settledOffset.value;
|
|
537
1077
|
isDragging.value = true;
|
|
538
1078
|
}
|
|
539
|
-
function
|
|
1079
|
+
function moveDrag(clientY, timeStamp) {
|
|
1080
|
+
const state = dragState;
|
|
1081
|
+
if (!state) return;
|
|
1082
|
+
state.tracker.add(0, clientY, timeStamp);
|
|
1083
|
+
const shown = stretchedOffset(state.baseOffset + clientY - state.startY, state.offsets, state);
|
|
1084
|
+
dragOffset.value = shown;
|
|
1085
|
+
reportScrim(scrimFor(shown, state));
|
|
1086
|
+
}
|
|
1087
|
+
function endDrag(clientY, timeStamp) {
|
|
540
1088
|
const state = dragState;
|
|
541
1089
|
dragState = null;
|
|
542
1090
|
session.detach();
|
|
543
1091
|
if (!state) return;
|
|
1092
|
+
const delta = clientY - state.startY;
|
|
1093
|
+
if (state.tracker.lastSample?.y !== clientY) state.tracker.add(0, clientY, timeStamp);
|
|
1094
|
+
const release = resolveSheetRelease({
|
|
1095
|
+
offset: Math.max(0, state.baseOffset + delta),
|
|
1096
|
+
velocity: state.tracker.velocity(timeStamp).y / 1e3,
|
|
1097
|
+
height: state.height || 1,
|
|
1098
|
+
dir: Math.sign(delta),
|
|
1099
|
+
travel: Math.abs(delta),
|
|
1100
|
+
baseOffset: state.baseOffset,
|
|
1101
|
+
offsets: state.offsets,
|
|
1102
|
+
reserve: state.reserve,
|
|
1103
|
+
isTouch: state.pointerType === "touch"
|
|
1104
|
+
});
|
|
1105
|
+
if (release.kind === "close") closeSheet(release.exit, state);
|
|
544
1106
|
isDragging.value = false;
|
|
545
|
-
|
|
546
|
-
const isFlick = Math.abs(velocity) > 1.2 && state.travel > 48;
|
|
547
|
-
if (state.dir > 0 && isFlick) {
|
|
548
|
-
dismissOrSettleShortest(state.baseOffset, state);
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
if (state.dir < 0 && isFlick) {
|
|
552
|
-
settleAt(0, state.baseOffset, state);
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
if (state.rawOffset > dismissTravelFor(state.height, state.offsets)) {
|
|
556
|
-
dismissOrSettleShortest(state.baseOffset, state);
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
settleAt(resolveSettleOffset(state.rawOffset, state.offsets, state.dir, state.baseOffset), state.baseOffset, state);
|
|
1107
|
+
if (release.kind === "settle") settleAt(release.target, state.baseOffset, state);
|
|
560
1108
|
}
|
|
561
|
-
|
|
1109
|
+
/** The drag in flight returns to its stop; the arms keep tracking their contacts. */
|
|
1110
|
+
function dropDrag() {
|
|
562
1111
|
const state = dragState;
|
|
563
|
-
pendingBody = null;
|
|
564
|
-
touchArming = null;
|
|
565
1112
|
dragState = null;
|
|
566
1113
|
session.detach();
|
|
567
1114
|
if (!state) return;
|
|
568
1115
|
isDragging.value = false;
|
|
569
1116
|
dragOffset.value = state.baseOffset;
|
|
570
1117
|
settledOffset.value = state.baseOffset;
|
|
571
|
-
|
|
572
|
-
onScrimOpacity(scrimOpacity.value);
|
|
573
|
-
}
|
|
574
|
-
/** A second finger is a pinch. The browser keeps the zoom; the sheet lets go. */
|
|
575
|
-
function yieldToPinch(pointerId) {
|
|
576
|
-
if (dragState == null || dragState.pointerId === pointerId) return false;
|
|
577
|
-
cancelDrag();
|
|
578
|
-
return true;
|
|
579
|
-
}
|
|
580
|
-
function onPointerMove(event) {
|
|
581
|
-
if (dragState != null) {
|
|
582
|
-
if (yieldToPinch(event.pointerId)) return;
|
|
583
|
-
if (event.cancelable) event.preventDefault();
|
|
584
|
-
updateDrag(event.clientY, event.timeStamp);
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
const pending = pendingBody;
|
|
588
|
-
if (pending == null || pending.pointerId !== event.pointerId) return;
|
|
589
|
-
const delta = event.clientY - pending.startY;
|
|
590
|
-
if (Math.abs(delta) < 8) return;
|
|
591
|
-
const pullingDown = delta > 0 && pending.atTop;
|
|
592
|
-
const pullingUp = delta < 0 && pending.atBottom && activeOffset.value > 0;
|
|
593
|
-
if (!pullingDown && !pullingUp) {
|
|
594
|
-
pendingBody = null;
|
|
595
|
-
session.detach();
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
pendingBody = null;
|
|
599
|
-
beginDrag(pending.pointerId, pending.startY, event.timeStamp);
|
|
600
|
-
if (event.cancelable) event.preventDefault();
|
|
601
|
-
updateDrag(event.clientY, event.timeStamp);
|
|
602
|
-
}
|
|
603
|
-
function onPointerUp(event) {
|
|
604
|
-
if (dragState != null && dragState.pointerId !== event.pointerId) return;
|
|
605
|
-
pendingBody = null;
|
|
606
|
-
if (dragState == null) {
|
|
607
|
-
session.detach();
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
endDrag();
|
|
611
|
-
}
|
|
612
|
-
function onPointerCancel(event) {
|
|
613
|
-
if (dragState != null && dragState.pointerId !== event.pointerId) return;
|
|
614
|
-
cancelDrag();
|
|
615
|
-
}
|
|
616
|
-
function onHandlePointerDown(event) {
|
|
617
|
-
if (event.button != null && event.button !== 0) return;
|
|
618
|
-
if (yieldToPinch(event.pointerId)) return;
|
|
619
|
-
session.attach();
|
|
620
|
-
beginDrag(event.pointerId, event.clientY, event.timeStamp);
|
|
621
|
-
if (event.cancelable) event.preventDefault();
|
|
622
|
-
}
|
|
623
|
-
function onBodyPointerDown(event) {
|
|
624
|
-
if (yieldToPinch(event.pointerId)) return;
|
|
625
|
-
if (event.pointerType === "touch") return;
|
|
626
|
-
if (event.button != null && event.button !== 0) return;
|
|
627
|
-
const element = body.value;
|
|
628
|
-
if (!element) return;
|
|
629
|
-
const edges = armingEdges(element, event.target);
|
|
630
|
-
if (edges == null) {
|
|
631
|
-
pendingBody = null;
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
pendingBody = {
|
|
635
|
-
pointerId: event.pointerId,
|
|
636
|
-
startY: event.clientY,
|
|
637
|
-
atTop: edges.atTop,
|
|
638
|
-
atBottom: edges.atBottom
|
|
639
|
-
};
|
|
640
|
-
session.attach();
|
|
641
|
-
}
|
|
642
|
-
function onTouchStart(event) {
|
|
643
|
-
if (event.touches.length > 1) {
|
|
644
|
-
touchArming = null;
|
|
645
|
-
cancelDrag();
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
const touch = event.changedTouches[0];
|
|
649
|
-
const element = body.value;
|
|
650
|
-
const edges = touch && element ? armingEdges(element, event.target) : null;
|
|
651
|
-
touchArming = touch && edges ? {
|
|
652
|
-
identifier: touch.identifier,
|
|
653
|
-
startY: touch.clientY,
|
|
654
|
-
...edges
|
|
655
|
-
} : null;
|
|
1118
|
+
reportScrim(scrimFor(state.baseOffset, state));
|
|
656
1119
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const arming = touchArming;
|
|
690
|
-
if (arming != null && Array.from(event.changedTouches).some((item) => item.identifier === arming.identifier)) touchArming = null;
|
|
691
|
-
if (dragState != null && Array.from(event.changedTouches).some((item) => item.identifier === dragState?.pointerId)) endDrag();
|
|
1120
|
+
const dragPointerId = () => dragState?.pointerId ?? null;
|
|
1121
|
+
const touchArm = createSheetTouchArm({
|
|
1122
|
+
activeOffset: () => activeOffset.value,
|
|
1123
|
+
dragPointerId: () => dragState?.viaTouch ? dragState.pointerId : null,
|
|
1124
|
+
begin: (start, clientY, timeStamp) => beginDrag({
|
|
1125
|
+
...start,
|
|
1126
|
+
viaTouch: true
|
|
1127
|
+
}, clientY, timeStamp),
|
|
1128
|
+
move: moveDrag,
|
|
1129
|
+
end: endDrag,
|
|
1130
|
+
cancel: dropDrag,
|
|
1131
|
+
yieldToPinch: cancelDrag
|
|
1132
|
+
});
|
|
1133
|
+
const pointerArm = createSheetPointerArm({
|
|
1134
|
+
body: () => body.value,
|
|
1135
|
+
dragPointerId,
|
|
1136
|
+
isTouchDrag: () => dragState?.viaTouch ?? false,
|
|
1137
|
+
attach: () => session.attach(),
|
|
1138
|
+
detach: () => session.detach(),
|
|
1139
|
+
begin: (start, clientY, timeStamp) => beginDrag({
|
|
1140
|
+
...start,
|
|
1141
|
+
viaTouch: false
|
|
1142
|
+
}, clientY, timeStamp),
|
|
1143
|
+
move: moveDrag,
|
|
1144
|
+
end: endDrag,
|
|
1145
|
+
cancel: cancelDrag
|
|
1146
|
+
});
|
|
1147
|
+
/** Every arm and any drag in flight let go: the sheet returns to its stop. */
|
|
1148
|
+
function cancelDrag() {
|
|
1149
|
+
pointerArm.reset();
|
|
1150
|
+
touchArm.reset();
|
|
1151
|
+
dropDrag();
|
|
692
1152
|
}
|
|
693
1153
|
function updateOverflow() {
|
|
694
1154
|
const element = body.value;
|
|
695
1155
|
isOverflowing.value = element != null && (element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
|
|
696
1156
|
}
|
|
697
|
-
function recordSheetHeight() {
|
|
1157
|
+
function recordSheetHeight(height) {
|
|
698
1158
|
if (isDragging.value || settledLayoutOffset.value > 0 || isReconciling.value) return;
|
|
699
|
-
const height = panel.value?.getBoundingClientRect().height ?? 0;
|
|
700
1159
|
if (height > 0) sheetHeight.value = height;
|
|
701
1160
|
}
|
|
702
1161
|
session = createSheetPointerSession({
|
|
703
|
-
onPointerMove,
|
|
704
|
-
onPointerUp,
|
|
705
|
-
onPointerCancel,
|
|
706
|
-
onTouchStart,
|
|
707
|
-
onTouchMove,
|
|
708
|
-
onTouchEnd,
|
|
709
|
-
|
|
1162
|
+
onPointerMove: pointerArm.onPointerMove,
|
|
1163
|
+
onPointerUp: pointerArm.onPointerUp,
|
|
1164
|
+
onPointerCancel: pointerArm.onPointerCancel,
|
|
1165
|
+
onTouchStart: touchArm.onTouchStart,
|
|
1166
|
+
onTouchMove: touchArm.onTouchMove,
|
|
1167
|
+
onTouchEnd: touchArm.onTouchEnd,
|
|
1168
|
+
onInterrupt: () => cancelDrag()
|
|
710
1169
|
});
|
|
711
1170
|
watch(panel, (element) => {
|
|
712
1171
|
observer?.disconnect();
|
|
713
1172
|
observer = null;
|
|
714
|
-
if (!element
|
|
715
|
-
|
|
716
|
-
recordSheetHeight();
|
|
1173
|
+
if (!element) return;
|
|
1174
|
+
if (typeof ResizeObserver === "undefined") {
|
|
1175
|
+
recordSheetHeight(element.getBoundingClientRect().height);
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
observer = new ResizeObserver((entries) => {
|
|
1179
|
+
const entry = entries[entries.length - 1];
|
|
1180
|
+
recordSheetHeight(entry?.borderBoxSize?.[0]?.blockSize ?? element.getBoundingClientRect().height);
|
|
717
1181
|
updateOverflow();
|
|
718
1182
|
});
|
|
719
1183
|
observer.observe(element);
|
|
720
|
-
recordSheetHeight();
|
|
721
1184
|
}, { immediate: true });
|
|
722
1185
|
watch(body, (element) => {
|
|
723
1186
|
session.setBody(element);
|
|
@@ -729,16 +1192,15 @@ function useSheetGestures(options) {
|
|
|
729
1192
|
isReconciling.value = false;
|
|
730
1193
|
scrollPreservationInset.value = 0;
|
|
731
1194
|
if (!open) {
|
|
732
|
-
|
|
733
|
-
pendingBody = null;
|
|
734
|
-
touchArming = null;
|
|
1195
|
+
pendingDismissal = null;
|
|
735
1196
|
return;
|
|
736
1197
|
}
|
|
1198
|
+
clearDragClose();
|
|
737
1199
|
dragOffset.value = 0;
|
|
738
1200
|
settledOffset.value = 0;
|
|
739
1201
|
settledLayoutOffset.value = 0;
|
|
740
1202
|
scrimOpacity.value = 1;
|
|
741
|
-
nextTick(recordSheetHeight);
|
|
1203
|
+
if (typeof ResizeObserver === "undefined") nextTick(() => recordSheetHeight(panel.value?.getBoundingClientRect().height ?? 0));
|
|
742
1204
|
});
|
|
743
1205
|
watch(canDismiss, (allowed) => {
|
|
744
1206
|
if (!allowed) cancelDrag();
|
|
@@ -753,29 +1215,85 @@ function useSheetGestures(options) {
|
|
|
753
1215
|
isReconciling,
|
|
754
1216
|
isOverflowing,
|
|
755
1217
|
panelTransform: computed(() => {
|
|
756
|
-
const
|
|
757
|
-
const translation = activeOffset.value - layoutOffset;
|
|
1218
|
+
const translation = (heldClose.value?.offset ?? activeOffset.value) - layoutOffset.value;
|
|
758
1219
|
return translation !== 0 ? `translateY(${translation}px)` : void 0;
|
|
759
1220
|
}),
|
|
760
1221
|
panelHeight: computed(() => {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
return `${Math.max(0, sheetHeight.value - layoutOffset)}px`;
|
|
1222
|
+
if (layoutOffset.value <= 0 || sheetHeight.value <= 0) return void 0;
|
|
1223
|
+
return `${Math.max(0, sheetHeight.value - layoutOffset.value)}px`;
|
|
764
1224
|
}),
|
|
765
1225
|
scrollPreservationInset,
|
|
766
1226
|
scrimOpacity,
|
|
767
|
-
|
|
768
|
-
|
|
1227
|
+
dragExit,
|
|
1228
|
+
isDismissedByTouchDrag,
|
|
1229
|
+
onHandlePointerDown: pointerArm.onHandlePointerDown,
|
|
1230
|
+
onBodyPointerDown: pointerArm.onBodyPointerDown,
|
|
769
1231
|
updateOverflow
|
|
770
1232
|
};
|
|
771
1233
|
}
|
|
772
1234
|
//#endregion
|
|
1235
|
+
//#region src/BottomSheet/useSheetReserve.ts
|
|
1236
|
+
const BLOCK_SIZE_PROPERTIES = [
|
|
1237
|
+
"height",
|
|
1238
|
+
"min-height",
|
|
1239
|
+
"max-height",
|
|
1240
|
+
"block-size",
|
|
1241
|
+
"min-block-size",
|
|
1242
|
+
"max-block-size"
|
|
1243
|
+
];
|
|
1244
|
+
function camelCase(property) {
|
|
1245
|
+
return property.replace(/-([a-z])/g, (_match, letter) => letter.toUpperCase());
|
|
1246
|
+
}
|
|
1247
|
+
/** Whether an inline `style` binding sets any block size. */
|
|
1248
|
+
function styleSetsBlockSize(style) {
|
|
1249
|
+
if (Array.isArray(style)) return style.some(styleSetsBlockSize);
|
|
1250
|
+
if (typeof style === "string") return BLOCK_SIZE_PROPERTIES.some((property) => new RegExp(`(^|;)\\s*${property}\\s*:`, "i").test(style));
|
|
1251
|
+
if (style == null || typeof style !== "object") return false;
|
|
1252
|
+
const record = style;
|
|
1253
|
+
return BLOCK_SIZE_PROPERTIES.some((property) => record[property] != null || record[camelCase(property)] != null);
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Whether the caller sizes the sheet through its fallthrough attributes: an
|
|
1257
|
+
* inline block size, or any class, whose rules can size it too. Nothing
|
|
1258
|
+
* extends such a sheet by the reserve.
|
|
1259
|
+
*/
|
|
1260
|
+
function isSizedByCaller(attrs) {
|
|
1261
|
+
const className = attrs.class;
|
|
1262
|
+
return (Array.isArray(className) ? className.length > 0 : className != null && className !== "" && !(typeof className === "object" && Object.keys(className).length === 0)) || styleSetsBlockSize(attrs.style);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* How far the sheet's surface reaches below the screen. Only a finger
|
|
1266
|
+
* stretches the sheet past MIN_RESERVE, so a device with a touch pointer keeps
|
|
1267
|
+
* 40% of the layout viewport while the sheet is presented, enough that a pull
|
|
1268
|
+
* past the top never shows the page under it. A device without one, and a
|
|
1269
|
+
* sheet the caller sizes, keep MIN_RESERVE.
|
|
1270
|
+
*/
|
|
1271
|
+
function useSheetReserve(isPresented, isSized) {
|
|
1272
|
+
const hasTouchPointer = useMediaQuery("(any-pointer: coarse)");
|
|
1273
|
+
const viewportHeight = shallowRef(0);
|
|
1274
|
+
const tracksViewport = computed(() => isPresented.value && hasTouchPointer.value && !isSized());
|
|
1275
|
+
watch(tracksViewport, (tracks, _previous, onCleanup) => {
|
|
1276
|
+
if (!tracks || typeof window === "undefined") {
|
|
1277
|
+
viewportHeight.value = 0;
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
const read = () => {
|
|
1281
|
+
viewportHeight.value = window.innerHeight;
|
|
1282
|
+
};
|
|
1283
|
+
read();
|
|
1284
|
+
window.addEventListener("resize", read);
|
|
1285
|
+
onCleanup(() => window.removeEventListener("resize", read));
|
|
1286
|
+
}, { immediate: true });
|
|
1287
|
+
return computed(() => viewportHeight.value > 0 ? sheetReserve(viewportHeight.value) : 48);
|
|
1288
|
+
}
|
|
1289
|
+
//#endregion
|
|
773
1290
|
//#region src/BottomSheet/BottomSheetPanel.vue
|
|
774
1291
|
const _hoisted_1$1 = [
|
|
775
1292
|
"data-state",
|
|
776
1293
|
"data-height",
|
|
777
1294
|
"data-dragging",
|
|
778
|
-
"data-reconciling"
|
|
1295
|
+
"data-reconciling",
|
|
1296
|
+
"data-exit"
|
|
779
1297
|
];
|
|
780
1298
|
const _hoisted_2$1 = [
|
|
781
1299
|
"data-keyboard",
|
|
@@ -803,7 +1321,8 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
803
1321
|
"scrimOpacity",
|
|
804
1322
|
"motionStart",
|
|
805
1323
|
"motionComplete",
|
|
806
|
-
"snap"
|
|
1324
|
+
"snap",
|
|
1325
|
+
"scrimFade"
|
|
807
1326
|
],
|
|
808
1327
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
809
1328
|
const props = __props;
|
|
@@ -821,6 +1340,8 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
821
1340
|
const content = useTemplateRef("content");
|
|
822
1341
|
useScrollbars(body);
|
|
823
1342
|
const isInteractive = computed(() => props.state === "open");
|
|
1343
|
+
const attrs = useAttrs();
|
|
1344
|
+
const reserve = useSheetReserve(computed(() => props.state !== "hidden"), () => isSizedByCaller(attrs));
|
|
824
1345
|
const heightKind = computed(() => {
|
|
825
1346
|
const height = props.height;
|
|
826
1347
|
return height === "hug" || height === "capped" || height === "tall" ? height : "custom";
|
|
@@ -835,6 +1356,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
835
1356
|
body,
|
|
836
1357
|
isOpen: isInteractive,
|
|
837
1358
|
canDismiss: computed(() => props.isSwipeDismissAllowed),
|
|
1359
|
+
reserve,
|
|
838
1360
|
getSnapHeights: () => {
|
|
839
1361
|
const points = props.snapPoints;
|
|
840
1362
|
if (!points?.length || typeof window === "undefined") return [];
|
|
@@ -844,12 +1366,27 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
844
1366
|
onSnap: (visibleHeight) => emit("snap", visibleHeight),
|
|
845
1367
|
onDismiss: () => emit("dismiss")
|
|
846
1368
|
});
|
|
1369
|
+
const isCrossFade = computed(() => gestures.isDismissedByTouchDrag.value && defaultPrefersReducedMotion());
|
|
1370
|
+
const playedDragExit = computed(() => {
|
|
1371
|
+
const exit = gestures.dragExit.value;
|
|
1372
|
+
return exit != null && !isCrossFade.value && !defaultPrefersReducedMotion() && supportsWebAnimations() ? exit : null;
|
|
1373
|
+
});
|
|
1374
|
+
const holdsDragClose = computed(() => gestures.dragExit.value != null && (playedDragExit.value != null || isCrossFade.value));
|
|
1375
|
+
watch(playedDragExit, (exit) => {
|
|
1376
|
+
emit("scrimFade", exit != null && panel.value != null ? dragExitFade(panel.value, exit) : null);
|
|
1377
|
+
}, { flush: "sync" });
|
|
847
1378
|
const panelStyle = computed(() => {
|
|
848
|
-
const style = {
|
|
1379
|
+
const style = {
|
|
1380
|
+
"--_sheet-budget": budget.value,
|
|
1381
|
+
"--_sheet-reserve": `${reserve.value}px`
|
|
1382
|
+
};
|
|
849
1383
|
if (isInteractive.value) {
|
|
850
1384
|
style.transform = gestures.panelTransform.value;
|
|
851
1385
|
style.height = gestures.panelHeight.value;
|
|
852
|
-
} else if (props.state === "exiting")
|
|
1386
|
+
} else if (props.state === "exiting") {
|
|
1387
|
+
style.height = gestures.panelHeight.value;
|
|
1388
|
+
if (holdsDragClose.value) style.transform = gestures.panelTransform.value ?? "translateY(0px)";
|
|
1389
|
+
}
|
|
853
1390
|
return style;
|
|
854
1391
|
});
|
|
855
1392
|
const bodyStyle = computed(() => {
|
|
@@ -858,17 +1395,38 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
858
1395
|
});
|
|
859
1396
|
const overflowTabStop = computed(() => isInteractive.value && gestures.isOverflowing.value);
|
|
860
1397
|
let cancelMotionWait = null;
|
|
1398
|
+
/** The element a swipe's close moved on the animator, until the sheet is hidden. */
|
|
1399
|
+
let dragExitElement = null;
|
|
861
1400
|
function waitForMotion(motion) {
|
|
862
1401
|
cancelMotionWait?.();
|
|
863
1402
|
emit("motionStart", motion);
|
|
864
|
-
|
|
1403
|
+
const complete = () => {
|
|
865
1404
|
cancelMotionWait = null;
|
|
866
1405
|
emit("motionComplete", motion);
|
|
867
|
-
}
|
|
1406
|
+
};
|
|
1407
|
+
const element = panel.value;
|
|
1408
|
+
const exit = playedDragExit.value;
|
|
1409
|
+
if (motion === "exiting" && exit != null && element != null) {
|
|
1410
|
+
dragExitElement = element;
|
|
1411
|
+
cancelMotionWait = playDragExit(element, exit, {
|
|
1412
|
+
onSettled: () => emit("scrimFade", null),
|
|
1413
|
+
complete
|
|
1414
|
+
});
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
cancelMotionWait = waitForTransition(element, motion === "exiting" && isCrossFade.value ? "opacity" : "transform", complete);
|
|
868
1418
|
}
|
|
869
1419
|
watch(() => props.state, (state) => {
|
|
870
|
-
if (state === "open" || state === "exiting")
|
|
871
|
-
|
|
1420
|
+
if (state === "open" || state === "exiting") {
|
|
1421
|
+
waitForMotion(state === "open" ? "entering" : "exiting");
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
cancelMotionWait?.();
|
|
1425
|
+
cancelMotionWait = null;
|
|
1426
|
+
if (dragExitElement != null) {
|
|
1427
|
+
resetDragExit(dragExitElement);
|
|
1428
|
+
dragExitElement = null;
|
|
1429
|
+
}
|
|
872
1430
|
}, { flush: "post" });
|
|
873
1431
|
onMounted(() => {
|
|
874
1432
|
gestures.updateOverflow();
|
|
@@ -894,6 +1452,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
894
1452
|
"data-height": heightKind.value,
|
|
895
1453
|
"data-dragging": unref(gestures).isDragging.value || void 0,
|
|
896
1454
|
"data-reconciling": unref(gestures).isReconciling.value || void 0,
|
|
1455
|
+
"data-exit": __props.state === "exiting" && isCrossFade.value ? "fade" : void 0,
|
|
897
1456
|
style: normalizeStyle(panelStyle.value),
|
|
898
1457
|
tabindex: "-1"
|
|
899
1458
|
}, [createElementVNode("div", {
|
|
@@ -1078,7 +1637,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1078
1637
|
});
|
|
1079
1638
|
const isDismissible = computed(() => props.purpose === "info");
|
|
1080
1639
|
const isSwipeDismissAllowed = computed(() => props.purpose === "info" && !props.isInline);
|
|
1081
|
-
const
|
|
1640
|
+
const scrimFade = ref(null);
|
|
1641
|
+
const isClosing = computed(() => !isOpen.value && isPresented.value);
|
|
1642
|
+
const dialogStyle = computed(() => ({
|
|
1643
|
+
"--_sheet-scrim-opacity": isClosing.value ? "0" : String(scrimOpacity.value),
|
|
1644
|
+
"--_sheet-scrim-duration": scrimFade.value == null ? void 0 : `${scrimFade.value.durationMs}ms`,
|
|
1645
|
+
"--_sheet-scrim-easing": scrimFade.value?.easing
|
|
1646
|
+
}));
|
|
1082
1647
|
useFocusTrap({
|
|
1083
1648
|
container: computed(() => panelElement()),
|
|
1084
1649
|
isEnabled: computed(() => !hosted.value && isOpen.value && props.hasScrim)
|
|
@@ -1197,7 +1762,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1197
1762
|
openSheet();
|
|
1198
1763
|
}, { flush: "post" });
|
|
1199
1764
|
watch(isOpen, (value) => {
|
|
1200
|
-
if (value)
|
|
1765
|
+
if (value) {
|
|
1766
|
+
scrimOpacity.value = 1;
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1201
1769
|
isSettled.value = false;
|
|
1202
1770
|
isModalShown.value = false;
|
|
1203
1771
|
});
|
|
@@ -1299,7 +1867,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1299
1867
|
ref: dialog,
|
|
1300
1868
|
class: normalizeClass(["astryx-bottom-sheet-dialog", {
|
|
1301
1869
|
"astryx-bottom-sheet-dialog--scrim": __props.hasScrim,
|
|
1302
|
-
"astryx-bottom-sheet-dialog--closing":
|
|
1870
|
+
"astryx-bottom-sheet-dialog--closing": isClosing.value
|
|
1303
1871
|
}]),
|
|
1304
1872
|
"data-settled": isSettled.value || void 0,
|
|
1305
1873
|
"aria-label": dialogLabel.value,
|
|
@@ -1323,8 +1891,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1323
1891
|
"is-swipe-dismiss-allowed": isSwipeDismissAllowed.value,
|
|
1324
1892
|
onDismiss: requestClose,
|
|
1325
1893
|
onScrimOpacity: _cache[4] || (_cache[4] = ($event) => scrimOpacity.value = $event),
|
|
1326
|
-
|
|
1327
|
-
|
|
1894
|
+
onScrimFade: _cache[5] || (_cache[5] = ($event) => scrimFade.value = $event),
|
|
1895
|
+
onSnap: _cache[6] || (_cache[6] = ($event) => emit("snap", $event)),
|
|
1896
|
+
onMotionStart: _cache[7] || (_cache[7] = ($event) => emit("motionStart", $event)),
|
|
1328
1897
|
onMotionComplete: onPanelMotionComplete
|
|
1329
1898
|
}), {
|
|
1330
1899
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
@@ -1337,7 +1906,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1337
1906
|
"snap-points",
|
|
1338
1907
|
"is-swipe-dismiss-allowed"
|
|
1339
1908
|
])]),
|
|
1340
|
-
_cache[
|
|
1909
|
+
_cache[8] || (_cache[8] = createElementVNode("div", {
|
|
1341
1910
|
class: "astryx-bottom-sheet__edge-tint",
|
|
1342
1911
|
"aria-hidden": "true"
|
|
1343
1912
|
}, null, -1)),
|