react-spring-carousel 3.0.0-beta-2.1.4 → 3.0.0-beta-2.1.6
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 +729 -670
- package/dist/index.umd.js +10 -10
- package/dist/useSpringCarousel.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSpringRef as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as Zt, jsx as J } from "react/jsx-runtime";
|
|
2
|
+
import { useSpringRef as te, useSpring as Rt } from "@react-spring/web";
|
|
3
|
+
import lt, { useRef as T, useEffect as X, useCallback as Nt, useMemo as ft, useReducer as ee } from "react";
|
|
4
|
+
function re(r, t, e) {
|
|
5
5
|
return Math.max(t, Math.min(r, e));
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const C = {
|
|
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 E = {
|
|
|
21
21
|
r[0] -= t[0], r[1] -= t[1];
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function xt(r, t, e) {
|
|
25
25
|
return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(r, e * 5) : r * t * e / (t + e * r);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return n === 0 ?
|
|
27
|
+
function Tt(r, t, e, n = 0.15) {
|
|
28
|
+
return n === 0 ? re(r, t, e) : r < t ? -xt(t - r, e - t, n) + t : r > e ? +xt(r - e, e - t, n) + e : r;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const [[
|
|
32
|
-
return [
|
|
30
|
+
function ne(r, [t, e], [n, i]) {
|
|
31
|
+
const [[a, o], [c, u]] = r;
|
|
32
|
+
return [Tt(t, a, o, n), Tt(e, c, u, i)];
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ie(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,40 +41,40 @@ function oe(r, t) {
|
|
|
41
41
|
}
|
|
42
42
|
return (t === "string" ? String : Number)(r);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
44
|
+
function se(r) {
|
|
45
|
+
var t = ie(r, "string");
|
|
46
46
|
return typeof t == "symbol" ? t : String(t);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return t =
|
|
48
|
+
function $(r, t, e) {
|
|
49
|
+
return t = se(t), t in r ? Object.defineProperty(r, t, {
|
|
50
50
|
value: e,
|
|
51
51
|
enumerable: !0,
|
|
52
52
|
configurable: !0,
|
|
53
53
|
writable: !0
|
|
54
54
|
}) : r[t] = e, r;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function It(r, t) {
|
|
57
57
|
var e = Object.keys(r);
|
|
58
58
|
if (Object.getOwnPropertySymbols) {
|
|
59
59
|
var n = Object.getOwnPropertySymbols(r);
|
|
60
|
-
t && (n = n.filter(function(
|
|
61
|
-
return Object.getOwnPropertyDescriptor(r,
|
|
60
|
+
t && (n = n.filter(function(i) {
|
|
61
|
+
return Object.getOwnPropertyDescriptor(r, i).enumerable;
|
|
62
62
|
})), e.push.apply(e, n);
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function b(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 ? It(Object(e), !0).forEach(function(n) {
|
|
70
|
+
$(r, n, e[n]);
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : It(Object(e)).forEach(function(n) {
|
|
72
72
|
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
return r;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const Mt = {
|
|
78
78
|
pointer: {
|
|
79
79
|
start: "down",
|
|
80
80
|
change: "move",
|
|
@@ -96,98 +96,98 @@ const Lt = {
|
|
|
96
96
|
end: "end"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function Et(r) {
|
|
100
100
|
return r ? r[0].toUpperCase() + r.slice(1) : "";
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return r && !
|
|
102
|
+
const oe = ["enter", "leave"];
|
|
103
|
+
function ae(r = !1, t) {
|
|
104
|
+
return r && !oe.includes(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const n =
|
|
108
|
-
return "on" +
|
|
106
|
+
function ce(r, t = "", e = !1) {
|
|
107
|
+
const n = Mt[r], i = n && n[t] || t;
|
|
108
|
+
return "on" + Et(r) + Et(i) + (ae(e, i) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const ue = ["gotpointercapture", "lostpointercapture"];
|
|
111
|
+
function le(r) {
|
|
112
112
|
let t = r.substring(2).toLowerCase();
|
|
113
113
|
const e = !!~t.indexOf("passive");
|
|
114
114
|
e && (t = t.replace("passive", ""));
|
|
115
|
-
const n =
|
|
116
|
-
return
|
|
115
|
+
const n = ue.includes(t) ? "capturecapture" : "capture", i = !!~t.indexOf(n);
|
|
116
|
+
return i && (t = t.replace("capture", "")), {
|
|
117
117
|
device: t,
|
|
118
|
-
capture:
|
|
118
|
+
capture: i,
|
|
119
119
|
passive: e
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const e =
|
|
122
|
+
function fe(r, t = "") {
|
|
123
|
+
const e = Mt[r], n = e && e[t] || t;
|
|
124
124
|
return r + n;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function nt(r) {
|
|
127
127
|
return "touches" in r;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
129
|
+
function Lt(r) {
|
|
130
|
+
return nt(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function de(r) {
|
|
133
133
|
return Array.from(r.touches).filter((t) => {
|
|
134
134
|
var e, n;
|
|
135
135
|
return t.target === r.currentTarget || ((e = r.currentTarget) === null || e === void 0 || (n = e.contains) === null || n === void 0 ? void 0 : n.call(e, t.target));
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function he(r) {
|
|
139
139
|
return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
return
|
|
141
|
+
function Vt(r) {
|
|
142
|
+
return nt(r) ? he(r)[0] : r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function pe(r) {
|
|
145
|
+
return de(r).map((t) => t.identifier);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const t =
|
|
149
|
-
return
|
|
147
|
+
function dt(r) {
|
|
148
|
+
const t = Vt(r);
|
|
149
|
+
return nt(r) ? t.identifier : t.pointerId;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const t =
|
|
151
|
+
function St(r) {
|
|
152
|
+
const t = Vt(r);
|
|
153
153
|
return [t.clientX, t.clientY];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function ge(r) {
|
|
156
156
|
const t = {};
|
|
157
157
|
if ("buttons" in r && (t.buttons = r.buttons), "shiftKey" in r) {
|
|
158
158
|
const {
|
|
159
159
|
shiftKey: e,
|
|
160
160
|
altKey: n,
|
|
161
|
-
metaKey:
|
|
162
|
-
ctrlKey:
|
|
161
|
+
metaKey: i,
|
|
162
|
+
ctrlKey: a
|
|
163
163
|
} = r;
|
|
164
164
|
Object.assign(t, {
|
|
165
165
|
shiftKey: e,
|
|
166
166
|
altKey: n,
|
|
167
|
-
metaKey:
|
|
168
|
-
ctrlKey:
|
|
167
|
+
metaKey: i,
|
|
168
|
+
ctrlKey: a
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
return t;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function rt(r, ...t) {
|
|
174
174
|
return typeof r == "function" ? r(...t) : r;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function me() {
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return r.length === 0 ?
|
|
178
|
+
function ve(...r) {
|
|
179
|
+
return r.length === 0 ? me : r.length === 1 ? r[0] : function() {
|
|
180
180
|
let t;
|
|
181
181
|
for (const e of r)
|
|
182
182
|
t = e.apply(this, arguments) || t;
|
|
183
183
|
return t;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function kt(r, t) {
|
|
187
187
|
return Object.assign({}, t, r || {});
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
class
|
|
189
|
+
const ye = 32;
|
|
190
|
+
class be {
|
|
191
191
|
constructor(t, e, n) {
|
|
192
192
|
this.ctrl = t, this.args = e, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
|
|
193
193
|
}
|
|
@@ -220,13 +220,13 @@ class we {
|
|
|
220
220
|
state: t,
|
|
221
221
|
shared: e,
|
|
222
222
|
ingKey: n,
|
|
223
|
-
args:
|
|
223
|
+
args: i
|
|
224
224
|
} = this;
|
|
225
|
-
e[n] = t._active = t.active = t._blocked = t._force = !1, t._step = [!1, !1], t.intentional = !1, t._movement = [0, 0], t._distance = [0, 0], t._direction = [0, 0], t._delta = [0, 0], t._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], t.args =
|
|
225
|
+
e[n] = t._active = t.active = t._blocked = t._force = !1, t._step = [!1, !1], t.intentional = !1, t._movement = [0, 0], t._distance = [0, 0], t._direction = [0, 0], t._delta = [0, 0], t._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], t.args = i, t.axis = void 0, t.memo = void 0, t.elapsedTime = t.timeDelta = 0, t.direction = [0, 0], t.distance = [0, 0], t.overflow = [0, 0], t._movementBound = [!1, !1], t.velocity = [0, 0], t.movement = [0, 0], t.delta = [0, 0], t.timeStamp = 0;
|
|
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 ? rt(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;
|
|
@@ -240,60 +240,60 @@ class we {
|
|
|
240
240
|
const {
|
|
241
241
|
state: e,
|
|
242
242
|
config: n,
|
|
243
|
-
shared:
|
|
243
|
+
shared: i
|
|
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,
|
|
248
|
-
const
|
|
249
|
-
|
|
246
|
+
let a = 0;
|
|
247
|
+
if (t && (e.event = t, n.preventDefault && t.cancelable && e.event.preventDefault(), e.type = t.type, i.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, i.locked = !!document.pointerLockElement, Object.assign(i, ge(t)), i.down = i.pressed = i.buttons % 2 === 1 || i.touches > 0, a = t.timeStamp - e.timeStamp, e.timeStamp = t.timeStamp, e.elapsedTime = e.timeStamp - e.startTime), e._active) {
|
|
248
|
+
const p = e._delta.map(Math.abs);
|
|
249
|
+
C.addTo(e._distance, p);
|
|
250
250
|
}
|
|
251
251
|
this.axisIntent && this.axisIntent(t);
|
|
252
|
-
const [
|
|
253
|
-
_step:
|
|
254
|
-
values:
|
|
252
|
+
const [o, c] = e._movement, [u, d] = n.threshold, {
|
|
253
|
+
_step: l,
|
|
254
|
+
values: m
|
|
255
255
|
} = e;
|
|
256
|
-
if (n.hasCustomTransform ? (
|
|
257
|
-
const
|
|
256
|
+
if (n.hasCustomTransform ? (l[0] === !1 && (l[0] = Math.abs(o) >= u && m[0]), l[1] === !1 && (l[1] = Math.abs(c) >= d && m[1])) : (l[0] === !1 && (l[0] = Math.abs(o) >= u && Math.sign(o) * u), l[1] === !1 && (l[1] = Math.abs(c) >= d && Math.sign(c) * d)), e.intentional = l[0] !== !1 || l[1] !== !1, !e.intentional) return;
|
|
257
|
+
const h = [0, 0];
|
|
258
258
|
if (n.hasCustomTransform) {
|
|
259
|
-
const [
|
|
260
|
-
|
|
259
|
+
const [p, z] = m;
|
|
260
|
+
h[0] = l[0] !== !1 ? p - l[0] : 0, h[1] = l[1] !== !1 ? z - l[1] : 0;
|
|
261
261
|
} else
|
|
262
|
-
|
|
263
|
-
this.restrictToAxis && !e._blocked && this.restrictToAxis(
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
const [
|
|
267
|
-
e.overflow = [
|
|
262
|
+
h[0] = l[0] !== !1 ? o - l[0] : 0, h[1] = l[1] !== !1 ? c - l[1] : 0;
|
|
263
|
+
this.restrictToAxis && !e._blocked && this.restrictToAxis(h);
|
|
264
|
+
const S = e.offset, E = e._active && !e._blocked || e.active;
|
|
265
|
+
E && (e.first = e._active && !e.active, e.last = !e._active && e.active, e.active = i[this.ingKey] = e._active, t && (e.first && ("bounds" in n && (e._bounds = rt(n.bounds, e)), this.setup && this.setup()), e.movement = h, this.computeOffset()));
|
|
266
|
+
const [D, g] = e.offset, [[I, A], [_, k]] = e._bounds;
|
|
267
|
+
e.overflow = [D < I ? -1 : D > A ? 1 : 0, g < _ ? -1 : g > k ? 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 B = e._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
-
if (e.offset =
|
|
270
|
-
e.delta =
|
|
271
|
-
const
|
|
272
|
-
|
|
269
|
+
if (e.offset = ne(e._bounds, e.offset, B), e.delta = C.sub(e.offset, S), this.computeMovement(), E && (!e.last || a > ye)) {
|
|
270
|
+
e.delta = C.sub(e.offset, S);
|
|
271
|
+
const p = e.delta.map(Math.abs);
|
|
272
|
+
C.addTo(e.distance, p), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && a > 0 && (e.velocity = [p[0] / a, p[1] / a], e.timeDelta = a);
|
|
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
|
|
278
|
+
const i = this.handler(b(b(b({}, e), t), {}, {
|
|
279
279
|
[this.aliasKey]: t.values
|
|
280
280
|
}));
|
|
281
|
-
|
|
281
|
+
i !== void 0 && (t.memo = i);
|
|
282
282
|
}
|
|
283
283
|
clean() {
|
|
284
284
|
this.eventStore.clean(), this.timeoutStore.clean();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const n = Math.abs(r),
|
|
289
|
-
if (n >
|
|
287
|
+
function _e([r, t], e) {
|
|
288
|
+
const n = Math.abs(r), i = Math.abs(t);
|
|
289
|
+
if (n > i && n > e)
|
|
290
290
|
return "x";
|
|
291
|
-
if (
|
|
291
|
+
if (i > n && i > e)
|
|
292
292
|
return "y";
|
|
293
293
|
}
|
|
294
|
-
class
|
|
294
|
+
class we extends be {
|
|
295
295
|
constructor(...t) {
|
|
296
|
-
super(...t),
|
|
296
|
+
super(...t), $(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
298
298
|
reset() {
|
|
299
299
|
super.reset(), this.state.axis = void 0;
|
|
@@ -302,16 +302,16 @@ class xe extends we {
|
|
|
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 = C.add(this.state.lastOffset, this.state.movement);
|
|
306
306
|
}
|
|
307
307
|
computeMovement() {
|
|
308
|
-
this.state.movement =
|
|
308
|
+
this.state.movement = C.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
|
|
314
|
-
e.axis =
|
|
313
|
+
const i = typeof n.axisThreshold == "object" ? n.axisThreshold[Lt(t)] : n.axisThreshold;
|
|
314
|
+
e.axis = _e(e._movement, i);
|
|
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 xe extends we {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
330
|
+
const Ct = (r) => r, Dt = 0.15, gt = {
|
|
331
331
|
enabled(r = !0) {
|
|
332
332
|
return r;
|
|
333
333
|
},
|
|
334
334
|
eventOptions(r, t, e) {
|
|
335
|
-
return
|
|
335
|
+
return b(b({}, e.shared.eventOptions), r);
|
|
336
336
|
},
|
|
337
337
|
preventDefault(r = !1) {
|
|
338
338
|
return r;
|
|
@@ -343,33 +343,33 @@ const At = (r) => r, $t = 0.15, dt = {
|
|
|
343
343
|
rubberband(r = 0) {
|
|
344
344
|
switch (r) {
|
|
345
345
|
case !0:
|
|
346
|
-
return [
|
|
346
|
+
return [Dt, Dt];
|
|
347
347
|
case !1:
|
|
348
348
|
return [0, 0];
|
|
349
349
|
default:
|
|
350
|
-
return
|
|
350
|
+
return C.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 C.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
|
|
361
|
-
return (
|
|
362
|
-
const
|
|
363
|
-
return (!isFinite(
|
|
360
|
+
const i = n || Ct;
|
|
361
|
+
return (a) => {
|
|
362
|
+
const o = i(a);
|
|
363
|
+
return (!isFinite(o[0]) || !isFinite(o[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${o[0]},${[1]}]`), o;
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
return n ||
|
|
366
|
+
return n || Ct;
|
|
367
367
|
},
|
|
368
368
|
threshold(r) {
|
|
369
|
-
return
|
|
369
|
+
return C.toVector(r, 0);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
372
|
+
process.env.NODE_ENV === "development" && Object.assign(gt, {
|
|
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(dt, {
|
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const
|
|
389
|
+
const xe = 0, Q = b(b({}, gt), {}, {
|
|
390
390
|
axis(r, t, {
|
|
391
391
|
axis: e
|
|
392
392
|
}) {
|
|
393
393
|
if (this.lockDirection = e === "lock", !this.lockDirection) return e;
|
|
394
394
|
},
|
|
395
|
-
axisThreshold(r =
|
|
395
|
+
axisThreshold(r = xe) {
|
|
396
396
|
return r;
|
|
397
397
|
},
|
|
398
398
|
bounds(r = {}) {
|
|
399
399
|
if (typeof r == "function")
|
|
400
|
-
return (
|
|
400
|
+
return (a) => Q.bounds(r(a));
|
|
401
401
|
if ("current" in r)
|
|
402
402
|
return () => r.current;
|
|
403
403
|
if (typeof HTMLElement == "function" && r instanceof HTMLElement)
|
|
@@ -406,19 +406,19 @@ const Ie = 0, Y = y(y({}, dt), {}, {
|
|
|
406
406
|
left: t = -1 / 0,
|
|
407
407
|
right: e = 1 / 0,
|
|
408
408
|
top: n = -1 / 0,
|
|
409
|
-
bottom:
|
|
409
|
+
bottom: i = 1 / 0
|
|
410
410
|
} = r;
|
|
411
|
-
return [[t, e], [n,
|
|
411
|
+
return [[t, e], [n, i]];
|
|
412
412
|
}
|
|
413
|
-
}),
|
|
413
|
+
}), At = {
|
|
414
414
|
ArrowRight: (r, t = 1) => [r * t, 0],
|
|
415
415
|
ArrowLeft: (r, t = 1) => [-1 * r * t, 0],
|
|
416
416
|
ArrowUp: (r, t = 1) => [0, -1 * r * t],
|
|
417
417
|
ArrowDown: (r, t = 1) => [0, r * t]
|
|
418
418
|
};
|
|
419
|
-
class
|
|
419
|
+
class Te extends we {
|
|
420
420
|
constructor(...t) {
|
|
421
|
-
super(...t),
|
|
421
|
+
super(...t), $(this, "ingKey", "dragging");
|
|
422
422
|
}
|
|
423
423
|
reset() {
|
|
424
424
|
super.reset();
|
|
@@ -428,13 +428,13 @@ class Ee extends xe {
|
|
|
428
428
|
setup() {
|
|
429
429
|
const t = this.state;
|
|
430
430
|
if (t._bounds instanceof HTMLElement) {
|
|
431
|
-
const e = t._bounds.getBoundingClientRect(), n = t.currentTarget.getBoundingClientRect(),
|
|
431
|
+
const e = t._bounds.getBoundingClientRect(), n = t.currentTarget.getBoundingClientRect(), i = {
|
|
432
432
|
left: e.left - n.left + t.offset[0],
|
|
433
433
|
right: e.right - n.right + t.offset[0],
|
|
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 = Q.bounds(i);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
cancel() {
|
|
@@ -452,8 +452,8 @@ class Ee extends xe {
|
|
|
452
452
|
pointerDown(t) {
|
|
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
|
-
const
|
|
456
|
-
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(
|
|
455
|
+
const i = this.ctrl.setEventIds(t);
|
|
456
|
+
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(i && i.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = dt(t), n._pointerActive = !0, this.computeValues(St(t)), this.computeInitial(), e.preventScrollAxis && Lt(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 xe {
|
|
|
462
462
|
pointerMove(t) {
|
|
463
463
|
const e = this.state, n = this.config;
|
|
464
464
|
if (!e._pointerActive) return;
|
|
465
|
-
const
|
|
466
|
-
if (e._pointerId !== void 0 &&
|
|
467
|
-
const
|
|
468
|
-
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta =
|
|
465
|
+
const i = dt(t);
|
|
466
|
+
if (e._pointerId !== void 0 && i !== e._pointerId) return;
|
|
467
|
+
const a = St(t);
|
|
468
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = C.sub(a, e._values), this.computeValues(a)), C.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 xe {
|
|
|
491
491
|
}
|
|
492
492
|
const e = this.state, n = this.config;
|
|
493
493
|
if (!e._active || !e._pointerActive) return;
|
|
494
|
-
const
|
|
495
|
-
if (e._pointerId !== void 0 &&
|
|
494
|
+
const i = dt(t);
|
|
495
|
+
if (e._pointerId !== void 0 && i !== e._pointerId) return;
|
|
496
496
|
this.state._pointerActive = !1, this.setActive(), this.compute(t);
|
|
497
|
-
const [
|
|
498
|
-
if (e.tap =
|
|
497
|
+
const [a, o] = e._distance;
|
|
498
|
+
if (e.tap = a <= n.tapsThreshold && o <= 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 [c, u] = e._delta, [d, l] = e._movement, [m, h] = n.swipe.velocity, [S, E] = n.swipe.distance, D = n.swipe.duration;
|
|
502
|
+
if (e.elapsedTime < D) {
|
|
503
|
+
const g = Math.abs(c / e.timeDelta), I = Math.abs(u / e.timeDelta);
|
|
504
|
+
g > m && Math.abs(d) > S && (e.swipe[0] = Math.sign(c)), I > h && Math.abs(l) > E && (e.swipe[1] = Math.sign(u));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -514,8 +514,8 @@ class Ee extends xe {
|
|
|
514
514
|
if (process.env.NODE_ENV === "development")
|
|
515
515
|
try {
|
|
516
516
|
if (n === "pointer" && e.preventScrollDelay === void 0) {
|
|
517
|
-
const
|
|
518
|
-
window.getComputedStyle(
|
|
517
|
+
const i = "uv" in t ? t.sourceEvent.currentTarget : t.currentTarget;
|
|
518
|
+
window.getComputedStyle(i).touchAction === "auto" && console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.", i);
|
|
519
519
|
}
|
|
520
520
|
} catch {
|
|
521
521
|
}
|
|
@@ -528,7 +528,7 @@ class Ee extends xe {
|
|
|
528
528
|
this.state._preventScroll && t.cancelable && t.preventDefault();
|
|
529
529
|
}
|
|
530
530
|
setupScrollPrevention(t) {
|
|
531
|
-
this.state._preventScroll = !1,
|
|
531
|
+
this.state._preventScroll = !1, Ie(t);
|
|
532
532
|
const e = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
533
533
|
passive: !1
|
|
534
534
|
});
|
|
@@ -540,14 +540,14 @@ class Ee extends xe {
|
|
|
540
540
|
}, this.config.delay);
|
|
541
541
|
}
|
|
542
542
|
keyDown(t) {
|
|
543
|
-
const e =
|
|
543
|
+
const e = At[t.key];
|
|
544
544
|
if (e) {
|
|
545
|
-
const n = this.state,
|
|
546
|
-
this.start(t), n._delta = e(this.config.keyboardDisplacement,
|
|
545
|
+
const n = this.state, i = t.shiftKey ? 10 : t.altKey ? 0.1 : 1;
|
|
546
|
+
this.start(t), n._delta = e(this.config.keyboardDisplacement, i), n._keyboardActive = !0, C.addTo(n._movement, n._delta), this.compute(t), this.emit();
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
keyUp(t) {
|
|
550
|
-
t.key in
|
|
550
|
+
t.key in At && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
|
|
551
551
|
}
|
|
552
552
|
bind(t) {
|
|
553
553
|
const e = this.config.device;
|
|
@@ -557,88 +557,88 @@ class Ee extends xe {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Ie(r) {
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
|
-
const
|
|
564
|
-
function
|
|
565
|
-
return
|
|
563
|
+
const Z = typeof window < "u" && window.document && window.document.createElement;
|
|
564
|
+
function Bt() {
|
|
565
|
+
return Z && "ontouchstart" in window;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
567
|
+
function Ee() {
|
|
568
|
+
return Bt() || Z && window.navigator.maxTouchPoints > 1;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
570
|
+
function Se() {
|
|
571
|
+
return Z && "onpointerdown" in window;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
return
|
|
573
|
+
function ke() {
|
|
574
|
+
return Z && "exitPointerLock" in window.document;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function Ce() {
|
|
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 R = {
|
|
584
|
+
isBrowser: Z,
|
|
585
|
+
gesture: Ce(),
|
|
586
|
+
touch: Bt(),
|
|
587
|
+
touchscreen: Ee(),
|
|
588
|
+
pointer: Se(),
|
|
589
|
+
pointerLock: ke()
|
|
590
|
+
}, De = 250, Ae = 180, $e = 0.5, Oe = 50, Pe = 250, Re = 10, $t = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
},
|
|
594
|
+
}, jt = b(b({}, Q), {}, {
|
|
595
595
|
device(r, t, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: e = !1,
|
|
598
598
|
lock: n = !1,
|
|
599
|
-
mouse:
|
|
599
|
+
mouse: i = !1
|
|
600
600
|
} = {}
|
|
601
601
|
}) {
|
|
602
|
-
return this.pointerLock = n &&
|
|
602
|
+
return this.pointerLock = n && R.pointerLock, R.touch && e ? "touch" : this.pointerLock ? "mouse" : R.pointer && !i ? "pointer" : R.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 ? De : void 0, !(!R.touchscreen || e === !1))
|
|
608
608
|
return r || (e !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
610
|
pointerCapture(r, t, {
|
|
611
611
|
pointer: {
|
|
612
612
|
capture: e = !0,
|
|
613
613
|
buttons: n = 1,
|
|
614
|
-
keys:
|
|
614
|
+
keys: i = !0
|
|
615
615
|
} = {}
|
|
616
616
|
}) {
|
|
617
|
-
return this.pointerButtons = n, this.keys =
|
|
617
|
+
return this.pointerButtons = n, this.keys = i, !this.pointerLock && this.device === "pointer" && e;
|
|
618
618
|
},
|
|
619
619
|
threshold(r, t, {
|
|
620
620
|
filterTaps: e = !1,
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
|
-
axis:
|
|
622
|
+
axis: i = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const
|
|
625
|
-
return this.filterTaps = e, this.tapsThreshold = n,
|
|
624
|
+
const a = C.toVector(r, e ? n : i ? 1 : 0);
|
|
625
|
+
return this.filterTaps = e, this.tapsThreshold = n, a;
|
|
626
626
|
},
|
|
627
627
|
swipe({
|
|
628
|
-
velocity: r =
|
|
629
|
-
distance: t =
|
|
630
|
-
duration: e =
|
|
628
|
+
velocity: r = $e,
|
|
629
|
+
distance: t = Oe,
|
|
630
|
+
duration: e = Pe
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
|
-
velocity: this.transform(
|
|
634
|
-
distance: this.transform(
|
|
633
|
+
velocity: this.transform(C.toVector(r)),
|
|
634
|
+
distance: this.transform(C.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 $ = {
|
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
648
|
axisThreshold(r) {
|
|
649
|
-
return r ?
|
|
649
|
+
return r ? b(b({}, $t), r) : $t;
|
|
650
650
|
},
|
|
651
|
-
keyboardDisplacement(r =
|
|
651
|
+
keyboardDisplacement(r = Re) {
|
|
652
652
|
return r;
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
655
|
+
process.env.NODE_ENV === "development" && Object.assign(jt, {
|
|
656
656
|
useTouch(r) {
|
|
657
657
|
if (r !== void 0)
|
|
658
658
|
throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
|
|
@@ -679,41 +679,41 @@ process.env.NODE_ENV === "development" && Object.assign(Ut, {
|
|
|
679
679
|
return NaN;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
|
-
|
|
682
|
+
b(b({}, gt), {}, {
|
|
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 && !R.touch && R.gesture) return "gesture";
|
|
690
|
+
if (R.touch && n) return "touch";
|
|
691
|
+
if (R.touchscreen) {
|
|
692
|
+
if (R.pointer) return "pointer";
|
|
693
|
+
if (R.touch) return "touch";
|
|
694
694
|
}
|
|
695
695
|
},
|
|
696
696
|
bounds(r, t, {
|
|
697
697
|
scaleBounds: e = {},
|
|
698
698
|
angleBounds: n = {}
|
|
699
699
|
}) {
|
|
700
|
-
const
|
|
701
|
-
const
|
|
700
|
+
const i = (o) => {
|
|
701
|
+
const c = kt(rt(e, o), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
|
-
return [
|
|
706
|
-
},
|
|
707
|
-
const
|
|
705
|
+
return [c.min, c.max];
|
|
706
|
+
}, a = (o) => {
|
|
707
|
+
const c = kt(rt(n, o), {
|
|
708
708
|
min: -1 / 0,
|
|
709
709
|
max: 1 / 0
|
|
710
710
|
});
|
|
711
|
-
return [
|
|
711
|
+
return [c.min, c.max];
|
|
712
712
|
};
|
|
713
|
-
return typeof e != "function" && typeof n != "function" ? [
|
|
713
|
+
return typeof e != "function" && typeof n != "function" ? [i(), a()] : (o) => [i(o), a(o)];
|
|
714
714
|
},
|
|
715
715
|
threshold(r, t, e) {
|
|
716
|
-
return this.lockDirection = e.axis === "lock",
|
|
716
|
+
return this.lockDirection = e.axis === "lock", C.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 @@ y(y({}, dt), {}, {
|
|
|
722
722
|
return r;
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
|
-
|
|
725
|
+
b(b({}, Q), {}, {
|
|
726
726
|
mouseOnly: (r = !0) => r
|
|
727
727
|
});
|
|
728
|
-
|
|
728
|
+
b(b({}, Q), {}, {
|
|
729
729
|
mouseOnly: (r = !0) => r
|
|
730
730
|
});
|
|
731
|
-
const
|
|
732
|
-
function
|
|
733
|
-
|
|
731
|
+
const Ut = /* @__PURE__ */ new Map(), pt = /* @__PURE__ */ new Map();
|
|
732
|
+
function Ne(r) {
|
|
733
|
+
Ut.set(r.key, r.engine), pt.set(r.key, r.resolver);
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const Me = {
|
|
736
736
|
key: "drag",
|
|
737
|
-
engine:
|
|
738
|
-
resolver:
|
|
737
|
+
engine: Te,
|
|
738
|
+
resolver: jt
|
|
739
739
|
};
|
|
740
|
-
function
|
|
740
|
+
function Le(r, t) {
|
|
741
741
|
if (r == null) return {};
|
|
742
|
-
var e = {}, n = Object.keys(r),
|
|
743
|
-
for (
|
|
744
|
-
|
|
742
|
+
var e = {}, n = Object.keys(r), i, a;
|
|
743
|
+
for (a = 0; a < n.length; a++)
|
|
744
|
+
i = n[a], !(t.indexOf(i) >= 0) && (e[i] = r[i]);
|
|
745
745
|
return e;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function Ve(r, t) {
|
|
748
748
|
if (r == null) return {};
|
|
749
|
-
var e =
|
|
749
|
+
var e = Le(r, t), n, i;
|
|
750
750
|
if (Object.getOwnPropertySymbols) {
|
|
751
|
-
var
|
|
752
|
-
for (
|
|
753
|
-
n =
|
|
751
|
+
var a = Object.getOwnPropertySymbols(r);
|
|
752
|
+
for (i = 0; i < a.length; i++)
|
|
753
|
+
n = a[i], !(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 Be = {
|
|
758
758
|
target(r) {
|
|
759
759
|
if (r)
|
|
760
760
|
return () => "current" in r ? r.current : r;
|
|
@@ -762,7 +762,7 @@ const Ue = {
|
|
|
762
762
|
enabled(r = !0) {
|
|
763
763
|
return r;
|
|
764
764
|
},
|
|
765
|
-
window(r =
|
|
765
|
+
window(r = R.isBrowser ? window : void 0) {
|
|
766
766
|
return r;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
@@ -777,83 +777,83 @@ const Ue = {
|
|
|
777
777
|
transform(r) {
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
781
|
-
function
|
|
780
|
+
}, je = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
|
+
function et(r = {}, t) {
|
|
782
782
|
const e = {};
|
|
783
|
-
for (const [n,
|
|
784
|
-
switch (typeof
|
|
783
|
+
for (const [n, i] of Object.entries(t))
|
|
784
|
+
switch (typeof i) {
|
|
785
785
|
case "function":
|
|
786
786
|
if (process.env.NODE_ENV === "development") {
|
|
787
|
-
const
|
|
788
|
-
Number.isNaN(
|
|
787
|
+
const a = i.call(e, r[n], n, r);
|
|
788
|
+
Number.isNaN(a) || (e[n] = a);
|
|
789
789
|
} else
|
|
790
|
-
e[n] =
|
|
790
|
+
e[n] = i.call(e, r[n], n, r);
|
|
791
791
|
break;
|
|
792
792
|
case "object":
|
|
793
|
-
e[n] =
|
|
793
|
+
e[n] = et(r[n], i);
|
|
794
794
|
break;
|
|
795
795
|
case "boolean":
|
|
796
|
-
|
|
796
|
+
i && (e[n] = r[n]);
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
799
|
return e;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Ue(r, t, e = {}) {
|
|
802
802
|
const n = r, {
|
|
803
|
-
target:
|
|
804
|
-
eventOptions:
|
|
805
|
-
window:
|
|
806
|
-
enabled:
|
|
807
|
-
transform:
|
|
808
|
-
} = n,
|
|
809
|
-
if (e.shared =
|
|
810
|
-
target:
|
|
811
|
-
eventOptions:
|
|
812
|
-
window:
|
|
813
|
-
enabled:
|
|
814
|
-
transform:
|
|
815
|
-
},
|
|
816
|
-
const
|
|
817
|
-
e[t] =
|
|
803
|
+
target: i,
|
|
804
|
+
eventOptions: a,
|
|
805
|
+
window: o,
|
|
806
|
+
enabled: c,
|
|
807
|
+
transform: u
|
|
808
|
+
} = n, d = Ve(n, je);
|
|
809
|
+
if (e.shared = et({
|
|
810
|
+
target: i,
|
|
811
|
+
eventOptions: a,
|
|
812
|
+
window: o,
|
|
813
|
+
enabled: c,
|
|
814
|
+
transform: u
|
|
815
|
+
}, Be), t) {
|
|
816
|
+
const l = pt.get(t);
|
|
817
|
+
e[t] = et(b({
|
|
818
818
|
shared: e.shared
|
|
819
|
-
},
|
|
819
|
+
}, d), l);
|
|
820
820
|
} else
|
|
821
|
-
for (const
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
e[
|
|
821
|
+
for (const l in d) {
|
|
822
|
+
const m = pt.get(l);
|
|
823
|
+
if (m)
|
|
824
|
+
e[l] = et(b({
|
|
825
825
|
shared: e.shared
|
|
826
|
-
},
|
|
827
|
-
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(
|
|
828
|
-
if (
|
|
826
|
+
}, d[l]), m);
|
|
827
|
+
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(l)) {
|
|
828
|
+
if (l === "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 \`${l}\` was used. Please read the documentation for further information.`);
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
return e;
|
|
834
834
|
}
|
|
835
835
|
class zt {
|
|
836
836
|
constructor(t, e) {
|
|
837
|
-
|
|
837
|
+
$(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
838
838
|
}
|
|
839
|
-
add(t, e, n,
|
|
840
|
-
const
|
|
841
|
-
t.addEventListener(
|
|
842
|
-
const
|
|
843
|
-
t.removeEventListener(
|
|
839
|
+
add(t, e, n, i, a) {
|
|
840
|
+
const o = this._listeners, c = fe(e, n), u = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = b(b({}, u), a);
|
|
841
|
+
t.addEventListener(c, i, d);
|
|
842
|
+
const l = () => {
|
|
843
|
+
t.removeEventListener(c, i, d), o.delete(l);
|
|
844
844
|
};
|
|
845
|
-
return
|
|
845
|
+
return o.add(l), l;
|
|
846
846
|
}
|
|
847
847
|
clean() {
|
|
848
848
|
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class ze {
|
|
852
852
|
constructor() {
|
|
853
|
-
|
|
853
|
+
$(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
854
854
|
}
|
|
855
|
-
add(t, e, n = 140, ...
|
|
856
|
-
this.remove(t), this._timeouts.set(t, window.setTimeout(e, n, ...
|
|
855
|
+
add(t, e, n = 140, ...i) {
|
|
856
|
+
this.remove(t), this._timeouts.set(t, window.setTimeout(e, n, ...i));
|
|
857
857
|
}
|
|
858
858
|
remove(t) {
|
|
859
859
|
const e = this._timeouts.get(t);
|
|
@@ -863,20 +863,20 @@ class Ge {
|
|
|
863
863
|
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
866
|
+
class Ke {
|
|
867
867
|
constructor(t) {
|
|
868
|
-
|
|
868
|
+
$(this, "gestures", /* @__PURE__ */ new Set()), $(this, "_targetEventStore", new zt(this)), $(this, "gestureEventStores", {}), $(this, "gestureTimeoutStores", {}), $(this, "handlers", {}), $(this, "config", {}), $(this, "pointerIds", /* @__PURE__ */ new Set()), $(this, "touchIds", /* @__PURE__ */ new Set()), $(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
|
+
}), Fe(this, t);
|
|
876
876
|
}
|
|
877
877
|
setEventIds(t) {
|
|
878
|
-
if (
|
|
879
|
-
return this.touchIds = new Set(
|
|
878
|
+
if (nt(t))
|
|
879
|
+
return this.touchIds = new Set(pe(t)), this.touchIds;
|
|
880
880
|
if ("pointerId" in t)
|
|
881
881
|
return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
|
|
882
882
|
}
|
|
@@ -884,7 +884,7 @@ class Fe {
|
|
|
884
884
|
this.handlers = t, this.nativeHandlers = e;
|
|
885
885
|
}
|
|
886
886
|
applyConfig(t, e) {
|
|
887
|
-
this.config =
|
|
887
|
+
this.config = Ue(t, e, this.config);
|
|
888
888
|
}
|
|
889
889
|
clean() {
|
|
890
890
|
this._targetEventStore.clean();
|
|
@@ -896,99 +896,99 @@ class Fe {
|
|
|
896
896
|
}
|
|
897
897
|
bind(...t) {
|
|
898
898
|
const e = this.config.shared, n = {};
|
|
899
|
-
let
|
|
900
|
-
if (!(e.target && (
|
|
899
|
+
let i;
|
|
900
|
+
if (!(e.target && (i = e.target(), !i))) {
|
|
901
901
|
if (e.enabled) {
|
|
902
|
-
for (const
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
const
|
|
906
|
-
new
|
|
902
|
+
for (const o of this.gestures) {
|
|
903
|
+
const c = this.config[o], u = Ot(n, c.eventOptions, !!i);
|
|
904
|
+
if (c.enabled) {
|
|
905
|
+
const d = Ut.get(o);
|
|
906
|
+
new d(this, t, o).bind(u);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
for (const
|
|
911
|
-
o
|
|
912
|
-
event:
|
|
909
|
+
const a = Ot(n, e.eventOptions, !!i);
|
|
910
|
+
for (const o in this.nativeHandlers)
|
|
911
|
+
a(o, "", (c) => this.nativeHandlers[o](b(b({}, this.state.shared), {}, {
|
|
912
|
+
event: c,
|
|
913
913
|
args: t
|
|
914
914
|
})), void 0, !0);
|
|
915
915
|
}
|
|
916
|
-
for (const
|
|
917
|
-
n[
|
|
918
|
-
if (!
|
|
919
|
-
for (const
|
|
916
|
+
for (const a in n)
|
|
917
|
+
n[a] = ve(...n[a]);
|
|
918
|
+
if (!i) return n;
|
|
919
|
+
for (const a in n) {
|
|
920
920
|
const {
|
|
921
|
-
device:
|
|
922
|
-
capture:
|
|
923
|
-
passive:
|
|
924
|
-
} =
|
|
925
|
-
this._targetEventStore.add(
|
|
926
|
-
capture:
|
|
927
|
-
passive:
|
|
921
|
+
device: o,
|
|
922
|
+
capture: c,
|
|
923
|
+
passive: u
|
|
924
|
+
} = le(a);
|
|
925
|
+
this._targetEventStore.add(i, o, "", n[a], {
|
|
926
|
+
capture: c,
|
|
927
|
+
passive: u
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
r.gestures.add(t), r.gestureEventStores[t] = new zt(r, t), r.gestureTimeoutStores[t] = new
|
|
933
|
+
function H(r, t) {
|
|
934
|
+
r.gestures.add(t), r.gestureEventStores[t] = new zt(r, t), r.gestureTimeoutStores[t] = new ze();
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
t.drag &&
|
|
936
|
+
function Fe(r, t) {
|
|
937
|
+
t.drag && H(r, "drag"), t.wheel && H(r, "wheel"), t.scroll && H(r, "scroll"), t.move && H(r, "move"), t.pinch && H(r, "pinch"), t.hover && H(r, "hover");
|
|
938
938
|
}
|
|
939
|
-
const
|
|
940
|
-
var
|
|
941
|
-
const
|
|
942
|
-
let
|
|
943
|
-
e &&
|
|
939
|
+
const Ot = (r, t, e) => (n, i, a, o = {}, c = !1) => {
|
|
940
|
+
var u, d;
|
|
941
|
+
const l = (u = o.capture) !== null && u !== void 0 ? u : t.capture, m = (d = o.passive) !== null && d !== void 0 ? d : t.passive;
|
|
942
|
+
let h = c ? n : ce(n, i, l);
|
|
943
|
+
e && m && (h += "Passive"), r[h] = r[h] || [], r[h].push(a);
|
|
944
944
|
};
|
|
945
|
-
function
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
return
|
|
945
|
+
function Ge(r, t = {}, e, n) {
|
|
946
|
+
const i = lt.useMemo(() => new Ke(r), []);
|
|
947
|
+
if (i.applyHandlers(r, n), i.applyConfig(t, e), lt.useEffect(i.effect.bind(i)), lt.useEffect(() => i.clean.bind(i), []), t.target === void 0)
|
|
948
|
+
return i.bind.bind(i);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
return
|
|
950
|
+
function We(r, t) {
|
|
951
|
+
return Ne(Me), Ge({
|
|
952
952
|
drag: r
|
|
953
953
|
}, t || {}, "drag");
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ye(r) {
|
|
956
956
|
const {
|
|
957
957
|
type: t,
|
|
958
958
|
actionType: e,
|
|
959
959
|
toIndex: n,
|
|
960
|
-
itemsLength:
|
|
961
|
-
withLoop:
|
|
962
|
-
scrollAmount:
|
|
963
|
-
totalAvailable:
|
|
960
|
+
itemsLength: i,
|
|
961
|
+
withLoop: a,
|
|
962
|
+
scrollAmount: o,
|
|
963
|
+
totalAvailable: c
|
|
964
964
|
} = r;
|
|
965
|
-
let
|
|
966
|
-
t === "next" && (
|
|
967
|
-
let
|
|
968
|
-
t === "next" && (
|
|
969
|
-
const
|
|
965
|
+
let u = r.currentActive, d = r.fromValueRaw, l = !1, m = !1;
|
|
966
|
+
t === "next" && (u += 1), t === "prev" && (u = u === 0 ? i - 1 : u - 1), n !== void 0 && (u = n);
|
|
967
|
+
let h = 0;
|
|
968
|
+
t === "next" && (h = -(u * o), a && u === i && (u = 0, d = d + o * i, h = 0), !a && (Math.abs(h) >= c || u === i - 1) && (m = !0, h = -c)), t === "prev" && (h = -(u * o), u === i - 1 && (d = d - i * o), !a && h >= 0 && (l = !0, h = 0)), e === "resize" && (h = -(u * o), a || (u === 0 && (l = !0), (u === i - 1 || Math.abs(h) >= c) && (m = !0, Math.abs(h) >= c && c > 0 && (h = -c))));
|
|
969
|
+
const S = a ? u % i : u, E = a ? i + u % i : u;
|
|
970
970
|
return {
|
|
971
|
-
newActive:
|
|
972
|
-
fromValue:
|
|
973
|
-
toValue:
|
|
974
|
-
startReached:
|
|
975
|
-
endReached:
|
|
976
|
-
logicalIndex:
|
|
977
|
-
realTrackIndex:
|
|
971
|
+
newActive: u,
|
|
972
|
+
fromValue: d,
|
|
973
|
+
toValue: h,
|
|
974
|
+
startReached: l,
|
|
975
|
+
endReached: m,
|
|
976
|
+
logicalIndex: S,
|
|
977
|
+
realTrackIndex: E
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function q(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
|
|
984
|
-
const r =
|
|
983
|
+
function He() {
|
|
984
|
+
const r = T(
|
|
985
985
|
null
|
|
986
986
|
);
|
|
987
987
|
r.current === null && (r.current = /* @__PURE__ */ new Set());
|
|
988
|
-
const t =
|
|
988
|
+
const t = T(null);
|
|
989
989
|
return t.current === null && (t.current = {
|
|
990
990
|
useListenToCustomEvent(e) {
|
|
991
|
-
|
|
991
|
+
X(() => {
|
|
992
992
|
const n = r.current;
|
|
993
993
|
return n.add(e), () => {
|
|
994
994
|
n.delete(e);
|
|
@@ -997,7 +997,7 @@ function qe() {
|
|
|
997
997
|
},
|
|
998
998
|
emitEvent(e) {
|
|
999
999
|
const n = r.current;
|
|
1000
|
-
!n || n.size === 0 || n.forEach((
|
|
1000
|
+
!n || n.size === 0 || n.forEach((i) => i(e));
|
|
1001
1001
|
}
|
|
1002
1002
|
}), t.current;
|
|
1003
1003
|
}
|
|
@@ -1006,342 +1006,360 @@ function rr({
|
|
|
1006
1006
|
items: t,
|
|
1007
1007
|
withLoop: e = !1,
|
|
1008
1008
|
id: n,
|
|
1009
|
-
gutter:
|
|
1010
|
-
itemsPerSlide:
|
|
1011
|
-
carouselAxis:
|
|
1012
|
-
startingPosition:
|
|
1013
|
-
enableGestures:
|
|
1014
|
-
slideWhenDragThresholdIsReached:
|
|
1015
|
-
slideType:
|
|
1016
|
-
initialActiveItem:
|
|
1017
|
-
renderWindow:
|
|
1018
|
-
renderPlaceholder:
|
|
1009
|
+
gutter: i = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
|
|
1010
|
+
itemsPerSlide: a = [{ breakpoint: 0, itemsPerSlide: 1 }],
|
|
1011
|
+
carouselAxis: o = "x",
|
|
1012
|
+
startingPosition: c = "start",
|
|
1013
|
+
enableGestures: u = !0,
|
|
1014
|
+
slideWhenDragThresholdIsReached: d = !0,
|
|
1015
|
+
slideType: l = "item",
|
|
1016
|
+
initialActiveItem: m = 0,
|
|
1017
|
+
renderWindow: h,
|
|
1018
|
+
renderPlaceholder: S
|
|
1019
1019
|
}) {
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1024
|
-
const
|
|
1025
|
-
function
|
|
1026
|
-
if (
|
|
1027
|
-
if (typeof
|
|
1028
|
-
return t[
|
|
1029
|
-
`initialActiveItem: item at index ${
|
|
1020
|
+
const E = T(r), D = T(null), g = T(null), I = T(0), A = T(0), _ = T(!e), k = T(!1), B = T(0), p = T(0), z = T(t);
|
|
1021
|
+
z.current = t;
|
|
1022
|
+
const it = T(e);
|
|
1023
|
+
it.current = e;
|
|
1024
|
+
const mt = T(!1), j = T(null), N = T(null), U = T(null), K = T(null), F = T({ width: 0, height: 0 });
|
|
1025
|
+
function vt(s) {
|
|
1026
|
+
if (s === void 0) return 0;
|
|
1027
|
+
if (typeof s == "number")
|
|
1028
|
+
return t[s] ? s : (console.warn(
|
|
1029
|
+
`initialActiveItem: item at index ${s} doesn't exist.`
|
|
1030
1030
|
), 0);
|
|
1031
|
-
const
|
|
1032
|
-
return
|
|
1031
|
+
const f = t.findIndex((v) => v.id === s);
|
|
1032
|
+
return f < 0 ? (console.warn(`initialActiveItem: item with id "${s}" doesn't exist.`), 0) : f;
|
|
1033
1033
|
}
|
|
1034
|
-
const
|
|
1034
|
+
const tt = te(), st = Rt({
|
|
1035
1035
|
value: 0,
|
|
1036
|
-
ref:
|
|
1037
|
-
onChange({ value:
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1036
|
+
ref: tt,
|
|
1037
|
+
onChange({ value: s }) {
|
|
1038
|
+
g.current.style.transform = q(
|
|
1039
|
+
s.value,
|
|
1040
|
+
o,
|
|
1041
1041
|
n
|
|
1042
1042
|
);
|
|
1043
1043
|
}
|
|
1044
|
-
}),
|
|
1045
|
-
function
|
|
1046
|
-
if (!
|
|
1047
|
-
let
|
|
1048
|
-
for (const
|
|
1049
|
-
(
|
|
1050
|
-
return
|
|
1051
|
-
}
|
|
1052
|
-
function
|
|
1053
|
-
const { totalGutterCssVar:
|
|
1054
|
-
return
|
|
1044
|
+
}), Kt = e ? t.length * 3 : t.length, { useListenToCustomEvent: yt, emitEvent: G } = He();
|
|
1045
|
+
function bt(s) {
|
|
1046
|
+
if (!s || s.length === 0) return null;
|
|
1047
|
+
let f = null, v = -1 / 0;
|
|
1048
|
+
for (const x of s)
|
|
1049
|
+
(x.media ? window.matchMedia(x.media).matches : window.innerWidth >= x.breakpoint) && x.breakpoint >= v && (f = x, v = x.breakpoint);
|
|
1050
|
+
return f;
|
|
1051
|
+
}
|
|
1052
|
+
function _t() {
|
|
1053
|
+
const { totalGutterCssVar: s } = wt();
|
|
1054
|
+
return s;
|
|
1055
1055
|
}
|
|
1056
1056
|
function Ft() {
|
|
1057
|
-
const
|
|
1058
|
-
return (
|
|
1057
|
+
const s = bt(a);
|
|
1058
|
+
return (s == null ? void 0 : s.itemsPerSlide) || 1;
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1061
|
-
|
|
1060
|
+
function ot(s) {
|
|
1061
|
+
E.current && (k.current || W({
|
|
1062
1062
|
type: "next",
|
|
1063
|
-
toIndex:
|
|
1063
|
+
toIndex: s,
|
|
1064
1064
|
actionType: "click"
|
|
1065
1065
|
}));
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1068
|
-
|
|
1067
|
+
function at(s) {
|
|
1068
|
+
E.current && (_.current || W({
|
|
1069
1069
|
type: "prev",
|
|
1070
|
-
toIndex:
|
|
1070
|
+
toIndex: s,
|
|
1071
1071
|
actionType: "click"
|
|
1072
1072
|
}));
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
type:
|
|
1076
|
-
shouldAnimate:
|
|
1077
|
-
toIndex:
|
|
1078
|
-
actionType:
|
|
1074
|
+
function W({
|
|
1075
|
+
type: s,
|
|
1076
|
+
shouldAnimate: f = !0,
|
|
1077
|
+
toIndex: v,
|
|
1078
|
+
actionType: x
|
|
1079
1079
|
}) {
|
|
1080
|
-
var
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
const
|
|
1084
|
-
type:
|
|
1085
|
-
actionType:
|
|
1086
|
-
toIndex:
|
|
1087
|
-
currentActive:
|
|
1080
|
+
var L, M;
|
|
1081
|
+
const O = !f;
|
|
1082
|
+
_.current = !1, k.current = !1;
|
|
1083
|
+
const y = Ye({
|
|
1084
|
+
type: s,
|
|
1085
|
+
actionType: x,
|
|
1086
|
+
toIndex: v,
|
|
1087
|
+
currentActive: p.current,
|
|
1088
1088
|
itemsLength: t.length,
|
|
1089
1089
|
withLoop: e,
|
|
1090
|
-
scrollAmount:
|
|
1091
|
-
totalAvailable:
|
|
1092
|
-
e ?
|
|
1090
|
+
scrollAmount: A.current,
|
|
1091
|
+
totalAvailable: s === "next" || x === "resize" ? ct(
|
|
1092
|
+
e ? A.current * (t.length * 2) : 0
|
|
1093
1093
|
) : 0,
|
|
1094
|
-
fromValueRaw:
|
|
1094
|
+
fromValueRaw: st.value.get()
|
|
1095
1095
|
});
|
|
1096
|
-
|
|
1096
|
+
p.current = y.newActive, _.current = y.startReached, k.current = y.endReached, I.current = y.toValue, G(x === "resize" ? {
|
|
1097
1097
|
eventName: "onResize",
|
|
1098
|
-
sliceActionType:
|
|
1099
|
-
slideDirection:
|
|
1098
|
+
sliceActionType: x,
|
|
1099
|
+
slideDirection: s,
|
|
1100
1100
|
currentItem: {
|
|
1101
|
-
id: ((
|
|
1102
|
-
index:
|
|
1103
|
-
trackIndex:
|
|
1104
|
-
startReached:
|
|
1105
|
-
endReached:
|
|
1101
|
+
id: ((L = t.at(y.logicalIndex)) == null ? void 0 : L.id) ?? "",
|
|
1102
|
+
index: y.logicalIndex,
|
|
1103
|
+
trackIndex: y.realTrackIndex,
|
|
1104
|
+
startReached: _.current,
|
|
1105
|
+
endReached: k.current
|
|
1106
1106
|
}
|
|
1107
1107
|
} : {
|
|
1108
1108
|
eventName: "onSlideStartChange",
|
|
1109
|
-
sliceActionType:
|
|
1110
|
-
slideDirection:
|
|
1109
|
+
sliceActionType: x,
|
|
1110
|
+
slideDirection: s,
|
|
1111
1111
|
nextItem: {
|
|
1112
|
-
index:
|
|
1113
|
-
id: ((
|
|
1114
|
-
trackIndex:
|
|
1115
|
-
startReached:
|
|
1116
|
-
endReached:
|
|
1112
|
+
index: y.logicalIndex,
|
|
1113
|
+
id: ((M = t.at(y.logicalIndex)) == null ? void 0 : M.id) ?? "",
|
|
1114
|
+
trackIndex: y.realTrackIndex,
|
|
1115
|
+
startReached: _.current,
|
|
1116
|
+
endReached: k.current
|
|
1117
1117
|
}
|
|
1118
|
-
}),
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1118
|
+
}), O && g.current && (g.current.style.transform = q(
|
|
1119
|
+
y.toValue,
|
|
1120
|
+
o,
|
|
1121
|
+
n
|
|
1122
|
+
)), tt.start({
|
|
1123
|
+
immediate: O,
|
|
1124
|
+
from: { value: y.fromValue },
|
|
1125
|
+
to: { value: y.toValue },
|
|
1126
|
+
onChange({ value: Y }) {
|
|
1127
|
+
g.current.style.transform = q(
|
|
1128
|
+
Y.value,
|
|
1129
|
+
o,
|
|
1126
1130
|
n
|
|
1127
1131
|
);
|
|
1128
1132
|
},
|
|
1129
|
-
onRest({ finished:
|
|
1130
|
-
var
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1133
|
+
onRest({ finished: Y }) {
|
|
1134
|
+
var P;
|
|
1135
|
+
if (Y) {
|
|
1136
|
+
const w = e ? p.current % t.length : p.current, V = e ? t.length + p.current % t.length : p.current;
|
|
1137
|
+
G({
|
|
1134
1138
|
eventName: "onSlideChangeComplete",
|
|
1135
|
-
sliceActionType:
|
|
1136
|
-
slideDirection:
|
|
1139
|
+
sliceActionType: x,
|
|
1140
|
+
slideDirection: s,
|
|
1137
1141
|
currentItem: {
|
|
1138
|
-
index:
|
|
1139
|
-
id: ((
|
|
1140
|
-
trackIndex:
|
|
1141
|
-
startReached:
|
|
1142
|
-
endReached:
|
|
1142
|
+
index: w,
|
|
1143
|
+
id: ((P = t.at(w)) == null ? void 0 : P.id) ?? "",
|
|
1144
|
+
trackIndex: V,
|
|
1145
|
+
startReached: _.current,
|
|
1146
|
+
endReached: k.current
|
|
1143
1147
|
}
|
|
1144
1148
|
});
|
|
1145
1149
|
}
|
|
1146
1150
|
}
|
|
1147
1151
|
});
|
|
1148
1152
|
}
|
|
1149
|
-
function
|
|
1150
|
-
const
|
|
1151
|
-
let
|
|
1152
|
-
return
|
|
1153
|
+
function Gt() {
|
|
1154
|
+
const s = g.current;
|
|
1155
|
+
let f = 0;
|
|
1156
|
+
return l === "item" ? f = s.children[0].getBoundingClientRect()[o === "x" ? "width" : "height"] + _t() : f = s.getBoundingClientRect()[o === "x" ? "width" : "height"] + _t(), f;
|
|
1153
1157
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const
|
|
1156
|
-
return
|
|
1158
|
+
function ct(s) {
|
|
1159
|
+
const f = g.current;
|
|
1160
|
+
return f[o === "x" ? "scrollWidth" : "scrollHeight"] - f.getBoundingClientRect()[o === "x" ? "width" : "height"] - s;
|
|
1157
1161
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const
|
|
1162
|
+
function wt() {
|
|
1163
|
+
const s = bt(i);
|
|
1160
1164
|
return {
|
|
1161
|
-
totalGutterCssVar: (
|
|
1162
|
-
totalStartEndGutterCssVar: ((
|
|
1165
|
+
totalGutterCssVar: (s == null ? void 0 : s.gutter) || 0,
|
|
1166
|
+
totalStartEndGutterCssVar: ((s == null ? void 0 : s.startEndGutter) || 0) * 2
|
|
1163
1167
|
};
|
|
1164
1168
|
}
|
|
1165
|
-
|
|
1166
|
-
function
|
|
1167
|
-
const
|
|
1168
|
-
switch (
|
|
1169
|
+
X(() => {
|
|
1170
|
+
function s(P) {
|
|
1171
|
+
const w = Ft();
|
|
1172
|
+
switch (P) {
|
|
1169
1173
|
case "start":
|
|
1170
1174
|
return 0;
|
|
1171
1175
|
case "middle-start":
|
|
1172
|
-
return Math.floor((
|
|
1176
|
+
return Math.floor((w - 1) * 0.25);
|
|
1173
1177
|
case "center":
|
|
1174
|
-
return Math.floor((
|
|
1178
|
+
return Math.floor((w - 1) * 0.5);
|
|
1175
1179
|
case "middle-end":
|
|
1176
|
-
return Math.floor((
|
|
1180
|
+
return Math.floor((w - 1) * 0.75);
|
|
1177
1181
|
case "end":
|
|
1178
|
-
return
|
|
1182
|
+
return w - 1;
|
|
1179
1183
|
default:
|
|
1180
1184
|
return 0;
|
|
1181
1185
|
}
|
|
1182
1186
|
}
|
|
1183
|
-
function
|
|
1184
|
-
|
|
1185
|
-
const { totalStartEndGutterCssVar:
|
|
1186
|
-
let
|
|
1187
|
-
e && (
|
|
1187
|
+
function f() {
|
|
1188
|
+
A.current = Gt(), B.current = A.current / 4;
|
|
1189
|
+
const { totalStartEndGutterCssVar: P } = wt();
|
|
1190
|
+
let w = 0;
|
|
1191
|
+
e && (w = A.current * t.length), w -= A.current * s(c), w -= P / 2, D.current.style.setProperty(
|
|
1188
1192
|
`--${n}-offset-modifier`,
|
|
1189
|
-
`${-
|
|
1190
|
-
);
|
|
1193
|
+
`${-w}px`
|
|
1194
|
+
), e && g.current && (o === "x" ? g.current.style.left = "0px" : g.current.style.top = "0px");
|
|
1191
1195
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1196
|
+
function v(P) {
|
|
1197
|
+
if (D.current && (f(), P)) {
|
|
1198
|
+
const w = vt(m), V = e ? t.length + w % t.length : w;
|
|
1199
|
+
G({ eventName: "onInit", index: w, trackIndex: V });
|
|
1196
1200
|
}
|
|
1197
1201
|
}
|
|
1198
|
-
function
|
|
1199
|
-
|
|
1202
|
+
function x() {
|
|
1203
|
+
v(), W({
|
|
1200
1204
|
type: "resize",
|
|
1201
|
-
toIndex:
|
|
1205
|
+
toIndex: p.current,
|
|
1202
1206
|
shouldAnimate: !1,
|
|
1203
1207
|
actionType: "resize"
|
|
1204
1208
|
});
|
|
1205
1209
|
}
|
|
1206
|
-
function
|
|
1207
|
-
U.current !== null && clearTimeout(U.current), U.current =
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1210
|
+
function O() {
|
|
1211
|
+
U.current !== null && (clearTimeout(U.current), U.current = null), K.current !== null && (cancelAnimationFrame(K.current), K.current = null);
|
|
1212
|
+
}
|
|
1213
|
+
function y(P) {
|
|
1214
|
+
K.current === null && (K.current = requestAnimationFrame(() => {
|
|
1215
|
+
K.current = null;
|
|
1216
|
+
const w = D.current;
|
|
1217
|
+
if (!w) return;
|
|
1218
|
+
const V = w.getBoundingClientRect();
|
|
1219
|
+
(V.width !== F.current.width || V.height !== F.current.height) && (F.current = {
|
|
1220
|
+
width: V.width,
|
|
1221
|
+
height: V.height
|
|
1222
|
+
}, x()), P && (U.current = window.setTimeout(() => {
|
|
1223
|
+
U.current = null, y(!1);
|
|
1224
|
+
}, 400));
|
|
1225
|
+
}));
|
|
1217
1226
|
}
|
|
1218
|
-
function
|
|
1219
|
-
|
|
1220
|
-
|
|
1227
|
+
function L() {
|
|
1228
|
+
O(), y(!0);
|
|
1229
|
+
}
|
|
1230
|
+
function M() {
|
|
1231
|
+
O(), U.current = window.setTimeout(() => {
|
|
1232
|
+
U.current = null, F.current = { width: 0, height: 0 }, y(!0);
|
|
1221
1233
|
}, 250);
|
|
1222
1234
|
}
|
|
1235
|
+
function Y() {
|
|
1236
|
+
document.visibilityState === "visible" && (O(), F.current = { width: 0, height: 0 }, y(!0));
|
|
1237
|
+
}
|
|
1223
1238
|
if (r) {
|
|
1224
|
-
if (
|
|
1225
|
-
|
|
1226
|
-
else if (
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
width:
|
|
1230
|
-
height:
|
|
1239
|
+
if (E.current = !0, mt.current)
|
|
1240
|
+
x();
|
|
1241
|
+
else if (v(!0), mt.current = !0, D.current) {
|
|
1242
|
+
const w = D.current.getBoundingClientRect();
|
|
1243
|
+
F.current = {
|
|
1244
|
+
width: w.width,
|
|
1245
|
+
height: w.height
|
|
1231
1246
|
};
|
|
1232
1247
|
}
|
|
1233
|
-
const
|
|
1234
|
-
return
|
|
1235
|
-
|
|
1248
|
+
const P = window.visualViewport ?? window;
|
|
1249
|
+
return P.addEventListener("resize", L), window.addEventListener("orientationchange", M), document.addEventListener("visibilitychange", Y), () => {
|
|
1250
|
+
P.removeEventListener("resize", L), window.removeEventListener(
|
|
1236
1251
|
"orientationchange",
|
|
1237
|
-
|
|
1238
|
-
),
|
|
1252
|
+
M
|
|
1253
|
+
), document.removeEventListener(
|
|
1254
|
+
"visibilitychange",
|
|
1255
|
+
Y
|
|
1256
|
+
), O();
|
|
1239
1257
|
};
|
|
1240
1258
|
}
|
|
1241
|
-
}, [r, n,
|
|
1242
|
-
const
|
|
1243
|
-
r &&
|
|
1259
|
+
}, [r, n, o, e]), X(() => {
|
|
1260
|
+
const s = vt(m);
|
|
1261
|
+
r && s !== p.current && W({
|
|
1244
1262
|
type: "next",
|
|
1245
|
-
toIndex:
|
|
1263
|
+
toIndex: s,
|
|
1246
1264
|
actionType: "resize",
|
|
1247
1265
|
shouldAnimate: !1
|
|
1248
1266
|
});
|
|
1249
|
-
}, [r,
|
|
1250
|
-
const
|
|
1251
|
-
function
|
|
1267
|
+
}, [r, m]);
|
|
1268
|
+
const ut = u;
|
|
1269
|
+
function Wt() {
|
|
1252
1270
|
if (N.current !== null && (cancelAnimationFrame(N.current), N.current = null), j.current) {
|
|
1253
|
-
const
|
|
1254
|
-
j.current = null,
|
|
1271
|
+
const s = j.current;
|
|
1272
|
+
j.current = null, G(s);
|
|
1255
1273
|
}
|
|
1256
1274
|
}
|
|
1257
|
-
function
|
|
1258
|
-
j.current =
|
|
1275
|
+
function Yt(s) {
|
|
1276
|
+
j.current = s, N.current === null && (N.current = requestAnimationFrame(() => {
|
|
1259
1277
|
N.current = null;
|
|
1260
|
-
const
|
|
1261
|
-
j.current = null,
|
|
1278
|
+
const f = j.current;
|
|
1279
|
+
j.current = null, f && G(f);
|
|
1262
1280
|
}));
|
|
1263
1281
|
}
|
|
1264
|
-
|
|
1282
|
+
X(
|
|
1265
1283
|
() => () => {
|
|
1266
1284
|
N.current !== null && (cancelAnimationFrame(N.current), N.current = null), j.current = null;
|
|
1267
1285
|
},
|
|
1268
1286
|
[]
|
|
1269
1287
|
);
|
|
1270
|
-
const
|
|
1271
|
-
(
|
|
1272
|
-
if (!
|
|
1288
|
+
const Ht = We(
|
|
1289
|
+
(s) => {
|
|
1290
|
+
if (!E.current)
|
|
1273
1291
|
return;
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
...
|
|
1292
|
+
const f = s.dragging, v = s.offset[o === "x" ? 0 : 1], x = s.movement[o === "x" ? 0 : 1], O = x > B.current, y = x < -B.current, L = s.velocity;
|
|
1293
|
+
f && (Yt({
|
|
1294
|
+
...s,
|
|
1277
1295
|
eventName: "onDrag",
|
|
1278
1296
|
slideActionType: "drag"
|
|
1279
|
-
}),
|
|
1280
|
-
value:
|
|
1297
|
+
}), tt.start({
|
|
1298
|
+
value: v,
|
|
1281
1299
|
immediate: !0,
|
|
1282
1300
|
config: {
|
|
1283
|
-
velocity:
|
|
1301
|
+
velocity: L
|
|
1284
1302
|
},
|
|
1285
|
-
onChange({ value:
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1303
|
+
onChange({ value: M }) {
|
|
1304
|
+
g.current.style.transform = q(
|
|
1305
|
+
M.value,
|
|
1306
|
+
o,
|
|
1289
1307
|
n
|
|
1290
1308
|
);
|
|
1291
1309
|
}
|
|
1292
|
-
}),
|
|
1310
|
+
}), d && (O || y) && s.cancel()), s.last && (Wt(), O ? (W({
|
|
1293
1311
|
actionType: "drag",
|
|
1294
1312
|
type: "prev"
|
|
1295
|
-
}),
|
|
1313
|
+
}), s.cancel()) : y ? (W({
|
|
1296
1314
|
actionType: "drag",
|
|
1297
1315
|
type: "next"
|
|
1298
|
-
}),
|
|
1299
|
-
value:
|
|
1316
|
+
}), s.cancel()) : (tt.start({
|
|
1317
|
+
value: I.current,
|
|
1300
1318
|
config: {
|
|
1301
|
-
velocity:
|
|
1319
|
+
velocity: L
|
|
1302
1320
|
},
|
|
1303
|
-
onChange({ value:
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1321
|
+
onChange({ value: M }) {
|
|
1322
|
+
g.current.style.transform = q(
|
|
1323
|
+
M.value,
|
|
1324
|
+
o,
|
|
1307
1325
|
n
|
|
1308
1326
|
);
|
|
1309
1327
|
}
|
|
1310
|
-
}),
|
|
1328
|
+
}), s.cancel()));
|
|
1311
1329
|
},
|
|
1312
1330
|
{
|
|
1313
|
-
enabled:
|
|
1314
|
-
axis:
|
|
1331
|
+
enabled: ut,
|
|
1332
|
+
axis: o,
|
|
1315
1333
|
rubberband: !e,
|
|
1316
1334
|
...e ? {} : {
|
|
1317
1335
|
bounds: () => ({
|
|
1318
1336
|
right: 0,
|
|
1319
|
-
left: -
|
|
1320
|
-
top: -
|
|
1337
|
+
left: -ct(0),
|
|
1338
|
+
top: -ct(0),
|
|
1321
1339
|
bottom: 0
|
|
1322
1340
|
})
|
|
1323
1341
|
},
|
|
1324
|
-
from: () => [
|
|
1342
|
+
from: () => [st.value.get(), st.value.get()]
|
|
1325
1343
|
}
|
|
1326
|
-
),
|
|
1327
|
-
var
|
|
1328
|
-
const
|
|
1329
|
-
if (typeof
|
|
1330
|
-
const
|
|
1331
|
-
return
|
|
1332
|
-
}, []),
|
|
1333
|
-
() => Array.from({ length: t.length }, (
|
|
1334
|
-
const
|
|
1335
|
-
return e ?
|
|
1344
|
+
), Xt = Nt((s) => {
|
|
1345
|
+
var y;
|
|
1346
|
+
const f = z.current, x = it.current ? f.length + p.current % f.length : p.current;
|
|
1347
|
+
if (typeof s == "number") return x === s;
|
|
1348
|
+
const O = p.current % f.length;
|
|
1349
|
+
return s === ((y = f[O]) == null ? void 0 : y.id);
|
|
1350
|
+
}, []), qt = ft(
|
|
1351
|
+
() => Array.from({ length: t.length }, (s, f) => () => {
|
|
1352
|
+
const v = e ? p.current % t.length : p.current;
|
|
1353
|
+
return e ? f === (v + 1) % t.length : v + 1 >= t.length ? !1 : f === v + 1;
|
|
1336
1354
|
}),
|
|
1337
1355
|
[t.length, e]
|
|
1338
|
-
),
|
|
1339
|
-
() => Array.from({ length: t.length }, (
|
|
1340
|
-
const
|
|
1341
|
-
return e ?
|
|
1356
|
+
), Jt = ft(
|
|
1357
|
+
() => Array.from({ length: t.length }, (s, f) => () => {
|
|
1358
|
+
const v = e ? p.current % t.length : p.current;
|
|
1359
|
+
return e ? f === (v - 1 + t.length) % t.length : v - 1 < 0 ? !1 : f === v - 1;
|
|
1342
1360
|
}),
|
|
1343
1361
|
[t.length, e]
|
|
1344
|
-
),
|
|
1362
|
+
), Qt = ft(
|
|
1345
1363
|
() => `
|
|
1346
1364
|
[data-part-internal="${n}-Container"] {
|
|
1347
1365
|
display: flex;
|
|
@@ -1351,19 +1369,19 @@ function rr({
|
|
|
1351
1369
|
--${n}-items-per-slide: 1;
|
|
1352
1370
|
--${n}-offset-position: 0px;
|
|
1353
1371
|
--${n}-offset-modifier: 0px;
|
|
1354
|
-
--${n}-scroll-x-value: ${
|
|
1355
|
-
--${n}-scroll-y-value: ${
|
|
1372
|
+
--${n}-scroll-x-value: ${o === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1373
|
+
--${n}-scroll-y-value: ${o === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1356
1374
|
--${n}-gutter: 0px;
|
|
1357
1375
|
--${n}-start-end-gutter: 0px;
|
|
1358
|
-
touch-action: ${
|
|
1376
|
+
touch-action: ${ut ? o === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1359
1377
|
}
|
|
1360
1378
|
[data-part-internal="${n}-Track"] {
|
|
1361
1379
|
display: flex;
|
|
1362
1380
|
position: relative;
|
|
1363
1381
|
--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));
|
|
1364
|
-
left: ${e &&
|
|
1365
|
-
top: ${e &&
|
|
1366
|
-
flex-direction: ${
|
|
1382
|
+
left: ${e && o === "x" ? "var(--initial-offset-modifier)" : "0px"};
|
|
1383
|
+
top: ${e && o === "y" ? "var(--initial-offset-modifier)" : "0px"};
|
|
1384
|
+
flex-direction: ${o === "x" ? "row" : "column"};
|
|
1367
1385
|
width: 100%;
|
|
1368
1386
|
height: 100%;
|
|
1369
1387
|
gap: var(--${n}-gutter);
|
|
@@ -1373,21 +1391,21 @@ function rr({
|
|
|
1373
1391
|
display: flex;
|
|
1374
1392
|
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)));
|
|
1375
1393
|
}
|
|
1376
|
-
${
|
|
1377
|
-
(
|
|
1378
|
-
@media ${
|
|
1394
|
+
${i && i.length > 0 ? i.slice().sort((s, f) => s.breakpoint - f.breakpoint).map(
|
|
1395
|
+
(s) => `
|
|
1396
|
+
@media ${s.media || `(min-width: ${s.breakpoint}px)`} {
|
|
1379
1397
|
[data-part-internal="${n}-Container"] {
|
|
1380
|
-
--${n}-gutter: ${
|
|
1381
|
-
--${n}-start-end-gutter: ${(
|
|
1398
|
+
--${n}-gutter: ${s.gutter || 0}px;
|
|
1399
|
+
--${n}-start-end-gutter: ${(s.startEndGutter || 0) * 2}px;
|
|
1382
1400
|
}
|
|
1383
1401
|
}
|
|
1384
1402
|
`
|
|
1385
1403
|
).join("") : ""}
|
|
1386
|
-
${
|
|
1387
|
-
(
|
|
1388
|
-
@media ${
|
|
1404
|
+
${a && a.length > 0 ? a.slice().sort((s, f) => s.breakpoint - f.breakpoint).map(
|
|
1405
|
+
(s) => `
|
|
1406
|
+
@media ${s.media || `(min-width: ${s.breakpoint}px)`} {
|
|
1389
1407
|
[data-part-internal="${n}-Container"] {
|
|
1390
|
-
--${n}-items-per-slide: ${
|
|
1408
|
+
--${n}-items-per-slide: ${s.itemsPerSlide || 1};
|
|
1391
1409
|
}
|
|
1392
1410
|
}
|
|
1393
1411
|
`
|
|
@@ -1395,190 +1413,231 @@ function rr({
|
|
|
1395
1413
|
`,
|
|
1396
1414
|
[
|
|
1397
1415
|
n,
|
|
1398
|
-
|
|
1399
|
-
|
|
1416
|
+
o,
|
|
1417
|
+
ut,
|
|
1400
1418
|
t.length,
|
|
1401
1419
|
e,
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
o
|
|
1420
|
+
i,
|
|
1421
|
+
a
|
|
1405
1422
|
]
|
|
1406
1423
|
);
|
|
1407
1424
|
return {
|
|
1408
|
-
carouselFragment: /* @__PURE__ */
|
|
1425
|
+
carouselFragment: /* @__PURE__ */ Zt(
|
|
1409
1426
|
"div",
|
|
1410
1427
|
{
|
|
1411
|
-
ref:
|
|
1428
|
+
ref: D,
|
|
1412
1429
|
className: "ReactSpringCarouselContainer",
|
|
1413
1430
|
"data-part": "Container",
|
|
1414
1431
|
"data-part-internal": `${n}-Container`,
|
|
1415
|
-
...
|
|
1432
|
+
...Ht(),
|
|
1416
1433
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
|
|
1434
|
+
/* @__PURE__ */ J("style", { dangerouslySetInnerHTML: { __html: Qt } }),
|
|
1435
|
+
/* @__PURE__ */ J(
|
|
1436
|
+
Xe,
|
|
1420
1437
|
{
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
{
|
|
1436
|
-
className: "ReactSpringCarouselItem",
|
|
1437
|
-
"data-part": "Item",
|
|
1438
|
-
"data-part-internal": `${n}-Item`,
|
|
1439
|
-
"data-id": p.id,
|
|
1440
|
-
"aria-hidden": "true",
|
|
1441
|
-
children: x == null ? void 0 : x({ item: p, index: l, isClonedItem: k })
|
|
1442
|
-
},
|
|
1443
|
-
`${p.id}-${l}`
|
|
1444
|
-
);
|
|
1445
|
-
}
|
|
1446
|
-
const v = Jt[m], T = Qt[m];
|
|
1447
|
-
return /* @__PURE__ */ q(
|
|
1448
|
-
"div",
|
|
1449
|
-
{
|
|
1450
|
-
className: "ReactSpringCarouselItem",
|
|
1451
|
-
"data-part": "Item",
|
|
1452
|
-
"data-part-internal": `${n}-Item`,
|
|
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: T
|
|
1461
|
-
}) : p.renderItem
|
|
1462
|
-
},
|
|
1463
|
-
`${p.id}-${l}`
|
|
1464
|
-
);
|
|
1465
|
-
})
|
|
1438
|
+
id: n,
|
|
1439
|
+
trackRef: g,
|
|
1440
|
+
items: t,
|
|
1441
|
+
trackLength: Kt,
|
|
1442
|
+
withLoop: e,
|
|
1443
|
+
renderWindow: h,
|
|
1444
|
+
renderPlaceholder: S,
|
|
1445
|
+
activeItemRef: p,
|
|
1446
|
+
isNextItemFns: qt,
|
|
1447
|
+
isPrevItemFns: Jt,
|
|
1448
|
+
handleIsActiveItem: Xt,
|
|
1449
|
+
useListenToCustomEvent: yt,
|
|
1450
|
+
startReachedRef: _,
|
|
1451
|
+
endReachedRef: k
|
|
1466
1452
|
}
|
|
1467
1453
|
)
|
|
1468
1454
|
]
|
|
1469
1455
|
}
|
|
1470
1456
|
),
|
|
1471
|
-
useListenToCustomEvent:
|
|
1472
|
-
slideToNextItem: () =>
|
|
1473
|
-
slideToPrevItem: () =>
|
|
1474
|
-
slideToItem: (
|
|
1475
|
-
if (typeof
|
|
1476
|
-
if (!t[
|
|
1457
|
+
useListenToCustomEvent: yt,
|
|
1458
|
+
slideToNextItem: () => ot(),
|
|
1459
|
+
slideToPrevItem: () => at(),
|
|
1460
|
+
slideToItem: (s) => {
|
|
1461
|
+
if (typeof s == "number") {
|
|
1462
|
+
if (!t[s]) {
|
|
1477
1463
|
console.warn(
|
|
1478
|
-
`The item you're trying to slide doesn't exist. index: ${
|
|
1464
|
+
`The item you're trying to slide doesn't exist. index: ${s}`
|
|
1479
1465
|
);
|
|
1480
1466
|
return;
|
|
1481
1467
|
}
|
|
1482
|
-
|
|
1468
|
+
s > p.current ? ot(s) : at(s);
|
|
1483
1469
|
}
|
|
1484
|
-
if (typeof
|
|
1485
|
-
const
|
|
1486
|
-
if (
|
|
1470
|
+
if (typeof s == "string") {
|
|
1471
|
+
const f = t.findIndex((v) => v.id === s);
|
|
1472
|
+
if (f < 0) {
|
|
1487
1473
|
console.warn(
|
|
1488
|
-
`The item you're trying to slide doesn't exist. id: ${
|
|
1474
|
+
`The item you're trying to slide doesn't exist. id: ${s}`
|
|
1489
1475
|
);
|
|
1490
1476
|
return;
|
|
1491
1477
|
}
|
|
1492
|
-
|
|
1478
|
+
f > p.current ? ot(f) : at(f);
|
|
1493
1479
|
}
|
|
1494
1480
|
}
|
|
1495
1481
|
};
|
|
1496
1482
|
}
|
|
1497
|
-
function
|
|
1483
|
+
function Xe({
|
|
1484
|
+
id: r,
|
|
1485
|
+
trackRef: t,
|
|
1486
|
+
items: e,
|
|
1487
|
+
trackLength: n,
|
|
1488
|
+
withLoop: i,
|
|
1489
|
+
renderWindow: a,
|
|
1490
|
+
renderPlaceholder: o,
|
|
1491
|
+
activeItemRef: c,
|
|
1492
|
+
isNextItemFns: u,
|
|
1493
|
+
isPrevItemFns: d,
|
|
1494
|
+
handleIsActiveItem: l,
|
|
1495
|
+
useListenToCustomEvent: m,
|
|
1496
|
+
startReachedRef: h,
|
|
1497
|
+
endReachedRef: S
|
|
1498
|
+
}) {
|
|
1499
|
+
const [, E] = ee((g) => g + 1, 0), D = Nt(
|
|
1500
|
+
(g) => {
|
|
1501
|
+
a !== void 0 && (g.eventName === "onSlideStartChange" || g.eventName === "onResize") && E();
|
|
1502
|
+
},
|
|
1503
|
+
[a]
|
|
1504
|
+
);
|
|
1505
|
+
return m(D), /* @__PURE__ */ J(
|
|
1506
|
+
"div",
|
|
1507
|
+
{
|
|
1508
|
+
ref: t,
|
|
1509
|
+
className: "ReactSpringCarouselTrack",
|
|
1510
|
+
"data-part": "Track",
|
|
1511
|
+
"data-part-internal": `${r}-Track`,
|
|
1512
|
+
onScroll: () => {
|
|
1513
|
+
h.current = !1, S.current = !1;
|
|
1514
|
+
},
|
|
1515
|
+
children: Array.from({ length: n }, (g, I) => {
|
|
1516
|
+
const A = i ? I % e.length : I, _ = e[A], k = i && (I < e.length || I >= e.length * 2);
|
|
1517
|
+
if (a !== void 0) {
|
|
1518
|
+
const z = i ? e.length + c.current % e.length : c.current;
|
|
1519
|
+
if (Math.abs(I - z) > a)
|
|
1520
|
+
return /* @__PURE__ */ J(
|
|
1521
|
+
"div",
|
|
1522
|
+
{
|
|
1523
|
+
className: "ReactSpringCarouselItem",
|
|
1524
|
+
"data-part": "Item",
|
|
1525
|
+
"data-part-internal": `${r}-Item`,
|
|
1526
|
+
"data-id": _.id,
|
|
1527
|
+
"aria-hidden": "true",
|
|
1528
|
+
children: o == null ? void 0 : o({ item: _, index: I, isClonedItem: k })
|
|
1529
|
+
},
|
|
1530
|
+
`${_.id}-${I}`
|
|
1531
|
+
);
|
|
1532
|
+
}
|
|
1533
|
+
const B = u[A], p = d[A];
|
|
1534
|
+
return /* @__PURE__ */ J(
|
|
1535
|
+
"div",
|
|
1536
|
+
{
|
|
1537
|
+
className: "ReactSpringCarouselItem",
|
|
1538
|
+
"data-part": "Item",
|
|
1539
|
+
"data-part-internal": `${r}-Item`,
|
|
1540
|
+
"data-id": _.id,
|
|
1541
|
+
children: typeof _.renderItem == "function" ? _.renderItem({
|
|
1542
|
+
useListenToCustomEvent: m,
|
|
1543
|
+
index: I,
|
|
1544
|
+
isClonedItem: k,
|
|
1545
|
+
isActiveItem: l,
|
|
1546
|
+
isNextItem: B,
|
|
1547
|
+
isPrevItem: p
|
|
1548
|
+
}) : _.renderItem
|
|
1549
|
+
},
|
|
1550
|
+
`${_.id}-${I}`
|
|
1551
|
+
);
|
|
1552
|
+
})
|
|
1553
|
+
}
|
|
1554
|
+
);
|
|
1555
|
+
}
|
|
1556
|
+
function qe(r) {
|
|
1498
1557
|
let t = 0;
|
|
1499
1558
|
const e = getComputedStyle(r).getPropertyValue("gap");
|
|
1500
1559
|
return e.includes("px") && (t = Number(e.replace("px", ""))), t;
|
|
1501
1560
|
}
|
|
1502
|
-
function
|
|
1561
|
+
function Pt(r) {
|
|
1503
1562
|
return r.scrollWidth - r.clientWidth;
|
|
1504
1563
|
}
|
|
1505
|
-
function
|
|
1506
|
-
const t = r.children[0], e =
|
|
1564
|
+
function ht(r) {
|
|
1565
|
+
const t = r.children[0], e = qe(r);
|
|
1507
1566
|
return t.getBoundingClientRect().width + e;
|
|
1508
1567
|
}
|
|
1509
1568
|
function nr({ container: r, onReach: t }) {
|
|
1510
|
-
const e =
|
|
1569
|
+
const e = T("start"), n = T(0), [, i] = Rt(() => ({
|
|
1511
1570
|
x: 0
|
|
1512
1571
|
}));
|
|
1513
|
-
function
|
|
1514
|
-
|
|
1572
|
+
function a(c) {
|
|
1573
|
+
i.start({
|
|
1515
1574
|
from: {
|
|
1516
1575
|
x: r.current.scrollLeft
|
|
1517
1576
|
},
|
|
1518
1577
|
to: {
|
|
1519
|
-
x:
|
|
1578
|
+
x: c
|
|
1520
1579
|
},
|
|
1521
|
-
onChange({ value:
|
|
1522
|
-
r.current && (r.current.scrollLeft =
|
|
1580
|
+
onChange({ value: u }) {
|
|
1581
|
+
r.current && (r.current.scrollLeft = u.x);
|
|
1523
1582
|
}
|
|
1524
1583
|
});
|
|
1525
1584
|
}
|
|
1526
|
-
function
|
|
1527
|
-
if (!r.current ||
|
|
1585
|
+
function o(c) {
|
|
1586
|
+
if (!r.current || c === "next" && e.current === "end" || c === "prev" && e.current === "start")
|
|
1528
1587
|
return;
|
|
1529
|
-
let
|
|
1530
|
-
if (
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1588
|
+
let u = 0;
|
|
1589
|
+
if (c === "next" && (n.current += 1), c === "prev" && (n.current -= 1), u = n.current * ht(r.current), c === "next") {
|
|
1590
|
+
const d = Pt(r.current);
|
|
1591
|
+
u > d && (e.current = "end", u = d, t && t("end"));
|
|
1533
1592
|
}
|
|
1534
|
-
|
|
1593
|
+
c === "prev" && u <= 0 && (e.current = "start", n.current = 0, u = 0, t && t("start")), a(u);
|
|
1535
1594
|
}
|
|
1536
|
-
return
|
|
1537
|
-
function
|
|
1538
|
-
var
|
|
1539
|
-
const
|
|
1540
|
-
index:
|
|
1541
|
-
start:
|
|
1542
|
-
end:
|
|
1543
|
-
})),
|
|
1544
|
-
(
|
|
1595
|
+
return X(() => {
|
|
1596
|
+
function c() {
|
|
1597
|
+
var A;
|
|
1598
|
+
const S = ht(r.current), E = ((A = [...r.current.children].at(0)) == null ? void 0 : A.getBoundingClientRect().width) || 0, D = Array(r.current.childElementCount).fill(0).map((_, k) => ({
|
|
1599
|
+
index: k,
|
|
1600
|
+
start: S * k,
|
|
1601
|
+
end: S * (k + 1)
|
|
1602
|
+
})), g = r.current.scrollLeft + E, I = D.find(
|
|
1603
|
+
(_) => g >= _.start && g < _.end
|
|
1545
1604
|
);
|
|
1546
|
-
n.current = (
|
|
1605
|
+
n.current = (I == null ? void 0 : I.index) || 0;
|
|
1547
1606
|
}
|
|
1548
|
-
function
|
|
1549
|
-
|
|
1607
|
+
function u() {
|
|
1608
|
+
i.stop();
|
|
1550
1609
|
}
|
|
1551
|
-
function
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1610
|
+
function d(S) {
|
|
1611
|
+
const E = S.target;
|
|
1612
|
+
E.scrollLeft === 0 ? (n.current = 0, e.current = "start", t && t("start")) : E.scrollLeft >= Pt(E) ? (e.current = "end", t && t("end")) : e.current !== "idle" && (e.current = "idle", t && t("idle"));
|
|
1554
1613
|
}
|
|
1555
|
-
let
|
|
1556
|
-
function
|
|
1557
|
-
|
|
1558
|
-
r.current.scrollLeft ===
|
|
1614
|
+
let l, m = 0;
|
|
1615
|
+
function h() {
|
|
1616
|
+
m = r.current.scrollLeft, clearTimeout(l), l = setTimeout(function() {
|
|
1617
|
+
r.current.scrollLeft === m && c();
|
|
1559
1618
|
}, 200);
|
|
1560
1619
|
}
|
|
1561
1620
|
if (r.current)
|
|
1562
|
-
return r.current.addEventListener("wheel",
|
|
1621
|
+
return r.current.addEventListener("wheel", u, {
|
|
1563
1622
|
passive: !0
|
|
1564
|
-
}), r.current.addEventListener("scroll",
|
|
1565
|
-
r.current && (r.current.removeEventListener("scroll",
|
|
1623
|
+
}), r.current.addEventListener("scroll", d), r.current.addEventListener("scroll", h), () => {
|
|
1624
|
+
r.current && (r.current.removeEventListener("scroll", h), r.current.removeEventListener("scroll", d), r.current.removeEventListener("wheel", u));
|
|
1566
1625
|
};
|
|
1567
|
-
}, [r, t]),
|
|
1626
|
+
}, [r, t]), X(() => {
|
|
1568
1627
|
if (r.current) {
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1628
|
+
const c = new ResizeObserver(() => {
|
|
1629
|
+
a(n.current * ht(r.current));
|
|
1571
1630
|
});
|
|
1572
|
-
return
|
|
1573
|
-
|
|
1631
|
+
return c.observe(r.current), () => {
|
|
1632
|
+
c.disconnect();
|
|
1574
1633
|
};
|
|
1575
1634
|
}
|
|
1576
1635
|
}, []), {
|
|
1577
1636
|
scrollToNext() {
|
|
1578
|
-
|
|
1637
|
+
o("next");
|
|
1579
1638
|
},
|
|
1580
1639
|
scrollToPrev() {
|
|
1581
|
-
|
|
1640
|
+
o("prev");
|
|
1582
1641
|
}
|
|
1583
1642
|
};
|
|
1584
1643
|
}
|