@mkbabb/keyframes.js 4.4.0 → 5.1.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 +36 -221
- package/dist/animation-BGyzfzBq.js +947 -0
- package/dist/compile-CcSUwM8R.js +276 -0
- package/dist/{waapi-D9MHMm_9.js → delegation-DWwr4IXr.js} +116 -32
- package/dist/{draw-svg-DYRDxBlL.js → draw-svg-GURj9nin.js} +17 -13
- package/dist/easing-registry-DHV2-5gA.js +27 -0
- package/dist/easing-registry-y1p9McFy.js +2 -0
- package/dist/engine/index.d.ts +2873 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine-DEVgCTUy.js +156 -0
- package/dist/engine-DrBtsKaf.js +4 -0
- package/dist/{format-BUgCTjmr.js → format-C-Gi9r7L.js} +4 -4
- package/dist/{scroll-grammar-B4kPvGh5.js → grammar-BLucehC4.js} +1 -1
- package/dist/group-vJcsHKN9.js +360 -0
- package/dist/{ingest-CNM5xkQT.js → ingest-S5hUe20K.js} +62 -56
- package/dist/keyframes.d.ts +585 -989
- package/dist/keyframes.js +188 -129
- package/dist/morph-svg-BToeumw5.js +89 -0
- package/dist/{motion-path-J-RSNmRQ.js → motion-path-pQVbamWT.js} +16 -12
- package/dist/parse-flatten-DRMHFytp.js +2 -0
- package/dist/parse-flatten-ZZUSEQEL.js +63 -0
- package/dist/{animations-5nf2kBkv.js → presets-BG2Fczzq.js} +124 -73
- package/dist/{scheduler-7eIr_q1g.js → scheduler-CUtVnuoU.js} +1 -1
- package/dist/{scroll-scene-CXEgM49Q.js → scroll-CxpYFO4u.js} +50 -46
- package/dist/sequence-C_DCiOIQ.js +708 -0
- package/dist/validate-DDeGnvSt.js +39 -0
- package/package.json +45 -6
- package/dist/animate-CuUJt2Tb.js +0 -26
- package/dist/compile-DgNRG6Lo.js +0 -251
- package/dist/decay-BvNmFk51.js +0 -25
- package/dist/engine-CNHvTgpw.js +0 -1122
- package/dist/errors-W8zkvPw4.js +0 -21
- package/dist/morph-svg-DRjl9Hfz.js +0 -62
- package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
- package/dist/sequence-CF5hazqz.js +0 -198
- package/dist/springTimingFunction-CDHZ00JQ.js +0 -63
- package/dist/timeline-B7SV3T_E.js +0 -442
- package/dist/utils-D7nuAND5.js +0 -97
- package/dist/validate-8r6Yo-uc.js +0 -35
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { n as e } from "./presets-BG2Fczzq.js";
|
|
2
|
+
import { r as t } from "./delegation-DWwr4IXr.js";
|
|
3
|
+
import { t as n } from "./engine-DEVgCTUy.js";
|
|
4
|
+
import { n as r } from "./compile-CcSUwM8R.js";
|
|
5
|
+
import { extractKeyframes as i, parseCSSStylesheet as a } from "@mkbabb/value.js";
|
|
6
|
+
//#region src/animation/validate.ts
|
|
7
|
+
var o = /* @__PURE__ */ e({
|
|
8
|
+
explain: () => u,
|
|
9
|
+
validate: () => c
|
|
10
|
+
}), s = (e) => new n().fromString(e);
|
|
11
|
+
async function c(e, n = {}) {
|
|
12
|
+
let i = s(e), a = [...i.diagnostics], o = a.some((e) => e.code === "PARSE_ERROR" || e.code === "EMPTY_PARSE"), c = e.trim().length > 0 && !o, l = await r([i], n.compile ?? {}), u = t(i);
|
|
13
|
+
return {
|
|
14
|
+
parseable: c,
|
|
15
|
+
eligible: l.eligible,
|
|
16
|
+
refusals: l.refusals,
|
|
17
|
+
diagnostics: a,
|
|
18
|
+
waapi: u
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var l = (e) => {
|
|
22
|
+
try {
|
|
23
|
+
return [...i(a(e)).keys()];
|
|
24
|
+
} catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
async function u(e, t = {}) {
|
|
29
|
+
let n = await c(e, t), r = l(e), i = r.length > 0 ? r.join(", ") : "(no @keyframes block)", a = [];
|
|
30
|
+
a.push(`@keyframes ${i}:`), a.push(` parseable: ${n.parseable ? "yes" : "no"}`), a.push(` compile-eligible: ${n.eligible ? "yes" : "no"}`);
|
|
31
|
+
for (let e of n.refusals) a.push(` – ${e.reason}: ${e.message}`);
|
|
32
|
+
if (a.push(` waapi-eligible: ${n.waapi.eligible ? "yes" : "no"}`), n.waapi.eligible || a.push(` – ${n.waapi.reason}`), n.diagnostics.length > 0) {
|
|
33
|
+
a.push(" diagnostics:");
|
|
34
|
+
for (let e of n.diagnostics) a.push(` – ${e.code}: ${e.message}`);
|
|
35
|
+
}
|
|
36
|
+
return a.join("\n");
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { c as n, o as r, u as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkbabb/keyframes.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.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": [
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"types": "./dist/keyframes.d.ts",
|
|
24
24
|
"import": "./dist/keyframes.js",
|
|
25
25
|
"default": "./dist/keyframes.js"
|
|
26
|
+
},
|
|
27
|
+
"./engine": {
|
|
28
|
+
"types": "./dist/engine/index.d.ts",
|
|
29
|
+
"import": "./dist/engine/index.js",
|
|
30
|
+
"default": "./dist/engine/index.js"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"files": [
|
|
@@ -42,16 +47,21 @@
|
|
|
42
47
|
"gh-pages": "vite build --mode gh-pages",
|
|
43
48
|
"proof:boundary": "node scripts/proof-boundary.mjs",
|
|
44
49
|
"proof:published-surface": "node scripts/proof-published-surface.mjs",
|
|
50
|
+
"proof:alias-dropped": "node scripts/proof-alias-dropped.mjs",
|
|
51
|
+
"proof:changelog-5": "node scripts/proof-changelog-5.mjs",
|
|
45
52
|
"proof:agent-surface": "node scripts/proof-agent-surface.mjs",
|
|
53
|
+
"proof:in-is-importable": "node scripts/proof-in-is-importable.mjs",
|
|
46
54
|
"proof:agent-validate": "node scripts/proof-agent-validate.mjs && vitest run test/agent-validate.test.ts",
|
|
47
55
|
"proof:demo-on-published-surface": "node scripts/proof-demo-on-published-surface.mjs",
|
|
48
56
|
"proof:color-fidelity": "node scripts/proof-color-fidelity.mjs && vitest run test/color-fidelity.test.ts",
|
|
49
57
|
"proof:readme-runs": "node scripts/proof-readme-runs.mjs",
|
|
58
|
+
"proof:readme-paths-live": "node scripts/proof-readme-paths-live.mjs",
|
|
50
59
|
"proof:deps-current": "node scripts/proof-deps-current.mjs",
|
|
51
60
|
"proof:repin-witness": "node scripts/proof-repin-witness.mjs",
|
|
52
61
|
"proof:dogfood": "node scripts/proof-dogfood.mjs",
|
|
53
62
|
"proof:engine": "node scripts/proof-engine.mjs",
|
|
54
63
|
"proof:decomposition": "node scripts/proof-decomposition.mjs",
|
|
64
|
+
"proof:no-flat-siblings": "node scripts/proof-no-flat-siblings.mjs",
|
|
55
65
|
"proof:idioms": "node scripts/proof-idioms.mjs",
|
|
56
66
|
"proof:brittleness": "node scripts/proof-brittleness.mjs",
|
|
57
67
|
"proof:modern-web": "node scripts/proof-modern-web.mjs",
|
|
@@ -137,6 +147,7 @@
|
|
|
137
147
|
"proof:single-writer": "node scripts/proof-single-writer.mjs",
|
|
138
148
|
"proof:composable-encapsulation": "node scripts/proof-composable-encapsulation.mjs",
|
|
139
149
|
"proof:demo-no-oversize": "node scripts/proof-demo-no-oversize.mjs",
|
|
150
|
+
"proof:scene-colocated": "node scripts/proof-scene-colocated.mjs",
|
|
140
151
|
"proof:no-brittle-selector": "node scripts/proof-no-brittle-selector.mjs",
|
|
141
152
|
"proof:no-dup-utility": "node scripts/proof-no-dup-utility.mjs",
|
|
142
153
|
"proof:cartoon-is-panel-depth": "node scripts/proof-cartoon-is-panel-depth.mjs",
|
|
@@ -184,9 +195,7 @@
|
|
|
184
195
|
"proof:css-parity": "node scripts/proof-css-parity.mjs",
|
|
185
196
|
"proof:packrat-sound": "node scripts/proof-packrat-sound.mjs",
|
|
186
197
|
"proof:consume-bundle": "node scripts/proof-consume-bundle.mjs",
|
|
187
|
-
"proof:keyframes-vue-published": "node scripts/proof-keyframes-vue-published.mjs",
|
|
188
198
|
"proof:workaround-deletion": "node scripts/proof-workaround-deletion.mjs",
|
|
189
|
-
"proof:control-point-live": "node scripts/proof-control-point-live.mjs",
|
|
190
199
|
"proof:settle-is-predicate": "node scripts/proof-settle-is-predicate.mjs",
|
|
191
200
|
"proof:manifest-sourced": "node scripts/proof-manifest-sourced.mjs",
|
|
192
201
|
"proof:chronic-closure": "node scripts/proof-chronic-closure.mjs",
|
|
@@ -195,8 +204,36 @@
|
|
|
195
204
|
"proof:emerging-css-resolve-now": "node scripts/proof-emerging-css-resolve-now.mjs && vitest run test/emerging-css-resolve-now.test.ts",
|
|
196
205
|
"proof:morphsvg-consume": "node scripts/proof-morphsvg-consume.mjs && vitest run test/morph-svg.test.ts",
|
|
197
206
|
"proof:portable-perf": "node scripts/proof-portable-perf.mjs",
|
|
198
|
-
"proof:
|
|
199
|
-
"proof:
|
|
207
|
+
"proof:spring-heatmap": "node scripts/proof-spring-heatmap.mjs",
|
|
208
|
+
"proof:record-truth": "node scripts/proof-record-truth.mjs",
|
|
209
|
+
"proof:lint-clean": "node scripts/proof-lint-clean.mjs",
|
|
210
|
+
"proof:no-silent-fallback": "node scripts/proof-no-silent-fallback.mjs",
|
|
211
|
+
"lint": "depcruise src --ignore-known",
|
|
212
|
+
"proof:drag2d-light-certified": "node scripts/proof-drag2d-light-certified.mjs",
|
|
213
|
+
"proof:published-on-master": "node scripts/proof-published-on-master.mjs",
|
|
214
|
+
"proof:deploy-roundtrip": "node scripts/proof-deploy-roundtrip.mjs",
|
|
215
|
+
"proof:wave-charter": "node scripts/proof-wave-charter.mjs",
|
|
216
|
+
"proof:pin-ledger-current": "node scripts/proof-pin-ledger-current.mjs",
|
|
217
|
+
"proof:emerging-css-resolve-p2": "node scripts/proof-emerging-css-resolve-p2.mjs && vitest run test/emerging-css-resolve-p2.test.ts",
|
|
218
|
+
"proof:processframe-soa": "node scripts/proof-processframe-soa.mjs",
|
|
219
|
+
"proof:nan-frame": "node scripts/proof-nan-frame.mjs && vitest run test/nan-frame.test.ts",
|
|
220
|
+
"proof:waapi-adaptive-densify": "node scripts/proof-waapi-adaptive-densify.mjs",
|
|
221
|
+
"proof:grammar-fuzz": "node scripts/proof-grammar-fuzz.mjs && vitest run test/grammar-fuzz.test.ts",
|
|
222
|
+
"proof:kf-differential": "node scripts/proof-kf-differential.mjs",
|
|
223
|
+
"proof:demo-control-point": "node scripts/proof-demo-control-point.mjs",
|
|
224
|
+
"proof:easing-curve-editor": "node scripts/proof-easing-curve-editor.mjs",
|
|
225
|
+
"proof:scene-switcher-mobile": "node scripts/proof-scene-switcher-mobile.mjs",
|
|
226
|
+
"proof:amiga-decay-visible": "node scripts/proof-amiga-decay-visible.mjs",
|
|
227
|
+
"proof:morph-renders-d": "node scripts/proof-morph-renders-d.mjs && vitest run test/morph-svg.test.ts",
|
|
228
|
+
"proof:morph-orients": "node scripts/proof-morph-orients.mjs && vitest run test/morph-svg.test.ts",
|
|
229
|
+
"proof:morph-scene": "node scripts/proof-morph-scene.mjs",
|
|
230
|
+
"proof:emerging-css-resolve-fn": "node scripts/proof-emerging-css-resolve-fn.mjs && vitest run test/emerging-css-resolve-fn.test.ts",
|
|
231
|
+
"proof:no-cross-realm-cast": "node scripts/proof-no-cross-realm-cast.mjs",
|
|
232
|
+
"proof:color-soa": "node scripts/proof-color-soa.mjs",
|
|
233
|
+
"proof:glassui-aria-ask": "node scripts/proof-glassui-aria-ask.mjs",
|
|
234
|
+
"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",
|
|
235
|
+
"proof:hygiene": "node scripts/run-all.mjs --tier=proof:hygiene-chain",
|
|
236
|
+
"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-flat-siblings && 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:scene-colocated && 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:in-is-importable && 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:readme-paths-live && 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:no-silent-fallback && 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",
|
|
200
237
|
"proof:all": "node scripts/run-all.mjs --all",
|
|
201
238
|
"proof:all:demo": "npm run proof:demo-smoke && npm run proof:occlusion && npm run proof:peer-satisfied",
|
|
202
239
|
"test": "vitest",
|
|
@@ -217,7 +254,7 @@
|
|
|
217
254
|
},
|
|
218
255
|
"homepage": "https://github.com/mkbabb/keyframes.js#readme",
|
|
219
256
|
"dependencies": {
|
|
220
|
-
"@mkbabb/value.js": "^1.
|
|
257
|
+
"@mkbabb/value.js": "^1.2.0"
|
|
221
258
|
},
|
|
222
259
|
"optionalDependencies": {
|
|
223
260
|
"@mkbabb/glass-ui": "~4.0.0"
|
|
@@ -237,7 +274,9 @@
|
|
|
237
274
|
"@vueuse/core": "^14.3.0",
|
|
238
275
|
"class-variance-authority": "^0.7.1",
|
|
239
276
|
"clsx": "^2.1.1",
|
|
277
|
+
"dependency-cruiser": "^17.4.3",
|
|
240
278
|
"embla-carousel-vue": "^8.6.0",
|
|
279
|
+
"fast-check": "^3.23.2",
|
|
241
280
|
"highlight.js": "^11.11.1",
|
|
242
281
|
"html2canvas": "^1.4.1",
|
|
243
282
|
"jsdom": "^29.1.1",
|
package/dist/animate-CuUJt2Tb.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./sequence-CF5hazqz.js";
|
|
2
|
-
import { AnimationGroup as t, CSSKeyframesAnimation as n } from "./engine-CNHvTgpw.js";
|
|
3
|
-
import { fromMotionPath as r } from "./motion-path-J-RSNmRQ.js";
|
|
4
|
-
//#region src/animation/animate.ts
|
|
5
|
-
var i = (e) => typeof e == "object" && !!e && !Array.isArray(e) && !(e instanceof Map) && typeof e.path == "string", a = (e) => e instanceof Map || typeof e == "object" && !!e && !Array.isArray(e);
|
|
6
|
-
function o(o, s, c) {
|
|
7
|
-
let { transform: l, autoPlay: u = !0, ...d } = c ?? {};
|
|
8
|
-
if (s instanceof t || s instanceof e) {
|
|
9
|
-
let e = Array.isArray(o) ? o : [o];
|
|
10
|
-
return s.setTargets?.(...e), u && s.play(), s;
|
|
11
|
-
}
|
|
12
|
-
if (i(s)) return r(o, {
|
|
13
|
-
...s,
|
|
14
|
-
...d,
|
|
15
|
-
autoPlay: u
|
|
16
|
-
});
|
|
17
|
-
let f = new n(d);
|
|
18
|
-
if (typeof s == "string") f.fromString(s, l);
|
|
19
|
-
else if (Array.isArray(s)) f.fromVars(s, l);
|
|
20
|
-
else if (a(s)) f.fromKeyframes(s, l);
|
|
21
|
-
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 }).");
|
|
22
|
-
let p = Array.isArray(o) ? o : [o];
|
|
23
|
-
return f.setTargets(...p), u && f.play(), f;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { o as animate };
|
package/dist/compile-DgNRG6Lo.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./sequence-CF5hazqz.js";
|
|
2
|
-
import { AnimationGroup as t, getAnimationId as n } from "./engine-CNHvTgpw.js";
|
|
3
|
-
import { a as r, i, n as a, t as o } from "./format-BUgCTjmr.js";
|
|
4
|
-
import { a as s } from "./scroll-grammar-B4kPvGh5.js";
|
|
5
|
-
import { COLOR_SPACE_RANGES as c, color2 as l, deltaEOK as u, formatCSS as d, normalizeColorUnit as f, reverseCSSTime as p, sampleColorRamp as m, scale as h } from "@mkbabb/value.js";
|
|
6
|
-
//#region src/animation/compile-color.ts
|
|
7
|
-
var g = c.oklab.a.number.min, _ = c.oklab.a.number.max, v = c.oklab.b.number.min, y = c.oklab.b.number.max, b = (e) => Math.round(e * 1e4) / 1e4, x = (e) => typeof e == "object" && !!e && e.unit === "color", S = (e) => f(e).value, C = (e) => {
|
|
8
|
-
let t = l(e, "oklab");
|
|
9
|
-
return [
|
|
10
|
-
t.l,
|
|
11
|
-
h(t.a, 0, 1, g, _),
|
|
12
|
-
h(t.b, 0, 1, v, y)
|
|
13
|
-
];
|
|
14
|
-
}, w = (e) => {
|
|
15
|
-
let [t, n, r] = C(e);
|
|
16
|
-
return `oklab(${b(t)} ${b(n)} ${b(r)})`;
|
|
17
|
-
}, T = (e, t) => {
|
|
18
|
-
let [n, r, i] = C(e), [a, o, s] = C(t);
|
|
19
|
-
return u(n, r, i, a, o, s);
|
|
20
|
-
}, E = (e, t, n) => l({
|
|
21
|
-
colorSpace: "oklab",
|
|
22
|
-
l: e,
|
|
23
|
-
a: h(t, g, _, 0, 1),
|
|
24
|
-
b: h(n, v, y, 0, 1),
|
|
25
|
-
alpha: 1
|
|
26
|
-
}, "oklab"), D = (e, t) => {
|
|
27
|
-
let [n, r, i] = C(e), [a, o, s] = C(t);
|
|
28
|
-
return E((n + a) / 2, (r + o) / 2, (i + s) / 2);
|
|
29
|
-
}, O = (e) => {
|
|
30
|
-
let t = /([\d.]+)\s*%/.exec(e.toString());
|
|
31
|
-
return t ? parseFloat(t[1]) : 0;
|
|
32
|
-
}, k = (e, t, n) => {
|
|
33
|
-
let r = (e.parsedVars[t] ?? {})[n];
|
|
34
|
-
if (Array.isArray(r)) return r.find((e) => x(e));
|
|
35
|
-
};
|
|
36
|
-
function A(e, t, n, r, i) {
|
|
37
|
-
let a = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), o = [], s = 0;
|
|
38
|
-
for (let a = 0; a + 1 < e.templateFrames.length; a++) {
|
|
39
|
-
let c = k(e, a, t), l = k(e, a + 1, t);
|
|
40
|
-
if (!c || !l) continue;
|
|
41
|
-
let u = O(e.templateFrames[a].start), d = O(e.templateFrames[a + 1].start);
|
|
42
|
-
if (c.toString() === l.toString()) {
|
|
43
|
-
o.push({
|
|
44
|
-
pct: u,
|
|
45
|
-
css: c.toString()
|
|
46
|
-
});
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
let f = S(c), p = S(l), h = m(f, p, n, {
|
|
50
|
-
space: r,
|
|
51
|
-
...i
|
|
52
|
-
});
|
|
53
|
-
for (let e = 0; e < h.length; e++) {
|
|
54
|
-
let t = e / (h.length - 1), n = u + (d - u) * t;
|
|
55
|
-
o.push({
|
|
56
|
-
pct: b(n),
|
|
57
|
-
css: w(h[e])
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
for (let e = 0; e + 1 < h.length; e++) {
|
|
61
|
-
let t = (e + .5) / (h.length - 1), n = m(f, p, 1024, {
|
|
62
|
-
space: r,
|
|
63
|
-
...i
|
|
64
|
-
})[Math.round(t * 1023)], a = D(h[e], h[e + 1]);
|
|
65
|
-
s = Math.max(s, T(a, n));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
let c = e.templateFrames.length - 1, l = k(e, c, t);
|
|
69
|
-
if (l) {
|
|
70
|
-
let t = O(e.templateFrames[c].start);
|
|
71
|
-
o[o.length - 1]?.pct !== t && o.push({
|
|
72
|
-
pct: t,
|
|
73
|
-
css: l.toString()
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
cssProp: a,
|
|
78
|
-
stops: o,
|
|
79
|
-
worstDelta: s
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function j(e, t, n, r) {
|
|
83
|
-
let i = [], a = /* @__PURE__ */ new Set();
|
|
84
|
-
for (let t = 0; t + 1 < e.templateFrames.length; t++) {
|
|
85
|
-
let n = e.parsedVars[t] ?? {};
|
|
86
|
-
for (let [r, o] of Object.entries(n)) {
|
|
87
|
-
if (a.has(r) || !Array.isArray(o) || !o.some((e) => x(e))) continue;
|
|
88
|
-
let n = k(e, t, r), s = k(e, t + 1, r);
|
|
89
|
-
n && s && n.toString() !== s.toString() && (i.push(r), a.add(r));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (i.length === 0) return null;
|
|
93
|
-
let o = Math.max(3, n), s = e.options.colorSpace === "oklch" ? "oklch" : "oklab", c = e.options.hueMethod ? { hueMethod: e.options.hueMethod } : {}, l = 0, u = /* @__PURE__ */ new Map(), d = [];
|
|
94
|
-
for (let t of i) {
|
|
95
|
-
let n = A(e, t, o, s, c);
|
|
96
|
-
l = Math.max(l, n.worstDelta);
|
|
97
|
-
for (let { pct: e, css: t } of n.stops) {
|
|
98
|
-
let r = u.get(e);
|
|
99
|
-
r || (r = [], u.set(e, r), d.push(e)), r.push(`${n.cssProp}: ${t};`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (l > r) return {
|
|
103
|
-
refused: !0,
|
|
104
|
-
delta: l
|
|
105
|
-
};
|
|
106
|
-
d.sort((e, t) => e - t);
|
|
107
|
-
let f = "";
|
|
108
|
-
for (let e of d) {
|
|
109
|
-
let t = u.get(e);
|
|
110
|
-
f += `${e}% {\n ${t.join("\n ")}\n}\n`;
|
|
111
|
-
}
|
|
112
|
-
return { block: `@keyframes ${t} {\n${f}}` };
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/animation/compile.ts
|
|
116
|
-
var M = .04, N = 16;
|
|
117
|
-
function P(e) {
|
|
118
|
-
let t = [];
|
|
119
|
-
for (let r of Object.keys(e.animations)) {
|
|
120
|
-
let i = e.animations[r], a = i.layer.blendMode, o = a === "weighted" && i.layer.weightSpring != null, s = a === "weighted" && i.layer.weightSpring == null, c = a === "add" ? "add" : s ? "accumulate" : "replace";
|
|
121
|
-
t.push({
|
|
122
|
-
animation: i.animation,
|
|
123
|
-
name: L(n(i.animation)),
|
|
124
|
-
composition: c,
|
|
125
|
-
weighted: o,
|
|
126
|
-
...s ? { staticWeight: i.layer.weight } : {},
|
|
127
|
-
delay: 0
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return t;
|
|
131
|
-
}
|
|
132
|
-
function F(e) {
|
|
133
|
-
return e.entries.map((e) => ({
|
|
134
|
-
animation: e.animation,
|
|
135
|
-
name: L(n(e.animation)),
|
|
136
|
-
composition: "replace",
|
|
137
|
-
weighted: !1,
|
|
138
|
-
delay: e.at
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
function I(e) {
|
|
142
|
-
return e.map((e, t) => {
|
|
143
|
-
let r = "animation" in e ? e.animation : e;
|
|
144
|
-
return {
|
|
145
|
-
animation: r,
|
|
146
|
-
name: L(n(r) || `anim-${t}`),
|
|
147
|
-
composition: "replace",
|
|
148
|
-
weighted: !1,
|
|
149
|
-
delay: 0
|
|
150
|
-
};
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function L(e) {
|
|
154
|
-
let t = e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
155
|
-
return /^[a-zA-Z_]/.test(t) ? t : `a${t}`;
|
|
156
|
-
}
|
|
157
|
-
function R(e) {
|
|
158
|
-
for (let t = 0; t < e.templateFrames.length; t++) {
|
|
159
|
-
let n = e.parsedVars[t] ?? {};
|
|
160
|
-
for (let [e, t] of Object.entries(n)) if (!Array.isArray(t) || t.length === 0) return e;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function z(e, t, n) {
|
|
164
|
-
let { animation: s, name: c } = e;
|
|
165
|
-
if (e.weighted) return n.push({
|
|
166
|
-
name: c,
|
|
167
|
-
reason: "weighted-blend",
|
|
168
|
-
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"
|
|
169
|
-
}), null;
|
|
170
|
-
for (let e of s.frames) if (!s.usesDefaultRenderer(e.transform)) return n.push({
|
|
171
|
-
name: c,
|
|
172
|
-
reason: "custom-renderer",
|
|
173
|
-
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"
|
|
174
|
-
}), null;
|
|
175
|
-
let l = R(s);
|
|
176
|
-
if (l) return n.push({
|
|
177
|
-
name: c,
|
|
178
|
-
reason: "computed-unit-drift",
|
|
179
|
-
message: `computed-unit drift on "${l}" — the declared value cannot be re-emitted as a faithful authored string; the JS playback is the only faithful path`
|
|
180
|
-
}), null;
|
|
181
|
-
let u = j(s, c, t.densifyStops ?? 16, t.deltaEEpsilon ?? .04);
|
|
182
|
-
if (u && "refused" in u) return n.push({
|
|
183
|
-
name: c,
|
|
184
|
-
reason: "perceptual-oklab",
|
|
185
|
-
message: `perceptual oklab color track exceeds the densify ΔE-ε threshold (ΔE ${b(u.delta)} > ${t.deltaEEpsilon ?? .04}) — a faithful pure-CSS twin is not available; the JS playback is the only faithful path`
|
|
186
|
-
}), null;
|
|
187
|
-
let d;
|
|
188
|
-
if (e.staticWeight != null) {
|
|
189
|
-
let t = r(s, c, e.staticWeight);
|
|
190
|
-
if ("refused" in t) return n.push({
|
|
191
|
-
name: c,
|
|
192
|
-
reason: "weighted-blend",
|
|
193
|
-
message: `static-weight pre-multiply cannot scale the non-numeric leaf "${t.key}" (a color/string has no scalar weight) — the weighted blend is kf's unique tier; the JS playback is the only faithful path`
|
|
194
|
-
}), null;
|
|
195
|
-
d = t.block;
|
|
196
|
-
}
|
|
197
|
-
let f = d ?? (u && "block" in u ? u.block : i(s, c)), m;
|
|
198
|
-
try {
|
|
199
|
-
m = a(s.options, c);
|
|
200
|
-
} catch {
|
|
201
|
-
return n.push({
|
|
202
|
-
name: c,
|
|
203
|
-
reason: "custom-renderer",
|
|
204
|
-
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"
|
|
205
|
-
}), null;
|
|
206
|
-
}
|
|
207
|
-
let h = o(e.composition), g = h ? `\n ${h}` : "", _ = e.delay > 0 ? `\n animation-delay: ${p(e.delay)};` : "", v = B(s);
|
|
208
|
-
return `${f}\n\n${`.${c} {\n animation: ${m};${g}${_}${v}\n}`}`;
|
|
209
|
-
}
|
|
210
|
-
function B(e) {
|
|
211
|
-
let t = e.scrollOptions;
|
|
212
|
-
if (t == null) return "";
|
|
213
|
-
let n = s(t), r = "";
|
|
214
|
-
for (let [e, t] of Object.entries(n)) t != null && (r += `\n ${e}: ${t};`);
|
|
215
|
-
return r;
|
|
216
|
-
}
|
|
217
|
-
async function V(n, r = {}) {
|
|
218
|
-
let i = n instanceof t ? P(n) : n instanceof e ? F(n) : I(n), a = /* @__PURE__ */ new Map();
|
|
219
|
-
for (let e of i) {
|
|
220
|
-
let t = a.get(e.name) ?? 0;
|
|
221
|
-
a.set(e.name, t + 1), t > 0 && (e.name = `${e.name}-${t + 1}`);
|
|
222
|
-
}
|
|
223
|
-
r.staggerDelays && i.forEach((e, t) => {
|
|
224
|
-
let n = r.staggerDelays[t];
|
|
225
|
-
typeof n == "number" && n > 0 && (e.delay += n);
|
|
226
|
-
});
|
|
227
|
-
let o = [], s = [];
|
|
228
|
-
for (let e of i) {
|
|
229
|
-
let t = z(e, r, o);
|
|
230
|
-
t && s.push(t);
|
|
231
|
-
}
|
|
232
|
-
let c = o.length === 0;
|
|
233
|
-
if (s.length === 0) return {
|
|
234
|
-
css: "",
|
|
235
|
-
eligible: c,
|
|
236
|
-
refusals: o
|
|
237
|
-
};
|
|
238
|
-
let l = s.join("\n\n"), u;
|
|
239
|
-
try {
|
|
240
|
-
u = await d(l, r.printWidth);
|
|
241
|
-
} catch {
|
|
242
|
-
u = l;
|
|
243
|
-
}
|
|
244
|
-
return {
|
|
245
|
-
css: u,
|
|
246
|
-
eligible: c,
|
|
247
|
-
refusals: o
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
//#endregion
|
|
251
|
-
export { M as DEFAULT_DELTA_E_EPSILON, N as DEFAULT_DENSIFY_STOPS, V as compileToCSS };
|
package/dist/decay-BvNmFk51.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/animation/decay.ts
|
|
2
|
-
var e = 5;
|
|
3
|
-
function t(t) {
|
|
4
|
-
let n = t.initial ?? 0, r = t.velocity, i = t.friction ?? e;
|
|
5
|
-
if (i <= 0) throw Error("decay() requires a friction coefficient > 0.");
|
|
6
|
-
let a = n + r / i;
|
|
7
|
-
return (e) => {
|
|
8
|
-
if (e <= 0) return {
|
|
9
|
-
value: n,
|
|
10
|
-
velocity: r
|
|
11
|
-
};
|
|
12
|
-
let t = Math.exp(-i * e);
|
|
13
|
-
return {
|
|
14
|
-
value: a - r / i * t,
|
|
15
|
-
velocity: r * t
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function n(t) {
|
|
20
|
-
let n = t.friction ?? e;
|
|
21
|
-
if (n <= 0) throw Error("decayRest() requires a friction coefficient > 0.");
|
|
22
|
-
return (t.initial ?? 0) + t.velocity / n;
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
export { n, t };
|