@sprawlify/primitives 0.0.109 → 0.0.111
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/{aria-hidden-BX4SWNE_.mjs → aria-hidden-C72KtklN.mjs} +1 -1
- package/dist/{aria-hidden-BAGrxNHt.cjs → aria-hidden-CIBHXlCy.cjs} +1 -1
- package/dist/aria-hidden.cjs +2 -2
- package/dist/aria-hidden.mjs +2 -2
- package/dist/{auto-resize-B1BDDnp1.cjs → auto-resize-BTTNXiml.cjs} +1 -1
- package/dist/{auto-resize-CN2vAzdj.mjs → auto-resize-CbNgN0OO.mjs} +1 -1
- package/dist/auto-resize.cjs +2 -2
- package/dist/auto-resize.mjs +2 -2
- package/dist/collection.d.cts +2 -2
- package/dist/collection.d.mts +2 -2
- package/dist/{core-BmIEKqtP.mjs → core-Ci9Yu6QI.mjs} +1 -1
- package/dist/{core-nBg9RC_y.cjs → core-DwdPztGA.cjs} +1 -1
- package/dist/core.cjs +2 -2
- package/dist/core.mjs +2 -2
- package/dist/{dismissable-DWfZGIA7.mjs → dismissable-B9k5K6f9.mjs} +2 -2
- package/dist/{dismissable-ChwcJMHk.cjs → dismissable-DxjbwsOf.cjs} +2 -2
- package/dist/dismissable.cjs +3 -3
- package/dist/dismissable.mjs +3 -3
- package/dist/{dom-query-s2ESLR2U.mjs → dom-query-BFuRs3l4.mjs} +1 -1
- package/dist/{dom-query-Bd63cRVF.cjs → dom-query-BUO7rGsg.cjs} +1 -1
- package/dist/dom-query.cjs +1 -1
- package/dist/dom-query.mjs +1 -1
- package/dist/{focus-trap-fucc6OU_.cjs → focus-trap-BewqTQFt.cjs} +1 -1
- package/dist/{focus-trap-DzBvBlTH.mjs → focus-trap-Do8IUXYh.mjs} +1 -1
- package/dist/focus-trap.cjs +2 -2
- package/dist/focus-trap.mjs +2 -2
- package/dist/{focus-visible-D5qBaAOn.mjs → focus-visible-GXKbbuiq.mjs} +1 -1
- package/dist/{focus-visible-75XTctXf.cjs → focus-visible-JdJXqMic.cjs} +1 -1
- package/dist/focus-visible.cjs +2 -2
- package/dist/focus-visible.mjs +2 -2
- package/dist/{i18n-utils-DB-lUfrr.cjs → i18n-utils-BRLqoCq8.cjs} +1 -1
- package/dist/{i18n-utils-oWZyUib_.mjs → i18n-utils-DZs1CPj8.mjs} +1 -1
- package/dist/i18n-utils.cjs +2 -2
- package/dist/i18n-utils.mjs +2 -2
- package/dist/{interact-outside-2qkUnl4N.mjs → interact-outside-Ba50N1a5.mjs} +1 -1
- package/dist/{interact-outside-Cx4J0EBf.cjs → interact-outside-Bg-QSXqp.cjs} +1 -1
- package/dist/interact-outside.cjs +2 -2
- package/dist/interact-outside.mjs +2 -2
- package/dist/{list-collection-B_8BN0XB.d.cts → list-collection-Cjgbx_9l.d.cts} +1 -1
- package/dist/{list-collection-DkRA5LOq.d.mts → list-collection-IF510iNl.d.mts} +1 -1
- package/dist/machines/accordion/index.cjs +2 -2
- package/dist/machines/accordion/index.mjs +2 -2
- package/dist/machines/angle-slider/index.cjs +2 -2
- package/dist/machines/angle-slider/index.d.cts +1 -1
- package/dist/machines/angle-slider/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.mjs +2 -2
- package/dist/machines/aspect-ratio/index.cjs +2 -2
- package/dist/machines/aspect-ratio/index.mjs +2 -2
- package/dist/machines/async-list/index.cjs +2 -2
- package/dist/machines/async-list/index.mjs +2 -2
- package/dist/machines/avatar/index.cjs +2 -2
- package/dist/machines/avatar/index.mjs +2 -2
- package/dist/machines/carousel/index.cjs +3 -3
- package/dist/machines/carousel/index.d.cts +1 -1
- package/dist/machines/carousel/index.d.mts +1 -1
- package/dist/machines/carousel/index.mjs +3 -3
- package/dist/machines/cascade-select/index.cjs +5 -5
- package/dist/machines/cascade-select/index.d.cts +2 -2
- package/dist/machines/cascade-select/index.d.mts +2 -2
- package/dist/machines/cascade-select/index.mjs +5 -5
- package/dist/machines/checkbox/index.cjs +3 -3
- package/dist/machines/checkbox/index.d.cts +1 -1
- package/dist/machines/checkbox/index.d.mts +1 -1
- package/dist/machines/checkbox/index.mjs +3 -3
- package/dist/machines/clipboard/index.cjs +2 -2
- package/dist/machines/clipboard/index.d.cts +1 -1
- package/dist/machines/clipboard/index.d.mts +1 -1
- package/dist/machines/clipboard/index.mjs +2 -2
- package/dist/machines/collapsible/index.cjs +2 -2
- package/dist/machines/collapsible/index.d.cts +1 -1
- package/dist/machines/collapsible/index.d.mts +1 -1
- package/dist/machines/collapsible/index.mjs +2 -2
- package/dist/machines/color-picker/index.cjs +5 -5
- package/dist/machines/color-picker/index.d.cts +1 -1
- package/dist/machines/color-picker/index.d.mts +1 -1
- package/dist/machines/color-picker/index.mjs +5 -5
- package/dist/machines/combobox/index.cjs +5 -5
- package/dist/machines/combobox/index.d.cts +2 -2
- package/dist/machines/combobox/index.d.mts +2 -2
- package/dist/machines/combobox/index.mjs +5 -5
- package/dist/machines/date-picker/index.cjs +5 -5
- package/dist/machines/date-picker/index.d.cts +1 -1
- package/dist/machines/date-picker/index.d.mts +1 -1
- package/dist/machines/date-picker/index.mjs +5 -5
- package/dist/machines/dialog/index.cjs +7 -7
- package/dist/machines/dialog/index.d.cts +1 -1
- package/dist/machines/dialog/index.d.mts +1 -1
- package/dist/machines/dialog/index.mjs +7 -7
- package/dist/machines/drawer/index.cjs +1934 -0
- package/dist/machines/drawer/index.d.cts +310 -0
- package/dist/machines/drawer/index.d.mts +310 -0
- package/dist/machines/drawer/index.mjs +1927 -0
- package/dist/machines/dropdown-menu/index.cjs +5 -5
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/dropdown-menu/index.mjs +5 -5
- package/dist/machines/editable/index.cjs +3 -3
- package/dist/machines/editable/index.d.cts +1 -1
- package/dist/machines/editable/index.d.mts +1 -1
- package/dist/machines/editable/index.mjs +3 -3
- package/dist/machines/file-upload/index.cjs +3 -3
- package/dist/machines/file-upload/index.d.cts +1 -1
- package/dist/machines/file-upload/index.d.mts +1 -1
- package/dist/machines/file-upload/index.mjs +3 -3
- package/dist/machines/floating-panel/index.cjs +2 -2
- package/dist/machines/floating-panel/index.d.cts +1 -1
- package/dist/machines/floating-panel/index.d.mts +1 -1
- package/dist/machines/floating-panel/index.mjs +2 -2
- package/dist/machines/hover-card/index.cjs +5 -5
- package/dist/machines/hover-card/index.d.cts +1 -1
- package/dist/machines/hover-card/index.d.mts +1 -1
- package/dist/machines/hover-card/index.mjs +5 -5
- package/dist/machines/image-cropper/index.cjs +2 -2
- package/dist/machines/image-cropper/index.mjs +2 -2
- package/dist/machines/listbox/index.cjs +3 -3
- package/dist/machines/listbox/index.d.cts +3 -3
- package/dist/machines/listbox/index.d.mts +3 -3
- package/dist/machines/listbox/index.mjs +3 -3
- package/dist/machines/marquee/index.cjs +2 -2
- package/dist/machines/marquee/index.d.cts +3 -3
- package/dist/machines/marquee/index.d.mts +3 -3
- package/dist/machines/marquee/index.mjs +2 -2
- package/dist/machines/navigation-menu/index.cjs +4 -4
- package/dist/machines/navigation-menu/index.d.cts +1 -1
- package/dist/machines/navigation-menu/index.d.mts +1 -1
- package/dist/machines/navigation-menu/index.mjs +4 -4
- package/dist/machines/number-input/index.cjs +2 -2
- package/dist/machines/number-input/index.d.cts +1 -1
- package/dist/machines/number-input/index.d.mts +1 -1
- package/dist/machines/number-input/index.mjs +2 -2
- package/dist/machines/pagination/index.cjs +2 -2
- package/dist/machines/pagination/index.mjs +2 -2
- package/dist/machines/password-input/index.cjs +2 -2
- package/dist/machines/password-input/index.d.cts +1 -1
- package/dist/machines/password-input/index.d.mts +1 -1
- package/dist/machines/password-input/index.mjs +2 -2
- package/dist/machines/pin-input/index.cjs +2 -2
- package/dist/machines/pin-input/index.d.cts +1 -1
- package/dist/machines/pin-input/index.d.mts +1 -1
- package/dist/machines/pin-input/index.mjs +2 -2
- package/dist/machines/popover/index.cjs +8 -8
- package/dist/machines/popover/index.d.cts +1 -1
- package/dist/machines/popover/index.d.mts +1 -1
- package/dist/machines/popover/index.mjs +8 -8
- package/dist/machines/presence/index.cjs +2 -2
- package/dist/machines/presence/index.mjs +2 -2
- package/dist/machines/progress/index.cjs +2 -2
- package/dist/machines/progress/index.d.cts +1 -1
- package/dist/machines/progress/index.d.mts +1 -1
- package/dist/machines/progress/index.mjs +2 -2
- package/dist/machines/qr-code/index.cjs +2 -2
- package/dist/machines/qr-code/index.mjs +2 -2
- package/dist/machines/radio-group/index.cjs +3 -3
- package/dist/machines/radio-group/index.d.cts +1 -1
- package/dist/machines/radio-group/index.d.mts +1 -1
- package/dist/machines/radio-group/index.mjs +3 -3
- package/dist/machines/rating-group/index.cjs +2 -2
- package/dist/machines/rating-group/index.mjs +2 -2
- package/dist/machines/scroll-area/index.cjs +2 -2
- package/dist/machines/scroll-area/index.d.cts +1 -1
- package/dist/machines/scroll-area/index.d.mts +1 -1
- package/dist/machines/scroll-area/index.mjs +2 -2
- package/dist/machines/select/index.cjs +6 -6
- package/dist/machines/select/index.d.cts +2 -2
- package/dist/machines/select/index.d.mts +2 -2
- package/dist/machines/select/index.mjs +6 -6
- package/dist/machines/separator/index.cjs +2 -2
- package/dist/machines/separator/index.mjs +2 -2
- package/dist/machines/signature-pad/index.cjs +2 -2
- package/dist/machines/signature-pad/index.mjs +2 -2
- package/dist/machines/slider/index.cjs +2 -2
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/index.d.mts +1 -1
- package/dist/machines/slider/index.mjs +2 -2
- package/dist/machines/splitter/index.cjs +2 -2
- package/dist/machines/splitter/index.mjs +2 -2
- package/dist/machines/steps/index.cjs +2 -2
- package/dist/machines/steps/index.d.cts +1 -1
- package/dist/machines/steps/index.d.mts +1 -1
- package/dist/machines/steps/index.mjs +2 -2
- package/dist/machines/switch/index.cjs +3 -3
- package/dist/machines/switch/index.mjs +3 -3
- package/dist/machines/tabs/index.cjs +2 -2
- package/dist/machines/tabs/index.d.cts +1 -1
- package/dist/machines/tabs/index.d.mts +1 -1
- package/dist/machines/tabs/index.mjs +2 -2
- package/dist/machines/tags-input/index.cjs +4 -4
- package/dist/machines/tags-input/index.d.cts +1 -1
- package/dist/machines/tags-input/index.d.mts +1 -1
- package/dist/machines/tags-input/index.mjs +4 -4
- package/dist/machines/timer/index.cjs +2 -2
- package/dist/machines/timer/index.d.cts +1 -1
- package/dist/machines/timer/index.d.mts +1 -1
- package/dist/machines/timer/index.mjs +2 -2
- package/dist/machines/toast/index.cjs +4 -4
- package/dist/machines/toast/index.d.cts +1 -1
- package/dist/machines/toast/index.d.mts +1 -1
- package/dist/machines/toast/index.mjs +4 -4
- package/dist/machines/toggle/index.cjs +2 -2
- package/dist/machines/toggle/index.mjs +2 -2
- package/dist/machines/toggle-group/index.cjs +2 -2
- package/dist/machines/toggle-group/index.mjs +2 -2
- package/dist/machines/tooltip/index.cjs +4 -4
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tooltip/index.mjs +4 -4
- package/dist/machines/tour/index.cjs +6 -6
- package/dist/machines/tour/index.d.cts +1 -1
- package/dist/machines/tour/index.d.mts +1 -1
- package/dist/machines/tour/index.mjs +6 -6
- package/dist/machines/tree-view/index.cjs +2 -2
- package/dist/machines/tree-view/index.d.cts +1 -1
- package/dist/machines/tree-view/index.d.mts +1 -1
- package/dist/machines/tree-view/index.mjs +2 -2
- package/dist/{popper-BDy37WA0.mjs → popper-BlgbmdAn.mjs} +1 -1
- package/dist/{popper-Cx3KHzeT.cjs → popper-viCrafLC.cjs} +1 -1
- package/dist/popper.cjs +2 -2
- package/dist/popper.mjs +2 -2
- package/dist/{remove-scroll-D9FAOapi.cjs → remove-scroll-D4CMJmU2.cjs} +1 -1
- package/dist/{remove-scroll-HcSiTbd5.mjs → remove-scroll-D55GZoBb.mjs} +1 -1
- package/dist/{scroll-snap-DfSwN3As.mjs → scroll-snap-CdneVP31.mjs} +1 -1
- package/dist/{scroll-snap-Dp_2adEa.cjs → scroll-snap-vZ2q6dcN.cjs} +1 -1
- package/dist/scroll-snap.cjs +2 -2
- package/dist/scroll-snap.mjs +2 -2
- package/dist/{selection-DdNvrKbj.d.mts → selection-6urf-c8j.d.mts} +1 -1
- package/dist/{selection-Bb_ZSVxe.d.cts → selection-BmS2RDMq.d.cts} +1 -1
- package/package.json +11 -11
- package/dist/machines/bottom-sheet/index.cjs +0 -667
- package/dist/machines/bottom-sheet/index.d.cts +0 -239
- package/dist/machines/bottom-sheet/index.d.mts +0 -239
- package/dist/machines/bottom-sheet/index.mjs +0 -662
|
@@ -1,667 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_create_anatomy = require("../../create-anatomy-BnwEmNnc.cjs");
|
|
3
|
-
const require_dom_query = require("../../dom-query-Bd63cRVF.cjs");
|
|
4
|
-
const require_defineProperty = require("../../defineProperty-8IOBQ1i_.cjs");
|
|
5
|
-
const require_aria_hidden = require("../../aria-hidden-BAGrxNHt.cjs");
|
|
6
|
-
const require_utils = require("../../utils-ByNiZU8f.cjs");
|
|
7
|
-
const require_core = require("../../core-nBg9RC_y.cjs");
|
|
8
|
-
require("../../interact-outside-Cx4J0EBf.cjs");
|
|
9
|
-
const require_dismissable = require("../../dismissable-ChwcJMHk.cjs");
|
|
10
|
-
const require_focus_trap = require("../../focus-trap-fucc6OU_.cjs");
|
|
11
|
-
const require_create_props = require("../../create-props-DP39rHnH.cjs");
|
|
12
|
-
const require_remove_scroll = require("../../remove-scroll-D9FAOapi.cjs");
|
|
13
|
-
//#region src/machines/bottom-sheet/bottom-sheet.anatomy.ts
|
|
14
|
-
const anatomy = require_create_anatomy.createAnatomy("bottom-sheet").parts("content", "title", "trigger", "backdrop", "grabber", "grabberIndicator", "closeTrigger");
|
|
15
|
-
const parts = anatomy.build();
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/machines/bottom-sheet/bottom-sheet.dom.ts
|
|
18
|
-
const getContentId = (ctx) => ctx.ids?.content ?? `bottom-sheet:${ctx.id}:content`;
|
|
19
|
-
const getTitleId = (ctx) => ctx.ids?.title ?? `bottom-sheet:${ctx.id}:title`;
|
|
20
|
-
const getTriggerId = (ctx) => ctx.ids?.trigger ?? `bottom-sheet:${ctx.id}:trigger`;
|
|
21
|
-
const getBackdropId = (ctx) => ctx.ids?.backdrop ?? `bottom-sheet:${ctx.id}:backdrop`;
|
|
22
|
-
const getGrabberId = (ctx) => ctx.ids?.grabber ?? `bottom-sheet:${ctx.id}:grabber`;
|
|
23
|
-
const getGrabberIndicatorId = (ctx) => ctx.ids?.grabberIndicator ?? `bottom-sheet:${ctx.id}:grabber-indicator`;
|
|
24
|
-
const getCloseTriggerId = (ctx) => ctx.ids?.closeTrigger ?? `bottom-sheet:${ctx.id}:close-trigger`;
|
|
25
|
-
const getContentEl = (ctx) => ctx.getById(getContentId(ctx));
|
|
26
|
-
const getTriggerEl = (ctx) => ctx.getById(getTriggerId(ctx));
|
|
27
|
-
const getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId(ctx));
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/machines/bottom-sheet/bottom-sheet.connect.ts
|
|
30
|
-
function connect(service, normalize) {
|
|
31
|
-
const { state, send, context, scope, prop } = service;
|
|
32
|
-
const open = state.hasTag("open");
|
|
33
|
-
const dragOffset = context.get("dragOffset");
|
|
34
|
-
const dragging = dragOffset !== null;
|
|
35
|
-
const activeSnapPoint = context.get("activeSnapPoint");
|
|
36
|
-
const resolvedActiveSnapPoint = context.get("resolvedActiveSnapPoint");
|
|
37
|
-
const translate = dragOffset ?? resolvedActiveSnapPoint?.offset;
|
|
38
|
-
function onPointerDown(event) {
|
|
39
|
-
if (!require_dom_query.isLeftClick(event)) return;
|
|
40
|
-
const target = require_dom_query.getEventTarget(event);
|
|
41
|
-
if (target?.hasAttribute("data-no-drag") || target?.closest("[data-no-drag]")) return;
|
|
42
|
-
if (state.matches("closing")) return;
|
|
43
|
-
send({
|
|
44
|
-
type: "POINTER_DOWN",
|
|
45
|
-
point: require_dom_query.getEventPoint(event)
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
open,
|
|
50
|
-
dragging,
|
|
51
|
-
setOpen(nextOpen) {
|
|
52
|
-
if (state.hasTag("open") === nextOpen) return;
|
|
53
|
-
send({ type: nextOpen ? "OPEN" : "CLOSE" });
|
|
54
|
-
},
|
|
55
|
-
snapPoints: prop("snapPoints"),
|
|
56
|
-
activeSnapPoint,
|
|
57
|
-
setActiveSnapPoint(snapPoint) {
|
|
58
|
-
if (context.get("activeSnapPoint") === snapPoint) return;
|
|
59
|
-
send({
|
|
60
|
-
type: "ACTIVE_SNAP_POINT.SET",
|
|
61
|
-
snapPoint
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
getOpenPercentage() {
|
|
65
|
-
if (!open) return 0;
|
|
66
|
-
const contentHeight = context.get("contentHeight");
|
|
67
|
-
if (!contentHeight) return 0;
|
|
68
|
-
const currentOffset = translate ?? 0;
|
|
69
|
-
return Math.max(0, Math.min(1, 1 - currentOffset / contentHeight));
|
|
70
|
-
},
|
|
71
|
-
getActiveSnapIndex() {
|
|
72
|
-
return prop("snapPoints").indexOf(activeSnapPoint);
|
|
73
|
-
},
|
|
74
|
-
getContentHeight() {
|
|
75
|
-
return context.get("contentHeight");
|
|
76
|
-
},
|
|
77
|
-
getContentProps(props = { draggable: true }) {
|
|
78
|
-
return normalize.element({
|
|
79
|
-
...parts.content.attrs,
|
|
80
|
-
dir: prop("dir"),
|
|
81
|
-
id: getContentId(scope),
|
|
82
|
-
tabIndex: -1,
|
|
83
|
-
role: "dialog",
|
|
84
|
-
"aria-modal": prop("modal"),
|
|
85
|
-
"aria-labelledby": getTitleId(scope),
|
|
86
|
-
hidden: !open,
|
|
87
|
-
"data-state": open ? "open" : "closed",
|
|
88
|
-
style: {
|
|
89
|
-
transform: "translate3d(0, var(--bottom-sheet-translate, 0), 0)",
|
|
90
|
-
transitionDuration: dragging ? "0s" : void 0,
|
|
91
|
-
"--bottom-sheet-translate": require_utils.toPx(translate),
|
|
92
|
-
willChange: "transform"
|
|
93
|
-
},
|
|
94
|
-
onPointerDown(event) {
|
|
95
|
-
if (!props.draggable) return;
|
|
96
|
-
onPointerDown(event);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
getTitleProps() {
|
|
101
|
-
return normalize.element({
|
|
102
|
-
...parts.title.attrs,
|
|
103
|
-
id: getTitleId(scope),
|
|
104
|
-
dir: prop("dir")
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
getTriggerProps() {
|
|
108
|
-
return normalize.button({
|
|
109
|
-
...parts.trigger.attrs,
|
|
110
|
-
id: getTriggerId(scope),
|
|
111
|
-
type: "button",
|
|
112
|
-
onClick() {
|
|
113
|
-
send({ type: open ? "CLOSE" : "OPEN" });
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
getBackdropProps() {
|
|
118
|
-
return normalize.element({
|
|
119
|
-
...parts.backdrop.attrs,
|
|
120
|
-
id: getBackdropId(scope),
|
|
121
|
-
hidden: !open,
|
|
122
|
-
"data-state": open ? "open" : "closed",
|
|
123
|
-
style: { willChange: "opacity" }
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
getGrabberProps() {
|
|
127
|
-
return normalize.element({
|
|
128
|
-
...parts.grabber.attrs,
|
|
129
|
-
id: getGrabberId(scope),
|
|
130
|
-
onPointerDown(event) {
|
|
131
|
-
onPointerDown(event);
|
|
132
|
-
},
|
|
133
|
-
style: { touchAction: "none" }
|
|
134
|
-
});
|
|
135
|
-
},
|
|
136
|
-
getGrabberIndicatorProps() {
|
|
137
|
-
return normalize.element({
|
|
138
|
-
...parts.grabberIndicator.attrs,
|
|
139
|
-
id: getGrabberIndicatorId(scope)
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
getCloseTriggerProps() {
|
|
143
|
-
return normalize.button({
|
|
144
|
-
...parts.closeTrigger.attrs,
|
|
145
|
-
id: getCloseTriggerId(scope),
|
|
146
|
-
onClick() {
|
|
147
|
-
send({ type: "CLOSE" });
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/machines/bottom-sheet/utils/find-closest-snap-point.ts
|
|
155
|
-
function findClosestSnapPoint(offset, snapPoints) {
|
|
156
|
-
return snapPoints.reduce((acc, curr) => {
|
|
157
|
-
const closestDiff = Math.abs(offset - acc.offset);
|
|
158
|
-
return Math.abs(offset - curr.offset) < closestDiff ? curr : acc;
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
//#endregion
|
|
162
|
-
//#region src/machines/bottom-sheet/utils/get-scroll-info.ts
|
|
163
|
-
function isScrollContainer(element) {
|
|
164
|
-
const overflow = getComputedStyle(element).overflowY;
|
|
165
|
-
return overflow === "auto" || overflow === "scroll";
|
|
166
|
-
}
|
|
167
|
-
function getScrollInfo(target, container) {
|
|
168
|
-
let element = target;
|
|
169
|
-
let availableScroll = 0;
|
|
170
|
-
let availableScrollTop = 0;
|
|
171
|
-
while (element) {
|
|
172
|
-
const { clientHeight, scrollTop, scrollHeight } = element;
|
|
173
|
-
const scrolled = scrollHeight - scrollTop - clientHeight;
|
|
174
|
-
if ((scrollTop !== 0 || scrolled !== 0) && isScrollContainer(element)) {
|
|
175
|
-
availableScroll += scrolled;
|
|
176
|
-
availableScrollTop += scrollTop;
|
|
177
|
-
}
|
|
178
|
-
if (element === container || element === document.documentElement) break;
|
|
179
|
-
element = element.parentNode;
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
availableScroll,
|
|
183
|
-
availableScrollTop
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region src/machines/bottom-sheet/utils/drag-manager.ts
|
|
188
|
-
const DRAG_START_THRESHOLD = .3;
|
|
189
|
-
var DragManager = class {
|
|
190
|
-
constructor() {
|
|
191
|
-
require_defineProperty._defineProperty(this, "pointerStart", null);
|
|
192
|
-
require_defineProperty._defineProperty(this, "dragOffset", null);
|
|
193
|
-
require_defineProperty._defineProperty(this, "lastPoint", null);
|
|
194
|
-
require_defineProperty._defineProperty(this, "lastTimestamp", null);
|
|
195
|
-
require_defineProperty._defineProperty(this, "velocity", null);
|
|
196
|
-
}
|
|
197
|
-
setPointerStart(point) {
|
|
198
|
-
this.pointerStart = point;
|
|
199
|
-
}
|
|
200
|
-
clearPointerStart() {
|
|
201
|
-
this.pointerStart = null;
|
|
202
|
-
}
|
|
203
|
-
getPointerStart() {
|
|
204
|
-
return this.pointerStart;
|
|
205
|
-
}
|
|
206
|
-
setDragOffset(point, resolvedActiveSnapPointOffset) {
|
|
207
|
-
if (!this.pointerStart) return;
|
|
208
|
-
const currentTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
209
|
-
if (this.lastPoint) {
|
|
210
|
-
const dy = point.y - this.lastPoint.y;
|
|
211
|
-
if (this.lastTimestamp) {
|
|
212
|
-
const dt = currentTimestamp - this.lastTimestamp;
|
|
213
|
-
if (dt > 0) {
|
|
214
|
-
const calculatedVelocity = dy / dt * 1e3;
|
|
215
|
-
this.velocity = Number.isFinite(calculatedVelocity) ? calculatedVelocity : 0;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
this.lastPoint = point;
|
|
220
|
-
this.lastTimestamp = currentTimestamp;
|
|
221
|
-
let delta = this.pointerStart.y - point.y - resolvedActiveSnapPointOffset;
|
|
222
|
-
if (delta > 0) delta = 0;
|
|
223
|
-
this.dragOffset = -delta;
|
|
224
|
-
}
|
|
225
|
-
getDragOffset() {
|
|
226
|
-
return this.dragOffset;
|
|
227
|
-
}
|
|
228
|
-
clearDragOffset() {
|
|
229
|
-
this.dragOffset = null;
|
|
230
|
-
}
|
|
231
|
-
getVelocity() {
|
|
232
|
-
return this.velocity;
|
|
233
|
-
}
|
|
234
|
-
clearVelocityTracking() {
|
|
235
|
-
this.lastPoint = null;
|
|
236
|
-
this.lastTimestamp = null;
|
|
237
|
-
this.velocity = null;
|
|
238
|
-
}
|
|
239
|
-
clear() {
|
|
240
|
-
this.clearPointerStart();
|
|
241
|
-
this.clearDragOffset();
|
|
242
|
-
this.clearVelocityTracking();
|
|
243
|
-
}
|
|
244
|
-
shouldStartDragging(point, target, container, preventDragOnScroll) {
|
|
245
|
-
if (!this.pointerStart || !container) return false;
|
|
246
|
-
if (preventDragOnScroll) {
|
|
247
|
-
const delta = this.pointerStart.y - point.y;
|
|
248
|
-
if (Math.abs(delta) < DRAG_START_THRESHOLD) return false;
|
|
249
|
-
const { availableScroll, availableScrollTop } = getScrollInfo(target, container);
|
|
250
|
-
if (delta > 0 && Math.abs(availableScroll) > 1 || delta < 0 && Math.abs(availableScrollTop) > 0) return false;
|
|
251
|
-
}
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
findClosestSnapPoint(snapPoints) {
|
|
255
|
-
if (this.dragOffset === null) return snapPoints[0]?.value ?? 1;
|
|
256
|
-
return findClosestSnapPoint(this.dragOffset, snapPoints).value;
|
|
257
|
-
}
|
|
258
|
-
shouldDismiss(contentHeight, snapPoints, swipeVelocityThreshold, closeThreshold) {
|
|
259
|
-
if (this.dragOffset === null || this.velocity === null || contentHeight === null) return false;
|
|
260
|
-
const visibleHeight = contentHeight - this.dragOffset;
|
|
261
|
-
const smallestSnapPoint = snapPoints.reduce((acc, curr) => curr.offset > acc.offset ? curr : acc);
|
|
262
|
-
const isFastSwipe = this.velocity > 0 && this.velocity >= swipeVelocityThreshold;
|
|
263
|
-
const closeThresholdInPixels = contentHeight * (1 - closeThreshold);
|
|
264
|
-
const isBelowSmallestSnapPoint = visibleHeight < contentHeight - smallestSnapPoint.offset;
|
|
265
|
-
return isFastSwipe || visibleHeight < closeThresholdInPixels && isBelowSmallestSnapPoint || visibleHeight === 0;
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
//#endregion
|
|
269
|
-
//#region src/machines/bottom-sheet/utils/resolve-snap-point.ts
|
|
270
|
-
function resolveSnapPoint(snapPoint, containerHeight) {
|
|
271
|
-
if (typeof snapPoint === "number") return {
|
|
272
|
-
value: snapPoint,
|
|
273
|
-
offset: containerHeight - snapPoint * containerHeight
|
|
274
|
-
};
|
|
275
|
-
if (typeof snapPoint === "string") return {
|
|
276
|
-
value: snapPoint,
|
|
277
|
-
offset: containerHeight - parseFloat(snapPoint)
|
|
278
|
-
};
|
|
279
|
-
throw new Error(`Invalid snap point: ${snapPoint}`);
|
|
280
|
-
}
|
|
281
|
-
//#endregion
|
|
282
|
-
//#region src/machines/bottom-sheet/bottom-sheet.machine.ts
|
|
283
|
-
const machine = require_core.createMachine({
|
|
284
|
-
props({ props, scope }) {
|
|
285
|
-
const initialFocusEl = props.role === "alertdialog" ? () => getCloseTriggerEl(scope) : void 0;
|
|
286
|
-
const modal = typeof props.modal === "boolean" ? props.modal : true;
|
|
287
|
-
return {
|
|
288
|
-
modal,
|
|
289
|
-
trapFocus: modal,
|
|
290
|
-
preventScroll: modal,
|
|
291
|
-
closeOnInteractOutside: true,
|
|
292
|
-
closeOnEscape: true,
|
|
293
|
-
restoreFocus: true,
|
|
294
|
-
initialFocusEl,
|
|
295
|
-
snapPoints: [1],
|
|
296
|
-
defaultActiveSnapPoint: 1,
|
|
297
|
-
swipeVelocityThreshold: 700,
|
|
298
|
-
closeThreshold: .25,
|
|
299
|
-
preventDragOnScroll: true,
|
|
300
|
-
...props
|
|
301
|
-
};
|
|
302
|
-
},
|
|
303
|
-
context({ bindable, prop }) {
|
|
304
|
-
return {
|
|
305
|
-
dragOffset: bindable(() => ({ defaultValue: null })),
|
|
306
|
-
activeSnapPoint: bindable(() => ({
|
|
307
|
-
defaultValue: prop("defaultActiveSnapPoint"),
|
|
308
|
-
value: prop("activeSnapPoint"),
|
|
309
|
-
onChange(value) {
|
|
310
|
-
return prop("onActiveSnapPointChange")?.({ snapPoint: value });
|
|
311
|
-
}
|
|
312
|
-
})),
|
|
313
|
-
resolvedActiveSnapPoint: bindable(() => ({ defaultValue: null })),
|
|
314
|
-
contentHeight: bindable(() => ({ defaultValue: null }))
|
|
315
|
-
};
|
|
316
|
-
},
|
|
317
|
-
refs() {
|
|
318
|
-
return { dragManager: new DragManager() };
|
|
319
|
-
},
|
|
320
|
-
computed: { resolvedSnapPoints({ context, prop }) {
|
|
321
|
-
const contentHeight = context.get("contentHeight");
|
|
322
|
-
if (contentHeight === null) return [];
|
|
323
|
-
return prop("snapPoints").map((snapPoint) => resolveSnapPoint(snapPoint, contentHeight));
|
|
324
|
-
} },
|
|
325
|
-
watch({ track, context, prop, action }) {
|
|
326
|
-
track([() => context.get("activeSnapPoint"), () => context.get("contentHeight")], () => {
|
|
327
|
-
const activeSnapPoint = context.get("activeSnapPoint");
|
|
328
|
-
const contentHeight = context.get("contentHeight");
|
|
329
|
-
if (contentHeight === null) return;
|
|
330
|
-
const resolvedActiveSnapPoint = resolveSnapPoint(activeSnapPoint, contentHeight);
|
|
331
|
-
context.set("resolvedActiveSnapPoint", resolvedActiveSnapPoint);
|
|
332
|
-
});
|
|
333
|
-
track([() => prop("open")], () => {
|
|
334
|
-
action(["toggleVisibility"]);
|
|
335
|
-
});
|
|
336
|
-
},
|
|
337
|
-
initialState({ prop }) {
|
|
338
|
-
return prop("open") || prop("defaultOpen") ? "open" : "closed";
|
|
339
|
-
},
|
|
340
|
-
on: { "ACTIVE_SNAP_POINT.SET": { actions: ["setActiveSnapPoint"] } },
|
|
341
|
-
states: {
|
|
342
|
-
open: {
|
|
343
|
-
tags: ["open"],
|
|
344
|
-
effects: [
|
|
345
|
-
"trackDismissableElement",
|
|
346
|
-
"preventScroll",
|
|
347
|
-
"trapFocus",
|
|
348
|
-
"hideContentBelow",
|
|
349
|
-
"trackPointerMove",
|
|
350
|
-
"trackContentHeight"
|
|
351
|
-
],
|
|
352
|
-
on: {
|
|
353
|
-
"CONTROLLED.CLOSE": { target: "closed" },
|
|
354
|
-
POINTER_DOWN: { actions: ["setPointerStart"] },
|
|
355
|
-
POINTER_MOVE: [{
|
|
356
|
-
guard: "isDragging",
|
|
357
|
-
actions: ["setDragOffset"]
|
|
358
|
-
}, {
|
|
359
|
-
guard: "shouldStartDragging",
|
|
360
|
-
actions: ["setDragOffset"]
|
|
361
|
-
}],
|
|
362
|
-
POINTER_UP: [
|
|
363
|
-
{
|
|
364
|
-
guard: "shouldCloseOnSwipe",
|
|
365
|
-
target: "closing"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
guard: "isDragging",
|
|
369
|
-
actions: [
|
|
370
|
-
"setClosestSnapPoint",
|
|
371
|
-
"clearPointerStart",
|
|
372
|
-
"clearDragOffset"
|
|
373
|
-
]
|
|
374
|
-
},
|
|
375
|
-
{ actions: ["clearPointerStart", "clearDragOffset"] }
|
|
376
|
-
],
|
|
377
|
-
CLOSE: [{
|
|
378
|
-
guard: "isOpenControlled",
|
|
379
|
-
actions: ["invokeOnClose"]
|
|
380
|
-
}, {
|
|
381
|
-
target: "closing",
|
|
382
|
-
actions: ["invokeOnClose"]
|
|
383
|
-
}]
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
closing: {
|
|
387
|
-
effects: ["trackExitAnimation"],
|
|
388
|
-
on: { ANIMATION_END: {
|
|
389
|
-
target: "closed",
|
|
390
|
-
actions: [
|
|
391
|
-
"invokeOnClose",
|
|
392
|
-
"clearPointerStart",
|
|
393
|
-
"clearDragOffset",
|
|
394
|
-
"clearActiveSnapPoint",
|
|
395
|
-
"clearResolvedActiveSnapPoint",
|
|
396
|
-
"clearContentHeight",
|
|
397
|
-
"clearVelocityTracking"
|
|
398
|
-
]
|
|
399
|
-
} }
|
|
400
|
-
},
|
|
401
|
-
closed: {
|
|
402
|
-
tags: ["closed"],
|
|
403
|
-
on: {
|
|
404
|
-
"CONTROLLED.OPEN": { target: "open" },
|
|
405
|
-
OPEN: [{
|
|
406
|
-
guard: "isOpenControlled",
|
|
407
|
-
actions: ["invokeOnOpen"]
|
|
408
|
-
}, {
|
|
409
|
-
target: "open",
|
|
410
|
-
actions: ["invokeOnOpen"]
|
|
411
|
-
}]
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
implementations: {
|
|
416
|
-
guards: {
|
|
417
|
-
isOpenControlled: ({ prop }) => prop("open") !== void 0,
|
|
418
|
-
isDragging({ context }) {
|
|
419
|
-
return context.get("dragOffset") !== null;
|
|
420
|
-
},
|
|
421
|
-
shouldStartDragging({ prop, refs, event, scope }) {
|
|
422
|
-
return refs.get("dragManager").shouldStartDragging(event.point, event.target, getContentEl(scope), prop("preventDragOnScroll"));
|
|
423
|
-
},
|
|
424
|
-
shouldCloseOnSwipe({ prop, context, computed, refs }) {
|
|
425
|
-
return refs.get("dragManager").shouldDismiss(context.get("contentHeight"), computed("resolvedSnapPoints"), prop("swipeVelocityThreshold"), prop("closeThreshold"));
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
actions: {
|
|
429
|
-
invokeOnOpen({ prop }) {
|
|
430
|
-
prop("onOpenChange")?.({ open: true });
|
|
431
|
-
},
|
|
432
|
-
invokeOnClose({ prop }) {
|
|
433
|
-
prop("onOpenChange")?.({ open: false });
|
|
434
|
-
},
|
|
435
|
-
setActiveSnapPoint({ context, event }) {
|
|
436
|
-
context.set("activeSnapPoint", event.snapPoint);
|
|
437
|
-
},
|
|
438
|
-
setPointerStart({ event, refs }) {
|
|
439
|
-
refs.get("dragManager").setPointerStart(event.point);
|
|
440
|
-
},
|
|
441
|
-
setDragOffset({ context, event, refs }) {
|
|
442
|
-
const dragManager = refs.get("dragManager");
|
|
443
|
-
dragManager.setDragOffset(event.point, context.get("resolvedActiveSnapPoint")?.offset || 0);
|
|
444
|
-
context.set("dragOffset", dragManager.getDragOffset());
|
|
445
|
-
},
|
|
446
|
-
setClosestSnapPoint({ computed, context, refs }) {
|
|
447
|
-
const snapPoints = computed("resolvedSnapPoints");
|
|
448
|
-
const contentHeight = context.get("contentHeight");
|
|
449
|
-
if (!snapPoints.length || contentHeight === null) return;
|
|
450
|
-
const closestSnapPoint = refs.get("dragManager").findClosestSnapPoint(snapPoints);
|
|
451
|
-
context.set("activeSnapPoint", closestSnapPoint);
|
|
452
|
-
const resolved = resolveSnapPoint(closestSnapPoint, contentHeight);
|
|
453
|
-
context.set("resolvedActiveSnapPoint", resolved);
|
|
454
|
-
},
|
|
455
|
-
clearDragOffset({ context, refs }) {
|
|
456
|
-
refs.get("dragManager").clearDragOffset();
|
|
457
|
-
context.set("dragOffset", null);
|
|
458
|
-
},
|
|
459
|
-
clearActiveSnapPoint({ context, prop }) {
|
|
460
|
-
context.set("activeSnapPoint", prop("defaultActiveSnapPoint"));
|
|
461
|
-
},
|
|
462
|
-
clearResolvedActiveSnapPoint({ context }) {
|
|
463
|
-
context.set("resolvedActiveSnapPoint", null);
|
|
464
|
-
},
|
|
465
|
-
clearPointerStart({ refs }) {
|
|
466
|
-
refs.get("dragManager").clearPointerStart();
|
|
467
|
-
},
|
|
468
|
-
clearContentHeight({ context }) {
|
|
469
|
-
context.set("contentHeight", null);
|
|
470
|
-
},
|
|
471
|
-
clearVelocityTracking({ refs }) {
|
|
472
|
-
refs.get("dragManager").clearVelocityTracking();
|
|
473
|
-
},
|
|
474
|
-
toggleVisibility({ event, send, prop }) {
|
|
475
|
-
send({
|
|
476
|
-
type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE",
|
|
477
|
-
previousEvent: event
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
|
-
effects: {
|
|
482
|
-
trackDismissableElement({ scope, prop, send }) {
|
|
483
|
-
const getContentEl$1 = () => getContentEl(scope);
|
|
484
|
-
return require_dismissable.trackDismissableElement(getContentEl$1, {
|
|
485
|
-
defer: true,
|
|
486
|
-
exclude: [getTriggerEl(scope)],
|
|
487
|
-
onInteractOutside(event) {
|
|
488
|
-
prop("onInteractOutside")?.(event);
|
|
489
|
-
if (!prop("closeOnInteractOutside")) event.preventDefault();
|
|
490
|
-
},
|
|
491
|
-
onFocusOutside: prop("onFocusOutside"),
|
|
492
|
-
onEscapeKeyDown(event) {
|
|
493
|
-
prop("onEscapeKeyDown")?.(event);
|
|
494
|
-
if (!prop("closeOnEscape")) event.preventDefault();
|
|
495
|
-
},
|
|
496
|
-
onPointerDownOutside: prop("onPointerDownOutside"),
|
|
497
|
-
onRequestDismiss: prop("onRequestDismiss"),
|
|
498
|
-
onDismiss() {
|
|
499
|
-
send({
|
|
500
|
-
type: "CLOSE",
|
|
501
|
-
src: "interact-outside"
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
},
|
|
506
|
-
preventScroll({ scope, prop }) {
|
|
507
|
-
if (!prop("preventScroll")) return;
|
|
508
|
-
return require_remove_scroll.preventBodyScroll(scope.getDoc());
|
|
509
|
-
},
|
|
510
|
-
trapFocus({ scope, prop }) {
|
|
511
|
-
if (!prop("trapFocus")) return;
|
|
512
|
-
const contentEl = () => getContentEl(scope);
|
|
513
|
-
return require_focus_trap.trapFocus(contentEl, {
|
|
514
|
-
preventScroll: true,
|
|
515
|
-
returnFocusOnDeactivate: !!prop("restoreFocus"),
|
|
516
|
-
initialFocus: prop("initialFocusEl"),
|
|
517
|
-
setReturnFocus: (el) => prop("finalFocusEl")?.() || el,
|
|
518
|
-
getShadowRoot: true
|
|
519
|
-
});
|
|
520
|
-
},
|
|
521
|
-
hideContentBelow({ scope, prop }) {
|
|
522
|
-
if (!prop("modal")) return;
|
|
523
|
-
const getElements = () => [getContentEl(scope)];
|
|
524
|
-
return require_aria_hidden.ariaHidden(getElements, { defer: true });
|
|
525
|
-
},
|
|
526
|
-
trackPointerMove({ scope, send, prop }) {
|
|
527
|
-
let lastY = 0;
|
|
528
|
-
function onPointerMove(event) {
|
|
529
|
-
send({
|
|
530
|
-
type: "POINTER_MOVE",
|
|
531
|
-
point: require_dom_query.getEventPoint(event),
|
|
532
|
-
target: require_dom_query.getEventTarget(event)
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
function onPointerUp(event) {
|
|
536
|
-
if (event.pointerType === "touch") return;
|
|
537
|
-
send({
|
|
538
|
-
type: "POINTER_UP",
|
|
539
|
-
point: require_dom_query.getEventPoint(event)
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
function onTouchStart(event) {
|
|
543
|
-
if (!event.touches[0]) return;
|
|
544
|
-
lastY = event.touches[0].clientY;
|
|
545
|
-
}
|
|
546
|
-
function onTouchMove(event) {
|
|
547
|
-
if (!event.touches[0]) return;
|
|
548
|
-
const point = require_dom_query.getEventPoint(event);
|
|
549
|
-
const target = event.target;
|
|
550
|
-
if (!prop("preventDragOnScroll")) {
|
|
551
|
-
send({
|
|
552
|
-
type: "POINTER_MOVE",
|
|
553
|
-
point,
|
|
554
|
-
target
|
|
555
|
-
});
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
const contentEl = getContentEl(scope);
|
|
559
|
-
if (!contentEl) return;
|
|
560
|
-
let el = target;
|
|
561
|
-
while (el && el !== contentEl && el.scrollHeight <= el.clientHeight) el = el.parentElement;
|
|
562
|
-
if (el && el !== contentEl) {
|
|
563
|
-
const scrollTop = el.scrollTop;
|
|
564
|
-
const y = event.touches[0].clientY;
|
|
565
|
-
if (scrollTop <= 0 && y > lastY) event.preventDefault();
|
|
566
|
-
lastY = y;
|
|
567
|
-
}
|
|
568
|
-
send({
|
|
569
|
-
type: "POINTER_MOVE",
|
|
570
|
-
point,
|
|
571
|
-
target
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
function onTouchEnd(event) {
|
|
575
|
-
if (event.touches.length !== 0) return;
|
|
576
|
-
send({
|
|
577
|
-
type: "POINTER_UP",
|
|
578
|
-
point: require_dom_query.getEventPoint(event)
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
const doc = scope.getDoc();
|
|
582
|
-
const cleanups = [
|
|
583
|
-
require_dom_query.addDomEvent(doc, "pointermove", onPointerMove),
|
|
584
|
-
require_dom_query.addDomEvent(doc, "pointerup", onPointerUp),
|
|
585
|
-
require_dom_query.addDomEvent(doc, "touchstart", onTouchStart, { passive: false }),
|
|
586
|
-
require_dom_query.addDomEvent(doc, "touchmove", onTouchMove, { passive: false }),
|
|
587
|
-
require_dom_query.addDomEvent(doc, "touchend", onTouchEnd)
|
|
588
|
-
];
|
|
589
|
-
return () => {
|
|
590
|
-
cleanups.forEach((cleanup) => cleanup());
|
|
591
|
-
};
|
|
592
|
-
},
|
|
593
|
-
trackContentHeight({ context, scope }) {
|
|
594
|
-
const contentEl = getContentEl(scope);
|
|
595
|
-
if (!contentEl) return;
|
|
596
|
-
const updateHeight = () => {
|
|
597
|
-
const rect = contentEl.getBoundingClientRect();
|
|
598
|
-
context.set("contentHeight", rect.height);
|
|
599
|
-
};
|
|
600
|
-
updateHeight();
|
|
601
|
-
return require_dom_query.resizeObserverBorderBox.observe(contentEl, updateHeight);
|
|
602
|
-
},
|
|
603
|
-
trackExitAnimation({ send, scope }) {
|
|
604
|
-
let cleanup;
|
|
605
|
-
const rafCleanup = require_dom_query.raf(() => {
|
|
606
|
-
const contentEl = getContentEl(scope);
|
|
607
|
-
if (!contentEl) return;
|
|
608
|
-
const animationName = getComputedStyle(contentEl).animationName;
|
|
609
|
-
if (!animationName || animationName === "none") {
|
|
610
|
-
send({ type: "ANIMATION_END" });
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
const onEnd = (event) => {
|
|
614
|
-
if (require_dom_query.getEventTarget(event) === contentEl) send({ type: "ANIMATION_END" });
|
|
615
|
-
};
|
|
616
|
-
contentEl.addEventListener("animationend", onEnd);
|
|
617
|
-
cleanup = () => {
|
|
618
|
-
contentEl.removeEventListener("animationend", onEnd);
|
|
619
|
-
};
|
|
620
|
-
});
|
|
621
|
-
return () => {
|
|
622
|
-
rafCleanup();
|
|
623
|
-
cleanup?.();
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
//#endregion
|
|
630
|
-
//#region src/machines/bottom-sheet/bottom-sheet.props.ts
|
|
631
|
-
const props = require_create_props.createProps()([
|
|
632
|
-
"id",
|
|
633
|
-
"ids",
|
|
634
|
-
"dir",
|
|
635
|
-
"modal",
|
|
636
|
-
"initialFocusEl",
|
|
637
|
-
"finalFocusEl",
|
|
638
|
-
"open",
|
|
639
|
-
"defaultOpen",
|
|
640
|
-
"getRootNode",
|
|
641
|
-
"snapPoints",
|
|
642
|
-
"swipeVelocityThreshold",
|
|
643
|
-
"closeThreshold",
|
|
644
|
-
"preventDragOnScroll",
|
|
645
|
-
"closeOnEscape",
|
|
646
|
-
"closeOnInteractOutside",
|
|
647
|
-
"onEscapeKeyDown",
|
|
648
|
-
"onFocusOutside",
|
|
649
|
-
"onInteractOutside",
|
|
650
|
-
"onOpenChange",
|
|
651
|
-
"onPointerDownOutside",
|
|
652
|
-
"onRequestDismiss",
|
|
653
|
-
"preventScroll",
|
|
654
|
-
"restoreFocus",
|
|
655
|
-
"role",
|
|
656
|
-
"trapFocus",
|
|
657
|
-
"defaultActiveSnapPoint",
|
|
658
|
-
"activeSnapPoint",
|
|
659
|
-
"onActiveSnapPointChange"
|
|
660
|
-
]);
|
|
661
|
-
const splitProps = require_utils.createSplitProps(props);
|
|
662
|
-
//#endregion
|
|
663
|
-
exports.anatomy = anatomy;
|
|
664
|
-
exports.connect = connect;
|
|
665
|
-
exports.machine = machine;
|
|
666
|
-
exports.props = props;
|
|
667
|
-
exports.splitProps = splitProps;
|