react-spring-carousel 3.0.0-beta-2.1.1 → 3.0.0-beta-2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +555 -526
- package/dist/index.umd.js +10 -10
- package/dist/types.d.ts +12 -0
- package/dist/useSpringCarousel.d.ts +1 -1
- package/package.json +1 -1
- package/dist/utils.d.ts +0 -6
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSpringRef as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as ee, jsx as q } from "react/jsx-runtime";
|
|
2
|
+
import { useSpringRef as re, useSpring as Mt } from "@react-spring/web";
|
|
3
|
+
import at, { useRef as _, useEffect as G, useState as Tt, useCallback as ne, useMemo as ct } from "react";
|
|
4
|
+
function se(r, t, e) {
|
|
5
5
|
return Math.max(t, Math.min(r, e));
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const E = {
|
|
8
8
|
toVector(r, t) {
|
|
9
9
|
return r === void 0 && (r = t), Array.isArray(r) ? r : [r, r];
|
|
10
10
|
},
|
|
@@ -21,17 +21,17 @@ const x = {
|
|
|
21
21
|
r[0] -= t[0], r[1] -= t[1];
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function It(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 Et(r, t, e, n = 0.15) {
|
|
28
|
+
return n === 0 ? se(r, t, e) : r < t ? -It(t - r, e - t, n) + t : r > e ? +It(r - e, e - t, n) + e : r;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const [[
|
|
32
|
-
return [
|
|
30
|
+
function ie(r, [t, e], [n, s]) {
|
|
31
|
+
const [[o, a], [u, c]] = r;
|
|
32
|
+
return [Et(t, o, a, n), Et(e, u, c, s)];
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function oe(r, t) {
|
|
35
35
|
if (typeof r != "object" || r === null) return r;
|
|
36
36
|
var e = r[Symbol.toPrimitive];
|
|
37
37
|
if (e !== void 0) {
|
|
@@ -41,19 +41,19 @@ function ne(r, t) {
|
|
|
41
41
|
}
|
|
42
42
|
return (t === "string" ? String : Number)(r);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
44
|
+
function ae(r) {
|
|
45
|
+
var t = oe(r, "string");
|
|
46
46
|
return typeof t == "symbol" ? t : String(t);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return t =
|
|
48
|
+
function C(r, t, e) {
|
|
49
|
+
return t = ae(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 St(r, t) {
|
|
57
57
|
var e = Object.keys(r);
|
|
58
58
|
if (Object.getOwnPropertySymbols) {
|
|
59
59
|
var n = Object.getOwnPropertySymbols(r);
|
|
@@ -63,18 +63,18 @@ function Tt(r, t) {
|
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function y(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 ? St(Object(e), !0).forEach(function(n) {
|
|
70
|
+
C(r, n, e[n]);
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : St(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 Lt = {
|
|
78
78
|
pointer: {
|
|
79
79
|
start: "down",
|
|
80
80
|
change: "move",
|
|
@@ -96,98 +96,98 @@ const Nt = {
|
|
|
96
96
|
end: "end"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function kt(r) {
|
|
100
100
|
return r ? r[0].toUpperCase() + r.slice(1) : "";
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return r && !
|
|
102
|
+
const ce = ["enter", "leave"];
|
|
103
|
+
function ue(r = !1, t) {
|
|
104
|
+
return r && !ce.includes(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const n =
|
|
108
|
-
return "on" +
|
|
106
|
+
function le(r, t = "", e = !1) {
|
|
107
|
+
const n = Lt[r], s = n && n[t] || t;
|
|
108
|
+
return "on" + kt(r) + kt(s) + (ue(e, s) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const fe = ["gotpointercapture", "lostpointercapture"];
|
|
111
|
+
function de(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 = fe.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 he(r, t = "") {
|
|
123
|
+
const e = Lt[r], n = e && e[t] || t;
|
|
124
124
|
return r + n;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function tt(r) {
|
|
127
127
|
return "touches" in r;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
129
|
+
function Vt(r) {
|
|
130
|
+
return tt(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function pe(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 ge(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 tt(r) ? ge(r)[0] : r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function me(r) {
|
|
145
|
+
return pe(r).map((t) => t.identifier);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const t =
|
|
149
|
-
return
|
|
147
|
+
function ut(r) {
|
|
148
|
+
const t = Bt(r);
|
|
149
|
+
return tt(r) ? t.identifier : t.pointerId;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const t =
|
|
151
|
+
function Ct(r) {
|
|
152
|
+
const t = Bt(r);
|
|
153
153
|
return [t.clientX, t.clientY];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function ve(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;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function Z(r, ...t) {
|
|
174
174
|
return typeof r == "function" ? r(...t) : r;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function ye() {
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return r.length === 0 ?
|
|
178
|
+
function be(...r) {
|
|
179
|
+
return r.length === 0 ? ye : r.length === 1 ? r[0] : function() {
|
|
180
180
|
let t;
|
|
181
181
|
for (const e of r)
|
|
182
182
|
t = e.apply(this, arguments) || t;
|
|
183
183
|
return t;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Dt(r, t) {
|
|
187
187
|
return Object.assign({}, t, r || {});
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
class
|
|
189
|
+
const _e = 32;
|
|
190
|
+
class we {
|
|
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 ye {
|
|
|
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;
|
|
@@ -243,39 +243,39 @@ class ye {
|
|
|
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,
|
|
248
|
-
const
|
|
249
|
-
|
|
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, ve(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 S = e._delta.map(Math.abs);
|
|
249
|
+
E.addTo(e._distance, S);
|
|
250
250
|
}
|
|
251
251
|
this.axisIntent && this.axisIntent(t);
|
|
252
|
-
const [
|
|
252
|
+
const [a, u] = e._movement, [c, h] = n.threshold, {
|
|
253
253
|
_step: f,
|
|
254
|
-
values:
|
|
254
|
+
values: b
|
|
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(a) >= c && b[0]), f[1] === !1 && (f[1] = Math.abs(u) >= h && b[1])) : (f[0] === !1 && (f[0] = Math.abs(a) >= c && Math.sign(a) * c), f[1] === !1 && (f[1] = Math.abs(u) >= h && Math.sign(u) * h)), e.intentional = f[0] !== !1 || f[1] !== !1, !e.intentional) return;
|
|
257
|
+
const d = [0, 0];
|
|
258
258
|
if (n.hasCustomTransform) {
|
|
259
|
-
const [
|
|
260
|
-
|
|
259
|
+
const [S, R] = b;
|
|
260
|
+
d[0] = f[0] !== !1 ? S - f[0] : 0, d[1] = f[1] !== !1 ? R - f[1] : 0;
|
|
261
261
|
} else
|
|
262
|
-
|
|
263
|
-
this.restrictToAxis && !e._blocked && this.restrictToAxis(
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
const [
|
|
267
|
-
e.overflow = [
|
|
268
|
-
const
|
|
269
|
-
if (e.offset =
|
|
270
|
-
e.delta =
|
|
271
|
-
const
|
|
272
|
-
|
|
262
|
+
d[0] = f[0] !== !1 ? a - f[0] : 0, d[1] = f[1] !== !1 ? u - f[1] : 0;
|
|
263
|
+
this.restrictToAxis && !e._blocked && this.restrictToAxis(d);
|
|
264
|
+
const T = e.offset, I = e._active && !e._blocked || e.active;
|
|
265
|
+
I && (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 = d, this.computeOffset()));
|
|
266
|
+
const [L, P] = e.offset, [[A, O], [D, V]] = e._bounds;
|
|
267
|
+
e.overflow = [L < A ? -1 : L > O ? 1 : 0, P < D ? -1 : P > V ? 1 : 0], e._movementBound[0] = e.overflow[0] ? e._movementBound[0] === !1 ? e._movement[0] : e._movementBound[0] : !1, e._movementBound[1] = e.overflow[1] ? e._movementBound[1] === !1 ? e._movement[1] : e._movementBound[1] : !1;
|
|
268
|
+
const B = e._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
+
if (e.offset = ie(e._bounds, e.offset, B), e.delta = E.sub(e.offset, T), this.computeMovement(), I && (!e.last || o > _e)) {
|
|
270
|
+
e.delta = E.sub(e.offset, T);
|
|
271
|
+
const S = e.delta.map(Math.abs);
|
|
272
|
+
E.addTo(e.distance, S), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && o > 0 && (e.velocity = [S[0] / o, S[1] / o], e.timeDelta = o);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
emit() {
|
|
276
276
|
const t = this.state, e = this.shared, n = this.config;
|
|
277
277
|
if (t._active || this.clean(), (t._blocked || !t.intentional) && !t._force && !n.triggerAllEvents) return;
|
|
278
|
-
const s = this.handler(
|
|
278
|
+
const s = this.handler(y(y(y({}, e), t), {}, {
|
|
279
279
|
[this.aliasKey]: t.values
|
|
280
280
|
}));
|
|
281
281
|
s !== void 0 && (t.memo = s);
|
|
@@ -284,16 +284,16 @@ class ye {
|
|
|
284
284
|
this.eventStore.clean(), this.timeoutStore.clean();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function xe([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 Te extends we {
|
|
295
295
|
constructor(...t) {
|
|
296
|
-
super(...t),
|
|
296
|
+
super(...t), C(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
298
298
|
reset() {
|
|
299
299
|
super.reset(), this.state.axis = void 0;
|
|
@@ -302,16 +302,16 @@ class _e extends ye {
|
|
|
302
302
|
this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
|
|
303
303
|
}
|
|
304
304
|
computeOffset() {
|
|
305
|
-
this.state.offset =
|
|
305
|
+
this.state.offset = E.add(this.state.lastOffset, this.state.movement);
|
|
306
306
|
}
|
|
307
307
|
computeMovement() {
|
|
308
|
-
this.state.movement =
|
|
308
|
+
this.state.movement = E.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[Vt(t)] : n.axisThreshold;
|
|
314
|
+
e.axis = xe(e._movement, s);
|
|
315
315
|
}
|
|
316
316
|
e._blocked = (n.lockDirection || !!n.axis) && !e.axis || !!n.axis && n.axis !== e.axis;
|
|
317
317
|
}
|
|
@@ -327,12 +327,12 @@ class _e extends ye {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
330
|
+
const At = (r) => r, $t = 0.15, dt = {
|
|
331
331
|
enabled(r = !0) {
|
|
332
332
|
return r;
|
|
333
333
|
},
|
|
334
334
|
eventOptions(r, t, e) {
|
|
335
|
-
return
|
|
335
|
+
return y(y({}, e.shared.eventOptions), r);
|
|
336
336
|
},
|
|
337
337
|
preventDefault(r = !1) {
|
|
338
338
|
return r;
|
|
@@ -343,33 +343,33 @@ const kt = (r) => r, Dt = 0.15, ut = {
|
|
|
343
343
|
rubberband(r = 0) {
|
|
344
344
|
switch (r) {
|
|
345
345
|
case !0:
|
|
346
|
-
return [
|
|
346
|
+
return [$t, $t];
|
|
347
347
|
case !1:
|
|
348
348
|
return [0, 0];
|
|
349
349
|
default:
|
|
350
|
-
return
|
|
350
|
+
return E.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 E.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 ||
|
|
361
|
-
return (
|
|
362
|
-
const
|
|
363
|
-
return (!isFinite(
|
|
360
|
+
const s = n || At;
|
|
361
|
+
return (o) => {
|
|
362
|
+
const a = s(o);
|
|
363
|
+
return (!isFinite(a[0]) || !isFinite(a[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${a[0]},${[1]}]`), a;
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
return n ||
|
|
366
|
+
return n || At;
|
|
367
367
|
},
|
|
368
368
|
threshold(r) {
|
|
369
|
-
return
|
|
369
|
+
return E.toVector(r, 0);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
372
|
+
process.env.NODE_ENV === "development" && Object.assign(dt, {
|
|
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(ut, {
|
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const
|
|
389
|
+
const Ie = 0, Y = y(y({}, dt), {}, {
|
|
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 = Ie) {
|
|
396
396
|
return r;
|
|
397
397
|
},
|
|
398
398
|
bounds(r = {}) {
|
|
399
399
|
if (typeof r == "function")
|
|
400
|
-
return (
|
|
400
|
+
return (o) => Y.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 we = 0, F = v(v({}, ut), {}, {
|
|
|
410
410
|
} = r;
|
|
411
411
|
return [[t, e], [n, s]];
|
|
412
412
|
}
|
|
413
|
-
}),
|
|
413
|
+
}), Ot = {
|
|
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 Ee extends Te {
|
|
420
420
|
constructor(...t) {
|
|
421
|
-
super(...t),
|
|
421
|
+
super(...t), C(this, "ingKey", "dragging");
|
|
422
422
|
}
|
|
423
423
|
reset() {
|
|
424
424
|
super.reset();
|
|
@@ -434,7 +434,7 @@ class xe extends _e {
|
|
|
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 = Y.bounds(s);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
cancel() {
|
|
@@ -453,7 +453,7 @@ class xe extends _e {
|
|
|
453
453
|
const e = this.config, n = this.state;
|
|
454
454
|
if (t.buttons != null && (Array.isArray(e.pointerButtons) ? !e.pointerButtons.includes(t.buttons) : e.pointerButtons !== -1 && e.pointerButtons !== t.buttons)) return;
|
|
455
455
|
const s = this.ctrl.setEventIds(t);
|
|
456
|
-
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId =
|
|
456
|
+
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = ut(t), n._pointerActive = !0, this.computeValues(Ct(t)), this.computeInitial(), e.preventScrollAxis && Vt(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : e.delay > 0 ? (this.setupDelayTrigger(t), e.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
|
|
457
457
|
}
|
|
458
458
|
startPointerDrag(t) {
|
|
459
459
|
const e = this.state;
|
|
@@ -462,10 +462,10 @@ class xe extends _e {
|
|
|
462
462
|
pointerMove(t) {
|
|
463
463
|
const e = this.state, n = this.config;
|
|
464
464
|
if (!e._pointerActive) return;
|
|
465
|
-
const s =
|
|
465
|
+
const s = ut(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 =
|
|
467
|
+
const o = Ct(t);
|
|
468
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = E.sub(o, e._values), this.computeValues(o)), E.addTo(e._movement, e._delta), this.compute(t), e._delayed && e.intentional) {
|
|
469
469
|
this.timeoutStore.remove("dragDelay"), e.active = !1, this.startPointerDrag(t);
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
@@ -491,17 +491,17 @@ class xe extends _e {
|
|
|
491
491
|
}
|
|
492
492
|
const e = this.state, n = this.config;
|
|
493
493
|
if (!e._active || !e._pointerActive) return;
|
|
494
|
-
const s =
|
|
494
|
+
const s = ut(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, a] = e._distance;
|
|
498
|
+
if (e.tap = o <= n.tapsThreshold && a <= n.tapsThreshold, e.tap && n.filterTaps)
|
|
499
499
|
e._force = !0;
|
|
500
500
|
else {
|
|
501
|
-
const [
|
|
502
|
-
if (e.elapsedTime <
|
|
503
|
-
const
|
|
504
|
-
|
|
501
|
+
const [u, c] = e._delta, [h, f] = e._movement, [b, d] = n.swipe.velocity, [T, I] = n.swipe.distance, L = n.swipe.duration;
|
|
502
|
+
if (e.elapsedTime < L) {
|
|
503
|
+
const P = Math.abs(u / e.timeDelta), A = Math.abs(c / e.timeDelta);
|
|
504
|
+
P > b && Math.abs(h) > T && (e.swipe[0] = Math.sign(u)), A > d && Math.abs(f) > I && (e.swipe[1] = Math.sign(c));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -528,7 +528,7 @@ class xe extends _e {
|
|
|
528
528
|
this.state._preventScroll && t.cancelable && t.preventDefault();
|
|
529
529
|
}
|
|
530
530
|
setupScrollPrevention(t) {
|
|
531
|
-
this.state._preventScroll = !1,
|
|
531
|
+
this.state._preventScroll = !1, Se(t);
|
|
532
532
|
const e = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
533
533
|
passive: !1
|
|
534
534
|
});
|
|
@@ -540,14 +540,14 @@ class xe extends _e {
|
|
|
540
540
|
}, this.config.delay);
|
|
541
541
|
}
|
|
542
542
|
keyDown(t) {
|
|
543
|
-
const e =
|
|
543
|
+
const e = Ot[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, E.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 Ot && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
|
|
551
551
|
}
|
|
552
552
|
bind(t) {
|
|
553
553
|
const e = this.config.device;
|
|
@@ -557,41 +557,41 @@ class xe extends _e {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Se(r) {
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
|
-
const
|
|
564
|
-
function
|
|
565
|
-
return
|
|
563
|
+
const H = typeof window < "u" && window.document && window.document.createElement;
|
|
564
|
+
function jt() {
|
|
565
|
+
return H && "ontouchstart" in window;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
567
|
+
function ke() {
|
|
568
|
+
return jt() || H && window.navigator.maxTouchPoints > 1;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
570
|
+
function Ce() {
|
|
571
|
+
return H && "onpointerdown" in window;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
return
|
|
573
|
+
function De() {
|
|
574
|
+
return H && "exitPointerLock" in window.document;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function Ae() {
|
|
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 $ = {
|
|
584
|
+
isBrowser: H,
|
|
585
|
+
gesture: Ae(),
|
|
586
|
+
touch: jt(),
|
|
587
|
+
touchscreen: ke(),
|
|
588
|
+
pointer: Ce(),
|
|
589
|
+
pointerLock: De()
|
|
590
|
+
}, $e = 250, Oe = 180, Pe = 0.5, Re = 50, Ne = 250, Me = 10, Pt = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
},
|
|
594
|
+
}, Ut = y(y({}, Y), {}, {
|
|
595
595
|
device(r, t, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: e = !1,
|
|
@@ -599,12 +599,12 @@ const A = {
|
|
|
599
599
|
mouse: s = !1
|
|
600
600
|
} = {}
|
|
601
601
|
}) {
|
|
602
|
-
return this.pointerLock = n &&
|
|
602
|
+
return this.pointerLock = n && $.pointerLock, $.touch && e ? "touch" : this.pointerLock ? "mouse" : $.pointer && !s ? "pointer" : $.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 ? $e : void 0, !(!$.touchscreen || e === !1))
|
|
608
608
|
return r || (e !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
610
|
pointerCapture(r, t, {
|
|
@@ -621,24 +621,24 @@ const A = {
|
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
622
|
axis: s = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const
|
|
625
|
-
return this.filterTaps = e, this.tapsThreshold = n,
|
|
624
|
+
const o = E.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 = Pe,
|
|
629
|
+
distance: t = Re,
|
|
630
|
+
duration: e = Ne
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
|
-
velocity: this.transform(
|
|
634
|
-
distance: this.transform(
|
|
633
|
+
velocity: this.transform(E.toVector(r)),
|
|
634
|
+
distance: this.transform(E.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 Oe;
|
|
642
642
|
case !1:
|
|
643
643
|
return 0;
|
|
644
644
|
default:
|
|
@@ -646,13 +646,13 @@ const A = {
|
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
648
|
axisThreshold(r) {
|
|
649
|
-
return r ?
|
|
649
|
+
return r ? y(y({}, Pt), r) : Pt;
|
|
650
650
|
},
|
|
651
|
-
keyboardDisplacement(r =
|
|
651
|
+
keyboardDisplacement(r = Me) {
|
|
652
652
|
return r;
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
655
|
+
process.env.NODE_ENV === "development" && Object.assign(Ut, {
|
|
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(Vt, {
|
|
|
679
679
|
return NaN;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
|
-
|
|
682
|
+
y(y({}, dt), {}, {
|
|
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 && !$.touch && $.gesture) return "gesture";
|
|
690
|
+
if ($.touch && n) return "touch";
|
|
691
|
+
if ($.touchscreen) {
|
|
692
|
+
if ($.pointer) return "pointer";
|
|
693
|
+
if ($.touch) return "touch";
|
|
694
694
|
}
|
|
695
695
|
},
|
|
696
696
|
bounds(r, t, {
|
|
697
697
|
scaleBounds: e = {},
|
|
698
698
|
angleBounds: n = {}
|
|
699
699
|
}) {
|
|
700
|
-
const s = (
|
|
701
|
-
const
|
|
700
|
+
const s = (a) => {
|
|
701
|
+
const u = Dt(Z(e, a), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
|
-
return [
|
|
706
|
-
},
|
|
707
|
-
const
|
|
705
|
+
return [u.min, u.max];
|
|
706
|
+
}, o = (a) => {
|
|
707
|
+
const u = Dt(Z(n, a), {
|
|
708
708
|
min: -1 / 0,
|
|
709
709
|
max: 1 / 0
|
|
710
710
|
});
|
|
711
|
-
return [
|
|
711
|
+
return [u.min, u.max];
|
|
712
712
|
};
|
|
713
|
-
return typeof e != "function" && typeof n != "function" ? [s(),
|
|
713
|
+
return typeof e != "function" && typeof n != "function" ? [s(), o()] : (a) => [s(a), o(a)];
|
|
714
714
|
},
|
|
715
715
|
threshold(r, t, e) {
|
|
716
|
-
return this.lockDirection = e.axis === "lock",
|
|
716
|
+
return this.lockDirection = e.axis === "lock", E.toVector(r, this.lockDirection ? [0.1, 3] : 0);
|
|
717
717
|
},
|
|
718
718
|
modifierKey(r) {
|
|
719
719
|
return r === void 0 ? "ctrlKey" : r;
|
|
@@ -722,39 +722,39 @@ v(v({}, ut), {}, {
|
|
|
722
722
|
return r;
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
|
-
|
|
725
|
+
y(y({}, Y), {}, {
|
|
726
726
|
mouseOnly: (r = !0) => r
|
|
727
727
|
});
|
|
728
|
-
|
|
728
|
+
y(y({}, Y), {}, {
|
|
729
729
|
mouseOnly: (r = !0) => r
|
|
730
730
|
});
|
|
731
|
-
const
|
|
732
|
-
function
|
|
733
|
-
|
|
731
|
+
const Kt = /* @__PURE__ */ new Map(), ft = /* @__PURE__ */ new Map();
|
|
732
|
+
function Le(r) {
|
|
733
|
+
Kt.set(r.key, r.engine), ft.set(r.key, r.resolver);
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const Ve = {
|
|
736
736
|
key: "drag",
|
|
737
|
-
engine:
|
|
738
|
-
resolver:
|
|
737
|
+
engine: Ee,
|
|
738
|
+
resolver: Ut
|
|
739
739
|
};
|
|
740
|
-
function
|
|
740
|
+
function Be(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 je(r, t) {
|
|
748
748
|
if (r == null) return {};
|
|
749
|
-
var e =
|
|
749
|
+
var e = Be(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 Ue = {
|
|
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 = $.isBrowser ? window : void 0) {
|
|
766
766
|
return r;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
@@ -777,20 +777,20 @@ const Ve = {
|
|
|
777
777
|
transform(r) {
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
781
|
-
function
|
|
780
|
+
}, Ke = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
|
+
function Q(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;
|
|
792
792
|
case "object":
|
|
793
|
-
e[n] =
|
|
793
|
+
e[n] = Q(r[n], s);
|
|
794
794
|
break;
|
|
795
795
|
case "boolean":
|
|
796
796
|
s && (e[n] = r[n]);
|
|
@@ -798,32 +798,32 @@ function q(r = {}, t) {
|
|
|
798
798
|
}
|
|
799
799
|
return e;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function ze(r, t, e = {}) {
|
|
802
802
|
const n = r, {
|
|
803
803
|
target: s,
|
|
804
|
-
eventOptions:
|
|
805
|
-
window:
|
|
806
|
-
enabled:
|
|
804
|
+
eventOptions: o,
|
|
805
|
+
window: a,
|
|
806
|
+
enabled: u,
|
|
807
807
|
transform: c
|
|
808
|
-
} = n, h =
|
|
809
|
-
if (e.shared =
|
|
808
|
+
} = n, h = je(n, Ke);
|
|
809
|
+
if (e.shared = Q({
|
|
810
810
|
target: s,
|
|
811
|
-
eventOptions:
|
|
812
|
-
window:
|
|
813
|
-
enabled:
|
|
811
|
+
eventOptions: o,
|
|
812
|
+
window: a,
|
|
813
|
+
enabled: u,
|
|
814
814
|
transform: c
|
|
815
|
-
},
|
|
816
|
-
const f =
|
|
817
|
-
e[t] =
|
|
815
|
+
}, Ue), t) {
|
|
816
|
+
const f = ft.get(t);
|
|
817
|
+
e[t] = Q(y({
|
|
818
818
|
shared: e.shared
|
|
819
819
|
}, h), f);
|
|
820
820
|
} else
|
|
821
821
|
for (const f in h) {
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
e[f] =
|
|
822
|
+
const b = ft.get(f);
|
|
823
|
+
if (b)
|
|
824
|
+
e[f] = Q(y({
|
|
825
825
|
shared: e.shared
|
|
826
|
-
}, h[f]),
|
|
826
|
+
}, h[f]), b);
|
|
827
827
|
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(f)) {
|
|
828
828
|
if (f === "domTarget")
|
|
829
829
|
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
@@ -832,25 +832,25 @@ function Be(r, t, e = {}) {
|
|
|
832
832
|
}
|
|
833
833
|
return e;
|
|
834
834
|
}
|
|
835
|
-
class
|
|
835
|
+
class zt {
|
|
836
836
|
constructor(t, e) {
|
|
837
|
-
|
|
837
|
+
C(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
838
838
|
}
|
|
839
|
-
add(t, e, n, s,
|
|
840
|
-
const
|
|
841
|
-
t.addEventListener(
|
|
839
|
+
add(t, e, n, s, o) {
|
|
840
|
+
const a = this._listeners, u = he(e, n), c = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, h = y(y({}, c), o);
|
|
841
|
+
t.addEventListener(u, s, h);
|
|
842
842
|
const f = () => {
|
|
843
|
-
t.removeEventListener(
|
|
843
|
+
t.removeEventListener(u, s, h), a.delete(f);
|
|
844
844
|
};
|
|
845
|
-
return
|
|
845
|
+
return a.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 Fe {
|
|
852
852
|
constructor() {
|
|
853
|
-
|
|
853
|
+
C(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,20 +863,20 @@ class Ue {
|
|
|
863
863
|
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
866
|
+
class Ge {
|
|
867
867
|
constructor(t) {
|
|
868
|
-
|
|
868
|
+
C(this, "gestures", /* @__PURE__ */ new Set()), C(this, "_targetEventStore", new zt(this)), C(this, "gestureEventStores", {}), C(this, "gestureTimeoutStores", {}), C(this, "handlers", {}), C(this, "config", {}), C(this, "pointerIds", /* @__PURE__ */ new Set()), C(this, "touchIds", /* @__PURE__ */ new Set()), C(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 (
|
|
879
|
-
return this.touchIds = new Set(
|
|
878
|
+
if (tt(t))
|
|
879
|
+
return this.touchIds = new Set(me(t)), this.touchIds;
|
|
880
880
|
if ("pointerId" in t)
|
|
881
881
|
return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
|
|
882
882
|
}
|
|
@@ -884,7 +884,7 @@ class Ke {
|
|
|
884
884
|
this.handlers = t, this.nativeHandlers = e;
|
|
885
885
|
}
|
|
886
886
|
applyConfig(t, e) {
|
|
887
|
-
this.config =
|
|
887
|
+
this.config = ze(t, e, this.config);
|
|
888
888
|
}
|
|
889
889
|
clean() {
|
|
890
890
|
this._targetEventStore.clean();
|
|
@@ -899,88 +899,88 @@ class Ke {
|
|
|
899
899
|
let s;
|
|
900
900
|
if (!(e.target && (s = e.target(), !s))) {
|
|
901
901
|
if (e.enabled) {
|
|
902
|
-
for (const
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
const h =
|
|
906
|
-
new h(this, t,
|
|
902
|
+
for (const a of this.gestures) {
|
|
903
|
+
const u = this.config[a], c = Rt(n, u.eventOptions, !!s);
|
|
904
|
+
if (u.enabled) {
|
|
905
|
+
const h = Kt.get(a);
|
|
906
|
+
new h(this, t, a).bind(c);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
for (const
|
|
911
|
-
a
|
|
912
|
-
event:
|
|
909
|
+
const o = Rt(n, e.eventOptions, !!s);
|
|
910
|
+
for (const a in this.nativeHandlers)
|
|
911
|
+
o(a, "", (u) => this.nativeHandlers[a](y(y({}, this.state.shared), {}, {
|
|
912
|
+
event: u,
|
|
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] = be(...n[o]);
|
|
918
918
|
if (!s) return n;
|
|
919
|
-
for (const
|
|
919
|
+
for (const o in n) {
|
|
920
920
|
const {
|
|
921
|
-
device:
|
|
922
|
-
capture:
|
|
921
|
+
device: a,
|
|
922
|
+
capture: u,
|
|
923
923
|
passive: c
|
|
924
|
-
} =
|
|
925
|
-
this._targetEventStore.add(s,
|
|
926
|
-
capture:
|
|
924
|
+
} = de(o);
|
|
925
|
+
this._targetEventStore.add(s, a, "", n[o], {
|
|
926
|
+
capture: u,
|
|
927
927
|
passive: c
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
r.gestures.add(t), r.gestureEventStores[t] = new
|
|
933
|
+
function F(r, t) {
|
|
934
|
+
r.gestures.add(t), r.gestureEventStores[t] = new zt(r, t), r.gestureTimeoutStores[t] = new Fe();
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
t.drag &&
|
|
936
|
+
function We(r, t) {
|
|
937
|
+
t.drag && F(r, "drag"), t.wheel && F(r, "wheel"), t.scroll && F(r, "scroll"), t.move && F(r, "move"), t.pinch && F(r, "pinch"), t.hover && F(r, "hover");
|
|
938
938
|
}
|
|
939
|
-
const
|
|
939
|
+
const Rt = (r, t, e) => (n, s, o, a = {}, u = !1) => {
|
|
940
940
|
var c, h;
|
|
941
|
-
const f = (c =
|
|
942
|
-
let
|
|
943
|
-
e &&
|
|
941
|
+
const f = (c = a.capture) !== null && c !== void 0 ? c : t.capture, b = (h = a.passive) !== null && h !== void 0 ? h : t.passive;
|
|
942
|
+
let d = u ? n : le(n, s, f);
|
|
943
|
+
e && b && (d += "Passive"), r[d] = r[d] || [], r[d].push(o);
|
|
944
944
|
};
|
|
945
|
-
function
|
|
946
|
-
const s =
|
|
947
|
-
if (s.applyHandlers(r, n), s.applyConfig(t, e),
|
|
945
|
+
function Ye(r, t = {}, e, n) {
|
|
946
|
+
const s = at.useMemo(() => new Ge(r), []);
|
|
947
|
+
if (s.applyHandlers(r, n), s.applyConfig(t, e), at.useEffect(s.effect.bind(s)), at.useEffect(() => s.clean.bind(s), []), t.target === void 0)
|
|
948
948
|
return s.bind.bind(s);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
return
|
|
950
|
+
function He(r, t) {
|
|
951
|
+
return Le(Ve), Ye({
|
|
952
952
|
drag: r
|
|
953
953
|
}, t || {}, "drag");
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Xe(r) {
|
|
956
956
|
const {
|
|
957
957
|
type: t,
|
|
958
958
|
actionType: e,
|
|
959
959
|
toIndex: n,
|
|
960
960
|
itemsLength: s,
|
|
961
|
-
withLoop:
|
|
962
|
-
scrollAmount:
|
|
963
|
-
totalAvailable:
|
|
961
|
+
withLoop: o,
|
|
962
|
+
scrollAmount: a,
|
|
963
|
+
totalAvailable: u
|
|
964
964
|
} = r;
|
|
965
|
-
let c = r.currentActive, h = r.fromValueRaw, f = !1,
|
|
965
|
+
let c = r.currentActive, h = r.fromValueRaw, f = !1, b = !1;
|
|
966
966
|
t === "next" && (c += 1), t === "prev" && (c = c === 0 ? s - 1 : c - 1), n !== void 0 && (c = n);
|
|
967
|
-
let
|
|
968
|
-
t === "next" && (
|
|
969
|
-
const
|
|
967
|
+
let d = 0;
|
|
968
|
+
t === "next" && (d = -(c * a), o && c === s && (c = 0, h = h + a * s, d = 0), !o && (Math.abs(d) >= u || c === s - 1) && (b = !0, d = -u)), t === "prev" && (d = -(c * a), c === s - 1 && (h = h - s * a), !o && d >= 0 && (f = !0, d = 0)), e === "resize" && (d = -(c * a), o || (c === 0 && (f = !0), (c === s - 1 || Math.abs(d) >= u) && (b = !0, Math.abs(d) >= u && u > 0 && (d = -u))));
|
|
969
|
+
const T = o ? c % s : c, I = o ? s + c % s : c;
|
|
970
970
|
return {
|
|
971
971
|
newActive: c,
|
|
972
972
|
fromValue: h,
|
|
973
|
-
toValue:
|
|
973
|
+
toValue: d,
|
|
974
974
|
startReached: f,
|
|
975
|
-
endReached:
|
|
976
|
-
logicalIndex:
|
|
977
|
-
realTrackIndex:
|
|
975
|
+
endReached: b,
|
|
976
|
+
logicalIndex: T,
|
|
977
|
+
realTrackIndex: I
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function J(r, t, e) {
|
|
981
981
|
return t === "x" ? `translate3d(calc(${r}px + var(--${e}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${r}px + var(--${e}-offset-modifier)), 0px)`;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function qe() {
|
|
984
984
|
const r = _(
|
|
985
985
|
null
|
|
986
986
|
);
|
|
@@ -988,7 +988,7 @@ function Ye() {
|
|
|
988
988
|
const t = _(null);
|
|
989
989
|
return t.current === null && (t.current = {
|
|
990
990
|
useListenToCustomEvent(e) {
|
|
991
|
-
|
|
991
|
+
G(() => {
|
|
992
992
|
const n = r.current;
|
|
993
993
|
return n.add(e), () => {
|
|
994
994
|
n.delete(e);
|
|
@@ -1001,320 +1001,348 @@ function Ye() {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
}), t.current;
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1005
|
-
let t = r.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
|
|
1006
|
-
return t = t.replace(/[\n\t]+/g, " "), t = t.replace(/\s*([{}:;,])\s*/g, "$1"), t = t.replace(/\s+}/g, "}"), t = t.replace(/{\s+/g, "{"), t = t.replace(/\s+/g, " "), t.trim();
|
|
1007
|
-
}
|
|
1008
|
-
function tr({
|
|
1004
|
+
function rr({
|
|
1009
1005
|
init: r = !0,
|
|
1010
1006
|
items: t,
|
|
1011
1007
|
withLoop: e = !1,
|
|
1012
1008
|
id: n,
|
|
1013
1009
|
gutter: s = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
|
|
1014
|
-
itemsPerSlide:
|
|
1015
|
-
carouselAxis:
|
|
1016
|
-
startingPosition:
|
|
1010
|
+
itemsPerSlide: o = [{ breakpoint: 0, itemsPerSlide: 1 }],
|
|
1011
|
+
carouselAxis: a = "x",
|
|
1012
|
+
startingPosition: u = "start",
|
|
1017
1013
|
enableGestures: c = !0,
|
|
1018
1014
|
slideWhenDragThresholdIsReached: h = !0,
|
|
1019
1015
|
slideType: f = "item",
|
|
1020
|
-
initialActiveItem:
|
|
1021
|
-
renderWindow:
|
|
1016
|
+
initialActiveItem: b = 0,
|
|
1017
|
+
renderWindow: d,
|
|
1018
|
+
renderPlaceholder: T
|
|
1022
1019
|
}) {
|
|
1023
|
-
const [
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
const
|
|
1028
|
-
function
|
|
1020
|
+
const [I, L] = Tt(!1), [, P] = Tt(0), A = _(r), O = _(null), D = _(null), V = _(0), B = _(0), S = _(!e), R = _(!1), et = _(0), w = _(0), ht = _(t);
|
|
1021
|
+
ht.current = t;
|
|
1022
|
+
const pt = _(e);
|
|
1023
|
+
pt.current = e;
|
|
1024
|
+
const gt = _(!1), j = _(null), N = _(null), U = _(null), W = _({ width: 0, height: 0 });
|
|
1025
|
+
function mt(i) {
|
|
1029
1026
|
if (i === void 0) return 0;
|
|
1030
1027
|
if (typeof i == "number")
|
|
1031
1028
|
return t[i] ? i : (console.warn(
|
|
1032
1029
|
`initialActiveItem: item at index ${i} doesn't exist.`
|
|
1033
1030
|
), 0);
|
|
1034
|
-
const
|
|
1035
|
-
return
|
|
1031
|
+
const l = t.findIndex((m) => m.id === i);
|
|
1032
|
+
return l < 0 ? (console.warn(`initialActiveItem: item with id "${i}" doesn't exist.`), 0) : l;
|
|
1036
1033
|
}
|
|
1037
|
-
const
|
|
1034
|
+
const X = re(), rt = Mt({
|
|
1038
1035
|
value: 0,
|
|
1039
|
-
ref:
|
|
1036
|
+
ref: X,
|
|
1040
1037
|
onChange({ value: i }) {
|
|
1041
|
-
D.current.style.transform =
|
|
1038
|
+
D.current.style.transform = J(
|
|
1042
1039
|
i.value,
|
|
1043
|
-
|
|
1040
|
+
a,
|
|
1044
1041
|
n
|
|
1045
1042
|
);
|
|
1046
1043
|
}
|
|
1047
|
-
}),
|
|
1048
|
-
function
|
|
1044
|
+
}), Ft = e ? t.length * 3 : t.length, { useListenToCustomEvent: vt, emitEvent: K } = qe();
|
|
1045
|
+
function yt(i) {
|
|
1049
1046
|
if (!i || i.length === 0) return null;
|
|
1050
|
-
let
|
|
1051
|
-
for (const
|
|
1052
|
-
(
|
|
1053
|
-
return
|
|
1047
|
+
let l = null, m = -1 / 0;
|
|
1048
|
+
for (const p of i)
|
|
1049
|
+
(p.media ? window.matchMedia(p.media).matches : window.innerWidth >= p.breakpoint) && p.breakpoint >= m && (l = p, m = p.breakpoint);
|
|
1050
|
+
return l;
|
|
1054
1051
|
}
|
|
1055
|
-
function
|
|
1056
|
-
const { totalGutterCssVar: i } =
|
|
1052
|
+
function bt() {
|
|
1053
|
+
const { totalGutterCssVar: i } = _t();
|
|
1057
1054
|
return i;
|
|
1058
1055
|
}
|
|
1059
|
-
function
|
|
1060
|
-
const i =
|
|
1056
|
+
function Gt() {
|
|
1057
|
+
const i = yt(o);
|
|
1061
1058
|
return (i == null ? void 0 : i.itemsPerSlide) || 1;
|
|
1062
1059
|
}
|
|
1063
|
-
function
|
|
1064
|
-
|
|
1060
|
+
function nt(i) {
|
|
1061
|
+
A.current && (R.current || z({
|
|
1065
1062
|
type: "next",
|
|
1066
1063
|
toIndex: i,
|
|
1067
1064
|
actionType: "click"
|
|
1068
1065
|
}));
|
|
1069
1066
|
}
|
|
1070
|
-
function
|
|
1071
|
-
|
|
1067
|
+
function st(i) {
|
|
1068
|
+
A.current && (S.current || z({
|
|
1072
1069
|
type: "prev",
|
|
1073
1070
|
toIndex: i,
|
|
1074
1071
|
actionType: "click"
|
|
1075
1072
|
}));
|
|
1076
1073
|
}
|
|
1077
|
-
function
|
|
1074
|
+
function z({
|
|
1078
1075
|
type: i,
|
|
1079
|
-
shouldAnimate:
|
|
1076
|
+
shouldAnimate: l = !0,
|
|
1080
1077
|
toIndex: m,
|
|
1081
|
-
actionType:
|
|
1078
|
+
actionType: p
|
|
1082
1079
|
}) {
|
|
1083
|
-
var
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
const
|
|
1080
|
+
var x, g;
|
|
1081
|
+
const k = !l;
|
|
1082
|
+
S.current = !1, R.current = !1;
|
|
1083
|
+
const v = Xe({
|
|
1087
1084
|
type: i,
|
|
1088
|
-
actionType:
|
|
1085
|
+
actionType: p,
|
|
1089
1086
|
toIndex: m,
|
|
1090
|
-
currentActive:
|
|
1087
|
+
currentActive: w.current,
|
|
1091
1088
|
itemsLength: t.length,
|
|
1092
1089
|
withLoop: e,
|
|
1093
|
-
scrollAmount:
|
|
1094
|
-
totalAvailable: i === "next" ?
|
|
1095
|
-
e ?
|
|
1090
|
+
scrollAmount: B.current,
|
|
1091
|
+
totalAvailable: i === "next" || p === "resize" ? it(
|
|
1092
|
+
e ? B.current * (t.length * 2) : 0
|
|
1096
1093
|
) : 0,
|
|
1097
|
-
fromValueRaw:
|
|
1094
|
+
fromValueRaw: rt.value.get()
|
|
1098
1095
|
});
|
|
1099
|
-
|
|
1096
|
+
w.current = v.newActive, S.current = v.startReached, R.current = v.endReached, V.current = v.toValue, d !== void 0 && P((M) => M + 1), K(p === "resize" ? {
|
|
1100
1097
|
eventName: "onResize",
|
|
1101
|
-
sliceActionType:
|
|
1098
|
+
sliceActionType: p,
|
|
1102
1099
|
slideDirection: i,
|
|
1103
1100
|
currentItem: {
|
|
1104
|
-
id: ((
|
|
1105
|
-
index:
|
|
1106
|
-
trackIndex:
|
|
1107
|
-
startReached:
|
|
1108
|
-
endReached:
|
|
1101
|
+
id: ((x = t.at(v.logicalIndex)) == null ? void 0 : x.id) ?? "",
|
|
1102
|
+
index: v.logicalIndex,
|
|
1103
|
+
trackIndex: v.realTrackIndex,
|
|
1104
|
+
startReached: S.current,
|
|
1105
|
+
endReached: R.current
|
|
1109
1106
|
}
|
|
1110
1107
|
} : {
|
|
1111
1108
|
eventName: "onSlideStartChange",
|
|
1112
|
-
sliceActionType:
|
|
1109
|
+
sliceActionType: p,
|
|
1113
1110
|
slideDirection: i,
|
|
1114
1111
|
nextItem: {
|
|
1115
|
-
index:
|
|
1116
|
-
id: ((
|
|
1117
|
-
trackIndex:
|
|
1118
|
-
startReached:
|
|
1119
|
-
endReached:
|
|
1112
|
+
index: v.logicalIndex,
|
|
1113
|
+
id: ((g = t.at(v.logicalIndex)) == null ? void 0 : g.id) ?? "",
|
|
1114
|
+
trackIndex: v.realTrackIndex,
|
|
1115
|
+
startReached: S.current,
|
|
1116
|
+
endReached: R.current
|
|
1120
1117
|
}
|
|
1121
|
-
}),
|
|
1122
|
-
immediate:
|
|
1123
|
-
from: { value:
|
|
1124
|
-
to: { value:
|
|
1125
|
-
onChange({ value:
|
|
1126
|
-
D.current.style.transform =
|
|
1127
|
-
|
|
1128
|
-
|
|
1118
|
+
}), X.start({
|
|
1119
|
+
immediate: k,
|
|
1120
|
+
from: { value: v.fromValue },
|
|
1121
|
+
to: { value: v.toValue },
|
|
1122
|
+
onChange({ value: M }) {
|
|
1123
|
+
D.current.style.transform = J(
|
|
1124
|
+
M.value,
|
|
1125
|
+
a,
|
|
1129
1126
|
n
|
|
1130
1127
|
);
|
|
1131
1128
|
},
|
|
1132
|
-
onRest({ finished:
|
|
1133
|
-
var
|
|
1134
|
-
if (
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1129
|
+
onRest({ finished: M }) {
|
|
1130
|
+
var wt;
|
|
1131
|
+
if (M) {
|
|
1132
|
+
const xt = e ? w.current % t.length : w.current, te = e ? t.length + w.current % t.length : w.current;
|
|
1133
|
+
K({
|
|
1137
1134
|
eventName: "onSlideChangeComplete",
|
|
1138
|
-
sliceActionType:
|
|
1135
|
+
sliceActionType: p,
|
|
1139
1136
|
slideDirection: i,
|
|
1140
1137
|
currentItem: {
|
|
1141
|
-
index:
|
|
1142
|
-
id: ((
|
|
1143
|
-
trackIndex:
|
|
1144
|
-
startReached:
|
|
1145
|
-
endReached:
|
|
1138
|
+
index: xt,
|
|
1139
|
+
id: ((wt = t.at(xt)) == null ? void 0 : wt.id) ?? "",
|
|
1140
|
+
trackIndex: te,
|
|
1141
|
+
startReached: S.current,
|
|
1142
|
+
endReached: R.current
|
|
1146
1143
|
}
|
|
1147
1144
|
});
|
|
1148
1145
|
}
|
|
1149
1146
|
}
|
|
1150
1147
|
});
|
|
1151
1148
|
}
|
|
1152
|
-
function
|
|
1149
|
+
function Wt() {
|
|
1153
1150
|
const i = D.current;
|
|
1154
|
-
let
|
|
1155
|
-
return f === "item" ?
|
|
1151
|
+
let l = 0;
|
|
1152
|
+
return f === "item" ? l = i.children[0].getBoundingClientRect()[a === "x" ? "width" : "height"] + bt() : l = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + bt(), l;
|
|
1156
1153
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const
|
|
1159
|
-
return
|
|
1154
|
+
function it(i) {
|
|
1155
|
+
const l = D.current;
|
|
1156
|
+
return l[a === "x" ? "scrollWidth" : "scrollHeight"] - l.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
|
|
1160
1157
|
}
|
|
1161
|
-
function
|
|
1162
|
-
const i =
|
|
1158
|
+
function _t() {
|
|
1159
|
+
const i = yt(s);
|
|
1163
1160
|
return {
|
|
1164
1161
|
totalGutterCssVar: (i == null ? void 0 : i.gutter) || 0,
|
|
1165
1162
|
totalStartEndGutterCssVar: ((i == null ? void 0 : i.startEndGutter) || 0) * 2
|
|
1166
1163
|
};
|
|
1167
1164
|
}
|
|
1168
|
-
|
|
1169
|
-
function i(
|
|
1170
|
-
const
|
|
1171
|
-
switch (
|
|
1165
|
+
G(() => {
|
|
1166
|
+
function i(x) {
|
|
1167
|
+
const g = Gt();
|
|
1168
|
+
switch (x) {
|
|
1172
1169
|
case "start":
|
|
1173
1170
|
return 0;
|
|
1174
1171
|
case "middle-start":
|
|
1175
|
-
return Math.floor((
|
|
1172
|
+
return Math.floor((g - 1) * 0.25);
|
|
1176
1173
|
case "center":
|
|
1177
|
-
return Math.floor((
|
|
1174
|
+
return Math.floor((g - 1) * 0.5);
|
|
1178
1175
|
case "middle-end":
|
|
1179
|
-
return Math.floor((
|
|
1176
|
+
return Math.floor((g - 1) * 0.75);
|
|
1180
1177
|
case "end":
|
|
1181
|
-
return
|
|
1178
|
+
return g - 1;
|
|
1182
1179
|
default:
|
|
1183
1180
|
return 0;
|
|
1184
1181
|
}
|
|
1185
1182
|
}
|
|
1186
|
-
function
|
|
1187
|
-
|
|
1188
|
-
const { totalStartEndGutterCssVar:
|
|
1189
|
-
let
|
|
1190
|
-
e && (
|
|
1183
|
+
function l() {
|
|
1184
|
+
B.current = Wt(), et.current = B.current / 4;
|
|
1185
|
+
const { totalStartEndGutterCssVar: x } = _t();
|
|
1186
|
+
let g = 0;
|
|
1187
|
+
e && (g = B.current * t.length), g -= B.current * i(u), g -= x / 2, O.current.style.setProperty(
|
|
1191
1188
|
`--${n}-offset-modifier`,
|
|
1192
|
-
`${-
|
|
1189
|
+
`${-g}px`
|
|
1193
1190
|
);
|
|
1194
1191
|
}
|
|
1195
|
-
function m(
|
|
1196
|
-
if (
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1192
|
+
function m(x) {
|
|
1193
|
+
if (O.current && (l(), L(!0), x)) {
|
|
1194
|
+
const g = mt(b), M = e ? t.length + g % t.length : g;
|
|
1195
|
+
K({ eventName: "onInit", index: g, trackIndex: M });
|
|
1199
1196
|
}
|
|
1200
1197
|
}
|
|
1201
|
-
function
|
|
1202
|
-
m(),
|
|
1198
|
+
function p() {
|
|
1199
|
+
m(), z({
|
|
1203
1200
|
type: "resize",
|
|
1204
|
-
toIndex:
|
|
1201
|
+
toIndex: w.current,
|
|
1205
1202
|
shouldAnimate: !1,
|
|
1206
1203
|
actionType: "resize"
|
|
1207
1204
|
});
|
|
1208
1205
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1206
|
+
function k() {
|
|
1207
|
+
U.current === null && (U.current = requestAnimationFrame(() => {
|
|
1208
|
+
U.current = null;
|
|
1209
|
+
const x = O.current;
|
|
1210
|
+
if (!x) return;
|
|
1211
|
+
const g = x.getBoundingClientRect();
|
|
1212
|
+
(g.width !== W.current.width || g.height !== W.current.height) && (W.current = {
|
|
1213
|
+
width: g.width,
|
|
1214
|
+
height: g.height
|
|
1215
|
+
}, p());
|
|
1216
|
+
}));
|
|
1217
|
+
}
|
|
1218
|
+
function v() {
|
|
1219
|
+
setTimeout(() => {
|
|
1220
|
+
W.current = { width: 0, height: 0 }, k();
|
|
1221
|
+
}, 250);
|
|
1222
|
+
}
|
|
1223
|
+
if (r) {
|
|
1224
|
+
if (A.current = !0, gt.current)
|
|
1225
|
+
p();
|
|
1226
|
+
else if (m(!0), gt.current = !0, O.current) {
|
|
1227
|
+
const g = O.current.getBoundingClientRect();
|
|
1228
|
+
W.current = {
|
|
1229
|
+
width: g.width,
|
|
1230
|
+
height: g.height
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
const x = window.visualViewport ?? window;
|
|
1234
|
+
return x.addEventListener("resize", k), window.addEventListener("orientationchange", v), () => {
|
|
1235
|
+
x.removeEventListener("resize", k), window.removeEventListener(
|
|
1236
|
+
"orientationchange",
|
|
1237
|
+
v
|
|
1238
|
+
), U.current !== null && (cancelAnimationFrame(U.current), U.current = null);
|
|
1212
1239
|
};
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1240
|
+
}
|
|
1241
|
+
}, [r, n, a, e]), G(() => {
|
|
1242
|
+
const i = mt(b);
|
|
1243
|
+
r && i !== w.current && z({
|
|
1216
1244
|
type: "next",
|
|
1217
1245
|
toIndex: i,
|
|
1218
1246
|
actionType: "resize",
|
|
1219
1247
|
shouldAnimate: !1
|
|
1220
1248
|
});
|
|
1221
|
-
}, [r,
|
|
1222
|
-
const
|
|
1223
|
-
function
|
|
1224
|
-
if (
|
|
1225
|
-
const i =
|
|
1226
|
-
|
|
1249
|
+
}, [r, b]);
|
|
1250
|
+
const ot = c;
|
|
1251
|
+
function Yt() {
|
|
1252
|
+
if (N.current !== null && (cancelAnimationFrame(N.current), N.current = null), j.current) {
|
|
1253
|
+
const i = j.current;
|
|
1254
|
+
j.current = null, K(i);
|
|
1227
1255
|
}
|
|
1228
1256
|
}
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1257
|
+
function Ht(i) {
|
|
1258
|
+
j.current = i, N.current === null && (N.current = requestAnimationFrame(() => {
|
|
1259
|
+
N.current = null;
|
|
1260
|
+
const l = j.current;
|
|
1261
|
+
j.current = null, l && K(l);
|
|
1234
1262
|
}));
|
|
1235
1263
|
}
|
|
1236
|
-
|
|
1264
|
+
G(
|
|
1237
1265
|
() => () => {
|
|
1238
|
-
|
|
1266
|
+
N.current !== null && (cancelAnimationFrame(N.current), N.current = null), j.current = null;
|
|
1239
1267
|
},
|
|
1240
1268
|
[]
|
|
1241
1269
|
);
|
|
1242
|
-
const
|
|
1270
|
+
const Xt = He(
|
|
1243
1271
|
(i) => {
|
|
1244
|
-
if (!
|
|
1272
|
+
if (!A.current)
|
|
1245
1273
|
return;
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1274
|
+
const l = i.dragging, m = i.offset[a === "x" ? 0 : 1], p = i.movement[a === "x" ? 0 : 1], k = p > et.current, v = p < -et.current, x = i.velocity;
|
|
1275
|
+
l && (Ht({
|
|
1248
1276
|
...i,
|
|
1249
1277
|
eventName: "onDrag",
|
|
1250
1278
|
slideActionType: "drag"
|
|
1251
|
-
}),
|
|
1279
|
+
}), X.start({
|
|
1252
1280
|
value: m,
|
|
1253
1281
|
immediate: !0,
|
|
1254
1282
|
config: {
|
|
1255
|
-
velocity:
|
|
1283
|
+
velocity: x
|
|
1256
1284
|
},
|
|
1257
|
-
onChange({ value:
|
|
1258
|
-
D.current.style.transform =
|
|
1259
|
-
|
|
1260
|
-
|
|
1285
|
+
onChange({ value: g }) {
|
|
1286
|
+
D.current.style.transform = J(
|
|
1287
|
+
g.value,
|
|
1288
|
+
a,
|
|
1261
1289
|
n
|
|
1262
1290
|
);
|
|
1263
1291
|
}
|
|
1264
|
-
}), h && (
|
|
1292
|
+
}), h && (k || v) && i.cancel()), i.last && (Yt(), k ? (z({
|
|
1265
1293
|
actionType: "drag",
|
|
1266
1294
|
type: "prev"
|
|
1267
|
-
}), i.cancel()) :
|
|
1295
|
+
}), i.cancel()) : v ? (z({
|
|
1268
1296
|
actionType: "drag",
|
|
1269
1297
|
type: "next"
|
|
1270
|
-
}), i.cancel()) : (
|
|
1271
|
-
value:
|
|
1298
|
+
}), i.cancel()) : (X.start({
|
|
1299
|
+
value: V.current,
|
|
1272
1300
|
config: {
|
|
1273
|
-
velocity:
|
|
1301
|
+
velocity: x
|
|
1274
1302
|
},
|
|
1275
|
-
onChange({ value:
|
|
1276
|
-
D.current.style.transform =
|
|
1277
|
-
|
|
1278
|
-
|
|
1303
|
+
onChange({ value: g }) {
|
|
1304
|
+
D.current.style.transform = J(
|
|
1305
|
+
g.value,
|
|
1306
|
+
a,
|
|
1279
1307
|
n
|
|
1280
1308
|
);
|
|
1281
1309
|
}
|
|
1282
1310
|
}), i.cancel()));
|
|
1283
1311
|
},
|
|
1284
1312
|
{
|
|
1285
|
-
enabled:
|
|
1286
|
-
axis:
|
|
1313
|
+
enabled: ot,
|
|
1314
|
+
axis: a,
|
|
1287
1315
|
rubberband: !e,
|
|
1288
1316
|
...e ? {} : {
|
|
1289
1317
|
bounds: () => ({
|
|
1290
1318
|
right: 0,
|
|
1291
|
-
left: -
|
|
1292
|
-
top: -
|
|
1319
|
+
left: -it(0),
|
|
1320
|
+
top: -it(0),
|
|
1293
1321
|
bottom: 0
|
|
1294
1322
|
})
|
|
1295
1323
|
},
|
|
1296
|
-
from: () => [
|
|
1324
|
+
from: () => [rt.value.get(), rt.value.get()]
|
|
1297
1325
|
}
|
|
1298
|
-
),
|
|
1299
|
-
var
|
|
1300
|
-
const
|
|
1301
|
-
if (typeof i == "number") return
|
|
1302
|
-
const
|
|
1303
|
-
return i === ((
|
|
1304
|
-
}, []),
|
|
1305
|
-
() => Array.from({ length: t.length }, (i,
|
|
1306
|
-
const m = e ?
|
|
1307
|
-
return e ?
|
|
1326
|
+
), qt = ne((i) => {
|
|
1327
|
+
var v;
|
|
1328
|
+
const l = ht.current, p = pt.current ? l.length + w.current % l.length : w.current;
|
|
1329
|
+
if (typeof i == "number") return p === i;
|
|
1330
|
+
const k = w.current % l.length;
|
|
1331
|
+
return i === ((v = l[k]) == null ? void 0 : v.id);
|
|
1332
|
+
}, []), Jt = ct(
|
|
1333
|
+
() => Array.from({ length: t.length }, (i, l) => () => {
|
|
1334
|
+
const m = e ? w.current % t.length : w.current;
|
|
1335
|
+
return e ? l === (m + 1) % t.length : m + 1 >= t.length ? !1 : l === m + 1;
|
|
1308
1336
|
}),
|
|
1309
1337
|
[t.length, e]
|
|
1310
|
-
),
|
|
1311
|
-
() => Array.from({ length: t.length }, (i,
|
|
1312
|
-
const m = e ?
|
|
1313
|
-
return e ?
|
|
1338
|
+
), Qt = ct(
|
|
1339
|
+
() => Array.from({ length: t.length }, (i, l) => () => {
|
|
1340
|
+
const m = e ? w.current % t.length : w.current;
|
|
1341
|
+
return e ? l === (m - 1 + t.length) % t.length : m - 1 < 0 ? !1 : l === m - 1;
|
|
1314
1342
|
}),
|
|
1315
1343
|
[t.length, e]
|
|
1316
|
-
),
|
|
1317
|
-
() =>
|
|
1344
|
+
), Zt = ct(
|
|
1345
|
+
() => `
|
|
1318
1346
|
[data-part-internal="${n}-Container"] {
|
|
1319
1347
|
display: flex;
|
|
1320
1348
|
width: 100%;
|
|
@@ -1323,19 +1351,19 @@ function tr({
|
|
|
1323
1351
|
--${n}-items-per-slide: 1;
|
|
1324
1352
|
--${n}-offset-position: 0px;
|
|
1325
1353
|
--${n}-offset-modifier: 0px;
|
|
1326
|
-
--${n}-scroll-x-value: ${
|
|
1327
|
-
--${n}-scroll-y-value: ${
|
|
1354
|
+
--${n}-scroll-x-value: ${a === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1355
|
+
--${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1328
1356
|
--${n}-gutter: 0px;
|
|
1329
1357
|
--${n}-start-end-gutter: 0px;
|
|
1330
|
-
touch-action: ${
|
|
1358
|
+
touch-action: ${ot ? a === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1331
1359
|
}
|
|
1332
1360
|
[data-part-internal="${n}-Track"] {
|
|
1333
1361
|
display: flex;
|
|
1334
1362
|
position: relative;
|
|
1335
1363
|
--initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${t.length} * var(--${n}-items-per-slide)) + var(--${n}-start-end-gutter)) * ${t.length} / var(--${n}-items-per-slide));
|
|
1336
|
-
left: ${e &&
|
|
1337
|
-
top: ${e &&
|
|
1338
|
-
flex-direction: ${
|
|
1364
|
+
left: ${e && a === "x" && !I ? "var(--initial-offset-modifier)" : "0px"};
|
|
1365
|
+
top: ${e && a === "y" && !I ? "var(--initial-offset-modifier)" : "0px"};
|
|
1366
|
+
flex-direction: ${a === "x" ? "row" : "column"};
|
|
1339
1367
|
width: 100%;
|
|
1340
1368
|
height: 100%;
|
|
1341
1369
|
gap: var(--${n}-gutter);
|
|
@@ -1345,7 +1373,7 @@ function tr({
|
|
|
1345
1373
|
display: flex;
|
|
1346
1374
|
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)));
|
|
1347
1375
|
}
|
|
1348
|
-
${s && s.length > 0 ? s.slice().sort((i,
|
|
1376
|
+
${s && s.length > 0 ? s.slice().sort((i, l) => i.breakpoint - l.breakpoint).map(
|
|
1349
1377
|
(i) => `
|
|
1350
1378
|
@media ${i.media || `(min-width: ${i.breakpoint}px)`} {
|
|
1351
1379
|
[data-part-internal="${n}-Container"] {
|
|
@@ -1355,7 +1383,7 @@ function tr({
|
|
|
1355
1383
|
}
|
|
1356
1384
|
`
|
|
1357
1385
|
).join("") : ""}
|
|
1358
|
-
${
|
|
1386
|
+
${o && o.length > 0 ? o.slice().sort((i, l) => i.breakpoint - l.breakpoint).map(
|
|
1359
1387
|
(i) => `
|
|
1360
1388
|
@media ${i.media || `(min-width: ${i.breakpoint}px)`} {
|
|
1361
1389
|
[data-part-internal="${n}-Container"] {
|
|
@@ -1364,30 +1392,30 @@ function tr({
|
|
|
1364
1392
|
}
|
|
1365
1393
|
`
|
|
1366
1394
|
).join("") : ""}
|
|
1367
|
-
|
|
1395
|
+
`,
|
|
1368
1396
|
[
|
|
1369
1397
|
n,
|
|
1370
|
-
|
|
1371
|
-
|
|
1398
|
+
a,
|
|
1399
|
+
ot,
|
|
1372
1400
|
t.length,
|
|
1373
1401
|
e,
|
|
1374
|
-
|
|
1402
|
+
I,
|
|
1375
1403
|
s,
|
|
1376
|
-
|
|
1404
|
+
o
|
|
1377
1405
|
]
|
|
1378
1406
|
);
|
|
1379
1407
|
return {
|
|
1380
|
-
carouselFragment: /* @__PURE__ */
|
|
1408
|
+
carouselFragment: /* @__PURE__ */ ee(
|
|
1381
1409
|
"div",
|
|
1382
1410
|
{
|
|
1383
|
-
ref:
|
|
1411
|
+
ref: O,
|
|
1384
1412
|
className: "ReactSpringCarouselContainer",
|
|
1385
1413
|
"data-part": "Container",
|
|
1386
1414
|
"data-part-internal": `${n}-Container`,
|
|
1387
|
-
...
|
|
1415
|
+
...Xt(),
|
|
1388
1416
|
children: [
|
|
1389
|
-
/* @__PURE__ */
|
|
1390
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ q("style", { dangerouslySetInnerHTML: { __html: Zt } }),
|
|
1418
|
+
/* @__PURE__ */ q(
|
|
1391
1419
|
"div",
|
|
1392
1420
|
{
|
|
1393
1421
|
ref: D,
|
|
@@ -1395,43 +1423,44 @@ function tr({
|
|
|
1395
1423
|
"data-part": "Track",
|
|
1396
1424
|
"data-part-internal": `${n}-Track`,
|
|
1397
1425
|
onScroll: () => {
|
|
1398
|
-
|
|
1426
|
+
S.current = !1, R.current = !1;
|
|
1399
1427
|
},
|
|
1400
|
-
children: Array.from({ length:
|
|
1401
|
-
const m = e ?
|
|
1402
|
-
if (
|
|
1403
|
-
const
|
|
1404
|
-
if (Math.abs(
|
|
1405
|
-
return /* @__PURE__ */
|
|
1428
|
+
children: Array.from({ length: Ft }, (i, l) => {
|
|
1429
|
+
const m = e ? l % t.length : l, p = t[m], k = e && (l < t.length || l >= t.length * 2);
|
|
1430
|
+
if (d !== void 0) {
|
|
1431
|
+
const g = e ? t.length + w.current % t.length : w.current;
|
|
1432
|
+
if (Math.abs(l - g) > d)
|
|
1433
|
+
return /* @__PURE__ */ q(
|
|
1406
1434
|
"div",
|
|
1407
1435
|
{
|
|
1408
1436
|
className: "ReactSpringCarouselItem",
|
|
1409
1437
|
"data-part": "Item",
|
|
1410
1438
|
"data-part-internal": `${n}-Item`,
|
|
1411
|
-
"data-id":
|
|
1412
|
-
"aria-hidden": "true"
|
|
1439
|
+
"data-id": p.id,
|
|
1440
|
+
"aria-hidden": "true",
|
|
1441
|
+
children: T == null ? void 0 : T({ item: p, index: l, isClonedItem: k })
|
|
1413
1442
|
},
|
|
1414
|
-
`${
|
|
1443
|
+
`${p.id}-${l}`
|
|
1415
1444
|
);
|
|
1416
1445
|
}
|
|
1417
|
-
const
|
|
1418
|
-
return /* @__PURE__ */
|
|
1446
|
+
const v = Jt[m], x = Qt[m];
|
|
1447
|
+
return /* @__PURE__ */ q(
|
|
1419
1448
|
"div",
|
|
1420
1449
|
{
|
|
1421
1450
|
className: "ReactSpringCarouselItem",
|
|
1422
1451
|
"data-part": "Item",
|
|
1423
1452
|
"data-part-internal": `${n}-Item`,
|
|
1424
|
-
"data-id":
|
|
1425
|
-
children: typeof
|
|
1426
|
-
useListenToCustomEvent:
|
|
1427
|
-
index:
|
|
1428
|
-
isClonedItem:
|
|
1429
|
-
isActiveItem:
|
|
1430
|
-
isNextItem:
|
|
1431
|
-
isPrevItem:
|
|
1432
|
-
}) :
|
|
1453
|
+
"data-id": p.id,
|
|
1454
|
+
children: typeof p.renderItem == "function" ? p.renderItem({
|
|
1455
|
+
useListenToCustomEvent: vt,
|
|
1456
|
+
index: l,
|
|
1457
|
+
isClonedItem: k,
|
|
1458
|
+
isActiveItem: qt,
|
|
1459
|
+
isNextItem: v,
|
|
1460
|
+
isPrevItem: x
|
|
1461
|
+
}) : p.renderItem
|
|
1433
1462
|
},
|
|
1434
|
-
`${
|
|
1463
|
+
`${p.id}-${l}`
|
|
1435
1464
|
);
|
|
1436
1465
|
})
|
|
1437
1466
|
}
|
|
@@ -1439,9 +1468,9 @@ function tr({
|
|
|
1439
1468
|
]
|
|
1440
1469
|
}
|
|
1441
1470
|
),
|
|
1442
|
-
useListenToCustomEvent:
|
|
1443
|
-
slideToNextItem: () =>
|
|
1444
|
-
slideToPrevItem: () =>
|
|
1471
|
+
useListenToCustomEvent: vt,
|
|
1472
|
+
slideToNextItem: () => nt(),
|
|
1473
|
+
slideToPrevItem: () => st(),
|
|
1445
1474
|
slideToItem: (i) => {
|
|
1446
1475
|
if (typeof i == "number") {
|
|
1447
1476
|
if (!t[i]) {
|
|
@@ -1450,110 +1479,110 @@ function tr({
|
|
|
1450
1479
|
);
|
|
1451
1480
|
return;
|
|
1452
1481
|
}
|
|
1453
|
-
i >
|
|
1482
|
+
i > w.current ? nt(i) : st(i);
|
|
1454
1483
|
}
|
|
1455
1484
|
if (typeof i == "string") {
|
|
1456
|
-
const
|
|
1457
|
-
if (
|
|
1485
|
+
const l = t.findIndex((m) => m.id === i);
|
|
1486
|
+
if (l < 0) {
|
|
1458
1487
|
console.warn(
|
|
1459
1488
|
`The item you're trying to slide doesn't exist. id: ${i}`
|
|
1460
1489
|
);
|
|
1461
1490
|
return;
|
|
1462
1491
|
}
|
|
1463
|
-
|
|
1492
|
+
l > w.current ? nt(l) : st(l);
|
|
1464
1493
|
}
|
|
1465
1494
|
}
|
|
1466
1495
|
};
|
|
1467
1496
|
}
|
|
1468
|
-
function
|
|
1497
|
+
function Je(r) {
|
|
1469
1498
|
let t = 0;
|
|
1470
1499
|
const e = getComputedStyle(r).getPropertyValue("gap");
|
|
1471
1500
|
return e.includes("px") && (t = Number(e.replace("px", ""))), t;
|
|
1472
1501
|
}
|
|
1473
|
-
function
|
|
1502
|
+
function Nt(r) {
|
|
1474
1503
|
return r.scrollWidth - r.clientWidth;
|
|
1475
1504
|
}
|
|
1476
|
-
function
|
|
1477
|
-
const t = r.children[0], e =
|
|
1505
|
+
function lt(r) {
|
|
1506
|
+
const t = r.children[0], e = Je(r);
|
|
1478
1507
|
return t.getBoundingClientRect().width + e;
|
|
1479
1508
|
}
|
|
1480
|
-
function
|
|
1481
|
-
const e = _("start"), n = _(0), [, s] =
|
|
1509
|
+
function nr({ container: r, onReach: t }) {
|
|
1510
|
+
const e = _("start"), n = _(0), [, s] = Mt(() => ({
|
|
1482
1511
|
x: 0
|
|
1483
1512
|
}));
|
|
1484
|
-
function
|
|
1513
|
+
function o(u) {
|
|
1485
1514
|
s.start({
|
|
1486
1515
|
from: {
|
|
1487
1516
|
x: r.current.scrollLeft
|
|
1488
1517
|
},
|
|
1489
1518
|
to: {
|
|
1490
|
-
x:
|
|
1519
|
+
x: u
|
|
1491
1520
|
},
|
|
1492
1521
|
onChange({ value: c }) {
|
|
1493
1522
|
r.current && (r.current.scrollLeft = c.x);
|
|
1494
1523
|
}
|
|
1495
1524
|
});
|
|
1496
1525
|
}
|
|
1497
|
-
function
|
|
1498
|
-
if (!r.current ||
|
|
1526
|
+
function a(u) {
|
|
1527
|
+
if (!r.current || u === "next" && e.current === "end" || u === "prev" && e.current === "start")
|
|
1499
1528
|
return;
|
|
1500
1529
|
let c = 0;
|
|
1501
|
-
if (
|
|
1502
|
-
const h =
|
|
1530
|
+
if (u === "next" && (n.current += 1), u === "prev" && (n.current -= 1), c = n.current * lt(r.current), u === "next") {
|
|
1531
|
+
const h = Nt(r.current);
|
|
1503
1532
|
c > h && (e.current = "end", c = h, t && t("end"));
|
|
1504
1533
|
}
|
|
1505
|
-
|
|
1534
|
+
u === "prev" && c <= 0 && (e.current = "start", n.current = 0, c = 0, t && t("start")), o(c);
|
|
1506
1535
|
}
|
|
1507
|
-
return
|
|
1508
|
-
function
|
|
1509
|
-
var
|
|
1510
|
-
const
|
|
1511
|
-
index:
|
|
1512
|
-
start:
|
|
1513
|
-
end:
|
|
1514
|
-
})),
|
|
1515
|
-
(
|
|
1536
|
+
return G(() => {
|
|
1537
|
+
function u() {
|
|
1538
|
+
var O;
|
|
1539
|
+
const T = lt(r.current), I = ((O = [...r.current.children].at(0)) == null ? void 0 : O.getBoundingClientRect().width) || 0, L = Array(r.current.childElementCount).fill(0).map((D, V) => ({
|
|
1540
|
+
index: V,
|
|
1541
|
+
start: T * V,
|
|
1542
|
+
end: T * (V + 1)
|
|
1543
|
+
})), P = r.current.scrollLeft + I, A = L.find(
|
|
1544
|
+
(D) => P >= D.start && P < D.end
|
|
1516
1545
|
);
|
|
1517
|
-
n.current = (
|
|
1546
|
+
n.current = (A == null ? void 0 : A.index) || 0;
|
|
1518
1547
|
}
|
|
1519
1548
|
function c() {
|
|
1520
1549
|
s.stop();
|
|
1521
1550
|
}
|
|
1522
|
-
function h(
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1551
|
+
function h(T) {
|
|
1552
|
+
const I = T.target;
|
|
1553
|
+
I.scrollLeft === 0 ? (n.current = 0, e.current = "start", t && t("start")) : I.scrollLeft >= Nt(I) ? (e.current = "end", t && t("end")) : e.current !== "idle" && (e.current = "idle", t && t("idle"));
|
|
1525
1554
|
}
|
|
1526
|
-
let f,
|
|
1527
|
-
function
|
|
1528
|
-
|
|
1529
|
-
r.current.scrollLeft ===
|
|
1555
|
+
let f, b = 0;
|
|
1556
|
+
function d() {
|
|
1557
|
+
b = r.current.scrollLeft, clearTimeout(f), f = setTimeout(function() {
|
|
1558
|
+
r.current.scrollLeft === b && u();
|
|
1530
1559
|
}, 200);
|
|
1531
1560
|
}
|
|
1532
1561
|
if (r.current)
|
|
1533
1562
|
return r.current.addEventListener("wheel", c, {
|
|
1534
1563
|
passive: !0
|
|
1535
|
-
}), r.current.addEventListener("scroll", h), r.current.addEventListener("scroll",
|
|
1536
|
-
r.current && (r.current.removeEventListener("scroll",
|
|
1564
|
+
}), r.current.addEventListener("scroll", h), r.current.addEventListener("scroll", d), () => {
|
|
1565
|
+
r.current && (r.current.removeEventListener("scroll", d), r.current.removeEventListener("scroll", h), r.current.removeEventListener("wheel", c));
|
|
1537
1566
|
};
|
|
1538
|
-
}, [r, t]),
|
|
1567
|
+
}, [r, t]), G(() => {
|
|
1539
1568
|
if (r.current) {
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1569
|
+
const u = new ResizeObserver(() => {
|
|
1570
|
+
o(n.current * lt(r.current));
|
|
1542
1571
|
});
|
|
1543
|
-
return
|
|
1544
|
-
|
|
1572
|
+
return u.observe(r.current), () => {
|
|
1573
|
+
u.disconnect();
|
|
1545
1574
|
};
|
|
1546
1575
|
}
|
|
1547
1576
|
}, []), {
|
|
1548
1577
|
scrollToNext() {
|
|
1549
|
-
|
|
1578
|
+
a("next");
|
|
1550
1579
|
},
|
|
1551
1580
|
scrollToPrev() {
|
|
1552
|
-
|
|
1581
|
+
a("prev");
|
|
1553
1582
|
}
|
|
1554
1583
|
};
|
|
1555
1584
|
}
|
|
1556
1585
|
export {
|
|
1557
|
-
|
|
1558
|
-
|
|
1586
|
+
rr as useSpringCarousel,
|
|
1587
|
+
nr as useSpringScroll
|
|
1559
1588
|
};
|