@mkbabb/keyframes.js 5.0.0 → 5.2.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 +112 -217
- package/dist/backward-color-BtbRcnna.js +108 -0
- package/dist/compile-BHCTPerD.js +30 -0
- package/dist/{waapi-D0ssxKy1.js → delegation-BQYCrP2p.js} +117 -99
- package/dist/{draw-svg-Dat9mHgi.js → draw-svg-CK9Qrly8.js} +18 -26
- package/dist/easing-registry-DHV2-5gA.js +27 -0
- package/dist/easing-registry-y1p9McFy.js +2 -0
- package/dist/easing-serialize-D4LZCB6i.js +21 -0
- package/dist/engine/index.d.ts +3139 -0
- package/dist/engine/index.js +16 -0
- package/dist/engine-CPK_udUQ.js +1172 -0
- package/dist/engine-DlpimZtM.js +3 -0
- package/dist/entry-D82NKUhP.js +148 -0
- package/dist/format-BdIvdLzG.js +114 -0
- package/dist/group-HM7N4uOE.js +390 -0
- package/dist/handle-D4xrf_ya.js +21 -0
- package/dist/{ingest-CU-kdYcM.js → ingest-_g6tfk2e.js} +62 -56
- package/dist/keyframes.d.ts +1156 -1099
- package/dist/keyframes.js +412 -132
- package/dist/morph-svg-KUrH9KnK.js +79 -0
- package/dist/motion-path-wM5tPfrY.js +26 -0
- package/dist/parse-flatten-DRMHFytp.js +2 -0
- package/dist/parse-flatten-ZZUSEQEL.js +63 -0
- package/dist/presets-DeDJYL4G.js +275 -0
- package/dist/{scheduler-7eIr_q1g.js → scheduler-CfGIC3GX.js} +1 -1
- package/dist/scroll-BEyCx0b_.js +287 -0
- package/dist/sequence-s0bL7Uul.js +736 -0
- package/dist/{validate-B1pE-Y_T.js → validate-xFZ_Ld1k.js} +17 -13
- package/dist/view-transition-BPJQxUTC.js +305 -0
- package/package.json +123 -84
- package/dist/animate-CTWr6K7j.js +0 -26
- package/dist/animations-CZxf0rep.js +0 -224
- package/dist/compile-YRJRdpKF.js +0 -251
- package/dist/decay-BvNmFk51.js +0 -25
- package/dist/engine-DQcb7CLW.js +0 -1349
- package/dist/errors-W8zkvPw4.js +0 -21
- package/dist/format-BUgCTjmr.js +0 -123
- package/dist/morph-svg-83uyYxoW.js +0 -84
- package/dist/motion-path-C0OHqcA3.js +0 -31
- package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
- package/dist/scroll-grammar-B4kPvGh5.js +0 -23
- package/dist/scroll-scene-DQxhxn9I.js +0 -176
- package/dist/sequence-cBr7thU8.js +0 -198
- package/dist/springTimingFunction-D26gPkAy.js +0 -63
- package/dist/timeline-vY3eD3Ax.js +0 -430
- package/dist/utils-BPRImVl5.js +0 -100
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { n as e } from "./presets-DeDJYL4G.js";
|
|
2
|
+
import { t } from "./engine-CPK_udUQ.js";
|
|
3
|
+
//#region src/animation/ingest/cssom.ts
|
|
4
|
+
var n = (e, t, n, r = {}) => {
|
|
4
5
|
e.push({
|
|
5
6
|
code: t,
|
|
6
7
|
message: n,
|
|
7
8
|
...r
|
|
8
9
|
});
|
|
9
|
-
},
|
|
10
|
+
}, r = (e) => {
|
|
10
11
|
if (typeof CSSKeyframesRule < "u" && e instanceof CSSKeyframesRule) return !0;
|
|
11
12
|
let t = e;
|
|
12
13
|
return t.type === 7 && typeof t.name == "string" && typeof t.cssText == "string";
|
|
13
|
-
},
|
|
14
|
+
}, i = 32, a = (e) => e.cssRules !== void 0 && !r(e), o = (e, t, n, c = 0) => {
|
|
14
15
|
let l = [];
|
|
15
16
|
for (let t = 0; t < e.length; t++) {
|
|
16
17
|
let n = e[t];
|
|
@@ -18,59 +19,59 @@ var t = (e, t, n, r = {}) => {
|
|
|
18
19
|
let r = n;
|
|
19
20
|
r.type === 1 && typeof r.cssText == "string" && l.push(r.cssText);
|
|
20
21
|
}
|
|
21
|
-
for (let
|
|
22
|
-
let
|
|
23
|
-
if (
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
let c = RegExp(`\\banimation(?:-name)?\\s*:[^;}]*\\b${
|
|
27
|
-
f != null && t.set(
|
|
28
|
-
name:
|
|
22
|
+
for (let i = 0; i < e.length; i++) {
|
|
23
|
+
let a = e[i];
|
|
24
|
+
if (a == null || !r(a)) continue;
|
|
25
|
+
let o = a.name;
|
|
26
|
+
if (n.animationName != null && o !== n.animationName) continue;
|
|
27
|
+
let c = RegExp(`\\banimation(?:-name)?\\s*:[^;}]*\\b${o}\\b`), u = l.find((e) => c.test(e)), d = [], f = s(a.cssText, u, n.options, d);
|
|
28
|
+
f != null && t.set(o, {
|
|
29
|
+
name: o,
|
|
29
30
|
animation: f,
|
|
30
31
|
diagnostics: d
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
if (c <
|
|
34
|
-
let
|
|
35
|
-
|
|
34
|
+
if (c < i) for (let r = 0; r < e.length; r++) {
|
|
35
|
+
let i = e[r];
|
|
36
|
+
i == null || !a(i) || o(i.cssRules, t, n, c + 1);
|
|
36
37
|
}
|
|
37
|
-
},
|
|
38
|
+
}, s = (e, r, i, a) => {
|
|
38
39
|
try {
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
for (let e of
|
|
42
|
-
return
|
|
43
|
-
} catch (
|
|
44
|
-
|
|
40
|
+
let n = new t(i ?? {}), o = r ? `${r}\n${e}` : e;
|
|
41
|
+
n.fromString(o);
|
|
42
|
+
for (let e of n.diagnostics) a.push(e);
|
|
43
|
+
return n;
|
|
44
|
+
} catch (t) {
|
|
45
|
+
n(a, "PARSE_ERROR", `@keyframes rule could not be reconstructed: ${t instanceof Error ? t.message : String(t)} — the source CSS could not be parsed faithfully (refused, not approximated)`, { input: e });
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
},
|
|
48
|
-
let r = /* @__PURE__ */ new Map(), i = [],
|
|
48
|
+
}, c = (e, t = {}) => {
|
|
49
|
+
let r = /* @__PURE__ */ new Map(), i = [], a;
|
|
49
50
|
if (e == null) {
|
|
50
|
-
if (typeof document > "u") return
|
|
51
|
+
if (typeof document > "u") return n(i, "CORS_SKIP", "no document in scope — resolveLiveKeyframes() needs a Document, a ShadowRoot, a CSSStyleSheet[], or a CSSStyleSheet (SSR has no live CSSOM)"), {
|
|
51
52
|
animations: r,
|
|
52
53
|
diagnostics: i
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
-
} else
|
|
56
|
-
for (let e of
|
|
57
|
-
let
|
|
55
|
+
a = Array.from(document.styleSheets);
|
|
56
|
+
} else a = Array.isArray(e) ? e : typeof Document < "u" && e instanceof Document ? Array.from(e.styleSheets) : typeof ShadowRoot < "u" && e instanceof ShadowRoot ? [...e.styleSheets == null ? [] : Array.from(e.styleSheets), ...e.adoptedStyleSheets ?? []] : [e];
|
|
57
|
+
for (let e of a) {
|
|
58
|
+
let a = null;
|
|
58
59
|
try {
|
|
59
|
-
|
|
60
|
-
} catch (
|
|
60
|
+
a = e.cssRules;
|
|
61
|
+
} catch (t) {
|
|
61
62
|
let r = e.href ?? "(inline)";
|
|
62
|
-
|
|
63
|
+
n(i, "CORS_SKIP", `cross-origin stylesheet skipped: ${r} — its cssRules threw ${t instanceof Error ? t.name : "an error"} (no Access-Control-Allow-Origin + crossorigin). The sheet is REPORTED, not silently dropped.`, { input: r });
|
|
63
64
|
continue;
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
a != null && o(a, r, t);
|
|
66
67
|
}
|
|
67
68
|
return {
|
|
68
69
|
animations: r,
|
|
69
70
|
diagnostics: i
|
|
70
71
|
};
|
|
71
|
-
},
|
|
72
|
+
}, l = (e, t = {}) => c(e, t), u = (e, t = {}) => {
|
|
72
73
|
let r = /* @__PURE__ */ new Map(), i = [], a = e ?? (typeof document < "u" ? document : void 0);
|
|
73
|
-
if (a == null || typeof a.getAnimations != "function") return
|
|
74
|
+
if (a == null || typeof a.getAnimations != "function") return n(i, "CORS_SKIP", "no getAnimations() in scope — fromLiveAnimations() needs a Document or Element with the Web Animations API (SSR has none)"), {
|
|
74
75
|
animations: r,
|
|
75
76
|
diagnostics: i
|
|
76
77
|
};
|
|
@@ -79,24 +80,24 @@ var t = (e, t, n, r = {}) => {
|
|
|
79
80
|
let t = e.animationName;
|
|
80
81
|
typeof t == "string" && t.length > 0 && o.add(t);
|
|
81
82
|
}
|
|
82
|
-
let
|
|
83
|
+
let s = (a instanceof Document ? a : a.ownerDocument ?? (typeof document < "u" ? document : void 0)) ?? void 0;
|
|
83
84
|
for (let e of o) {
|
|
84
|
-
let
|
|
85
|
-
...
|
|
85
|
+
let n = c(s, {
|
|
86
|
+
...t,
|
|
86
87
|
animationName: e
|
|
87
88
|
});
|
|
88
|
-
for (let [e,
|
|
89
|
-
for (let e of
|
|
89
|
+
for (let [e, t] of n.animations) r.set(e, t);
|
|
90
|
+
for (let e of n.diagnostics) i.push(e);
|
|
90
91
|
}
|
|
91
92
|
return {
|
|
92
93
|
animations: r,
|
|
93
94
|
diagnostics: i
|
|
94
95
|
};
|
|
95
|
-
},
|
|
96
|
+
}, d = (e) => {
|
|
96
97
|
if (typeof e != "object" || !e) return !1;
|
|
97
98
|
let t = e;
|
|
98
99
|
return typeof t.value == "number" && typeof t.unit == "string";
|
|
99
|
-
},
|
|
100
|
+
}, f = async (e, t) => {
|
|
100
101
|
let n = [], { animationName: r, commit: i = !0 } = t;
|
|
101
102
|
if (typeof e.getAnimations != "function") return n.push({
|
|
102
103
|
code: "WAAPI_INELIGIBLE",
|
|
@@ -115,9 +116,9 @@ var t = (e, t, n, r = {}) => {
|
|
|
115
116
|
currentTime: 0,
|
|
116
117
|
diagnostics: n
|
|
117
118
|
};
|
|
118
|
-
let o = a.currentTime,
|
|
119
|
+
let o = a.currentTime, s = null, l = 0;
|
|
119
120
|
if (typeof o == "number" && Number.isFinite(o)) l = o;
|
|
120
|
-
else if (
|
|
121
|
+
else if (d(o)) if (o.unit === "percent" && Number.isFinite(o.value)) s = o.value / 100;
|
|
121
122
|
else return n.push({
|
|
122
123
|
code: "ADOPT_REFUSE",
|
|
123
124
|
message: `the running animation "${r}" reports a currentTime in an unsupported unit "${String(o.unit)}" — adoptRunning() refuses (only a numeric ms playhead or a scroll-driven "percent" CSSUnitValue can seed the takeover faithfully)`
|
|
@@ -126,13 +127,13 @@ var t = (e, t, n, r = {}) => {
|
|
|
126
127
|
currentTime: 0,
|
|
127
128
|
diagnostics: n
|
|
128
129
|
};
|
|
129
|
-
let
|
|
130
|
+
let u = c(e.ownerDocument ?? (typeof document < "u" ? document : void 0) ?? void 0, {
|
|
130
131
|
...t,
|
|
131
132
|
animationName: r
|
|
132
133
|
});
|
|
133
|
-
for (let e of
|
|
134
|
-
let
|
|
135
|
-
if (
|
|
134
|
+
for (let e of u.diagnostics) n.push(e);
|
|
135
|
+
let f = u.animations.get(r);
|
|
136
|
+
if (f == null) return n.push({
|
|
136
137
|
code: "ADOPT_REFUSE",
|
|
137
138
|
message: `the @keyframes rule for "${r}" could not be found or reconstructed from the CSSOM — adoptRunning() refuses rather than reconstruct from the lossy computed keyframe list`
|
|
138
139
|
}), {
|
|
@@ -140,21 +141,26 @@ var t = (e, t, n, r = {}) => {
|
|
|
140
141
|
currentTime: l,
|
|
141
142
|
diagnostics: n
|
|
142
143
|
};
|
|
143
|
-
let m =
|
|
144
|
-
for (let e of
|
|
144
|
+
let m = f.animation;
|
|
145
|
+
for (let e of f.diagnostics) n.push(e);
|
|
145
146
|
m.setTargets(e);
|
|
146
|
-
let h =
|
|
147
|
+
let h = s == null ? l : s * m.options.duration;
|
|
147
148
|
i && m.interpFrames(h, !0);
|
|
148
149
|
try {
|
|
149
150
|
a.cancel();
|
|
150
151
|
} catch {}
|
|
151
|
-
return
|
|
152
|
+
return p(m, h), {
|
|
152
153
|
animation: m,
|
|
153
154
|
currentTime: h,
|
|
154
155
|
diagnostics: n
|
|
155
156
|
};
|
|
156
|
-
},
|
|
157
|
+
}, p = (e, t) => {
|
|
157
158
|
e.setUseWAAPI(!1), e.setDelay(0), e.onStart(), e.started = !0, e.startTime = (typeof performance < "u" && performance.now ? performance.now() : Date.now()) - t, e.t = t, e.play();
|
|
158
|
-
}
|
|
159
|
+
}, m = /* @__PURE__ */ e({
|
|
160
|
+
adoptRunning: () => f,
|
|
161
|
+
fromLiveAnimations: () => u,
|
|
162
|
+
fromStyleSheets: () => l,
|
|
163
|
+
resolveLiveKeyframes: () => c
|
|
164
|
+
});
|
|
159
165
|
//#endregion
|
|
160
|
-
export {
|
|
166
|
+
export { c as a, l as i, f as n, u as r, m as t };
|