@wix/motion 2.0.0 → 2.0.1
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/motion.js +1 -1
- package/dist/cjs/motion.js.map +1 -1
- package/dist/es/motion.js +544 -352
- package/dist/es/motion.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/AnimationGroup.d.ts +5 -0
- package/dist/types/AnimationGroup.d.ts.map +1 -1
- package/dist/types/Sequence.d.ts +33 -0
- package/dist/types/Sequence.d.ts.map +1 -0
- package/dist/types/motion.d.ts +12 -3
- package/dist/types/motion.d.ts.map +1 -1
- package/dist/types/types.d.ts +14 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/es/motion.js
CHANGED
|
@@ -1,94 +1,104 @@
|
|
|
1
|
-
class
|
|
1
|
+
class O {
|
|
2
2
|
animations;
|
|
3
3
|
options;
|
|
4
4
|
ready;
|
|
5
5
|
isCSS;
|
|
6
|
-
constructor(
|
|
7
|
-
this.animations =
|
|
6
|
+
constructor(e, n) {
|
|
7
|
+
this.animations = e, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = e[0] instanceof CSSAnimation;
|
|
8
8
|
}
|
|
9
9
|
getProgress() {
|
|
10
10
|
return this.animations[0]?.effect?.getComputedTiming().progress || 0;
|
|
11
11
|
}
|
|
12
|
-
async play(
|
|
12
|
+
async play(e) {
|
|
13
13
|
await this.ready;
|
|
14
14
|
for (const n of this.animations)
|
|
15
15
|
n.play();
|
|
16
|
-
await Promise.all(this.animations.map((n) => n.ready)),
|
|
16
|
+
await Promise.all(this.animations.map((n) => n.ready)), e && e();
|
|
17
17
|
}
|
|
18
18
|
pause() {
|
|
19
|
-
for (const
|
|
20
|
-
|
|
19
|
+
for (const e of this.animations)
|
|
20
|
+
e.pause();
|
|
21
21
|
}
|
|
22
|
-
async reverse(
|
|
22
|
+
async reverse(e) {
|
|
23
23
|
await this.ready;
|
|
24
24
|
for (const n of this.animations)
|
|
25
25
|
n.reverse();
|
|
26
|
-
await Promise.all(this.animations.map((n) => n.ready)),
|
|
26
|
+
await Promise.all(this.animations.map((n) => n.ready)), e && e();
|
|
27
27
|
}
|
|
28
|
-
progress(
|
|
28
|
+
progress(e) {
|
|
29
29
|
for (const n of this.animations) {
|
|
30
|
-
const { delay: i, duration:
|
|
31
|
-
n.currentTime = ((i || 0) +
|
|
30
|
+
const { delay: i, duration: s, iterations: r } = n.effect.getTiming(), u = (Number.isFinite(s) ? s : 0) * (Number.isFinite(r) ? r : 1);
|
|
31
|
+
n.currentTime = ((i || 0) + u) * e;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
cancel() {
|
|
35
|
-
for (const
|
|
36
|
-
|
|
35
|
+
for (const e of this.animations)
|
|
36
|
+
e.cancel();
|
|
37
37
|
}
|
|
38
|
-
setPlaybackRate(
|
|
38
|
+
setPlaybackRate(e) {
|
|
39
39
|
for (const n of this.animations)
|
|
40
|
-
n.playbackRate =
|
|
40
|
+
n.playbackRate = e;
|
|
41
41
|
}
|
|
42
|
-
async onFinish(
|
|
42
|
+
async onFinish(e) {
|
|
43
43
|
try {
|
|
44
44
|
await Promise.all(this.animations.map((i) => i.finished));
|
|
45
45
|
const n = this.animations[0];
|
|
46
46
|
if (n && !this.isCSS) {
|
|
47
47
|
const i = n.effect?.target;
|
|
48
48
|
if (i) {
|
|
49
|
-
const
|
|
50
|
-
i.dispatchEvent(
|
|
49
|
+
const s = new Event("animationend");
|
|
50
|
+
i.dispatchEvent(s);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
e();
|
|
54
54
|
} catch (n) {
|
|
55
55
|
console.warn("animation was interrupted - aborting onFinish callback - ", n);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
get finished() {
|
|
59
|
-
return Promise.all(this.animations.map((
|
|
59
|
+
return Promise.all(this.animations.map((e) => e.finished));
|
|
60
60
|
}
|
|
61
61
|
get playState() {
|
|
62
62
|
return this.animations[0]?.playState;
|
|
63
63
|
}
|
|
64
|
+
getTimingOptions() {
|
|
65
|
+
return this.animations.map((e) => {
|
|
66
|
+
const n = e.effect?.getTiming(), i = n?.delay ?? 0, s = Number(n?.duration) || 0, r = n?.iterations ?? 1;
|
|
67
|
+
return {
|
|
68
|
+
delay: i,
|
|
69
|
+
duration: s,
|
|
70
|
+
iterations: r
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
|
-
const
|
|
66
|
-
linear:
|
|
67
|
-
sineIn:
|
|
68
|
-
sineOut:
|
|
75
|
+
const D = (t) => t, W = (t) => 1 - Math.cos(t * Math.PI / 2), B = (t) => Math.sin(t * Math.PI / 2), K = (t) => -(Math.cos(Math.PI * t) - 1) / 2, X = (t) => t ** 2, J = (t) => 1 - (1 - t) ** 2, U = (t) => t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2, Y = (t) => t ** 3, Q = (t) => 1 - (1 - t) ** 3, Z = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2, tt = (t) => t ** 4, et = (t) => 1 - (1 - t) ** 4, nt = (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2, it = (t) => t ** 5, st = (t) => 1 - (1 - t) ** 5, rt = (t) => t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2, ot = (t) => t === 0 ? 0 : 2 ** (10 * t - 10), at = (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t), ct = (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2, ut = (t) => 1 - Math.sqrt(1 - t ** 2), ft = (t) => Math.sqrt(1 - (t - 1) ** 2), lt = (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2, mt = (t) => 2.70158 * t ** 3 - 1.70158 * t ** 2, dt = (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2, ht = (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, z = {
|
|
76
|
+
linear: D,
|
|
77
|
+
sineIn: W,
|
|
78
|
+
sineOut: B,
|
|
69
79
|
sineInOut: K,
|
|
70
|
-
quadIn:
|
|
71
|
-
quadOut:
|
|
72
|
-
quadInOut:
|
|
73
|
-
cubicIn:
|
|
80
|
+
quadIn: X,
|
|
81
|
+
quadOut: J,
|
|
82
|
+
quadInOut: U,
|
|
83
|
+
cubicIn: Y,
|
|
74
84
|
cubicOut: Q,
|
|
75
|
-
cubicInOut:
|
|
76
|
-
quartIn:
|
|
77
|
-
quartOut:
|
|
78
|
-
quartInOut:
|
|
79
|
-
quintIn:
|
|
80
|
-
quintOut:
|
|
81
|
-
quintInOut:
|
|
82
|
-
expoIn:
|
|
83
|
-
expoOut:
|
|
84
|
-
expoInOut:
|
|
85
|
-
circIn:
|
|
86
|
-
circOut:
|
|
87
|
-
circInOut:
|
|
88
|
-
backIn:
|
|
89
|
-
backOut:
|
|
90
|
-
backInOut:
|
|
91
|
-
},
|
|
85
|
+
cubicInOut: Z,
|
|
86
|
+
quartIn: tt,
|
|
87
|
+
quartOut: et,
|
|
88
|
+
quartInOut: nt,
|
|
89
|
+
quintIn: it,
|
|
90
|
+
quintOut: st,
|
|
91
|
+
quintInOut: rt,
|
|
92
|
+
expoIn: ot,
|
|
93
|
+
expoOut: at,
|
|
94
|
+
expoInOut: ct,
|
|
95
|
+
circIn: ut,
|
|
96
|
+
circOut: ft,
|
|
97
|
+
circInOut: lt,
|
|
98
|
+
backIn: mt,
|
|
99
|
+
backOut: dt,
|
|
100
|
+
backInOut: ht
|
|
101
|
+
}, F = {
|
|
92
102
|
linear: "linear",
|
|
93
103
|
ease: "ease",
|
|
94
104
|
easeIn: "ease-in",
|
|
@@ -119,40 +129,197 @@ const H = (e) => e, V = (e) => 1 - Math.cos(e * Math.PI / 2), W = (e) => Math.si
|
|
|
119
129
|
backOut: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
120
130
|
backInOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
|
|
121
131
|
};
|
|
122
|
-
function
|
|
123
|
-
return
|
|
132
|
+
function pt(t) {
|
|
133
|
+
return t === "percentage" ? "%" : t || "px";
|
|
134
|
+
}
|
|
135
|
+
function gt(t) {
|
|
136
|
+
return t ? F[t] || t : F.linear;
|
|
137
|
+
}
|
|
138
|
+
function bt(t, e, n, i) {
|
|
139
|
+
const s = 3 * t, r = 3 * (n - t) - s, u = 1 - s - r, a = 3 * e, l = 3 * (i - e) - a, m = 1 - a - l, o = (d) => ((u * d + r) * d + s) * d, c = (d) => ((m * d + l) * d + a) * d, f = (d) => (3 * u * d + 2 * r) * d + s;
|
|
140
|
+
function p(d) {
|
|
141
|
+
let h = d;
|
|
142
|
+
for (let b = 0; b < 8; b++) {
|
|
143
|
+
const y = o(h) - d;
|
|
144
|
+
if (Math.abs(y) < 1e-7) return h;
|
|
145
|
+
const _ = f(h);
|
|
146
|
+
if (Math.abs(_) < 1e-6) break;
|
|
147
|
+
h -= y / _;
|
|
148
|
+
}
|
|
149
|
+
let v = 0, g = 1;
|
|
150
|
+
for (h = (v + g) / 2; g - v > 1e-7; ) {
|
|
151
|
+
const b = o(h);
|
|
152
|
+
if (Math.abs(b - d) < 1e-7) return h;
|
|
153
|
+
d > b ? v = h : g = h, h = (v + g) / 2;
|
|
154
|
+
}
|
|
155
|
+
return h;
|
|
156
|
+
}
|
|
157
|
+
return (d) => d <= 0 ? 0 : d >= 1 ? 1 : c(p(d));
|
|
158
|
+
}
|
|
159
|
+
function yt(t) {
|
|
160
|
+
const e = t.match(
|
|
161
|
+
/^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
|
|
162
|
+
);
|
|
163
|
+
if (!e) return;
|
|
164
|
+
const n = parseFloat(e[1]), i = parseFloat(e[2]), s = parseFloat(e[3]), r = parseFloat(e[4]);
|
|
165
|
+
if (![n, i, s, r].some(isNaN))
|
|
166
|
+
return bt(n, i, s, r);
|
|
167
|
+
}
|
|
168
|
+
function vt(t) {
|
|
169
|
+
const e = t.match(/^linear\((.+)\)$/);
|
|
170
|
+
if (!e) return;
|
|
171
|
+
const n = e[1].split(",").map((u) => u.trim()).filter(Boolean);
|
|
172
|
+
if (n.length === 0) return;
|
|
173
|
+
const i = [];
|
|
174
|
+
for (const u of n) {
|
|
175
|
+
const a = u.split(/\s+/), l = parseFloat(a[0]);
|
|
176
|
+
if (isNaN(l)) return;
|
|
177
|
+
const m = [];
|
|
178
|
+
for (let o = 1; o < a.length; o++)
|
|
179
|
+
if (a[o].endsWith("%")) {
|
|
180
|
+
const c = parseFloat(a[o]) / 100;
|
|
181
|
+
if (isNaN(c)) return;
|
|
182
|
+
m.push(c);
|
|
183
|
+
}
|
|
184
|
+
m.length === 0 ? i.push({ output: l, pos: null }) : m.length === 1 ? i.push({ output: l, pos: m[0] }) : (i.push({ output: l, pos: m[0] }), i.push({ output: l, pos: m[1] }));
|
|
185
|
+
}
|
|
186
|
+
if (i.length === 0) return;
|
|
187
|
+
i[0].pos === null && (i[0].pos = 0), i[i.length - 1].pos === null && (i[i.length - 1].pos = 1);
|
|
188
|
+
let s = 0;
|
|
189
|
+
for (; s < i.length; )
|
|
190
|
+
if (i[s].pos === null) {
|
|
191
|
+
const u = s - 1;
|
|
192
|
+
let a = s;
|
|
193
|
+
for (; a < i.length && i[a].pos === null; ) a++;
|
|
194
|
+
const l = i[u].pos, m = i[a].pos, o = a - u;
|
|
195
|
+
for (let c = u + 1; c < a; c++)
|
|
196
|
+
i[c].pos = l + (m - l) * (c - u) / o;
|
|
197
|
+
s = a + 1;
|
|
198
|
+
} else
|
|
199
|
+
s++;
|
|
200
|
+
for (let u = 1; u < i.length; u++)
|
|
201
|
+
i[u].pos < i[u - 1].pos && (i[u].pos = i[u - 1].pos);
|
|
202
|
+
const r = i;
|
|
203
|
+
return (u) => {
|
|
204
|
+
if (u <= r[0].pos) return r[0].output;
|
|
205
|
+
const a = r[r.length - 1];
|
|
206
|
+
if (u >= a.pos) return a.output;
|
|
207
|
+
let l = 0, m = r.length - 1;
|
|
208
|
+
for (; l < m - 1; ) {
|
|
209
|
+
const f = l + m >>> 1;
|
|
210
|
+
r[f].pos <= u ? l = f : m = f;
|
|
211
|
+
}
|
|
212
|
+
const o = r[l], c = r[m];
|
|
213
|
+
return c.pos === o.pos ? c.output : o.output + (c.output - o.output) * (u - o.pos) / (c.pos - o.pos);
|
|
214
|
+
};
|
|
124
215
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
216
|
+
function R(t) {
|
|
217
|
+
if (!t) return;
|
|
218
|
+
const e = z[t];
|
|
219
|
+
return e || (yt(t) ?? vt(t) ?? z.linear);
|
|
127
220
|
}
|
|
128
|
-
|
|
129
|
-
|
|
221
|
+
class Et extends O {
|
|
222
|
+
animationGroups;
|
|
223
|
+
delay;
|
|
224
|
+
offset;
|
|
225
|
+
offsetEasing;
|
|
226
|
+
timingOptions;
|
|
227
|
+
constructor(e, n = {}) {
|
|
228
|
+
const i = e.flatMap((s) => [...s.animations]);
|
|
229
|
+
super(i), this.animationGroups = e, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : R(n.offsetEasing) ?? D, this.timingOptions = this.animationGroups.map((s) => s.getTimingOptions().map(({ delay: r, duration: u, iterations: a }) => ({
|
|
230
|
+
delay: r,
|
|
231
|
+
duration: Number.isFinite(u) ? u : 0,
|
|
232
|
+
iterations: Number.isFinite(a) ? a : 1
|
|
233
|
+
}))), this.applyOffsets(), this.ready = Promise.all(e.map((s) => s.ready)).then(() => {
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Calculates stagger delay offsets for each animation group using the formula:
|
|
238
|
+
* easing(i / last) * last * offset
|
|
239
|
+
* where i is the group index and last is the index of the final group.
|
|
240
|
+
*/
|
|
241
|
+
calculateOffsets() {
|
|
242
|
+
const e = this.animationGroups.length;
|
|
243
|
+
if (e <= 1) return [0];
|
|
244
|
+
const n = e - 1;
|
|
245
|
+
return Array.from(
|
|
246
|
+
{ length: e },
|
|
247
|
+
(i, s) => this.offsetEasing(s / n) * n * this.offset | 0
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
applyOffsets() {
|
|
251
|
+
const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
|
|
252
|
+
this.animationGroups.forEach((i, s) => {
|
|
253
|
+
i.animations.forEach((r, u) => {
|
|
254
|
+
const a = r.effect;
|
|
255
|
+
if (!a) return;
|
|
256
|
+
const { delay: l, duration: m, iterations: o } = this.timingOptions[s][u], c = l + e[s], f = n - (c + m * o);
|
|
257
|
+
a.updateTiming({ delay: c + this.delay, endDelay: f });
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
getSequenceActiveDuration(e) {
|
|
262
|
+
const n = [];
|
|
263
|
+
for (let i = 0; i < this.timingOptions.length; i++) {
|
|
264
|
+
const s = this.timingOptions[i].reduce((r, u) => {
|
|
265
|
+
if (!u) return r;
|
|
266
|
+
const { delay: a, duration: l, iterations: m } = u;
|
|
267
|
+
return Math.max(r, a + l * m);
|
|
268
|
+
}, 0);
|
|
269
|
+
n.push(e[i] + s);
|
|
270
|
+
}
|
|
271
|
+
return Math.max(...n);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Inserts new AnimationGroups at specified indices, then recalculates
|
|
275
|
+
* stagger offsets for all groups. Each entry specifies the target index
|
|
276
|
+
* in the animationGroups array where the group should be inserted.
|
|
277
|
+
*/
|
|
278
|
+
addGroups(e) {
|
|
279
|
+
if (e.length === 0) return;
|
|
280
|
+
const n = [...e].sort((i, s) => s.index - i.index);
|
|
281
|
+
for (const { index: i, group: s } of n) {
|
|
282
|
+
const r = Math.min(i, this.animationGroups.length);
|
|
283
|
+
this.animationGroups.splice(r, 0, s), this.timingOptions.splice(r, 0, s.getTimingOptions());
|
|
284
|
+
const u = [...s.animations], a = this.animationGroups.slice(0, r).reduce((l, m) => l + m.animations.length, 0);
|
|
285
|
+
this.animations.splice(a, 0, ...u);
|
|
286
|
+
}
|
|
287
|
+
this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((i) => i.ready)).then(() => {
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
async onFinish(e) {
|
|
291
|
+
try {
|
|
292
|
+
await Promise.all(this.animationGroups.map((n) => n.finished)), e();
|
|
293
|
+
} catch (n) {
|
|
294
|
+
console.warn("animation was interrupted - aborting onFinish callback - ", n);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
130
297
|
}
|
|
131
|
-
class
|
|
298
|
+
class _t {
|
|
132
299
|
_animation;
|
|
133
300
|
customEffect;
|
|
134
301
|
progress;
|
|
135
302
|
_tickCbId;
|
|
136
303
|
_finishHandler;
|
|
137
|
-
constructor(
|
|
304
|
+
constructor(e, n, i, s) {
|
|
138
305
|
const r = new KeyframeEffect(n, [], {
|
|
139
306
|
...i,
|
|
140
307
|
composite: "add"
|
|
141
|
-
}), { timeline:
|
|
142
|
-
this._animation = new Animation(r,
|
|
143
|
-
this.effect.target?.getAnimations().find((
|
|
308
|
+
}), { timeline: u } = s;
|
|
309
|
+
this._animation = new Animation(r, u), this._tickCbId = null, this.progress = null, this.customEffect = (a) => e(r.target, a), this._finishHandler = (a) => {
|
|
310
|
+
this.effect.target?.getAnimations().find((l) => l === this._animation) || this.cancel();
|
|
144
311
|
}, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
|
|
145
312
|
}
|
|
146
313
|
// private tick method for customEffect loop implementation
|
|
147
314
|
_tick() {
|
|
148
315
|
try {
|
|
149
|
-
const
|
|
150
|
-
|
|
316
|
+
const e = this.effect?.getComputedTiming().progress ?? null;
|
|
317
|
+
e !== this.progress && (this.customEffect?.(e), this.progress = e), this._tickCbId = requestAnimationFrame(() => {
|
|
151
318
|
this._tick();
|
|
152
319
|
});
|
|
153
|
-
} catch (
|
|
320
|
+
} catch (e) {
|
|
154
321
|
this._tickCbId = null, console.error(
|
|
155
|
-
`failed to run customEffect! effectId: ${this.id}, error: ${
|
|
322
|
+
`failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error ? e.message : e}`
|
|
156
323
|
);
|
|
157
324
|
}
|
|
158
325
|
}
|
|
@@ -160,39 +327,39 @@ class pe {
|
|
|
160
327
|
get currentTime() {
|
|
161
328
|
return this._animation.currentTime;
|
|
162
329
|
}
|
|
163
|
-
set currentTime(
|
|
164
|
-
this._animation.currentTime =
|
|
330
|
+
set currentTime(e) {
|
|
331
|
+
this._animation.currentTime = e;
|
|
165
332
|
}
|
|
166
333
|
get startTime() {
|
|
167
334
|
return this._animation.startTime;
|
|
168
335
|
}
|
|
169
|
-
set startTime(
|
|
170
|
-
this._animation.startTime =
|
|
336
|
+
set startTime(e) {
|
|
337
|
+
this._animation.startTime = e;
|
|
171
338
|
}
|
|
172
339
|
get playbackRate() {
|
|
173
340
|
return this._animation.playbackRate;
|
|
174
341
|
}
|
|
175
|
-
set playbackRate(
|
|
176
|
-
this._animation.playbackRate =
|
|
342
|
+
set playbackRate(e) {
|
|
343
|
+
this._animation.playbackRate = e;
|
|
177
344
|
}
|
|
178
345
|
// Animation basic properties
|
|
179
346
|
get id() {
|
|
180
347
|
return this._animation.id;
|
|
181
348
|
}
|
|
182
|
-
set id(
|
|
183
|
-
this._animation.id =
|
|
349
|
+
set id(e) {
|
|
350
|
+
this._animation.id = e;
|
|
184
351
|
}
|
|
185
352
|
get effect() {
|
|
186
353
|
return this._animation.effect;
|
|
187
354
|
}
|
|
188
|
-
set effect(
|
|
189
|
-
this._animation.effect =
|
|
355
|
+
set effect(e) {
|
|
356
|
+
this._animation.effect = e;
|
|
190
357
|
}
|
|
191
358
|
get timeline() {
|
|
192
359
|
return this._animation.timeline;
|
|
193
360
|
}
|
|
194
|
-
set timeline(
|
|
195
|
-
this._animation.timeline =
|
|
361
|
+
set timeline(e) {
|
|
362
|
+
this._animation.timeline = e;
|
|
196
363
|
}
|
|
197
364
|
// Animation readonly state properties
|
|
198
365
|
get finished() {
|
|
@@ -214,20 +381,20 @@ class pe {
|
|
|
214
381
|
get oncancel() {
|
|
215
382
|
return this._animation.oncancel;
|
|
216
383
|
}
|
|
217
|
-
set oncancel(
|
|
218
|
-
this._animation.oncancel =
|
|
384
|
+
set oncancel(e) {
|
|
385
|
+
this._animation.oncancel = e;
|
|
219
386
|
}
|
|
220
387
|
get onfinish() {
|
|
221
388
|
return this._animation.onfinish;
|
|
222
389
|
}
|
|
223
|
-
set onfinish(
|
|
224
|
-
this._animation.onfinish =
|
|
390
|
+
set onfinish(e) {
|
|
391
|
+
this._animation.onfinish = e;
|
|
225
392
|
}
|
|
226
393
|
get onremove() {
|
|
227
394
|
return this._animation.onremove;
|
|
228
395
|
}
|
|
229
|
-
set onremove(
|
|
230
|
-
this._animation.onremove =
|
|
396
|
+
set onremove(e) {
|
|
397
|
+
this._animation.onremove = e;
|
|
231
398
|
}
|
|
232
399
|
// CustomAnimation overridden methods
|
|
233
400
|
play() {
|
|
@@ -254,37 +421,37 @@ class pe {
|
|
|
254
421
|
reverse() {
|
|
255
422
|
this._animation.reverse();
|
|
256
423
|
}
|
|
257
|
-
updatePlaybackRate(
|
|
258
|
-
this._animation.updatePlaybackRate(
|
|
424
|
+
updatePlaybackRate(e) {
|
|
425
|
+
this._animation.updatePlaybackRate(e);
|
|
259
426
|
}
|
|
260
427
|
// Animation events API
|
|
261
|
-
addEventListener(
|
|
262
|
-
this._animation.addEventListener(
|
|
428
|
+
addEventListener(e, n, i) {
|
|
429
|
+
this._animation.addEventListener(e, n, i);
|
|
263
430
|
}
|
|
264
|
-
removeEventListener(
|
|
265
|
-
this._animation.removeEventListener(
|
|
431
|
+
removeEventListener(e, n, i) {
|
|
432
|
+
this._animation.removeEventListener(e, n, i);
|
|
266
433
|
}
|
|
267
|
-
dispatchEvent(
|
|
268
|
-
return this._animation.dispatchEvent(
|
|
434
|
+
dispatchEvent(e) {
|
|
435
|
+
return this._animation.dispatchEvent(e);
|
|
269
436
|
}
|
|
270
437
|
}
|
|
271
|
-
function
|
|
272
|
-
return
|
|
438
|
+
function wt(t) {
|
|
439
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
273
440
|
}
|
|
274
|
-
var
|
|
275
|
-
function
|
|
276
|
-
return x || (x = 1, (function(
|
|
277
|
-
(function(
|
|
441
|
+
var A = { exports: {} }, C = A.exports, x;
|
|
442
|
+
function It() {
|
|
443
|
+
return x || (x = 1, (function(t) {
|
|
444
|
+
(function(e) {
|
|
278
445
|
var n = function() {
|
|
279
|
-
}, i =
|
|
280
|
-
return setTimeout(
|
|
446
|
+
}, i = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(o) {
|
|
447
|
+
return setTimeout(o, 16);
|
|
281
448
|
};
|
|
282
|
-
function
|
|
283
|
-
var
|
|
284
|
-
|
|
449
|
+
function s() {
|
|
450
|
+
var o = this;
|
|
451
|
+
o.reads = [], o.writes = [], o.raf = i.bind(e);
|
|
285
452
|
}
|
|
286
|
-
|
|
287
|
-
constructor:
|
|
453
|
+
s.prototype = {
|
|
454
|
+
constructor: s,
|
|
288
455
|
/**
|
|
289
456
|
* We run this inside a try catch
|
|
290
457
|
* so that if any jobs error, we
|
|
@@ -293,8 +460,8 @@ function ve() {
|
|
|
293
460
|
*
|
|
294
461
|
* @param {Array} tasks
|
|
295
462
|
*/
|
|
296
|
-
runTasks: function(
|
|
297
|
-
for (var
|
|
463
|
+
runTasks: function(o) {
|
|
464
|
+
for (var c; c = o.shift(); ) c();
|
|
298
465
|
},
|
|
299
466
|
/**
|
|
300
467
|
* Adds a job to the read batch and
|
|
@@ -304,9 +471,9 @@ function ve() {
|
|
|
304
471
|
* @param {Object} ctx the context to be bound to `fn` (optional).
|
|
305
472
|
* @public
|
|
306
473
|
*/
|
|
307
|
-
measure: function(
|
|
308
|
-
var
|
|
309
|
-
return this.reads.push(
|
|
474
|
+
measure: function(o, c) {
|
|
475
|
+
var f = c ? o.bind(c) : o;
|
|
476
|
+
return this.reads.push(f), r(this), f;
|
|
310
477
|
},
|
|
311
478
|
/**
|
|
312
479
|
* Adds a job to the
|
|
@@ -317,9 +484,9 @@ function ve() {
|
|
|
317
484
|
* @param {Object} ctx the context to be bound to `fn` (optional).
|
|
318
485
|
* @public
|
|
319
486
|
*/
|
|
320
|
-
mutate: function(
|
|
321
|
-
var
|
|
322
|
-
return this.writes.push(
|
|
487
|
+
mutate: function(o, c) {
|
|
488
|
+
var f = c ? o.bind(c) : o;
|
|
489
|
+
return this.writes.push(f), r(this), f;
|
|
323
490
|
},
|
|
324
491
|
/**
|
|
325
492
|
* Clears a scheduled 'read' or 'write' task.
|
|
@@ -328,8 +495,8 @@ function ve() {
|
|
|
328
495
|
* @return {Boolean} success
|
|
329
496
|
* @public
|
|
330
497
|
*/
|
|
331
|
-
clear: function(
|
|
332
|
-
return
|
|
498
|
+
clear: function(o) {
|
|
499
|
+
return a(this.reads, o) || a(this.writes, o);
|
|
333
500
|
},
|
|
334
501
|
/**
|
|
335
502
|
* Extend this FastDom with some
|
|
@@ -365,385 +532,410 @@ function ve() {
|
|
|
365
532
|
* @param {Object} props properties to mixin
|
|
366
533
|
* @return {FastDom}
|
|
367
534
|
*/
|
|
368
|
-
extend: function(
|
|
369
|
-
if (typeof
|
|
370
|
-
var
|
|
371
|
-
return
|
|
535
|
+
extend: function(o) {
|
|
536
|
+
if (typeof o != "object") throw new Error("expected object");
|
|
537
|
+
var c = Object.create(this);
|
|
538
|
+
return l(c, o), c.fastdom = this, c.initialize && c.initialize(), c;
|
|
372
539
|
},
|
|
373
540
|
// override this with a function
|
|
374
541
|
// to prevent Errors in console
|
|
375
542
|
// when tasks throw
|
|
376
543
|
catch: null
|
|
377
544
|
};
|
|
378
|
-
function r(
|
|
379
|
-
|
|
545
|
+
function r(o) {
|
|
546
|
+
o.scheduled || (o.scheduled = !0, o.raf(u.bind(null, o)));
|
|
380
547
|
}
|
|
381
|
-
function
|
|
382
|
-
var
|
|
548
|
+
function u(o) {
|
|
549
|
+
var c = o.writes, f = o.reads, p;
|
|
383
550
|
try {
|
|
384
|
-
n("flushing reads",
|
|
385
|
-
} catch (
|
|
386
|
-
|
|
551
|
+
n("flushing reads", f.length), o.runTasks(f), n("flushing writes", c.length), o.runTasks(c);
|
|
552
|
+
} catch (d) {
|
|
553
|
+
p = d;
|
|
387
554
|
}
|
|
388
|
-
if (
|
|
389
|
-
if (n("task errored",
|
|
390
|
-
else throw
|
|
555
|
+
if (o.scheduled = !1, (f.length || c.length) && r(o), p)
|
|
556
|
+
if (n("task errored", p.message), o.catch) o.catch(p);
|
|
557
|
+
else throw p;
|
|
391
558
|
}
|
|
392
|
-
function
|
|
393
|
-
var
|
|
394
|
-
return !!~
|
|
559
|
+
function a(o, c) {
|
|
560
|
+
var f = o.indexOf(c);
|
|
561
|
+
return !!~f && !!o.splice(f, 1);
|
|
395
562
|
}
|
|
396
|
-
function
|
|
397
|
-
for (var
|
|
398
|
-
|
|
563
|
+
function l(o, c) {
|
|
564
|
+
for (var f in c)
|
|
565
|
+
c.hasOwnProperty(f) && (o[f] = c[f]);
|
|
399
566
|
}
|
|
400
|
-
var
|
|
401
|
-
|
|
567
|
+
var m = e.fastdom = e.fastdom || new s();
|
|
568
|
+
t.exports = m;
|
|
402
569
|
})(typeof window < "u" ? window : typeof C < "u" ? C : globalThis);
|
|
403
|
-
})(
|
|
570
|
+
})(A)), A.exports;
|
|
404
571
|
}
|
|
405
|
-
var
|
|
406
|
-
const
|
|
407
|
-
function
|
|
408
|
-
Object.assign(
|
|
572
|
+
var Ot = It();
|
|
573
|
+
const E = /* @__PURE__ */ wt(Ot), $ = {};
|
|
574
|
+
function Nt(t) {
|
|
575
|
+
Object.assign($, t);
|
|
409
576
|
}
|
|
410
|
-
function
|
|
411
|
-
return
|
|
412
|
-
`${
|
|
577
|
+
function At(t) {
|
|
578
|
+
return t in $ ? $[t] : (console.warn(
|
|
579
|
+
`${t} not found in registry. Please make sure to import and register the preset.`
|
|
413
580
|
), null);
|
|
414
581
|
}
|
|
415
|
-
function
|
|
416
|
-
return
|
|
582
|
+
function w(t, e) {
|
|
583
|
+
return t ? (e || document).getElementById(t) : null;
|
|
417
584
|
}
|
|
418
|
-
function
|
|
419
|
-
return
|
|
585
|
+
function kt(t, e) {
|
|
586
|
+
return t?.matches(`[data-motion-part~="${e}"]`) ? t : t?.querySelector(`[data-motion-part~="${e}"]`);
|
|
420
587
|
}
|
|
421
|
-
function
|
|
422
|
-
const
|
|
423
|
-
return
|
|
588
|
+
function Tt(t) {
|
|
589
|
+
const e = t.alternate ? "alternate" : "";
|
|
590
|
+
return t.reversed ? `${e ? `${e}-` : ""}reverse` : e || "normal";
|
|
424
591
|
}
|
|
425
|
-
function
|
|
426
|
-
return `${
|
|
592
|
+
function T(t) {
|
|
593
|
+
return `${t.value}${pt(t.unit)}`;
|
|
427
594
|
}
|
|
428
|
-
function
|
|
429
|
-
return `${
|
|
595
|
+
function M(t, e, n) {
|
|
596
|
+
return `${t.name || "cover"} ${n && t.offset.unit !== "percentage" ? `calc(100% + ${T(t.offset)}${e ? ` + ${e}` : ""})` : e ? `calc(${T(t.offset)} + ${e})` : T(t.offset)}`;
|
|
430
597
|
}
|
|
431
|
-
function
|
|
598
|
+
function G(t) {
|
|
432
599
|
return {
|
|
433
|
-
start:
|
|
434
|
-
end:
|
|
600
|
+
start: M(t.startOffset, t.startOffsetAdd),
|
|
601
|
+
end: M(t.endOffset, t.endOffsetAdd, !0)
|
|
435
602
|
};
|
|
436
603
|
}
|
|
437
|
-
function
|
|
438
|
-
return (
|
|
604
|
+
function L(t) {
|
|
605
|
+
return (e) => E.measure(() => e(t));
|
|
439
606
|
}
|
|
440
|
-
function
|
|
441
|
-
return (
|
|
607
|
+
function j(t) {
|
|
608
|
+
return (e) => E.mutate(() => e(t));
|
|
442
609
|
}
|
|
443
|
-
function
|
|
444
|
-
if (
|
|
445
|
-
const
|
|
446
|
-
return typeof
|
|
447
|
-
} else if (
|
|
448
|
-
const
|
|
449
|
-
const { name:
|
|
450
|
-
return [{ ...i, name:
|
|
610
|
+
function I(t) {
|
|
611
|
+
if (t.namedEffect) {
|
|
612
|
+
const e = t.namedEffect.type;
|
|
613
|
+
return typeof e == "string" ? At(e) : null;
|
|
614
|
+
} else if (t.keyframeEffect) {
|
|
615
|
+
const e = (i) => {
|
|
616
|
+
const { name: s, keyframes: r } = i.keyframeEffect;
|
|
617
|
+
return [{ ...i, name: s, keyframes: r }];
|
|
451
618
|
};
|
|
452
|
-
return { web:
|
|
453
|
-
const { effectId:
|
|
454
|
-
return
|
|
619
|
+
return { web: e, style: e, getNames: (i) => {
|
|
620
|
+
const { effectId: s } = i, { name: r } = i.keyframeEffect, u = r || s;
|
|
621
|
+
return u ? [u] : [];
|
|
455
622
|
} };
|
|
456
|
-
} else if (
|
|
457
|
-
return (
|
|
623
|
+
} else if (t.customEffect)
|
|
624
|
+
return (e) => [{ ...e, keyframes: [] }];
|
|
458
625
|
return null;
|
|
459
626
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
627
|
+
function H(t, e, n) {
|
|
628
|
+
return t.map((i, s) => {
|
|
462
629
|
const r = {
|
|
463
630
|
fill: i.fill,
|
|
464
|
-
easing:
|
|
631
|
+
easing: gt(i.easing),
|
|
465
632
|
iterations: i.iterations === 0 ? 1 / 0 : i.iterations || 1,
|
|
466
633
|
composite: i.composite,
|
|
467
|
-
direction:
|
|
634
|
+
direction: Tt(i)
|
|
468
635
|
};
|
|
469
|
-
return q(
|
|
636
|
+
return q(e) ? (r.duration = i.duration, r.delay = i.delay || 0) : window.ViewTimeline && e?.trigger === "view-progress" ? r.duration = "auto" : (r.duration = 99.99, r.delay = 0.01), {
|
|
470
637
|
effect: i,
|
|
471
638
|
options: r,
|
|
472
|
-
id: n && `${n}-${
|
|
639
|
+
id: n && `${n}-${s + 1}`,
|
|
473
640
|
part: i.part
|
|
474
641
|
};
|
|
475
642
|
});
|
|
476
643
|
}
|
|
477
|
-
function q(
|
|
478
|
-
return !
|
|
644
|
+
function q(t) {
|
|
645
|
+
return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
|
|
479
646
|
}
|
|
480
|
-
function
|
|
481
|
-
if (
|
|
482
|
-
if (q(i) && (
|
|
483
|
-
if (
|
|
484
|
-
|
|
647
|
+
function N(t, e, n, i, s) {
|
|
648
|
+
if (t) {
|
|
649
|
+
if (q(i) && (e.duration = e.duration || 1, s?.reducedMotion))
|
|
650
|
+
if (e.iterations === 1 || e.iterations == null)
|
|
651
|
+
e = { ...e, duration: 1 };
|
|
485
652
|
else
|
|
486
653
|
return [];
|
|
487
654
|
let r;
|
|
488
|
-
return n instanceof HTMLElement && (r = { measure:
|
|
655
|
+
return n instanceof HTMLElement && (r = { measure: L(n), mutate: j(n) }), t.web ? t.web(e, r, s) : t(e, r, s);
|
|
489
656
|
}
|
|
490
657
|
return [];
|
|
491
658
|
}
|
|
492
|
-
function
|
|
493
|
-
const r =
|
|
494
|
-
if (n?.trigger === "pointer-move" && !
|
|
495
|
-
let
|
|
496
|
-
|
|
497
|
-
...
|
|
659
|
+
function V(t, e, n, i, s) {
|
|
660
|
+
const r = t instanceof HTMLElement ? t : w(t, s);
|
|
661
|
+
if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
|
|
662
|
+
let f = e;
|
|
663
|
+
e.customEffect && (f = {
|
|
664
|
+
...e,
|
|
498
665
|
namedEffect: { id: "", type: "CustomMouse" }
|
|
499
666
|
});
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
),
|
|
503
|
-
|
|
504
|
-
|
|
667
|
+
const p = I(
|
|
668
|
+
f
|
|
669
|
+
), d = N(
|
|
670
|
+
p,
|
|
671
|
+
e,
|
|
505
672
|
r,
|
|
506
673
|
n,
|
|
507
674
|
i
|
|
508
675
|
);
|
|
509
|
-
return typeof
|
|
676
|
+
return typeof d != "function" ? null : d(r);
|
|
510
677
|
}
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
678
|
+
const u = I(e), a = N(
|
|
679
|
+
u,
|
|
680
|
+
e,
|
|
514
681
|
r,
|
|
515
682
|
n,
|
|
516
683
|
i
|
|
517
684
|
);
|
|
518
|
-
if (!
|
|
685
|
+
if (!a || a.length === 0)
|
|
519
686
|
return null;
|
|
520
|
-
const
|
|
521
|
-
let
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
subject: n.element ||
|
|
687
|
+
const l = H(a, n, e.effectId);
|
|
688
|
+
let m;
|
|
689
|
+
const o = n?.trigger === "view-progress";
|
|
690
|
+
o && window.ViewTimeline && (m = new ViewTimeline({
|
|
691
|
+
subject: n.element || w(n.componentId)
|
|
525
692
|
}));
|
|
526
|
-
const
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
"timing" in
|
|
693
|
+
const c = l.map(({ effect: f, options: p, id: d, part: h }) => {
|
|
694
|
+
const v = h ? kt(r, h) : r, g = new KeyframeEffect(v || null, [], p);
|
|
695
|
+
E.mutate(() => {
|
|
696
|
+
"timing" in f && g.updateTiming(f.timing), g.setKeyframes(f.keyframes);
|
|
530
697
|
});
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
) : new Animation(
|
|
537
|
-
if (
|
|
538
|
-
if (
|
|
539
|
-
|
|
540
|
-
const { start:
|
|
541
|
-
|
|
698
|
+
const b = o && m ? { timeline: m } : {}, y = typeof f.customEffect == "function" ? new _t(
|
|
699
|
+
f.customEffect,
|
|
700
|
+
v || null,
|
|
701
|
+
p,
|
|
702
|
+
b
|
|
703
|
+
) : new Animation(g, b.timeline);
|
|
704
|
+
if (o)
|
|
705
|
+
if (m)
|
|
706
|
+
E.mutate(() => {
|
|
707
|
+
const { start: _, end: k } = G(f);
|
|
708
|
+
y.rangeStart = _, y.rangeEnd = k, y.play();
|
|
542
709
|
});
|
|
543
710
|
else {
|
|
544
|
-
const { startOffset:
|
|
545
|
-
|
|
546
|
-
const S =
|
|
547
|
-
Object.assign(
|
|
711
|
+
const { startOffset: _, endOffset: k } = e;
|
|
712
|
+
E.mutate(() => {
|
|
713
|
+
const S = f.startOffset || _, P = f.endOffset || k;
|
|
714
|
+
Object.assign(y, {
|
|
548
715
|
start: {
|
|
549
716
|
name: S.name,
|
|
550
717
|
offset: S.offset?.value,
|
|
551
|
-
add:
|
|
718
|
+
add: f.startOffsetAdd
|
|
552
719
|
},
|
|
553
720
|
end: {
|
|
554
721
|
name: P.name,
|
|
555
722
|
offset: P.offset?.value,
|
|
556
|
-
add:
|
|
723
|
+
add: f.endOffsetAdd
|
|
557
724
|
}
|
|
558
725
|
});
|
|
559
726
|
});
|
|
560
727
|
}
|
|
561
|
-
return
|
|
728
|
+
return d && (y.id = d), y;
|
|
562
729
|
});
|
|
563
|
-
return new
|
|
564
|
-
...
|
|
730
|
+
return new O(c, {
|
|
731
|
+
...e,
|
|
565
732
|
trigger: { ...n || {} },
|
|
566
733
|
// make sure the group is ready after all animation targets are measured and mutated
|
|
567
|
-
measured: new Promise((
|
|
734
|
+
measured: new Promise((f) => E.mutate(f))
|
|
568
735
|
});
|
|
569
736
|
}
|
|
570
|
-
function $
|
|
571
|
-
return
|
|
737
|
+
function $t(t, e) {
|
|
738
|
+
return t ? `#${t}${e ? `[data-motion-part~="${e}"]` : ""}` : "";
|
|
572
739
|
}
|
|
573
|
-
function
|
|
574
|
-
const { duration: n, delay: i, iterations:
|
|
575
|
-
return `${
|
|
740
|
+
function qt(t, e) {
|
|
741
|
+
const { duration: n, delay: i, iterations: s = 1, fill: r, easing: u = "linear", direction: a } = t.options, l = t.effect.name, m = n === "auto";
|
|
742
|
+
return `${l} ${m ? "auto" : `${n}ms`}${m ? " " : ` ${i || 1}ms `}${u}${r && r !== "none" ? ` ${r}` : ""} ${!s || s === 1 / 0 ? "infinite" : s}${a === "normal" ? "" : ` ${a}`} ${e ? "" : "paused"}`;
|
|
576
743
|
}
|
|
577
|
-
function
|
|
578
|
-
return
|
|
744
|
+
function St(t, e, n) {
|
|
745
|
+
return t?.style ? (q(n) && (e.duration = e.duration || 1), t.style(e)) : [];
|
|
579
746
|
}
|
|
580
|
-
function
|
|
581
|
-
const i =
|
|
582
|
-
return r.map((
|
|
583
|
-
const { start:
|
|
747
|
+
function Dt(t, e, n) {
|
|
748
|
+
const i = I(e), s = St(i, e), r = H(s, n, e.effectId), u = n?.trigger === "view-progress";
|
|
749
|
+
return r.map((a, l) => {
|
|
750
|
+
const { start: m, end: o } = u ? G(a.effect) : {};
|
|
584
751
|
return {
|
|
585
|
-
target: $
|
|
586
|
-
animation:
|
|
587
|
-
composition:
|
|
588
|
-
custom:
|
|
589
|
-
name:
|
|
590
|
-
keyframes:
|
|
591
|
-
id:
|
|
592
|
-
animationTimeline:
|
|
593
|
-
animationRange:
|
|
752
|
+
target: $t(t, a.part),
|
|
753
|
+
animation: qt(a, u),
|
|
754
|
+
composition: a.options.composite,
|
|
755
|
+
custom: a.effect.custom,
|
|
756
|
+
name: a.effect.name,
|
|
757
|
+
keyframes: a.effect.keyframes,
|
|
758
|
+
id: a.id && `${a.id}-${l + 1}`,
|
|
759
|
+
animationTimeline: u ? `--${n?.id}` : "",
|
|
760
|
+
animationRange: m || o ? `${m} ${o}` : ""
|
|
594
761
|
};
|
|
595
762
|
});
|
|
596
763
|
}
|
|
597
|
-
function
|
|
598
|
-
const i =
|
|
599
|
-
if (i && i.prepare &&
|
|
600
|
-
const r = { measure:
|
|
601
|
-
i.prepare(
|
|
764
|
+
function Pt(t, e, n) {
|
|
765
|
+
const i = I(e), s = t instanceof HTMLElement ? t : w(t);
|
|
766
|
+
if (i && i.prepare && s) {
|
|
767
|
+
const r = { measure: L(s), mutate: j(s) };
|
|
768
|
+
i.prepare(e, r);
|
|
602
769
|
}
|
|
603
|
-
n &&
|
|
770
|
+
n && E.mutate(n);
|
|
604
771
|
}
|
|
605
|
-
function
|
|
606
|
-
const n =
|
|
772
|
+
function zt(t, e) {
|
|
773
|
+
const n = I(e);
|
|
607
774
|
if (!n)
|
|
608
775
|
return null;
|
|
609
776
|
if (!n.style)
|
|
610
|
-
return
|
|
611
|
-
const i = n.getNames(
|
|
612
|
-
return i.forEach((
|
|
613
|
-
|
|
614
|
-
r?.find((
|
|
777
|
+
return e.effectId && t ? Ft(t, e.effectId) : null;
|
|
778
|
+
const i = n.getNames(e), r = (typeof t == "string" ? w(t) : t)?.getAnimations(), u = r?.map((l) => l.animationName) || [], a = [];
|
|
779
|
+
return i.forEach((l) => {
|
|
780
|
+
u.includes(l) && a.push(
|
|
781
|
+
r?.find((m) => m.animationName === l)
|
|
615
782
|
);
|
|
616
|
-
}),
|
|
783
|
+
}), a?.length ? new O(a) : null;
|
|
617
784
|
}
|
|
618
|
-
function
|
|
619
|
-
const i = (typeof
|
|
620
|
-
const r =
|
|
621
|
-
return r ? r.startsWith(
|
|
785
|
+
function Ft(t, e) {
|
|
786
|
+
const i = (typeof t == "string" ? w(t) : t)?.getAnimations().filter((s) => {
|
|
787
|
+
const r = s.id || s.animationName;
|
|
788
|
+
return r ? r.startsWith(e) : !0;
|
|
622
789
|
});
|
|
623
|
-
return i?.length ? new
|
|
790
|
+
return i?.length ? new O(i) : null;
|
|
624
791
|
}
|
|
625
|
-
function
|
|
626
|
-
const { disabled:
|
|
627
|
-
if (!
|
|
792
|
+
function Rt(t, e, n, i = {}) {
|
|
793
|
+
const { disabled: s, allowActiveEvent: r, ...u } = i, a = V(t, e, n, u);
|
|
794
|
+
if (!a)
|
|
628
795
|
return null;
|
|
629
|
-
let
|
|
796
|
+
let l = {};
|
|
630
797
|
if (n.trigger === "view-progress" && !window.ViewTimeline) {
|
|
631
|
-
const
|
|
632
|
-
return
|
|
798
|
+
const m = n.element || w(n.componentId), { ready: o } = a;
|
|
799
|
+
return a.animations.map((c) => ({
|
|
633
800
|
/* we use getters for start and end in order to access the animation's start and end
|
|
634
801
|
only when initializing the scrub scene rather than immediately */
|
|
635
802
|
get start() {
|
|
636
|
-
return
|
|
803
|
+
return c.start;
|
|
637
804
|
},
|
|
638
805
|
get end() {
|
|
639
|
-
return
|
|
806
|
+
return c.end;
|
|
640
807
|
},
|
|
641
|
-
viewSource:
|
|
642
|
-
ready:
|
|
808
|
+
viewSource: m,
|
|
809
|
+
ready: o,
|
|
643
810
|
getProgress() {
|
|
644
|
-
return
|
|
811
|
+
return a.getProgress();
|
|
645
812
|
},
|
|
646
|
-
effect(
|
|
647
|
-
const { activeDuration:
|
|
648
|
-
|
|
813
|
+
effect(f, p) {
|
|
814
|
+
const { activeDuration: d } = c.effect.getComputedTiming(), { delay: h } = c.effect.getTiming();
|
|
815
|
+
c.currentTime = ((h || 0) + (d || 0)) * p;
|
|
649
816
|
},
|
|
650
|
-
disabled:
|
|
817
|
+
disabled: s,
|
|
651
818
|
destroy() {
|
|
652
|
-
|
|
819
|
+
c.cancel();
|
|
653
820
|
}
|
|
654
821
|
}));
|
|
655
822
|
} else if (n.trigger === "pointer-move") {
|
|
656
|
-
const
|
|
657
|
-
if (
|
|
658
|
-
const
|
|
659
|
-
return
|
|
823
|
+
const m = e, { centeredToTarget: o, transitionDuration: c, transitionEasing: f } = m, p = n.axis;
|
|
824
|
+
if (m.keyframeEffect) {
|
|
825
|
+
const d = a;
|
|
826
|
+
return d.animations?.length === 0 ? null : {
|
|
660
827
|
target: void 0,
|
|
661
|
-
centeredToTarget:
|
|
662
|
-
ready:
|
|
828
|
+
centeredToTarget: o,
|
|
829
|
+
ready: d.ready,
|
|
663
830
|
_currentProgress: 0,
|
|
664
831
|
getProgress() {
|
|
665
832
|
return this._currentProgress;
|
|
666
833
|
},
|
|
667
|
-
effect(
|
|
668
|
-
const
|
|
669
|
-
this._currentProgress =
|
|
834
|
+
effect(v, g) {
|
|
835
|
+
const b = p === "x" ? g.x : g.y;
|
|
836
|
+
this._currentProgress = b, d.progress(b);
|
|
670
837
|
},
|
|
671
|
-
disabled:
|
|
838
|
+
disabled: s ?? !1,
|
|
672
839
|
destroy() {
|
|
673
|
-
|
|
840
|
+
d.cancel();
|
|
674
841
|
}
|
|
675
842
|
};
|
|
676
843
|
}
|
|
677
|
-
|
|
678
|
-
centeredToTarget:
|
|
844
|
+
l = {
|
|
845
|
+
centeredToTarget: o,
|
|
679
846
|
allowActiveEvent: r
|
|
680
|
-
},
|
|
847
|
+
}, e.customEffect && c && (l.transitionDuration = c, l.transitionEasing = R(f)), l.target = a.target;
|
|
681
848
|
}
|
|
682
849
|
return {
|
|
683
|
-
...
|
|
850
|
+
...l,
|
|
684
851
|
getProgress() {
|
|
685
|
-
return
|
|
852
|
+
return a.getProgress();
|
|
686
853
|
},
|
|
687
|
-
effect(
|
|
688
|
-
|
|
689
|
-
|
|
854
|
+
effect(m, o, c, f) {
|
|
855
|
+
a.progress(
|
|
856
|
+
c ? {
|
|
690
857
|
// @ts-expect-error spread error on p
|
|
691
|
-
...
|
|
692
|
-
v:
|
|
693
|
-
active:
|
|
694
|
-
} :
|
|
858
|
+
...o,
|
|
859
|
+
v: c,
|
|
860
|
+
active: f
|
|
861
|
+
} : o
|
|
695
862
|
);
|
|
696
863
|
},
|
|
697
|
-
disabled:
|
|
864
|
+
disabled: s,
|
|
698
865
|
destroy() {
|
|
699
|
-
|
|
866
|
+
a.cancel();
|
|
700
867
|
}
|
|
701
868
|
};
|
|
702
869
|
}
|
|
703
|
-
function
|
|
704
|
-
const
|
|
705
|
-
return
|
|
706
|
-
|
|
707
|
-
}),
|
|
870
|
+
function Ct(t, e, n, i = !1) {
|
|
871
|
+
const s = zt(t, e);
|
|
872
|
+
return s ? (s.ready = new Promise((r) => {
|
|
873
|
+
Pt(t, e, r);
|
|
874
|
+
}), s) : V(t, e, n, { reducedMotion: i });
|
|
875
|
+
}
|
|
876
|
+
function xt(t) {
|
|
877
|
+
return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
|
|
878
|
+
}
|
|
879
|
+
function Mt(t, e) {
|
|
880
|
+
const n = [];
|
|
881
|
+
for (const { target: i, options: s } of t) {
|
|
882
|
+
const r = xt(i);
|
|
883
|
+
for (const u of r) {
|
|
884
|
+
const a = Ct(
|
|
885
|
+
u,
|
|
886
|
+
s,
|
|
887
|
+
void 0,
|
|
888
|
+
e?.reducedMotion
|
|
889
|
+
);
|
|
890
|
+
a instanceof O && n.push(a);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
return n;
|
|
894
|
+
}
|
|
895
|
+
function Gt(t, e, n) {
|
|
896
|
+
const i = Mt(e, n);
|
|
897
|
+
return new Et(i, t);
|
|
708
898
|
}
|
|
709
899
|
export {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
900
|
+
mt as backIn,
|
|
901
|
+
ht as backInOut,
|
|
902
|
+
dt as backOut,
|
|
903
|
+
ut as circIn,
|
|
904
|
+
lt as circInOut,
|
|
905
|
+
ft as circOut,
|
|
906
|
+
Mt as createAnimationGroups,
|
|
907
|
+
F as cssEasings,
|
|
908
|
+
Y as cubicIn,
|
|
909
|
+
Z as cubicInOut,
|
|
719
910
|
Q as cubicOut,
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
911
|
+
ot as expoIn,
|
|
912
|
+
ct as expoInOut,
|
|
913
|
+
at as expoOut,
|
|
914
|
+
Ct as getAnimation,
|
|
915
|
+
Dt as getCSSAnimation,
|
|
916
|
+
pt as getCssUnits,
|
|
917
|
+
gt as getEasing,
|
|
918
|
+
Ft as getElementAnimation,
|
|
919
|
+
zt as getElementCSSAnimation,
|
|
920
|
+
R as getJsEasing,
|
|
921
|
+
Rt as getScrubScene,
|
|
922
|
+
Gt as getSequence,
|
|
923
|
+
V as getWebAnimation,
|
|
924
|
+
z as jsEasings,
|
|
925
|
+
D as linear,
|
|
926
|
+
Pt as prepareAnimation,
|
|
927
|
+
X as quadIn,
|
|
928
|
+
U as quadInOut,
|
|
929
|
+
J as quadOut,
|
|
930
|
+
tt as quartIn,
|
|
931
|
+
nt as quartInOut,
|
|
932
|
+
et as quartOut,
|
|
933
|
+
it as quintIn,
|
|
934
|
+
rt as quintInOut,
|
|
935
|
+
st as quintOut,
|
|
936
|
+
Nt as registerEffects,
|
|
937
|
+
W as sineIn,
|
|
746
938
|
K as sineInOut,
|
|
747
|
-
|
|
939
|
+
B as sineOut
|
|
748
940
|
};
|
|
749
941
|
//# sourceMappingURL=motion.js.map
|