@mkbabb/keyframes.js 4.2.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 +123 -0
- package/dist/{animate-WjeAtXAe.js → animate-D5KoLKwi.js} +2 -2
- package/dist/{animations-WlZvjmDT.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-Dm9f0vTl.js → draw-svg-CF2cTJj-.js} +1 -1
- package/dist/{engine-Gk4Q7ltr.js → engine-BKm1GcJT.js} +302 -357
- package/dist/ingest-BFBYGTH-.js +139 -0
- package/dist/keyframes.d.ts +984 -6
- package/dist/keyframes.js +82 -236
- package/dist/{motion-path-DQ73oD2j.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-CPT7qUV1.js → timeline-BjcmprQ6.js} +173 -39
- package/dist/waapi-Bd5QadtA.js +179 -0
- package/package.json +22 -6
- package/dist/springTimingFunction-DMb11kBe.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": [
|
|
@@ -42,6 +42,9 @@
|
|
|
42
42
|
"gh-pages": "vite build --mode gh-pages",
|
|
43
43
|
"proof:boundary": "node scripts/proof-boundary.mjs",
|
|
44
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",
|
|
45
48
|
"proof:readme-runs": "node scripts/proof-readme-runs.mjs",
|
|
46
49
|
"proof:deps-current": "node scripts/proof-deps-current.mjs",
|
|
47
50
|
"proof:repin-witness": "node scripts/proof-repin-witness.mjs",
|
|
@@ -58,6 +61,7 @@
|
|
|
58
61
|
"proof:engine-correctness": "vitest run test/engine-correctness.test.ts",
|
|
59
62
|
"proof:standalone-zero-alloc": "vitest run test/standalone-zero-alloc.test.ts",
|
|
60
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",
|
|
61
65
|
"proof:bench-runs": "node scripts/proof-bench-runs.mjs",
|
|
62
66
|
"proof:orchestration": "node scripts/proof-orchestration.mjs",
|
|
63
67
|
"proof:interp-fastprops": "node --allow-natives-syntax scripts/proof-interp-fastprops.mjs && vitest run test/interp-fastprops.test.ts",
|
|
@@ -65,13 +69,18 @@
|
|
|
65
69
|
"proof:event-ordering": "vitest run test/event-ordering.test.ts",
|
|
66
70
|
"proof:roundtrip-easing": "vitest run test/roundtrip-easing.test.ts",
|
|
67
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",
|
|
68
75
|
"proof:motion-path": "node scripts/proof-motion-path.mjs && vitest run test/motion-path.test.ts",
|
|
69
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",
|
|
70
78
|
"proof:drawsvg": "node scripts/proof-drawsvg.mjs && vitest run test/draw-svg.test.ts",
|
|
71
79
|
"proof:finished": "node scripts/proof-finished.mjs && vitest run test/finished.test.ts",
|
|
72
80
|
"proof:adopt-compiled": "node scripts/proof-adopt-compiled.mjs && vitest run test/adopt-compiled.test.ts",
|
|
73
81
|
"proof:interpolate-anything": "node scripts/proof-interpolate-anything.mjs && vitest run test/interpolate-anything.test.ts",
|
|
74
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",
|
|
75
84
|
"proof:orbital-rotate3d": "node scripts/proof-orbital-rotate3d.mjs && vitest run test/orbital-rotate3d.test.ts",
|
|
76
85
|
"proof:asset-store-singleton": "vitest run test/asset-store-singleton.test.ts",
|
|
77
86
|
"proof:scene-raf-leak": "vitest run test/scene-raf-leak.test.ts",
|
|
@@ -89,10 +98,12 @@
|
|
|
89
98
|
"proof:gate-is-runtime": "node scripts/proof-gate-is-runtime.mjs",
|
|
90
99
|
"proof:engine-no-throw-on-play": "node scripts/proof-engine-no-throw-on-play.mjs",
|
|
91
100
|
"proof:subject-animates": "node scripts/proof-subject-animates.mjs",
|
|
101
|
+
"proof:cold-entry": "node scripts/proof-cold-entry.mjs",
|
|
92
102
|
"proof:amiga-subject-is-pivot": "node scripts/proof-amiga-subject-is-pivot.mjs",
|
|
93
103
|
"proof:icon-paint-live": "node scripts/proof-icon-paint-live.mjs",
|
|
94
104
|
"proof:specular-absent-at-rest": "node scripts/proof-specular-absent-at-rest.mjs",
|
|
95
105
|
"proof:demo-fonts": "node scripts/proof-demo-fonts.mjs",
|
|
106
|
+
"proof:font-census": "node scripts/proof-font-census.mjs",
|
|
96
107
|
"proof:drag-gesture": "node scripts/proof-drag-gesture.mjs",
|
|
97
108
|
"proof:perf-frame-budget": "node scripts/proof-perf-frame-budget.mjs",
|
|
98
109
|
"proof:easing-editor-live": "node scripts/proof-easing-editor-live.mjs",
|
|
@@ -112,6 +123,7 @@
|
|
|
112
123
|
"proof:timeline-rail-width": "node scripts/proof-timeline-rail-width.mjs",
|
|
113
124
|
"proof:demo-shell-grid": "node scripts/proof-demo-shell-grid.mjs",
|
|
114
125
|
"proof:stage-not-clipped": "node scripts/proof-stage-not-clipped.mjs",
|
|
126
|
+
"proof:layout-cluster": "node scripts/proof-layout-cluster.mjs",
|
|
115
127
|
"proof:cartoon-shadow-unclipped": "node scripts/proof-cartoon-shadow-unclipped.mjs",
|
|
116
128
|
"proof:no-deprecated-guard": "node scripts/proof-no-deprecated-guard.mjs",
|
|
117
129
|
"proof:single-writer": "node scripts/proof-single-writer.mjs",
|
|
@@ -153,14 +165,18 @@
|
|
|
153
165
|
"proof:motion-path-editable": "node scripts/proof-motion-path-editable.mjs",
|
|
154
166
|
"proof:motion-path-copy": "node scripts/proof-motion-path-copy.mjs",
|
|
155
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",
|
|
156
170
|
"proof:ci-coverage": "node scripts/proof-ci-coverage.mjs",
|
|
157
171
|
"proof:manifest-sourced": "node scripts/proof-manifest-sourced.mjs",
|
|
158
172
|
"proof:chronic-closure": "node scripts/proof-chronic-closure.mjs",
|
|
159
|
-
"proof:correctness": "npm run proof:engine-no-throw-on-play && npm run proof:subject-animates && 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:live-session && npm run proof:live-session-mobile && npm run proof:appearance-suffusion",
|
|
160
|
-
"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: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: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:motion-path && npm run proof:blend && 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: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: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:ci-coverage && vitest run",
|
|
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",
|
|
161
175
|
"proof:all": "npm run proof:correctness && npm run proof:hygiene",
|
|
162
176
|
"test": "vitest",
|
|
163
|
-
"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"
|
|
164
180
|
},
|
|
165
181
|
"repository": {
|
|
166
182
|
"type": "git",
|
|
@@ -176,10 +192,10 @@
|
|
|
176
192
|
"homepage": "https://github.com/mkbabb/keyframes.js#readme",
|
|
177
193
|
"dependencies": {
|
|
178
194
|
"@mkbabb/parse-that": "^0.9.0",
|
|
179
|
-
"@mkbabb/value.js": "^0.
|
|
195
|
+
"@mkbabb/value.js": "^0.13.0"
|
|
180
196
|
},
|
|
181
197
|
"optionalDependencies": {
|
|
182
|
-
"@mkbabb/glass-ui": "~
|
|
198
|
+
"@mkbabb/glass-ui": "~4.0.0"
|
|
183
199
|
},
|
|
184
200
|
"devDependencies": {
|
|
185
201
|
"@iconify-json/radix-icons": "^1.2.6",
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { c as e, o as t, s as n } from "./timeline-CPT7qUV1.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 };
|