react-spring-carousel 3.0.0-beta-2.0.189 → 3.0.0-beta-2.0.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 +286 -291
- package/dist/index.umd.js +8 -8
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as At, jsx as Q } from "react/jsx-runtime";
|
|
2
2
|
import { useSpring as $t } from "@react-spring/web";
|
|
3
|
-
import Z, { useRef as
|
|
4
|
-
function
|
|
3
|
+
import Z, { useRef as A, useEffect as _t, useState as Pt } from "react";
|
|
4
|
+
function Nt(r, t, e) {
|
|
5
5
|
return Math.max(t, Math.min(r, e));
|
|
6
6
|
}
|
|
7
7
|
const v = {
|
|
@@ -25,11 +25,11 @@ function ct(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
27
|
function ut(r, t, e, n = 0.15) {
|
|
28
|
-
return n === 0 ?
|
|
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
|
-
function
|
|
31
|
-
const [[
|
|
32
|
-
return [ut(t,
|
|
30
|
+
function Mt(r, [t, e], [n, s]) {
|
|
31
|
+
const [[o, c], [a, u]] = r;
|
|
32
|
+
return [ut(t, o, c, n), ut(e, a, u, s)];
|
|
33
33
|
}
|
|
34
34
|
function Rt(r, t) {
|
|
35
35
|
if (typeof r != "object" || r === null) return r;
|
|
@@ -41,12 +41,12 @@ function Rt(r, t) {
|
|
|
41
41
|
}
|
|
42
42
|
return (t === "string" ? String : Number)(r);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Lt(r) {
|
|
45
45
|
var t = Rt(r, "string");
|
|
46
46
|
return typeof t == "symbol" ? t : String(t);
|
|
47
47
|
}
|
|
48
48
|
function w(r, t, e) {
|
|
49
|
-
return t =
|
|
49
|
+
return t = Lt(t), t in r ? Object.defineProperty(r, t, {
|
|
50
50
|
value: e,
|
|
51
51
|
enumerable: !0,
|
|
52
52
|
configurable: !0,
|
|
@@ -99,27 +99,27 @@ const bt = {
|
|
|
99
99
|
function lt(r) {
|
|
100
100
|
return r ? r[0].toUpperCase() + r.slice(1) : "";
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return r && !
|
|
102
|
+
const Vt = ["enter", "leave"];
|
|
103
|
+
function jt(r = !1, t) {
|
|
104
|
+
return r && !Vt.includes(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Ut(r, t = "", e = !1) {
|
|
107
107
|
const n = bt[r], s = n && n[t] || t;
|
|
108
|
-
return "on" + lt(r) + lt(s) + (
|
|
108
|
+
return "on" + lt(r) + lt(s) + (jt(e, s) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const Kt = ["gotpointercapture", "lostpointercapture"];
|
|
111
|
+
function Bt(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 = Kt.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
|
|
122
|
+
function zt(r, t = "") {
|
|
123
123
|
const e = bt[r], n = e && e[t] || t;
|
|
124
124
|
return r + n;
|
|
125
125
|
}
|
|
@@ -129,20 +129,20 @@ function H(r) {
|
|
|
129
129
|
function wt(r) {
|
|
130
130
|
return H(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Wt(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 Yt(r) {
|
|
139
139
|
return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
|
|
140
140
|
}
|
|
141
141
|
function Et(r) {
|
|
142
|
-
return H(r) ?
|
|
142
|
+
return H(r) ? Yt(r)[0] : r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function Ft(r) {
|
|
145
|
+
return Wt(r).map((t) => t.identifier);
|
|
146
146
|
}
|
|
147
147
|
function tt(r) {
|
|
148
148
|
const t = Et(r);
|
|
@@ -152,20 +152,20 @@ function dt(r) {
|
|
|
152
152
|
const t = Et(r);
|
|
153
153
|
return [t.clientX, t.clientY];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Ht(r) {
|
|
156
156
|
const t = {};
|
|
157
157
|
if ("buttons" in r && (t.buttons = r.buttons), "shiftKey" in r) {
|
|
158
158
|
const {
|
|
159
159
|
shiftKey: e,
|
|
160
160
|
altKey: n,
|
|
161
161
|
metaKey: s,
|
|
162
|
-
ctrlKey:
|
|
162
|
+
ctrlKey: o
|
|
163
163
|
} = r;
|
|
164
164
|
Object.assign(t, {
|
|
165
165
|
shiftKey: e,
|
|
166
166
|
altKey: n,
|
|
167
167
|
metaKey: s,
|
|
168
|
-
ctrlKey:
|
|
168
|
+
ctrlKey: o
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
return t;
|
|
@@ -173,10 +173,10 @@ function Ft(r) {
|
|
|
173
173
|
function F(r, ...t) {
|
|
174
174
|
return typeof r == "function" ? r(...t) : r;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Gt() {
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return r.length === 0 ?
|
|
178
|
+
function Xt(...r) {
|
|
179
|
+
return r.length === 0 ? Gt : 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;
|
|
@@ -186,8 +186,8 @@ function Gt(...r) {
|
|
|
186
186
|
function ht(r, t) {
|
|
187
187
|
return Object.assign({}, t, r || {});
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
class
|
|
189
|
+
const qt = 32;
|
|
190
|
+
class Jt {
|
|
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
|
}
|
|
@@ -243,33 +243,33 @@ class qt {
|
|
|
243
243
|
shared: s
|
|
244
244
|
} = this;
|
|
245
245
|
e.args = this.args;
|
|
246
|
-
let
|
|
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,
|
|
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, Ht(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
248
|
const l = e._delta.map(Math.abs);
|
|
249
249
|
v.addTo(e._distance, l);
|
|
250
250
|
}
|
|
251
251
|
this.axisIntent && this.axisIntent(t);
|
|
252
|
-
const [
|
|
252
|
+
const [c, a] = e._movement, [u, p] = n.threshold, {
|
|
253
253
|
_step: f,
|
|
254
254
|
values: x
|
|
255
255
|
} = e;
|
|
256
|
-
if (n.hasCustomTransform ? (f[0] === !1 && (f[0] = Math.abs(
|
|
257
|
-
const
|
|
256
|
+
if (n.hasCustomTransform ? (f[0] === !1 && (f[0] = Math.abs(c) >= u && x[0]), f[1] === !1 && (f[1] = Math.abs(a) >= p && x[1])) : (f[0] === !1 && (f[0] = Math.abs(c) >= u && Math.sign(c) * u), f[1] === !1 && (f[1] = Math.abs(a) >= p && Math.sign(a) * p)), e.intentional = f[0] !== !1 || f[1] !== !1, !e.intentional) return;
|
|
257
|
+
const y = [0, 0];
|
|
258
258
|
if (n.hasCustomTransform) {
|
|
259
|
-
const [l,
|
|
260
|
-
|
|
259
|
+
const [l, M] = x;
|
|
260
|
+
y[0] = f[0] !== !1 ? l - f[0] : 0, y[1] = f[1] !== !1 ? M - f[1] : 0;
|
|
261
261
|
} else
|
|
262
|
-
|
|
263
|
-
this.restrictToAxis && !e._blocked && this.restrictToAxis(
|
|
262
|
+
y[0] = f[0] !== !1 ? c - f[0] : 0, y[1] = f[1] !== !1 ? a - f[1] : 0;
|
|
263
|
+
this.restrictToAxis && !e._blocked && this.restrictToAxis(y);
|
|
264
264
|
const P = e.offset, N = e._active && !e._blocked || e.active;
|
|
265
|
-
N && (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 = F(n.bounds, e)), this.setup && this.setup()), e.movement =
|
|
266
|
-
const [
|
|
267
|
-
e.overflow = [
|
|
265
|
+
N && (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 = F(n.bounds, e)), this.setup && this.setup()), e.movement = y, this.computeOffset()));
|
|
266
|
+
const [$, C] = e.offset, [[_, B], [I, T]] = e._bounds;
|
|
267
|
+
e.overflow = [$ < _ ? -1 : $ > B ? 1 : 0, C < I ? -1 : C > T ? 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
268
|
const V = e._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
-
if (e.offset =
|
|
269
|
+
if (e.offset = Mt(e._bounds, e.offset, V), e.delta = v.sub(e.offset, P), this.computeMovement(), N && (!e.last || o > qt)) {
|
|
270
270
|
e.delta = v.sub(e.offset, P);
|
|
271
271
|
const l = e.delta.map(Math.abs);
|
|
272
|
-
v.addTo(e.distance, l), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first &&
|
|
272
|
+
v.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() {
|
|
@@ -284,14 +284,14 @@ class qt {
|
|
|
284
284
|
this.eventStore.clean(), this.timeoutStore.clean();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Qt([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 Zt extends Jt {
|
|
295
295
|
constructor(...t) {
|
|
296
296
|
super(...t), w(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
@@ -311,7 +311,7 @@ class Qt extends qt {
|
|
|
311
311
|
const e = this.state, n = this.config;
|
|
312
312
|
if (!e.axis && t) {
|
|
313
313
|
const s = typeof n.axisThreshold == "object" ? n.axisThreshold[wt(t)] : n.axisThreshold;
|
|
314
|
-
e.axis =
|
|
314
|
+
e.axis = Qt(e._movement, s);
|
|
315
315
|
}
|
|
316
316
|
e._blocked = (n.lockDirection || !!n.axis) && !e.axis || !!n.axis && n.axis !== e.axis;
|
|
317
317
|
}
|
|
@@ -358,9 +358,9 @@ const pt = (r) => r, mt = 0.15, nt = {
|
|
|
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
|
-
return (
|
|
362
|
-
const
|
|
363
|
-
return (!isFinite(
|
|
361
|
+
return (o) => {
|
|
362
|
+
const c = s(o);
|
|
363
|
+
return (!isFinite(c[0]) || !isFinite(c[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${c[0]},${[1]}]`), c;
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
return n || pt;
|
|
@@ -386,18 +386,18 @@ process.env.NODE_ENV === "development" && Object.assign(nt, {
|
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const
|
|
389
|
+
const te = 0, U = h(h({}, nt), {}, {
|
|
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 = te) {
|
|
396
396
|
return r;
|
|
397
397
|
},
|
|
398
398
|
bounds(r = {}) {
|
|
399
399
|
if (typeof r == "function")
|
|
400
|
-
return (
|
|
400
|
+
return (o) => U.bounds(r(o));
|
|
401
401
|
if ("current" in r)
|
|
402
402
|
return () => r.current;
|
|
403
403
|
if (typeof HTMLElement == "function" && r instanceof HTMLElement)
|
|
@@ -416,7 +416,7 @@ const Zt = 0, K = h(h({}, nt), {}, {
|
|
|
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 ee extends Zt {
|
|
420
420
|
constructor(...t) {
|
|
421
421
|
super(...t), w(this, "ingKey", "dragging");
|
|
422
422
|
}
|
|
@@ -434,7 +434,7 @@ class te extends Qt {
|
|
|
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 = U.bounds(s);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
cancel() {
|
|
@@ -464,8 +464,8 @@ class te extends Qt {
|
|
|
464
464
|
if (!e._pointerActive) return;
|
|
465
465
|
const s = tt(t);
|
|
466
466
|
if (e._pointerId !== void 0 && s !== e._pointerId) return;
|
|
467
|
-
const
|
|
468
|
-
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = v.sub(
|
|
467
|
+
const o = dt(t);
|
|
468
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = v.sub(o, e._values), this.computeValues(o)), v.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
|
}
|
|
@@ -494,14 +494,14 @@ class te extends Qt {
|
|
|
494
494
|
const s = tt(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 [
|
|
498
|
-
if (e.tap =
|
|
497
|
+
const [o, c] = e._distance;
|
|
498
|
+
if (e.tap = o <= n.tapsThreshold && c <= n.tapsThreshold, e.tap && n.filterTaps)
|
|
499
499
|
e._force = !0;
|
|
500
500
|
else {
|
|
501
|
-
const [a,
|
|
502
|
-
if (e.elapsedTime <
|
|
503
|
-
const C = Math.abs(a / e.timeDelta),
|
|
504
|
-
C > x && Math.abs(p) > P && (e.swipe[0] = Math.sign(a)),
|
|
501
|
+
const [a, u] = e._delta, [p, f] = e._movement, [x, y] = n.swipe.velocity, [P, N] = n.swipe.distance, $ = n.swipe.duration;
|
|
502
|
+
if (e.elapsedTime < $) {
|
|
503
|
+
const C = Math.abs(a / e.timeDelta), _ = Math.abs(u / e.timeDelta);
|
|
504
|
+
C > x && Math.abs(p) > P && (e.swipe[0] = Math.sign(a)), _ > y && Math.abs(f) > N && (e.swipe[1] = Math.sign(u));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -528,7 +528,7 @@ class te extends Qt {
|
|
|
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, re(t);
|
|
532
532
|
const e = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
533
533
|
passive: !1
|
|
534
534
|
});
|
|
@@ -557,23 +557,23 @@ class te extends Qt {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function re(r) {
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
|
-
const
|
|
563
|
+
const K = typeof window < "u" && window.document && window.document.createElement;
|
|
564
564
|
function xt() {
|
|
565
|
-
return
|
|
566
|
-
}
|
|
567
|
-
function re() {
|
|
568
|
-
return xt() || B && window.navigator.maxTouchPoints > 1;
|
|
565
|
+
return K && "ontouchstart" in window;
|
|
569
566
|
}
|
|
570
567
|
function ne() {
|
|
571
|
-
return
|
|
568
|
+
return xt() || K && window.navigator.maxTouchPoints > 1;
|
|
572
569
|
}
|
|
573
570
|
function se() {
|
|
574
|
-
return
|
|
571
|
+
return K && "onpointerdown" in window;
|
|
575
572
|
}
|
|
576
573
|
function ie() {
|
|
574
|
+
return K && "exitPointerLock" in window.document;
|
|
575
|
+
}
|
|
576
|
+
function oe() {
|
|
577
577
|
try {
|
|
578
578
|
return "constructor" in GestureEvent;
|
|
579
579
|
} catch {
|
|
@@ -581,17 +581,17 @@ function ie() {
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
const S = {
|
|
584
|
-
isBrowser:
|
|
585
|
-
gesture:
|
|
584
|
+
isBrowser: K,
|
|
585
|
+
gesture: oe(),
|
|
586
586
|
touch: xt(),
|
|
587
|
-
touchscreen:
|
|
588
|
-
pointer:
|
|
589
|
-
pointerLock:
|
|
590
|
-
},
|
|
587
|
+
touchscreen: ne(),
|
|
588
|
+
pointer: se(),
|
|
589
|
+
pointerLock: ie()
|
|
590
|
+
}, ae = 250, ce = 180, ue = 0.5, fe = 50, le = 250, de = 10, vt = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
},
|
|
594
|
+
}, Tt = h(h({}, U), {}, {
|
|
595
595
|
device(r, t, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: e = !1,
|
|
@@ -604,7 +604,7 @@ const S = {
|
|
|
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 ? ae : void 0, !(!S.touchscreen || e === !1))
|
|
608
608
|
return r || (e !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
610
|
pointerCapture(r, t, {
|
|
@@ -621,13 +621,13 @@ const S = {
|
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
622
|
axis: s = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const
|
|
625
|
-
return this.filterTaps = e, this.tapsThreshold = n,
|
|
624
|
+
const o = v.toVector(r, e ? n : s ? 1 : 0);
|
|
625
|
+
return this.filterTaps = e, this.tapsThreshold = n, o;
|
|
626
626
|
},
|
|
627
627
|
swipe({
|
|
628
|
-
velocity: r =
|
|
629
|
-
distance: t =
|
|
630
|
-
duration: e =
|
|
628
|
+
velocity: r = ue,
|
|
629
|
+
distance: t = fe,
|
|
630
|
+
duration: e = le
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
633
|
velocity: this.transform(v.toVector(r)),
|
|
@@ -638,7 +638,7 @@ const S = {
|
|
|
638
638
|
delay(r = 0) {
|
|
639
639
|
switch (r) {
|
|
640
640
|
case !0:
|
|
641
|
-
return
|
|
641
|
+
return ce;
|
|
642
642
|
case !1:
|
|
643
643
|
return 0;
|
|
644
644
|
default:
|
|
@@ -648,11 +648,11 @@ const S = {
|
|
|
648
648
|
axisThreshold(r) {
|
|
649
649
|
return r ? h(h({}, vt), r) : vt;
|
|
650
650
|
},
|
|
651
|
-
keyboardDisplacement(r =
|
|
651
|
+
keyboardDisplacement(r = de) {
|
|
652
652
|
return r;
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
655
|
+
process.env.NODE_ENV === "development" && Object.assign(Tt, {
|
|
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 } }`.");
|
|
@@ -697,20 +697,20 @@ h(h({}, nt), {}, {
|
|
|
697
697
|
scaleBounds: e = {},
|
|
698
698
|
angleBounds: n = {}
|
|
699
699
|
}) {
|
|
700
|
-
const s = (
|
|
701
|
-
const a = ht(F(e,
|
|
700
|
+
const s = (c) => {
|
|
701
|
+
const a = ht(F(e, c), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
705
|
return [a.min, a.max];
|
|
706
|
-
},
|
|
707
|
-
const a = ht(F(n,
|
|
706
|
+
}, o = (c) => {
|
|
707
|
+
const a = ht(F(n, c), {
|
|
708
708
|
min: -1 / 0,
|
|
709
709
|
max: 1 / 0
|
|
710
710
|
});
|
|
711
711
|
return [a.min, a.max];
|
|
712
712
|
};
|
|
713
|
-
return typeof e != "function" && typeof n != "function" ? [s(),
|
|
713
|
+
return typeof e != "function" && typeof n != "function" ? [s(), o()] : (c) => [s(c), o(c)];
|
|
714
714
|
},
|
|
715
715
|
threshold(r, t, e) {
|
|
716
716
|
return this.lockDirection = e.axis === "lock", v.toVector(r, this.lockDirection ? [0.1, 3] : 0);
|
|
@@ -722,39 +722,39 @@ h(h({}, nt), {}, {
|
|
|
722
722
|
return r;
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
|
-
h(h({},
|
|
725
|
+
h(h({}, U), {}, {
|
|
726
726
|
mouseOnly: (r = !0) => r
|
|
727
727
|
});
|
|
728
|
-
h(h({},
|
|
728
|
+
h(h({}, U), {}, {
|
|
729
729
|
mouseOnly: (r = !0) => r
|
|
730
730
|
});
|
|
731
|
-
const
|
|
732
|
-
function
|
|
733
|
-
|
|
731
|
+
const St = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map();
|
|
732
|
+
function he(r) {
|
|
733
|
+
St.set(r.key, r.engine), rt.set(r.key, r.resolver);
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const pe = {
|
|
736
736
|
key: "drag",
|
|
737
|
-
engine:
|
|
738
|
-
resolver:
|
|
737
|
+
engine: ee,
|
|
738
|
+
resolver: Tt
|
|
739
739
|
};
|
|
740
|
-
function
|
|
740
|
+
function me(r, t) {
|
|
741
741
|
if (r == null) return {};
|
|
742
|
-
var e = {}, n = Object.keys(r), s,
|
|
743
|
-
for (
|
|
744
|
-
s = n[
|
|
742
|
+
var e = {}, n = Object.keys(r), s, o;
|
|
743
|
+
for (o = 0; o < n.length; o++)
|
|
744
|
+
s = n[o], !(t.indexOf(s) >= 0) && (e[s] = r[s]);
|
|
745
745
|
return e;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function ge(r, t) {
|
|
748
748
|
if (r == null) return {};
|
|
749
|
-
var e =
|
|
749
|
+
var e = me(r, t), n, s;
|
|
750
750
|
if (Object.getOwnPropertySymbols) {
|
|
751
|
-
var
|
|
752
|
-
for (s = 0; s <
|
|
753
|
-
n =
|
|
751
|
+
var o = Object.getOwnPropertySymbols(r);
|
|
752
|
+
for (s = 0; s < o.length; s++)
|
|
753
|
+
n = o[s], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(r, n) && (e[n] = r[n]);
|
|
754
754
|
}
|
|
755
755
|
return e;
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const ve = {
|
|
758
758
|
target(r) {
|
|
759
759
|
if (r)
|
|
760
760
|
return () => "current" in r ? r.current : r;
|
|
@@ -777,15 +777,15 @@ const ge = {
|
|
|
777
777
|
transform(r) {
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
780
|
+
}, ye = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
781
|
function Y(r = {}, t) {
|
|
782
782
|
const e = {};
|
|
783
783
|
for (const [n, s] of Object.entries(t))
|
|
784
784
|
switch (typeof s) {
|
|
785
785
|
case "function":
|
|
786
786
|
if (process.env.NODE_ENV === "development") {
|
|
787
|
-
const
|
|
788
|
-
Number.isNaN(
|
|
787
|
+
const o = s.call(e, r[n], n, r);
|
|
788
|
+
Number.isNaN(o) || (e[n] = o);
|
|
789
789
|
} else
|
|
790
790
|
e[n] = s.call(e, r[n], n, r);
|
|
791
791
|
break;
|
|
@@ -801,18 +801,18 @@ function Y(r = {}, t) {
|
|
|
801
801
|
function _e(r, t, e = {}) {
|
|
802
802
|
const n = r, {
|
|
803
803
|
target: s,
|
|
804
|
-
eventOptions:
|
|
805
|
-
window:
|
|
804
|
+
eventOptions: o,
|
|
805
|
+
window: c,
|
|
806
806
|
enabled: a,
|
|
807
|
-
transform:
|
|
808
|
-
} = n, p =
|
|
807
|
+
transform: u
|
|
808
|
+
} = n, p = ge(n, ye);
|
|
809
809
|
if (e.shared = Y({
|
|
810
810
|
target: s,
|
|
811
|
-
eventOptions:
|
|
812
|
-
window:
|
|
811
|
+
eventOptions: o,
|
|
812
|
+
window: c,
|
|
813
813
|
enabled: a,
|
|
814
|
-
transform:
|
|
815
|
-
},
|
|
814
|
+
transform: u
|
|
815
|
+
}, ve), t) {
|
|
816
816
|
const f = rt.get(t);
|
|
817
817
|
e[t] = Y(h({
|
|
818
818
|
shared: e.shared
|
|
@@ -836,19 +836,19 @@ class It {
|
|
|
836
836
|
constructor(t, e) {
|
|
837
837
|
w(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
838
838
|
}
|
|
839
|
-
add(t, e, n, s,
|
|
840
|
-
const
|
|
839
|
+
add(t, e, n, s, o) {
|
|
840
|
+
const c = this._listeners, a = zt(e, n), u = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = h(h({}, u), o);
|
|
841
841
|
t.addEventListener(a, s, p);
|
|
842
842
|
const f = () => {
|
|
843
|
-
t.removeEventListener(a, s, p),
|
|
843
|
+
t.removeEventListener(a, s, p), c.delete(f);
|
|
844
844
|
};
|
|
845
|
-
return
|
|
845
|
+
return c.add(f), f;
|
|
846
846
|
}
|
|
847
847
|
clean() {
|
|
848
848
|
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class be {
|
|
852
852
|
constructor() {
|
|
853
853
|
w(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
854
854
|
}
|
|
@@ -863,7 +863,7 @@ class ye {
|
|
|
863
863
|
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
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: {
|
|
@@ -872,11 +872,11 @@ class be {
|
|
|
872
872
|
ctrlKey: !1,
|
|
873
873
|
altKey: !1
|
|
874
874
|
}
|
|
875
|
-
}),
|
|
875
|
+
}), Ee(this, t);
|
|
876
876
|
}
|
|
877
877
|
setEventIds(t) {
|
|
878
878
|
if (H(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,72 +899,72 @@ class be {
|
|
|
899
899
|
let s;
|
|
900
900
|
if (!(e.target && (s = e.target(), !s))) {
|
|
901
901
|
if (e.enabled) {
|
|
902
|
-
for (const
|
|
903
|
-
const a = this.config[
|
|
902
|
+
for (const c of this.gestures) {
|
|
903
|
+
const a = this.config[c], u = yt(n, a.eventOptions, !!s);
|
|
904
904
|
if (a.enabled) {
|
|
905
|
-
const p =
|
|
906
|
-
new p(this, t,
|
|
905
|
+
const p = St.get(c);
|
|
906
|
+
new p(this, t, c).bind(u);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
for (const
|
|
911
|
-
|
|
909
|
+
const o = yt(n, e.eventOptions, !!s);
|
|
910
|
+
for (const c in this.nativeHandlers)
|
|
911
|
+
o(c, "", (a) => this.nativeHandlers[c](h(h({}, this.state.shared), {}, {
|
|
912
912
|
event: a,
|
|
913
913
|
args: t
|
|
914
914
|
})), void 0, !0);
|
|
915
915
|
}
|
|
916
|
-
for (const
|
|
917
|
-
n[
|
|
916
|
+
for (const o in n)
|
|
917
|
+
n[o] = Xt(...n[o]);
|
|
918
918
|
if (!s) return n;
|
|
919
|
-
for (const
|
|
919
|
+
for (const o in n) {
|
|
920
920
|
const {
|
|
921
|
-
device:
|
|
921
|
+
device: c,
|
|
922
922
|
capture: a,
|
|
923
|
-
passive:
|
|
924
|
-
} =
|
|
925
|
-
this._targetEventStore.add(s,
|
|
923
|
+
passive: u
|
|
924
|
+
} = Bt(o);
|
|
925
|
+
this._targetEventStore.add(s, c, "", n[o], {
|
|
926
926
|
capture: a,
|
|
927
|
-
passive:
|
|
927
|
+
passive: u
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
function L(r, t) {
|
|
934
|
-
r.gestures.add(t), r.gestureEventStores[t] = new It(r, t), r.gestureTimeoutStores[t] = new
|
|
934
|
+
r.gestures.add(t), r.gestureEventStores[t] = new It(r, t), r.gestureTimeoutStores[t] = new be();
|
|
935
935
|
}
|
|
936
|
-
function
|
|
936
|
+
function Ee(r, t) {
|
|
937
937
|
t.drag && L(r, "drag"), t.wheel && L(r, "wheel"), t.scroll && L(r, "scroll"), t.move && L(r, "move"), t.pinch && L(r, "pinch"), t.hover && L(r, "hover");
|
|
938
938
|
}
|
|
939
|
-
const
|
|
940
|
-
var
|
|
941
|
-
const f = (
|
|
942
|
-
let
|
|
943
|
-
e && x && (
|
|
939
|
+
const yt = (r, t, e) => (n, s, o, c = {}, a = !1) => {
|
|
940
|
+
var u, p;
|
|
941
|
+
const f = (u = c.capture) !== null && u !== void 0 ? u : t.capture, x = (p = c.passive) !== null && p !== void 0 ? p : t.passive;
|
|
942
|
+
let y = a ? n : Ut(n, s, f);
|
|
943
|
+
e && x && (y += "Passive"), r[y] = r[y] || [], r[y].push(o);
|
|
944
944
|
};
|
|
945
|
-
function
|
|
946
|
-
const s = Z.useMemo(() => new
|
|
945
|
+
function xe(r, t = {}, e, n) {
|
|
946
|
+
const s = Z.useMemo(() => new we(r), []);
|
|
947
947
|
if (s.applyHandlers(r, n), s.applyConfig(t, e), Z.useEffect(s.effect.bind(s)), Z.useEffect(() => s.clean.bind(s), []), t.target === void 0)
|
|
948
948
|
return s.bind.bind(s);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
return
|
|
950
|
+
function Te(r, t) {
|
|
951
|
+
return he(pe), xe({
|
|
952
952
|
drag: r
|
|
953
953
|
}, t || {}, "drag");
|
|
954
954
|
}
|
|
955
955
|
const et = "RSC::Event";
|
|
956
956
|
function Se() {
|
|
957
|
-
const r =
|
|
957
|
+
const r = A(null);
|
|
958
958
|
function t(n) {
|
|
959
|
-
|
|
959
|
+
_t(() => {
|
|
960
960
|
r.current || (r.current = document.createElement("div"));
|
|
961
|
-
function s(
|
|
962
|
-
n(
|
|
961
|
+
function s(o) {
|
|
962
|
+
n(o.detail);
|
|
963
963
|
}
|
|
964
964
|
if (r.current)
|
|
965
965
|
return r.current.addEventListener(et, s, !1), () => {
|
|
966
|
-
var
|
|
967
|
-
(
|
|
966
|
+
var o;
|
|
967
|
+
(o = r.current) == null || o.removeEventListener(
|
|
968
968
|
et,
|
|
969
969
|
s,
|
|
970
970
|
!1
|
|
@@ -985,158 +985,148 @@ function Se() {
|
|
|
985
985
|
emitEvent: e
|
|
986
986
|
};
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function Oe({
|
|
989
989
|
init: r = !0,
|
|
990
990
|
items: t,
|
|
991
991
|
withLoop: e = !1,
|
|
992
992
|
id: n,
|
|
993
993
|
itemsPerSlide: s = 1,
|
|
994
|
-
gutter:
|
|
995
|
-
startEndGutter:
|
|
994
|
+
gutter: o = 0,
|
|
995
|
+
startEndGutter: c = 0,
|
|
996
996
|
carouselAxis: a = "x",
|
|
997
|
-
slideType:
|
|
997
|
+
slideType: u = "fixed",
|
|
998
998
|
startingPosition: p = "start",
|
|
999
999
|
enableGestures: f = !0,
|
|
1000
1000
|
slideWhenDragThresholdIsReached: x = !0,
|
|
1001
|
-
onInit:
|
|
1001
|
+
onInit: y
|
|
1002
1002
|
}) {
|
|
1003
|
-
const [P, N] =
|
|
1003
|
+
const [P, N] = Pt(!1), $ = A(r), C = A(null), _ = A(null), B = A(0), I = A(!e), T = A(!1), V = A(0), l = A(0), [M, G] = $t(
|
|
1004
1004
|
() => ({
|
|
1005
1005
|
value: 0,
|
|
1006
|
-
onChange({ value:
|
|
1007
|
-
|
|
1006
|
+
onChange({ value: i }) {
|
|
1007
|
+
u === "fixed" && C.current.style.setProperty(
|
|
1008
1008
|
`--${n}-offset-position`,
|
|
1009
|
-
`${
|
|
1010
|
-
),
|
|
1009
|
+
`${i.value}px`
|
|
1010
|
+
), u === "freeScroll" && (_.current[a === "x" ? "scrollLeft" : "scrollTop"] = Math.abs(i.value));
|
|
1011
1011
|
}
|
|
1012
1012
|
}),
|
|
1013
1013
|
[a]
|
|
1014
|
-
), Dt =
|
|
1015
|
-
...t.map((
|
|
1016
|
-
...
|
|
1017
|
-
id: `prev-repeated-item-${
|
|
1014
|
+
), Dt = u !== "freeScroll" && e ? [
|
|
1015
|
+
...t.map((i) => ({
|
|
1016
|
+
...i,
|
|
1017
|
+
id: `prev-repeated-item-${i.id}`,
|
|
1018
1018
|
isClonedItem: !0
|
|
1019
1019
|
})),
|
|
1020
1020
|
...t,
|
|
1021
|
-
...t.map((
|
|
1022
|
-
...
|
|
1023
|
-
id: `next-repeated-item-${
|
|
1021
|
+
...t.map((i) => ({
|
|
1022
|
+
...i,
|
|
1023
|
+
id: `next-repeated-item-${i.id}`,
|
|
1024
1024
|
isClonedItem: !0
|
|
1025
1025
|
}))
|
|
1026
|
-
] : t, { useListenToCustomEvent: st, emitEvent:
|
|
1027
|
-
function X(
|
|
1028
|
-
|
|
1026
|
+
] : t, { useListenToCustomEvent: st, emitEvent: z } = Se();
|
|
1027
|
+
function X(i) {
|
|
1028
|
+
$.current && (T.current || j({
|
|
1029
1029
|
type: "next",
|
|
1030
|
-
toIndex:
|
|
1030
|
+
toIndex: i,
|
|
1031
1031
|
actionType: "click"
|
|
1032
1032
|
}));
|
|
1033
1033
|
}
|
|
1034
|
-
function q(
|
|
1035
|
-
|
|
1034
|
+
function q(i) {
|
|
1035
|
+
$.current && (I.current || j({
|
|
1036
1036
|
type: "prev",
|
|
1037
|
-
toIndex:
|
|
1037
|
+
toIndex: i,
|
|
1038
1038
|
actionType: "click"
|
|
1039
1039
|
}));
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1042
|
-
type:
|
|
1041
|
+
function j({
|
|
1042
|
+
type: i,
|
|
1043
1043
|
shouldAnimate: d = !0,
|
|
1044
|
-
toIndex:
|
|
1045
|
-
actionType:
|
|
1044
|
+
toIndex: E,
|
|
1045
|
+
actionType: b
|
|
1046
1046
|
}) {
|
|
1047
1047
|
var ot, at;
|
|
1048
1048
|
const m = W(), O = !d;
|
|
1049
|
-
|
|
1050
|
-
let
|
|
1051
|
-
if (
|
|
1052
|
-
const
|
|
1049
|
+
I.current = !1, T.current = !1;
|
|
1050
|
+
let D = M.value.get(), g = 0;
|
|
1051
|
+
if (i === "next" && u === "fixed" && (l.current += 1), i === "prev" && u === "fixed" && (l.current === 0 ? l.current = t.length - 1 : l.current -= 1), i === "next" && u === "fixed") {
|
|
1052
|
+
const k = J(
|
|
1053
1053
|
e ? m * (t.length * 2) : 0
|
|
1054
1054
|
);
|
|
1055
|
-
g = -(l.current * m), e && l.current === t.length && (l.current = 0,
|
|
1055
|
+
g = -(l.current * m), e && l.current === t.length && (l.current = 0, D = D + m * t.length, g = 0), !e && Math.abs(g) >= k && (T.current = !0, g = -k);
|
|
1056
1056
|
}
|
|
1057
|
-
if (
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1057
|
+
if (i === "prev" && u === "fixed" && (g = -(l.current * m), l.current === t.length - 1 && (D = D - t.length * m), !e && g >= 0 && (I.current = !0, g = 0)), i === "next" && u === "freeScroll") {
|
|
1058
|
+
const k = _.current[a === "x" ? "scrollLeft" : "scrollTop"], R = a === "x" ? _.current.scrollWidth - _.current.clientWidth : _.current.scrollHeight - _.current.clientHeight;
|
|
1059
|
+
D = k, g = k + m, (g > R || R - g < 80) && (g = R, T.current = !0);
|
|
1060
1060
|
}
|
|
1061
|
-
if (
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1061
|
+
if (i === "prev" && u === "freeScroll") {
|
|
1062
|
+
const k = _.current[a === "x" ? "scrollLeft" : "scrollTop"];
|
|
1063
|
+
D = k, g = k - m, g <= 0 && (g = 0, T.current = !0);
|
|
1064
1064
|
}
|
|
1065
|
-
|
|
1065
|
+
B.current = g, z(b === "resize" ? {
|
|
1066
1066
|
eventName: "onResize",
|
|
1067
|
-
sliceActionType:
|
|
1068
|
-
slideDirection:
|
|
1067
|
+
sliceActionType: b,
|
|
1068
|
+
slideDirection: i,
|
|
1069
1069
|
currentItem: {
|
|
1070
1070
|
index: l.current,
|
|
1071
1071
|
id: ((ot = t.at(l.current)) == null ? void 0 : ot.id) ?? "",
|
|
1072
|
-
startReached:
|
|
1073
|
-
endReached:
|
|
1072
|
+
startReached: I.current,
|
|
1073
|
+
endReached: T.current
|
|
1074
1074
|
}
|
|
1075
1075
|
} : {
|
|
1076
1076
|
eventName: "onSlideStartChange",
|
|
1077
|
-
sliceActionType:
|
|
1078
|
-
slideDirection:
|
|
1077
|
+
sliceActionType: b,
|
|
1078
|
+
slideDirection: i,
|
|
1079
1079
|
nextItem: {
|
|
1080
1080
|
index: l.current,
|
|
1081
1081
|
id: ((at = t.at(l.current)) == null ? void 0 : at.id) ?? "",
|
|
1082
|
-
startReached:
|
|
1083
|
-
endReached:
|
|
1082
|
+
startReached: I.current,
|
|
1083
|
+
endReached: T.current
|
|
1084
1084
|
}
|
|
1085
|
-
}),
|
|
1085
|
+
}), E !== void 0 && (l.current = E), G.start({
|
|
1086
1086
|
immediate: O,
|
|
1087
1087
|
from: {
|
|
1088
|
-
value:
|
|
1088
|
+
value: D
|
|
1089
1089
|
},
|
|
1090
1090
|
to: {
|
|
1091
1091
|
value: g
|
|
1092
1092
|
},
|
|
1093
|
-
onRest({ finished:
|
|
1094
|
-
var
|
|
1095
|
-
|
|
1093
|
+
onRest({ finished: k }) {
|
|
1094
|
+
var R;
|
|
1095
|
+
k && u === "fixed" && z({
|
|
1096
1096
|
eventName: "onSlideChangeComplete",
|
|
1097
|
-
sliceActionType:
|
|
1098
|
-
slideDirection:
|
|
1097
|
+
sliceActionType: b,
|
|
1098
|
+
slideDirection: i,
|
|
1099
1099
|
currentItem: {
|
|
1100
1100
|
index: l.current,
|
|
1101
|
-
id: ((
|
|
1102
|
-
startReached:
|
|
1103
|
-
endReached:
|
|
1104
|
-
}
|
|
1105
|
-
}), I && c === "fluid" && j({
|
|
1106
|
-
eventName: "onSlideChangeComplete",
|
|
1107
|
-
sliceActionType: E,
|
|
1108
|
-
slideDirection: o,
|
|
1109
|
-
currentItem: {
|
|
1110
|
-
index: 0,
|
|
1111
|
-
id: "",
|
|
1112
|
-
startReached: T.current,
|
|
1113
|
-
endReached: b.current
|
|
1101
|
+
id: ((R = t.at(l.current)) == null ? void 0 : R.id) ?? "",
|
|
1102
|
+
startReached: I.current,
|
|
1103
|
+
endReached: T.current
|
|
1114
1104
|
}
|
|
1115
1105
|
});
|
|
1116
1106
|
}
|
|
1117
1107
|
});
|
|
1118
1108
|
}
|
|
1119
1109
|
function W() {
|
|
1120
|
-
const
|
|
1110
|
+
const i = _.current.children[0];
|
|
1121
1111
|
let d = 0;
|
|
1122
|
-
return d =
|
|
1112
|
+
return d = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + o, d;
|
|
1123
1113
|
}
|
|
1124
|
-
function J(
|
|
1125
|
-
const d =
|
|
1126
|
-
return d[a === "x" ? "scrollWidth" : "scrollHeight"] - d.getBoundingClientRect()[a === "x" ? "width" : "height"] -
|
|
1114
|
+
function J(i) {
|
|
1115
|
+
const d = _.current;
|
|
1116
|
+
return d[a === "x" ? "scrollWidth" : "scrollHeight"] - d.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
|
|
1127
1117
|
}
|
|
1128
1118
|
function kt() {
|
|
1129
|
-
let
|
|
1119
|
+
let i = 0;
|
|
1130
1120
|
const d = getComputedStyle(
|
|
1131
1121
|
document.documentElement
|
|
1132
1122
|
).getPropertyValue(`--${n}-start-end-gutter`);
|
|
1133
|
-
return d.includes("px") && (
|
|
1123
|
+
return d.includes("px") && (i = Number(
|
|
1134
1124
|
d.replace("px", "")
|
|
1135
|
-
)), { totalStartEndGutterCssVar:
|
|
1125
|
+
)), { totalStartEndGutterCssVar: i };
|
|
1136
1126
|
}
|
|
1137
|
-
|
|
1138
|
-
function
|
|
1139
|
-
switch (
|
|
1127
|
+
_t(() => {
|
|
1128
|
+
function i(b, m) {
|
|
1129
|
+
switch (b) {
|
|
1140
1130
|
case "start":
|
|
1141
1131
|
return 0;
|
|
1142
1132
|
case "middle-start":
|
|
@@ -1151,54 +1141,54 @@ function Ce({
|
|
|
1151
1141
|
return 0;
|
|
1152
1142
|
}
|
|
1153
1143
|
}
|
|
1154
|
-
function d(
|
|
1144
|
+
function d(b) {
|
|
1155
1145
|
if (C.current) {
|
|
1156
1146
|
const { totalStartEndGutterCssVar: m } = kt();
|
|
1157
1147
|
let O = 0;
|
|
1158
|
-
e && (O = W() * t.length), O -= W() *
|
|
1148
|
+
e && (O = W() * t.length), O -= W() * i(p, s), O -= m / 2, C.current.style.setProperty(
|
|
1159
1149
|
`--${n}-offset-modifier`,
|
|
1160
1150
|
`${-O}px`
|
|
1161
|
-
), N(!0),
|
|
1151
|
+
), N(!0), b && b();
|
|
1162
1152
|
}
|
|
1163
1153
|
}
|
|
1164
|
-
function
|
|
1165
|
-
d(),
|
|
1154
|
+
function E() {
|
|
1155
|
+
d(), j({
|
|
1166
1156
|
type: "next",
|
|
1167
1157
|
toIndex: l.current,
|
|
1168
1158
|
shouldAnimate: !1,
|
|
1169
1159
|
actionType: "resize"
|
|
1170
|
-
})
|
|
1160
|
+
});
|
|
1171
1161
|
}
|
|
1172
|
-
if (r && (V.current = W() / 4), r &&
|
|
1173
|
-
return d(
|
|
1174
|
-
window.removeEventListener("resize",
|
|
1162
|
+
if (r && (V.current = W() / 4), r && u === "fixed")
|
|
1163
|
+
return d(y), window.addEventListener("resize", E), () => {
|
|
1164
|
+
window.removeEventListener("resize", E);
|
|
1175
1165
|
};
|
|
1176
|
-
}, [r, e, n, a,
|
|
1177
|
-
const it = f &&
|
|
1178
|
-
(
|
|
1179
|
-
if (
|
|
1166
|
+
}, [r, e, n, a, o, p, u]);
|
|
1167
|
+
const it = f && u !== "freeScroll", Ct = Te(
|
|
1168
|
+
(i) => {
|
|
1169
|
+
if (!$.current)
|
|
1180
1170
|
return;
|
|
1181
|
-
const d =
|
|
1182
|
-
d && (
|
|
1183
|
-
...
|
|
1171
|
+
const d = i.dragging, E = i.offset[a === "x" ? 0 : 1], b = i.movement[a === "x" ? 0 : 1], m = b > V.current, O = b < -V.current, D = i.velocity;
|
|
1172
|
+
d && (z({
|
|
1173
|
+
...i,
|
|
1184
1174
|
eventName: "onDrag",
|
|
1185
1175
|
slideActionType: "drag"
|
|
1186
1176
|
}), G.start({
|
|
1187
|
-
value:
|
|
1177
|
+
value: E,
|
|
1188
1178
|
immediate: !0,
|
|
1189
1179
|
config: {
|
|
1190
|
-
velocity:
|
|
1180
|
+
velocity: D
|
|
1191
1181
|
}
|
|
1192
|
-
}), x && (m || O) &&
|
|
1182
|
+
}), x && (m || O) && i.cancel()), i.last && (m ? j({
|
|
1193
1183
|
actionType: "drag",
|
|
1194
1184
|
type: "prev"
|
|
1195
|
-
}) : O ?
|
|
1185
|
+
}) : O ? j({
|
|
1196
1186
|
actionType: "drag",
|
|
1197
1187
|
type: "next"
|
|
1198
1188
|
}) : G.start({
|
|
1199
|
-
value:
|
|
1189
|
+
value: B.current,
|
|
1200
1190
|
config: {
|
|
1201
|
-
velocity:
|
|
1191
|
+
velocity: D
|
|
1202
1192
|
}
|
|
1203
1193
|
}));
|
|
1204
1194
|
},
|
|
@@ -1214,11 +1204,15 @@ function Ce({
|
|
|
1214
1204
|
bottom: 0
|
|
1215
1205
|
})
|
|
1216
1206
|
},
|
|
1217
|
-
from: () => [
|
|
1207
|
+
from: () => [M.value.get(), M.value.get()]
|
|
1218
1208
|
}
|
|
1219
1209
|
);
|
|
1210
|
+
function Ot(i) {
|
|
1211
|
+
var d, E;
|
|
1212
|
+
return typeof i == "number" ? l.current === i : ((d = t.find((b) => b.id === i)) == null ? void 0 : d.id) === ((E = t[l.current]) == null ? void 0 : E.id);
|
|
1213
|
+
}
|
|
1220
1214
|
return {
|
|
1221
|
-
carouselFragment: /* @__PURE__ */
|
|
1215
|
+
carouselFragment: /* @__PURE__ */ At(
|
|
1222
1216
|
"div",
|
|
1223
1217
|
{
|
|
1224
1218
|
ref: C,
|
|
@@ -1232,8 +1226,8 @@ function Ce({
|
|
|
1232
1226
|
dangerouslySetInnerHTML: {
|
|
1233
1227
|
__html: `
|
|
1234
1228
|
:root {
|
|
1235
|
-
--${n}-start-end-gutter: ${
|
|
1236
|
-
--${n}-gutter: ${
|
|
1229
|
+
--${n}-start-end-gutter: ${c * 2}px;
|
|
1230
|
+
--${n}-gutter: ${o}px;
|
|
1237
1231
|
}
|
|
1238
1232
|
[data-part-internal="${n}-Container"] {
|
|
1239
1233
|
display: flex;
|
|
@@ -1243,8 +1237,8 @@ function Ce({
|
|
|
1243
1237
|
--${n}-items-per-slide: ${s};
|
|
1244
1238
|
--${n}-offset-position: 0px;
|
|
1245
1239
|
--${n}-offset-modifier: 0px;
|
|
1246
|
-
--${n}-scroll-x-value: ${
|
|
1247
|
-
--${n}-scroll-y-value: ${
|
|
1240
|
+
--${n}-scroll-x-value: ${u !== "freeScroll" && a === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1241
|
+
--${n}-scroll-y-value: ${u !== "freeScroll" && a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1248
1242
|
|
|
1249
1243
|
}
|
|
1250
1244
|
[data-part-internal="${n}-Track"] {
|
|
@@ -1260,12 +1254,12 @@ function Ce({
|
|
|
1260
1254
|
height: 100%;
|
|
1261
1255
|
gap: var(--${n}-gutter);
|
|
1262
1256
|
transform: translate3d(var(--${n}-scroll-x-value), var(--${n}-scroll-y-value), 0px);
|
|
1263
|
-
overflow-x: ${
|
|
1257
|
+
overflow-x: ${u === "freeScroll" ? "auto" : "visible"};
|
|
1264
1258
|
touch-action: ${it ? a === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1265
1259
|
}
|
|
1266
1260
|
[data-part-internal="${n}-Item"] {
|
|
1267
1261
|
display: flex;
|
|
1268
|
-
flex: ${
|
|
1262
|
+
flex: ${u === "fixed" ? `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)))` : "1"};
|
|
1269
1263
|
}
|
|
1270
1264
|
`
|
|
1271
1265
|
}
|
|
@@ -1274,33 +1268,34 @@ function Ce({
|
|
|
1274
1268
|
/* @__PURE__ */ Q(
|
|
1275
1269
|
"div",
|
|
1276
1270
|
{
|
|
1277
|
-
ref:
|
|
1271
|
+
ref: _,
|
|
1278
1272
|
className: "ReactSpringCarouselTrack",
|
|
1279
1273
|
"data-part": "Track",
|
|
1280
1274
|
"data-part-internal": `${n}-Track`,
|
|
1281
1275
|
...Ct(),
|
|
1282
1276
|
onScroll: () => {
|
|
1283
|
-
|
|
1277
|
+
I.current = !1, T.current = !1;
|
|
1284
1278
|
},
|
|
1285
|
-
...
|
|
1279
|
+
...u === "freeScroll" ? {
|
|
1286
1280
|
onWheel() {
|
|
1287
|
-
|
|
1281
|
+
I.current = !1, T.current = !1, M.value.stop();
|
|
1288
1282
|
}
|
|
1289
1283
|
} : {},
|
|
1290
|
-
children: Dt.map((
|
|
1284
|
+
children: Dt.map((i, d) => /* @__PURE__ */ Q(
|
|
1291
1285
|
"div",
|
|
1292
1286
|
{
|
|
1293
1287
|
className: "ReactSpringCarouselItem",
|
|
1294
1288
|
"data-part": "Item",
|
|
1295
1289
|
"data-part-internal": `${n}-Item`,
|
|
1296
|
-
"data-id":
|
|
1297
|
-
children: typeof
|
|
1290
|
+
"data-id": i.id,
|
|
1291
|
+
children: typeof i.renderItem == "function" ? i.renderItem({
|
|
1298
1292
|
useListenToCustomEvent: st,
|
|
1299
1293
|
index: d,
|
|
1300
|
-
isClonedItem: !!
|
|
1301
|
-
|
|
1294
|
+
isClonedItem: !!i.isClonedItem,
|
|
1295
|
+
isActiveItem: Ot
|
|
1296
|
+
}) : i.renderItem
|
|
1302
1297
|
},
|
|
1303
|
-
`${
|
|
1298
|
+
`${i.id}-${d}`
|
|
1304
1299
|
))
|
|
1305
1300
|
}
|
|
1306
1301
|
)
|
|
@@ -1310,21 +1305,21 @@ function Ce({
|
|
|
1310
1305
|
useListenToCustomEvent: st,
|
|
1311
1306
|
slideToNextItem: () => X(),
|
|
1312
1307
|
slideToPrevItem: () => q(),
|
|
1313
|
-
slideToItem: (
|
|
1314
|
-
if (typeof
|
|
1315
|
-
if (!t[
|
|
1308
|
+
slideToItem: (i) => {
|
|
1309
|
+
if (typeof i == "number") {
|
|
1310
|
+
if (!t[i]) {
|
|
1316
1311
|
console.warn(
|
|
1317
|
-
`The item you're trying to slide doesn't exist. index: ${
|
|
1312
|
+
`The item you're trying to slide doesn't exist. index: ${i}`
|
|
1318
1313
|
);
|
|
1319
1314
|
return;
|
|
1320
1315
|
}
|
|
1321
|
-
|
|
1316
|
+
i > l.current ? X(i) : q(i);
|
|
1322
1317
|
}
|
|
1323
|
-
if (typeof
|
|
1324
|
-
const d = t.findIndex((
|
|
1318
|
+
if (typeof i == "string") {
|
|
1319
|
+
const d = t.findIndex((E) => E.id === i);
|
|
1325
1320
|
if (d < 0) {
|
|
1326
1321
|
console.warn(
|
|
1327
|
-
`The item you're trying to slide doesn't exist. id: ${
|
|
1322
|
+
`The item you're trying to slide doesn't exist. id: ${i}`
|
|
1328
1323
|
);
|
|
1329
1324
|
return;
|
|
1330
1325
|
}
|
|
@@ -1334,5 +1329,5 @@ function Ce({
|
|
|
1334
1329
|
};
|
|
1335
1330
|
}
|
|
1336
1331
|
export {
|
|
1337
|
-
|
|
1332
|
+
Oe as useSpringCarousel
|
|
1338
1333
|
};
|