react-spring-carousel 3.0.0-beta-2.0.263 → 3.0.0-beta-2.0.3
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 +288 -275
- package/dist/index.umd.js +13 -11
- package/dist/types.d.ts +7 -0
- package/dist/useSpringCarousel.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as At, jsx as
|
|
2
|
-
import { useSpring as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as At, jsx as X } from "react/jsx-runtime";
|
|
2
|
+
import { useSpring as $t } from "@react-spring/web";
|
|
3
|
+
import q, { useRef as k, useEffect as Z, useState as Pt } from "react";
|
|
4
4
|
function Nt(r, t, e) {
|
|
5
5
|
return Math.max(t, Math.min(r, e));
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const y = {
|
|
8
8
|
toVector(r, t) {
|
|
9
9
|
return r === void 0 && (r = t), Array.isArray(r) ? r : [r, r];
|
|
10
10
|
},
|
|
@@ -28,8 +28,8 @@ function ut(r, t, e, n = 0.15) {
|
|
|
28
28
|
return n === 0 ? Nt(r, t, e) : r < t ? -ct(t - r, e - t, n) + t : r > e ? +ct(r - e, e - t, n) + e : r;
|
|
29
29
|
}
|
|
30
30
|
function Mt(r, [t, e], [n, s]) {
|
|
31
|
-
const [[o,
|
|
32
|
-
return [ut(t, o,
|
|
31
|
+
const [[o, a], [u, h]] = r;
|
|
32
|
+
return [ut(t, o, a, n), ut(e, u, h, s)];
|
|
33
33
|
}
|
|
34
34
|
function Rt(r, t) {
|
|
35
35
|
if (typeof r != "object" || r === null) return r;
|
|
@@ -45,7 +45,7 @@ function Lt(r) {
|
|
|
45
45
|
var t = Rt(r, "string");
|
|
46
46
|
return typeof t == "symbol" ? t : String(t);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function w(r, t, e) {
|
|
49
49
|
return t = Lt(t), t in r ? Object.defineProperty(r, t, {
|
|
50
50
|
value: e,
|
|
51
51
|
enumerable: !0,
|
|
@@ -53,7 +53,7 @@ function y(r, t, e) {
|
|
|
53
53
|
writable: !0
|
|
54
54
|
}) : r[t] = e, r;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function lt(r, t) {
|
|
57
57
|
var e = Object.keys(r);
|
|
58
58
|
if (Object.getOwnPropertySymbols) {
|
|
59
59
|
var n = Object.getOwnPropertySymbols(r);
|
|
@@ -63,12 +63,12 @@ function ft(r, t) {
|
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function d(r) {
|
|
67
67
|
for (var t = 1; t < arguments.length; t++) {
|
|
68
68
|
var e = arguments[t] != null ? arguments[t] : {};
|
|
69
|
-
t % 2 ?
|
|
70
|
-
|
|
71
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) :
|
|
69
|
+
t % 2 ? lt(Object(e), !0).forEach(function(n) {
|
|
70
|
+
w(r, n, e[n]);
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : lt(Object(e)).forEach(function(n) {
|
|
72
72
|
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -96,7 +96,7 @@ const _t = {
|
|
|
96
96
|
end: "end"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function ft(r) {
|
|
100
100
|
return r ? r[0].toUpperCase() + r.slice(1) : "";
|
|
101
101
|
}
|
|
102
102
|
const Vt = ["enter", "leave"];
|
|
@@ -105,7 +105,7 @@ function jt(r = !1, t) {
|
|
|
105
105
|
}
|
|
106
106
|
function Ut(r, t = "", e = !1) {
|
|
107
107
|
const n = _t[r], s = n && n[t] || t;
|
|
108
|
-
return "on" +
|
|
108
|
+
return "on" + ft(r) + ft(s) + (jt(e, s) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
110
|
const Kt = ["gotpointercapture", "lostpointercapture"];
|
|
111
111
|
function Bt(r) {
|
|
@@ -135,16 +135,16 @@ function Yt(r) {
|
|
|
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 Gt(r) {
|
|
139
139
|
return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
|
|
140
140
|
}
|
|
141
141
|
function wt(r) {
|
|
142
|
-
return Y(r) ?
|
|
142
|
+
return Y(r) ? Gt(r)[0] : r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Ft(r) {
|
|
145
145
|
return Yt(r).map((t) => t.identifier);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function J(r) {
|
|
148
148
|
const t = wt(r);
|
|
149
149
|
return Y(r) ? t.identifier : t.pointerId;
|
|
150
150
|
}
|
|
@@ -152,7 +152,7 @@ function dt(r) {
|
|
|
152
152
|
const t = wt(r);
|
|
153
153
|
return [t.clientX, t.clientY];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Wt(r) {
|
|
156
156
|
const t = {};
|
|
157
157
|
if ("buttons" in r && (t.buttons = r.buttons), "shiftKey" in r) {
|
|
158
158
|
const {
|
|
@@ -244,38 +244,38 @@ class Jt {
|
|
|
244
244
|
} = this;
|
|
245
245
|
e.args = this.args;
|
|
246
246
|
let o = 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, Wt(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = t.timeStamp - e.timeStamp, e.timeStamp = t.timeStamp, e.elapsedTime = e.timeStamp - e.startTime), e._active) {
|
|
248
|
+
const l = e._delta.map(Math.abs);
|
|
249
|
+
y.addTo(e._distance, l);
|
|
250
250
|
}
|
|
251
251
|
this.axisIntent && this.axisIntent(t);
|
|
252
|
-
const [
|
|
253
|
-
_step:
|
|
254
|
-
values:
|
|
252
|
+
const [a, u] = e._movement, [h, p] = n.threshold, {
|
|
253
|
+
_step: c,
|
|
254
|
+
values: b
|
|
255
255
|
} = e;
|
|
256
|
-
if (n.hasCustomTransform ? (
|
|
256
|
+
if (n.hasCustomTransform ? (c[0] === !1 && (c[0] = Math.abs(a) >= h && b[0]), c[1] === !1 && (c[1] = Math.abs(u) >= p && b[1])) : (c[0] === !1 && (c[0] = Math.abs(a) >= h && Math.sign(a) * h), c[1] === !1 && (c[1] = Math.abs(u) >= p && Math.sign(u) * p)), e.intentional = c[0] !== !1 || c[1] !== !1, !e.intentional) return;
|
|
257
257
|
const m = [0, 0];
|
|
258
258
|
if (n.hasCustomTransform) {
|
|
259
|
-
const [
|
|
260
|
-
m[0] =
|
|
259
|
+
const [l, L] = b;
|
|
260
|
+
m[0] = c[0] !== !1 ? l - c[0] : 0, m[1] = c[1] !== !1 ? L - c[1] : 0;
|
|
261
261
|
} else
|
|
262
|
-
m[0] =
|
|
262
|
+
m[0] = c[0] !== !1 ? a - c[0] : 0, m[1] = c[1] !== !1 ? u - c[1] : 0;
|
|
263
263
|
this.restrictToAxis && !e._blocked && this.restrictToAxis(m);
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
const [
|
|
267
|
-
e.overflow = [
|
|
268
|
-
const
|
|
269
|
-
if (e.offset = Mt(e._bounds, e.offset,
|
|
270
|
-
e.delta =
|
|
271
|
-
const
|
|
272
|
-
|
|
264
|
+
const $ = e.offset, D = e._active && !e._blocked || e.active;
|
|
265
|
+
D && (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 = z(n.bounds, e)), this.setup && this.setup()), e.movement = m, this.computeOffset()));
|
|
266
|
+
const [S, A] = e.offset, [[P, x], [C, O]] = e._bounds;
|
|
267
|
+
e.overflow = [S < P ? -1 : S > x ? 1 : 0, A < C ? -1 : A > O ? 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 R = e._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
+
if (e.offset = Mt(e._bounds, e.offset, R), e.delta = y.sub(e.offset, $), this.computeMovement(), D && (!e.last || o > qt)) {
|
|
270
|
+
e.delta = y.sub(e.offset, $);
|
|
271
|
+
const l = e.delta.map(Math.abs);
|
|
272
|
+
y.addTo(e.distance, l), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && o > 0 && (e.velocity = [l[0] / o, l[1] / o], e.timeDelta = o);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
emit() {
|
|
276
276
|
const t = this.state, e = this.shared, n = this.config;
|
|
277
277
|
if (t._active || this.clean(), (t._blocked || !t.intentional) && !t._force && !n.triggerAllEvents) return;
|
|
278
|
-
const s = this.handler(
|
|
278
|
+
const s = this.handler(d(d(d({}, e), t), {}, {
|
|
279
279
|
[this.aliasKey]: t.values
|
|
280
280
|
}));
|
|
281
281
|
s !== void 0 && (t.memo = s);
|
|
@@ -293,7 +293,7 @@ function Qt([r, t], e) {
|
|
|
293
293
|
}
|
|
294
294
|
class Zt extends Jt {
|
|
295
295
|
constructor(...t) {
|
|
296
|
-
super(...t),
|
|
296
|
+
super(...t), w(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
298
298
|
reset() {
|
|
299
299
|
super.reset(), this.state.axis = void 0;
|
|
@@ -302,10 +302,10 @@ class Zt extends Jt {
|
|
|
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 = y.add(this.state.lastOffset, this.state.movement);
|
|
306
306
|
}
|
|
307
307
|
computeMovement() {
|
|
308
|
-
this.state.movement =
|
|
308
|
+
this.state.movement = y.sub(this.state.offset, this.state.lastOffset);
|
|
309
309
|
}
|
|
310
310
|
axisIntent(t) {
|
|
311
311
|
const e = this.state, n = this.config;
|
|
@@ -327,12 +327,12 @@ class Zt extends Jt {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const pt = (r) => r,
|
|
330
|
+
const pt = (r) => r, gt = 0.15, et = {
|
|
331
331
|
enabled(r = !0) {
|
|
332
332
|
return r;
|
|
333
333
|
},
|
|
334
334
|
eventOptions(r, t, e) {
|
|
335
|
-
return
|
|
335
|
+
return d(d({}, e.shared.eventOptions), r);
|
|
336
336
|
},
|
|
337
337
|
preventDefault(r = !1) {
|
|
338
338
|
return r;
|
|
@@ -343,33 +343,33 @@ const pt = (r) => r, mt = 0.15, rt = {
|
|
|
343
343
|
rubberband(r = 0) {
|
|
344
344
|
switch (r) {
|
|
345
345
|
case !0:
|
|
346
|
-
return [
|
|
346
|
+
return [gt, gt];
|
|
347
347
|
case !1:
|
|
348
348
|
return [0, 0];
|
|
349
349
|
default:
|
|
350
|
-
return
|
|
350
|
+
return y.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 y.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
360
|
const s = n || pt;
|
|
361
361
|
return (o) => {
|
|
362
|
-
const
|
|
363
|
-
return (!isFinite(
|
|
362
|
+
const a = s(o);
|
|
363
|
+
return (!isFinite(a[0]) || !isFinite(a[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${a[0]},${[1]}]`), a;
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
return n || pt;
|
|
367
367
|
},
|
|
368
368
|
threshold(r) {
|
|
369
|
-
return
|
|
369
|
+
return y.toVector(r, 0);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
372
|
+
process.env.NODE_ENV === "development" && Object.assign(et, {
|
|
373
373
|
domTarget(r) {
|
|
374
374
|
if (r !== void 0)
|
|
375
375
|
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
@@ -386,7 +386,7 @@ process.env.NODE_ENV === "development" && Object.assign(rt, {
|
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const te = 0,
|
|
389
|
+
const te = 0, V = d(d({}, et), {}, {
|
|
390
390
|
axis(r, t, {
|
|
391
391
|
axis: e
|
|
392
392
|
}) {
|
|
@@ -397,7 +397,7 @@ const te = 0, L = h(h({}, rt), {}, {
|
|
|
397
397
|
},
|
|
398
398
|
bounds(r = {}) {
|
|
399
399
|
if (typeof r == "function")
|
|
400
|
-
return (o) =>
|
|
400
|
+
return (o) => V.bounds(r(o));
|
|
401
401
|
if ("current" in r)
|
|
402
402
|
return () => r.current;
|
|
403
403
|
if (typeof HTMLElement == "function" && r instanceof HTMLElement)
|
|
@@ -410,7 +410,7 @@ const te = 0, L = h(h({}, rt), {}, {
|
|
|
410
410
|
} = r;
|
|
411
411
|
return [[t, e], [n, s]];
|
|
412
412
|
}
|
|
413
|
-
}),
|
|
413
|
+
}), mt = {
|
|
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],
|
|
@@ -418,7 +418,7 @@ const te = 0, L = h(h({}, rt), {}, {
|
|
|
418
418
|
};
|
|
419
419
|
class ee extends Zt {
|
|
420
420
|
constructor(...t) {
|
|
421
|
-
super(...t),
|
|
421
|
+
super(...t), w(this, "ingKey", "dragging");
|
|
422
422
|
}
|
|
423
423
|
reset() {
|
|
424
424
|
super.reset();
|
|
@@ -434,7 +434,7 @@ class ee extends Zt {
|
|
|
434
434
|
top: e.top - n.top + t.offset[1],
|
|
435
435
|
bottom: e.bottom - n.bottom + t.offset[1]
|
|
436
436
|
};
|
|
437
|
-
t._bounds =
|
|
437
|
+
t._bounds = V.bounds(s);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
cancel() {
|
|
@@ -453,7 +453,7 @@ class ee extends Zt {
|
|
|
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 = J(t), n._pointerActive = !0, this.computeValues(dt(t)), this.computeInitial(), e.preventScrollAxis && bt(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 ee extends Zt {
|
|
|
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 = J(t);
|
|
466
466
|
if (e._pointerId !== void 0 && s !== e._pointerId) return;
|
|
467
467
|
const o = dt(t);
|
|
468
|
-
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta =
|
|
468
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = y.sub(o, e._values), this.computeValues(o)), y.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 ee extends Zt {
|
|
|
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 = J(t);
|
|
495
495
|
if (e._pointerId !== void 0 && s !== e._pointerId) return;
|
|
496
496
|
this.state._pointerActive = !1, this.setActive(), this.compute(t);
|
|
497
|
-
const [o,
|
|
498
|
-
if (e.tap = o <= n.tapsThreshold &&
|
|
497
|
+
const [o, a] = e._distance;
|
|
498
|
+
if (e.tap = o <= n.tapsThreshold && a <= n.tapsThreshold, e.tap && n.filterTaps)
|
|
499
499
|
e._force = !0;
|
|
500
500
|
else {
|
|
501
|
-
const [
|
|
502
|
-
if (e.elapsedTime <
|
|
503
|
-
const
|
|
504
|
-
|
|
501
|
+
const [u, h] = e._delta, [p, c] = e._movement, [b, m] = n.swipe.velocity, [$, D] = n.swipe.distance, S = n.swipe.duration;
|
|
502
|
+
if (e.elapsedTime < S) {
|
|
503
|
+
const A = Math.abs(u / e.timeDelta), P = Math.abs(h / e.timeDelta);
|
|
504
|
+
A > b && Math.abs(p) > $ && (e.swipe[0] = Math.sign(u)), P > m && Math.abs(c) > D && (e.swipe[1] = Math.sign(h));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -540,14 +540,14 @@ class ee extends Zt {
|
|
|
540
540
|
}, this.config.delay);
|
|
541
541
|
}
|
|
542
542
|
keyDown(t) {
|
|
543
|
-
const e =
|
|
543
|
+
const e = mt[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, y.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 mt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
|
|
551
551
|
}
|
|
552
552
|
bind(t) {
|
|
553
553
|
const e = this.config.device;
|
|
@@ -560,18 +560,18 @@ class ee extends Zt {
|
|
|
560
560
|
function re(r) {
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
|
-
const
|
|
563
|
+
const j = typeof window < "u" && window.document && window.document.createElement;
|
|
564
564
|
function Et() {
|
|
565
|
-
return
|
|
565
|
+
return j && "ontouchstart" in window;
|
|
566
566
|
}
|
|
567
567
|
function ne() {
|
|
568
|
-
return Et() ||
|
|
568
|
+
return Et() || j && window.navigator.maxTouchPoints > 1;
|
|
569
569
|
}
|
|
570
570
|
function se() {
|
|
571
|
-
return
|
|
571
|
+
return j && "onpointerdown" in window;
|
|
572
572
|
}
|
|
573
573
|
function ie() {
|
|
574
|
-
return
|
|
574
|
+
return j && "exitPointerLock" in window.document;
|
|
575
575
|
}
|
|
576
576
|
function oe() {
|
|
577
577
|
try {
|
|
@@ -580,18 +580,18 @@ function oe() {
|
|
|
580
580
|
return !1;
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
const
|
|
584
|
-
isBrowser:
|
|
583
|
+
const I = {
|
|
584
|
+
isBrowser: j,
|
|
585
585
|
gesture: oe(),
|
|
586
586
|
touch: Et(),
|
|
587
587
|
touchscreen: ne(),
|
|
588
588
|
pointer: se(),
|
|
589
589
|
pointerLock: ie()
|
|
590
|
-
}, ae = 250, ce = 180, ue = 0.5,
|
|
590
|
+
}, ae = 250, ce = 180, ue = 0.5, le = 50, fe = 250, de = 10, vt = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
}, Tt =
|
|
594
|
+
}, Tt = d(d({}, V), {}, {
|
|
595
595
|
device(r, t, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: e = !1,
|
|
@@ -599,12 +599,12 @@ const x = {
|
|
|
599
599
|
mouse: s = !1
|
|
600
600
|
} = {}
|
|
601
601
|
}) {
|
|
602
|
-
return this.pointerLock = n &&
|
|
602
|
+
return this.pointerLock = n && I.pointerLock, I.touch && e ? "touch" : this.pointerLock ? "mouse" : I.pointer && !s ? "pointer" : I.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 ? ae : void 0, !(!
|
|
607
|
+
if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ? ae : void 0, !(!I.touchscreen || e === !1))
|
|
608
608
|
return r || (e !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
610
|
pointerCapture(r, t, {
|
|
@@ -621,17 +621,17 @@ const x = {
|
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
622
|
axis: s = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const o =
|
|
624
|
+
const o = y.toVector(r, e ? n : s ? 1 : 0);
|
|
625
625
|
return this.filterTaps = e, this.tapsThreshold = n, o;
|
|
626
626
|
},
|
|
627
627
|
swipe({
|
|
628
628
|
velocity: r = ue,
|
|
629
|
-
distance: t =
|
|
630
|
-
duration: e =
|
|
629
|
+
distance: t = le,
|
|
630
|
+
duration: e = fe
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
|
-
velocity: this.transform(
|
|
634
|
-
distance: this.transform(
|
|
633
|
+
velocity: this.transform(y.toVector(r)),
|
|
634
|
+
distance: this.transform(y.toVector(t)),
|
|
635
635
|
duration: e
|
|
636
636
|
};
|
|
637
637
|
},
|
|
@@ -646,7 +646,7 @@ const x = {
|
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
648
|
axisThreshold(r) {
|
|
649
|
-
return r ?
|
|
649
|
+
return r ? d(d({}, vt), r) : vt;
|
|
650
650
|
},
|
|
651
651
|
keyboardDisplacement(r = de) {
|
|
652
652
|
return r;
|
|
@@ -679,41 +679,41 @@ process.env.NODE_ENV === "development" && Object.assign(Tt, {
|
|
|
679
679
|
return NaN;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
|
-
|
|
682
|
+
d(d({}, et), {}, {
|
|
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 && !I.touch && I.gesture) return "gesture";
|
|
690
|
+
if (I.touch && n) return "touch";
|
|
691
|
+
if (I.touchscreen) {
|
|
692
|
+
if (I.pointer) return "pointer";
|
|
693
|
+
if (I.touch) return "touch";
|
|
694
694
|
}
|
|
695
695
|
},
|
|
696
696
|
bounds(r, t, {
|
|
697
697
|
scaleBounds: e = {},
|
|
698
698
|
angleBounds: n = {}
|
|
699
699
|
}) {
|
|
700
|
-
const s = (
|
|
701
|
-
const
|
|
700
|
+
const s = (a) => {
|
|
701
|
+
const u = ht(z(e, a), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
|
-
return [
|
|
706
|
-
}, o = (
|
|
707
|
-
const
|
|
705
|
+
return [u.min, u.max];
|
|
706
|
+
}, o = (a) => {
|
|
707
|
+
const u = ht(z(n, a), {
|
|
708
708
|
min: -1 / 0,
|
|
709
709
|
max: 1 / 0
|
|
710
710
|
});
|
|
711
|
-
return [
|
|
711
|
+
return [u.min, u.max];
|
|
712
712
|
};
|
|
713
|
-
return typeof e != "function" && typeof n != "function" ? [s(), o()] : (
|
|
713
|
+
return typeof e != "function" && typeof n != "function" ? [s(), o()] : (a) => [s(a), o(a)];
|
|
714
714
|
},
|
|
715
715
|
threshold(r, t, e) {
|
|
716
|
-
return this.lockDirection = e.axis === "lock",
|
|
716
|
+
return this.lockDirection = e.axis === "lock", y.toVector(r, this.lockDirection ? [0.1, 3] : 0);
|
|
717
717
|
},
|
|
718
718
|
modifierKey(r) {
|
|
719
719
|
return r === void 0 ? "ctrlKey" : r;
|
|
@@ -722,31 +722,31 @@ h(h({}, rt), {}, {
|
|
|
722
722
|
return r;
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
|
-
|
|
725
|
+
d(d({}, V), {}, {
|
|
726
726
|
mouseOnly: (r = !0) => r
|
|
727
727
|
});
|
|
728
|
-
|
|
728
|
+
d(d({}, V), {}, {
|
|
729
729
|
mouseOnly: (r = !0) => r
|
|
730
730
|
});
|
|
731
|
-
const xt = /* @__PURE__ */ new Map(),
|
|
731
|
+
const xt = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Map();
|
|
732
732
|
function he(r) {
|
|
733
|
-
xt.set(r.key, r.engine),
|
|
733
|
+
xt.set(r.key, r.engine), tt.set(r.key, r.resolver);
|
|
734
734
|
}
|
|
735
735
|
const pe = {
|
|
736
736
|
key: "drag",
|
|
737
737
|
engine: ee,
|
|
738
738
|
resolver: Tt
|
|
739
739
|
};
|
|
740
|
-
function
|
|
740
|
+
function ge(r, t) {
|
|
741
741
|
if (r == null) return {};
|
|
742
742
|
var e = {}, n = Object.keys(r), s, o;
|
|
743
743
|
for (o = 0; o < n.length; o++)
|
|
744
744
|
s = n[o], !(t.indexOf(s) >= 0) && (e[s] = r[s]);
|
|
745
745
|
return e;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function me(r, t) {
|
|
748
748
|
if (r == null) return {};
|
|
749
|
-
var e =
|
|
749
|
+
var e = ge(r, t), n, s;
|
|
750
750
|
if (Object.getOwnPropertySymbols) {
|
|
751
751
|
var o = Object.getOwnPropertySymbols(r);
|
|
752
752
|
for (s = 0; s < o.length; s++)
|
|
@@ -762,7 +762,7 @@ const ve = {
|
|
|
762
762
|
enabled(r = !0) {
|
|
763
763
|
return r;
|
|
764
764
|
},
|
|
765
|
-
window(r =
|
|
765
|
+
window(r = I.isBrowser ? window : void 0) {
|
|
766
766
|
return r;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
@@ -802,47 +802,47 @@ function _e(r, t, e = {}) {
|
|
|
802
802
|
const n = r, {
|
|
803
803
|
target: s,
|
|
804
804
|
eventOptions: o,
|
|
805
|
-
window:
|
|
806
|
-
enabled:
|
|
807
|
-
transform:
|
|
808
|
-
} = n, p =
|
|
805
|
+
window: a,
|
|
806
|
+
enabled: u,
|
|
807
|
+
transform: h
|
|
808
|
+
} = n, p = me(n, ye);
|
|
809
809
|
if (e.shared = B({
|
|
810
810
|
target: s,
|
|
811
811
|
eventOptions: o,
|
|
812
|
-
window:
|
|
813
|
-
enabled:
|
|
814
|
-
transform:
|
|
812
|
+
window: a,
|
|
813
|
+
enabled: u,
|
|
814
|
+
transform: h
|
|
815
815
|
}, ve), t) {
|
|
816
|
-
const
|
|
817
|
-
e[t] = B(
|
|
816
|
+
const c = tt.get(t);
|
|
817
|
+
e[t] = B(d({
|
|
818
818
|
shared: e.shared
|
|
819
|
-
}, p),
|
|
819
|
+
}, p), c);
|
|
820
820
|
} else
|
|
821
|
-
for (const
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
e[
|
|
821
|
+
for (const c in p) {
|
|
822
|
+
const b = tt.get(c);
|
|
823
|
+
if (b)
|
|
824
|
+
e[c] = B(d({
|
|
825
825
|
shared: e.shared
|
|
826
|
-
}, p[
|
|
827
|
-
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(
|
|
828
|
-
if (
|
|
826
|
+
}, p[c]), b);
|
|
827
|
+
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(c)) {
|
|
828
|
+
if (c === "domTarget")
|
|
829
829
|
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
830
|
-
console.warn(`[@use-gesture]: Unknown config key \`${
|
|
830
|
+
console.warn(`[@use-gesture]: Unknown config key \`${c}\` was used. Please read the documentation for further information.`);
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
return e;
|
|
834
834
|
}
|
|
835
835
|
class It {
|
|
836
836
|
constructor(t, e) {
|
|
837
|
-
|
|
837
|
+
w(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
838
838
|
}
|
|
839
839
|
add(t, e, n, s, o) {
|
|
840
|
-
const
|
|
841
|
-
t.addEventListener(
|
|
842
|
-
const
|
|
843
|
-
t.removeEventListener(
|
|
840
|
+
const a = this._listeners, u = zt(e, n), h = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = d(d({}, h), o);
|
|
841
|
+
t.addEventListener(u, s, p);
|
|
842
|
+
const c = () => {
|
|
843
|
+
t.removeEventListener(u, s, p), a.delete(c);
|
|
844
844
|
};
|
|
845
|
-
return
|
|
845
|
+
return a.add(c), c;
|
|
846
846
|
}
|
|
847
847
|
clean() {
|
|
848
848
|
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
@@ -850,7 +850,7 @@ class It {
|
|
|
850
850
|
}
|
|
851
851
|
class be {
|
|
852
852
|
constructor() {
|
|
853
|
-
|
|
853
|
+
w(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
854
854
|
}
|
|
855
855
|
add(t, e, n = 140, ...s) {
|
|
856
856
|
this.remove(t), this._timeouts.set(t, window.setTimeout(e, n, ...s));
|
|
@@ -865,7 +865,7 @@ class be {
|
|
|
865
865
|
}
|
|
866
866
|
class we {
|
|
867
867
|
constructor(t) {
|
|
868
|
-
|
|
868
|
+
w(this, "gestures", /* @__PURE__ */ new Set()), w(this, "_targetEventStore", new It(this)), w(this, "gestureEventStores", {}), w(this, "gestureTimeoutStores", {}), w(this, "handlers", {}), w(this, "config", {}), w(this, "pointerIds", /* @__PURE__ */ new Set()), w(this, "touchIds", /* @__PURE__ */ new Set()), w(this, "state", {
|
|
869
869
|
shared: {
|
|
870
870
|
shiftKey: !1,
|
|
871
871
|
metaKey: !1,
|
|
@@ -876,7 +876,7 @@ class we {
|
|
|
876
876
|
}
|
|
877
877
|
setEventIds(t) {
|
|
878
878
|
if (Y(t))
|
|
879
|
-
return this.touchIds = new Set(
|
|
879
|
+
return this.touchIds = new Set(Ft(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
|
}
|
|
@@ -899,17 +899,17 @@ class we {
|
|
|
899
899
|
let s;
|
|
900
900
|
if (!(e.target && (s = e.target(), !s))) {
|
|
901
901
|
if (e.enabled) {
|
|
902
|
-
for (const
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
const p = xt.get(
|
|
906
|
-
new p(this, t,
|
|
902
|
+
for (const a of this.gestures) {
|
|
903
|
+
const u = this.config[a], h = yt(n, u.eventOptions, !!s);
|
|
904
|
+
if (u.enabled) {
|
|
905
|
+
const p = xt.get(a);
|
|
906
|
+
new p(this, t, a).bind(h);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
909
|
const o = yt(n, e.eventOptions, !!s);
|
|
910
|
-
for (const
|
|
911
|
-
o(
|
|
912
|
-
event:
|
|
910
|
+
for (const a in this.nativeHandlers)
|
|
911
|
+
o(a, "", (u) => this.nativeHandlers[a](d(d({}, this.state.shared), {}, {
|
|
912
|
+
event: u,
|
|
913
913
|
args: t
|
|
914
914
|
})), void 0, !0);
|
|
915
915
|
}
|
|
@@ -918,33 +918,33 @@ class we {
|
|
|
918
918
|
if (!s) return n;
|
|
919
919
|
for (const o in n) {
|
|
920
920
|
const {
|
|
921
|
-
device:
|
|
922
|
-
capture:
|
|
923
|
-
passive:
|
|
921
|
+
device: a,
|
|
922
|
+
capture: u,
|
|
923
|
+
passive: h
|
|
924
924
|
} = Bt(o);
|
|
925
|
-
this._targetEventStore.add(s,
|
|
926
|
-
capture:
|
|
927
|
-
passive:
|
|
925
|
+
this._targetEventStore.add(s, a, "", n[o], {
|
|
926
|
+
capture: u,
|
|
927
|
+
passive: h
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function M(r, t) {
|
|
934
934
|
r.gestures.add(t), r.gestureEventStores[t] = new It(r, t), r.gestureTimeoutStores[t] = new be();
|
|
935
935
|
}
|
|
936
936
|
function Ee(r, t) {
|
|
937
|
-
t.drag &&
|
|
937
|
+
t.drag && M(r, "drag"), t.wheel && M(r, "wheel"), t.scroll && M(r, "scroll"), t.move && M(r, "move"), t.pinch && M(r, "pinch"), t.hover && M(r, "hover");
|
|
938
938
|
}
|
|
939
|
-
const yt = (r, t, e) => (n, s, o,
|
|
940
|
-
var
|
|
941
|
-
const
|
|
942
|
-
let m =
|
|
943
|
-
e &&
|
|
939
|
+
const yt = (r, t, e) => (n, s, o, a = {}, u = !1) => {
|
|
940
|
+
var h, p;
|
|
941
|
+
const c = (h = a.capture) !== null && h !== void 0 ? h : t.capture, b = (p = a.passive) !== null && p !== void 0 ? p : t.passive;
|
|
942
|
+
let m = u ? n : Ut(n, s, c);
|
|
943
|
+
e && b && (m += "Passive"), r[m] = r[m] || [], r[m].push(o);
|
|
944
944
|
};
|
|
945
945
|
function Te(r, t = {}, e, n) {
|
|
946
|
-
const s =
|
|
947
|
-
if (s.applyHandlers(r, n), s.applyConfig(t, e),
|
|
946
|
+
const s = q.useMemo(() => new we(r), []);
|
|
947
|
+
if (s.applyHandlers(r, n), s.applyConfig(t, e), q.useEffect(s.effect.bind(s)), q.useEffect(() => s.clean.bind(s), []), t.target === void 0)
|
|
948
948
|
return s.bind.bind(s);
|
|
949
949
|
}
|
|
950
950
|
function xe(r, t) {
|
|
@@ -952,20 +952,20 @@ function xe(r, t) {
|
|
|
952
952
|
drag: r
|
|
953
953
|
}, t || {}, "drag");
|
|
954
954
|
}
|
|
955
|
-
const
|
|
955
|
+
const Q = "RSC::Event";
|
|
956
956
|
function Ie() {
|
|
957
|
-
const r =
|
|
957
|
+
const r = k(null);
|
|
958
958
|
function t(n) {
|
|
959
|
-
|
|
959
|
+
Z(() => {
|
|
960
960
|
r.current || (r.current = document.createElement("div"));
|
|
961
961
|
function s(o) {
|
|
962
962
|
n(o.detail);
|
|
963
963
|
}
|
|
964
964
|
if (r.current)
|
|
965
|
-
return r.current.addEventListener(
|
|
965
|
+
return r.current.addEventListener(Q, s, !1), () => {
|
|
966
966
|
var o;
|
|
967
967
|
(o = r.current) == null || o.removeEventListener(
|
|
968
|
-
|
|
968
|
+
Q,
|
|
969
969
|
s,
|
|
970
970
|
!1
|
|
971
971
|
);
|
|
@@ -974,7 +974,7 @@ function Ie() {
|
|
|
974
974
|
}
|
|
975
975
|
function e(n) {
|
|
976
976
|
if (r.current) {
|
|
977
|
-
const s = new CustomEvent(
|
|
977
|
+
const s = new CustomEvent(Q, {
|
|
978
978
|
detail: n
|
|
979
979
|
});
|
|
980
980
|
r.current.dispatchEvent(s);
|
|
@@ -991,20 +991,19 @@ function Oe({
|
|
|
991
991
|
withLoop: e = !1,
|
|
992
992
|
id: n,
|
|
993
993
|
itemsPerSlide: s = 1,
|
|
994
|
-
|
|
995
|
-
startEndGutter: c = 0,
|
|
994
|
+
responsiveGutter: o = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
|
|
996
995
|
carouselAxis: a = "x",
|
|
997
|
-
startingPosition:
|
|
998
|
-
enableGestures:
|
|
999
|
-
slideWhenDragThresholdIsReached:
|
|
1000
|
-
onInit:
|
|
1001
|
-
initialActiveItem:
|
|
996
|
+
startingPosition: u = "start",
|
|
997
|
+
enableGestures: h = !0,
|
|
998
|
+
slideWhenDragThresholdIsReached: p = !0,
|
|
999
|
+
onInit: c,
|
|
1000
|
+
initialActiveItem: b = 0
|
|
1002
1001
|
}) {
|
|
1003
|
-
const [
|
|
1002
|
+
const [m, $] = Pt(!1), D = k(r), S = k(null), A = k(null), P = k(0), x = k(0), C = k(!e), O = k(!1), R = k(0), l = k(0), [L, G] = $t(
|
|
1004
1003
|
() => ({
|
|
1005
1004
|
value: 0,
|
|
1006
1005
|
onChange({ value: i }) {
|
|
1007
|
-
|
|
1006
|
+
S.current.style.setProperty(
|
|
1008
1007
|
`--${n}-offset-position`,
|
|
1009
1008
|
`${i.value}px`
|
|
1010
1009
|
);
|
|
@@ -1023,128 +1022,138 @@ function Oe({
|
|
|
1023
1022
|
id: `next-repeated-item-${i.id}`,
|
|
1024
1023
|
isClonedItem: !0
|
|
1025
1024
|
}))
|
|
1026
|
-
] : t, { useListenToCustomEvent:
|
|
1027
|
-
function
|
|
1028
|
-
|
|
1025
|
+
] : t, { useListenToCustomEvent: rt, emitEvent: U } = Ie();
|
|
1026
|
+
function kt() {
|
|
1027
|
+
const { totalGutterCssVar: i } = nt();
|
|
1028
|
+
return i;
|
|
1029
|
+
}
|
|
1030
|
+
function F(i) {
|
|
1031
|
+
D.current && (O.current || N({
|
|
1029
1032
|
type: "next",
|
|
1030
1033
|
toIndex: i,
|
|
1031
1034
|
actionType: "click"
|
|
1032
1035
|
}));
|
|
1033
1036
|
}
|
|
1034
|
-
function
|
|
1035
|
-
|
|
1037
|
+
function W(i) {
|
|
1038
|
+
D.current && (C.current || N({
|
|
1036
1039
|
type: "prev",
|
|
1037
1040
|
toIndex: i,
|
|
1038
1041
|
actionType: "click"
|
|
1039
1042
|
}));
|
|
1040
1043
|
}
|
|
1041
|
-
function
|
|
1044
|
+
function N({
|
|
1042
1045
|
type: i,
|
|
1043
1046
|
shouldAnimate: f = !0,
|
|
1044
|
-
toIndex:
|
|
1045
|
-
actionType:
|
|
1047
|
+
toIndex: v,
|
|
1048
|
+
actionType: g
|
|
1046
1049
|
}) {
|
|
1047
1050
|
var it, ot;
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
let
|
|
1051
|
-
if (i === "next" && (l.current += 1), i === "prev" && (l.current === 0 ? l.current = t.length - 1 : l.current -= 1),
|
|
1052
|
-
const K =
|
|
1053
|
-
e ?
|
|
1051
|
+
const _ = !f;
|
|
1052
|
+
C.current = !1, O.current = !1;
|
|
1053
|
+
let E = L.value.get(), T = 0;
|
|
1054
|
+
if (i === "next" && (l.current += 1), i === "prev" && (l.current === 0 ? l.current = t.length - 1 : l.current -= 1), v !== void 0 && (l.current = v), i === "next") {
|
|
1055
|
+
const K = H(
|
|
1056
|
+
e ? x.current * (t.length * 2) : 0
|
|
1054
1057
|
);
|
|
1055
|
-
|
|
1058
|
+
T = -(l.current * x.current), e && l.current === t.length && (l.current = 0, E = E + x.current * t.length, T = 0), !e && Math.abs(T) >= K && (O.current = !0, T = -K);
|
|
1056
1059
|
}
|
|
1057
|
-
i === "prev" && (
|
|
1060
|
+
i === "prev" && (T = -(l.current * x.current), l.current === t.length - 1 && (E = E - t.length * x.current), !e && T >= 0 && (C.current = !0, T = 0)), P.current = T, g === "resize" ? (T = -(l.current * x.current), U({
|
|
1058
1061
|
eventName: "onResize",
|
|
1059
|
-
sliceActionType:
|
|
1062
|
+
sliceActionType: g,
|
|
1060
1063
|
slideDirection: i,
|
|
1061
1064
|
currentItem: {
|
|
1062
1065
|
index: l.current,
|
|
1063
1066
|
id: ((it = t.at(l.current)) == null ? void 0 : it.id) ?? "",
|
|
1064
|
-
startReached:
|
|
1065
|
-
endReached:
|
|
1067
|
+
startReached: C.current,
|
|
1068
|
+
endReached: O.current
|
|
1066
1069
|
}
|
|
1067
1070
|
})) : U({
|
|
1068
1071
|
eventName: "onSlideStartChange",
|
|
1069
|
-
sliceActionType:
|
|
1072
|
+
sliceActionType: g,
|
|
1070
1073
|
slideDirection: i,
|
|
1071
1074
|
nextItem: {
|
|
1072
1075
|
index: l.current,
|
|
1073
1076
|
id: ((ot = t.at(l.current)) == null ? void 0 : ot.id) ?? "",
|
|
1074
|
-
startReached:
|
|
1075
|
-
endReached:
|
|
1077
|
+
startReached: C.current,
|
|
1078
|
+
endReached: O.current
|
|
1076
1079
|
}
|
|
1077
|
-
}),
|
|
1078
|
-
immediate:
|
|
1080
|
+
}), G.start({
|
|
1081
|
+
immediate: _,
|
|
1079
1082
|
from: {
|
|
1080
|
-
value:
|
|
1083
|
+
value: E
|
|
1081
1084
|
},
|
|
1082
1085
|
to: {
|
|
1083
|
-
value:
|
|
1086
|
+
value: T
|
|
1084
1087
|
},
|
|
1085
1088
|
onRest({ finished: K }) {
|
|
1086
1089
|
var at;
|
|
1087
1090
|
K && U({
|
|
1088
1091
|
eventName: "onSlideChangeComplete",
|
|
1089
|
-
sliceActionType:
|
|
1092
|
+
sliceActionType: g,
|
|
1090
1093
|
slideDirection: i,
|
|
1091
1094
|
currentItem: {
|
|
1092
1095
|
index: l.current,
|
|
1093
1096
|
id: ((at = t.at(l.current)) == null ? void 0 : at.id) ?? "",
|
|
1094
|
-
startReached:
|
|
1095
|
-
endReached:
|
|
1097
|
+
startReached: C.current,
|
|
1098
|
+
endReached: O.current
|
|
1096
1099
|
}
|
|
1097
1100
|
});
|
|
1098
1101
|
}
|
|
1099
1102
|
});
|
|
1100
1103
|
}
|
|
1101
1104
|
function Dt() {
|
|
1102
|
-
const i =
|
|
1105
|
+
const i = A.current.children[0];
|
|
1103
1106
|
let f = 0;
|
|
1104
|
-
return f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] +
|
|
1107
|
+
return f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + kt(), f;
|
|
1105
1108
|
}
|
|
1106
|
-
function
|
|
1107
|
-
const f =
|
|
1109
|
+
function H(i) {
|
|
1110
|
+
const f = A.current;
|
|
1108
1111
|
return f[a === "x" ? "scrollWidth" : "scrollHeight"] - f.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
|
|
1109
1112
|
}
|
|
1110
|
-
function
|
|
1111
|
-
let i = 0;
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1113
|
+
function nt() {
|
|
1114
|
+
let i = 0, f = 0;
|
|
1115
|
+
if (S.current) {
|
|
1116
|
+
const v = window.getComputedStyle(
|
|
1117
|
+
S.current
|
|
1118
|
+
), g = v.getPropertyValue(`--${n}-start-end-gutter`).trim();
|
|
1119
|
+
g.includes("px") && (i = Number(
|
|
1120
|
+
g.replace("px", "")
|
|
1121
|
+
));
|
|
1122
|
+
const _ = v.getPropertyValue(`--${n}-gutter`).trim();
|
|
1123
|
+
_.includes("px") && (f = Number(_.replace("px", "")));
|
|
1124
|
+
}
|
|
1125
|
+
return { totalStartEndGutterCssVar: i, totalGutterCssVar: f };
|
|
1126
|
+
}
|
|
1127
|
+
Z(() => {
|
|
1128
|
+
function i(g, _) {
|
|
1129
|
+
switch (g) {
|
|
1122
1130
|
case "start":
|
|
1123
1131
|
return 0;
|
|
1124
1132
|
case "middle-start":
|
|
1125
|
-
return Math.floor((
|
|
1133
|
+
return Math.floor((_ - 1) * 0.25);
|
|
1126
1134
|
case "center":
|
|
1127
|
-
return Math.floor((
|
|
1135
|
+
return Math.floor((_ - 1) * 0.5);
|
|
1128
1136
|
case "middle-end":
|
|
1129
|
-
return Math.floor((
|
|
1137
|
+
return Math.floor((_ - 1) * 0.75);
|
|
1130
1138
|
case "end":
|
|
1131
|
-
return
|
|
1139
|
+
return _ - 1;
|
|
1132
1140
|
default:
|
|
1133
1141
|
return 0;
|
|
1134
1142
|
}
|
|
1135
1143
|
}
|
|
1136
|
-
function f(
|
|
1137
|
-
if (
|
|
1138
|
-
const { totalStartEndGutterCssVar:
|
|
1139
|
-
|
|
1140
|
-
|
|
1144
|
+
function f(g) {
|
|
1145
|
+
if (x.current = Dt(), R.current = x.current / 4, S.current) {
|
|
1146
|
+
const { totalStartEndGutterCssVar: _ } = nt();
|
|
1147
|
+
console.log({ totalStartEndGutterCssVar: _ });
|
|
1148
|
+
let E = 0;
|
|
1149
|
+
e && (E = x.current * t.length), E -= x.current * i(u, s), E -= _ / 2, S.current.style.setProperty(
|
|
1141
1150
|
`--${n}-offset-modifier`,
|
|
1142
|
-
`${-
|
|
1143
|
-
),
|
|
1151
|
+
`${-E}px`
|
|
1152
|
+
), $(!0), g && g();
|
|
1144
1153
|
}
|
|
1145
1154
|
}
|
|
1146
|
-
function
|
|
1147
|
-
|
|
1155
|
+
function v() {
|
|
1156
|
+
f(), N({
|
|
1148
1157
|
type: "resize",
|
|
1149
1158
|
toIndex: l.current,
|
|
1150
1159
|
shouldAnimate: !1,
|
|
@@ -1152,42 +1161,42 @@ function Oe({
|
|
|
1152
1161
|
});
|
|
1153
1162
|
}
|
|
1154
1163
|
if (r)
|
|
1155
|
-
return
|
|
1156
|
-
window.removeEventListener("resize",
|
|
1164
|
+
return D.current = !0, f(c), window.addEventListener("resize", v), () => {
|
|
1165
|
+
window.removeEventListener("resize", v);
|
|
1157
1166
|
};
|
|
1158
|
-
}, [r, e, n, a, o,
|
|
1159
|
-
r &&
|
|
1167
|
+
}, [r, e, n, a, o, u]), Z(() => {
|
|
1168
|
+
r && b !== l.current && N({
|
|
1160
1169
|
type: "next",
|
|
1161
|
-
toIndex:
|
|
1170
|
+
toIndex: b,
|
|
1162
1171
|
actionType: "resize",
|
|
1163
1172
|
shouldAnimate: !1
|
|
1164
1173
|
});
|
|
1165
|
-
}, [r,
|
|
1166
|
-
const st =
|
|
1174
|
+
}, [r, b]);
|
|
1175
|
+
const st = h, Ct = xe(
|
|
1167
1176
|
(i) => {
|
|
1168
|
-
if (!
|
|
1177
|
+
if (!D.current)
|
|
1169
1178
|
return;
|
|
1170
|
-
const f = i.dragging,
|
|
1179
|
+
const f = i.dragging, v = i.offset[a === "x" ? 0 : 1], g = i.movement[a === "x" ? 0 : 1], _ = g > R.current, E = g < -R.current, T = i.velocity;
|
|
1171
1180
|
f && (U({
|
|
1172
1181
|
...i,
|
|
1173
1182
|
eventName: "onDrag",
|
|
1174
1183
|
slideActionType: "drag"
|
|
1175
|
-
}),
|
|
1176
|
-
value:
|
|
1184
|
+
}), G.start({
|
|
1185
|
+
value: v,
|
|
1177
1186
|
immediate: !0,
|
|
1178
1187
|
config: {
|
|
1179
|
-
velocity:
|
|
1188
|
+
velocity: T
|
|
1180
1189
|
}
|
|
1181
|
-
}),
|
|
1190
|
+
}), p && (_ || E) && i.cancel()), i.last && (_ ? (N({
|
|
1182
1191
|
actionType: "drag",
|
|
1183
1192
|
type: "prev"
|
|
1184
|
-
}), i.cancel()) :
|
|
1193
|
+
}), i.cancel()) : E ? (N({
|
|
1185
1194
|
actionType: "drag",
|
|
1186
1195
|
type: "next"
|
|
1187
|
-
}), i.cancel()) : (
|
|
1188
|
-
value:
|
|
1196
|
+
}), i.cancel()) : (G.start({
|
|
1197
|
+
value: P.current,
|
|
1189
1198
|
config: {
|
|
1190
|
-
velocity:
|
|
1199
|
+
velocity: T
|
|
1191
1200
|
}
|
|
1192
1201
|
}), i.cancel()));
|
|
1193
1202
|
},
|
|
@@ -1198,37 +1207,33 @@ function Oe({
|
|
|
1198
1207
|
...e ? {} : {
|
|
1199
1208
|
bounds: () => ({
|
|
1200
1209
|
right: 0,
|
|
1201
|
-
left: -
|
|
1202
|
-
top: -
|
|
1210
|
+
left: -H(0),
|
|
1211
|
+
top: -H(0),
|
|
1203
1212
|
bottom: 0
|
|
1204
1213
|
})
|
|
1205
1214
|
},
|
|
1206
|
-
from: () => [
|
|
1215
|
+
from: () => [L.value.get(), L.value.get()]
|
|
1207
1216
|
}
|
|
1208
1217
|
);
|
|
1209
1218
|
function Ot(i) {
|
|
1210
|
-
var f,
|
|
1211
|
-
return typeof i == "number" ? l.current === i : ((f = t.find((
|
|
1219
|
+
var f, v;
|
|
1220
|
+
return typeof i == "number" ? l.current === i : ((f = t.find((g) => g.id === i)) == null ? void 0 : f.id) === ((v = t[l.current]) == null ? void 0 : v.id);
|
|
1212
1221
|
}
|
|
1213
1222
|
return {
|
|
1214
1223
|
carouselFragment: /* @__PURE__ */ At(
|
|
1215
1224
|
"div",
|
|
1216
1225
|
{
|
|
1217
|
-
ref:
|
|
1226
|
+
ref: S,
|
|
1218
1227
|
className: "ReactSpringCarouselContainer",
|
|
1219
1228
|
"data-part": "Container",
|
|
1220
1229
|
"data-part-internal": `${n}-Container`,
|
|
1221
1230
|
...Ct(),
|
|
1222
1231
|
children: [
|
|
1223
|
-
/* @__PURE__ */
|
|
1232
|
+
/* @__PURE__ */ X(
|
|
1224
1233
|
"style",
|
|
1225
1234
|
{
|
|
1226
1235
|
dangerouslySetInnerHTML: {
|
|
1227
1236
|
__html: `
|
|
1228
|
-
:root {
|
|
1229
|
-
--${n}-start-end-gutter: ${c * 2}px;
|
|
1230
|
-
--${n}-gutter: ${o}px;
|
|
1231
|
-
}
|
|
1232
1237
|
[data-part-internal="${n}-Container"] {
|
|
1233
1238
|
display: flex;
|
|
1234
1239
|
width: 100%;
|
|
@@ -1239,16 +1244,14 @@ function Oe({
|
|
|
1239
1244
|
--${n}-offset-modifier: 0px;
|
|
1240
1245
|
--${n}-scroll-x-value: ${a === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1241
1246
|
--${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1242
|
-
|
|
1247
|
+
touch-action: ${st ? a === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1243
1248
|
}
|
|
1244
1249
|
[data-part-internal="${n}-Track"] {
|
|
1245
1250
|
display: flex;
|
|
1246
1251
|
position: relative;
|
|
1247
1252
|
--initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${t.length} * ${s}) + var(--${n}-start-end-gutter)) * ${t.length} / ${s});
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
left: ${e && a === "x" && !P ? "var(--initial-offset-modifier)" : "0px"};
|
|
1251
|
-
top: ${e && a === "y" && !P ? "var(--initial-offset-modifier)" : "0px"};
|
|
1253
|
+
left: ${e && a === "x" && !m ? "var(--initial-offset-modifier)" : "0px"};
|
|
1254
|
+
top: ${e && a === "y" && !m ? "var(--initial-offset-modifier)" : "0px"};
|
|
1252
1255
|
flex-direction: ${a === "x" ? "row" : "column"};
|
|
1253
1256
|
width: 100%;
|
|
1254
1257
|
height: 100%;
|
|
@@ -1259,21 +1262,31 @@ function Oe({
|
|
|
1259
1262
|
display: flex;
|
|
1260
1263
|
flex: 1 0 calc(100% / var(--${n}-items-per-slide) - calc(var(--${n}-gutter) * (var(--${n}-items-per-slide) - 1)) / var(--${n}-items-per-slide) - calc(var(--${n}-start-end-gutter) / var(--${n}-items-per-slide)))
|
|
1261
1264
|
}
|
|
1265
|
+
${o && o.length > 0 ? o.sort((i, f) => i.breakpoint - f.breakpoint).map(
|
|
1266
|
+
(i) => `
|
|
1267
|
+
@media (min-width: ${i.breakpoint}px) {
|
|
1268
|
+
[data-part-internal="${n}-Container"] {
|
|
1269
|
+
--${n}-gutter: ${i.gutter || 0}px;
|
|
1270
|
+
--${n}-start-end-gutter: ${(i.startEndGutter || 0) * 2}px;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
`
|
|
1274
|
+
).join("") : ""}
|
|
1262
1275
|
`
|
|
1263
1276
|
}
|
|
1264
1277
|
}
|
|
1265
1278
|
),
|
|
1266
|
-
/* @__PURE__ */
|
|
1279
|
+
/* @__PURE__ */ X(
|
|
1267
1280
|
"div",
|
|
1268
1281
|
{
|
|
1269
|
-
ref:
|
|
1282
|
+
ref: A,
|
|
1270
1283
|
className: "ReactSpringCarouselTrack",
|
|
1271
1284
|
"data-part": "Track",
|
|
1272
1285
|
"data-part-internal": `${n}-Track`,
|
|
1273
1286
|
onScroll: () => {
|
|
1274
|
-
|
|
1287
|
+
C.current = !1, O.current = !1;
|
|
1275
1288
|
},
|
|
1276
|
-
children: St.map((i, f) => /* @__PURE__ */
|
|
1289
|
+
children: St.map((i, f) => /* @__PURE__ */ X(
|
|
1277
1290
|
"div",
|
|
1278
1291
|
{
|
|
1279
1292
|
className: "ReactSpringCarouselItem",
|
|
@@ -1281,7 +1294,7 @@ function Oe({
|
|
|
1281
1294
|
"data-part-internal": `${n}-Item`,
|
|
1282
1295
|
"data-id": i.id,
|
|
1283
1296
|
children: typeof i.renderItem == "function" ? i.renderItem({
|
|
1284
|
-
useListenToCustomEvent:
|
|
1297
|
+
useListenToCustomEvent: rt,
|
|
1285
1298
|
index: f,
|
|
1286
1299
|
isClonedItem: !!i.isClonedItem,
|
|
1287
1300
|
isActiveItem: Ot
|
|
@@ -1294,9 +1307,9 @@ function Oe({
|
|
|
1294
1307
|
]
|
|
1295
1308
|
}
|
|
1296
1309
|
),
|
|
1297
|
-
useListenToCustomEvent:
|
|
1298
|
-
slideToNextItem: () =>
|
|
1299
|
-
slideToPrevItem: () =>
|
|
1310
|
+
useListenToCustomEvent: rt,
|
|
1311
|
+
slideToNextItem: () => F(),
|
|
1312
|
+
slideToPrevItem: () => W(),
|
|
1300
1313
|
slideToItem: (i) => {
|
|
1301
1314
|
if (typeof i == "number") {
|
|
1302
1315
|
if (!t[i]) {
|
|
@@ -1305,17 +1318,17 @@ function Oe({
|
|
|
1305
1318
|
);
|
|
1306
1319
|
return;
|
|
1307
1320
|
}
|
|
1308
|
-
i > l.current ?
|
|
1321
|
+
i > l.current ? F(i) : W(i);
|
|
1309
1322
|
}
|
|
1310
1323
|
if (typeof i == "string") {
|
|
1311
|
-
const f = t.findIndex((
|
|
1324
|
+
const f = t.findIndex((v) => v.id === i);
|
|
1312
1325
|
if (f < 0) {
|
|
1313
1326
|
console.warn(
|
|
1314
1327
|
`The item you're trying to slide doesn't exist. id: ${i}`
|
|
1315
1328
|
);
|
|
1316
1329
|
return;
|
|
1317
1330
|
}
|
|
1318
|
-
f > l.current ?
|
|
1331
|
+
f > l.current ? F(f) : W(f);
|
|
1319
1332
|
}
|
|
1320
1333
|
}
|
|
1321
1334
|
};
|