@mkbabb/keyframes.js 4.3.0 → 5.0.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.
@@ -1,7 +1,73 @@
1
- import { f as e, i as t } from "./timeline-BjcmprQ6.js";
1
+ import { f as e, i as t } from "./timeline-vY3eD3Ax.js";
2
2
  import { COMPUTED_UNITS as n, unflattenObjectToString as r } from "@mkbabb/value.js";
3
+ var i = .005, a = (e, t) => {
4
+ let n = /* @__PURE__ */ new Map(), r = e.interpFrames(t, !1);
5
+ for (let e in r) {
6
+ let t = r[e];
7
+ if (t !== void 0) for (let r = 0; r < t.length; r++) {
8
+ let i = t[r]?.value;
9
+ typeof i == "number" && Number.isFinite(i) && n.set(t.length > 1 ? `${e}.${r}` : e, i);
10
+ }
11
+ }
12
+ return n;
13
+ }, o = 64, s = (e, t, n) => {
14
+ let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = n - t;
15
+ for (let n = 0; n <= o; n++) {
16
+ let c = a(e, t + s * n / o);
17
+ for (let [e, t] of c) {
18
+ let n = r.get(e), a = i.get(e);
19
+ (n === void 0 || t < n) && r.set(e, t), (a === void 0 || t > a) && i.set(e, t);
20
+ }
21
+ }
22
+ let c = /* @__PURE__ */ new Map();
23
+ for (let [e, t] of r) c.set(e, (i.get(e) ?? t) - t);
24
+ return c;
25
+ }, c = (e, t, n, r, i, o) => {
26
+ let s = r - t, c = 0;
27
+ for (let r of [.25, .75]) {
28
+ let l = a(e, t + s * r);
29
+ for (let [e, t] of l) {
30
+ let a = n.get(e), s = i.get(e);
31
+ if (a === void 0 || s === void 0) continue;
32
+ let l = o.get(e);
33
+ if (l === void 0 || l === 0) continue;
34
+ let u = a + (s - a) * r, d = Math.abs(t - u) / l;
35
+ d > c && (c = d);
36
+ }
37
+ }
38
+ return c;
39
+ };
40
+ function l(e, t, n) {
41
+ let r = /* @__PURE__ */ new Set();
42
+ if (n <= 0) return r;
43
+ for (let n = 1; n < t.length; n++) {
44
+ let o = t[n - 1], l = t[n];
45
+ if (l - o <= 0) continue;
46
+ let u = s(e, o, l), d = a(e, o), f = a(e, l), p = (t, n, r, i) => ({
47
+ a: t,
48
+ sampleA: n,
49
+ b: r,
50
+ sampleB: i,
51
+ error: c(e, t, n, r, i, u)
52
+ }), m = [p(o, d, l, f)], h = 16;
53
+ for (; h > 0;) {
54
+ let t = -1, n = i;
55
+ for (let e = 0; e < m.length; e++) m[e].error > n && (n = m[e].error, t = e);
56
+ if (t === -1) break;
57
+ let o = m[t], s = (o.a + o.b) / 2;
58
+ if (s <= o.a || s >= o.b) {
59
+ m.splice(t, 1);
60
+ continue;
61
+ }
62
+ let c = a(e, s);
63
+ r.add(s), h--, m.splice(t, 1, p(o.a, o.sampleA, s, c), p(s, c, o.b, o.sampleB));
64
+ }
65
+ }
66
+ return r;
67
+ }
68
+ //#endregion
3
69
  //#region src/animation/waapi.ts
4
- var i = new Set([
70
+ var u = new Set([
5
71
  ...n,
6
72
  "%",
7
73
  "vh",
@@ -34,8 +100,8 @@ var i = new Set([
34
100
  "cqb",
35
101
  "cqmin",
36
102
  "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) {
103
+ ]), d = (e) => typeof e == "string" && u.has(e), f = new Set(["offset-distance"]), p = (e) => f.has(e) || f.has(e.split(".").pop() ?? e), m = () => typeof globalThis.webkitConvertPointFromNodeToPage == "function";
104
+ function h(e) {
39
105
  if (!e.targets || e.targets.length === 0) return {
40
106
  eligible: !1,
41
107
  reason: "no DOM targets"
@@ -63,14 +129,14 @@ function l(e) {
63
129
  eligible: !1,
64
130
  reason: "easing has no faithful CSS twin (would run bare linear on the compositor)"
65
131
  };
66
- if (t?.css?.startsWith("linear(") && c()) return {
132
+ if (t?.css?.startsWith("linear(") && m()) return {
67
133
  eligible: !1,
68
134
  reason: "WebKit refuses HW-accel for linear() easing — the spring twin stays on the rAF path (CE-1.0)"
69
135
  };
70
136
  for (let t of e.frames) for (let [e, n] of Object.entries(t.interpVars)) {
71
- let t = s(e);
137
+ let t = p(e);
72
138
  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 === "%");
139
+ let n = d(e.start?.unit) && !(t && e.start?.unit === "%"), r = d(e.stop?.unit) && !(t && e.stop?.unit === "%");
74
140
  if (n || r) return {
75
141
  eligible: !1,
76
142
  reason: `layout-dependent unit (${String(e.start?.unit ?? e.stop?.unit)}) would freeze to px under WAAPI`
@@ -83,15 +149,11 @@ function l(e) {
83
149
  }
84
150
  return { eligible: !0 };
85
151
  }
86
- var u = 8;
87
- function d(t) {
152
+ function g(t) {
88
153
  let n = t.options.duration, i = [], a = /* @__PURE__ */ new Set();
89
154
  for (let e of t.frames) a.add(e.time.start), a.add(e.time.stop);
90
155
  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
- }
156
+ for (let e of l(t, o, n)) s.add(e);
95
157
  for (let a of [...s].sort((e, t) => e - t)) {
96
158
  let o = t.interpFrames(a, !1);
97
159
  if (Object.keys(o).length === 0) continue;
@@ -103,32 +165,32 @@ function d(t) {
103
165
  }
104
166
  return i;
105
167
  }
106
- var f = {
168
+ var _ = {
107
169
  normal: "normal",
108
170
  reverse: "reverse",
109
171
  alternate: "alternate",
110
172
  "alternate-reverse": "alternate-reverse"
111
- }, p = {
173
+ }, v = {
112
174
  none: "none",
113
175
  forwards: "forwards",
114
176
  backwards: "backwards",
115
177
  both: "both"
116
- }, m = {
178
+ }, y = {
117
179
  replace: "replace",
118
180
  add: "add",
119
181
  accumulate: "accumulate"
120
- }, h = (e) => {
182
+ }, b = (e) => {
121
183
  for (let t of e.frames) {
122
184
  let e = t.composition;
123
- if (e != null && e !== "replace") return m[e] ?? "replace";
185
+ if (e != null && e !== "replace") return y[e] ?? "replace";
124
186
  }
125
187
  return "replace";
126
188
  };
127
- function g(e) {
128
- let t = e.options, n = f[t.direction], r = p[t.fillMode];
189
+ function x(e) {
190
+ let t = e.options, n = _[t.direction], r = v[t.fillMode];
129
191
  if (n == null) throw TypeError(`Unrecognised animation direction "${t.direction}".`);
130
192
  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 = {
193
+ let i = (e.frames[0]?.timingFunction ?? e.options.timingFunction).css ?? "linear", a = b(e), o = {
132
194
  duration: t.duration,
133
195
  delay: t.delay,
134
196
  iterations: t.iterationCount === Infinity ? Infinity : t.iterationCount,
@@ -138,8 +200,8 @@ function g(e) {
138
200
  };
139
201
  return a !== "replace" && (o.composite = a), o;
140
202
  }
141
- async function _(e) {
142
- let t = d(e), n = g(e), r = e.targets.map((e) => e.animate(t, n));
203
+ async function S(e) {
204
+ let t = g(e), n = x(e), r = e.targets.map((e) => e.animate(t, n));
143
205
  e._waAnimations = r, e.playback.loop(async (t) => {
144
206
  if (e.done) return !1;
145
207
  if (await e.advanceTo(t), e.paused) for (let e of r) e.pause();
@@ -155,8 +217,8 @@ async function _(e) {
155
217
  e.playback.stop(), e._waAnimations = [];
156
218
  }
157
219
  }
158
- function v(e, n) {
159
- let r = l(e);
220
+ function C(e, n) {
221
+ let r = h(e);
160
222
  if (!r.eligible) return {
161
223
  attached: !1,
162
224
  reason: r.reason
@@ -166,8 +228,8 @@ function v(e, n) {
166
228
  attached: !1,
167
229
  reason: "native scroll/view timeline unavailable (feature absent)"
168
230
  };
169
- let a = d(e), o = {
170
- ...g(e),
231
+ let a = g(e), o = {
232
+ ...x(e),
171
233
  timeline: i
172
234
  }, s = e.targets.map((e) => e.animate(a, o));
173
235
  return e._waAnimations = s, {
@@ -176,4 +238,4 @@ function v(e, n) {
176
238
  };
177
239
  }
178
240
  //#endregion
179
- export { l as n, _ as r, v as t };
241
+ export { h as n, S as r, C as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkbabb/keyframes.js",
3
- "version": "4.3.0",
3
+ "version": "5.0.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,7 +42,10 @@
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:alias-dropped": "node scripts/proof-alias-dropped.mjs",
46
+ "proof:changelog-5": "node scripts/proof-changelog-5.mjs",
45
47
  "proof:agent-surface": "node scripts/proof-agent-surface.mjs",
48
+ "proof:agent-validate": "node scripts/proof-agent-validate.mjs && vitest run test/agent-validate.test.ts",
46
49
  "proof:demo-on-published-surface": "node scripts/proof-demo-on-published-surface.mjs",
47
50
  "proof:color-fidelity": "node scripts/proof-color-fidelity.mjs && vitest run test/color-fidelity.test.ts",
48
51
  "proof:readme-runs": "node scripts/proof-readme-runs.mjs",
@@ -62,8 +65,15 @@
62
65
  "proof:standalone-zero-alloc": "vitest run test/standalone-zero-alloc.test.ts",
63
66
  "proof:compile-deterministic": "vitest run test/compile-deterministic.test.ts",
64
67
  "proof:compile-replay": "node scripts/proof-compile-replay.mjs && vitest run test/compile-roundtrip.test.ts",
68
+ "proof:replay-equality": "node scripts/proof-replay-equality.mjs && vitest run test/replay-equality.test.ts",
65
69
  "proof:bench-runs": "node scripts/proof-bench-runs.mjs",
70
+ "proof:bench-taxonomy": "node scripts/proof-bench-taxonomy.mjs",
71
+ "proof:scheduler-posttask": "node scripts/proof-scheduler-posttask.mjs",
72
+ "proof:epf1-measure": "node scripts/proof-epf1-measure.mjs",
73
+ "proof:spring-vector": "node scripts/proof-spring-vector.mjs",
66
74
  "proof:orchestration": "node scripts/proof-orchestration.mjs",
75
+ "proof:animate-orchestration": "vitest run test/animate-orchestration.test.ts",
76
+ "proof:transport-events": "node scripts/proof-transport-events.mjs",
67
77
  "proof:interp-fastprops": "node --allow-natives-syntax scripts/proof-interp-fastprops.mjs && vitest run test/interp-fastprops.test.ts",
68
78
  "proof:sync-step": "vitest run test/sync-step.test.ts",
69
79
  "proof:event-ordering": "vitest run test/event-ordering.test.ts",
@@ -165,14 +175,58 @@
165
175
  "proof:motion-path-editable": "node scripts/proof-motion-path-editable.mjs",
166
176
  "proof:motion-path-copy": "node scripts/proof-motion-path-copy.mjs",
167
177
  "proof:easter-egg": "node scripts/proof-easter-egg.mjs",
178
+ "proof:crayon-preserved": "node scripts/proof-crayon-preserved.mjs",
179
+ "proof:design-refinement": "node scripts/proof-design-refinement.mjs",
168
180
  "proof:spring-slider-continuous": "node scripts/proof-spring-slider-continuous.mjs",
169
181
  "proof:taste-packet": "node scripts/proof-taste-packet.mjs",
170
182
  "proof:ci-coverage": "node scripts/proof-ci-coverage.mjs",
183
+ "proof:report-all": "node scripts/proof-report-all.mjs",
184
+ "proof:no-single-option-select": "node scripts/proof-no-single-option-select.mjs",
185
+ "proof:peer-satisfied": "node scripts/proof-peer-satisfied.mjs",
186
+ "proof:css-parity": "node scripts/proof-css-parity.mjs",
187
+ "proof:packrat-sound": "node scripts/proof-packrat-sound.mjs",
188
+ "proof:consume-bundle": "node scripts/proof-consume-bundle.mjs",
189
+ "proof:keyframes-vue-published": "node scripts/proof-keyframes-vue-published.mjs",
190
+ "proof:workaround-deletion": "node scripts/proof-workaround-deletion.mjs",
191
+ "proof:settle-is-predicate": "node scripts/proof-settle-is-predicate.mjs",
171
192
  "proof:manifest-sourced": "node scripts/proof-manifest-sourced.mjs",
172
193
  "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",
194
+ "proof:no-foreign-symbol-stamp": "node scripts/proof-no-foreign-symbol-stamp.mjs",
195
+ "proof:soa-composite": "node scripts/proof-soa-composite.mjs && npm run proof:blend",
196
+ "proof:emerging-css-resolve-now": "node scripts/proof-emerging-css-resolve-now.mjs && vitest run test/emerging-css-resolve-now.test.ts",
197
+ "proof:morphsvg-consume": "node scripts/proof-morphsvg-consume.mjs && vitest run test/morph-svg.test.ts",
198
+ "proof:portable-perf": "node scripts/proof-portable-perf.mjs",
199
+ "proof:spring-heatmap": "node scripts/proof-spring-heatmap.mjs",
200
+ "proof:record-truth": "node scripts/proof-record-truth.mjs",
201
+ "proof:lint-clean": "node scripts/proof-lint-clean.mjs",
202
+ "lint": "depcruise src --ignore-known",
203
+ "proof:drag2d-light-certified": "node scripts/proof-drag2d-light-certified.mjs",
204
+ "proof:published-on-master": "node scripts/proof-published-on-master.mjs",
205
+ "proof:deploy-roundtrip": "node scripts/proof-deploy-roundtrip.mjs",
206
+ "proof:wave-charter": "node scripts/proof-wave-charter.mjs",
207
+ "proof:pin-ledger-current": "node scripts/proof-pin-ledger-current.mjs",
208
+ "proof:emerging-css-resolve-p2": "node scripts/proof-emerging-css-resolve-p2.mjs && vitest run test/emerging-css-resolve-p2.test.ts",
209
+ "proof:processframe-soa": "node scripts/proof-processframe-soa.mjs",
210
+ "proof:nan-frame": "node scripts/proof-nan-frame.mjs && vitest run test/nan-frame.test.ts",
211
+ "proof:waapi-adaptive-densify": "node scripts/proof-waapi-adaptive-densify.mjs",
212
+ "proof:grammar-fuzz": "node scripts/proof-grammar-fuzz.mjs && vitest run test/grammar-fuzz.test.ts",
213
+ "proof:kf-differential": "node scripts/proof-kf-differential.mjs",
214
+ "proof:demo-control-point": "node scripts/proof-demo-control-point.mjs",
215
+ "proof:easing-curve-editor": "node scripts/proof-easing-curve-editor.mjs",
216
+ "proof:scene-switcher-mobile": "node scripts/proof-scene-switcher-mobile.mjs",
217
+ "proof:amiga-decay-visible": "node scripts/proof-amiga-decay-visible.mjs",
218
+ "proof:morph-renders-d": "node scripts/proof-morph-renders-d.mjs && vitest run test/morph-svg.test.ts",
219
+ "proof:morph-orients": "node scripts/proof-morph-orients.mjs && vitest run test/morph-svg.test.ts",
220
+ "proof:morph-scene": "node scripts/proof-morph-scene.mjs",
221
+ "proof:emerging-css-resolve-fn": "node scripts/proof-emerging-css-resolve-fn.mjs && vitest run test/emerging-css-resolve-fn.test.ts",
222
+ "proof:no-cross-realm-cast": "node scripts/proof-no-cross-realm-cast.mjs",
223
+ "proof:color-soa": "node scripts/proof-color-soa.mjs",
224
+ "proof:glassui-aria-ask": "node scripts/proof-glassui-aria-ask.mjs",
225
+ "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 && npm run proof:emerging-css-resolve-now && npm run proof:spring-heatmap && npm run proof:demo-control-point && npm run proof:easing-curve-editor && npm run proof:scene-switcher-mobile && npm run proof:amiga-decay-visible && npm run proof:morph-scene",
226
+ "proof:hygiene": "node scripts/run-all.mjs --tier=proof:hygiene-chain",
227
+ "proof:hygiene-chain": "npm run proof:record-truth && npm run proof:deps-current && npm run proof:repin-witness && npm run proof:boundary && npm run proof:consume-bundle && npm run proof:css-parity && npm run proof:packrat-sound && npm run proof:workaround-deletion && 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:no-single-option-select && npm run proof:settle-is-predicate && 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:crayon-preserved && npm run proof:design-refinement && 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:replay-equality && npm run proof:platform-adopt && npm run proof:orchestration && npm run proof:transport-events && npm run proof:animate-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:alias-dropped && npm run proof:changelog-5 && npm run proof:agent-surface && npm run proof:agent-validate && 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:bench-taxonomy && npm run proof:scheduler-posttask && npm run proof:epf1-measure && npm run proof:spring-vector && npm run proof:gate-is-runtime && npm run proof:chronic-closure && npm run proof:taste-packet && npm run proof:ci-coverage && npm run proof:no-foreign-symbol-stamp && npm run proof:soa-composite && npm run proof:morphsvg-consume && npm run proof:portable-perf && npm run proof:published-on-master && npm run proof:deploy-roundtrip && npm run proof:lint-clean && npm run proof:drag2d-light-certified && npm run proof:wave-charter && npm run proof:pin-ledger-current && npm run proof:emerging-css-resolve-p2 && npm run proof:processframe-soa && npm run proof:nan-frame && npm run proof:waapi-adaptive-densify && npm run proof:grammar-fuzz && npm run proof:kf-differential && npm run proof:morph-renders-d && npm run proof:morph-orients && npm run proof:emerging-css-resolve-fn && npm run proof:no-cross-realm-cast && npm run proof:color-soa && npm run proof:glassui-aria-ask && npm run proof:report-all && vitest run",
228
+ "proof:all": "node scripts/run-all.mjs --all",
229
+ "proof:all:demo": "npm run proof:demo-smoke && npm run proof:occlusion && npm run proof:peer-satisfied",
176
230
  "test": "vitest",
177
231
  "bench": "vitest bench",
178
232
  "bench:color-fidelity": "vitest run test/color-fidelity.test.ts && node scripts/color-fidelity-harness.mjs",
@@ -191,8 +245,7 @@
191
245
  },
192
246
  "homepage": "https://github.com/mkbabb/keyframes.js#readme",
193
247
  "dependencies": {
194
- "@mkbabb/parse-that": "^0.9.0",
195
- "@mkbabb/value.js": "^0.13.0"
248
+ "@mkbabb/value.js": "^1.2.0"
196
249
  },
197
250
  "optionalDependencies": {
198
251
  "@mkbabb/glass-ui": "~4.0.0"
@@ -212,7 +265,9 @@
212
265
  "@vueuse/core": "^14.3.0",
213
266
  "class-variance-authority": "^0.7.1",
214
267
  "clsx": "^2.1.1",
268
+ "dependency-cruiser": "^17.4.3",
215
269
  "embla-carousel-vue": "^8.6.0",
270
+ "fast-check": "^3.23.2",
216
271
  "highlight.js": "^11.11.1",
217
272
  "html2canvas": "^1.4.1",
218
273
  "jsdom": "^29.1.1",
@@ -1,21 +0,0 @@
1
- import { CSSKeyframesAnimation as e } from "./engine-BKm1GcJT.js";
2
- import { fromMotionPath as t } from "./motion-path-CqmlG74k.js";
3
- //#region src/animation/animate.ts
4
- var n = (e) => typeof e == "object" && !!e && !Array.isArray(e) && !(e instanceof Map) && typeof e.path == "string", r = (e) => e instanceof Map || typeof e == "object" && !!e && !Array.isArray(e);
5
- function i(i, a, o) {
6
- let { transform: s, autoPlay: c = !0, ...l } = o ?? {};
7
- if (n(a)) return t(i, {
8
- ...a,
9
- ...l,
10
- autoPlay: c
11
- });
12
- let u = new e(l);
13
- if (typeof a == "string") u.fromString(a, s);
14
- else if (Array.isArray(a)) u.fromVars(a, s);
15
- else if (r(a)) u.fromKeyframes(a, s);
16
- else throw Error("animate(): unrecognized input — pass a CSS @keyframes string, a keyframe map ({ \"0%\": {...} }), a vars array ([from, to]), or a MotionPath spec ({ path }).");
17
- let d = Array.isArray(i) ? i : [i];
18
- return u.setTargets(...d), c && u.play(), u;
19
- }
20
- //#endregion
21
- export { i as animate };
@@ -1,13 +0,0 @@
1
- //#region src/animation/internal/binarySearch.ts
2
- function e(e, t, n, r) {
3
- let i = 0, a = e.length - 1;
4
- for (; i <= a;) {
5
- let o = i + a >> 1, s = e[o];
6
- if (t < n(s)) a = o - 1;
7
- else if (t > r(s)) i = o + 1;
8
- else return o;
9
- }
10
- return -1;
11
- }
12
- //#endregion
13
- export { e as t };
@@ -1,249 +0,0 @@
1
- import { v as e } from "./timeline-BjcmprQ6.js";
2
- import { t } from "./sequence-COn8zk5o.js";
3
- import { AnimationGroup as n, getAnimationId as r } from "./engine-BKm1GcJT.js";
4
- import { COLOR_SPACE_RANGES as i, camelCaseToHyphen as a, color2 as o, deltaEOK as s, formatCSS as c, normalizeColorUnit as l, reverseAnimationShorthand as u, sampleColorRamp as d, scale as f, timingFunctions as p, unflattenObjectToString as m } from "@mkbabb/value.js";
5
- //#region src/animation/format.ts
6
- function h(t) {
7
- if (t.css !== void 0) return t.css;
8
- let n = Object.entries(p).find(([e, n]) => n === t.fn)?.[0];
9
- if (n === void 0) throw new e("timingFunction", t.fn, "a custom TimingFunction has no CSS animation-timing-function representation — attach a faithful Easing.css twin, or use a registry name / cubic-bezier() / linear() literal");
10
- return a(n);
11
- }
12
- function g(e, t, n) {
13
- let r = e.parsedVars[t] ?? {}, i = Object.entries(m(r)).map(([e, t]) => ` ${a(e)}: ${t};`), o = e.templateFrames[t], s = o.timingFunction ? h(o.timingFunction) : n;
14
- return s !== n && i.push(` animation-timing-function: ${s};`), `{\n${i.join("\n").trim()}\n}`;
15
- }
16
- function _(e, t, n) {
17
- let r = h(e.options.timingFunction), i = /* @__PURE__ */ new Map();
18
- e.templateFrames.forEach((t, a) => {
19
- let o = n?.get(a) ?? g(e, a, r), s = i.get(o);
20
- s ? s.push(t.start) : i.set(o, [t.start]);
21
- });
22
- let a = "";
23
- for (let [e, t] of i) a += `${t.join(", ")} ${e}\n`;
24
- return `@keyframes ${t} {\n${a}}`;
25
- }
26
- function v(e, t) {
27
- let n = {
28
- name: t,
29
- duration: e.duration,
30
- timingFunction: h(e.timingFunction),
31
- iterationCount: isFinite(e.iterationCount) ? e.iterationCount : Infinity,
32
- direction: e.direction,
33
- fillMode: e.fillMode
34
- };
35
- return e.delay > 0 && (n.delay = e.delay), u(n);
36
- }
37
- function y(e) {
38
- return e === "replace" ? void 0 : `animation-composition: ${e};`;
39
- }
40
- //#endregion
41
- //#region src/animation/compile-color.ts
42
- var b = i.oklab.a.number.min, x = i.oklab.a.number.max, S = i.oklab.b.number.min, C = i.oklab.b.number.max, w = (e) => Math.round(e * 1e4) / 1e4, T = (e) => typeof e == "object" && !!e && e.unit === "color", E = (e) => l(e).value, D = (e) => {
43
- let t = o(e, "oklab");
44
- return [
45
- t.l,
46
- f(t.a, 0, 1, b, x),
47
- f(t.b, 0, 1, S, C)
48
- ];
49
- }, O = (e) => {
50
- let [t, n, r] = D(e);
51
- return `oklab(${w(t)} ${w(n)} ${w(r)})`;
52
- }, k = (e, t) => {
53
- let [n, r, i] = D(e), [a, o, c] = D(t);
54
- return s(n, r, i, a, o, c);
55
- }, A = (e, t, n) => o({
56
- colorSpace: "oklab",
57
- l: e,
58
- a: f(t, b, x, 0, 1),
59
- b: f(n, S, C, 0, 1),
60
- alpha: 1
61
- }, "oklab"), j = (e, t) => {
62
- let [n, r, i] = D(e), [a, o, s] = D(t);
63
- return A((n + a) / 2, (r + o) / 2, (i + s) / 2);
64
- }, M = (e) => {
65
- let t = /([\d.]+)\s*%/.exec(e.toString());
66
- return t ? parseFloat(t[1]) : 0;
67
- }, N = (e, t, n) => {
68
- let r = (e.parsedVars[t] ?? {})[n];
69
- if (Array.isArray(r)) return r.find((e) => T(e));
70
- };
71
- function P(e, t, n, r) {
72
- let i = [], a = /* @__PURE__ */ new Set();
73
- for (let t = 0; t + 1 < e.templateFrames.length; t++) {
74
- let n = e.parsedVars[t] ?? {};
75
- for (let [r, o] of Object.entries(n)) {
76
- if (a.has(r) || !Array.isArray(o) || !o.some((e) => T(e))) continue;
77
- let n = N(e, t, r), s = N(e, t + 1, r);
78
- n && s && n.toString() !== s.toString() && (i.push(r), a.add(r));
79
- }
80
- }
81
- if (i.length === 0 || i.length > 1) return null;
82
- let o = i[0], s = Math.max(3, n), c = o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), l = e.options.colorSpace === "oklch" ? "oklch" : "oklab", u = e.options.hueMethod ? { hueMethod: e.options.hueMethod } : {}, f = [], p = 0;
83
- for (let t = 0; t + 1 < e.templateFrames.length; t++) {
84
- let n = N(e, t, o), r = N(e, t + 1, o);
85
- if (!n || !r) continue;
86
- let i = M(e.templateFrames[t].start), a = M(e.templateFrames[t + 1].start);
87
- if (n.toString() === r.toString()) {
88
- f.push({
89
- pct: i,
90
- css: n.toString()
91
- });
92
- continue;
93
- }
94
- let c = E(n), m = E(r), h = d(c, m, s, {
95
- space: l,
96
- ...u
97
- });
98
- for (let e = 0; e < h.length; e++) {
99
- let t = e / (h.length - 1), n = i + (a - i) * t;
100
- f.push({
101
- pct: w(n),
102
- css: O(h[e])
103
- });
104
- }
105
- for (let e = 0; e + 1 < h.length; e++) {
106
- let t = (e + .5) / (h.length - 1), n = d(c, m, 1024, {
107
- space: l,
108
- ...u
109
- })[Math.round(t * 1023)], r = j(h[e], h[e + 1]);
110
- p = Math.max(p, k(r, n));
111
- }
112
- }
113
- let m = e.templateFrames.length - 1, h = N(e, m, o);
114
- if (h) {
115
- let t = M(e.templateFrames[m].start);
116
- f[f.length - 1]?.pct !== t && f.push({
117
- pct: t,
118
- css: h.toString()
119
- });
120
- }
121
- if (p > r) return {
122
- refused: !0,
123
- delta: p
124
- };
125
- let g = "";
126
- for (let { pct: e, css: t } of f) g += `${e}% {\n ${c}: ${t};\n}\n`;
127
- return { block: `@keyframes ${t} {\n${g}}` };
128
- }
129
- //#endregion
130
- //#region src/animation/compile.ts
131
- var F = .04, I = 16;
132
- function L(e) {
133
- let t = [];
134
- for (let n of Object.keys(e.animations)) {
135
- let i = e.animations[n], a = i.layer.blendMode, o = a === "weighted" || i.layer.weightSpring != null, s = a === "add" ? "add" : "replace";
136
- t.push({
137
- animation: i.animation,
138
- name: B(r(i.animation)),
139
- composition: s,
140
- weighted: o,
141
- delay: 0
142
- });
143
- }
144
- return t;
145
- }
146
- function R(e) {
147
- return e.entries.map((e) => ({
148
- animation: e.animation,
149
- name: B(r(e.animation)),
150
- composition: "replace",
151
- weighted: !1,
152
- delay: e.at
153
- }));
154
- }
155
- function z(e) {
156
- return e.map((e, t) => {
157
- let n = "animation" in e ? e.animation : e;
158
- return {
159
- animation: n,
160
- name: B(r(n) || `anim-${t}`),
161
- composition: "replace",
162
- weighted: !1,
163
- delay: 0
164
- };
165
- });
166
- }
167
- function B(e) {
168
- let t = e.replace(/[^a-zA-Z0-9_-]/g, "-");
169
- return /^[a-zA-Z_]/.test(t) ? t : `a${t}`;
170
- }
171
- var V = (e) => e % 1e3 == 0 ? `${e / 1e3}s` : `${e}ms`;
172
- function H(e) {
173
- for (let t = 0; t < e.templateFrames.length; t++) {
174
- let n = e.parsedVars[t] ?? {};
175
- for (let [e, t] of Object.entries(n)) if (!Array.isArray(t) || t.length === 0) return e;
176
- }
177
- }
178
- function U(e, t, n) {
179
- let { animation: r, name: i } = e;
180
- if (e.weighted) return n.push({
181
- name: i,
182
- reason: "weighted-blend",
183
- message: "weighted layer blend has no animation-composition equivalent (CSS composites replace/add/accumulate only); the weighted axis is kf's unique blend tier — the JS playback is the only faithful path"
184
- }), null;
185
- for (let e of r.frames) if (!r.usesDefaultRenderer(e.transform)) return n.push({
186
- name: i,
187
- reason: "custom-renderer",
188
- message: "custom renderer (a transform closure, not the default DOM-style renderer) cannot be expressed as CSS — the JS playback is the only faithful path"
189
- }), null;
190
- let a = H(r);
191
- if (a) return n.push({
192
- name: i,
193
- reason: "computed-unit-drift",
194
- message: `computed-unit drift on "${a}" — the declared value cannot be re-emitted as a faithful authored string; the JS playback is the only faithful path`
195
- }), null;
196
- let o = P(r, i, t.densifyStops ?? 16, t.deltaEEpsilon ?? .04);
197
- if (o && "refused" in o) return n.push({
198
- name: i,
199
- reason: "perceptual-oklab",
200
- message: `perceptual oklab color track exceeds the densify ΔE-ε threshold (ΔE ${w(o.delta)} > ${t.deltaEEpsilon ?? .04}) — a faithful pure-CSS twin is not available; the JS playback is the only faithful path`
201
- }), null;
202
- let s = o && "block" in o ? o.block : _(r, i), c;
203
- try {
204
- c = v(r.options, i);
205
- } catch {
206
- return n.push({
207
- name: i,
208
- reason: "custom-renderer",
209
- message: "easing has no faithful CSS timing-function twin (a custom closure cannot be CSS) — attach an Easing.css twin or use a registry name / cubic-bezier() / linear(); the JS playback is the only faithful path"
210
- }), null;
211
- }
212
- let l = y(e.composition), u = l ? `\n ${l}` : "", d = e.delay > 0 ? `\n animation-delay: ${V(e.delay)};` : "";
213
- return `${s}\n\n${`.${i} {\n animation: ${c};${u}${d}\n}`}`;
214
- }
215
- async function W(e, r = {}) {
216
- let i = e instanceof n ? L(e) : e instanceof t ? R(e) : z(e), a = /* @__PURE__ */ new Map();
217
- for (let e of i) {
218
- let t = a.get(e.name) ?? 0;
219
- a.set(e.name, t + 1), t > 0 && (e.name = `${e.name}-${t + 1}`);
220
- }
221
- r.staggerDelays && i.forEach((e, t) => {
222
- let n = r.staggerDelays[t];
223
- typeof n == "number" && n > 0 && (e.delay += n);
224
- });
225
- let o = [], s = [];
226
- for (let e of i) {
227
- let t = U(e, r, o);
228
- t && s.push(t);
229
- }
230
- let l = o.length === 0;
231
- if (s.length === 0) return {
232
- css: "",
233
- eligible: l,
234
- refusals: o
235
- };
236
- let u = s.join("\n\n"), d;
237
- try {
238
- d = await c(u, r.printWidth);
239
- } catch {
240
- d = u;
241
- }
242
- return {
243
- css: d,
244
- eligible: l,
245
- refusals: o
246
- };
247
- }
248
- //#endregion
249
- export { F as DEFAULT_DELTA_E_EPSILON, I as DEFAULT_DENSIFY_STOPS, W as compileToCSS };