@wix/interact 2.1.3 → 2.1.4
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/cjs/index.js +1 -1
- package/dist/cjs/react.js +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +2 -2
- package/dist/{index-BtEG0cjF.mjs → index-DHqlFmW8.mjs} +1022 -987
- package/dist/index-DHqlFmW8.mjs.map +1 -0
- package/dist/index-DYEvpIGz.js +18 -0
- package/dist/index-DYEvpIGz.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/handlers/effectHandlers.d.ts.map +1 -1
- package/dist/types/handlers/viewEnter.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/index-BtEG0cjF.mjs.map +0 -1
- package/dist/index-ErMKtmX2.js +0 -18
- package/dist/index-ErMKtmX2.js.map +0 -1
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
function st(
|
|
2
|
-
return [...
|
|
1
|
+
function st(t) {
|
|
2
|
+
return [...t.matchAll(/\[([-\w]+)]/g)].map(([e, n]) => n);
|
|
3
3
|
}
|
|
4
|
-
function C(
|
|
5
|
-
const n = st(
|
|
4
|
+
function C(t, e) {
|
|
5
|
+
const n = st(e);
|
|
6
6
|
let s = 0;
|
|
7
|
-
return n.length ?
|
|
7
|
+
return n.length ? t.replace(/\[]/g, () => {
|
|
8
8
|
const r = n[s++];
|
|
9
9
|
return r !== void 0 ? `[${r}]` : "[]";
|
|
10
|
-
}) :
|
|
10
|
+
}) : t;
|
|
11
11
|
}
|
|
12
12
|
class G {
|
|
13
13
|
animations;
|
|
14
14
|
options;
|
|
15
15
|
ready;
|
|
16
16
|
isCSS;
|
|
17
|
-
constructor(
|
|
18
|
-
this.animations =
|
|
17
|
+
constructor(e, n) {
|
|
18
|
+
this.animations = e, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = e[0] instanceof CSSAnimation;
|
|
19
19
|
}
|
|
20
20
|
getProgress() {
|
|
21
21
|
return this.animations[0]?.effect?.getComputedTiming().progress || 0;
|
|
22
22
|
}
|
|
23
|
-
async play(
|
|
23
|
+
async play(e) {
|
|
24
24
|
await this.ready;
|
|
25
25
|
for (const n of this.animations)
|
|
26
26
|
n.play();
|
|
27
|
-
await Promise.all(this.animations.map((n) => n.ready)),
|
|
27
|
+
await Promise.all(this.animations.map((n) => n.ready)), e && e();
|
|
28
28
|
}
|
|
29
29
|
pause() {
|
|
30
|
-
for (const
|
|
31
|
-
|
|
30
|
+
for (const e of this.animations)
|
|
31
|
+
e.pause();
|
|
32
32
|
}
|
|
33
|
-
async reverse(
|
|
33
|
+
async reverse(e) {
|
|
34
34
|
await this.ready;
|
|
35
35
|
for (const n of this.animations)
|
|
36
36
|
n.reverse();
|
|
37
|
-
await Promise.all(this.animations.map((n) => n.ready)),
|
|
37
|
+
await Promise.all(this.animations.map((n) => n.ready)), e && e();
|
|
38
38
|
}
|
|
39
|
-
progress(
|
|
39
|
+
progress(e) {
|
|
40
40
|
for (const n of this.animations) {
|
|
41
41
|
const { delay: s, duration: r, iterations: i } = n.effect.getTiming(), o = (Number.isFinite(r) ? r : 0) * (Number.isFinite(i) ? i : 1);
|
|
42
|
-
n.currentTime = ((s || 0) + o) *
|
|
42
|
+
n.currentTime = ((s || 0) + o) * e;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
cancel() {
|
|
46
|
-
for (const
|
|
47
|
-
|
|
46
|
+
for (const e of this.animations)
|
|
47
|
+
e.cancel();
|
|
48
48
|
}
|
|
49
|
-
setPlaybackRate(
|
|
49
|
+
setPlaybackRate(e) {
|
|
50
50
|
for (const n of this.animations)
|
|
51
|
-
n.playbackRate =
|
|
51
|
+
n.playbackRate = e;
|
|
52
52
|
}
|
|
53
|
-
async onFinish(
|
|
53
|
+
async onFinish(e) {
|
|
54
54
|
try {
|
|
55
55
|
await Promise.all(this.animations.map((s) => s.finished));
|
|
56
56
|
const n = this.animations[0];
|
|
@@ -61,20 +61,37 @@ class G {
|
|
|
61
61
|
s.dispatchEvent(r);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
e();
|
|
65
65
|
} catch (n) {
|
|
66
66
|
console.warn("animation was interrupted - aborting onFinish callback - ", n);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
async onAbort(e) {
|
|
70
|
+
try {
|
|
71
|
+
await Promise.all(this.animations.map((n) => n.finished));
|
|
72
|
+
} catch (n) {
|
|
73
|
+
if (n.name === "AbortError") {
|
|
74
|
+
const s = this.animations[0];
|
|
75
|
+
if (s && !this.isCSS) {
|
|
76
|
+
const r = s.effect?.target;
|
|
77
|
+
if (r) {
|
|
78
|
+
const i = new Event("animationcancel");
|
|
79
|
+
r.dispatchEvent(i);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
e();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
69
86
|
get finished() {
|
|
70
|
-
return Promise.all(this.animations.map((
|
|
87
|
+
return Promise.all(this.animations.map((e) => e.finished));
|
|
71
88
|
}
|
|
72
89
|
get playState() {
|
|
73
90
|
return this.animations[0]?.playState;
|
|
74
91
|
}
|
|
75
92
|
getTimingOptions() {
|
|
76
|
-
return this.animations.map((
|
|
77
|
-
const n =
|
|
93
|
+
return this.animations.map((e) => {
|
|
94
|
+
const n = e.effect?.getTiming(), s = n?.delay ?? 0, r = Number(n?.duration) || 0, i = n?.iterations ?? 1;
|
|
78
95
|
return {
|
|
79
96
|
delay: s,
|
|
80
97
|
duration: r,
|
|
@@ -83,7 +100,7 @@ class G {
|
|
|
83
100
|
});
|
|
84
101
|
}
|
|
85
102
|
}
|
|
86
|
-
const Re = (
|
|
103
|
+
const Re = (t) => t, it = (t) => 1 - Math.cos(t * Math.PI / 2), rt = (t) => Math.sin(t * Math.PI / 2), ot = (t) => -(Math.cos(Math.PI * t) - 1) / 2, ct = (t) => t ** 2, at = (t) => 1 - (1 - t) ** 2, ft = (t) => t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2, lt = (t) => t ** 3, ut = (t) => 1 - (1 - t) ** 3, dt = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2, ht = (t) => t ** 4, mt = (t) => 1 - (1 - t) ** 4, pt = (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2, gt = (t) => t ** 5, vt = (t) => 1 - (1 - t) ** 5, yt = (t) => t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2, Et = (t) => t === 0 ? 0 : 2 ** (10 * t - 10), wt = (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t), bt = (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2, St = (t) => 1 - Math.sqrt(1 - t ** 2), It = (t) => Math.sqrt(1 - (t - 1) ** 2), Tt = (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2, Ot = (t) => 2.70158 * t ** 3 - 1.70158 * t ** 2, Ct = (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2, kt = (t, e = 1.70158 * 1.525) => t < 0.5 ? (2 * t) ** 2 * ((e + 1) * 2 * t - e) / 2 : ((2 * t - 2) ** 2 * ((e + 1) * (t * 2 - 2) + e) + 2) / 2, we = {
|
|
87
104
|
linear: Re,
|
|
88
105
|
sineIn: it,
|
|
89
106
|
sineOut: rt,
|
|
@@ -140,59 +157,59 @@ const Re = (e) => e, it = (e) => 1 - Math.cos(e * Math.PI / 2), rt = (e) => Math
|
|
|
140
157
|
backOut: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
141
158
|
backInOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
|
|
142
159
|
};
|
|
143
|
-
function
|
|
144
|
-
return
|
|
160
|
+
function At(t) {
|
|
161
|
+
return t === "percentage" ? "%" : t || "px";
|
|
145
162
|
}
|
|
146
|
-
function B(
|
|
147
|
-
return
|
|
163
|
+
function B(t) {
|
|
164
|
+
return t ? be[t] || t : be.linear;
|
|
148
165
|
}
|
|
149
|
-
function
|
|
150
|
-
const r = 3 *
|
|
166
|
+
function qt(t, e, n, s) {
|
|
167
|
+
const r = 3 * t, i = 3 * (n - t) - r, o = 1 - r - i, c = 3 * e, l = 3 * (s - e) - c, f = 1 - c - l, a = (d) => ((o * d + i) * d + r) * d, u = (d) => ((f * d + l) * d + c) * d, m = (d) => (3 * o * d + 2 * i) * d + r;
|
|
151
168
|
function g(d) {
|
|
152
169
|
let h = d;
|
|
153
|
-
for (let
|
|
170
|
+
for (let y = 0; y < 8; y++) {
|
|
154
171
|
const w = a(h) - d;
|
|
155
172
|
if (Math.abs(w) < 1e-7) return h;
|
|
156
173
|
const b = m(h);
|
|
157
174
|
if (Math.abs(b) < 1e-6) break;
|
|
158
175
|
h -= w / b;
|
|
159
176
|
}
|
|
160
|
-
let p = 0,
|
|
161
|
-
for (h = (p +
|
|
162
|
-
const
|
|
163
|
-
if (Math.abs(
|
|
164
|
-
d >
|
|
177
|
+
let p = 0, v = 1;
|
|
178
|
+
for (h = (p + v) / 2; v - p > 1e-7; ) {
|
|
179
|
+
const y = a(h);
|
|
180
|
+
if (Math.abs(y - d) < 1e-7) return h;
|
|
181
|
+
d > y ? p = h : v = h, h = (p + v) / 2;
|
|
165
182
|
}
|
|
166
183
|
return h;
|
|
167
184
|
}
|
|
168
|
-
return (d) => d <= 0 ? 0 : d >= 1 ? 1 :
|
|
185
|
+
return (d) => d <= 0 ? 0 : d >= 1 ? 1 : u(g(d));
|
|
169
186
|
}
|
|
170
|
-
function _t(
|
|
171
|
-
const
|
|
187
|
+
function _t(t) {
|
|
188
|
+
const e = t.match(
|
|
172
189
|
/^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
|
|
173
190
|
);
|
|
174
|
-
if (!
|
|
175
|
-
const n = parseFloat(
|
|
191
|
+
if (!e) return;
|
|
192
|
+
const n = parseFloat(e[1]), s = parseFloat(e[2]), r = parseFloat(e[3]), i = parseFloat(e[4]);
|
|
176
193
|
if (![n, s, r, i].some(isNaN))
|
|
177
|
-
return
|
|
194
|
+
return qt(n, s, r, i);
|
|
178
195
|
}
|
|
179
|
-
function xt(
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
182
|
-
const n =
|
|
196
|
+
function xt(t) {
|
|
197
|
+
const e = t.match(/^linear\((.+)\)$/);
|
|
198
|
+
if (!e) return;
|
|
199
|
+
const n = e[1].split(",").map((o) => o.trim()).filter(Boolean);
|
|
183
200
|
if (n.length === 0) return;
|
|
184
201
|
const s = [];
|
|
185
202
|
for (const o of n) {
|
|
186
|
-
const c = o.split(/\s+/),
|
|
187
|
-
if (isNaN(
|
|
203
|
+
const c = o.split(/\s+/), l = parseFloat(c[0]);
|
|
204
|
+
if (isNaN(l)) return;
|
|
188
205
|
const f = [];
|
|
189
206
|
for (let a = 1; a < c.length; a++)
|
|
190
207
|
if (c[a].endsWith("%")) {
|
|
191
|
-
const
|
|
192
|
-
if (isNaN(
|
|
193
|
-
f.push(
|
|
208
|
+
const u = parseFloat(c[a]) / 100;
|
|
209
|
+
if (isNaN(u)) return;
|
|
210
|
+
f.push(u);
|
|
194
211
|
}
|
|
195
|
-
f.length === 0 ? s.push({ output:
|
|
212
|
+
f.length === 0 ? s.push({ output: l, pos: null }) : f.length === 1 ? s.push({ output: l, pos: f[0] }) : (s.push({ output: l, pos: f[0] }), s.push({ output: l, pos: f[1] }));
|
|
196
213
|
}
|
|
197
214
|
if (s.length === 0) return;
|
|
198
215
|
s[0].pos === null && (s[0].pos = 0), s[s.length - 1].pos === null && (s[s.length - 1].pos = 1);
|
|
@@ -202,9 +219,9 @@ function xt(e) {
|
|
|
202
219
|
const o = r - 1;
|
|
203
220
|
let c = r;
|
|
204
221
|
for (; c < s.length && s[c].pos === null; ) c++;
|
|
205
|
-
const
|
|
206
|
-
for (let
|
|
207
|
-
s[
|
|
222
|
+
const l = s[o].pos, f = s[c].pos, a = c - o;
|
|
223
|
+
for (let u = o + 1; u < c; u++)
|
|
224
|
+
s[u].pos = l + (f - l) * (u - o) / a;
|
|
208
225
|
r = c + 1;
|
|
209
226
|
} else
|
|
210
227
|
r++;
|
|
@@ -215,19 +232,19 @@ function xt(e) {
|
|
|
215
232
|
if (o <= i[0].pos) return i[0].output;
|
|
216
233
|
const c = i[i.length - 1];
|
|
217
234
|
if (o >= c.pos) return c.output;
|
|
218
|
-
let
|
|
219
|
-
for (;
|
|
220
|
-
const m =
|
|
221
|
-
i[m].pos <= o ?
|
|
235
|
+
let l = 0, f = i.length - 1;
|
|
236
|
+
for (; l < f - 1; ) {
|
|
237
|
+
const m = l + f >>> 1;
|
|
238
|
+
i[m].pos <= o ? l = m : f = m;
|
|
222
239
|
}
|
|
223
|
-
const a = i[
|
|
224
|
-
return
|
|
240
|
+
const a = i[l], u = i[f];
|
|
241
|
+
return u.pos === a.pos ? u.output : a.output + (u.output - a.output) * (o - a.pos) / (u.pos - a.pos);
|
|
225
242
|
};
|
|
226
243
|
}
|
|
227
|
-
function
|
|
228
|
-
if (!
|
|
229
|
-
const
|
|
230
|
-
return
|
|
244
|
+
function He(t) {
|
|
245
|
+
if (!t) return;
|
|
246
|
+
const e = we[t];
|
|
247
|
+
return e || (_t(t) ?? xt(t) ?? we.linear);
|
|
231
248
|
}
|
|
232
249
|
class Mt extends G {
|
|
233
250
|
animationGroups;
|
|
@@ -235,13 +252,13 @@ class Mt extends G {
|
|
|
235
252
|
offset;
|
|
236
253
|
offsetEasing;
|
|
237
254
|
timingOptions;
|
|
238
|
-
constructor(
|
|
239
|
-
const s =
|
|
240
|
-
super(s), this.animationGroups =
|
|
255
|
+
constructor(e, n = {}) {
|
|
256
|
+
const s = e.flatMap((r) => [...r.animations]);
|
|
257
|
+
super(s), this.animationGroups = e, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : He(n.offsetEasing) ?? Re, this.timingOptions = this.animationGroups.map((r) => r.getTimingOptions().map(({ delay: i, duration: o, iterations: c }) => ({
|
|
241
258
|
delay: i,
|
|
242
259
|
duration: Number.isFinite(o) ? o : 0,
|
|
243
260
|
iterations: Number.isFinite(c) ? c : 1
|
|
244
|
-
}))), this.applyOffsets(), this.ready = Promise.all(
|
|
261
|
+
}))), this.applyOffsets(), this.ready = Promise.all(e.map((r) => r.ready)).then(() => {
|
|
245
262
|
});
|
|
246
263
|
}
|
|
247
264
|
/**
|
|
@@ -250,35 +267,35 @@ class Mt extends G {
|
|
|
250
267
|
* where i is the group index and last is the index of the final group.
|
|
251
268
|
*/
|
|
252
269
|
calculateOffsets() {
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
const n =
|
|
270
|
+
const e = this.animationGroups.length;
|
|
271
|
+
if (e <= 1) return [0];
|
|
272
|
+
const n = e - 1;
|
|
256
273
|
return Array.from(
|
|
257
|
-
{ length:
|
|
274
|
+
{ length: e },
|
|
258
275
|
(s, r) => this.offsetEasing(r / n) * n * this.offset | 0
|
|
259
276
|
);
|
|
260
277
|
}
|
|
261
278
|
applyOffsets() {
|
|
262
279
|
if (this.animationGroups.length === 0 || this.animations.length === 0) return;
|
|
263
|
-
const
|
|
280
|
+
const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
|
|
264
281
|
this.animationGroups.forEach((s, r) => {
|
|
265
282
|
s.animations.forEach((i, o) => {
|
|
266
283
|
const c = i.effect;
|
|
267
284
|
if (!c) return;
|
|
268
|
-
const { delay:
|
|
269
|
-
c.updateTiming({ delay:
|
|
285
|
+
const { delay: l, duration: f, iterations: a } = this.timingOptions[r][o], u = l + e[r], m = n - (u + f * a);
|
|
286
|
+
c.updateTiming({ delay: u + this.delay, endDelay: m });
|
|
270
287
|
});
|
|
271
288
|
});
|
|
272
289
|
}
|
|
273
|
-
getSequenceActiveDuration(
|
|
290
|
+
getSequenceActiveDuration(e) {
|
|
274
291
|
const n = [];
|
|
275
292
|
for (let s = 0; s < this.timingOptions.length; s++) {
|
|
276
293
|
const r = this.timingOptions[s].reduce((i, o) => {
|
|
277
294
|
if (!o) return i;
|
|
278
|
-
const { delay: c, duration:
|
|
279
|
-
return Math.max(i, c +
|
|
295
|
+
const { delay: c, duration: l, iterations: f } = o;
|
|
296
|
+
return Math.max(i, c + l * f);
|
|
280
297
|
}, 0);
|
|
281
|
-
n.push(
|
|
298
|
+
n.push(e[s] + r);
|
|
282
299
|
}
|
|
283
300
|
return Math.max(...n);
|
|
284
301
|
}
|
|
@@ -287,13 +304,13 @@ class Mt extends G {
|
|
|
287
304
|
* stagger offsets for all groups. Each entry specifies the target index
|
|
288
305
|
* in the animationGroups array where the group should be inserted.
|
|
289
306
|
*/
|
|
290
|
-
addGroups(
|
|
291
|
-
if (
|
|
292
|
-
const n = [...
|
|
307
|
+
addGroups(e) {
|
|
308
|
+
if (e.length === 0) return;
|
|
309
|
+
const n = [...e].sort((s, r) => r.index - s.index);
|
|
293
310
|
for (const { index: s, group: r } of n) {
|
|
294
311
|
const i = Math.min(s, this.animationGroups.length);
|
|
295
312
|
this.animationGroups.splice(i, 0, r), this.timingOptions.splice(i, 0, r.getTimingOptions());
|
|
296
|
-
const o = [...r.animations], c = this.animationGroups.slice(0, i).reduce((
|
|
313
|
+
const o = [...r.animations], c = this.animationGroups.slice(0, i).reduce((l, f) => l + f.animations.length, 0);
|
|
297
314
|
this.animations.splice(c, 0, ...o);
|
|
298
315
|
}
|
|
299
316
|
this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((s) => s.ready)).then(() => {
|
|
@@ -304,19 +321,19 @@ class Mt extends G {
|
|
|
304
321
|
* stagger offsets for remaining groups. Cancelled animations in removed
|
|
305
322
|
* groups are returned.
|
|
306
323
|
*/
|
|
307
|
-
removeGroups(
|
|
324
|
+
removeGroups(e) {
|
|
308
325
|
const n = [], s = [], r = [];
|
|
309
326
|
for (let i = 0; i < this.animationGroups.length; i++)
|
|
310
|
-
|
|
327
|
+
e(this.animationGroups[i]) ? n.push(this.animationGroups[i]) : (s.push(this.animationGroups[i]), r.push(this.timingOptions[i]));
|
|
311
328
|
if (n.length === 0) return n;
|
|
312
329
|
for (const i of n)
|
|
313
330
|
i.cancel();
|
|
314
331
|
return this.animationGroups = s, this.timingOptions = r, this.animations = s.flatMap((i) => [...i.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((i) => i.ready)).then(() => {
|
|
315
332
|
}), n;
|
|
316
333
|
}
|
|
317
|
-
async onFinish(
|
|
334
|
+
async onFinish(e) {
|
|
318
335
|
try {
|
|
319
|
-
await Promise.all(this.animationGroups.map((n) => n.finished)),
|
|
336
|
+
await Promise.all(this.animationGroups.map((n) => n.finished)), e();
|
|
320
337
|
} catch (n) {
|
|
321
338
|
console.warn("animation was interrupted - aborting onFinish callback - ", n);
|
|
322
339
|
}
|
|
@@ -328,25 +345,25 @@ class Lt {
|
|
|
328
345
|
progress;
|
|
329
346
|
_tickCbId;
|
|
330
347
|
_finishHandler;
|
|
331
|
-
constructor(
|
|
348
|
+
constructor(e, n, s, r) {
|
|
332
349
|
const i = new KeyframeEffect(n, [], {
|
|
333
350
|
...s,
|
|
334
351
|
composite: "add"
|
|
335
352
|
}), { timeline: o } = r;
|
|
336
|
-
this._animation = new Animation(i, o), this._tickCbId = null, this.progress = null, this.customEffect = (c) =>
|
|
337
|
-
this.effect.target?.getAnimations().find((
|
|
353
|
+
this._animation = new Animation(i, o), this._tickCbId = null, this.progress = null, this.customEffect = (c) => e(i.target, c), this._finishHandler = (c) => {
|
|
354
|
+
this.effect.target?.getAnimations().find((l) => l === this._animation) || this.cancel();
|
|
338
355
|
}, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
|
|
339
356
|
}
|
|
340
357
|
// private tick method for customEffect loop implementation
|
|
341
358
|
_tick() {
|
|
342
359
|
try {
|
|
343
|
-
const
|
|
344
|
-
|
|
360
|
+
const e = this.effect?.getComputedTiming().progress ?? null;
|
|
361
|
+
e !== this.progress && (this.customEffect?.(e), this.progress = e), this._tickCbId = requestAnimationFrame(() => {
|
|
345
362
|
this._tick();
|
|
346
363
|
});
|
|
347
|
-
} catch (
|
|
364
|
+
} catch (e) {
|
|
348
365
|
this._tickCbId = null, console.error(
|
|
349
|
-
`failed to run customEffect! effectId: ${this.id}, error: ${
|
|
366
|
+
`failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error ? e.message : e}`
|
|
350
367
|
);
|
|
351
368
|
}
|
|
352
369
|
}
|
|
@@ -354,39 +371,39 @@ class Lt {
|
|
|
354
371
|
get currentTime() {
|
|
355
372
|
return this._animation.currentTime;
|
|
356
373
|
}
|
|
357
|
-
set currentTime(
|
|
358
|
-
this._animation.currentTime =
|
|
374
|
+
set currentTime(e) {
|
|
375
|
+
this._animation.currentTime = e;
|
|
359
376
|
}
|
|
360
377
|
get startTime() {
|
|
361
378
|
return this._animation.startTime;
|
|
362
379
|
}
|
|
363
|
-
set startTime(
|
|
364
|
-
this._animation.startTime =
|
|
380
|
+
set startTime(e) {
|
|
381
|
+
this._animation.startTime = e;
|
|
365
382
|
}
|
|
366
383
|
get playbackRate() {
|
|
367
384
|
return this._animation.playbackRate;
|
|
368
385
|
}
|
|
369
|
-
set playbackRate(
|
|
370
|
-
this._animation.playbackRate =
|
|
386
|
+
set playbackRate(e) {
|
|
387
|
+
this._animation.playbackRate = e;
|
|
371
388
|
}
|
|
372
389
|
// Animation basic properties
|
|
373
390
|
get id() {
|
|
374
391
|
return this._animation.id;
|
|
375
392
|
}
|
|
376
|
-
set id(
|
|
377
|
-
this._animation.id =
|
|
393
|
+
set id(e) {
|
|
394
|
+
this._animation.id = e;
|
|
378
395
|
}
|
|
379
396
|
get effect() {
|
|
380
397
|
return this._animation.effect;
|
|
381
398
|
}
|
|
382
|
-
set effect(
|
|
383
|
-
this._animation.effect =
|
|
399
|
+
set effect(e) {
|
|
400
|
+
this._animation.effect = e;
|
|
384
401
|
}
|
|
385
402
|
get timeline() {
|
|
386
403
|
return this._animation.timeline;
|
|
387
404
|
}
|
|
388
|
-
set timeline(
|
|
389
|
-
this._animation.timeline =
|
|
405
|
+
set timeline(e) {
|
|
406
|
+
this._animation.timeline = e;
|
|
390
407
|
}
|
|
391
408
|
// Animation readonly state properties
|
|
392
409
|
get finished() {
|
|
@@ -408,20 +425,20 @@ class Lt {
|
|
|
408
425
|
get oncancel() {
|
|
409
426
|
return this._animation.oncancel;
|
|
410
427
|
}
|
|
411
|
-
set oncancel(
|
|
412
|
-
this._animation.oncancel =
|
|
428
|
+
set oncancel(e) {
|
|
429
|
+
this._animation.oncancel = e;
|
|
413
430
|
}
|
|
414
431
|
get onfinish() {
|
|
415
432
|
return this._animation.onfinish;
|
|
416
433
|
}
|
|
417
|
-
set onfinish(
|
|
418
|
-
this._animation.onfinish =
|
|
434
|
+
set onfinish(e) {
|
|
435
|
+
this._animation.onfinish = e;
|
|
419
436
|
}
|
|
420
437
|
get onremove() {
|
|
421
438
|
return this._animation.onremove;
|
|
422
439
|
}
|
|
423
|
-
set onremove(
|
|
424
|
-
this._animation.onremove =
|
|
440
|
+
set onremove(e) {
|
|
441
|
+
this._animation.onremove = e;
|
|
425
442
|
}
|
|
426
443
|
// CustomAnimation overridden methods
|
|
427
444
|
play() {
|
|
@@ -448,34 +465,34 @@ class Lt {
|
|
|
448
465
|
reverse() {
|
|
449
466
|
this._animation.reverse();
|
|
450
467
|
}
|
|
451
|
-
updatePlaybackRate(
|
|
452
|
-
this._animation.updatePlaybackRate(
|
|
468
|
+
updatePlaybackRate(e) {
|
|
469
|
+
this._animation.updatePlaybackRate(e);
|
|
453
470
|
}
|
|
454
471
|
// Animation events API
|
|
455
|
-
addEventListener(
|
|
456
|
-
this._animation.addEventListener(
|
|
472
|
+
addEventListener(e, n, s) {
|
|
473
|
+
this._animation.addEventListener(e, n, s);
|
|
457
474
|
}
|
|
458
|
-
removeEventListener(
|
|
459
|
-
this._animation.removeEventListener(
|
|
475
|
+
removeEventListener(e, n, s) {
|
|
476
|
+
this._animation.removeEventListener(e, n, s);
|
|
460
477
|
}
|
|
461
|
-
dispatchEvent(
|
|
462
|
-
return this._animation.dispatchEvent(
|
|
478
|
+
dispatchEvent(e) {
|
|
479
|
+
return this._animation.dispatchEvent(e);
|
|
463
480
|
}
|
|
464
481
|
}
|
|
465
|
-
function Pt(
|
|
466
|
-
return
|
|
482
|
+
function Pt(t) {
|
|
483
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
467
484
|
}
|
|
468
485
|
var K = { exports: {} }, Se = K.exports, Ie;
|
|
469
486
|
function $t() {
|
|
470
|
-
return Ie || (Ie = 1, (function(
|
|
471
|
-
(function(
|
|
487
|
+
return Ie || (Ie = 1, (function(t) {
|
|
488
|
+
(function(e) {
|
|
472
489
|
var n = function() {
|
|
473
|
-
}, s =
|
|
490
|
+
}, s = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(a) {
|
|
474
491
|
return setTimeout(a, 16);
|
|
475
492
|
};
|
|
476
493
|
function r() {
|
|
477
494
|
var a = this;
|
|
478
|
-
a.reads = [], a.writes = [], a.raf = s.bind(
|
|
495
|
+
a.reads = [], a.writes = [], a.raf = s.bind(e);
|
|
479
496
|
}
|
|
480
497
|
r.prototype = {
|
|
481
498
|
constructor: r,
|
|
@@ -488,7 +505,7 @@ function $t() {
|
|
|
488
505
|
* @param {Array} tasks
|
|
489
506
|
*/
|
|
490
507
|
runTasks: function(a) {
|
|
491
|
-
for (var
|
|
508
|
+
for (var u; u = a.shift(); ) u();
|
|
492
509
|
},
|
|
493
510
|
/**
|
|
494
511
|
* Adds a job to the read batch and
|
|
@@ -498,8 +515,8 @@ function $t() {
|
|
|
498
515
|
* @param {Object} ctx the context to be bound to `fn` (optional).
|
|
499
516
|
* @public
|
|
500
517
|
*/
|
|
501
|
-
measure: function(a,
|
|
502
|
-
var m =
|
|
518
|
+
measure: function(a, u) {
|
|
519
|
+
var m = u ? a.bind(u) : a;
|
|
503
520
|
return this.reads.push(m), i(this), m;
|
|
504
521
|
},
|
|
505
522
|
/**
|
|
@@ -511,8 +528,8 @@ function $t() {
|
|
|
511
528
|
* @param {Object} ctx the context to be bound to `fn` (optional).
|
|
512
529
|
* @public
|
|
513
530
|
*/
|
|
514
|
-
mutate: function(a,
|
|
515
|
-
var m =
|
|
531
|
+
mutate: function(a, u) {
|
|
532
|
+
var m = u ? a.bind(u) : a;
|
|
516
533
|
return this.writes.push(m), i(this), m;
|
|
517
534
|
},
|
|
518
535
|
/**
|
|
@@ -561,8 +578,8 @@ function $t() {
|
|
|
561
578
|
*/
|
|
562
579
|
extend: function(a) {
|
|
563
580
|
if (typeof a != "object") throw new Error("expected object");
|
|
564
|
-
var
|
|
565
|
-
return u
|
|
581
|
+
var u = Object.create(this);
|
|
582
|
+
return l(u, a), u.fastdom = this, u.initialize && u.initialize(), u;
|
|
566
583
|
},
|
|
567
584
|
// override this with a function
|
|
568
585
|
// to prevent Errors in console
|
|
@@ -573,86 +590,86 @@ function $t() {
|
|
|
573
590
|
a.scheduled || (a.scheduled = !0, a.raf(o.bind(null, a)));
|
|
574
591
|
}
|
|
575
592
|
function o(a) {
|
|
576
|
-
var
|
|
593
|
+
var u = a.writes, m = a.reads, g;
|
|
577
594
|
try {
|
|
578
|
-
n("flushing reads", m.length), a.runTasks(m), n("flushing writes",
|
|
595
|
+
n("flushing reads", m.length), a.runTasks(m), n("flushing writes", u.length), a.runTasks(u);
|
|
579
596
|
} catch (d) {
|
|
580
597
|
g = d;
|
|
581
598
|
}
|
|
582
|
-
if (a.scheduled = !1, (m.length ||
|
|
599
|
+
if (a.scheduled = !1, (m.length || u.length) && i(a), g)
|
|
583
600
|
if (n("task errored", g.message), a.catch) a.catch(g);
|
|
584
601
|
else throw g;
|
|
585
602
|
}
|
|
586
|
-
function c(a,
|
|
587
|
-
var m = a.indexOf(
|
|
603
|
+
function c(a, u) {
|
|
604
|
+
var m = a.indexOf(u);
|
|
588
605
|
return !!~m && !!a.splice(m, 1);
|
|
589
606
|
}
|
|
590
|
-
function
|
|
591
|
-
for (var m in
|
|
592
|
-
|
|
607
|
+
function l(a, u) {
|
|
608
|
+
for (var m in u)
|
|
609
|
+
u.hasOwnProperty(m) && (a[m] = u[m]);
|
|
593
610
|
}
|
|
594
|
-
var f =
|
|
595
|
-
|
|
611
|
+
var f = e.fastdom = e.fastdom || new r();
|
|
612
|
+
t.exports = f;
|
|
596
613
|
})(typeof window < "u" ? window : typeof Se < "u" ? Se : globalThis);
|
|
597
614
|
})(K)), K.exports;
|
|
598
615
|
}
|
|
599
616
|
var Ft = $t();
|
|
600
617
|
const T = /* @__PURE__ */ Pt(Ft), fe = {};
|
|
601
|
-
function Rt(
|
|
602
|
-
Object.assign(fe,
|
|
618
|
+
function Rt(t) {
|
|
619
|
+
Object.assign(fe, t);
|
|
603
620
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
606
|
-
`${
|
|
621
|
+
function Ht(t) {
|
|
622
|
+
return t in fe ? fe[t] : (console.warn(
|
|
623
|
+
`${t} not found in registry. Please make sure to import and register the preset.`
|
|
607
624
|
), null);
|
|
608
625
|
}
|
|
609
|
-
function M(
|
|
610
|
-
return
|
|
626
|
+
function M(t, e) {
|
|
627
|
+
return t ? document.getElementById(t) : null;
|
|
611
628
|
}
|
|
612
|
-
function
|
|
613
|
-
return
|
|
629
|
+
function zt(t, e) {
|
|
630
|
+
return t?.matches(`[data-motion-part~="${e}"]`) ? t : t?.querySelector(`[data-motion-part~="${e}"]`);
|
|
614
631
|
}
|
|
615
|
-
function Gt(
|
|
616
|
-
const
|
|
617
|
-
return
|
|
632
|
+
function Gt(t) {
|
|
633
|
+
const e = t.alternate ? "alternate" : "";
|
|
634
|
+
return t.reversed ? `${e ? `${e}-` : ""}reverse` : e || "normal";
|
|
618
635
|
}
|
|
619
|
-
function re(
|
|
620
|
-
return `${
|
|
636
|
+
function re(t) {
|
|
637
|
+
return `${t.value}${At(t.unit)}`;
|
|
621
638
|
}
|
|
622
|
-
function Te(
|
|
623
|
-
return `${
|
|
639
|
+
function Te(t, e, n) {
|
|
640
|
+
return `${t.name || "cover"} ${n && t.offset.unit !== "percentage" ? `calc(100% + ${re(t.offset)}${e ? ` + ${e}` : ""})` : e ? `calc(${re(t.offset)} + ${e})` : re(t.offset)}`;
|
|
624
641
|
}
|
|
625
|
-
function
|
|
642
|
+
function Dt(t) {
|
|
626
643
|
return {
|
|
627
|
-
start: Te(
|
|
628
|
-
end: Te(
|
|
644
|
+
start: Te(t.startOffset, t.startOffsetAdd),
|
|
645
|
+
end: Te(t.endOffset, t.endOffsetAdd, !0)
|
|
629
646
|
};
|
|
630
647
|
}
|
|
631
|
-
function
|
|
632
|
-
return (
|
|
648
|
+
function ze(t) {
|
|
649
|
+
return (e) => T.measure(() => e(t));
|
|
633
650
|
}
|
|
634
|
-
function Ge(
|
|
635
|
-
return (
|
|
651
|
+
function Ge(t) {
|
|
652
|
+
return (e) => T.mutate(() => e(t));
|
|
636
653
|
}
|
|
637
|
-
function Z(
|
|
638
|
-
if (
|
|
639
|
-
const
|
|
640
|
-
return typeof
|
|
641
|
-
} else if (
|
|
642
|
-
const
|
|
654
|
+
function Z(t) {
|
|
655
|
+
if (t.namedEffect) {
|
|
656
|
+
const e = t.namedEffect.type;
|
|
657
|
+
return typeof e == "string" ? Ht(e) : null;
|
|
658
|
+
} else if (t.keyframeEffect) {
|
|
659
|
+
const e = (s) => {
|
|
643
660
|
const { name: r, keyframes: i } = s.keyframeEffect;
|
|
644
661
|
return [{ ...s, name: r, keyframes: i }];
|
|
645
662
|
};
|
|
646
|
-
return { web:
|
|
663
|
+
return { web: e, style: e, getNames: (s) => {
|
|
647
664
|
const { effectId: r } = s, { name: i } = s.keyframeEffect, o = i || r;
|
|
648
665
|
return o ? [o] : [];
|
|
649
666
|
} };
|
|
650
|
-
} else if (
|
|
651
|
-
return (
|
|
667
|
+
} else if (t.customEffect)
|
|
668
|
+
return (e) => [{ ...e, keyframes: [] }];
|
|
652
669
|
return null;
|
|
653
670
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
671
|
+
function Nt(t, e, n) {
|
|
672
|
+
return t.map((s, r) => {
|
|
656
673
|
const i = {
|
|
657
674
|
fill: s.fill,
|
|
658
675
|
easing: B(s.easing),
|
|
@@ -660,7 +677,7 @@ function Dt(e, t, n) {
|
|
|
660
677
|
composite: s.composite,
|
|
661
678
|
direction: Gt(s)
|
|
662
679
|
};
|
|
663
|
-
return
|
|
680
|
+
return De(e) ? (i.duration = s.duration, i.delay = s.delay || 0) : window.ViewTimeline && e?.trigger === "view-progress" ? i.duration = "auto" : (i.duration = 99.99, i.delay = 0.01), {
|
|
664
681
|
effect: s,
|
|
665
682
|
options: i,
|
|
666
683
|
id: n && `${n}-${r + 1}`,
|
|
@@ -668,74 +685,74 @@ function Dt(e, t, n) {
|
|
|
668
685
|
};
|
|
669
686
|
});
|
|
670
687
|
}
|
|
671
|
-
function
|
|
672
|
-
return !
|
|
688
|
+
function De(t) {
|
|
689
|
+
return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
|
|
673
690
|
}
|
|
674
|
-
function Oe(
|
|
675
|
-
if (
|
|
676
|
-
if (
|
|
677
|
-
if (
|
|
678
|
-
|
|
691
|
+
function Oe(t, e, n, s, r) {
|
|
692
|
+
if (t) {
|
|
693
|
+
if (De(s) && (e.duration = e.duration || 1, r?.reducedMotion))
|
|
694
|
+
if (e.iterations === 1 || e.iterations == null)
|
|
695
|
+
e = { ...e, duration: 1 };
|
|
679
696
|
else
|
|
680
697
|
return [];
|
|
681
698
|
let i;
|
|
682
|
-
return n instanceof HTMLElement && (i = { measure:
|
|
699
|
+
return n instanceof HTMLElement && (i = { measure: ze(n), mutate: Ge(n) }), t.web ? t.web(e, i, r) : t(e, i, r);
|
|
683
700
|
}
|
|
684
701
|
return [];
|
|
685
702
|
}
|
|
686
|
-
function ve(
|
|
687
|
-
const i =
|
|
688
|
-
if (n?.trigger === "pointer-move" && !
|
|
689
|
-
let m =
|
|
690
|
-
|
|
691
|
-
...
|
|
703
|
+
function ve(t, e, n, s, r) {
|
|
704
|
+
const i = t instanceof HTMLElement ? t : M(t);
|
|
705
|
+
if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
|
|
706
|
+
let m = e;
|
|
707
|
+
e.customEffect && (m = {
|
|
708
|
+
...e,
|
|
692
709
|
namedEffect: { id: "", type: "CustomMouse" }
|
|
693
710
|
});
|
|
694
711
|
const g = Z(
|
|
695
712
|
m
|
|
696
713
|
), d = Oe(
|
|
697
714
|
g,
|
|
698
|
-
|
|
715
|
+
e,
|
|
699
716
|
i,
|
|
700
717
|
n,
|
|
701
718
|
s
|
|
702
719
|
);
|
|
703
720
|
return typeof d != "function" ? null : d(i);
|
|
704
721
|
}
|
|
705
|
-
const o = Z(
|
|
722
|
+
const o = Z(e), c = Oe(
|
|
706
723
|
o,
|
|
707
|
-
|
|
724
|
+
e,
|
|
708
725
|
i,
|
|
709
726
|
n,
|
|
710
727
|
s
|
|
711
728
|
);
|
|
712
729
|
if (!c || c.length === 0)
|
|
713
730
|
return null;
|
|
714
|
-
const
|
|
731
|
+
const l = Nt(c, n, e.effectId);
|
|
715
732
|
let f;
|
|
716
733
|
const a = n?.trigger === "view-progress";
|
|
717
734
|
a && window.ViewTimeline && (f = new ViewTimeline({
|
|
718
735
|
subject: n.element || M(n.componentId)
|
|
719
736
|
}));
|
|
720
|
-
const
|
|
721
|
-
const p = h ?
|
|
737
|
+
const u = l.map(({ effect: m, options: g, id: d, part: h }) => {
|
|
738
|
+
const p = h ? zt(i, h) : i, v = new KeyframeEffect(p || null, [], g);
|
|
722
739
|
T.mutate(() => {
|
|
723
|
-
"timing" in m &&
|
|
740
|
+
"timing" in m && v.updateTiming(m.timing), v.setKeyframes(m.keyframes);
|
|
724
741
|
});
|
|
725
|
-
const
|
|
742
|
+
const y = a && f ? { timeline: f } : {}, w = typeof m.customEffect == "function" ? new Lt(
|
|
726
743
|
m.customEffect,
|
|
727
744
|
p || null,
|
|
728
745
|
g,
|
|
729
|
-
|
|
730
|
-
) : new Animation(
|
|
746
|
+
y
|
|
747
|
+
) : new Animation(v, y.timeline);
|
|
731
748
|
if (a)
|
|
732
749
|
if (f)
|
|
733
750
|
T.mutate(() => {
|
|
734
|
-
const { start: b, end: S } =
|
|
751
|
+
const { start: b, end: S } = Dt(m);
|
|
735
752
|
w.rangeStart = b, w.rangeEnd = S, w.play();
|
|
736
753
|
});
|
|
737
754
|
else {
|
|
738
|
-
const { startOffset: b, endOffset: S } =
|
|
755
|
+
const { startOffset: b, endOffset: S } = e;
|
|
739
756
|
T.mutate(() => {
|
|
740
757
|
const I = m.startOffset || b, $ = m.endOffset || S;
|
|
741
758
|
Object.assign(w, {
|
|
@@ -754,56 +771,56 @@ function ve(e, t, n, s, r) {
|
|
|
754
771
|
}
|
|
755
772
|
return d && (w.id = d), w;
|
|
756
773
|
});
|
|
757
|
-
return new G(
|
|
758
|
-
...
|
|
774
|
+
return new G(u, {
|
|
775
|
+
...e,
|
|
759
776
|
trigger: { ...n || {} },
|
|
760
777
|
// make sure the group is ready after all animation targets are measured and mutated
|
|
761
778
|
measured: new Promise((m) => T.mutate(m))
|
|
762
779
|
});
|
|
763
780
|
}
|
|
764
|
-
function Vt(
|
|
765
|
-
const s = Z(
|
|
781
|
+
function Vt(t, e, n) {
|
|
782
|
+
const s = Z(e), r = t instanceof HTMLElement ? t : M(t);
|
|
766
783
|
if (s && s.prepare && r) {
|
|
767
|
-
const i = { measure:
|
|
768
|
-
s.prepare(
|
|
784
|
+
const i = { measure: ze(r), mutate: Ge(r) };
|
|
785
|
+
s.prepare(e, i);
|
|
769
786
|
}
|
|
770
787
|
n && T.mutate(n);
|
|
771
788
|
}
|
|
772
|
-
function Wt(
|
|
773
|
-
const n = Z(
|
|
789
|
+
function Wt(t, e) {
|
|
790
|
+
const n = Z(e);
|
|
774
791
|
if (!n)
|
|
775
792
|
return null;
|
|
776
793
|
if (!n.style)
|
|
777
|
-
return
|
|
778
|
-
const s = n.getNames(
|
|
779
|
-
return s.forEach((
|
|
780
|
-
o.includes(
|
|
781
|
-
i?.find((f) => f.animationName ===
|
|
794
|
+
return e.effectId && t ? jt(t, e.effectId) : null;
|
|
795
|
+
const s = n.getNames(e), i = (typeof t == "string" ? M(t) : t)?.getAnimations(), o = i?.map((l) => l.animationName) || [], c = [];
|
|
796
|
+
return s.forEach((l) => {
|
|
797
|
+
o.includes(l) && c.push(
|
|
798
|
+
i?.find((f) => f.animationName === l)
|
|
782
799
|
);
|
|
783
800
|
}), c?.length ? new G(c) : null;
|
|
784
801
|
}
|
|
785
|
-
function jt(
|
|
786
|
-
const s = (typeof
|
|
802
|
+
function jt(t, e) {
|
|
803
|
+
const s = (typeof t == "string" ? M(t) : t)?.getAnimations().filter((r) => {
|
|
787
804
|
const i = r.id || r.animationName;
|
|
788
|
-
return i ? i.startsWith(
|
|
805
|
+
return i ? i.startsWith(e) : !0;
|
|
789
806
|
});
|
|
790
807
|
return s?.length ? new G(s) : null;
|
|
791
808
|
}
|
|
792
|
-
function
|
|
793
|
-
const { disabled: r, allowActiveEvent: i, ...o } = s, c = ve(
|
|
809
|
+
function Ne(t, e, n, s = {}) {
|
|
810
|
+
const { disabled: r, allowActiveEvent: i, ...o } = s, c = ve(t, e, n, o);
|
|
794
811
|
if (!c)
|
|
795
812
|
return null;
|
|
796
|
-
let
|
|
813
|
+
let l = {};
|
|
797
814
|
if (n.trigger === "view-progress" && !window.ViewTimeline) {
|
|
798
815
|
const f = n.element || M(n.componentId), { ready: a } = c;
|
|
799
|
-
return c.animations.map((
|
|
816
|
+
return c.animations.map((u) => ({
|
|
800
817
|
/* we use getters for start and end in order to access the animation's start and end
|
|
801
818
|
only when initializing the scrub scene rather than immediately */
|
|
802
819
|
get start() {
|
|
803
|
-
return
|
|
820
|
+
return u.start;
|
|
804
821
|
},
|
|
805
822
|
get end() {
|
|
806
|
-
return
|
|
823
|
+
return u.end;
|
|
807
824
|
},
|
|
808
825
|
viewSource: f,
|
|
809
826
|
ready: a,
|
|
@@ -811,16 +828,16 @@ function De(e, t, n, s = {}) {
|
|
|
811
828
|
return c.getProgress();
|
|
812
829
|
},
|
|
813
830
|
effect(m, g) {
|
|
814
|
-
const { activeDuration: d } =
|
|
815
|
-
|
|
831
|
+
const { activeDuration: d } = u.effect.getComputedTiming(), { delay: h } = u.effect.getTiming();
|
|
832
|
+
u.currentTime = ((h || 0) + (d || 0)) * g;
|
|
816
833
|
},
|
|
817
834
|
disabled: r,
|
|
818
835
|
destroy() {
|
|
819
|
-
|
|
836
|
+
u.cancel();
|
|
820
837
|
}
|
|
821
838
|
}));
|
|
822
839
|
} else if (n.trigger === "pointer-move") {
|
|
823
|
-
const f =
|
|
840
|
+
const f = e, { centeredToTarget: a, transitionDuration: u, transitionEasing: m } = f, g = n.axis;
|
|
824
841
|
if (f.keyframeEffect) {
|
|
825
842
|
const d = c;
|
|
826
843
|
return d.animations?.length === 0 ? null : {
|
|
@@ -831,9 +848,9 @@ function De(e, t, n, s = {}) {
|
|
|
831
848
|
getProgress() {
|
|
832
849
|
return this._currentProgress;
|
|
833
850
|
},
|
|
834
|
-
effect(p,
|
|
835
|
-
const
|
|
836
|
-
this._currentProgress =
|
|
851
|
+
effect(p, v) {
|
|
852
|
+
const y = g === "x" ? v.x : v.y;
|
|
853
|
+
this._currentProgress = y, d.progress(y);
|
|
837
854
|
},
|
|
838
855
|
disabled: r ?? !1,
|
|
839
856
|
destroy() {
|
|
@@ -841,22 +858,22 @@ function De(e, t, n, s = {}) {
|
|
|
841
858
|
}
|
|
842
859
|
};
|
|
843
860
|
}
|
|
844
|
-
|
|
861
|
+
l = {
|
|
845
862
|
centeredToTarget: a,
|
|
846
863
|
allowActiveEvent: i
|
|
847
|
-
},
|
|
864
|
+
}, e.customEffect && u && (l.transitionDuration = u, l.transitionEasing = He(m)), l.target = c.target;
|
|
848
865
|
}
|
|
849
866
|
return {
|
|
850
|
-
...
|
|
867
|
+
...l,
|
|
851
868
|
getProgress() {
|
|
852
869
|
return c.getProgress();
|
|
853
870
|
},
|
|
854
|
-
effect(f, a,
|
|
871
|
+
effect(f, a, u, m) {
|
|
855
872
|
c.progress(
|
|
856
|
-
|
|
873
|
+
u ? {
|
|
857
874
|
// @ts-expect-error spread error on p
|
|
858
875
|
...a,
|
|
859
|
-
v:
|
|
876
|
+
v: u,
|
|
860
877
|
active: m
|
|
861
878
|
} : a
|
|
862
879
|
);
|
|
@@ -867,50 +884,50 @@ function De(e, t, n, s = {}) {
|
|
|
867
884
|
}
|
|
868
885
|
};
|
|
869
886
|
}
|
|
870
|
-
function ne(
|
|
871
|
-
const r = Wt(
|
|
887
|
+
function ne(t, e, n, s = !1) {
|
|
888
|
+
const r = Wt(t, e);
|
|
872
889
|
return r ? (r.ready = new Promise((i) => {
|
|
873
|
-
Vt(
|
|
874
|
-
}), r) : ve(
|
|
890
|
+
Vt(t, e, i);
|
|
891
|
+
}), r) : ve(t, e, n, { reducedMotion: s });
|
|
875
892
|
}
|
|
876
|
-
function Yt(
|
|
877
|
-
return
|
|
893
|
+
function Yt(t) {
|
|
894
|
+
return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
|
|
878
895
|
}
|
|
879
|
-
function Ve(
|
|
896
|
+
function Ve(t, e) {
|
|
880
897
|
const n = [];
|
|
881
|
-
for (const { target: s, options: r } of
|
|
898
|
+
for (const { target: s, options: r } of t) {
|
|
882
899
|
const i = Yt(s);
|
|
883
900
|
for (const o of i) {
|
|
884
901
|
const c = ne(
|
|
885
902
|
o,
|
|
886
903
|
r,
|
|
887
904
|
void 0,
|
|
888
|
-
|
|
905
|
+
e?.reducedMotion
|
|
889
906
|
);
|
|
890
907
|
c instanceof G && n.push(c);
|
|
891
908
|
}
|
|
892
909
|
}
|
|
893
910
|
return n;
|
|
894
911
|
}
|
|
895
|
-
function Bt(
|
|
896
|
-
const s = Ve(
|
|
897
|
-
return new Mt(s,
|
|
912
|
+
function Bt(t, e, n) {
|
|
913
|
+
const s = Ve(e, n);
|
|
914
|
+
return new Mt(s, t);
|
|
898
915
|
}
|
|
899
|
-
function Q(
|
|
900
|
-
return
|
|
916
|
+
function Q(t, e) {
|
|
917
|
+
return e.includes("&") ? e.replace(/&/g, t) : `${t}${e}`;
|
|
901
918
|
}
|
|
902
919
|
function _() {
|
|
903
920
|
return "wi-12343210".replace(
|
|
904
921
|
/\d/g,
|
|
905
|
-
(
|
|
906
|
-
(+
|
|
922
|
+
(t) => String.fromCharCode(
|
|
923
|
+
(+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4) + 97
|
|
907
924
|
)
|
|
908
925
|
// 97 for "a"
|
|
909
926
|
);
|
|
910
927
|
}
|
|
911
928
|
function Kt({
|
|
912
|
-
key:
|
|
913
|
-
effectId:
|
|
929
|
+
key: t,
|
|
930
|
+
effectId: e,
|
|
914
931
|
transition: n,
|
|
915
932
|
properties: s,
|
|
916
933
|
childSelector: r = "> :first-child",
|
|
@@ -920,12 +937,12 @@ function Kt({
|
|
|
920
937
|
if (n?.styleProperties) {
|
|
921
938
|
const { duration: d, easing: h, delay: p } = n;
|
|
922
939
|
d && (n.styleProperties.some(
|
|
923
|
-
(
|
|
940
|
+
(y) => y.name.startsWith("--")
|
|
924
941
|
) ? o = [
|
|
925
942
|
`all ${d}ms ${B(h || "ease")}${p ? ` ${p}ms` : ""}`,
|
|
926
943
|
"visibility 0s"
|
|
927
944
|
] : o = n.styleProperties.map(
|
|
928
|
-
(
|
|
945
|
+
(y) => `${y.name} ${d}ms ${B(
|
|
929
946
|
h || "ease"
|
|
930
947
|
)}${p ? ` ${p}ms` : ""}`
|
|
931
948
|
)), s = n.styleProperties;
|
|
@@ -933,53 +950,53 @@ function Kt({
|
|
|
933
950
|
o = s?.filter((d) => d.duration).map(
|
|
934
951
|
(d) => `${d.name} ${d.duration}ms ${B(d.easing) || "ease"}${d.delay ? ` ${d.delay}ms` : ""}`
|
|
935
952
|
) || [];
|
|
936
|
-
const c = s?.map((d) => `${d.name}: ${d.value};`) || [],
|
|
937
|
-
`${
|
|
953
|
+
const c = s?.map((d) => `${d.name}: ${d.value};`) || [], l = t.replace(/"/g, "'"), f = `:is(:state(${e}), :--${e}) ${r}`, a = `[data-interact-effect~="${e}"] ${r}`, u = i ? Q(f, i) : f, m = i ? Q(a, i) : a, g = [
|
|
954
|
+
`${u},
|
|
938
955
|
${m} {
|
|
939
956
|
${c.join(`
|
|
940
957
|
`)}
|
|
941
958
|
}`
|
|
942
959
|
];
|
|
943
960
|
if (o.length) {
|
|
944
|
-
const d = `[data-interact-key="${
|
|
961
|
+
const d = `[data-interact-key="${l}"] ${r}`, h = i ? Q(d, i) : d;
|
|
945
962
|
g.push(`@media (prefers-reduced-motion: no-preference) { ${h} {
|
|
946
963
|
transition: ${o.join(", ")};
|
|
947
964
|
} }`);
|
|
948
965
|
}
|
|
949
966
|
return g;
|
|
950
967
|
}
|
|
951
|
-
function k(
|
|
952
|
-
const n = (
|
|
968
|
+
function k(t, e) {
|
|
969
|
+
const n = (t || []).filter((i) => e[i]?.type === "media" && e[i].predicate).map((i) => e[i].predicate).join(") and ("), s = n && `(${n})`;
|
|
953
970
|
return s && window.matchMedia(s);
|
|
954
971
|
}
|
|
955
|
-
function L(
|
|
956
|
-
for (const n of
|
|
957
|
-
const s =
|
|
972
|
+
function L(t, e) {
|
|
973
|
+
for (const n of t || []) {
|
|
974
|
+
const s = e[n];
|
|
958
975
|
if (s?.type === "selector" && s.predicate)
|
|
959
976
|
return s.predicate;
|
|
960
977
|
}
|
|
961
978
|
}
|
|
962
|
-
const
|
|
979
|
+
const N = {
|
|
963
980
|
rangeStart: { name: "cover", offset: { value: 0, unit: "percentage" } },
|
|
964
981
|
rangeEnd: { name: "cover", offset: { value: 100, unit: "percentage" } }
|
|
965
982
|
};
|
|
966
|
-
function Qt(
|
|
967
|
-
const n =
|
|
983
|
+
function Qt(t, e) {
|
|
984
|
+
const n = t?.name ?? N.rangeStart.name, s = e?.name ?? t?.name ?? N.rangeEnd.name, r = {
|
|
968
985
|
name: n,
|
|
969
|
-
offset:
|
|
986
|
+
offset: t?.offset || N.rangeStart.offset
|
|
970
987
|
}, i = {
|
|
971
988
|
name: s,
|
|
972
|
-
offset:
|
|
989
|
+
offset: e?.offset || N.rangeEnd.offset
|
|
973
990
|
};
|
|
974
991
|
return { startOffset: r, endOffset: i };
|
|
975
992
|
}
|
|
976
|
-
function P(
|
|
977
|
-
if ("keyframeEffect" in
|
|
993
|
+
function P(t) {
|
|
994
|
+
if ("keyframeEffect" in t && !t.keyframeEffect.name && "effectId" in t && (t.keyframeEffect.name = t.effectId), "duration" in t)
|
|
978
995
|
return {
|
|
979
996
|
id: "",
|
|
980
|
-
...
|
|
997
|
+
...t
|
|
981
998
|
};
|
|
982
|
-
const { rangeStart:
|
|
999
|
+
const { rangeStart: e, rangeEnd: n, ...s } = t, { startOffset: r, endOffset: i } = Qt(e, n);
|
|
983
1000
|
return {
|
|
984
1001
|
id: "",
|
|
985
1002
|
startOffset: r,
|
|
@@ -987,17 +1004,17 @@ function P(e) {
|
|
|
987
1004
|
...s
|
|
988
1005
|
};
|
|
989
1006
|
}
|
|
990
|
-
function O(
|
|
991
|
-
let s =
|
|
992
|
-
s || (s = /* @__PURE__ */ new Set(),
|
|
1007
|
+
function O(t, e, n) {
|
|
1008
|
+
let s = t.get(e);
|
|
1009
|
+
s || (s = /* @__PURE__ */ new Set(), t.set(e, s)), s.add(n);
|
|
993
1010
|
}
|
|
994
|
-
function
|
|
995
|
-
|
|
1011
|
+
function D(t, e) {
|
|
1012
|
+
t.get(e)?.forEach((s) => {
|
|
996
1013
|
const { source: r, target: i, cleanup: o } = s;
|
|
997
1014
|
o();
|
|
998
|
-
const c = r ===
|
|
999
|
-
|
|
1000
|
-
}),
|
|
1015
|
+
const c = r === e ? i : r;
|
|
1016
|
+
t.get(c)?.delete(s);
|
|
1017
|
+
}), t.delete(e);
|
|
1001
1018
|
}
|
|
1002
1019
|
const Xt = {
|
|
1003
1020
|
root: null,
|
|
@@ -1007,58 +1024,63 @@ const Xt = {
|
|
|
1007
1024
|
root: null,
|
|
1008
1025
|
rootMargin: "0px",
|
|
1009
1026
|
threshold: [0]
|
|
1010
|
-
},
|
|
1027
|
+
}, Jt = 0.2;
|
|
1028
|
+
function Zt(t) {
|
|
1029
|
+
const e = t.trim().split(/\s+/), n = e[0], s = e.length > 1 ? e[1] : e[0], r = (i) => i.startsWith("-") ? i.slice(1) : parseFloat(i) ? `-${i}` : i;
|
|
1030
|
+
return `${r(n)} 0px ${r(s)}`;
|
|
1031
|
+
}
|
|
1032
|
+
const H = {}, ee = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), U = /* @__PURE__ */ new WeakMap();
|
|
1011
1033
|
let We = {}, F = null;
|
|
1012
|
-
function
|
|
1013
|
-
We =
|
|
1034
|
+
function en(t) {
|
|
1035
|
+
We = t;
|
|
1014
1036
|
}
|
|
1015
|
-
function je(
|
|
1016
|
-
ee.get(
|
|
1017
|
-
s ===
|
|
1037
|
+
function je(t, e) {
|
|
1038
|
+
ee.get(t)?.forEach(({ source: s, handler: r }) => {
|
|
1039
|
+
s === t && r(e);
|
|
1018
1040
|
});
|
|
1019
1041
|
}
|
|
1020
1042
|
function Ce() {
|
|
1021
|
-
return F || (F = new IntersectionObserver((
|
|
1022
|
-
|
|
1023
|
-
const n =
|
|
1024
|
-
|
|
1043
|
+
return F || (F = new IntersectionObserver((t) => {
|
|
1044
|
+
t.forEach((e) => {
|
|
1045
|
+
const n = e.target;
|
|
1046
|
+
e.isIntersecting || je(n, !1);
|
|
1025
1047
|
});
|
|
1026
1048
|
}, Ut), F);
|
|
1027
1049
|
}
|
|
1028
|
-
function Ye(
|
|
1029
|
-
const n = JSON.stringify({ ...
|
|
1030
|
-
if (
|
|
1031
|
-
return
|
|
1032
|
-
const s = t ? Xt : {
|
|
1050
|
+
function Ye(t, e = !1) {
|
|
1051
|
+
const n = JSON.stringify({ ...t, isSafeMode: e });
|
|
1052
|
+
if (H[n])
|
|
1053
|
+
return H[n];
|
|
1054
|
+
const s = t.threshold ?? Jt, r = e ? Xt : {
|
|
1033
1055
|
root: null,
|
|
1034
|
-
rootMargin:
|
|
1035
|
-
threshold:
|
|
1036
|
-
},
|
|
1037
|
-
|
|
1038
|
-
const
|
|
1039
|
-
if (
|
|
1056
|
+
rootMargin: t.inset ? Zt(t.inset) : "0px",
|
|
1057
|
+
threshold: s
|
|
1058
|
+
}, i = new IntersectionObserver((o) => {
|
|
1059
|
+
o.forEach((c) => {
|
|
1060
|
+
const l = c.target, f = !X.has(l);
|
|
1061
|
+
if (f && (X.add(l), t.useSafeViewEnter && !c.isIntersecting)) {
|
|
1040
1062
|
T.measure(() => {
|
|
1041
|
-
const
|
|
1042
|
-
if (!
|
|
1063
|
+
const u = c.boundingClientRect.height, m = c.rootBounds?.height;
|
|
1064
|
+
if (!m)
|
|
1043
1065
|
return;
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
U.set(
|
|
1066
|
+
const g = Array.isArray(t.threshold) ? Math.min(...t.threshold) : t.threshold;
|
|
1067
|
+
g && u * g > m && T.mutate(() => {
|
|
1068
|
+
i.unobserve(l);
|
|
1069
|
+
const h = Ye(t, !0);
|
|
1070
|
+
U.set(l, h), h.observe(l);
|
|
1049
1071
|
});
|
|
1050
1072
|
});
|
|
1051
1073
|
return;
|
|
1052
1074
|
}
|
|
1053
|
-
const
|
|
1054
|
-
(
|
|
1075
|
+
const a = t.type || "once";
|
|
1076
|
+
(c.isIntersecting || a === "alternate" && !f) && (je(l, c.isIntersecting), a === "once" && (i.unobserve(c.target), X.delete(l)));
|
|
1055
1077
|
});
|
|
1056
|
-
},
|
|
1057
|
-
return
|
|
1078
|
+
}, r);
|
|
1079
|
+
return H[n] = i, i;
|
|
1058
1080
|
}
|
|
1059
|
-
function
|
|
1060
|
-
const c = { ...We, ...s },
|
|
1061
|
-
|
|
1081
|
+
function tn(t, e, n, s = {}, { reducedMotion: r, selectorCondition: i, animation: o } = {}) {
|
|
1082
|
+
const c = { ...We, ...s }, l = c.type || "once", f = o || ne(
|
|
1083
|
+
e,
|
|
1062
1084
|
P(n),
|
|
1063
1085
|
void 0,
|
|
1064
1086
|
r
|
|
@@ -1066,166 +1088,171 @@ function Zt(e, t, n, s = {}, { reducedMotion: r, selectorCondition: i, animation
|
|
|
1066
1088
|
if (!f)
|
|
1067
1089
|
return;
|
|
1068
1090
|
const a = Ye(c);
|
|
1069
|
-
|
|
1070
|
-
let
|
|
1071
|
-
const d = { source:
|
|
1072
|
-
i && !
|
|
1091
|
+
l !== "once" && f.persist?.();
|
|
1092
|
+
let u = !0;
|
|
1093
|
+
const d = { source: t, target: e, handler: (h) => {
|
|
1094
|
+
i && !e.matches(i) || (l === "once" ? h && f.play(() => {
|
|
1073
1095
|
const p = () => {
|
|
1074
|
-
|
|
1096
|
+
e.dataset.interactEnter = "start";
|
|
1075
1097
|
};
|
|
1076
|
-
f.isCSS
|
|
1077
|
-
requestAnimationFrame(p);
|
|
1078
|
-
}), f.onFinish(() => {
|
|
1098
|
+
if (f.isCSS) {
|
|
1079
1099
|
T.mutate(() => {
|
|
1080
|
-
|
|
1100
|
+
requestAnimationFrame(p);
|
|
1081
1101
|
});
|
|
1082
|
-
|
|
1083
|
-
|
|
1102
|
+
const v = () => {
|
|
1103
|
+
T.mutate(() => {
|
|
1104
|
+
e.dataset.interactEnter = "done";
|
|
1105
|
+
});
|
|
1106
|
+
};
|
|
1107
|
+
f.onFinish(v), f.onAbort(v);
|
|
1108
|
+
} else
|
|
1109
|
+
T.mutate(p);
|
|
1110
|
+
}) : l === "alternate" ? u && h ? (u = !1, f.play()) : u || f.reverse() : l === "repeat" ? h ? (f.progress(0), f.play()) : (f.pause(), f.progress(0)) : l === "state" && (h ? f.play() : f.pause()));
|
|
1084
1111
|
}, cleanup: () => {
|
|
1085
|
-
(U.get(
|
|
1112
|
+
(U.get(t) || a).unobserve(t), (l === "repeat" || l === "state") && Ce().unobserve(t), f.cancel(), X.delete(t), U.delete(t);
|
|
1086
1113
|
} };
|
|
1087
|
-
O(ee,
|
|
1114
|
+
O(ee, t, d), O(ee, e, d), U.set(t, a), a.observe(t), (l === "repeat" || l === "state") && Ce().observe(t);
|
|
1088
1115
|
}
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1116
|
+
function nn(t) {
|
|
1117
|
+
D(ee, t);
|
|
1091
1118
|
}
|
|
1092
|
-
function
|
|
1093
|
-
F = null, Object.keys(
|
|
1119
|
+
function sn() {
|
|
1120
|
+
F = null, Object.keys(H).forEach((t) => delete H[t]);
|
|
1094
1121
|
}
|
|
1095
1122
|
const ke = {
|
|
1096
|
-
add:
|
|
1097
|
-
remove:
|
|
1098
|
-
setOptions:
|
|
1099
|
-
reset:
|
|
1123
|
+
add: tn,
|
|
1124
|
+
remove: nn,
|
|
1125
|
+
setOptions: en,
|
|
1126
|
+
reset: sn
|
|
1100
1127
|
};
|
|
1101
|
-
function Be(
|
|
1102
|
-
return Object.assign(Object.create(
|
|
1128
|
+
function Be(t, e) {
|
|
1129
|
+
return Object.assign(Object.create(e), t);
|
|
1103
1130
|
}
|
|
1104
|
-
function
|
|
1105
|
-
let r =
|
|
1131
|
+
function rn(t, e, n, s) {
|
|
1132
|
+
let r = t * (1 - n) + e * n;
|
|
1106
1133
|
if (s) {
|
|
1107
|
-
const i = r -
|
|
1108
|
-
Math.abs(i) < s && (r =
|
|
1109
|
-
const o =
|
|
1134
|
+
const i = r - t;
|
|
1135
|
+
Math.abs(i) < s && (r = t + s * Math.sign(i));
|
|
1136
|
+
const o = e - r;
|
|
1110
1137
|
if (Math.abs(o) < s)
|
|
1111
|
-
return
|
|
1138
|
+
return e;
|
|
1112
1139
|
}
|
|
1113
1140
|
return r;
|
|
1114
1141
|
}
|
|
1115
|
-
function
|
|
1116
|
-
let
|
|
1142
|
+
function on(t) {
|
|
1143
|
+
let e = !1;
|
|
1117
1144
|
return function() {
|
|
1118
|
-
|
|
1119
|
-
|
|
1145
|
+
e || (e = !0, window.requestAnimationFrame(() => {
|
|
1146
|
+
e = !1, t();
|
|
1120
1147
|
}));
|
|
1121
1148
|
};
|
|
1122
1149
|
}
|
|
1123
|
-
function
|
|
1150
|
+
function Ae(t, e) {
|
|
1124
1151
|
let n = 0;
|
|
1125
1152
|
return function() {
|
|
1126
1153
|
n && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
1127
|
-
n = 0,
|
|
1128
|
-
},
|
|
1154
|
+
n = 0, t();
|
|
1155
|
+
}, e);
|
|
1129
1156
|
};
|
|
1130
1157
|
}
|
|
1131
|
-
function
|
|
1132
|
-
const n =
|
|
1133
|
-
return te(n[1],
|
|
1158
|
+
function cn(t, e) {
|
|
1159
|
+
const n = t.match(/^calc\s*\(\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\+\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\)\s*$/);
|
|
1160
|
+
return te(n[1], e) + te(n[6], e);
|
|
1134
1161
|
}
|
|
1135
|
-
function te(
|
|
1136
|
-
return
|
|
1162
|
+
function te(t, e) {
|
|
1163
|
+
return t ? /^-?\d+px$/.test(t) ? parseInt(t) : /^-?\d+[lsd]?vh$/.test(t) ? parseInt(t) * e.viewportHeight / 100 : /^-?\d+[lsd]?vw$/.test(t) ? parseInt(t) * e.viewportWidth / 100 : /^calc\s*\(\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\+\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\)\s*$/.test(t) ? cn(t, e) : parseInt(t) || 0 : 0;
|
|
1137
1164
|
}
|
|
1138
|
-
function
|
|
1139
|
-
const { name: s, offset: r = 0 } =
|
|
1165
|
+
function q(t, e, n) {
|
|
1166
|
+
const { name: s, offset: r = 0 } = t, { start: i, end: o } = n, c = o - i, l = r / 100;
|
|
1140
1167
|
let f, a;
|
|
1141
|
-
return s === "entry" ? (f = i -
|
|
1168
|
+
return s === "entry" ? (f = i - e, a = Math.min(e, c)) : s === "entry-crossing" ? (f = i - e, a = c) : s === "contain" ? (f = Math.min(o - e, i), a = Math.abs(e - c)) : s === "exit" ? (f = Math.max(i, o - e), a = Math.min(e, c)) : s === "exit-crossing" ? (f = i, a = c) : s === "cover" && (f = i - e, a = c + e), f + l * a | 0;
|
|
1142
1169
|
}
|
|
1143
|
-
function oe(
|
|
1170
|
+
function oe(t, e, n, s, r) {
|
|
1144
1171
|
let i = 0;
|
|
1145
|
-
const o = { start:
|
|
1146
|
-
return
|
|
1172
|
+
const o = { start: e, end: n };
|
|
1173
|
+
return t.forEach((c, l) => {
|
|
1147
1174
|
i += c.offset;
|
|
1148
1175
|
const f = c.sticky;
|
|
1149
1176
|
if (f) {
|
|
1150
|
-
if ("end" in f &&
|
|
1177
|
+
if ("end" in f && t[l - 1]?.element) {
|
|
1151
1178
|
const m = ((r ? c.element.offsetWidth : c.element.offsetHeight) || 0) + f.end - s, g = i + m - c.offset, d = g < o.start, h = !d && g <= n;
|
|
1152
1179
|
let p = 0;
|
|
1153
1180
|
(d || h) && (p = c.offset, o.end += p), d && (o.start += p);
|
|
1154
1181
|
}
|
|
1155
1182
|
if ("start" in f) {
|
|
1156
|
-
const a = i - f.start,
|
|
1183
|
+
const a = i - f.start, u = a < o.start, m = !u && a <= o.end;
|
|
1157
1184
|
let g = 0;
|
|
1158
|
-
const d =
|
|
1185
|
+
const d = t[l - 1]?.element;
|
|
1159
1186
|
if (d) {
|
|
1160
|
-
if (
|
|
1161
|
-
const h = (r ? d.offsetWidth : d.offsetHeight) || 0, p = c.offset,
|
|
1162
|
-
g = h - (p +
|
|
1187
|
+
if (u || m) {
|
|
1188
|
+
const h = (r ? d.offsetWidth : d.offsetHeight) || 0, p = c.offset, v = (r ? c.element.offsetWidth : c.element.offsetHeight) || 0;
|
|
1189
|
+
g = h - (p + v), i += g, o.end += g;
|
|
1163
1190
|
}
|
|
1164
|
-
|
|
1191
|
+
u && (o.start += g);
|
|
1165
1192
|
}
|
|
1166
1193
|
}
|
|
1167
1194
|
}
|
|
1168
1195
|
}), o;
|
|
1169
1196
|
}
|
|
1170
|
-
function
|
|
1171
|
-
const { start: o, end: c, duration:
|
|
1172
|
-
let f = o, a = c,
|
|
1173
|
-
if (typeof
|
|
1174
|
-
|
|
1197
|
+
function an(t, e, n, s, r, i) {
|
|
1198
|
+
const { start: o, end: c, duration: l } = t;
|
|
1199
|
+
let f = o, a = c, u = t.startRange, m = t.endRange, g;
|
|
1200
|
+
if (typeof l == "string") {
|
|
1201
|
+
u = { name: l, offset: 0 }, m = { name: l, offset: 100 }, f = q(u, n, e), a = q(m, n, e), g = a - f;
|
|
1175
1202
|
const d = oe(i, f, a, n, s);
|
|
1176
1203
|
f = d.start, a = d.end;
|
|
1177
1204
|
} else {
|
|
1178
|
-
if (
|
|
1179
|
-
|
|
1180
|
-
const d = te(
|
|
1181
|
-
f =
|
|
1205
|
+
if (u || o?.name) {
|
|
1206
|
+
u = u || o;
|
|
1207
|
+
const d = te(u.add, r), h = q({ ...u, offset: 0 }, n, e), p = q({ ...u, offset: 100 }, n, e), v = oe(i, h, p, n, s);
|
|
1208
|
+
f = v.start + u.offset / 100 * (v.end - v.start) + d;
|
|
1182
1209
|
}
|
|
1183
1210
|
if (m || c?.name) {
|
|
1184
1211
|
m = m || c;
|
|
1185
|
-
const d = te(m.add, r), h =
|
|
1186
|
-
a =
|
|
1187
|
-
} else typeof
|
|
1212
|
+
const d = te(m.add, r), h = q({ ...m, offset: 0 }, n, e), p = q({ ...m, offset: 100 }, n, e), v = oe(i, h, p, n, s);
|
|
1213
|
+
a = v.start + m.offset / 100 * (v.end - v.start) + d;
|
|
1214
|
+
} else typeof l == "number" && (a = f + l);
|
|
1188
1215
|
}
|
|
1189
|
-
return !g && !
|
|
1216
|
+
return !g && !l && (g = a - f), { ...t, start: f, end: a, startRange: u, endRange: m, duration: g || l };
|
|
1190
1217
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return
|
|
1218
|
+
function fn(t) {
|
|
1219
|
+
return t.position === "sticky";
|
|
1193
1220
|
}
|
|
1194
|
-
function
|
|
1195
|
-
return
|
|
1221
|
+
function ln(t, e, n) {
|
|
1222
|
+
return t.position === "fixed" && (!e || e === window.document.body || e === n);
|
|
1196
1223
|
}
|
|
1197
|
-
function
|
|
1198
|
-
return parseInt(
|
|
1224
|
+
function un(t, e) {
|
|
1225
|
+
return parseInt(e ? t.left : t.top);
|
|
1199
1226
|
}
|
|
1200
|
-
function
|
|
1201
|
-
return parseInt(
|
|
1227
|
+
function dn(t, e) {
|
|
1228
|
+
return parseInt(e ? t.right : t.bottom);
|
|
1202
1229
|
}
|
|
1203
|
-
function
|
|
1204
|
-
n && (
|
|
1205
|
-
const s = (
|
|
1206
|
-
return n && (
|
|
1230
|
+
function hn(t, e, n) {
|
|
1231
|
+
n && (t.style.position = "static");
|
|
1232
|
+
const s = (e ? t.offsetLeft : t.offsetTop) || 0;
|
|
1233
|
+
return n && (t.style.position = null), s;
|
|
1207
1234
|
}
|
|
1208
|
-
function
|
|
1235
|
+
function mn(t, e) {
|
|
1209
1236
|
let n;
|
|
1210
|
-
const s =
|
|
1237
|
+
const s = un(t, e), r = dn(t, e), i = !isNaN(s), o = !isNaN(r);
|
|
1211
1238
|
return (i || o) && (n = {}, i && (n.start = s), o && (n.end = r)), n;
|
|
1212
1239
|
}
|
|
1213
|
-
function V(
|
|
1214
|
-
const i =
|
|
1215
|
-
let c = (s ? i.offsetWidth : i.offsetHeight) || 0,
|
|
1240
|
+
function V(t, e, n, s, r) {
|
|
1241
|
+
const i = t[0].viewSource, o = [];
|
|
1242
|
+
let c = (s ? i.offsetWidth : i.offsetHeight) || 0, l = 0, f = i;
|
|
1216
1243
|
for (; f; ) {
|
|
1217
|
-
const
|
|
1218
|
-
if ((!g || !("end" in g)) && (
|
|
1244
|
+
const u = window.getComputedStyle(f), m = fn(u), g = m ? mn(u, s) : void 0, d = hn(f, s, m);
|
|
1245
|
+
if ((!g || !("end" in g)) && (l += d), o.push({ element: f, offset: d, sticky: g }), f = f.offsetParent, ln(u, f, e))
|
|
1219
1246
|
break;
|
|
1220
|
-
if (f ===
|
|
1247
|
+
if (f === e) {
|
|
1221
1248
|
o.push({ element: f, offset: 0 });
|
|
1222
1249
|
break;
|
|
1223
1250
|
}
|
|
1224
1251
|
}
|
|
1225
|
-
return o.reverse(),
|
|
1226
|
-
...
|
|
1227
|
-
|
|
1228
|
-
{ start:
|
|
1252
|
+
return o.reverse(), t.map((u) => ({
|
|
1253
|
+
...an(
|
|
1254
|
+
u,
|
|
1255
|
+
{ start: l, end: l + c },
|
|
1229
1256
|
n,
|
|
1230
1257
|
s,
|
|
1231
1258
|
r,
|
|
@@ -1233,7 +1260,7 @@ function V(e, t, n, s, r) {
|
|
|
1233
1260
|
)
|
|
1234
1261
|
}));
|
|
1235
1262
|
}
|
|
1236
|
-
const
|
|
1263
|
+
const qe = 100, pn = {
|
|
1237
1264
|
horizontal: !1,
|
|
1238
1265
|
observeViewportEntry: !0,
|
|
1239
1266
|
viewportRootMargin: "7% 7%",
|
|
@@ -1241,81 +1268,81 @@ const Ae = 100, hn = {
|
|
|
1241
1268
|
observeSourcesResize: !1,
|
|
1242
1269
|
observeContentResize: !1
|
|
1243
1270
|
};
|
|
1244
|
-
function
|
|
1271
|
+
function gn(t, e, n, s) {
|
|
1245
1272
|
let r = 0;
|
|
1246
|
-
return
|
|
1273
|
+
return t >= e && t <= n ? r = s ? (t - e) / s : 1 : t > n && (r = 1), r;
|
|
1247
1274
|
}
|
|
1248
|
-
function _e(
|
|
1249
|
-
return
|
|
1275
|
+
function _e(t, e) {
|
|
1276
|
+
return t === window ? e ? window.document.documentElement.clientWidth : window.document.documentElement.clientHeight : e ? t.clientWidth : t.clientHeight;
|
|
1250
1277
|
}
|
|
1251
|
-
function
|
|
1278
|
+
function vn() {
|
|
1252
1279
|
return {
|
|
1253
1280
|
viewportWidth: window.document.documentElement.clientWidth,
|
|
1254
1281
|
viewportHeight: window.document.documentElement.clientHeight
|
|
1255
1282
|
};
|
|
1256
1283
|
}
|
|
1257
|
-
function
|
|
1258
|
-
const
|
|
1259
|
-
let i = _e(n, s), o, c,
|
|
1260
|
-
const
|
|
1261
|
-
if (
|
|
1284
|
+
function yn(t) {
|
|
1285
|
+
const e = Be(t, pn), n = e.root, s = e.horizontal, r = /* @__PURE__ */ new WeakMap();
|
|
1286
|
+
let i = _e(n, s), o, c, l, f, a;
|
|
1287
|
+
const u = [], m = vn();
|
|
1288
|
+
if (e.scenes = Object.values(
|
|
1262
1289
|
// TODO(ameerf): find a polyfill and use groupBy instead of following reduce
|
|
1263
|
-
|
|
1264
|
-
(h, p,
|
|
1265
|
-
const
|
|
1266
|
-
return h[
|
|
1290
|
+
t.scenes.reduce(
|
|
1291
|
+
(h, p, v) => {
|
|
1292
|
+
const y = p.groupId ? `group-${p.groupId}` : String(v);
|
|
1293
|
+
return h[y] ? h[y].push(p) : h[y] = [p], h;
|
|
1267
1294
|
},
|
|
1268
1295
|
{}
|
|
1269
1296
|
)
|
|
1270
|
-
).flatMap((h) => (h.every((p) => p.viewSource && (typeof p.duration == "string" || p.start?.name)) ? (h = V(h, n, i, s, m), (
|
|
1297
|
+
).flatMap((h) => (h.every((p) => p.viewSource && (typeof p.duration == "string" || p.start?.name)) ? (h = V(h, n, i, s, m), (e.observeSourcesResize || e.observeContentResize) && u.push(h)) : h.forEach((p) => {
|
|
1271
1298
|
p.end == null && (p.end = p.start + p.duration), p.duration == null && (p.duration = p.end - p.start);
|
|
1272
|
-
}), h)),
|
|
1299
|
+
}), h)), e.scenes.forEach((h, p) => {
|
|
1273
1300
|
h.index = p;
|
|
1274
|
-
}),
|
|
1301
|
+
}), u.length) {
|
|
1275
1302
|
const h = /* @__PURE__ */ new Map();
|
|
1276
|
-
window.ResizeObserver && (
|
|
1277
|
-
p.forEach((
|
|
1278
|
-
const
|
|
1303
|
+
window.ResizeObserver && (l = new window.ResizeObserver(function(p) {
|
|
1304
|
+
p.forEach((v) => {
|
|
1305
|
+
const y = h.get(v.target), w = V(y, n, i, s, m);
|
|
1279
1306
|
w.forEach((b, S) => {
|
|
1280
|
-
|
|
1281
|
-
}),
|
|
1307
|
+
e.scenes[b.index] = w[S];
|
|
1308
|
+
}), u.splice(u.indexOf(y), 1, w);
|
|
1282
1309
|
});
|
|
1283
|
-
}),
|
|
1284
|
-
|
|
1285
|
-
}),
|
|
1286
|
-
const
|
|
1287
|
-
const w = V(
|
|
1310
|
+
}), u.forEach((p) => {
|
|
1311
|
+
l.observe(p[0].viewSource, { box: "border-box" }), h.set(p[0].viewSource, p);
|
|
1312
|
+
}), e.observeContentResize && e.contentRoot && new window.ResizeObserver(Ae(() => {
|
|
1313
|
+
const v = u.map((y) => {
|
|
1314
|
+
const w = V(y, n, i, s, m);
|
|
1288
1315
|
return w.forEach((b, S) => {
|
|
1289
|
-
|
|
1316
|
+
e.scenes[b.index] = w[S];
|
|
1290
1317
|
}), w;
|
|
1291
1318
|
});
|
|
1292
|
-
|
|
1293
|
-
h.set(
|
|
1319
|
+
u.length = 0, u.push(...v), u.forEach((y) => {
|
|
1320
|
+
h.set(y[0].viewSource, y);
|
|
1294
1321
|
});
|
|
1295
|
-
},
|
|
1322
|
+
}, qe)).observe(e.contentRoot, { box: "border-box" })), e.observeViewportResize && (f = Ae(function() {
|
|
1296
1323
|
i = _e(n, s);
|
|
1297
|
-
const p =
|
|
1298
|
-
const
|
|
1299
|
-
return
|
|
1300
|
-
|
|
1301
|
-
}),
|
|
1324
|
+
const p = u.map((v) => {
|
|
1325
|
+
const y = V(v, n, i, s, m);
|
|
1326
|
+
return y.forEach((w, b) => {
|
|
1327
|
+
e.scenes[w.index] = y[b];
|
|
1328
|
+
}), y;
|
|
1302
1329
|
});
|
|
1303
|
-
|
|
1304
|
-
h.set(
|
|
1330
|
+
u.length = 0, u.push(...p), u.forEach((v) => {
|
|
1331
|
+
h.set(v[0].viewSource, v);
|
|
1305
1332
|
});
|
|
1306
|
-
},
|
|
1333
|
+
}, qe), n === window ? window.addEventListener("resize", f) : window.ResizeObserver && (a = new window.ResizeObserver(f), a.observe(n, { box: "border-box" })));
|
|
1307
1334
|
}
|
|
1308
|
-
|
|
1335
|
+
e.observeViewportEntry && window.IntersectionObserver && (c = new window.IntersectionObserver(function(h) {
|
|
1309
1336
|
h.forEach((p) => {
|
|
1310
|
-
(r.get(p.target) || []).forEach((
|
|
1311
|
-
|
|
1337
|
+
(r.get(p.target) || []).forEach((v) => {
|
|
1338
|
+
v.disabled = !p.isIntersecting;
|
|
1312
1339
|
});
|
|
1313
1340
|
});
|
|
1314
1341
|
}, {
|
|
1315
1342
|
root: n === window ? window.document : n,
|
|
1316
|
-
rootMargin:
|
|
1343
|
+
rootMargin: e.viewportRootMargin,
|
|
1317
1344
|
threshold: 0
|
|
1318
|
-
}),
|
|
1345
|
+
}), e.scenes.forEach((h) => {
|
|
1319
1346
|
if (h.viewSource) {
|
|
1320
1347
|
let p = r.get(h.viewSource);
|
|
1321
1348
|
p || (p = [], r.set(h.viewSource, p), c.observe(h.viewSource)), p.push(h);
|
|
@@ -1323,34 +1350,34 @@ function gn(e) {
|
|
|
1323
1350
|
}));
|
|
1324
1351
|
function g({ p: h, vp: p }) {
|
|
1325
1352
|
h = +h.toFixed(1);
|
|
1326
|
-
const
|
|
1353
|
+
const v = +p.toFixed(4);
|
|
1327
1354
|
if (h !== o) {
|
|
1328
|
-
for (let
|
|
1329
|
-
if (!
|
|
1330
|
-
const { start: w, end: b, duration: S } =
|
|
1331
|
-
|
|
1355
|
+
for (let y of e.scenes)
|
|
1356
|
+
if (!y.disabled) {
|
|
1357
|
+
const { start: w, end: b, duration: S } = y, I = gn(h, w, b, S);
|
|
1358
|
+
y.effect(y, I, v);
|
|
1332
1359
|
}
|
|
1333
1360
|
o = h;
|
|
1334
1361
|
}
|
|
1335
1362
|
}
|
|
1336
1363
|
function d() {
|
|
1337
|
-
|
|
1364
|
+
e.scenes.forEach((h) => h.destroy?.()), c && (c.disconnect(), c = null), l && (l.disconnect(), l = null), f && (a ? (a.disconnect(), a = null) : window.removeEventListener("resize", f));
|
|
1338
1365
|
}
|
|
1339
1366
|
return {
|
|
1340
1367
|
tick: g,
|
|
1341
1368
|
destroy: d
|
|
1342
1369
|
};
|
|
1343
1370
|
}
|
|
1344
|
-
const
|
|
1371
|
+
const En = {
|
|
1345
1372
|
transitionActive: !1,
|
|
1346
1373
|
transitionFriction: 0.9,
|
|
1347
1374
|
transitionEpsilon: 1,
|
|
1348
1375
|
velocityActive: !1,
|
|
1349
1376
|
velocityMax: 1
|
|
1350
1377
|
};
|
|
1351
|
-
class
|
|
1352
|
-
constructor(
|
|
1353
|
-
this.config = Be(
|
|
1378
|
+
class wn {
|
|
1379
|
+
constructor(e = {}) {
|
|
1380
|
+
this.config = Be(e, En), this.progress = {
|
|
1354
1381
|
p: 0,
|
|
1355
1382
|
prevP: 0,
|
|
1356
1383
|
vp: 0
|
|
@@ -1363,7 +1390,7 @@ class yn {
|
|
|
1363
1390
|
this.config.root = n ? window : this.config.root, this.config.contentRoot = this.config.contentRoot || (n ? window.document.body : this.config.root.firstElementChild), this.config.resetProgress = this.config.resetProgress || this.resetProgress.bind(this), this._measure = this.config.measure || (() => {
|
|
1364
1391
|
const s = this.config.root;
|
|
1365
1392
|
this.progress.p = this.config.horizontal ? s.scrollX || s.scrollLeft || 0 : s.scrollY || s.scrollTop || 0;
|
|
1366
|
-
}), this._trigger =
|
|
1393
|
+
}), this._trigger = on(() => {
|
|
1367
1394
|
this._measure?.(), this.tick(!0);
|
|
1368
1395
|
});
|
|
1369
1396
|
}
|
|
@@ -1386,16 +1413,16 @@ class yn {
|
|
|
1386
1413
|
* @param {number} [scrollPosition.x]
|
|
1387
1414
|
* @param {number} [scrollPosition.y]
|
|
1388
1415
|
*/
|
|
1389
|
-
resetProgress(
|
|
1390
|
-
const n = this.config.root, s =
|
|
1391
|
-
this.progress.p = i, this.progress.prevP = i, this.progress.vp = 0, this.config.transitionActive && (this.currentProgress.p = i, this.currentProgress.prevP = i, this.currentProgress.vp = 0),
|
|
1416
|
+
resetProgress(e = {}) {
|
|
1417
|
+
const n = this.config.root, s = e.x || e.x === 0 ? e.x : n.scrollX || n.scrollLeft || 0, r = e.y || e.y === 0 ? e.y : n.scrollY || n.scrollTop || 0, i = this.config.horizontal ? s : r;
|
|
1418
|
+
this.progress.p = i, this.progress.prevP = i, this.progress.vp = 0, this.config.transitionActive && (this.currentProgress.p = i, this.currentProgress.prevP = i, this.currentProgress.vp = 0), e && this.config.root.scrollTo(s, r);
|
|
1392
1419
|
}
|
|
1393
1420
|
/**
|
|
1394
1421
|
* Handle animation frame work.
|
|
1395
1422
|
*
|
|
1396
1423
|
* @param {boolean} [clearLerpFrame] whether to cancel an existing lerp frame
|
|
1397
1424
|
*/
|
|
1398
|
-
tick(
|
|
1425
|
+
tick(e) {
|
|
1399
1426
|
const n = this.config.transitionActive;
|
|
1400
1427
|
n && this.lerp();
|
|
1401
1428
|
const s = n ? this.currentProgress : this.progress;
|
|
@@ -1403,13 +1430,13 @@ class yn {
|
|
|
1403
1430
|
const r = s.p - s.prevP, i = r < 0 ? -1 : 1;
|
|
1404
1431
|
s.vp = Math.min(this.config.velocityMax, Math.abs(r)) / this.config.velocityMax * i;
|
|
1405
1432
|
}
|
|
1406
|
-
this.effect.tick(s), n && s.p !== this.progress.p && (
|
|
1433
|
+
this.effect.tick(s), n && s.p !== this.progress.p && (e && this._lerpFrameId && window.cancelAnimationFrame(this._lerpFrameId), this._lerpFrameId = window.requestAnimationFrame(() => this.tick())), s.prevP = s.p;
|
|
1407
1434
|
}
|
|
1408
1435
|
/**
|
|
1409
1436
|
* Calculate current progress.
|
|
1410
1437
|
*/
|
|
1411
1438
|
lerp() {
|
|
1412
|
-
this.currentProgress.p =
|
|
1439
|
+
this.currentProgress.p = rn(this.currentProgress.p, this.progress.p, +(1 - this.config.transitionFriction).toFixed(3), this.config.transitionEpsilon);
|
|
1413
1440
|
}
|
|
1414
1441
|
/**
|
|
1415
1442
|
* Stop the event and effect, and remove all DOM side-effects.
|
|
@@ -1433,7 +1460,7 @@ class yn {
|
|
|
1433
1460
|
* Reset registered effect.
|
|
1434
1461
|
*/
|
|
1435
1462
|
setupEffect() {
|
|
1436
|
-
this.removeEffect(), this.effect =
|
|
1463
|
+
this.removeEffect(), this.effect = yn(this.config);
|
|
1437
1464
|
}
|
|
1438
1465
|
/**
|
|
1439
1466
|
* Remove registered effect.
|
|
@@ -1444,29 +1471,29 @@ class yn {
|
|
|
1444
1471
|
}
|
|
1445
1472
|
const le = /* @__PURE__ */ new WeakMap();
|
|
1446
1473
|
let Ke = () => ({});
|
|
1447
|
-
function
|
|
1448
|
-
Ke =
|
|
1474
|
+
function bn(t) {
|
|
1475
|
+
Ke = t;
|
|
1449
1476
|
}
|
|
1450
|
-
function
|
|
1477
|
+
function Sn(t, e, n, s, { reducedMotion: r }) {
|
|
1451
1478
|
if (r)
|
|
1452
1479
|
return;
|
|
1453
1480
|
const i = {
|
|
1454
1481
|
trigger: "view-progress",
|
|
1455
|
-
element:
|
|
1482
|
+
element: t
|
|
1456
1483
|
}, o = P(n);
|
|
1457
1484
|
let c;
|
|
1458
1485
|
if ("ViewTimeline" in window) {
|
|
1459
|
-
const f = ve(
|
|
1486
|
+
const f = ve(e, o, i);
|
|
1460
1487
|
f && (f.play(), c = () => {
|
|
1461
1488
|
f.ready.then(() => {
|
|
1462
1489
|
f.cancel();
|
|
1463
1490
|
});
|
|
1464
1491
|
});
|
|
1465
1492
|
} else {
|
|
1466
|
-
const f =
|
|
1493
|
+
const f = Ne(e, o, i);
|
|
1467
1494
|
if (f) {
|
|
1468
|
-
const a = Array.isArray(f) ? f : [f],
|
|
1469
|
-
viewSource:
|
|
1495
|
+
const a = Array.isArray(f) ? f : [f], u = new wn({
|
|
1496
|
+
viewSource: t,
|
|
1470
1497
|
scenes: a,
|
|
1471
1498
|
observeViewportEntry: !1,
|
|
1472
1499
|
observeViewportResize: !1,
|
|
@@ -1475,67 +1502,67 @@ function wn(e, t, n, s, { reducedMotion: r }) {
|
|
|
1475
1502
|
...Ke()
|
|
1476
1503
|
});
|
|
1477
1504
|
c = () => {
|
|
1478
|
-
|
|
1505
|
+
u.destroy();
|
|
1479
1506
|
}, Promise.all(a.map((m) => m.ready || Promise.resolve())).then(
|
|
1480
1507
|
() => {
|
|
1481
|
-
|
|
1508
|
+
u.start();
|
|
1482
1509
|
}
|
|
1483
1510
|
);
|
|
1484
1511
|
}
|
|
1485
1512
|
}
|
|
1486
1513
|
if (!c) return;
|
|
1487
|
-
const
|
|
1488
|
-
O(le,
|
|
1514
|
+
const l = { source: t, target: e, cleanup: c };
|
|
1515
|
+
O(le, t, l), O(le, e, l);
|
|
1489
1516
|
}
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1517
|
+
function In(t) {
|
|
1518
|
+
D(le, t);
|
|
1492
1519
|
}
|
|
1493
|
-
const
|
|
1494
|
-
add:
|
|
1495
|
-
remove:
|
|
1496
|
-
registerOptionsGetter:
|
|
1520
|
+
const Tn = {
|
|
1521
|
+
add: Sn,
|
|
1522
|
+
remove: In,
|
|
1523
|
+
registerOptionsGetter: bn
|
|
1497
1524
|
};
|
|
1498
|
-
function xe(
|
|
1499
|
-
return Math.min(Math.max(
|
|
1525
|
+
function xe(t, e, n) {
|
|
1526
|
+
return Math.min(Math.max(t, n), e);
|
|
1500
1527
|
}
|
|
1501
|
-
function Me(
|
|
1502
|
-
let
|
|
1528
|
+
function Me(t) {
|
|
1529
|
+
let e = !1;
|
|
1503
1530
|
return function() {
|
|
1504
|
-
if (!
|
|
1505
|
-
return
|
|
1506
|
-
|
|
1531
|
+
if (!e)
|
|
1532
|
+
return e = !0, window.requestAnimationFrame(() => {
|
|
1533
|
+
e = !1, t();
|
|
1507
1534
|
});
|
|
1508
1535
|
};
|
|
1509
1536
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let
|
|
1512
|
-
if (
|
|
1537
|
+
function On(t) {
|
|
1538
|
+
let e = t, n = 0, s = 0;
|
|
1539
|
+
if (e.offsetParent)
|
|
1513
1540
|
do
|
|
1514
|
-
n +=
|
|
1515
|
-
while (
|
|
1541
|
+
n += e.offsetLeft, s += e.offsetTop, e = e.offsetParent;
|
|
1542
|
+
while (e);
|
|
1516
1543
|
return {
|
|
1517
1544
|
left: n,
|
|
1518
1545
|
top: s,
|
|
1519
|
-
width:
|
|
1520
|
-
height:
|
|
1546
|
+
width: t.offsetWidth,
|
|
1547
|
+
height: t.offsetHeight
|
|
1521
1548
|
};
|
|
1522
1549
|
}
|
|
1523
|
-
function
|
|
1524
|
-
const
|
|
1525
|
-
let
|
|
1526
|
-
if (
|
|
1550
|
+
function Cn() {
|
|
1551
|
+
const t = window.devicePixelRatio;
|
|
1552
|
+
let e = !1;
|
|
1553
|
+
if (t === 1)
|
|
1527
1554
|
return !1;
|
|
1528
1555
|
document.body.addEventListener("pointerdown", (s) => {
|
|
1529
|
-
|
|
1556
|
+
e = s.offsetX !== 10;
|
|
1530
1557
|
}, { once: !0 });
|
|
1531
1558
|
const n = new PointerEvent("pointerdown", {
|
|
1532
1559
|
clientX: 10
|
|
1533
1560
|
});
|
|
1534
|
-
return document.body.dispatchEvent(n),
|
|
1561
|
+
return document.body.dispatchEvent(n), e;
|
|
1535
1562
|
}
|
|
1536
|
-
function
|
|
1537
|
-
return new Promise((
|
|
1538
|
-
const
|
|
1563
|
+
function kn() {
|
|
1564
|
+
return new Promise((t) => {
|
|
1565
|
+
const e = window.scrollY;
|
|
1539
1566
|
let n = !1, s;
|
|
1540
1567
|
function r() {
|
|
1541
1568
|
document.body.addEventListener("pointerdown", (c) => {
|
|
@@ -1547,102 +1574,102 @@ function On() {
|
|
|
1547
1574
|
document.body.dispatchEvent(o);
|
|
1548
1575
|
}
|
|
1549
1576
|
function i() {
|
|
1550
|
-
window.scrollY !==
|
|
1577
|
+
window.scrollY !== e && (window.removeEventListener("scroll", i), r(), t(n));
|
|
1551
1578
|
}
|
|
1552
1579
|
r(), window.addEventListener("scroll", i), window.scrollY > 0 && window.scrollBy(0, -1);
|
|
1553
1580
|
});
|
|
1554
1581
|
}
|
|
1555
|
-
function
|
|
1556
|
-
|
|
1557
|
-
|
|
1582
|
+
function An(t) {
|
|
1583
|
+
kn().then((e) => {
|
|
1584
|
+
t.fixRequired = e, e && (window.addEventListener("scroll", t.scrollHandler), t.scrollHandler());
|
|
1558
1585
|
});
|
|
1559
1586
|
}
|
|
1560
1587
|
let W = 0;
|
|
1561
1588
|
const J = /* @__PURE__ */ new Set();
|
|
1562
|
-
function
|
|
1563
|
-
const
|
|
1589
|
+
function qn() {
|
|
1590
|
+
const t = (n) => {
|
|
1564
1591
|
for (let s of n.changedTouches)
|
|
1565
1592
|
J.add(s.identifier);
|
|
1566
|
-
},
|
|
1593
|
+
}, e = (n) => {
|
|
1567
1594
|
for (let s of n.changedTouches)
|
|
1568
1595
|
J.delete(s.identifier);
|
|
1569
1596
|
};
|
|
1570
|
-
return document.addEventListener("touchstart",
|
|
1571
|
-
J.clear(), document.removeEventListener("touchstart",
|
|
1597
|
+
return document.addEventListener("touchstart", t, { passive: !0 }), document.addEventListener("touchend", e, { passive: !0 }), function() {
|
|
1598
|
+
J.clear(), document.removeEventListener("touchstart", t), document.removeEventListener("touchend", e);
|
|
1572
1599
|
};
|
|
1573
1600
|
}
|
|
1574
|
-
function
|
|
1601
|
+
function _n(t, e) {
|
|
1575
1602
|
if ("onscrollend" in window)
|
|
1576
|
-
return
|
|
1577
|
-
|
|
1603
|
+
return t.addEventListener("scrollend", e), function() {
|
|
1604
|
+
t.removeEventListener("scrollend", e);
|
|
1578
1605
|
};
|
|
1579
1606
|
let n = 0, s;
|
|
1580
|
-
W || (s =
|
|
1607
|
+
W || (s = qn()), W += 1;
|
|
1581
1608
|
function r(i) {
|
|
1582
1609
|
clearTimeout(n), n = setTimeout(() => {
|
|
1583
|
-
J.size ? setTimeout(r, 100) : (
|
|
1610
|
+
J.size ? setTimeout(r, 100) : (e(i), n = 0);
|
|
1584
1611
|
}, 100);
|
|
1585
1612
|
}
|
|
1586
|
-
return
|
|
1587
|
-
|
|
1613
|
+
return t.addEventListener("scroll", r), function() {
|
|
1614
|
+
t.removeEventListener("scroll", r), W -= 1, W || s();
|
|
1588
1615
|
};
|
|
1589
1616
|
}
|
|
1590
|
-
function
|
|
1617
|
+
function xn(t, e, n) {
|
|
1591
1618
|
return {
|
|
1592
1619
|
x(s) {
|
|
1593
|
-
const r =
|
|
1620
|
+
const r = t.left - n.x + t.width / 2, i = r >= e.width / 2, o = (i ? r : e.width - r) * 2, c = i ? 0 : r - o / 2;
|
|
1594
1621
|
return (s - c) / o;
|
|
1595
1622
|
},
|
|
1596
1623
|
y(s) {
|
|
1597
|
-
const r =
|
|
1624
|
+
const r = t.top - n.y + t.height / 2, i = r >= e.height / 2, o = (i ? r : e.height - r) * 2, c = i ? 0 : r - o / 2;
|
|
1598
1625
|
return (s - c) / o;
|
|
1599
1626
|
}
|
|
1600
1627
|
};
|
|
1601
1628
|
}
|
|
1602
|
-
function
|
|
1603
|
-
this.x = window.scrollX, this.y = window.scrollY, requestAnimationFrame(() =>
|
|
1629
|
+
function Mn(t, e) {
|
|
1630
|
+
this.x = window.scrollX, this.y = window.scrollY, requestAnimationFrame(() => t && t(e));
|
|
1604
1631
|
}
|
|
1605
|
-
function
|
|
1606
|
-
|
|
1632
|
+
function Ln(t) {
|
|
1633
|
+
t.rect.width = window.document.documentElement.clientWidth, t.rect.height = window.document.documentElement.clientHeight;
|
|
1607
1634
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const
|
|
1635
|
+
function Pn(t) {
|
|
1636
|
+
const e = new ResizeObserver((n) => {
|
|
1610
1637
|
n.forEach((s) => {
|
|
1611
|
-
|
|
1638
|
+
t.rect.width = s.borderBoxSize[0].inlineSize, t.rect.height = s.borderBoxSize[0].blockSize;
|
|
1612
1639
|
});
|
|
1613
1640
|
});
|
|
1614
|
-
return
|
|
1641
|
+
return e.observe(t.root, { box: "border-box" }), e;
|
|
1615
1642
|
}
|
|
1616
|
-
function
|
|
1617
|
-
let
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
a.target && a.centeredToTarget && (a.transform =
|
|
1643
|
+
function $n(t) {
|
|
1644
|
+
let e = !1, n = { x: t.rect.width / 2, y: t.rect.height / 2, vx: 0, vy: 0 }, s, r, i, o, c;
|
|
1645
|
+
const l = { x: 0, y: 0 };
|
|
1646
|
+
t.scenes.forEach((a) => {
|
|
1647
|
+
a.target && a.centeredToTarget && (a.transform = xn(On(a.target), t.rect, l), e = !0), t.root ? r = Pn(t) : (i = Ln.bind(null, t), window.addEventListener("resize", i));
|
|
1621
1648
|
}), s = function(a) {
|
|
1622
|
-
for (let
|
|
1623
|
-
if (!
|
|
1624
|
-
const m =
|
|
1625
|
-
|
|
1649
|
+
for (let u of t.scenes)
|
|
1650
|
+
if (!u.disabled) {
|
|
1651
|
+
const m = u.transform?.x(a.x) || a.x / t.rect.width, g = u.transform?.y(a.y) || a.y / t.rect.height, d = +xe(0, 1, m).toPrecision(4), h = +xe(0, 1, g).toPrecision(4), p = { x: a.vx, y: a.vy };
|
|
1652
|
+
t.allowActiveEvent && (a.active = m <= 1 && g <= 1 && m >= 0 && g >= 0), u.effect(u, { x: d, y: h }, p, a.active);
|
|
1626
1653
|
}
|
|
1627
1654
|
Object.assign(n, a);
|
|
1628
|
-
},
|
|
1655
|
+
}, e && (o = Mn.bind(l, s, n), c = _n(document, o));
|
|
1629
1656
|
function f() {
|
|
1630
|
-
|
|
1657
|
+
t.scenes.forEach((a) => a.destroy?.()), c?.(), r ? (r.disconnect(), r = null) : (window.removeEventListener("resize", i), i = null), s = null, n = null;
|
|
1631
1658
|
}
|
|
1632
1659
|
return {
|
|
1633
1660
|
tick: s,
|
|
1634
1661
|
destroy: f
|
|
1635
1662
|
};
|
|
1636
1663
|
}
|
|
1637
|
-
const
|
|
1664
|
+
const Fn = 1e3 / 60 * 3;
|
|
1638
1665
|
let j;
|
|
1639
|
-
function
|
|
1666
|
+
function Rn() {
|
|
1640
1667
|
x.x = window.scrollX, x.y = window.scrollY;
|
|
1641
1668
|
}
|
|
1642
|
-
const x = { x: 0, y: 0, scrollHandler:
|
|
1643
|
-
class
|
|
1644
|
-
constructor(
|
|
1645
|
-
this.config = { ...
|
|
1669
|
+
const x = { x: 0, y: 0, scrollHandler: Rn, fixRequired: void 0 };
|
|
1670
|
+
class Hn {
|
|
1671
|
+
constructor(e = {}) {
|
|
1672
|
+
this.config = { ...e }, this.effect = null, this._nextTick = null, this._nextTransitionTick = null, this._startTime = 0;
|
|
1646
1673
|
let n;
|
|
1647
1674
|
this.config.transitionDuration ? n = this.config.noThrottle ? () => this.transition() : Me(() => this.transition()) : n = this.config.noThrottle ? () => (this.tick(), null) : Me(() => {
|
|
1648
1675
|
this.tick();
|
|
@@ -1667,9 +1694,9 @@ class Fn {
|
|
|
1667
1694
|
}, this._pointerEnter = () => {
|
|
1668
1695
|
this.progress.active = !0, this._nextTick = n();
|
|
1669
1696
|
}, this.config.root) {
|
|
1670
|
-
j = typeof j == "boolean" ? j :
|
|
1697
|
+
j = typeof j == "boolean" ? j : Cn();
|
|
1671
1698
|
const r = j ? window.devicePixelRatio : 1;
|
|
1672
|
-
typeof x.fixRequired > "u" &&
|
|
1699
|
+
typeof x.fixRequired > "u" && An(x), this._measure = (i) => {
|
|
1673
1700
|
if (i.target !== this.config.root) {
|
|
1674
1701
|
const o = new PointerEvent("pointermove", {
|
|
1675
1702
|
bubbles: !0,
|
|
@@ -1708,11 +1735,11 @@ class Fn {
|
|
|
1708
1735
|
* @returns {number} the requestAnimationFrame id for the transition tick.
|
|
1709
1736
|
*/
|
|
1710
1737
|
transition() {
|
|
1711
|
-
const
|
|
1738
|
+
const e = this.config.transitionDuration, n = this.config.transitionEasing || ((o) => o), s = performance.now();
|
|
1712
1739
|
let r = !1;
|
|
1713
1740
|
const i = (o) => {
|
|
1714
|
-
const c = (o - this._startTime) /
|
|
1715
|
-
r && (this.progress.vx = 0, this.progress.vy = 0, r = !1), this.currentProgress = Object.entries(this.progress).reduce((f, [a,
|
|
1741
|
+
const c = (o - this._startTime) / e, l = n(Math.min(1, c));
|
|
1742
|
+
r && (this.progress.vx = 0, this.progress.vy = 0, r = !1), this.currentProgress = Object.entries(this.progress).reduce((f, [a, u]) => (a === "active" ? f[a] = u : f[a] = this.previousProgress[a] + (u - this.previousProgress[a]) * l, f), this.currentProgress || {}), c < 1 && (this._nextTransitionTick = requestAnimationFrame(i), r = o - this._startTime > Fn), this.effect.tick(this.currentProgress);
|
|
1716
1743
|
};
|
|
1717
1744
|
return this._startTime ? (this._nextTransitionTick && cancelAnimationFrame(this._nextTransitionTick), Object.assign(this.previousProgress, this.currentProgress), this._startTime = s, i(s)) : this._startTime = s, this._nextTransitionTick;
|
|
1718
1745
|
}
|
|
@@ -1727,21 +1754,21 @@ class Fn {
|
|
|
1727
1754
|
*/
|
|
1728
1755
|
setupEvent() {
|
|
1729
1756
|
this.removeEvent();
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1757
|
+
const e = this.config.root || window;
|
|
1758
|
+
e.addEventListener("pointermove", this._measure, { passive: !0 }), this.config.eventSource && this.config.eventSource.addEventListener("pointermove", this._measure, { passive: !0 }), this.config.allowActiveEvent && (e.addEventListener("pointerleave", this._pointerLeave, { passive: !0 }), e.addEventListener("pointerenter", this._pointerEnter, { passive: !0 }), this.config.eventSource && (this.config.eventSource.addEventListener("pointerleave", this._pointerLeave, { passive: !0 }), this.config.eventSource.addEventListener("pointerenter", this._pointerEnter, { passive: !0 })));
|
|
1732
1759
|
}
|
|
1733
1760
|
/**
|
|
1734
1761
|
* Remove pointermove handler.
|
|
1735
1762
|
*/
|
|
1736
1763
|
removeEvent() {
|
|
1737
|
-
const
|
|
1738
|
-
|
|
1764
|
+
const e = this.config.root || window;
|
|
1765
|
+
e.removeEventListener("pointermove", this._measure), this.config.eventSource && this.config.eventSource.removeEventListener("pointermove", this._measure), this.config.allowActiveEvent && (e.removeEventListener("pointerleave", this._pointerLeave), e.removeEventListener("pointerenter", this._pointerEnter), this.config.eventSource && (this.config.eventSource.removeEventListener("pointerleave", this._pointerLeave), this.config.eventSource.removeEventListener("pointerenter", this._pointerEnter)));
|
|
1739
1766
|
}
|
|
1740
1767
|
/**
|
|
1741
1768
|
* Reset registered effect.
|
|
1742
1769
|
*/
|
|
1743
1770
|
setupEffect() {
|
|
1744
|
-
this.removeEffect(), this.effect =
|
|
1771
|
+
this.removeEffect(), this.effect = $n(this.config);
|
|
1745
1772
|
}
|
|
1746
1773
|
/**
|
|
1747
1774
|
* Remove registered effect.
|
|
@@ -1752,210 +1779,218 @@ class Fn {
|
|
|
1752
1779
|
}
|
|
1753
1780
|
const ue = /* @__PURE__ */ new WeakMap();
|
|
1754
1781
|
let Qe = () => ({});
|
|
1755
|
-
function
|
|
1756
|
-
Qe =
|
|
1782
|
+
function zn(t) {
|
|
1783
|
+
Qe = t;
|
|
1757
1784
|
}
|
|
1758
|
-
function
|
|
1785
|
+
function Gn(t, e, n, s = {}, { reducedMotion: r }) {
|
|
1759
1786
|
if (r)
|
|
1760
1787
|
return;
|
|
1761
1788
|
const i = {
|
|
1762
1789
|
trigger: "pointer-move",
|
|
1763
|
-
element:
|
|
1790
|
+
element: t,
|
|
1764
1791
|
axis: s.axis ?? "y"
|
|
1765
|
-
}, o =
|
|
1792
|
+
}, o = Ne(e, P(n), i);
|
|
1766
1793
|
if (o) {
|
|
1767
|
-
const c = Array.isArray(o) ? o : [o],
|
|
1768
|
-
root: s.hitArea === "self" ?
|
|
1794
|
+
const c = Array.isArray(o) ? o : [o], l = new Hn({
|
|
1795
|
+
root: s.hitArea === "self" ? t : void 0,
|
|
1769
1796
|
scenes: c,
|
|
1770
1797
|
...Qe()
|
|
1771
|
-
}), a = { source:
|
|
1772
|
-
|
|
1798
|
+
}), a = { source: t, target: e, cleanup: () => {
|
|
1799
|
+
l.destroy();
|
|
1773
1800
|
} };
|
|
1774
|
-
O(ue,
|
|
1775
|
-
c.map((
|
|
1801
|
+
O(ue, t, a), O(ue, e, a), Promise.all(
|
|
1802
|
+
c.map((u) => u.ready || Promise.resolve())
|
|
1776
1803
|
).then(() => {
|
|
1777
|
-
|
|
1804
|
+
l.start();
|
|
1778
1805
|
});
|
|
1779
1806
|
}
|
|
1780
1807
|
}
|
|
1781
|
-
function
|
|
1782
|
-
|
|
1808
|
+
function Dn(t) {
|
|
1809
|
+
D(ue, t);
|
|
1783
1810
|
}
|
|
1784
|
-
const
|
|
1785
|
-
add:
|
|
1786
|
-
remove:
|
|
1787
|
-
registerOptionsGetter:
|
|
1811
|
+
const Nn = {
|
|
1812
|
+
add: Gn,
|
|
1813
|
+
remove: Dn,
|
|
1814
|
+
registerOptionsGetter: zn
|
|
1788
1815
|
}, de = /* @__PURE__ */ new WeakMap();
|
|
1789
|
-
function
|
|
1816
|
+
function Vn(t, e, n, s, { reducedMotion: r, selectorCondition: i, animation: o }) {
|
|
1790
1817
|
const c = o || ne(
|
|
1791
|
-
|
|
1818
|
+
e,
|
|
1792
1819
|
P(n),
|
|
1793
1820
|
void 0,
|
|
1794
1821
|
r
|
|
1795
1822
|
);
|
|
1796
1823
|
if (!c)
|
|
1797
1824
|
return;
|
|
1798
|
-
const
|
|
1799
|
-
i && !
|
|
1800
|
-
}, a = { source:
|
|
1801
|
-
c.cancel(),
|
|
1825
|
+
const l = () => {
|
|
1826
|
+
i && !e.matches(i) || c.play();
|
|
1827
|
+
}, a = { source: t, target: e, cleanup: () => {
|
|
1828
|
+
c.cancel(), t.removeEventListener("animationend", l);
|
|
1802
1829
|
} };
|
|
1803
|
-
O(de,
|
|
1830
|
+
O(de, t, a), O(de, e, a), t.addEventListener("animationend", l);
|
|
1804
1831
|
}
|
|
1805
|
-
function
|
|
1806
|
-
|
|
1832
|
+
function Wn(t) {
|
|
1833
|
+
D(de, t);
|
|
1807
1834
|
}
|
|
1808
|
-
const
|
|
1809
|
-
add:
|
|
1810
|
-
remove:
|
|
1835
|
+
const jn = {
|
|
1836
|
+
add: Vn,
|
|
1837
|
+
remove: Wn
|
|
1811
1838
|
};
|
|
1812
|
-
function
|
|
1839
|
+
function Yn(t, e, n, s = !1, r, i, o) {
|
|
1813
1840
|
const c = o || ne(
|
|
1814
|
-
|
|
1815
|
-
P(
|
|
1841
|
+
t,
|
|
1842
|
+
P(e),
|
|
1816
1843
|
void 0,
|
|
1817
1844
|
s
|
|
1818
1845
|
);
|
|
1819
1846
|
if (!c)
|
|
1820
1847
|
return null;
|
|
1821
|
-
let
|
|
1848
|
+
let l = !0;
|
|
1822
1849
|
const f = n.type || "alternate";
|
|
1823
1850
|
return (a) => {
|
|
1824
|
-
if (r && !
|
|
1825
|
-
const
|
|
1826
|
-
if (m ||
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1851
|
+
if (r && !t.matches(r)) return;
|
|
1852
|
+
const u = !i, m = i?.enter?.includes(a.type), g = i?.leave?.includes(a.type);
|
|
1853
|
+
if (m || u) {
|
|
1854
|
+
if (f === "alternate" || f === "state")
|
|
1855
|
+
l ? (l = !1, c.play()) : f === "alternate" ? c.reverse() : f === "state" && (c.playState === "running" ? c.pause() : c.playState !== "finished" && c.play());
|
|
1856
|
+
else {
|
|
1857
|
+
if (c.progress(0), delete t.dataset.interactEnter, c.isCSS) {
|
|
1858
|
+
const d = () => {
|
|
1859
|
+
T.mutate(() => {
|
|
1860
|
+
t.dataset.interactEnter = "done";
|
|
1861
|
+
});
|
|
1862
|
+
};
|
|
1863
|
+
c.onFinish(d), c.onAbort(d);
|
|
1864
|
+
}
|
|
1865
|
+
c.play();
|
|
1866
|
+
}
|
|
1832
1867
|
return;
|
|
1833
1868
|
}
|
|
1834
1869
|
g && (f === "alternate" ? c.reverse() : f === "repeat" ? (c.cancel(), T.mutate(() => {
|
|
1835
|
-
delete
|
|
1870
|
+
delete t.dataset.interactEnter;
|
|
1836
1871
|
})) : f === "state" && c.playState === "running" && c.pause());
|
|
1837
1872
|
};
|
|
1838
1873
|
}
|
|
1839
|
-
function
|
|
1874
|
+
function Bn(t, e, {
|
|
1840
1875
|
effectId: n,
|
|
1841
1876
|
listContainer: s,
|
|
1842
1877
|
listItemSelector: r
|
|
1843
1878
|
}, i, o, c) {
|
|
1844
|
-
const
|
|
1845
|
-
return (
|
|
1846
|
-
if (o && !
|
|
1847
|
-
const m =
|
|
1879
|
+
const l = !!s, f = i.method || "toggle", a = f === "toggle";
|
|
1880
|
+
return (u) => {
|
|
1881
|
+
if (o && !t.matches(o)) return;
|
|
1882
|
+
const m = l ? t.closest(
|
|
1848
1883
|
`${s} > ${r || ""}:has(:scope)`
|
|
1849
|
-
) : void 0, g = !c, d = c?.enter?.includes(
|
|
1850
|
-
g ?
|
|
1884
|
+
) : void 0, g = !c, d = c?.enter?.includes(u.type), h = c?.leave?.includes(u.type);
|
|
1885
|
+
g ? e.toggleEffect(n, f, m) : (d && e.toggleEffect(n, a ? "add" : f, m), h && a && e.toggleEffect(n, "remove", m));
|
|
1851
1886
|
};
|
|
1852
1887
|
}
|
|
1853
1888
|
const he = /* @__PURE__ */ new WeakMap();
|
|
1854
|
-
function Le(
|
|
1889
|
+
function Le(t, e) {
|
|
1855
1890
|
return (n) => {
|
|
1856
1891
|
const s = n;
|
|
1857
|
-
|
|
1892
|
+
t.contains(s.relatedTarget) || e(s);
|
|
1858
1893
|
};
|
|
1859
1894
|
}
|
|
1860
|
-
function
|
|
1861
|
-
return (
|
|
1862
|
-
const n =
|
|
1863
|
-
n.pointerType &&
|
|
1895
|
+
function Kn(t) {
|
|
1896
|
+
return (e) => {
|
|
1897
|
+
const n = e;
|
|
1898
|
+
n.pointerType && t(n);
|
|
1864
1899
|
};
|
|
1865
1900
|
}
|
|
1866
|
-
function
|
|
1867
|
-
return (
|
|
1868
|
-
const n =
|
|
1869
|
-
n.code === "Space" ? (n.preventDefault(),
|
|
1901
|
+
function Qn(t) {
|
|
1902
|
+
return (e) => {
|
|
1903
|
+
const n = e;
|
|
1904
|
+
n.code === "Space" ? (n.preventDefault(), t(n)) : n.code === "Enter" && t(n);
|
|
1870
1905
|
};
|
|
1871
1906
|
}
|
|
1872
|
-
const
|
|
1873
|
-
focusin: (
|
|
1874
|
-
focusout: (
|
|
1875
|
-
click: (
|
|
1876
|
-
keydown: (
|
|
1907
|
+
const Xn = {
|
|
1908
|
+
focusin: (t, e) => Le(t, e),
|
|
1909
|
+
focusout: (t, e) => Le(t, e),
|
|
1910
|
+
click: (t, e) => Kn(e),
|
|
1911
|
+
keydown: (t, e) => Qn(e)
|
|
1877
1912
|
};
|
|
1878
|
-
function
|
|
1879
|
-
const s =
|
|
1880
|
-
return s ? s(
|
|
1881
|
-
}
|
|
1882
|
-
function
|
|
1883
|
-
return typeof
|
|
1884
|
-
}
|
|
1885
|
-
function
|
|
1886
|
-
if (typeof
|
|
1887
|
-
return { toggle: [
|
|
1888
|
-
if (Array.isArray(
|
|
1889
|
-
return { toggle: [...
|
|
1890
|
-
if (
|
|
1891
|
-
const
|
|
1892
|
-
return { enter:
|
|
1913
|
+
function Un(t, e, n) {
|
|
1914
|
+
const s = Xn[t];
|
|
1915
|
+
return s ? s(e, n) : (r) => n(r);
|
|
1916
|
+
}
|
|
1917
|
+
function Jn(t) {
|
|
1918
|
+
return typeof t == "object" && !Array.isArray(t) && ("enter" in t || "leave" in t);
|
|
1919
|
+
}
|
|
1920
|
+
function Zn(t) {
|
|
1921
|
+
if (typeof t == "string")
|
|
1922
|
+
return { toggle: [t] };
|
|
1923
|
+
if (Array.isArray(t))
|
|
1924
|
+
return { toggle: [...t] };
|
|
1925
|
+
if (Jn(t)) {
|
|
1926
|
+
const e = t.enter ? [...t.enter] : [], n = t.leave ? [...t.leave] : [];
|
|
1927
|
+
return { enter: e, leave: n };
|
|
1893
1928
|
}
|
|
1894
1929
|
return {};
|
|
1895
1930
|
}
|
|
1896
|
-
function
|
|
1897
|
-
return !!(
|
|
1931
|
+
function es(t) {
|
|
1932
|
+
return !!(t.enter?.length || t.leave?.length);
|
|
1898
1933
|
}
|
|
1899
|
-
function
|
|
1900
|
-
return
|
|
1934
|
+
function ts(t) {
|
|
1935
|
+
return es(t) ? { enter: t.enter ?? [], leave: t.leave ?? [] } : void 0;
|
|
1901
1936
|
}
|
|
1902
|
-
function
|
|
1937
|
+
function ns(t, e, n, s, {
|
|
1903
1938
|
reducedMotion: r,
|
|
1904
1939
|
targetController: i,
|
|
1905
1940
|
selectorCondition: o,
|
|
1906
1941
|
animation: c
|
|
1907
1942
|
}) {
|
|
1908
|
-
const
|
|
1909
|
-
let
|
|
1910
|
-
if (f ?
|
|
1911
|
-
|
|
1943
|
+
const l = Zn(s.eventConfig), f = n.transition || n.transitionProperties, a = ts(l);
|
|
1944
|
+
let u, m = !1;
|
|
1945
|
+
if (f ? u = Bn(
|
|
1946
|
+
e,
|
|
1912
1947
|
i,
|
|
1913
1948
|
n,
|
|
1914
1949
|
s,
|
|
1915
1950
|
o,
|
|
1916
1951
|
a
|
|
1917
|
-
) : (
|
|
1918
|
-
|
|
1952
|
+
) : (u = Yn(
|
|
1953
|
+
e,
|
|
1919
1954
|
n,
|
|
1920
1955
|
s,
|
|
1921
1956
|
r,
|
|
1922
1957
|
o,
|
|
1923
1958
|
a,
|
|
1924
1959
|
c
|
|
1925
|
-
), m = s.type === "once"), !
|
|
1960
|
+
), m = s.type === "once"), !u)
|
|
1926
1961
|
return;
|
|
1927
|
-
const g =
|
|
1928
|
-
function h(
|
|
1929
|
-
const S =
|
|
1930
|
-
|
|
1962
|
+
const g = u, d = new AbortController();
|
|
1963
|
+
function h(y, w, b) {
|
|
1964
|
+
const S = Un(w, t, g);
|
|
1965
|
+
y.addEventListener(w, S, { ...b, signal: d.signal });
|
|
1931
1966
|
}
|
|
1932
|
-
const
|
|
1967
|
+
const v = { source: t, target: e, cleanup: () => {
|
|
1933
1968
|
d.abort();
|
|
1934
1969
|
} };
|
|
1935
|
-
if (O(he,
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1938
|
-
I === "focusin" && (
|
|
1970
|
+
if (O(he, t, v), O(he, e, v), a) {
|
|
1971
|
+
const y = l.enter, w = l.leave;
|
|
1972
|
+
y.forEach((I) => {
|
|
1973
|
+
I === "focusin" && (t.tabIndex = 0), h(t, I, { passive: !0, once: m });
|
|
1939
1974
|
});
|
|
1940
1975
|
const b = !s.method || s.method === "toggle";
|
|
1941
1976
|
(f ? b : s.type !== "once") && w.forEach((I) => {
|
|
1942
1977
|
if (I === "focusout") {
|
|
1943
|
-
h(
|
|
1978
|
+
h(t, I, { once: m });
|
|
1944
1979
|
return;
|
|
1945
1980
|
}
|
|
1946
|
-
h(
|
|
1981
|
+
h(t, I, { passive: !0 });
|
|
1947
1982
|
});
|
|
1948
1983
|
} else
|
|
1949
|
-
(
|
|
1950
|
-
h(
|
|
1984
|
+
(l.toggle ?? []).forEach((w) => {
|
|
1985
|
+
h(t, w, { once: m, passive: w !== "keydown" });
|
|
1951
1986
|
});
|
|
1952
1987
|
}
|
|
1953
|
-
function
|
|
1954
|
-
|
|
1988
|
+
function ss(t) {
|
|
1989
|
+
D(he, t);
|
|
1955
1990
|
}
|
|
1956
1991
|
const R = {
|
|
1957
|
-
add:
|
|
1958
|
-
remove:
|
|
1992
|
+
add: ns,
|
|
1993
|
+
remove: ss
|
|
1959
1994
|
}, me = {
|
|
1960
1995
|
click: ["click"],
|
|
1961
1996
|
activate: ["click", "keydown"],
|
|
@@ -1968,14 +2003,14 @@ const R = {
|
|
|
1968
2003
|
click: me.activate,
|
|
1969
2004
|
hover: me.interest
|
|
1970
2005
|
};
|
|
1971
|
-
function Y(
|
|
1972
|
-
const
|
|
2006
|
+
function Y(t) {
|
|
2007
|
+
const e = me[t];
|
|
1973
2008
|
return (n, s, r, i, o) => {
|
|
1974
|
-
const c = o?.allowA11yTriggers &&
|
|
2009
|
+
const c = o?.allowA11yTriggers && t in Pe ? Pe[t] : e;
|
|
1975
2010
|
R.add(n, s, r, { ...i, eventConfig: c }, o ?? {});
|
|
1976
2011
|
};
|
|
1977
2012
|
}
|
|
1978
|
-
const
|
|
2013
|
+
const A = {
|
|
1979
2014
|
viewEnter: ke,
|
|
1980
2015
|
hover: {
|
|
1981
2016
|
add: Y("hover"),
|
|
@@ -1986,9 +2021,9 @@ const q = {
|
|
|
1986
2021
|
remove: R.remove
|
|
1987
2022
|
},
|
|
1988
2023
|
pageVisible: ke,
|
|
1989
|
-
animationEnd:
|
|
1990
|
-
viewProgress:
|
|
1991
|
-
pointerMove:
|
|
2024
|
+
animationEnd: jn,
|
|
2025
|
+
viewProgress: Tn,
|
|
2026
|
+
pointerMove: Nn,
|
|
1992
2027
|
activate: {
|
|
1993
2028
|
add: Y("activate"),
|
|
1994
2029
|
remove: R.remove
|
|
@@ -1998,8 +2033,8 @@ const q = {
|
|
|
1998
2033
|
remove: R.remove
|
|
1999
2034
|
}
|
|
2000
2035
|
};
|
|
2001
|
-
function
|
|
2002
|
-
return
|
|
2036
|
+
function is(t) {
|
|
2037
|
+
return t.replace(/\[([-\w]+)]/g, "[]");
|
|
2003
2038
|
}
|
|
2004
2039
|
class E {
|
|
2005
2040
|
static defineInteractElement;
|
|
@@ -2017,11 +2052,11 @@ class E {
|
|
|
2017
2052
|
constructor() {
|
|
2018
2053
|
this.dataCache = { effects: {}, sequences: {}, conditions: {}, interactions: {} }, this.addedInteractions = {}, this.mediaQueryListeners = /* @__PURE__ */ new Map(), this.listInteractionsCache = {}, this.controllers = /* @__PURE__ */ new Set();
|
|
2019
2054
|
}
|
|
2020
|
-
init(
|
|
2055
|
+
init(e, n) {
|
|
2021
2056
|
if (typeof window > "u" || !window.customElements)
|
|
2022
2057
|
return;
|
|
2023
2058
|
const s = n?.useCutsomElement ?? !!E.defineInteractElement;
|
|
2024
|
-
this.dataCache =
|
|
2059
|
+
this.dataCache = os(e, s);
|
|
2025
2060
|
const r = E.defineInteractElement?.();
|
|
2026
2061
|
s && r === !1 ? document.querySelectorAll("interact-element").forEach((i) => {
|
|
2027
2062
|
i.connect();
|
|
@@ -2030,94 +2065,94 @@ class E {
|
|
|
2030
2065
|
);
|
|
2031
2066
|
}
|
|
2032
2067
|
destroy() {
|
|
2033
|
-
for (const
|
|
2034
|
-
|
|
2035
|
-
for (const [,
|
|
2036
|
-
|
|
2068
|
+
for (const e of this.controllers)
|
|
2069
|
+
e.disconnect();
|
|
2070
|
+
for (const [, e] of this.mediaQueryListeners.entries())
|
|
2071
|
+
e.mql.removeEventListener("change", e.handler);
|
|
2037
2072
|
this.mediaQueryListeners.clear(), this.addedInteractions = {}, this.listInteractionsCache = {}, this.controllers.clear(), this.dataCache = { effects: {}, sequences: {}, conditions: {}, interactions: {} }, E.instances.splice(E.instances.indexOf(this), 1);
|
|
2038
2073
|
}
|
|
2039
|
-
setController(
|
|
2040
|
-
this.controllers.add(n), E.setController(
|
|
2074
|
+
setController(e, n) {
|
|
2075
|
+
this.controllers.add(n), E.setController(e, n);
|
|
2041
2076
|
}
|
|
2042
|
-
deleteController(
|
|
2043
|
-
const s = E.controllerCache.get(
|
|
2044
|
-
this.clearInteractionStateForKey(
|
|
2077
|
+
deleteController(e, n = !1) {
|
|
2078
|
+
const s = E.controllerCache.get(e);
|
|
2079
|
+
this.clearInteractionStateForKey(e), this.clearMediaQueryListenersForKey(e), s && n && (this.controllers.delete(s), E.deleteController(e));
|
|
2045
2080
|
}
|
|
2046
|
-
has(
|
|
2047
|
-
return !!this.get(
|
|
2081
|
+
has(e) {
|
|
2082
|
+
return !!this.get(e);
|
|
2048
2083
|
}
|
|
2049
|
-
get(
|
|
2050
|
-
const n =
|
|
2084
|
+
get(e) {
|
|
2085
|
+
const n = is(e);
|
|
2051
2086
|
return this.dataCache.interactions[n];
|
|
2052
2087
|
}
|
|
2053
|
-
clearMediaQueryListenersForKey(
|
|
2088
|
+
clearMediaQueryListenersForKey(e) {
|
|
2054
2089
|
for (const [n, s] of this.mediaQueryListeners.entries())
|
|
2055
|
-
s.key ===
|
|
2090
|
+
s.key === e && (s.mql.removeEventListener("change", s.handler), this.mediaQueryListeners.delete(n));
|
|
2056
2091
|
}
|
|
2057
|
-
clearInteractionStateForKey(
|
|
2058
|
-
(this.get(
|
|
2059
|
-
const i = C(r,
|
|
2092
|
+
clearInteractionStateForKey(e) {
|
|
2093
|
+
(this.get(e)?.interactionIds || []).forEach((r) => {
|
|
2094
|
+
const i = C(r, e);
|
|
2060
2095
|
delete this.addedInteractions[i];
|
|
2061
2096
|
});
|
|
2062
|
-
const s = `${
|
|
2097
|
+
const s = `${e}::seq::`;
|
|
2063
2098
|
for (const r of E.sequenceCache.keys())
|
|
2064
2099
|
r.startsWith(s) && (E.sequenceCache.delete(r), delete this.addedInteractions[r]);
|
|
2065
2100
|
}
|
|
2066
|
-
setupMediaQueryListener(
|
|
2067
|
-
this.mediaQueryListeners.has(
|
|
2101
|
+
setupMediaQueryListener(e, n, s, r) {
|
|
2102
|
+
this.mediaQueryListeners.has(e) || (n.addEventListener("change", r), this.mediaQueryListeners.set(e, {
|
|
2068
2103
|
mql: n,
|
|
2069
2104
|
handler: r,
|
|
2070
2105
|
key: s
|
|
2071
2106
|
}));
|
|
2072
2107
|
}
|
|
2073
|
-
static create(
|
|
2108
|
+
static create(e, n) {
|
|
2074
2109
|
const s = new E();
|
|
2075
|
-
return E.instances.push(s), s.init(
|
|
2110
|
+
return E.instances.push(s), s.init(e, n), s;
|
|
2076
2111
|
}
|
|
2077
2112
|
static destroy() {
|
|
2078
|
-
E.controllerCache.forEach((
|
|
2079
|
-
|
|
2113
|
+
E.controllerCache.forEach((e) => {
|
|
2114
|
+
e.disconnect();
|
|
2080
2115
|
}), E.instances.length = 0, E.controllerCache.clear(), E.sequenceCache.clear(), E.elementSequenceMap = /* @__PURE__ */ new WeakMap();
|
|
2081
2116
|
}
|
|
2082
|
-
static setup(
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
),
|
|
2086
|
-
|
|
2087
|
-
),
|
|
2088
|
-
|
|
2089
|
-
),
|
|
2117
|
+
static setup(e) {
|
|
2118
|
+
e.scrollOptionsGetter && A.viewProgress.registerOptionsGetter?.(
|
|
2119
|
+
e.scrollOptionsGetter
|
|
2120
|
+
), e.pointerOptionsGetter && A.pointerMove.registerOptionsGetter?.(
|
|
2121
|
+
e.pointerOptionsGetter
|
|
2122
|
+
), e.viewEnter && A.viewEnter.setOptions(
|
|
2123
|
+
e.viewEnter
|
|
2124
|
+
), e.allowA11yTriggers !== void 0 && (E.allowA11yTriggers = e.allowA11yTriggers);
|
|
2090
2125
|
}
|
|
2091
|
-
static getInstance(
|
|
2092
|
-
return E.instances.find((n) => n.has(
|
|
2126
|
+
static getInstance(e) {
|
|
2127
|
+
return E.instances.find((n) => n.has(e));
|
|
2093
2128
|
}
|
|
2094
|
-
static getController(
|
|
2095
|
-
return
|
|
2129
|
+
static getController(e) {
|
|
2130
|
+
return e ? E.controllerCache.get(e) : void 0;
|
|
2096
2131
|
}
|
|
2097
|
-
static setController(
|
|
2098
|
-
E.controllerCache.set(
|
|
2132
|
+
static setController(e, n) {
|
|
2133
|
+
E.controllerCache.set(e, n);
|
|
2099
2134
|
}
|
|
2100
|
-
static deleteController(
|
|
2101
|
-
E.controllerCache.delete(
|
|
2135
|
+
static deleteController(e) {
|
|
2136
|
+
E.controllerCache.delete(e);
|
|
2102
2137
|
}
|
|
2103
2138
|
static registerEffects = Rt;
|
|
2104
|
-
static getSequence(
|
|
2105
|
-
const i = E.sequenceCache.get(
|
|
2139
|
+
static getSequence(e, n, s, r) {
|
|
2140
|
+
const i = E.sequenceCache.get(e);
|
|
2106
2141
|
if (i) return i;
|
|
2107
2142
|
const o = Bt(n, s, r);
|
|
2108
|
-
return E.sequenceCache.set(
|
|
2143
|
+
return E.sequenceCache.set(e, o), E._registerSequenceElements(s, o), o;
|
|
2109
2144
|
}
|
|
2110
|
-
static addToSequence(
|
|
2111
|
-
const i = E.sequenceCache.get(
|
|
2145
|
+
static addToSequence(e, n, s, r) {
|
|
2146
|
+
const i = E.sequenceCache.get(e);
|
|
2112
2147
|
if (!i) return !1;
|
|
2113
|
-
const c = Ve(n, r).map((
|
|
2148
|
+
const c = Ve(n, r).map((l, f) => ({
|
|
2114
2149
|
index: s[f] ?? i.animationGroups.length,
|
|
2115
|
-
group:
|
|
2150
|
+
group: l
|
|
2116
2151
|
}));
|
|
2117
2152
|
return i.addGroups(c), E._registerSequenceElements(n, i), !0;
|
|
2118
2153
|
}
|
|
2119
|
-
static _registerSequenceElements(
|
|
2120
|
-
for (const { target: s } of
|
|
2154
|
+
static _registerSequenceElements(e, n) {
|
|
2155
|
+
for (const { target: s } of e) {
|
|
2121
2156
|
const r = Array.isArray(s) ? s : s instanceof HTMLElement ? [s] : [];
|
|
2122
2157
|
for (const i of r) {
|
|
2123
2158
|
let o = E.elementSequenceMap.get(i);
|
|
@@ -2125,8 +2160,8 @@ class E {
|
|
|
2125
2160
|
}
|
|
2126
2161
|
}
|
|
2127
2162
|
}
|
|
2128
|
-
static removeFromSequences(
|
|
2129
|
-
for (const n of
|
|
2163
|
+
static removeFromSequences(e) {
|
|
2164
|
+
for (const n of e) {
|
|
2130
2165
|
const s = E.elementSequenceMap.get(n);
|
|
2131
2166
|
if (s) {
|
|
2132
2167
|
for (const r of s)
|
|
@@ -2138,35 +2173,35 @@ class E {
|
|
|
2138
2173
|
}
|
|
2139
2174
|
}
|
|
2140
2175
|
}
|
|
2141
|
-
let
|
|
2142
|
-
function
|
|
2143
|
-
asCombinator:
|
|
2176
|
+
let rs = 0;
|
|
2177
|
+
function z(t, {
|
|
2178
|
+
asCombinator: e = !1,
|
|
2144
2179
|
addItemFilter: n = !1,
|
|
2145
2180
|
useFirstChild: s = !1
|
|
2146
2181
|
} = {}) {
|
|
2147
|
-
if (
|
|
2148
|
-
const r = `${n &&
|
|
2149
|
-
return
|
|
2150
|
-
} else if (
|
|
2151
|
-
return
|
|
2152
|
-
return s ?
|
|
2153
|
-
}
|
|
2154
|
-
function $e(
|
|
2155
|
-
return "sequenceId" in
|
|
2156
|
-
}
|
|
2157
|
-
function ce(
|
|
2158
|
-
return e
|
|
2182
|
+
if (t.listContainer) {
|
|
2183
|
+
const r = `${n && t.listItemSelector ? ` > ${t.listItemSelector}` : ""}`;
|
|
2184
|
+
return t.selector ? `${t.listContainer}${r} ${t.selector}` : `${t.listContainer}${r || " > *"}`;
|
|
2185
|
+
} else if (t.selector)
|
|
2186
|
+
return t.selector;
|
|
2187
|
+
return s ? e ? "> :first-child" : ":scope > :first-child" : "";
|
|
2188
|
+
}
|
|
2189
|
+
function $e(t) {
|
|
2190
|
+
return "sequenceId" in t && !("effects" in t);
|
|
2191
|
+
}
|
|
2192
|
+
function ce(t, e) {
|
|
2193
|
+
return t[e] || (t[e] = {
|
|
2159
2194
|
triggers: [],
|
|
2160
2195
|
effects: {},
|
|
2161
2196
|
sequences: {},
|
|
2162
2197
|
interactionIds: /* @__PURE__ */ new Set(),
|
|
2163
2198
|
selectors: /* @__PURE__ */ new Set()
|
|
2164
|
-
}), e
|
|
2199
|
+
}), t[e];
|
|
2165
2200
|
}
|
|
2166
|
-
function
|
|
2167
|
-
const n =
|
|
2168
|
-
return
|
|
2169
|
-
const i = r.key, o = ++
|
|
2201
|
+
function os(t, e = !1) {
|
|
2202
|
+
const n = t.conditions || {}, s = {};
|
|
2203
|
+
return t.interactions?.forEach((r) => {
|
|
2204
|
+
const i = r.key, o = ++rs, { effects: c, sequences: l, ...f } = r;
|
|
2170
2205
|
if (!i) {
|
|
2171
2206
|
console.error(`Interaction ${o} is missing a key for source element.`);
|
|
2172
2207
|
return;
|
|
@@ -2174,9 +2209,9 @@ function is(e, t = !1) {
|
|
|
2174
2209
|
ce(s, i);
|
|
2175
2210
|
const a = c ? Array.from(c) : [];
|
|
2176
2211
|
a.reverse();
|
|
2177
|
-
const
|
|
2212
|
+
const u = l?.map((d) => {
|
|
2178
2213
|
if ($e(d)) {
|
|
2179
|
-
const p =
|
|
2214
|
+
const p = t.sequences?.[d.sequenceId];
|
|
2180
2215
|
return p ? { ...p, ...d } : (console.warn(`Interact: Sequence "${d.sequenceId}" not found in config`), d);
|
|
2181
2216
|
}
|
|
2182
2217
|
const h = d;
|
|
@@ -2184,35 +2219,35 @@ function is(e, t = !1) {
|
|
|
2184
2219
|
}), m = {
|
|
2185
2220
|
...f,
|
|
2186
2221
|
effects: a.length > 0 ? a : void 0,
|
|
2187
|
-
sequences:
|
|
2222
|
+
sequences: u
|
|
2188
2223
|
};
|
|
2189
2224
|
s[i].triggers.push(m), s[i].selectors.add(
|
|
2190
|
-
|
|
2225
|
+
z(m, { useFirstChild: e })
|
|
2191
2226
|
);
|
|
2192
2227
|
const g = m.listContainer;
|
|
2193
2228
|
a.forEach((d) => {
|
|
2194
2229
|
let h = d.key;
|
|
2195
2230
|
if (!h && d.effectId) {
|
|
2196
|
-
const w =
|
|
2231
|
+
const w = t.effects[d.effectId];
|
|
2197
2232
|
w && (h = w.key);
|
|
2198
2233
|
}
|
|
2199
2234
|
d.effectId || (d.effectId = _()), h = h || i, d.key = h;
|
|
2200
2235
|
const p = d.effectId;
|
|
2201
2236
|
if (g && d.listContainer && (h !== i || d.listContainer !== g))
|
|
2202
2237
|
return;
|
|
2203
|
-
const
|
|
2204
|
-
if (d.interactionId =
|
|
2238
|
+
const v = `${i}::${h}::${p}::${o}`;
|
|
2239
|
+
if (d.interactionId = v, s[i].interactionIds.add(v), h === i)
|
|
2205
2240
|
return;
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
-
}),
|
|
2241
|
+
const y = ce(s, h);
|
|
2242
|
+
y.effects[v] || (y.effects[v] = [], y.interactionIds.add(v)), y.effects[v].push({ ...f, effect: d }), y.selectors.add(z(d, { useFirstChild: e }));
|
|
2243
|
+
}), u?.forEach((d) => {
|
|
2209
2244
|
if (!d || $e(d)) return;
|
|
2210
|
-
const h = d, p = h.sequenceId || _(),
|
|
2211
|
-
for (const
|
|
2212
|
-
|
|
2213
|
-
let w =
|
|
2214
|
-
if (!w &&
|
|
2215
|
-
const b =
|
|
2245
|
+
const h = d, p = h.sequenceId || _(), v = h.effects;
|
|
2246
|
+
for (const y of v) {
|
|
2247
|
+
y.effectId || (y.effectId = _());
|
|
2248
|
+
let w = y.key;
|
|
2249
|
+
if (!w && y.effectId) {
|
|
2250
|
+
const b = t.effects[y.effectId];
|
|
2216
2251
|
b && (w = b.key);
|
|
2217
2252
|
}
|
|
2218
2253
|
if (w = w || i, w !== i) {
|
|
@@ -2220,134 +2255,134 @@ function is(e, t = !1) {
|
|
|
2220
2255
|
b.sequences[S] || (b.sequences[S] = [], b.interactionIds.add(S)), b.sequences[S].push({
|
|
2221
2256
|
...f,
|
|
2222
2257
|
sequence: h
|
|
2223
|
-
}), b.selectors.add(
|
|
2258
|
+
}), b.selectors.add(z(y, { useFirstChild: e }));
|
|
2224
2259
|
}
|
|
2225
2260
|
}
|
|
2226
2261
|
});
|
|
2227
2262
|
}), {
|
|
2228
|
-
effects:
|
|
2229
|
-
sequences:
|
|
2263
|
+
effects: t.effects || {},
|
|
2264
|
+
sequences: t.sequences || {},
|
|
2230
2265
|
conditions: n,
|
|
2231
2266
|
interactions: s
|
|
2232
2267
|
};
|
|
2233
2268
|
}
|
|
2234
|
-
function pe(
|
|
2235
|
-
if (
|
|
2236
|
-
const s =
|
|
2237
|
-
return s ?
|
|
2269
|
+
function pe(t, e, n) {
|
|
2270
|
+
if (t.listContainer) {
|
|
2271
|
+
const s = e.querySelector(t.listContainer);
|
|
2272
|
+
return s ? t.selector ? Array.from(s.querySelectorAll(t.selector)) : Array.from(s.children) : (console.warn(`Interact: No container found for list container "${t.listContainer}"`), []);
|
|
2238
2273
|
}
|
|
2239
|
-
if (
|
|
2240
|
-
const s =
|
|
2274
|
+
if (t.selector) {
|
|
2275
|
+
const s = e.querySelectorAll(t.selector);
|
|
2241
2276
|
if (s.length > 0)
|
|
2242
2277
|
return Array.from(s);
|
|
2243
|
-
console.warn(`Interact: No elements found for selector "${
|
|
2278
|
+
console.warn(`Interact: No elements found for selector "${t.selector}"`);
|
|
2244
2279
|
}
|
|
2245
|
-
return n ?
|
|
2280
|
+
return n ? e.firstElementChild : e;
|
|
2246
2281
|
}
|
|
2247
|
-
function ge(
|
|
2248
|
-
return
|
|
2282
|
+
function ge(t, e) {
|
|
2283
|
+
return e.map((n) => t.selector ? n.querySelector(t.selector) : n).filter(Boolean);
|
|
2249
2284
|
}
|
|
2250
|
-
function Xe(
|
|
2285
|
+
function Xe(t, e, n, s, r, i, o, c) {
|
|
2251
2286
|
return [
|
|
2252
|
-
o ? ge(
|
|
2253
|
-
c ? ge(
|
|
2287
|
+
o ? ge(t, o) : pe(t, n, s),
|
|
2288
|
+
c ? ge(e, c) : pe(e, r, i)
|
|
2254
2289
|
];
|
|
2255
2290
|
}
|
|
2256
|
-
function Ue(
|
|
2257
|
-
const c = Array.isArray(s),
|
|
2291
|
+
function Ue(t, e, n, s, r, i, o) {
|
|
2292
|
+
const c = Array.isArray(s), l = Array.isArray(r);
|
|
2258
2293
|
c ? s.forEach((f, a) => {
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
|
|
2294
|
+
const u = l ? r[a] : r;
|
|
2295
|
+
u && Fe(
|
|
2296
|
+
t,
|
|
2262
2297
|
f,
|
|
2263
|
-
|
|
2264
|
-
|
|
2298
|
+
e.trigger,
|
|
2299
|
+
u,
|
|
2265
2300
|
n,
|
|
2266
|
-
|
|
2301
|
+
e.params,
|
|
2267
2302
|
i,
|
|
2268
2303
|
o
|
|
2269
2304
|
);
|
|
2270
|
-
}) : (
|
|
2305
|
+
}) : (l ? r : [r]).forEach((a) => {
|
|
2271
2306
|
Fe(
|
|
2272
|
-
|
|
2307
|
+
t,
|
|
2273
2308
|
s,
|
|
2274
|
-
|
|
2309
|
+
e.trigger,
|
|
2275
2310
|
a,
|
|
2276
2311
|
n,
|
|
2277
|
-
|
|
2312
|
+
e.params,
|
|
2278
2313
|
i,
|
|
2279
2314
|
o
|
|
2280
2315
|
);
|
|
2281
2316
|
});
|
|
2282
2317
|
}
|
|
2283
|
-
function Je(
|
|
2318
|
+
function Je(t, e, n, s, r) {
|
|
2284
2319
|
const i = {}, o = [];
|
|
2285
2320
|
(s.effects || []).forEach((c) => {
|
|
2286
|
-
const
|
|
2287
|
-
...n.dataCache.effects[
|
|
2321
|
+
const l = c.effectId, f = {
|
|
2322
|
+
...n.dataCache.effects[l] || {},
|
|
2288
2323
|
...c,
|
|
2289
|
-
effectId:
|
|
2290
|
-
}, a = f.key,
|
|
2291
|
-
if (i[
|
|
2324
|
+
effectId: l
|
|
2325
|
+
}, a = f.key, u = C(c.interactionId, t);
|
|
2326
|
+
if (i[u] || n.addedInteractions[u] && !r)
|
|
2292
2327
|
return;
|
|
2293
2328
|
const m = k(f.conditions || [], n.dataCache.conditions);
|
|
2294
|
-
if (m && n.setupMediaQueryListener(
|
|
2295
|
-
|
|
2329
|
+
if (m && n.setupMediaQueryListener(u, m, t, () => {
|
|
2330
|
+
e.update();
|
|
2296
2331
|
}), !m || m.matches) {
|
|
2297
|
-
i[
|
|
2298
|
-
const g = a && C(a,
|
|
2332
|
+
i[u] = !0;
|
|
2333
|
+
const g = a && C(a, t);
|
|
2299
2334
|
let d;
|
|
2300
2335
|
if (g) {
|
|
2301
2336
|
if (d = E.getController(g), !d)
|
|
2302
2337
|
return;
|
|
2303
2338
|
f.listContainer && d.watchChildList(f.listContainer);
|
|
2304
2339
|
} else
|
|
2305
|
-
d =
|
|
2340
|
+
d = e;
|
|
2306
2341
|
const [h, p] = Xe(
|
|
2307
2342
|
s,
|
|
2308
2343
|
f,
|
|
2309
|
-
|
|
2310
|
-
|
|
2344
|
+
e.element,
|
|
2345
|
+
e.useFirstChild,
|
|
2311
2346
|
d.element,
|
|
2312
2347
|
d.useFirstChild,
|
|
2313
2348
|
r
|
|
2314
2349
|
);
|
|
2315
2350
|
if (!h || !p)
|
|
2316
2351
|
return;
|
|
2317
|
-
n.addedInteractions[
|
|
2318
|
-
const
|
|
2352
|
+
n.addedInteractions[u] = !0;
|
|
2353
|
+
const v = g || s.key, y = L(
|
|
2319
2354
|
f.conditions || [],
|
|
2320
2355
|
n.dataCache.conditions
|
|
2321
2356
|
);
|
|
2322
2357
|
o.push([
|
|
2323
|
-
|
|
2358
|
+
v,
|
|
2324
2359
|
s,
|
|
2325
2360
|
f,
|
|
2326
2361
|
h,
|
|
2327
2362
|
p,
|
|
2328
|
-
|
|
2363
|
+
y,
|
|
2329
2364
|
d.useFirstChild
|
|
2330
2365
|
]);
|
|
2331
2366
|
}
|
|
2332
2367
|
}), o.reverse().forEach((c) => {
|
|
2333
2368
|
Ue(...c);
|
|
2334
|
-
}),
|
|
2369
|
+
}), as(t, e, n, s, r);
|
|
2335
2370
|
}
|
|
2336
|
-
function
|
|
2337
|
-
return "sequenceId" in
|
|
2371
|
+
function cs(t) {
|
|
2372
|
+
return "sequenceId" in t && !("effects" in t);
|
|
2338
2373
|
}
|
|
2339
|
-
function Ze(
|
|
2340
|
-
const c = k(
|
|
2341
|
-
if (c && r.setupMediaQueryListener(
|
|
2342
|
-
const
|
|
2374
|
+
function Ze(t, e, n, s, r, i, o) {
|
|
2375
|
+
const c = k(t.conditions || [], r.dataCache.conditions);
|
|
2376
|
+
if (c && r.setupMediaQueryListener(e, c, i.updateKey, i.onUpdate), c && !c.matches) return null;
|
|
2377
|
+
const l = t.effects || [], f = [];
|
|
2343
2378
|
let a = !1;
|
|
2344
|
-
for (const
|
|
2345
|
-
const m =
|
|
2379
|
+
for (const u of l) {
|
|
2380
|
+
const m = u.effectId, d = {
|
|
2346
2381
|
...m ? r.dataCache.effects[m] || {} : {},
|
|
2347
|
-
...
|
|
2382
|
+
...u
|
|
2348
2383
|
}, h = k(d.conditions || [], r.dataCache.conditions);
|
|
2349
2384
|
if (h) {
|
|
2350
|
-
const I = `${
|
|
2385
|
+
const I = `${e}::${m || "eff"}`;
|
|
2351
2386
|
r.setupMediaQueryListener(
|
|
2352
2387
|
I,
|
|
2353
2388
|
h,
|
|
@@ -2356,37 +2391,37 @@ function Ze(e, t, n, s, r, i, o) {
|
|
|
2356
2391
|
);
|
|
2357
2392
|
}
|
|
2358
2393
|
if (h && !h.matches) continue;
|
|
2359
|
-
const p = d.key,
|
|
2360
|
-
let
|
|
2361
|
-
if (
|
|
2362
|
-
if (
|
|
2394
|
+
const p = d.key, v = p && C(p, n);
|
|
2395
|
+
let y;
|
|
2396
|
+
if (v) {
|
|
2397
|
+
if (y = E.getController(v), !y) return null;
|
|
2363
2398
|
} else
|
|
2364
|
-
|
|
2365
|
-
const w =
|
|
2399
|
+
y = s;
|
|
2400
|
+
const w = v || n;
|
|
2366
2401
|
let b;
|
|
2367
2402
|
if (o && w === o.controllerKey && d.listContainer === o.listContainer ? (b = ge(d, o.elements), b.length > 0 && (a = !0)) : b = pe(
|
|
2368
2403
|
d,
|
|
2369
|
-
|
|
2370
|
-
|
|
2404
|
+
y.element,
|
|
2405
|
+
y.useFirstChild
|
|
2371
2406
|
), !b || Array.isArray(b) && b.length === 0) return null;
|
|
2372
2407
|
const S = P(d);
|
|
2373
2408
|
f.push({ target: b, options: S });
|
|
2374
2409
|
}
|
|
2375
2410
|
return o && !a ? null : f.length > 0 ? f : null;
|
|
2376
2411
|
}
|
|
2377
|
-
function et(
|
|
2378
|
-
const i = (
|
|
2379
|
-
if (!i) return n.map((c,
|
|
2412
|
+
function et(t, e, n) {
|
|
2413
|
+
const i = (t.useFirstChild ? t.element.firstElementChild : t.element)?.querySelector(e);
|
|
2414
|
+
if (!i) return n.map((c, l) => l);
|
|
2380
2415
|
const o = Array.from(i.children);
|
|
2381
2416
|
return n.map((c) => {
|
|
2382
|
-
const
|
|
2383
|
-
return
|
|
2417
|
+
const l = o.indexOf(c);
|
|
2418
|
+
return l >= 0 ? l : o.length;
|
|
2384
2419
|
});
|
|
2385
2420
|
}
|
|
2386
|
-
function
|
|
2421
|
+
function as(t, e, n, s, r) {
|
|
2387
2422
|
s.sequences?.forEach((i) => {
|
|
2388
2423
|
let o;
|
|
2389
|
-
if (
|
|
2424
|
+
if (cs(i)) {
|
|
2390
2425
|
const g = n.dataCache.sequences[i.sequenceId];
|
|
2391
2426
|
if (!g) {
|
|
2392
2427
|
console.warn(`Interact: Sequence "${i.sequenceId}" not found in cache`);
|
|
@@ -2395,84 +2430,84 @@ function os(e, t, n, s, r) {
|
|
|
2395
2430
|
o = { ...g, ...i };
|
|
2396
2431
|
} else
|
|
2397
2432
|
o = i;
|
|
2398
|
-
const c = o.sequenceId || _(),
|
|
2399
|
-
if (n.addedInteractions[
|
|
2400
|
-
const f = r && s.listContainer ? { controllerKey:
|
|
2433
|
+
const c = o.sequenceId || _(), l = C(`${t}::seq::${c}`, t);
|
|
2434
|
+
if (n.addedInteractions[l] && !r) return;
|
|
2435
|
+
const f = r && s.listContainer ? { controllerKey: t, listContainer: s.listContainer, elements: r } : void 0, a = Ze(
|
|
2401
2436
|
o,
|
|
2402
|
-
|
|
2403
|
-
e,
|
|
2437
|
+
l,
|
|
2404
2438
|
t,
|
|
2439
|
+
e,
|
|
2405
2440
|
n,
|
|
2406
|
-
{ updateKey:
|
|
2441
|
+
{ updateKey: t, onUpdate: () => e.update() },
|
|
2407
2442
|
f
|
|
2408
2443
|
);
|
|
2409
2444
|
if (!a) return;
|
|
2410
|
-
if (r && n.addedInteractions[
|
|
2445
|
+
if (r && n.addedInteractions[l]) {
|
|
2411
2446
|
const g = et(
|
|
2412
|
-
|
|
2447
|
+
e,
|
|
2413
2448
|
s.listContainer,
|
|
2414
2449
|
r
|
|
2415
2450
|
);
|
|
2416
|
-
E.addToSequence(
|
|
2451
|
+
E.addToSequence(l, a, g, {
|
|
2417
2452
|
reducedMotion: E.forceReducedMotion
|
|
2418
2453
|
});
|
|
2419
2454
|
return;
|
|
2420
2455
|
}
|
|
2421
|
-
const
|
|
2456
|
+
const u = E.getSequence(l, o, a, {
|
|
2422
2457
|
reducedMotion: E.forceReducedMotion
|
|
2423
2458
|
});
|
|
2424
|
-
n.addedInteractions[
|
|
2459
|
+
n.addedInteractions[l] = !0;
|
|
2425
2460
|
const m = L(
|
|
2426
2461
|
s.conditions || [],
|
|
2427
2462
|
n.dataCache.conditions
|
|
2428
2463
|
);
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2464
|
+
A[s.trigger]?.add(
|
|
2465
|
+
e.element,
|
|
2466
|
+
e.element,
|
|
2432
2467
|
{},
|
|
2433
2468
|
s.params || {},
|
|
2434
2469
|
{
|
|
2435
2470
|
reducedMotion: E.forceReducedMotion,
|
|
2436
2471
|
selectorCondition: m,
|
|
2437
|
-
animation:
|
|
2472
|
+
animation: u,
|
|
2438
2473
|
allowA11yTriggers: E.allowA11yTriggers
|
|
2439
2474
|
}
|
|
2440
2475
|
);
|
|
2441
2476
|
});
|
|
2442
2477
|
}
|
|
2443
|
-
function
|
|
2444
|
-
const i = n.get(
|
|
2478
|
+
function fs(t, e, n, s, r) {
|
|
2479
|
+
const i = n.get(t)?.sequences || {};
|
|
2445
2480
|
Object.keys(i).forEach((c) => {
|
|
2446
2481
|
i[c].some(({ sequence: f, ...a }) => {
|
|
2447
|
-
const
|
|
2482
|
+
const u = k(
|
|
2448
2483
|
a.conditions || [],
|
|
2449
2484
|
n.dataCache.conditions
|
|
2450
2485
|
);
|
|
2451
|
-
if (
|
|
2486
|
+
if (u && !u.matches)
|
|
2452
2487
|
return !1;
|
|
2453
|
-
const m = a.key && C(a.key,
|
|
2488
|
+
const m = a.key && C(a.key, t), g = E.getController(m);
|
|
2454
2489
|
if (!g)
|
|
2455
2490
|
return !0;
|
|
2456
2491
|
const d = f.sequenceId || _(), h = C(`${m}::seq::${d}`, m);
|
|
2457
2492
|
if (n.addedInteractions[h] && !r)
|
|
2458
2493
|
return !0;
|
|
2459
|
-
const
|
|
2494
|
+
const v = Ze(
|
|
2460
2495
|
f,
|
|
2461
2496
|
h,
|
|
2462
2497
|
m,
|
|
2463
2498
|
g,
|
|
2464
2499
|
n,
|
|
2465
|
-
{ updateKey:
|
|
2466
|
-
r && s ? { controllerKey:
|
|
2500
|
+
{ updateKey: t, onUpdate: () => e.update() },
|
|
2501
|
+
r && s ? { controllerKey: t, listContainer: s, elements: r } : void 0
|
|
2467
2502
|
);
|
|
2468
|
-
if (!
|
|
2503
|
+
if (!v) return !0;
|
|
2469
2504
|
if (r && n.addedInteractions[h]) {
|
|
2470
|
-
const b = et(
|
|
2471
|
-
return E.addToSequence(h,
|
|
2505
|
+
const b = et(e, s, r);
|
|
2506
|
+
return E.addToSequence(h, v, b, {
|
|
2472
2507
|
reducedMotion: E.forceReducedMotion
|
|
2473
2508
|
}), !0;
|
|
2474
2509
|
}
|
|
2475
|
-
const
|
|
2510
|
+
const y = E.getSequence(h, f, v, {
|
|
2476
2511
|
reducedMotion: E.forceReducedMotion
|
|
2477
2512
|
});
|
|
2478
2513
|
n.addedInteractions[h] = !0;
|
|
@@ -2480,7 +2515,7 @@ function cs(e, t, n, s, r) {
|
|
|
2480
2515
|
a.conditions || [],
|
|
2481
2516
|
n.dataCache.conditions
|
|
2482
2517
|
);
|
|
2483
|
-
return
|
|
2518
|
+
return A[a.trigger]?.add(
|
|
2484
2519
|
g.element,
|
|
2485
2520
|
g.element,
|
|
2486
2521
|
{},
|
|
@@ -2488,18 +2523,18 @@ function cs(e, t, n, s, r) {
|
|
|
2488
2523
|
{
|
|
2489
2524
|
reducedMotion: E.forceReducedMotion,
|
|
2490
2525
|
selectorCondition: w,
|
|
2491
|
-
animation:
|
|
2526
|
+
animation: y,
|
|
2492
2527
|
allowA11yTriggers: E.allowA11yTriggers
|
|
2493
2528
|
}
|
|
2494
2529
|
), !0;
|
|
2495
2530
|
});
|
|
2496
2531
|
});
|
|
2497
2532
|
}
|
|
2498
|
-
function tt(
|
|
2499
|
-
const i = n.get(
|
|
2533
|
+
function tt(t, e, n, s, r) {
|
|
2534
|
+
const i = n.get(t), o = i?.effects || {}, c = Object.keys(o), l = [];
|
|
2500
2535
|
c.forEach((a) => {
|
|
2501
|
-
const
|
|
2502
|
-
if (n.addedInteractions[
|
|
2536
|
+
const u = C(a, t);
|
|
2537
|
+
if (n.addedInteractions[u] && !r)
|
|
2503
2538
|
return;
|
|
2504
2539
|
o[a].some(({ effect: g, ...d }) => {
|
|
2505
2540
|
const h = k(
|
|
@@ -2508,158 +2543,158 @@ function tt(e, t, n, s, r) {
|
|
|
2508
2543
|
);
|
|
2509
2544
|
if (h && !h.matches)
|
|
2510
2545
|
return !1;
|
|
2511
|
-
const p = g.effectId,
|
|
2546
|
+
const p = g.effectId, v = {
|
|
2512
2547
|
...n.dataCache.effects[p] || {},
|
|
2513
2548
|
...g,
|
|
2514
2549
|
effectId: p
|
|
2515
2550
|
};
|
|
2516
|
-
if (s &&
|
|
2551
|
+
if (s && v.listContainer !== s)
|
|
2517
2552
|
return !1;
|
|
2518
|
-
const
|
|
2519
|
-
if (
|
|
2520
|
-
|
|
2521
|
-
}), !
|
|
2522
|
-
const w = d.key && C(d.key,
|
|
2553
|
+
const y = k(v.conditions || [], n.dataCache.conditions);
|
|
2554
|
+
if (y && n.setupMediaQueryListener(u, y, t, () => {
|
|
2555
|
+
e.update();
|
|
2556
|
+
}), !y || y.matches) {
|
|
2557
|
+
const w = d.key && C(d.key, t), b = E.getController(w);
|
|
2523
2558
|
if (!b)
|
|
2524
2559
|
return !0;
|
|
2525
|
-
|
|
2560
|
+
v.listContainer && e.watchChildList(v.listContainer);
|
|
2526
2561
|
const [S, I] = Xe(
|
|
2527
2562
|
d,
|
|
2528
|
-
|
|
2563
|
+
v,
|
|
2529
2564
|
b.element,
|
|
2530
2565
|
b.useFirstChild,
|
|
2531
|
-
|
|
2532
|
-
|
|
2566
|
+
e.element,
|
|
2567
|
+
e.useFirstChild,
|
|
2533
2568
|
void 0,
|
|
2534
2569
|
r
|
|
2535
2570
|
);
|
|
2536
2571
|
if (!S || !I)
|
|
2537
2572
|
return !0;
|
|
2538
|
-
n.addedInteractions[
|
|
2573
|
+
n.addedInteractions[u] = !0;
|
|
2539
2574
|
const $ = L(
|
|
2540
|
-
|
|
2575
|
+
v.conditions || [],
|
|
2541
2576
|
n.dataCache.conditions
|
|
2542
2577
|
);
|
|
2543
|
-
return
|
|
2544
|
-
|
|
2578
|
+
return l.push([
|
|
2579
|
+
t,
|
|
2545
2580
|
d,
|
|
2546
|
-
|
|
2581
|
+
v,
|
|
2547
2582
|
S,
|
|
2548
2583
|
I,
|
|
2549
2584
|
$,
|
|
2550
|
-
|
|
2585
|
+
e.useFirstChild
|
|
2551
2586
|
]), !0;
|
|
2552
2587
|
}
|
|
2553
2588
|
return !1;
|
|
2554
2589
|
});
|
|
2555
|
-
}),
|
|
2590
|
+
}), l.reverse().forEach((a) => {
|
|
2556
2591
|
Ue(...a);
|
|
2557
|
-
}),
|
|
2592
|
+
}), fs(t, e, n, s, r);
|
|
2558
2593
|
const f = Object.keys(i?.sequences || {}).length > 0;
|
|
2559
2594
|
return c.length > 0 || f;
|
|
2560
2595
|
}
|
|
2561
|
-
function Fe(
|
|
2562
|
-
let
|
|
2596
|
+
function Fe(t, e, n, s, r, i, o, c) {
|
|
2597
|
+
let l;
|
|
2563
2598
|
if (r.transition || r.transitionProperties) {
|
|
2564
2599
|
const f = {
|
|
2565
|
-
key:
|
|
2600
|
+
key: t,
|
|
2566
2601
|
effectId: r.effectId,
|
|
2567
2602
|
transition: r.transition,
|
|
2568
2603
|
properties: r.transitionProperties,
|
|
2569
|
-
childSelector:
|
|
2604
|
+
childSelector: z(r, {
|
|
2570
2605
|
asCombinator: !0,
|
|
2571
2606
|
addItemFilter: !0,
|
|
2572
2607
|
useFirstChild: c
|
|
2573
2608
|
}),
|
|
2574
2609
|
selectorCondition: o
|
|
2575
2610
|
};
|
|
2576
|
-
if (
|
|
2611
|
+
if (l = E.getController(t), !l)
|
|
2577
2612
|
return;
|
|
2578
|
-
|
|
2613
|
+
l.renderStyle(Kt(f));
|
|
2579
2614
|
}
|
|
2580
|
-
|
|
2615
|
+
A[n]?.add(e, s, r, i, {
|
|
2581
2616
|
reducedMotion: E.forceReducedMotion,
|
|
2582
|
-
targetController:
|
|
2617
|
+
targetController: l,
|
|
2583
2618
|
selectorCondition: o,
|
|
2584
2619
|
allowA11yTriggers: E.allowA11yTriggers
|
|
2585
2620
|
});
|
|
2586
2621
|
}
|
|
2587
|
-
function
|
|
2588
|
-
const
|
|
2622
|
+
function ls(t) {
|
|
2623
|
+
const e = t.key, n = E.getInstance(e);
|
|
2589
2624
|
if (!n)
|
|
2590
|
-
return console.warn(`No instance found for key: ${
|
|
2591
|
-
const { triggers: s = [] } = n?.get(
|
|
2592
|
-
n.setController(
|
|
2593
|
-
const
|
|
2594
|
-
if (
|
|
2595
|
-
const f = `${
|
|
2596
|
-
n.setupMediaQueryListener(f,
|
|
2597
|
-
|
|
2625
|
+
return console.warn(`No instance found for key: ${e}`), E.setController(e, t), !1;
|
|
2626
|
+
const { triggers: s = [] } = n?.get(e) || {}, r = s.length > 0;
|
|
2627
|
+
n.setController(e, t), s.forEach((o, c) => {
|
|
2628
|
+
const l = k(o.conditions, n.dataCache.conditions);
|
|
2629
|
+
if (l) {
|
|
2630
|
+
const f = `${e}::trigger::${c}`;
|
|
2631
|
+
n.setupMediaQueryListener(f, l, e, () => {
|
|
2632
|
+
t.update();
|
|
2598
2633
|
});
|
|
2599
2634
|
}
|
|
2600
|
-
(!
|
|
2635
|
+
(!l || l.matches) && (o.listContainer && t.watchChildList(o.listContainer), Je(e, t, n, o));
|
|
2601
2636
|
});
|
|
2602
2637
|
let i = !1;
|
|
2603
|
-
return n && (i = tt(
|
|
2638
|
+
return n && (i = tt(e, t, n)), r || i;
|
|
2604
2639
|
}
|
|
2605
|
-
function
|
|
2606
|
-
const s =
|
|
2640
|
+
function us(t, e, n) {
|
|
2641
|
+
const s = t.key, r = E.getInstance(s);
|
|
2607
2642
|
if (r) {
|
|
2608
2643
|
const { triggers: i = [] } = r?.get(s) || {};
|
|
2609
2644
|
i.forEach((o, c) => {
|
|
2610
|
-
if (o.listContainer !==
|
|
2645
|
+
if (o.listContainer !== e)
|
|
2611
2646
|
return;
|
|
2612
|
-
const
|
|
2613
|
-
if (
|
|
2614
|
-
const f = `${s}::listTrigger::${
|
|
2615
|
-
r.setupMediaQueryListener(f,
|
|
2616
|
-
|
|
2647
|
+
const l = k(o.conditions, r.dataCache.conditions);
|
|
2648
|
+
if (l) {
|
|
2649
|
+
const f = `${s}::listTrigger::${e}::${c}`;
|
|
2650
|
+
r.setupMediaQueryListener(f, l, s, () => {
|
|
2651
|
+
t.update();
|
|
2617
2652
|
});
|
|
2618
2653
|
}
|
|
2619
|
-
(!
|
|
2620
|
-
}), tt(s,
|
|
2654
|
+
(!l || l.matches) && Je(s, t, r, o, n);
|
|
2655
|
+
}), tt(s, t, r, e, n);
|
|
2621
2656
|
}
|
|
2622
2657
|
}
|
|
2623
|
-
function
|
|
2624
|
-
const n =
|
|
2658
|
+
function ds(t, e = !1) {
|
|
2659
|
+
const n = t.key, s = E.getInstance(n);
|
|
2625
2660
|
if (!s)
|
|
2626
2661
|
return;
|
|
2627
2662
|
const r = [...s.get(n)?.selectors.values() || []].filter(Boolean).join(",");
|
|
2628
2663
|
let i;
|
|
2629
|
-
r ? (i = [...
|
|
2664
|
+
r ? (i = [...t.element.querySelectorAll(r)], t.useFirstChild || i.push(t.element)) : i = [t.element], nt(i), s.deleteController(n, e);
|
|
2630
2665
|
}
|
|
2631
|
-
function nt(
|
|
2632
|
-
const
|
|
2633
|
-
for (const n of
|
|
2634
|
-
for (const s of
|
|
2666
|
+
function nt(t) {
|
|
2667
|
+
const e = Object.values(A);
|
|
2668
|
+
for (const n of t)
|
|
2669
|
+
for (const s of e)
|
|
2635
2670
|
s.remove(n);
|
|
2636
|
-
E.removeFromSequences(
|
|
2671
|
+
E.removeFromSequences(t);
|
|
2637
2672
|
}
|
|
2638
2673
|
const ae = "interactEffect";
|
|
2639
|
-
class
|
|
2674
|
+
class hs {
|
|
2640
2675
|
element;
|
|
2641
2676
|
key;
|
|
2642
2677
|
connected;
|
|
2643
2678
|
sheet;
|
|
2644
2679
|
useFirstChild;
|
|
2645
2680
|
_observers;
|
|
2646
|
-
constructor(
|
|
2647
|
-
this.element =
|
|
2681
|
+
constructor(e, n, s) {
|
|
2682
|
+
this.element = e, this.key = n, this.connected = !1, this.sheet = null, this._observers = /* @__PURE__ */ new WeakMap(), this.useFirstChild = s?.useFirstChild ?? !1;
|
|
2648
2683
|
}
|
|
2649
|
-
connect(
|
|
2684
|
+
connect(e) {
|
|
2650
2685
|
if (this.connected)
|
|
2651
2686
|
return;
|
|
2652
2687
|
const n = this.element.dataset.interactKey;
|
|
2653
|
-
if (
|
|
2688
|
+
if (e = e || this.key || n, !e) {
|
|
2654
2689
|
console.warn("Interact: No key provided");
|
|
2655
2690
|
return;
|
|
2656
2691
|
}
|
|
2657
|
-
n !==
|
|
2658
|
-
`Interact: Key mismatch between element ${n} and parameter ${
|
|
2659
|
-
), this.element.dataset.interactKey =
|
|
2692
|
+
n !== e && (n && console.warn(
|
|
2693
|
+
`Interact: Key mismatch between element ${n} and parameter ${e}, updating element key`
|
|
2694
|
+
), this.element.dataset.interactKey = e), this.key = e, this.connected = ls(this);
|
|
2660
2695
|
}
|
|
2661
|
-
disconnect({ removeFromCache:
|
|
2662
|
-
if ((this.key || this.element.dataset.interactKey) &&
|
|
2696
|
+
disconnect({ removeFromCache: e = !1 } = {}) {
|
|
2697
|
+
if ((this.key || this.element.dataset.interactKey) && ds(this, e), this.sheet) {
|
|
2663
2698
|
const s = document.adoptedStyleSheets.indexOf(this.sheet);
|
|
2664
2699
|
document.adoptedStyleSheets.splice(s, 1);
|
|
2665
2700
|
}
|
|
@@ -2668,13 +2703,13 @@ class us {
|
|
|
2668
2703
|
update() {
|
|
2669
2704
|
this.disconnect(), this.connect();
|
|
2670
2705
|
}
|
|
2671
|
-
renderStyle(
|
|
2706
|
+
renderStyle(e) {
|
|
2672
2707
|
if (!this.sheet)
|
|
2673
|
-
this.sheet = new CSSStyleSheet(), this.sheet.replaceSync(
|
|
2708
|
+
this.sheet = new CSSStyleSheet(), this.sheet.replaceSync(e.join(`
|
|
2674
2709
|
`)), document.adoptedStyleSheets.push(this.sheet);
|
|
2675
2710
|
else {
|
|
2676
2711
|
let n = this.sheet.cssRules.length;
|
|
2677
|
-
for (const s of
|
|
2712
|
+
for (const s of e)
|
|
2678
2713
|
try {
|
|
2679
2714
|
this.sheet.insertRule(s, n), n++;
|
|
2680
2715
|
} catch (r) {
|
|
@@ -2682,30 +2717,30 @@ class us {
|
|
|
2682
2717
|
}
|
|
2683
2718
|
}
|
|
2684
2719
|
}
|
|
2685
|
-
toggleEffect(
|
|
2720
|
+
toggleEffect(e, n, s, r) {
|
|
2686
2721
|
if (s === null)
|
|
2687
2722
|
return;
|
|
2688
2723
|
if (!r && this.element.toggleEffect) {
|
|
2689
|
-
this.element.toggleEffect(
|
|
2724
|
+
this.element.toggleEffect(e, n, s);
|
|
2690
2725
|
return;
|
|
2691
2726
|
}
|
|
2692
2727
|
const i = new Set(
|
|
2693
2728
|
this.element.dataset[ae]?.split(" ") || []
|
|
2694
2729
|
);
|
|
2695
|
-
n === "toggle" ? i.has(
|
|
2730
|
+
n === "toggle" ? i.has(e) ? i.delete(e) : i.add(e) : n === "add" ? i.add(e) : n === "remove" ? i.delete(e) : n === "clear" && i.clear(), (s || this.element).dataset[ae] = Array.from(i).join(" ");
|
|
2696
2731
|
}
|
|
2697
2732
|
getActiveEffects() {
|
|
2698
2733
|
const n = (this.element.dataset[ae] || "").trim();
|
|
2699
2734
|
return n ? n.split(/\s+/) : [];
|
|
2700
2735
|
}
|
|
2701
|
-
watchChildList(
|
|
2702
|
-
const n = this.element.querySelector(
|
|
2736
|
+
watchChildList(e) {
|
|
2737
|
+
const n = this.element.querySelector(e);
|
|
2703
2738
|
if (n) {
|
|
2704
2739
|
let s = this._observers.get(n);
|
|
2705
|
-
s || (s = new MutationObserver(this._childListChangeHandler.bind(this,
|
|
2740
|
+
s || (s = new MutationObserver(this._childListChangeHandler.bind(this, e)), this._observers.set(n, s), s.observe(n, { childList: !0 }));
|
|
2706
2741
|
}
|
|
2707
2742
|
}
|
|
2708
|
-
_childListChangeHandler(
|
|
2743
|
+
_childListChangeHandler(e, n) {
|
|
2709
2744
|
const s = this.key || this.element.dataset.interactKey, r = [], i = [];
|
|
2710
2745
|
n.forEach((o) => {
|
|
2711
2746
|
o.removedNodes.forEach((c) => {
|
|
@@ -2713,58 +2748,58 @@ class us {
|
|
|
2713
2748
|
}), o.addedNodes.forEach((c) => {
|
|
2714
2749
|
c instanceof HTMLElement && i.push(c);
|
|
2715
2750
|
});
|
|
2716
|
-
}), nt(r), s &&
|
|
2751
|
+
}), nt(r), s && us(this, e, i);
|
|
2717
2752
|
}
|
|
2718
2753
|
}
|
|
2719
|
-
function
|
|
2720
|
-
new
|
|
2754
|
+
function ys(t, e) {
|
|
2755
|
+
new hs(t, e).connect();
|
|
2721
2756
|
}
|
|
2722
|
-
function
|
|
2723
|
-
const
|
|
2724
|
-
|
|
2757
|
+
function Es(t) {
|
|
2758
|
+
const e = E.getController(t);
|
|
2759
|
+
e && e.disconnect({ removeFromCache: !0 });
|
|
2725
2760
|
}
|
|
2726
|
-
const
|
|
2727
|
-
let i = `[data-interact-key="${
|
|
2728
|
-
const o =
|
|
2761
|
+
const ms = (t, e, n, s) => {
|
|
2762
|
+
let i = `[data-interact-key="${t.replace(/"/g, "'")}"]`;
|
|
2763
|
+
const o = z(e, { asCombinator: !0, useFirstChild: s });
|
|
2729
2764
|
return o && (i = `${i} ${o}`), n && (i = Q(i, n)), i;
|
|
2730
2765
|
};
|
|
2731
|
-
function
|
|
2766
|
+
function ws(t, e = !1) {
|
|
2732
2767
|
const n = [], s = /* @__PURE__ */ new Set();
|
|
2733
|
-
return
|
|
2768
|
+
return t.interactions.forEach(
|
|
2734
2769
|
({
|
|
2735
2770
|
key: r,
|
|
2736
2771
|
selector: i,
|
|
2737
2772
|
listContainer: o,
|
|
2738
2773
|
listItemSelector: c,
|
|
2739
|
-
trigger:
|
|
2774
|
+
trigger: l,
|
|
2740
2775
|
params: f,
|
|
2741
2776
|
effects: a,
|
|
2742
|
-
conditions:
|
|
2777
|
+
conditions: u
|
|
2743
2778
|
}) => {
|
|
2744
|
-
if (
|
|
2779
|
+
if (l === "viewEnter") {
|
|
2745
2780
|
const g = f;
|
|
2746
2781
|
(!g?.type || g.type === "once") && a?.forEach((h) => {
|
|
2747
|
-
const p = h?.effectId &&
|
|
2748
|
-
key:
|
|
2749
|
-
selector:
|
|
2782
|
+
const p = h?.effectId && t.effects[h.effectId] || h, {
|
|
2783
|
+
key: v,
|
|
2784
|
+
selector: y,
|
|
2750
2785
|
listContainer: w,
|
|
2751
2786
|
listItemSelector: b,
|
|
2752
2787
|
conditions: S
|
|
2753
2788
|
} = p;
|
|
2754
|
-
if (!(!
|
|
2755
|
-
const ye =
|
|
2789
|
+
if (!(!v || v === r) || !(!y && !i || y === i) || !(!w && !o || w === o) || !(!b && !c || b === c)) return;
|
|
2790
|
+
const ye = t.conditions || {}, Ee = L(
|
|
2756
2791
|
S,
|
|
2757
2792
|
ye
|
|
2758
2793
|
), se = L(
|
|
2759
|
-
|
|
2794
|
+
u,
|
|
2760
2795
|
ye
|
|
2761
2796
|
);
|
|
2762
2797
|
if (!(!Ee && !se || Ee === se)) return;
|
|
2763
|
-
const ie =
|
|
2798
|
+
const ie = ms(
|
|
2764
2799
|
r,
|
|
2765
2800
|
p,
|
|
2766
2801
|
se,
|
|
2767
|
-
|
|
2802
|
+
e
|
|
2768
2803
|
);
|
|
2769
2804
|
s.has(ie) || (s.add(ie), n.push(`@media (prefers-reduced-motion: no-preference) {
|
|
2770
2805
|
${ie}:not([data-interact-enter]) {
|
|
@@ -2782,10 +2817,10 @@ function ys(e, t = !1) {
|
|
|
2782
2817
|
`);
|
|
2783
2818
|
}
|
|
2784
2819
|
export {
|
|
2785
|
-
|
|
2820
|
+
hs as I,
|
|
2786
2821
|
E as a,
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2822
|
+
ys as b,
|
|
2823
|
+
ws as g,
|
|
2824
|
+
Es as r
|
|
2790
2825
|
};
|
|
2791
|
-
//# sourceMappingURL=index-
|
|
2826
|
+
//# sourceMappingURL=index-DHqlFmW8.mjs.map
|