react-spring-carousel 3.0.0-beta-2.0.502 → 3.0.0-beta-2.0.504
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 +508 -511
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSpring as
|
|
3
|
-
import Q, { useRef as C, useEffect as R, useState as
|
|
4
|
-
function
|
|
5
|
-
return Math.max(
|
|
1
|
+
import { jsxs as Me, jsx as J } from "react/jsx-runtime";
|
|
2
|
+
import { useSpring as Ee } from "@react-spring/web";
|
|
3
|
+
import Q, { useRef as C, useEffect as R, useState as Ve } from "react";
|
|
4
|
+
function Re(t, e, r) {
|
|
5
|
+
return Math.max(e, Math.min(t, r));
|
|
6
6
|
}
|
|
7
7
|
const w = {
|
|
8
|
-
toVector(
|
|
9
|
-
return
|
|
8
|
+
toVector(t, e) {
|
|
9
|
+
return t === void 0 && (t = e), Array.isArray(t) ? t : [t, t];
|
|
10
10
|
},
|
|
11
|
-
add(
|
|
12
|
-
return [
|
|
11
|
+
add(t, e) {
|
|
12
|
+
return [t[0] + e[0], t[1] + e[1]];
|
|
13
13
|
},
|
|
14
|
-
sub(
|
|
15
|
-
return [
|
|
14
|
+
sub(t, e) {
|
|
15
|
+
return [t[0] - e[0], t[1] - e[1]];
|
|
16
16
|
},
|
|
17
|
-
addTo(
|
|
18
|
-
|
|
17
|
+
addTo(t, e) {
|
|
18
|
+
t[0] += e[0], t[1] += e[1];
|
|
19
19
|
},
|
|
20
|
-
subTo(
|
|
21
|
-
|
|
20
|
+
subTo(t, e) {
|
|
21
|
+
t[0] -= e[0], t[1] -= e[1];
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function le(t, e, r) {
|
|
25
|
+
return e === 0 || Math.abs(e) === 1 / 0 ? Math.pow(t, r * 5) : t * e * r / (e + r * t);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return n === 0 ?
|
|
27
|
+
function fe(t, e, r, n = 0.15) {
|
|
28
|
+
return n === 0 ? Re(t, e, r) : t < e ? -le(e - t, r - e, n) + e : t > r ? +le(t - r, r - e, n) + r : t;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const [[o, a], [c, l]] =
|
|
32
|
-
return [
|
|
30
|
+
function je(t, [e, r], [n, s]) {
|
|
31
|
+
const [[o, a], [c, l]] = t;
|
|
32
|
+
return [fe(e, o, a, n), fe(r, c, l, s)];
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (typeof
|
|
36
|
-
var r =
|
|
34
|
+
function Be(t, e) {
|
|
35
|
+
if (typeof t != "object" || t === null) return t;
|
|
36
|
+
var r = t[Symbol.toPrimitive];
|
|
37
37
|
if (r !== void 0) {
|
|
38
|
-
var n = r.call(
|
|
38
|
+
var n = r.call(t, e);
|
|
39
39
|
if (typeof n != "object") return n;
|
|
40
40
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
41
41
|
}
|
|
42
|
-
return (
|
|
42
|
+
return (e === "string" ? String : Number)(t);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
var
|
|
46
|
-
return typeof
|
|
44
|
+
function Ue(t) {
|
|
45
|
+
var e = Be(t, "string");
|
|
46
|
+
return typeof e == "symbol" ? e : String(e);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function x(t, e, r) {
|
|
49
|
+
return e = Ue(e), e in t ? Object.defineProperty(t, e, {
|
|
50
50
|
value: r,
|
|
51
51
|
enumerable: !0,
|
|
52
52
|
configurable: !0,
|
|
53
53
|
writable: !0
|
|
54
|
-
}) : e
|
|
54
|
+
}) : t[e] = r, t;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
var r = Object.keys(
|
|
56
|
+
function de(t, e) {
|
|
57
|
+
var r = Object.keys(t);
|
|
58
58
|
if (Object.getOwnPropertySymbols) {
|
|
59
|
-
var n = Object.getOwnPropertySymbols(
|
|
60
|
-
|
|
61
|
-
return Object.getOwnPropertyDescriptor(
|
|
59
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
60
|
+
e && (n = n.filter(function(s) {
|
|
61
|
+
return Object.getOwnPropertyDescriptor(t, s).enumerable;
|
|
62
62
|
})), r.push.apply(r, n);
|
|
63
63
|
}
|
|
64
64
|
return r;
|
|
65
65
|
}
|
|
66
|
-
function p(
|
|
67
|
-
for (var
|
|
68
|
-
var r = arguments[
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
72
|
-
Object.defineProperty(
|
|
66
|
+
function p(t) {
|
|
67
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
68
|
+
var r = arguments[e] != null ? arguments[e] : {};
|
|
69
|
+
e % 2 ? de(Object(r), !0).forEach(function(n) {
|
|
70
|
+
x(t, n, r[n]);
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach(function(n) {
|
|
72
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return t;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const Te = {
|
|
78
78
|
pointer: {
|
|
79
79
|
start: "down",
|
|
80
80
|
change: "move",
|
|
@@ -96,106 +96,106 @@ const Tt = {
|
|
|
96
96
|
end: "end"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
100
|
-
return
|
|
99
|
+
function he(t) {
|
|
100
|
+
return t ? t[0].toUpperCase() + t.slice(1) : "";
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return
|
|
102
|
+
const Ke = ["enter", "leave"];
|
|
103
|
+
function ze(t = !1, e) {
|
|
104
|
+
return t && !Ke.includes(e);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const n =
|
|
108
|
-
return "on" +
|
|
106
|
+
function Ge(t, e = "", r = !1) {
|
|
107
|
+
const n = Te[t], s = n && n[e] || e;
|
|
108
|
+
return "on" + he(t) + he(s) + (ze(r, s) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
112
|
-
let
|
|
113
|
-
const r = !!~
|
|
114
|
-
r && (
|
|
115
|
-
const n =
|
|
116
|
-
return s && (
|
|
117
|
-
device:
|
|
110
|
+
const We = ["gotpointercapture", "lostpointercapture"];
|
|
111
|
+
function Ye(t) {
|
|
112
|
+
let e = t.substring(2).toLowerCase();
|
|
113
|
+
const r = !!~e.indexOf("passive");
|
|
114
|
+
r && (e = e.replace("passive", ""));
|
|
115
|
+
const n = We.includes(e) ? "capturecapture" : "capture", s = !!~e.indexOf(n);
|
|
116
|
+
return s && (e = e.replace("capture", "")), {
|
|
117
|
+
device: e,
|
|
118
118
|
capture: s,
|
|
119
119
|
passive: r
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const r =
|
|
124
|
-
return
|
|
122
|
+
function Fe(t, e = "") {
|
|
123
|
+
const r = Te[t], n = r && r[e] || e;
|
|
124
|
+
return t + n;
|
|
125
125
|
}
|
|
126
|
-
function W(
|
|
127
|
-
return "touches" in
|
|
126
|
+
function W(t) {
|
|
127
|
+
return "touches" in t;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
return W(
|
|
129
|
+
function xe(t) {
|
|
130
|
+
return W(t) ? "touch" : "pointerType" in t ? t.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
return Array.from(
|
|
132
|
+
function He(t) {
|
|
133
|
+
return Array.from(t.touches).filter((e) => {
|
|
134
134
|
var r, n;
|
|
135
|
-
return
|
|
135
|
+
return e.target === t.currentTarget || ((r = t.currentTarget) === null || r === void 0 || (n = r.contains) === null || n === void 0 ? void 0 : n.call(r, e.target));
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
138
|
+
function Xe(t) {
|
|
139
|
+
return t.type === "touchend" || t.type === "touchcancel" ? t.changedTouches : t.targetTouches;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
return W(
|
|
141
|
+
function Se(t) {
|
|
142
|
+
return W(t) ? Xe(t)[0] : t;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function qe(t) {
|
|
145
|
+
return He(t).map((e) => e.identifier);
|
|
146
146
|
}
|
|
147
|
-
function Z(
|
|
148
|
-
const
|
|
149
|
-
return W(
|
|
147
|
+
function Z(t) {
|
|
148
|
+
const e = Se(t);
|
|
149
|
+
return W(t) ? e.identifier : e.pointerId;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
return [
|
|
151
|
+
function pe(t) {
|
|
152
|
+
const e = Se(t);
|
|
153
|
+
return [e.clientX, e.clientY];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
157
|
-
if ("buttons" in
|
|
155
|
+
function Je(t) {
|
|
156
|
+
const e = {};
|
|
157
|
+
if ("buttons" in t && (e.buttons = t.buttons), "shiftKey" in t) {
|
|
158
158
|
const {
|
|
159
159
|
shiftKey: r,
|
|
160
160
|
altKey: n,
|
|
161
161
|
metaKey: s,
|
|
162
162
|
ctrlKey: o
|
|
163
|
-
} =
|
|
164
|
-
Object.assign(
|
|
163
|
+
} = t;
|
|
164
|
+
Object.assign(e, {
|
|
165
165
|
shiftKey: r,
|
|
166
166
|
altKey: n,
|
|
167
167
|
metaKey: s,
|
|
168
168
|
ctrlKey: o
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
return
|
|
171
|
+
return e;
|
|
172
172
|
}
|
|
173
|
-
function G(
|
|
174
|
-
return typeof
|
|
173
|
+
function G(t, ...e) {
|
|
174
|
+
return typeof t == "function" ? t(...e) : t;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Qe() {
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
180
|
-
let
|
|
181
|
-
for (const r of
|
|
182
|
-
|
|
183
|
-
return
|
|
178
|
+
function Ze(...t) {
|
|
179
|
+
return t.length === 0 ? Qe : t.length === 1 ? t[0] : function() {
|
|
180
|
+
let e;
|
|
181
|
+
for (const r of t)
|
|
182
|
+
e = r.apply(this, arguments) || e;
|
|
183
|
+
return e;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
return Object.assign({},
|
|
186
|
+
function me(t, e) {
|
|
187
|
+
return Object.assign({}, e, t || {});
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
class
|
|
191
|
-
constructor(
|
|
192
|
-
this.ctrl =
|
|
189
|
+
const et = 32;
|
|
190
|
+
class tt {
|
|
191
|
+
constructor(e, r, n) {
|
|
192
|
+
this.ctrl = e, this.args = r, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
|
|
193
193
|
}
|
|
194
194
|
get state() {
|
|
195
195
|
return this.ctrl.state[this.key];
|
|
196
196
|
}
|
|
197
|
-
set state(
|
|
198
|
-
this.ctrl.state[this.key] =
|
|
197
|
+
set state(e) {
|
|
198
|
+
this.ctrl.state[this.key] = e;
|
|
199
199
|
}
|
|
200
200
|
get shared() {
|
|
201
201
|
return this.ctrl.state.shared;
|
|
@@ -217,26 +217,26 @@ class ee {
|
|
|
217
217
|
}
|
|
218
218
|
reset() {
|
|
219
219
|
const {
|
|
220
|
-
state:
|
|
220
|
+
state: e,
|
|
221
221
|
shared: r,
|
|
222
222
|
ingKey: n,
|
|
223
223
|
args: s
|
|
224
224
|
} = this;
|
|
225
|
-
r[n] =
|
|
225
|
+
r[n] = e._active = e.active = e._blocked = e._force = !1, e._step = [!1, !1], e.intentional = !1, e._movement = [0, 0], e._distance = [0, 0], e._direction = [0, 0], e._delta = [0, 0], e._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], e.args = s, e.axis = void 0, e.memo = void 0, e.elapsedTime = e.timeDelta = 0, e.direction = [0, 0], e.distance = [0, 0], e.overflow = [0, 0], e._movementBound = [!1, !1], e.velocity = [0, 0], e.movement = [0, 0], e.delta = [0, 0], e.timeStamp = 0;
|
|
226
226
|
}
|
|
227
|
-
start(
|
|
227
|
+
start(e) {
|
|
228
228
|
const r = this.state, n = this.config;
|
|
229
|
-
r._active || (this.reset(), this.computeInitial(), r._active = !0, r.target =
|
|
229
|
+
r._active || (this.reset(), this.computeInitial(), r._active = !0, r.target = e.target, r.currentTarget = e.currentTarget, r.lastOffset = n.from ? G(n.from, r) : r.offset, r.offset = r.lastOffset, r.startTime = r.timeStamp = e.timeStamp);
|
|
230
230
|
}
|
|
231
|
-
computeValues(
|
|
231
|
+
computeValues(e) {
|
|
232
232
|
const r = this.state;
|
|
233
|
-
r._values =
|
|
233
|
+
r._values = e, r.values = this.config.transform(e);
|
|
234
234
|
}
|
|
235
235
|
computeInitial() {
|
|
236
|
-
const
|
|
237
|
-
|
|
236
|
+
const e = this.state;
|
|
237
|
+
e._initial = e._values, e.initial = e.values;
|
|
238
238
|
}
|
|
239
|
-
compute(
|
|
239
|
+
compute(e) {
|
|
240
240
|
const {
|
|
241
241
|
state: r,
|
|
242
242
|
config: n,
|
|
@@ -244,11 +244,11 @@ class ee {
|
|
|
244
244
|
} = this;
|
|
245
245
|
r.args = this.args;
|
|
246
246
|
let o = 0;
|
|
247
|
-
if (
|
|
247
|
+
if (e && (r.event = e, n.preventDefault && e.cancelable && r.event.preventDefault(), r.type = e.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, Je(e)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = e.timeStamp - r.timeStamp, r.timeStamp = e.timeStamp, r.elapsedTime = r.timeStamp - r.startTime), r._active) {
|
|
248
248
|
const O = r._delta.map(Math.abs);
|
|
249
249
|
w.addTo(r._distance, O);
|
|
250
250
|
}
|
|
251
|
-
this.axisIntent && this.axisIntent(
|
|
251
|
+
this.axisIntent && this.axisIntent(e);
|
|
252
252
|
const [a, c] = r._movement, [l, d] = n.threshold, {
|
|
253
253
|
_step: u,
|
|
254
254
|
values: v
|
|
@@ -262,38 +262,38 @@ class ee {
|
|
|
262
262
|
m[0] = u[0] !== !1 ? a - u[0] : 0, m[1] = u[1] !== !1 ? c - u[1] : 0;
|
|
263
263
|
this.restrictToAxis && !r._blocked && this.restrictToAxis(m);
|
|
264
264
|
const E = r.offset, k = r._active && !r._blocked || r.active;
|
|
265
|
-
k && (r.first = r._active && !r.active, r.last = !r._active && r.active, r.active = s[this.ingKey] = r._active,
|
|
266
|
-
const [P, y] = r.offset, [[$, N], [b,
|
|
267
|
-
r.overflow = [P < $ ? -1 : P > N ? 1 : 0, y < b ? -1 : y >
|
|
265
|
+
k && (r.first = r._active && !r.active, r.last = !r._active && r.active, r.active = s[this.ingKey] = r._active, e && (r.first && ("bounds" in n && (r._bounds = G(n.bounds, r)), this.setup && this.setup()), r.movement = m, this.computeOffset()));
|
|
266
|
+
const [P, y] = r.offset, [[$, N], [b, S]] = r._bounds;
|
|
267
|
+
r.overflow = [P < $ ? -1 : P > N ? 1 : 0, y < b ? -1 : y > S ? 1 : 0], r._movementBound[0] = r.overflow[0] ? r._movementBound[0] === !1 ? r._movement[0] : r._movementBound[0] : !1, r._movementBound[1] = r.overflow[1] ? r._movementBound[1] === !1 ? r._movement[1] : r._movementBound[1] : !1;
|
|
268
268
|
const L = r._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
-
if (r.offset =
|
|
269
|
+
if (r.offset = je(r._bounds, r.offset, L), r.delta = w.sub(r.offset, E), this.computeMovement(), k && (!r.last || o > et)) {
|
|
270
270
|
r.delta = w.sub(r.offset, E);
|
|
271
271
|
const O = r.delta.map(Math.abs);
|
|
272
272
|
w.addTo(r.distance, O), r.direction = r.delta.map(Math.sign), r._direction = r._delta.map(Math.sign), !r.first && o > 0 && (r.velocity = [O[0] / o, O[1] / o], r.timeDelta = o);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
emit() {
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
const s = this.handler(p(p(p({}, r),
|
|
279
|
-
[this.aliasKey]:
|
|
276
|
+
const e = this.state, r = this.shared, n = this.config;
|
|
277
|
+
if (e._active || this.clean(), (e._blocked || !e.intentional) && !e._force && !n.triggerAllEvents) return;
|
|
278
|
+
const s = this.handler(p(p(p({}, r), e), {}, {
|
|
279
|
+
[this.aliasKey]: e.values
|
|
280
280
|
}));
|
|
281
|
-
s !== void 0 && (
|
|
281
|
+
s !== void 0 && (e.memo = s);
|
|
282
282
|
}
|
|
283
283
|
clean() {
|
|
284
284
|
this.eventStore.clean(), this.timeoutStore.clean();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const n = Math.abs(
|
|
287
|
+
function rt([t, e], r) {
|
|
288
|
+
const n = Math.abs(t), s = Math.abs(e);
|
|
289
289
|
if (n > s && n > r)
|
|
290
290
|
return "x";
|
|
291
291
|
if (s > n && s > r)
|
|
292
292
|
return "y";
|
|
293
293
|
}
|
|
294
|
-
class
|
|
295
|
-
constructor(...
|
|
296
|
-
super(...
|
|
294
|
+
class nt extends tt {
|
|
295
|
+
constructor(...e) {
|
|
296
|
+
super(...e), x(this, "aliasKey", "xy");
|
|
297
297
|
}
|
|
298
298
|
reset() {
|
|
299
299
|
super.reset(), this.state.axis = void 0;
|
|
@@ -307,139 +307,139 @@ class ne extends ee {
|
|
|
307
307
|
computeMovement() {
|
|
308
308
|
this.state.movement = w.sub(this.state.offset, this.state.lastOffset);
|
|
309
309
|
}
|
|
310
|
-
axisIntent(
|
|
310
|
+
axisIntent(e) {
|
|
311
311
|
const r = this.state, n = this.config;
|
|
312
|
-
if (!r.axis &&
|
|
313
|
-
const s = typeof n.axisThreshold == "object" ? n.axisThreshold[
|
|
314
|
-
r.axis =
|
|
312
|
+
if (!r.axis && e) {
|
|
313
|
+
const s = typeof n.axisThreshold == "object" ? n.axisThreshold[xe(e)] : n.axisThreshold;
|
|
314
|
+
r.axis = rt(r._movement, s);
|
|
315
315
|
}
|
|
316
316
|
r._blocked = (n.lockDirection || !!n.axis) && !r.axis || !!n.axis && n.axis !== r.axis;
|
|
317
317
|
}
|
|
318
|
-
restrictToAxis(
|
|
318
|
+
restrictToAxis(e) {
|
|
319
319
|
if (this.config.axis || this.config.lockDirection)
|
|
320
320
|
switch (this.state.axis) {
|
|
321
321
|
case "x":
|
|
322
|
-
|
|
322
|
+
e[1] = 0;
|
|
323
323
|
break;
|
|
324
324
|
case "y":
|
|
325
|
-
|
|
325
|
+
e[0] = 0;
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
331
|
-
enabled(
|
|
332
|
-
return
|
|
330
|
+
const ge = (t) => t, ve = 0.15, ne = {
|
|
331
|
+
enabled(t = !0) {
|
|
332
|
+
return t;
|
|
333
333
|
},
|
|
334
|
-
eventOptions(
|
|
335
|
-
return p(p({}, r.shared.eventOptions),
|
|
334
|
+
eventOptions(t, e, r) {
|
|
335
|
+
return p(p({}, r.shared.eventOptions), t);
|
|
336
336
|
},
|
|
337
|
-
preventDefault(
|
|
338
|
-
return
|
|
337
|
+
preventDefault(t = !1) {
|
|
338
|
+
return t;
|
|
339
339
|
},
|
|
340
|
-
triggerAllEvents(
|
|
341
|
-
return
|
|
340
|
+
triggerAllEvents(t = !1) {
|
|
341
|
+
return t;
|
|
342
342
|
},
|
|
343
|
-
rubberband(
|
|
344
|
-
switch (
|
|
343
|
+
rubberband(t = 0) {
|
|
344
|
+
switch (t) {
|
|
345
345
|
case !0:
|
|
346
|
-
return [
|
|
346
|
+
return [ve, ve];
|
|
347
347
|
case !1:
|
|
348
348
|
return [0, 0];
|
|
349
349
|
default:
|
|
350
|
-
return w.toVector(
|
|
350
|
+
return w.toVector(t);
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
|
-
from(
|
|
354
|
-
if (typeof
|
|
355
|
-
if (
|
|
353
|
+
from(t) {
|
|
354
|
+
if (typeof t == "function") return t;
|
|
355
|
+
if (t != null) return w.toVector(t);
|
|
356
356
|
},
|
|
357
|
-
transform(
|
|
358
|
-
const n =
|
|
357
|
+
transform(t, e, r) {
|
|
358
|
+
const n = t || r.shared.transform;
|
|
359
359
|
if (this.hasCustomTransform = !!n, process.env.NODE_ENV === "development") {
|
|
360
|
-
const s = n ||
|
|
360
|
+
const s = n || ge;
|
|
361
361
|
return (o) => {
|
|
362
362
|
const a = s(o);
|
|
363
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 || ge;
|
|
367
367
|
},
|
|
368
|
-
threshold(
|
|
369
|
-
return w.toVector(
|
|
368
|
+
threshold(t) {
|
|
369
|
+
return w.toVector(t, 0);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
373
|
-
domTarget(
|
|
374
|
-
if (
|
|
372
|
+
process.env.NODE_ENV === "development" && Object.assign(ne, {
|
|
373
|
+
domTarget(t) {
|
|
374
|
+
if (t !== void 0)
|
|
375
375
|
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
376
376
|
return NaN;
|
|
377
377
|
},
|
|
378
|
-
lockDirection(
|
|
379
|
-
if (
|
|
378
|
+
lockDirection(t) {
|
|
379
|
+
if (t !== void 0)
|
|
380
380
|
throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
|
|
381
381
|
return NaN;
|
|
382
382
|
},
|
|
383
|
-
initial(
|
|
384
|
-
if (
|
|
383
|
+
initial(t) {
|
|
384
|
+
if (t !== void 0)
|
|
385
385
|
throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
|
|
386
386
|
return NaN;
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
const
|
|
390
|
-
axis(
|
|
389
|
+
const st = 0, j = p(p({}, ne), {}, {
|
|
390
|
+
axis(t, e, {
|
|
391
391
|
axis: r
|
|
392
392
|
}) {
|
|
393
393
|
if (this.lockDirection = r === "lock", !this.lockDirection) return r;
|
|
394
394
|
},
|
|
395
|
-
axisThreshold(
|
|
396
|
-
return
|
|
395
|
+
axisThreshold(t = st) {
|
|
396
|
+
return t;
|
|
397
397
|
},
|
|
398
|
-
bounds(
|
|
399
|
-
if (typeof
|
|
400
|
-
return (o) => j.bounds(
|
|
401
|
-
if ("current" in
|
|
402
|
-
return () =>
|
|
403
|
-
if (typeof HTMLElement == "function" &&
|
|
404
|
-
return
|
|
398
|
+
bounds(t = {}) {
|
|
399
|
+
if (typeof t == "function")
|
|
400
|
+
return (o) => j.bounds(t(o));
|
|
401
|
+
if ("current" in t)
|
|
402
|
+
return () => t.current;
|
|
403
|
+
if (typeof HTMLElement == "function" && t instanceof HTMLElement)
|
|
404
|
+
return t;
|
|
405
405
|
const {
|
|
406
|
-
left:
|
|
406
|
+
left: e = -1 / 0,
|
|
407
407
|
right: r = 1 / 0,
|
|
408
408
|
top: n = -1 / 0,
|
|
409
409
|
bottom: s = 1 / 0
|
|
410
|
-
} =
|
|
411
|
-
return [[
|
|
412
|
-
}
|
|
413
|
-
}),
|
|
414
|
-
ArrowRight: (
|
|
415
|
-
ArrowLeft: (
|
|
416
|
-
ArrowUp: (
|
|
417
|
-
ArrowDown: (
|
|
410
|
+
} = t;
|
|
411
|
+
return [[e, r], [n, s]];
|
|
412
|
+
}
|
|
413
|
+
}), ye = {
|
|
414
|
+
ArrowRight: (t, e = 1) => [t * e, 0],
|
|
415
|
+
ArrowLeft: (t, e = 1) => [-1 * t * e, 0],
|
|
416
|
+
ArrowUp: (t, e = 1) => [0, -1 * t * e],
|
|
417
|
+
ArrowDown: (t, e = 1) => [0, t * e]
|
|
418
418
|
};
|
|
419
|
-
class
|
|
420
|
-
constructor(...
|
|
421
|
-
super(...
|
|
419
|
+
class it extends nt {
|
|
420
|
+
constructor(...e) {
|
|
421
|
+
super(...e), x(this, "ingKey", "dragging");
|
|
422
422
|
}
|
|
423
423
|
reset() {
|
|
424
424
|
super.reset();
|
|
425
|
-
const
|
|
426
|
-
|
|
425
|
+
const e = this.state;
|
|
426
|
+
e._pointerId = void 0, e._pointerActive = !1, e._keyboardActive = !1, e._preventScroll = !1, e._delayed = !1, e.swipe = [0, 0], e.tap = !1, e.canceled = !1, e.cancel = this.cancel.bind(this);
|
|
427
427
|
}
|
|
428
428
|
setup() {
|
|
429
|
-
const
|
|
430
|
-
if (
|
|
431
|
-
const r =
|
|
432
|
-
left: r.left - n.left +
|
|
433
|
-
right: r.right - n.right +
|
|
434
|
-
top: r.top - n.top +
|
|
435
|
-
bottom: r.bottom - n.bottom +
|
|
429
|
+
const e = this.state;
|
|
430
|
+
if (e._bounds instanceof HTMLElement) {
|
|
431
|
+
const r = e._bounds.getBoundingClientRect(), n = e.currentTarget.getBoundingClientRect(), s = {
|
|
432
|
+
left: r.left - n.left + e.offset[0],
|
|
433
|
+
right: r.right - n.right + e.offset[0],
|
|
434
|
+
top: r.top - n.top + e.offset[1],
|
|
435
|
+
bottom: r.bottom - n.bottom + e.offset[1]
|
|
436
436
|
};
|
|
437
|
-
|
|
437
|
+
e._bounds = j.bounds(s);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
cancel() {
|
|
441
|
-
const
|
|
442
|
-
|
|
441
|
+
const e = this.state;
|
|
442
|
+
e.canceled || (e.canceled = !0, e._active = !1, setTimeout(() => {
|
|
443
443
|
this.compute(), this.emit();
|
|
444
444
|
}, 0));
|
|
445
445
|
}
|
|
@@ -449,24 +449,24 @@ class ie extends ne {
|
|
|
449
449
|
clean() {
|
|
450
450
|
this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean();
|
|
451
451
|
}
|
|
452
|
-
pointerDown(
|
|
452
|
+
pointerDown(e) {
|
|
453
453
|
const r = this.config, n = this.state;
|
|
454
|
-
if (
|
|
455
|
-
const s = this.ctrl.setEventIds(
|
|
456
|
-
r.pointerCapture &&
|
|
454
|
+
if (e.buttons != null && (Array.isArray(r.pointerButtons) ? !r.pointerButtons.includes(e.buttons) : r.pointerButtons !== -1 && r.pointerButtons !== e.buttons)) return;
|
|
455
|
+
const s = this.ctrl.setEventIds(e);
|
|
456
|
+
r.pointerCapture && e.target.setPointerCapture(e.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(e), this.setupPointer(e), n._pointerId = Z(e), n._pointerActive = !0, this.computeValues(pe(e)), this.computeInitial(), r.preventScrollAxis && xe(e) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(e)) : r.delay > 0 ? (this.setupDelayTrigger(e), r.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e));
|
|
457
457
|
}
|
|
458
|
-
startPointerDrag(
|
|
458
|
+
startPointerDrag(e) {
|
|
459
459
|
const r = this.state;
|
|
460
|
-
r._active = !0, r._preventScroll = !0, r._delayed = !1, this.compute(
|
|
460
|
+
r._active = !0, r._preventScroll = !0, r._delayed = !1, this.compute(e), this.emit();
|
|
461
461
|
}
|
|
462
|
-
pointerMove(
|
|
462
|
+
pointerMove(e) {
|
|
463
463
|
const r = this.state, n = this.config;
|
|
464
464
|
if (!r._pointerActive) return;
|
|
465
|
-
const s = Z(
|
|
465
|
+
const s = Z(e);
|
|
466
466
|
if (r._pointerId !== void 0 && s !== r._pointerId) return;
|
|
467
|
-
const o =
|
|
468
|
-
if (document.pointerLockElement ===
|
|
469
|
-
this.timeoutStore.remove("dragDelay"), r.active = !1, this.startPointerDrag(
|
|
467
|
+
const o = pe(e);
|
|
468
|
+
if (document.pointerLockElement === e.target ? r._delta = [e.movementX, e.movementY] : (r._delta = w.sub(o, r._values), this.computeValues(o)), w.addTo(r._movement, r._delta), this.compute(e), r._delayed && r.intentional) {
|
|
469
|
+
this.timeoutStore.remove("dragDelay"), r.active = !1, this.startPointerDrag(e);
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
472
472
|
if (n.preventScrollAxis && !r._preventScroll)
|
|
@@ -475,25 +475,25 @@ class ie extends ne {
|
|
|
475
475
|
r._active = !1, this.clean();
|
|
476
476
|
return;
|
|
477
477
|
} else {
|
|
478
|
-
this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(
|
|
478
|
+
this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(e);
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
481
|
else
|
|
482
482
|
return;
|
|
483
483
|
this.emit();
|
|
484
484
|
}
|
|
485
|
-
pointerUp(
|
|
486
|
-
this.ctrl.setEventIds(
|
|
485
|
+
pointerUp(e) {
|
|
486
|
+
this.ctrl.setEventIds(e);
|
|
487
487
|
try {
|
|
488
|
-
this.config.pointerCapture &&
|
|
488
|
+
this.config.pointerCapture && e.target.hasPointerCapture(e.pointerId) && e.target.releasePointerCapture(e.pointerId);
|
|
489
489
|
} catch {
|
|
490
490
|
process.env.NODE_ENV === "development" && console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.");
|
|
491
491
|
}
|
|
492
492
|
const r = this.state, n = this.config;
|
|
493
493
|
if (!r._active || !r._pointerActive) return;
|
|
494
|
-
const s = Z(
|
|
494
|
+
const s = Z(e);
|
|
495
495
|
if (r._pointerId !== void 0 && s !== r._pointerId) return;
|
|
496
|
-
this.state._pointerActive = !1, this.setActive(), this.compute(
|
|
496
|
+
this.state._pointerActive = !1, this.setActive(), this.compute(e);
|
|
497
497
|
const [o, a] = r._distance;
|
|
498
498
|
if (r.tap = o <= n.tapsThreshold && a <= n.tapsThreshold, r.tap && n.filterTaps)
|
|
499
499
|
r._force = !0;
|
|
@@ -506,74 +506,74 @@ class ie extends ne {
|
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
508
508
|
}
|
|
509
|
-
pointerClick(
|
|
510
|
-
!this.state.tap &&
|
|
509
|
+
pointerClick(e) {
|
|
510
|
+
!this.state.tap && e.detail > 0 && (e.preventDefault(), e.stopPropagation());
|
|
511
511
|
}
|
|
512
|
-
setupPointer(
|
|
512
|
+
setupPointer(e) {
|
|
513
513
|
const r = this.config, n = r.device;
|
|
514
514
|
if (process.env.NODE_ENV === "development")
|
|
515
515
|
try {
|
|
516
516
|
if (n === "pointer" && r.preventScrollDelay === void 0) {
|
|
517
|
-
const s = "uv" in
|
|
517
|
+
const s = "uv" in e ? e.sourceEvent.currentTarget : e.currentTarget;
|
|
518
518
|
window.getComputedStyle(s).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.", s);
|
|
519
519
|
}
|
|
520
520
|
} catch {
|
|
521
521
|
}
|
|
522
|
-
r.pointerLock &&
|
|
522
|
+
r.pointerLock && e.currentTarget.requestPointerLock(), r.pointerCapture || (this.eventStore.add(this.sharedConfig.window, n, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "cancel", this.pointerUp.bind(this)));
|
|
523
523
|
}
|
|
524
524
|
pointerClean() {
|
|
525
525
|
this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock();
|
|
526
526
|
}
|
|
527
|
-
preventScroll(
|
|
528
|
-
this.state._preventScroll &&
|
|
527
|
+
preventScroll(e) {
|
|
528
|
+
this.state._preventScroll && e.cancelable && e.preventDefault();
|
|
529
529
|
}
|
|
530
|
-
setupScrollPrevention(
|
|
531
|
-
this.state._preventScroll = !1,
|
|
530
|
+
setupScrollPrevention(e) {
|
|
531
|
+
this.state._preventScroll = !1, ot(e);
|
|
532
532
|
const r = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
533
533
|
passive: !1
|
|
534
534
|
});
|
|
535
|
-
this.eventStore.add(this.sharedConfig.window, "touch", "end", r), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", r), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay,
|
|
535
|
+
this.eventStore.add(this.sharedConfig.window, "touch", "end", r), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", r), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, e);
|
|
536
536
|
}
|
|
537
|
-
setupDelayTrigger(
|
|
537
|
+
setupDelayTrigger(e) {
|
|
538
538
|
this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
|
|
539
|
-
this.state._step = [0, 0], this.startPointerDrag(
|
|
539
|
+
this.state._step = [0, 0], this.startPointerDrag(e);
|
|
540
540
|
}, this.config.delay);
|
|
541
541
|
}
|
|
542
|
-
keyDown(
|
|
543
|
-
const r =
|
|
542
|
+
keyDown(e) {
|
|
543
|
+
const r = ye[e.key];
|
|
544
544
|
if (r) {
|
|
545
|
-
const n = this.state, s =
|
|
546
|
-
this.start(
|
|
545
|
+
const n = this.state, s = e.shiftKey ? 10 : e.altKey ? 0.1 : 1;
|
|
546
|
+
this.start(e), n._delta = r(this.config.keyboardDisplacement, s), n._keyboardActive = !0, w.addTo(n._movement, n._delta), this.compute(e), this.emit();
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
keyUp(
|
|
550
|
-
|
|
549
|
+
keyUp(e) {
|
|
550
|
+
e.key in ye && (this.state._keyboardActive = !1, this.setActive(), this.compute(e), this.emit());
|
|
551
551
|
}
|
|
552
|
-
bind(
|
|
552
|
+
bind(e) {
|
|
553
553
|
const r = this.config.device;
|
|
554
|
-
|
|
554
|
+
e(r, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (e(r, "change", this.pointerMove.bind(this)), e(r, "end", this.pointerUp.bind(this)), e(r, "cancel", this.pointerUp.bind(this)), e("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (e("key", "down", this.keyDown.bind(this)), e("key", "up", this.keyUp.bind(this))), this.config.filterTaps && e("click", "", this.pointerClick.bind(this), {
|
|
555
555
|
capture: !0,
|
|
556
556
|
passive: !1
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
"persist" in
|
|
560
|
+
function ot(t) {
|
|
561
|
+
"persist" in t && typeof t.persist == "function" && t.persist();
|
|
562
562
|
}
|
|
563
563
|
const B = typeof window < "u" && window.document && window.document.createElement;
|
|
564
|
-
function
|
|
564
|
+
function Ie() {
|
|
565
565
|
return B && "ontouchstart" in window;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
567
|
+
function at() {
|
|
568
|
+
return Ie() || B && window.navigator.maxTouchPoints > 1;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function ct() {
|
|
571
571
|
return B && "onpointerdown" in window;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function ut() {
|
|
574
574
|
return B && "exitPointerLock" in window.document;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function lt() {
|
|
577
577
|
try {
|
|
578
578
|
return "constructor" in GestureEvent;
|
|
579
579
|
} catch {
|
|
@@ -582,17 +582,17 @@ function le() {
|
|
|
582
582
|
}
|
|
583
583
|
const D = {
|
|
584
584
|
isBrowser: B,
|
|
585
|
-
gesture:
|
|
586
|
-
touch:
|
|
587
|
-
touchscreen:
|
|
588
|
-
pointer:
|
|
589
|
-
pointerLock:
|
|
590
|
-
},
|
|
585
|
+
gesture: lt(),
|
|
586
|
+
touch: Ie(),
|
|
587
|
+
touchscreen: at(),
|
|
588
|
+
pointer: ct(),
|
|
589
|
+
pointerLock: ut()
|
|
590
|
+
}, ft = 250, dt = 180, ht = 0.5, pt = 50, mt = 250, gt = 10, be = {
|
|
591
591
|
mouse: 0,
|
|
592
592
|
touch: 0,
|
|
593
593
|
pen: 8
|
|
594
|
-
},
|
|
595
|
-
device(
|
|
594
|
+
}, ke = p(p({}, j), {}, {
|
|
595
|
+
device(t, e, {
|
|
596
596
|
pointer: {
|
|
597
597
|
touch: r = !1,
|
|
598
598
|
lock: n = !1,
|
|
@@ -601,13 +601,13 @@ const D = {
|
|
|
601
601
|
}) {
|
|
602
602
|
return this.pointerLock = n && D.pointerLock, D.touch && r ? "touch" : this.pointerLock ? "mouse" : D.pointer && !s ? "pointer" : D.touch ? "touch" : "mouse";
|
|
603
603
|
},
|
|
604
|
-
preventScrollAxis(
|
|
604
|
+
preventScrollAxis(t, e, {
|
|
605
605
|
preventScroll: r
|
|
606
606
|
}) {
|
|
607
|
-
if (this.preventScrollDelay = typeof r == "number" ? r : r || r === void 0 &&
|
|
608
|
-
return
|
|
607
|
+
if (this.preventScrollDelay = typeof r == "number" ? r : r || r === void 0 && t ? ft : void 0, !(!D.touchscreen || r === !1))
|
|
608
|
+
return t || (r !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
|
-
pointerCapture(
|
|
610
|
+
pointerCapture(t, e, {
|
|
611
611
|
pointer: {
|
|
612
612
|
capture: r = !0,
|
|
613
613
|
buttons: n = 1,
|
|
@@ -616,71 +616,71 @@ const D = {
|
|
|
616
616
|
}) {
|
|
617
617
|
return this.pointerButtons = n, this.keys = s, !this.pointerLock && this.device === "pointer" && r;
|
|
618
618
|
},
|
|
619
|
-
threshold(
|
|
619
|
+
threshold(t, e, {
|
|
620
620
|
filterTaps: r = !1,
|
|
621
621
|
tapsThreshold: n = 3,
|
|
622
622
|
axis: s = void 0
|
|
623
623
|
}) {
|
|
624
|
-
const o = w.toVector(
|
|
624
|
+
const o = w.toVector(t, r ? n : s ? 1 : 0);
|
|
625
625
|
return this.filterTaps = r, this.tapsThreshold = n, o;
|
|
626
626
|
},
|
|
627
627
|
swipe({
|
|
628
|
-
velocity:
|
|
629
|
-
distance:
|
|
630
|
-
duration: r =
|
|
628
|
+
velocity: t = ht,
|
|
629
|
+
distance: e = pt,
|
|
630
|
+
duration: r = mt
|
|
631
631
|
} = {}) {
|
|
632
632
|
return {
|
|
633
|
-
velocity: this.transform(w.toVector(
|
|
634
|
-
distance: this.transform(w.toVector(
|
|
633
|
+
velocity: this.transform(w.toVector(t)),
|
|
634
|
+
distance: this.transform(w.toVector(e)),
|
|
635
635
|
duration: r
|
|
636
636
|
};
|
|
637
637
|
},
|
|
638
|
-
delay(
|
|
639
|
-
switch (
|
|
638
|
+
delay(t = 0) {
|
|
639
|
+
switch (t) {
|
|
640
640
|
case !0:
|
|
641
|
-
return
|
|
641
|
+
return dt;
|
|
642
642
|
case !1:
|
|
643
643
|
return 0;
|
|
644
644
|
default:
|
|
645
|
-
return
|
|
645
|
+
return t;
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
|
-
axisThreshold(
|
|
649
|
-
return
|
|
648
|
+
axisThreshold(t) {
|
|
649
|
+
return t ? p(p({}, be), t) : be;
|
|
650
650
|
},
|
|
651
|
-
keyboardDisplacement(
|
|
652
|
-
return
|
|
651
|
+
keyboardDisplacement(t = gt) {
|
|
652
|
+
return t;
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
|
-
process.env.NODE_ENV === "development" && Object.assign(
|
|
656
|
-
useTouch(
|
|
657
|
-
if (
|
|
655
|
+
process.env.NODE_ENV === "development" && Object.assign(ke, {
|
|
656
|
+
useTouch(t) {
|
|
657
|
+
if (t !== void 0)
|
|
658
658
|
throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
|
|
659
659
|
return NaN;
|
|
660
660
|
},
|
|
661
|
-
experimental_preventWindowScrollY(
|
|
662
|
-
if (
|
|
661
|
+
experimental_preventWindowScrollY(t) {
|
|
662
|
+
if (t !== void 0)
|
|
663
663
|
throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");
|
|
664
664
|
return NaN;
|
|
665
665
|
},
|
|
666
|
-
swipeVelocity(
|
|
667
|
-
if (
|
|
666
|
+
swipeVelocity(t) {
|
|
667
|
+
if (t !== void 0)
|
|
668
668
|
throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");
|
|
669
669
|
return NaN;
|
|
670
670
|
},
|
|
671
|
-
swipeDistance(
|
|
672
|
-
if (
|
|
671
|
+
swipeDistance(t) {
|
|
672
|
+
if (t !== void 0)
|
|
673
673
|
throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");
|
|
674
674
|
return NaN;
|
|
675
675
|
},
|
|
676
|
-
swipeDuration(
|
|
677
|
-
if (
|
|
676
|
+
swipeDuration(t) {
|
|
677
|
+
if (t !== void 0)
|
|
678
678
|
throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");
|
|
679
679
|
return NaN;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
|
-
p(p({},
|
|
683
|
-
device(
|
|
682
|
+
p(p({}, ne), {}, {
|
|
683
|
+
device(t, e, {
|
|
684
684
|
shared: r,
|
|
685
685
|
pointer: {
|
|
686
686
|
touch: n = !1
|
|
@@ -693,18 +693,18 @@ p(p({}, nt), {}, {
|
|
|
693
693
|
if (D.touch) return "touch";
|
|
694
694
|
}
|
|
695
695
|
},
|
|
696
|
-
bounds(
|
|
696
|
+
bounds(t, e, {
|
|
697
697
|
scaleBounds: r = {},
|
|
698
698
|
angleBounds: n = {}
|
|
699
699
|
}) {
|
|
700
700
|
const s = (a) => {
|
|
701
|
-
const c =
|
|
701
|
+
const c = me(G(r, a), {
|
|
702
702
|
min: -1 / 0,
|
|
703
703
|
max: 1 / 0
|
|
704
704
|
});
|
|
705
705
|
return [c.min, c.max];
|
|
706
706
|
}, o = (a) => {
|
|
707
|
-
const c =
|
|
707
|
+
const c = me(G(n, a), {
|
|
708
708
|
min: -1 / 0,
|
|
709
709
|
max: 1 / 0
|
|
710
710
|
});
|
|
@@ -712,114 +712,114 @@ p(p({}, nt), {}, {
|
|
|
712
712
|
};
|
|
713
713
|
return typeof r != "function" && typeof n != "function" ? [s(), o()] : (a) => [s(a), o(a)];
|
|
714
714
|
},
|
|
715
|
-
threshold(
|
|
716
|
-
return this.lockDirection = r.axis === "lock", w.toVector(
|
|
715
|
+
threshold(t, e, r) {
|
|
716
|
+
return this.lockDirection = r.axis === "lock", w.toVector(t, this.lockDirection ? [0.1, 3] : 0);
|
|
717
717
|
},
|
|
718
|
-
modifierKey(
|
|
719
|
-
return
|
|
718
|
+
modifierKey(t) {
|
|
719
|
+
return t === void 0 ? "ctrlKey" : t;
|
|
720
720
|
},
|
|
721
|
-
pinchOnWheel(
|
|
722
|
-
return
|
|
721
|
+
pinchOnWheel(t = !0) {
|
|
722
|
+
return t;
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
725
|
p(p({}, j), {}, {
|
|
726
|
-
mouseOnly: (
|
|
726
|
+
mouseOnly: (t = !0) => t
|
|
727
727
|
});
|
|
728
728
|
p(p({}, j), {}, {
|
|
729
|
-
mouseOnly: (
|
|
729
|
+
mouseOnly: (t = !0) => t
|
|
730
730
|
});
|
|
731
|
-
const
|
|
732
|
-
function
|
|
733
|
-
|
|
731
|
+
const Ce = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map();
|
|
732
|
+
function vt(t) {
|
|
733
|
+
Ce.set(t.key, t.engine), re.set(t.key, t.resolver);
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const yt = {
|
|
736
736
|
key: "drag",
|
|
737
|
-
engine:
|
|
738
|
-
resolver:
|
|
737
|
+
engine: it,
|
|
738
|
+
resolver: ke
|
|
739
739
|
};
|
|
740
|
-
function
|
|
741
|
-
if (
|
|
742
|
-
var r = {}, n = Object.keys(
|
|
740
|
+
function bt(t, e) {
|
|
741
|
+
if (t == null) return {};
|
|
742
|
+
var r = {}, n = Object.keys(t), s, o;
|
|
743
743
|
for (o = 0; o < n.length; o++)
|
|
744
|
-
s = n[o], !(
|
|
744
|
+
s = n[o], !(e.indexOf(s) >= 0) && (r[s] = t[s]);
|
|
745
745
|
return r;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
if (
|
|
749
|
-
var r =
|
|
747
|
+
function _t(t, e) {
|
|
748
|
+
if (t == null) return {};
|
|
749
|
+
var r = bt(t, e), n, s;
|
|
750
750
|
if (Object.getOwnPropertySymbols) {
|
|
751
|
-
var o = Object.getOwnPropertySymbols(
|
|
751
|
+
var o = Object.getOwnPropertySymbols(t);
|
|
752
752
|
for (s = 0; s < o.length; s++)
|
|
753
|
-
n = o[s], !(
|
|
753
|
+
n = o[s], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
|
|
754
754
|
}
|
|
755
755
|
return r;
|
|
756
756
|
}
|
|
757
|
-
const
|
|
758
|
-
target(
|
|
759
|
-
if (
|
|
760
|
-
return () => "current" in
|
|
757
|
+
const wt = {
|
|
758
|
+
target(t) {
|
|
759
|
+
if (t)
|
|
760
|
+
return () => "current" in t ? t.current : t;
|
|
761
761
|
},
|
|
762
|
-
enabled(
|
|
763
|
-
return
|
|
762
|
+
enabled(t = !0) {
|
|
763
|
+
return t;
|
|
764
764
|
},
|
|
765
|
-
window(
|
|
766
|
-
return
|
|
765
|
+
window(t = D.isBrowser ? window : void 0) {
|
|
766
|
+
return t;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
769
|
-
passive:
|
|
770
|
-
capture:
|
|
769
|
+
passive: t = !0,
|
|
770
|
+
capture: e = !1
|
|
771
771
|
} = {}) {
|
|
772
772
|
return {
|
|
773
|
-
passive:
|
|
774
|
-
capture:
|
|
773
|
+
passive: t,
|
|
774
|
+
capture: e
|
|
775
775
|
};
|
|
776
776
|
},
|
|
777
|
-
transform(
|
|
778
|
-
return
|
|
777
|
+
transform(t) {
|
|
778
|
+
return t;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
781
|
-
function z(
|
|
780
|
+
}, Et = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
|
+
function z(t = {}, e) {
|
|
782
782
|
const r = {};
|
|
783
|
-
for (const [n, s] of Object.entries(
|
|
783
|
+
for (const [n, s] of Object.entries(e))
|
|
784
784
|
switch (typeof s) {
|
|
785
785
|
case "function":
|
|
786
786
|
if (process.env.NODE_ENV === "development") {
|
|
787
|
-
const o = s.call(r,
|
|
787
|
+
const o = s.call(r, t[n], n, t);
|
|
788
788
|
Number.isNaN(o) || (r[n] = o);
|
|
789
789
|
} else
|
|
790
|
-
r[n] = s.call(r,
|
|
790
|
+
r[n] = s.call(r, t[n], n, t);
|
|
791
791
|
break;
|
|
792
792
|
case "object":
|
|
793
|
-
r[n] = z(
|
|
793
|
+
r[n] = z(t[n], s);
|
|
794
794
|
break;
|
|
795
795
|
case "boolean":
|
|
796
|
-
s && (r[n] =
|
|
796
|
+
s && (r[n] = t[n]);
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
799
|
return r;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
802
|
-
const n =
|
|
801
|
+
function Tt(t, e, r = {}) {
|
|
802
|
+
const n = t, {
|
|
803
803
|
target: s,
|
|
804
804
|
eventOptions: o,
|
|
805
805
|
window: a,
|
|
806
806
|
enabled: c,
|
|
807
807
|
transform: l
|
|
808
|
-
} = n, d =
|
|
808
|
+
} = n, d = _t(n, Et);
|
|
809
809
|
if (r.shared = z({
|
|
810
810
|
target: s,
|
|
811
811
|
eventOptions: o,
|
|
812
812
|
window: a,
|
|
813
813
|
enabled: c,
|
|
814
814
|
transform: l
|
|
815
|
-
},
|
|
816
|
-
const u =
|
|
817
|
-
r[
|
|
815
|
+
}, wt), e) {
|
|
816
|
+
const u = re.get(e);
|
|
817
|
+
r[e] = z(p({
|
|
818
818
|
shared: r.shared
|
|
819
819
|
}, d), u);
|
|
820
820
|
} else
|
|
821
821
|
for (const u in d) {
|
|
822
|
-
const v =
|
|
822
|
+
const v = re.get(u);
|
|
823
823
|
if (v)
|
|
824
824
|
r[u] = z(p({
|
|
825
825
|
shared: r.shared
|
|
@@ -832,96 +832,96 @@ function Te(e, t, r = {}) {
|
|
|
832
832
|
}
|
|
833
833
|
return r;
|
|
834
834
|
}
|
|
835
|
-
class
|
|
836
|
-
constructor(
|
|
837
|
-
|
|
835
|
+
class De {
|
|
836
|
+
constructor(e, r) {
|
|
837
|
+
x(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = e, this._gestureKey = r;
|
|
838
838
|
}
|
|
839
|
-
add(
|
|
840
|
-
const a = this._listeners, c =
|
|
841
|
-
|
|
839
|
+
add(e, r, n, s, o) {
|
|
840
|
+
const a = this._listeners, c = Fe(r, n), l = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = p(p({}, l), o);
|
|
841
|
+
e.addEventListener(c, s, d);
|
|
842
842
|
const u = () => {
|
|
843
|
-
|
|
843
|
+
e.removeEventListener(c, s, d), a.delete(u);
|
|
844
844
|
};
|
|
845
845
|
return a.add(u), u;
|
|
846
846
|
}
|
|
847
847
|
clean() {
|
|
848
|
-
this._listeners.forEach((
|
|
848
|
+
this._listeners.forEach((e) => e()), this._listeners.clear();
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class xt {
|
|
852
852
|
constructor() {
|
|
853
|
-
|
|
853
|
+
x(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
854
854
|
}
|
|
855
|
-
add(
|
|
856
|
-
this.remove(
|
|
855
|
+
add(e, r, n = 140, ...s) {
|
|
856
|
+
this.remove(e), this._timeouts.set(e, window.setTimeout(r, n, ...s));
|
|
857
857
|
}
|
|
858
|
-
remove(
|
|
859
|
-
const r = this._timeouts.get(
|
|
858
|
+
remove(e) {
|
|
859
|
+
const r = this._timeouts.get(e);
|
|
860
860
|
r && window.clearTimeout(r);
|
|
861
861
|
}
|
|
862
862
|
clean() {
|
|
863
|
-
this._timeouts.forEach((
|
|
863
|
+
this._timeouts.forEach((e) => void window.clearTimeout(e)), this._timeouts.clear();
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
867
|
-
constructor(
|
|
868
|
-
|
|
866
|
+
class St {
|
|
867
|
+
constructor(e) {
|
|
868
|
+
x(this, "gestures", /* @__PURE__ */ new Set()), x(this, "_targetEventStore", new De(this)), x(this, "gestureEventStores", {}), x(this, "gestureTimeoutStores", {}), x(this, "handlers", {}), x(this, "config", {}), x(this, "pointerIds", /* @__PURE__ */ new Set()), x(this, "touchIds", /* @__PURE__ */ new Set()), x(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
|
+
}), It(this, e);
|
|
876
876
|
}
|
|
877
|
-
setEventIds(
|
|
878
|
-
if (W(
|
|
879
|
-
return this.touchIds = new Set(
|
|
880
|
-
if ("pointerId" in
|
|
881
|
-
return
|
|
877
|
+
setEventIds(e) {
|
|
878
|
+
if (W(e))
|
|
879
|
+
return this.touchIds = new Set(qe(e)), this.touchIds;
|
|
880
|
+
if ("pointerId" in e)
|
|
881
|
+
return e.type === "pointerup" || e.type === "pointercancel" ? this.pointerIds.delete(e.pointerId) : e.type === "pointerdown" && this.pointerIds.add(e.pointerId), this.pointerIds;
|
|
882
882
|
}
|
|
883
|
-
applyHandlers(
|
|
884
|
-
this.handlers =
|
|
883
|
+
applyHandlers(e, r) {
|
|
884
|
+
this.handlers = e, this.nativeHandlers = r;
|
|
885
885
|
}
|
|
886
|
-
applyConfig(
|
|
887
|
-
this.config =
|
|
886
|
+
applyConfig(e, r) {
|
|
887
|
+
this.config = Tt(e, r, this.config);
|
|
888
888
|
}
|
|
889
889
|
clean() {
|
|
890
890
|
this._targetEventStore.clean();
|
|
891
|
-
for (const
|
|
892
|
-
this.gestureEventStores[
|
|
891
|
+
for (const e of this.gestures)
|
|
892
|
+
this.gestureEventStores[e].clean(), this.gestureTimeoutStores[e].clean();
|
|
893
893
|
}
|
|
894
894
|
effect() {
|
|
895
895
|
return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
|
|
896
896
|
}
|
|
897
|
-
bind(...
|
|
897
|
+
bind(...e) {
|
|
898
898
|
const r = this.config.shared, n = {};
|
|
899
899
|
let s;
|
|
900
900
|
if (!(r.target && (s = r.target(), !s))) {
|
|
901
901
|
if (r.enabled) {
|
|
902
902
|
for (const a of this.gestures) {
|
|
903
|
-
const c = this.config[a], l =
|
|
903
|
+
const c = this.config[a], l = _e(n, c.eventOptions, !!s);
|
|
904
904
|
if (c.enabled) {
|
|
905
|
-
const d =
|
|
906
|
-
new d(this,
|
|
905
|
+
const d = Ce.get(a);
|
|
906
|
+
new d(this, e, a).bind(l);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const o =
|
|
909
|
+
const o = _e(n, r.eventOptions, !!s);
|
|
910
910
|
for (const a in this.nativeHandlers)
|
|
911
911
|
o(a, "", (c) => this.nativeHandlers[a](p(p({}, this.state.shared), {}, {
|
|
912
912
|
event: c,
|
|
913
|
-
args:
|
|
913
|
+
args: e
|
|
914
914
|
})), void 0, !0);
|
|
915
915
|
}
|
|
916
916
|
for (const o in n)
|
|
917
|
-
n[o] =
|
|
917
|
+
n[o] = Ze(...n[o]);
|
|
918
918
|
if (!s) return n;
|
|
919
919
|
for (const o in n) {
|
|
920
920
|
const {
|
|
921
921
|
device: a,
|
|
922
922
|
capture: c,
|
|
923
923
|
passive: l
|
|
924
|
-
} =
|
|
924
|
+
} = Ye(o);
|
|
925
925
|
this._targetEventStore.add(s, a, "", n[o], {
|
|
926
926
|
capture: c,
|
|
927
927
|
passive: l
|
|
@@ -930,42 +930,42 @@ class xe {
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function V(
|
|
934
|
-
|
|
933
|
+
function V(t, e) {
|
|
934
|
+
t.gestures.add(e), t.gestureEventStores[e] = new De(t, e), t.gestureTimeoutStores[e] = new xt();
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
936
|
+
function It(t, e) {
|
|
937
|
+
e.drag && V(t, "drag"), e.wheel && V(t, "wheel"), e.scroll && V(t, "scroll"), e.move && V(t, "move"), e.pinch && V(t, "pinch"), e.hover && V(t, "hover");
|
|
938
938
|
}
|
|
939
|
-
const
|
|
939
|
+
const _e = (t, e, r) => (n, s, o, a = {}, c = !1) => {
|
|
940
940
|
var l, d;
|
|
941
|
-
const u = (l = a.capture) !== null && l !== void 0 ? l :
|
|
942
|
-
let m = c ? n :
|
|
943
|
-
r && v && (m += "Passive"),
|
|
941
|
+
const u = (l = a.capture) !== null && l !== void 0 ? l : e.capture, v = (d = a.passive) !== null && d !== void 0 ? d : e.passive;
|
|
942
|
+
let m = c ? n : Ge(n, s, u);
|
|
943
|
+
r && v && (m += "Passive"), t[m] = t[m] || [], t[m].push(o);
|
|
944
944
|
};
|
|
945
|
-
function
|
|
946
|
-
const s = Q.useMemo(() => new
|
|
947
|
-
if (s.applyHandlers(
|
|
945
|
+
function kt(t, e = {}, r, n) {
|
|
946
|
+
const s = Q.useMemo(() => new St(t), []);
|
|
947
|
+
if (s.applyHandlers(t, n), s.applyConfig(e, r), Q.useEffect(s.effect.bind(s)), Q.useEffect(() => s.clean.bind(s), []), e.target === void 0)
|
|
948
948
|
return s.bind.bind(s);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
return
|
|
952
|
-
drag:
|
|
953
|
-
},
|
|
950
|
+
function Ct(t, e) {
|
|
951
|
+
return vt(yt), kt({
|
|
952
|
+
drag: t
|
|
953
|
+
}, e || {}, "drag");
|
|
954
954
|
}
|
|
955
|
-
const
|
|
956
|
-
function
|
|
957
|
-
const
|
|
958
|
-
function
|
|
955
|
+
const ee = "RSC::Event";
|
|
956
|
+
function Dt() {
|
|
957
|
+
const t = C(null);
|
|
958
|
+
function e(n) {
|
|
959
959
|
R(() => {
|
|
960
|
-
|
|
960
|
+
t.current || (t.current = document.createElement("div"));
|
|
961
961
|
function s(o) {
|
|
962
962
|
n(o.detail);
|
|
963
963
|
}
|
|
964
|
-
if (
|
|
965
|
-
return
|
|
964
|
+
if (t.current)
|
|
965
|
+
return t.current.addEventListener(ee, s, !1), () => {
|
|
966
966
|
var o;
|
|
967
|
-
(o =
|
|
968
|
-
|
|
967
|
+
(o = t.current) == null || o.removeEventListener(
|
|
968
|
+
ee,
|
|
969
969
|
s,
|
|
970
970
|
!1
|
|
971
971
|
);
|
|
@@ -973,25 +973,25 @@ function De() {
|
|
|
973
973
|
}, [n]);
|
|
974
974
|
}
|
|
975
975
|
function r(n) {
|
|
976
|
-
if (
|
|
977
|
-
const s = new CustomEvent(
|
|
976
|
+
if (t.current) {
|
|
977
|
+
const s = new CustomEvent(ee, {
|
|
978
978
|
detail: n
|
|
979
979
|
});
|
|
980
|
-
|
|
980
|
+
t.current.dispatchEvent(s);
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
return {
|
|
984
|
-
useListenToCustomEvent:
|
|
984
|
+
useListenToCustomEvent: e,
|
|
985
985
|
emitEvent: r
|
|
986
986
|
};
|
|
987
987
|
}
|
|
988
|
-
function
|
|
989
|
-
let
|
|
990
|
-
return
|
|
988
|
+
function Pt(t) {
|
|
989
|
+
let e = t.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
|
|
990
|
+
return e = e.replace(/[\n\t]+/g, " "), e = e.replace(/\s*([{}:;,])\s*/g, "$1"), e = e.replace(/\s+}/g, "}"), e = e.replace(/{\s+/g, "{"), e = e.replace(/\s+/g, " "), e.trim();
|
|
991
991
|
}
|
|
992
|
-
function
|
|
993
|
-
init:
|
|
994
|
-
items:
|
|
992
|
+
function Mt({
|
|
993
|
+
init: t = !0,
|
|
994
|
+
items: e,
|
|
995
995
|
withLoop: r = !1,
|
|
996
996
|
id: n,
|
|
997
997
|
gutter: s = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
|
|
@@ -1004,32 +1004,29 @@ function Me({
|
|
|
1004
1004
|
initialActiveItem: v = 0,
|
|
1005
1005
|
slideType: m = "item"
|
|
1006
1006
|
}) {
|
|
1007
|
-
const [E, k] =
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
[a]
|
|
1015
|
-
), Pt = r ? [
|
|
1016
|
-
...t.map((i) => ({
|
|
1007
|
+
const [E, k] = Ve(!1), P = C(t), y = C(null), $ = C(null), N = C(0), b = C(0), S = C(!r), L = C(!1), O = C(0), h = C(0), [Y, F] = Ee(() => ({
|
|
1008
|
+
value: 0,
|
|
1009
|
+
onChange({ value: i }) {
|
|
1010
|
+
$.current.style.transform = `translate3d(calc(${i.value}px + var(--${n}-offset-modifier)), 0px, 0px)`;
|
|
1011
|
+
}
|
|
1012
|
+
})), Pe = r ? [
|
|
1013
|
+
...e.map((i) => ({
|
|
1017
1014
|
...i,
|
|
1018
1015
|
id: `prev-repeated-item-${i.id}`,
|
|
1019
1016
|
isClonedItem: !0
|
|
1020
1017
|
})),
|
|
1021
|
-
...
|
|
1022
|
-
...
|
|
1018
|
+
...e,
|
|
1019
|
+
...e.map((i) => ({
|
|
1023
1020
|
...i,
|
|
1024
1021
|
id: `next-repeated-item-${i.id}`,
|
|
1025
1022
|
isClonedItem: !0
|
|
1026
1023
|
}))
|
|
1027
|
-
] :
|
|
1028
|
-
function $
|
|
1029
|
-
const { totalGutterCssVar: i } =
|
|
1024
|
+
] : e, { useListenToCustomEvent: se, emitEvent: U } = Dt();
|
|
1025
|
+
function $e() {
|
|
1026
|
+
const { totalGutterCssVar: i } = ie();
|
|
1030
1027
|
return i;
|
|
1031
1028
|
}
|
|
1032
|
-
function
|
|
1029
|
+
function Oe() {
|
|
1033
1030
|
if (y.current) {
|
|
1034
1031
|
const f = window.getComputedStyle(
|
|
1035
1032
|
y.current
|
|
@@ -1046,7 +1043,7 @@ function Me({
|
|
|
1046
1043
|
}));
|
|
1047
1044
|
}
|
|
1048
1045
|
function X(i) {
|
|
1049
|
-
P.current && (
|
|
1046
|
+
P.current && (S.current || M({
|
|
1050
1047
|
type: "prev",
|
|
1051
1048
|
toIndex: i,
|
|
1052
1049
|
actionType: "click"
|
|
@@ -1058,24 +1055,24 @@ function Me({
|
|
|
1058
1055
|
toIndex: _,
|
|
1059
1056
|
actionType: T
|
|
1060
1057
|
}) {
|
|
1061
|
-
var
|
|
1058
|
+
var ae, ce;
|
|
1062
1059
|
const A = !f;
|
|
1063
|
-
|
|
1060
|
+
S.current = !1, L.current = !1;
|
|
1064
1061
|
let g = Y.value.get(), I = 0;
|
|
1065
|
-
if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current =
|
|
1062
|
+
if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current = e.length - 1 : h.current -= 1), _ !== void 0 && (h.current = _), i === "next") {
|
|
1066
1063
|
const K = q(
|
|
1067
|
-
r ? b.current * (
|
|
1064
|
+
r ? b.current * (e.length * 2) : 0
|
|
1068
1065
|
);
|
|
1069
|
-
I = -(h.current * b.current), r && h.current ===
|
|
1066
|
+
I = -(h.current * b.current), r && h.current === e.length && (h.current = 0, g = g + b.current * e.length, I = 0), !r && (Math.abs(I) >= K || h.current === e.length - 1) && (L.current = !0, I = -K);
|
|
1070
1067
|
}
|
|
1071
|
-
i === "prev" && (I = -(h.current * b.current), h.current ===
|
|
1068
|
+
i === "prev" && (I = -(h.current * b.current), h.current === e.length - 1 && (g = g - e.length * b.current), !r && I >= 0 && (S.current = !0, I = 0)), N.current = I, T === "resize" ? (I = -(h.current * b.current), U({
|
|
1072
1069
|
eventName: "onResize",
|
|
1073
1070
|
sliceActionType: T,
|
|
1074
1071
|
slideDirection: i,
|
|
1075
1072
|
currentItem: {
|
|
1076
1073
|
index: h.current,
|
|
1077
|
-
id: ((
|
|
1078
|
-
startReached:
|
|
1074
|
+
id: ((ae = e.at(h.current)) == null ? void 0 : ae.id) ?? "",
|
|
1075
|
+
startReached: S.current,
|
|
1079
1076
|
endReached: L.current
|
|
1080
1077
|
}
|
|
1081
1078
|
})) : U({
|
|
@@ -1084,11 +1081,11 @@ function Me({
|
|
|
1084
1081
|
slideDirection: i,
|
|
1085
1082
|
nextItem: {
|
|
1086
1083
|
index: h.current,
|
|
1087
|
-
id: ((
|
|
1088
|
-
startReached:
|
|
1084
|
+
id: ((ce = e.at(h.current)) == null ? void 0 : ce.id) ?? "",
|
|
1085
|
+
startReached: S.current,
|
|
1089
1086
|
endReached: L.current
|
|
1090
1087
|
}
|
|
1091
|
-
}), F.start({
|
|
1088
|
+
}), console.log("12312312312312312"), F.start({
|
|
1092
1089
|
immediate: A,
|
|
1093
1090
|
from: {
|
|
1094
1091
|
value: g
|
|
@@ -1097,31 +1094,31 @@ function Me({
|
|
|
1097
1094
|
value: I
|
|
1098
1095
|
},
|
|
1099
1096
|
onRest({ finished: K }) {
|
|
1100
|
-
var
|
|
1097
|
+
var ue;
|
|
1101
1098
|
K && U({
|
|
1102
1099
|
eventName: "onSlideChangeComplete",
|
|
1103
1100
|
sliceActionType: T,
|
|
1104
1101
|
slideDirection: i,
|
|
1105
1102
|
currentItem: {
|
|
1106
1103
|
index: h.current,
|
|
1107
|
-
id: ((
|
|
1108
|
-
startReached:
|
|
1104
|
+
id: ((ue = e.at(h.current)) == null ? void 0 : ue.id) ?? "",
|
|
1105
|
+
startReached: S.current,
|
|
1109
1106
|
endReached: L.current
|
|
1110
1107
|
}
|
|
1111
1108
|
});
|
|
1112
1109
|
}
|
|
1113
1110
|
});
|
|
1114
1111
|
}
|
|
1115
|
-
function
|
|
1112
|
+
function Ae() {
|
|
1116
1113
|
const i = m === "item" ? $.current.children[0] : y.current;
|
|
1117
1114
|
let f = 0;
|
|
1118
|
-
return f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + $
|
|
1115
|
+
return f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + $e(), f;
|
|
1119
1116
|
}
|
|
1120
1117
|
function q(i) {
|
|
1121
1118
|
const f = y.current;
|
|
1122
1119
|
return f[a === "x" ? "scrollWidth" : "scrollHeight"] - f.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
|
|
1123
1120
|
}
|
|
1124
|
-
function
|
|
1121
|
+
function ie() {
|
|
1125
1122
|
let i = 0, f = 0;
|
|
1126
1123
|
if (y.current) {
|
|
1127
1124
|
const _ = window.getComputedStyle(
|
|
@@ -1137,7 +1134,7 @@ function Me({
|
|
|
1137
1134
|
}
|
|
1138
1135
|
R(() => {
|
|
1139
1136
|
function i(A) {
|
|
1140
|
-
const g =
|
|
1137
|
+
const g = Oe();
|
|
1141
1138
|
switch (A) {
|
|
1142
1139
|
case "start":
|
|
1143
1140
|
return 0;
|
|
@@ -1154,10 +1151,10 @@ function Me({
|
|
|
1154
1151
|
}
|
|
1155
1152
|
}
|
|
1156
1153
|
function f() {
|
|
1157
|
-
b.current =
|
|
1158
|
-
const { totalStartEndGutterCssVar: A } =
|
|
1154
|
+
b.current = Ae(), console.log(b.current), O.current = b.current / 4;
|
|
1155
|
+
const { totalStartEndGutterCssVar: A } = ie();
|
|
1159
1156
|
let g = 0;
|
|
1160
|
-
r && (g = b.current *
|
|
1157
|
+
r && (g = b.current * e.length), g -= b.current * i(c), g -= A / 2, y.current.style.setProperty(
|
|
1161
1158
|
`--${n}-offset-modifier`,
|
|
1162
1159
|
`${-g}px`
|
|
1163
1160
|
);
|
|
@@ -1173,21 +1170,21 @@ function Me({
|
|
|
1173
1170
|
actionType: "resize"
|
|
1174
1171
|
});
|
|
1175
1172
|
}
|
|
1176
|
-
if (
|
|
1173
|
+
if (t)
|
|
1177
1174
|
return P.current = !0, _(), window.addEventListener("resize", T), () => {
|
|
1178
1175
|
window.removeEventListener("resize", T);
|
|
1179
1176
|
};
|
|
1180
|
-
}, [
|
|
1181
|
-
|
|
1177
|
+
}, [t]), R(() => {
|
|
1178
|
+
t && v !== h.current && (console.log("resize also ere?"), M({
|
|
1182
1179
|
type: "next",
|
|
1183
1180
|
toIndex: v,
|
|
1184
1181
|
actionType: "resize",
|
|
1185
1182
|
shouldAnimate: !1
|
|
1186
1183
|
}));
|
|
1187
|
-
}, [
|
|
1184
|
+
}, [t, v]), R(() => {
|
|
1188
1185
|
E && u && u();
|
|
1189
1186
|
}, [E, u]);
|
|
1190
|
-
const
|
|
1187
|
+
const oe = l, Le = Ct(
|
|
1191
1188
|
(i) => {
|
|
1192
1189
|
if (!P.current)
|
|
1193
1190
|
return;
|
|
@@ -1196,7 +1193,7 @@ function Me({
|
|
|
1196
1193
|
...i,
|
|
1197
1194
|
eventName: "onDrag",
|
|
1198
1195
|
slideActionType: "drag"
|
|
1199
|
-
}), F.start({
|
|
1196
|
+
}), console.log("222222"), F.start({
|
|
1200
1197
|
value: _,
|
|
1201
1198
|
immediate: !0,
|
|
1202
1199
|
config: {
|
|
@@ -1208,7 +1205,7 @@ function Me({
|
|
|
1208
1205
|
}), i.cancel()) : g ? (M({
|
|
1209
1206
|
actionType: "drag",
|
|
1210
1207
|
type: "next"
|
|
1211
|
-
}), i.cancel()) : (F.start({
|
|
1208
|
+
}), i.cancel()) : (console.log("333333"), F.start({
|
|
1212
1209
|
value: N.current,
|
|
1213
1210
|
config: {
|
|
1214
1211
|
velocity: I
|
|
@@ -1216,7 +1213,7 @@ function Me({
|
|
|
1216
1213
|
}), i.cancel()));
|
|
1217
1214
|
},
|
|
1218
1215
|
{
|
|
1219
|
-
enabled:
|
|
1216
|
+
enabled: oe,
|
|
1220
1217
|
axis: a,
|
|
1221
1218
|
rubberband: !r,
|
|
1222
1219
|
...r ? {} : {
|
|
@@ -1230,25 +1227,25 @@ function Me({
|
|
|
1230
1227
|
from: () => [Y.value.get(), Y.value.get()]
|
|
1231
1228
|
}
|
|
1232
1229
|
);
|
|
1233
|
-
function
|
|
1230
|
+
function Ne(i) {
|
|
1234
1231
|
var f, _;
|
|
1235
|
-
return typeof i == "number" ? h.current === i : ((f =
|
|
1232
|
+
return typeof i == "number" ? h.current === i : ((f = e.find((T) => T.id === i)) == null ? void 0 : f.id) === ((_ = e[h.current]) == null ? void 0 : _.id);
|
|
1236
1233
|
}
|
|
1237
1234
|
return {
|
|
1238
|
-
carouselFragment: /* @__PURE__ */
|
|
1235
|
+
carouselFragment: /* @__PURE__ */ Me(
|
|
1239
1236
|
"div",
|
|
1240
1237
|
{
|
|
1241
1238
|
ref: y,
|
|
1242
1239
|
className: "ReactSpringCarouselContainer",
|
|
1243
1240
|
"data-part": "Container",
|
|
1244
1241
|
"data-part-internal": `${n}-Container`,
|
|
1245
|
-
...
|
|
1242
|
+
...Le(),
|
|
1246
1243
|
children: [
|
|
1247
1244
|
/* @__PURE__ */ J(
|
|
1248
1245
|
"style",
|
|
1249
1246
|
{
|
|
1250
1247
|
dangerouslySetInnerHTML: {
|
|
1251
|
-
__html:
|
|
1248
|
+
__html: Pt(`
|
|
1252
1249
|
[data-part-internal="${n}-Container"] {
|
|
1253
1250
|
display: flex;
|
|
1254
1251
|
width: 100%;
|
|
@@ -1261,12 +1258,12 @@ function Me({
|
|
|
1261
1258
|
--${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
|
|
1262
1259
|
--${n}-gutter: 0px;
|
|
1263
1260
|
--${n}-start-end-gutter: 0px;
|
|
1264
|
-
touch-action: ${
|
|
1261
|
+
touch-action: ${oe ? a === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1265
1262
|
}
|
|
1266
1263
|
[data-part-internal="${n}-Track"] {
|
|
1267
1264
|
display: flex;
|
|
1268
1265
|
position: relative;
|
|
1269
|
-
--initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${
|
|
1266
|
+
--initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${e.length} * var(--${n}-items-per-slide)) + var(--${n}-start-end-gutter)) * ${e.length} / var(--${n}-items-per-slide));
|
|
1270
1267
|
left: ${r && a === "x" && !E ? "var(--initial-offset-modifier)" : "0px"};
|
|
1271
1268
|
top: ${r && a === "y" && !E ? "var(--initial-offset-modifier)" : "0px"};
|
|
1272
1269
|
flex-direction: ${a === "x" ? "row" : "column"};
|
|
@@ -1310,9 +1307,9 @@ function Me({
|
|
|
1310
1307
|
"data-part": "Track",
|
|
1311
1308
|
"data-part-internal": `${n}-Track`,
|
|
1312
1309
|
onScroll: () => {
|
|
1313
|
-
|
|
1310
|
+
S.current = !1, L.current = !1;
|
|
1314
1311
|
},
|
|
1315
|
-
children:
|
|
1312
|
+
children: Pe.map((i, f) => /* @__PURE__ */ J(
|
|
1316
1313
|
"div",
|
|
1317
1314
|
{
|
|
1318
1315
|
className: "ReactSpringCarouselItem",
|
|
@@ -1320,10 +1317,10 @@ function Me({
|
|
|
1320
1317
|
"data-part-internal": `${n}-Item`,
|
|
1321
1318
|
"data-id": i.id,
|
|
1322
1319
|
children: typeof i.renderItem == "function" ? i.renderItem({
|
|
1323
|
-
useListenToCustomEvent:
|
|
1320
|
+
useListenToCustomEvent: se,
|
|
1324
1321
|
index: f,
|
|
1325
1322
|
isClonedItem: !!i.isClonedItem,
|
|
1326
|
-
isActiveItem:
|
|
1323
|
+
isActiveItem: Ne
|
|
1327
1324
|
}) : i.renderItem
|
|
1328
1325
|
},
|
|
1329
1326
|
`${i.id}-${f}`
|
|
@@ -1333,12 +1330,12 @@ function Me({
|
|
|
1333
1330
|
]
|
|
1334
1331
|
}
|
|
1335
1332
|
),
|
|
1336
|
-
useListenToCustomEvent:
|
|
1333
|
+
useListenToCustomEvent: se,
|
|
1337
1334
|
slideToNextItem: () => H(),
|
|
1338
1335
|
slideToPrevItem: () => X(),
|
|
1339
1336
|
slideToItem: (i) => {
|
|
1340
1337
|
if (typeof i == "number") {
|
|
1341
|
-
if (!
|
|
1338
|
+
if (!e[i]) {
|
|
1342
1339
|
console.warn(
|
|
1343
1340
|
`The item you're trying to slide doesn't exist. index: ${i}`
|
|
1344
1341
|
);
|
|
@@ -1347,7 +1344,7 @@ function Me({
|
|
|
1347
1344
|
i > h.current ? H(i) : X(i);
|
|
1348
1345
|
}
|
|
1349
1346
|
if (typeof i == "string") {
|
|
1350
|
-
const f =
|
|
1347
|
+
const f = e.findIndex((_) => _.id === i);
|
|
1351
1348
|
if (f < 0) {
|
|
1352
1349
|
console.warn(
|
|
1353
1350
|
`The item you're trying to slide doesn't exist. id: ${i}`
|
|
@@ -1359,53 +1356,53 @@ function Me({
|
|
|
1359
1356
|
}
|
|
1360
1357
|
};
|
|
1361
1358
|
}
|
|
1362
|
-
function $
|
|
1363
|
-
let
|
|
1364
|
-
const r = getComputedStyle(
|
|
1365
|
-
return r.includes("px") && (
|
|
1359
|
+
function $t(t) {
|
|
1360
|
+
let e = 0;
|
|
1361
|
+
const r = getComputedStyle(t).getPropertyValue("gap");
|
|
1362
|
+
return r.includes("px") && (e = Number(r.replace("px", ""))), e;
|
|
1366
1363
|
}
|
|
1367
|
-
function
|
|
1368
|
-
return
|
|
1364
|
+
function we(t) {
|
|
1365
|
+
return t.scrollWidth - t.clientWidth;
|
|
1369
1366
|
}
|
|
1370
|
-
function
|
|
1371
|
-
const
|
|
1372
|
-
return
|
|
1367
|
+
function te(t) {
|
|
1368
|
+
const e = t.children[0], r = $t(t);
|
|
1369
|
+
return e.getBoundingClientRect().width + r;
|
|
1373
1370
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const r = C("start"), n = C(0), [, s] =
|
|
1371
|
+
function Vt({ container: t, onReach: e }) {
|
|
1372
|
+
const r = C("start"), n = C(0), [, s] = Ee(() => ({
|
|
1376
1373
|
x: 0
|
|
1377
1374
|
}));
|
|
1378
1375
|
function o(c) {
|
|
1379
1376
|
s.start({
|
|
1380
1377
|
from: {
|
|
1381
|
-
x:
|
|
1378
|
+
x: t.current.scrollLeft
|
|
1382
1379
|
},
|
|
1383
1380
|
to: {
|
|
1384
1381
|
x: c
|
|
1385
1382
|
},
|
|
1386
1383
|
onChange({ value: l }) {
|
|
1387
|
-
|
|
1384
|
+
t.current && (t.current.scrollLeft = l.x);
|
|
1388
1385
|
}
|
|
1389
1386
|
});
|
|
1390
1387
|
}
|
|
1391
1388
|
function a(c) {
|
|
1392
|
-
if (!
|
|
1389
|
+
if (!t.current || c === "next" && r.current === "end" || c === "prev" && r.current === "start")
|
|
1393
1390
|
return;
|
|
1394
1391
|
let l = 0;
|
|
1395
|
-
if (c === "next" && (n.current += 1), c === "prev" && (n.current -= 1), l = n.current *
|
|
1396
|
-
const d =
|
|
1397
|
-
l > d && (r.current = "end", l = d,
|
|
1392
|
+
if (c === "next" && (n.current += 1), c === "prev" && (n.current -= 1), l = n.current * te(t.current), c === "next") {
|
|
1393
|
+
const d = we(t.current);
|
|
1394
|
+
l > d && (r.current = "end", l = d, e && e("end"));
|
|
1398
1395
|
}
|
|
1399
|
-
c === "prev" && l <= 0 && (r.current = "start", n.current = 0, l = 0,
|
|
1396
|
+
c === "prev" && l <= 0 && (r.current = "start", n.current = 0, l = 0, e && e("start")), o(l);
|
|
1400
1397
|
}
|
|
1401
1398
|
return R(() => {
|
|
1402
1399
|
function c() {
|
|
1403
1400
|
var N;
|
|
1404
|
-
const E =
|
|
1405
|
-
index:
|
|
1406
|
-
start: E *
|
|
1407
|
-
end: E * (
|
|
1408
|
-
})), y =
|
|
1401
|
+
const E = te(t.current), k = ((N = [...t.current.children].at(0)) == null ? void 0 : N.getBoundingClientRect().width) || 0, P = Array(t.current.childElementCount).fill(0).map((b, S) => ({
|
|
1402
|
+
index: S,
|
|
1403
|
+
start: E * S,
|
|
1404
|
+
end: E * (S + 1)
|
|
1405
|
+
})), y = t.current.scrollLeft + k, $ = P.find(
|
|
1409
1406
|
(b) => y >= b.start && y < b.end
|
|
1410
1407
|
);
|
|
1411
1408
|
n.current = ($ == null ? void 0 : $.index) || 0;
|
|
@@ -1415,26 +1412,26 @@ function Ve({ container: e, onReach: t }) {
|
|
|
1415
1412
|
}
|
|
1416
1413
|
function d(E) {
|
|
1417
1414
|
const k = E.target;
|
|
1418
|
-
k.scrollLeft === 0 ? (n.current = 0, r.current = "start",
|
|
1415
|
+
k.scrollLeft === 0 ? (n.current = 0, r.current = "start", e && e("start")) : k.scrollLeft >= we(k) ? (r.current = "end", e && e("end")) : r.current !== "idle" && (r.current = "idle", e && e("idle"));
|
|
1419
1416
|
}
|
|
1420
1417
|
let u, v = 0;
|
|
1421
1418
|
function m() {
|
|
1422
|
-
v =
|
|
1423
|
-
|
|
1419
|
+
v = t.current.scrollLeft, clearTimeout(u), u = setTimeout(function() {
|
|
1420
|
+
t.current.scrollLeft === v && c();
|
|
1424
1421
|
}, 200);
|
|
1425
1422
|
}
|
|
1426
|
-
if (
|
|
1427
|
-
return
|
|
1423
|
+
if (t.current)
|
|
1424
|
+
return t.current.addEventListener("wheel", l, {
|
|
1428
1425
|
passive: !0
|
|
1429
|
-
}),
|
|
1430
|
-
|
|
1426
|
+
}), t.current.addEventListener("scroll", d), t.current.addEventListener("scroll", m), () => {
|
|
1427
|
+
t.current && (t.current.removeEventListener("scroll", m), t.current.removeEventListener("scroll", d), t.current.removeEventListener("wheel", l));
|
|
1431
1428
|
};
|
|
1432
|
-
}, [
|
|
1433
|
-
if (
|
|
1429
|
+
}, [t, e]), R(() => {
|
|
1430
|
+
if (t.current) {
|
|
1434
1431
|
const c = new ResizeObserver(() => {
|
|
1435
|
-
o(n.current *
|
|
1432
|
+
o(n.current * te(t.current));
|
|
1436
1433
|
});
|
|
1437
|
-
return c.observe(
|
|
1434
|
+
return c.observe(t.current), () => {
|
|
1438
1435
|
c.disconnect();
|
|
1439
1436
|
};
|
|
1440
1437
|
}
|
|
@@ -1448,6 +1445,6 @@ function Ve({ container: e, onReach: t }) {
|
|
|
1448
1445
|
};
|
|
1449
1446
|
}
|
|
1450
1447
|
export {
|
|
1451
|
-
|
|
1452
|
-
|
|
1448
|
+
Mt as useSpringCarousel,
|
|
1449
|
+
Vt as useSpringScroll
|
|
1453
1450
|
};
|