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