@mkbabb/keyframes.js 4.1.0 → 4.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 +520 -65
- package/dist/{animate-12YQKwyY.js → animate-D5KoLKwi.js} +2 -2
- package/dist/{animations-CcAWdZlW.js → animations-DaMcGoCd.js} +2 -2
- package/dist/binarySearch-DOP8erk-.js +13 -0
- package/dist/compile-C0xOTIC4.js +249 -0
- package/dist/decay-BvNmFk51.js +25 -0
- package/dist/{draw-svg-DwAa5cbU.js → draw-svg-CF2cTJj-.js} +1 -1
- package/dist/{engine-Cj0T6OIH.js → engine-BKm1GcJT.js} +338 -361
- package/dist/ingest-BFBYGTH-.js +139 -0
- package/dist/keyframes.d.ts +1068 -29
- package/dist/keyframes.js +82 -236
- package/dist/{motion-path-683GcEZK.js → motion-path-CqmlG74k.js} +1 -1
- package/dist/scroll-scene-JpRpH1uU.js +197 -0
- package/dist/sequence-COn8zk5o.js +156 -0
- package/dist/springTimingFunction-CcJEvGwN.js +51 -0
- package/dist/{timeline-BHz0o8dZ.js → timeline-BjcmprQ6.js} +184 -49
- package/dist/waapi-Bd5QadtA.js +179 -0
- package/package.json +110 -11
- package/dist/springTimingFunction-cMJnhbug.js +0 -178
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { f as e, i as t } from "./timeline-BjcmprQ6.js";
|
|
2
|
+
import { COMPUTED_UNITS as n, unflattenObjectToString as r } from "@mkbabb/value.js";
|
|
3
|
+
//#region src/animation/waapi.ts
|
|
4
|
+
var i = new Set([
|
|
5
|
+
...n,
|
|
6
|
+
"%",
|
|
7
|
+
"vh",
|
|
8
|
+
"vw",
|
|
9
|
+
"vmin",
|
|
10
|
+
"vmax",
|
|
11
|
+
"vi",
|
|
12
|
+
"vb",
|
|
13
|
+
"svh",
|
|
14
|
+
"svw",
|
|
15
|
+
"svmin",
|
|
16
|
+
"svmax",
|
|
17
|
+
"svi",
|
|
18
|
+
"svb",
|
|
19
|
+
"lvh",
|
|
20
|
+
"lvw",
|
|
21
|
+
"lvmin",
|
|
22
|
+
"lvmax",
|
|
23
|
+
"lvi",
|
|
24
|
+
"lvb",
|
|
25
|
+
"dvh",
|
|
26
|
+
"dvw",
|
|
27
|
+
"dvmin",
|
|
28
|
+
"dvmax",
|
|
29
|
+
"dvi",
|
|
30
|
+
"dvb",
|
|
31
|
+
"cqw",
|
|
32
|
+
"cqh",
|
|
33
|
+
"cqi",
|
|
34
|
+
"cqb",
|
|
35
|
+
"cqmin",
|
|
36
|
+
"cqmax"
|
|
37
|
+
]), a = (e) => typeof e == "string" && i.has(e), o = new Set(["offset-distance"]), s = (e) => o.has(e) || o.has(e.split(".").pop() ?? e), c = () => typeof globalThis.webkitConvertPointFromNodeToPage == "function";
|
|
38
|
+
function l(e) {
|
|
39
|
+
if (!e.targets || e.targets.length === 0) return {
|
|
40
|
+
eligible: !1,
|
|
41
|
+
reason: "no DOM targets"
|
|
42
|
+
};
|
|
43
|
+
if (typeof e.targets[0]?.animate != "function") return {
|
|
44
|
+
eligible: !1,
|
|
45
|
+
reason: "target does not implement Element.animate()"
|
|
46
|
+
};
|
|
47
|
+
for (let t of e.frames) if (!e.usesDefaultRenderer(t.transform)) return {
|
|
48
|
+
eligible: !1,
|
|
49
|
+
reason: "custom transform function (not the default DOM renderer)"
|
|
50
|
+
};
|
|
51
|
+
let t = e.frames[0]?.timingFunction;
|
|
52
|
+
if (t && e.frames.length > 1) {
|
|
53
|
+
for (let n = 1; n < e.frames.length; n++) if (e.frames[n].timingFunction.fn !== t.fn) return {
|
|
54
|
+
eligible: !1,
|
|
55
|
+
reason: "non-uniform per-frame timing function (WAAPI supports one easing per animation)"
|
|
56
|
+
};
|
|
57
|
+
if (t.css !== void 0) return {
|
|
58
|
+
eligible: !1,
|
|
59
|
+
reason: "CSS-twinned easing across multiple segments (WAAPI restarts the curve per segment)"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (t && t.css === void 0) return {
|
|
63
|
+
eligible: !1,
|
|
64
|
+
reason: "easing has no faithful CSS twin (would run bare linear on the compositor)"
|
|
65
|
+
};
|
|
66
|
+
if (t?.css?.startsWith("linear(") && c()) return {
|
|
67
|
+
eligible: !1,
|
|
68
|
+
reason: "WebKit refuses HW-accel for linear() easing — the spring twin stays on the rAF path (CE-1.0)"
|
|
69
|
+
};
|
|
70
|
+
for (let t of e.frames) for (let [e, n] of Object.entries(t.interpVars)) {
|
|
71
|
+
let t = s(e);
|
|
72
|
+
for (let e of n) {
|
|
73
|
+
let n = a(e.start?.unit) && !(t && e.start?.unit === "%"), r = a(e.stop?.unit) && !(t && e.stop?.unit === "%");
|
|
74
|
+
if (n || r) return {
|
|
75
|
+
eligible: !1,
|
|
76
|
+
reason: `layout-dependent unit (${String(e.start?.unit ?? e.stop?.unit)}) would freeze to px under WAAPI`
|
|
77
|
+
};
|
|
78
|
+
if (e.start?.unit === "color" || e.stop?.unit === "color") return {
|
|
79
|
+
eligible: !1,
|
|
80
|
+
reason: "color interpolation requires perceptual lerp"
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return { eligible: !0 };
|
|
85
|
+
}
|
|
86
|
+
var u = 8;
|
|
87
|
+
function d(t) {
|
|
88
|
+
let n = t.options.duration, i = [], a = /* @__PURE__ */ new Set();
|
|
89
|
+
for (let e of t.frames) a.add(e.time.start), a.add(e.time.stop);
|
|
90
|
+
let o = [...a].sort((e, t) => e - t), s = new Set(o);
|
|
91
|
+
if (n > 0) for (let e = 1; e < o.length; e++) {
|
|
92
|
+
let t = o[e - 1], n = o[e] - t;
|
|
93
|
+
if (!(n <= 0)) for (let e = 1; e <= u; e++) s.add(t + n * e / 9);
|
|
94
|
+
}
|
|
95
|
+
for (let a of [...s].sort((e, t) => e - t)) {
|
|
96
|
+
let o = t.interpFrames(a, !1);
|
|
97
|
+
if (Object.keys(o).length === 0) continue;
|
|
98
|
+
let s = r(o);
|
|
99
|
+
i.push({
|
|
100
|
+
offset: e(a / n, 0, 1),
|
|
101
|
+
...s
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return i;
|
|
105
|
+
}
|
|
106
|
+
var f = {
|
|
107
|
+
normal: "normal",
|
|
108
|
+
reverse: "reverse",
|
|
109
|
+
alternate: "alternate",
|
|
110
|
+
"alternate-reverse": "alternate-reverse"
|
|
111
|
+
}, p = {
|
|
112
|
+
none: "none",
|
|
113
|
+
forwards: "forwards",
|
|
114
|
+
backwards: "backwards",
|
|
115
|
+
both: "both"
|
|
116
|
+
}, m = {
|
|
117
|
+
replace: "replace",
|
|
118
|
+
add: "add",
|
|
119
|
+
accumulate: "accumulate"
|
|
120
|
+
}, h = (e) => {
|
|
121
|
+
for (let t of e.frames) {
|
|
122
|
+
let e = t.composition;
|
|
123
|
+
if (e != null && e !== "replace") return m[e] ?? "replace";
|
|
124
|
+
}
|
|
125
|
+
return "replace";
|
|
126
|
+
};
|
|
127
|
+
function g(e) {
|
|
128
|
+
let t = e.options, n = f[t.direction], r = p[t.fillMode];
|
|
129
|
+
if (n == null) throw TypeError(`Unrecognised animation direction "${t.direction}".`);
|
|
130
|
+
if (r == null) throw TypeError(`Unrecognised animation fill mode "${t.fillMode}".`);
|
|
131
|
+
let i = (e.frames[0]?.timingFunction ?? e.options.timingFunction).css ?? "linear", a = h(e), o = {
|
|
132
|
+
duration: t.duration,
|
|
133
|
+
delay: t.delay,
|
|
134
|
+
iterations: t.iterationCount === Infinity ? Infinity : t.iterationCount,
|
|
135
|
+
direction: n,
|
|
136
|
+
fill: r,
|
|
137
|
+
easing: i
|
|
138
|
+
};
|
|
139
|
+
return a !== "replace" && (o.composite = a), o;
|
|
140
|
+
}
|
|
141
|
+
async function _(e) {
|
|
142
|
+
let t = d(e), n = g(e), r = e.targets.map((e) => e.animate(t, n));
|
|
143
|
+
e._waAnimations = r, e.playback.loop(async (t) => {
|
|
144
|
+
if (e.done) return !1;
|
|
145
|
+
if (await e.advanceTo(t), e.paused) for (let e of r) e.pause();
|
|
146
|
+
else for (let e of r) e.playState === "paused" && e.play();
|
|
147
|
+
return !e.done;
|
|
148
|
+
});
|
|
149
|
+
try {
|
|
150
|
+
await Promise.all(r.map((e) => e.finished));
|
|
151
|
+
for (let t of r) try {
|
|
152
|
+
e.restPosition === "final" && typeof t.commitStyles == "function" && t.commitStyles(), t.cancel();
|
|
153
|
+
} catch {}
|
|
154
|
+
} catch {} finally {
|
|
155
|
+
e.playback.stop(), e._waAnimations = [];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function v(e, n) {
|
|
159
|
+
let r = l(e);
|
|
160
|
+
if (!r.eligible) return {
|
|
161
|
+
attached: !1,
|
|
162
|
+
reason: r.reason
|
|
163
|
+
};
|
|
164
|
+
let i = t(n);
|
|
165
|
+
if (i == null) return {
|
|
166
|
+
attached: !1,
|
|
167
|
+
reason: "native scroll/view timeline unavailable (feature absent)"
|
|
168
|
+
};
|
|
169
|
+
let a = d(e), o = {
|
|
170
|
+
...g(e),
|
|
171
|
+
timeline: i
|
|
172
|
+
}, s = e.targets.map((e) => e.animate(a, o));
|
|
173
|
+
return e._waAnimations = s, {
|
|
174
|
+
attached: !0,
|
|
175
|
+
animations: s
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
export { l as n, _ as r, v as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkbabb/keyframes.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Create keyframe animations for anything in JavaScript; specify your keyframes in standards-complaint CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"dist"
|
|
29
|
+
"dist",
|
|
30
|
+
"!dist/gh-pages",
|
|
31
|
+
"!dist/_*"
|
|
30
32
|
],
|
|
31
33
|
"scripts": {
|
|
32
34
|
"prepare": "npm run build:lib",
|
|
@@ -39,7 +41,11 @@
|
|
|
39
41
|
"build:watch": "vite build --watch --mode production",
|
|
40
42
|
"gh-pages": "vite build --mode gh-pages",
|
|
41
43
|
"proof:boundary": "node scripts/proof-boundary.mjs",
|
|
42
|
-
"proof:
|
|
44
|
+
"proof:published-surface": "node scripts/proof-published-surface.mjs",
|
|
45
|
+
"proof:agent-surface": "node scripts/proof-agent-surface.mjs",
|
|
46
|
+
"proof:demo-on-published-surface": "node scripts/proof-demo-on-published-surface.mjs",
|
|
47
|
+
"proof:color-fidelity": "node scripts/proof-color-fidelity.mjs && vitest run test/color-fidelity.test.ts",
|
|
48
|
+
"proof:readme-runs": "node scripts/proof-readme-runs.mjs",
|
|
43
49
|
"proof:deps-current": "node scripts/proof-deps-current.mjs",
|
|
44
50
|
"proof:repin-witness": "node scripts/proof-repin-witness.mjs",
|
|
45
51
|
"proof:dogfood": "node scripts/proof-dogfood.mjs",
|
|
@@ -55,52 +61,141 @@
|
|
|
55
61
|
"proof:engine-correctness": "vitest run test/engine-correctness.test.ts",
|
|
56
62
|
"proof:standalone-zero-alloc": "vitest run test/standalone-zero-alloc.test.ts",
|
|
57
63
|
"proof:compile-deterministic": "vitest run test/compile-deterministic.test.ts",
|
|
64
|
+
"proof:compile-replay": "node scripts/proof-compile-replay.mjs && vitest run test/compile-roundtrip.test.ts",
|
|
58
65
|
"proof:bench-runs": "node scripts/proof-bench-runs.mjs",
|
|
59
66
|
"proof:orchestration": "node scripts/proof-orchestration.mjs",
|
|
60
67
|
"proof:interp-fastprops": "node --allow-natives-syntax scripts/proof-interp-fastprops.mjs && vitest run test/interp-fastprops.test.ts",
|
|
61
68
|
"proof:sync-step": "vitest run test/sync-step.test.ts",
|
|
69
|
+
"proof:event-ordering": "vitest run test/event-ordering.test.ts",
|
|
62
70
|
"proof:roundtrip-easing": "vitest run test/roundtrip-easing.test.ts",
|
|
63
71
|
"proof:adapter-capture": "vitest run test/adapter-capture.test.ts",
|
|
72
|
+
"proof:composition-honored": "node scripts/proof-composition-honored.mjs && vitest run test/composition-honored.test.ts",
|
|
73
|
+
"proof:diagnostics-channel": "node scripts/proof-diagnostics-channel.mjs && vitest run test/diagnostics-channel.test.ts",
|
|
74
|
+
"proof:scroll-roundtrip": "node scripts/proof-scroll-roundtrip.mjs && vitest run test/scroll-scene.test.ts",
|
|
64
75
|
"proof:motion-path": "node scripts/proof-motion-path.mjs && vitest run test/motion-path.test.ts",
|
|
65
76
|
"proof:blend": "node scripts/proof-blend.mjs && vitest run test/blend.test.ts",
|
|
77
|
+
"proof:spring-blend-weight": "node scripts/proof-spring-blend-weight.mjs && vitest run test/spring-blend-weight.test.ts",
|
|
66
78
|
"proof:drawsvg": "node scripts/proof-drawsvg.mjs && vitest run test/draw-svg.test.ts",
|
|
67
79
|
"proof:finished": "node scripts/proof-finished.mjs && vitest run test/finished.test.ts",
|
|
68
80
|
"proof:adopt-compiled": "node scripts/proof-adopt-compiled.mjs && vitest run test/adopt-compiled.test.ts",
|
|
69
81
|
"proof:interpolate-anything": "node scripts/proof-interpolate-anything.mjs && vitest run test/interpolate-anything.test.ts",
|
|
70
82
|
"proof:roundtrip-fidelity": "node scripts/proof-roundtrip-fidelity.mjs && vitest run test/roundtrip-fidelity.test.ts",
|
|
83
|
+
"proof:ingest-replay": "node scripts/proof-ingest-replay.mjs && vitest run test/ingest.test.ts",
|
|
71
84
|
"proof:orbital-rotate3d": "node scripts/proof-orbital-rotate3d.mjs && vitest run test/orbital-rotate3d.test.ts",
|
|
72
85
|
"proof:asset-store-singleton": "vitest run test/asset-store-singleton.test.ts",
|
|
73
86
|
"proof:scene-raf-leak": "vitest run test/scene-raf-leak.test.ts",
|
|
87
|
+
"proof:scene-contract-identity": "vitest run test/scene-contract-identity.test.ts",
|
|
88
|
+
"proof:group-snapshot-identity": "vitest run test/group-snapshot-identity.test.ts",
|
|
74
89
|
"proof:resize-tracks": "vitest run test/resize-tracks.test.ts",
|
|
75
90
|
"proof:computed-real-dom": "node scripts/proof-computed-real-dom.mjs",
|
|
76
91
|
"proof:demo-usability": "node scripts/proof-demo-usability.mjs",
|
|
92
|
+
"proof:demo-smoke": "node scripts/demo-smoke.mjs",
|
|
93
|
+
"proof:occlusion": "node scripts/occlusion-gate.mjs",
|
|
94
|
+
"proof:lighthouse-a11y": "node scripts/lighthouse-gate.mjs",
|
|
95
|
+
"proof:live-session": "node scripts/proof-live-session.mjs",
|
|
96
|
+
"proof:live-session-mobile": "node scripts/proof-live-session-mobile.mjs",
|
|
97
|
+
"proof:appearance-suffusion": "node scripts/proof-appearance-suffusion.mjs",
|
|
98
|
+
"proof:gate-is-runtime": "node scripts/proof-gate-is-runtime.mjs",
|
|
99
|
+
"proof:engine-no-throw-on-play": "node scripts/proof-engine-no-throw-on-play.mjs",
|
|
100
|
+
"proof:subject-animates": "node scripts/proof-subject-animates.mjs",
|
|
101
|
+
"proof:cold-entry": "node scripts/proof-cold-entry.mjs",
|
|
102
|
+
"proof:amiga-subject-is-pivot": "node scripts/proof-amiga-subject-is-pivot.mjs",
|
|
103
|
+
"proof:icon-paint-live": "node scripts/proof-icon-paint-live.mjs",
|
|
104
|
+
"proof:specular-absent-at-rest": "node scripts/proof-specular-absent-at-rest.mjs",
|
|
105
|
+
"proof:demo-fonts": "node scripts/proof-demo-fonts.mjs",
|
|
106
|
+
"proof:font-census": "node scripts/proof-font-census.mjs",
|
|
107
|
+
"proof:drag-gesture": "node scripts/proof-drag-gesture.mjs",
|
|
108
|
+
"proof:perf-frame-budget": "node scripts/proof-perf-frame-budget.mjs",
|
|
109
|
+
"proof:easing-editor-live": "node scripts/proof-easing-editor-live.mjs",
|
|
110
|
+
"proof:fsm-suspend-resume-live": "node scripts/proof-fsm-suspend-resume-live.mjs",
|
|
111
|
+
"proof:visual-lock": "node scripts/proof-visual-lock.mjs",
|
|
112
|
+
"proof:browser": "node scripts/proof-browser.mjs",
|
|
113
|
+
"proof:scene-machine-irrefragable": "node scripts/proof-scene-machine-irrefragable.mjs",
|
|
114
|
+
"proof:drawer-spring": "node scripts/proof-drawer-spring.mjs",
|
|
115
|
+
"proof:scene-control-dfa": "node scripts/proof-scene-control-dfa.mjs && vitest run test/control-surface-dfa.test.ts",
|
|
116
|
+
"proof:scene-transition-perf": "node scripts/proof-scene-transition-perf.mjs",
|
|
117
|
+
"proof:control-surface-single-writer": "node scripts/proof-control-surface-single-writer.mjs",
|
|
118
|
+
"proof:sheet-reopen-scroll": "node scripts/proof-sheet-reopen-scroll.mjs",
|
|
119
|
+
"proof:dock-popover-opens": "node scripts/proof-dock-popover-opens.mjs",
|
|
120
|
+
"proof:single-toggle": "node scripts/proof-single-toggle.mjs",
|
|
121
|
+
"proof:single-column-pack": "node scripts/proof-single-column-pack.mjs",
|
|
122
|
+
"proof:label-subgrid": "node scripts/proof-label-subgrid.mjs",
|
|
123
|
+
"proof:timeline-rail-width": "node scripts/proof-timeline-rail-width.mjs",
|
|
124
|
+
"proof:demo-shell-grid": "node scripts/proof-demo-shell-grid.mjs",
|
|
125
|
+
"proof:stage-not-clipped": "node scripts/proof-stage-not-clipped.mjs",
|
|
126
|
+
"proof:layout-cluster": "node scripts/proof-layout-cluster.mjs",
|
|
127
|
+
"proof:cartoon-shadow-unclipped": "node scripts/proof-cartoon-shadow-unclipped.mjs",
|
|
128
|
+
"proof:no-deprecated-guard": "node scripts/proof-no-deprecated-guard.mjs",
|
|
129
|
+
"proof:single-writer": "node scripts/proof-single-writer.mjs",
|
|
130
|
+
"proof:composable-encapsulation": "node scripts/proof-composable-encapsulation.mjs",
|
|
131
|
+
"proof:demo-no-oversize": "node scripts/proof-demo-no-oversize.mjs",
|
|
132
|
+
"proof:no-brittle-selector": "node scripts/proof-no-brittle-selector.mjs",
|
|
133
|
+
"proof:no-dup-utility": "node scripts/proof-no-dup-utility.mjs",
|
|
134
|
+
"proof:cartoon-is-panel-depth": "node scripts/proof-cartoon-is-panel-depth.mjs",
|
|
135
|
+
"proof:glass-and-cartoon": "node scripts/proof-glass-and-cartoon.mjs",
|
|
136
|
+
"proof:phi-leaf-zero": "node scripts/proof-phi-leaf-zero.mjs",
|
|
137
|
+
"proof:icon-idiom": "node scripts/proof-icon-idiom.mjs",
|
|
138
|
+
"proof:styling-idioms": "node scripts/proof-styling-idioms.mjs",
|
|
139
|
+
"proof:scene-parity": "node scripts/proof-scene-parity.mjs",
|
|
140
|
+
"proof:typing-dots": "node scripts/proof-typing-dots.mjs",
|
|
141
|
+
"proof:dogfood-hero": "node scripts/proof-dogfood-hero.mjs",
|
|
142
|
+
"proof:easing-canvas-bounded": "node scripts/proof-easing-canvas-bounded.mjs",
|
|
143
|
+
"proof:scene-uses-standard-ribbon": "node scripts/proof-scene-uses-standard-ribbon.mjs",
|
|
144
|
+
"proof:easing-sidebar-normalized": "node scripts/proof-easing-sidebar-normalized.mjs",
|
|
145
|
+
"proof:easing-sidebar-minimal": "node scripts/proof-easing-sidebar-minimal.mjs",
|
|
146
|
+
"proof:easing-stage-is-ball": "node scripts/proof-easing-stage-is-ball.mjs",
|
|
147
|
+
"proof:scene-card-rounded": "node scripts/proof-scene-card-rounded.mjs",
|
|
148
|
+
"proof:stage-glass-card": "node scripts/proof-stage-glass-card.mjs",
|
|
149
|
+
"proof:card-rounded-primitive": "node scripts/proof-card-rounded-primitive.mjs",
|
|
150
|
+
"proof:stage-within-docks": "node scripts/proof-stage-within-docks.mjs",
|
|
151
|
+
"proof:mobile-single-page": "node scripts/proof-mobile-single-page.mjs",
|
|
152
|
+
"proof:dock-zorder": "node scripts/proof-dock-zorder.mjs",
|
|
153
|
+
"proof:bezier-no-scroll": "node scripts/proof-bezier-no-scroll.mjs",
|
|
154
|
+
"proof:bezier-single-card": "node scripts/proof-bezier-single-card.mjs",
|
|
155
|
+
"proof:bezier-grown": "node scripts/proof-bezier-grown.mjs",
|
|
156
|
+
"proof:pp-logo-svg": "node scripts/proof-pp-logo-svg.mjs",
|
|
157
|
+
"proof:darkmode-row-toggle": "node scripts/proof-darkmode-row-toggle.mjs",
|
|
158
|
+
"proof:idle-fade": "node scripts/proof-idle-fade.mjs",
|
|
159
|
+
"proof:scene-perf-budget": "node scripts/proof-scene-perf-budget.mjs && vitest run test/amiga-sphere-spin.test.ts",
|
|
160
|
+
"proof:hero-rung": "node scripts/proof-hero-rung.mjs",
|
|
161
|
+
"proof:hero-balance": "node scripts/proof-hero-balance.mjs",
|
|
162
|
+
"proof:hero-cls": "node scripts/proof-hero-cls.mjs",
|
|
77
163
|
"proof:cohesion": "vitest run test/boundary-cohesion.test.ts",
|
|
164
|
+
"proof:sequence-rows-draggable": "node scripts/proof-sequence-rows-draggable.mjs",
|
|
165
|
+
"proof:motion-path-editable": "node scripts/proof-motion-path-editable.mjs",
|
|
166
|
+
"proof:motion-path-copy": "node scripts/proof-motion-path-copy.mjs",
|
|
167
|
+
"proof:easter-egg": "node scripts/proof-easter-egg.mjs",
|
|
168
|
+
"proof:spring-slider-continuous": "node scripts/proof-spring-slider-continuous.mjs",
|
|
169
|
+
"proof:taste-packet": "node scripts/proof-taste-packet.mjs",
|
|
78
170
|
"proof:ci-coverage": "node scripts/proof-ci-coverage.mjs",
|
|
79
|
-
"proof:
|
|
171
|
+
"proof:manifest-sourced": "node scripts/proof-manifest-sourced.mjs",
|
|
172
|
+
"proof:chronic-closure": "node scripts/proof-chronic-closure.mjs",
|
|
173
|
+
"proof:correctness": "npm run proof:engine-no-throw-on-play && npm run proof:subject-animates && npm run proof:cold-entry && npm run proof:fsm-suspend-resume-live && npm run proof:easing-editor-live && npm run proof:amiga-subject-is-pivot && npm run proof:drag-gesture && npm run proof:control-surface-single-writer && npm run proof:sheet-reopen-scroll && npm run proof:perf-frame-budget && npm run proof:icon-paint-live && npm run proof:specular-absent-at-rest && npm run proof:demo-fonts && npm run proof:font-census && npm run proof:live-session && npm run proof:live-session-mobile && npm run proof:appearance-suffusion && npm run proof:spring-slider-continuous",
|
|
174
|
+
"proof:hygiene": "npm run proof:deps-current && npm run proof:repin-witness && npm run proof:boundary && npm run proof:dogfood && npm run proof:engine && npm run proof:decomposition && npm run proof:no-deprecated-guard && npm run proof:single-writer && npm run proof:composable-encapsulation && npm run proof:demo-no-oversize && npm run proof:no-brittle-selector && npm run proof:no-dup-utility && npm run proof:demo-smoke && npm run proof:occlusion && npm run proof:cartoon-is-panel-depth && npm run proof:glass-and-cartoon && npm run proof:dock-popover-opens && npm run proof:single-toggle && npm run proof:darkmode-row-toggle && npm run proof:idle-fade && npm run proof:single-column-pack && npm run proof:label-subgrid && npm run proof:timeline-rail-width && npm run proof:demo-shell-grid && npm run proof:layout-cluster && npm run proof:stage-not-clipped && npm run proof:cartoon-shadow-unclipped && npm run proof:scene-machine-irrefragable && npm run proof:scene-control-dfa && npm run proof:scene-transition-perf && npm run proof:dock-zorder && npm run proof:drawer-spring && npm run proof:idioms && npm run proof:phi-leaf-zero && npm run proof:icon-idiom && npm run proof:styling-idioms && npm run proof:scene-parity && npm run proof:sequence-rows-draggable && npm run proof:motion-path-editable && npm run proof:motion-path-copy && npm run proof:easter-egg && npm run proof:typing-dots && npm run proof:dogfood-hero && npm run proof:easing-canvas-bounded && npm run proof:scene-uses-standard-ribbon && npm run proof:easing-sidebar-normalized && npm run proof:easing-sidebar-minimal && npm run proof:easing-stage-is-ball && npm run proof:scene-card-rounded && npm run proof:stage-glass-card && npm run proof:card-rounded-primitive && npm run proof:stage-within-docks && npm run proof:mobile-single-page && npm run proof:bezier-no-scroll && npm run proof:bezier-single-card && npm run proof:bezier-grown && npm run proof:pp-logo-svg && npm run proof:scene-perf-budget && npm run proof:hero-rung && npm run proof:hero-balance && npm run proof:hero-cls && npm run proof:brittleness && npm run proof:demo-elevate && npm run proof:modern-web && npm run proof:zero-alloc && npm run proof:engine-correctness && npm run proof:standalone-zero-alloc && npm run proof:compile-deterministic && npm run proof:compile-replay && npm run proof:platform-adopt && npm run proof:orchestration && npm run proof:interp-fastprops && npm run proof:sync-step && npm run proof:roundtrip-easing && npm run proof:adapter-capture && npm run proof:composition-honored && npm run proof:diagnostics-channel && npm run proof:scroll-roundtrip && npm run proof:motion-path && npm run proof:blend && npm run proof:spring-blend-weight && npm run proof:drawsvg && npm run proof:finished && npm run proof:adopt-compiled && npm run proof:interpolate-anything && npm run proof:roundtrip-fidelity && npm run proof:ingest-replay && npm run proof:orbital-rotate3d && npm run proof:asset-store-singleton && npm run proof:scene-raf-leak && npm run proof:scene-contract-identity && npm run proof:group-snapshot-identity && npm run proof:resize-tracks && npm run proof:cohesion && npm run proof:visual-lock && npm run proof:demo-usability && npm run proof:computed-real-dom && npm run proof:lighthouse-a11y && npm run proof:lighthouse-mobile && npm run proof:published-surface && npm run proof:agent-surface && npm run proof:demo-on-published-surface && npm run proof:color-fidelity && npm run proof:readme-runs && npm run proof:event-ordering && npm run proof:manifest-sourced && npm run proof:bench-runs && npm run proof:gate-is-runtime && npm run proof:chronic-closure && npm run proof:taste-packet && npm run proof:ci-coverage && vitest run",
|
|
175
|
+
"proof:all": "npm run proof:correctness && npm run proof:hygiene",
|
|
80
176
|
"test": "vitest",
|
|
81
|
-
"bench": "vitest bench"
|
|
177
|
+
"bench": "vitest bench",
|
|
178
|
+
"bench:color-fidelity": "vitest run test/color-fidelity.test.ts && node scripts/color-fidelity-harness.mjs",
|
|
179
|
+
"gen:agent-surface": "node scripts/gen-agent-surface.mjs"
|
|
82
180
|
},
|
|
83
181
|
"repository": {
|
|
84
182
|
"type": "git",
|
|
85
183
|
"url": "git+https://github.com/mkbabb/keyframes.js.git"
|
|
86
184
|
},
|
|
87
|
-
"author": "",
|
|
185
|
+
"author": "Mike Babb <mike@babb.dev>",
|
|
88
186
|
"engines": {
|
|
89
187
|
"node": ">=22"
|
|
90
188
|
},
|
|
91
|
-
"peerDependencies": {
|
|
92
|
-
"vue": "^3.5.0"
|
|
93
|
-
},
|
|
94
189
|
"bugs": {
|
|
95
190
|
"url": "https://github.com/mkbabb/keyframes.js/issues"
|
|
96
191
|
},
|
|
97
192
|
"homepage": "https://github.com/mkbabb/keyframes.js#readme",
|
|
98
193
|
"dependencies": {
|
|
99
194
|
"@mkbabb/parse-that": "^0.9.0",
|
|
100
|
-
"@mkbabb/value.js": "^0.
|
|
195
|
+
"@mkbabb/value.js": "^0.13.0"
|
|
101
196
|
},
|
|
102
197
|
"optionalDependencies": {
|
|
103
|
-
"@mkbabb/glass-ui": "
|
|
198
|
+
"@mkbabb/glass-ui": "~4.0.0"
|
|
104
199
|
},
|
|
105
200
|
"devDependencies": {
|
|
106
201
|
"@iconify-json/radix-icons": "^1.2.6",
|
|
@@ -123,6 +218,8 @@
|
|
|
123
218
|
"jsdom": "^29.1.1",
|
|
124
219
|
"monaco-editor": "^0.55.1",
|
|
125
220
|
"monaco-themes": "^0.4.8",
|
|
221
|
+
"pixelmatch": "^7.2.0",
|
|
222
|
+
"pngjs": "^7.0.0",
|
|
126
223
|
"prettier": "^3.8.3",
|
|
127
224
|
"prettier-plugin-classnames": "^0.10.2",
|
|
128
225
|
"prettier-plugin-merge": "^0.10.1",
|
|
@@ -140,10 +237,12 @@
|
|
|
140
237
|
"vee-validate": "^4.15.1",
|
|
141
238
|
"vite": "^8.0.16",
|
|
142
239
|
"vite-plugin-dts": "^5.0.2",
|
|
240
|
+
"vite-svg-loader": "^5.1.0",
|
|
143
241
|
"vitest": "^4.1.8",
|
|
144
242
|
"vue": "^3.5.35",
|
|
145
243
|
"vue-router": "^5.1.0",
|
|
146
244
|
"vue-sonner": "^2.0.9",
|
|
245
|
+
"yaml": "^2.9.0",
|
|
147
246
|
"zod": "^3.25.76"
|
|
148
247
|
}
|
|
149
248
|
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { c as e, o as t, s as n } from "./timeline-BHz0o8dZ.js";
|
|
2
|
-
//#region src/animation/spring.ts
|
|
3
|
-
function r(t) {
|
|
4
|
-
let { visualDuration: n, duration: r, bounce: a = 0, ...o } = t, s = n ?? r ?? i.response, c = 1 - e(a, -1, 1);
|
|
5
|
-
return {
|
|
6
|
-
...o,
|
|
7
|
-
response: s,
|
|
8
|
-
dampingFraction: c
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
var i = {
|
|
12
|
-
response: .5,
|
|
13
|
-
dampingFraction: .86,
|
|
14
|
-
initial: 0,
|
|
15
|
-
initialVelocity: 0,
|
|
16
|
-
settleThreshold: .001,
|
|
17
|
-
velocitySettleThreshold: .001,
|
|
18
|
-
respectReducedMotion: !1
|
|
19
|
-
}, a = class e {
|
|
20
|
-
options;
|
|
21
|
-
targetValue;
|
|
22
|
-
currentValue;
|
|
23
|
-
currentVelocity;
|
|
24
|
-
isSettled;
|
|
25
|
-
elapsed;
|
|
26
|
-
originValue;
|
|
27
|
-
originVelocity;
|
|
28
|
-
omega;
|
|
29
|
-
zeta;
|
|
30
|
-
omegaD;
|
|
31
|
-
subscribers = /* @__PURE__ */ new Set();
|
|
32
|
-
disposed = !1;
|
|
33
|
-
_playback = new t();
|
|
34
|
-
_onFrame = void 0;
|
|
35
|
-
constructor(e) {
|
|
36
|
-
this.options = {
|
|
37
|
-
...i,
|
|
38
|
-
...e
|
|
39
|
-
}, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.currentVelocity = this.options.initialVelocity, this.isSettled = this.options.initialVelocity === 0, this.elapsed = 0, this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.omega = 2 * Math.PI / this.options.response, this.zeta = this.options.dampingFraction, this.omegaD = this.zeta < 1 ? this.omega * Math.sqrt(1 - this.zeta * this.zeta) : 0;
|
|
40
|
-
}
|
|
41
|
-
static fromDuration(t) {
|
|
42
|
-
return new e(r(t ?? {}));
|
|
43
|
-
}
|
|
44
|
-
get target() {
|
|
45
|
-
return this.targetValue;
|
|
46
|
-
}
|
|
47
|
-
get value() {
|
|
48
|
-
return this.currentValue;
|
|
49
|
-
}
|
|
50
|
-
get velocity() {
|
|
51
|
-
return this.currentVelocity;
|
|
52
|
-
}
|
|
53
|
-
get settled() {
|
|
54
|
-
return this.isSettled;
|
|
55
|
-
}
|
|
56
|
-
set target(e) {
|
|
57
|
-
e === this.targetValue && !this.options.initialVelocity || this.reseatTarget(e);
|
|
58
|
-
}
|
|
59
|
-
reseatTarget(e) {
|
|
60
|
-
this.targetValue = e, n(this.options.respectReducedMotion, () => this._snapSettled(), () => {
|
|
61
|
-
this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.elapsed = 0, this.isSettled = !1, this._onFrame && this._startLoop();
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
_snapSettled() {
|
|
65
|
-
this.currentValue = this.targetValue, this.currentVelocity = 0, this.originValue = this.targetValue, this.originVelocity = 0, this.elapsed = 0, this.isSettled = !0, this.emit(), this._playback.stop();
|
|
66
|
-
}
|
|
67
|
-
tickDt(e) {
|
|
68
|
-
return this._stepSeconds(e / 1e3);
|
|
69
|
-
}
|
|
70
|
-
_stepSeconds(e) {
|
|
71
|
-
return this.disposed || this.isSettled || e <= 0 ? this.currentValue : (this.elapsed += e, this.evaluateAt(this.elapsed), this.checkSettled(), this.emit(), this.currentValue);
|
|
72
|
-
}
|
|
73
|
-
tickToTime(e) {
|
|
74
|
-
return this.disposed || this.isSettled ? this.currentValue : (this.elapsed = Math.max(0, e), this.evaluateAt(this.elapsed), this.checkSettled(), this.emit(), this.currentValue);
|
|
75
|
-
}
|
|
76
|
-
evaluateAt(e) {
|
|
77
|
-
let t = this.originValue - this.targetValue, n = this.originVelocity, r = this.omega, i = this.zeta, a, o;
|
|
78
|
-
if (i < 1) {
|
|
79
|
-
let s = this.omegaD, c = Math.exp(-i * r * e), l = t, u = (n + i * r * t) / s, d = Math.cos(s * e), f = Math.sin(s * e);
|
|
80
|
-
a = c * (l * d + u * f), o = c * ((u * s - l * i * r) * d - (l * s + u * i * r) * f);
|
|
81
|
-
} else if (i === 1) {
|
|
82
|
-
let i = Math.exp(-r * e), s = t, c = n + r * t;
|
|
83
|
-
a = i * (s + c * e), o = i * (c - r * (s + c * e));
|
|
84
|
-
} else {
|
|
85
|
-
let s = r * Math.sqrt(i * i - 1), c = -i * r + s, l = -i * r - s, u = (n - l * t) / (c - l), d = t - u, f = Math.exp(c * e), p = Math.exp(l * e);
|
|
86
|
-
a = u * f + d * p, o = u * c * f + d * l * p;
|
|
87
|
-
}
|
|
88
|
-
this.currentValue = this.targetValue + a, this.currentVelocity = o;
|
|
89
|
-
}
|
|
90
|
-
checkSettled() {
|
|
91
|
-
let e = Math.abs(this.currentValue - this.targetValue), t = Math.abs(this.currentVelocity);
|
|
92
|
-
e < this.options.settleThreshold && t < this.options.velocitySettleThreshold && (this.currentValue = this.targetValue, this.currentVelocity = 0, this.isSettled = !0);
|
|
93
|
-
}
|
|
94
|
-
snap() {
|
|
95
|
-
this._snapSettled();
|
|
96
|
-
}
|
|
97
|
-
reset(e, t) {
|
|
98
|
-
let n = e ?? 0, r = t ?? 0;
|
|
99
|
-
this.targetValue = n, this.currentValue = n, this.currentVelocity = r, this.originValue = n, this.originVelocity = r, this.elapsed = 0, this.isSettled = r === 0, this.emit(), this._playback.stop();
|
|
100
|
-
}
|
|
101
|
-
subscribe(e) {
|
|
102
|
-
return this.subscribers.add(e), () => {
|
|
103
|
-
this.subscribers.delete(e);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
emit() {
|
|
107
|
-
if (this.subscribers.size !== 0) for (let e of this.subscribers) e(this.currentValue, this.currentVelocity);
|
|
108
|
-
}
|
|
109
|
-
dispose() {
|
|
110
|
-
this.disposed = !0, this._playback.stop(), this.subscribers.clear();
|
|
111
|
-
}
|
|
112
|
-
play(e) {
|
|
113
|
-
this.disposed || (this._onFrame = e, n(this.options.respectReducedMotion, () => this._snapSettled(), () => {
|
|
114
|
-
if (this.isSettled) {
|
|
115
|
-
e?.(this.currentValue, this.currentVelocity);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
this._startLoop();
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
stop() {
|
|
122
|
-
this._onFrame = void 0, this._playback.stop();
|
|
123
|
-
}
|
|
124
|
-
_startLoop() {
|
|
125
|
-
this._playback.drive(this, () => this._onFrame?.(this.currentValue, this.currentVelocity));
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/animation/springLinearStops.ts
|
|
130
|
-
function o(e) {
|
|
131
|
-
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = new a({
|
|
132
|
-
response: e.response,
|
|
133
|
-
dampingFraction: e.dampingFraction,
|
|
134
|
-
initial: 0,
|
|
135
|
-
settleThreshold: n,
|
|
136
|
-
velocitySettleThreshold: n
|
|
137
|
-
});
|
|
138
|
-
i.target = 1;
|
|
139
|
-
let o = ["0"], s = r / (t + 1);
|
|
140
|
-
for (let e = 1; e <= t; e++) {
|
|
141
|
-
i._stepSeconds(s);
|
|
142
|
-
let n = e / (t + 1) * 100, r = i.settled ? 1 : i.value;
|
|
143
|
-
o.push(`${r.toFixed(5)} ${n.toFixed(3)}%`);
|
|
144
|
-
}
|
|
145
|
-
return o.push("1"), i.dispose(), `linear(${o.join(", ")})`;
|
|
146
|
-
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region src/animation/springTimingFunction.ts
|
|
149
|
-
function s(e) {
|
|
150
|
-
let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = new a({
|
|
151
|
-
response: e.response,
|
|
152
|
-
dampingFraction: e.dampingFraction,
|
|
153
|
-
initial: 0,
|
|
154
|
-
settleThreshold: n,
|
|
155
|
-
velocitySettleThreshold: n
|
|
156
|
-
});
|
|
157
|
-
i.target = 1;
|
|
158
|
-
let s = new Float64Array(t + 1);
|
|
159
|
-
s[0] = 0;
|
|
160
|
-
let c = r / t;
|
|
161
|
-
for (let e = 1; e <= t; e++) i._stepSeconds(c), s[e] = i.settled ? 1 : i.value;
|
|
162
|
-
s[t] = 1, i.dispose();
|
|
163
|
-
let l = (e) => {
|
|
164
|
-
if (e <= 0) return 0;
|
|
165
|
-
if (e >= 1) return 1;
|
|
166
|
-
let n = e * t, r = Math.floor(n), i = n - r, a = s[r];
|
|
167
|
-
return a + (s[r + 1] - a) * i;
|
|
168
|
-
}, u = {
|
|
169
|
-
response: e.response,
|
|
170
|
-
dampingFraction: e.dampingFraction
|
|
171
|
-
};
|
|
172
|
-
return e.settleThreshold !== void 0 && (u.settleThreshold = e.settleThreshold), e.maxDuration !== void 0 && (u.maxDuration = e.maxDuration), {
|
|
173
|
-
fn: l,
|
|
174
|
-
css: o(u)
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
export { o as n, a as r, s as t };
|