@orioncactuscorp/ui 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +67 -68
- package/dist/components/Modal/modalScrollArbitration.js +1 -0
- package/dist/components/Modal/useModalDrag.js +729 -663
- package/dist/styles.css +1 -1
- package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts +4 -0
- package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { ocSpring as
|
|
3
|
-
import { resolveOcMotion as
|
|
4
|
-
import { resolveModalPopupSnapPositions as
|
|
5
|
-
import { setModalBodyTouchScrollLock as
|
|
6
|
-
import { resolveResizedBottomSheetTranslate as
|
|
7
|
-
import { createSpringAnimator as
|
|
1
|
+
import { useRef as w, useLayoutEffect as ot, useCallback as p, useEffect as It } from "react";
|
|
2
|
+
import { ocSpring as Ze } from "../../utils/spring.js";
|
|
3
|
+
import { resolveOcMotion as zt } from "../../utils/motion.js";
|
|
4
|
+
import { resolveModalPopupSnapPositions as qe } from "./snapPoints.js";
|
|
5
|
+
import { setModalBodyTouchScrollLock as Ut, shouldLockModalBodyTouchScroll as tr, shouldIgnoreDragTarget as Wt, getScrollableAncestor as er, hasActiveTextSelection as rr, getBottomTouchDragDecision as nr, getPopupTouchDragDecision as or } from "./modalScrollArbitration.js";
|
|
6
|
+
import { resolveResizedBottomSheetTranslate as ar, resolveBottomSheetRestState as sr } from "./bottomSheetGeometry.js";
|
|
7
|
+
import { createSpringAnimator as Gt } from "../../utils/spring/animator.js";
|
|
8
8
|
const F = {
|
|
9
9
|
dragStartThresholdPx: {
|
|
10
10
|
touch: 10,
|
|
11
11
|
mouse: 2
|
|
12
12
|
},
|
|
13
|
+
// Mouse drags on body content arbitrate against native text selection: the
|
|
14
|
+
// gesture drives the sheet only once it is clearly vertical past this
|
|
15
|
+
// distance, otherwise the browser keeps its selection behavior.
|
|
16
|
+
selectionArbitrationThresholdPx: 12,
|
|
13
17
|
releaseVelocity: {
|
|
14
18
|
sampleWindowMs: 90,
|
|
15
19
|
maxPxPerSecond: 4e3,
|
|
@@ -36,31 +40,31 @@ const F = {
|
|
|
36
40
|
popupDragFollower: {
|
|
37
41
|
settleDurationFactor: 1 / 6
|
|
38
42
|
}
|
|
39
|
-
},
|
|
43
|
+
}, ir = Ze.snappy({
|
|
40
44
|
duration: F.settleSpring.durationSeconds * F.popupDragFollower.settleDurationFactor
|
|
41
|
-
}),
|
|
42
|
-
function
|
|
45
|
+
}), lr = [], cr = [];
|
|
46
|
+
function Ye(r) {
|
|
43
47
|
r.cancelable !== !1 && r.preventDefault();
|
|
44
48
|
}
|
|
45
|
-
function
|
|
49
|
+
function A(r, n, i) {
|
|
46
50
|
return Math.min(Math.max(r, n), i);
|
|
47
51
|
}
|
|
48
|
-
function
|
|
52
|
+
function Me(r) {
|
|
49
53
|
return [...new Set(r)].sort((n, i) => n - i);
|
|
50
54
|
}
|
|
51
|
-
function
|
|
55
|
+
function ur(r, n) {
|
|
52
56
|
return r.reduce(
|
|
53
57
|
(i, o) => Math.abs(o - n) < Math.abs(i - n) ? o : i
|
|
54
58
|
);
|
|
55
59
|
}
|
|
56
|
-
function
|
|
60
|
+
function Ee({
|
|
57
61
|
deltaX: r,
|
|
58
62
|
deltaY: n,
|
|
59
63
|
placement: i
|
|
60
64
|
}) {
|
|
61
65
|
return i === "bottom" ? Math.abs(n) : Math.hypot(r, n);
|
|
62
66
|
}
|
|
63
|
-
function
|
|
67
|
+
function dr(r, n, i) {
|
|
64
68
|
if (i === "down")
|
|
65
69
|
return r.find((l) => l > n + 1) ?? r[r.length - 1] ?? 0;
|
|
66
70
|
for (let l = r.length - 1; l >= 0; l -= 1) {
|
|
@@ -70,55 +74,55 @@ function nr(r, n, i) {
|
|
|
70
74
|
}
|
|
71
75
|
return r[0] ?? 0;
|
|
72
76
|
}
|
|
73
|
-
function
|
|
74
|
-
const y =
|
|
77
|
+
function pr(r, n, i, o, l = i) {
|
|
78
|
+
const y = dr(r, n, o), T = o === "down" ? Math.max(i, l) : Math.min(i, l);
|
|
75
79
|
if (o === "down") {
|
|
76
80
|
if (r.filter(
|
|
77
|
-
(
|
|
81
|
+
($) => $ > n + 1 && $ <= i + 1
|
|
78
82
|
).length === 0) return y;
|
|
79
|
-
const
|
|
80
|
-
(
|
|
83
|
+
const tt = r.filter(
|
|
84
|
+
($) => $ > n + 1 && $ <= T + 1
|
|
81
85
|
);
|
|
82
|
-
return
|
|
86
|
+
return tt[tt.length - 1] ?? y;
|
|
83
87
|
}
|
|
84
88
|
return r.filter(
|
|
85
|
-
(
|
|
89
|
+
(L) => L < n - 1 && L >= i - 1
|
|
86
90
|
).length === 0 ? y : r.filter(
|
|
87
|
-
(
|
|
91
|
+
(L) => L < n - 1 && L >= T - 1
|
|
88
92
|
)[0] ?? y;
|
|
89
93
|
}
|
|
90
|
-
function
|
|
94
|
+
function be(r, n) {
|
|
91
95
|
if (n <= 0) return 0;
|
|
92
96
|
const i = n, { resistance: o } = F.rubberBand;
|
|
93
97
|
return r * o * i / (i + o * r);
|
|
94
98
|
}
|
|
95
|
-
function
|
|
99
|
+
function Kt({
|
|
96
100
|
targetTranslate: r,
|
|
97
101
|
minTranslate: n,
|
|
98
102
|
maxTranslate: i,
|
|
99
103
|
minBoundaryLimit: o,
|
|
100
104
|
maxBoundaryLimit: l
|
|
101
105
|
}) {
|
|
102
|
-
return r < n ? n -
|
|
106
|
+
return r < n ? n - be(n - r, o) : r > i ? i + be(r - i, l) : r;
|
|
103
107
|
}
|
|
104
|
-
function
|
|
108
|
+
function Le(r) {
|
|
105
109
|
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
|
|
106
110
|
}
|
|
107
|
-
function
|
|
111
|
+
function ke(r) {
|
|
108
112
|
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest(
|
|
109
113
|
'[data-oc-part="handle"], [data-oc-component="modal-navigation"]'
|
|
110
114
|
);
|
|
111
115
|
}
|
|
112
|
-
function
|
|
116
|
+
function fr(r) {
|
|
113
117
|
return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-component="modal-navigation"]');
|
|
114
118
|
}
|
|
115
|
-
function
|
|
119
|
+
function gr(r) {
|
|
116
120
|
return typeof Element > "u" || !(r instanceof Element) ? null : r.closest('[data-oc-component="modal-navigation"]');
|
|
117
121
|
}
|
|
118
|
-
function
|
|
122
|
+
function mr(r, n) {
|
|
119
123
|
return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
120
124
|
}
|
|
121
|
-
function
|
|
125
|
+
function Ce(r, n) {
|
|
122
126
|
if (!r.length)
|
|
123
127
|
return {
|
|
124
128
|
minTranslate: 0,
|
|
@@ -137,14 +141,14 @@ function Ye(r, n) {
|
|
|
137
141
|
maxTranslate: l
|
|
138
142
|
};
|
|
139
143
|
}
|
|
140
|
-
function
|
|
144
|
+
function Fe(r, n) {
|
|
141
145
|
for (let i = 0; i < r.length; i += 1) {
|
|
142
146
|
const o = "item" in r && typeof r.item == "function" ? r.item(i) : r[i];
|
|
143
147
|
if (o?.identifier === n) return o;
|
|
144
148
|
}
|
|
145
149
|
return null;
|
|
146
150
|
}
|
|
147
|
-
function
|
|
151
|
+
function Re(r) {
|
|
148
152
|
if (!r) return { x: 0, y: 0 };
|
|
149
153
|
const n = window.getComputedStyle(r).transform;
|
|
150
154
|
if (!n || n === "none") return { x: 0, y: 0 };
|
|
@@ -166,207 +170,207 @@ function Ae(r) {
|
|
|
166
170
|
}
|
|
167
171
|
return { x: 0, y: 0 };
|
|
168
172
|
}
|
|
169
|
-
function
|
|
170
|
-
return
|
|
173
|
+
function Jt(r) {
|
|
174
|
+
return Re(r).y;
|
|
171
175
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
176
|
+
function Ae(r) {
|
|
177
|
+
return Re(r);
|
|
174
178
|
}
|
|
175
|
-
function
|
|
179
|
+
function yt(r) {
|
|
176
180
|
if (!r || !/^-?\d*\.?\d+(?:px)?$/.test(r.trim())) return;
|
|
177
181
|
const n = Number.parseFloat(r);
|
|
178
182
|
return Number.isFinite(n) ? n : void 0;
|
|
179
183
|
}
|
|
180
|
-
function
|
|
184
|
+
function Z() {
|
|
181
185
|
return Date.now();
|
|
182
186
|
}
|
|
183
|
-
function
|
|
187
|
+
function hr(r, n) {
|
|
184
188
|
const i = n - F.releaseVelocity.sampleWindowMs;
|
|
185
189
|
for (; r.length > 2 && (r[1]?.time ?? n) < i; )
|
|
186
190
|
r.shift();
|
|
187
191
|
}
|
|
188
|
-
function
|
|
189
|
-
const i = n.time ??
|
|
192
|
+
function St(r, n) {
|
|
193
|
+
const i = n.time ?? Z();
|
|
190
194
|
r.samples.push({
|
|
191
195
|
time: i,
|
|
192
196
|
pageX: n.pageX,
|
|
193
197
|
pageY: n.pageY,
|
|
194
198
|
translateX: n.translateX,
|
|
195
199
|
translateY: n.translateY
|
|
196
|
-
}),
|
|
200
|
+
}), hr(r.samples, i);
|
|
197
201
|
}
|
|
198
|
-
function
|
|
202
|
+
function Ot(r, n) {
|
|
199
203
|
return {
|
|
200
204
|
x: r.startTranslateX + n.pageX - r.startX,
|
|
201
205
|
y: r.startTranslate + n.pageY - r.startY
|
|
202
206
|
};
|
|
203
207
|
}
|
|
204
|
-
function
|
|
205
|
-
const i =
|
|
206
|
-
|
|
208
|
+
function Be(r, n) {
|
|
209
|
+
const i = Ot(r, n);
|
|
210
|
+
St(r, {
|
|
207
211
|
pageX: n.pageX,
|
|
208
212
|
pageY: n.pageY,
|
|
209
213
|
translateX: i.x,
|
|
210
214
|
translateY: i.y
|
|
211
215
|
});
|
|
212
216
|
}
|
|
213
|
-
function
|
|
217
|
+
function Ie({
|
|
214
218
|
session: r,
|
|
215
219
|
fallbackDeltaY: n,
|
|
216
220
|
fallbackElapsed: i
|
|
217
221
|
}) {
|
|
218
222
|
const o = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: h } = F.releaseVelocity;
|
|
219
223
|
if (o) {
|
|
220
|
-
const y = o.time - h, T = r.samples.find((
|
|
224
|
+
const y = o.time - h, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
|
|
221
225
|
if (T && T !== o) {
|
|
222
|
-
const
|
|
223
|
-
if (Number.isFinite(
|
|
224
|
-
return
|
|
226
|
+
const D = Math.max(o.time - T.time, 1), b = (o.translateY - T.translateY) / D * 1e3;
|
|
227
|
+
if (Number.isFinite(b))
|
|
228
|
+
return A(b, -l, l);
|
|
225
229
|
}
|
|
226
230
|
}
|
|
227
|
-
return
|
|
231
|
+
return A(
|
|
228
232
|
n / Math.max(i, 1) * 1e3,
|
|
229
233
|
-l,
|
|
230
234
|
l
|
|
231
235
|
);
|
|
232
236
|
}
|
|
233
|
-
function
|
|
237
|
+
function Oe({
|
|
234
238
|
session: r,
|
|
235
239
|
fallbackDelta: n,
|
|
236
240
|
fallbackElapsed: i
|
|
237
241
|
}) {
|
|
238
242
|
const o = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: h } = F.releaseVelocity;
|
|
239
243
|
if (o) {
|
|
240
|
-
const y = o.time - h, T = r.samples.find((
|
|
244
|
+
const y = o.time - h, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
|
|
241
245
|
if (T && T !== o) {
|
|
242
|
-
const
|
|
243
|
-
x: (o.translateX - T.translateX) /
|
|
244
|
-
y: (o.translateY - T.translateY) /
|
|
246
|
+
const D = Math.max(o.time - T.time, 1), b = {
|
|
247
|
+
x: (o.translateX - T.translateX) / D * 1e3,
|
|
248
|
+
y: (o.translateY - T.translateY) / D * 1e3
|
|
245
249
|
};
|
|
246
|
-
if (Number.isFinite(
|
|
250
|
+
if (Number.isFinite(b.x) && Number.isFinite(b.y))
|
|
247
251
|
return {
|
|
248
|
-
x:
|
|
249
|
-
y:
|
|
252
|
+
x: A(b.x, -l, l),
|
|
253
|
+
y: A(b.y, -l, l)
|
|
250
254
|
};
|
|
251
255
|
}
|
|
252
256
|
}
|
|
253
257
|
return {
|
|
254
|
-
x:
|
|
258
|
+
x: A(
|
|
255
259
|
n.x / Math.max(i, 1) * 1e3,
|
|
256
260
|
-l,
|
|
257
261
|
l
|
|
258
262
|
),
|
|
259
|
-
y:
|
|
263
|
+
y: A(
|
|
260
264
|
n.y / Math.max(i, 1) * 1e3,
|
|
261
265
|
-l,
|
|
262
266
|
l
|
|
263
267
|
)
|
|
264
268
|
};
|
|
265
269
|
}
|
|
266
|
-
function
|
|
270
|
+
function yr({
|
|
267
271
|
currentTranslate: r,
|
|
268
272
|
releaseVelocity: n
|
|
269
273
|
}) {
|
|
270
274
|
const { lookaheadSeconds: i, maxDistancePx: o } = F.snapProjection;
|
|
271
|
-
return r +
|
|
275
|
+
return r + A(n * i, -o, o);
|
|
272
276
|
}
|
|
273
|
-
function
|
|
277
|
+
function Tr({
|
|
274
278
|
currentTranslate: r,
|
|
275
279
|
releaseVelocity: n
|
|
276
280
|
}) {
|
|
277
281
|
const { lookaheadSeconds: i, maxDistancePx: o } = F.snapProjection;
|
|
278
282
|
return {
|
|
279
|
-
x: r.x +
|
|
283
|
+
x: r.x + A(
|
|
280
284
|
n.x * i,
|
|
281
285
|
-o,
|
|
282
286
|
o
|
|
283
287
|
),
|
|
284
|
-
y: r.y +
|
|
288
|
+
y: r.y + A(
|
|
285
289
|
n.y * i,
|
|
286
290
|
-o,
|
|
287
291
|
o
|
|
288
292
|
)
|
|
289
293
|
};
|
|
290
294
|
}
|
|
291
|
-
function
|
|
295
|
+
function xr(r) {
|
|
292
296
|
return Math.abs(r) / 1e3 > F.releaseVelocity.flickThresholdPxPerMs;
|
|
293
297
|
}
|
|
294
|
-
function
|
|
298
|
+
function Pr(r) {
|
|
295
299
|
return Math.hypot(r.x, r.y) / 1e3 > F.releaseVelocity.flickThresholdPxPerMs;
|
|
296
300
|
}
|
|
297
|
-
function
|
|
301
|
+
function q(r, n) {
|
|
298
302
|
return Math.hypot(r.x - n.x, r.y - n.y);
|
|
299
303
|
}
|
|
300
|
-
function
|
|
304
|
+
function Ne(r, n) {
|
|
301
305
|
return r.reduce(
|
|
302
|
-
(i, o) =>
|
|
306
|
+
(i, o) => q(o, n) < q(i, n) ? o : i
|
|
303
307
|
);
|
|
304
308
|
}
|
|
305
|
-
function
|
|
309
|
+
function vr({
|
|
306
310
|
currentTranslate: r,
|
|
307
311
|
releaseVelocity: n,
|
|
308
312
|
targets: i
|
|
309
313
|
}) {
|
|
310
|
-
const o =
|
|
314
|
+
const o = Tr({
|
|
311
315
|
currentTranslate: r,
|
|
312
316
|
releaseVelocity: n
|
|
313
317
|
});
|
|
314
|
-
if (!
|
|
315
|
-
return
|
|
318
|
+
if (!Pr(n))
|
|
319
|
+
return Ne(i, r);
|
|
316
320
|
const l = i.filter((h) => {
|
|
317
321
|
const y = h.x - r.x, T = h.y - r.y;
|
|
318
322
|
return y * n.x + T * n.y > 0;
|
|
319
323
|
});
|
|
320
|
-
return
|
|
324
|
+
return Ne(
|
|
321
325
|
l.length ? l : i,
|
|
322
326
|
o
|
|
323
327
|
);
|
|
324
328
|
}
|
|
325
|
-
function
|
|
329
|
+
function _e(r) {
|
|
326
330
|
return r === "top" || r.startsWith("top-") ? "top" : r === "bottom" || r.startsWith("bottom-") ? "bottom" : "center";
|
|
327
331
|
}
|
|
328
|
-
function
|
|
332
|
+
function wr({
|
|
329
333
|
target: r,
|
|
330
334
|
targets: n
|
|
331
335
|
}) {
|
|
332
336
|
const i = n.filter((o) => o !== r);
|
|
333
337
|
if (i.length)
|
|
334
338
|
return i.reduce(
|
|
335
|
-
(o, l) => Math.min(o,
|
|
339
|
+
(o, l) => Math.min(o, q(r, l)),
|
|
336
340
|
Number.POSITIVE_INFINITY
|
|
337
341
|
);
|
|
338
342
|
}
|
|
339
|
-
function
|
|
343
|
+
function Dr({
|
|
340
344
|
closeThreshold: r,
|
|
341
345
|
currentTarget: n,
|
|
342
346
|
surfaceSize: i,
|
|
343
347
|
targets: o
|
|
344
348
|
}) {
|
|
345
|
-
const l =
|
|
349
|
+
const l = _e(n.key), h = l === "center" ? Math.min(i.width, i.height) : i.height, y = Math.max(
|
|
346
350
|
F.dismissal.minDistancePx,
|
|
347
351
|
h * r
|
|
348
352
|
);
|
|
349
353
|
if (l !== "center") return y;
|
|
350
|
-
const T =
|
|
354
|
+
const T = wr({
|
|
351
355
|
target: n,
|
|
352
356
|
targets: o
|
|
353
357
|
});
|
|
354
358
|
return !T || !Number.isFinite(T) ? y : Math.max(y, T * 0.75);
|
|
355
359
|
}
|
|
356
|
-
function
|
|
360
|
+
function Sr({
|
|
357
361
|
currentTarget: r,
|
|
358
362
|
currentTranslate: n
|
|
359
363
|
}) {
|
|
360
|
-
switch (
|
|
364
|
+
switch (_e(r.key)) {
|
|
361
365
|
case "top":
|
|
362
366
|
return r.y - n.y;
|
|
363
367
|
case "bottom":
|
|
364
368
|
return n.y - r.y;
|
|
365
369
|
case "center":
|
|
366
|
-
return
|
|
370
|
+
return q(r, n);
|
|
367
371
|
}
|
|
368
372
|
}
|
|
369
|
-
function
|
|
373
|
+
function Xr({
|
|
370
374
|
closeThreshold: r,
|
|
371
375
|
currentTarget: n,
|
|
372
376
|
currentTranslate: i,
|
|
@@ -375,32 +379,32 @@ function yr({
|
|
|
375
379
|
targets: h
|
|
376
380
|
}) {
|
|
377
381
|
if (o.key !== n.key) return !1;
|
|
378
|
-
const y =
|
|
382
|
+
const y = Sr({
|
|
379
383
|
currentTarget: n,
|
|
380
384
|
currentTranslate: i
|
|
381
385
|
});
|
|
382
|
-
return y <= 0 ? !1 : y >=
|
|
386
|
+
return y <= 0 ? !1 : y >= Dr({
|
|
383
387
|
closeThreshold: r,
|
|
384
388
|
currentTarget: n,
|
|
385
389
|
surfaceSize: l,
|
|
386
390
|
targets: h
|
|
387
391
|
});
|
|
388
392
|
}
|
|
389
|
-
function
|
|
393
|
+
function Yr({
|
|
390
394
|
presentationState: r,
|
|
391
395
|
releaseTranslate: n,
|
|
392
396
|
visibleTranslate: i
|
|
393
397
|
}) {
|
|
394
398
|
return r !== "visible" || Math.abs(n - i) > 1;
|
|
395
399
|
}
|
|
396
|
-
function
|
|
400
|
+
function Mr({
|
|
397
401
|
drag: r,
|
|
398
402
|
placement: n,
|
|
399
403
|
snapPositionCount: i
|
|
400
404
|
}) {
|
|
401
405
|
return n === "popup" && (r === "content" || r === "handle") && i > 0;
|
|
402
406
|
}
|
|
403
|
-
function
|
|
407
|
+
function Er({
|
|
404
408
|
dismissible: r,
|
|
405
409
|
peekTranslate: n,
|
|
406
410
|
sheetHeight: i,
|
|
@@ -411,11 +415,11 @@ function Pr({
|
|
|
411
415
|
minTranslate: 0
|
|
412
416
|
};
|
|
413
417
|
}
|
|
414
|
-
function
|
|
418
|
+
function Ve(r, n = 1) {
|
|
415
419
|
const i = Math.max(n, 1);
|
|
416
420
|
return r && Math.abs(r.maxTranslate - r.minTranslate) || i;
|
|
417
421
|
}
|
|
418
|
-
function
|
|
422
|
+
function He({
|
|
419
423
|
limit: r,
|
|
420
424
|
viewportSize: n,
|
|
421
425
|
viewportLimitRatio: i
|
|
@@ -423,26 +427,26 @@ function Be({
|
|
|
423
427
|
const o = Math.max(r, 0);
|
|
424
428
|
return n <= 0 ? o : Math.min(o, n * i);
|
|
425
429
|
}
|
|
426
|
-
function
|
|
430
|
+
function br({
|
|
427
431
|
minTranslate: r,
|
|
428
432
|
sheetHeight: n,
|
|
429
433
|
surfaceMotion: i
|
|
430
434
|
}) {
|
|
431
|
-
const o = i.parentElement?.getBoundingClientRect(), l = o?.top ?? 0, h = o && o.height > 0 ? o.height : window.innerHeight, y = i.getBoundingClientRect(), T =
|
|
435
|
+
const o = i.parentElement?.getBoundingClientRect(), l = o?.top ?? 0, h = o && o.height > 0 ? o.height : window.innerHeight, y = i.getBoundingClientRect(), T = Jt(i), D = y.top - T + r, b = Math.max(D - l, 0), { observedViewportLimitRatio: L } = F.rubberBand;
|
|
432
436
|
return {
|
|
433
|
-
minBoundaryLimit:
|
|
434
|
-
limit:
|
|
437
|
+
minBoundaryLimit: He({
|
|
438
|
+
limit: b,
|
|
435
439
|
viewportSize: h,
|
|
436
|
-
viewportLimitRatio:
|
|
440
|
+
viewportLimitRatio: L.top
|
|
437
441
|
}),
|
|
438
|
-
maxBoundaryLimit:
|
|
442
|
+
maxBoundaryLimit: He({
|
|
439
443
|
limit: n,
|
|
440
444
|
viewportSize: h,
|
|
441
|
-
viewportLimitRatio:
|
|
445
|
+
viewportLimitRatio: L.bottom
|
|
442
446
|
})
|
|
443
447
|
};
|
|
444
448
|
}
|
|
445
|
-
function
|
|
449
|
+
function Lr({
|
|
446
450
|
rubberBand: r,
|
|
447
451
|
targetTranslate: n,
|
|
448
452
|
sheetHeight: i,
|
|
@@ -450,22 +454,22 @@ function vr({
|
|
|
450
454
|
bounds: l,
|
|
451
455
|
rubberBandLimits: h
|
|
452
456
|
}) {
|
|
453
|
-
const y =
|
|
454
|
-
r ?
|
|
457
|
+
const y = A(
|
|
458
|
+
r ? Kt({
|
|
455
459
|
targetTranslate: n,
|
|
456
460
|
...h,
|
|
457
461
|
...l
|
|
458
462
|
}) : n,
|
|
459
463
|
l.minTranslate - h.minBoundaryLimit,
|
|
460
464
|
l.maxTranslate + h.maxBoundaryLimit
|
|
461
|
-
), T = Math.max(-y, 0),
|
|
465
|
+
), T = Math.max(-y, 0), D = Math.max(y, 0), b = o > 0 ? o : i, L = b > 0 ? 1 - D / Math.max(b, 1) : 0;
|
|
462
466
|
return {
|
|
463
467
|
translate: y,
|
|
464
468
|
overshootFillHeight: T,
|
|
465
|
-
backdropOpacity:
|
|
469
|
+
backdropOpacity: A(L, 0, 1)
|
|
466
470
|
};
|
|
467
471
|
}
|
|
468
|
-
function
|
|
472
|
+
function Nr({
|
|
469
473
|
enabled: r,
|
|
470
474
|
drag: n,
|
|
471
475
|
open: i,
|
|
@@ -474,28 +478,29 @@ function kr({
|
|
|
474
478
|
surfaceMotionNode: h,
|
|
475
479
|
backdropRef: y,
|
|
476
480
|
bodyNode: T,
|
|
477
|
-
snapHeights:
|
|
478
|
-
sheetHeight:
|
|
479
|
-
snapPositions:
|
|
480
|
-
defaultSnapPosition:
|
|
481
|
-
peekHeight:
|
|
482
|
-
peekFallback:
|
|
483
|
-
presentationState:
|
|
484
|
-
setPresentationState:
|
|
485
|
-
requestClose:
|
|
486
|
-
canCloseAttempt:
|
|
487
|
-
dismissible:
|
|
488
|
-
preserveShadowOpacity:
|
|
489
|
-
visibleTranslate:
|
|
490
|
-
shouldDeferBottomSettle:
|
|
491
|
-
closeThreshold:
|
|
492
|
-
scrollLockTimeout:
|
|
493
|
-
popupSnapLayoutVersion:
|
|
481
|
+
snapHeights: D = lr,
|
|
482
|
+
sheetHeight: b,
|
|
483
|
+
snapPositions: L = cr,
|
|
484
|
+
defaultSnapPosition: tt,
|
|
485
|
+
peekHeight: $,
|
|
486
|
+
peekFallback: Qt,
|
|
487
|
+
presentationState: V,
|
|
488
|
+
setPresentationState: Nt,
|
|
489
|
+
requestClose: at,
|
|
490
|
+
canCloseAttempt: Zt,
|
|
491
|
+
dismissible: H = !0,
|
|
492
|
+
preserveShadowOpacity: qt = !1,
|
|
493
|
+
visibleTranslate: S = 0,
|
|
494
|
+
shouldDeferBottomSettle: te,
|
|
495
|
+
closeThreshold: Tt = 0.35,
|
|
496
|
+
scrollLockTimeout: ee = 500,
|
|
497
|
+
popupSnapLayoutVersion: re = 0
|
|
494
498
|
}) {
|
|
495
|
-
const
|
|
499
|
+
const M = w({
|
|
496
500
|
dragging: !1,
|
|
497
501
|
allowed: !1,
|
|
498
502
|
chrome: !1,
|
|
503
|
+
selectionArbitration: !1,
|
|
499
504
|
closeAllowed: null,
|
|
500
505
|
started: !1,
|
|
501
506
|
source: null,
|
|
@@ -511,77 +516,77 @@ function kr({
|
|
|
511
516
|
samples: [],
|
|
512
517
|
pointerId: null,
|
|
513
518
|
touchId: null
|
|
514
|
-
}),
|
|
519
|
+
}), z = w(T), ne = w(!1), oe = w(!1), $e = w((t) => {
|
|
515
520
|
t.preventDefault();
|
|
516
|
-
}),
|
|
521
|
+
}), Xt = w(0), Vt = w(!1), R = w(null), _ = w(
|
|
517
522
|
null
|
|
518
|
-
),
|
|
523
|
+
), Yt = w(null), U = w(null), xt = w(0), j = w(null), Ht = w(!1), Rt = w(!1), ae = w(V), Mt = w({
|
|
519
524
|
kind: "default-snap"
|
|
520
|
-
}),
|
|
525
|
+
}), se = w(b ?? null), ie = w(S), le = w(D), _t = w(!1), st = w(!1), E = Mr({
|
|
521
526
|
drag: n,
|
|
522
527
|
placement: o,
|
|
523
|
-
snapPositionCount:
|
|
524
|
-
}),
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}, [
|
|
528
|
-
const t =
|
|
529
|
-
t && t !== T &&
|
|
528
|
+
snapPositionCount: L.length
|
|
529
|
+
}), ce = `${tt ?? ""}:${L.join("|")}`, ue = w(L), Et = w(tt);
|
|
530
|
+
ot(() => {
|
|
531
|
+
ue.current = L, Et.current = tt;
|
|
532
|
+
}, [tt, ce, L]), ot(() => {
|
|
533
|
+
const t = z.current;
|
|
534
|
+
t && t !== T && Ut(t, !1), z.current = T, ne.current && Ut(T, !0);
|
|
530
535
|
}, [T]);
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
}, []),
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
const e =
|
|
536
|
+
const it = p((t) => {
|
|
537
|
+
ne.current = t, Ut(z.current, t);
|
|
538
|
+
}, []), W = p((t) => {
|
|
539
|
+
if (oe.current === t) return;
|
|
540
|
+
oe.current = t;
|
|
541
|
+
const e = $e.current;
|
|
537
542
|
if (t) {
|
|
538
543
|
document.addEventListener("selectstart", e, !0), document.addEventListener("dragstart", e, !0);
|
|
539
544
|
return;
|
|
540
545
|
}
|
|
541
546
|
document.removeEventListener("selectstart", e, !0), document.removeEventListener("dragstart", e, !0);
|
|
542
|
-
}, []),
|
|
547
|
+
}, []), bt = p(
|
|
543
548
|
({ chrome: t, target: e }) => {
|
|
544
|
-
const a =
|
|
549
|
+
const a = tr({
|
|
545
550
|
target: e,
|
|
546
551
|
chrome: t,
|
|
547
|
-
bodyNode:
|
|
552
|
+
bodyNode: z.current
|
|
548
553
|
});
|
|
549
|
-
return
|
|
554
|
+
return it(a), a;
|
|
550
555
|
},
|
|
551
|
-
[
|
|
552
|
-
), I = p(() => l.current?.getBoundingClientRect().height ?? window.innerHeight, [l]),
|
|
553
|
-
if (
|
|
554
|
-
if (
|
|
556
|
+
[it]
|
|
557
|
+
), I = p(() => l.current?.getBoundingClientRect().height ?? window.innerHeight, [l]), Lt = p(() => {
|
|
558
|
+
if ($ !== void 0) return $;
|
|
559
|
+
if (Qt === "header")
|
|
555
560
|
return l.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
|
|
556
|
-
}, [
|
|
561
|
+
}, [Qt, $, l]), Pt = p(
|
|
557
562
|
(t) => {
|
|
558
|
-
const e =
|
|
559
|
-
return e === void 0 || e <= 0 ? 0 :
|
|
563
|
+
const e = Lt();
|
|
564
|
+
return e === void 0 || e <= 0 ? 0 : A(t - e, 0, t);
|
|
560
565
|
},
|
|
561
|
-
[
|
|
562
|
-
),
|
|
563
|
-
const t =
|
|
564
|
-
return t === void 0 || t <= 0 ? 0 :
|
|
565
|
-
}, [
|
|
566
|
-
() =>
|
|
567
|
-
[
|
|
568
|
-
),
|
|
566
|
+
[Lt]
|
|
567
|
+
), G = p(() => {
|
|
568
|
+
const t = Lt();
|
|
569
|
+
return t === void 0 || t <= 0 ? 0 : Pt(I());
|
|
570
|
+
}, [Lt, Pt, I]), $t = p(
|
|
571
|
+
() => V === "peeked" ? G() : S,
|
|
572
|
+
[G, V, S]
|
|
573
|
+
), et = p(() => {
|
|
569
574
|
const t = l.current;
|
|
570
|
-
if (!t) return
|
|
571
|
-
const e =
|
|
575
|
+
if (!t) return $t();
|
|
576
|
+
const e = yt(
|
|
572
577
|
t.style.getPropertyValue("--oc-modal-translate-y")
|
|
573
578
|
);
|
|
574
579
|
if (e !== void 0) return e;
|
|
575
|
-
const a =
|
|
580
|
+
const a = yt(
|
|
576
581
|
window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
|
|
577
582
|
);
|
|
578
|
-
return a !== void 0 ? a :
|
|
579
|
-
}, [
|
|
583
|
+
return a !== void 0 ? a : $t();
|
|
584
|
+
}, [$t, l]), kt = p(() => {
|
|
580
585
|
const t = l.current;
|
|
581
586
|
if (!t) return { x: 0, y: 0 };
|
|
582
|
-
const e =
|
|
587
|
+
const e = yt(
|
|
583
588
|
t.style.getPropertyValue("--oc-modal-translate-x")
|
|
584
|
-
), a =
|
|
589
|
+
), a = yt(
|
|
585
590
|
t.style.getPropertyValue("--oc-modal-translate-y")
|
|
586
591
|
);
|
|
587
592
|
if (e !== void 0 || a !== void 0)
|
|
@@ -591,22 +596,22 @@ function kr({
|
|
|
591
596
|
};
|
|
592
597
|
const c = window.getComputedStyle(t);
|
|
593
598
|
return {
|
|
594
|
-
x:
|
|
595
|
-
y:
|
|
599
|
+
x: yt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
|
|
600
|
+
y: yt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
|
|
596
601
|
};
|
|
597
|
-
}, [l]),
|
|
598
|
-
const t =
|
|
602
|
+
}, [l]), lt = p(() => {
|
|
603
|
+
const t = et(), e = Jt(l.current);
|
|
599
604
|
return Math.abs(e - t) > 1 ? e : t;
|
|
600
|
-
}, [
|
|
605
|
+
}, [et, l]), vt = p(
|
|
601
606
|
(t, e, a = 1) => Math.abs(t - e) <= a,
|
|
602
607
|
[]
|
|
603
|
-
),
|
|
604
|
-
const t =
|
|
605
|
-
return
|
|
606
|
-
}, [
|
|
608
|
+
), ct = p(() => {
|
|
609
|
+
const t = kt(), e = Ae(l.current);
|
|
610
|
+
return q(e, t) > 1 ? e : t;
|
|
611
|
+
}, [kt, l]), B = p(
|
|
607
612
|
(t, {
|
|
608
613
|
active: e,
|
|
609
|
-
nextDismissible: a =
|
|
614
|
+
nextDismissible: a = H,
|
|
610
615
|
rubberBand: c = !1,
|
|
611
616
|
sheetHeightOverride: s,
|
|
612
617
|
peekTranslateOverride: u,
|
|
@@ -614,80 +619,80 @@ function kr({
|
|
|
614
619
|
}) => {
|
|
615
620
|
const f = l.current;
|
|
616
621
|
if (!f) return;
|
|
617
|
-
const g = s ?? I(), m = f.parentElement, Y = u ??
|
|
622
|
+
const g = s ?? I(), m = f.parentElement, Y = u ?? G(), C = Er({
|
|
618
623
|
dismissible: a,
|
|
619
624
|
peekTranslate: Y,
|
|
620
625
|
sheetHeight: g,
|
|
621
|
-
visibleTranslate:
|
|
622
|
-
}),
|
|
623
|
-
minTranslate:
|
|
626
|
+
visibleTranslate: S
|
|
627
|
+
}), x = br({
|
|
628
|
+
minTranslate: C.minTranslate,
|
|
624
629
|
sheetHeight: g,
|
|
625
630
|
surfaceMotion: f
|
|
626
|
-
}),
|
|
631
|
+
}), P = Lr({
|
|
627
632
|
rubberBand: c,
|
|
628
633
|
targetTranslate: t,
|
|
629
634
|
sheetHeight: g,
|
|
630
635
|
peekTranslate: Y,
|
|
631
|
-
bounds:
|
|
632
|
-
rubberBandLimits:
|
|
636
|
+
bounds: C,
|
|
637
|
+
rubberBandLimits: x
|
|
633
638
|
});
|
|
634
|
-
|
|
639
|
+
M.current.lastTranslate = P.translate, f.style.setProperty(
|
|
635
640
|
"--oc-modal-translate-y",
|
|
636
|
-
`${
|
|
641
|
+
`${P.translate}px`
|
|
637
642
|
), d === "frame" || !e ? f.style.setProperty(
|
|
638
643
|
"--oc-modal-settled-translate-y",
|
|
639
|
-
`${
|
|
644
|
+
`${P.translate}px`
|
|
640
645
|
) : typeof d == "number" && f.style.setProperty(
|
|
641
646
|
"--oc-modal-settled-translate-y",
|
|
642
647
|
`${d}px`
|
|
643
|
-
),
|
|
648
|
+
), qt ? f.style.removeProperty(
|
|
644
649
|
"--_-modal-elevation-shadow-opacity"
|
|
645
650
|
) : f.style.setProperty(
|
|
646
651
|
"--_-modal-elevation-shadow-opacity",
|
|
647
|
-
String(1 -
|
|
652
|
+
String(1 - P.backdropOpacity)
|
|
648
653
|
), f.dataset.ocModalDragging = e ? "true" : "false", m?.style.setProperty(
|
|
649
654
|
"--oc-modal-overshoot-fill-height",
|
|
650
|
-
`${
|
|
655
|
+
`${P.overshootFillHeight}px`
|
|
651
656
|
), m && (m.dataset.ocModalDragging = e ? "true" : "false"), e ? f.style.setProperty("transition", "none") : f.style.removeProperty("transition"), y.current && (y.current.style.setProperty(
|
|
652
657
|
"--oc-modal-backdrop-opacity",
|
|
653
|
-
String(
|
|
658
|
+
String(P.backdropOpacity)
|
|
654
659
|
), y.current.style.transition = e ? "none" : "");
|
|
655
660
|
},
|
|
656
661
|
[
|
|
657
662
|
y,
|
|
658
|
-
|
|
659
|
-
|
|
663
|
+
H,
|
|
664
|
+
G,
|
|
660
665
|
I,
|
|
661
|
-
|
|
666
|
+
qt,
|
|
662
667
|
l,
|
|
663
|
-
|
|
668
|
+
S
|
|
664
669
|
]
|
|
665
|
-
),
|
|
666
|
-
const t = l.current, e =
|
|
670
|
+
), ut = p(() => {
|
|
671
|
+
const t = l.current, e = ue.current;
|
|
667
672
|
if (!(!t || !e.length))
|
|
668
|
-
return
|
|
669
|
-
defaultSnapPosition:
|
|
673
|
+
return qe({
|
|
674
|
+
defaultSnapPosition: Et.current,
|
|
670
675
|
snapPositions: e,
|
|
671
676
|
surfaceMotion: t
|
|
672
677
|
});
|
|
673
|
-
}, [l]),
|
|
678
|
+
}, [l]), K = p(
|
|
674
679
|
({ destroy: t = !0 } = {}) => {
|
|
675
|
-
t &&
|
|
680
|
+
t && _.current?.destroy(), _.current = null, Yt.current = null;
|
|
676
681
|
},
|
|
677
682
|
[]
|
|
678
|
-
),
|
|
683
|
+
), k = p(
|
|
679
684
|
(t, { active: e }) => {
|
|
680
685
|
const a = l.current;
|
|
681
686
|
if (!a) return;
|
|
682
|
-
const c =
|
|
683
|
-
x:
|
|
687
|
+
const c = ut(), s = c ? a.getBoundingClientRect() : void 0, u = c ? Ce(c.targets, "x") : void 0, d = c ? Ce(c.targets, "y") : void 0, f = Ve(u, s?.width), g = Ve(d, s?.height), m = c ? {
|
|
688
|
+
x: Kt({
|
|
684
689
|
targetTranslate: t.x,
|
|
685
690
|
minTranslate: u?.minTranslate ?? 0,
|
|
686
691
|
maxTranslate: u?.maxTranslate ?? 0,
|
|
687
692
|
minBoundaryLimit: f,
|
|
688
693
|
maxBoundaryLimit: f
|
|
689
694
|
}),
|
|
690
|
-
y:
|
|
695
|
+
y: Kt({
|
|
691
696
|
targetTranslate: t.y,
|
|
692
697
|
minTranslate: d?.minTranslate ?? 0,
|
|
693
698
|
maxTranslate: d?.maxTranslate ?? 0,
|
|
@@ -695,7 +700,7 @@ function kr({
|
|
|
695
700
|
maxBoundaryLimit: g
|
|
696
701
|
})
|
|
697
702
|
} : t;
|
|
698
|
-
|
|
703
|
+
M.current.lastTranslateX = m.x, M.current.lastTranslate = m.y;
|
|
699
704
|
const Y = e ? void 0 : t.settledTranslate;
|
|
700
705
|
a.style.setProperty(
|
|
701
706
|
"--oc-modal-translate-x",
|
|
@@ -705,45 +710,45 @@ function kr({
|
|
|
705
710
|
Y?.y ?? `${m.y}px`
|
|
706
711
|
), a.dataset.ocModalDragging = e ? "true" : "false", a.parentElement && (a.parentElement.dataset.ocModalDragging = e ? "true" : "false"), a.style.transition = e ? "none" : "";
|
|
707
712
|
},
|
|
708
|
-
[
|
|
709
|
-
),
|
|
710
|
-
|
|
711
|
-
}, [
|
|
712
|
-
(t, e =
|
|
713
|
-
|
|
713
|
+
[ut, l]
|
|
714
|
+
), X = p(() => {
|
|
715
|
+
R.current?.destroy(), R.current = null, K();
|
|
716
|
+
}, [K]), dt = p(
|
|
717
|
+
(t, e = H) => {
|
|
718
|
+
X(), B(t, {
|
|
714
719
|
active: !0,
|
|
715
720
|
nextDismissible: e,
|
|
716
721
|
rubberBand: !0,
|
|
717
722
|
settled: "frame"
|
|
718
723
|
});
|
|
719
724
|
},
|
|
720
|
-
[
|
|
721
|
-
),
|
|
722
|
-
const t =
|
|
723
|
-
return
|
|
725
|
+
[B, X, H]
|
|
726
|
+
), de = p(() => {
|
|
727
|
+
const t = lt(), e = ct();
|
|
728
|
+
return R.current !== null || _.current !== null ? (X(), o === "popup" && q(e, { x: 0, y: 0 }) > 0.5 ? k(e, { active: !1 }) : o === "bottom" && Math.abs(t) > 0.5 && B(t, { active: !1 }), { startTranslate: t, startTranslatePoint: e }) : { startTranslate: t, startTranslatePoint: e };
|
|
724
729
|
}, [
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
it,
|
|
730
|
+
k,
|
|
731
|
+
B,
|
|
732
|
+
X,
|
|
729
733
|
lt,
|
|
734
|
+
ct,
|
|
730
735
|
o
|
|
731
|
-
]),
|
|
736
|
+
]), v = p(() => {
|
|
732
737
|
const t = l.current;
|
|
733
738
|
t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.style.removeProperty("--_-modal-elevation-shadow-opacity"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), y.current?.style.removeProperty("transition"), y.current?.style.removeProperty("--oc-modal-backdrop-opacity"));
|
|
734
|
-
}, [y, l]),
|
|
739
|
+
}, [y, l]), pe = p(() => {
|
|
735
740
|
const t = l.current, e = t?.parentElement;
|
|
736
|
-
|
|
737
|
-
}, [y,
|
|
741
|
+
M.current.lastTranslate = 0, t?.style.removeProperty("--oc-modal-translate-y"), t?.style.removeProperty("--oc-modal-settled-translate-y"), t?.style.removeProperty("--_-modal-elevation-shadow-opacity"), e?.style.removeProperty("--oc-modal-overshoot-fill-height"), y.current?.style.removeProperty("--oc-modal-backdrop-opacity"), v();
|
|
742
|
+
}, [y, v, l]), fe = p(
|
|
738
743
|
({
|
|
739
744
|
preserveSnapPosition: t = !1,
|
|
740
745
|
resetY: e = !0
|
|
741
746
|
} = {}) => {
|
|
742
747
|
const a = l.current;
|
|
743
|
-
a && (t || (
|
|
748
|
+
a && (t || (U.current = null), M.current.lastTranslateX = 0, a.style.removeProperty("--oc-modal-translate-x"), e && (M.current.lastTranslate = 0, a.style.removeProperty("--oc-modal-translate-y")), v());
|
|
744
749
|
},
|
|
745
|
-
[
|
|
746
|
-
),
|
|
750
|
+
[v, l]
|
|
751
|
+
), O = p(
|
|
747
752
|
(t, {
|
|
748
753
|
initialVelocity: e = 0,
|
|
749
754
|
intent: a = "sheet",
|
|
@@ -755,82 +760,79 @@ function kr({
|
|
|
755
760
|
} = {}) => {
|
|
756
761
|
const g = l.current;
|
|
757
762
|
if (!g) return;
|
|
758
|
-
|
|
759
|
-
const m = s ??
|
|
763
|
+
X();
|
|
764
|
+
const m = s ?? Jt(g);
|
|
760
765
|
if (Math.abs(m - t) < 0.5) {
|
|
761
|
-
|
|
766
|
+
B(t, {
|
|
762
767
|
active: !1,
|
|
763
768
|
peekTranslateOverride: d,
|
|
764
769
|
sheetHeightOverride: f
|
|
765
|
-
}),
|
|
770
|
+
}), v(), u?.();
|
|
766
771
|
return;
|
|
767
772
|
}
|
|
768
|
-
|
|
773
|
+
const Y = c === "enter" ? t : "frame";
|
|
774
|
+
B(m, {
|
|
769
775
|
active: !0,
|
|
770
776
|
peekTranslateOverride: d,
|
|
771
|
-
|
|
772
|
-
// positions: expanding settles grow it up front (the growth is still
|
|
773
|
-
// offscreen), collapsing settles keep the current size until arrival
|
|
774
|
-
// so content is not clipped mid-motion. The completion frame syncs to
|
|
775
|
-
// the final target either way.
|
|
776
|
-
settled: Math.min(t, m),
|
|
777
|
+
settled: Y,
|
|
777
778
|
sheetHeightOverride: f
|
|
778
779
|
});
|
|
779
|
-
const
|
|
780
|
+
const C = zt({
|
|
780
781
|
element: g,
|
|
781
782
|
intent: a,
|
|
782
783
|
phase: c,
|
|
783
784
|
reduced: "preserve",
|
|
784
785
|
reducedMotion: !1,
|
|
785
786
|
property: "transform"
|
|
786
|
-
}),
|
|
787
|
+
}), x = Gt({
|
|
787
788
|
value: m,
|
|
788
789
|
target: t,
|
|
789
790
|
velocity: e,
|
|
790
|
-
spring:
|
|
791
|
+
spring: C.spring,
|
|
791
792
|
epsilon: 0.5,
|
|
792
793
|
velocityEpsilon: 50,
|
|
793
794
|
stabilityWindow: 0.02,
|
|
794
|
-
onUpdate: (
|
|
795
|
-
|
|
795
|
+
onUpdate: (P) => {
|
|
796
|
+
B(P, {
|
|
796
797
|
active: !0,
|
|
797
798
|
peekTranslateOverride: d,
|
|
799
|
+
settled: Y === "frame" ? "frame" : void 0,
|
|
798
800
|
sheetHeightOverride: f
|
|
799
801
|
});
|
|
800
802
|
},
|
|
801
803
|
onComplete: () => {
|
|
802
|
-
|
|
804
|
+
R.current === x && (R.current = null), B(t, {
|
|
803
805
|
active: !1,
|
|
804
806
|
peekTranslateOverride: d,
|
|
805
807
|
sheetHeightOverride: f
|
|
806
|
-
}),
|
|
808
|
+
}), v(), u?.();
|
|
807
809
|
}
|
|
808
810
|
});
|
|
809
|
-
|
|
811
|
+
R.current = x;
|
|
810
812
|
},
|
|
811
|
-
[
|
|
812
|
-
),
|
|
813
|
+
[B, X, v, l]
|
|
814
|
+
), J = p(
|
|
813
815
|
(t, {
|
|
814
816
|
from: e,
|
|
815
817
|
initialVelocity: a = { x: 0, y: 0 }
|
|
816
818
|
} = {}) => {
|
|
817
819
|
const c = l.current;
|
|
818
820
|
if (!c) return;
|
|
819
|
-
|
|
820
|
-
const s = e ??
|
|
821
|
-
if (
|
|
822
|
-
|
|
821
|
+
X();
|
|
822
|
+
const s = e ?? Ae(c), u = { x: t.x, y: t.y };
|
|
823
|
+
if (q(s, u) < 0.5) {
|
|
824
|
+
k(t, { active: !1 }), v();
|
|
823
825
|
return;
|
|
824
826
|
}
|
|
825
|
-
|
|
826
|
-
const f =
|
|
827
|
+
k(s, { active: !0 });
|
|
828
|
+
const f = zt({
|
|
827
829
|
element: c,
|
|
828
830
|
intent: "gesture",
|
|
829
831
|
phase: "release",
|
|
830
832
|
reduced: "preserve",
|
|
831
833
|
reducedMotion: !1,
|
|
832
834
|
property: "transform"
|
|
833
|
-
}), g =
|
|
835
|
+
}), g = Gt({
|
|
834
836
|
value: s,
|
|
835
837
|
target: u,
|
|
836
838
|
velocity: a,
|
|
@@ -839,79 +841,79 @@ function kr({
|
|
|
839
841
|
velocityEpsilon: 50,
|
|
840
842
|
stabilityWindow: 0.02,
|
|
841
843
|
onUpdate: (m) => {
|
|
842
|
-
|
|
844
|
+
k(m, { active: !0 });
|
|
843
845
|
},
|
|
844
846
|
onComplete: () => {
|
|
845
|
-
|
|
847
|
+
R.current === g && (R.current = null), k(t, { active: !1 }), v();
|
|
846
848
|
}
|
|
847
849
|
});
|
|
848
|
-
|
|
850
|
+
R.current = g;
|
|
849
851
|
},
|
|
850
852
|
[
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
853
|
+
k,
|
|
854
|
+
X,
|
|
855
|
+
v,
|
|
854
856
|
l
|
|
855
857
|
]
|
|
856
|
-
),
|
|
857
|
-
const t =
|
|
858
|
+
), pt = p(() => {
|
|
859
|
+
const t = _.current;
|
|
858
860
|
if (!t) return null;
|
|
859
861
|
const e = t.sample();
|
|
860
|
-
return
|
|
861
|
-
}, [
|
|
862
|
+
return k(e.value, { active: !0 }), e;
|
|
863
|
+
}, [k]), ge = p(
|
|
862
864
|
(t) => {
|
|
863
865
|
if (!l.current) return null;
|
|
864
|
-
|
|
865
|
-
const a =
|
|
866
|
+
X(), k(t, { active: !0 });
|
|
867
|
+
const a = Gt({
|
|
866
868
|
value: t,
|
|
867
869
|
target: t,
|
|
868
|
-
spring:
|
|
870
|
+
spring: ir,
|
|
869
871
|
autoplay: !1,
|
|
870
872
|
epsilon: 0.5,
|
|
871
873
|
velocityEpsilon: 50,
|
|
872
874
|
stabilityWindow: 0.02,
|
|
873
875
|
onUpdate: (c) => {
|
|
874
|
-
|
|
876
|
+
k(c, { active: !0 });
|
|
875
877
|
},
|
|
876
878
|
onComplete: () => {
|
|
877
|
-
const c =
|
|
878
|
-
!c ||
|
|
879
|
+
const c = Yt.current;
|
|
880
|
+
!c || _.current !== a || (K({ destroy: !1 }), k(c, { active: !1 }), v());
|
|
879
881
|
}
|
|
880
882
|
});
|
|
881
|
-
return
|
|
883
|
+
return _.current = a, a;
|
|
882
884
|
},
|
|
883
885
|
[
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
886
|
+
k,
|
|
887
|
+
X,
|
|
888
|
+
K,
|
|
889
|
+
v,
|
|
888
890
|
l
|
|
889
891
|
]
|
|
890
|
-
),
|
|
892
|
+
), me = p(
|
|
891
893
|
(t) => {
|
|
892
|
-
const e =
|
|
893
|
-
e && (
|
|
894
|
+
const e = _.current ?? ge(ct());
|
|
895
|
+
e && (Yt.current = null, e.setTarget(t));
|
|
894
896
|
},
|
|
895
|
-
[
|
|
896
|
-
),
|
|
897
|
+
[ct, ge]
|
|
898
|
+
), ft = p(
|
|
897
899
|
(t, e) => {
|
|
898
|
-
const a =
|
|
899
|
-
return
|
|
900
|
+
const a = Ot(t, e);
|
|
901
|
+
return me(a), pt(), a;
|
|
900
902
|
},
|
|
901
|
-
[
|
|
902
|
-
),
|
|
903
|
+
[pt, me]
|
|
904
|
+
), Ct = p(
|
|
903
905
|
(t) => {
|
|
904
|
-
const e = l.current, a =
|
|
906
|
+
const e = l.current, a = _.current;
|
|
905
907
|
if (!e || !a) {
|
|
906
|
-
|
|
908
|
+
J(t);
|
|
907
909
|
return;
|
|
908
910
|
}
|
|
909
|
-
const s =
|
|
910
|
-
if (
|
|
911
|
-
|
|
911
|
+
const s = pt() ? kt() : a.value, u = { x: t.x, y: t.y };
|
|
912
|
+
if (q(s, u) < 0.5) {
|
|
913
|
+
K(), k(t, { active: !1 }), v();
|
|
912
914
|
return;
|
|
913
915
|
}
|
|
914
|
-
const d =
|
|
916
|
+
const d = zt({
|
|
915
917
|
element: e,
|
|
916
918
|
intent: "gesture",
|
|
917
919
|
phase: "release",
|
|
@@ -919,78 +921,78 @@ function kr({
|
|
|
919
921
|
reducedMotion: !1,
|
|
920
922
|
property: "transform"
|
|
921
923
|
});
|
|
922
|
-
|
|
924
|
+
Yt.current = t, a.setTarget(u, { spring: d.spring });
|
|
923
925
|
},
|
|
924
926
|
[
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
927
|
+
k,
|
|
928
|
+
K,
|
|
929
|
+
v,
|
|
930
|
+
kt,
|
|
931
|
+
pt,
|
|
932
|
+
J,
|
|
931
933
|
l
|
|
932
934
|
]
|
|
933
|
-
),
|
|
935
|
+
), gt = p(
|
|
934
936
|
({
|
|
935
937
|
key: t,
|
|
936
938
|
settle: e
|
|
937
939
|
}) => {
|
|
938
|
-
if (
|
|
939
|
-
const a =
|
|
940
|
+
if (M.current.dragging) return !1;
|
|
941
|
+
const a = ut();
|
|
940
942
|
if (!a) return !1;
|
|
941
943
|
const c = (t ? a.targets.find((s) => s.key === t) : void 0) ?? a.defaultTarget;
|
|
942
|
-
return
|
|
944
|
+
return U.current = c.key, e ? J(c) : (X(), k(c, { active: !1 }), v()), !0;
|
|
943
945
|
},
|
|
944
946
|
[
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
947
|
+
k,
|
|
948
|
+
X,
|
|
949
|
+
v,
|
|
950
|
+
ut,
|
|
951
|
+
J
|
|
950
952
|
]
|
|
951
|
-
),
|
|
953
|
+
), he = p(
|
|
952
954
|
(t, { from: e, initialVelocity: a = 0 }) => {
|
|
953
|
-
|
|
955
|
+
O(t, {
|
|
954
956
|
from: e,
|
|
955
957
|
initialVelocity: a,
|
|
956
958
|
onComplete: () => {
|
|
957
|
-
|
|
959
|
+
at({ reason: "drag-dismiss" }, { skipAttempt: !0 });
|
|
958
960
|
}
|
|
959
961
|
});
|
|
960
962
|
},
|
|
961
|
-
[
|
|
963
|
+
[at, O]
|
|
962
964
|
);
|
|
963
|
-
|
|
965
|
+
It(
|
|
964
966
|
() => () => {
|
|
965
|
-
|
|
967
|
+
X(), W(!1), l.current && v();
|
|
966
968
|
},
|
|
967
969
|
[
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
970
|
+
X,
|
|
971
|
+
v,
|
|
972
|
+
W,
|
|
971
973
|
l
|
|
972
974
|
]
|
|
973
|
-
),
|
|
975
|
+
), ot(() => {
|
|
974
976
|
if (!i || !r || o !== "bottom") {
|
|
975
|
-
|
|
977
|
+
Ht.current = i;
|
|
976
978
|
return;
|
|
977
979
|
}
|
|
978
|
-
if (!l.current ||
|
|
979
|
-
|
|
980
|
-
const t =
|
|
981
|
-
|
|
982
|
-
const e =
|
|
983
|
-
|
|
984
|
-
}, f = !
|
|
980
|
+
if (!l.current || te?.()) return;
|
|
981
|
+
Rt.current = !0;
|
|
982
|
+
const t = Ht.current;
|
|
983
|
+
Ht.current = !0;
|
|
984
|
+
const e = b ?? I(), a = se.current ?? e, c = ae.current, s = le.current, u = ie.current, d = () => {
|
|
985
|
+
se.current = e, ae.current = V, ie.current = S, le.current = D;
|
|
986
|
+
}, f = !vt(
|
|
985
987
|
a,
|
|
986
988
|
e
|
|
987
|
-
), g =
|
|
989
|
+
), g = Pt(e), m = V === "peeked" ? g : S;
|
|
988
990
|
if (!t) {
|
|
989
|
-
|
|
991
|
+
Mt.current = { kind: "default-snap" }, B(e, {
|
|
990
992
|
active: !0,
|
|
991
993
|
peekTranslateOverride: g,
|
|
992
994
|
sheetHeightOverride: e
|
|
993
|
-
}),
|
|
995
|
+
}), O(m, {
|
|
994
996
|
from: e,
|
|
995
997
|
intent: "sheet",
|
|
996
998
|
peekTranslateOverride: g,
|
|
@@ -999,48 +1001,86 @@ function kr({
|
|
|
999
1001
|
}), d();
|
|
1000
1002
|
return;
|
|
1001
1003
|
}
|
|
1002
|
-
if (
|
|
1003
|
-
const
|
|
1004
|
-
currentTranslate:
|
|
1005
|
-
fallbackTranslate:
|
|
1006
|
-
restState:
|
|
1004
|
+
if (V === "visible" && f) {
|
|
1005
|
+
const x = l.current, P = et(), Q = c === "visible" && a > 0 ? ar({
|
|
1006
|
+
currentTranslate: P,
|
|
1007
|
+
fallbackTranslate: S,
|
|
1008
|
+
restState: Mt.current,
|
|
1007
1009
|
previousDefaultTranslate: u,
|
|
1008
1010
|
previousSheetHeight: a,
|
|
1009
1011
|
previousSnapHeights: s,
|
|
1010
1012
|
targetSheetHeight: e,
|
|
1011
|
-
targetDefaultTranslate:
|
|
1012
|
-
targetSnapHeights:
|
|
1013
|
-
}) :
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1013
|
+
targetDefaultTranslate: S,
|
|
1014
|
+
targetSnapHeights: D
|
|
1015
|
+
}) : S;
|
|
1016
|
+
X();
|
|
1017
|
+
const N = Number.parseFloat(x.style.height), Dt = Number.isFinite(N) && N > 0 ? N : a, Je = A(
|
|
1018
|
+
Dt - P,
|
|
1019
|
+
0,
|
|
1020
|
+
Dt
|
|
1021
|
+
), Qe = A(
|
|
1022
|
+
e - Q,
|
|
1023
|
+
0,
|
|
1024
|
+
e
|
|
1025
|
+
), nt = Math.max(Dt, e), jt = Math.max(
|
|
1026
|
+
0,
|
|
1027
|
+
nt - Je
|
|
1028
|
+
), De = Math.max(
|
|
1029
|
+
0,
|
|
1030
|
+
nt - Qe
|
|
1031
|
+
), Se = Pt(nt), Xe = () => {
|
|
1032
|
+
B(Q, {
|
|
1033
|
+
active: !1,
|
|
1034
|
+
peekTranslateOverride: g,
|
|
1035
|
+
sheetHeightOverride: e
|
|
1036
|
+
}), x.style.setProperty("transition", "none"), x.style.removeProperty("height"), x.style.setProperty(
|
|
1037
|
+
"--oc-modal-sheet-height",
|
|
1038
|
+
`${e}px`
|
|
1039
|
+
), x.getBoundingClientRect(), x.style.removeProperty("transition");
|
|
1040
|
+
};
|
|
1041
|
+
if (vt(jt, De)) {
|
|
1042
|
+
Xe(), d();
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
x.style.setProperty("transition", "none"), x.style.setProperty("height", `${nt}px`), x.style.setProperty(
|
|
1046
|
+
"--oc-modal-sheet-height",
|
|
1047
|
+
`${nt}px`
|
|
1048
|
+
), B(jt, {
|
|
1049
|
+
active: !0,
|
|
1050
|
+
peekTranslateOverride: Se,
|
|
1051
|
+
sheetHeightOverride: nt
|
|
1052
|
+
}), x.getBoundingClientRect(), x.style.removeProperty("transition"), O(De, {
|
|
1053
|
+
from: jt,
|
|
1054
|
+
intent: "sheet",
|
|
1055
|
+
peekTranslateOverride: Se,
|
|
1056
|
+
sheetHeightOverride: nt,
|
|
1057
|
+
onComplete: Xe
|
|
1018
1058
|
}), d();
|
|
1019
1059
|
return;
|
|
1020
1060
|
}
|
|
1021
|
-
if (
|
|
1022
|
-
|
|
1061
|
+
if (V === "peeked") {
|
|
1062
|
+
O(g, {
|
|
1023
1063
|
peekTranslateOverride: g,
|
|
1024
1064
|
sheetHeightOverride: e
|
|
1025
1065
|
}), d();
|
|
1026
1066
|
return;
|
|
1027
1067
|
}
|
|
1028
|
-
if (
|
|
1029
|
-
|
|
1068
|
+
if (Vt.current) {
|
|
1069
|
+
Vt.current = !1, d();
|
|
1030
1070
|
return;
|
|
1031
1071
|
}
|
|
1032
|
-
const Y = c !==
|
|
1033
|
-
if (!
|
|
1072
|
+
const Y = c !== V;
|
|
1073
|
+
if (!vt(
|
|
1034
1074
|
u,
|
|
1035
|
-
|
|
1075
|
+
S
|
|
1036
1076
|
)) {
|
|
1037
|
-
const
|
|
1038
|
-
if (
|
|
1039
|
-
|
|
1077
|
+
const x = et(), Q = R.current !== null && (S > u && x < S || S < u && x > S);
|
|
1078
|
+
if (vt(x, u) || Q) {
|
|
1079
|
+
X(), B(S, {
|
|
1040
1080
|
active: !1,
|
|
1041
1081
|
peekTranslateOverride: g,
|
|
1042
1082
|
sheetHeightOverride: e
|
|
1043
|
-
}),
|
|
1083
|
+
}), v(), d();
|
|
1044
1084
|
return;
|
|
1045
1085
|
}
|
|
1046
1086
|
}
|
|
@@ -1048,71 +1088,71 @@ function kr({
|
|
|
1048
1088
|
d();
|
|
1049
1089
|
return;
|
|
1050
1090
|
}
|
|
1051
|
-
|
|
1091
|
+
O(S, {
|
|
1052
1092
|
peekTranslateOverride: g,
|
|
1053
1093
|
sheetHeightOverride: e
|
|
1054
|
-
}),
|
|
1094
|
+
}), Mt.current = { kind: "default-snap" }, d();
|
|
1055
1095
|
}, [
|
|
1056
1096
|
r,
|
|
1057
|
-
|
|
1097
|
+
Pt,
|
|
1058
1098
|
I,
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1099
|
+
et,
|
|
1100
|
+
b,
|
|
1101
|
+
D,
|
|
1062
1102
|
i,
|
|
1063
1103
|
o,
|
|
1104
|
+
V,
|
|
1105
|
+
te,
|
|
1106
|
+
B,
|
|
1107
|
+
X,
|
|
1108
|
+
v,
|
|
1109
|
+
vt,
|
|
1064
1110
|
O,
|
|
1065
|
-
Qt,
|
|
1066
|
-
A,
|
|
1067
|
-
S,
|
|
1068
|
-
x,
|
|
1069
|
-
Mt,
|
|
1070
|
-
N,
|
|
1071
1111
|
h,
|
|
1072
1112
|
l,
|
|
1073
|
-
|
|
1074
|
-
]),
|
|
1075
|
-
o !== "bottom" &&
|
|
1076
|
-
}, [
|
|
1077
|
-
if (!i || !r || !
|
|
1078
|
-
const c = !i && o === "popup" &&
|
|
1079
|
-
|
|
1113
|
+
S
|
|
1114
|
+
]), ot(() => {
|
|
1115
|
+
o !== "bottom" && Rt.current && (Rt.current = !1, X(), pe());
|
|
1116
|
+
}, [X, o, pe]), ot(() => {
|
|
1117
|
+
if (!i || !r || !E) {
|
|
1118
|
+
const c = !i && o === "popup" && st.current, s = i && o !== "popup" && st.current;
|
|
1119
|
+
st.current && !c && (j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null), X(), fe({
|
|
1080
1120
|
preserveSnapPosition: s
|
|
1081
|
-
})),
|
|
1121
|
+
})), st.current && c && (X(), v()), _t.current = i && o === "popup", st.current = !1;
|
|
1082
1122
|
return;
|
|
1083
1123
|
}
|
|
1084
|
-
const t =
|
|
1085
|
-
|
|
1124
|
+
const t = _t.current;
|
|
1125
|
+
_t.current = !0, st.current = !0;
|
|
1086
1126
|
let e = null;
|
|
1087
|
-
const a = (c) =>
|
|
1127
|
+
const a = (c) => gt({
|
|
1088
1128
|
key: c,
|
|
1089
1129
|
settle: t
|
|
1090
1130
|
});
|
|
1091
1131
|
return a(
|
|
1092
|
-
|
|
1132
|
+
U.current ?? Et.current
|
|
1093
1133
|
) || (e = window.requestAnimationFrame(() => {
|
|
1094
1134
|
e = null, a(
|
|
1095
|
-
|
|
1135
|
+
U.current ?? Et.current
|
|
1096
1136
|
);
|
|
1097
1137
|
})), () => {
|
|
1098
1138
|
e !== null && window.cancelAnimationFrame(e);
|
|
1099
1139
|
};
|
|
1100
1140
|
}, [
|
|
1101
|
-
|
|
1141
|
+
X,
|
|
1102
1142
|
r,
|
|
1103
|
-
|
|
1143
|
+
v,
|
|
1104
1144
|
i,
|
|
1105
1145
|
o,
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
]),
|
|
1111
|
-
if (!i || !r || !
|
|
1146
|
+
ce,
|
|
1147
|
+
E,
|
|
1148
|
+
fe,
|
|
1149
|
+
gt
|
|
1150
|
+
]), ot(() => {
|
|
1151
|
+
if (!i || !r || !E) return;
|
|
1112
1152
|
const t = () => {
|
|
1113
|
-
|
|
1114
|
-
j.current = null, !
|
|
1115
|
-
key:
|
|
1153
|
+
M.current.dragging || j.current === null && (j.current = window.requestAnimationFrame(() => {
|
|
1154
|
+
j.current = null, !M.current.dragging && gt({
|
|
1155
|
+
key: U.current,
|
|
1116
1156
|
settle: !1
|
|
1117
1157
|
});
|
|
1118
1158
|
}));
|
|
@@ -1143,15 +1183,15 @@ function kr({
|
|
|
1143
1183
|
}, [
|
|
1144
1184
|
r,
|
|
1145
1185
|
i,
|
|
1146
|
-
|
|
1186
|
+
E,
|
|
1147
1187
|
l,
|
|
1148
|
-
|
|
1149
|
-
]),
|
|
1150
|
-
if (
|
|
1188
|
+
gt
|
|
1189
|
+
]), ot(() => {
|
|
1190
|
+
if (re <= 0 || !i || !r || !E)
|
|
1151
1191
|
return;
|
|
1152
1192
|
let t = window.requestAnimationFrame(() => {
|
|
1153
|
-
t = null,
|
|
1154
|
-
key:
|
|
1193
|
+
t = null, gt({
|
|
1194
|
+
key: U.current,
|
|
1155
1195
|
settle: !1
|
|
1156
1196
|
});
|
|
1157
1197
|
});
|
|
@@ -1161,66 +1201,68 @@ function kr({
|
|
|
1161
1201
|
}, [
|
|
1162
1202
|
r,
|
|
1163
1203
|
i,
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1204
|
+
E,
|
|
1205
|
+
re,
|
|
1206
|
+
gt
|
|
1167
1207
|
]);
|
|
1168
|
-
const
|
|
1208
|
+
const ye = p(
|
|
1169
1209
|
(t, e, a) => {
|
|
1170
|
-
if (typeof Element > "u" || !(t instanceof Element) ||
|
|
1171
|
-
const c = Date.now(), s = e > 0, u =
|
|
1172
|
-
return !a && u && s && u.scrollTop > 0 || !a &&
|
|
1210
|
+
if (typeof Element > "u" || !(t instanceof Element) || Wt(t)) return !1;
|
|
1211
|
+
const c = Date.now(), s = e > 0, u = er(t, z.current);
|
|
1212
|
+
return !a && u && s && u.scrollTop > 0 || !a && Xt.current && c - Xt.current < ee && Math.abs(et()) <= 1 ? (Xt.current = c, !1) : !0;
|
|
1173
1213
|
},
|
|
1174
|
-
[
|
|
1175
|
-
),
|
|
1214
|
+
[et, ee]
|
|
1215
|
+
), wt = p(
|
|
1176
1216
|
({
|
|
1177
1217
|
chrome: t,
|
|
1178
1218
|
pointerId: e = null,
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1219
|
+
selectionArbitration: a = !1,
|
|
1220
|
+
source: c,
|
|
1221
|
+
startX: s = 0,
|
|
1222
|
+
startY: u,
|
|
1223
|
+
touchId: d = null
|
|
1183
1224
|
}) => {
|
|
1184
|
-
const { startTranslate:
|
|
1185
|
-
|
|
1225
|
+
const { startTranslate: f, startTranslatePoint: g } = de(), m = Z();
|
|
1226
|
+
M.current = {
|
|
1186
1227
|
dragging: !0,
|
|
1187
1228
|
allowed: !1,
|
|
1188
1229
|
chrome: t,
|
|
1230
|
+
selectionArbitration: a,
|
|
1189
1231
|
closeAllowed: null,
|
|
1190
1232
|
started: !1,
|
|
1191
|
-
source:
|
|
1192
|
-
startX:
|
|
1193
|
-
startY:
|
|
1194
|
-
lastX:
|
|
1195
|
-
lastY:
|
|
1196
|
-
startTranslateX:
|
|
1197
|
-
startTranslate:
|
|
1198
|
-
lastTranslateX:
|
|
1199
|
-
lastTranslate:
|
|
1200
|
-
startTime:
|
|
1233
|
+
source: c,
|
|
1234
|
+
startX: s,
|
|
1235
|
+
startY: u,
|
|
1236
|
+
lastX: s,
|
|
1237
|
+
lastY: u,
|
|
1238
|
+
startTranslateX: g.x,
|
|
1239
|
+
startTranslate: f,
|
|
1240
|
+
lastTranslateX: g.x,
|
|
1241
|
+
lastTranslate: f,
|
|
1242
|
+
startTime: m,
|
|
1201
1243
|
samples: [
|
|
1202
1244
|
{
|
|
1203
|
-
time:
|
|
1204
|
-
pageX:
|
|
1205
|
-
pageY:
|
|
1206
|
-
translateX:
|
|
1207
|
-
translateY:
|
|
1245
|
+
time: m,
|
|
1246
|
+
pageX: s,
|
|
1247
|
+
pageY: u,
|
|
1248
|
+
translateX: g.x,
|
|
1249
|
+
translateY: f
|
|
1208
1250
|
}
|
|
1209
1251
|
],
|
|
1210
1252
|
pointerId: e,
|
|
1211
|
-
touchId:
|
|
1253
|
+
touchId: d
|
|
1212
1254
|
};
|
|
1213
1255
|
},
|
|
1214
|
-
[
|
|
1215
|
-
),
|
|
1256
|
+
[de]
|
|
1257
|
+
), mt = p(
|
|
1216
1258
|
(t) => {
|
|
1217
|
-
t.source === "touch" ?
|
|
1259
|
+
t.source === "touch" ? it(!1) : t.source === "pointer" && W(!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;
|
|
1218
1260
|
},
|
|
1219
|
-
[
|
|
1220
|
-
),
|
|
1261
|
+
[W, it]
|
|
1262
|
+
), Te = p(
|
|
1221
1263
|
(t, e) => {
|
|
1222
|
-
const a =
|
|
1223
|
-
t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = a, t.lastTranslateX = c.x, t.lastTranslate = a, t.startTime =
|
|
1264
|
+
const a = lt(), c = ct();
|
|
1265
|
+
t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = a, t.lastTranslateX = c.x, t.lastTranslate = a, t.startTime = Z(), t.samples = [
|
|
1224
1266
|
{
|
|
1225
1267
|
time: t.startTime,
|
|
1226
1268
|
pageX: e.x,
|
|
@@ -1230,8 +1272,8 @@ function kr({
|
|
|
1230
1272
|
}
|
|
1231
1273
|
];
|
|
1232
1274
|
},
|
|
1233
|
-
[
|
|
1234
|
-
),
|
|
1275
|
+
[lt, ct]
|
|
1276
|
+
), xe = p(
|
|
1235
1277
|
({
|
|
1236
1278
|
currentTranslate: t,
|
|
1237
1279
|
dismissible: e,
|
|
@@ -1239,76 +1281,89 @@ function kr({
|
|
|
1239
1281
|
deltaY: c,
|
|
1240
1282
|
startTranslate: s
|
|
1241
1283
|
}) => {
|
|
1242
|
-
const u = I(), d =
|
|
1284
|
+
const u = I(), d = G(), f = d > 0, g = u, m = Math.max(
|
|
1243
1285
|
F.dismissal.minDistancePx,
|
|
1244
|
-
(u - d) *
|
|
1245
|
-
), Y =
|
|
1246
|
-
(
|
|
1247
|
-
),
|
|
1286
|
+
(u - d) * Tt
|
|
1287
|
+
), Y = D.map(
|
|
1288
|
+
(Q) => A(u - Q, 0, u)
|
|
1289
|
+
), C = Me(
|
|
1248
1290
|
Y.length ? Y : [0]
|
|
1249
|
-
),
|
|
1291
|
+
), x = yr({
|
|
1250
1292
|
currentTranslate: t,
|
|
1251
1293
|
releaseVelocity: a
|
|
1252
1294
|
});
|
|
1253
|
-
f &&
|
|
1254
|
-
const
|
|
1255
|
-
return e && !f && c > 0 && t >= d + m ? g :
|
|
1256
|
-
|
|
1295
|
+
f && C.push(d);
|
|
1296
|
+
const P = Me(C);
|
|
1297
|
+
return e && !f && c > 0 && t >= d + m ? g : xr(a) ? P.length > 1 ? pr(
|
|
1298
|
+
P,
|
|
1257
1299
|
s,
|
|
1258
1300
|
t,
|
|
1259
1301
|
c > 0 ? "down" : "up",
|
|
1260
|
-
|
|
1261
|
-
) : 0 : e && t > u *
|
|
1302
|
+
x
|
|
1303
|
+
) : 0 : e && t > u * Tt && !f ? g : ur(P, t);
|
|
1262
1304
|
},
|
|
1263
|
-
[
|
|
1264
|
-
),
|
|
1305
|
+
[Tt, G, I, D]
|
|
1306
|
+
), Pe = p(
|
|
1265
1307
|
(t) => {
|
|
1266
|
-
const e =
|
|
1267
|
-
|
|
1268
|
-
defaultTranslate:
|
|
1308
|
+
const e = b ?? I();
|
|
1309
|
+
Mt.current = sr({
|
|
1310
|
+
defaultTranslate: S,
|
|
1269
1311
|
sheetHeight: e,
|
|
1270
|
-
snapHeights:
|
|
1312
|
+
snapHeights: D,
|
|
1271
1313
|
translate: t
|
|
1272
1314
|
});
|
|
1273
1315
|
},
|
|
1274
|
-
[I,
|
|
1275
|
-
),
|
|
1316
|
+
[I, b, D, S]
|
|
1317
|
+
), je = p(
|
|
1276
1318
|
(t) => {
|
|
1277
|
-
if (!r || o !== "bottom" && !
|
|
1319
|
+
if (!r || o !== "bottom" && !E || n === !1 || t.pointerType === "touch") return;
|
|
1278
1320
|
let e = !1;
|
|
1279
|
-
if (n === "handle" &&
|
|
1321
|
+
if (n === "handle" && ke(t.target))
|
|
1280
1322
|
e = !0;
|
|
1281
1323
|
else if (n === "handle")
|
|
1282
1324
|
return;
|
|
1283
|
-
if (!e &&
|
|
1325
|
+
if (!e && Wt(t.target)) return;
|
|
1326
|
+
if (n === "content" && (e = Le(t.target), !mr(t, e))) {
|
|
1327
|
+
o === "bottom" && !rr({
|
|
1328
|
+
target: t.target,
|
|
1329
|
+
boundary: z.current
|
|
1330
|
+
}) && wt({
|
|
1331
|
+
chrome: !1,
|
|
1332
|
+
pointerId: t.pointerId,
|
|
1333
|
+
selectionArbitration: !0,
|
|
1334
|
+
source: "pointer",
|
|
1335
|
+
startX: t.pageX,
|
|
1336
|
+
startY: t.pageY
|
|
1337
|
+
});
|
|
1284
1338
|
return;
|
|
1285
|
-
|
|
1286
|
-
|
|
1339
|
+
}
|
|
1340
|
+
const a = gr(t.target);
|
|
1341
|
+
wt({
|
|
1287
1342
|
chrome: e,
|
|
1288
1343
|
pointerId: t.pointerId,
|
|
1289
1344
|
source: "pointer",
|
|
1290
1345
|
startX: t.pageX,
|
|
1291
1346
|
startY: t.pageY
|
|
1292
|
-
}),
|
|
1347
|
+
}), fr(t.target) || t.preventDefault(), W(!0), !a && typeof t.currentTarget.setPointerCapture == "function" && t.currentTarget.setPointerCapture(t.pointerId);
|
|
1293
1348
|
},
|
|
1294
1349
|
[
|
|
1295
|
-
|
|
1350
|
+
wt,
|
|
1296
1351
|
n,
|
|
1297
1352
|
r,
|
|
1298
1353
|
o,
|
|
1299
|
-
|
|
1300
|
-
|
|
1354
|
+
E,
|
|
1355
|
+
W
|
|
1301
1356
|
]
|
|
1302
|
-
),
|
|
1357
|
+
), ht = p(
|
|
1303
1358
|
(t, e) => {
|
|
1304
|
-
if (!
|
|
1359
|
+
if (!H) return !1;
|
|
1305
1360
|
if (e <= 0) return !0;
|
|
1306
1361
|
if (t.closeAllowed !== null) return t.closeAllowed;
|
|
1307
|
-
const a =
|
|
1362
|
+
const a = Zt({ reason: "drag-dismiss" });
|
|
1308
1363
|
return t.closeAllowed = a, a;
|
|
1309
1364
|
},
|
|
1310
|
-
[
|
|
1311
|
-
),
|
|
1365
|
+
[Zt, H]
|
|
1366
|
+
), Ft = p(
|
|
1312
1367
|
({
|
|
1313
1368
|
closeAllowed: t,
|
|
1314
1369
|
currentTranslate: e,
|
|
@@ -1316,66 +1371,66 @@ function kr({
|
|
|
1316
1371
|
releaseVelocity: c,
|
|
1317
1372
|
startTranslate: s
|
|
1318
1373
|
}) => {
|
|
1319
|
-
const d =
|
|
1374
|
+
const d = xe({
|
|
1320
1375
|
currentTranslate: e,
|
|
1321
|
-
dismissible:
|
|
1376
|
+
dismissible: H && t !== !1,
|
|
1322
1377
|
releaseVelocity: c,
|
|
1323
1378
|
deltaY: a,
|
|
1324
1379
|
startTranslate: s
|
|
1325
|
-
}), f = I(), g =
|
|
1380
|
+
}), f = I(), g = G();
|
|
1326
1381
|
if (d >= f - 1) {
|
|
1327
|
-
|
|
1382
|
+
at({ reason: "drag-dismiss" }, { commit: !1 }) ? he(d, {
|
|
1328
1383
|
from: e,
|
|
1329
1384
|
initialVelocity: c
|
|
1330
|
-
}) :
|
|
1385
|
+
}) : O(s, {
|
|
1331
1386
|
from: e,
|
|
1332
1387
|
initialVelocity: c
|
|
1333
1388
|
});
|
|
1334
1389
|
return;
|
|
1335
1390
|
}
|
|
1336
|
-
g > 0 && d >= g - 1 ?
|
|
1337
|
-
presentationState:
|
|
1391
|
+
g > 0 && d >= g - 1 ? Nt("peeked") : (Yr({
|
|
1392
|
+
presentationState: V,
|
|
1338
1393
|
releaseTranslate: d,
|
|
1339
|
-
visibleTranslate:
|
|
1340
|
-
}) && (
|
|
1394
|
+
visibleTranslate: S
|
|
1395
|
+
}) && (Vt.current = !0), Nt("visible"), Pe(d)), O(d, {
|
|
1341
1396
|
from: e,
|
|
1342
1397
|
initialVelocity: c
|
|
1343
1398
|
});
|
|
1344
1399
|
},
|
|
1345
1400
|
[
|
|
1346
|
-
fe,
|
|
1347
|
-
ye,
|
|
1348
|
-
V,
|
|
1349
|
-
$,
|
|
1350
1401
|
he,
|
|
1402
|
+
Pe,
|
|
1403
|
+
H,
|
|
1404
|
+
G,
|
|
1405
|
+
xe,
|
|
1351
1406
|
I,
|
|
1407
|
+
V,
|
|
1408
|
+
at,
|
|
1409
|
+
Nt,
|
|
1352
1410
|
O,
|
|
1353
|
-
|
|
1354
|
-
It,
|
|
1355
|
-
N,
|
|
1356
|
-
D
|
|
1411
|
+
S
|
|
1357
1412
|
]
|
|
1358
|
-
),
|
|
1413
|
+
), At = p(
|
|
1359
1414
|
({
|
|
1360
1415
|
currentTranslate: t,
|
|
1361
1416
|
releaseDelta: e,
|
|
1362
1417
|
releaseTranslate: a,
|
|
1363
1418
|
releaseVelocity: c
|
|
1364
1419
|
}) => {
|
|
1365
|
-
const s =
|
|
1420
|
+
const s = ut();
|
|
1366
1421
|
if (!s) return;
|
|
1367
|
-
const u =
|
|
1422
|
+
const u = vr({
|
|
1368
1423
|
currentTranslate: a,
|
|
1369
1424
|
releaseVelocity: c,
|
|
1370
1425
|
targets: s.targets
|
|
1371
1426
|
}), d = s.targets.find(
|
|
1372
|
-
(Y) => Y.key ===
|
|
1427
|
+
(Y) => Y.key === U.current
|
|
1373
1428
|
) ?? s.defaultTarget, g = l.current?.getBoundingClientRect(), m = {
|
|
1374
1429
|
x: d.x + e.x,
|
|
1375
1430
|
y: d.y + e.y
|
|
1376
1431
|
};
|
|
1377
|
-
if (
|
|
1378
|
-
closeThreshold:
|
|
1432
|
+
if (H && g && Xr({
|
|
1433
|
+
closeThreshold: Tt,
|
|
1379
1434
|
currentTarget: d,
|
|
1380
1435
|
currentTranslate: m,
|
|
1381
1436
|
releaseTarget: u,
|
|
@@ -1384,49 +1439,59 @@ function kr({
|
|
|
1384
1439
|
width: g.width
|
|
1385
1440
|
},
|
|
1386
1441
|
targets: s.targets
|
|
1387
|
-
}) &&
|
|
1388
|
-
|
|
1442
|
+
}) && at({ reason: "drag-dismiss" })) {
|
|
1443
|
+
K(), v();
|
|
1389
1444
|
return;
|
|
1390
1445
|
}
|
|
1391
|
-
if (
|
|
1392
|
-
|
|
1446
|
+
if (U.current = u.key, _.current) {
|
|
1447
|
+
Ct(u);
|
|
1393
1448
|
return;
|
|
1394
1449
|
}
|
|
1395
|
-
|
|
1450
|
+
J(u, {
|
|
1396
1451
|
from: t,
|
|
1397
1452
|
initialVelocity: c
|
|
1398
1453
|
});
|
|
1399
1454
|
},
|
|
1400
1455
|
[
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1456
|
+
K,
|
|
1457
|
+
Tt,
|
|
1458
|
+
H,
|
|
1459
|
+
v,
|
|
1460
|
+
ut,
|
|
1461
|
+
at,
|
|
1462
|
+
Ct,
|
|
1463
|
+
J,
|
|
1409
1464
|
l
|
|
1410
1465
|
]
|
|
1411
|
-
),
|
|
1466
|
+
), ze = p(
|
|
1412
1467
|
(t) => {
|
|
1413
|
-
const e =
|
|
1414
|
-
if (!e.dragging || e.source !== "pointer" || !r || o !== "bottom" && !
|
|
1468
|
+
const e = M.current;
|
|
1469
|
+
if (!e.dragging || e.source !== "pointer" || !r || o !== "bottom" && !E)
|
|
1415
1470
|
return;
|
|
1416
1471
|
const a = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? F.dragStartThresholdPx.touch : F.dragStartThresholdPx.mouse;
|
|
1417
|
-
if (!(!e.started &&
|
|
1472
|
+
if (!(!e.started && Ee({ deltaX: a, deltaY: c, placement: o }) < s)) {
|
|
1473
|
+
if (e.selectionArbitration && !e.allowed) {
|
|
1474
|
+
const u = Math.abs(a), d = Math.abs(c), f = F.selectionArbitrationThresholdPx;
|
|
1475
|
+
if (u >= f && u >= d) {
|
|
1476
|
+
e.dragging = !1;
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
if (d < f || d <= u)
|
|
1480
|
+
return;
|
|
1481
|
+
window.getSelection?.()?.removeAllRanges(), W(!0);
|
|
1482
|
+
}
|
|
1418
1483
|
if (!e.allowed) {
|
|
1419
|
-
if (o === "bottom" && !
|
|
1484
|
+
if (o === "bottom" && !ye(t.target, c, e.chrome))
|
|
1420
1485
|
return;
|
|
1421
1486
|
e.allowed = !0, e.started = !0;
|
|
1422
1487
|
const u = t.currentTarget;
|
|
1423
1488
|
e.pointerId !== null && typeof u.hasPointerCapture == "function" && typeof u.setPointerCapture == "function" && !u.hasPointerCapture(e.pointerId) && u.setPointerCapture(e.pointerId);
|
|
1424
1489
|
}
|
|
1425
1490
|
if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, o === "popup")
|
|
1426
|
-
|
|
1491
|
+
ft(e, t), Be(e, t);
|
|
1427
1492
|
else {
|
|
1428
|
-
const u = e.startTranslate + c, d =
|
|
1429
|
-
|
|
1493
|
+
const u = e.startTranslate + c, d = ht(e, c);
|
|
1494
|
+
dt(u, d), St(e, {
|
|
1430
1495
|
pageX: t.pageX,
|
|
1431
1496
|
pageY: t.pageY,
|
|
1432
1497
|
translateX: e.lastTranslateX,
|
|
@@ -1437,141 +1502,142 @@ function kr({
|
|
|
1437
1502
|
},
|
|
1438
1503
|
[
|
|
1439
1504
|
r,
|
|
1440
|
-
|
|
1441
|
-
|
|
1505
|
+
ft,
|
|
1506
|
+
ht,
|
|
1442
1507
|
o,
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1508
|
+
E,
|
|
1509
|
+
W,
|
|
1510
|
+
dt,
|
|
1511
|
+
ye
|
|
1446
1512
|
]
|
|
1447
|
-
),
|
|
1513
|
+
), rt = p(
|
|
1448
1514
|
({
|
|
1449
1515
|
currentTarget: t,
|
|
1450
1516
|
pageX: e,
|
|
1451
1517
|
pageY: a,
|
|
1452
1518
|
releaseCapture: c = !0
|
|
1453
1519
|
}) => {
|
|
1454
|
-
const s =
|
|
1455
|
-
if (!s.dragging || s.source !== "pointer" || !r || o !== "bottom" && !
|
|
1520
|
+
const s = M.current;
|
|
1521
|
+
if (!s.dragging || s.source !== "pointer" || !r || o !== "bottom" && !E)
|
|
1456
1522
|
return;
|
|
1457
|
-
const u = s.started, d = Number.isFinite(e) ? e : s.lastX, f = Number.isFinite(a) ? a : s.lastY, g = d - s.startX, m = f - s.startY, Y = Math.max(
|
|
1458
|
-
let
|
|
1523
|
+
const u = s.started, d = Number.isFinite(e) ? e : s.lastX, f = Number.isFinite(a) ? a : s.lastY, g = d - s.startX, m = f - s.startY, Y = Math.max(Z() - s.startTime, 1);
|
|
1524
|
+
let C = {
|
|
1459
1525
|
x: s.lastTranslateX,
|
|
1460
1526
|
y: s.lastTranslate
|
|
1461
|
-
},
|
|
1462
|
-
const
|
|
1527
|
+
}, x = C;
|
|
1528
|
+
const P = s.startTranslate;
|
|
1463
1529
|
if (u)
|
|
1464
1530
|
if (o === "popup")
|
|
1465
|
-
|
|
1531
|
+
ft(s, {
|
|
1466
1532
|
pageX: d,
|
|
1467
1533
|
pageY: f
|
|
1468
|
-
}),
|
|
1534
|
+
}), C = {
|
|
1469
1535
|
x: s.lastTranslateX,
|
|
1470
1536
|
y: s.lastTranslate
|
|
1471
|
-
},
|
|
1537
|
+
}, x = Ot(s, {
|
|
1472
1538
|
pageX: d,
|
|
1473
1539
|
pageY: f
|
|
1474
1540
|
});
|
|
1475
1541
|
else {
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1542
|
+
const N = s.startTranslate + m, Dt = ht(s, m);
|
|
1543
|
+
dt(N, Dt), C = {
|
|
1478
1544
|
x: s.lastTranslateX,
|
|
1479
1545
|
y: s.lastTranslate
|
|
1480
1546
|
};
|
|
1481
1547
|
}
|
|
1482
|
-
const
|
|
1548
|
+
const Q = s.closeAllowed;
|
|
1483
1549
|
if (c && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
|
|
1484
|
-
const
|
|
1550
|
+
const N = o === "popup" ? x : {
|
|
1485
1551
|
x: s.lastTranslateX,
|
|
1486
1552
|
y: s.lastTranslate
|
|
1487
1553
|
};
|
|
1488
|
-
|
|
1554
|
+
St(s, {
|
|
1489
1555
|
pageX: d,
|
|
1490
1556
|
pageY: f,
|
|
1491
|
-
translateX:
|
|
1492
|
-
translateY:
|
|
1557
|
+
translateX: N.x,
|
|
1558
|
+
translateY: N.y
|
|
1493
1559
|
});
|
|
1494
1560
|
}
|
|
1495
|
-
if (
|
|
1496
|
-
if (
|
|
1497
|
-
const
|
|
1561
|
+
if (mt(s), !!u)
|
|
1562
|
+
if (xt.current = Z() + 500, o === "popup") {
|
|
1563
|
+
const N = Oe({
|
|
1498
1564
|
session: s,
|
|
1499
1565
|
fallbackDelta: { x: g, y: m },
|
|
1500
1566
|
fallbackElapsed: Y
|
|
1501
1567
|
});
|
|
1502
|
-
|
|
1503
|
-
currentTranslate:
|
|
1568
|
+
At({
|
|
1569
|
+
currentTranslate: C,
|
|
1504
1570
|
releaseDelta: { x: g, y: m },
|
|
1505
|
-
releaseTranslate:
|
|
1506
|
-
releaseVelocity:
|
|
1571
|
+
releaseTranslate: x,
|
|
1572
|
+
releaseVelocity: N
|
|
1507
1573
|
});
|
|
1508
1574
|
} else {
|
|
1509
|
-
const
|
|
1575
|
+
const N = Ie({
|
|
1510
1576
|
session: s,
|
|
1511
1577
|
fallbackDeltaY: m,
|
|
1512
1578
|
fallbackElapsed: Y
|
|
1513
1579
|
});
|
|
1514
|
-
|
|
1515
|
-
closeAllowed:
|
|
1516
|
-
currentTranslate:
|
|
1580
|
+
Ft({
|
|
1581
|
+
closeAllowed: Q,
|
|
1582
|
+
currentTranslate: C.y,
|
|
1517
1583
|
deltaY: m,
|
|
1518
|
-
releaseVelocity:
|
|
1519
|
-
startTranslate:
|
|
1584
|
+
releaseVelocity: N,
|
|
1585
|
+
startTranslate: P
|
|
1520
1586
|
});
|
|
1521
1587
|
}
|
|
1522
1588
|
},
|
|
1523
1589
|
[
|
|
1524
|
-
|
|
1525
|
-
|
|
1590
|
+
Ft,
|
|
1591
|
+
At,
|
|
1526
1592
|
r,
|
|
1527
|
-
|
|
1528
|
-
|
|
1593
|
+
ft,
|
|
1594
|
+
ht,
|
|
1529
1595
|
o,
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1596
|
+
E,
|
|
1597
|
+
mt,
|
|
1598
|
+
dt
|
|
1533
1599
|
]
|
|
1534
|
-
),
|
|
1600
|
+
), ve = p(
|
|
1535
1601
|
(t) => {
|
|
1536
|
-
|
|
1602
|
+
rt({
|
|
1537
1603
|
currentTarget: t.currentTarget,
|
|
1538
1604
|
pageX: t.pageX,
|
|
1539
1605
|
pageY: t.pageY
|
|
1540
1606
|
});
|
|
1541
1607
|
},
|
|
1542
|
-
[
|
|
1543
|
-
),
|
|
1608
|
+
[rt]
|
|
1609
|
+
), Ue = p(
|
|
1544
1610
|
(t) => {
|
|
1545
|
-
const e =
|
|
1546
|
-
e.pointerId !== null && t.pointerId !== e.pointerId ||
|
|
1611
|
+
const e = M.current;
|
|
1612
|
+
e.pointerId !== null && t.pointerId !== e.pointerId || rt({
|
|
1547
1613
|
pageX: t.pageX,
|
|
1548
1614
|
pageY: t.pageY,
|
|
1549
1615
|
releaseCapture: !1
|
|
1550
1616
|
});
|
|
1551
1617
|
},
|
|
1552
|
-
[
|
|
1618
|
+
[rt]
|
|
1553
1619
|
);
|
|
1554
|
-
|
|
1620
|
+
It(() => {
|
|
1555
1621
|
if (!r) return;
|
|
1556
1622
|
const t = (s) => {
|
|
1557
|
-
const u =
|
|
1558
|
-
!u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId ||
|
|
1623
|
+
const u = M.current;
|
|
1624
|
+
!u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || rt({
|
|
1559
1625
|
pageX: s.pageX,
|
|
1560
1626
|
pageY: s.pageY,
|
|
1561
1627
|
releaseCapture: !1
|
|
1562
1628
|
});
|
|
1563
1629
|
}, e = () => {
|
|
1564
|
-
const s =
|
|
1565
|
-
!s.dragging || s.source !== "pointer" ||
|
|
1630
|
+
const s = M.current;
|
|
1631
|
+
!s.dragging || s.source !== "pointer" || rt({
|
|
1566
1632
|
pageX: s.lastX,
|
|
1567
1633
|
pageY: s.lastY,
|
|
1568
1634
|
releaseCapture: !1
|
|
1569
1635
|
});
|
|
1570
1636
|
}, a = (s) => {
|
|
1571
|
-
const u =
|
|
1637
|
+
const u = M.current;
|
|
1572
1638
|
!u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
|
|
1573
1639
|
}, c = (s) => {
|
|
1574
|
-
const u =
|
|
1640
|
+
const u = M.current;
|
|
1575
1641
|
!u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
|
|
1576
1642
|
};
|
|
1577
1643
|
return document.addEventListener("pointerout", a, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
|
|
@@ -1593,40 +1659,40 @@ function kr({
|
|
|
1593
1659
|
!0
|
|
1594
1660
|
), window.removeEventListener("blur", e);
|
|
1595
1661
|
};
|
|
1596
|
-
}, [
|
|
1662
|
+
}, [rt, r]), It(() => {
|
|
1597
1663
|
if (!r) return;
|
|
1598
1664
|
const t = (e) => {
|
|
1599
|
-
const a =
|
|
1665
|
+
const a = xt.current;
|
|
1600
1666
|
if (a <= 0) return;
|
|
1601
|
-
if (
|
|
1602
|
-
|
|
1667
|
+
if (Z() > a) {
|
|
1668
|
+
xt.current = 0;
|
|
1603
1669
|
return;
|
|
1604
1670
|
}
|
|
1605
1671
|
const c = l.current;
|
|
1606
|
-
c && e.target instanceof Node && c.contains(e.target) && (
|
|
1672
|
+
c && e.target instanceof Node && c.contains(e.target) && (xt.current = 0, e.preventDefault(), e.stopPropagation());
|
|
1607
1673
|
};
|
|
1608
1674
|
return document.addEventListener("click", t, !0), () => {
|
|
1609
1675
|
document.removeEventListener("click", t, !0);
|
|
1610
1676
|
};
|
|
1611
1677
|
}, [r, l]);
|
|
1612
|
-
const
|
|
1613
|
-
const e =
|
|
1614
|
-
return e.touchId !== null ?
|
|
1615
|
-
}, []),
|
|
1678
|
+
const Bt = p((t) => {
|
|
1679
|
+
const e = M.current;
|
|
1680
|
+
return e.touchId !== null ? Fe(t.changedTouches, e.touchId) ?? Fe(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
|
|
1681
|
+
}, []), We = p(
|
|
1616
1682
|
(t) => {
|
|
1617
|
-
if (!r || o !== "bottom" && !
|
|
1683
|
+
if (!r || o !== "bottom" && !E || n === !1 || t.touches.length !== 1) return;
|
|
1618
1684
|
let e = !1;
|
|
1619
|
-
if (n === "handle" &&
|
|
1685
|
+
if (n === "handle" && ke(t.target))
|
|
1620
1686
|
e = !0;
|
|
1621
1687
|
else if (n === "handle")
|
|
1622
1688
|
return;
|
|
1623
|
-
if (!e &&
|
|
1624
|
-
n === "content" && (e =
|
|
1689
|
+
if (!e && Wt(t.target)) return;
|
|
1690
|
+
n === "content" && (e = Le(t.target));
|
|
1625
1691
|
const a = t.touches[0];
|
|
1626
|
-
o === "bottom" &&
|
|
1692
|
+
o === "bottom" && bt({
|
|
1627
1693
|
target: t.target,
|
|
1628
1694
|
chrome: e
|
|
1629
|
-
}),
|
|
1695
|
+
}), wt({
|
|
1630
1696
|
chrome: e,
|
|
1631
1697
|
source: "touch",
|
|
1632
1698
|
startX: a.pageX,
|
|
@@ -1635,51 +1701,51 @@ function kr({
|
|
|
1635
1701
|
});
|
|
1636
1702
|
},
|
|
1637
1703
|
[
|
|
1638
|
-
|
|
1704
|
+
wt,
|
|
1639
1705
|
n,
|
|
1640
1706
|
r,
|
|
1641
1707
|
o,
|
|
1642
|
-
|
|
1643
|
-
|
|
1708
|
+
E,
|
|
1709
|
+
bt
|
|
1644
1710
|
]
|
|
1645
|
-
),
|
|
1711
|
+
), we = p(
|
|
1646
1712
|
(t) => {
|
|
1647
|
-
const e =
|
|
1648
|
-
if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !
|
|
1713
|
+
const e = M.current;
|
|
1714
|
+
if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !E)
|
|
1649
1715
|
return;
|
|
1650
|
-
const a =
|
|
1716
|
+
const a = Bt(t);
|
|
1651
1717
|
if (!a) return;
|
|
1652
|
-
const c = a.pageX - e.startX, s = a.pageY - e.startY, u =
|
|
1718
|
+
const c = a.pageX - e.startX, s = a.pageY - e.startY, u = Ee({
|
|
1653
1719
|
deltaX: c,
|
|
1654
1720
|
deltaY: s,
|
|
1655
1721
|
placement: o
|
|
1656
|
-
}), d = F.dragStartThresholdPx.touch, f = o === "bottom" ?
|
|
1722
|
+
}), d = F.dragStartThresholdPx.touch, f = o === "bottom" ? nr({
|
|
1657
1723
|
target: t.target,
|
|
1658
1724
|
deltaY: s,
|
|
1659
1725
|
chrome: e.chrome,
|
|
1660
|
-
bodyNode:
|
|
1661
|
-
canExpand:
|
|
1662
|
-
}) :
|
|
1726
|
+
bodyNode: z.current,
|
|
1727
|
+
canExpand: lt() > 1
|
|
1728
|
+
}) : or({
|
|
1663
1729
|
target: t.target,
|
|
1664
|
-
bodyNode:
|
|
1730
|
+
bodyNode: z.current
|
|
1665
1731
|
});
|
|
1666
1732
|
if (f.preventDefault) {
|
|
1667
1733
|
const m = o === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < d && !e.started && u < d;
|
|
1668
|
-
!m && o === "bottom" &&
|
|
1734
|
+
!m && o === "bottom" && bt({
|
|
1669
1735
|
target: t.target,
|
|
1670
1736
|
chrome: e.chrome
|
|
1671
|
-
}), m ||
|
|
1737
|
+
}), m || Ye(t);
|
|
1672
1738
|
}
|
|
1673
1739
|
if (f.resetAnchor) {
|
|
1674
|
-
|
|
1740
|
+
it(!1), Te(e, { x: a.pageX, y: a.pageY });
|
|
1675
1741
|
return;
|
|
1676
1742
|
}
|
|
1677
1743
|
if (f.allowDrag && !(!e.started && u < d))
|
|
1678
|
-
if (e.allowed || (e.allowed = !0, e.started = !0), f.preventDefault ||
|
|
1679
|
-
|
|
1744
|
+
if (e.allowed || (e.allowed = !0, e.started = !0), f.preventDefault || Ye(t), e.lastX = a.pageX, e.lastY = a.pageY, o === "popup")
|
|
1745
|
+
ft(e, a), Be(e, a);
|
|
1680
1746
|
else {
|
|
1681
|
-
const g = e.startTranslate + s, m =
|
|
1682
|
-
|
|
1747
|
+
const g = e.startTranslate + s, m = ht(e, s);
|
|
1748
|
+
dt(g, m), St(e, {
|
|
1683
1749
|
pageX: a.pageX,
|
|
1684
1750
|
pageY: a.pageY,
|
|
1685
1751
|
translateX: e.lastTranslateX,
|
|
@@ -1689,22 +1755,22 @@ function kr({
|
|
|
1689
1755
|
},
|
|
1690
1756
|
[
|
|
1691
1757
|
r,
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1758
|
+
ft,
|
|
1759
|
+
ht,
|
|
1760
|
+
lt,
|
|
1761
|
+
Bt,
|
|
1696
1762
|
o,
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1763
|
+
E,
|
|
1764
|
+
Te,
|
|
1765
|
+
it,
|
|
1766
|
+
dt,
|
|
1767
|
+
bt
|
|
1702
1768
|
]
|
|
1703
1769
|
);
|
|
1704
|
-
|
|
1705
|
-
if (!i || !r || o !== "bottom" && !
|
|
1770
|
+
It(() => {
|
|
1771
|
+
if (!i || !r || o !== "bottom" && !E || n === !1 || typeof window > "u") return;
|
|
1706
1772
|
const t = (e) => {
|
|
1707
|
-
|
|
1773
|
+
we(e);
|
|
1708
1774
|
};
|
|
1709
1775
|
return window.addEventListener("touchmove", t, {
|
|
1710
1776
|
capture: !0,
|
|
@@ -1712,75 +1778,75 @@ function kr({
|
|
|
1712
1778
|
}), () => {
|
|
1713
1779
|
window.removeEventListener("touchmove", t, !0);
|
|
1714
1780
|
};
|
|
1715
|
-
}, [n, r,
|
|
1716
|
-
const
|
|
1781
|
+
}, [n, r, we, i, o, E]);
|
|
1782
|
+
const Ge = p(
|
|
1717
1783
|
(t) => {
|
|
1718
|
-
const e =
|
|
1719
|
-
if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !
|
|
1784
|
+
const e = M.current;
|
|
1785
|
+
if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !E)
|
|
1720
1786
|
return;
|
|
1721
|
-
const a =
|
|
1722
|
-
o === "popup" &&
|
|
1787
|
+
const a = Bt(t), c = a?.pageX ?? e.lastX, s = a?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, f = c - e.startX, g = s - e.startY, m = Math.max(Z() - e.startTime, 1);
|
|
1788
|
+
o === "popup" && pt();
|
|
1723
1789
|
const Y = {
|
|
1724
1790
|
x: e.lastTranslateX,
|
|
1725
1791
|
y: e.lastTranslate
|
|
1726
1792
|
};
|
|
1727
|
-
let
|
|
1728
|
-
const
|
|
1793
|
+
let C = Y;
|
|
1794
|
+
const x = e.startTranslate;
|
|
1729
1795
|
if (u) {
|
|
1730
|
-
const
|
|
1796
|
+
const P = o === "popup" ? Ot(e, {
|
|
1731
1797
|
pageX: c,
|
|
1732
1798
|
pageY: s
|
|
1733
1799
|
}) : {
|
|
1734
1800
|
x: e.lastTranslateX,
|
|
1735
1801
|
y: e.lastTranslate
|
|
1736
1802
|
};
|
|
1737
|
-
|
|
1803
|
+
C = P, St(e, {
|
|
1738
1804
|
pageX: c,
|
|
1739
1805
|
pageY: s,
|
|
1740
|
-
translateX:
|
|
1741
|
-
translateY:
|
|
1806
|
+
translateX: P.x,
|
|
1807
|
+
translateY: P.y
|
|
1742
1808
|
});
|
|
1743
1809
|
}
|
|
1744
|
-
if (
|
|
1745
|
-
if (
|
|
1746
|
-
const
|
|
1810
|
+
if (mt(e), !!u)
|
|
1811
|
+
if (xt.current = Z() + 500, o === "popup") {
|
|
1812
|
+
const P = Oe({
|
|
1747
1813
|
session: e,
|
|
1748
1814
|
fallbackDelta: { x: f, y: g },
|
|
1749
1815
|
fallbackElapsed: m
|
|
1750
1816
|
});
|
|
1751
|
-
|
|
1817
|
+
At({
|
|
1752
1818
|
currentTranslate: Y,
|
|
1753
1819
|
releaseDelta: { x: f, y: g },
|
|
1754
|
-
releaseTranslate:
|
|
1755
|
-
releaseVelocity:
|
|
1820
|
+
releaseTranslate: C,
|
|
1821
|
+
releaseVelocity: P
|
|
1756
1822
|
});
|
|
1757
1823
|
} else {
|
|
1758
|
-
const
|
|
1824
|
+
const P = Ie({
|
|
1759
1825
|
session: e,
|
|
1760
1826
|
fallbackDeltaY: g,
|
|
1761
1827
|
fallbackElapsed: m
|
|
1762
1828
|
});
|
|
1763
|
-
|
|
1829
|
+
Ft({
|
|
1764
1830
|
closeAllowed: d,
|
|
1765
1831
|
currentTranslate: Y.y,
|
|
1766
1832
|
deltaY: g,
|
|
1767
|
-
releaseVelocity:
|
|
1768
|
-
startTranslate:
|
|
1833
|
+
releaseVelocity: P,
|
|
1834
|
+
startTranslate: x
|
|
1769
1835
|
});
|
|
1770
1836
|
}
|
|
1771
1837
|
},
|
|
1772
1838
|
[
|
|
1773
|
-
bt,
|
|
1774
|
-
Ct,
|
|
1775
|
-
r,
|
|
1776
1839
|
Ft,
|
|
1840
|
+
At,
|
|
1841
|
+
r,
|
|
1842
|
+
Bt,
|
|
1777
1843
|
o,
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1844
|
+
E,
|
|
1845
|
+
mt,
|
|
1846
|
+
pt
|
|
1781
1847
|
]
|
|
1782
|
-
),
|
|
1783
|
-
const t =
|
|
1848
|
+
), Ke = p(() => {
|
|
1849
|
+
const t = M.current;
|
|
1784
1850
|
if (!t.dragging || t.source !== "touch") return;
|
|
1785
1851
|
const e = t.started, a = t.startTranslate, c = t.lastTranslate, s = {
|
|
1786
1852
|
x: t.startTranslateX,
|
|
@@ -1789,31 +1855,31 @@ function kr({
|
|
|
1789
1855
|
x: t.lastTranslateX,
|
|
1790
1856
|
y: t.lastTranslate
|
|
1791
1857
|
}, d = o;
|
|
1792
|
-
if (
|
|
1858
|
+
if (mt(t), !!e) {
|
|
1793
1859
|
if (d === "popup") {
|
|
1794
|
-
|
|
1860
|
+
_.current ? Ct(s) : J(s, { from: u });
|
|
1795
1861
|
return;
|
|
1796
1862
|
}
|
|
1797
|
-
|
|
1863
|
+
O(a, { from: c });
|
|
1798
1864
|
}
|
|
1799
1865
|
}, [
|
|
1800
1866
|
o,
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1867
|
+
mt,
|
|
1868
|
+
Ct,
|
|
1869
|
+
J,
|
|
1870
|
+
O
|
|
1805
1871
|
]);
|
|
1806
1872
|
return {
|
|
1807
|
-
onPointerDown:
|
|
1808
|
-
onPointerMove:
|
|
1809
|
-
onPointerUp:
|
|
1810
|
-
onPointerCancel:
|
|
1811
|
-
onLostPointerCapture:
|
|
1812
|
-
onTouchStart:
|
|
1813
|
-
onTouchEnd:
|
|
1814
|
-
onTouchCancel:
|
|
1873
|
+
onPointerDown: je,
|
|
1874
|
+
onPointerMove: ze,
|
|
1875
|
+
onPointerUp: ve,
|
|
1876
|
+
onPointerCancel: ve,
|
|
1877
|
+
onLostPointerCapture: Ue,
|
|
1878
|
+
onTouchStart: We,
|
|
1879
|
+
onTouchEnd: Ge,
|
|
1880
|
+
onTouchCancel: Ke
|
|
1815
1881
|
};
|
|
1816
1882
|
}
|
|
1817
1883
|
export {
|
|
1818
|
-
|
|
1884
|
+
Nr as useModalDrag
|
|
1819
1885
|
};
|