@orioncactuscorp/ui 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -27
- package/dist/components/Accordion/Accordion.css +1 -1
- package/dist/components/Accordion/Accordion.js +39 -38
- package/dist/components/Accordion/Accordion.module.scss.js +5 -5
- package/dist/components/ActionArea/ActionArea.css +1 -1
- package/dist/components/ActionArea/ActionArea.js +101 -71
- package/dist/components/ActionArea/ActionAreaLayout.css +1 -0
- package/dist/components/ActionArea/ActionAreaLayout.js +145 -0
- package/dist/components/ActionArea/ActionAreaLayout.module.scss.js +11 -0
- package/dist/components/ActionArea.js +10 -4
- package/dist/components/Alert/Alert.css +1 -1
- package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -1
- package/dist/components/BackgroundIconButton/BackgroundIconButton.js +72 -52
- package/dist/components/Badge/Badge.css +1 -1
- package/dist/components/Badge/Badge.js +69 -25
- package/dist/components/Button/Button.css +1 -1
- package/dist/components/Button/Button.js +79 -139
- package/dist/components/Cell/Cell.css +1 -1
- package/dist/components/Cell/Cell.js +98 -88
- package/dist/components/CheckMark/CheckMark.css +1 -1
- package/dist/components/CheckMark/CheckMark.js +20 -18
- package/dist/components/CheckMark/CheckMark.module.scss.js +7 -3
- package/dist/components/Checkbox/Checkbox.css +1 -1
- package/dist/components/Checkbox/Checkbox.module.scss.js +10 -8
- package/dist/components/Field/Field.css +1 -1
- package/dist/components/Fieldset/Fieldset.css +1 -1
- package/dist/components/IconButton/IconButton.css +1 -1
- package/dist/components/IconButton/IconButton.js +48 -29
- package/dist/components/Interaction/Interaction.css +1 -1
- package/dist/components/Loading/Loading.css +1 -1
- package/dist/components/Loading/Loading.js +10 -10
- package/dist/components/Menu/Menu.css +1 -1
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +377 -346
- package/dist/components/Modal/useModalDrag.js +654 -614
- package/dist/components/Radio/Radio.css +1 -1
- package/dist/components/Radio/Radio.module.scss.js +9 -7
- package/dist/components/ScrollArea/ScrollArea.css +1 -1
- package/dist/components/SectionHeader/SectionHeader.css +1 -1
- package/dist/components/Select/Select.css +1 -1
- package/dist/components/Select/Select.js +15 -15
- package/dist/components/Select/SelectContent.css +1 -1
- package/dist/components/Switch/Switch.css +1 -1
- package/dist/components/Switch/Switch.module.scss.js +6 -4
- package/dist/components/TextArea/TextArea.css +1 -1
- package/dist/components/TextArea/TextAreaContent.css +1 -1
- package/dist/components/TextButton/TextButton.css +1 -1
- package/dist/components/TextInput/TextInput.css +1 -1
- package/dist/components/TextInput/TextInputContent.css +1 -1
- package/dist/components/Tooltip/Tooltip.css +1 -1
- package/dist/components/internal/Pressable.js +90 -0
- package/dist/foundations/atomic.css +1 -1
- package/dist/foundations/motion.css +1 -1
- package/dist/foundations/typo.css +1 -1
- package/dist/foundations.css +3 -3
- package/dist/index.js +102 -96
- package/dist/react/motion.js +109 -106
- package/dist/styles.css +32 -31
- package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/ui/src/components/ActionArea/ActionArea.d.ts +1 -1
- package/dist/ui/src/components/ActionArea/ActionArea.d.ts.map +1 -1
- package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts +12 -0
- package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts.map +1 -0
- package/dist/ui/src/components/ActionArea/index.d.ts +2 -1
- package/dist/ui/src/components/ActionArea/index.d.ts.map +1 -1
- package/dist/ui/src/components/ActionArea/types.d.ts +13 -2
- package/dist/ui/src/components/ActionArea/types.d.ts.map +1 -1
- package/dist/ui/src/components/BackgroundIconButton/BackgroundIconButton.d.ts +1 -1
- package/dist/ui/src/components/BackgroundIconButton/BackgroundIconButton.d.ts.map +1 -1
- package/dist/ui/src/components/BackgroundIconButton/index.d.ts +1 -1
- package/dist/ui/src/components/BackgroundIconButton/index.d.ts.map +1 -1
- package/dist/ui/src/components/BackgroundIconButton/types.d.ts +6 -5
- package/dist/ui/src/components/BackgroundIconButton/types.d.ts.map +1 -1
- package/dist/ui/src/components/Badge/Badge.d.ts +1 -1
- package/dist/ui/src/components/Badge/Badge.d.ts.map +1 -1
- package/dist/ui/src/components/Badge/types.d.ts +19 -2
- package/dist/ui/src/components/Badge/types.d.ts.map +1 -1
- package/dist/ui/src/components/Button/Button.d.ts.map +1 -1
- package/dist/ui/src/components/Button/types.d.ts +3 -7
- package/dist/ui/src/components/Button/types.d.ts.map +1 -1
- package/dist/ui/src/components/Cell/Cell.d.ts.map +1 -1
- package/dist/ui/src/components/CheckMark/CheckMark.d.ts +1 -1
- package/dist/ui/src/components/CheckMark/CheckMark.d.ts.map +1 -1
- package/dist/ui/src/components/CheckMark/index.d.ts +1 -1
- package/dist/ui/src/components/CheckMark/index.d.ts.map +1 -1
- package/dist/ui/src/components/CheckMark/types.d.ts +2 -0
- package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -1
- package/dist/ui/src/components/IconButton/IconButton.d.ts +1 -1
- package/dist/ui/src/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/ui/src/components/IconButton/index.d.ts +1 -1
- package/dist/ui/src/components/IconButton/index.d.ts.map +1 -1
- package/dist/ui/src/components/IconButton/types.d.ts +6 -5
- package/dist/ui/src/components/IconButton/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/contexts.d.ts +1 -0
- package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/types.d.ts +7 -6
- package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
- package/dist/ui/src/components/internal/Pressable.d.ts +19 -0
- package/dist/ui/src/components/internal/Pressable.d.ts.map +1 -0
- package/dist/ui/src/index.d.ts +5 -5
- package/dist/ui/src/index.d.ts.map +1 -1
- package/dist/ui/src/react/motion/index.d.ts +9 -8
- package/dist/ui/src/react/motion/index.d.ts.map +1 -1
- package/dist/ui/src/utils/motion.d.ts +15 -14
- package/dist/ui/src/utils/motion.d.ts.map +1 -1
- package/dist/utils/motion.js +282 -183
- package/dist/vscode/oc-ui-vars.css +31 -16
- package/package.json +2 -2
- package/src/scss/foundations/atomic.scss +12 -10
- package/src/scss/foundations/atomic.test.ts +34 -0
- package/src/scss/foundations/motion.scss +30 -16
- package/src/scss/foundations/typo.scss +1 -1
- package/src/scss/index.scss +1 -0
- package/src/scss/mixins/_motion.scss +168 -77
- package/src/scss/mixins/_motion.test.ts +137 -54
- package/src/scss/mixins/_radius.scss +3 -0
- package/src/scss/mixins/_radius.test.ts +52 -0
- package/src/scss/mixins/_typo.scss +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { ocSpring as
|
|
3
|
-
import { resolveOcMotion as
|
|
4
|
-
import { resolveModalPopupSnapPositions as
|
|
5
|
-
import { setModalBodyTouchScrollLock as
|
|
6
|
-
import { createSpringAnimator as
|
|
7
|
-
const
|
|
1
|
+
import { useRef as E, useLayoutEffect as lt, useCallback as p, useEffect as kt } from "react";
|
|
2
|
+
import { ocSpring as Xe } from "../../utils/spring.js";
|
|
3
|
+
import { resolveOcMotion as At } from "../../utils/motion.js";
|
|
4
|
+
import { resolveModalPopupSnapPositions as De } from "./snapPoints.js";
|
|
5
|
+
import { setModalBodyTouchScrollLock as Bt, shouldLockModalBodyTouchScroll as ve, shouldIgnoreDragTarget as Ct, getScrollableAncestor as Se, getBottomTouchDragDecision as Ye, getPopupTouchDragDecision as Me } from "./modalScrollArbitration.js";
|
|
6
|
+
import { createSpringAnimator as It } from "../../utils/spring/animator.js";
|
|
7
|
+
const b = {
|
|
8
8
|
dragStartThresholdPx: {
|
|
9
9
|
touch: 10,
|
|
10
10
|
mouse: 2
|
|
@@ -22,124 +22,131 @@ const M = {
|
|
|
22
22
|
minDistancePx: 24
|
|
23
23
|
},
|
|
24
24
|
rubberBand: {
|
|
25
|
-
resistance: 0.55
|
|
25
|
+
resistance: 0.55,
|
|
26
|
+
// Calibrated from iOS bottom-sheet recordings: upward approx 10.3vh, downward approx 15.6vh.
|
|
27
|
+
observedViewportLimitRatio: {
|
|
28
|
+
top: 0.105,
|
|
29
|
+
bottom: 0.16
|
|
30
|
+
}
|
|
26
31
|
},
|
|
27
32
|
settleSpring: {
|
|
28
33
|
durationSeconds: 0.5
|
|
29
34
|
},
|
|
30
35
|
popupDragFollower: {
|
|
31
|
-
|
|
36
|
+
settleDurationFactor: 1 / 6
|
|
32
37
|
}
|
|
33
|
-
},
|
|
34
|
-
duration:
|
|
35
|
-
}),
|
|
36
|
-
function
|
|
38
|
+
}, Ee = Xe.snappy({
|
|
39
|
+
duration: b.settleSpring.durationSeconds * b.popupDragFollower.settleDurationFactor
|
|
40
|
+
}), be = [], Le = [];
|
|
41
|
+
function te(r) {
|
|
37
42
|
r.cancelable !== !1 && r.preventDefault();
|
|
38
43
|
}
|
|
39
|
-
function
|
|
44
|
+
function L(r, n, l) {
|
|
40
45
|
return Math.min(Math.max(r, n), l);
|
|
41
46
|
}
|
|
42
|
-
function
|
|
47
|
+
function ee(r) {
|
|
43
48
|
return [...new Set(r)].sort((n, l) => n - l);
|
|
44
49
|
}
|
|
45
|
-
function
|
|
50
|
+
function Fe(r, n) {
|
|
46
51
|
return r.reduce(
|
|
47
|
-
(l,
|
|
52
|
+
(l, a) => Math.abs(a - n) < Math.abs(l - n) ? a : l
|
|
48
53
|
);
|
|
49
54
|
}
|
|
50
|
-
function
|
|
55
|
+
function re({
|
|
51
56
|
deltaX: r,
|
|
52
57
|
deltaY: n,
|
|
53
58
|
placement: l
|
|
54
59
|
}) {
|
|
55
60
|
return l === "bottom" ? Math.abs(n) : Math.hypot(r, n);
|
|
56
61
|
}
|
|
57
|
-
function
|
|
62
|
+
function ke(r, n, l) {
|
|
58
63
|
if (l === "down")
|
|
59
64
|
return r.find((i) => i > n + 1) ?? r[r.length - 1] ?? 0;
|
|
60
65
|
for (let i = r.length - 1; i >= 0; i -= 1) {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
66
|
+
const f = r[i];
|
|
67
|
+
if (f !== void 0 && f < n - 1)
|
|
68
|
+
return f;
|
|
64
69
|
}
|
|
65
70
|
return r[0] ?? 0;
|
|
66
71
|
}
|
|
67
|
-
function
|
|
68
|
-
const T =
|
|
69
|
-
if (
|
|
72
|
+
function Ae(r, n, l, a, i = l) {
|
|
73
|
+
const T = ke(r, n, a), y = a === "down" ? Math.max(l, i) : Math.min(l, i);
|
|
74
|
+
if (a === "down") {
|
|
70
75
|
if (r.filter(
|
|
71
76
|
(F) => F > n + 1 && F <= l + 1
|
|
72
77
|
).length === 0) return T;
|
|
73
|
-
const
|
|
74
|
-
(F) => F > n + 1 && F <=
|
|
78
|
+
const nt = r.filter(
|
|
79
|
+
(F) => F > n + 1 && F <= y + 1
|
|
75
80
|
);
|
|
76
|
-
return
|
|
81
|
+
return nt[nt.length - 1] ?? T;
|
|
77
82
|
}
|
|
78
83
|
return r.filter(
|
|
79
|
-
(
|
|
84
|
+
(S) => S < n - 1 && S >= l - 1
|
|
80
85
|
).length === 0 ? T : r.filter(
|
|
81
|
-
(
|
|
86
|
+
(S) => S < n - 1 && S >= y - 1
|
|
82
87
|
)[0] ?? T;
|
|
83
88
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
function ne(r, n) {
|
|
90
|
+
if (n <= 0) return 0;
|
|
91
|
+
const l = n, { resistance: a } = b.rubberBand;
|
|
92
|
+
return r * a * l / (l + a * r);
|
|
87
93
|
}
|
|
88
|
-
function
|
|
94
|
+
function Ot({
|
|
89
95
|
targetTranslate: r,
|
|
90
96
|
minTranslate: n,
|
|
91
97
|
maxTranslate: l,
|
|
92
|
-
|
|
98
|
+
minBoundaryLimit: a,
|
|
99
|
+
maxBoundaryLimit: i
|
|
93
100
|
}) {
|
|
94
|
-
return r < n ? n -
|
|
101
|
+
return r < n ? n - ne(n - r, a) : r > l ? l + ne(r - l, i) : r;
|
|
95
102
|
}
|
|
96
|
-
function
|
|
103
|
+
function ae(r) {
|
|
97
104
|
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
|
|
98
105
|
}
|
|
99
|
-
function
|
|
106
|
+
function Be(r, n) {
|
|
100
107
|
return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
101
108
|
}
|
|
102
|
-
function
|
|
109
|
+
function oe(r, n) {
|
|
103
110
|
if (!r.length)
|
|
104
111
|
return {
|
|
105
112
|
minTranslate: 0,
|
|
106
113
|
maxTranslate: 0
|
|
107
114
|
};
|
|
108
|
-
const l = r.map((
|
|
109
|
-
if (Math.abs(i -
|
|
110
|
-
const
|
|
115
|
+
const l = r.map((f) => f[n]), a = Math.min(...l), i = Math.max(...l);
|
|
116
|
+
if (Math.abs(i - a) < 0.5) {
|
|
117
|
+
const f = (a + i) / 2;
|
|
111
118
|
return {
|
|
112
|
-
minTranslate:
|
|
113
|
-
maxTranslate:
|
|
119
|
+
minTranslate: f,
|
|
120
|
+
maxTranslate: f
|
|
114
121
|
};
|
|
115
122
|
}
|
|
116
123
|
return {
|
|
117
|
-
minTranslate:
|
|
124
|
+
minTranslate: a,
|
|
118
125
|
maxTranslate: i
|
|
119
126
|
};
|
|
120
127
|
}
|
|
121
|
-
function
|
|
128
|
+
function se(r, n) {
|
|
122
129
|
for (let l = 0; l < r.length; l += 1) {
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
130
|
+
const a = "item" in r && typeof r.item == "function" ? r.item(l) : r[l];
|
|
131
|
+
if (a?.identifier === n) return a;
|
|
125
132
|
}
|
|
126
133
|
return null;
|
|
127
134
|
}
|
|
128
|
-
function
|
|
135
|
+
function ge(r) {
|
|
129
136
|
if (!r) return { x: 0, y: 0 };
|
|
130
137
|
const n = window.getComputedStyle(r).transform;
|
|
131
138
|
if (!n || n === "none") return { x: 0, y: 0 };
|
|
132
139
|
const l = n.match(/^matrix\((.+)\)$/);
|
|
133
140
|
if (l) {
|
|
134
|
-
const i = l[1].split(",").map((
|
|
141
|
+
const i = l[1].split(",").map((f) => f.trim());
|
|
135
142
|
return {
|
|
136
143
|
x: Number.parseFloat(i[4] ?? "0") || 0,
|
|
137
144
|
y: Number.parseFloat(i[5] ?? "0") || 0
|
|
138
145
|
};
|
|
139
146
|
}
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
const i =
|
|
147
|
+
const a = n.match(/^matrix3d\((.+)\)$/);
|
|
148
|
+
if (a) {
|
|
149
|
+
const i = a[1].split(",").map((f) => f.trim());
|
|
143
150
|
return {
|
|
144
151
|
x: Number.parseFloat(i[12] ?? "0") || 0,
|
|
145
152
|
y: Number.parseFloat(i[13] ?? "0") || 0
|
|
@@ -147,65 +154,65 @@ function de(r) {
|
|
|
147
154
|
}
|
|
148
155
|
return { x: 0, y: 0 };
|
|
149
156
|
}
|
|
150
|
-
function
|
|
151
|
-
return
|
|
157
|
+
function Vt(r) {
|
|
158
|
+
return ge(r).y;
|
|
152
159
|
}
|
|
153
160
|
function le(r) {
|
|
154
|
-
return
|
|
161
|
+
return ge(r);
|
|
155
162
|
}
|
|
156
|
-
function
|
|
163
|
+
function rt(r) {
|
|
157
164
|
if (!r) return;
|
|
158
165
|
const n = Number.parseFloat(r);
|
|
159
166
|
return Number.isFinite(n) ? n : void 0;
|
|
160
167
|
}
|
|
161
|
-
function
|
|
168
|
+
function it() {
|
|
162
169
|
return Date.now();
|
|
163
170
|
}
|
|
164
|
-
function
|
|
165
|
-
const l = n -
|
|
171
|
+
function Ce(r, n) {
|
|
172
|
+
const l = n - b.releaseVelocity.sampleWindowMs;
|
|
166
173
|
for (; r.length > 2 && (r[1]?.time ?? n) < l; )
|
|
167
174
|
r.shift();
|
|
168
175
|
}
|
|
169
|
-
function
|
|
170
|
-
const l = n.time ??
|
|
176
|
+
function ct(r, n) {
|
|
177
|
+
const l = n.time ?? it();
|
|
171
178
|
r.samples.push({
|
|
172
179
|
time: l,
|
|
173
180
|
pageX: n.pageX,
|
|
174
181
|
pageY: n.pageY,
|
|
175
182
|
translateX: n.translateX,
|
|
176
183
|
translateY: n.translateY
|
|
177
|
-
}),
|
|
184
|
+
}), Ce(r.samples, l);
|
|
178
185
|
}
|
|
179
|
-
function
|
|
186
|
+
function St(r, n) {
|
|
180
187
|
return {
|
|
181
188
|
x: r.startTranslateX + n.pageX - r.startX,
|
|
182
189
|
y: r.startTranslate + n.pageY - r.startY
|
|
183
190
|
};
|
|
184
191
|
}
|
|
185
|
-
function
|
|
186
|
-
const l =
|
|
187
|
-
|
|
192
|
+
function ie(r, n) {
|
|
193
|
+
const l = St(r, n);
|
|
194
|
+
ct(r, {
|
|
188
195
|
pageX: n.pageX,
|
|
189
196
|
pageY: n.pageY,
|
|
190
197
|
translateX: l.x,
|
|
191
198
|
translateY: l.y
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
|
-
function
|
|
201
|
+
function ce({
|
|
195
202
|
session: r,
|
|
196
203
|
fallbackDeltaY: n,
|
|
197
204
|
fallbackElapsed: l
|
|
198
205
|
}) {
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
const T =
|
|
202
|
-
if (
|
|
203
|
-
const
|
|
204
|
-
if (Number.isFinite(
|
|
205
|
-
return
|
|
206
|
+
const a = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: f } = b.releaseVelocity;
|
|
207
|
+
if (a) {
|
|
208
|
+
const T = a.time - f, y = r.samples.find((w) => w.time >= T) ?? r.samples[0];
|
|
209
|
+
if (y && y !== a) {
|
|
210
|
+
const w = Math.max(a.time - y.time, 1), P = (a.translateY - y.translateY) / w * 1e3;
|
|
211
|
+
if (Number.isFinite(P))
|
|
212
|
+
return L(P, -i, i);
|
|
206
213
|
}
|
|
207
214
|
}
|
|
208
|
-
return
|
|
215
|
+
return L(
|
|
209
216
|
n / Math.max(l, 1) * 1e3,
|
|
210
217
|
-i,
|
|
211
218
|
i
|
|
@@ -216,169 +223,195 @@ function ue({
|
|
|
216
223
|
fallbackDelta: n,
|
|
217
224
|
fallbackElapsed: l
|
|
218
225
|
}) {
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
221
|
-
const T =
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
x: (
|
|
225
|
-
y: (
|
|
226
|
+
const a = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: f } = b.releaseVelocity;
|
|
227
|
+
if (a) {
|
|
228
|
+
const T = a.time - f, y = r.samples.find((w) => w.time >= T) ?? r.samples[0];
|
|
229
|
+
if (y && y !== a) {
|
|
230
|
+
const w = Math.max(a.time - y.time, 1), P = {
|
|
231
|
+
x: (a.translateX - y.translateX) / w * 1e3,
|
|
232
|
+
y: (a.translateY - y.translateY) / w * 1e3
|
|
226
233
|
};
|
|
227
|
-
if (Number.isFinite(
|
|
234
|
+
if (Number.isFinite(P.x) && Number.isFinite(P.y))
|
|
228
235
|
return {
|
|
229
|
-
x:
|
|
230
|
-
y:
|
|
236
|
+
x: L(P.x, -i, i),
|
|
237
|
+
y: L(P.y, -i, i)
|
|
231
238
|
};
|
|
232
239
|
}
|
|
233
240
|
}
|
|
234
241
|
return {
|
|
235
|
-
x:
|
|
242
|
+
x: L(
|
|
236
243
|
n.x / Math.max(l, 1) * 1e3,
|
|
237
244
|
-i,
|
|
238
245
|
i
|
|
239
246
|
),
|
|
240
|
-
y:
|
|
247
|
+
y: L(
|
|
241
248
|
n.y / Math.max(l, 1) * 1e3,
|
|
242
249
|
-i,
|
|
243
250
|
i
|
|
244
251
|
)
|
|
245
252
|
};
|
|
246
253
|
}
|
|
247
|
-
function
|
|
254
|
+
function Ie({
|
|
248
255
|
currentTranslate: r,
|
|
249
256
|
releaseVelocity: n
|
|
250
257
|
}) {
|
|
251
|
-
const { lookaheadSeconds: l, maxDistancePx:
|
|
252
|
-
return r +
|
|
258
|
+
const { lookaheadSeconds: l, maxDistancePx: a } = b.snapProjection;
|
|
259
|
+
return r + L(n * l, -a, a);
|
|
253
260
|
}
|
|
254
|
-
function
|
|
261
|
+
function Oe({
|
|
255
262
|
currentTranslate: r,
|
|
256
263
|
releaseVelocity: n
|
|
257
264
|
}) {
|
|
258
|
-
const { lookaheadSeconds: l, maxDistancePx:
|
|
265
|
+
const { lookaheadSeconds: l, maxDistancePx: a } = b.snapProjection;
|
|
259
266
|
return {
|
|
260
|
-
x: r.x +
|
|
267
|
+
x: r.x + L(
|
|
261
268
|
n.x * l,
|
|
262
|
-
-
|
|
263
|
-
|
|
269
|
+
-a,
|
|
270
|
+
a
|
|
264
271
|
),
|
|
265
|
-
y: r.y +
|
|
272
|
+
y: r.y + L(
|
|
266
273
|
n.y * l,
|
|
267
|
-
-
|
|
268
|
-
|
|
274
|
+
-a,
|
|
275
|
+
a
|
|
269
276
|
)
|
|
270
277
|
};
|
|
271
278
|
}
|
|
272
|
-
function
|
|
273
|
-
return Math.abs(r) / 1e3 >
|
|
279
|
+
function Ve(r) {
|
|
280
|
+
return Math.abs(r) / 1e3 > b.releaseVelocity.flickThresholdPxPerMs;
|
|
274
281
|
}
|
|
275
282
|
function Ne(r) {
|
|
276
|
-
return Math.hypot(r.x, r.y) / 1e3 >
|
|
283
|
+
return Math.hypot(r.x, r.y) / 1e3 > b.releaseVelocity.flickThresholdPxPerMs;
|
|
277
284
|
}
|
|
278
285
|
function ut(r, n) {
|
|
279
286
|
return Math.hypot(r.x - n.x, r.y - n.y);
|
|
280
287
|
}
|
|
281
288
|
function pe(r, n) {
|
|
282
289
|
return r.reduce(
|
|
283
|
-
(l,
|
|
290
|
+
(l, a) => ut(a, n) < ut(l, n) ? a : l
|
|
284
291
|
);
|
|
285
292
|
}
|
|
286
|
-
function
|
|
293
|
+
function He({
|
|
287
294
|
currentTranslate: r,
|
|
288
295
|
releaseVelocity: n,
|
|
289
296
|
targets: l
|
|
290
297
|
}) {
|
|
291
|
-
const
|
|
298
|
+
const a = Oe({
|
|
292
299
|
currentTranslate: r,
|
|
293
300
|
releaseVelocity: n
|
|
294
301
|
});
|
|
295
302
|
if (!Ne(n))
|
|
296
303
|
return pe(l, r);
|
|
297
|
-
const i = l.filter((
|
|
298
|
-
const T =
|
|
299
|
-
return T * n.x +
|
|
304
|
+
const i = l.filter((f) => {
|
|
305
|
+
const T = f.x - r.x, y = f.y - r.y;
|
|
306
|
+
return T * n.x + y * n.y > 0;
|
|
300
307
|
});
|
|
301
308
|
return pe(
|
|
302
309
|
i.length ? i : l,
|
|
303
|
-
|
|
310
|
+
a
|
|
304
311
|
);
|
|
305
312
|
}
|
|
306
|
-
function
|
|
313
|
+
function je({
|
|
307
314
|
presentationState: r,
|
|
308
315
|
releaseTranslate: n,
|
|
309
316
|
visibleTranslate: l
|
|
310
317
|
}) {
|
|
311
318
|
return r !== "visible" || Math.abs(n - l) > 1;
|
|
312
319
|
}
|
|
313
|
-
function
|
|
320
|
+
function ze({
|
|
314
321
|
drag: r,
|
|
315
322
|
placement: n,
|
|
316
323
|
snapPositionCount: l
|
|
317
324
|
}) {
|
|
318
325
|
return n === "popup" && r === "content" && l > 0;
|
|
319
326
|
}
|
|
320
|
-
function
|
|
327
|
+
function Re({
|
|
321
328
|
dismissible: r,
|
|
322
329
|
peekTranslate: n,
|
|
323
330
|
sheetHeight: l,
|
|
324
|
-
visibleTranslate:
|
|
331
|
+
visibleTranslate: a
|
|
325
332
|
}) {
|
|
326
333
|
return {
|
|
327
|
-
maxTranslate: n > 0 ? n : r ? l :
|
|
334
|
+
maxTranslate: n > 0 ? n : r ? l : a,
|
|
328
335
|
minTranslate: 0
|
|
329
336
|
};
|
|
330
337
|
}
|
|
338
|
+
function de(r, n = 1) {
|
|
339
|
+
const l = Math.max(n, 1);
|
|
340
|
+
return r && Math.abs(r.maxTranslate - r.minTranslate) || l;
|
|
341
|
+
}
|
|
342
|
+
function fe({
|
|
343
|
+
limit: r,
|
|
344
|
+
viewportSize: n,
|
|
345
|
+
viewportLimitRatio: l
|
|
346
|
+
}) {
|
|
347
|
+
const a = Math.max(r, 0);
|
|
348
|
+
return n <= 0 ? a : Math.min(a, n * l);
|
|
349
|
+
}
|
|
331
350
|
function _e({
|
|
351
|
+
minTranslate: r,
|
|
352
|
+
sheetHeight: n,
|
|
353
|
+
surfaceMotion: l
|
|
354
|
+
}) {
|
|
355
|
+
const a = l.parentElement?.getBoundingClientRect(), i = a?.top ?? 0, f = a && a.height > 0 ? a.height : window.innerHeight, T = l.getBoundingClientRect(), y = Vt(l), w = T.top - y + r, P = Math.max(w - i, 0), { observedViewportLimitRatio: S } = b.rubberBand;
|
|
356
|
+
return {
|
|
357
|
+
minBoundaryLimit: fe({
|
|
358
|
+
limit: P,
|
|
359
|
+
viewportSize: f,
|
|
360
|
+
viewportLimitRatio: S.top
|
|
361
|
+
}),
|
|
362
|
+
maxBoundaryLimit: fe({
|
|
363
|
+
limit: n,
|
|
364
|
+
viewportSize: f,
|
|
365
|
+
viewportLimitRatio: S.bottom
|
|
366
|
+
})
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function Ue({
|
|
332
370
|
rubberBand: r,
|
|
333
371
|
targetTranslate: n,
|
|
334
372
|
sheetHeight: l,
|
|
335
|
-
peekTranslate:
|
|
336
|
-
|
|
337
|
-
|
|
373
|
+
peekTranslate: a,
|
|
374
|
+
bounds: i,
|
|
375
|
+
rubberBandLimits: f
|
|
338
376
|
}) {
|
|
339
|
-
const T =
|
|
340
|
-
|
|
341
|
-
peekTranslate: o,
|
|
342
|
-
sheetHeight: l,
|
|
343
|
-
visibleTranslate: i
|
|
344
|
-
}), h = b(
|
|
345
|
-
r ? Nt({
|
|
377
|
+
const T = L(
|
|
378
|
+
r ? Ot({
|
|
346
379
|
targetTranslate: n,
|
|
347
|
-
|
|
348
|
-
...
|
|
380
|
+
...f,
|
|
381
|
+
...i
|
|
349
382
|
}) : n,
|
|
350
|
-
-
|
|
351
|
-
|
|
352
|
-
),
|
|
383
|
+
i.minTranslate - f.minBoundaryLimit,
|
|
384
|
+
i.maxTranslate + f.maxBoundaryLimit
|
|
385
|
+
), y = Math.max(-T, 0), w = Math.max(T, 0), P = a > 0 ? a : l, S = P > 0 ? 1 - w / Math.max(P, 1) : 0;
|
|
353
386
|
return {
|
|
354
|
-
translate:
|
|
355
|
-
overshootFillHeight:
|
|
356
|
-
backdropOpacity:
|
|
387
|
+
translate: T,
|
|
388
|
+
overshootFillHeight: y,
|
|
389
|
+
backdropOpacity: L(S, 0, 1)
|
|
357
390
|
};
|
|
358
391
|
}
|
|
359
|
-
function
|
|
392
|
+
function Qe({
|
|
360
393
|
enabled: r,
|
|
361
394
|
drag: n,
|
|
362
395
|
open: l,
|
|
363
|
-
placement:
|
|
396
|
+
placement: a,
|
|
364
397
|
surfaceMotionRef: i,
|
|
365
|
-
backdropRef:
|
|
398
|
+
backdropRef: f,
|
|
366
399
|
bodyNode: T,
|
|
367
|
-
snapHeights:
|
|
368
|
-
snapPositions:
|
|
369
|
-
defaultSnapPosition:
|
|
370
|
-
peekHeight:
|
|
371
|
-
peekFallback:
|
|
400
|
+
snapHeights: y = be,
|
|
401
|
+
snapPositions: w = Le,
|
|
402
|
+
defaultSnapPosition: P,
|
|
403
|
+
peekHeight: S,
|
|
404
|
+
peekFallback: nt,
|
|
372
405
|
presentationState: F,
|
|
373
|
-
setPresentationState:
|
|
406
|
+
setPresentationState: Yt,
|
|
374
407
|
requestClose: pt,
|
|
375
|
-
canCloseAttempt:
|
|
376
|
-
dismissible:
|
|
377
|
-
visibleTranslate:
|
|
408
|
+
canCloseAttempt: Nt,
|
|
409
|
+
dismissible: z = !0,
|
|
410
|
+
visibleTranslate: O = 0,
|
|
378
411
|
closeThreshold: Mt = 0.35,
|
|
379
|
-
scrollLockTimeout:
|
|
412
|
+
scrollLockTimeout: Ht = 500
|
|
380
413
|
}) {
|
|
381
|
-
const
|
|
414
|
+
const x = E({
|
|
382
415
|
dragging: !1,
|
|
383
416
|
allowed: !1,
|
|
384
417
|
chrome: !1,
|
|
@@ -397,366 +430,373 @@ function Ke({
|
|
|
397
430
|
samples: [],
|
|
398
431
|
pointerId: null,
|
|
399
432
|
touchId: null
|
|
400
|
-
}),
|
|
433
|
+
}), U = E(T), jt = E(!1), dt = E(0), Et = E(!1), R = E(null), V = E(
|
|
401
434
|
null
|
|
402
|
-
), ft =
|
|
435
|
+
), ft = E(null), at = E(null), N = E(null), bt = E(!1), Lt = E(!1), ot = E(!1), X = ze({
|
|
403
436
|
drag: n,
|
|
404
|
-
placement:
|
|
405
|
-
snapPositionCount:
|
|
406
|
-
}), zt = `${
|
|
437
|
+
placement: a,
|
|
438
|
+
snapPositionCount: w.length
|
|
439
|
+
}), zt = `${P ?? ""}:${w.join("|")}`, Rt = E(w), gt = E(P);
|
|
407
440
|
lt(() => {
|
|
408
|
-
|
|
409
|
-
}, [
|
|
410
|
-
const t =
|
|
411
|
-
t && t !== T &&
|
|
441
|
+
Rt.current = w, gt.current = P;
|
|
442
|
+
}, [P, zt, w]), lt(() => {
|
|
443
|
+
const t = U.current;
|
|
444
|
+
t && t !== T && Bt(t, !1), U.current = T, jt.current && Bt(T, !0);
|
|
412
445
|
}, [T]);
|
|
413
|
-
const
|
|
414
|
-
jt.current = t,
|
|
415
|
-
}, []), mt =
|
|
446
|
+
const $ = p((t) => {
|
|
447
|
+
jt.current = t, Bt(U.current, t);
|
|
448
|
+
}, []), mt = p(
|
|
416
449
|
({ chrome: t, target: e }) => {
|
|
417
|
-
const
|
|
450
|
+
const o = ve({
|
|
418
451
|
target: e,
|
|
419
452
|
chrome: t,
|
|
420
|
-
bodyNode:
|
|
453
|
+
bodyNode: U.current
|
|
421
454
|
});
|
|
422
|
-
return
|
|
455
|
+
return $(o), o;
|
|
423
456
|
},
|
|
424
|
-
[
|
|
425
|
-
),
|
|
426
|
-
if (
|
|
427
|
-
if (
|
|
457
|
+
[$]
|
|
458
|
+
), B = p(() => i.current?.getBoundingClientRect().height ?? window.innerHeight, [i]), _t = p(() => {
|
|
459
|
+
if (S !== void 0) return S;
|
|
460
|
+
if (nt === "header")
|
|
428
461
|
return i.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
|
|
429
|
-
}, [
|
|
430
|
-
const t =
|
|
462
|
+
}, [nt, S, i]), k = p(() => {
|
|
463
|
+
const t = _t();
|
|
431
464
|
if (t === void 0 || t <= 0) return 0;
|
|
432
|
-
const e =
|
|
433
|
-
return
|
|
434
|
-
}, [
|
|
435
|
-
() => F === "peeked" ? k() :
|
|
436
|
-
[k, F,
|
|
437
|
-
), ht =
|
|
465
|
+
const e = B();
|
|
466
|
+
return L(e - t, 0, e);
|
|
467
|
+
}, [_t, B]), Ft = p(
|
|
468
|
+
() => F === "peeked" ? k() : O,
|
|
469
|
+
[k, F, O]
|
|
470
|
+
), ht = p(() => {
|
|
438
471
|
const t = i.current;
|
|
439
|
-
if (!t) return
|
|
440
|
-
const e =
|
|
472
|
+
if (!t) return Ft();
|
|
473
|
+
const e = rt(
|
|
441
474
|
t.style.getPropertyValue("--oc-modal-translate-y")
|
|
442
475
|
);
|
|
443
476
|
if (e !== void 0) return e;
|
|
444
|
-
const
|
|
477
|
+
const o = rt(
|
|
445
478
|
window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
|
|
446
479
|
);
|
|
447
|
-
return
|
|
448
|
-
}, [
|
|
480
|
+
return o !== void 0 ? o : Ft();
|
|
481
|
+
}, [Ft, i]), Tt = p(() => {
|
|
449
482
|
const t = i.current;
|
|
450
483
|
if (!t) return { x: 0, y: 0 };
|
|
451
|
-
const e =
|
|
484
|
+
const e = rt(
|
|
452
485
|
t.style.getPropertyValue("--oc-modal-translate-x")
|
|
453
|
-
),
|
|
486
|
+
), o = rt(
|
|
454
487
|
t.style.getPropertyValue("--oc-modal-translate-y")
|
|
455
488
|
);
|
|
456
|
-
if (e !== void 0 ||
|
|
489
|
+
if (e !== void 0 || o !== void 0)
|
|
457
490
|
return {
|
|
458
491
|
x: e ?? 0,
|
|
459
|
-
y:
|
|
492
|
+
y: o ?? 0
|
|
460
493
|
};
|
|
461
494
|
const c = window.getComputedStyle(t);
|
|
462
495
|
return {
|
|
463
|
-
x:
|
|
464
|
-
y:
|
|
496
|
+
x: rt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
|
|
497
|
+
y: rt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
|
|
465
498
|
};
|
|
466
|
-
}, [i]), yt =
|
|
467
|
-
const t = ht(), e =
|
|
499
|
+
}, [i]), yt = p(() => {
|
|
500
|
+
const t = ht(), e = Vt(i.current);
|
|
468
501
|
return Math.abs(e - t) > 1 ? e : t;
|
|
469
|
-
}, [ht, i]),
|
|
502
|
+
}, [ht, i]), G = p(() => {
|
|
470
503
|
const t = Tt(), e = le(i.current);
|
|
471
504
|
return ut(e, t) > 1 ? e : t;
|
|
472
|
-
}, [Tt, i]),
|
|
505
|
+
}, [Tt, i]), H = p(
|
|
473
506
|
(t, {
|
|
474
507
|
active: e,
|
|
475
|
-
nextDismissible:
|
|
508
|
+
nextDismissible: o = z,
|
|
476
509
|
rubberBand: c = !1
|
|
477
510
|
}) => {
|
|
478
511
|
const s = i.current;
|
|
479
512
|
if (!s) return;
|
|
480
|
-
const u =
|
|
513
|
+
const u = B(), d = s.parentElement, g = k(), m = Re({
|
|
514
|
+
dismissible: o,
|
|
515
|
+
peekTranslate: g,
|
|
516
|
+
sheetHeight: u,
|
|
517
|
+
visibleTranslate: O
|
|
518
|
+
}), h = _e({
|
|
519
|
+
minTranslate: m.minTranslate,
|
|
520
|
+
sheetHeight: u,
|
|
521
|
+
surfaceMotion: s
|
|
522
|
+
}), v = Ue({
|
|
481
523
|
rubberBand: c,
|
|
482
524
|
targetTranslate: t,
|
|
483
525
|
sheetHeight: u,
|
|
484
|
-
peekTranslate:
|
|
485
|
-
|
|
486
|
-
|
|
526
|
+
peekTranslate: g,
|
|
527
|
+
bounds: m,
|
|
528
|
+
rubberBandLimits: h
|
|
487
529
|
});
|
|
488
|
-
|
|
530
|
+
x.current.lastTranslate = v.translate, s.style.setProperty(
|
|
489
531
|
"--oc-modal-translate-y",
|
|
490
|
-
`${
|
|
532
|
+
`${v.translate}px`
|
|
491
533
|
), s.style.setProperty(
|
|
492
534
|
"--_-modal-elevation-shadow-opacity",
|
|
493
|
-
String(1 -
|
|
494
|
-
), s.dataset.ocModalDragging = e ? "true" : "false",
|
|
535
|
+
String(1 - v.backdropOpacity)
|
|
536
|
+
), s.dataset.ocModalDragging = e ? "true" : "false", d?.style.setProperty(
|
|
495
537
|
"--oc-modal-overshoot-fill-height",
|
|
496
|
-
`${
|
|
497
|
-
),
|
|
538
|
+
`${v.overshootFillHeight}px`
|
|
539
|
+
), d && (d.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), f.current && (f.current.style.setProperty(
|
|
498
540
|
"--oc-modal-backdrop-opacity",
|
|
499
|
-
String(
|
|
500
|
-
),
|
|
541
|
+
String(v.backdropOpacity)
|
|
542
|
+
), f.current.style.transition = e ? "none" : "");
|
|
501
543
|
},
|
|
502
544
|
[
|
|
503
|
-
|
|
504
|
-
|
|
545
|
+
f,
|
|
546
|
+
z,
|
|
505
547
|
k,
|
|
506
|
-
|
|
548
|
+
B,
|
|
507
549
|
i,
|
|
508
|
-
|
|
550
|
+
O
|
|
509
551
|
]
|
|
510
|
-
),
|
|
511
|
-
const t = i.current, e =
|
|
552
|
+
), K = p(() => {
|
|
553
|
+
const t = i.current, e = Rt.current;
|
|
512
554
|
if (!(!t || !e.length))
|
|
513
|
-
return
|
|
555
|
+
return De({
|
|
514
556
|
defaultSnapPosition: gt.current,
|
|
515
557
|
snapPositions: e,
|
|
516
558
|
surfaceMotion: t
|
|
517
559
|
});
|
|
518
|
-
}, [i]),
|
|
560
|
+
}, [i]), q = p(
|
|
519
561
|
({ destroy: t = !0 } = {}) => {
|
|
520
562
|
t && V.current?.destroy(), V.current = null, ft.current = null;
|
|
521
563
|
},
|
|
522
564
|
[]
|
|
523
|
-
),
|
|
565
|
+
), Y = p(
|
|
524
566
|
(t, { active: e }) => {
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
527
|
-
const c =
|
|
528
|
-
x:
|
|
567
|
+
const o = i.current;
|
|
568
|
+
if (!o) return;
|
|
569
|
+
const c = K(), s = c ? o.getBoundingClientRect() : void 0, u = c ? oe(c.targets, "x") : void 0, d = c ? oe(c.targets, "y") : void 0, g = de(u, s?.width), m = de(d, s?.height), h = c ? {
|
|
570
|
+
x: Ot({
|
|
529
571
|
targetTranslate: t.x,
|
|
530
572
|
minTranslate: u?.minTranslate ?? 0,
|
|
531
573
|
maxTranslate: u?.maxTranslate ?? 0,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
) || s?.width || 1
|
|
574
|
+
minBoundaryLimit: g,
|
|
575
|
+
maxBoundaryLimit: g
|
|
535
576
|
}),
|
|
536
|
-
y:
|
|
577
|
+
y: Ot({
|
|
537
578
|
targetTranslate: t.y,
|
|
538
|
-
minTranslate:
|
|
539
|
-
maxTranslate:
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
) || s?.height || 1
|
|
579
|
+
minTranslate: d?.minTranslate ?? 0,
|
|
580
|
+
maxTranslate: d?.maxTranslate ?? 0,
|
|
581
|
+
minBoundaryLimit: m,
|
|
582
|
+
maxBoundaryLimit: m
|
|
543
583
|
})
|
|
544
584
|
} : t;
|
|
545
|
-
|
|
585
|
+
x.current.lastTranslateX = h.x, x.current.lastTranslate = h.y, o.style.setProperty(
|
|
546
586
|
"--oc-modal-translate-x",
|
|
547
|
-
`${
|
|
548
|
-
),
|
|
587
|
+
`${h.x}px`
|
|
588
|
+
), o.style.setProperty(
|
|
549
589
|
"--oc-modal-translate-y",
|
|
550
|
-
`${
|
|
551
|
-
),
|
|
590
|
+
`${h.y}px`
|
|
591
|
+
), o.dataset.ocModalDragging = e ? "true" : "false", o.parentElement && (o.parentElement.dataset.ocModalDragging = e ? "true" : "false"), o.style.transition = e ? "none" : "";
|
|
552
592
|
},
|
|
553
|
-
[
|
|
554
|
-
),
|
|
555
|
-
|
|
556
|
-
}, [
|
|
557
|
-
(t, e =
|
|
558
|
-
|
|
593
|
+
[K, i]
|
|
594
|
+
), M = p(() => {
|
|
595
|
+
R.current?.destroy(), R.current = null, q();
|
|
596
|
+
}, [q]), J = p(
|
|
597
|
+
(t, e = z) => {
|
|
598
|
+
M(), H(t, {
|
|
559
599
|
active: !0,
|
|
560
600
|
nextDismissible: e,
|
|
561
601
|
rubberBand: !0
|
|
562
602
|
});
|
|
563
603
|
},
|
|
564
|
-
[
|
|
565
|
-
),
|
|
604
|
+
[H, M, z]
|
|
605
|
+
), D = p(() => {
|
|
566
606
|
const t = i.current;
|
|
567
|
-
t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"),
|
|
568
|
-
}, [
|
|
607
|
+
t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), f.current?.style.removeProperty("transition"));
|
|
608
|
+
}, [f, i]), Ut = p(
|
|
569
609
|
({ resetY: t = !0 } = {}) => {
|
|
570
610
|
const e = i.current;
|
|
571
|
-
e && (at.current = null,
|
|
611
|
+
e && (at.current = null, x.current.lastTranslateX = 0, e.style.removeProperty("--oc-modal-translate-x"), t && (x.current.lastTranslate = 0, e.style.removeProperty("--oc-modal-translate-y")), D());
|
|
572
612
|
},
|
|
573
|
-
[
|
|
574
|
-
), A =
|
|
613
|
+
[D, i]
|
|
614
|
+
), A = p(
|
|
575
615
|
(t, {
|
|
576
616
|
initialVelocity: e = 0,
|
|
577
|
-
intent:
|
|
578
|
-
phase: c = "
|
|
617
|
+
intent: o = "sheet",
|
|
618
|
+
phase: c = "release",
|
|
579
619
|
from: s,
|
|
580
620
|
onComplete: u
|
|
581
621
|
} = {}) => {
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
if (Math.abs(
|
|
587
|
-
|
|
622
|
+
const d = i.current;
|
|
623
|
+
if (!d) return;
|
|
624
|
+
M();
|
|
625
|
+
const g = s ?? Vt(d);
|
|
626
|
+
if (Math.abs(g - t) < 0.5) {
|
|
627
|
+
H(t, { active: !1 }), D(), u?.();
|
|
588
628
|
return;
|
|
589
629
|
}
|
|
590
|
-
|
|
591
|
-
const m =
|
|
592
|
-
element:
|
|
593
|
-
intent:
|
|
630
|
+
H(g, { active: !0 });
|
|
631
|
+
const m = At({
|
|
632
|
+
element: d,
|
|
633
|
+
intent: o,
|
|
594
634
|
phase: c,
|
|
595
635
|
reduced: "preserve",
|
|
596
636
|
reducedMotion: !1,
|
|
597
637
|
property: "transform"
|
|
598
|
-
}),
|
|
599
|
-
value:
|
|
638
|
+
}), h = It({
|
|
639
|
+
value: g,
|
|
600
640
|
target: t,
|
|
601
641
|
velocity: e,
|
|
602
642
|
spring: m.spring,
|
|
603
643
|
epsilon: 0.5,
|
|
604
644
|
velocityEpsilon: 50,
|
|
605
645
|
stabilityWindow: 0.02,
|
|
606
|
-
onUpdate: (
|
|
607
|
-
|
|
646
|
+
onUpdate: (v) => {
|
|
647
|
+
H(v, { active: !0 });
|
|
608
648
|
},
|
|
609
649
|
onComplete: () => {
|
|
610
|
-
|
|
650
|
+
R.current === h && (R.current = null), H(t, { active: !1 }), D(), u?.();
|
|
611
651
|
}
|
|
612
652
|
});
|
|
613
|
-
|
|
653
|
+
R.current = h;
|
|
614
654
|
},
|
|
615
|
-
[
|
|
616
|
-
),
|
|
655
|
+
[H, M, D, i]
|
|
656
|
+
), _ = p(
|
|
617
657
|
(t, {
|
|
618
658
|
from: e,
|
|
619
|
-
initialVelocity:
|
|
659
|
+
initialVelocity: o = { x: 0, y: 0 }
|
|
620
660
|
} = {}) => {
|
|
621
661
|
const c = i.current;
|
|
622
662
|
if (!c) return;
|
|
623
|
-
|
|
663
|
+
M();
|
|
624
664
|
const s = e ?? le(c), u = { x: t.x, y: t.y };
|
|
625
665
|
if (ut(s, u) < 0.5) {
|
|
626
|
-
|
|
666
|
+
Y(u, { active: !1 }), D();
|
|
627
667
|
return;
|
|
628
668
|
}
|
|
629
|
-
|
|
630
|
-
const
|
|
669
|
+
Y(s, { active: !0 });
|
|
670
|
+
const g = At({
|
|
631
671
|
element: c,
|
|
632
672
|
intent: "gesture",
|
|
633
|
-
phase: "
|
|
673
|
+
phase: "release",
|
|
634
674
|
reduced: "preserve",
|
|
635
675
|
reducedMotion: !1,
|
|
636
676
|
property: "transform"
|
|
637
|
-
}), m =
|
|
677
|
+
}), m = It({
|
|
638
678
|
value: s,
|
|
639
679
|
target: u,
|
|
640
|
-
velocity:
|
|
641
|
-
spring:
|
|
680
|
+
velocity: o,
|
|
681
|
+
spring: g.spring,
|
|
642
682
|
epsilon: 0.5,
|
|
643
683
|
velocityEpsilon: 50,
|
|
644
684
|
stabilityWindow: 0.02,
|
|
645
|
-
onUpdate: (
|
|
646
|
-
|
|
685
|
+
onUpdate: (h) => {
|
|
686
|
+
Y(h, { active: !0 });
|
|
647
687
|
},
|
|
648
688
|
onComplete: () => {
|
|
649
|
-
|
|
689
|
+
R.current === m && (R.current = null), Y(u, { active: !1 }), D();
|
|
650
690
|
}
|
|
651
691
|
});
|
|
652
|
-
|
|
692
|
+
R.current = m;
|
|
653
693
|
},
|
|
654
694
|
[
|
|
655
|
-
S,
|
|
656
695
|
Y,
|
|
657
|
-
|
|
696
|
+
M,
|
|
697
|
+
D,
|
|
658
698
|
i
|
|
659
699
|
]
|
|
660
|
-
),
|
|
700
|
+
), Q = p(() => {
|
|
661
701
|
const t = V.current;
|
|
662
702
|
if (!t) return null;
|
|
663
703
|
const e = t.sample();
|
|
664
|
-
return
|
|
665
|
-
}, [
|
|
704
|
+
return Y(e.value, { active: !0 }), e;
|
|
705
|
+
}, [Y]), Wt = p(
|
|
666
706
|
(t) => {
|
|
667
707
|
if (!i.current) return null;
|
|
668
|
-
|
|
669
|
-
const
|
|
708
|
+
M(), Y(t, { active: !0 });
|
|
709
|
+
const o = It({
|
|
670
710
|
value: t,
|
|
671
711
|
target: t,
|
|
672
|
-
spring:
|
|
712
|
+
spring: Ee,
|
|
673
713
|
autoplay: !1,
|
|
674
714
|
epsilon: 0.5,
|
|
675
715
|
velocityEpsilon: 50,
|
|
676
716
|
stabilityWindow: 0.02,
|
|
677
717
|
onUpdate: (c) => {
|
|
678
|
-
|
|
718
|
+
Y(c, { active: !0 });
|
|
679
719
|
},
|
|
680
720
|
onComplete: () => {
|
|
681
721
|
const c = ft.current;
|
|
682
|
-
!c || V.current !==
|
|
722
|
+
!c || V.current !== o || (q({ destroy: !1 }), Y(c, { active: !1 }), D());
|
|
683
723
|
}
|
|
684
724
|
});
|
|
685
|
-
return V.current =
|
|
725
|
+
return V.current = o, o;
|
|
686
726
|
},
|
|
687
727
|
[
|
|
688
|
-
S,
|
|
689
728
|
Y,
|
|
690
|
-
|
|
691
|
-
|
|
729
|
+
M,
|
|
730
|
+
q,
|
|
731
|
+
D,
|
|
692
732
|
i
|
|
693
733
|
]
|
|
694
|
-
),
|
|
734
|
+
), $t = p(
|
|
695
735
|
(t) => {
|
|
696
|
-
const e = V.current ??
|
|
736
|
+
const e = V.current ?? Wt(G());
|
|
697
737
|
e && (ft.current = null, e.setTarget(t));
|
|
698
738
|
},
|
|
699
|
-
[
|
|
700
|
-
),
|
|
739
|
+
[G, Wt]
|
|
740
|
+
), Z = p(
|
|
701
741
|
(t, e) => {
|
|
702
|
-
const
|
|
703
|
-
return
|
|
742
|
+
const o = St(t, e);
|
|
743
|
+
return $t(o), Q(), o;
|
|
704
744
|
},
|
|
705
|
-
[
|
|
706
|
-
), xt =
|
|
745
|
+
[Q, $t]
|
|
746
|
+
), xt = p(
|
|
707
747
|
(t) => {
|
|
708
|
-
const e = i.current,
|
|
709
|
-
if (!e || !
|
|
710
|
-
|
|
748
|
+
const e = i.current, o = V.current;
|
|
749
|
+
if (!e || !o) {
|
|
750
|
+
_(t);
|
|
711
751
|
return;
|
|
712
752
|
}
|
|
713
|
-
const s =
|
|
753
|
+
const s = Q() ? Tt() : o.value, u = { x: t.x, y: t.y };
|
|
714
754
|
if (ut(s, u) < 0.5) {
|
|
715
|
-
|
|
755
|
+
q(), Y(u, { active: !1 }), D();
|
|
716
756
|
return;
|
|
717
757
|
}
|
|
718
|
-
const
|
|
758
|
+
const d = At({
|
|
719
759
|
element: e,
|
|
720
760
|
intent: "gesture",
|
|
721
|
-
phase: "
|
|
761
|
+
phase: "release",
|
|
722
762
|
reduced: "preserve",
|
|
723
763
|
reducedMotion: !1,
|
|
724
764
|
property: "transform"
|
|
725
765
|
});
|
|
726
|
-
ft.current = u,
|
|
766
|
+
ft.current = u, o.setTarget(u, { spring: d.spring });
|
|
727
767
|
},
|
|
728
768
|
[
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
769
|
+
Y,
|
|
770
|
+
q,
|
|
771
|
+
D,
|
|
732
772
|
Tt,
|
|
733
|
-
|
|
734
|
-
|
|
773
|
+
Q,
|
|
774
|
+
_,
|
|
735
775
|
i
|
|
736
776
|
]
|
|
737
|
-
),
|
|
777
|
+
), wt = p(
|
|
738
778
|
({
|
|
739
779
|
key: t,
|
|
740
780
|
settle: e
|
|
741
781
|
}) => {
|
|
742
|
-
if (
|
|
743
|
-
const
|
|
744
|
-
if (!
|
|
745
|
-
const c = (t ?
|
|
746
|
-
return at.current = c.key, e ?
|
|
782
|
+
if (x.current.dragging) return !1;
|
|
783
|
+
const o = K();
|
|
784
|
+
if (!o) return !1;
|
|
785
|
+
const c = (t ? o.targets.find((s) => s.key === t) : void 0) ?? o.defaultTarget;
|
|
786
|
+
return at.current = c.key, e ? _(c) : (M(), Y(c, { active: !1 }), D()), !0;
|
|
747
787
|
},
|
|
748
788
|
[
|
|
749
|
-
S,
|
|
750
789
|
Y,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
790
|
+
M,
|
|
791
|
+
D,
|
|
792
|
+
K,
|
|
793
|
+
_
|
|
754
794
|
]
|
|
755
|
-
), Gt =
|
|
756
|
-
(t, { from: e, initialVelocity:
|
|
795
|
+
), Gt = p(
|
|
796
|
+
(t, { from: e, initialVelocity: o = 0 }) => {
|
|
757
797
|
A(t, {
|
|
758
798
|
from: e,
|
|
759
|
-
initialVelocity:
|
|
799
|
+
initialVelocity: o,
|
|
760
800
|
onComplete: () => {
|
|
761
801
|
pt({ reason: "drag-dismiss" }, { skipAttempt: !0 });
|
|
762
802
|
}
|
|
@@ -764,24 +804,24 @@ function Ke({
|
|
|
764
804
|
},
|
|
765
805
|
[pt, A]
|
|
766
806
|
);
|
|
767
|
-
|
|
807
|
+
kt(
|
|
768
808
|
() => () => {
|
|
769
|
-
|
|
809
|
+
M(), i.current && D();
|
|
770
810
|
},
|
|
771
|
-
[
|
|
811
|
+
[M, D, i]
|
|
772
812
|
), lt(() => {
|
|
773
|
-
if (!l || !r ||
|
|
774
|
-
|
|
813
|
+
if (!l || !r || a !== "bottom") {
|
|
814
|
+
bt.current = l;
|
|
775
815
|
return;
|
|
776
816
|
}
|
|
777
|
-
const t =
|
|
778
|
-
|
|
779
|
-
const e = F === "peeked" ? k() :
|
|
817
|
+
const t = bt.current;
|
|
818
|
+
bt.current = !0;
|
|
819
|
+
const e = F === "peeked" ? k() : O;
|
|
780
820
|
if (!t) {
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
from:
|
|
784
|
-
intent: "
|
|
821
|
+
const o = B();
|
|
822
|
+
H(o, { active: !0 }), A(e, {
|
|
823
|
+
from: o,
|
|
824
|
+
intent: "sheet",
|
|
785
825
|
phase: "enter"
|
|
786
826
|
});
|
|
787
827
|
return;
|
|
@@ -790,178 +830,178 @@ function Ke({
|
|
|
790
830
|
A(k());
|
|
791
831
|
return;
|
|
792
832
|
}
|
|
793
|
-
if (
|
|
794
|
-
|
|
833
|
+
if (Et.current) {
|
|
834
|
+
Et.current = !1;
|
|
795
835
|
return;
|
|
796
836
|
}
|
|
797
|
-
A(
|
|
837
|
+
A(O);
|
|
798
838
|
}, [
|
|
799
839
|
r,
|
|
800
840
|
k,
|
|
801
|
-
|
|
841
|
+
B,
|
|
802
842
|
l,
|
|
803
|
-
|
|
843
|
+
a,
|
|
804
844
|
F,
|
|
805
|
-
|
|
845
|
+
H,
|
|
806
846
|
A,
|
|
807
|
-
|
|
847
|
+
O
|
|
808
848
|
]), lt(() => {
|
|
809
|
-
if (!l || !r || !
|
|
810
|
-
const c = !l &&
|
|
811
|
-
ot.current && !c && (
|
|
849
|
+
if (!l || !r || !X) {
|
|
850
|
+
const c = !l && a === "popup" && ot.current;
|
|
851
|
+
ot.current && !c && (N.current !== null && (window.cancelAnimationFrame(N.current), N.current = null), M(), Ut()), ot.current && c && (M(), D()), Lt.current = l && a === "popup", ot.current = !1;
|
|
812
852
|
return;
|
|
813
853
|
}
|
|
814
|
-
const t =
|
|
815
|
-
|
|
854
|
+
const t = Lt.current;
|
|
855
|
+
Lt.current = !0, ot.current = !0;
|
|
816
856
|
let e = null;
|
|
817
|
-
const
|
|
857
|
+
const o = (c) => wt({
|
|
818
858
|
key: c,
|
|
819
859
|
settle: t
|
|
820
860
|
});
|
|
821
|
-
return
|
|
822
|
-
e = null,
|
|
861
|
+
return o(gt.current) || (e = window.requestAnimationFrame(() => {
|
|
862
|
+
e = null, o(
|
|
823
863
|
at.current ?? gt.current
|
|
824
864
|
);
|
|
825
865
|
})), () => {
|
|
826
866
|
e !== null && window.cancelAnimationFrame(e);
|
|
827
867
|
};
|
|
828
868
|
}, [
|
|
829
|
-
|
|
869
|
+
M,
|
|
830
870
|
r,
|
|
831
|
-
|
|
871
|
+
D,
|
|
832
872
|
l,
|
|
833
|
-
|
|
873
|
+
a,
|
|
834
874
|
zt,
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
875
|
+
X,
|
|
876
|
+
Ut,
|
|
877
|
+
wt
|
|
838
878
|
]), lt(() => {
|
|
839
|
-
if (!l || !r || !
|
|
879
|
+
if (!l || !r || !X) return;
|
|
840
880
|
const t = () => {
|
|
841
|
-
|
|
842
|
-
|
|
881
|
+
x.current.dragging || N.current === null && (N.current = window.requestAnimationFrame(() => {
|
|
882
|
+
N.current = null, !x.current.dragging && wt({
|
|
843
883
|
key: at.current,
|
|
844
884
|
settle: !1
|
|
845
885
|
});
|
|
846
886
|
}));
|
|
847
887
|
};
|
|
848
888
|
window.addEventListener("resize", t), window.visualViewport?.addEventListener("resize", t);
|
|
849
|
-
const e = i.current,
|
|
850
|
-
return c && (e && c.observe(e),
|
|
851
|
-
window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), c?.disconnect(),
|
|
889
|
+
const e = i.current, o = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
890
|
+
return c && (e && c.observe(e), o && c.observe(o)), () => {
|
|
891
|
+
window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), c?.disconnect(), N.current !== null && (window.cancelAnimationFrame(N.current), N.current = null);
|
|
852
892
|
};
|
|
853
893
|
}, [
|
|
854
894
|
r,
|
|
855
895
|
l,
|
|
856
|
-
|
|
896
|
+
X,
|
|
857
897
|
i,
|
|
858
|
-
|
|
898
|
+
wt
|
|
859
899
|
]);
|
|
860
|
-
const
|
|
861
|
-
(t, e,
|
|
862
|
-
if (typeof Element > "u" || !(t instanceof Element) ||
|
|
863
|
-
const c = Date.now(), s = e > 0, u =
|
|
864
|
-
return !
|
|
900
|
+
const Kt = p(
|
|
901
|
+
(t, e, o) => {
|
|
902
|
+
if (typeof Element > "u" || !(t instanceof Element) || Ct(t)) return !1;
|
|
903
|
+
const c = Date.now(), s = e > 0, u = Se(t, U.current);
|
|
904
|
+
return !o && u && s && u.scrollTop > 0 || !o && dt.current && c - dt.current < Ht && Math.abs(ht()) <= 1 ? (dt.current = c, !1) : !0;
|
|
865
905
|
},
|
|
866
|
-
[ht,
|
|
867
|
-
),
|
|
906
|
+
[ht, Ht]
|
|
907
|
+
), Pt = p(
|
|
868
908
|
({
|
|
869
909
|
chrome: t,
|
|
870
910
|
pointerId: e = null,
|
|
871
|
-
source:
|
|
911
|
+
source: o,
|
|
872
912
|
startX: c = 0,
|
|
873
913
|
startY: s,
|
|
874
914
|
touchId: u = null
|
|
875
915
|
}) => {
|
|
876
|
-
const
|
|
877
|
-
|
|
916
|
+
const d = yt(), g = G(), m = it();
|
|
917
|
+
x.current = {
|
|
878
918
|
dragging: !0,
|
|
879
919
|
allowed: !1,
|
|
880
920
|
chrome: t,
|
|
881
921
|
closeAllowed: null,
|
|
882
922
|
started: !1,
|
|
883
|
-
source:
|
|
923
|
+
source: o,
|
|
884
924
|
startX: c,
|
|
885
925
|
startY: s,
|
|
886
926
|
lastX: c,
|
|
887
927
|
lastY: s,
|
|
888
|
-
startTranslateX:
|
|
889
|
-
startTranslate:
|
|
890
|
-
lastTranslateX:
|
|
891
|
-
lastTranslate:
|
|
928
|
+
startTranslateX: g.x,
|
|
929
|
+
startTranslate: d,
|
|
930
|
+
lastTranslateX: g.x,
|
|
931
|
+
lastTranslate: d,
|
|
892
932
|
startTime: m,
|
|
893
933
|
samples: [
|
|
894
934
|
{
|
|
895
935
|
time: m,
|
|
896
936
|
pageX: c,
|
|
897
937
|
pageY: s,
|
|
898
|
-
translateX:
|
|
899
|
-
translateY:
|
|
938
|
+
translateX: g.x,
|
|
939
|
+
translateY: d
|
|
900
940
|
}
|
|
901
941
|
],
|
|
902
942
|
pointerId: e,
|
|
903
943
|
touchId: u
|
|
904
944
|
};
|
|
905
945
|
},
|
|
906
|
-
[yt,
|
|
907
|
-
),
|
|
946
|
+
[yt, G]
|
|
947
|
+
), tt = p(
|
|
908
948
|
(t) => {
|
|
909
|
-
t.source === "touch" &&
|
|
949
|
+
t.source === "touch" && $(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
|
|
910
950
|
},
|
|
911
|
-
[
|
|
912
|
-
),
|
|
951
|
+
[$]
|
|
952
|
+
), qt = p(
|
|
913
953
|
(t, e) => {
|
|
914
|
-
const
|
|
915
|
-
t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate =
|
|
954
|
+
const o = yt(), c = G();
|
|
955
|
+
t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = o, t.lastTranslateX = c.x, t.lastTranslate = o, t.startTime = it(), t.samples = [
|
|
916
956
|
{
|
|
917
957
|
time: t.startTime,
|
|
918
958
|
pageX: e.x,
|
|
919
959
|
pageY: e.y,
|
|
920
960
|
translateX: c.x,
|
|
921
|
-
translateY:
|
|
961
|
+
translateY: o
|
|
922
962
|
}
|
|
923
963
|
];
|
|
924
964
|
},
|
|
925
|
-
[yt,
|
|
926
|
-
),
|
|
965
|
+
[yt, G]
|
|
966
|
+
), Jt = p(
|
|
927
967
|
({
|
|
928
968
|
currentTranslate: t,
|
|
929
969
|
dismissible: e,
|
|
930
|
-
releaseVelocity:
|
|
970
|
+
releaseVelocity: o,
|
|
931
971
|
deltaY: c,
|
|
932
972
|
startTranslate: s
|
|
933
973
|
}) => {
|
|
934
|
-
const u =
|
|
935
|
-
|
|
936
|
-
(u -
|
|
937
|
-
),
|
|
938
|
-
(
|
|
939
|
-
),
|
|
940
|
-
|
|
941
|
-
),
|
|
974
|
+
const u = B(), d = k(), g = d > 0, m = u, h = Math.max(
|
|
975
|
+
b.dismissal.minDistancePx,
|
|
976
|
+
(u - d) * Mt
|
|
977
|
+
), v = y.map(
|
|
978
|
+
(I) => L(u - I, 0, u)
|
|
979
|
+
), j = ee(
|
|
980
|
+
v.length ? v : [0]
|
|
981
|
+
), C = Ie({
|
|
942
982
|
currentTranslate: t,
|
|
943
|
-
releaseVelocity:
|
|
983
|
+
releaseVelocity: o
|
|
944
984
|
});
|
|
945
|
-
|
|
946
|
-
const st =
|
|
947
|
-
return e && !
|
|
985
|
+
g && j.push(d);
|
|
986
|
+
const st = ee(j);
|
|
987
|
+
return e && !g && c > 0 && t >= d + h ? m : Ve(o) ? st.length > 1 ? Ae(
|
|
948
988
|
st,
|
|
949
989
|
s,
|
|
950
990
|
t,
|
|
951
991
|
c > 0 ? "down" : "up",
|
|
952
|
-
|
|
953
|
-
) : 0 : e && t > u * Mt && !
|
|
992
|
+
C
|
|
993
|
+
) : 0 : e && t > u * Mt && !g ? m : Fe(st, t);
|
|
954
994
|
},
|
|
955
|
-
[Mt, k,
|
|
956
|
-
),
|
|
995
|
+
[Mt, k, B, y]
|
|
996
|
+
), me = p(
|
|
957
997
|
(t) => {
|
|
958
|
-
if (!r ||
|
|
998
|
+
if (!r || a !== "bottom" && !X || n === !1 || t.pointerType === "touch" || Ct(t.target)) return;
|
|
959
999
|
let e = !1;
|
|
960
1000
|
if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
|
|
961
1001
|
e = !0;
|
|
962
1002
|
else if (n === "handle")
|
|
963
1003
|
return;
|
|
964
|
-
n === "content" && (e =
|
|
1004
|
+
n === "content" && (e = ae(t.target), !Be(t, e)) || (Pt({
|
|
965
1005
|
chrome: e,
|
|
966
1006
|
pointerId: t.pointerId,
|
|
967
1007
|
source: "pointer",
|
|
@@ -969,33 +1009,33 @@ function Ke({
|
|
|
969
1009
|
startY: t.pageY
|
|
970
1010
|
}), t.currentTarget.setPointerCapture(t.pointerId));
|
|
971
1011
|
},
|
|
972
|
-
[
|
|
973
|
-
),
|
|
1012
|
+
[Pt, n, r, a, X]
|
|
1013
|
+
), et = p(
|
|
974
1014
|
(t, e) => {
|
|
975
|
-
if (!
|
|
1015
|
+
if (!z) return !1;
|
|
976
1016
|
if (e <= 0) return !0;
|
|
977
1017
|
if (t.closeAllowed !== null) return t.closeAllowed;
|
|
978
|
-
const
|
|
979
|
-
return t.closeAllowed =
|
|
1018
|
+
const o = Nt({ reason: "drag-dismiss" });
|
|
1019
|
+
return t.closeAllowed = o, o;
|
|
980
1020
|
},
|
|
981
|
-
[
|
|
982
|
-
), Xt =
|
|
1021
|
+
[Nt, z]
|
|
1022
|
+
), Xt = p(
|
|
983
1023
|
({
|
|
984
1024
|
closeAllowed: t,
|
|
985
1025
|
currentTranslate: e,
|
|
986
|
-
deltaY:
|
|
1026
|
+
deltaY: o,
|
|
987
1027
|
releaseVelocity: c,
|
|
988
1028
|
startTranslate: s
|
|
989
1029
|
}) => {
|
|
990
|
-
const
|
|
1030
|
+
const d = Jt({
|
|
991
1031
|
currentTranslate: e,
|
|
992
|
-
dismissible:
|
|
1032
|
+
dismissible: z && t !== !1,
|
|
993
1033
|
releaseVelocity: c,
|
|
994
|
-
deltaY:
|
|
1034
|
+
deltaY: o,
|
|
995
1035
|
startTranslate: s
|
|
996
|
-
}),
|
|
997
|
-
if (
|
|
998
|
-
pt({ reason: "drag-dismiss" }, { commit: !1 }) ? Gt(
|
|
1036
|
+
}), g = B(), m = k();
|
|
1037
|
+
if (d >= g - 1) {
|
|
1038
|
+
pt({ reason: "drag-dismiss" }, { commit: !1 }) ? Gt(d, {
|
|
999
1039
|
from: e,
|
|
1000
1040
|
initialVelocity: c
|
|
1001
1041
|
}) : A(s, {
|
|
@@ -1004,63 +1044,63 @@ function Ke({
|
|
|
1004
1044
|
});
|
|
1005
1045
|
return;
|
|
1006
1046
|
}
|
|
1007
|
-
m > 0 &&
|
|
1047
|
+
m > 0 && d >= m - 1 ? Yt("peeked") : (je({
|
|
1008
1048
|
presentationState: F,
|
|
1009
|
-
releaseTranslate:
|
|
1010
|
-
visibleTranslate:
|
|
1011
|
-
}) && (
|
|
1049
|
+
releaseTranslate: d,
|
|
1050
|
+
visibleTranslate: O
|
|
1051
|
+
}) && (Et.current = !0), Yt("visible")), A(d, {
|
|
1012
1052
|
from: e,
|
|
1013
1053
|
initialVelocity: c
|
|
1014
1054
|
});
|
|
1015
1055
|
},
|
|
1016
1056
|
[
|
|
1017
1057
|
Gt,
|
|
1018
|
-
|
|
1058
|
+
z,
|
|
1019
1059
|
k,
|
|
1020
|
-
|
|
1021
|
-
|
|
1060
|
+
Jt,
|
|
1061
|
+
B,
|
|
1022
1062
|
F,
|
|
1023
1063
|
pt,
|
|
1024
|
-
|
|
1064
|
+
Yt,
|
|
1025
1065
|
A,
|
|
1026
|
-
|
|
1066
|
+
O
|
|
1027
1067
|
]
|
|
1028
|
-
), Dt =
|
|
1068
|
+
), Dt = p(
|
|
1029
1069
|
({ currentTranslate: t, releaseVelocity: e }) => {
|
|
1030
|
-
const
|
|
1031
|
-
if (!
|
|
1032
|
-
const c =
|
|
1070
|
+
const o = K();
|
|
1071
|
+
if (!o) return;
|
|
1072
|
+
const c = He({
|
|
1033
1073
|
currentTranslate: t,
|
|
1034
1074
|
releaseVelocity: e,
|
|
1035
|
-
targets:
|
|
1075
|
+
targets: o.targets
|
|
1036
1076
|
});
|
|
1037
1077
|
if (at.current = c.key, V.current) {
|
|
1038
1078
|
xt(c);
|
|
1039
1079
|
return;
|
|
1040
1080
|
}
|
|
1041
|
-
|
|
1081
|
+
_(c, {
|
|
1042
1082
|
from: t,
|
|
1043
1083
|
initialVelocity: e
|
|
1044
1084
|
});
|
|
1045
1085
|
},
|
|
1046
|
-
[
|
|
1047
|
-
),
|
|
1086
|
+
[K, xt, _]
|
|
1087
|
+
), he = p(
|
|
1048
1088
|
(t) => {
|
|
1049
|
-
const e =
|
|
1050
|
-
if (!e.dragging || e.source !== "pointer" || !r ||
|
|
1089
|
+
const e = x.current;
|
|
1090
|
+
if (!e.dragging || e.source !== "pointer" || !r || a !== "bottom" && !X)
|
|
1051
1091
|
return;
|
|
1052
|
-
const
|
|
1053
|
-
if (!(!e.started &&
|
|
1092
|
+
const o = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? b.dragStartThresholdPx.touch : b.dragStartThresholdPx.mouse;
|
|
1093
|
+
if (!(!e.started && re({ deltaX: o, deltaY: c, placement: a }) < s)) {
|
|
1054
1094
|
if (!e.allowed) {
|
|
1055
|
-
if (
|
|
1095
|
+
if (a === "bottom" && !Kt(t.target, c, e.chrome))
|
|
1056
1096
|
return;
|
|
1057
1097
|
e.allowed = !0, e.started = !0;
|
|
1058
1098
|
}
|
|
1059
|
-
if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY,
|
|
1060
|
-
|
|
1099
|
+
if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, a === "popup")
|
|
1100
|
+
Z(e, t), ie(e, t);
|
|
1061
1101
|
else {
|
|
1062
|
-
const u = e.startTranslate + c,
|
|
1063
|
-
|
|
1102
|
+
const u = e.startTranslate + c, d = et(e, c);
|
|
1103
|
+
J(u, d), ct(e, {
|
|
1064
1104
|
pageX: t.pageX,
|
|
1065
1105
|
pageY: t.pageY,
|
|
1066
1106
|
translateX: e.lastTranslateX,
|
|
@@ -1071,84 +1111,84 @@ function Ke({
|
|
|
1071
1111
|
},
|
|
1072
1112
|
[
|
|
1073
1113
|
r,
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1114
|
+
Z,
|
|
1115
|
+
et,
|
|
1116
|
+
a,
|
|
1117
|
+
X,
|
|
1118
|
+
J,
|
|
1119
|
+
Kt
|
|
1080
1120
|
]
|
|
1081
|
-
),
|
|
1121
|
+
), W = p(
|
|
1082
1122
|
({
|
|
1083
1123
|
currentTarget: t,
|
|
1084
1124
|
pageX: e,
|
|
1085
|
-
pageY:
|
|
1125
|
+
pageY: o,
|
|
1086
1126
|
releaseCapture: c = !0
|
|
1087
1127
|
}) => {
|
|
1088
|
-
const s =
|
|
1089
|
-
if (!s.dragging || s.source !== "pointer" || !r ||
|
|
1128
|
+
const s = x.current;
|
|
1129
|
+
if (!s.dragging || s.source !== "pointer" || !r || a !== "bottom" && !X)
|
|
1090
1130
|
return;
|
|
1091
|
-
const u = s.started,
|
|
1092
|
-
let
|
|
1131
|
+
const u = s.started, d = Number.isFinite(e) ? e : s.lastX, g = Number.isFinite(o) ? o : s.lastY, m = d - s.startX, h = g - s.startY, v = Math.max(it() - s.startTime, 1);
|
|
1132
|
+
let j = {
|
|
1093
1133
|
x: s.lastTranslateX,
|
|
1094
1134
|
y: s.lastTranslate
|
|
1095
1135
|
};
|
|
1096
|
-
const
|
|
1136
|
+
const C = s.startTranslate;
|
|
1097
1137
|
if (u)
|
|
1098
|
-
if (
|
|
1099
|
-
|
|
1100
|
-
pageX:
|
|
1101
|
-
pageY:
|
|
1102
|
-
}),
|
|
1138
|
+
if (a === "popup")
|
|
1139
|
+
Z(s, {
|
|
1140
|
+
pageX: d,
|
|
1141
|
+
pageY: g
|
|
1142
|
+
}), j = {
|
|
1103
1143
|
x: s.lastTranslateX,
|
|
1104
1144
|
y: s.lastTranslate
|
|
1105
1145
|
};
|
|
1106
1146
|
else {
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1147
|
+
const I = s.startTranslate + h, Pe = et(s, h);
|
|
1148
|
+
J(I, Pe), j = {
|
|
1109
1149
|
x: s.lastTranslateX,
|
|
1110
1150
|
y: s.lastTranslate
|
|
1111
1151
|
};
|
|
1112
1152
|
}
|
|
1113
1153
|
const st = s.closeAllowed;
|
|
1114
1154
|
if (c && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
|
|
1115
|
-
const
|
|
1116
|
-
pageX:
|
|
1117
|
-
pageY:
|
|
1155
|
+
const I = a === "popup" ? St(s, {
|
|
1156
|
+
pageX: d,
|
|
1157
|
+
pageY: g
|
|
1118
1158
|
}) : {
|
|
1119
1159
|
x: s.lastTranslateX,
|
|
1120
1160
|
y: s.lastTranslate
|
|
1121
1161
|
};
|
|
1122
|
-
|
|
1123
|
-
pageX:
|
|
1124
|
-
pageY:
|
|
1125
|
-
translateX:
|
|
1126
|
-
translateY:
|
|
1162
|
+
ct(s, {
|
|
1163
|
+
pageX: d,
|
|
1164
|
+
pageY: g,
|
|
1165
|
+
translateX: I.x,
|
|
1166
|
+
translateY: I.y
|
|
1127
1167
|
});
|
|
1128
1168
|
}
|
|
1129
|
-
if (
|
|
1130
|
-
if (
|
|
1131
|
-
const
|
|
1169
|
+
if (tt(s), !!u)
|
|
1170
|
+
if (a === "popup") {
|
|
1171
|
+
const I = ue({
|
|
1132
1172
|
session: s,
|
|
1133
|
-
fallbackDelta: { x: m, y:
|
|
1134
|
-
fallbackElapsed:
|
|
1173
|
+
fallbackDelta: { x: m, y: h },
|
|
1174
|
+
fallbackElapsed: v
|
|
1135
1175
|
});
|
|
1136
1176
|
Dt({
|
|
1137
|
-
currentTranslate:
|
|
1138
|
-
releaseVelocity:
|
|
1177
|
+
currentTranslate: j,
|
|
1178
|
+
releaseVelocity: I
|
|
1139
1179
|
});
|
|
1140
1180
|
} else {
|
|
1141
|
-
const
|
|
1181
|
+
const I = ce({
|
|
1142
1182
|
session: s,
|
|
1143
|
-
fallbackDeltaY:
|
|
1144
|
-
fallbackElapsed:
|
|
1183
|
+
fallbackDeltaY: h,
|
|
1184
|
+
fallbackElapsed: v
|
|
1145
1185
|
});
|
|
1146
1186
|
Xt({
|
|
1147
1187
|
closeAllowed: st,
|
|
1148
|
-
currentTranslate:
|
|
1149
|
-
deltaY:
|
|
1150
|
-
releaseVelocity:
|
|
1151
|
-
startTranslate:
|
|
1188
|
+
currentTranslate: j.y,
|
|
1189
|
+
deltaY: h,
|
|
1190
|
+
releaseVelocity: I,
|
|
1191
|
+
startTranslate: C
|
|
1152
1192
|
});
|
|
1153
1193
|
}
|
|
1154
1194
|
},
|
|
@@ -1156,64 +1196,64 @@ function Ke({
|
|
|
1156
1196
|
Xt,
|
|
1157
1197
|
Dt,
|
|
1158
1198
|
r,
|
|
1159
|
-
|
|
1160
|
-
rt,
|
|
1161
|
-
o,
|
|
1162
|
-
P,
|
|
1199
|
+
Z,
|
|
1163
1200
|
et,
|
|
1164
|
-
|
|
1201
|
+
a,
|
|
1202
|
+
X,
|
|
1203
|
+
tt,
|
|
1204
|
+
J
|
|
1165
1205
|
]
|
|
1166
|
-
),
|
|
1206
|
+
), Qt = p(
|
|
1167
1207
|
(t) => {
|
|
1168
|
-
|
|
1208
|
+
W({
|
|
1169
1209
|
currentTarget: t.currentTarget,
|
|
1170
1210
|
pageX: t.pageX,
|
|
1171
1211
|
pageY: t.pageY
|
|
1172
1212
|
});
|
|
1173
1213
|
},
|
|
1174
|
-
[
|
|
1175
|
-
),
|
|
1214
|
+
[W]
|
|
1215
|
+
), Te = p(
|
|
1176
1216
|
(t) => {
|
|
1177
|
-
const e =
|
|
1178
|
-
e.pointerId !== null && t.pointerId !== e.pointerId ||
|
|
1217
|
+
const e = x.current;
|
|
1218
|
+
e.pointerId !== null && t.pointerId !== e.pointerId || W({
|
|
1179
1219
|
pageX: t.pageX,
|
|
1180
1220
|
pageY: t.pageY,
|
|
1181
1221
|
releaseCapture: !1
|
|
1182
1222
|
});
|
|
1183
1223
|
},
|
|
1184
|
-
[
|
|
1224
|
+
[W]
|
|
1185
1225
|
);
|
|
1186
|
-
|
|
1226
|
+
kt(() => {
|
|
1187
1227
|
if (!r) return;
|
|
1188
1228
|
const t = (s) => {
|
|
1189
|
-
const u =
|
|
1190
|
-
!u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId ||
|
|
1229
|
+
const u = x.current;
|
|
1230
|
+
!u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || W({
|
|
1191
1231
|
pageX: s.pageX,
|
|
1192
1232
|
pageY: s.pageY,
|
|
1193
1233
|
releaseCapture: !1
|
|
1194
1234
|
});
|
|
1195
1235
|
}, e = () => {
|
|
1196
|
-
const s =
|
|
1197
|
-
!s.dragging || s.source !== "pointer" ||
|
|
1236
|
+
const s = x.current;
|
|
1237
|
+
!s.dragging || s.source !== "pointer" || W({
|
|
1198
1238
|
pageX: s.lastX,
|
|
1199
1239
|
pageY: s.lastY,
|
|
1200
1240
|
releaseCapture: !1
|
|
1201
1241
|
});
|
|
1202
|
-
},
|
|
1203
|
-
const u =
|
|
1242
|
+
}, o = (s) => {
|
|
1243
|
+
const u = x.current;
|
|
1204
1244
|
!u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
|
|
1205
1245
|
}, c = (s) => {
|
|
1206
|
-
const u =
|
|
1246
|
+
const u = x.current;
|
|
1207
1247
|
!u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
|
|
1208
1248
|
};
|
|
1209
|
-
return document.addEventListener("pointerout",
|
|
1249
|
+
return document.addEventListener("pointerout", o, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
|
|
1210
1250
|
"pointercancel",
|
|
1211
1251
|
t,
|
|
1212
1252
|
!0
|
|
1213
1253
|
), window.addEventListener("blur", e), () => {
|
|
1214
1254
|
document.removeEventListener(
|
|
1215
1255
|
"pointerout",
|
|
1216
|
-
|
|
1256
|
+
o,
|
|
1217
1257
|
!0
|
|
1218
1258
|
), document.removeEventListener("mouseout", c, !0), window.removeEventListener(
|
|
1219
1259
|
"pointerup",
|
|
@@ -1225,78 +1265,78 @@ function Ke({
|
|
|
1225
1265
|
!0
|
|
1226
1266
|
), window.removeEventListener("blur", e);
|
|
1227
1267
|
};
|
|
1228
|
-
}, [
|
|
1229
|
-
const
|
|
1230
|
-
const e =
|
|
1231
|
-
return e.touchId !== null ?
|
|
1232
|
-
}, []),
|
|
1268
|
+
}, [W, r]);
|
|
1269
|
+
const vt = p((t) => {
|
|
1270
|
+
const e = x.current;
|
|
1271
|
+
return e.touchId !== null ? se(t.changedTouches, e.touchId) ?? se(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
|
|
1272
|
+
}, []), ye = p(
|
|
1233
1273
|
(t) => {
|
|
1234
|
-
if (!r ||
|
|
1274
|
+
if (!r || a !== "bottom" && !X || n === !1 || t.touches.length !== 1 || Ct(t.target)) return;
|
|
1235
1275
|
let e = !1;
|
|
1236
1276
|
if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
|
|
1237
1277
|
e = !0;
|
|
1238
1278
|
else if (n === "handle")
|
|
1239
1279
|
return;
|
|
1240
|
-
n === "content" && (e =
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1280
|
+
n === "content" && (e = ae(t.target));
|
|
1281
|
+
const o = t.touches[0];
|
|
1282
|
+
a === "bottom" && mt({
|
|
1243
1283
|
target: t.target,
|
|
1244
1284
|
chrome: e
|
|
1245
|
-
}),
|
|
1285
|
+
}), Pt({
|
|
1246
1286
|
chrome: e,
|
|
1247
1287
|
source: "touch",
|
|
1248
|
-
startX:
|
|
1249
|
-
startY:
|
|
1250
|
-
touchId:
|
|
1288
|
+
startX: o.pageX,
|
|
1289
|
+
startY: o.pageY,
|
|
1290
|
+
touchId: o.identifier
|
|
1251
1291
|
});
|
|
1252
1292
|
},
|
|
1253
1293
|
[
|
|
1254
|
-
|
|
1294
|
+
Pt,
|
|
1255
1295
|
n,
|
|
1256
1296
|
r,
|
|
1257
|
-
|
|
1258
|
-
|
|
1297
|
+
a,
|
|
1298
|
+
X,
|
|
1259
1299
|
mt
|
|
1260
1300
|
]
|
|
1261
|
-
),
|
|
1301
|
+
), Zt = p(
|
|
1262
1302
|
(t) => {
|
|
1263
|
-
const e =
|
|
1264
|
-
if (!e.dragging || e.source !== "touch" || !r ||
|
|
1303
|
+
const e = x.current;
|
|
1304
|
+
if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !X)
|
|
1265
1305
|
return;
|
|
1266
|
-
const
|
|
1267
|
-
if (!
|
|
1268
|
-
const c =
|
|
1306
|
+
const o = vt(t);
|
|
1307
|
+
if (!o) return;
|
|
1308
|
+
const c = o.pageX - e.startX, s = o.pageY - e.startY, u = re({
|
|
1269
1309
|
deltaX: c,
|
|
1270
1310
|
deltaY: s,
|
|
1271
|
-
placement:
|
|
1272
|
-
}),
|
|
1311
|
+
placement: a
|
|
1312
|
+
}), d = b.dragStartThresholdPx.touch, g = a === "bottom" ? Ye({
|
|
1273
1313
|
target: t.target,
|
|
1274
1314
|
deltaY: s,
|
|
1275
1315
|
chrome: e.chrome,
|
|
1276
|
-
bodyNode:
|
|
1277
|
-
}) :
|
|
1316
|
+
bodyNode: U.current
|
|
1317
|
+
}) : Me({
|
|
1278
1318
|
target: t.target,
|
|
1279
|
-
bodyNode:
|
|
1319
|
+
bodyNode: U.current
|
|
1280
1320
|
});
|
|
1281
|
-
if (
|
|
1282
|
-
const
|
|
1283
|
-
!
|
|
1321
|
+
if (g.preventDefault) {
|
|
1322
|
+
const h = a === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < d && !e.started && u < d;
|
|
1323
|
+
!h && a === "bottom" && mt({
|
|
1284
1324
|
target: t.target,
|
|
1285
1325
|
chrome: e.chrome
|
|
1286
|
-
}),
|
|
1326
|
+
}), h || te(t);
|
|
1287
1327
|
}
|
|
1288
|
-
if (
|
|
1289
|
-
|
|
1328
|
+
if (g.resetAnchor) {
|
|
1329
|
+
$(!1), qt(e, { x: o.pageX, y: o.pageY });
|
|
1290
1330
|
return;
|
|
1291
1331
|
}
|
|
1292
|
-
if (
|
|
1293
|
-
if (e.allowed || (e.allowed = !0, e.started = !0),
|
|
1294
|
-
|
|
1332
|
+
if (g.allowDrag && !(!e.started && u < d))
|
|
1333
|
+
if (e.allowed || (e.allowed = !0, e.started = !0), g.preventDefault || te(t), e.lastX = o.pageX, e.lastY = o.pageY, a === "popup")
|
|
1334
|
+
Z(e, o), ie(e, o);
|
|
1295
1335
|
else {
|
|
1296
|
-
const m = e.startTranslate + s,
|
|
1297
|
-
|
|
1298
|
-
pageX:
|
|
1299
|
-
pageY:
|
|
1336
|
+
const m = e.startTranslate + s, h = et(e, s);
|
|
1337
|
+
J(m, h), ct(e, {
|
|
1338
|
+
pageX: o.pageX,
|
|
1339
|
+
pageY: o.pageY,
|
|
1300
1340
|
translateX: e.lastTranslateX,
|
|
1301
1341
|
translateY: e.lastTranslate
|
|
1302
1342
|
});
|
|
@@ -1304,21 +1344,21 @@ function Ke({
|
|
|
1304
1344
|
},
|
|
1305
1345
|
[
|
|
1306
1346
|
r,
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1347
|
+
Z,
|
|
1348
|
+
et,
|
|
1349
|
+
vt,
|
|
1350
|
+
a,
|
|
1351
|
+
X,
|
|
1352
|
+
qt,
|
|
1353
|
+
$,
|
|
1354
|
+
J,
|
|
1315
1355
|
mt
|
|
1316
1356
|
]
|
|
1317
1357
|
);
|
|
1318
|
-
|
|
1319
|
-
if (!l || !r ||
|
|
1358
|
+
kt(() => {
|
|
1359
|
+
if (!l || !r || a !== "bottom" && !X || n === !1 || typeof window > "u") return;
|
|
1320
1360
|
const t = (e) => {
|
|
1321
|
-
|
|
1361
|
+
Zt(e);
|
|
1322
1362
|
};
|
|
1323
1363
|
return window.addEventListener("touchmove", t, {
|
|
1324
1364
|
capture: !0,
|
|
@@ -1326,56 +1366,56 @@ function Ke({
|
|
|
1326
1366
|
}), () => {
|
|
1327
1367
|
window.removeEventListener("touchmove", t, !0);
|
|
1328
1368
|
};
|
|
1329
|
-
}, [n, r,
|
|
1330
|
-
const
|
|
1369
|
+
}, [n, r, Zt, l, a, X]);
|
|
1370
|
+
const xe = p(
|
|
1331
1371
|
(t) => {
|
|
1332
|
-
const e =
|
|
1333
|
-
if (!e.dragging || e.source !== "touch" || !r ||
|
|
1372
|
+
const e = x.current;
|
|
1373
|
+
if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !X)
|
|
1334
1374
|
return;
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
const
|
|
1375
|
+
const o = vt(t), c = o?.pageX ?? e.lastX, s = o?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, g = c - e.startX, m = s - e.startY, h = Math.max(it() - e.startTime, 1);
|
|
1376
|
+
a === "popup" && Q();
|
|
1377
|
+
const v = {
|
|
1338
1378
|
x: e.lastTranslateX,
|
|
1339
1379
|
y: e.lastTranslate
|
|
1340
|
-
},
|
|
1380
|
+
}, j = e.startTranslate;
|
|
1341
1381
|
if (u) {
|
|
1342
|
-
const
|
|
1382
|
+
const C = a === "popup" ? St(e, {
|
|
1343
1383
|
pageX: c,
|
|
1344
1384
|
pageY: s
|
|
1345
1385
|
}) : {
|
|
1346
1386
|
x: e.lastTranslateX,
|
|
1347
1387
|
y: e.lastTranslate
|
|
1348
1388
|
};
|
|
1349
|
-
|
|
1389
|
+
ct(e, {
|
|
1350
1390
|
pageX: c,
|
|
1351
1391
|
pageY: s,
|
|
1352
|
-
translateX:
|
|
1353
|
-
translateY:
|
|
1392
|
+
translateX: C.x,
|
|
1393
|
+
translateY: C.y
|
|
1354
1394
|
});
|
|
1355
1395
|
}
|
|
1356
|
-
if (
|
|
1357
|
-
if (
|
|
1358
|
-
const
|
|
1396
|
+
if (tt(e), !!u)
|
|
1397
|
+
if (a === "popup") {
|
|
1398
|
+
const C = ue({
|
|
1359
1399
|
session: e,
|
|
1360
|
-
fallbackDelta: { x:
|
|
1361
|
-
fallbackElapsed:
|
|
1400
|
+
fallbackDelta: { x: g, y: m },
|
|
1401
|
+
fallbackElapsed: h
|
|
1362
1402
|
});
|
|
1363
1403
|
Dt({
|
|
1364
|
-
currentTranslate:
|
|
1365
|
-
releaseVelocity:
|
|
1404
|
+
currentTranslate: v,
|
|
1405
|
+
releaseVelocity: C
|
|
1366
1406
|
});
|
|
1367
1407
|
} else {
|
|
1368
|
-
const
|
|
1408
|
+
const C = ce({
|
|
1369
1409
|
session: e,
|
|
1370
1410
|
fallbackDeltaY: m,
|
|
1371
|
-
fallbackElapsed:
|
|
1411
|
+
fallbackElapsed: h
|
|
1372
1412
|
});
|
|
1373
1413
|
Xt({
|
|
1374
|
-
closeAllowed:
|
|
1375
|
-
currentTranslate:
|
|
1414
|
+
closeAllowed: d,
|
|
1415
|
+
currentTranslate: v.y,
|
|
1376
1416
|
deltaY: m,
|
|
1377
|
-
releaseVelocity:
|
|
1378
|
-
startTranslate:
|
|
1417
|
+
releaseVelocity: C,
|
|
1418
|
+
startTranslate: j
|
|
1379
1419
|
});
|
|
1380
1420
|
}
|
|
1381
1421
|
},
|
|
@@ -1383,47 +1423,47 @@ function Ke({
|
|
|
1383
1423
|
Xt,
|
|
1384
1424
|
Dt,
|
|
1385
1425
|
r,
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1426
|
+
vt,
|
|
1427
|
+
a,
|
|
1428
|
+
X,
|
|
1429
|
+
tt,
|
|
1430
|
+
Q
|
|
1391
1431
|
]
|
|
1392
|
-
),
|
|
1393
|
-
const t =
|
|
1432
|
+
), we = p(() => {
|
|
1433
|
+
const t = x.current;
|
|
1394
1434
|
if (!t.dragging || t.source !== "touch") return;
|
|
1395
|
-
const e = t.started,
|
|
1435
|
+
const e = t.started, o = t.startTranslate, c = t.lastTranslate, s = {
|
|
1396
1436
|
x: t.startTranslateX,
|
|
1397
1437
|
y: t.startTranslate
|
|
1398
1438
|
}, u = {
|
|
1399
1439
|
x: t.lastTranslateX,
|
|
1400
1440
|
y: t.lastTranslate
|
|
1401
|
-
},
|
|
1402
|
-
if (
|
|
1403
|
-
if (
|
|
1404
|
-
V.current ? xt(s) :
|
|
1441
|
+
}, d = a;
|
|
1442
|
+
if (tt(t), !!e) {
|
|
1443
|
+
if (d === "popup") {
|
|
1444
|
+
V.current ? xt(s) : _(s, { from: u });
|
|
1405
1445
|
return;
|
|
1406
1446
|
}
|
|
1407
|
-
A(
|
|
1447
|
+
A(o, { from: c });
|
|
1408
1448
|
}
|
|
1409
1449
|
}, [
|
|
1410
|
-
|
|
1411
|
-
|
|
1450
|
+
a,
|
|
1451
|
+
tt,
|
|
1412
1452
|
xt,
|
|
1413
|
-
|
|
1453
|
+
_,
|
|
1414
1454
|
A
|
|
1415
1455
|
]);
|
|
1416
1456
|
return {
|
|
1417
|
-
onPointerDown:
|
|
1418
|
-
onPointerMove:
|
|
1419
|
-
onPointerUp:
|
|
1420
|
-
onPointerCancel:
|
|
1421
|
-
onLostPointerCapture:
|
|
1422
|
-
onTouchStart:
|
|
1423
|
-
onTouchEnd:
|
|
1424
|
-
onTouchCancel:
|
|
1457
|
+
onPointerDown: me,
|
|
1458
|
+
onPointerMove: he,
|
|
1459
|
+
onPointerUp: Qt,
|
|
1460
|
+
onPointerCancel: Qt,
|
|
1461
|
+
onLostPointerCapture: Te,
|
|
1462
|
+
onTouchStart: ye,
|
|
1463
|
+
onTouchEnd: xe,
|
|
1464
|
+
onTouchCancel: we
|
|
1425
1465
|
};
|
|
1426
1466
|
}
|
|
1427
1467
|
export {
|
|
1428
|
-
|
|
1468
|
+
Qe as useModalDrag
|
|
1429
1469
|
};
|