@mkbabb/keyframes.js 6.4.0 → 6.6.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 +108 -4
- package/dist/engine/index.d.ts +12 -5
- package/dist/engine/index.js +133 -131
- package/dist/keyframes.d.ts +161 -16
- package/dist/keyframes.js +251 -154
- package/dist/{registry-8bG0FhGi.js → registry-BZOrCZZh.js} +1 -1
- package/dist/{registry-Bs7A0T_s.js → registry-D3fj1upb.js} +1 -1
- package/dist/{sequence-CPGHHEVM.js → sequence-BzJ-b_HG.js} +291 -149
- package/package.json +6 -4
package/dist/engine/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as e,
|
|
2
|
-
import { C as v, E as y, S as b, T as x, _ as te, a as ne, b as re, c as ie, d as ae, f as oe, g as se, h as ce, i as le, l as ue, m as de, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as ye, w as be, x as xe, y as S } from "../registry-
|
|
1
|
+
import { C as e, M as t, O as n, P as r, T as i, b as a, c as o, d as s, g as c, i as l, k as u, l as d, n as f, o as p, r as m, s as h, t as ee, w as g, x as _ } from "../sequence-BzJ-b_HG.js";
|
|
2
|
+
import { C as v, E as y, S as b, T as x, _ as te, a as ne, b as re, c as ie, d as ae, f as oe, g as se, h as ce, i as le, l as ue, m as de, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as ye, w as be, x as xe, y as S } from "../registry-BZOrCZZh.js";
|
|
3
3
|
import { clamp as Se, lerp as C, lerpArray as Ce, scale as we } from "@mkbabb/value.js/math";
|
|
4
4
|
import { easeInOutCubic as Te } from "@mkbabb/value.js/easing";
|
|
5
5
|
import { convertColor as Ee, mixColors as De, oklab as Oe } from "@mkbabb/value.js/color";
|
|
@@ -701,24 +701,24 @@ var Lt = (e) => {
|
|
|
701
701
|
to: i,
|
|
702
702
|
out: new Float64Array(t.length)
|
|
703
703
|
};
|
|
704
|
-
}, zt = (
|
|
705
|
-
if (typeof
|
|
706
|
-
if (typeof
|
|
707
|
-
if (typeof
|
|
708
|
-
throw new t(
|
|
709
|
-
}
|
|
710
|
-
if (typeof
|
|
711
|
-
let
|
|
704
|
+
}, zt = (e, n) => {
|
|
705
|
+
if (typeof n == "function") return { fn: n };
|
|
706
|
+
if (typeof n == "object") {
|
|
707
|
+
if (typeof n.fn == "function") return n;
|
|
708
|
+
throw new t(e, n, "an Easing must carry a callable `fn`");
|
|
709
|
+
}
|
|
710
|
+
if (typeof n != "string") throw new t(e, n, "a timing-function name or CSS timing-function literal must be a string");
|
|
711
|
+
let r;
|
|
712
712
|
try {
|
|
713
|
-
|
|
713
|
+
r = _e(n);
|
|
714
714
|
} catch {
|
|
715
|
-
throw new t(
|
|
715
|
+
throw new t(e, n, "unknown timing function — pass a callable TimingFunction, a typed Easing, a registry name, or a cubic-bezier() literal", "UNKNOWN_TIMING_FN");
|
|
716
716
|
}
|
|
717
|
-
let
|
|
718
|
-
return
|
|
719
|
-
fn:
|
|
720
|
-
css:
|
|
721
|
-
} : { fn:
|
|
717
|
+
let i = u(n);
|
|
718
|
+
return i ? {
|
|
719
|
+
fn: r,
|
|
720
|
+
css: i
|
|
721
|
+
} : { fn: r };
|
|
722
722
|
};
|
|
723
723
|
//#endregion
|
|
724
724
|
//#region src/animation/compile/frame/compiler.ts
|
|
@@ -859,14 +859,14 @@ function Kt(e) {
|
|
|
859
859
|
//#endregion
|
|
860
860
|
//#region src/animation/engine/play-lifecycle/transport.ts
|
|
861
861
|
function qt(e) {
|
|
862
|
-
e._playback.started && (e._playback.paused = !0);
|
|
862
|
+
e._playback.started && (e._playback.paused = !0, e._playback.anchorTick = void 0);
|
|
863
863
|
}
|
|
864
864
|
function Jt(e) {
|
|
865
865
|
if (e._playback.started && e._playback.paused) if (e._playback.paused = !1, e._playback._waAnimations.length > 0) for (let t of e._playback._waAnimations) t.play();
|
|
866
866
|
else e.playback.running || e.playback.loop(e._playback._boundFrame);
|
|
867
867
|
}
|
|
868
868
|
function Yt(e) {
|
|
869
|
-
|
|
869
|
+
l(e._playback, () => qt(e), () => Jt(e));
|
|
870
870
|
}
|
|
871
871
|
function Xt(e) {
|
|
872
872
|
tn(e), e.playback.stop(), N(e), en(e);
|
|
@@ -1037,21 +1037,21 @@ function hn(e, t, n) {
|
|
|
1037
1037
|
//#endregion
|
|
1038
1038
|
//#region src/animation/waapi/emission.ts
|
|
1039
1039
|
function gn(e) {
|
|
1040
|
-
let t = e.options.duration, n = [], r = e.frames.length > 1,
|
|
1041
|
-
if (r && !
|
|
1042
|
-
let
|
|
1043
|
-
for (let t of e.frames)
|
|
1044
|
-
let
|
|
1045
|
-
if (
|
|
1046
|
-
let
|
|
1047
|
-
for (let r of [...
|
|
1048
|
-
let
|
|
1049
|
-
if (Object.keys(
|
|
1050
|
-
let
|
|
1051
|
-
offset:
|
|
1052
|
-
...
|
|
1040
|
+
let t = e.options.duration, n = [], r = e.frames.length > 1, a = r && dn(e), o = r && !a ? e.frames[0]?.timingFunction.css : void 0;
|
|
1041
|
+
if (r && !a && o === void 0) throw TypeError("A multi-segment structural WAAPI animation requires a faithful CSS easing.");
|
|
1042
|
+
let s = /* @__PURE__ */ new Set();
|
|
1043
|
+
for (let t of e.frames) s.add(t.time.start), s.add(t.time.stop);
|
|
1044
|
+
let c = [...s].sort((e, t) => e - t), l = new Set(c);
|
|
1045
|
+
if (a) for (let n of hn(e, c, t)) l.add(n);
|
|
1046
|
+
let u = c.at(-1);
|
|
1047
|
+
for (let r of [...l].sort((e, t) => e - t)) {
|
|
1048
|
+
let a = e.interpFrames(r, !1);
|
|
1049
|
+
if (Object.keys(a).length === 0) continue;
|
|
1050
|
+
let s = {
|
|
1051
|
+
offset: i(r / t, 0, 1),
|
|
1052
|
+
...a
|
|
1053
1053
|
};
|
|
1054
|
-
|
|
1054
|
+
o !== void 0 && r !== u && (s.easing = o), n.push(s);
|
|
1055
1055
|
}
|
|
1056
1056
|
return n;
|
|
1057
1057
|
}
|
|
@@ -1094,27 +1094,27 @@ function xn(e) {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
//#endregion
|
|
1096
1096
|
//#region src/animation/waapi/delegation.ts
|
|
1097
|
-
async function Sn(
|
|
1098
|
-
let
|
|
1099
|
-
|
|
1097
|
+
async function Sn(t, n) {
|
|
1098
|
+
let r = gn(t), i = xn(t), a = t.targets.map((e) => e.animate(r, i));
|
|
1099
|
+
t._playback._waAnimations = a;
|
|
1100
1100
|
let o = () => {
|
|
1101
|
-
if (!
|
|
1102
|
-
for (let
|
|
1103
|
-
|
|
1101
|
+
if (!t.paused) {
|
|
1102
|
+
for (let e of a) if (e.playState === "paused") {
|
|
1103
|
+
t.pause();
|
|
1104
1104
|
break;
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
|
-
if (
|
|
1108
|
-
return !
|
|
1107
|
+
if (t.paused) for (let e of a) e.pause();
|
|
1108
|
+
return !t.done;
|
|
1109
1109
|
};
|
|
1110
|
-
|
|
1110
|
+
t.playback.loop((r) => t.done ? !1 : e(t.options.respectReducedMotion, () => !0, () => !1) ? (n.snapToReducedMotion(), !1) : (t.advanceTo(r), o()));
|
|
1111
1111
|
try {
|
|
1112
1112
|
await Promise.all(a.map((e) => e.finished));
|
|
1113
|
-
for (let
|
|
1114
|
-
|
|
1113
|
+
for (let e of a) try {
|
|
1114
|
+
t.restPosition === "final" && typeof e.commitStyles == "function" && e.commitStyles(), e.cancel();
|
|
1115
1115
|
} catch {}
|
|
1116
1116
|
} catch {} finally {
|
|
1117
|
-
|
|
1117
|
+
t.playback.stop(), t._playback._waAnimations = [];
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
1120
|
function Cn(e, t, n) {
|
|
@@ -1153,14 +1153,14 @@ async function En(e) {
|
|
|
1153
1153
|
function Dn(e) {
|
|
1154
1154
|
tn(e), e.fillForwards(), e._playback.iteration = 0, e._playback.done = !0, e.dispatchAnimationEvent("animationend"), N(e), en(e);
|
|
1155
1155
|
}
|
|
1156
|
-
async function On(
|
|
1157
|
-
if (
|
|
1158
|
-
return
|
|
1159
|
-
if (
|
|
1160
|
-
let
|
|
1161
|
-
return
|
|
1156
|
+
async function On(t) {
|
|
1157
|
+
if (t.managed) throw Error("Animation.play() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play() instead.");
|
|
1158
|
+
return t.assertNoUnresolvedNamedSelector(), f(t._playback, () => e(t.options.respectReducedMotion, () => (t.waapiIneligibleReason = void 0, En(t)), () => {
|
|
1159
|
+
if (t.options.useWAAPI) {
|
|
1160
|
+
let e = P(t);
|
|
1161
|
+
return e.eligible ? (t.waapiIneligibleReason = void 0, Tn(t)) : (t.waapiIneligibleReason = e.reason, wn(t));
|
|
1162
1162
|
}
|
|
1163
|
-
return
|
|
1163
|
+
return t.waapiIneligibleReason = void 0, wn(t);
|
|
1164
1164
|
}));
|
|
1165
1165
|
}
|
|
1166
1166
|
//#endregion
|
|
@@ -1207,8 +1207,8 @@ function Fn(e, t, n) {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
return e._playback.t;
|
|
1209
1209
|
}
|
|
1210
|
-
function In(
|
|
1211
|
-
return
|
|
1210
|
+
function In(t, n) {
|
|
1211
|
+
return e(t.options.respectReducedMotion, () => !0, () => !1) ? (Dn(t), !1) : (Pn(t, n), Ln(t, t.advanceTo(n)));
|
|
1212
1212
|
}
|
|
1213
1213
|
function Ln(e, t) {
|
|
1214
1214
|
return e._playback.paused ? !1 : e._playback.done ? (N(e), en(e), !1) : (e.interpFrames(t, !0, e._playback._interpOut), !0);
|
|
@@ -1310,12 +1310,12 @@ function Yn(e, t, n = !1) {
|
|
|
1310
1310
|
let i = I(e, Se(t, 0, 1) * e.options.duration, n);
|
|
1311
1311
|
return e._playback.reversed = r, i;
|
|
1312
1312
|
}
|
|
1313
|
-
function I(e, t,
|
|
1313
|
+
function I(e, t, r = !1, i) {
|
|
1314
1314
|
let a = t < 0;
|
|
1315
1315
|
a && (t = 0);
|
|
1316
1316
|
let o = e.options.fillMode === "backwards" || e.options.fillMode === "both";
|
|
1317
1317
|
t = e._playback.reversed ? e.options.duration - t : t;
|
|
1318
|
-
let s = e.frames, c = s.length, l = a && !o ? -1 :
|
|
1318
|
+
let s = e.frames, c = s.length, l = a && !o ? -1 : n(s, t, (e) => e.time.start, (e) => e.time.stop);
|
|
1319
1319
|
if (l === -1) return i === void 0 ? {} : (Xn(e, i), i);
|
|
1320
1320
|
let u = l, d = l;
|
|
1321
1321
|
for (let e = l - 1; e >= 0; e--) {
|
|
@@ -1328,7 +1328,7 @@ function I(e, t, n = !1, i) {
|
|
|
1328
1328
|
if (t < n.time.start || t > n.time.stop) break;
|
|
1329
1329
|
d = e;
|
|
1330
1330
|
}
|
|
1331
|
-
for (let
|
|
1331
|
+
for (let n = u; n <= d; n++) Zn(e, s[n], t, r);
|
|
1332
1332
|
if (u === d) {
|
|
1333
1333
|
let t = s[l].flatVars;
|
|
1334
1334
|
return i === void 0 ? t : (Xn(e, i), Object.assign(i, t), i);
|
|
@@ -1377,19 +1377,19 @@ function er(e) {
|
|
|
1377
1377
|
return e == null ? E.timingFunction : zt("timingFunction", e);
|
|
1378
1378
|
}
|
|
1379
1379
|
function tr(e) {
|
|
1380
|
-
return e == null ? E.iterationCount : e === "infinite" || e === "∞" || e === "Infinity" || e === Infinity ? Infinity :
|
|
1380
|
+
return e == null ? E.iterationCount : e === "infinite" || e === "∞" || e === "Infinity" || e === Infinity ? Infinity : r("iterationCount", e, (e) => {
|
|
1381
1381
|
let t = typeof e == "string" ? Number.parseFloat(e.trim()) : e;
|
|
1382
1382
|
return typeof t == "number" && !Number.isNaN(t) && t >= 0 ? t : void 0;
|
|
1383
1383
|
}, "expected a non-negative count, \"infinite\", or Infinity");
|
|
1384
1384
|
}
|
|
1385
1385
|
function nr(e) {
|
|
1386
|
-
if (e != null) return
|
|
1386
|
+
if (e != null) return r("duration", e, (e) => {
|
|
1387
1387
|
let t = typeof e == "string" ? $n(e) : e;
|
|
1388
1388
|
return typeof t == "number" && isFinite(t) && t > 0 ? t : void 0;
|
|
1389
1389
|
}, "expected a positive duration in milliseconds or a CSS time string");
|
|
1390
1390
|
}
|
|
1391
1391
|
function rr(e) {
|
|
1392
|
-
return e == null ? E.delay :
|
|
1392
|
+
return e == null ? E.delay : r("delay", e, (e) => {
|
|
1393
1393
|
let t = typeof e == "string" ? $n(e) : e;
|
|
1394
1394
|
return typeof t == "number" && isFinite(t) ? t : void 0;
|
|
1395
1395
|
}, "expected a delay in milliseconds or a CSS time string");
|
|
@@ -1788,7 +1788,7 @@ var H = (e) => typeof e == "string" ? e : e.name ?? String(e.id), ti = 0, ni = c
|
|
|
1788
1788
|
superKey;
|
|
1789
1789
|
targets;
|
|
1790
1790
|
options;
|
|
1791
|
-
playback = new
|
|
1791
|
+
playback = new _();
|
|
1792
1792
|
_playback;
|
|
1793
1793
|
get startTime() {
|
|
1794
1794
|
return this._playback.startTime;
|
|
@@ -2141,28 +2141,28 @@ var mi = (e) => typeof e != "object" || !e ? !1 : typeof e.clone == "function",
|
|
|
2141
2141
|
}
|
|
2142
2142
|
propertyRegistry = /* @__PURE__ */ new Map();
|
|
2143
2143
|
scrollOptions;
|
|
2144
|
-
fromString(
|
|
2145
|
-
|
|
2146
|
-
let
|
|
2147
|
-
this.propertyRegistry =
|
|
2148
|
-
let
|
|
2149
|
-
|
|
2150
|
-
let
|
|
2151
|
-
Object.keys(
|
|
2152
|
-
...
|
|
2144
|
+
fromString(e, t) {
|
|
2145
|
+
t = this.beginIngest(t);
|
|
2146
|
+
let n = li(e);
|
|
2147
|
+
this.propertyRegistry = n.properties;
|
|
2148
|
+
let r = fi(n.stylesheet);
|
|
2149
|
+
r === void 0 ? delete this.scrollOptions : this.scrollOptions = r, this.diagnostics = [...n.diagnostics];
|
|
2150
|
+
let i = di(n.options);
|
|
2151
|
+
Object.keys(i).length > 0 && this.setOptions({
|
|
2152
|
+
...i,
|
|
2153
2153
|
...this._ctorOptions
|
|
2154
2154
|
});
|
|
2155
|
-
for (let [
|
|
2156
|
-
let
|
|
2157
|
-
if (
|
|
2158
|
-
let
|
|
2159
|
-
|
|
2160
|
-
fn:
|
|
2161
|
-
css:
|
|
2162
|
-
} : { fn:
|
|
2155
|
+
for (let [e, r] of n.keyframes.entries()) {
|
|
2156
|
+
let i = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, mi(t) ? t.clone() : t])), a = n.timingFunctions.get(e), o = a ? _e(a) : void 0, s;
|
|
2157
|
+
if (o) {
|
|
2158
|
+
let e = a ? u(a) : void 0;
|
|
2159
|
+
s = e ? {
|
|
2160
|
+
fn: o,
|
|
2161
|
+
css: e
|
|
2162
|
+
} : { fn: o };
|
|
2163
2163
|
}
|
|
2164
|
-
let
|
|
2165
|
-
this.addFrame(
|
|
2164
|
+
let c = n.composition.get(e);
|
|
2165
|
+
this.addFrame(e, i, t, s, c);
|
|
2166
2166
|
}
|
|
2167
2167
|
return this.parse(), pi(this.propertyRegistry, this.diagnostics), this;
|
|
2168
2168
|
}
|
|
@@ -2281,18 +2281,18 @@ function Oi(e) {
|
|
|
2281
2281
|
let t = e.resolvePromise;
|
|
2282
2282
|
e.resolvePromise = null, t?.();
|
|
2283
2283
|
}
|
|
2284
|
-
async function ki(
|
|
2285
|
-
return
|
|
2286
|
-
let
|
|
2287
|
-
return
|
|
2288
|
-
|
|
2284
|
+
async function ki(t) {
|
|
2285
|
+
return t._playingPromise && t.resolvePromise && !t.started && !t.paused && !t.playback.running && t.playback.loop(t._boundFrame), f(t, () => e(t.respectReducedMotion, () => Ai(t), () => {
|
|
2286
|
+
let e = wi(t);
|
|
2287
|
+
return e && (t._waAnimations.push(...e), t._waapiDelegated = !0), new Promise((e) => {
|
|
2288
|
+
t.resolvePromise = e, t.playback.loop(t._boundFrame);
|
|
2289
2289
|
});
|
|
2290
2290
|
}));
|
|
2291
2291
|
}
|
|
2292
2292
|
function Ai(e) {
|
|
2293
2293
|
e.started = !0;
|
|
2294
2294
|
let t = e.lastTickTime;
|
|
2295
|
-
return yi(e.getEntries()), e.singleTarget && e.render(t), e.settle(), Promise.resolve();
|
|
2295
|
+
return yi(e.getEntries()), e.singleTarget && e.render(t), e.settle(), e._snappedToFinal = !0, Promise.resolve();
|
|
2296
2296
|
}
|
|
2297
2297
|
function ji(e) {
|
|
2298
2298
|
if (!e.started || e.paused) return;
|
|
@@ -2308,7 +2308,7 @@ function Mi(e) {
|
|
|
2308
2308
|
!e.started || !e.paused || (e.paused = !1, bi(e.getEntries(), !1), e._waapiDelegated && Di(e), e.playback.loop(e._boundFrame));
|
|
2309
2309
|
}
|
|
2310
2310
|
function Ni(e) {
|
|
2311
|
-
|
|
2311
|
+
l(e, () => ji(e), () => Mi(e));
|
|
2312
2312
|
}
|
|
2313
2313
|
function Pi(e) {
|
|
2314
2314
|
e._waapiDelegated && Ti(e);
|
|
@@ -2316,11 +2316,12 @@ function Pi(e) {
|
|
|
2316
2316
|
e.started = !1, e.done = !1, e.paused = !1, e.lastTickTime = 0;
|
|
2317
2317
|
}
|
|
2318
2318
|
function Fi(e) {
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2319
|
+
let t = e._snappedToFinal;
|
|
2320
|
+
for (let n of e.getEntries()) {
|
|
2321
|
+
let e = n.animation;
|
|
2322
|
+
(t || e.started || e.t !== 0) && e.frames.length > 0 && e.interpFrames(0, !0);
|
|
2322
2323
|
}
|
|
2323
|
-
e.settle();
|
|
2324
|
+
e.settle(), e._snappedToFinal = !1;
|
|
2324
2325
|
}
|
|
2325
2326
|
function Ii(e) {
|
|
2326
2327
|
e.playback.stop(), e.reset(), Oi(e);
|
|
@@ -2391,7 +2392,7 @@ var Ji = (e, t) => {
|
|
|
2391
2392
|
}, Yi = async (e, t, n) => {
|
|
2392
2393
|
for (let r = 0; r < e.length; r += n) Ji(e.slice(r, r + n), t), r + n < e.length && await qi();
|
|
2393
2394
|
}, Xi = (e, t, n) => {
|
|
2394
|
-
let r = new
|
|
2395
|
+
let r = new c({
|
|
2395
2396
|
...n,
|
|
2396
2397
|
initial: e
|
|
2397
2398
|
});
|
|
@@ -2574,7 +2575,7 @@ function sa(e, t, n) {
|
|
|
2574
2575
|
let r = gi(e.animations, t, "transitionLayer").layer, i = Si(n.weight);
|
|
2575
2576
|
r.op = "replace";
|
|
2576
2577
|
let a = r.weightSpring;
|
|
2577
|
-
a instanceof
|
|
2578
|
+
a instanceof c ? a.target = i : r.weightSpring = Xi(Si(r.weight), i, n.spring), e._hasLayerSprings = !0, e.invalidateEntries();
|
|
2578
2579
|
}
|
|
2579
2580
|
function ca(e, t, n, r) {
|
|
2580
2581
|
let i = r?.spring;
|
|
@@ -2618,9 +2619,10 @@ var la = class e {
|
|
|
2618
2619
|
}
|
|
2619
2620
|
unflatten = !1;
|
|
2620
2621
|
lastTickTime = 0;
|
|
2621
|
-
playback = new
|
|
2622
|
+
playback = new _();
|
|
2622
2623
|
_waAnimations = [];
|
|
2623
2624
|
_waapiDelegated = !1;
|
|
2625
|
+
_snappedToFinal = !1;
|
|
2624
2626
|
resolvePromise = null;
|
|
2625
2627
|
_playingPromise = null;
|
|
2626
2628
|
_boundFrame;
|
|
@@ -3170,7 +3172,7 @@ var Ta = class extends ua {
|
|
|
3170
3172
|
css: ao,
|
|
3171
3173
|
options: {
|
|
3172
3174
|
duration: 900,
|
|
3173
|
-
timingFunction:
|
|
3175
|
+
timingFunction: d(mo),
|
|
3174
3176
|
fillMode: "none"
|
|
3175
3177
|
},
|
|
3176
3178
|
group: "enter"
|
|
@@ -3195,7 +3197,7 @@ var Ta = class extends ua {
|
|
|
3195
3197
|
css: ho.springScaleInKeyframes,
|
|
3196
3198
|
options: {
|
|
3197
3199
|
duration: 600,
|
|
3198
|
-
timingFunction:
|
|
3200
|
+
timingFunction: d(lo)
|
|
3199
3201
|
},
|
|
3200
3202
|
group: "enter"
|
|
3201
3203
|
},
|
|
@@ -3203,7 +3205,7 @@ var Ta = class extends ua {
|
|
|
3203
3205
|
css: ho.springSlideInKeyframes,
|
|
3204
3206
|
options: {
|
|
3205
3207
|
duration: 600,
|
|
3206
|
-
timingFunction:
|
|
3208
|
+
timingFunction: d(co)
|
|
3207
3209
|
},
|
|
3208
3210
|
group: "enter"
|
|
3209
3211
|
},
|
|
@@ -3211,7 +3213,7 @@ var Ta = class extends ua {
|
|
|
3211
3213
|
css: ho.springPopKeyframes,
|
|
3212
3214
|
options: {
|
|
3213
3215
|
duration: 700,
|
|
3214
|
-
timingFunction:
|
|
3216
|
+
timingFunction: d(lo)
|
|
3215
3217
|
},
|
|
3216
3218
|
group: "attention"
|
|
3217
3219
|
},
|
|
@@ -3219,7 +3221,7 @@ var Ta = class extends ua {
|
|
|
3219
3221
|
css: ho.springWobbleKeyframes,
|
|
3220
3222
|
options: {
|
|
3221
3223
|
duration: 800,
|
|
3222
|
-
timingFunction:
|
|
3224
|
+
timingFunction: d(uo)
|
|
3223
3225
|
},
|
|
3224
3226
|
group: "attention"
|
|
3225
3227
|
}
|
|
@@ -3503,22 +3505,22 @@ var ks = class {
|
|
|
3503
3505
|
subscribers = new Map([["enter", /* @__PURE__ */ new Set()], ["leave", /* @__PURE__ */ new Set()]]);
|
|
3504
3506
|
constructor(e = {}) {
|
|
3505
3507
|
if (this.resolvedRange = Os(e.range), this.scrubSeconds = e.scrub ?? 0, this.snapPoints = e.snap != null && e.snap.length > 0 ? e.snap : void 0, this.scrubSeconds > 0) {
|
|
3506
|
-
let t =
|
|
3507
|
-
this.smoother = new
|
|
3508
|
+
let t = i(1 / (this.scrubSeconds * 60 + 1), .01, 1);
|
|
3509
|
+
this.smoother = new a({
|
|
3508
3510
|
damping: t,
|
|
3509
3511
|
clamp: !0,
|
|
3510
3512
|
...e.smoothing
|
|
3511
3513
|
});
|
|
3512
3514
|
}
|
|
3513
|
-
this.snapPoints != null && (this.snapSpring = new
|
|
3515
|
+
this.snapPoints != null && (this.snapSpring = new c({ ...e.snapSpring }));
|
|
3514
3516
|
}
|
|
3515
3517
|
get range() {
|
|
3516
3518
|
return this.resolvedRange;
|
|
3517
3519
|
}
|
|
3518
3520
|
scrollProgress(e) {
|
|
3519
|
-
this.rawScroll =
|
|
3520
|
-
let { start: t, end: n } = this.resolvedRange, r = n - t,
|
|
3521
|
-
return
|
|
3521
|
+
this.rawScroll = i(e, 0, 1);
|
|
3522
|
+
let { start: t, end: n } = this.resolvedRange, r = n - t, a = r > 0 ? i((this.rawScroll - t) / r, 0, 1) : 0, o = this.rawScroll >= t && this.rawScroll <= n;
|
|
3523
|
+
return o && !this.wasInside && this.fire("enter", a), !o && this.wasInside && this.fire("leave", a), this.wasInside = o, this.smoother ? (this.smoother.setTarget(a), this.localProgress = this.smoother.current) : this.localProgress = a, this.localProgress;
|
|
3522
3524
|
}
|
|
3523
3525
|
tick(e) {
|
|
3524
3526
|
return this.smoother && (this.smoother.tickDt(e), this.localProgress = this.smoother.current), this.localProgress;
|
|
@@ -3531,7 +3533,7 @@ var ks = class {
|
|
|
3531
3533
|
}
|
|
3532
3534
|
snapTo(e = 0) {
|
|
3533
3535
|
if (this.snapPoints == null || this.snapSpring == null) return null;
|
|
3534
|
-
let t =
|
|
3536
|
+
let t = i(p({
|
|
3535
3537
|
initial: this.localProgress,
|
|
3536
3538
|
velocity: e
|
|
3537
3539
|
}), 0, 1), n = this.snapPoints[0], r = Math.abs(t - n);
|
|
@@ -3643,22 +3645,22 @@ var Ps = class {
|
|
|
3643
3645
|
return Ns();
|
|
3644
3646
|
}
|
|
3645
3647
|
triggerProgress(e) {
|
|
3646
|
-
let t =
|
|
3648
|
+
let t = i(e, 0, 1), { start: n, end: r } = this.triggerRange, a = r - n, o = a > 0 ? i((t - n) / a, 0, 1) : 0, s = t >= n && t <= r, c = s && !this.wasInside, l = !s && this.wasInside, u = l && t > r;
|
|
3647
3649
|
switch (this.type) {
|
|
3648
3650
|
case "repeat":
|
|
3649
|
-
this.stepRepeat(
|
|
3651
|
+
this.stepRepeat(s, c, l, o);
|
|
3650
3652
|
break;
|
|
3651
3653
|
case "alternate":
|
|
3652
|
-
this.stepAlternate(
|
|
3654
|
+
this.stepAlternate(s, c, l, o);
|
|
3653
3655
|
break;
|
|
3654
3656
|
case "state":
|
|
3655
|
-
this.stepState(
|
|
3657
|
+
this.stepState(s, o);
|
|
3656
3658
|
break;
|
|
3657
3659
|
default:
|
|
3658
|
-
this.stepOnce(
|
|
3660
|
+
this.stepOnce(c, u, o);
|
|
3659
3661
|
break;
|
|
3660
3662
|
}
|
|
3661
|
-
return this.wasInside =
|
|
3663
|
+
return this.wasInside = s, this._state;
|
|
3662
3664
|
}
|
|
3663
3665
|
reset() {
|
|
3664
3666
|
this._state = "idle", this._direction = "forward", this._playhead = 0, this._cycles = 0, this.wasInside = !1, this.everEntered = !1;
|
|
@@ -3794,7 +3796,7 @@ function q(e) {
|
|
|
3794
3796
|
//#region src/animation/compile/emit/easing-serialize.ts
|
|
3795
3797
|
var Ys = /^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end)$/;
|
|
3796
3798
|
function Xs(e, t = 32) {
|
|
3797
|
-
return
|
|
3799
|
+
return s(Array.from({ length: t + 1 }, (n, r) => e(r / t)));
|
|
3798
3800
|
}
|
|
3799
3801
|
function J(e) {
|
|
3800
3802
|
if (e.css !== void 0) return e.css;
|
|
@@ -3889,7 +3891,7 @@ function rc(e, t, n) {
|
|
|
3889
3891
|
}
|
|
3890
3892
|
var ic = async (e) => {
|
|
3891
3893
|
let t = J(e.options.timingFunction);
|
|
3892
|
-
return e.templateFrames.map((n, r) => `${
|
|
3894
|
+
return e.templateFrames.map((n, r) => `${o(n.start)}\n${rc(e, r, t)}\n`);
|
|
3893
3895
|
};
|
|
3894
3896
|
function ac(e) {
|
|
3895
3897
|
let t = e.indexOf("{"), n = t === -1 ? e : e.slice(t + 1), r = n.lastIndexOf("}");
|
|
@@ -3897,18 +3899,18 @@ function ac(e) {
|
|
|
3897
3899
|
}
|
|
3898
3900
|
function oc(e, t, n) {
|
|
3899
3901
|
let r = J(e.options.timingFunction), i = /* @__PURE__ */ new Map();
|
|
3900
|
-
e.templateFrames.forEach((t,
|
|
3901
|
-
let s = n?.get(
|
|
3902
|
+
e.templateFrames.forEach((t, a) => {
|
|
3903
|
+
let s = n?.get(a) ?? rc(e, a, r), c = i.get(s), l = o(t.start);
|
|
3902
3904
|
c ? c.push(l) : i.set(s, [l]);
|
|
3903
3905
|
});
|
|
3904
|
-
let
|
|
3905
|
-
for (let [e, t] of i)
|
|
3906
|
-
return `@keyframes ${t} {\n${
|
|
3906
|
+
let a = "";
|
|
3907
|
+
for (let [e, t] of i) a += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
|
|
3908
|
+
return `@keyframes ${t} {\n${a}}`;
|
|
3907
3909
|
}
|
|
3908
3910
|
function sc(e, t, n) {
|
|
3909
3911
|
let r = J(e.options.timingFunction), i = /* @__PURE__ */ new Map();
|
|
3910
3912
|
for (let t = 0; t < e.templateFrames.length; t++) {
|
|
3911
|
-
let
|
|
3913
|
+
let a = e.templateFrames[t], s = e.parsedVars[t] ?? {}, c = {};
|
|
3912
3914
|
for (let [e, t] of Object.entries(s)) {
|
|
3913
3915
|
let r = nc(t, n);
|
|
3914
3916
|
if (r === void 0) return {
|
|
@@ -3917,27 +3919,27 @@ function sc(e, t, n) {
|
|
|
3917
3919
|
};
|
|
3918
3920
|
c[e] = r;
|
|
3919
3921
|
}
|
|
3920
|
-
let l = Object.entries(c).map(([e, t]) => ` ${k(e)}: ${y(t)};`), u =
|
|
3922
|
+
let l = Object.entries(c).map(([e, t]) => ` ${k(e)}: ${y(t)};`), u = a.timingFunction ? J(a.timingFunction) : r;
|
|
3921
3923
|
u !== r && l.push(` animation-timing-function: ${u};`);
|
|
3922
|
-
let d =
|
|
3924
|
+
let d = a.composition;
|
|
3923
3925
|
d != null && d !== "replace" && l.push(` animation-composition: ${d};`);
|
|
3924
|
-
let f = `{\n${l.join("\n")}\n}`, p = i.get(f), m = a
|
|
3926
|
+
let f = `{\n${l.join("\n")}\n}`, p = i.get(f), m = o(a.start);
|
|
3925
3927
|
p ? p.push(m) : i.set(f, [m]);
|
|
3926
3928
|
}
|
|
3927
|
-
let
|
|
3928
|
-
for (let [e, t] of i)
|
|
3929
|
-
return { block: `@keyframes ${t} {\n${
|
|
3929
|
+
let a = "";
|
|
3930
|
+
for (let [e, t] of i) a += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
|
|
3931
|
+
return { block: `@keyframes ${t} {\n${a}}` };
|
|
3930
3932
|
}
|
|
3931
3933
|
async function cc(e, t = "animation") {
|
|
3932
3934
|
let n = e.options, r = /* @__PURE__ */ new Map(), i = J(n.timingFunction);
|
|
3933
3935
|
e.templateFrames.forEach((t, n) => {
|
|
3934
|
-
let
|
|
3935
|
-
r.has(s) ? r.get(s).push(
|
|
3936
|
+
let a = o(t.start), s = rc(e, n, i);
|
|
3937
|
+
r.has(s) ? r.get(s).push(a) : r.set(s, [a]);
|
|
3936
3938
|
});
|
|
3937
|
-
let
|
|
3938
|
-
for (let [e, t] of r)
|
|
3939
|
+
let a = "";
|
|
3940
|
+
for (let [e, t] of r) a += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
|
|
3939
3941
|
let s = Zs(n, t), c = ec(e);
|
|
3940
|
-
return `${`${c ? `${c}\n\n` : ""}${s}\n@keyframes ${t} {\n${
|
|
3942
|
+
return `${`${c ? `${c}\n\n` : ""}${s}\n@keyframes ${t} {\n${a}}`.replace(/\(\s*\{/g, "{").replace(/\}\s*\)/g, "}")}\n`;
|
|
3941
3943
|
}
|
|
3942
3944
|
//#endregion
|
|
3943
3945
|
//#region src/animation/compile/emit/densify.ts
|