@mkbabb/keyframes.js 5.1.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 +98 -8
- 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 +570 -323
- package/dist/engine/index.js +3710 -17
- package/dist/keyframes.d.ts +1043 -454
- package/dist/keyframes.js +277 -107
- package/dist/{sequence-C_DCiOIQ.js → sequence-CES7o7hs.js} +258 -182
- package/package.json +104 -100
- package/dist/animation-BGyzfzBq.js +0 -947
- package/dist/compile-CcSUwM8R.js +0 -276
- package/dist/delegation-DWwr4IXr.js +0 -263
- package/dist/draw-svg-GURj9nin.js +0 -45
- package/dist/easing-registry-y1p9McFy.js +0 -2
- package/dist/engine-DEVgCTUy.js +0 -156
- package/dist/engine-DrBtsKaf.js +0 -4
- package/dist/format-C-Gi9r7L.js +0 -123
- package/dist/grammar-BLucehC4.js +0 -23
- package/dist/group-vJcsHKN9.js +0 -360
- package/dist/ingest-S5hUe20K.js +0 -166
- package/dist/morph-svg-BToeumw5.js +0 -89
- package/dist/motion-path-pQVbamWT.js +0 -35
- package/dist/parse-flatten-DRMHFytp.js +0 -2
- package/dist/parse-flatten-ZZUSEQEL.js +0 -63
- package/dist/presets-BG2Fczzq.js +0 -275
- package/dist/scheduler-CUtVnuoU.js +0 -14
- package/dist/scroll-CxpYFO4u.js +0 -180
- package/dist/validate-DDeGnvSt.js +0 -39
package/dist/scroll-CxpYFO4u.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./presets-BG2Fczzq.js";
|
|
2
|
-
import { c as t, f as n, i as r, r as i, s as a } from "./sequence-C_DCiOIQ.js";
|
|
3
|
-
import { i as o, r as s, t as c } from "./delegation-DWwr4IXr.js";
|
|
4
|
-
import { a as l, i as u, n as d, r as f, t as p } from "./grammar-BLucehC4.js";
|
|
5
|
-
//#region src/animation/scroll/range.ts
|
|
6
|
-
var m = {
|
|
7
|
-
entry: o.entry,
|
|
8
|
-
cover: o.cover,
|
|
9
|
-
contain: o.contain,
|
|
10
|
-
exit: o.exit,
|
|
11
|
-
normal: {
|
|
12
|
-
start: 0,
|
|
13
|
-
end: 1
|
|
14
|
-
},
|
|
15
|
-
"entry-crossing": {
|
|
16
|
-
start: 0,
|
|
17
|
-
end: .25
|
|
18
|
-
},
|
|
19
|
-
"exit-crossing": {
|
|
20
|
-
start: .75,
|
|
21
|
-
end: 1
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function h(e) {
|
|
25
|
-
if (e == null) return null;
|
|
26
|
-
let t = e.trim();
|
|
27
|
-
if (t.endsWith("%")) {
|
|
28
|
-
let e = Number.parseFloat(t.slice(0, -1));
|
|
29
|
-
return Number.isFinite(e) ? e / 100 : null;
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
function g(e, t) {
|
|
34
|
-
if (e == null) return t;
|
|
35
|
-
let n = h(e.offset);
|
|
36
|
-
if (n != null) {
|
|
37
|
-
if (e.phase != null && e.phase !== "normal") {
|
|
38
|
-
let t = m[e.phase];
|
|
39
|
-
return t.start + n * (t.end - t.start);
|
|
40
|
-
}
|
|
41
|
-
return n;
|
|
42
|
-
}
|
|
43
|
-
return e.phase == null ? t : m[e.phase].start;
|
|
44
|
-
}
|
|
45
|
-
function _(e) {
|
|
46
|
-
if (e == null) return {
|
|
47
|
-
start: 0,
|
|
48
|
-
end: 1
|
|
49
|
-
};
|
|
50
|
-
let t = g(e.start, 0), n = g(e.end, 1);
|
|
51
|
-
return n > t ? {
|
|
52
|
-
start: t,
|
|
53
|
-
end: n
|
|
54
|
-
} : {
|
|
55
|
-
start: 0,
|
|
56
|
-
end: 1
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/animation/scroll/scene.ts
|
|
61
|
-
function v(e) {
|
|
62
|
-
let { animation: t, nativeSpec: n, scrub: i, snap: a, velocity: o } = e;
|
|
63
|
-
if (i) return {
|
|
64
|
-
backend: "js",
|
|
65
|
-
reason: "scrub smoothing requested (native scroll has no SmoothProgress smoother)"
|
|
66
|
-
};
|
|
67
|
-
if (a) return {
|
|
68
|
-
backend: "js",
|
|
69
|
-
reason: "physics snap requested (native scroll has no decay/spring settle)"
|
|
70
|
-
};
|
|
71
|
-
if (o) return {
|
|
72
|
-
backend: "js",
|
|
73
|
-
reason: "scroll velocity / non-DOM driving requested (JS-only capability)"
|
|
74
|
-
};
|
|
75
|
-
if (t == null || n == null) return {
|
|
76
|
-
backend: "js",
|
|
77
|
-
reason: "non-DOM target or no native timeline spec (the universal JS driver)"
|
|
78
|
-
};
|
|
79
|
-
let l = s(t);
|
|
80
|
-
if (!l.eligible) return {
|
|
81
|
-
backend: "js",
|
|
82
|
-
reason: l.reason
|
|
83
|
-
};
|
|
84
|
-
if (r(n) == null) return {
|
|
85
|
-
backend: "js",
|
|
86
|
-
reason: "native scroll/view timeline unavailable (feature absent)"
|
|
87
|
-
};
|
|
88
|
-
let u = c(t, n);
|
|
89
|
-
return u.attached ? {
|
|
90
|
-
backend: "native",
|
|
91
|
-
attachment: u
|
|
92
|
-
} : {
|
|
93
|
-
backend: "js",
|
|
94
|
-
reason: u.reason
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function y(e) {
|
|
98
|
-
let t = ["position: sticky;"];
|
|
99
|
-
return e?.bottom == null ? t.push(`top: ${e?.top ?? 0}px;`) : t.push(`bottom: ${e.bottom}px;`), t.join(" ");
|
|
100
|
-
}
|
|
101
|
-
var b = class {
|
|
102
|
-
resolvedRange;
|
|
103
|
-
snapPoints;
|
|
104
|
-
snapSpring;
|
|
105
|
-
scrubSeconds;
|
|
106
|
-
smoother;
|
|
107
|
-
rawScroll = 0;
|
|
108
|
-
localProgress = 0;
|
|
109
|
-
wasInside = !1;
|
|
110
|
-
subscribers = new Map([["enter", /* @__PURE__ */ new Set()], ["leave", /* @__PURE__ */ new Set()]]);
|
|
111
|
-
constructor(e = {}) {
|
|
112
|
-
if (this.resolvedRange = _(e.range), this.scrubSeconds = e.scrub ?? 0, this.snapPoints = e.snap != null && e.snap.length > 0 ? e.snap : void 0, this.scrubSeconds > 0) {
|
|
113
|
-
let r = n(1 / (this.scrubSeconds * 60 + 1), .01, 1);
|
|
114
|
-
this.smoother = new t({
|
|
115
|
-
damping: r,
|
|
116
|
-
clamp: !0,
|
|
117
|
-
...e.smoothing
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
this.snapPoints != null && (this.snapSpring = new a({ ...e.snapSpring }));
|
|
121
|
-
}
|
|
122
|
-
get range() {
|
|
123
|
-
return this.resolvedRange;
|
|
124
|
-
}
|
|
125
|
-
scrollProgress(e) {
|
|
126
|
-
this.rawScroll = n(e, 0, 1);
|
|
127
|
-
let { start: t, end: r } = this.resolvedRange, i = r - t, a = i > 0 ? n((this.rawScroll - t) / i, 0, 1) : 0, o = this.rawScroll >= t && this.rawScroll <= r;
|
|
128
|
-
return o && !this.wasInside && this.fire("enter", a), !o && this.wasInside && this.fire("leave", a), this.wasInside = o, this.smoother ? (this.smoother.setTarget(a), this.localProgress = this.smoother.current) : this.localProgress = a, this.localProgress;
|
|
129
|
-
}
|
|
130
|
-
tick(e) {
|
|
131
|
-
return this.smoother && (this.smoother.tickDt(e), this.localProgress = this.smoother.current), this.localProgress;
|
|
132
|
-
}
|
|
133
|
-
get progress() {
|
|
134
|
-
return this.localProgress;
|
|
135
|
-
}
|
|
136
|
-
get settled() {
|
|
137
|
-
return this.smoother == null || this.smoother.settled;
|
|
138
|
-
}
|
|
139
|
-
snapTo(e = 0) {
|
|
140
|
-
if (this.snapPoints == null || this.snapSpring == null) return null;
|
|
141
|
-
let t = n(i({
|
|
142
|
-
initial: this.localProgress,
|
|
143
|
-
velocity: e
|
|
144
|
-
}), 0, 1), r = this.snapPoints[0], a = Math.abs(t - r);
|
|
145
|
-
for (let e of this.snapPoints) {
|
|
146
|
-
let n = Math.abs(t - e);
|
|
147
|
-
n < a && (a = n, r = e);
|
|
148
|
-
}
|
|
149
|
-
return this.snapSpring.reset(this.localProgress, e), this.snapSpring.target = r, r;
|
|
150
|
-
}
|
|
151
|
-
tickSnap(e) {
|
|
152
|
-
return this.snapSpring && !this.snapSpring.settled && (this.snapSpring.tickDt(e), this.localProgress = this.snapSpring.value), this.localProgress;
|
|
153
|
-
}
|
|
154
|
-
on(e, t) {
|
|
155
|
-
let n = this.subscribers.get(e);
|
|
156
|
-
return n.add(t), () => n.delete(t);
|
|
157
|
-
}
|
|
158
|
-
fire(e, t) {
|
|
159
|
-
for (let n of this.subscribers.get(e)) n(t);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
function x(e = {}) {
|
|
163
|
-
return new b(e);
|
|
164
|
-
}
|
|
165
|
-
//#endregion
|
|
166
|
-
//#region src/animation/scroll/index.ts
|
|
167
|
-
var S = /* @__PURE__ */ e({
|
|
168
|
-
ScrollScene: () => b,
|
|
169
|
-
createScrollScene: () => x,
|
|
170
|
-
dispatchScrollBackend: () => v,
|
|
171
|
-
parseScrollCSS: () => p,
|
|
172
|
-
parseScrollRange: () => d,
|
|
173
|
-
parseScrollTimeline: () => f,
|
|
174
|
-
pinCSS: () => y,
|
|
175
|
-
resolveRange: () => _,
|
|
176
|
-
roundTripScrollCSS: () => u,
|
|
177
|
-
serializeScrollOptions: () => l
|
|
178
|
-
});
|
|
179
|
-
//#endregion
|
|
180
|
-
export { y as a, v as i, b as n, _ as o, x as r, S as t };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./presets-BG2Fczzq.js";
|
|
2
|
-
import { r as t } from "./delegation-DWwr4IXr.js";
|
|
3
|
-
import { t as n } from "./engine-DEVgCTUy.js";
|
|
4
|
-
import { n as r } from "./compile-CcSUwM8R.js";
|
|
5
|
-
import { extractKeyframes as i, parseCSSStylesheet as a } from "@mkbabb/value.js";
|
|
6
|
-
//#region src/animation/validate.ts
|
|
7
|
-
var o = /* @__PURE__ */ e({
|
|
8
|
-
explain: () => u,
|
|
9
|
-
validate: () => c
|
|
10
|
-
}), s = (e) => new n().fromString(e);
|
|
11
|
-
async function c(e, n = {}) {
|
|
12
|
-
let i = s(e), a = [...i.diagnostics], o = a.some((e) => e.code === "PARSE_ERROR" || e.code === "EMPTY_PARSE"), c = e.trim().length > 0 && !o, l = await r([i], n.compile ?? {}), u = t(i);
|
|
13
|
-
return {
|
|
14
|
-
parseable: c,
|
|
15
|
-
eligible: l.eligible,
|
|
16
|
-
refusals: l.refusals,
|
|
17
|
-
diagnostics: a,
|
|
18
|
-
waapi: u
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
var l = (e) => {
|
|
22
|
-
try {
|
|
23
|
-
return [...i(a(e)).keys()];
|
|
24
|
-
} catch {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
async function u(e, t = {}) {
|
|
29
|
-
let n = await c(e, t), r = l(e), i = r.length > 0 ? r.join(", ") : "(no @keyframes block)", a = [];
|
|
30
|
-
a.push(`@keyframes ${i}:`), a.push(` parseable: ${n.parseable ? "yes" : "no"}`), a.push(` compile-eligible: ${n.eligible ? "yes" : "no"}`);
|
|
31
|
-
for (let e of n.refusals) a.push(` – ${e.reason}: ${e.message}`);
|
|
32
|
-
if (a.push(` waapi-eligible: ${n.waapi.eligible ? "yes" : "no"}`), n.waapi.eligible || a.push(` – ${n.waapi.reason}`), n.diagnostics.length > 0) {
|
|
33
|
-
a.push(" diagnostics:");
|
|
34
|
-
for (let e of n.diagnostics) a.push(` – ${e.code}: ${e.message}`);
|
|
35
|
-
}
|
|
36
|
-
return a.join("\n");
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { c as n, o as r, u as t };
|