react-spring-carousel 3.0.0-beta-2.1.1 → 3.0.0-beta-2.1.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/index.es.js +328 -330
- package/dist/index.umd.js +5 -5
- package/dist/types.d.ts +12 -0
- package/dist/useSpringCarousel.d.ts +1 -1
- package/package.json +1 -1
- package/dist/utils.d.ts +0 -6
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSpringRef as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as Zt, jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { useSpringRef as te, useSpring as Nt } from "@react-spring/web";
|
|
3
|
+
import it, { useRef as _, useEffect as G, useState as wt, useCallback as ee, useMemo as ot } from "react";
|
|
4
|
+
function re(r, t, e) {
|
|
5
5
|
return Math.max(t, Math.min(r, e));
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const I = {
|
|
8
8
|
toVector(r, t) {
|
|
9
9
|
return r === void 0 && (r = t), Array.isArray(r) ? r : [r, r];
|
|
10
10
|
},
|
|
@@ -21,17 +21,17 @@ const x = {
|
|
|
21
21
|
r[0] -= t[0], r[1] -= t[1];
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function xt(r, t, e) {
|
|
25
25
|
return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(r, e * 5) : r * t * e / (t + e * r);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return n === 0 ?
|
|
27
|
+
function Tt(r, t, e, n = 0.15) {
|
|
28
|
+
return n === 0 ? re(r, t, e) : r < t ? -xt(t - r, e - t, n) + t : r > e ? +xt(r - e, e - t, n) + e : r;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function ne(r, [t, e], [n, s]) {
|
|
31
31
|
const [[a, o], [l, c]] = r;
|
|
32
|
-
return [
|
|
32
|
+
return [Tt(t, a, o, n), Tt(e, l, c, s)];
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function se(r, t) {
|
|
35
35
|
if (typeof r != "object" || r === null) return r;
|
|
36
36
|
var e = r[Symbol.toPrimitive];
|
|
37
37
|
if (e !== void 0) {
|
|
@@ -41,19 +41,19 @@ function ne(r, t) {
|
|
|
41
41
|
}
|
|
42
42
|
return (t === "string" ? String : Number)(r);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
44
|
+
function ie(r) {
|
|
45
|
+
var t = se(r, "string");
|
|
46
46
|
return typeof t == "symbol" ? t : String(t);
|
|
47
47
|
}
|
|
48
48
|
function S(r, t, e) {
|
|
49
|
-
return t =
|
|
49
|
+
return t = ie(t), t in r ? Object.defineProperty(r, t, {
|
|
50
50
|
value: e,
|
|
51
51
|
enumerable: !0,
|
|
52
52
|
configurable: !0,
|
|
53
53
|
writable: !0
|
|
54
54
|
}) : r[t] = e, r;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function It(r, t) {
|
|
57
57
|
var e = Object.keys(r);
|
|
58
58
|
if (Object.getOwnPropertySymbols) {
|
|
59
59
|
var n = Object.getOwnPropertySymbols(r);
|
|
@@ -66,15 +66,15 @@ function Tt(r, t) {
|
|
|
66
66
|
function v(r) {
|
|
67
67
|
for (var t = 1; t < arguments.length; t++) {
|
|
68
68
|
var e = arguments[t] != null ? arguments[t] : {};
|
|
69
|
-
t % 2 ?
|
|
69
|
+
t % 2 ? It(Object(e), !0).forEach(function(n) {
|
|
70
70
|
S(r, n, e[n]);
|
|
71
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) :
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : It(Object(e)).forEach(function(n) {
|
|
72
72
|
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
return r;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const Rt = {
|
|
78
78
|
pointer: {
|
|
79
79
|
start: "down",
|
|
80
80
|
change: "move",
|
|
@@ -96,63 +96,63 @@ const Nt = {
|
|
|
96
96
|
end: "end"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function Et(r) {
|
|
100
100
|
return r ? r[0].toUpperCase() + r.slice(1) : "";
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return r && !
|
|
102
|
+
const oe = ["enter", "leave"];
|
|
103
|
+
function ae(r = !1, t) {
|
|
104
|
+
return r && !oe.includes(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const n =
|
|
108
|
-
return "on" +
|
|
106
|
+
function ce(r, t = "", e = !1) {
|
|
107
|
+
const n = Rt[r], s = n && n[t] || t;
|
|
108
|
+
return "on" + Et(r) + Et(s) + (ae(e, s) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const ue = ["gotpointercapture", "lostpointercapture"];
|
|
111
|
+
function le(r) {
|
|
112
112
|
let t = r.substring(2).toLowerCase();
|
|
113
113
|
const e = !!~t.indexOf("passive");
|
|
114
114
|
e && (t = t.replace("passive", ""));
|
|
115
|
-
const n =
|
|
115
|
+
const n = ue.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
|
|
116
116
|
return s && (t = t.replace("capture", "")), {
|
|
117
117
|
device: t,
|
|
118
118
|
capture: s,
|
|
119
119
|
passive: e
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const e =
|
|
122
|
+
function fe(r, t = "") {
|
|
123
|
+
const e = Rt[r], n = e && e[t] || t;
|
|
124
124
|
return r + n;
|
|
125
125
|
}
|
|
126
126
|
function Q(r) {
|
|
127
127
|
return "touches" in r;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Mt(r) {
|
|
130
130
|
return Q(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function de(r) {
|
|
133
133
|
return Array.from(r.touches).filter((t) => {
|
|
134
134
|
var e, n;
|
|
135
135
|
return t.target === r.currentTarget || ((e = r.currentTarget) === null || e === void 0 || (n = e.contains) === null || n === void 0 ? void 0 : n.call(e, t.target));
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function he(r) {
|
|
139
139
|
return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
return Q(r) ?
|
|
141
|
+
function Lt(r) {
|
|
142
|
+
return Q(r) ? he(r)[0] : r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function pe(r) {
|
|
145
|
+
return de(r).map((t) => t.identifier);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const t =
|
|
147
|
+
function at(r) {
|
|
148
|
+
const t = Lt(r);
|
|
149
149
|
return Q(r) ? t.identifier : t.pointerId;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const t =
|
|
151
|
+
function St(r) {
|
|
152
|
+
const t = Lt(r);
|
|
153
153
|
return [t.clientX, t.clientY];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function ge(r) {
|
|
156
156
|
const t = {};
|
|
157
157
|
if ("buttons" in r && (t.buttons = r.buttons), "shiftKey" in r) {
|
|
158
158
|
const {
|
|
@@ -173,21 +173,21 @@ function pe(r) {
|
|
|
173
173
|
function J(r, ...t) {
|
|
174
174
|
return typeof r == "function" ? r(...t) : r;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function me() {
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return r.length === 0 ?
|
|
178
|
+
function ve(...r) {
|
|
179
|
+
return r.length === 0 ? me : r.length === 1 ? r[0] : function() {
|
|
180
180
|
let t;
|
|
181
181
|
for (const e of r)
|
|
182
182
|
t = e.apply(this, arguments) || t;
|
|
183
183
|
return t;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function kt(r, t) {
|
|
187
187
|
return Object.assign({}, t, r || {});
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
class
|
|
189
|
+
const ye = 32;
|
|
190
|
+
class be {
|
|
191
191
|
constructor(t, e, n) {
|
|
192
192
|
this.ctrl = t, this.args = e, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
|
|
193
193
|
}
|
|
@@ -244,9 +244,9 @@ class ye {
|
|
|
244
244
|
} = this;
|
|
245
245
|
e.args = this.args;
|
|
246
246
|
let a = 0;
|
|
247
|
-
if (t && (e.event = t, n.preventDefault && t.cancelable && e.event.preventDefault(), e.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s,
|
|
248
|
-
const
|
|
249
|
-
|
|
247
|
+
if (t && (e.event = t, n.preventDefault && t.cancelable && e.event.preventDefault(), e.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, ge(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, a = t.timeStamp - e.timeStamp, e.timeStamp = t.timeStamp, e.elapsedTime = e.timeStamp - e.startTime), e._active) {
|
|
248
|
+
const E = e._delta.map(Math.abs);
|
|
249
|
+
I.addTo(e._distance, E);
|
|
250
250
|
}
|
|
251
251
|
this.axisIntent && this.axisIntent(t);
|
|
252
252
|
const [o, l] = e._movement, [c, h] = n.threshold, {
|
|
@@ -256,20 +256,20 @@ class ye {
|
|
|
256
256
|
if (n.hasCustomTransform ? (f[0] === !1 && (f[0] = Math.abs(o) >= c && y[0]), f[1] === !1 && (f[1] = Math.abs(l) >= h && y[1])) : (f[0] === !1 && (f[0] = Math.abs(o) >= c && Math.sign(o) * c), f[1] === !1 && (f[1] = Math.abs(l) >= h && Math.sign(l) * h)), e.intentional = f[0] !== !1 || f[1] !== !1, !e.intentional) return;
|
|
257
257
|
const p = [0, 0];
|
|
258
258
|
if (n.hasCustomTransform) {
|
|
259
|
-
const [
|
|
260
|
-
p[0] = f[0] !== !1 ?
|
|
259
|
+
const [E, $] = y;
|
|
260
|
+
p[0] = f[0] !== !1 ? E - f[0] : 0, p[1] = f[1] !== !1 ? $ - f[1] : 0;
|
|
261
261
|
} else
|
|
262
262
|
p[0] = f[0] !== !1 ? o - f[0] : 0, p[1] = f[1] !== !1 ? l - f[1] : 0;
|
|
263
263
|
this.restrictToAxis && !e._blocked && this.restrictToAxis(p);
|
|
264
|
-
const w = e.offset,
|
|
265
|
-
|
|
266
|
-
const [
|
|
267
|
-
e.overflow = [
|
|
268
|
-
const
|
|
269
|
-
if (e.offset =
|
|
270
|
-
e.delta =
|
|
271
|
-
const
|
|
272
|
-
|
|
264
|
+
const w = e.offset, x = e._active && !e._blocked || e.active;
|
|
265
|
+
x && (e.first = e._active && !e.active, e.last = !e._active && e.active, e.active = s[this.ingKey] = e._active, t && (e.first && ("bounds" in n && (e._bounds = J(n.bounds, e)), this.setup && this.setup()), e.movement = p, this.computeOffset()));
|
|
266
|
+
const [N, A] = e.offset, [[D, R], [k, M]] = e._bounds;
|
|
267
|
+
e.overflow = [N < D ? -1 : N > R ? 1 : 0, A < k ? -1 : A > M ? 1 : 0], e._movementBound[0] = e.overflow[0] ? e._movementBound[0] === !1 ? e._movement[0] : e._movementBound[0] : !1, e._movementBound[1] = e.overflow[1] ? e._movementBound[1] === !1 ? e._movement[1] : e._movementBound[1] : !1;
|
|
268
|
+
const L = e._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
+
if (e.offset = ne(e._bounds, e.offset, L), e.delta = I.sub(e.offset, w), this.computeMovement(), x && (!e.last || a > ye)) {
|
|
270
|
+
e.delta = I.sub(e.offset, w);
|
|
271
|
+
const E = e.delta.map(Math.abs);
|
|
272
|
+
I.addTo(e.distance, E), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && a > 0 && (e.velocity = [E[0] / a, E[1] / a], e.timeDelta = a);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
emit() {
|
|
@@ -284,14 +284,14 @@ class ye {
|
|
|
284
284
|
this.eventStore.clean(), this.timeoutStore.clean();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function _e([r, t], e) {
|
|
288
288
|
const n = Math.abs(r), s = Math.abs(t);
|
|
289
289
|
if (n > s && n > e)
|
|
290
290
|
return "x";
|
|
291
291
|
if (s > n && s > e)
|
|
292
292
|
return "y";
|
|
293
293
|
}
|
|
294
|
-
class
|
|
294
|
+
class we extends be {
|
|
295
295
|
constructor(...t) {
|
|
296
296
|
super(...t), S(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
@@ -302,16 +302,16 @@ class _e extends ye {
|
|
|
302
302
|
this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
|
|
303
303
|
}
|
|
304
304
|
computeOffset() {
|
|
305
|
-
this.state.offset =
|
|
305
|
+
this.state.offset = I.add(this.state.lastOffset, this.state.movement);
|
|
306
306
|
}
|
|
307
307
|
computeMovement() {
|
|
308
|
-
this.state.movement =
|
|
308
|
+
this.state.movement = I.sub(this.state.offset, this.state.lastOffset);
|
|
309
309
|
}
|
|
310
310
|
axisIntent(t) {
|
|
311
311
|
const e = this.state, n = this.config;
|
|
312
312
|
if (!e.axis && t) {
|
|
313
|
-
const s = typeof n.axisThreshold == "object" ? n.axisThreshold[
|
|
314
|
-
e.axis =
|
|
313
|
+
const s = typeof n.axisThreshold == "object" ? n.axisThreshold[Mt(t)] : n.axisThreshold;
|
|
314
|
+
e.axis = _e(e._movement, s);
|
|
315
315
|
}
|
|
316
316
|
e._blocked = (n.lockDirection || !!n.axis) && !e.axis || !!n.axis && n.axis !== e.axis;
|
|
317
317
|
}
|
|
@@ -327,7 +327,7 @@ class _e extends ye {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
330
|
+
const Dt = (r) => r, Ct = 0.15, lt = {
|
|
331
331
|
enabled(r = !0) {
|
|
332
332
|
return r;
|
|
333
333
|
},
|
|
@@ -343,33 +343,33 @@ const kt = (r) => r, Dt = 0.15, ut = {
|
|
|
343
343
|
rubberband(r = 0) {
|
|
344
344
|
switch (r) {
|
|
345
345
|
case !0:
|
|
346
|
-
return [
|
|
346
|
+
return [Ct, Ct];
|
|
347
347
|
case !1:
|
|
348
348
|
return [0, 0];
|
|
349
349
|
default:
|
|
350
|
-
return
|
|
350
|
+
return I.toVector(r);
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
353
|
from(r) {
|
|
354
354
|
if (typeof r == "function") return r;
|
|
355
|
-
if (r != null) return
|
|
355
|
+
if (r != null) return I.toVector(r);
|
|
356
356
|
},
|
|
357
357
|
transform(r, t, e) {
|
|
358
358
|
const n = r || e.shared.transform;
|
|
359
359
|
if (this.hasCustomTransform = !!n, process.env.NODE_ENV === "development") {
|
|
360
|
-
const s = n ||
|
|
360
|
+
const s = n || Dt;
|
|
361
361
|
return (a) => {
|
|
362
362
|
const o = s(a);
|
|
363
363
|
return (!isFinite(o[0]) || !isFinite(o[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${o[0]},${[1]}]`), o;
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
return n ||
|
|
366
|
+
return n || Dt;
|
|
367
367
|
},
|
|
368
368
|
threshold(r) {
|
|
369
|
-
return
|
|
369
|
+
return I.toVector(r, 0);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
372
|
+
process.env.NODE_ENV === "development" && Object.assign(lt, {
|
|
373
373
|
domTarget(r) {
|
|
374
374
|
if (r !== void 0)
|
|
375
375
|
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
@@ -386,13 +386,13 @@ process.env.NODE_ENV === "development" && Object.assign(ut, {
|
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const
|
|
389
|
+
const xe = 0, F = v(v({}, lt), {}, {
|
|
390
390
|
axis(r, t, {
|
|
391
391
|
axis: e
|
|
392
392
|
}) {
|
|
393
393
|
if (this.lockDirection = e === "lock", !this.lockDirection) return e;
|
|
394
394
|
},
|
|
395
|
-
axisThreshold(r =
|
|
395
|
+
axisThreshold(r = xe) {
|
|
396
396
|
return r;
|
|
397
397
|
},
|
|
398
398
|
bounds(r = {}) {
|
|
@@ -410,13 +410,13 @@ const we = 0, F = v(v({}, ut), {}, {
|
|
|
410
410
|
} = r;
|
|
411
411
|
return [[t, e], [n, s]];
|
|
412
412
|
}
|
|
413
|
-
}),
|
|
413
|
+
}), At = {
|
|
414
414
|
ArrowRight: (r, t = 1) => [r * t, 0],
|
|
415
415
|
ArrowLeft: (r, t = 1) => [-1 * r * t, 0],
|
|
416
416
|
ArrowUp: (r, t = 1) => [0, -1 * r * t],
|
|
417
417
|
ArrowDown: (r, t = 1) => [0, r * t]
|
|
418
418
|
};
|
|
419
|
-
class
|
|
419
|
+
class Te extends we {
|
|
420
420
|
constructor(...t) {
|
|
421
421
|
super(...t), S(this, "ingKey", "dragging");
|
|
422
422
|
}
|
|
@@ -453,7 +453,7 @@ class xe extends _e {
|
|
|
453
453
|
const e = this.config, n = this.state;
|
|
454
454
|
if (t.buttons != null && (Array.isArray(e.pointerButtons) ? !e.pointerButtons.includes(t.buttons) : e.pointerButtons !== -1 && e.pointerButtons !== t.buttons)) return;
|
|
455
455
|
const s = this.ctrl.setEventIds(t);
|
|
456
|
-
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId =
|
|
456
|
+
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = at(t), n._pointerActive = !0, this.computeValues(St(t)), this.computeInitial(), e.preventScrollAxis && Mt(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : e.delay > 0 ? (this.setupDelayTrigger(t), e.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
|
|
457
457
|
}
|
|
458
458
|
startPointerDrag(t) {
|
|
459
459
|
const e = this.state;
|
|
@@ -462,10 +462,10 @@ class xe extends _e {
|
|
|
462
462
|
pointerMove(t) {
|
|
463
463
|
const e = this.state, n = this.config;
|
|
464
464
|
if (!e._pointerActive) return;
|
|
465
|
-
const s =
|
|
465
|
+
const s = at(t);
|
|
466
466
|
if (e._pointerId !== void 0 && s !== e._pointerId) return;
|
|
467
|
-
const a =
|
|
468
|
-
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta =
|
|
467
|
+
const a = St(t);
|
|
468
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = I.sub(a, e._values), this.computeValues(a)), I.addTo(e._movement, e._delta), this.compute(t), e._delayed && e.intentional) {
|
|
469
469
|
this.timeoutStore.remove("dragDelay"), e.active = !1, this.startPointerDrag(t);
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
@@ -491,17 +491,17 @@ class xe extends _e {
|
|
|
491
491
|
}
|
|
492
492
|
const e = this.state, n = this.config;
|
|
493
493
|
if (!e._active || !e._pointerActive) return;
|
|
494
|
-
const s =
|
|
494
|
+
const s = at(t);
|
|
495
495
|
if (e._pointerId !== void 0 && s !== e._pointerId) return;
|
|
496
496
|
this.state._pointerActive = !1, this.setActive(), this.compute(t);
|
|
497
497
|
const [a, o] = e._distance;
|
|
498
498
|
if (e.tap = a <= n.tapsThreshold && o <= n.tapsThreshold, e.tap && n.filterTaps)
|
|
499
499
|
e._force = !0;
|
|
500
500
|
else {
|
|
501
|
-
const [l, c] = e._delta, [h, f] = e._movement, [y, p] = n.swipe.velocity, [w,
|
|
502
|
-
if (e.elapsedTime <
|
|
503
|
-
const
|
|
504
|
-
|
|
501
|
+
const [l, c] = e._delta, [h, f] = e._movement, [y, p] = n.swipe.velocity, [w, x] = n.swipe.distance, N = n.swipe.duration;
|
|
502
|
+
if (e.elapsedTime < N) {
|
|
503
|
+
const A = Math.abs(l / e.timeDelta), D = Math.abs(c / e.timeDelta);
|
|
504
|
+
A > y && Math.abs(h) > w && (e.swipe[0] = Math.sign(l)), D > p && Math.abs(f) > x && (e.swipe[1] = Math.sign(c));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -528,7 +528,7 @@ class xe extends _e {
|
|
|
528
528
|
this.state._preventScroll && t.cancelable && t.preventDefault();
|
|
529
529
|
}
|
|
530
530
|
setupScrollPrevention(t) {
|
|
531
|
-
this.state._preventScroll = !1,
|
|
531
|
+
this.state._preventScroll = !1, Ie(t);
|
|
532
532
|
const e = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
533
533
|
passive: !1
|
|
534
534
|
});
|
|
@@ -540,14 +540,14 @@ class xe extends _e {
|
|
|
540
540
|
}, this.config.delay);
|
|
541
541
|
}
|
|
542
542
|
keyDown(t) {
|
|
543
|
-
const e =
|
|
543
|
+
const e = At[t.key];
|
|
544
544
|
if (e) {
|
|
545
545
|
const n = this.state, s = t.shiftKey ? 10 : t.altKey ? 0.1 : 1;
|
|
546
|
-
this.start(t), n._delta = e(this.config.keyboardDisplacement, s), n._keyboardActive = !0,
|
|
546
|
+
this.start(t), n._delta = e(this.config.keyboardDisplacement, s), n._keyboardActive = !0, I.addTo(n._movement, n._delta), this.compute(t), this.emit();
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
keyUp(t) {
|
|
550
|
-
t.key in
|
|
550
|
+
t.key in At && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
|
|
551
551
|
}
|
|
552
552
|
bind(t) {
|
|
553
553
|
const e = this.config.device;
|
|
@@ -557,41 +557,41 @@ class xe extends _e {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Ie(r) {
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
563
|
const W = typeof window < "u" && window.document && window.document.createElement;
|
|
564
|
-
function
|
|
564
|
+
function Vt() {
|
|
565
565
|
return W && "ontouchstart" in window;
|
|
566
566
|
}
|
|
567
|
-
function Ie() {
|
|
568
|
-
return Lt() || W && window.navigator.maxTouchPoints > 1;
|
|
569
|
-
}
|
|
570
567
|
function Ee() {
|
|
571
|
-
return W &&
|
|
568
|
+
return Vt() || W && window.navigator.maxTouchPoints > 1;
|
|
572
569
|
}
|
|
573
570
|
function Se() {
|
|
574
|
-
return W && "
|
|
571
|
+
return W && "onpointerdown" in window;
|
|
575
572
|
}
|
|
576
573
|
function ke() {
|
|
574
|
+
return W && "exitPointerLock" in window.document;
|
|
575
|
+
}
|
|
576
|
+
function De() {
|
|
577
577
|
try {
|
|
578
578
|
return "constructor" in GestureEvent;
|
|
579
579
|
} catch {
|
|
580
580
|
return !1;
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
const
|
|
583
|
+
const C = {
|
|
584
584
|
isBrowser: W,
|
|
585
|
-
gesture:
|
|
586
|
-
touch:
|
|
587
|
-
touchscreen:
|
|
588
|
-
pointer:
|
|
589
|
-
pointerLock:
|
|
590
|
-
},
|
|
585
|
+
gesture: De(),
|
|
586
|
+
touch: Vt(),
|
|
587
|
+
touchscreen: Ee(),
|
|
588
|
+
pointer: Se(),
|
|
589
|
+
pointerLock: ke()
|
|
590
|
+
}, Ce = 250, Ae = 180, $e = 0.5, Oe = 50, Pe = 250, Ne = 10, $t = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
},
|
|
594
|
+
}, jt = v(v({}, F), {}, {
|
|
595
595
|
device(r, t, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: e = !1,
|
|
@@ -599,12 +599,12 @@ const A = {
|
|
|
599
599
|
mouse: s = !1
|
|
600
600
|
} = {}
|
|
601
601
|
}) {
|
|
602
|
-
return this.pointerLock = n &&
|
|
602
|
+
return this.pointerLock = n && C.pointerLock, C.touch && e ? "touch" : this.pointerLock ? "mouse" : C.pointer && !s ? "pointer" : C.touch ? "touch" : "mouse";
|
|
603
603
|
},
|
|
604
604
|
preventScrollAxis(r, t, {
|
|
605
605
|
preventScroll: e
|
|
606
606
|
}) {
|
|
607
|
-
if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ?
|
|
607
|
+
if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ? Ce : void 0, !(!C.touchscreen || e === !1))
|
|
608
608
|
return r || (e !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
610
|
pointerCapture(r, t, {
|
|
@@ -621,24 +621,24 @@ const A = {
|
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
622
|
axis: s = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const a =
|
|
624
|
+
const a = I.toVector(r, e ? n : s ? 1 : 0);
|
|
625
625
|
return this.filterTaps = e, this.tapsThreshold = n, a;
|
|
626
626
|
},
|
|
627
627
|
swipe({
|
|
628
|
-
velocity: r =
|
|
629
|
-
distance: t =
|
|
628
|
+
velocity: r = $e,
|
|
629
|
+
distance: t = Oe,
|
|
630
630
|
duration: e = Pe
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
|
-
velocity: this.transform(
|
|
634
|
-
distance: this.transform(
|
|
633
|
+
velocity: this.transform(I.toVector(r)),
|
|
634
|
+
distance: this.transform(I.toVector(t)),
|
|
635
635
|
duration: e
|
|
636
636
|
};
|
|
637
637
|
},
|
|
638
638
|
delay(r = 0) {
|
|
639
639
|
switch (r) {
|
|
640
640
|
case !0:
|
|
641
|
-
return
|
|
641
|
+
return Ae;
|
|
642
642
|
case !1:
|
|
643
643
|
return 0;
|
|
644
644
|
default:
|
|
@@ -646,13 +646,13 @@ const A = {
|
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
648
|
axisThreshold(r) {
|
|
649
|
-
return r ? v(v({},
|
|
649
|
+
return r ? v(v({}, $t), r) : $t;
|
|
650
650
|
},
|
|
651
|
-
keyboardDisplacement(r =
|
|
651
|
+
keyboardDisplacement(r = Ne) {
|
|
652
652
|
return r;
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
655
|
+
process.env.NODE_ENV === "development" && Object.assign(jt, {
|
|
656
656
|
useTouch(r) {
|
|
657
657
|
if (r !== void 0)
|
|
658
658
|
throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
|
|
@@ -679,18 +679,18 @@ process.env.NODE_ENV === "development" && Object.assign(Vt, {
|
|
|
679
679
|
return NaN;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
|
-
v(v({},
|
|
682
|
+
v(v({}, lt), {}, {
|
|
683
683
|
device(r, t, {
|
|
684
684
|
shared: e,
|
|
685
685
|
pointer: {
|
|
686
686
|
touch: n = !1
|
|
687
687
|
} = {}
|
|
688
688
|
}) {
|
|
689
|
-
if (e.target && !
|
|
690
|
-
if (
|
|
691
|
-
if (
|
|
692
|
-
if (
|
|
693
|
-
if (
|
|
689
|
+
if (e.target && !C.touch && C.gesture) return "gesture";
|
|
690
|
+
if (C.touch && n) return "touch";
|
|
691
|
+
if (C.touchscreen) {
|
|
692
|
+
if (C.pointer) return "pointer";
|
|
693
|
+
if (C.touch) return "touch";
|
|
694
694
|
}
|
|
695
695
|
},
|
|
696
696
|
bounds(r, t, {
|
|
@@ -698,13 +698,13 @@ v(v({}, ut), {}, {
|
|
|
698
698
|
angleBounds: n = {}
|
|
699
699
|
}) {
|
|
700
700
|
const s = (o) => {
|
|
701
|
-
const l =
|
|
701
|
+
const l = kt(J(e, o), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
705
|
return [l.min, l.max];
|
|
706
706
|
}, a = (o) => {
|
|
707
|
-
const l =
|
|
707
|
+
const l = kt(J(n, o), {
|
|
708
708
|
min: -1 / 0,
|
|
709
709
|
max: 1 / 0
|
|
710
710
|
});
|
|
@@ -713,7 +713,7 @@ v(v({}, ut), {}, {
|
|
|
713
713
|
return typeof e != "function" && typeof n != "function" ? [s(), a()] : (o) => [s(o), a(o)];
|
|
714
714
|
},
|
|
715
715
|
threshold(r, t, e) {
|
|
716
|
-
return this.lockDirection = e.axis === "lock",
|
|
716
|
+
return this.lockDirection = e.axis === "lock", I.toVector(r, this.lockDirection ? [0.1, 3] : 0);
|
|
717
717
|
},
|
|
718
718
|
modifierKey(r) {
|
|
719
719
|
return r === void 0 ? "ctrlKey" : r;
|
|
@@ -728,25 +728,25 @@ v(v({}, F), {}, {
|
|
|
728
728
|
v(v({}, F), {}, {
|
|
729
729
|
mouseOnly: (r = !0) => r
|
|
730
730
|
});
|
|
731
|
-
const
|
|
732
|
-
function
|
|
733
|
-
|
|
731
|
+
const Bt = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Map();
|
|
732
|
+
function Re(r) {
|
|
733
|
+
Bt.set(r.key, r.engine), ut.set(r.key, r.resolver);
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const Me = {
|
|
736
736
|
key: "drag",
|
|
737
|
-
engine:
|
|
738
|
-
resolver:
|
|
737
|
+
engine: Te,
|
|
738
|
+
resolver: jt
|
|
739
739
|
};
|
|
740
|
-
function
|
|
740
|
+
function Le(r, t) {
|
|
741
741
|
if (r == null) return {};
|
|
742
742
|
var e = {}, n = Object.keys(r), s, a;
|
|
743
743
|
for (a = 0; a < n.length; a++)
|
|
744
744
|
s = n[a], !(t.indexOf(s) >= 0) && (e[s] = r[s]);
|
|
745
745
|
return e;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function Ve(r, t) {
|
|
748
748
|
if (r == null) return {};
|
|
749
|
-
var e =
|
|
749
|
+
var e = Le(r, t), n, s;
|
|
750
750
|
if (Object.getOwnPropertySymbols) {
|
|
751
751
|
var a = Object.getOwnPropertySymbols(r);
|
|
752
752
|
for (s = 0; s < a.length; s++)
|
|
@@ -754,7 +754,7 @@ function Le(r, t) {
|
|
|
754
754
|
}
|
|
755
755
|
return e;
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const je = {
|
|
758
758
|
target(r) {
|
|
759
759
|
if (r)
|
|
760
760
|
return () => "current" in r ? r.current : r;
|
|
@@ -762,7 +762,7 @@ const Ve = {
|
|
|
762
762
|
enabled(r = !0) {
|
|
763
763
|
return r;
|
|
764
764
|
},
|
|
765
|
-
window(r =
|
|
765
|
+
window(r = C.isBrowser ? window : void 0) {
|
|
766
766
|
return r;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
@@ -777,7 +777,7 @@ const Ve = {
|
|
|
777
777
|
transform(r) {
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
780
|
+
}, Be = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
781
|
function q(r = {}, t) {
|
|
782
782
|
const e = {};
|
|
783
783
|
for (const [n, s] of Object.entries(t))
|
|
@@ -798,28 +798,28 @@ function q(r = {}, t) {
|
|
|
798
798
|
}
|
|
799
799
|
return e;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Ue(r, t, e = {}) {
|
|
802
802
|
const n = r, {
|
|
803
803
|
target: s,
|
|
804
804
|
eventOptions: a,
|
|
805
805
|
window: o,
|
|
806
806
|
enabled: l,
|
|
807
807
|
transform: c
|
|
808
|
-
} = n, h =
|
|
808
|
+
} = n, h = Ve(n, Be);
|
|
809
809
|
if (e.shared = q({
|
|
810
810
|
target: s,
|
|
811
811
|
eventOptions: a,
|
|
812
812
|
window: o,
|
|
813
813
|
enabled: l,
|
|
814
814
|
transform: c
|
|
815
|
-
},
|
|
816
|
-
const f =
|
|
815
|
+
}, je), t) {
|
|
816
|
+
const f = ut.get(t);
|
|
817
817
|
e[t] = q(v({
|
|
818
818
|
shared: e.shared
|
|
819
819
|
}, h), f);
|
|
820
820
|
} else
|
|
821
821
|
for (const f in h) {
|
|
822
|
-
const y =
|
|
822
|
+
const y = ut.get(f);
|
|
823
823
|
if (y)
|
|
824
824
|
e[f] = q(v({
|
|
825
825
|
shared: e.shared
|
|
@@ -832,12 +832,12 @@ function Be(r, t, e = {}) {
|
|
|
832
832
|
}
|
|
833
833
|
return e;
|
|
834
834
|
}
|
|
835
|
-
class
|
|
835
|
+
class Ut {
|
|
836
836
|
constructor(t, e) {
|
|
837
837
|
S(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
838
838
|
}
|
|
839
839
|
add(t, e, n, s, a) {
|
|
840
|
-
const o = this._listeners, l =
|
|
840
|
+
const o = this._listeners, l = fe(e, n), c = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, h = v(v({}, c), a);
|
|
841
841
|
t.addEventListener(l, s, h);
|
|
842
842
|
const f = () => {
|
|
843
843
|
t.removeEventListener(l, s, h), o.delete(f);
|
|
@@ -848,7 +848,7 @@ class Bt {
|
|
|
848
848
|
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class Ke {
|
|
852
852
|
constructor() {
|
|
853
853
|
S(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
854
854
|
}
|
|
@@ -863,20 +863,20 @@ class Ue {
|
|
|
863
863
|
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
866
|
+
class ze {
|
|
867
867
|
constructor(t) {
|
|
868
|
-
S(this, "gestures", /* @__PURE__ */ new Set()), S(this, "_targetEventStore", new
|
|
868
|
+
S(this, "gestures", /* @__PURE__ */ new Set()), S(this, "_targetEventStore", new Ut(this)), S(this, "gestureEventStores", {}), S(this, "gestureTimeoutStores", {}), S(this, "handlers", {}), S(this, "config", {}), S(this, "pointerIds", /* @__PURE__ */ new Set()), S(this, "touchIds", /* @__PURE__ */ new Set()), S(this, "state", {
|
|
869
869
|
shared: {
|
|
870
870
|
shiftKey: !1,
|
|
871
871
|
metaKey: !1,
|
|
872
872
|
ctrlKey: !1,
|
|
873
873
|
altKey: !1
|
|
874
874
|
}
|
|
875
|
-
}),
|
|
875
|
+
}), Ge(this, t);
|
|
876
876
|
}
|
|
877
877
|
setEventIds(t) {
|
|
878
878
|
if (Q(t))
|
|
879
|
-
return this.touchIds = new Set(
|
|
879
|
+
return this.touchIds = new Set(pe(t)), this.touchIds;
|
|
880
880
|
if ("pointerId" in t)
|
|
881
881
|
return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
|
|
882
882
|
}
|
|
@@ -884,7 +884,7 @@ class Ke {
|
|
|
884
884
|
this.handlers = t, this.nativeHandlers = e;
|
|
885
885
|
}
|
|
886
886
|
applyConfig(t, e) {
|
|
887
|
-
this.config =
|
|
887
|
+
this.config = Ue(t, e, this.config);
|
|
888
888
|
}
|
|
889
889
|
clean() {
|
|
890
890
|
this._targetEventStore.clean();
|
|
@@ -900,13 +900,13 @@ class Ke {
|
|
|
900
900
|
if (!(e.target && (s = e.target(), !s))) {
|
|
901
901
|
if (e.enabled) {
|
|
902
902
|
for (const o of this.gestures) {
|
|
903
|
-
const l = this.config[o], c =
|
|
903
|
+
const l = this.config[o], c = Ot(n, l.eventOptions, !!s);
|
|
904
904
|
if (l.enabled) {
|
|
905
|
-
const h =
|
|
905
|
+
const h = Bt.get(o);
|
|
906
906
|
new h(this, t, o).bind(c);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const a =
|
|
909
|
+
const a = Ot(n, e.eventOptions, !!s);
|
|
910
910
|
for (const o in this.nativeHandlers)
|
|
911
911
|
a(o, "", (l) => this.nativeHandlers[o](v(v({}, this.state.shared), {}, {
|
|
912
912
|
event: l,
|
|
@@ -914,14 +914,14 @@ class Ke {
|
|
|
914
914
|
})), void 0, !0);
|
|
915
915
|
}
|
|
916
916
|
for (const a in n)
|
|
917
|
-
n[a] =
|
|
917
|
+
n[a] = ve(...n[a]);
|
|
918
918
|
if (!s) return n;
|
|
919
919
|
for (const a in n) {
|
|
920
920
|
const {
|
|
921
921
|
device: o,
|
|
922
922
|
capture: l,
|
|
923
923
|
passive: c
|
|
924
|
-
} =
|
|
924
|
+
} = le(a);
|
|
925
925
|
this._targetEventStore.add(s, o, "", n[a], {
|
|
926
926
|
capture: l,
|
|
927
927
|
passive: c
|
|
@@ -930,29 +930,29 @@ class Ke {
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
r.gestures.add(t), r.gestureEventStores[t] = new
|
|
933
|
+
function z(r, t) {
|
|
934
|
+
r.gestures.add(t), r.gestureEventStores[t] = new Ut(r, t), r.gestureTimeoutStores[t] = new Ke();
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
t.drag &&
|
|
936
|
+
function Ge(r, t) {
|
|
937
|
+
t.drag && z(r, "drag"), t.wheel && z(r, "wheel"), t.scroll && z(r, "scroll"), t.move && z(r, "move"), t.pinch && z(r, "pinch"), t.hover && z(r, "hover");
|
|
938
938
|
}
|
|
939
|
-
const
|
|
939
|
+
const Ot = (r, t, e) => (n, s, a, o = {}, l = !1) => {
|
|
940
940
|
var c, h;
|
|
941
941
|
const f = (c = o.capture) !== null && c !== void 0 ? c : t.capture, y = (h = o.passive) !== null && h !== void 0 ? h : t.passive;
|
|
942
|
-
let p = l ? n :
|
|
942
|
+
let p = l ? n : ce(n, s, f);
|
|
943
943
|
e && y && (p += "Passive"), r[p] = r[p] || [], r[p].push(a);
|
|
944
944
|
};
|
|
945
|
-
function
|
|
946
|
-
const s =
|
|
947
|
-
if (s.applyHandlers(r, n), s.applyConfig(t, e),
|
|
945
|
+
function Fe(r, t = {}, e, n) {
|
|
946
|
+
const s = it.useMemo(() => new ze(r), []);
|
|
947
|
+
if (s.applyHandlers(r, n), s.applyConfig(t, e), it.useEffect(s.effect.bind(s)), it.useEffect(() => s.clean.bind(s), []), t.target === void 0)
|
|
948
948
|
return s.bind.bind(s);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
return
|
|
950
|
+
function We(r, t) {
|
|
951
|
+
return Re(Me), Fe({
|
|
952
952
|
drag: r
|
|
953
953
|
}, t || {}, "drag");
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ye(r) {
|
|
956
956
|
const {
|
|
957
957
|
type: t,
|
|
958
958
|
actionType: e,
|
|
@@ -966,7 +966,7 @@ function We(r) {
|
|
|
966
966
|
t === "next" && (c += 1), t === "prev" && (c = c === 0 ? s - 1 : c - 1), n !== void 0 && (c = n);
|
|
967
967
|
let p = 0;
|
|
968
968
|
t === "next" && (p = -(c * o), a && c === s && (c = 0, h = h + o * s, p = 0), !a && (Math.abs(p) >= l || c === s - 1) && (y = !0, p = -l)), t === "prev" && (p = -(c * o), c === s - 1 && (h = h - s * o), !a && p >= 0 && (f = !0, p = 0)), e === "resize" && (p = -(c * o));
|
|
969
|
-
const w = a ? c % s : c,
|
|
969
|
+
const w = a ? c % s : c, x = a ? s + c % s : c;
|
|
970
970
|
return {
|
|
971
971
|
newActive: c,
|
|
972
972
|
fromValue: h,
|
|
@@ -974,13 +974,13 @@ function We(r) {
|
|
|
974
974
|
startReached: f,
|
|
975
975
|
endReached: y,
|
|
976
976
|
logicalIndex: w,
|
|
977
|
-
realTrackIndex:
|
|
977
|
+
realTrackIndex: x
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
980
|
function X(r, t, e) {
|
|
981
981
|
return t === "x" ? `translate3d(calc(${r}px + var(--${e}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${r}px + var(--${e}-offset-modifier)), 0px)`;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function He() {
|
|
984
984
|
const r = _(
|
|
985
985
|
null
|
|
986
986
|
);
|
|
@@ -988,7 +988,7 @@ function Ye() {
|
|
|
988
988
|
const t = _(null);
|
|
989
989
|
return t.current === null && (t.current = {
|
|
990
990
|
useListenToCustomEvent(e) {
|
|
991
|
-
|
|
991
|
+
G(() => {
|
|
992
992
|
const n = r.current;
|
|
993
993
|
return n.add(e), () => {
|
|
994
994
|
n.delete(e);
|
|
@@ -1001,10 +1001,6 @@ function Ye() {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
}), t.current;
|
|
1003
1003
|
}
|
|
1004
|
-
function He(r) {
|
|
1005
|
-
let t = r.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
|
|
1006
|
-
return t = t.replace(/[\n\t]+/g, " "), t = t.replace(/\s*([{}:;,])\s*/g, "$1"), t = t.replace(/\s+}/g, "}"), t = t.replace(/{\s+/g, "{"), t = t.replace(/\s+/g, " "), t.trim();
|
|
1007
|
-
}
|
|
1008
1004
|
function tr({
|
|
1009
1005
|
init: r = !0,
|
|
1010
1006
|
items: t,
|
|
@@ -1018,14 +1014,15 @@ function tr({
|
|
|
1018
1014
|
slideWhenDragThresholdIsReached: h = !0,
|
|
1019
1015
|
slideType: f = "item",
|
|
1020
1016
|
initialActiveItem: y = 0,
|
|
1021
|
-
renderWindow: p
|
|
1017
|
+
renderWindow: p,
|
|
1018
|
+
renderPlaceholder: w
|
|
1022
1019
|
}) {
|
|
1023
|
-
const [
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
const
|
|
1028
|
-
function
|
|
1020
|
+
const [x, N] = wt(!1), [, A] = wt(0), D = _(r), R = _(null), k = _(null), M = _(0), L = _(0), E = _(!e), $ = _(!1), Z = _(0), b = _(0), ft = _(t);
|
|
1021
|
+
ft.current = t;
|
|
1022
|
+
const dt = _(e);
|
|
1023
|
+
dt.current = e;
|
|
1024
|
+
const ht = _(!1), j = _(null), O = _(null);
|
|
1025
|
+
function pt(i) {
|
|
1029
1026
|
if (i === void 0) return 0;
|
|
1030
1027
|
if (typeof i == "number")
|
|
1031
1028
|
return t[i] ? i : (console.warn(
|
|
@@ -1034,78 +1031,78 @@ function tr({
|
|
|
1034
1031
|
const u = t.findIndex((m) => m.id === i);
|
|
1035
1032
|
return u < 0 ? (console.warn(`initialActiveItem: item with id "${i}" doesn't exist.`), 0) : u;
|
|
1036
1033
|
}
|
|
1037
|
-
const Y =
|
|
1034
|
+
const Y = te(), tt = Nt({
|
|
1038
1035
|
value: 0,
|
|
1039
1036
|
ref: Y,
|
|
1040
1037
|
onChange({ value: i }) {
|
|
1041
|
-
|
|
1038
|
+
k.current.style.transform = X(
|
|
1042
1039
|
i.value,
|
|
1043
1040
|
o,
|
|
1044
1041
|
n
|
|
1045
1042
|
);
|
|
1046
1043
|
}
|
|
1047
|
-
}),
|
|
1048
|
-
function
|
|
1044
|
+
}), Kt = e ? t.length * 3 : t.length, { useListenToCustomEvent: gt, emitEvent: B } = He();
|
|
1045
|
+
function mt(i) {
|
|
1049
1046
|
if (!i || i.length === 0) return null;
|
|
1050
1047
|
let u = null, m = -1 / 0;
|
|
1051
1048
|
for (const g of i)
|
|
1052
1049
|
(g.media ? window.matchMedia(g.media).matches : window.innerWidth >= g.breakpoint) && g.breakpoint >= m && (u = g, m = g.breakpoint);
|
|
1053
1050
|
return u;
|
|
1054
1051
|
}
|
|
1055
|
-
function
|
|
1056
|
-
const { totalGutterCssVar: i } =
|
|
1052
|
+
function vt() {
|
|
1053
|
+
const { totalGutterCssVar: i } = yt();
|
|
1057
1054
|
return i;
|
|
1058
1055
|
}
|
|
1059
|
-
function
|
|
1060
|
-
const i =
|
|
1056
|
+
function zt() {
|
|
1057
|
+
const i = mt(a);
|
|
1061
1058
|
return (i == null ? void 0 : i.itemsPerSlide) || 1;
|
|
1062
1059
|
}
|
|
1063
|
-
function
|
|
1064
|
-
|
|
1060
|
+
function et(i) {
|
|
1061
|
+
D.current && ($.current || U({
|
|
1065
1062
|
type: "next",
|
|
1066
1063
|
toIndex: i,
|
|
1067
1064
|
actionType: "click"
|
|
1068
1065
|
}));
|
|
1069
1066
|
}
|
|
1070
|
-
function
|
|
1071
|
-
|
|
1067
|
+
function rt(i) {
|
|
1068
|
+
D.current && (E.current || U({
|
|
1072
1069
|
type: "prev",
|
|
1073
1070
|
toIndex: i,
|
|
1074
1071
|
actionType: "click"
|
|
1075
1072
|
}));
|
|
1076
1073
|
}
|
|
1077
|
-
function
|
|
1074
|
+
function U({
|
|
1078
1075
|
type: i,
|
|
1079
1076
|
shouldAnimate: u = !0,
|
|
1080
1077
|
toIndex: m,
|
|
1081
1078
|
actionType: g
|
|
1082
1079
|
}) {
|
|
1083
|
-
var
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
const d =
|
|
1080
|
+
var P, V;
|
|
1081
|
+
const T = !u;
|
|
1082
|
+
E.current = !1, $.current = !1;
|
|
1083
|
+
const d = Ye({
|
|
1087
1084
|
type: i,
|
|
1088
1085
|
actionType: g,
|
|
1089
1086
|
toIndex: m,
|
|
1090
1087
|
currentActive: b.current,
|
|
1091
1088
|
itemsLength: t.length,
|
|
1092
1089
|
withLoop: e,
|
|
1093
|
-
scrollAmount:
|
|
1094
|
-
totalAvailable: i === "next" ?
|
|
1095
|
-
e ?
|
|
1090
|
+
scrollAmount: L.current,
|
|
1091
|
+
totalAvailable: i === "next" ? nt(
|
|
1092
|
+
e ? L.current * (t.length * 2) : 0
|
|
1096
1093
|
) : 0,
|
|
1097
|
-
fromValueRaw:
|
|
1094
|
+
fromValueRaw: tt.value.get()
|
|
1098
1095
|
});
|
|
1099
|
-
b.current = d.newActive,
|
|
1096
|
+
b.current = d.newActive, E.current = d.startReached, $.current = d.endReached, M.current = d.toValue, p !== void 0 && A((K) => K + 1), B(g === "resize" ? {
|
|
1100
1097
|
eventName: "onResize",
|
|
1101
1098
|
sliceActionType: g,
|
|
1102
1099
|
slideDirection: i,
|
|
1103
1100
|
currentItem: {
|
|
1104
|
-
id: ((
|
|
1101
|
+
id: ((P = t.at(d.logicalIndex)) == null ? void 0 : P.id) ?? "",
|
|
1105
1102
|
index: d.logicalIndex,
|
|
1106
1103
|
trackIndex: d.realTrackIndex,
|
|
1107
|
-
startReached:
|
|
1108
|
-
endReached:
|
|
1104
|
+
startReached: E.current,
|
|
1105
|
+
endReached: $.current
|
|
1109
1106
|
}
|
|
1110
1107
|
} : {
|
|
1111
1108
|
eventName: "onSlideStartChange",
|
|
@@ -1113,62 +1110,62 @@ function tr({
|
|
|
1113
1110
|
slideDirection: i,
|
|
1114
1111
|
nextItem: {
|
|
1115
1112
|
index: d.logicalIndex,
|
|
1116
|
-
id: ((
|
|
1113
|
+
id: ((V = t.at(d.logicalIndex)) == null ? void 0 : V.id) ?? "",
|
|
1117
1114
|
trackIndex: d.realTrackIndex,
|
|
1118
|
-
startReached:
|
|
1119
|
-
endReached:
|
|
1115
|
+
startReached: E.current,
|
|
1116
|
+
endReached: $.current
|
|
1120
1117
|
}
|
|
1121
1118
|
}), Y.start({
|
|
1122
|
-
immediate:
|
|
1119
|
+
immediate: T,
|
|
1123
1120
|
from: { value: d.fromValue },
|
|
1124
1121
|
to: { value: d.toValue },
|
|
1125
|
-
onChange({ value:
|
|
1126
|
-
|
|
1127
|
-
|
|
1122
|
+
onChange({ value: K }) {
|
|
1123
|
+
k.current.style.transform = X(
|
|
1124
|
+
K.value,
|
|
1128
1125
|
o,
|
|
1129
1126
|
n
|
|
1130
1127
|
);
|
|
1131
1128
|
},
|
|
1132
|
-
onRest({ finished:
|
|
1133
|
-
var
|
|
1134
|
-
if (
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1129
|
+
onRest({ finished: K }) {
|
|
1130
|
+
var bt;
|
|
1131
|
+
if (K) {
|
|
1132
|
+
const _t = e ? b.current % t.length : b.current, Qt = e ? t.length + b.current % t.length : b.current;
|
|
1133
|
+
B({
|
|
1137
1134
|
eventName: "onSlideChangeComplete",
|
|
1138
1135
|
sliceActionType: g,
|
|
1139
1136
|
slideDirection: i,
|
|
1140
1137
|
currentItem: {
|
|
1141
|
-
index:
|
|
1142
|
-
id: ((
|
|
1143
|
-
trackIndex:
|
|
1144
|
-
startReached:
|
|
1145
|
-
endReached:
|
|
1138
|
+
index: _t,
|
|
1139
|
+
id: ((bt = t.at(_t)) == null ? void 0 : bt.id) ?? "",
|
|
1140
|
+
trackIndex: Qt,
|
|
1141
|
+
startReached: E.current,
|
|
1142
|
+
endReached: $.current
|
|
1146
1143
|
}
|
|
1147
1144
|
});
|
|
1148
1145
|
}
|
|
1149
1146
|
}
|
|
1150
1147
|
});
|
|
1151
1148
|
}
|
|
1152
|
-
function
|
|
1153
|
-
const i =
|
|
1149
|
+
function Gt() {
|
|
1150
|
+
const i = k.current;
|
|
1154
1151
|
let u = 0;
|
|
1155
|
-
return f === "item" ? u = i.children[0].getBoundingClientRect()[o === "x" ? "width" : "height"] +
|
|
1152
|
+
return f === "item" ? u = i.children[0].getBoundingClientRect()[o === "x" ? "width" : "height"] + vt() : u = i.getBoundingClientRect()[o === "x" ? "width" : "height"] + vt(), u;
|
|
1156
1153
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const u =
|
|
1154
|
+
function nt(i) {
|
|
1155
|
+
const u = k.current;
|
|
1159
1156
|
return u[o === "x" ? "scrollWidth" : "scrollHeight"] - u.getBoundingClientRect()[o === "x" ? "width" : "height"] - i;
|
|
1160
1157
|
}
|
|
1161
|
-
function
|
|
1162
|
-
const i =
|
|
1158
|
+
function yt() {
|
|
1159
|
+
const i = mt(s);
|
|
1163
1160
|
return {
|
|
1164
1161
|
totalGutterCssVar: (i == null ? void 0 : i.gutter) || 0,
|
|
1165
1162
|
totalStartEndGutterCssVar: ((i == null ? void 0 : i.startEndGutter) || 0) * 2
|
|
1166
1163
|
};
|
|
1167
1164
|
}
|
|
1168
|
-
|
|
1169
|
-
function i(
|
|
1170
|
-
const d =
|
|
1171
|
-
switch (
|
|
1165
|
+
G(() => {
|
|
1166
|
+
function i(T) {
|
|
1167
|
+
const d = zt();
|
|
1168
|
+
switch (T) {
|
|
1172
1169
|
case "start":
|
|
1173
1170
|
return 0;
|
|
1174
1171
|
case "middle-start":
|
|
@@ -1184,22 +1181,22 @@ function tr({
|
|
|
1184
1181
|
}
|
|
1185
1182
|
}
|
|
1186
1183
|
function u() {
|
|
1187
|
-
|
|
1188
|
-
const { totalStartEndGutterCssVar:
|
|
1184
|
+
L.current = Gt(), Z.current = L.current / 4;
|
|
1185
|
+
const { totalStartEndGutterCssVar: T } = yt();
|
|
1189
1186
|
let d = 0;
|
|
1190
|
-
e && (d =
|
|
1187
|
+
e && (d = L.current * t.length), d -= L.current * i(l), d -= T / 2, R.current.style.setProperty(
|
|
1191
1188
|
`--${n}-offset-modifier`,
|
|
1192
1189
|
`${-d}px`
|
|
1193
1190
|
);
|
|
1194
1191
|
}
|
|
1195
|
-
function m(
|
|
1196
|
-
if (
|
|
1197
|
-
const d =
|
|
1198
|
-
|
|
1192
|
+
function m(T) {
|
|
1193
|
+
if (R.current && (u(), N(!0), T)) {
|
|
1194
|
+
const d = pt(y), P = e ? t.length + d % t.length : d;
|
|
1195
|
+
B({ eventName: "onInit", index: d, trackIndex: P });
|
|
1199
1196
|
}
|
|
1200
1197
|
}
|
|
1201
1198
|
function g() {
|
|
1202
|
-
m(),
|
|
1199
|
+
m(), U({
|
|
1203
1200
|
type: "resize",
|
|
1204
1201
|
toIndex: b.current,
|
|
1205
1202
|
shouldAnimate: !1,
|
|
@@ -1207,44 +1204,44 @@ function tr({
|
|
|
1207
1204
|
});
|
|
1208
1205
|
}
|
|
1209
1206
|
if (r)
|
|
1210
|
-
return
|
|
1207
|
+
return D.current = !0, ht.current ? g() : (m(!0), ht.current = !0), window.addEventListener("resize", g), () => {
|
|
1211
1208
|
window.removeEventListener("resize", g);
|
|
1212
1209
|
};
|
|
1213
|
-
}, [r, n, o, e]),
|
|
1214
|
-
const i =
|
|
1215
|
-
r && i !== b.current &&
|
|
1210
|
+
}, [r, n, o, e]), G(() => {
|
|
1211
|
+
const i = pt(y);
|
|
1212
|
+
r && i !== b.current && U({
|
|
1216
1213
|
type: "next",
|
|
1217
1214
|
toIndex: i,
|
|
1218
1215
|
actionType: "resize",
|
|
1219
1216
|
shouldAnimate: !1
|
|
1220
1217
|
});
|
|
1221
1218
|
}, [r, y]);
|
|
1222
|
-
const
|
|
1223
|
-
function
|
|
1224
|
-
if (O.current !== null && (cancelAnimationFrame(O.current), O.current = null),
|
|
1225
|
-
const i =
|
|
1226
|
-
|
|
1219
|
+
const st = c;
|
|
1220
|
+
function Ft() {
|
|
1221
|
+
if (O.current !== null && (cancelAnimationFrame(O.current), O.current = null), j.current) {
|
|
1222
|
+
const i = j.current;
|
|
1223
|
+
j.current = null, B(i);
|
|
1227
1224
|
}
|
|
1228
1225
|
}
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1226
|
+
function Wt(i) {
|
|
1227
|
+
j.current = i, O.current === null && (O.current = requestAnimationFrame(() => {
|
|
1231
1228
|
O.current = null;
|
|
1232
|
-
const u =
|
|
1233
|
-
|
|
1229
|
+
const u = j.current;
|
|
1230
|
+
j.current = null, u && B(u);
|
|
1234
1231
|
}));
|
|
1235
1232
|
}
|
|
1236
|
-
|
|
1233
|
+
G(
|
|
1237
1234
|
() => () => {
|
|
1238
|
-
O.current !== null && (cancelAnimationFrame(O.current), O.current = null),
|
|
1235
|
+
O.current !== null && (cancelAnimationFrame(O.current), O.current = null), j.current = null;
|
|
1239
1236
|
},
|
|
1240
1237
|
[]
|
|
1241
1238
|
);
|
|
1242
|
-
const
|
|
1239
|
+
const Yt = We(
|
|
1243
1240
|
(i) => {
|
|
1244
|
-
if (!
|
|
1241
|
+
if (!D.current)
|
|
1245
1242
|
return;
|
|
1246
|
-
const u = i.dragging, m = i.offset[o === "x" ? 0 : 1], g = i.movement[o === "x" ? 0 : 1],
|
|
1247
|
-
u && (
|
|
1243
|
+
const u = i.dragging, m = i.offset[o === "x" ? 0 : 1], g = i.movement[o === "x" ? 0 : 1], T = g > Z.current, d = g < -Z.current, P = i.velocity;
|
|
1244
|
+
u && (Wt({
|
|
1248
1245
|
...i,
|
|
1249
1246
|
eventName: "onDrag",
|
|
1250
1247
|
slideActionType: "drag"
|
|
@@ -1252,29 +1249,29 @@ function tr({
|
|
|
1252
1249
|
value: m,
|
|
1253
1250
|
immediate: !0,
|
|
1254
1251
|
config: {
|
|
1255
|
-
velocity:
|
|
1252
|
+
velocity: P
|
|
1256
1253
|
},
|
|
1257
|
-
onChange({ value:
|
|
1258
|
-
|
|
1259
|
-
|
|
1254
|
+
onChange({ value: V }) {
|
|
1255
|
+
k.current.style.transform = X(
|
|
1256
|
+
V.value,
|
|
1260
1257
|
o,
|
|
1261
1258
|
n
|
|
1262
1259
|
);
|
|
1263
1260
|
}
|
|
1264
|
-
}), h && (
|
|
1261
|
+
}), h && (T || d) && i.cancel()), i.last && (Ft(), T ? (U({
|
|
1265
1262
|
actionType: "drag",
|
|
1266
1263
|
type: "prev"
|
|
1267
|
-
}), i.cancel()) : d ? (
|
|
1264
|
+
}), i.cancel()) : d ? (U({
|
|
1268
1265
|
actionType: "drag",
|
|
1269
1266
|
type: "next"
|
|
1270
1267
|
}), i.cancel()) : (Y.start({
|
|
1271
1268
|
value: M.current,
|
|
1272
1269
|
config: {
|
|
1273
|
-
velocity:
|
|
1270
|
+
velocity: P
|
|
1274
1271
|
},
|
|
1275
|
-
onChange({ value:
|
|
1276
|
-
|
|
1277
|
-
|
|
1272
|
+
onChange({ value: V }) {
|
|
1273
|
+
k.current.style.transform = X(
|
|
1274
|
+
V.value,
|
|
1278
1275
|
o,
|
|
1279
1276
|
n
|
|
1280
1277
|
);
|
|
@@ -1282,39 +1279,39 @@ function tr({
|
|
|
1282
1279
|
}), i.cancel()));
|
|
1283
1280
|
},
|
|
1284
1281
|
{
|
|
1285
|
-
enabled:
|
|
1282
|
+
enabled: st,
|
|
1286
1283
|
axis: o,
|
|
1287
1284
|
rubberband: !e,
|
|
1288
1285
|
...e ? {} : {
|
|
1289
1286
|
bounds: () => ({
|
|
1290
1287
|
right: 0,
|
|
1291
|
-
left: -
|
|
1292
|
-
top: -
|
|
1288
|
+
left: -nt(0),
|
|
1289
|
+
top: -nt(0),
|
|
1293
1290
|
bottom: 0
|
|
1294
1291
|
})
|
|
1295
1292
|
},
|
|
1296
|
-
from: () => [
|
|
1293
|
+
from: () => [tt.value.get(), tt.value.get()]
|
|
1297
1294
|
}
|
|
1298
|
-
),
|
|
1295
|
+
), Ht = ee((i) => {
|
|
1299
1296
|
var d;
|
|
1300
|
-
const u =
|
|
1297
|
+
const u = ft.current, g = dt.current ? u.length + b.current % u.length : b.current;
|
|
1301
1298
|
if (typeof i == "number") return g === i;
|
|
1302
|
-
const
|
|
1303
|
-
return i === ((d = u[
|
|
1304
|
-
}, []),
|
|
1299
|
+
const T = b.current % u.length;
|
|
1300
|
+
return i === ((d = u[T]) == null ? void 0 : d.id);
|
|
1301
|
+
}, []), Xt = ot(
|
|
1305
1302
|
() => Array.from({ length: t.length }, (i, u) => () => {
|
|
1306
1303
|
const m = e ? b.current % t.length : b.current;
|
|
1307
1304
|
return e ? u === (m + 1) % t.length : m + 1 >= t.length ? !1 : u === m + 1;
|
|
1308
1305
|
}),
|
|
1309
1306
|
[t.length, e]
|
|
1310
|
-
),
|
|
1307
|
+
), qt = ot(
|
|
1311
1308
|
() => Array.from({ length: t.length }, (i, u) => () => {
|
|
1312
1309
|
const m = e ? b.current % t.length : b.current;
|
|
1313
1310
|
return e ? u === (m - 1 + t.length) % t.length : m - 1 < 0 ? !1 : u === m - 1;
|
|
1314
1311
|
}),
|
|
1315
1312
|
[t.length, e]
|
|
1316
|
-
),
|
|
1317
|
-
() =>
|
|
1313
|
+
), Jt = ot(
|
|
1314
|
+
() => `
|
|
1318
1315
|
[data-part-internal="${n}-Container"] {
|
|
1319
1316
|
display: flex;
|
|
1320
1317
|
width: 100%;
|
|
@@ -1327,14 +1324,14 @@ function tr({
|
|
|
1327
1324
|
--${n}-scroll-y-value: ${o === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1328
1325
|
--${n}-gutter: 0px;
|
|
1329
1326
|
--${n}-start-end-gutter: 0px;
|
|
1330
|
-
touch-action: ${
|
|
1327
|
+
touch-action: ${st ? o === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1331
1328
|
}
|
|
1332
1329
|
[data-part-internal="${n}-Track"] {
|
|
1333
1330
|
display: flex;
|
|
1334
1331
|
position: relative;
|
|
1335
1332
|
--initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${t.length} * var(--${n}-items-per-slide)) + var(--${n}-start-end-gutter)) * ${t.length} / var(--${n}-items-per-slide));
|
|
1336
|
-
left: ${e && o === "x" && !
|
|
1337
|
-
top: ${e && o === "y" && !
|
|
1333
|
+
left: ${e && o === "x" && !x ? "var(--initial-offset-modifier)" : "0px"};
|
|
1334
|
+
top: ${e && o === "y" && !x ? "var(--initial-offset-modifier)" : "0px"};
|
|
1338
1335
|
flex-direction: ${o === "x" ? "row" : "column"};
|
|
1339
1336
|
width: 100%;
|
|
1340
1337
|
height: 100%;
|
|
@@ -1364,44 +1361,44 @@ function tr({
|
|
|
1364
1361
|
}
|
|
1365
1362
|
`
|
|
1366
1363
|
).join("") : ""}
|
|
1367
|
-
|
|
1364
|
+
`,
|
|
1368
1365
|
[
|
|
1369
1366
|
n,
|
|
1370
1367
|
o,
|
|
1371
|
-
|
|
1368
|
+
st,
|
|
1372
1369
|
t.length,
|
|
1373
1370
|
e,
|
|
1374
|
-
|
|
1371
|
+
x,
|
|
1375
1372
|
s,
|
|
1376
1373
|
a
|
|
1377
1374
|
]
|
|
1378
1375
|
);
|
|
1379
1376
|
return {
|
|
1380
|
-
carouselFragment: /* @__PURE__ */
|
|
1377
|
+
carouselFragment: /* @__PURE__ */ Zt(
|
|
1381
1378
|
"div",
|
|
1382
1379
|
{
|
|
1383
|
-
ref:
|
|
1380
|
+
ref: R,
|
|
1384
1381
|
className: "ReactSpringCarouselContainer",
|
|
1385
1382
|
"data-part": "Container",
|
|
1386
1383
|
"data-part-internal": `${n}-Container`,
|
|
1387
|
-
...
|
|
1384
|
+
...Yt(),
|
|
1388
1385
|
children: [
|
|
1389
|
-
/* @__PURE__ */ H("style", { dangerouslySetInnerHTML: { __html:
|
|
1386
|
+
/* @__PURE__ */ H("style", { dangerouslySetInnerHTML: { __html: Jt } }),
|
|
1390
1387
|
/* @__PURE__ */ H(
|
|
1391
1388
|
"div",
|
|
1392
1389
|
{
|
|
1393
|
-
ref:
|
|
1390
|
+
ref: k,
|
|
1394
1391
|
className: "ReactSpringCarouselTrack",
|
|
1395
1392
|
"data-part": "Track",
|
|
1396
1393
|
"data-part-internal": `${n}-Track`,
|
|
1397
1394
|
onScroll: () => {
|
|
1398
|
-
|
|
1395
|
+
E.current = !1, $.current = !1;
|
|
1399
1396
|
},
|
|
1400
|
-
children: Array.from({ length:
|
|
1401
|
-
const m = e ? u % t.length : u, g = t[m],
|
|
1397
|
+
children: Array.from({ length: Kt }, (i, u) => {
|
|
1398
|
+
const m = e ? u % t.length : u, g = t[m], T = e && (u < t.length || u >= t.length * 2);
|
|
1402
1399
|
if (p !== void 0) {
|
|
1403
|
-
const
|
|
1404
|
-
if (Math.abs(u -
|
|
1400
|
+
const V = e ? t.length + b.current % t.length : b.current;
|
|
1401
|
+
if (Math.abs(u - V) > p)
|
|
1405
1402
|
return /* @__PURE__ */ H(
|
|
1406
1403
|
"div",
|
|
1407
1404
|
{
|
|
@@ -1409,12 +1406,13 @@ function tr({
|
|
|
1409
1406
|
"data-part": "Item",
|
|
1410
1407
|
"data-part-internal": `${n}-Item`,
|
|
1411
1408
|
"data-id": g.id,
|
|
1412
|
-
"aria-hidden": "true"
|
|
1409
|
+
"aria-hidden": "true",
|
|
1410
|
+
children: w == null ? void 0 : w({ item: g, index: u, isClonedItem: T })
|
|
1413
1411
|
},
|
|
1414
1412
|
`${g.id}-${u}`
|
|
1415
1413
|
);
|
|
1416
1414
|
}
|
|
1417
|
-
const d =
|
|
1415
|
+
const d = Xt[m], P = qt[m];
|
|
1418
1416
|
return /* @__PURE__ */ H(
|
|
1419
1417
|
"div",
|
|
1420
1418
|
{
|
|
@@ -1423,12 +1421,12 @@ function tr({
|
|
|
1423
1421
|
"data-part-internal": `${n}-Item`,
|
|
1424
1422
|
"data-id": g.id,
|
|
1425
1423
|
children: typeof g.renderItem == "function" ? g.renderItem({
|
|
1426
|
-
useListenToCustomEvent:
|
|
1424
|
+
useListenToCustomEvent: gt,
|
|
1427
1425
|
index: u,
|
|
1428
|
-
isClonedItem:
|
|
1429
|
-
isActiveItem:
|
|
1426
|
+
isClonedItem: T,
|
|
1427
|
+
isActiveItem: Ht,
|
|
1430
1428
|
isNextItem: d,
|
|
1431
|
-
isPrevItem:
|
|
1429
|
+
isPrevItem: P
|
|
1432
1430
|
}) : g.renderItem
|
|
1433
1431
|
},
|
|
1434
1432
|
`${g.id}-${u}`
|
|
@@ -1439,9 +1437,9 @@ function tr({
|
|
|
1439
1437
|
]
|
|
1440
1438
|
}
|
|
1441
1439
|
),
|
|
1442
|
-
useListenToCustomEvent:
|
|
1443
|
-
slideToNextItem: () =>
|
|
1444
|
-
slideToPrevItem: () =>
|
|
1440
|
+
useListenToCustomEvent: gt,
|
|
1441
|
+
slideToNextItem: () => et(),
|
|
1442
|
+
slideToPrevItem: () => rt(),
|
|
1445
1443
|
slideToItem: (i) => {
|
|
1446
1444
|
if (typeof i == "number") {
|
|
1447
1445
|
if (!t[i]) {
|
|
@@ -1450,7 +1448,7 @@ function tr({
|
|
|
1450
1448
|
);
|
|
1451
1449
|
return;
|
|
1452
1450
|
}
|
|
1453
|
-
i > b.current ?
|
|
1451
|
+
i > b.current ? et(i) : rt(i);
|
|
1454
1452
|
}
|
|
1455
1453
|
if (typeof i == "string") {
|
|
1456
1454
|
const u = t.findIndex((m) => m.id === i);
|
|
@@ -1460,7 +1458,7 @@ function tr({
|
|
|
1460
1458
|
);
|
|
1461
1459
|
return;
|
|
1462
1460
|
}
|
|
1463
|
-
u > b.current ?
|
|
1461
|
+
u > b.current ? et(u) : rt(u);
|
|
1464
1462
|
}
|
|
1465
1463
|
}
|
|
1466
1464
|
};
|
|
@@ -1473,12 +1471,12 @@ function Xe(r) {
|
|
|
1473
1471
|
function Pt(r) {
|
|
1474
1472
|
return r.scrollWidth - r.clientWidth;
|
|
1475
1473
|
}
|
|
1476
|
-
function
|
|
1474
|
+
function ct(r) {
|
|
1477
1475
|
const t = r.children[0], e = Xe(r);
|
|
1478
1476
|
return t.getBoundingClientRect().width + e;
|
|
1479
1477
|
}
|
|
1480
1478
|
function er({ container: r, onReach: t }) {
|
|
1481
|
-
const e = _("start"), n = _(0), [, s] =
|
|
1479
|
+
const e = _("start"), n = _(0), [, s] = Nt(() => ({
|
|
1482
1480
|
x: 0
|
|
1483
1481
|
}));
|
|
1484
1482
|
function a(l) {
|
|
@@ -1498,30 +1496,30 @@ function er({ container: r, onReach: t }) {
|
|
|
1498
1496
|
if (!r.current || l === "next" && e.current === "end" || l === "prev" && e.current === "start")
|
|
1499
1497
|
return;
|
|
1500
1498
|
let c = 0;
|
|
1501
|
-
if (l === "next" && (n.current += 1), l === "prev" && (n.current -= 1), c = n.current *
|
|
1499
|
+
if (l === "next" && (n.current += 1), l === "prev" && (n.current -= 1), c = n.current * ct(r.current), l === "next") {
|
|
1502
1500
|
const h = Pt(r.current);
|
|
1503
1501
|
c > h && (e.current = "end", c = h, t && t("end"));
|
|
1504
1502
|
}
|
|
1505
1503
|
l === "prev" && c <= 0 && (e.current = "start", n.current = 0, c = 0, t && t("start")), a(c);
|
|
1506
1504
|
}
|
|
1507
|
-
return
|
|
1505
|
+
return G(() => {
|
|
1508
1506
|
function l() {
|
|
1509
|
-
var
|
|
1510
|
-
const w =
|
|
1511
|
-
index:
|
|
1512
|
-
start: w *
|
|
1513
|
-
end: w * (
|
|
1514
|
-
})),
|
|
1515
|
-
(
|
|
1507
|
+
var R;
|
|
1508
|
+
const w = ct(r.current), x = ((R = [...r.current.children].at(0)) == null ? void 0 : R.getBoundingClientRect().width) || 0, N = Array(r.current.childElementCount).fill(0).map((k, M) => ({
|
|
1509
|
+
index: M,
|
|
1510
|
+
start: w * M,
|
|
1511
|
+
end: w * (M + 1)
|
|
1512
|
+
})), A = r.current.scrollLeft + x, D = N.find(
|
|
1513
|
+
(k) => A >= k.start && A < k.end
|
|
1516
1514
|
);
|
|
1517
|
-
n.current = (
|
|
1515
|
+
n.current = (D == null ? void 0 : D.index) || 0;
|
|
1518
1516
|
}
|
|
1519
1517
|
function c() {
|
|
1520
1518
|
s.stop();
|
|
1521
1519
|
}
|
|
1522
1520
|
function h(w) {
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1521
|
+
const x = w.target;
|
|
1522
|
+
x.scrollLeft === 0 ? (n.current = 0, e.current = "start", t && t("start")) : x.scrollLeft >= Pt(x) ? (e.current = "end", t && t("end")) : e.current !== "idle" && (e.current = "idle", t && t("idle"));
|
|
1525
1523
|
}
|
|
1526
1524
|
let f, y = 0;
|
|
1527
1525
|
function p() {
|
|
@@ -1535,10 +1533,10 @@ function er({ container: r, onReach: t }) {
|
|
|
1535
1533
|
}), r.current.addEventListener("scroll", h), r.current.addEventListener("scroll", p), () => {
|
|
1536
1534
|
r.current && (r.current.removeEventListener("scroll", p), r.current.removeEventListener("scroll", h), r.current.removeEventListener("wheel", c));
|
|
1537
1535
|
};
|
|
1538
|
-
}, [r, t]),
|
|
1536
|
+
}, [r, t]), G(() => {
|
|
1539
1537
|
if (r.current) {
|
|
1540
1538
|
const l = new ResizeObserver(() => {
|
|
1541
|
-
a(n.current *
|
|
1539
|
+
a(n.current * ct(r.current));
|
|
1542
1540
|
});
|
|
1543
1541
|
return l.observe(r.current), () => {
|
|
1544
1542
|
l.disconnect();
|