@mkbabb/keyframes.js 5.2.0 → 5.3.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/README.md +15 -5
- package/dist/easing-registry-BAgudUsG.js +2 -0
- package/dist/{easing-registry-DHV2-5gA.js → easing-registry-BlbS88NR.js} +2 -2
- package/dist/engine/index.d.ts +155 -174
- package/dist/engine/index.js +3710 -16
- package/dist/keyframes.d.ts +370 -305
- package/dist/keyframes.js +91 -142
- package/dist/{sequence-s0bL7Uul.js → sequence-CES7o7hs.js} +218 -170
- package/package.json +16 -42
- package/dist/backward-color-BtbRcnna.js +0 -108
- package/dist/compile-BHCTPerD.js +0 -30
- package/dist/delegation-BQYCrP2p.js +0 -259
- package/dist/draw-svg-CK9Qrly8.js +0 -33
- package/dist/easing-registry-y1p9McFy.js +0 -2
- package/dist/easing-serialize-D4LZCB6i.js +0 -21
- package/dist/engine-CPK_udUQ.js +0 -1172
- package/dist/engine-DlpimZtM.js +0 -3
- package/dist/entry-D82NKUhP.js +0 -148
- package/dist/format-BdIvdLzG.js +0 -114
- package/dist/group-HM7N4uOE.js +0 -390
- package/dist/handle-D4xrf_ya.js +0 -21
- package/dist/ingest-_g6tfk2e.js +0 -166
- package/dist/morph-svg-KUrH9KnK.js +0 -79
- package/dist/motion-path-wM5tPfrY.js +0 -26
- package/dist/parse-flatten-DRMHFytp.js +0 -2
- package/dist/parse-flatten-ZZUSEQEL.js +0 -63
- package/dist/presets-DeDJYL4G.js +0 -275
- package/dist/scheduler-CfGIC3GX.js +0 -14
- package/dist/scroll-BEyCx0b_.js +0 -287
- package/dist/validate-xFZ_Ld1k.js +0 -39
- package/dist/view-transition-BPJQxUTC.js +0 -305
package/dist/engine-CPK_udUQ.js
DELETED
|
@@ -1,1172 +0,0 @@
|
|
|
1
|
-
import { d as e, g as t, h as n, l as r, x as i, y as a } from "./sequence-s0bL7Uul.js";
|
|
2
|
-
import { n as o, r as s, t as c } from "./parse-flatten-ZZUSEQEL.js";
|
|
3
|
-
import { i as l, n as u, r as ee } from "./delegation-BQYCrP2p.js";
|
|
4
|
-
import { t as d } from "./easing-registry-DHV2-5gA.js";
|
|
5
|
-
import { COLOR_SPACE_RANGES as te, FunctionValue as f, ValueArray as p, ValueUnit as m, clamp as ne, coerceToSyntax as re, easeInOutCubic as ie, extractAnimationOptions as ae, extractFunctions as oe, extractKeyframes as se, extractProperties as ce, extractTimelineOptions as le, isColorUnit as ue, isObject as de, lerpArray as fe, lerpValue as pe, parseCSSStylesheet as h, parseCSSTime as me, parseCSSValue as g, parseCSSValueUnit as he, scale as ge, seekPreviousValue as _e, sleep as ve, unflattenObject as ye } from "@mkbabb/value.js";
|
|
6
|
-
//#region src/animation/constants/defaults.ts
|
|
7
|
-
var _ = [
|
|
8
|
-
"normal",
|
|
9
|
-
"reverse",
|
|
10
|
-
"alternate",
|
|
11
|
-
"alternate-reverse"
|
|
12
|
-
], v = [
|
|
13
|
-
"none",
|
|
14
|
-
"forwards",
|
|
15
|
-
"backwards",
|
|
16
|
-
"both"
|
|
17
|
-
], y = Object.keys(te), b = [
|
|
18
|
-
"shorter",
|
|
19
|
-
"longer",
|
|
20
|
-
"increasing",
|
|
21
|
-
"decreasing"
|
|
22
|
-
], x = () => {}, S = {
|
|
23
|
-
duration: 1e3,
|
|
24
|
-
delay: 0,
|
|
25
|
-
iterationCount: 1,
|
|
26
|
-
direction: "normal",
|
|
27
|
-
fillMode: "forwards",
|
|
28
|
-
timingFunction: { fn: ie },
|
|
29
|
-
useWAAPI: !0,
|
|
30
|
-
respectReducedMotion: !1,
|
|
31
|
-
colorSpace: "oklab"
|
|
32
|
-
}, be = {
|
|
33
|
-
zIndex: 0,
|
|
34
|
-
weight: 1,
|
|
35
|
-
blendMode: "replace",
|
|
36
|
-
enabled: !0
|
|
37
|
-
}, xe = 1e6, Se = /^(?:from|to)$/i, Ce = /^(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?%$/, we = /^(?:entry|exit|cover|contain)(?:\s+\d+(?:\.\d+)?%)?$/i, C = "named-selector", Te = /^(entry|exit|cover|contain)(?:\s+(\d+(?:\.\d+)?)%)?$/i, Ee = (e) => {
|
|
38
|
-
let t = Te.exec(e.trim());
|
|
39
|
-
if (t === null) throw new a("start", e, "not a conforming scroll-range named selector (entry/exit/cover/contain, optionally with a range fraction like 'entry 50%')", "NAMED_SELECTOR_NO_TIMELINE");
|
|
40
|
-
let n = l[t[1].toLowerCase()], r = t[2];
|
|
41
|
-
if (r === void 0) return n.start;
|
|
42
|
-
let i = Number.parseFloat(r) / 100;
|
|
43
|
-
return n.start + i * (n.end - n.start);
|
|
44
|
-
}, De = "a keyframe selector must be a percentage 0%–100% (e.g. \"0%\", \"50%\"), the keyword 'from'/'to', or a scroll-range named selector (entry/exit/cover/contain, optionally with a range fraction like 'entry 0%')";
|
|
45
|
-
function Oe(e) {
|
|
46
|
-
let t = e.trim();
|
|
47
|
-
if (t === "") throw new a("start", e, `${De} — got an empty/blank string`, "EMPTY_PARSE");
|
|
48
|
-
if (we.test(t)) return new m(t, void 0, [C]);
|
|
49
|
-
if (!Se.test(t) && !(Ce.test(t) && parseFloat(t) <= 100)) throw new a("start", e, `${De} — got ${JSON.stringify(e)}`);
|
|
50
|
-
return he(t);
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/animation/compile/numeric-plan.ts
|
|
54
|
-
var ke = (e) => typeof e.start.value == "number" && typeof e.stop.value == "number" && e.computed !== !0 && e.value.unit !== "color" && e._colorPlan == null, Ae = (e) => {
|
|
55
|
-
let t = [], n = [];
|
|
56
|
-
for (let r of e) ke(r) ? t.push(r) : n.push(r);
|
|
57
|
-
let r = t.length, i = new Float64Array(r), a = new Float64Array(r);
|
|
58
|
-
for (let e = 0; e < r; e++) i[e] = t[e].start.value, a[e] = t[e].stop.value;
|
|
59
|
-
return {
|
|
60
|
-
numeric: t,
|
|
61
|
-
from: i,
|
|
62
|
-
to: a,
|
|
63
|
-
out: new Float64Array(r),
|
|
64
|
-
boxed: n
|
|
65
|
-
};
|
|
66
|
-
}, w = (e, n) => {
|
|
67
|
-
if (typeof n == "function") return { fn: n };
|
|
68
|
-
if (typeof n == "object") {
|
|
69
|
-
if (typeof n.fn == "function") return n;
|
|
70
|
-
throw new a(e, n, "an Easing must carry a callable `fn`");
|
|
71
|
-
}
|
|
72
|
-
let r = d(n);
|
|
73
|
-
if (!r) throw new a(e, n, "unknown timing function — pass a callable TimingFunction, a typed Easing, a registry name, or a cubic-bezier() literal", "UNKNOWN_TIMING_FN");
|
|
74
|
-
let i = t(n);
|
|
75
|
-
return i ? {
|
|
76
|
-
fn: r,
|
|
77
|
-
css: i
|
|
78
|
-
} : { fn: r };
|
|
79
|
-
};
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/animation/compile/frame-compiler.ts
|
|
82
|
-
function je(e, t, n) {
|
|
83
|
-
let [r, i] = [e.start, t.start];
|
|
84
|
-
return {
|
|
85
|
-
start: r.value * n / 100,
|
|
86
|
-
stop: i.value * n / 100
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
var Me = class {
|
|
90
|
-
_options;
|
|
91
|
-
templateFrames = [];
|
|
92
|
-
parsedVars = [];
|
|
93
|
-
frames = [];
|
|
94
|
-
frameId = 0;
|
|
95
|
-
constructor(e) {
|
|
96
|
-
this._options = e;
|
|
97
|
-
}
|
|
98
|
-
get options() {
|
|
99
|
-
return this._options;
|
|
100
|
-
}
|
|
101
|
-
addFrame(e, t, n, r, i) {
|
|
102
|
-
typeof e == "number" ? e = String(e) + "%" : typeof e == "string" ? e = e : e instanceof m && (e = String(e));
|
|
103
|
-
let a = Oe(e), o = {
|
|
104
|
-
id: this.frameId,
|
|
105
|
-
start: a,
|
|
106
|
-
vars: t,
|
|
107
|
-
transform: n,
|
|
108
|
-
timingFunction: r == null ? this.options.timingFunction : w("timingFunction", r),
|
|
109
|
-
composition: i
|
|
110
|
-
};
|
|
111
|
-
this.templateFrames.push(o), this.frameId += 1;
|
|
112
|
-
}
|
|
113
|
-
createFrame(e, t) {
|
|
114
|
-
let n = this.templateFrames[e], r = this.templateFrames[t], i = {
|
|
115
|
-
start: e,
|
|
116
|
-
stop: t
|
|
117
|
-
}, a = je(n, r, this.options.duration), o = n.transform;
|
|
118
|
-
if (o == null) {
|
|
119
|
-
let t = _e(e, this.templateFrames, (e) => e.transform != null);
|
|
120
|
-
o = (t === void 0 ? void 0 : this.templateFrames[t].transform) ?? x;
|
|
121
|
-
}
|
|
122
|
-
let s = n.timingFunction;
|
|
123
|
-
if (s == null) {
|
|
124
|
-
let t = _e(e, this.templateFrames, (e) => e.timingFunction != null);
|
|
125
|
-
s = (t === void 0 ? void 0 : this.templateFrames[t].timingFunction) ?? this.options.timingFunction;
|
|
126
|
-
}
|
|
127
|
-
let c = e * xe + t, l = r.composition;
|
|
128
|
-
return {
|
|
129
|
-
id: c,
|
|
130
|
-
ixs: i,
|
|
131
|
-
start: n.start,
|
|
132
|
-
time: a,
|
|
133
|
-
interpVars: {},
|
|
134
|
-
allInterpVars: [],
|
|
135
|
-
transform: o,
|
|
136
|
-
timingFunction: s,
|
|
137
|
-
...l == null ? {} : { composition: l }
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
buildVarIndex() {
|
|
141
|
-
let e = /* @__PURE__ */ new Map();
|
|
142
|
-
for (let t = 0; t < this.parsedVars.length; t++) for (let n of Object.keys(this.parsedVars[t])) {
|
|
143
|
-
let r = e.get(n);
|
|
144
|
-
r || (r = [], e.set(n, r)), r.push(t);
|
|
145
|
-
}
|
|
146
|
-
return e;
|
|
147
|
-
}
|
|
148
|
-
reconcileVars(e, t) {
|
|
149
|
-
let n = this.parsedVars[e];
|
|
150
|
-
if (n) for (let r of Object.keys(n)) {
|
|
151
|
-
let n = t.get(r);
|
|
152
|
-
if (!n) continue;
|
|
153
|
-
let i = -1;
|
|
154
|
-
for (let t of n) if (t > e) {
|
|
155
|
-
i = t;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
if (i === -1) continue;
|
|
159
|
-
let [a, o] = [e, i], s = this.frames.findIndex((e) => e.ixs.start === a && e.ixs.stop === o), l = s === -1 ? this.createFrame(a, o) : this.frames[s];
|
|
160
|
-
l.interpVars[r] = c(r, a, o, this.parsedVars, this.options.colorSpace, this.options.hueMethod), s === -1 && this.frames.push(l);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
parse(e) {
|
|
164
|
-
this.frames = [], this.templateFrames.sort((e, t) => e.start.value - t.start.value), this.parsedVars = this.templateFrames.map((t) => {
|
|
165
|
-
let n = o(t.vars);
|
|
166
|
-
return Object.values(n).forEach((t) => {
|
|
167
|
-
t.setTargets(e);
|
|
168
|
-
}), n;
|
|
169
|
-
});
|
|
170
|
-
for (let e = 0; e < this.templateFrames.length - 1; e++) this.frames.push(this.createFrame(e, e + 1));
|
|
171
|
-
let t = this.buildVarIndex();
|
|
172
|
-
this.frames.forEach((e, n) => this.reconcileVars(n, t)), this.frames.sort((e, t) => e.time.start === t.time.start ? e.time.stop - t.time.stop : e.time.start - t.time.start), this.frames = this.frames.filter((e) => e.interpVars != null && Object.keys(e.interpVars).length > 0), this.frames.forEach((e) => this.finalizeFrameVars(e));
|
|
173
|
-
}
|
|
174
|
-
finalizeFrameVars(e) {
|
|
175
|
-
e.flatVars = Object.entries(e.interpVars).reduce((e, [t, n]) => (e[t] = n.map((e) => e.value), e), {}), e.vars = ye(e.flatVars), e._plainProj = void 0, e.allInterpVars = Object.values(e.interpVars).flat(), e._numericPlan = Ae(e.allInterpVars);
|
|
176
|
-
}
|
|
177
|
-
renormalizeColors() {
|
|
178
|
-
for (let e of this.frames) {
|
|
179
|
-
for (let t of Object.keys(e.interpVars)) e.interpVars[t] = c(t, e.ixs.start, e.ixs.stop, this.parsedVars, this.options.colorSpace, this.options.hueMethod);
|
|
180
|
-
this.finalizeFrameVars(e);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
//#endregion
|
|
185
|
-
//#region src/animation/engine/play-lifecycle.ts
|
|
186
|
-
function Ne(e, t) {
|
|
187
|
-
if (!(typeof AnimationEvent > "u")) for (let n of e.targets) typeof n?.dispatchEvent == "function" && n.dispatchEvent(new AnimationEvent(t, {
|
|
188
|
-
animationName: e.name ?? "",
|
|
189
|
-
elapsedTime: e._playback.t / 1e3
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
function Pe(e, t) {
|
|
193
|
-
return e === "reverse" || e === "alternate-reverse" && t % 2 == 0 || e === "alternate" && t % 2 == 1;
|
|
194
|
-
}
|
|
195
|
-
function T(e) {
|
|
196
|
-
if (e._playback.startTime !== void 0) {
|
|
197
|
-
let t = e._playback.t, n = e.options.duration - 2 * t;
|
|
198
|
-
e._playback.startTime -= n;
|
|
199
|
-
}
|
|
200
|
-
e._playback.reversed = !e._playback.reversed;
|
|
201
|
-
}
|
|
202
|
-
function E(e) {
|
|
203
|
-
if (e._playback.reversed = !1, Pe(e.options.direction, e._playback.iteration) && T(e), (e.options.fillMode === "backwards" || e.options.fillMode === "both") && e.fillBackwards(), e.options.delay > 0) return e._playback.paused = !0, ve(e.options.delay).then(() => {
|
|
204
|
-
e._playback.paused = !1, e._playback.started = !0;
|
|
205
|
-
});
|
|
206
|
-
e._playback.started = !0;
|
|
207
|
-
}
|
|
208
|
-
function D(e) {
|
|
209
|
-
e.paintRest(), e._playback.startTime = void 0, e._playback.iteration >= e.options.iterationCount - 1 ? (e._playback.done = !0, e._playback.iteration = 0, e.dispatchAnimationEvent("animationend")) : (e._playback.iteration += 1, e.dispatchAnimationEvent("animationiteration"));
|
|
210
|
-
}
|
|
211
|
-
function Fe(e, t) {
|
|
212
|
-
if (e._playback.startTime === void 0) {
|
|
213
|
-
let n = E(e), r = () => (e._playback.startTime = t + e.options.delay, e.dispatchAnimationEvent("animationstart"), O(e, t));
|
|
214
|
-
return n ? n.then(r) : r();
|
|
215
|
-
}
|
|
216
|
-
return O(e, t);
|
|
217
|
-
}
|
|
218
|
-
function O(e, t) {
|
|
219
|
-
if (e._playback.paused && e._playback.pausedTime === 0) return e._playback.pausedTime = t, e._playback.t;
|
|
220
|
-
if (e._playback.pausedTime > 0 && !e._playback.paused) {
|
|
221
|
-
let n = t - e._playback.pausedTime;
|
|
222
|
-
e._playback.startTime += n, e._playback.pausedTime = 0;
|
|
223
|
-
}
|
|
224
|
-
return e._playback.t = t - e._playback.startTime, e._playback.t >= e.options.duration && (D(e), e._playback.t = e.options.duration), e._playback.t;
|
|
225
|
-
}
|
|
226
|
-
function Ie(t, n) {
|
|
227
|
-
if (e(t.options.respectReducedMotion, () => !0, () => !1)) return ze(t), !1;
|
|
228
|
-
let r = t.advanceTo(n);
|
|
229
|
-
return typeof r == "number" ? k(t, r) : r.then((e) => k(t, e));
|
|
230
|
-
}
|
|
231
|
-
function k(e, t) {
|
|
232
|
-
return e._playback.paused ? !1 : e._playback.done ? (N(e), A(e), !1) : (e.interpFrames(t, !0, e._playback._interpOut), !0);
|
|
233
|
-
}
|
|
234
|
-
function A(e) {
|
|
235
|
-
let t = e._playback.resolvePromise;
|
|
236
|
-
e._playback.resolvePromise = null, t?.();
|
|
237
|
-
}
|
|
238
|
-
function j(e) {
|
|
239
|
-
return new Promise((t) => {
|
|
240
|
-
e._playback.resolvePromise = t, e.playback.loop(e._playback._boundFrame);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
async function Le(e) {
|
|
244
|
-
await u(e), N(e);
|
|
245
|
-
}
|
|
246
|
-
function M(e) {
|
|
247
|
-
let t = e._playback._waAnimations;
|
|
248
|
-
if (t.length !== 0) {
|
|
249
|
-
for (let e of t) try {
|
|
250
|
-
e.cancel();
|
|
251
|
-
} catch {}
|
|
252
|
-
e._playback._waAnimations = [];
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
async function Re(e) {
|
|
256
|
-
e._playback.started = !0, e.dispatchAnimationEvent("animationstart"), e.fillForwards(), e._playback.iteration = 0, e._playback.done = !0, e.dispatchAnimationEvent("animationend"), N(e);
|
|
257
|
-
}
|
|
258
|
-
function ze(e) {
|
|
259
|
-
M(e), e.fillForwards(), e._playback.iteration = 0, e._playback.done = !0, e.dispatchAnimationEvent("animationend"), N(e), A(e);
|
|
260
|
-
}
|
|
261
|
-
async function Be(t) {
|
|
262
|
-
if (t.managed) throw Error("Animation.play() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play() instead.");
|
|
263
|
-
if (t.assertNoUnresolvedNamedSelector(), t._playback._playingPromise) return t._playback._playingPromise;
|
|
264
|
-
let n = e(t.options.respectReducedMotion, () => (t.waapiIneligibleReason = void 0, Re(t)), () => {
|
|
265
|
-
if (t.options.useWAAPI) {
|
|
266
|
-
let e = ee(t);
|
|
267
|
-
return e.eligible ? (t.waapiIneligibleReason = void 0, Le(t)) : (t.waapiIneligibleReason = e.reason, j(t));
|
|
268
|
-
}
|
|
269
|
-
return t.waapiIneligibleReason = void 0, j(t);
|
|
270
|
-
});
|
|
271
|
-
return t._playback._playingPromise = n, n.finally(() => {
|
|
272
|
-
t._playback._playingPromise = null;
|
|
273
|
-
}), n;
|
|
274
|
-
}
|
|
275
|
-
function Ve(e) {
|
|
276
|
-
e._playback.started && (e._playback.paused = !0);
|
|
277
|
-
}
|
|
278
|
-
function He(e) {
|
|
279
|
-
if (e._playback.started && e._playback.paused) if (e._playback.paused = !1, e._playback._waAnimations.length > 0) for (let t of e._playback._waAnimations) t.play();
|
|
280
|
-
else e.playback.running || e.playback.loop(e._playback._boundFrame);
|
|
281
|
-
}
|
|
282
|
-
function Ue(e) {
|
|
283
|
-
M(e), e.playback.stop(), N(e), A(e);
|
|
284
|
-
}
|
|
285
|
-
function We(e) {
|
|
286
|
-
return !(!e._playback.started || e._playback.paused);
|
|
287
|
-
}
|
|
288
|
-
function Ge(e) {
|
|
289
|
-
return e._playback.reversed ? e.options.duration - e._playback.t : e._playback.t;
|
|
290
|
-
}
|
|
291
|
-
function N(e) {
|
|
292
|
-
e._playback.done = !1, e._playback.started = !1, e._playback.paused = !1, e._playback.reversed = !1, e._playback.iteration = 0, e._playback.startTime = void 0, e._playback.pausedTime = 0, e._playback.t = 0;
|
|
293
|
-
}
|
|
294
|
-
function Ke(e) {
|
|
295
|
-
M(e), e._playback.started && e.frames.length > 0 && e.fillBackwards(), N(e);
|
|
296
|
-
}
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/animation/engine/playback-state.ts
|
|
299
|
-
var qe = class {
|
|
300
|
-
resolvePromise = null;
|
|
301
|
-
_playingPromise = null;
|
|
302
|
-
_waAnimations = [];
|
|
303
|
-
_boundFrame;
|
|
304
|
-
_interpOut = {};
|
|
305
|
-
startTime = void 0;
|
|
306
|
-
pausedTime = 0;
|
|
307
|
-
t = 0;
|
|
308
|
-
iteration = 0;
|
|
309
|
-
started = !1;
|
|
310
|
-
done = !1;
|
|
311
|
-
reversed = !1;
|
|
312
|
-
paused = !1;
|
|
313
|
-
constructor(e) {
|
|
314
|
-
this._boundFrame = e;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
//#endregion
|
|
318
|
-
//#region src/animation/engine/composition.ts
|
|
319
|
-
function Je(e) {
|
|
320
|
-
for (let t of e) if (t.composition != null && t.composition !== "replace") return !0;
|
|
321
|
-
return !1;
|
|
322
|
-
}
|
|
323
|
-
function Ye(e, t) {
|
|
324
|
-
e.clear(), t.clear();
|
|
325
|
-
}
|
|
326
|
-
function Xe(e, t) {
|
|
327
|
-
let n = e.composition;
|
|
328
|
-
if (n == null || n === "replace") return;
|
|
329
|
-
let r = e.flatVars;
|
|
330
|
-
for (let i in r) {
|
|
331
|
-
let a = r[i];
|
|
332
|
-
if (!Array.isArray(a) || a.length === 0) continue;
|
|
333
|
-
if (!a.every((e) => e instanceof m && typeof e.value == "number")) {
|
|
334
|
-
$e(i, n, t);
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
let o = t.compositionBase.get(i);
|
|
338
|
-
o === void 0 && (o = Ze(t.target, i, a.length), t.compositionBase.set(i, o));
|
|
339
|
-
let s = n === "accumulate" ? t.iteration : 0;
|
|
340
|
-
for (let n = 0; n < a.length; n++) {
|
|
341
|
-
let r = a[n], c = o[n] ?? 0;
|
|
342
|
-
s > 0 ? r.value = c + s * (Qe(e, i, n, t.compositionBase) - c) + r.value : r.value = c + r.value;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function Ze(e, t, n) {
|
|
347
|
-
let r = Array(n).fill(0);
|
|
348
|
-
if (e == null || e.style == null) return r;
|
|
349
|
-
let i = t.split(".").pop() ?? t, a = e.style.getPropertyValue(i) || e.style[i] || "";
|
|
350
|
-
if (!a) return r;
|
|
351
|
-
let o = a.match(/-?\d*\.?\d+(?:e[+-]?\d+)?/gi);
|
|
352
|
-
if (o == null) return r;
|
|
353
|
-
for (let e = 0; e < n && e < o.length; e++) {
|
|
354
|
-
let t = Number.parseFloat(o[e]);
|
|
355
|
-
Number.isFinite(t) && (r[e] = t);
|
|
356
|
-
}
|
|
357
|
-
return r;
|
|
358
|
-
}
|
|
359
|
-
function Qe(e, t, n, r) {
|
|
360
|
-
let i = e.interpVars[t]?.[n]?.stop;
|
|
361
|
-
return i instanceof m && typeof i.value == "number" ? i.value : r.get(t)?.[n] ?? 0;
|
|
362
|
-
}
|
|
363
|
-
function $e(e, t, n) {
|
|
364
|
-
n.compositionFallbackSeen.has(e) || (n.compositionFallbackSeen.add(e), n.diagnostics.push({
|
|
365
|
-
code: "COMPOSITION_FALLBACK",
|
|
366
|
-
message: `animation-composition: ${t} on a non-numeric leaf "${e}" has no faithful numeric add — composited as \`replace\` (the lerped value), never a wrong sum`,
|
|
367
|
-
property: e
|
|
368
|
-
}));
|
|
369
|
-
}
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region src/animation/compile/plain-vars.ts
|
|
372
|
-
var et = (e) => e instanceof m && typeof e.value == "number" && (e.unit == null || e.unit === "") && !ue(e), P = (e) => e.length === 1 ? String(e[0]) : e.map((e) => String(e)).join(" "), tt = (e, t) => {
|
|
373
|
-
if (t.indexOf(".") === -1) return {
|
|
374
|
-
obj: e,
|
|
375
|
-
key: t
|
|
376
|
-
};
|
|
377
|
-
let n = t.split("."), r = e;
|
|
378
|
-
for (let e = 0; e < n.length - 1; e++) {
|
|
379
|
-
let t = n[e], i = r[t];
|
|
380
|
-
(typeof i != "object" || !i) && (i = {}, r[t] = i), r = i;
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
obj: r,
|
|
384
|
-
key: n[n.length - 1]
|
|
385
|
-
};
|
|
386
|
-
}, F = (e) => {
|
|
387
|
-
let t = {}, n = [];
|
|
388
|
-
for (let r in e) {
|
|
389
|
-
let i = e[r];
|
|
390
|
-
if (i === void 0) continue;
|
|
391
|
-
let { obj: a, key: o } = tt(t, r), s = i.length === 1 && et(i[0]);
|
|
392
|
-
a[o] = s ? i[0].value : P(i), n.push({
|
|
393
|
-
obj: a,
|
|
394
|
-
key: o,
|
|
395
|
-
units: i,
|
|
396
|
-
numeric: s
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
root: t,
|
|
401
|
-
writers: n
|
|
402
|
-
};
|
|
403
|
-
}, I = (e) => {
|
|
404
|
-
let { writers: t } = e;
|
|
405
|
-
for (let e = 0; e < t.length; e++) {
|
|
406
|
-
let n = t[e];
|
|
407
|
-
n.obj[n.key] = n.numeric ? n.units[0].value : P(n.units);
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/animation/engine/interpolate.ts
|
|
412
|
-
function L(e) {
|
|
413
|
-
return e.options.fillMode === "forwards" || e.options.fillMode === "both" ? "final" : "initial";
|
|
414
|
-
}
|
|
415
|
-
function nt(e) {
|
|
416
|
-
L(e) === "final" ? z(e, e.options.duration, !0) : z(e, 0, !0);
|
|
417
|
-
}
|
|
418
|
-
function R(e) {
|
|
419
|
-
let t = e.compiler.templateFrames.find((e) => e.start.superType?.includes(C));
|
|
420
|
-
if (t != null) {
|
|
421
|
-
let e = String(t.start.value);
|
|
422
|
-
throw new a("start", e, `named scroll-range selector ("${e}") requires a ScrollTimeline or ManualTimeline — call bindTimeline(timeline) before play() to resolve the named phase to a numeric position`, "NAMED_SELECTOR_NO_TIMELINE");
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
function rt(e, t, n = !1) {
|
|
426
|
-
R(e);
|
|
427
|
-
let r = e._playback.reversed;
|
|
428
|
-
e._playback.reversed = !1;
|
|
429
|
-
let i = z(e, ne(t, 0, 1) * e.options.duration, n);
|
|
430
|
-
return e._playback.reversed = r, i;
|
|
431
|
-
}
|
|
432
|
-
function z(e, t, r = !1, i) {
|
|
433
|
-
t = e._playback.reversed ? e.options.duration - t : t;
|
|
434
|
-
let a = e.frames, o = a.length, s = n(a, t, (e) => e.time.start, (e) => e.time.stop);
|
|
435
|
-
if (s === -1) return i === void 0 ? {} : (B(e, i), i);
|
|
436
|
-
let c = s, l = s;
|
|
437
|
-
for (let e = s - 1; e >= 0; e--) {
|
|
438
|
-
let n = a[e];
|
|
439
|
-
if (t < n.time.start || t > n.time.stop) break;
|
|
440
|
-
c = e;
|
|
441
|
-
}
|
|
442
|
-
for (let e = s + 1; e < o; e++) {
|
|
443
|
-
let n = a[e];
|
|
444
|
-
if (t < n.time.start || t > n.time.stop) break;
|
|
445
|
-
l = e;
|
|
446
|
-
}
|
|
447
|
-
for (let n = c; n <= l; n++) it(e, a[n], t, r);
|
|
448
|
-
if (c === l) {
|
|
449
|
-
let t = a[s].flatVars;
|
|
450
|
-
return i === void 0 ? t : (B(e, i), Object.assign(i, t), i);
|
|
451
|
-
}
|
|
452
|
-
let u = i ?? {};
|
|
453
|
-
i !== void 0 && B(e, i);
|
|
454
|
-
for (let e = c; e <= l; e++) Object.assign(u, a[e].flatVars);
|
|
455
|
-
return u;
|
|
456
|
-
}
|
|
457
|
-
function B(e, t) {
|
|
458
|
-
let n = e._stableKeys;
|
|
459
|
-
for (let e = 0; e < n.length; e++) t[n[e]] = void 0;
|
|
460
|
-
}
|
|
461
|
-
function it(e, t, n, r) {
|
|
462
|
-
let { start: i, stop: a } = t.time, o = i === a ? 1 : ge(n, i, a, 0, 1), s = t.timingFunction.fn(o), c = t._numericPlan;
|
|
463
|
-
if (c !== void 0 && c.numeric.length > 0) {
|
|
464
|
-
let { numeric: e, from: t, to: n, out: r } = c;
|
|
465
|
-
fe(t, n, s, r);
|
|
466
|
-
for (let t = 0; t < e.length; t++) e[t].value.value = r[t];
|
|
467
|
-
for (let e of c.boxed) pe(s, e);
|
|
468
|
-
} else for (let e of t.allInterpVars) pe(s, e);
|
|
469
|
-
if (r && e._hasComposition && t.composition != null && at(e, t), r) if (e.unflatten) {
|
|
470
|
-
let e = t._plainProj;
|
|
471
|
-
e === void 0 ? (e = F(t.flatVars), t._plainProj = e, t.plainVars = e.root) : I(e), t.transform(t.plainVars, n);
|
|
472
|
-
} else t.transform(t.flatVars, n);
|
|
473
|
-
}
|
|
474
|
-
function at(e, t) {
|
|
475
|
-
Xe(t, {
|
|
476
|
-
iteration: e._playback.iteration,
|
|
477
|
-
target: e.targets[0],
|
|
478
|
-
compositionBase: e._compositionBase,
|
|
479
|
-
compositionFallbackSeen: e._compositionFallbackSeen,
|
|
480
|
-
diagnostics: e.diagnostics
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
//#endregion
|
|
484
|
-
//#region src/animation/engine/options.ts
|
|
485
|
-
var V = (e) => {
|
|
486
|
-
try {
|
|
487
|
-
let t = me(e);
|
|
488
|
-
return Number.isFinite(t) ? t : void 0;
|
|
489
|
-
} catch {
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
function ot(e) {
|
|
494
|
-
return e == null ? S.timingFunction : w("timingFunction", e);
|
|
495
|
-
}
|
|
496
|
-
function st(e) {
|
|
497
|
-
return e == null ? S.iterationCount : e === "infinite" || e === "∞" || e === "Infinity" || e === Infinity ? Infinity : i("iterationCount", e, (e) => {
|
|
498
|
-
let t = typeof e == "string" ? Number.parseFloat(e.trim()) : e;
|
|
499
|
-
return typeof t == "number" && !Number.isNaN(t) && t >= 0 ? t : void 0;
|
|
500
|
-
}, "expected a non-negative count, \"infinite\", or Infinity");
|
|
501
|
-
}
|
|
502
|
-
function ct(e) {
|
|
503
|
-
if (e != null) return i("duration", e, (e) => {
|
|
504
|
-
let t = typeof e == "string" ? V(e) : e;
|
|
505
|
-
return typeof t == "number" && isFinite(t) && t > 0 ? t : void 0;
|
|
506
|
-
}, "expected a positive duration in milliseconds or a CSS time string");
|
|
507
|
-
}
|
|
508
|
-
function lt(e) {
|
|
509
|
-
return e == null ? S.delay : i("delay", e, (e) => {
|
|
510
|
-
let t = typeof e == "string" ? V(e) : e;
|
|
511
|
-
return typeof t == "number" && isFinite(t) ? t : void 0;
|
|
512
|
-
}, "expected a delay in milliseconds or a CSS time string");
|
|
513
|
-
}
|
|
514
|
-
function ut(e) {
|
|
515
|
-
if (e == null) return S.direction;
|
|
516
|
-
if (!_.includes(e)) throw new a("direction", e, `expected one of: ${_.join(", ")}`);
|
|
517
|
-
return e;
|
|
518
|
-
}
|
|
519
|
-
function dt(e) {
|
|
520
|
-
if (e == null) return S.fillMode;
|
|
521
|
-
if (!v.includes(e)) throw new a("fillMode", e, `expected one of: ${v.join(", ")}`);
|
|
522
|
-
return e;
|
|
523
|
-
}
|
|
524
|
-
function H(e, t) {
|
|
525
|
-
if (t == null) return S[e];
|
|
526
|
-
if (typeof t != "boolean") throw new a(e, t, "expected a boolean");
|
|
527
|
-
return t;
|
|
528
|
-
}
|
|
529
|
-
function ft(e) {
|
|
530
|
-
if (e == null) return S.colorSpace;
|
|
531
|
-
if (!y.includes(e)) throw new a("colorSpace", e, `expected one of: ${y.join(", ")}`);
|
|
532
|
-
return e;
|
|
533
|
-
}
|
|
534
|
-
function pt(e) {
|
|
535
|
-
if (e != null) {
|
|
536
|
-
if (!b.includes(e)) throw new a("hueMethod", e, `expected one of: ${b.join(", ")}`);
|
|
537
|
-
return e;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
//#endregion
|
|
541
|
-
//#region src/animation/engine/option-setters.ts
|
|
542
|
-
function U(e, t) {
|
|
543
|
-
e.options.timingFunction = ot(t);
|
|
544
|
-
}
|
|
545
|
-
function W(e, t) {
|
|
546
|
-
e.options.iterationCount = st(t);
|
|
547
|
-
}
|
|
548
|
-
function mt(e, t) {
|
|
549
|
-
let n = ct(t);
|
|
550
|
-
if (n === void 0) return;
|
|
551
|
-
let r = n / e.options.duration;
|
|
552
|
-
for (let t = 0; t < e.frames.length; t++) {
|
|
553
|
-
let n = e.frames[t];
|
|
554
|
-
n.time.start *= r, n.time.stop *= r;
|
|
555
|
-
}
|
|
556
|
-
e.options.duration = n;
|
|
557
|
-
}
|
|
558
|
-
function G(e, t) {
|
|
559
|
-
e.options.delay = lt(t);
|
|
560
|
-
}
|
|
561
|
-
function K(e, t) {
|
|
562
|
-
e.options.direction = ut(t), e._playback.reversed = Pe(e.options.direction, e._playback.iteration);
|
|
563
|
-
}
|
|
564
|
-
function q(e, t) {
|
|
565
|
-
e.options.fillMode = dt(t);
|
|
566
|
-
}
|
|
567
|
-
function J(e, t) {
|
|
568
|
-
e.options.useWAAPI = H("useWAAPI", t);
|
|
569
|
-
}
|
|
570
|
-
function ht(e, t) {
|
|
571
|
-
e.options.respectReducedMotion = H("respectReducedMotion", t);
|
|
572
|
-
}
|
|
573
|
-
function gt(e, t) {
|
|
574
|
-
e.options.colorSpace = ft(t), e.frames.length > 0 && e.compiler.renormalizeColors();
|
|
575
|
-
}
|
|
576
|
-
function _t(e, t) {
|
|
577
|
-
let n = pt(t);
|
|
578
|
-
n !== void 0 && (e.options.hueMethod = n, e.frames.length > 0 && e.compiler.renormalizeColors());
|
|
579
|
-
}
|
|
580
|
-
function vt(e, t) {
|
|
581
|
-
t !== void 0 && (e.options.composite = t);
|
|
582
|
-
}
|
|
583
|
-
function yt(e, t) {
|
|
584
|
-
U(e, t.timingFunction), mt(e, t.duration), W(e, t.iterationCount), G(e, t.delay), K(e, t.direction), q(e, t.fillMode), J(e, t.useWAAPI), ht(e, t.respectReducedMotion), gt(e, t.colorSpace), _t(e, t.hueMethod), vt(e, t.composite);
|
|
585
|
-
}
|
|
586
|
-
//#endregion
|
|
587
|
-
//#region src/animation/engine/compile-bridge.ts
|
|
588
|
-
function bt(e) {
|
|
589
|
-
e.compiler.parse(e.targets), St(e), xt(e);
|
|
590
|
-
}
|
|
591
|
-
function xt(e) {
|
|
592
|
-
e._hasComposition = Je(e.frames), Ye(e._compositionBase, e._compositionFallbackSeen);
|
|
593
|
-
}
|
|
594
|
-
function St(e) {
|
|
595
|
-
let t = /* @__PURE__ */ new Set();
|
|
596
|
-
for (let n of e.frames) for (let e in n.flatVars) t.add(e);
|
|
597
|
-
e._stableKeys = [...t];
|
|
598
|
-
}
|
|
599
|
-
function Ct(e, t) {
|
|
600
|
-
e._setCompiler(t.compiler), e.options = e.compiler.options, e.unflatten = t.unflatten, St(e), xt(e);
|
|
601
|
-
}
|
|
602
|
-
//#endregion
|
|
603
|
-
//#region src/animation/resolve/env.ts
|
|
604
|
-
var wt = () => {
|
|
605
|
-
let e = typeof globalThis < "u" && typeof globalThis.CSS?.supports == "function", t = typeof globalThis < "u" && typeof globalThis.matchMedia == "function";
|
|
606
|
-
return {
|
|
607
|
-
supports: e ? (e) => globalThis.CSS.supports(e) : () => !1,
|
|
608
|
-
matchMedia: t ? (e) => globalThis.matchMedia(e) : () => ({ matches: !1 })
|
|
609
|
-
};
|
|
610
|
-
}, Tt = (e, t, n) => {
|
|
611
|
-
let r = {
|
|
612
|
-
functions: e,
|
|
613
|
-
env: {
|
|
614
|
-
...wt(),
|
|
615
|
-
...t
|
|
616
|
-
},
|
|
617
|
-
seen: /* @__PURE__ */ new Set(),
|
|
618
|
-
depth: 0
|
|
619
|
-
};
|
|
620
|
-
return n !== void 0 && (r.diagnostics = n), r;
|
|
621
|
-
}, Y = Symbol("kf.resolve.drop"), Et = (e, t, n) => {
|
|
622
|
-
if (t.syntax === void 0) return e;
|
|
623
|
-
let r = re(String(e), t.syntax);
|
|
624
|
-
if (r !== null) return r;
|
|
625
|
-
if (t.default === void 0) return Y;
|
|
626
|
-
try {
|
|
627
|
-
return g(t.default);
|
|
628
|
-
} catch (e) {
|
|
629
|
-
return n?.push({
|
|
630
|
-
code: "CUSTOM_FN_ARG_DROP",
|
|
631
|
-
property: t.name,
|
|
632
|
-
message: `--fn() arg coercion: default for ${t.name} failed to parse (${String(e)})`
|
|
633
|
-
}), Y;
|
|
634
|
-
}
|
|
635
|
-
}, Dt = (e, t) => !(e instanceof m) || e.unit !== "var" ? !1 : String(e.value).split(",", 1)[0]?.trim() === t, Ot = (e, t) => {
|
|
636
|
-
if (e instanceof m) {
|
|
637
|
-
if (e.unit === "var") {
|
|
638
|
-
for (let [n, r] of t) if (Dt(e, n)) return r.clone();
|
|
639
|
-
}
|
|
640
|
-
return e;
|
|
641
|
-
}
|
|
642
|
-
let n = e.values.map((e) => Ot(e, t));
|
|
643
|
-
return new f(e.name, n);
|
|
644
|
-
}, kt = (e, t, n) => {
|
|
645
|
-
if (t.seen.has(e.name)) return Y;
|
|
646
|
-
let r = t.functions.get(e.name);
|
|
647
|
-
if (r === void 0 || r.result === void 0) return Y;
|
|
648
|
-
let i = r.parameters ?? [], a = e.values;
|
|
649
|
-
if (a.length > i.length) return Y;
|
|
650
|
-
let o = /* @__PURE__ */ new Map();
|
|
651
|
-
for (let e = 0; e < i.length; e++) {
|
|
652
|
-
let n = i[e], r = a[e], s;
|
|
653
|
-
if (r === void 0) {
|
|
654
|
-
if (n.default === void 0) return Y;
|
|
655
|
-
try {
|
|
656
|
-
s = g(n.default);
|
|
657
|
-
} catch (e) {
|
|
658
|
-
return t.diagnostics?.push({
|
|
659
|
-
code: "CUSTOM_FN_ARG_DROP",
|
|
660
|
-
property: n.name,
|
|
661
|
-
message: `--fn() missing-positional default for ${n.name} failed to parse (${String(e)})`
|
|
662
|
-
}), Y;
|
|
663
|
-
}
|
|
664
|
-
} else s = Et(r, n, t.diagnostics);
|
|
665
|
-
if (s === Y) return Y;
|
|
666
|
-
o.set(n.name, s);
|
|
667
|
-
}
|
|
668
|
-
let s = r.result.clone().map((e) => Ot(e, o));
|
|
669
|
-
t.seen.add(e.name);
|
|
670
|
-
let c = [];
|
|
671
|
-
for (let e of s) {
|
|
672
|
-
let r = n(e, {
|
|
673
|
-
...t,
|
|
674
|
-
depth: t.depth + 1
|
|
675
|
-
});
|
|
676
|
-
r !== Y && c.push(r);
|
|
677
|
-
}
|
|
678
|
-
return t.seen.delete(e.name), c.length === 0 ? Y : c[0];
|
|
679
|
-
}, At = (e) => {
|
|
680
|
-
let t = e.indexOf("(");
|
|
681
|
-
if (t <= 0 || !e.trimEnd().endsWith(")")) return;
|
|
682
|
-
let n = e.slice(0, t).trim().toLowerCase(), r = e.slice(t + 1, e.lastIndexOf(")")).trim();
|
|
683
|
-
if (!(!n || !r)) return {
|
|
684
|
-
name: n,
|
|
685
|
-
query: r
|
|
686
|
-
};
|
|
687
|
-
}, jt = (e, t) => {
|
|
688
|
-
let n = String(e instanceof m ? e.value : e).trim();
|
|
689
|
-
if (n === "else" || n === "") return !0;
|
|
690
|
-
let r = At(n);
|
|
691
|
-
if (!r) return !1;
|
|
692
|
-
let { name: i, query: a } = r;
|
|
693
|
-
return i === "supports" ? t.env.supports?.(a) ?? !1 : i === "media" ? t.env.matchMedia?.(a)?.matches ?? !1 : i === "style" ? t.env.customProps === void 0 ? void 0 : Mt(a, t.env.customProps) : !1;
|
|
694
|
-
}, Mt = (e, t) => {
|
|
695
|
-
let n = e.indexOf(":");
|
|
696
|
-
if (n === -1) {
|
|
697
|
-
let n = e.trim();
|
|
698
|
-
return n === "" ? !1 : t(n) !== void 0;
|
|
699
|
-
}
|
|
700
|
-
let r = e.slice(0, n).trim(), i = e.slice(n + 1).trim();
|
|
701
|
-
if (r === "") return !1;
|
|
702
|
-
let a = t(r);
|
|
703
|
-
if (a === void 0) return !1;
|
|
704
|
-
let o = (e) => e.trim().replace(/\s+/g, " ");
|
|
705
|
-
return o(a) === o(i);
|
|
706
|
-
}, Nt = (e) => e instanceof m && String(e.value).trim() === "", Pt = (e) => {
|
|
707
|
-
if (e === Y) return e;
|
|
708
|
-
if (e instanceof m && e.unit === "string") try {
|
|
709
|
-
return g(String(e.value));
|
|
710
|
-
} catch {
|
|
711
|
-
return e;
|
|
712
|
-
}
|
|
713
|
-
return e;
|
|
714
|
-
}, Ft = (e, t, n) => {
|
|
715
|
-
let r = e.values, i = r[0], a = r[1], o = r[2];
|
|
716
|
-
if (i === void 0 || a === void 0) return Y;
|
|
717
|
-
let s = jt(i, t);
|
|
718
|
-
return s === void 0 ? e : s ? Pt(n(a, t)) : o !== void 0 && !Nt(o) ? Pt(n(o, t)) : Y;
|
|
719
|
-
}, It = (e) => {
|
|
720
|
-
if (e.name !== "if") return !1;
|
|
721
|
-
let t = e.values[0];
|
|
722
|
-
return t === void 0 ? !1 : At(String(t instanceof m ? t.value : t).trim())?.name === "style";
|
|
723
|
-
}, Lt = 32, X = (e, t) => {
|
|
724
|
-
if (t.depth > Lt) return Y;
|
|
725
|
-
if (e instanceof m || !(e instanceof f)) return e;
|
|
726
|
-
if (e.name === "if") return Ft(e, {
|
|
727
|
-
...t,
|
|
728
|
-
depth: t.depth + 1
|
|
729
|
-
}, X);
|
|
730
|
-
if (e.name === "sibling-index") {
|
|
731
|
-
let n = t.env.siblingIndex;
|
|
732
|
-
return n === void 0 ? e : new m(n(), "");
|
|
733
|
-
}
|
|
734
|
-
if (e.name === "sibling-count") {
|
|
735
|
-
let n = t.env.siblingCount;
|
|
736
|
-
return n === void 0 ? e : new m(n(), "");
|
|
737
|
-
}
|
|
738
|
-
if (e.name.startsWith("--") && t.functions.has(e.name)) return kt(e, t, X);
|
|
739
|
-
let n = [], r = !1;
|
|
740
|
-
for (let i of e.values) {
|
|
741
|
-
let e = X(i, {
|
|
742
|
-
...t,
|
|
743
|
-
depth: t.depth + 1
|
|
744
|
-
});
|
|
745
|
-
if (e === Y) {
|
|
746
|
-
r = !0;
|
|
747
|
-
continue;
|
|
748
|
-
}
|
|
749
|
-
e !== i && (r = !0), n.push(e);
|
|
750
|
-
}
|
|
751
|
-
return r ? new f(e.name, n) : e;
|
|
752
|
-
}, Z = (e, t) => {
|
|
753
|
-
let n = [], r = !1;
|
|
754
|
-
for (let i of e) {
|
|
755
|
-
let e = X(i, t);
|
|
756
|
-
if (e === Y) {
|
|
757
|
-
r = !0;
|
|
758
|
-
continue;
|
|
759
|
-
}
|
|
760
|
-
e !== i && (r = !0), n.push(e);
|
|
761
|
-
}
|
|
762
|
-
return n.length === 0 ? Y : r ? new p(...n) : e;
|
|
763
|
-
}, Q = (e) => e instanceof f ? e.name === "if" || e.name === "spring" || e.name === "sibling-index" || e.name === "sibling-count" || e.name.startsWith("--") ? !0 : e.values.some((e) => Q(e)) : e instanceof p ? e.some((e) => Q(e)) : !1, $ = (e) => e instanceof f ? e.name === "sibling-index" || e.name === "sibling-count" || It(e) ? !0 : e.values.some((e) => $(e)) : e instanceof p ? e.some((e) => $(e)) : !1;
|
|
764
|
-
//#endregion
|
|
765
|
-
//#region src/animation/resolve/element-resolve.ts
|
|
766
|
-
function Rt(e) {
|
|
767
|
-
let t = e.compiler.templateFrames, n = !1;
|
|
768
|
-
for (let e of t) {
|
|
769
|
-
let t = e.vars;
|
|
770
|
-
for (let e in t) if ($(t[e])) {
|
|
771
|
-
n = !0;
|
|
772
|
-
break;
|
|
773
|
-
}
|
|
774
|
-
if (n) break;
|
|
775
|
-
}
|
|
776
|
-
if (!n) return !1;
|
|
777
|
-
let r = Bt(e);
|
|
778
|
-
if (r === void 0) return !1;
|
|
779
|
-
let i = Tt(/* @__PURE__ */ new Map(), r), a = !1;
|
|
780
|
-
for (let e of t) {
|
|
781
|
-
let t = e.vars;
|
|
782
|
-
for (let e in t) {
|
|
783
|
-
let n = t[e];
|
|
784
|
-
if (!(n instanceof p) || !$(n)) continue;
|
|
785
|
-
let r = Z(n, i);
|
|
786
|
-
if (r === Y) {
|
|
787
|
-
delete t[e], a = !0;
|
|
788
|
-
continue;
|
|
789
|
-
}
|
|
790
|
-
r !== n && (t[e] = r, a = !0);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return a ? (e.parse(), !0) : !1;
|
|
794
|
-
}
|
|
795
|
-
function zt(e) {
|
|
796
|
-
if (!Rt(e)) for (let t of e.frames) for (let n of Object.values(t.interpVars)) for (let { start: t, stop: r, value: i } of n) t.setTargets(e.targets), r.setTargets(e.targets), i.setTargets(e.targets);
|
|
797
|
-
}
|
|
798
|
-
function Bt(e) {
|
|
799
|
-
let t = e.targets[0];
|
|
800
|
-
if (t == null) return;
|
|
801
|
-
let n = { customProps: (e) => {
|
|
802
|
-
let n = "";
|
|
803
|
-
return t instanceof Element && typeof getComputedStyle == "function" && (n = getComputedStyle(t).getPropertyValue(e).trim()), n === "" && (n = t.style.getPropertyValue(e).trim()), n === "" ? void 0 : n;
|
|
804
|
-
} }, r = t.parentElement;
|
|
805
|
-
return r != null && (n.siblingIndex = () => Array.prototype.indexOf.call(r.children, t) + 1, n.siblingCount = () => r.children.length), n;
|
|
806
|
-
}
|
|
807
|
-
//#endregion
|
|
808
|
-
//#region src/animation/internal/animation-id.ts
|
|
809
|
-
var Vt = (e) => typeof e == "string" ? e : e.name ?? String(e.id), Ht = 0, Ut = class {
|
|
810
|
-
id = Ht++;
|
|
811
|
-
name;
|
|
812
|
-
superKey;
|
|
813
|
-
targets;
|
|
814
|
-
options;
|
|
815
|
-
_compiler;
|
|
816
|
-
get compiler() {
|
|
817
|
-
return this._compiler;
|
|
818
|
-
}
|
|
819
|
-
playback = new r();
|
|
820
|
-
_playback;
|
|
821
|
-
get startTime() {
|
|
822
|
-
return this._playback.startTime;
|
|
823
|
-
}
|
|
824
|
-
set startTime(e) {
|
|
825
|
-
this._playback.startTime = e;
|
|
826
|
-
}
|
|
827
|
-
get pausedTime() {
|
|
828
|
-
return this._playback.pausedTime;
|
|
829
|
-
}
|
|
830
|
-
set pausedTime(e) {
|
|
831
|
-
this._playback.pausedTime = e;
|
|
832
|
-
}
|
|
833
|
-
get t() {
|
|
834
|
-
return this._playback.t;
|
|
835
|
-
}
|
|
836
|
-
set t(e) {
|
|
837
|
-
this._playback.t = e;
|
|
838
|
-
}
|
|
839
|
-
get iteration() {
|
|
840
|
-
return this._playback.iteration;
|
|
841
|
-
}
|
|
842
|
-
set iteration(e) {
|
|
843
|
-
this._playback.iteration = e;
|
|
844
|
-
}
|
|
845
|
-
get started() {
|
|
846
|
-
return this._playback.started;
|
|
847
|
-
}
|
|
848
|
-
set started(e) {
|
|
849
|
-
this._playback.started = e;
|
|
850
|
-
}
|
|
851
|
-
get done() {
|
|
852
|
-
return this._playback.done;
|
|
853
|
-
}
|
|
854
|
-
set done(e) {
|
|
855
|
-
this._playback.done = e;
|
|
856
|
-
}
|
|
857
|
-
get reversed() {
|
|
858
|
-
return this._playback.reversed;
|
|
859
|
-
}
|
|
860
|
-
set reversed(e) {
|
|
861
|
-
this._playback.reversed = e;
|
|
862
|
-
}
|
|
863
|
-
get paused() {
|
|
864
|
-
return this._playback.paused;
|
|
865
|
-
}
|
|
866
|
-
set paused(e) {
|
|
867
|
-
this._playback.paused = e;
|
|
868
|
-
}
|
|
869
|
-
diagnostics = [];
|
|
870
|
-
_compositionBase = /* @__PURE__ */ new Map();
|
|
871
|
-
_compositionFallbackSeen = /* @__PURE__ */ new Set();
|
|
872
|
-
_hasComposition = !1;
|
|
873
|
-
managed = !1;
|
|
874
|
-
waapiIneligibleReason = void 0;
|
|
875
|
-
unflatten = !0;
|
|
876
|
-
_stableKeys = [];
|
|
877
|
-
_ctorOptions = {};
|
|
878
|
-
get flatKeys() {
|
|
879
|
-
return this._stableKeys;
|
|
880
|
-
}
|
|
881
|
-
_defaultTransform = (e) => s(e, this.targets);
|
|
882
|
-
usesDefaultRenderer(e) {
|
|
883
|
-
return e === this._defaultTransform;
|
|
884
|
-
}
|
|
885
|
-
dispatchAnimationEvent(e) {
|
|
886
|
-
Ne(this, e);
|
|
887
|
-
}
|
|
888
|
-
constructor(e, t, n, r) {
|
|
889
|
-
this.options = {}, this._compiler = new Me(this.options), this._playback = new qe(this._frame.bind(this)), this._ctorOptions = e ?? {}, this.setOptions({
|
|
890
|
-
...S,
|
|
891
|
-
...this._ctorOptions
|
|
892
|
-
}), this.targets = t == null ? [] : Array.isArray(t) ? t : [t], this.name = n, this.superKey = r;
|
|
893
|
-
}
|
|
894
|
-
get templateFrames() {
|
|
895
|
-
return this.compiler.templateFrames;
|
|
896
|
-
}
|
|
897
|
-
set templateFrames(e) {
|
|
898
|
-
this.compiler.templateFrames = e;
|
|
899
|
-
}
|
|
900
|
-
get parsedVars() {
|
|
901
|
-
return this.compiler.parsedVars;
|
|
902
|
-
}
|
|
903
|
-
get frames() {
|
|
904
|
-
return this.compiler.frames;
|
|
905
|
-
}
|
|
906
|
-
get frameId() {
|
|
907
|
-
return this.compiler.frameId;
|
|
908
|
-
}
|
|
909
|
-
addFrame(e, t, n, r, i) {
|
|
910
|
-
return this.compiler.addFrame(e, t, n, r, i), this;
|
|
911
|
-
}
|
|
912
|
-
parse() {
|
|
913
|
-
return bt(this), this;
|
|
914
|
-
}
|
|
915
|
-
adoptCompiled(e) {
|
|
916
|
-
return Ct(this, e), this;
|
|
917
|
-
}
|
|
918
|
-
_setCompiler(e) {
|
|
919
|
-
this._compiler = e;
|
|
920
|
-
}
|
|
921
|
-
setTimingFunction(e) {
|
|
922
|
-
return U(this, e), this;
|
|
923
|
-
}
|
|
924
|
-
setIterationCount(e) {
|
|
925
|
-
return W(this, e), this;
|
|
926
|
-
}
|
|
927
|
-
setDuration(e) {
|
|
928
|
-
return mt(this, e), this;
|
|
929
|
-
}
|
|
930
|
-
setDelay(e) {
|
|
931
|
-
return G(this, e), this;
|
|
932
|
-
}
|
|
933
|
-
setDirection(e) {
|
|
934
|
-
return K(this, e), this;
|
|
935
|
-
}
|
|
936
|
-
setFillMode(e) {
|
|
937
|
-
return q(this, e), this;
|
|
938
|
-
}
|
|
939
|
-
setUseWAAPI(e) {
|
|
940
|
-
return J(this, e), this;
|
|
941
|
-
}
|
|
942
|
-
setRespectReducedMotion(e) {
|
|
943
|
-
return ht(this, e), this;
|
|
944
|
-
}
|
|
945
|
-
setColorSpace(e) {
|
|
946
|
-
return gt(this, e), this;
|
|
947
|
-
}
|
|
948
|
-
setHueMethod(e) {
|
|
949
|
-
return _t(this, e), this;
|
|
950
|
-
}
|
|
951
|
-
setComposite(e) {
|
|
952
|
-
return vt(this, e), this;
|
|
953
|
-
}
|
|
954
|
-
setOptions(e) {
|
|
955
|
-
return yt(this, e), this;
|
|
956
|
-
}
|
|
957
|
-
reverse() {
|
|
958
|
-
return T(this), this;
|
|
959
|
-
}
|
|
960
|
-
fillForwards() {
|
|
961
|
-
this.interpFrames(this.options.duration, !0);
|
|
962
|
-
}
|
|
963
|
-
fillBackwards() {
|
|
964
|
-
this.interpFrames(0, !0);
|
|
965
|
-
}
|
|
966
|
-
get restPosition() {
|
|
967
|
-
return L(this);
|
|
968
|
-
}
|
|
969
|
-
paintRest() {
|
|
970
|
-
nt(this);
|
|
971
|
-
}
|
|
972
|
-
assertNoUnresolvedNamedSelector() {
|
|
973
|
-
R(this);
|
|
974
|
-
}
|
|
975
|
-
at(e, t = !1) {
|
|
976
|
-
return rt(this, e, t);
|
|
977
|
-
}
|
|
978
|
-
interpFrames(e, t = !1, n) {
|
|
979
|
-
return z(this, e, t, n);
|
|
980
|
-
}
|
|
981
|
-
onStart() {
|
|
982
|
-
return E(this);
|
|
983
|
-
}
|
|
984
|
-
onEnd() {
|
|
985
|
-
D(this);
|
|
986
|
-
}
|
|
987
|
-
advanceTo(e) {
|
|
988
|
-
return Fe(this, e);
|
|
989
|
-
}
|
|
990
|
-
_frame(e) {
|
|
991
|
-
return Ie(this, e);
|
|
992
|
-
}
|
|
993
|
-
get finished() {
|
|
994
|
-
return this._playback._playingPromise ?? Promise.resolve();
|
|
995
|
-
}
|
|
996
|
-
async play() {
|
|
997
|
-
return Be(this);
|
|
998
|
-
}
|
|
999
|
-
pause() {
|
|
1000
|
-
return Ve(this), this;
|
|
1001
|
-
}
|
|
1002
|
-
resume() {
|
|
1003
|
-
return He(this), this;
|
|
1004
|
-
}
|
|
1005
|
-
toggle() {
|
|
1006
|
-
return this.paused ? this.resume() : this.pause();
|
|
1007
|
-
}
|
|
1008
|
-
stop() {
|
|
1009
|
-
Ue(this);
|
|
1010
|
-
}
|
|
1011
|
-
playing() {
|
|
1012
|
-
return We(this);
|
|
1013
|
-
}
|
|
1014
|
-
get effectiveT() {
|
|
1015
|
-
return Ge(this);
|
|
1016
|
-
}
|
|
1017
|
-
settle() {
|
|
1018
|
-
return N(this), this;
|
|
1019
|
-
}
|
|
1020
|
-
reset() {
|
|
1021
|
-
return Ke(this), this;
|
|
1022
|
-
}
|
|
1023
|
-
setTargets(...e) {
|
|
1024
|
-
return this.targets = e, zt(this), this;
|
|
1025
|
-
}
|
|
1026
|
-
}, Wt = (e, t) => {
|
|
1027
|
-
let n = {};
|
|
1028
|
-
for (let r of e.declarations) {
|
|
1029
|
-
let e = r.value;
|
|
1030
|
-
if (e instanceof p && Q(e)) {
|
|
1031
|
-
let n = Z(e, t);
|
|
1032
|
-
if (n === Y) continue;
|
|
1033
|
-
e = n;
|
|
1034
|
-
}
|
|
1035
|
-
n[r.name] = e;
|
|
1036
|
-
}
|
|
1037
|
-
return n;
|
|
1038
|
-
}, Gt = (e) => {
|
|
1039
|
-
let t = [];
|
|
1040
|
-
for (let n of e.selectors) n.kind === "percent" ? t.push(`${n.value}%`) : t.push(n.name);
|
|
1041
|
-
return t;
|
|
1042
|
-
}, Kt = (e) => {
|
|
1043
|
-
let t = se(e);
|
|
1044
|
-
for (let e of t.values()) if (e.length > 0) return e;
|
|
1045
|
-
return [];
|
|
1046
|
-
}, qt = (e, t) => {
|
|
1047
|
-
let n = [], r = (e, t) => {
|
|
1048
|
-
n.push({
|
|
1049
|
-
code: e,
|
|
1050
|
-
message: t.message ?? e,
|
|
1051
|
-
...t
|
|
1052
|
-
});
|
|
1053
|
-
}, i = typeof e == "string" ? h(e) : e, a = Kt(i);
|
|
1054
|
-
typeof e == "string" && a.length === 0 && e.trim() && (i = h(`@keyframes anonymous {\n${e.trim()}\n}`), a = Kt(i)), typeof e == "string" && a.length === 0 && e.trim() && r("EMPTY_PARSE", {
|
|
1055
|
-
message: "the input is non-empty but parsed to zero @keyframes rules (no animatable stops) — the resulting animation has no frames",
|
|
1056
|
-
input: e
|
|
1057
|
-
});
|
|
1058
|
-
let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = oe(i), u = Tt(l, t, n);
|
|
1059
|
-
for (let e of a) {
|
|
1060
|
-
let t = Wt(e, u);
|
|
1061
|
-
for (let n of Gt(e)) {
|
|
1062
|
-
let r = o.get(n);
|
|
1063
|
-
o.set(n, {
|
|
1064
|
-
...r ?? {},
|
|
1065
|
-
...t
|
|
1066
|
-
}), e.timingFunction != null && s.set(n, e.timingFunction);
|
|
1067
|
-
let i = e.composition;
|
|
1068
|
-
i != null && c.set(n, i);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
return {
|
|
1072
|
-
keyframes: o,
|
|
1073
|
-
timingFunctions: s,
|
|
1074
|
-
composition: c,
|
|
1075
|
-
properties: ce(i),
|
|
1076
|
-
functions: l,
|
|
1077
|
-
options: ae(i),
|
|
1078
|
-
diagnostics: n,
|
|
1079
|
-
stylesheet: i
|
|
1080
|
-
};
|
|
1081
|
-
};
|
|
1082
|
-
//#endregion
|
|
1083
|
-
//#region src/animation/engine/css/metadata.ts
|
|
1084
|
-
function Jt(e) {
|
|
1085
|
-
let t = {};
|
|
1086
|
-
return e.duration != null && (t.duration = e.duration), e.timingFunction != null && (t.timingFunction = e.timingFunction), e.iterationCount !== void 0 && (t.iterationCount = e.iterationCount === null ? Infinity : e.iterationCount), e.direction != null && (t.direction = e.direction), e.delay != null && (t.delay = e.delay), e.fillMode != null && (t.fillMode = e.fillMode), e.composition != null && (t.composite = e.composition), t;
|
|
1087
|
-
}
|
|
1088
|
-
function Yt(e) {
|
|
1089
|
-
let t = le(e);
|
|
1090
|
-
return Object.keys(t).length > 0 ? t : void 0;
|
|
1091
|
-
}
|
|
1092
|
-
function Xt(e, t) {
|
|
1093
|
-
if (!(typeof CSS > "u" || typeof CSS.registerProperty != "function")) for (let [n, r] of e) {
|
|
1094
|
-
if (r.syntax == null) continue;
|
|
1095
|
-
let e = {
|
|
1096
|
-
name: n,
|
|
1097
|
-
syntax: r.syntax,
|
|
1098
|
-
inherits: r.inherits ?? !1
|
|
1099
|
-
};
|
|
1100
|
-
r.initialValue != null && (e.initialValue = r.initialValue.toString());
|
|
1101
|
-
try {
|
|
1102
|
-
CSS.registerProperty(e);
|
|
1103
|
-
} catch (e) {
|
|
1104
|
-
if (e instanceof DOMException && e.name === "InvalidModificationError") continue;
|
|
1105
|
-
t.push({
|
|
1106
|
-
code: "PROPERTY_REGISTER_REJECTED",
|
|
1107
|
-
property: n,
|
|
1108
|
-
message: `CSS.registerProperty refused @property ${n}: ${String(e)}`
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
//#endregion
|
|
1114
|
-
//#region src/animation/engine/css/css-animation.ts
|
|
1115
|
-
var Zt = (e) => typeof e != "object" || !e ? !1 : typeof e.clone == "function", Qt = class extends Ut {
|
|
1116
|
-
_boundTimeline;
|
|
1117
|
-
constructor(e, ...t) {
|
|
1118
|
-
super(e, t), this.unflatten = !1;
|
|
1119
|
-
}
|
|
1120
|
-
bindTimeline(e) {
|
|
1121
|
-
this._boundTimeline = e;
|
|
1122
|
-
let t = !1;
|
|
1123
|
-
for (let e of this.compiler.templateFrames) e.start.superType?.includes("named-selector") && (e.start = new m(Ee(String(e.start.value)) * 100, "%"), t = !0);
|
|
1124
|
-
return t && this.compiler.frames.length > 0 && this.parse(), this;
|
|
1125
|
-
}
|
|
1126
|
-
resolveTransform(e) {
|
|
1127
|
-
return this.unflatten = e != null, e ?? this._defaultTransform;
|
|
1128
|
-
}
|
|
1129
|
-
fromVars(e, t) {
|
|
1130
|
-
t = this.resolveTransform(t);
|
|
1131
|
-
for (let n = 0; n < e.length; n++) {
|
|
1132
|
-
let r = e[n], i = Math.round(n / (e.length - 1) * 100);
|
|
1133
|
-
this.addFrame(i, r, t);
|
|
1134
|
-
}
|
|
1135
|
-
return this.parse(), this;
|
|
1136
|
-
}
|
|
1137
|
-
fromKeyframes(e, t) {
|
|
1138
|
-
t = this.resolveTransform(t), de(e) && (e = new Map(Object.entries(e)));
|
|
1139
|
-
let n = e instanceof Map ? e.entries() : Object.entries(e);
|
|
1140
|
-
for (let [e, r] of n) this.addFrame(e, r, t);
|
|
1141
|
-
return this.parse(), this;
|
|
1142
|
-
}
|
|
1143
|
-
propertyRegistry = /* @__PURE__ */ new Map();
|
|
1144
|
-
scrollOptions;
|
|
1145
|
-
fromString(e, n) {
|
|
1146
|
-
n = this.resolveTransform(n);
|
|
1147
|
-
let r = qt(e);
|
|
1148
|
-
this.propertyRegistry = r.properties;
|
|
1149
|
-
let i = Yt(r.stylesheet);
|
|
1150
|
-
i === void 0 ? delete this.scrollOptions : this.scrollOptions = i, this.diagnostics = [...r.diagnostics];
|
|
1151
|
-
let a = Jt(r.options);
|
|
1152
|
-
Object.keys(a).length > 0 && this.setOptions({
|
|
1153
|
-
...a,
|
|
1154
|
-
...this._ctorOptions
|
|
1155
|
-
});
|
|
1156
|
-
for (let [e, i] of r.keyframes.entries()) {
|
|
1157
|
-
let a = Object.fromEntries(Object.entries(i).map(([e, t]) => [e, Zt(t) ? t.clone() : t])), o = r.timingFunctions.get(e), s = o ? d(o) : void 0, c;
|
|
1158
|
-
if (s) {
|
|
1159
|
-
let e = o ? t(o) : void 0;
|
|
1160
|
-
c = e ? {
|
|
1161
|
-
fn: s,
|
|
1162
|
-
css: e
|
|
1163
|
-
} : { fn: s };
|
|
1164
|
-
}
|
|
1165
|
-
let l = r.composition.get(e);
|
|
1166
|
-
this.addFrame(e, a, n, c, l);
|
|
1167
|
-
}
|
|
1168
|
-
return this.parse(), Xt(this.propertyRegistry, this.diagnostics), this;
|
|
1169
|
-
}
|
|
1170
|
-
};
|
|
1171
|
-
//#endregion
|
|
1172
|
-
export { F as a, w as c, _ as d, v as f, S as h, Vt as i, C as l, be as m, qt as n, I as o, x as p, Ut as r, Me as s, Qt as t, Ee as u };
|