react-spring-carousel 3.0.0-beta-2.0.252 → 3.0.0-beta-2.0.254
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 +363 -378
- package/dist/index.umd.js +9 -10
- package/dist/types.d.ts +0 -1
- 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
|
|
2
|
-
import { useSpring as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as Ot, jsx as X } from "react/jsx-runtime";
|
|
2
|
+
import { useSpring as At } from "@react-spring/web";
|
|
3
|
+
import q, { useRef as S, useEffect as vt, useState as Pt } from "react";
|
|
4
|
+
function $t(r, t, e) {
|
|
5
5
|
return Math.max(t, Math.min(r, e));
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const g = {
|
|
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 v = {
|
|
|
21
21
|
r[0] -= t[0], r[1] -= t[1];
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function ot(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 at(r, t, e, n = 0.15) {
|
|
28
|
+
return n === 0 ? $t(r, t, e) : r < t ? -ot(t - r, e - t, n) + t : r > e ? +ot(r - e, e - t, n) + e : r;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const [[o,
|
|
32
|
-
return [
|
|
30
|
+
function Nt(r, [t, e], [n, s]) {
|
|
31
|
+
const [[o, c], [a, d]] = r;
|
|
32
|
+
return [at(t, o, c, n), at(e, a, d, s)];
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function Mt(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 Rt(r, t) {
|
|
|
41
41
|
}
|
|
42
42
|
return (t === "string" ? String : Number)(r);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
44
|
+
function Rt(r) {
|
|
45
|
+
var t = Mt(r, "string");
|
|
46
46
|
return typeof t == "symbol" ? t : String(t);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return t =
|
|
48
|
+
function y(r, t, e) {
|
|
49
|
+
return t = Rt(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 ct(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 ft(r, t) {
|
|
|
66
66
|
function h(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 ? ct(Object(e), !0).forEach(function(n) {
|
|
70
|
+
y(r, n, e[n]);
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : ct(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 yt = {
|
|
78
78
|
pointer: {
|
|
79
79
|
start: "down",
|
|
80
80
|
change: "move",
|
|
@@ -96,40 +96,40 @@ const bt = {
|
|
|
96
96
|
end: "end"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function ut(r) {
|
|
100
100
|
return r ? r[0].toUpperCase() + r.slice(1) : "";
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return r && !
|
|
102
|
+
const Lt = ["enter", "leave"];
|
|
103
|
+
function Vt(r = !1, t) {
|
|
104
|
+
return r && !Lt.includes(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const n =
|
|
108
|
-
return "on" +
|
|
106
|
+
function jt(r, t = "", e = !1) {
|
|
107
|
+
const n = yt[r], s = n && n[t] || t;
|
|
108
|
+
return "on" + ut(r) + ut(s) + (Vt(e, s) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const Ut = ["gotpointercapture", "lostpointercapture"];
|
|
111
|
+
function Kt(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 = Ut.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 Bt(r, t = "") {
|
|
123
|
+
const e = yt[r], n = e && e[t] || t;
|
|
124
124
|
return r + n;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Y(r) {
|
|
127
127
|
return "touches" in r;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
129
|
+
function _t(r) {
|
|
130
|
+
return Y(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function zt(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));
|
|
@@ -138,21 +138,21 @@ function Wt(r) {
|
|
|
138
138
|
function Yt(r) {
|
|
139
139
|
return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
return
|
|
141
|
+
function bt(r) {
|
|
142
|
+
return Y(r) ? Yt(r)[0] : r;
|
|
143
143
|
}
|
|
144
144
|
function Ft(r) {
|
|
145
|
-
return
|
|
145
|
+
return zt(r).map((t) => t.identifier);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const t =
|
|
149
|
-
return
|
|
147
|
+
function J(r) {
|
|
148
|
+
const t = bt(r);
|
|
149
|
+
return Y(r) ? t.identifier : t.pointerId;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const t =
|
|
151
|
+
function ft(r) {
|
|
152
|
+
const t = bt(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 {
|
|
@@ -170,12 +170,12 @@ function Ht(r) {
|
|
|
170
170
|
}
|
|
171
171
|
return t;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function z(r, ...t) {
|
|
174
174
|
return typeof r == "function" ? r(...t) : r;
|
|
175
175
|
}
|
|
176
176
|
function Gt() {
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Ht(...r) {
|
|
179
179
|
return r.length === 0 ? Gt : r.length === 1 ? r[0] : function() {
|
|
180
180
|
let t;
|
|
181
181
|
for (const e of r)
|
|
@@ -183,11 +183,11 @@ function Xt(...r) {
|
|
|
183
183
|
return t;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function lt(r, t) {
|
|
187
187
|
return Object.assign({}, t, r || {});
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
class
|
|
189
|
+
const Xt = 32;
|
|
190
|
+
class qt {
|
|
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
|
}
|
|
@@ -226,7 +226,7 @@ class Jt {
|
|
|
226
226
|
}
|
|
227
227
|
start(t) {
|
|
228
228
|
const e = this.state, n = this.config;
|
|
229
|
-
e._active || (this.reset(), this.computeInitial(), e._active = !0, e.target = t.target, e.currentTarget = t.currentTarget, e.lastOffset = n.from ?
|
|
229
|
+
e._active || (this.reset(), this.computeInitial(), e._active = !0, e.target = t.target, e.currentTarget = t.currentTarget, e.lastOffset = n.from ? z(n.from, e) : e.offset, e.offset = e.lastOffset, e.startTime = e.timeStamp = t.timeStamp);
|
|
230
230
|
}
|
|
231
231
|
computeValues(t) {
|
|
232
232
|
const e = this.state;
|
|
@@ -244,32 +244,32 @@ 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 f = e._delta.map(Math.abs);
|
|
249
|
+
g.addTo(e._distance, f);
|
|
250
250
|
}
|
|
251
251
|
this.axisIntent && this.axisIntent(t);
|
|
252
|
-
const [
|
|
253
|
-
_step:
|
|
254
|
-
values:
|
|
252
|
+
const [c, a] = e._movement, [d, p] = n.threshold, {
|
|
253
|
+
_step: u,
|
|
254
|
+
values: E
|
|
255
255
|
} = e;
|
|
256
|
-
if (n.hasCustomTransform ? (
|
|
257
|
-
const
|
|
256
|
+
if (n.hasCustomTransform ? (u[0] === !1 && (u[0] = Math.abs(c) >= d && E[0]), u[1] === !1 && (u[1] = Math.abs(a) >= p && E[1])) : (u[0] === !1 && (u[0] = Math.abs(c) >= d && Math.sign(c) * d), u[1] === !1 && (u[1] = Math.abs(a) >= p && Math.sign(a) * p)), e.intentional = u[0] !== !1 || u[1] !== !1, !e.intentional) return;
|
|
257
|
+
const m = [0, 0];
|
|
258
258
|
if (n.hasCustomTransform) {
|
|
259
|
-
const [
|
|
260
|
-
|
|
259
|
+
const [f, R] = E;
|
|
260
|
+
m[0] = u[0] !== !1 ? f - u[0] : 0, m[1] = u[1] !== !1 ? R - u[1] : 0;
|
|
261
261
|
} else
|
|
262
|
-
|
|
263
|
-
this.restrictToAxis && !e._blocked && this.restrictToAxis(
|
|
264
|
-
const P = e.offset,
|
|
265
|
-
|
|
266
|
-
const [
|
|
267
|
-
e.overflow = [
|
|
262
|
+
m[0] = u[0] !== !1 ? c - u[0] : 0, m[1] = u[1] !== !1 ? a - u[1] : 0;
|
|
263
|
+
this.restrictToAxis && !e._blocked && this.restrictToAxis(m);
|
|
264
|
+
const P = 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 [k, A] = e.offset, [[$, T], [C, O]] = e._bounds;
|
|
267
|
+
e.overflow = [k < $ ? -1 : k > T ? 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
268
|
const M = e._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
-
if (e.offset =
|
|
270
|
-
e.delta =
|
|
271
|
-
const
|
|
272
|
-
|
|
269
|
+
if (e.offset = Nt(e._bounds, e.offset, M), e.delta = g.sub(e.offset, P), this.computeMovement(), D && (!e.last || o > Xt)) {
|
|
270
|
+
e.delta = g.sub(e.offset, P);
|
|
271
|
+
const f = e.delta.map(Math.abs);
|
|
272
|
+
g.addTo(e.distance, f), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && o > 0 && (e.velocity = [f[0] / o, f[1] / o], e.timeDelta = o);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
emit() {
|
|
@@ -284,16 +284,16 @@ class Jt {
|
|
|
284
284
|
this.eventStore.clean(), this.timeoutStore.clean();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Jt([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 Qt extends qt {
|
|
295
295
|
constructor(...t) {
|
|
296
|
-
super(...t),
|
|
296
|
+
super(...t), y(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
298
298
|
reset() {
|
|
299
299
|
super.reset(), this.state.axis = void 0;
|
|
@@ -302,16 +302,16 @@ 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 = g.add(this.state.lastOffset, this.state.movement);
|
|
306
306
|
}
|
|
307
307
|
computeMovement() {
|
|
308
|
-
this.state.movement =
|
|
308
|
+
this.state.movement = g.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[_t(t)] : n.axisThreshold;
|
|
314
|
+
e.axis = Jt(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 Zt extends Jt {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
330
|
+
const dt = (r) => r, ht = 0.15, tt = {
|
|
331
331
|
enabled(r = !0) {
|
|
332
332
|
return r;
|
|
333
333
|
},
|
|
@@ -343,33 +343,33 @@ const pt = (r) => r, mt = 0.15, nt = {
|
|
|
343
343
|
rubberband(r = 0) {
|
|
344
344
|
switch (r) {
|
|
345
345
|
case !0:
|
|
346
|
-
return [
|
|
346
|
+
return [ht, ht];
|
|
347
347
|
case !1:
|
|
348
348
|
return [0, 0];
|
|
349
349
|
default:
|
|
350
|
-
return
|
|
350
|
+
return g.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 g.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 (o) => {
|
|
362
|
-
const
|
|
363
|
-
return (!isFinite(
|
|
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
|
-
return n ||
|
|
366
|
+
return n || dt;
|
|
367
367
|
},
|
|
368
368
|
threshold(r) {
|
|
369
|
-
return
|
|
369
|
+
return g.toVector(r, 0);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
372
|
+
process.env.NODE_ENV === "development" && Object.assign(tt, {
|
|
373
373
|
domTarget(r) {
|
|
374
374
|
if (r !== void 0)
|
|
375
375
|
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
@@ -386,18 +386,18 @@ process.env.NODE_ENV === "development" && Object.assign(nt, {
|
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const
|
|
389
|
+
const Zt = 0, V = h(h({}, tt), {}, {
|
|
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 = Zt) {
|
|
396
396
|
return r;
|
|
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,15 +410,15 @@ const te = 0, U = h(h({}, nt), {}, {
|
|
|
410
410
|
} = r;
|
|
411
411
|
return [[t, e], [n, s]];
|
|
412
412
|
}
|
|
413
|
-
}),
|
|
413
|
+
}), pt = {
|
|
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 Qt {
|
|
420
420
|
constructor(...t) {
|
|
421
|
-
super(...t),
|
|
421
|
+
super(...t), y(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(ft(t)), this.computeInitial(), e.preventScrollAxis && _t(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
|
-
const o =
|
|
468
|
-
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta =
|
|
467
|
+
const o = ft(t);
|
|
468
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = g.sub(o, e._values), this.computeValues(o)), g.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, 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
|
|
504
|
-
|
|
501
|
+
const [a, d] = e._delta, [p, u] = e._movement, [E, m] = n.swipe.velocity, [P, D] = n.swipe.distance, k = n.swipe.duration;
|
|
502
|
+
if (e.elapsedTime < k) {
|
|
503
|
+
const A = Math.abs(a / e.timeDelta), $ = Math.abs(d / e.timeDelta);
|
|
504
|
+
A > E && Math.abs(p) > P && (e.swipe[0] = Math.sign(a)), $ > m && Math.abs(u) > D && (e.swipe[1] = Math.sign(d));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -528,7 +528,7 @@ class ee extends Zt {
|
|
|
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, ee(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 ee extends Zt {
|
|
|
540
540
|
}, this.config.delay);
|
|
541
541
|
}
|
|
542
542
|
keyDown(t) {
|
|
543
|
-
const e =
|
|
543
|
+
const e = pt[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, g.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 pt && (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 ee extends Zt {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function ee(r) {
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
|
-
const
|
|
564
|
-
function
|
|
565
|
-
return
|
|
563
|
+
const j = typeof window < "u" && window.document && window.document.createElement;
|
|
564
|
+
function wt() {
|
|
565
|
+
return j && "ontouchstart" in window;
|
|
566
|
+
}
|
|
567
|
+
function re() {
|
|
568
|
+
return wt() || j && window.navigator.maxTouchPoints > 1;
|
|
566
569
|
}
|
|
567
570
|
function ne() {
|
|
568
|
-
return
|
|
571
|
+
return j && "onpointerdown" in window;
|
|
569
572
|
}
|
|
570
573
|
function se() {
|
|
571
|
-
return
|
|
574
|
+
return j && "exitPointerLock" in window.document;
|
|
572
575
|
}
|
|
573
576
|
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 {
|
|
580
580
|
return !1;
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
const
|
|
584
|
-
isBrowser:
|
|
585
|
-
gesture:
|
|
586
|
-
touch:
|
|
587
|
-
touchscreen:
|
|
588
|
-
pointer:
|
|
589
|
-
pointerLock:
|
|
590
|
-
},
|
|
583
|
+
const x = {
|
|
584
|
+
isBrowser: j,
|
|
585
|
+
gesture: ie(),
|
|
586
|
+
touch: wt(),
|
|
587
|
+
touchscreen: re(),
|
|
588
|
+
pointer: ne(),
|
|
589
|
+
pointerLock: se()
|
|
590
|
+
}, oe = 250, ae = 180, ce = 0.5, ue = 50, fe = 250, le = 10, mt = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
},
|
|
594
|
+
}, Et = h(h({}, V), {}, {
|
|
595
595
|
device(r, t, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: e = !1,
|
|
@@ -599,12 +599,12 @@ const S = {
|
|
|
599
599
|
mouse: s = !1
|
|
600
600
|
} = {}
|
|
601
601
|
}) {
|
|
602
|
-
return this.pointerLock = n &&
|
|
602
|
+
return this.pointerLock = n && x.pointerLock, x.touch && e ? "touch" : this.pointerLock ? "mouse" : x.pointer && !s ? "pointer" : x.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 ? oe : void 0, !(!x.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 S = {
|
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
622
|
axis: s = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const o =
|
|
624
|
+
const o = g.toVector(r, e ? n : s ? 1 : 0);
|
|
625
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 = ce,
|
|
629
|
+
distance: t = ue,
|
|
630
|
+
duration: e = fe
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
|
-
velocity: this.transform(
|
|
634
|
-
distance: this.transform(
|
|
633
|
+
velocity: this.transform(g.toVector(r)),
|
|
634
|
+
distance: this.transform(g.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 S = {
|
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
648
|
axisThreshold(r) {
|
|
649
|
-
return r ? h(h({},
|
|
649
|
+
return r ? h(h({}, mt), r) : mt;
|
|
650
650
|
},
|
|
651
|
-
keyboardDisplacement(r =
|
|
651
|
+
keyboardDisplacement(r = le) {
|
|
652
652
|
return r;
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
655
|
+
process.env.NODE_ENV === "development" && Object.assign(Et, {
|
|
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,41 +679,41 @@ process.env.NODE_ENV === "development" && Object.assign(St, {
|
|
|
679
679
|
return NaN;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
|
-
h(h({},
|
|
682
|
+
h(h({}, tt), {}, {
|
|
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 && !x.touch && x.gesture) return "gesture";
|
|
690
|
+
if (x.touch && n) return "touch";
|
|
691
|
+
if (x.touchscreen) {
|
|
692
|
+
if (x.pointer) return "pointer";
|
|
693
|
+
if (x.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 a =
|
|
700
|
+
const s = (c) => {
|
|
701
|
+
const a = lt(z(e, c), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
705
|
return [a.min, a.max];
|
|
706
|
-
}, o = (
|
|
707
|
-
const a =
|
|
706
|
+
}, o = (c) => {
|
|
707
|
+
const a = lt(z(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(), o()] : (
|
|
713
|
+
return typeof e != "function" && typeof n != "function" ? [s(), o()] : (c) => [s(c), o(c)];
|
|
714
714
|
},
|
|
715
715
|
threshold(r, t, e) {
|
|
716
|
-
return this.lockDirection = e.axis === "lock",
|
|
716
|
+
return this.lockDirection = e.axis === "lock", g.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({}, nt), {}, {
|
|
|
722
722
|
return r;
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
|
-
h(h({},
|
|
725
|
+
h(h({}, V), {}, {
|
|
726
726
|
mouseOnly: (r = !0) => r
|
|
727
727
|
});
|
|
728
|
-
h(h({},
|
|
728
|
+
h(h({}, V), {}, {
|
|
729
729
|
mouseOnly: (r = !0) => r
|
|
730
730
|
});
|
|
731
|
-
const Tt = /* @__PURE__ */ new Map(),
|
|
732
|
-
function
|
|
733
|
-
Tt.set(r.key, r.engine),
|
|
731
|
+
const Tt = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
|
|
732
|
+
function de(r) {
|
|
733
|
+
Tt.set(r.key, r.engine), Z.set(r.key, r.resolver);
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const he = {
|
|
736
736
|
key: "drag",
|
|
737
|
-
engine:
|
|
738
|
-
resolver:
|
|
737
|
+
engine: te,
|
|
738
|
+
resolver: Et
|
|
739
739
|
};
|
|
740
|
-
function
|
|
740
|
+
function pe(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 = pe(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++)
|
|
@@ -754,7 +754,7 @@ function ge(r, t) {
|
|
|
754
754
|
}
|
|
755
755
|
return e;
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const ge = {
|
|
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 = x.isBrowser ? window : void 0) {
|
|
766
766
|
return r;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
@@ -777,8 +777,8 @@ const ve = {
|
|
|
777
777
|
transform(r) {
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
781
|
-
function
|
|
780
|
+
}, ve = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
|
+
function B(r = {}, t) {
|
|
782
782
|
const e = {};
|
|
783
783
|
for (const [n, s] of Object.entries(t))
|
|
784
784
|
switch (typeof s) {
|
|
@@ -790,7 +790,7 @@ function Y(r = {}, t) {
|
|
|
790
790
|
e[n] = s.call(e, r[n], n, r);
|
|
791
791
|
break;
|
|
792
792
|
case "object":
|
|
793
|
-
e[n] =
|
|
793
|
+
e[n] = B(r[n], s);
|
|
794
794
|
break;
|
|
795
795
|
case "boolean":
|
|
796
796
|
s && (e[n] = r[n]);
|
|
@@ -798,59 +798,59 @@ function Y(r = {}, t) {
|
|
|
798
798
|
}
|
|
799
799
|
return e;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function ye(r, t, e = {}) {
|
|
802
802
|
const n = r, {
|
|
803
803
|
target: s,
|
|
804
804
|
eventOptions: o,
|
|
805
|
-
window:
|
|
805
|
+
window: c,
|
|
806
806
|
enabled: a,
|
|
807
|
-
transform:
|
|
808
|
-
} = n, p =
|
|
809
|
-
if (e.shared =
|
|
807
|
+
transform: d
|
|
808
|
+
} = n, p = me(n, ve);
|
|
809
|
+
if (e.shared = B({
|
|
810
810
|
target: s,
|
|
811
811
|
eventOptions: o,
|
|
812
|
-
window:
|
|
812
|
+
window: c,
|
|
813
813
|
enabled: a,
|
|
814
|
-
transform:
|
|
815
|
-
},
|
|
816
|
-
const
|
|
817
|
-
e[t] =
|
|
814
|
+
transform: d
|
|
815
|
+
}, ge), t) {
|
|
816
|
+
const u = Z.get(t);
|
|
817
|
+
e[t] = B(h({
|
|
818
818
|
shared: e.shared
|
|
819
|
-
}, p),
|
|
819
|
+
}, p), u);
|
|
820
820
|
} else
|
|
821
|
-
for (const
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
e[
|
|
821
|
+
for (const u in p) {
|
|
822
|
+
const E = Z.get(u);
|
|
823
|
+
if (E)
|
|
824
|
+
e[u] = B(h({
|
|
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[u]), E);
|
|
827
|
+
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(u)) {
|
|
828
|
+
if (u === "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 \`${u}\` was used. Please read the documentation for further information.`);
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
return e;
|
|
834
834
|
}
|
|
835
|
-
class
|
|
835
|
+
class xt {
|
|
836
836
|
constructor(t, e) {
|
|
837
|
-
|
|
837
|
+
y(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
838
838
|
}
|
|
839
839
|
add(t, e, n, s, o) {
|
|
840
|
-
const
|
|
840
|
+
const c = this._listeners, a = Bt(e, n), d = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = h(h({}, d), o);
|
|
841
841
|
t.addEventListener(a, s, p);
|
|
842
|
-
const
|
|
843
|
-
t.removeEventListener(a, s, p),
|
|
842
|
+
const u = () => {
|
|
843
|
+
t.removeEventListener(a, s, p), c.delete(u);
|
|
844
844
|
};
|
|
845
|
-
return
|
|
845
|
+
return c.add(u), u;
|
|
846
846
|
}
|
|
847
847
|
clean() {
|
|
848
848
|
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class _e {
|
|
852
852
|
constructor() {
|
|
853
|
-
|
|
853
|
+
y(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));
|
|
@@ -863,19 +863,19 @@ class be {
|
|
|
863
863
|
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
866
|
+
class be {
|
|
867
867
|
constructor(t) {
|
|
868
|
-
|
|
868
|
+
y(this, "gestures", /* @__PURE__ */ new Set()), y(this, "_targetEventStore", new xt(this)), y(this, "gestureEventStores", {}), y(this, "gestureTimeoutStores", {}), y(this, "handlers", {}), y(this, "config", {}), y(this, "pointerIds", /* @__PURE__ */ new Set()), y(this, "touchIds", /* @__PURE__ */ new Set()), y(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
|
+
}), we(this, t);
|
|
876
876
|
}
|
|
877
877
|
setEventIds(t) {
|
|
878
|
-
if (
|
|
878
|
+
if (Y(t))
|
|
879
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;
|
|
@@ -884,7 +884,7 @@ class we {
|
|
|
884
884
|
this.handlers = t, this.nativeHandlers = e;
|
|
885
885
|
}
|
|
886
886
|
applyConfig(t, e) {
|
|
887
|
-
this.config =
|
|
887
|
+
this.config = ye(t, e, this.config);
|
|
888
888
|
}
|
|
889
889
|
clean() {
|
|
890
890
|
this._targetEventStore.clean();
|
|
@@ -899,73 +899,73 @@ 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 a = this.config[
|
|
902
|
+
for (const c of this.gestures) {
|
|
903
|
+
const a = this.config[c], d = gt(n, a.eventOptions, !!s);
|
|
904
904
|
if (a.enabled) {
|
|
905
|
-
const p = Tt.get(
|
|
906
|
-
new p(this, t,
|
|
905
|
+
const p = Tt.get(c);
|
|
906
|
+
new p(this, t, c).bind(d);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const o =
|
|
910
|
-
for (const
|
|
911
|
-
o(
|
|
909
|
+
const o = gt(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
916
|
for (const o in n)
|
|
917
|
-
n[o] =
|
|
917
|
+
n[o] = Ht(...n[o]);
|
|
918
918
|
if (!s) return n;
|
|
919
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: d
|
|
924
|
+
} = Kt(o);
|
|
925
|
+
this._targetEventStore.add(s, c, "", n[o], {
|
|
926
926
|
capture: a,
|
|
927
|
-
passive:
|
|
927
|
+
passive: d
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
r.gestures.add(t), r.gestureEventStores[t] = new
|
|
933
|
+
function N(r, t) {
|
|
934
|
+
r.gestures.add(t), r.gestureEventStores[t] = new xt(r, t), r.gestureTimeoutStores[t] = new _e();
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
t.drag &&
|
|
936
|
+
function we(r, t) {
|
|
937
|
+
t.drag && N(r, "drag"), t.wheel && N(r, "wheel"), t.scroll && N(r, "scroll"), t.move && N(r, "move"), t.pinch && N(r, "pinch"), t.hover && N(r, "hover");
|
|
938
938
|
}
|
|
939
|
-
const
|
|
940
|
-
var
|
|
941
|
-
const
|
|
942
|
-
let
|
|
943
|
-
e &&
|
|
939
|
+
const gt = (r, t, e) => (n, s, o, c = {}, a = !1) => {
|
|
940
|
+
var d, p;
|
|
941
|
+
const u = (d = c.capture) !== null && d !== void 0 ? d : t.capture, E = (p = c.passive) !== null && p !== void 0 ? p : t.passive;
|
|
942
|
+
let m = a ? n : jt(n, s, u);
|
|
943
|
+
e && E && (m += "Passive"), r[m] = r[m] || [], r[m].push(o);
|
|
944
944
|
};
|
|
945
|
-
function
|
|
946
|
-
const s =
|
|
947
|
-
if (s.applyHandlers(r, n), s.applyConfig(t, e),
|
|
945
|
+
function Ee(r, t = {}, e, n) {
|
|
946
|
+
const s = q.useMemo(() => new be(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
|
-
function
|
|
951
|
-
return he
|
|
950
|
+
function Te(r, t) {
|
|
951
|
+
return de(he), Ee({
|
|
952
952
|
drag: r
|
|
953
953
|
}, t || {}, "drag");
|
|
954
954
|
}
|
|
955
|
-
const
|
|
956
|
-
function
|
|
957
|
-
const r =
|
|
955
|
+
const Q = "RSC::Event";
|
|
956
|
+
function xe() {
|
|
957
|
+
const r = S(null);
|
|
958
958
|
function t(n) {
|
|
959
|
-
|
|
959
|
+
vt(() => {
|
|
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 Te() {
|
|
|
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);
|
|
@@ -985,33 +985,32 @@ function Te() {
|
|
|
985
985
|
emitEvent: e
|
|
986
986
|
};
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function Ce({
|
|
989
989
|
init: r = !0,
|
|
990
990
|
items: t,
|
|
991
991
|
withLoop: e = !1,
|
|
992
992
|
id: n,
|
|
993
993
|
itemsPerSlide: s = 1,
|
|
994
994
|
gutter: o = 0,
|
|
995
|
-
startEndGutter:
|
|
995
|
+
startEndGutter: c = 0,
|
|
996
996
|
carouselAxis: a = "x",
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
onInit: y
|
|
997
|
+
startingPosition: d = "start",
|
|
998
|
+
enableGestures: p = !0,
|
|
999
|
+
slideWhenDragThresholdIsReached: u = !0,
|
|
1000
|
+
onInit: E
|
|
1002
1001
|
}) {
|
|
1003
|
-
const [
|
|
1002
|
+
const [m, P] = Pt(!1), D = S(r), k = S(null), A = S(null), $ = S(0), T = S(0), C = S(!e), O = S(!1), M = S(0), f = S(0), [R, F] = At(
|
|
1004
1003
|
() => ({
|
|
1005
1004
|
value: 0,
|
|
1006
1005
|
onChange({ value: i }) {
|
|
1007
|
-
|
|
1006
|
+
k.current.style.setProperty(
|
|
1008
1007
|
`--${n}-offset-position`,
|
|
1009
1008
|
`${i.value}px`
|
|
1010
|
-
)
|
|
1009
|
+
);
|
|
1011
1010
|
}
|
|
1012
1011
|
}),
|
|
1013
1012
|
[a]
|
|
1014
|
-
),
|
|
1013
|
+
), It = e ? [
|
|
1015
1014
|
...t.map((i) => ({
|
|
1016
1015
|
...i,
|
|
1017
1016
|
id: `prev-repeated-item-${i.id}`,
|
|
@@ -1023,211 +1022,203 @@ 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: et, emitEvent: U } = xe();
|
|
1026
|
+
function W(i) {
|
|
1027
|
+
D.current && (O.current || L({
|
|
1029
1028
|
type: "next",
|
|
1030
1029
|
toIndex: i,
|
|
1031
1030
|
actionType: "click"
|
|
1032
1031
|
}));
|
|
1033
1032
|
}
|
|
1034
|
-
function
|
|
1035
|
-
|
|
1033
|
+
function G(i) {
|
|
1034
|
+
D.current && (C.current || L({
|
|
1036
1035
|
type: "prev",
|
|
1037
1036
|
toIndex: i,
|
|
1038
1037
|
actionType: "click"
|
|
1039
1038
|
}));
|
|
1040
1039
|
}
|
|
1041
|
-
function
|
|
1040
|
+
function L({
|
|
1042
1041
|
type: i,
|
|
1043
|
-
shouldAnimate:
|
|
1044
|
-
toIndex:
|
|
1045
|
-
actionType:
|
|
1042
|
+
shouldAnimate: l = !0,
|
|
1043
|
+
toIndex: _,
|
|
1044
|
+
actionType: v
|
|
1046
1045
|
}) {
|
|
1047
|
-
var
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
let
|
|
1051
|
-
if (i === "next" &&
|
|
1052
|
-
const
|
|
1053
|
-
e ?
|
|
1046
|
+
var nt, st;
|
|
1047
|
+
const I = !l;
|
|
1048
|
+
C.current = !1, O.current = !1;
|
|
1049
|
+
let b = R.value.get(), w = 0;
|
|
1050
|
+
if (i === "next" && (f.current += 1), i === "prev" && (f.current === 0 ? f.current = t.length - 1 : f.current -= 1), i === "next") {
|
|
1051
|
+
const K = H(
|
|
1052
|
+
e ? T.current * (t.length * 2) : 0
|
|
1054
1053
|
);
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1057
|
-
if (i === "prev" && c === "fixed" && (g = -(l.current * m), l.current === t.length - 1 && (D = D - t.length * m), !e && g >= 0 && (T.current = !0, g = 0)), i === "next" && c === "freeScroll") {
|
|
1058
|
-
const k = _.current[a === "x" ? "scrollLeft" : "scrollTop"], L = a === "x" ? _.current.scrollWidth - _.current.clientWidth : _.current.scrollHeight - _.current.clientHeight;
|
|
1059
|
-
D = k, g = k + m, (g > L || L - g < 80) && (g = L, I.current = !0);
|
|
1054
|
+
w = -(f.current * T.current), e && f.current === t.length && (f.current = 0, b = b + T.current * t.length, w = 0), !e && Math.abs(w) >= K && (O.current = !0, w = -K);
|
|
1060
1055
|
}
|
|
1061
|
-
|
|
1062
|
-
const k = _.current[a === "x" ? "scrollLeft" : "scrollTop"];
|
|
1063
|
-
D = k, g = k - m, g <= 0 && (g = 0, T.current = !0);
|
|
1064
|
-
}
|
|
1065
|
-
B.current = g, b === "resize" ? (g = -(l.current * m), z({
|
|
1056
|
+
i === "prev" && (w = -(f.current * T.current), f.current === t.length - 1 && (b = b - t.length * T.current), !e && w >= 0 && (C.current = !0, w = 0)), $.current = w, v === "resize" ? (w = -(f.current * T.current), U({
|
|
1066
1057
|
eventName: "onResize",
|
|
1067
|
-
sliceActionType:
|
|
1058
|
+
sliceActionType: v,
|
|
1068
1059
|
slideDirection: i,
|
|
1069
1060
|
currentItem: {
|
|
1070
|
-
index:
|
|
1071
|
-
id: ((
|
|
1072
|
-
startReached:
|
|
1073
|
-
endReached:
|
|
1061
|
+
index: f.current,
|
|
1062
|
+
id: ((nt = t.at(f.current)) == null ? void 0 : nt.id) ?? "",
|
|
1063
|
+
startReached: C.current,
|
|
1064
|
+
endReached: O.current
|
|
1074
1065
|
}
|
|
1075
|
-
})) :
|
|
1066
|
+
})) : U({
|
|
1076
1067
|
eventName: "onSlideStartChange",
|
|
1077
|
-
sliceActionType:
|
|
1068
|
+
sliceActionType: v,
|
|
1078
1069
|
slideDirection: i,
|
|
1079
1070
|
nextItem: {
|
|
1080
|
-
index:
|
|
1081
|
-
id: ((
|
|
1082
|
-
startReached:
|
|
1083
|
-
endReached:
|
|
1071
|
+
index: f.current,
|
|
1072
|
+
id: ((st = t.at(f.current)) == null ? void 0 : st.id) ?? "",
|
|
1073
|
+
startReached: C.current,
|
|
1074
|
+
endReached: O.current
|
|
1084
1075
|
}
|
|
1085
|
-
}),
|
|
1086
|
-
immediate:
|
|
1076
|
+
}), _ !== void 0 && (f.current = _), F.start({
|
|
1077
|
+
immediate: I,
|
|
1087
1078
|
from: {
|
|
1088
|
-
value:
|
|
1079
|
+
value: b
|
|
1089
1080
|
},
|
|
1090
1081
|
to: {
|
|
1091
|
-
value:
|
|
1082
|
+
value: w
|
|
1092
1083
|
},
|
|
1093
|
-
onRest({ finished:
|
|
1094
|
-
var
|
|
1095
|
-
|
|
1084
|
+
onRest({ finished: K }) {
|
|
1085
|
+
var it;
|
|
1086
|
+
K && U({
|
|
1096
1087
|
eventName: "onSlideChangeComplete",
|
|
1097
|
-
sliceActionType:
|
|
1088
|
+
sliceActionType: v,
|
|
1098
1089
|
slideDirection: i,
|
|
1099
1090
|
currentItem: {
|
|
1100
|
-
index:
|
|
1101
|
-
id: ((
|
|
1102
|
-
startReached:
|
|
1103
|
-
endReached:
|
|
1091
|
+
index: f.current,
|
|
1092
|
+
id: ((it = t.at(f.current)) == null ? void 0 : it.id) ?? "",
|
|
1093
|
+
startReached: C.current,
|
|
1094
|
+
endReached: O.current
|
|
1104
1095
|
}
|
|
1105
1096
|
});
|
|
1106
1097
|
}
|
|
1107
1098
|
});
|
|
1108
1099
|
}
|
|
1109
|
-
function
|
|
1110
|
-
const i =
|
|
1111
|
-
let
|
|
1112
|
-
return
|
|
1100
|
+
function St() {
|
|
1101
|
+
const i = A.current.children[0];
|
|
1102
|
+
let l = 0;
|
|
1103
|
+
return l = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + o, l;
|
|
1113
1104
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const
|
|
1116
|
-
return
|
|
1105
|
+
function H(i) {
|
|
1106
|
+
const l = A.current;
|
|
1107
|
+
return l[a === "x" ? "scrollWidth" : "scrollHeight"] - l.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
|
|
1117
1108
|
}
|
|
1118
|
-
function
|
|
1109
|
+
function Dt() {
|
|
1119
1110
|
let i = 0;
|
|
1120
|
-
const
|
|
1111
|
+
const l = getComputedStyle(
|
|
1121
1112
|
document.documentElement
|
|
1122
1113
|
).getPropertyValue(`--${n}-start-end-gutter`);
|
|
1123
|
-
return
|
|
1124
|
-
|
|
1114
|
+
return l.includes("px") && (i = Number(
|
|
1115
|
+
l.replace("px", "")
|
|
1125
1116
|
)), { totalStartEndGutterCssVar: i };
|
|
1126
1117
|
}
|
|
1127
|
-
|
|
1128
|
-
function i(
|
|
1129
|
-
switch (
|
|
1118
|
+
vt(() => {
|
|
1119
|
+
function i(v, I) {
|
|
1120
|
+
switch (v) {
|
|
1130
1121
|
case "start":
|
|
1131
1122
|
return 0;
|
|
1132
1123
|
case "middle-start":
|
|
1133
|
-
return Math.floor((
|
|
1124
|
+
return Math.floor((I - 1) * 0.25);
|
|
1134
1125
|
case "center":
|
|
1135
|
-
return Math.floor((
|
|
1126
|
+
return Math.floor((I - 1) * 0.5);
|
|
1136
1127
|
case "middle-end":
|
|
1137
|
-
return Math.floor((
|
|
1128
|
+
return Math.floor((I - 1) * 0.75);
|
|
1138
1129
|
case "end":
|
|
1139
|
-
return
|
|
1130
|
+
return I - 1;
|
|
1140
1131
|
default:
|
|
1141
1132
|
return 0;
|
|
1142
1133
|
}
|
|
1143
1134
|
}
|
|
1144
|
-
function
|
|
1145
|
-
if (
|
|
1146
|
-
const { totalStartEndGutterCssVar:
|
|
1147
|
-
let
|
|
1148
|
-
e && (
|
|
1135
|
+
function l(v) {
|
|
1136
|
+
if (k.current) {
|
|
1137
|
+
const { totalStartEndGutterCssVar: I } = Dt();
|
|
1138
|
+
let b = 0;
|
|
1139
|
+
e && (b = T.current * t.length), b -= T.current * i(d, s), b -= I / 2, k.current.style.setProperty(
|
|
1149
1140
|
`--${n}-offset-modifier`,
|
|
1150
|
-
`${-
|
|
1151
|
-
),
|
|
1141
|
+
`${-b}px`
|
|
1142
|
+
), P(!0), v && v();
|
|
1152
1143
|
}
|
|
1153
1144
|
}
|
|
1154
|
-
function
|
|
1155
|
-
|
|
1145
|
+
function _() {
|
|
1146
|
+
l(), L({
|
|
1156
1147
|
type: "resize",
|
|
1157
|
-
toIndex:
|
|
1148
|
+
toIndex: f.current,
|
|
1158
1149
|
shouldAnimate: !1,
|
|
1159
1150
|
actionType: "resize"
|
|
1160
1151
|
});
|
|
1161
1152
|
}
|
|
1162
|
-
if (r
|
|
1163
|
-
return
|
|
1164
|
-
window.removeEventListener("resize",
|
|
1153
|
+
if (r)
|
|
1154
|
+
return D.current = !0, T.current = St(), M.current = T.current / 4, l(E), window.addEventListener("resize", _), () => {
|
|
1155
|
+
window.removeEventListener("resize", _);
|
|
1165
1156
|
};
|
|
1166
|
-
}, [r, e, n, a, o,
|
|
1167
|
-
const
|
|
1157
|
+
}, [r, e, n, a, o, d]);
|
|
1158
|
+
const rt = p, kt = Te(
|
|
1168
1159
|
(i) => {
|
|
1169
|
-
if (!
|
|
1160
|
+
if (!D.current)
|
|
1170
1161
|
return;
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1162
|
+
const l = i.dragging, _ = i.offset[a === "x" ? 0 : 1], v = i.movement[a === "x" ? 0 : 1], I = v > M.current, b = v < -M.current, w = i.velocity;
|
|
1163
|
+
l && (U({
|
|
1173
1164
|
...i,
|
|
1174
1165
|
eventName: "onDrag",
|
|
1175
1166
|
slideActionType: "drag"
|
|
1176
|
-
}),
|
|
1177
|
-
value:
|
|
1167
|
+
}), F.start({
|
|
1168
|
+
value: _,
|
|
1178
1169
|
immediate: !0,
|
|
1179
1170
|
config: {
|
|
1180
|
-
velocity:
|
|
1171
|
+
velocity: w
|
|
1181
1172
|
}
|
|
1182
|
-
}),
|
|
1173
|
+
}), u && (I || b) && i.cancel()), i.last && (I ? (L({
|
|
1183
1174
|
actionType: "drag",
|
|
1184
1175
|
type: "prev"
|
|
1185
|
-
}), i.cancel()) :
|
|
1176
|
+
}), i.cancel()) : b ? (L({
|
|
1186
1177
|
actionType: "drag",
|
|
1187
1178
|
type: "next"
|
|
1188
|
-
}),
|
|
1189
|
-
value:
|
|
1179
|
+
}), i.cancel()) : (F.start({
|
|
1180
|
+
value: $.current,
|
|
1190
1181
|
config: {
|
|
1191
|
-
velocity:
|
|
1182
|
+
velocity: w
|
|
1192
1183
|
}
|
|
1193
1184
|
}), i.cancel()));
|
|
1194
1185
|
},
|
|
1195
1186
|
{
|
|
1196
|
-
enabled:
|
|
1187
|
+
enabled: rt,
|
|
1197
1188
|
axis: a,
|
|
1198
1189
|
rubberband: !e,
|
|
1199
1190
|
...e ? {} : {
|
|
1200
1191
|
bounds: () => ({
|
|
1201
1192
|
right: 0,
|
|
1202
|
-
left: -
|
|
1203
|
-
top: -
|
|
1193
|
+
left: -H(0),
|
|
1194
|
+
top: -H(0),
|
|
1204
1195
|
bottom: 0
|
|
1205
1196
|
})
|
|
1206
1197
|
},
|
|
1207
1198
|
from: () => [R.value.get(), R.value.get()]
|
|
1208
1199
|
}
|
|
1209
1200
|
);
|
|
1210
|
-
function
|
|
1211
|
-
var
|
|
1212
|
-
return typeof i == "number" ?
|
|
1201
|
+
function Ct(i) {
|
|
1202
|
+
var l, _;
|
|
1203
|
+
return typeof i == "number" ? f.current === i : ((l = t.find((v) => v.id === i)) == null ? void 0 : l.id) === ((_ = t[f.current]) == null ? void 0 : _.id);
|
|
1213
1204
|
}
|
|
1214
1205
|
return {
|
|
1215
|
-
carouselFragment: /* @__PURE__ */
|
|
1206
|
+
carouselFragment: /* @__PURE__ */ Ot(
|
|
1216
1207
|
"div",
|
|
1217
1208
|
{
|
|
1218
|
-
ref:
|
|
1209
|
+
ref: k,
|
|
1219
1210
|
className: "ReactSpringCarouselContainer",
|
|
1220
1211
|
"data-part": "Container",
|
|
1221
1212
|
"data-part-internal": `${n}-Container`,
|
|
1222
|
-
...
|
|
1213
|
+
...kt(),
|
|
1223
1214
|
children: [
|
|
1224
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ X(
|
|
1225
1216
|
"style",
|
|
1226
1217
|
{
|
|
1227
1218
|
dangerouslySetInnerHTML: {
|
|
1228
1219
|
__html: `
|
|
1229
1220
|
:root {
|
|
1230
|
-
--${n}-start-end-gutter: ${
|
|
1221
|
+
--${n}-start-end-gutter: ${c * 2}px;
|
|
1231
1222
|
--${n}-gutter: ${o}px;
|
|
1232
1223
|
}
|
|
1233
1224
|
[data-part-internal="${n}-Container"] {
|
|
@@ -1238,9 +1229,9 @@ function Oe({
|
|
|
1238
1229
|
--${n}-items-per-slide: ${s};
|
|
1239
1230
|
--${n}-offset-position: 0px;
|
|
1240
1231
|
--${n}-offset-modifier: 0px;
|
|
1241
|
-
--${n}-scroll-x-value: ${
|
|
1242
|
-
--${n}-scroll-y-value: ${
|
|
1243
|
-
touch-action: ${
|
|
1232
|
+
--${n}-scroll-x-value: ${a === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1233
|
+
--${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1234
|
+
touch-action: ${rt ? a === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1244
1235
|
}
|
|
1245
1236
|
[data-part-internal="${n}-Track"] {
|
|
1246
1237
|
display: flex;
|
|
@@ -1248,39 +1239,33 @@ function Oe({
|
|
|
1248
1239
|
--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});
|
|
1249
1240
|
|
|
1250
1241
|
|
|
1251
|
-
left: ${
|
|
1252
|
-
top: ${
|
|
1242
|
+
left: ${e && a === "x" && !m ? "var(--initial-offset-modifier)" : "0px"};
|
|
1243
|
+
top: ${e && a === "y" && !m ? "var(--initial-offset-modifier)" : "0px"};
|
|
1253
1244
|
flex-direction: ${a === "x" ? "row" : "column"};
|
|
1254
1245
|
width: 100%;
|
|
1255
1246
|
height: 100%;
|
|
1256
1247
|
gap: var(--${n}-gutter);
|
|
1257
1248
|
transform: translate3d(var(--${n}-scroll-x-value), var(--${n}-scroll-y-value), 0px);
|
|
1258
|
-
overflow-x: ${c === "freeScroll" ? "auto" : "visible"};
|
|
1259
1249
|
}
|
|
1260
1250
|
[data-part-internal="${n}-Item"] {
|
|
1261
1251
|
display: flex;
|
|
1262
|
-
flex:
|
|
1252
|
+
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)))
|
|
1263
1253
|
}
|
|
1264
1254
|
`
|
|
1265
1255
|
}
|
|
1266
1256
|
}
|
|
1267
1257
|
),
|
|
1268
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ X(
|
|
1269
1259
|
"div",
|
|
1270
1260
|
{
|
|
1271
|
-
ref:
|
|
1261
|
+
ref: A,
|
|
1272
1262
|
className: "ReactSpringCarouselTrack",
|
|
1273
1263
|
"data-part": "Track",
|
|
1274
1264
|
"data-part-internal": `${n}-Track`,
|
|
1275
1265
|
onScroll: () => {
|
|
1276
|
-
|
|
1266
|
+
C.current = !1, O.current = !1;
|
|
1277
1267
|
},
|
|
1278
|
-
|
|
1279
|
-
onWheel() {
|
|
1280
|
-
T.current = !1, I.current = !1, R.value.stop();
|
|
1281
|
-
}
|
|
1282
|
-
} : {},
|
|
1283
|
-
children: Dt.map((i, d) => /* @__PURE__ */ Q(
|
|
1268
|
+
children: It.map((i, l) => /* @__PURE__ */ X(
|
|
1284
1269
|
"div",
|
|
1285
1270
|
{
|
|
1286
1271
|
className: "ReactSpringCarouselItem",
|
|
@@ -1288,22 +1273,22 @@ function Oe({
|
|
|
1288
1273
|
"data-part-internal": `${n}-Item`,
|
|
1289
1274
|
"data-id": i.id,
|
|
1290
1275
|
children: typeof i.renderItem == "function" ? i.renderItem({
|
|
1291
|
-
useListenToCustomEvent:
|
|
1292
|
-
index:
|
|
1276
|
+
useListenToCustomEvent: et,
|
|
1277
|
+
index: l,
|
|
1293
1278
|
isClonedItem: !!i.isClonedItem,
|
|
1294
|
-
isActiveItem:
|
|
1279
|
+
isActiveItem: Ct
|
|
1295
1280
|
}) : i.renderItem
|
|
1296
1281
|
},
|
|
1297
|
-
`${i.id}-${
|
|
1282
|
+
`${i.id}-${l}`
|
|
1298
1283
|
))
|
|
1299
1284
|
}
|
|
1300
1285
|
)
|
|
1301
1286
|
]
|
|
1302
1287
|
}
|
|
1303
1288
|
),
|
|
1304
|
-
useListenToCustomEvent:
|
|
1305
|
-
slideToNextItem: () =>
|
|
1306
|
-
slideToPrevItem: () =>
|
|
1289
|
+
useListenToCustomEvent: et,
|
|
1290
|
+
slideToNextItem: () => W(),
|
|
1291
|
+
slideToPrevItem: () => G(),
|
|
1307
1292
|
slideToItem: (i) => {
|
|
1308
1293
|
if (typeof i == "number") {
|
|
1309
1294
|
if (!t[i]) {
|
|
@@ -1312,21 +1297,21 @@ function Oe({
|
|
|
1312
1297
|
);
|
|
1313
1298
|
return;
|
|
1314
1299
|
}
|
|
1315
|
-
i >
|
|
1300
|
+
i > f.current ? W(i) : G(i);
|
|
1316
1301
|
}
|
|
1317
1302
|
if (typeof i == "string") {
|
|
1318
|
-
const
|
|
1319
|
-
if (
|
|
1303
|
+
const l = t.findIndex((_) => _.id === i);
|
|
1304
|
+
if (l < 0) {
|
|
1320
1305
|
console.warn(
|
|
1321
1306
|
`The item you're trying to slide doesn't exist. id: ${i}`
|
|
1322
1307
|
);
|
|
1323
1308
|
return;
|
|
1324
1309
|
}
|
|
1325
|
-
|
|
1310
|
+
l > f.current ? W(l) : G(l);
|
|
1326
1311
|
}
|
|
1327
1312
|
}
|
|
1328
1313
|
};
|
|
1329
1314
|
}
|
|
1330
1315
|
export {
|
|
1331
|
-
|
|
1316
|
+
Ce as useSpringCarousel
|
|
1332
1317
|
};
|