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