@mobielnl/elements 0.9.0 → 0.10.0
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/elements.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.umd.cjs +240 -213
- package/dist/index-Bf0gZOvJ.js +2525 -0
- package/dist/{index-D_h35XTR.js → index-CY36KeHQ.js} +38310 -30736
- package/dist/index.d.ts +425 -20
- package/package.json +7 -5
- package/dist/index-DGwXRCKf.js +0 -2382
package/dist/index-DGwXRCKf.js
DELETED
|
@@ -1,2382 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { r as pt, t as Z, i as Re, a as q, n as De, p as mt, b as fn, c as Ve, d as pn, v as mn, e as gn, f as x, g as le, s as vn, h as yn, j as Ie, k as H, l as gt, m as Y, o as bn, q as Tn, u as te, w as ue, x as I, y as ne, z as Vn, A as An, B as vt, C as Ne, D as Sn, E as wn, F as Pn, G as D, H as yt, I as bt, J as Tt, K as je, L as Vt, M as xn, N as Cn, O as Mn, P as ze, Q as Fn, R as On, S as Rn, T as Dn, U as In, V as Nn, W as Kn, X as En, Y as Bn, Z as Ln, _ as kn } from "./index-D_h35XTR.js";
|
|
3
|
-
import { Fragment as _n } from "react";
|
|
4
|
-
var ae = typeof globalThis < "u" && globalThis.process ? globalThis.process : { env: { NODE_ENV: "production" } };
|
|
5
|
-
function At(t, e) {
|
|
6
|
-
if (!Array.isArray(e))
|
|
7
|
-
return !1;
|
|
8
|
-
const n = e.length;
|
|
9
|
-
if (n !== t.length)
|
|
10
|
-
return !1;
|
|
11
|
-
for (let s = 0; s < n; s++)
|
|
12
|
-
if (e[s] !== t[s])
|
|
13
|
-
return !1;
|
|
14
|
-
return !0;
|
|
15
|
-
}
|
|
16
|
-
function ce(t, e, n) {
|
|
17
|
-
const s = t.getProps();
|
|
18
|
-
return pt(s, e, n !== void 0 ? n : s.custom, t);
|
|
19
|
-
}
|
|
20
|
-
const R = (t) => t * 1e3, N = (t) => t / 1e3, Gn = {
|
|
21
|
-
type: "spring",
|
|
22
|
-
stiffness: 500,
|
|
23
|
-
damping: 25,
|
|
24
|
-
restSpeed: 10
|
|
25
|
-
}, Un = (t) => ({
|
|
26
|
-
type: "spring",
|
|
27
|
-
stiffness: 550,
|
|
28
|
-
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
|
|
29
|
-
restSpeed: 10
|
|
30
|
-
}), $n = {
|
|
31
|
-
type: "keyframes",
|
|
32
|
-
duration: 0.8
|
|
33
|
-
}, Wn = {
|
|
34
|
-
type: "keyframes",
|
|
35
|
-
ease: [0.25, 0.1, 0.35, 1],
|
|
36
|
-
duration: 0.3
|
|
37
|
-
}, jn = (t, { keyframes: e }) => e.length > 2 ? $n : Z.has(t) ? t.startsWith("scale") ? Un(e[1]) : Gn : Wn;
|
|
38
|
-
function zn({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: l, from: a, elapsed: u, ...h }) {
|
|
39
|
-
return !!Object.keys(h).length;
|
|
40
|
-
}
|
|
41
|
-
function St(t, e) {
|
|
42
|
-
return t[e] || t.default || t;
|
|
43
|
-
}
|
|
44
|
-
const Hn = {
|
|
45
|
-
useManualTiming: !1
|
|
46
|
-
}, qn = (t) => t !== null;
|
|
47
|
-
function he(t, { repeat: e, repeatType: n = "loop" }, s) {
|
|
48
|
-
const i = t.filter(qn), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
|
|
49
|
-
return !r || s === void 0 ? i[r] : s;
|
|
50
|
-
}
|
|
51
|
-
const wt = (t) => /^0[^.\s]+$/u.test(t);
|
|
52
|
-
function Yn(t) {
|
|
53
|
-
return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || wt(t) : !0;
|
|
54
|
-
}
|
|
55
|
-
const Pt = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), Xn = (
|
|
56
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
|
|
57
|
-
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
|
|
58
|
-
);
|
|
59
|
-
function Zn(t) {
|
|
60
|
-
const e = Xn.exec(t);
|
|
61
|
-
if (!e)
|
|
62
|
-
return [,];
|
|
63
|
-
const [, n, s, i] = e;
|
|
64
|
-
return [`--${n ?? s}`, i];
|
|
65
|
-
}
|
|
66
|
-
const Jn = 4;
|
|
67
|
-
function xt(t, e, n = 1) {
|
|
68
|
-
q(n <= Jn, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);
|
|
69
|
-
const [s, i] = Zn(t);
|
|
70
|
-
if (!s)
|
|
71
|
-
return;
|
|
72
|
-
const r = window.getComputedStyle(e).getPropertyValue(s);
|
|
73
|
-
if (r) {
|
|
74
|
-
const o = r.trim();
|
|
75
|
-
return Pt(o) ? parseFloat(o) : o;
|
|
76
|
-
}
|
|
77
|
-
return Re(i) ? xt(i, e, n + 1) : i;
|
|
78
|
-
}
|
|
79
|
-
const Qn = /* @__PURE__ */ new Set([
|
|
80
|
-
"width",
|
|
81
|
-
"height",
|
|
82
|
-
"top",
|
|
83
|
-
"left",
|
|
84
|
-
"right",
|
|
85
|
-
"bottom",
|
|
86
|
-
"x",
|
|
87
|
-
"y",
|
|
88
|
-
"translateX",
|
|
89
|
-
"translateY"
|
|
90
|
-
]), He = (t) => t === De || t === mt, qe = (t, e) => parseFloat(t.split(", ")[e]), Ye = (t, e) => (n, { transform: s }) => {
|
|
91
|
-
if (s === "none" || !s)
|
|
92
|
-
return 0;
|
|
93
|
-
const i = s.match(/^matrix3d\((.+)\)$/u);
|
|
94
|
-
if (i)
|
|
95
|
-
return qe(i[1], e);
|
|
96
|
-
{
|
|
97
|
-
const r = s.match(/^matrix\((.+)\)$/u);
|
|
98
|
-
return r ? qe(r[1], t) : 0;
|
|
99
|
-
}
|
|
100
|
-
}, es = /* @__PURE__ */ new Set(["x", "y", "z"]), ts = fn.filter((t) => !es.has(t));
|
|
101
|
-
function ns(t) {
|
|
102
|
-
const e = [];
|
|
103
|
-
return ts.forEach((n) => {
|
|
104
|
-
const s = t.getValue(n);
|
|
105
|
-
s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
|
|
106
|
-
}), e;
|
|
107
|
-
}
|
|
108
|
-
const $ = {
|
|
109
|
-
// Dimensions
|
|
110
|
-
width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
111
|
-
height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
112
|
-
top: (t, { top: e }) => parseFloat(e),
|
|
113
|
-
left: (t, { left: e }) => parseFloat(e),
|
|
114
|
-
bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
|
|
115
|
-
right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
|
|
116
|
-
// Transform
|
|
117
|
-
x: Ye(4, 13),
|
|
118
|
-
y: Ye(5, 14)
|
|
119
|
-
};
|
|
120
|
-
$.translateX = $.x;
|
|
121
|
-
$.translateY = $.y;
|
|
122
|
-
const Ct = (t) => (e) => e.test(t), ss = {
|
|
123
|
-
test: (t) => t === "auto",
|
|
124
|
-
parse: (t) => t
|
|
125
|
-
}, Mt = [De, mt, Ve, pn, mn, gn, ss], Xe = (t) => Mt.find(Ct(t)), _ = /* @__PURE__ */ new Set();
|
|
126
|
-
let Ae = !1, Se = !1;
|
|
127
|
-
function Ft() {
|
|
128
|
-
if (Se) {
|
|
129
|
-
const t = Array.from(_).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
|
|
130
|
-
e.forEach((s) => {
|
|
131
|
-
const i = ns(s);
|
|
132
|
-
i.length && (n.set(s, i), s.render());
|
|
133
|
-
}), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
|
|
134
|
-
s.render();
|
|
135
|
-
const i = n.get(s);
|
|
136
|
-
i && i.forEach(([r, o]) => {
|
|
137
|
-
var l;
|
|
138
|
-
(l = s.getValue(r)) === null || l === void 0 || l.set(o);
|
|
139
|
-
});
|
|
140
|
-
}), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
|
|
141
|
-
s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
Se = !1, Ae = !1, _.forEach((t) => t.complete()), _.clear();
|
|
145
|
-
}
|
|
146
|
-
function Ot() {
|
|
147
|
-
_.forEach((t) => {
|
|
148
|
-
t.readKeyframes(), t.needsMeasurement && (Se = !0);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function is() {
|
|
152
|
-
Ot(), Ft();
|
|
153
|
-
}
|
|
154
|
-
class Ke {
|
|
155
|
-
constructor(e, n, s, i, r, o = !1) {
|
|
156
|
-
this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = o;
|
|
157
|
-
}
|
|
158
|
-
scheduleResolve() {
|
|
159
|
-
this.isScheduled = !0, this.isAsync ? (_.add(this), Ae || (Ae = !0, x.read(Ot), x.resolveKeyframes(Ft))) : (this.readKeyframes(), this.complete());
|
|
160
|
-
}
|
|
161
|
-
readKeyframes() {
|
|
162
|
-
const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
|
|
163
|
-
for (let r = 0; r < e.length; r++)
|
|
164
|
-
if (e[r] === null)
|
|
165
|
-
if (r === 0) {
|
|
166
|
-
const o = i?.get(), l = e[e.length - 1];
|
|
167
|
-
if (o !== void 0)
|
|
168
|
-
e[0] = o;
|
|
169
|
-
else if (s && n) {
|
|
170
|
-
const a = s.readValue(n, l);
|
|
171
|
-
a != null && (e[0] = a);
|
|
172
|
-
}
|
|
173
|
-
e[0] === void 0 && (e[0] = l), i && o === void 0 && i.set(e[0]);
|
|
174
|
-
} else
|
|
175
|
-
e[r] = e[r - 1];
|
|
176
|
-
}
|
|
177
|
-
setFinalKeyframe() {
|
|
178
|
-
}
|
|
179
|
-
measureInitialState() {
|
|
180
|
-
}
|
|
181
|
-
renderEndStyles() {
|
|
182
|
-
}
|
|
183
|
-
measureEndState() {
|
|
184
|
-
}
|
|
185
|
-
complete() {
|
|
186
|
-
this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), _.delete(this);
|
|
187
|
-
}
|
|
188
|
-
cancel() {
|
|
189
|
-
this.isComplete || (this.isScheduled = !1, _.delete(this));
|
|
190
|
-
}
|
|
191
|
-
resume() {
|
|
192
|
-
this.isComplete || this.scheduleResolve();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const Ee = (t, e) => (n) => !!(le(n) && vn.test(n) && n.startsWith(t) || e && !yn(n) && Object.prototype.hasOwnProperty.call(n, e)), Rt = (t, e, n) => (s) => {
|
|
196
|
-
if (!le(s))
|
|
197
|
-
return s;
|
|
198
|
-
const [i, r, o, l] = s.match(Ie);
|
|
199
|
-
return {
|
|
200
|
-
[t]: parseFloat(i),
|
|
201
|
-
[e]: parseFloat(r),
|
|
202
|
-
[n]: parseFloat(o),
|
|
203
|
-
alpha: l !== void 0 ? parseFloat(l) : 1
|
|
204
|
-
};
|
|
205
|
-
}, rs = (t) => Y(0, 255, t), me = {
|
|
206
|
-
...De,
|
|
207
|
-
transform: (t) => Math.round(rs(t))
|
|
208
|
-
}, L = {
|
|
209
|
-
test: /* @__PURE__ */ Ee("rgb", "red"),
|
|
210
|
-
parse: /* @__PURE__ */ Rt("red", "green", "blue"),
|
|
211
|
-
transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + me.transform(t) + ", " + me.transform(e) + ", " + me.transform(n) + ", " + H(gt.transform(s)) + ")"
|
|
212
|
-
};
|
|
213
|
-
function os(t) {
|
|
214
|
-
let e = "", n = "", s = "", i = "";
|
|
215
|
-
return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), {
|
|
216
|
-
red: parseInt(e, 16),
|
|
217
|
-
green: parseInt(n, 16),
|
|
218
|
-
blue: parseInt(s, 16),
|
|
219
|
-
alpha: i ? parseInt(i, 16) / 255 : 1
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
const we = {
|
|
223
|
-
test: /* @__PURE__ */ Ee("#"),
|
|
224
|
-
parse: os,
|
|
225
|
-
transform: L.transform
|
|
226
|
-
}, U = {
|
|
227
|
-
test: /* @__PURE__ */ Ee("hsl", "hue"),
|
|
228
|
-
parse: /* @__PURE__ */ Rt("hue", "saturation", "lightness"),
|
|
229
|
-
transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + Ve.transform(H(e)) + ", " + Ve.transform(H(n)) + ", " + H(gt.transform(s)) + ")"
|
|
230
|
-
}, w = {
|
|
231
|
-
test: (t) => L.test(t) || we.test(t) || U.test(t),
|
|
232
|
-
parse: (t) => L.test(t) ? L.parse(t) : U.test(t) ? U.parse(t) : we.parse(t),
|
|
233
|
-
transform: (t) => le(t) ? t : t.hasOwnProperty("red") ? L.transform(t) : U.transform(t)
|
|
234
|
-
};
|
|
235
|
-
function as(t) {
|
|
236
|
-
var e, n;
|
|
237
|
-
return isNaN(t) && le(t) && (((e = t.match(Ie)) === null || e === void 0 ? void 0 : e.length) || 0) + (((n = t.match(bn)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
|
|
238
|
-
}
|
|
239
|
-
const Dt = "number", It = "color", ls = "var", us = "var(", Ze = "${}", cs = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
240
|
-
function X(t) {
|
|
241
|
-
const e = t.toString(), n = [], s = {
|
|
242
|
-
color: [],
|
|
243
|
-
number: [],
|
|
244
|
-
var: []
|
|
245
|
-
}, i = [];
|
|
246
|
-
let r = 0;
|
|
247
|
-
const l = e.replace(cs, (a) => (w.test(a) ? (s.color.push(r), i.push(It), n.push(w.parse(a))) : a.startsWith(us) ? (s.var.push(r), i.push(ls), n.push(a)) : (s.number.push(r), i.push(Dt), n.push(parseFloat(a))), ++r, Ze)).split(Ze);
|
|
248
|
-
return { values: n, split: l, indexes: s, types: i };
|
|
249
|
-
}
|
|
250
|
-
function Nt(t) {
|
|
251
|
-
return X(t).values;
|
|
252
|
-
}
|
|
253
|
-
function Kt(t) {
|
|
254
|
-
const { split: e, types: n } = X(t), s = e.length;
|
|
255
|
-
return (i) => {
|
|
256
|
-
let r = "";
|
|
257
|
-
for (let o = 0; o < s; o++)
|
|
258
|
-
if (r += e[o], i[o] !== void 0) {
|
|
259
|
-
const l = n[o];
|
|
260
|
-
l === Dt ? r += H(i[o]) : l === It ? r += w.transform(i[o]) : r += i[o];
|
|
261
|
-
}
|
|
262
|
-
return r;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
const hs = (t) => typeof t == "number" ? 0 : t;
|
|
266
|
-
function ds(t) {
|
|
267
|
-
const e = Nt(t);
|
|
268
|
-
return Kt(t)(e.map(hs));
|
|
269
|
-
}
|
|
270
|
-
const W = {
|
|
271
|
-
test: as,
|
|
272
|
-
parse: Nt,
|
|
273
|
-
createTransformer: Kt,
|
|
274
|
-
getAnimatableNone: ds
|
|
275
|
-
}, fs = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
276
|
-
function ps(t) {
|
|
277
|
-
const [e, n] = t.slice(0, -1).split("(");
|
|
278
|
-
if (e === "drop-shadow")
|
|
279
|
-
return t;
|
|
280
|
-
const [s] = n.match(Ie) || [];
|
|
281
|
-
if (!s)
|
|
282
|
-
return t;
|
|
283
|
-
const i = n.replace(s, "");
|
|
284
|
-
let r = fs.has(e) ? 1 : 0;
|
|
285
|
-
return s !== n && (r *= 100), e + "(" + r + i + ")";
|
|
286
|
-
}
|
|
287
|
-
const ms = /\b([a-z-]*)\(.*?\)/gu, Pe = {
|
|
288
|
-
...W,
|
|
289
|
-
getAnimatableNone: (t) => {
|
|
290
|
-
const e = t.match(ms);
|
|
291
|
-
return e ? e.map(ps).join(" ") : t;
|
|
292
|
-
}
|
|
293
|
-
}, gs = {
|
|
294
|
-
...Tn,
|
|
295
|
-
// Color props
|
|
296
|
-
color: w,
|
|
297
|
-
backgroundColor: w,
|
|
298
|
-
outlineColor: w,
|
|
299
|
-
fill: w,
|
|
300
|
-
stroke: w,
|
|
301
|
-
// Border props
|
|
302
|
-
borderColor: w,
|
|
303
|
-
borderTopColor: w,
|
|
304
|
-
borderRightColor: w,
|
|
305
|
-
borderBottomColor: w,
|
|
306
|
-
borderLeftColor: w,
|
|
307
|
-
filter: Pe,
|
|
308
|
-
WebkitFilter: Pe
|
|
309
|
-
}, Be = (t) => gs[t];
|
|
310
|
-
function Et(t, e) {
|
|
311
|
-
let n = Be(t);
|
|
312
|
-
return n !== Pe && (n = W), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
|
|
313
|
-
}
|
|
314
|
-
const vs = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
315
|
-
function ys(t, e, n) {
|
|
316
|
-
let s = 0, i;
|
|
317
|
-
for (; s < t.length && !i; ) {
|
|
318
|
-
const r = t[s];
|
|
319
|
-
typeof r == "string" && !vs.has(r) && X(r).values.length && (i = t[s]), s++;
|
|
320
|
-
}
|
|
321
|
-
if (i && n)
|
|
322
|
-
for (const r of e)
|
|
323
|
-
t[r] = Et(n, i);
|
|
324
|
-
}
|
|
325
|
-
class Bt extends Ke {
|
|
326
|
-
constructor(e, n, s, i, r) {
|
|
327
|
-
super(e, n, s, i, r, !0);
|
|
328
|
-
}
|
|
329
|
-
readKeyframes() {
|
|
330
|
-
const { unresolvedKeyframes: e, element: n, name: s } = this;
|
|
331
|
-
if (!n || !n.current)
|
|
332
|
-
return;
|
|
333
|
-
super.readKeyframes();
|
|
334
|
-
for (let a = 0; a < e.length; a++) {
|
|
335
|
-
let u = e[a];
|
|
336
|
-
if (typeof u == "string" && (u = u.trim(), Re(u))) {
|
|
337
|
-
const h = xt(u, n.current);
|
|
338
|
-
h !== void 0 && (e[a] = h), a === e.length - 1 && (this.finalKeyframe = u);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
if (this.resolveNoneKeyframes(), !Qn.has(s) || e.length !== 2)
|
|
342
|
-
return;
|
|
343
|
-
const [i, r] = e, o = Xe(i), l = Xe(r);
|
|
344
|
-
if (o !== l)
|
|
345
|
-
if (He(o) && He(l))
|
|
346
|
-
for (let a = 0; a < e.length; a++) {
|
|
347
|
-
const u = e[a];
|
|
348
|
-
typeof u == "string" && (e[a] = parseFloat(u));
|
|
349
|
-
}
|
|
350
|
-
else
|
|
351
|
-
this.needsMeasurement = !0;
|
|
352
|
-
}
|
|
353
|
-
resolveNoneKeyframes() {
|
|
354
|
-
const { unresolvedKeyframes: e, name: n } = this, s = [];
|
|
355
|
-
for (let i = 0; i < e.length; i++)
|
|
356
|
-
Yn(e[i]) && s.push(i);
|
|
357
|
-
s.length && ys(e, s, n);
|
|
358
|
-
}
|
|
359
|
-
measureInitialState() {
|
|
360
|
-
const { element: e, unresolvedKeyframes: n, name: s } = this;
|
|
361
|
-
if (!e || !e.current)
|
|
362
|
-
return;
|
|
363
|
-
s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = $[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
|
|
364
|
-
const i = n[n.length - 1];
|
|
365
|
-
i !== void 0 && e.getValue(s, i).jump(i, !1);
|
|
366
|
-
}
|
|
367
|
-
measureEndState() {
|
|
368
|
-
var e;
|
|
369
|
-
const { element: n, name: s, unresolvedKeyframes: i } = this;
|
|
370
|
-
if (!n || !n.current)
|
|
371
|
-
return;
|
|
372
|
-
const r = n.getValue(s);
|
|
373
|
-
r && r.jump(this.measuredOrigin, !1);
|
|
374
|
-
const o = i.length - 1, l = i[o];
|
|
375
|
-
i[o] = $[s](n.measureViewportBox(), window.getComputedStyle(n.current)), l !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = l), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([a, u]) => {
|
|
376
|
-
n.getValue(a).set(u);
|
|
377
|
-
}), this.resolveNoneKeyframes();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
function Lt(t) {
|
|
381
|
-
let e;
|
|
382
|
-
return () => (e === void 0 && (e = t()), e);
|
|
383
|
-
}
|
|
384
|
-
let Q;
|
|
385
|
-
function bs() {
|
|
386
|
-
Q = void 0;
|
|
387
|
-
}
|
|
388
|
-
const K = {
|
|
389
|
-
now: () => (Q === void 0 && K.set(te.isProcessing || Hn.useManualTiming ? te.timestamp : performance.now()), Q),
|
|
390
|
-
set: (t) => {
|
|
391
|
-
Q = t, queueMicrotask(bs);
|
|
392
|
-
}
|
|
393
|
-
}, Je = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
|
|
394
|
-
(W.test(t) || t === "0") && // And it contains numbers and/or colors
|
|
395
|
-
!t.startsWith("url("));
|
|
396
|
-
function Ts(t) {
|
|
397
|
-
const e = t[0];
|
|
398
|
-
if (t.length === 1)
|
|
399
|
-
return !0;
|
|
400
|
-
for (let n = 0; n < t.length; n++)
|
|
401
|
-
if (t[n] !== e)
|
|
402
|
-
return !0;
|
|
403
|
-
}
|
|
404
|
-
function Vs(t, e, n, s) {
|
|
405
|
-
const i = t[0];
|
|
406
|
-
if (i === null)
|
|
407
|
-
return !1;
|
|
408
|
-
if (e === "display" || e === "visibility")
|
|
409
|
-
return !0;
|
|
410
|
-
const r = t[t.length - 1], o = Je(i, e), l = Je(r, e);
|
|
411
|
-
return ue(o === l, `You are trying to animate ${e} from "${i}" to "${r}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${r} via the \`style\` property.`), !o || !l ? !1 : Ts(t) || n === "spring" && s;
|
|
412
|
-
}
|
|
413
|
-
const As = 40;
|
|
414
|
-
class kt {
|
|
415
|
-
constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", ...l }) {
|
|
416
|
-
this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = K.now(), this.options = {
|
|
417
|
-
autoplay: e,
|
|
418
|
-
delay: n,
|
|
419
|
-
type: s,
|
|
420
|
-
repeat: i,
|
|
421
|
-
repeatDelay: r,
|
|
422
|
-
repeatType: o,
|
|
423
|
-
...l
|
|
424
|
-
}, this.updateFinishedPromise();
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* This method uses the createdAt and resolvedAt to calculate the
|
|
428
|
-
* animation startTime. *Ideally*, we would use the createdAt time as t=0
|
|
429
|
-
* as the following frame would then be the first frame of the animation in
|
|
430
|
-
* progress, which would feel snappier.
|
|
431
|
-
*
|
|
432
|
-
* However, if there's a delay (main thread work) between the creation of
|
|
433
|
-
* the animation and the first commited frame, we prefer to use resolvedAt
|
|
434
|
-
* to avoid a sudden jump into the animation.
|
|
435
|
-
*/
|
|
436
|
-
calcStartTime() {
|
|
437
|
-
return this.resolvedAt ? this.resolvedAt - this.createdAt > As ? this.resolvedAt : this.createdAt : this.createdAt;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* A getter for resolved data. If keyframes are not yet resolved, accessing
|
|
441
|
-
* this.resolved will synchronously flush all pending keyframe resolvers.
|
|
442
|
-
* This is a deoptimisation, but at its worst still batches read/writes.
|
|
443
|
-
*/
|
|
444
|
-
get resolved() {
|
|
445
|
-
return !this._resolved && !this.hasAttemptedResolve && is(), this._resolved;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* A method to be called when the keyframes resolver completes. This method
|
|
449
|
-
* will check if its possible to run the animation and, if not, skip it.
|
|
450
|
-
* Otherwise, it will call initPlayback on the implementing class.
|
|
451
|
-
*/
|
|
452
|
-
onKeyframesResolved(e, n) {
|
|
453
|
-
this.resolvedAt = K.now(), this.hasAttemptedResolve = !0;
|
|
454
|
-
const { name: s, type: i, velocity: r, delay: o, onComplete: l, onUpdate: a, isGenerator: u } = this.options;
|
|
455
|
-
if (!u && !Vs(e, s, i, r))
|
|
456
|
-
if (o)
|
|
457
|
-
this.options.duration = 0;
|
|
458
|
-
else {
|
|
459
|
-
a?.(he(e, this.options, n)), l?.(), this.resolveFinishedPromise();
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
const h = this.initPlayback(e, n);
|
|
463
|
-
h !== !1 && (this._resolved = {
|
|
464
|
-
keyframes: e,
|
|
465
|
-
finalKeyframe: n,
|
|
466
|
-
...h
|
|
467
|
-
}, this.onPostResolved());
|
|
468
|
-
}
|
|
469
|
-
onPostResolved() {
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
473
|
-
* resolves when the animation finishes at all but in a future update could/should
|
|
474
|
-
* reject if its cancels.
|
|
475
|
-
*/
|
|
476
|
-
then(e, n) {
|
|
477
|
-
return this.currentFinishedPromise.then(e, n);
|
|
478
|
-
}
|
|
479
|
-
updateFinishedPromise() {
|
|
480
|
-
this.currentFinishedPromise = new Promise((e) => {
|
|
481
|
-
this.resolveFinishedPromise = e;
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
function _t(t, e) {
|
|
486
|
-
return e ? t * (1e3 / e) : 0;
|
|
487
|
-
}
|
|
488
|
-
const Ss = 5;
|
|
489
|
-
function Gt(t, e, n) {
|
|
490
|
-
const s = Math.max(e - Ss, 0);
|
|
491
|
-
return _t(n - t(s), e - s);
|
|
492
|
-
}
|
|
493
|
-
const ge = 1e-3, ws = 0.01, Qe = 10, Ps = 0.05, xs = 1;
|
|
494
|
-
function Cs({ duration: t = 800, bounce: e = 0.25, velocity: n = 0, mass: s = 1 }) {
|
|
495
|
-
let i, r;
|
|
496
|
-
ue(t <= R(Qe), "Spring duration must be 10 seconds or less");
|
|
497
|
-
let o = 1 - e;
|
|
498
|
-
o = Y(Ps, xs, o), t = Y(ws, Qe, N(t)), o < 1 ? (i = (u) => {
|
|
499
|
-
const h = u * o, c = h * t, d = h - n, f = xe(u, o), v = Math.exp(-c);
|
|
500
|
-
return ge - d / f * v;
|
|
501
|
-
}, r = (u) => {
|
|
502
|
-
const c = u * o * t, d = c * n + n, f = Math.pow(o, 2) * Math.pow(u, 2) * t, v = Math.exp(-c), T = xe(Math.pow(u, 2), o);
|
|
503
|
-
return (-i(u) + ge > 0 ? -1 : 1) * ((d - f) * v) / T;
|
|
504
|
-
}) : (i = (u) => {
|
|
505
|
-
const h = Math.exp(-u * t), c = (u - n) * t + 1;
|
|
506
|
-
return -ge + h * c;
|
|
507
|
-
}, r = (u) => {
|
|
508
|
-
const h = Math.exp(-u * t), c = (n - u) * (t * t);
|
|
509
|
-
return h * c;
|
|
510
|
-
});
|
|
511
|
-
const l = 5 / t, a = Fs(i, r, l);
|
|
512
|
-
if (t = R(t), isNaN(a))
|
|
513
|
-
return {
|
|
514
|
-
stiffness: 100,
|
|
515
|
-
damping: 10,
|
|
516
|
-
duration: t
|
|
517
|
-
};
|
|
518
|
-
{
|
|
519
|
-
const u = Math.pow(a, 2) * s;
|
|
520
|
-
return {
|
|
521
|
-
stiffness: u,
|
|
522
|
-
damping: o * 2 * Math.sqrt(s * u),
|
|
523
|
-
duration: t
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
const Ms = 12;
|
|
528
|
-
function Fs(t, e, n) {
|
|
529
|
-
let s = n;
|
|
530
|
-
for (let i = 1; i < Ms; i++)
|
|
531
|
-
s = s - t(s) / e(s);
|
|
532
|
-
return s;
|
|
533
|
-
}
|
|
534
|
-
function xe(t, e) {
|
|
535
|
-
return t * Math.sqrt(1 - e * e);
|
|
536
|
-
}
|
|
537
|
-
const Os = ["duration", "bounce"], Rs = ["stiffness", "damping", "mass"];
|
|
538
|
-
function et(t, e) {
|
|
539
|
-
return e.some((n) => t[n] !== void 0);
|
|
540
|
-
}
|
|
541
|
-
function Ds(t) {
|
|
542
|
-
let e = {
|
|
543
|
-
velocity: 0,
|
|
544
|
-
stiffness: 100,
|
|
545
|
-
damping: 10,
|
|
546
|
-
mass: 1,
|
|
547
|
-
isResolvedFromDuration: !1,
|
|
548
|
-
...t
|
|
549
|
-
};
|
|
550
|
-
if (!et(t, Rs) && et(t, Os)) {
|
|
551
|
-
const n = Cs(t);
|
|
552
|
-
e = {
|
|
553
|
-
...e,
|
|
554
|
-
...n,
|
|
555
|
-
mass: 1
|
|
556
|
-
}, e.isResolvedFromDuration = !0;
|
|
557
|
-
}
|
|
558
|
-
return e;
|
|
559
|
-
}
|
|
560
|
-
function Ut({ keyframes: t, restDelta: e, restSpeed: n, ...s }) {
|
|
561
|
-
const i = t[0], r = t[t.length - 1], o = { done: !1, value: i }, { stiffness: l, damping: a, mass: u, duration: h, velocity: c, isResolvedFromDuration: d } = Ds({
|
|
562
|
-
...s,
|
|
563
|
-
velocity: -N(s.velocity || 0)
|
|
564
|
-
}), f = c || 0, v = a / (2 * Math.sqrt(l * u)), T = r - i, b = N(Math.sqrt(l / u)), m = Math.abs(T) < 5;
|
|
565
|
-
n || (n = m ? 0.01 : 2), e || (e = m ? 5e-3 : 0.5);
|
|
566
|
-
let y;
|
|
567
|
-
if (v < 1) {
|
|
568
|
-
const p = xe(b, v);
|
|
569
|
-
y = (A) => {
|
|
570
|
-
const V = Math.exp(-v * b * A);
|
|
571
|
-
return r - V * ((f + v * b * T) / p * Math.sin(p * A) + T * Math.cos(p * A));
|
|
572
|
-
};
|
|
573
|
-
} else if (v === 1)
|
|
574
|
-
y = (p) => r - Math.exp(-b * p) * (T + (f + b * T) * p);
|
|
575
|
-
else {
|
|
576
|
-
const p = b * Math.sqrt(v * v - 1);
|
|
577
|
-
y = (A) => {
|
|
578
|
-
const V = Math.exp(-v * b * A), S = Math.min(p * A, 300);
|
|
579
|
-
return r - V * ((f + v * b * T) * Math.sinh(S) + p * T * Math.cosh(S)) / p;
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
return {
|
|
583
|
-
calculatedDuration: d && h || null,
|
|
584
|
-
next: (p) => {
|
|
585
|
-
const A = y(p);
|
|
586
|
-
if (d)
|
|
587
|
-
o.done = p >= h;
|
|
588
|
-
else {
|
|
589
|
-
let V = 0;
|
|
590
|
-
v < 1 && (V = p === 0 ? R(f) : Gt(y, p, A));
|
|
591
|
-
const S = Math.abs(V) <= n, F = Math.abs(r - A) <= e;
|
|
592
|
-
o.done = S && F;
|
|
593
|
-
}
|
|
594
|
-
return o.value = o.done ? r : A, o;
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
function tt({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: l, max: a, restDelta: u = 0.5, restSpeed: h }) {
|
|
599
|
-
const c = t[0], d = {
|
|
600
|
-
done: !1,
|
|
601
|
-
value: c
|
|
602
|
-
}, f = (g) => l !== void 0 && g < l || a !== void 0 && g > a, v = (g) => l === void 0 ? a : a === void 0 || Math.abs(l - g) < Math.abs(a - g) ? l : a;
|
|
603
|
-
let T = n * e;
|
|
604
|
-
const b = c + T, m = o === void 0 ? b : o(b);
|
|
605
|
-
m !== b && (T = m - c);
|
|
606
|
-
const y = (g) => -T * Math.exp(-g / s), p = (g) => m + y(g), A = (g) => {
|
|
607
|
-
const C = y(g), M = p(g);
|
|
608
|
-
d.done = Math.abs(C) <= u, d.value = d.done ? m : M;
|
|
609
|
-
};
|
|
610
|
-
let V, S;
|
|
611
|
-
const F = (g) => {
|
|
612
|
-
f(d.value) && (V = g, S = Ut({
|
|
613
|
-
keyframes: [d.value, v(d.value)],
|
|
614
|
-
velocity: Gt(p, g, d.value),
|
|
615
|
-
// TODO: This should be passing * 1000
|
|
616
|
-
damping: i,
|
|
617
|
-
stiffness: r,
|
|
618
|
-
restDelta: u,
|
|
619
|
-
restSpeed: h
|
|
620
|
-
}));
|
|
621
|
-
};
|
|
622
|
-
return F(0), {
|
|
623
|
-
calculatedDuration: null,
|
|
624
|
-
next: (g) => {
|
|
625
|
-
let C = !1;
|
|
626
|
-
return !S && V === void 0 && (C = !0, A(g), F(g)), V !== void 0 && g >= V ? S.next(g - V) : (!C && A(g), d);
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
const $t = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Is = 1e-7, Ns = 12;
|
|
631
|
-
function Ks(t, e, n, s, i) {
|
|
632
|
-
let r, o, l = 0;
|
|
633
|
-
do
|
|
634
|
-
o = e + (n - e) / 2, r = $t(o, s, i) - t, r > 0 ? n = o : e = o;
|
|
635
|
-
while (Math.abs(r) > Is && ++l < Ns);
|
|
636
|
-
return o;
|
|
637
|
-
}
|
|
638
|
-
function J(t, e, n, s) {
|
|
639
|
-
if (t === e && n === s)
|
|
640
|
-
return I;
|
|
641
|
-
const i = (r) => Ks(r, 0, 1, t, n);
|
|
642
|
-
return (r) => r === 0 || r === 1 ? r : $t(i(r), e, s);
|
|
643
|
-
}
|
|
644
|
-
const Es = /* @__PURE__ */ J(0.42, 0, 1, 1), Bs = /* @__PURE__ */ J(0, 0, 0.58, 1), Wt = /* @__PURE__ */ J(0.42, 0, 0.58, 1), Ls = (t) => Array.isArray(t) && typeof t[0] != "number", jt = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, zt = (t) => (e) => 1 - t(1 - e), Le = (t) => 1 - Math.sin(Math.acos(t)), ks = zt(Le), _s = jt(Le), Ht = /* @__PURE__ */ J(0.33, 1.53, 0.69, 0.99), ke = /* @__PURE__ */ zt(Ht), Gs = /* @__PURE__ */ jt(ke), Us = (t) => (t *= 2) < 1 ? 0.5 * ke(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), nt = {
|
|
645
|
-
linear: I,
|
|
646
|
-
easeIn: Es,
|
|
647
|
-
easeInOut: Wt,
|
|
648
|
-
easeOut: Bs,
|
|
649
|
-
circIn: Le,
|
|
650
|
-
circInOut: _s,
|
|
651
|
-
circOut: ks,
|
|
652
|
-
backIn: ke,
|
|
653
|
-
backInOut: Gs,
|
|
654
|
-
backOut: Ht,
|
|
655
|
-
anticipate: Us
|
|
656
|
-
}, st = (t) => {
|
|
657
|
-
if (Array.isArray(t)) {
|
|
658
|
-
q(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
|
|
659
|
-
const [e, n, s, i] = t;
|
|
660
|
-
return J(e, n, s, i);
|
|
661
|
-
} else if (typeof t == "string")
|
|
662
|
-
return q(nt[t] !== void 0, `Invalid easing type '${t}'`), nt[t];
|
|
663
|
-
return t;
|
|
664
|
-
}, $s = (t, e) => (n) => e(t(n)), E = (...t) => t.reduce($s), qt = (t, e, n) => {
|
|
665
|
-
const s = e - t;
|
|
666
|
-
return s === 0 ? 1 : (n - t) / s;
|
|
667
|
-
}, de = (t, e, n) => t + (e - t) * n;
|
|
668
|
-
function ve(t, e, n) {
|
|
669
|
-
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
|
|
670
|
-
}
|
|
671
|
-
function Ws({ hue: t, saturation: e, lightness: n, alpha: s }) {
|
|
672
|
-
t /= 360, e /= 100, n /= 100;
|
|
673
|
-
let i = 0, r = 0, o = 0;
|
|
674
|
-
if (!e)
|
|
675
|
-
i = r = o = n;
|
|
676
|
-
else {
|
|
677
|
-
const l = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - l;
|
|
678
|
-
i = ve(a, l, t + 1 / 3), r = ve(a, l, t), o = ve(a, l, t - 1 / 3);
|
|
679
|
-
}
|
|
680
|
-
return {
|
|
681
|
-
red: Math.round(i * 255),
|
|
682
|
-
green: Math.round(r * 255),
|
|
683
|
-
blue: Math.round(o * 255),
|
|
684
|
-
alpha: s
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
function se(t, e) {
|
|
688
|
-
return (n) => n > 0 ? e : t;
|
|
689
|
-
}
|
|
690
|
-
const ye = (t, e, n) => {
|
|
691
|
-
const s = t * t, i = n * (e * e - s) + s;
|
|
692
|
-
return i < 0 ? 0 : Math.sqrt(i);
|
|
693
|
-
}, js = [we, L, U], zs = (t) => js.find((e) => e.test(t));
|
|
694
|
-
function it(t) {
|
|
695
|
-
const e = zs(t);
|
|
696
|
-
if (ue(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e)
|
|
697
|
-
return !1;
|
|
698
|
-
let n = e.parse(t);
|
|
699
|
-
return e === U && (n = Ws(n)), n;
|
|
700
|
-
}
|
|
701
|
-
const rt = (t, e) => {
|
|
702
|
-
const n = it(t), s = it(e);
|
|
703
|
-
if (!n || !s)
|
|
704
|
-
return se(t, e);
|
|
705
|
-
const i = { ...n };
|
|
706
|
-
return (r) => (i.red = ye(n.red, s.red, r), i.green = ye(n.green, s.green, r), i.blue = ye(n.blue, s.blue, r), i.alpha = de(n.alpha, s.alpha, r), L.transform(i));
|
|
707
|
-
}, Ce = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
708
|
-
function Hs(t, e) {
|
|
709
|
-
return Ce.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
|
|
710
|
-
}
|
|
711
|
-
function qs(t, e) {
|
|
712
|
-
return (n) => de(t, e, n);
|
|
713
|
-
}
|
|
714
|
-
function _e(t) {
|
|
715
|
-
return typeof t == "number" ? qs : typeof t == "string" ? Re(t) ? se : w.test(t) ? rt : Zs : Array.isArray(t) ? Yt : typeof t == "object" ? w.test(t) ? rt : Ys : se;
|
|
716
|
-
}
|
|
717
|
-
function Yt(t, e) {
|
|
718
|
-
const n = [...t], s = n.length, i = t.map((r, o) => _e(r)(r, e[o]));
|
|
719
|
-
return (r) => {
|
|
720
|
-
for (let o = 0; o < s; o++)
|
|
721
|
-
n[o] = i[o](r);
|
|
722
|
-
return n;
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
function Ys(t, e) {
|
|
726
|
-
const n = { ...t, ...e }, s = {};
|
|
727
|
-
for (const i in n)
|
|
728
|
-
t[i] !== void 0 && e[i] !== void 0 && (s[i] = _e(t[i])(t[i], e[i]));
|
|
729
|
-
return (i) => {
|
|
730
|
-
for (const r in s)
|
|
731
|
-
n[r] = s[r](i);
|
|
732
|
-
return n;
|
|
733
|
-
};
|
|
734
|
-
}
|
|
735
|
-
function Xs(t, e) {
|
|
736
|
-
var n;
|
|
737
|
-
const s = [], i = { color: 0, var: 0, number: 0 };
|
|
738
|
-
for (let r = 0; r < e.values.length; r++) {
|
|
739
|
-
const o = e.types[r], l = t.indexes[o][i[o]], a = (n = t.values[l]) !== null && n !== void 0 ? n : 0;
|
|
740
|
-
s[r] = a, i[o]++;
|
|
741
|
-
}
|
|
742
|
-
return s;
|
|
743
|
-
}
|
|
744
|
-
const Zs = (t, e) => {
|
|
745
|
-
const n = W.createTransformer(e), s = X(t), i = X(e);
|
|
746
|
-
return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? Ce.has(t) && !i.values.length || Ce.has(e) && !s.values.length ? Hs(t, e) : E(Yt(Xs(s, i), i.values), n) : (ue(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), se(t, e));
|
|
747
|
-
};
|
|
748
|
-
function Xt(t, e, n) {
|
|
749
|
-
return typeof t == "number" && typeof e == "number" && typeof n == "number" ? de(t, e, n) : _e(t)(t, e);
|
|
750
|
-
}
|
|
751
|
-
function Js(t, e, n) {
|
|
752
|
-
const s = [], i = n || Xt, r = t.length - 1;
|
|
753
|
-
for (let o = 0; o < r; o++) {
|
|
754
|
-
let l = i(t[o], t[o + 1]);
|
|
755
|
-
if (e) {
|
|
756
|
-
const a = Array.isArray(e) ? e[o] || I : e;
|
|
757
|
-
l = E(a, l);
|
|
758
|
-
}
|
|
759
|
-
s.push(l);
|
|
760
|
-
}
|
|
761
|
-
return s;
|
|
762
|
-
}
|
|
763
|
-
function Qs(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
|
|
764
|
-
const r = t.length;
|
|
765
|
-
if (q(r === e.length, "Both input and output ranges must be the same length"), r === 1)
|
|
766
|
-
return () => e[0];
|
|
767
|
-
if (r === 2 && t[0] === t[1])
|
|
768
|
-
return () => e[1];
|
|
769
|
-
t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
|
|
770
|
-
const o = Js(e, s, i), l = o.length, a = (u) => {
|
|
771
|
-
let h = 0;
|
|
772
|
-
if (l > 1)
|
|
773
|
-
for (; h < t.length - 2 && !(u < t[h + 1]); h++)
|
|
774
|
-
;
|
|
775
|
-
const c = qt(t[h], t[h + 1], u);
|
|
776
|
-
return o[h](c);
|
|
777
|
-
};
|
|
778
|
-
return n ? (u) => a(Y(t[0], t[r - 1], u)) : a;
|
|
779
|
-
}
|
|
780
|
-
function ei(t, e) {
|
|
781
|
-
const n = t[t.length - 1];
|
|
782
|
-
for (let s = 1; s <= e; s++) {
|
|
783
|
-
const i = qt(0, e, s);
|
|
784
|
-
t.push(de(n, 1, i));
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function ti(t) {
|
|
788
|
-
const e = [0];
|
|
789
|
-
return ei(e, t.length - 1), e;
|
|
790
|
-
}
|
|
791
|
-
function ni(t, e) {
|
|
792
|
-
return t.map((n) => n * e);
|
|
793
|
-
}
|
|
794
|
-
function si(t, e) {
|
|
795
|
-
return t.map(() => e || Wt).splice(0, t.length - 1);
|
|
796
|
-
}
|
|
797
|
-
function ie({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
|
|
798
|
-
const i = Ls(s) ? s.map(st) : st(s), r = {
|
|
799
|
-
done: !1,
|
|
800
|
-
value: e[0]
|
|
801
|
-
}, o = ni(
|
|
802
|
-
// Only use the provided offsets if they're the correct length
|
|
803
|
-
// TODO Maybe we should warn here if there's a length mismatch
|
|
804
|
-
n && n.length === e.length ? n : ti(e),
|
|
805
|
-
t
|
|
806
|
-
), l = Qs(o, e, {
|
|
807
|
-
ease: Array.isArray(i) ? i : si(e, i)
|
|
808
|
-
});
|
|
809
|
-
return {
|
|
810
|
-
calculatedDuration: t,
|
|
811
|
-
next: (a) => (r.value = l(a), r.done = a >= t, r)
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
const ot = 2e4;
|
|
815
|
-
function ii(t) {
|
|
816
|
-
let e = 0;
|
|
817
|
-
const n = 50;
|
|
818
|
-
let s = t.next(e);
|
|
819
|
-
for (; !s.done && e < ot; )
|
|
820
|
-
e += n, s = t.next(e);
|
|
821
|
-
return e >= ot ? 1 / 0 : e;
|
|
822
|
-
}
|
|
823
|
-
const ri = (t) => {
|
|
824
|
-
const e = ({ timestamp: n }) => t(n);
|
|
825
|
-
return {
|
|
826
|
-
start: () => x.update(e, !0),
|
|
827
|
-
stop: () => ne(e),
|
|
828
|
-
/**
|
|
829
|
-
* If we're processing this frame we can use the
|
|
830
|
-
* framelocked timestamp to keep things in sync.
|
|
831
|
-
*/
|
|
832
|
-
now: () => te.isProcessing ? te.timestamp : K.now()
|
|
833
|
-
};
|
|
834
|
-
}, oi = {
|
|
835
|
-
decay: tt,
|
|
836
|
-
inertia: tt,
|
|
837
|
-
tween: ie,
|
|
838
|
-
keyframes: ie,
|
|
839
|
-
spring: Ut
|
|
840
|
-
}, ai = (t) => t / 100;
|
|
841
|
-
class Ge extends kt {
|
|
842
|
-
constructor(e) {
|
|
843
|
-
super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => {
|
|
844
|
-
if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
|
|
845
|
-
return;
|
|
846
|
-
this.teardown();
|
|
847
|
-
const { onStop: a } = this.options;
|
|
848
|
-
a && a();
|
|
849
|
-
};
|
|
850
|
-
const { name: n, motionValue: s, element: i, keyframes: r } = this.options, o = i?.KeyframeResolver || Ke, l = (a, u) => this.onKeyframesResolved(a, u);
|
|
851
|
-
this.resolver = new o(r, l, n, s, i), this.resolver.scheduleResolve();
|
|
852
|
-
}
|
|
853
|
-
initPlayback(e) {
|
|
854
|
-
const { type: n = "keyframes", repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = this.options, l = oi[n] || ie;
|
|
855
|
-
let a, u;
|
|
856
|
-
l !== ie && typeof e[0] != "number" && (ae.env.NODE_ENV !== "production" && q(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), a = E(ai, Xt(e[0], e[1])), e = [0, 100]);
|
|
857
|
-
const h = l({ ...this.options, keyframes: e });
|
|
858
|
-
r === "mirror" && (u = l({
|
|
859
|
-
...this.options,
|
|
860
|
-
keyframes: [...e].reverse(),
|
|
861
|
-
velocity: -o
|
|
862
|
-
})), h.calculatedDuration === null && (h.calculatedDuration = ii(h));
|
|
863
|
-
const { calculatedDuration: c } = h, d = c + i, f = d * (s + 1) - i;
|
|
864
|
-
return {
|
|
865
|
-
generator: h,
|
|
866
|
-
mirroredGenerator: u,
|
|
867
|
-
mapPercentToKeyframes: a,
|
|
868
|
-
calculatedDuration: c,
|
|
869
|
-
resolvedDuration: d,
|
|
870
|
-
totalDuration: f
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
onPostResolved() {
|
|
874
|
-
const { autoplay: e = !0 } = this.options;
|
|
875
|
-
this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState;
|
|
876
|
-
}
|
|
877
|
-
tick(e, n = !1) {
|
|
878
|
-
const { resolved: s } = this;
|
|
879
|
-
if (!s) {
|
|
880
|
-
const { keyframes: g } = this.options;
|
|
881
|
-
return { done: !0, value: g[g.length - 1] };
|
|
882
|
-
}
|
|
883
|
-
const { finalKeyframe: i, generator: r, mirroredGenerator: o, mapPercentToKeyframes: l, keyframes: a, calculatedDuration: u, totalDuration: h, resolvedDuration: c } = s;
|
|
884
|
-
if (this.startTime === null)
|
|
885
|
-
return r.next(0);
|
|
886
|
-
const { delay: d, repeat: f, repeatType: v, repeatDelay: T, onUpdate: b } = this.options;
|
|
887
|
-
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - h / this.speed, this.startTime)), n ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed;
|
|
888
|
-
const m = this.currentTime - d * (this.speed >= 0 ? 1 : -1), y = this.speed >= 0 ? m < 0 : m > h;
|
|
889
|
-
this.currentTime = Math.max(m, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = h);
|
|
890
|
-
let p = this.currentTime, A = r;
|
|
891
|
-
if (f) {
|
|
892
|
-
const g = Math.min(this.currentTime, h) / c;
|
|
893
|
-
let C = Math.floor(g), M = g % 1;
|
|
894
|
-
!M && g >= 1 && (M = 1), M === 1 && C--, C = Math.min(C, f + 1), !!(C % 2) && (v === "reverse" ? (M = 1 - M, T && (M -= T / c)) : v === "mirror" && (A = o)), p = Y(0, 1, M) * c;
|
|
895
|
-
}
|
|
896
|
-
const V = y ? { done: !1, value: a[0] } : A.next(p);
|
|
897
|
-
l && (V.value = l(V.value));
|
|
898
|
-
let { done: S } = V;
|
|
899
|
-
!y && u !== null && (S = this.speed >= 0 ? this.currentTime >= h : this.currentTime <= 0);
|
|
900
|
-
const F = this.holdTime === null && (this.state === "finished" || this.state === "running" && S);
|
|
901
|
-
return F && i !== void 0 && (V.value = he(a, this.options, i)), b && b(V.value), F && this.finish(), V;
|
|
902
|
-
}
|
|
903
|
-
get duration() {
|
|
904
|
-
const { resolved: e } = this;
|
|
905
|
-
return e ? N(e.calculatedDuration) : 0;
|
|
906
|
-
}
|
|
907
|
-
get time() {
|
|
908
|
-
return N(this.currentTime);
|
|
909
|
-
}
|
|
910
|
-
set time(e) {
|
|
911
|
-
e = R(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed);
|
|
912
|
-
}
|
|
913
|
-
get speed() {
|
|
914
|
-
return this.playbackSpeed;
|
|
915
|
-
}
|
|
916
|
-
set speed(e) {
|
|
917
|
-
const n = this.playbackSpeed !== e;
|
|
918
|
-
this.playbackSpeed = e, n && (this.time = N(this.currentTime));
|
|
919
|
-
}
|
|
920
|
-
play() {
|
|
921
|
-
if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) {
|
|
922
|
-
this.pendingPlayState = "running";
|
|
923
|
-
return;
|
|
924
|
-
}
|
|
925
|
-
if (this.isStopped)
|
|
926
|
-
return;
|
|
927
|
-
const { driver: e = ri, onPlay: n, startTime: s } = this.options;
|
|
928
|
-
this.driver || (this.driver = e((r) => this.tick(r))), n && n();
|
|
929
|
-
const i = this.driver.now();
|
|
930
|
-
this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = s ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start();
|
|
931
|
-
}
|
|
932
|
-
pause() {
|
|
933
|
-
var e;
|
|
934
|
-
if (!this._resolved) {
|
|
935
|
-
this.pendingPlayState = "paused";
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0;
|
|
939
|
-
}
|
|
940
|
-
complete() {
|
|
941
|
-
this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null;
|
|
942
|
-
}
|
|
943
|
-
finish() {
|
|
944
|
-
this.teardown(), this.state = "finished";
|
|
945
|
-
const { onComplete: e } = this.options;
|
|
946
|
-
e && e();
|
|
947
|
-
}
|
|
948
|
-
cancel() {
|
|
949
|
-
this.cancelTime !== null && this.tick(this.cancelTime), this.teardown(), this.updateFinishedPromise();
|
|
950
|
-
}
|
|
951
|
-
teardown() {
|
|
952
|
-
this.state = "idle", this.stopDriver(), this.resolveFinishedPromise(), this.updateFinishedPromise(), this.startTime = this.cancelTime = null, this.resolver.cancel();
|
|
953
|
-
}
|
|
954
|
-
stopDriver() {
|
|
955
|
-
this.driver && (this.driver.stop(), this.driver = void 0);
|
|
956
|
-
}
|
|
957
|
-
sample(e) {
|
|
958
|
-
return this.startTime = 0, this.tick(e, !0);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
const Zt = (t) => Array.isArray(t) && typeof t[0] == "number";
|
|
962
|
-
function Jt(t) {
|
|
963
|
-
return !!(!t || typeof t == "string" && t in Ue || Zt(t) || Array.isArray(t) && t.every(Jt));
|
|
964
|
-
}
|
|
965
|
-
const z = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, Ue = {
|
|
966
|
-
linear: "linear",
|
|
967
|
-
ease: "ease",
|
|
968
|
-
easeIn: "ease-in",
|
|
969
|
-
easeOut: "ease-out",
|
|
970
|
-
easeInOut: "ease-in-out",
|
|
971
|
-
circIn: /* @__PURE__ */ z([0, 0.65, 0.55, 1]),
|
|
972
|
-
circOut: /* @__PURE__ */ z([0.55, 0, 1, 0.45]),
|
|
973
|
-
backIn: /* @__PURE__ */ z([0.31, 0.01, 0.66, -0.59]),
|
|
974
|
-
backOut: /* @__PURE__ */ z([0.33, 1.53, 0.69, 0.99])
|
|
975
|
-
};
|
|
976
|
-
function li(t) {
|
|
977
|
-
return Qt(t) || Ue.easeOut;
|
|
978
|
-
}
|
|
979
|
-
function Qt(t) {
|
|
980
|
-
if (t)
|
|
981
|
-
return Zt(t) ? z(t) : Array.isArray(t) ? t.map(li) : Ue[t];
|
|
982
|
-
}
|
|
983
|
-
function ui(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: l, times: a } = {}) {
|
|
984
|
-
const u = { [e]: n };
|
|
985
|
-
a && (u.offset = a);
|
|
986
|
-
const h = Qt(l);
|
|
987
|
-
return Array.isArray(h) && (u.easing = h), t.animate(u, {
|
|
988
|
-
delay: s,
|
|
989
|
-
duration: i,
|
|
990
|
-
easing: Array.isArray(h) ? "linear" : h,
|
|
991
|
-
fill: "both",
|
|
992
|
-
iterations: r + 1,
|
|
993
|
-
direction: o === "reverse" ? "alternate" : "normal"
|
|
994
|
-
});
|
|
995
|
-
}
|
|
996
|
-
const ci = /* @__PURE__ */ Lt(() => Object.hasOwnProperty.call(Element.prototype, "animate")), re = 10, hi = 2e4;
|
|
997
|
-
function di(t) {
|
|
998
|
-
return t.type === "spring" || !Jt(t.ease);
|
|
999
|
-
}
|
|
1000
|
-
function fi(t, e) {
|
|
1001
|
-
const n = new Ge({
|
|
1002
|
-
...e,
|
|
1003
|
-
keyframes: t,
|
|
1004
|
-
repeat: 0,
|
|
1005
|
-
delay: 0,
|
|
1006
|
-
isGenerator: !0
|
|
1007
|
-
});
|
|
1008
|
-
let s = { done: !1, value: t[0] };
|
|
1009
|
-
const i = [];
|
|
1010
|
-
let r = 0;
|
|
1011
|
-
for (; !s.done && r < hi; )
|
|
1012
|
-
s = n.sample(r), i.push(s.value), r += re;
|
|
1013
|
-
return {
|
|
1014
|
-
times: void 0,
|
|
1015
|
-
keyframes: i,
|
|
1016
|
-
duration: r - re,
|
|
1017
|
-
ease: "linear"
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
class at extends kt {
|
|
1021
|
-
constructor(e) {
|
|
1022
|
-
super(e);
|
|
1023
|
-
const { name: n, motionValue: s, element: i, keyframes: r } = this.options;
|
|
1024
|
-
this.resolver = new Bt(r, (o, l) => this.onKeyframesResolved(o, l), n, s, i), this.resolver.scheduleResolve();
|
|
1025
|
-
}
|
|
1026
|
-
initPlayback(e, n) {
|
|
1027
|
-
var s;
|
|
1028
|
-
let { duration: i = 300, times: r, ease: o, type: l, motionValue: a, name: u, startTime: h } = this.options;
|
|
1029
|
-
if (!(!((s = a.owner) === null || s === void 0) && s.current))
|
|
1030
|
-
return !1;
|
|
1031
|
-
if (di(this.options)) {
|
|
1032
|
-
const { onComplete: d, onUpdate: f, motionValue: v, element: T, ...b } = this.options, m = fi(e, b);
|
|
1033
|
-
e = m.keyframes, e.length === 1 && (e[1] = e[0]), i = m.duration, r = m.times, o = m.ease, l = "keyframes";
|
|
1034
|
-
}
|
|
1035
|
-
const c = ui(a.owner.current, u, e, { ...this.options, duration: i, times: r, ease: o });
|
|
1036
|
-
return c.startTime = h ?? this.calcStartTime(), this.pendingTimeline ? (c.timeline = this.pendingTimeline, this.pendingTimeline = void 0) : c.onfinish = () => {
|
|
1037
|
-
const { onComplete: d } = this.options;
|
|
1038
|
-
a.set(he(e, this.options, n)), d && d(), this.cancel(), this.resolveFinishedPromise();
|
|
1039
|
-
}, {
|
|
1040
|
-
animation: c,
|
|
1041
|
-
duration: i,
|
|
1042
|
-
times: r,
|
|
1043
|
-
type: l,
|
|
1044
|
-
ease: o,
|
|
1045
|
-
keyframes: e
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
get duration() {
|
|
1049
|
-
const { resolved: e } = this;
|
|
1050
|
-
if (!e)
|
|
1051
|
-
return 0;
|
|
1052
|
-
const { duration: n } = e;
|
|
1053
|
-
return N(n);
|
|
1054
|
-
}
|
|
1055
|
-
get time() {
|
|
1056
|
-
const { resolved: e } = this;
|
|
1057
|
-
if (!e)
|
|
1058
|
-
return 0;
|
|
1059
|
-
const { animation: n } = e;
|
|
1060
|
-
return N(n.currentTime || 0);
|
|
1061
|
-
}
|
|
1062
|
-
set time(e) {
|
|
1063
|
-
const { resolved: n } = this;
|
|
1064
|
-
if (!n)
|
|
1065
|
-
return;
|
|
1066
|
-
const { animation: s } = n;
|
|
1067
|
-
s.currentTime = R(e);
|
|
1068
|
-
}
|
|
1069
|
-
get speed() {
|
|
1070
|
-
const { resolved: e } = this;
|
|
1071
|
-
if (!e)
|
|
1072
|
-
return 1;
|
|
1073
|
-
const { animation: n } = e;
|
|
1074
|
-
return n.playbackRate;
|
|
1075
|
-
}
|
|
1076
|
-
set speed(e) {
|
|
1077
|
-
const { resolved: n } = this;
|
|
1078
|
-
if (!n)
|
|
1079
|
-
return;
|
|
1080
|
-
const { animation: s } = n;
|
|
1081
|
-
s.playbackRate = e;
|
|
1082
|
-
}
|
|
1083
|
-
get state() {
|
|
1084
|
-
const { resolved: e } = this;
|
|
1085
|
-
if (!e)
|
|
1086
|
-
return "idle";
|
|
1087
|
-
const { animation: n } = e;
|
|
1088
|
-
return n.playState;
|
|
1089
|
-
}
|
|
1090
|
-
get startTime() {
|
|
1091
|
-
const { resolved: e } = this;
|
|
1092
|
-
if (!e)
|
|
1093
|
-
return null;
|
|
1094
|
-
const { animation: n } = e;
|
|
1095
|
-
return n.startTime;
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* Replace the default DocumentTimeline with another AnimationTimeline.
|
|
1099
|
-
* Currently used for scroll animations.
|
|
1100
|
-
*/
|
|
1101
|
-
attachTimeline(e) {
|
|
1102
|
-
if (!this._resolved)
|
|
1103
|
-
this.pendingTimeline = e;
|
|
1104
|
-
else {
|
|
1105
|
-
const { resolved: n } = this;
|
|
1106
|
-
if (!n)
|
|
1107
|
-
return I;
|
|
1108
|
-
const { animation: s } = n;
|
|
1109
|
-
s.timeline = e, s.onfinish = null;
|
|
1110
|
-
}
|
|
1111
|
-
return I;
|
|
1112
|
-
}
|
|
1113
|
-
play() {
|
|
1114
|
-
if (this.isStopped)
|
|
1115
|
-
return;
|
|
1116
|
-
const { resolved: e } = this;
|
|
1117
|
-
if (!e)
|
|
1118
|
-
return;
|
|
1119
|
-
const { animation: n } = e;
|
|
1120
|
-
n.playState === "finished" && this.updateFinishedPromise(), n.play();
|
|
1121
|
-
}
|
|
1122
|
-
pause() {
|
|
1123
|
-
const { resolved: e } = this;
|
|
1124
|
-
if (!e)
|
|
1125
|
-
return;
|
|
1126
|
-
const { animation: n } = e;
|
|
1127
|
-
n.pause();
|
|
1128
|
-
}
|
|
1129
|
-
stop() {
|
|
1130
|
-
if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
|
|
1131
|
-
return;
|
|
1132
|
-
this.resolveFinishedPromise(), this.updateFinishedPromise();
|
|
1133
|
-
const { resolved: e } = this;
|
|
1134
|
-
if (!e)
|
|
1135
|
-
return;
|
|
1136
|
-
const { animation: n, keyframes: s, duration: i, type: r, ease: o, times: l } = e;
|
|
1137
|
-
if (n.playState === "idle" || n.playState === "finished")
|
|
1138
|
-
return;
|
|
1139
|
-
if (this.time) {
|
|
1140
|
-
const { motionValue: u, onUpdate: h, onComplete: c, element: d, ...f } = this.options, v = new Ge({
|
|
1141
|
-
...f,
|
|
1142
|
-
keyframes: s,
|
|
1143
|
-
duration: i,
|
|
1144
|
-
type: r,
|
|
1145
|
-
ease: o,
|
|
1146
|
-
times: l,
|
|
1147
|
-
isGenerator: !0
|
|
1148
|
-
}), T = R(this.time);
|
|
1149
|
-
u.setWithVelocity(v.sample(T - re).value, v.sample(T).value, re);
|
|
1150
|
-
}
|
|
1151
|
-
const { onStop: a } = this.options;
|
|
1152
|
-
a && a(), this.cancel();
|
|
1153
|
-
}
|
|
1154
|
-
complete() {
|
|
1155
|
-
const { resolved: e } = this;
|
|
1156
|
-
e && e.animation.finish();
|
|
1157
|
-
}
|
|
1158
|
-
cancel() {
|
|
1159
|
-
const { resolved: e } = this;
|
|
1160
|
-
e && e.animation.cancel();
|
|
1161
|
-
}
|
|
1162
|
-
static supports(e) {
|
|
1163
|
-
const { motionValue: n, name: s, repeatDelay: i, repeatType: r, damping: o, type: l } = e;
|
|
1164
|
-
return ci() && s && Vn.has(s) && n && n.owner && n.owner.current instanceof HTMLElement && /**
|
|
1165
|
-
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
1166
|
-
* no way to read the value from WAAPI every frame.
|
|
1167
|
-
*/
|
|
1168
|
-
!n.owner.getProps().onUpdate && !i && r !== "mirror" && o !== 0 && l !== "inertia";
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
function pi(t, e) {
|
|
1172
|
-
let n;
|
|
1173
|
-
const s = () => {
|
|
1174
|
-
const { currentTime: i } = e, o = (i === null ? 0 : i.value) / 100;
|
|
1175
|
-
n !== o && t(o), n = o;
|
|
1176
|
-
};
|
|
1177
|
-
return x.update(s, !0), () => ne(s);
|
|
1178
|
-
}
|
|
1179
|
-
const mi = Lt(() => window.ScrollTimeline !== void 0);
|
|
1180
|
-
class gi {
|
|
1181
|
-
constructor(e) {
|
|
1182
|
-
this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
|
|
1183
|
-
}
|
|
1184
|
-
then(e, n) {
|
|
1185
|
-
return Promise.all(this.animations).then(e).catch(n);
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* TODO: Filter out cancelled or stopped animations before returning
|
|
1189
|
-
*/
|
|
1190
|
-
getAll(e) {
|
|
1191
|
-
return this.animations[0][e];
|
|
1192
|
-
}
|
|
1193
|
-
setAll(e, n) {
|
|
1194
|
-
for (let s = 0; s < this.animations.length; s++)
|
|
1195
|
-
this.animations[s][e] = n;
|
|
1196
|
-
}
|
|
1197
|
-
attachTimeline(e) {
|
|
1198
|
-
const n = this.animations.map((s) => {
|
|
1199
|
-
if (mi() && s.attachTimeline)
|
|
1200
|
-
s.attachTimeline(e);
|
|
1201
|
-
else
|
|
1202
|
-
return s.pause(), pi((i) => {
|
|
1203
|
-
s.time = s.duration * i;
|
|
1204
|
-
}, e);
|
|
1205
|
-
});
|
|
1206
|
-
return () => {
|
|
1207
|
-
n.forEach((s, i) => {
|
|
1208
|
-
s && s(), this.animations[i].stop();
|
|
1209
|
-
});
|
|
1210
|
-
};
|
|
1211
|
-
}
|
|
1212
|
-
get time() {
|
|
1213
|
-
return this.getAll("time");
|
|
1214
|
-
}
|
|
1215
|
-
set time(e) {
|
|
1216
|
-
this.setAll("time", e);
|
|
1217
|
-
}
|
|
1218
|
-
get speed() {
|
|
1219
|
-
return this.getAll("speed");
|
|
1220
|
-
}
|
|
1221
|
-
set speed(e) {
|
|
1222
|
-
this.setAll("speed", e);
|
|
1223
|
-
}
|
|
1224
|
-
get startTime() {
|
|
1225
|
-
return this.getAll("startTime");
|
|
1226
|
-
}
|
|
1227
|
-
get duration() {
|
|
1228
|
-
let e = 0;
|
|
1229
|
-
for (let n = 0; n < this.animations.length; n++)
|
|
1230
|
-
e = Math.max(e, this.animations[n].duration);
|
|
1231
|
-
return e;
|
|
1232
|
-
}
|
|
1233
|
-
runAll(e) {
|
|
1234
|
-
this.animations.forEach((n) => n[e]());
|
|
1235
|
-
}
|
|
1236
|
-
play() {
|
|
1237
|
-
this.runAll("play");
|
|
1238
|
-
}
|
|
1239
|
-
pause() {
|
|
1240
|
-
this.runAll("pause");
|
|
1241
|
-
}
|
|
1242
|
-
cancel() {
|
|
1243
|
-
this.runAll("cancel");
|
|
1244
|
-
}
|
|
1245
|
-
complete() {
|
|
1246
|
-
this.runAll("complete");
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
const vi = (t, e, n, s = {}, i, r, o) => (l) => {
|
|
1250
|
-
const a = St(s, t) || {}, u = a.delay || s.delay || 0;
|
|
1251
|
-
let { elapsed: h = 0 } = s;
|
|
1252
|
-
h = h - R(u);
|
|
1253
|
-
let c = {
|
|
1254
|
-
keyframes: Array.isArray(n) ? n : [null, n],
|
|
1255
|
-
ease: "easeOut",
|
|
1256
|
-
velocity: e.getVelocity(),
|
|
1257
|
-
...a,
|
|
1258
|
-
delay: -h,
|
|
1259
|
-
onUpdate: (f) => {
|
|
1260
|
-
e.set(f), a.onUpdate && a.onUpdate(f);
|
|
1261
|
-
},
|
|
1262
|
-
onComplete: () => {
|
|
1263
|
-
l(), a.onComplete && a.onComplete(), o && o();
|
|
1264
|
-
},
|
|
1265
|
-
onStop: o,
|
|
1266
|
-
name: t,
|
|
1267
|
-
motionValue: e,
|
|
1268
|
-
element: r ? void 0 : i
|
|
1269
|
-
};
|
|
1270
|
-
zn(a) || (c = {
|
|
1271
|
-
...c,
|
|
1272
|
-
...jn(t, c)
|
|
1273
|
-
}), c.duration && (c.duration = R(c.duration)), c.repeatDelay && (c.repeatDelay = R(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
|
|
1274
|
-
let d = !1;
|
|
1275
|
-
if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (c.duration = 0, c.delay === 0 && (d = !0)), d && !r && e.get() !== void 0) {
|
|
1276
|
-
const f = he(c.keyframes, a);
|
|
1277
|
-
if (f !== void 0)
|
|
1278
|
-
return x.update(() => {
|
|
1279
|
-
c.onUpdate(f), c.onComplete();
|
|
1280
|
-
}), new gi([]);
|
|
1281
|
-
}
|
|
1282
|
-
return !r && at.supports(c) ? new at(c) : new Ge(c);
|
|
1283
|
-
};
|
|
1284
|
-
class en {
|
|
1285
|
-
constructor() {
|
|
1286
|
-
this.subscriptions = [];
|
|
1287
|
-
}
|
|
1288
|
-
add(e) {
|
|
1289
|
-
return An(this.subscriptions, e), () => vt(this.subscriptions, e);
|
|
1290
|
-
}
|
|
1291
|
-
notify(e, n, s) {
|
|
1292
|
-
const i = this.subscriptions.length;
|
|
1293
|
-
if (i)
|
|
1294
|
-
if (i === 1)
|
|
1295
|
-
this.subscriptions[0](e, n, s);
|
|
1296
|
-
else
|
|
1297
|
-
for (let r = 0; r < i; r++) {
|
|
1298
|
-
const o = this.subscriptions[r];
|
|
1299
|
-
o && o(e, n, s);
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
getSize() {
|
|
1303
|
-
return this.subscriptions.length;
|
|
1304
|
-
}
|
|
1305
|
-
clear() {
|
|
1306
|
-
this.subscriptions.length = 0;
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
const lt = 30, yi = (t) => !isNaN(parseFloat(t));
|
|
1310
|
-
class tn {
|
|
1311
|
-
/**
|
|
1312
|
-
* @param init - The initiating value
|
|
1313
|
-
* @param config - Optional configuration options
|
|
1314
|
-
*
|
|
1315
|
-
* - `transformer`: A function to transform incoming values with.
|
|
1316
|
-
*
|
|
1317
|
-
* @internal
|
|
1318
|
-
*/
|
|
1319
|
-
constructor(e, n = {}) {
|
|
1320
|
-
this.version = "11.5.6", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
|
|
1321
|
-
const r = K.now();
|
|
1322
|
-
this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current);
|
|
1323
|
-
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
|
|
1324
|
-
}
|
|
1325
|
-
setCurrent(e) {
|
|
1326
|
-
this.current = e, this.updatedAt = K.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = yi(this.current));
|
|
1327
|
-
}
|
|
1328
|
-
setPrevFrameValue(e = this.current) {
|
|
1329
|
-
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
1330
|
-
}
|
|
1331
|
-
/**
|
|
1332
|
-
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
1333
|
-
*
|
|
1334
|
-
* It returns a function that, when called, will cancel the subscription.
|
|
1335
|
-
*
|
|
1336
|
-
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
1337
|
-
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
1338
|
-
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
1339
|
-
*
|
|
1340
|
-
* ```jsx
|
|
1341
|
-
* export const MyComponent = () => {
|
|
1342
|
-
* const x = useMotionValue(0)
|
|
1343
|
-
* const y = useMotionValue(0)
|
|
1344
|
-
* const opacity = useMotionValue(1)
|
|
1345
|
-
*
|
|
1346
|
-
* useEffect(() => {
|
|
1347
|
-
* function updateOpacity() {
|
|
1348
|
-
* const maxXY = Math.max(x.get(), y.get())
|
|
1349
|
-
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
1350
|
-
* opacity.set(newOpacity)
|
|
1351
|
-
* }
|
|
1352
|
-
*
|
|
1353
|
-
* const unsubscribeX = x.on("change", updateOpacity)
|
|
1354
|
-
* const unsubscribeY = y.on("change", updateOpacity)
|
|
1355
|
-
*
|
|
1356
|
-
* return () => {
|
|
1357
|
-
* unsubscribeX()
|
|
1358
|
-
* unsubscribeY()
|
|
1359
|
-
* }
|
|
1360
|
-
* }, [])
|
|
1361
|
-
*
|
|
1362
|
-
* return <motion.div style={{ x }} />
|
|
1363
|
-
* }
|
|
1364
|
-
* ```
|
|
1365
|
-
*
|
|
1366
|
-
* @param subscriber - A function that receives the latest value.
|
|
1367
|
-
* @returns A function that, when called, will cancel this subscription.
|
|
1368
|
-
*
|
|
1369
|
-
* @deprecated
|
|
1370
|
-
*/
|
|
1371
|
-
onChange(e) {
|
|
1372
|
-
return ae.env.NODE_ENV !== "production" && Ne(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
|
|
1373
|
-
}
|
|
1374
|
-
on(e, n) {
|
|
1375
|
-
this.events[e] || (this.events[e] = new en());
|
|
1376
|
-
const s = this.events[e].add(n);
|
|
1377
|
-
return e === "change" ? () => {
|
|
1378
|
-
s(), x.read(() => {
|
|
1379
|
-
this.events.change.getSize() || this.stop();
|
|
1380
|
-
});
|
|
1381
|
-
} : s;
|
|
1382
|
-
}
|
|
1383
|
-
clearListeners() {
|
|
1384
|
-
for (const e in this.events)
|
|
1385
|
-
this.events[e].clear();
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Attaches a passive effect to the `MotionValue`.
|
|
1389
|
-
*
|
|
1390
|
-
* @internal
|
|
1391
|
-
*/
|
|
1392
|
-
attach(e, n) {
|
|
1393
|
-
this.passiveEffect = e, this.stopPassiveEffect = n;
|
|
1394
|
-
}
|
|
1395
|
-
/**
|
|
1396
|
-
* Sets the state of the `MotionValue`.
|
|
1397
|
-
*
|
|
1398
|
-
* @remarks
|
|
1399
|
-
*
|
|
1400
|
-
* ```jsx
|
|
1401
|
-
* const x = useMotionValue(0)
|
|
1402
|
-
* x.set(10)
|
|
1403
|
-
* ```
|
|
1404
|
-
*
|
|
1405
|
-
* @param latest - Latest value to set.
|
|
1406
|
-
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
1407
|
-
*
|
|
1408
|
-
* @public
|
|
1409
|
-
*/
|
|
1410
|
-
set(e, n = !0) {
|
|
1411
|
-
!n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
|
|
1412
|
-
}
|
|
1413
|
-
setWithVelocity(e, n, s) {
|
|
1414
|
-
this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
|
|
1415
|
-
}
|
|
1416
|
-
/**
|
|
1417
|
-
* Set the state of the `MotionValue`, stopping any active animations,
|
|
1418
|
-
* effects, and resets velocity to `0`.
|
|
1419
|
-
*/
|
|
1420
|
-
jump(e, n = !0) {
|
|
1421
|
-
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* Returns the latest state of `MotionValue`
|
|
1425
|
-
*
|
|
1426
|
-
* @returns - The latest state of `MotionValue`
|
|
1427
|
-
*
|
|
1428
|
-
* @public
|
|
1429
|
-
*/
|
|
1430
|
-
get() {
|
|
1431
|
-
return this.current;
|
|
1432
|
-
}
|
|
1433
|
-
/**
|
|
1434
|
-
* @public
|
|
1435
|
-
*/
|
|
1436
|
-
getPrevious() {
|
|
1437
|
-
return this.prev;
|
|
1438
|
-
}
|
|
1439
|
-
/**
|
|
1440
|
-
* Returns the latest velocity of `MotionValue`
|
|
1441
|
-
*
|
|
1442
|
-
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1443
|
-
*
|
|
1444
|
-
* @public
|
|
1445
|
-
*/
|
|
1446
|
-
getVelocity() {
|
|
1447
|
-
const e = K.now();
|
|
1448
|
-
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > lt)
|
|
1449
|
-
return 0;
|
|
1450
|
-
const n = Math.min(this.updatedAt - this.prevUpdatedAt, lt);
|
|
1451
|
-
return _t(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
|
|
1452
|
-
}
|
|
1453
|
-
/**
|
|
1454
|
-
* Registers a new animation to control this `MotionValue`. Only one
|
|
1455
|
-
* animation can drive a `MotionValue` at one time.
|
|
1456
|
-
*
|
|
1457
|
-
* ```jsx
|
|
1458
|
-
* value.start()
|
|
1459
|
-
* ```
|
|
1460
|
-
*
|
|
1461
|
-
* @param animation - A function that starts the provided animation
|
|
1462
|
-
*
|
|
1463
|
-
* @internal
|
|
1464
|
-
*/
|
|
1465
|
-
start(e) {
|
|
1466
|
-
return this.stop(), new Promise((n) => {
|
|
1467
|
-
this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
|
|
1468
|
-
}).then(() => {
|
|
1469
|
-
this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
|
|
1470
|
-
});
|
|
1471
|
-
}
|
|
1472
|
-
/**
|
|
1473
|
-
* Stop the currently active animation.
|
|
1474
|
-
*
|
|
1475
|
-
* @public
|
|
1476
|
-
*/
|
|
1477
|
-
stop() {
|
|
1478
|
-
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
1479
|
-
}
|
|
1480
|
-
/**
|
|
1481
|
-
* Returns `true` if this value is currently animating.
|
|
1482
|
-
*
|
|
1483
|
-
* @public
|
|
1484
|
-
*/
|
|
1485
|
-
isAnimating() {
|
|
1486
|
-
return !!this.animation;
|
|
1487
|
-
}
|
|
1488
|
-
clearAnimation() {
|
|
1489
|
-
delete this.animation;
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1493
|
-
*
|
|
1494
|
-
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1495
|
-
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1496
|
-
* created a `MotionValue` via the `motionValue` function.
|
|
1497
|
-
*
|
|
1498
|
-
* @public
|
|
1499
|
-
*/
|
|
1500
|
-
destroy() {
|
|
1501
|
-
this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
function oe(t, e) {
|
|
1505
|
-
return new tn(t, e);
|
|
1506
|
-
}
|
|
1507
|
-
function bi(t, e, n) {
|
|
1508
|
-
t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, oe(n));
|
|
1509
|
-
}
|
|
1510
|
-
function Ti(t, e) {
|
|
1511
|
-
const n = ce(t, e);
|
|
1512
|
-
let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
|
|
1513
|
-
r = { ...r, ...s };
|
|
1514
|
-
for (const o in r) {
|
|
1515
|
-
const l = Sn(r[o]);
|
|
1516
|
-
bi(t, o, l);
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
function Vi(t) {
|
|
1520
|
-
return t.props[wn];
|
|
1521
|
-
}
|
|
1522
|
-
class Ai extends tn {
|
|
1523
|
-
constructor() {
|
|
1524
|
-
super(...arguments), this.output = [], this.counts = /* @__PURE__ */ new Map();
|
|
1525
|
-
}
|
|
1526
|
-
add(e) {
|
|
1527
|
-
const n = Pn(e);
|
|
1528
|
-
if (!n)
|
|
1529
|
-
return;
|
|
1530
|
-
const s = this.counts.get(n) || 0;
|
|
1531
|
-
this.counts.set(n, s + 1), s === 0 && (this.output.push(n), this.update());
|
|
1532
|
-
let i = !1;
|
|
1533
|
-
return () => {
|
|
1534
|
-
if (i)
|
|
1535
|
-
return;
|
|
1536
|
-
i = !0;
|
|
1537
|
-
const r = this.counts.get(n) - 1;
|
|
1538
|
-
this.counts.set(n, r), r === 0 && (vt(this.output, n), this.update());
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
update() {
|
|
1542
|
-
this.set(this.output.length ? this.output.join(", ") : "auto");
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
function Si(t) {
|
|
1546
|
-
return !!(D(t) && t.add);
|
|
1547
|
-
}
|
|
1548
|
-
function wi(t, e) {
|
|
1549
|
-
var n;
|
|
1550
|
-
if (!t.applyWillChange)
|
|
1551
|
-
return;
|
|
1552
|
-
let s = t.getValue("willChange");
|
|
1553
|
-
if (!s && !(!((n = t.props.style) === null || n === void 0) && n.willChange) && (s = new Ai("auto"), t.addValue("willChange", s)), Si(s))
|
|
1554
|
-
return s.add(e);
|
|
1555
|
-
}
|
|
1556
|
-
function Pi({ protectedKeys: t, needsAnimating: e }, n) {
|
|
1557
|
-
const s = t.hasOwnProperty(n) && e[n] !== !0;
|
|
1558
|
-
return e[n] = !1, s;
|
|
1559
|
-
}
|
|
1560
|
-
function nn(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
|
|
1561
|
-
var r;
|
|
1562
|
-
let { transition: o = t.getDefaultTransition(), transitionEnd: l, ...a } = e;
|
|
1563
|
-
s && (o = s);
|
|
1564
|
-
const u = [], h = i && t.animationState && t.animationState.getState()[i];
|
|
1565
|
-
for (const c in a) {
|
|
1566
|
-
const d = t.getValue(c, (r = t.latestValues[c]) !== null && r !== void 0 ? r : null), f = a[c];
|
|
1567
|
-
if (f === void 0 || h && Pi(h, c))
|
|
1568
|
-
continue;
|
|
1569
|
-
const v = {
|
|
1570
|
-
delay: n,
|
|
1571
|
-
...St(o || {}, c)
|
|
1572
|
-
};
|
|
1573
|
-
let T = !1;
|
|
1574
|
-
if (window.MotionHandoffAnimation) {
|
|
1575
|
-
const m = Vi(t);
|
|
1576
|
-
if (m) {
|
|
1577
|
-
const y = window.MotionHandoffAnimation(m, c, x);
|
|
1578
|
-
y !== null && (v.startTime = y, T = !0);
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
d.start(vi(c, d, f, t.shouldReduceMotion && Z.has(c) ? { type: !1 } : v, t, T, wi(t, c)));
|
|
1582
|
-
const b = d.animation;
|
|
1583
|
-
b && u.push(b);
|
|
1584
|
-
}
|
|
1585
|
-
return l && Promise.all(u).then(() => {
|
|
1586
|
-
x.update(() => {
|
|
1587
|
-
l && Ti(t, l);
|
|
1588
|
-
});
|
|
1589
|
-
}), u;
|
|
1590
|
-
}
|
|
1591
|
-
function Me(t, e, n = {}) {
|
|
1592
|
-
var s;
|
|
1593
|
-
const i = ce(t, e, n.type === "exit" ? (s = t.presenceContext) === null || s === void 0 ? void 0 : s.custom : void 0);
|
|
1594
|
-
let { transition: r = t.getDefaultTransition() || {} } = i || {};
|
|
1595
|
-
n.transitionOverride && (r = n.transitionOverride);
|
|
1596
|
-
const o = i ? () => Promise.all(nn(t, i, n)) : () => Promise.resolve(), l = t.variantChildren && t.variantChildren.size ? (u = 0) => {
|
|
1597
|
-
const { delayChildren: h = 0, staggerChildren: c, staggerDirection: d } = r;
|
|
1598
|
-
return xi(t, e, h + u, c, d, n);
|
|
1599
|
-
} : () => Promise.resolve(), { when: a } = r;
|
|
1600
|
-
if (a) {
|
|
1601
|
-
const [u, h] = a === "beforeChildren" ? [o, l] : [l, o];
|
|
1602
|
-
return u().then(() => h());
|
|
1603
|
-
} else
|
|
1604
|
-
return Promise.all([o(), l(n.delay)]);
|
|
1605
|
-
}
|
|
1606
|
-
function xi(t, e, n = 0, s = 0, i = 1, r) {
|
|
1607
|
-
const o = [], l = (t.variantChildren.size - 1) * s, a = i === 1 ? (u = 0) => u * s : (u = 0) => l - u * s;
|
|
1608
|
-
return Array.from(t.variantChildren).sort(Ci).forEach((u, h) => {
|
|
1609
|
-
u.notify("AnimationStart", e), o.push(Me(u, e, {
|
|
1610
|
-
...r,
|
|
1611
|
-
delay: n + a(h)
|
|
1612
|
-
}).then(() => u.notify("AnimationComplete", e)));
|
|
1613
|
-
}), Promise.all(o);
|
|
1614
|
-
}
|
|
1615
|
-
function Ci(t, e) {
|
|
1616
|
-
return t.sortNodePosition(e);
|
|
1617
|
-
}
|
|
1618
|
-
function Mi(t, e, n = {}) {
|
|
1619
|
-
t.notify("AnimationStart", e);
|
|
1620
|
-
let s;
|
|
1621
|
-
if (Array.isArray(e)) {
|
|
1622
|
-
const i = e.map((r) => Me(t, r, n));
|
|
1623
|
-
s = Promise.all(i);
|
|
1624
|
-
} else if (typeof e == "string")
|
|
1625
|
-
s = Me(t, e, n);
|
|
1626
|
-
else {
|
|
1627
|
-
const i = typeof e == "function" ? ce(t, e, n.custom) : e;
|
|
1628
|
-
s = Promise.all(nn(t, i, n));
|
|
1629
|
-
}
|
|
1630
|
-
return s.then(() => {
|
|
1631
|
-
t.notify("AnimationComplete", e);
|
|
1632
|
-
});
|
|
1633
|
-
}
|
|
1634
|
-
const Fi = bt.length;
|
|
1635
|
-
function sn(t) {
|
|
1636
|
-
if (!t)
|
|
1637
|
-
return;
|
|
1638
|
-
if (!t.isControllingVariants) {
|
|
1639
|
-
const n = t.parent ? sn(t.parent) || {} : {};
|
|
1640
|
-
return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
|
|
1641
|
-
}
|
|
1642
|
-
const e = {};
|
|
1643
|
-
for (let n = 0; n < Fi; n++) {
|
|
1644
|
-
const s = bt[n], i = t.props[s];
|
|
1645
|
-
(yt(i) || i === !1) && (e[s] = i);
|
|
1646
|
-
}
|
|
1647
|
-
return e;
|
|
1648
|
-
}
|
|
1649
|
-
const Oi = [...Vt].reverse(), Ri = Vt.length;
|
|
1650
|
-
function Di(t) {
|
|
1651
|
-
return (e) => Promise.all(e.map(({ animation: n, options: s }) => Mi(t, n, s)));
|
|
1652
|
-
}
|
|
1653
|
-
function Ii(t) {
|
|
1654
|
-
let e = Di(t), n = ut(), s = !0;
|
|
1655
|
-
const i = (a) => (u, h) => {
|
|
1656
|
-
var c;
|
|
1657
|
-
const d = ce(t, h, a === "exit" ? (c = t.presenceContext) === null || c === void 0 ? void 0 : c.custom : void 0);
|
|
1658
|
-
if (d) {
|
|
1659
|
-
const { transition: f, transitionEnd: v, ...T } = d;
|
|
1660
|
-
u = { ...u, ...T, ...v };
|
|
1661
|
-
}
|
|
1662
|
-
return u;
|
|
1663
|
-
};
|
|
1664
|
-
function r(a) {
|
|
1665
|
-
e = a(t);
|
|
1666
|
-
}
|
|
1667
|
-
function o(a) {
|
|
1668
|
-
const { props: u } = t, h = sn(t.parent) || {}, c = [], d = /* @__PURE__ */ new Set();
|
|
1669
|
-
let f = {}, v = 1 / 0;
|
|
1670
|
-
for (let b = 0; b < Ri; b++) {
|
|
1671
|
-
const m = Oi[b], y = n[m], p = u[m] !== void 0 ? u[m] : h[m], A = yt(p), V = m === a ? y.isActive : null;
|
|
1672
|
-
V === !1 && (v = b);
|
|
1673
|
-
let S = p === h[m] && p !== u[m] && A;
|
|
1674
|
-
if (S && s && t.manuallyAnimateOnMount && (S = !1), y.protectedKeys = { ...f }, // If it isn't active and hasn't *just* been set as inactive
|
|
1675
|
-
!y.isActive && V === null || // If we didn't and don't have any defined prop for this animation type
|
|
1676
|
-
!p && !y.prevProp || // Or if the prop doesn't define an animation
|
|
1677
|
-
Tt(p) || typeof p == "boolean")
|
|
1678
|
-
continue;
|
|
1679
|
-
const F = Ni(y.prevProp, p);
|
|
1680
|
-
let g = F || // If we're making this variant active, we want to always make it active
|
|
1681
|
-
m === a && y.isActive && !S && A || // If we removed a higher-priority variant (i is in reverse order)
|
|
1682
|
-
b > v && A, C = !1;
|
|
1683
|
-
const M = Array.isArray(p) ? p : [p];
|
|
1684
|
-
let G = M.reduce(i(m), {});
|
|
1685
|
-
V === !1 && (G = {});
|
|
1686
|
-
const { prevResolvedValues: $e = {} } = y, dn = {
|
|
1687
|
-
...$e,
|
|
1688
|
-
...G
|
|
1689
|
-
}, We = (P) => {
|
|
1690
|
-
g = !0, d.has(P) && (C = !0, d.delete(P)), y.needsAnimating[P] = !0;
|
|
1691
|
-
const O = t.getValue(P);
|
|
1692
|
-
O && (O.liveStyle = !1);
|
|
1693
|
-
};
|
|
1694
|
-
for (const P in dn) {
|
|
1695
|
-
const O = G[P], fe = $e[P];
|
|
1696
|
-
if (f.hasOwnProperty(P))
|
|
1697
|
-
continue;
|
|
1698
|
-
let pe = !1;
|
|
1699
|
-
je(O) && je(fe) ? pe = !At(O, fe) : pe = O !== fe, pe ? O != null ? We(P) : d.add(P) : O !== void 0 && d.has(P) ? We(P) : y.protectedKeys[P] = !0;
|
|
1700
|
-
}
|
|
1701
|
-
y.prevProp = p, y.prevResolvedValues = G, y.isActive && (f = { ...f, ...G }), s && t.blockInitialAnimation && (g = !1), g && (!(S && F) || C) && c.push(...M.map((P) => ({
|
|
1702
|
-
animation: P,
|
|
1703
|
-
options: { type: m }
|
|
1704
|
-
})));
|
|
1705
|
-
}
|
|
1706
|
-
if (d.size) {
|
|
1707
|
-
const b = {};
|
|
1708
|
-
d.forEach((m) => {
|
|
1709
|
-
const y = t.getBaseTarget(m), p = t.getValue(m);
|
|
1710
|
-
p && (p.liveStyle = !0), b[m] = y ?? null;
|
|
1711
|
-
}), c.push({ animation: b });
|
|
1712
|
-
}
|
|
1713
|
-
let T = !!c.length;
|
|
1714
|
-
return s && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (T = !1), s = !1, T ? e(c) : Promise.resolve();
|
|
1715
|
-
}
|
|
1716
|
-
function l(a, u) {
|
|
1717
|
-
var h;
|
|
1718
|
-
if (n[a].isActive === u)
|
|
1719
|
-
return Promise.resolve();
|
|
1720
|
-
(h = t.variantChildren) === null || h === void 0 || h.forEach((d) => {
|
|
1721
|
-
var f;
|
|
1722
|
-
return (f = d.animationState) === null || f === void 0 ? void 0 : f.setActive(a, u);
|
|
1723
|
-
}), n[a].isActive = u;
|
|
1724
|
-
const c = o(a);
|
|
1725
|
-
for (const d in n)
|
|
1726
|
-
n[d].protectedKeys = {};
|
|
1727
|
-
return c;
|
|
1728
|
-
}
|
|
1729
|
-
return {
|
|
1730
|
-
animateChanges: o,
|
|
1731
|
-
setActive: l,
|
|
1732
|
-
setAnimateFunction: r,
|
|
1733
|
-
getState: () => n,
|
|
1734
|
-
reset: () => {
|
|
1735
|
-
n = ut(), s = !0;
|
|
1736
|
-
}
|
|
1737
|
-
};
|
|
1738
|
-
}
|
|
1739
|
-
function Ni(t, e) {
|
|
1740
|
-
return typeof e == "string" ? e !== t : Array.isArray(e) ? !At(e, t) : !1;
|
|
1741
|
-
}
|
|
1742
|
-
function B(t = !1) {
|
|
1743
|
-
return {
|
|
1744
|
-
isActive: t,
|
|
1745
|
-
protectedKeys: {},
|
|
1746
|
-
needsAnimating: {},
|
|
1747
|
-
prevResolvedValues: {}
|
|
1748
|
-
};
|
|
1749
|
-
}
|
|
1750
|
-
function ut() {
|
|
1751
|
-
return {
|
|
1752
|
-
animate: B(!0),
|
|
1753
|
-
whileInView: B(),
|
|
1754
|
-
whileHover: B(),
|
|
1755
|
-
whileTap: B(),
|
|
1756
|
-
whileDrag: B(),
|
|
1757
|
-
whileFocus: B(),
|
|
1758
|
-
exit: B()
|
|
1759
|
-
};
|
|
1760
|
-
}
|
|
1761
|
-
class j {
|
|
1762
|
-
constructor(e) {
|
|
1763
|
-
this.isMounted = !1, this.node = e;
|
|
1764
|
-
}
|
|
1765
|
-
update() {
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
class Ki extends j {
|
|
1769
|
-
/**
|
|
1770
|
-
* We dynamically generate the AnimationState manager as it contains a reference
|
|
1771
|
-
* to the underlying animation library. We only want to load that if we load this,
|
|
1772
|
-
* so people can optionally code split it out using the `m` component.
|
|
1773
|
-
*/
|
|
1774
|
-
constructor(e) {
|
|
1775
|
-
super(e), e.animationState || (e.animationState = Ii(e));
|
|
1776
|
-
}
|
|
1777
|
-
updateAnimationControlsSubscription() {
|
|
1778
|
-
const { animate: e } = this.node.getProps();
|
|
1779
|
-
Tt(e) && (this.unmountControls = e.subscribe(this.node));
|
|
1780
|
-
}
|
|
1781
|
-
/**
|
|
1782
|
-
* Subscribe any provided AnimationControls to the component's VisualElement
|
|
1783
|
-
*/
|
|
1784
|
-
mount() {
|
|
1785
|
-
this.updateAnimationControlsSubscription();
|
|
1786
|
-
}
|
|
1787
|
-
update() {
|
|
1788
|
-
const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
|
|
1789
|
-
e !== n && this.updateAnimationControlsSubscription();
|
|
1790
|
-
}
|
|
1791
|
-
unmount() {
|
|
1792
|
-
var e;
|
|
1793
|
-
this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
let Ei = 0;
|
|
1797
|
-
class Bi extends j {
|
|
1798
|
-
constructor() {
|
|
1799
|
-
super(...arguments), this.id = Ei++;
|
|
1800
|
-
}
|
|
1801
|
-
update() {
|
|
1802
|
-
if (!this.node.presenceContext)
|
|
1803
|
-
return;
|
|
1804
|
-
const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
|
|
1805
|
-
if (!this.node.animationState || e === s)
|
|
1806
|
-
return;
|
|
1807
|
-
const i = this.node.animationState.setActive("exit", !e);
|
|
1808
|
-
n && !e && i.then(() => n(this.id));
|
|
1809
|
-
}
|
|
1810
|
-
mount() {
|
|
1811
|
-
const { register: e } = this.node.presenceContext || {};
|
|
1812
|
-
e && (this.unmount = e(this.id));
|
|
1813
|
-
}
|
|
1814
|
-
unmount() {
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
const Li = {
|
|
1818
|
-
animation: {
|
|
1819
|
-
Feature: Ki
|
|
1820
|
-
},
|
|
1821
|
-
exit: {
|
|
1822
|
-
Feature: Bi
|
|
1823
|
-
}
|
|
1824
|
-
}, ki = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1;
|
|
1825
|
-
function rn(t, e = "page") {
|
|
1826
|
-
return {
|
|
1827
|
-
point: {
|
|
1828
|
-
x: t[`${e}X`],
|
|
1829
|
-
y: t[`${e}Y`]
|
|
1830
|
-
}
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1833
|
-
const _i = (t) => (e) => ki(e) && t(e, rn(e));
|
|
1834
|
-
function k(t, e, n, s = { passive: !0 }) {
|
|
1835
|
-
return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
|
|
1836
|
-
}
|
|
1837
|
-
function ee(t, e, n, s) {
|
|
1838
|
-
return k(t, e, _i(n), s);
|
|
1839
|
-
}
|
|
1840
|
-
function on(t) {
|
|
1841
|
-
let e = null;
|
|
1842
|
-
return () => {
|
|
1843
|
-
const n = () => {
|
|
1844
|
-
e = null;
|
|
1845
|
-
};
|
|
1846
|
-
return e === null ? (e = t, n) : !1;
|
|
1847
|
-
};
|
|
1848
|
-
}
|
|
1849
|
-
const Gi = on("dragHorizontal"), Ui = on("dragVertical");
|
|
1850
|
-
function $i(t) {
|
|
1851
|
-
let e = !1;
|
|
1852
|
-
{
|
|
1853
|
-
const n = Gi(), s = Ui();
|
|
1854
|
-
n && s ? e = () => {
|
|
1855
|
-
n(), s();
|
|
1856
|
-
} : (n && n(), s && s());
|
|
1857
|
-
}
|
|
1858
|
-
return e;
|
|
1859
|
-
}
|
|
1860
|
-
function an() {
|
|
1861
|
-
const t = $i();
|
|
1862
|
-
return t ? (t(), !1) : !0;
|
|
1863
|
-
}
|
|
1864
|
-
const ct = () => ({ min: 0, max: 0 }), ln = () => ({
|
|
1865
|
-
x: ct(),
|
|
1866
|
-
y: ct()
|
|
1867
|
-
});
|
|
1868
|
-
function Wi({ top: t, left: e, right: n, bottom: s }) {
|
|
1869
|
-
return {
|
|
1870
|
-
x: { min: e, max: n },
|
|
1871
|
-
y: { min: t, max: s }
|
|
1872
|
-
};
|
|
1873
|
-
}
|
|
1874
|
-
function ji(t, e) {
|
|
1875
|
-
if (!e)
|
|
1876
|
-
return t;
|
|
1877
|
-
const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
|
|
1878
|
-
return {
|
|
1879
|
-
top: n.y,
|
|
1880
|
-
left: n.x,
|
|
1881
|
-
bottom: s.y,
|
|
1882
|
-
right: s.x
|
|
1883
|
-
};
|
|
1884
|
-
}
|
|
1885
|
-
function zi(t, e) {
|
|
1886
|
-
return Wi(ji(t.getBoundingClientRect(), e));
|
|
1887
|
-
}
|
|
1888
|
-
function ht(t, e) {
|
|
1889
|
-
const n = e ? "pointerenter" : "pointerleave", s = e ? "onHoverStart" : "onHoverEnd", i = (r, o) => {
|
|
1890
|
-
if (r.pointerType === "touch" || an())
|
|
1891
|
-
return;
|
|
1892
|
-
const l = t.getProps();
|
|
1893
|
-
t.animationState && l.whileHover && t.animationState.setActive("whileHover", e);
|
|
1894
|
-
const a = l[s];
|
|
1895
|
-
a && x.postRender(() => a(r, o));
|
|
1896
|
-
};
|
|
1897
|
-
return ee(t.current, n, i, {
|
|
1898
|
-
passive: !t.getProps()[s]
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
|
-
class Hi extends j {
|
|
1902
|
-
mount() {
|
|
1903
|
-
this.unmount = E(ht(this.node, !0), ht(this.node, !1));
|
|
1904
|
-
}
|
|
1905
|
-
unmount() {
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
class qi extends j {
|
|
1909
|
-
constructor() {
|
|
1910
|
-
super(...arguments), this.isActive = !1;
|
|
1911
|
-
}
|
|
1912
|
-
onFocus() {
|
|
1913
|
-
let e = !1;
|
|
1914
|
-
try {
|
|
1915
|
-
e = this.node.current.matches(":focus-visible");
|
|
1916
|
-
} catch {
|
|
1917
|
-
e = !0;
|
|
1918
|
-
}
|
|
1919
|
-
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
1920
|
-
}
|
|
1921
|
-
onBlur() {
|
|
1922
|
-
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
1923
|
-
}
|
|
1924
|
-
mount() {
|
|
1925
|
-
this.unmount = E(k(this.node.current, "focus", () => this.onFocus()), k(this.node.current, "blur", () => this.onBlur()));
|
|
1926
|
-
}
|
|
1927
|
-
unmount() {
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
const un = (t, e) => e ? t === e ? !0 : un(t, e.parentElement) : !1;
|
|
1931
|
-
function be(t, e) {
|
|
1932
|
-
if (!e)
|
|
1933
|
-
return;
|
|
1934
|
-
const n = new PointerEvent("pointer" + t);
|
|
1935
|
-
e(n, rn(n));
|
|
1936
|
-
}
|
|
1937
|
-
class Yi extends j {
|
|
1938
|
-
constructor() {
|
|
1939
|
-
super(...arguments), this.removeStartListeners = I, this.removeEndListeners = I, this.removeAccessibleListeners = I, this.startPointerPress = (e, n) => {
|
|
1940
|
-
if (this.isPressing)
|
|
1941
|
-
return;
|
|
1942
|
-
this.removeEndListeners();
|
|
1943
|
-
const s = this.node.getProps(), r = ee(window, "pointerup", (l, a) => {
|
|
1944
|
-
if (!this.checkPressEnd())
|
|
1945
|
-
return;
|
|
1946
|
-
const { onTap: u, onTapCancel: h, globalTapTarget: c } = this.node.getProps(), d = !c && !un(this.node.current, l.target) ? h : u;
|
|
1947
|
-
d && x.update(() => d(l, a));
|
|
1948
|
-
}, {
|
|
1949
|
-
passive: !(s.onTap || s.onPointerUp)
|
|
1950
|
-
}), o = ee(window, "pointercancel", (l, a) => this.cancelPress(l, a), {
|
|
1951
|
-
passive: !(s.onTapCancel || s.onPointerCancel)
|
|
1952
|
-
});
|
|
1953
|
-
this.removeEndListeners = E(r, o), this.startPress(e, n);
|
|
1954
|
-
}, this.startAccessiblePress = () => {
|
|
1955
|
-
const e = (r) => {
|
|
1956
|
-
if (r.key !== "Enter" || this.isPressing)
|
|
1957
|
-
return;
|
|
1958
|
-
const o = (l) => {
|
|
1959
|
-
l.key !== "Enter" || !this.checkPressEnd() || be("up", (a, u) => {
|
|
1960
|
-
const { onTap: h } = this.node.getProps();
|
|
1961
|
-
h && x.postRender(() => h(a, u));
|
|
1962
|
-
});
|
|
1963
|
-
};
|
|
1964
|
-
this.removeEndListeners(), this.removeEndListeners = k(this.node.current, "keyup", o), be("down", (l, a) => {
|
|
1965
|
-
this.startPress(l, a);
|
|
1966
|
-
});
|
|
1967
|
-
}, n = k(this.node.current, "keydown", e), s = () => {
|
|
1968
|
-
this.isPressing && be("cancel", (r, o) => this.cancelPress(r, o));
|
|
1969
|
-
}, i = k(this.node.current, "blur", s);
|
|
1970
|
-
this.removeAccessibleListeners = E(n, i);
|
|
1971
|
-
};
|
|
1972
|
-
}
|
|
1973
|
-
startPress(e, n) {
|
|
1974
|
-
this.isPressing = !0;
|
|
1975
|
-
const { onTapStart: s, whileTap: i } = this.node.getProps();
|
|
1976
|
-
i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), s && x.postRender(() => s(e, n));
|
|
1977
|
-
}
|
|
1978
|
-
checkPressEnd() {
|
|
1979
|
-
return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !an();
|
|
1980
|
-
}
|
|
1981
|
-
cancelPress(e, n) {
|
|
1982
|
-
if (!this.checkPressEnd())
|
|
1983
|
-
return;
|
|
1984
|
-
const { onTapCancel: s } = this.node.getProps();
|
|
1985
|
-
s && x.postRender(() => s(e, n));
|
|
1986
|
-
}
|
|
1987
|
-
mount() {
|
|
1988
|
-
const e = this.node.getProps(), n = ee(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, {
|
|
1989
|
-
passive: !(e.onTapStart || e.onPointerStart)
|
|
1990
|
-
}), s = k(this.node.current, "focus", this.startAccessiblePress);
|
|
1991
|
-
this.removeStartListeners = E(n, s);
|
|
1992
|
-
}
|
|
1993
|
-
unmount() {
|
|
1994
|
-
this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners();
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
const Fe = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), Xi = (t) => {
|
|
1998
|
-
const e = Fe.get(t.target);
|
|
1999
|
-
e && e(t);
|
|
2000
|
-
}, Zi = (t) => {
|
|
2001
|
-
t.forEach(Xi);
|
|
2002
|
-
};
|
|
2003
|
-
function Ji({ root: t, ...e }) {
|
|
2004
|
-
const n = t || document;
|
|
2005
|
-
Te.has(n) || Te.set(n, {});
|
|
2006
|
-
const s = Te.get(n), i = JSON.stringify(e);
|
|
2007
|
-
return s[i] || (s[i] = new IntersectionObserver(Zi, { root: t, ...e })), s[i];
|
|
2008
|
-
}
|
|
2009
|
-
function Qi(t, e, n) {
|
|
2010
|
-
const s = Ji(e);
|
|
2011
|
-
return Fe.set(t, n), s.observe(t), () => {
|
|
2012
|
-
Fe.delete(t), s.unobserve(t);
|
|
2013
|
-
};
|
|
2014
|
-
}
|
|
2015
|
-
const er = {
|
|
2016
|
-
some: 0,
|
|
2017
|
-
all: 1
|
|
2018
|
-
};
|
|
2019
|
-
class tr extends j {
|
|
2020
|
-
constructor() {
|
|
2021
|
-
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
2022
|
-
}
|
|
2023
|
-
startObserver() {
|
|
2024
|
-
this.unmount();
|
|
2025
|
-
const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
|
|
2026
|
-
root: n ? n.current : void 0,
|
|
2027
|
-
rootMargin: s,
|
|
2028
|
-
threshold: typeof i == "number" ? i : er[i]
|
|
2029
|
-
}, l = (a) => {
|
|
2030
|
-
const { isIntersecting: u } = a;
|
|
2031
|
-
if (this.isInView === u || (this.isInView = u, r && !u && this.hasEnteredView))
|
|
2032
|
-
return;
|
|
2033
|
-
u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
|
|
2034
|
-
const { onViewportEnter: h, onViewportLeave: c } = this.node.getProps(), d = u ? h : c;
|
|
2035
|
-
d && d(a);
|
|
2036
|
-
};
|
|
2037
|
-
return Qi(this.node.current, o, l);
|
|
2038
|
-
}
|
|
2039
|
-
mount() {
|
|
2040
|
-
this.startObserver();
|
|
2041
|
-
}
|
|
2042
|
-
update() {
|
|
2043
|
-
if (typeof IntersectionObserver > "u")
|
|
2044
|
-
return;
|
|
2045
|
-
const { props: e, prevProps: n } = this.node;
|
|
2046
|
-
["amount", "margin", "root"].some(nr(e, n)) && this.startObserver();
|
|
2047
|
-
}
|
|
2048
|
-
unmount() {
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
function nr({ viewport: t = {} }, { viewport: e = {} } = {}) {
|
|
2052
|
-
return (n) => t[n] !== e[n];
|
|
2053
|
-
}
|
|
2054
|
-
const sr = {
|
|
2055
|
-
inView: {
|
|
2056
|
-
Feature: tr
|
|
2057
|
-
},
|
|
2058
|
-
tap: {
|
|
2059
|
-
Feature: Yi
|
|
2060
|
-
},
|
|
2061
|
-
focus: {
|
|
2062
|
-
Feature: qi
|
|
2063
|
-
},
|
|
2064
|
-
hover: {
|
|
2065
|
-
Feature: Hi
|
|
2066
|
-
}
|
|
2067
|
-
}, Oe = { current: null }, cn = { current: !1 };
|
|
2068
|
-
function ir() {
|
|
2069
|
-
if (cn.current = !0, !!xn)
|
|
2070
|
-
if (window.matchMedia) {
|
|
2071
|
-
const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Oe.current = t.matches;
|
|
2072
|
-
t.addListener(e), e();
|
|
2073
|
-
} else
|
|
2074
|
-
Oe.current = !1;
|
|
2075
|
-
}
|
|
2076
|
-
function rr(t, e, n) {
|
|
2077
|
-
for (const s in e) {
|
|
2078
|
-
const i = e[s], r = n[s];
|
|
2079
|
-
if (D(i))
|
|
2080
|
-
t.addValue(s, i), ae.env.NODE_ENV === "development" && Ne(i.version === "11.5.6", `Attempting to mix Framer Motion versions ${i.version} with 11.5.6 may not work as expected.`);
|
|
2081
|
-
else if (D(r))
|
|
2082
|
-
t.addValue(s, oe(i, { owner: t }));
|
|
2083
|
-
else if (r !== i)
|
|
2084
|
-
if (t.hasValue(s)) {
|
|
2085
|
-
const o = t.getValue(s);
|
|
2086
|
-
o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
|
|
2087
|
-
} else {
|
|
2088
|
-
const o = t.getStaticValue(s);
|
|
2089
|
-
t.addValue(s, oe(o !== void 0 ? o : i, { owner: t }));
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
for (const s in n)
|
|
2093
|
-
e[s] === void 0 && t.removeValue(s);
|
|
2094
|
-
return e;
|
|
2095
|
-
}
|
|
2096
|
-
const dt = /* @__PURE__ */ new WeakMap(), or = [...Mt, w, W], ar = (t) => or.find(Ct(t)), ft = [
|
|
2097
|
-
"AnimationStart",
|
|
2098
|
-
"AnimationComplete",
|
|
2099
|
-
"Update",
|
|
2100
|
-
"BeforeLayoutMeasure",
|
|
2101
|
-
"LayoutMeasure",
|
|
2102
|
-
"LayoutAnimationStart",
|
|
2103
|
-
"LayoutAnimationComplete"
|
|
2104
|
-
];
|
|
2105
|
-
class lr {
|
|
2106
|
-
/**
|
|
2107
|
-
* This method takes React props and returns found MotionValues. For example, HTML
|
|
2108
|
-
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
2109
|
-
*
|
|
2110
|
-
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
2111
|
-
* intended to be one.
|
|
2112
|
-
*/
|
|
2113
|
-
scrapeMotionValuesFromProps(e, n, s) {
|
|
2114
|
-
return {};
|
|
2115
|
-
}
|
|
2116
|
-
constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, l = {}) {
|
|
2117
|
-
this.applyWillChange = !1, this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Ke, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
|
|
2118
|
-
this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
|
|
2119
|
-
}, this.renderScheduledAt = 0, this.scheduleRender = () => {
|
|
2120
|
-
const d = K.now();
|
|
2121
|
-
this.renderScheduledAt < d && (this.renderScheduledAt = d, x.render(this.render, !1, !0));
|
|
2122
|
-
};
|
|
2123
|
-
const { latestValues: a, renderState: u } = o;
|
|
2124
|
-
this.latestValues = a, this.baseTarget = { ...a }, this.initialValues = n.initial ? { ...a } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = l, this.blockInitialAnimation = !!r, this.isControllingVariants = Cn(n), this.isVariantNode = Mn(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
2125
|
-
const { willChange: h, ...c } = this.scrapeMotionValuesFromProps(n, {}, this);
|
|
2126
|
-
for (const d in c) {
|
|
2127
|
-
const f = c[d];
|
|
2128
|
-
a[d] !== void 0 && D(f) && f.set(a[d], !1);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
mount(e) {
|
|
2132
|
-
this.current = e, dt.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), cn.current || ir(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Oe.current, ae.env.NODE_ENV !== "production" && Ne(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
|
|
2133
|
-
}
|
|
2134
|
-
unmount() {
|
|
2135
|
-
dt.delete(this.current), this.projection && this.projection.unmount(), ne(this.notifyUpdate), ne(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
|
|
2136
|
-
for (const e in this.events)
|
|
2137
|
-
this.events[e].clear();
|
|
2138
|
-
for (const e in this.features) {
|
|
2139
|
-
const n = this.features[e];
|
|
2140
|
-
n && (n.unmount(), n.isMounted = !1);
|
|
2141
|
-
}
|
|
2142
|
-
this.current = null;
|
|
2143
|
-
}
|
|
2144
|
-
bindToMotionValue(e, n) {
|
|
2145
|
-
this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
|
|
2146
|
-
const s = Z.has(e), i = n.on("change", (l) => {
|
|
2147
|
-
this.latestValues[e] = l, this.props.onUpdate && x.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
|
|
2148
|
-
}), r = n.on("renderRequest", this.scheduleRender);
|
|
2149
|
-
let o;
|
|
2150
|
-
window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
|
|
2151
|
-
i(), r(), o && o(), n.owner && n.stop();
|
|
2152
|
-
});
|
|
2153
|
-
}
|
|
2154
|
-
sortNodePosition(e) {
|
|
2155
|
-
return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
|
|
2156
|
-
}
|
|
2157
|
-
updateFeatures() {
|
|
2158
|
-
let e = "animation";
|
|
2159
|
-
for (e in ze) {
|
|
2160
|
-
const n = ze[e];
|
|
2161
|
-
if (!n)
|
|
2162
|
-
continue;
|
|
2163
|
-
const { isEnabled: s, Feature: i } = n;
|
|
2164
|
-
if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
|
|
2165
|
-
const r = this.features[e];
|
|
2166
|
-
r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
triggerBuild() {
|
|
2171
|
-
this.build(this.renderState, this.latestValues, this.props);
|
|
2172
|
-
}
|
|
2173
|
-
/**
|
|
2174
|
-
* Measure the current viewport box with or without transforms.
|
|
2175
|
-
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
2176
|
-
* removed with a re-render to work.
|
|
2177
|
-
*/
|
|
2178
|
-
measureViewportBox() {
|
|
2179
|
-
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : ln();
|
|
2180
|
-
}
|
|
2181
|
-
getStaticValue(e) {
|
|
2182
|
-
return this.latestValues[e];
|
|
2183
|
-
}
|
|
2184
|
-
setStaticValue(e, n) {
|
|
2185
|
-
this.latestValues[e] = n;
|
|
2186
|
-
}
|
|
2187
|
-
/**
|
|
2188
|
-
* Update the provided props. Ensure any newly-added motion values are
|
|
2189
|
-
* added to our map, old ones removed, and listeners updated.
|
|
2190
|
-
*/
|
|
2191
|
-
update(e, n) {
|
|
2192
|
-
(e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
|
|
2193
|
-
for (let s = 0; s < ft.length; s++) {
|
|
2194
|
-
const i = ft[s];
|
|
2195
|
-
this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
|
|
2196
|
-
const r = "on" + i, o = e[r];
|
|
2197
|
-
o && (this.propEventSubscriptions[i] = this.on(i, o));
|
|
2198
|
-
}
|
|
2199
|
-
this.prevMotionValues = rr(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
|
|
2200
|
-
}
|
|
2201
|
-
getProps() {
|
|
2202
|
-
return this.props;
|
|
2203
|
-
}
|
|
2204
|
-
/**
|
|
2205
|
-
* Returns the variant definition with a given name.
|
|
2206
|
-
*/
|
|
2207
|
-
getVariant(e) {
|
|
2208
|
-
return this.props.variants ? this.props.variants[e] : void 0;
|
|
2209
|
-
}
|
|
2210
|
-
/**
|
|
2211
|
-
* Returns the defined default transition on this component.
|
|
2212
|
-
*/
|
|
2213
|
-
getDefaultTransition() {
|
|
2214
|
-
return this.props.transition;
|
|
2215
|
-
}
|
|
2216
|
-
getTransformPagePoint() {
|
|
2217
|
-
return this.props.transformPagePoint;
|
|
2218
|
-
}
|
|
2219
|
-
getClosestVariantNode() {
|
|
2220
|
-
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
2221
|
-
}
|
|
2222
|
-
/**
|
|
2223
|
-
* Add a child visual element to our set of children.
|
|
2224
|
-
*/
|
|
2225
|
-
addVariantChild(e) {
|
|
2226
|
-
const n = this.getClosestVariantNode();
|
|
2227
|
-
if (n)
|
|
2228
|
-
return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
|
|
2229
|
-
}
|
|
2230
|
-
/**
|
|
2231
|
-
* Add a motion value and bind it to this visual element.
|
|
2232
|
-
*/
|
|
2233
|
-
addValue(e, n) {
|
|
2234
|
-
const s = this.values.get(e);
|
|
2235
|
-
n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
|
|
2236
|
-
}
|
|
2237
|
-
/**
|
|
2238
|
-
* Remove a motion value and unbind any active subscriptions.
|
|
2239
|
-
*/
|
|
2240
|
-
removeValue(e) {
|
|
2241
|
-
this.values.delete(e);
|
|
2242
|
-
const n = this.valueSubscriptions.get(e);
|
|
2243
|
-
n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
|
|
2244
|
-
}
|
|
2245
|
-
/**
|
|
2246
|
-
* Check whether we have a motion value for this key
|
|
2247
|
-
*/
|
|
2248
|
-
hasValue(e) {
|
|
2249
|
-
return this.values.has(e);
|
|
2250
|
-
}
|
|
2251
|
-
getValue(e, n) {
|
|
2252
|
-
if (this.props.values && this.props.values[e])
|
|
2253
|
-
return this.props.values[e];
|
|
2254
|
-
let s = this.values.get(e);
|
|
2255
|
-
return s === void 0 && n !== void 0 && (s = oe(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
|
|
2256
|
-
}
|
|
2257
|
-
/**
|
|
2258
|
-
* If we're trying to animate to a previously unencountered value,
|
|
2259
|
-
* we need to check for it in our state and as a last resort read it
|
|
2260
|
-
* directly from the instance (which might have performance implications).
|
|
2261
|
-
*/
|
|
2262
|
-
readValue(e, n) {
|
|
2263
|
-
var s;
|
|
2264
|
-
let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (s = this.getBaseTargetFromProps(this.props, e)) !== null && s !== void 0 ? s : this.readValueFromInstance(this.current, e, this.options);
|
|
2265
|
-
return i != null && (typeof i == "string" && (Pt(i) || wt(i)) ? i = parseFloat(i) : !ar(i) && W.test(n) && (i = Et(e, n)), this.setBaseTarget(e, D(i) ? i.get() : i)), D(i) ? i.get() : i;
|
|
2266
|
-
}
|
|
2267
|
-
/**
|
|
2268
|
-
* Set the base target to later animate back to. This is currently
|
|
2269
|
-
* only hydrated on creation and when we first read a value.
|
|
2270
|
-
*/
|
|
2271
|
-
setBaseTarget(e, n) {
|
|
2272
|
-
this.baseTarget[e] = n;
|
|
2273
|
-
}
|
|
2274
|
-
/**
|
|
2275
|
-
* Find the base target for a value thats been removed from all animation
|
|
2276
|
-
* props.
|
|
2277
|
-
*/
|
|
2278
|
-
getBaseTarget(e) {
|
|
2279
|
-
var n;
|
|
2280
|
-
const { initial: s } = this.props;
|
|
2281
|
-
let i;
|
|
2282
|
-
if (typeof s == "string" || typeof s == "object") {
|
|
2283
|
-
const o = pt(this.props, s, (n = this.presenceContext) === null || n === void 0 ? void 0 : n.custom);
|
|
2284
|
-
o && (i = o[e]);
|
|
2285
|
-
}
|
|
2286
|
-
if (s && i !== void 0)
|
|
2287
|
-
return i;
|
|
2288
|
-
const r = this.getBaseTargetFromProps(this.props, e);
|
|
2289
|
-
return r !== void 0 && !D(r) ? r : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
|
|
2290
|
-
}
|
|
2291
|
-
on(e, n) {
|
|
2292
|
-
return this.events[e] || (this.events[e] = new en()), this.events[e].add(n);
|
|
2293
|
-
}
|
|
2294
|
-
notify(e, ...n) {
|
|
2295
|
-
this.events[e] && this.events[e].notify(...n);
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
class hn extends lr {
|
|
2299
|
-
constructor() {
|
|
2300
|
-
super(...arguments), this.KeyframeResolver = Bt;
|
|
2301
|
-
}
|
|
2302
|
-
sortInstanceNodePosition(e, n) {
|
|
2303
|
-
return e.compareDocumentPosition(n) & 2 ? 1 : -1;
|
|
2304
|
-
}
|
|
2305
|
-
getBaseTargetFromProps(e, n) {
|
|
2306
|
-
return e.style ? e.style[n] : void 0;
|
|
2307
|
-
}
|
|
2308
|
-
removeValueFromRenderState(e, { vars: n, style: s }) {
|
|
2309
|
-
delete n[e], delete s[e];
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
function ur(t) {
|
|
2313
|
-
return window.getComputedStyle(t);
|
|
2314
|
-
}
|
|
2315
|
-
class cr extends hn {
|
|
2316
|
-
constructor() {
|
|
2317
|
-
super(...arguments), this.type = "html", this.applyWillChange = !0, this.renderInstance = Fn;
|
|
2318
|
-
}
|
|
2319
|
-
readValueFromInstance(e, n) {
|
|
2320
|
-
if (Z.has(n)) {
|
|
2321
|
-
const s = Be(n);
|
|
2322
|
-
return s && s.default || 0;
|
|
2323
|
-
} else {
|
|
2324
|
-
const s = ur(e), i = (On(n) ? s.getPropertyValue(n) : s[n]) || 0;
|
|
2325
|
-
return typeof i == "string" ? i.trim() : i;
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
measureInstanceViewportBox(e, { transformPagePoint: n }) {
|
|
2329
|
-
return zi(e, n);
|
|
2330
|
-
}
|
|
2331
|
-
build(e, n, s) {
|
|
2332
|
-
Rn(e, n, s.transformTemplate);
|
|
2333
|
-
}
|
|
2334
|
-
scrapeMotionValuesFromProps(e, n, s) {
|
|
2335
|
-
return Dn(e, n, s);
|
|
2336
|
-
}
|
|
2337
|
-
handleChildMotionValue() {
|
|
2338
|
-
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
2339
|
-
const { children: e } = this.props;
|
|
2340
|
-
D(e) && (this.childSubscription = e.on("change", (n) => {
|
|
2341
|
-
this.current && (this.current.textContent = `${n}`);
|
|
2342
|
-
}));
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
class hr extends hn {
|
|
2346
|
-
constructor() {
|
|
2347
|
-
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln;
|
|
2348
|
-
}
|
|
2349
|
-
getBaseTargetFromProps(e, n) {
|
|
2350
|
-
return e[n];
|
|
2351
|
-
}
|
|
2352
|
-
readValueFromInstance(e, n) {
|
|
2353
|
-
if (Z.has(n)) {
|
|
2354
|
-
const s = Be(n);
|
|
2355
|
-
return s && s.default || 0;
|
|
2356
|
-
}
|
|
2357
|
-
return n = Nn.has(n) ? n : In(n), e.getAttribute(n);
|
|
2358
|
-
}
|
|
2359
|
-
scrapeMotionValuesFromProps(e, n, s) {
|
|
2360
|
-
return Kn(e, n, s);
|
|
2361
|
-
}
|
|
2362
|
-
build(e, n, s) {
|
|
2363
|
-
En(e, n, this.isSVGTag, s.transformTemplate);
|
|
2364
|
-
}
|
|
2365
|
-
renderInstance(e, n, s, i) {
|
|
2366
|
-
Bn(e, n, s, i);
|
|
2367
|
-
}
|
|
2368
|
-
mount(e) {
|
|
2369
|
-
this.isSVGTag = Ln(e.tagName), super.mount(e);
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
const dr = (t, e) => kn(t) ? new hr(e) : new cr(e, {
|
|
2373
|
-
allowProjection: t !== _n
|
|
2374
|
-
}), fr = {
|
|
2375
|
-
renderer: dr,
|
|
2376
|
-
...Li,
|
|
2377
|
-
...sr
|
|
2378
|
-
};
|
|
2379
|
-
var yr = fr;
|
|
2380
|
-
export {
|
|
2381
|
-
yr as default
|
|
2382
|
-
};
|