@mkbabb/keyframes.js 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -5
- package/dist/easing-registry-BAgudUsG.js +2 -0
- package/dist/{easing-registry-DHV2-5gA.js → easing-registry-BlbS88NR.js} +2 -2
- package/dist/engine/index.d.ts +155 -174
- package/dist/engine/index.js +3710 -16
- package/dist/keyframes.d.ts +370 -305
- package/dist/keyframes.js +91 -142
- package/dist/{sequence-s0bL7Uul.js → sequence-CES7o7hs.js} +218 -170
- package/package.json +16 -42
- package/dist/backward-color-BtbRcnna.js +0 -108
- package/dist/compile-BHCTPerD.js +0 -30
- package/dist/delegation-BQYCrP2p.js +0 -259
- package/dist/draw-svg-CK9Qrly8.js +0 -33
- package/dist/easing-registry-y1p9McFy.js +0 -2
- package/dist/easing-serialize-D4LZCB6i.js +0 -21
- package/dist/engine-CPK_udUQ.js +0 -1172
- package/dist/engine-DlpimZtM.js +0 -3
- package/dist/entry-D82NKUhP.js +0 -148
- package/dist/format-BdIvdLzG.js +0 -114
- package/dist/group-HM7N4uOE.js +0 -390
- package/dist/handle-D4xrf_ya.js +0 -21
- package/dist/ingest-_g6tfk2e.js +0 -166
- package/dist/morph-svg-KUrH9KnK.js +0 -79
- package/dist/motion-path-wM5tPfrY.js +0 -26
- package/dist/parse-flatten-DRMHFytp.js +0 -2
- package/dist/parse-flatten-ZZUSEQEL.js +0 -63
- package/dist/presets-DeDJYL4G.js +0 -275
- package/dist/scheduler-CfGIC3GX.js +0 -14
- package/dist/scroll-BEyCx0b_.js +0 -287
- package/dist/validate-xFZ_Ld1k.js +0 -39
- package/dist/view-transition-BPJQxUTC.js +0 -305
|
@@ -27,7 +27,7 @@ var s = (e) => typeof e == "function" ? { fn: e } : e, c = /^(linear|ease|ease-i
|
|
|
27
27
|
async function d(e) {
|
|
28
28
|
let t;
|
|
29
29
|
try {
|
|
30
|
-
t = await import("./easing-registry-
|
|
30
|
+
t = await import("./easing-registry-BAgudUsG.js");
|
|
31
31
|
} catch (t) {
|
|
32
32
|
throw Error(`keyframes: the easing-registry chunk failed to load while resolving easing "${e}" — the easing registry is unreachable.`, { cause: t });
|
|
33
33
|
}
|
|
@@ -38,7 +38,7 @@ async function d(e) {
|
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/animation/internal/binarySearch.ts
|
|
41
|
-
function
|
|
41
|
+
function ee(e, t, n, r) {
|
|
42
42
|
let i = 0, a = e.length - 1;
|
|
43
43
|
for (; i <= a;) {
|
|
44
44
|
let o = i + a >> 1, s = e[o];
|
|
@@ -50,16 +50,16 @@ function f(e, t, n, r) {
|
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/animation/internal/leaves.ts
|
|
53
|
-
var
|
|
54
|
-
function
|
|
53
|
+
var f = 1e3 / 60;
|
|
54
|
+
function p(e) {
|
|
55
55
|
if (typeof window < "u" && window.requestAnimationFrame) return window.requestAnimationFrame(e);
|
|
56
|
-
let t =
|
|
56
|
+
let t = f, n = Date.now();
|
|
57
57
|
return setTimeout(() => {
|
|
58
58
|
let r = Date.now(), i = r - n;
|
|
59
|
-
n = r, t = Math.max(0,
|
|
59
|
+
n = r, t = Math.max(0, f - i), e(r);
|
|
60
60
|
}, t);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function m(e) {
|
|
63
63
|
if (e != null) {
|
|
64
64
|
if (typeof e == "number" && typeof window < "u" && window.cancelAnimationFrame) return window.cancelAnimationFrame(e);
|
|
65
65
|
clearTimeout(e);
|
|
@@ -67,23 +67,23 @@ function h(e) {
|
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/animation/internal/reduced-motion.ts
|
|
70
|
-
var
|
|
71
|
-
function
|
|
70
|
+
var te = "(prefers-reduced-motion: reduce)", h = null, g;
|
|
71
|
+
function ne() {
|
|
72
72
|
let e = typeof window > "u" ? void 0 : window.matchMedia;
|
|
73
|
-
return typeof e == "function" ?
|
|
73
|
+
return typeof e == "function" ? h !== null && g === e ? h : (g = e, h = e.call(window, te), h) : (h = null, g = e, null);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
75
|
+
function _() {
|
|
76
|
+
return ne()?.matches ?? !1;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return e === !1 || e === void 0 || !
|
|
78
|
+
function v(e) {
|
|
79
|
+
return e === !1 || e === void 0 || !_() ? 1 : e === !0 || e < 0 ? 0 : e > 1 ? 1 : e;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return !e && e !== 0 || !
|
|
81
|
+
function y(e, t, n) {
|
|
82
|
+
return !e && e !== 0 || !_() ? n() : e === !0 || e === 0 ? t() : n();
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/animation/physics/playback.ts
|
|
86
|
-
var
|
|
86
|
+
var b = class {
|
|
87
87
|
_rafId = null;
|
|
88
88
|
_startTime = void 0;
|
|
89
89
|
_lastFrameT = 0;
|
|
@@ -94,16 +94,16 @@ var C = class {
|
|
|
94
94
|
}
|
|
95
95
|
_run(e) {
|
|
96
96
|
let t = ++this._gen, n = (e) => {
|
|
97
|
-
t === this._gen && (e ? this._rafId =
|
|
97
|
+
t === this._gen && (e ? this._rafId = p(r) : this._cleanup());
|
|
98
98
|
}, r = (t) => {
|
|
99
99
|
let r = e(t);
|
|
100
100
|
r && typeof r.then == "function" ? r.then(n) : n(r);
|
|
101
101
|
};
|
|
102
|
-
this._rafId =
|
|
102
|
+
this._rafId = p(r);
|
|
103
103
|
}
|
|
104
104
|
play = (t, n, r) => {
|
|
105
105
|
if (t <= 0) throw Error("RAFPlayback.play() requires a duration > 0.");
|
|
106
|
-
return this.stop(),
|
|
106
|
+
return this.stop(), y(r?.respectReducedMotion, () => (n(1), Promise.resolve()), () => new Promise((r) => {
|
|
107
107
|
this._resolve = r, this._startTime = void 0, this._run((r) => {
|
|
108
108
|
this._startTime === void 0 && (this._startTime = r);
|
|
109
109
|
let i = e((r - this._startTime) / t, 0, 1);
|
|
@@ -121,14 +121,32 @@ var C = class {
|
|
|
121
121
|
this.stop(), this._run(e);
|
|
122
122
|
};
|
|
123
123
|
stop = () => {
|
|
124
|
-
this._gen++, this._rafId !== null &&
|
|
124
|
+
this._gen++, this._rafId !== null && m(this._rafId), this._cleanup();
|
|
125
125
|
};
|
|
126
126
|
_cleanup() {
|
|
127
127
|
this._rafId = null, this._startTime = void 0, this._lastFrameT = 0;
|
|
128
128
|
let e = this._resolve;
|
|
129
129
|
this._resolve = null, e?.();
|
|
130
130
|
}
|
|
131
|
-
}
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/animation/physics/managed-stepper.ts
|
|
134
|
+
function x(e) {
|
|
135
|
+
e._playback.drive(e, () => e._emitManagedFrame());
|
|
136
|
+
}
|
|
137
|
+
function S(e, t) {
|
|
138
|
+
e.disposed || (e._onFrame = t, y(e.respectReducedMotion, () => {
|
|
139
|
+
e.snap(), e._emitManagedFrame();
|
|
140
|
+
}, () => {
|
|
141
|
+
e.settled ? e._emitManagedFrame() : x(e);
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
function C(e) {
|
|
145
|
+
e._onFrame = void 0, e._playback.stop();
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/animation/physics/smooth.ts
|
|
149
|
+
var w = {
|
|
132
150
|
damping: .1,
|
|
133
151
|
snapThreshold: .001,
|
|
134
152
|
targetEpsilon: 0,
|
|
@@ -140,8 +158,14 @@ var C = class {
|
|
|
140
158
|
targetValue;
|
|
141
159
|
currentValue;
|
|
142
160
|
isSettled;
|
|
143
|
-
_playback = new
|
|
161
|
+
_playback = new b();
|
|
144
162
|
_onFrame = void 0;
|
|
163
|
+
get respectReducedMotion() {
|
|
164
|
+
return this.options.respectReducedMotion;
|
|
165
|
+
}
|
|
166
|
+
_emitManagedFrame() {
|
|
167
|
+
this._onFrame?.(this.currentValue);
|
|
168
|
+
}
|
|
145
169
|
constructor(e) {
|
|
146
170
|
this.options = {
|
|
147
171
|
...w,
|
|
@@ -160,8 +184,8 @@ var C = class {
|
|
|
160
184
|
setTarget(t) {
|
|
161
185
|
this.options.clamp && (t = e(t, 0, 1));
|
|
162
186
|
let n = Math.abs(t - this.targetValue);
|
|
163
|
-
n > 0 && n >= this.options.targetEpsilon && (this.targetValue = t,
|
|
164
|
-
this.isSettled = !1, this._onFrame && this
|
|
187
|
+
n > 0 && n >= this.options.targetEpsilon && (this.targetValue = t, y(this.options.respectReducedMotion, () => this._snapSettled(), () => {
|
|
188
|
+
this.isSettled = !1, this._onFrame && x(this);
|
|
165
189
|
}));
|
|
166
190
|
}
|
|
167
191
|
_snapSettled() {
|
|
@@ -180,19 +204,13 @@ var C = class {
|
|
|
180
204
|
this.targetValue = t, this.currentValue = t, this.isSettled = !0, this._playback.stop();
|
|
181
205
|
}
|
|
182
206
|
play(e) {
|
|
183
|
-
|
|
184
|
-
if (this.isSettled) {
|
|
185
|
-
e?.(this.currentValue);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
this._startLoop();
|
|
189
|
-
});
|
|
207
|
+
S(this, e);
|
|
190
208
|
}
|
|
191
209
|
stop() {
|
|
192
|
-
this
|
|
210
|
+
C(this);
|
|
193
211
|
}
|
|
194
212
|
_startLoop() {
|
|
195
|
-
|
|
213
|
+
x(this);
|
|
196
214
|
}
|
|
197
215
|
}, E = {
|
|
198
216
|
response: .5,
|
|
@@ -206,23 +224,17 @@ var C = class {
|
|
|
206
224
|
//#endregion
|
|
207
225
|
//#region src/animation/physics/spring/managed-play.ts
|
|
208
226
|
function D(e) {
|
|
209
|
-
|
|
227
|
+
x(e);
|
|
210
228
|
}
|
|
211
229
|
function O(e, t) {
|
|
212
|
-
|
|
213
|
-
if (e.settled) {
|
|
214
|
-
t?.(e.value, e.velocity);
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
D(e);
|
|
218
|
-
}));
|
|
230
|
+
S(e, t);
|
|
219
231
|
}
|
|
220
232
|
function k(e) {
|
|
221
|
-
e
|
|
233
|
+
C(e);
|
|
222
234
|
}
|
|
223
235
|
//#endregion
|
|
224
|
-
//#region src/animation/physics/spring/duration.ts
|
|
225
|
-
function
|
|
236
|
+
//#region src/animation/physics/spring/solver/duration.ts
|
|
237
|
+
function re(t) {
|
|
226
238
|
let { visualDuration: n, duration: r, bounce: i = 0, ...a } = t, o = n ?? r ?? .5, s = 1 - e(i, -1, 1);
|
|
227
239
|
return {
|
|
228
240
|
...a,
|
|
@@ -231,8 +243,57 @@ function A(t) {
|
|
|
231
243
|
};
|
|
232
244
|
}
|
|
233
245
|
//#endregion
|
|
234
|
-
//#region src/animation/physics/spring/
|
|
235
|
-
|
|
246
|
+
//#region src/animation/physics/spring/solver/solver.ts
|
|
247
|
+
function A(e, t, n, r) {
|
|
248
|
+
if (t < 1) return {
|
|
249
|
+
regime: "under",
|
|
250
|
+
w: e,
|
|
251
|
+
z: t,
|
|
252
|
+
wd: n,
|
|
253
|
+
decay: Math.exp(-t * e * r),
|
|
254
|
+
cos: Math.cos(n * r),
|
|
255
|
+
sin: Math.sin(n * r)
|
|
256
|
+
};
|
|
257
|
+
if (t === 1) return {
|
|
258
|
+
regime: "critical",
|
|
259
|
+
w: e,
|
|
260
|
+
decay: Math.exp(-e * r),
|
|
261
|
+
t: r
|
|
262
|
+
};
|
|
263
|
+
let i = e * Math.sqrt(t * t - 1), a = -t * e + i, o = -t * e - i;
|
|
264
|
+
return {
|
|
265
|
+
regime: "over",
|
|
266
|
+
r1: a,
|
|
267
|
+
r2: o,
|
|
268
|
+
e1: Math.exp(a * r),
|
|
269
|
+
e2: Math.exp(o * r)
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function j(e, t, n, r = {
|
|
273
|
+
x: 0,
|
|
274
|
+
v: 0
|
|
275
|
+
}) {
|
|
276
|
+
if (n.regime === "under") {
|
|
277
|
+
let { w: i, z: a, wd: o, decay: s, cos: c, sin: l } = n, u = e, d = (t + a * i * e) / o;
|
|
278
|
+
return r.x = s * (u * c + d * l), r.v = s * ((d * o - u * a * i) * c - (u * o + d * a * i) * l), r;
|
|
279
|
+
}
|
|
280
|
+
if (n.regime === "critical") {
|
|
281
|
+
let { w: i, decay: a, t: o } = n, s = e, c = t + i * e;
|
|
282
|
+
return r.x = a * (s + c * o), r.v = a * (c - i * (s + c * o)), r;
|
|
283
|
+
}
|
|
284
|
+
let { r1: i, r2: a, e1: o, e2: s } = n, c = (t - a * e) / (i - a), l = e - c;
|
|
285
|
+
return r.x = c * o + l * s, r.v = c * i * o + l * a * s, r;
|
|
286
|
+
}
|
|
287
|
+
function ie(e, t, n, r, i, a) {
|
|
288
|
+
return j(e, t, A(n, r, i, a));
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/animation/physics/spring/solver/vector.ts
|
|
292
|
+
var M = new Float64Array(), N = class {
|
|
293
|
+
solution = {
|
|
294
|
+
x: 0,
|
|
295
|
+
v: 0
|
|
296
|
+
};
|
|
236
297
|
vecOrigin = null;
|
|
237
298
|
vecOriginVel = null;
|
|
238
299
|
vecTarget = null;
|
|
@@ -246,10 +307,10 @@ var j = new Float64Array(), M = class {
|
|
|
246
307
|
this.vecOrigin.set(this.vecCurrent), this.vecOriginVel.set(this.vecVelocity), this.vecTarget.set(e), this.vecElapsed = 0;
|
|
247
308
|
}
|
|
248
309
|
get values() {
|
|
249
|
-
return this.vecCurrent ??
|
|
310
|
+
return this.vecCurrent ?? M;
|
|
250
311
|
}
|
|
251
312
|
get velocities() {
|
|
252
|
-
return this.vecVelocity ??
|
|
313
|
+
return this.vecVelocity ?? M;
|
|
253
314
|
}
|
|
254
315
|
get armed() {
|
|
255
316
|
return this.vecTarget !== null;
|
|
@@ -257,55 +318,32 @@ var j = new Float64Array(), M = class {
|
|
|
257
318
|
tick(e, t, n, r) {
|
|
258
319
|
if (this.vecTarget === null || e <= 0) return this.values;
|
|
259
320
|
this.vecElapsed += e / 1e3;
|
|
260
|
-
let i = this.vecElapsed, a =
|
|
261
|
-
|
|
262
|
-
let
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
for (let e = 0; e < d.length; e++) {
|
|
266
|
-
let t = c[e] - u[e], n = l[e], r, x;
|
|
267
|
-
if (o < 1) {
|
|
268
|
-
let e = t, i = (n + o * a * t) / s;
|
|
269
|
-
r = p * (e * m + i * h), x = p * ((i * s - e * o * a) * m - (e * s + i * o * a) * h);
|
|
270
|
-
} else if (o === 1) {
|
|
271
|
-
let e = t, o = n + a * t;
|
|
272
|
-
r = g * (e + o * i), x = g * (o - a * (e + o * i));
|
|
273
|
-
} else {
|
|
274
|
-
let e = (n - v * t) / (_ - v), i = t - e;
|
|
275
|
-
r = e * y + i * b, x = e * _ * y + i * v * b;
|
|
276
|
-
}
|
|
277
|
-
d[e] = u[e] + r, f[e] = x;
|
|
321
|
+
let i = this.vecElapsed, a = this.vecOrigin, o = this.vecOriginVel, s = this.vecTarget, c = this.vecCurrent, l = this.vecVelocity, u = A(t, n, r, i), d = this.solution;
|
|
322
|
+
for (let e = 0; e < c.length; e++) {
|
|
323
|
+
let t = a[e] - s[e], n = o[e];
|
|
324
|
+
j(t, n, u, d), c[e] = s[e] + d.x, l[e] = d.v;
|
|
278
325
|
}
|
|
279
|
-
return
|
|
326
|
+
return c;
|
|
280
327
|
}
|
|
281
328
|
};
|
|
282
329
|
//#endregion
|
|
283
|
-
//#region src/animation/physics/spring/
|
|
284
|
-
function
|
|
285
|
-
let
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
x: n * (r + i * a),
|
|
297
|
-
v: n * (i - o * (r + i * a))
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
let c = o * Math.sqrt(s * s - 1), l = -s * o + c, u = -s * o - c, d = (t - u * e) / (l - u), f = e - d, p = Math.exp(l * a), m = Math.exp(u * a);
|
|
301
|
-
return {
|
|
302
|
-
x: d * p + f * m,
|
|
303
|
-
v: d * l * p + f * u * m
|
|
304
|
-
};
|
|
330
|
+
//#region src/animation/physics/spring/vector-surface.ts
|
|
331
|
+
function P(e, t) {
|
|
332
|
+
let n = e ?? new N();
|
|
333
|
+
return n.setTargets(t), n;
|
|
334
|
+
}
|
|
335
|
+
function F(e) {
|
|
336
|
+
return e?.values ?? M;
|
|
337
|
+
}
|
|
338
|
+
function I(e) {
|
|
339
|
+
return e?.velocities ?? M;
|
|
340
|
+
}
|
|
341
|
+
function L(e, t, n, r, i) {
|
|
342
|
+
return e === null || t <= 0 ? M : e.tick(t, n, r, i);
|
|
305
343
|
}
|
|
306
344
|
//#endregion
|
|
307
345
|
//#region src/animation/physics/spring/progress.ts
|
|
308
|
-
var
|
|
346
|
+
var R = class e {
|
|
309
347
|
options;
|
|
310
348
|
get respectReducedMotion() {
|
|
311
349
|
return this.options.respectReducedMotion;
|
|
@@ -324,16 +362,19 @@ var P = class e {
|
|
|
324
362
|
subscribers = /* @__PURE__ */ new Set();
|
|
325
363
|
disposed = !1;
|
|
326
364
|
vectorLanes = null;
|
|
327
|
-
_playback = new
|
|
365
|
+
_playback = new b();
|
|
328
366
|
_onFrame = void 0;
|
|
367
|
+
_emitManagedFrame() {
|
|
368
|
+
this._onFrame?.(this.value, this.velocity);
|
|
369
|
+
}
|
|
329
370
|
constructor(e) {
|
|
330
371
|
this.options = {
|
|
331
372
|
...E,
|
|
332
373
|
...e
|
|
333
|
-
}, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.currentVelocity = this.options.initialVelocity, this.isSettled = this.options.initialVelocity === 0, this.elapsed = 0, this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.amplitudeScale =
|
|
374
|
+
}, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.currentVelocity = this.options.initialVelocity, this.isSettled = this.options.initialVelocity === 0, this.elapsed = 0, this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.amplitudeScale = v(this.options.respectReducedMotion), this.omega = 2 * Math.PI / this.options.response, this.zeta = this.options.dampingFraction, this.omegaD = this.zeta < 1 ? this.omega * Math.sqrt(1 - this.zeta * this.zeta) : 0;
|
|
334
375
|
}
|
|
335
376
|
static fromDuration(t) {
|
|
336
|
-
return new e(
|
|
377
|
+
return new e(re(t ?? {}));
|
|
337
378
|
}
|
|
338
379
|
get target() {
|
|
339
380
|
return this.targetValue;
|
|
@@ -351,8 +392,8 @@ var P = class e {
|
|
|
351
392
|
e === this.targetValue && !this.options.initialVelocity || this.reseatTarget(e);
|
|
352
393
|
}
|
|
353
394
|
reseatTarget(e) {
|
|
354
|
-
this.targetValue = e,
|
|
355
|
-
this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.elapsed = 0, this.isSettled = !1, this.amplitudeScale =
|
|
395
|
+
this.targetValue = e, y(this.options.respectReducedMotion, () => this._snapSettled(), () => {
|
|
396
|
+
this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.elapsed = 0, this.isSettled = !1, this.amplitudeScale = v(this.options.respectReducedMotion), this._onFrame && D(this);
|
|
356
397
|
});
|
|
357
398
|
}
|
|
358
399
|
_snapSettled() {
|
|
@@ -368,7 +409,7 @@ var P = class e {
|
|
|
368
409
|
return this.disposed || this.isSettled ? this.currentValue : (this.elapsed = Math.max(0, e), this.evaluateAt(this.elapsed), this.checkSettled(), this.emit(), this.currentValue);
|
|
369
410
|
}
|
|
370
411
|
evaluateAt(e) {
|
|
371
|
-
let t = this.amplitudeScale, n = this.originValue + t * (this.targetValue - this.originValue), r = this.originValue - n, i = this.originVelocity, { x: a, v: o } =
|
|
412
|
+
let t = this.amplitudeScale, n = this.originValue + t * (this.targetValue - this.originValue), r = this.originValue - n, i = this.originVelocity, { x: a, v: o } = ie(r, i, this.omega, this.zeta, this.omegaD, e);
|
|
372
413
|
this.currentValue = n + a, this.currentVelocity = o;
|
|
373
414
|
}
|
|
374
415
|
checkSettled() {
|
|
@@ -380,19 +421,19 @@ var P = class e {
|
|
|
380
421
|
}
|
|
381
422
|
reset(e, t) {
|
|
382
423
|
let n = e ?? 0, r = t ?? 0;
|
|
383
|
-
this.targetValue = n, this.currentValue = n, this.currentVelocity = r, this.originValue = n, this.originVelocity = r, this.elapsed = 0, this.amplitudeScale =
|
|
424
|
+
this.targetValue = n, this.currentValue = n, this.currentVelocity = r, this.originValue = n, this.originVelocity = r, this.elapsed = 0, this.amplitudeScale = v(this.options.respectReducedMotion), this.isSettled = r === 0, this.emit(), this._playback.stop();
|
|
384
425
|
}
|
|
385
426
|
setTargets(e) {
|
|
386
|
-
|
|
427
|
+
this.vectorLanes = P(this.vectorLanes, e);
|
|
387
428
|
}
|
|
388
429
|
get values() {
|
|
389
|
-
return this.vectorLanes
|
|
430
|
+
return F(this.vectorLanes);
|
|
390
431
|
}
|
|
391
432
|
get velocities() {
|
|
392
|
-
return this.vectorLanes
|
|
433
|
+
return I(this.vectorLanes);
|
|
393
434
|
}
|
|
394
435
|
tickVector(e) {
|
|
395
|
-
return this.disposed || this.vectorLanes === null || e <= 0 ? this.values : this.vectorLanes
|
|
436
|
+
return this.disposed || this.vectorLanes === null || e <= 0 ? this.values : L(this.vectorLanes, e, this.omega, this.zeta, this.omegaD);
|
|
396
437
|
}
|
|
397
438
|
subscribe(e) {
|
|
398
439
|
return this.subscribers.add(e), () => {
|
|
@@ -413,9 +454,9 @@ var P = class e {
|
|
|
413
454
|
}
|
|
414
455
|
};
|
|
415
456
|
//#endregion
|
|
416
|
-
//#region src/animation/physics/spring/sample.ts
|
|
417
|
-
function
|
|
418
|
-
let t = new
|
|
457
|
+
//#region src/animation/physics/spring/solver/sample.ts
|
|
458
|
+
function z(e) {
|
|
459
|
+
let t = new R({
|
|
419
460
|
response: e.response,
|
|
420
461
|
dampingFraction: e.dampingFraction,
|
|
421
462
|
initial: 0,
|
|
@@ -428,9 +469,9 @@ function F(e) {
|
|
|
428
469
|
return t.dispose(), n;
|
|
429
470
|
}
|
|
430
471
|
//#endregion
|
|
431
|
-
//#region src/animation/physics/spring/linear-stops.ts
|
|
432
|
-
function
|
|
433
|
-
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i =
|
|
472
|
+
//#region src/animation/physics/spring/css/linear-stops.ts
|
|
473
|
+
function B(e) {
|
|
474
|
+
let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = z({
|
|
434
475
|
response: e.response,
|
|
435
476
|
dampingFraction: e.dampingFraction,
|
|
436
477
|
sampleCount: t,
|
|
@@ -444,9 +485,9 @@ function I(e) {
|
|
|
444
485
|
return a.push("1"), `linear(${a.join(", ")})`;
|
|
445
486
|
}
|
|
446
487
|
//#endregion
|
|
447
|
-
//#region src/animation/physics/spring/timing-function.ts
|
|
448
|
-
function
|
|
449
|
-
let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i =
|
|
488
|
+
//#region src/animation/physics/spring/css/timing-function.ts
|
|
489
|
+
function V(e) {
|
|
490
|
+
let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = z({
|
|
450
491
|
response: e.response,
|
|
451
492
|
dampingFraction: e.dampingFraction,
|
|
452
493
|
sampleCount: t,
|
|
@@ -467,12 +508,12 @@ function L(e) {
|
|
|
467
508
|
};
|
|
468
509
|
return e.settleThreshold !== void 0 && (s.settleThreshold = e.settleThreshold), e.maxDuration !== void 0 && (s.maxDuration = e.maxDuration), {
|
|
469
510
|
fn: o,
|
|
470
|
-
css:
|
|
511
|
+
css: B(s)
|
|
471
512
|
};
|
|
472
513
|
}
|
|
473
514
|
//#endregion
|
|
474
515
|
//#region src/animation/orchestration/timeline/native.ts
|
|
475
|
-
function
|
|
516
|
+
function H(e) {
|
|
476
517
|
if (typeof window > "u") return null;
|
|
477
518
|
if (e.kind === "scroll") {
|
|
478
519
|
if (globalThis.ScrollTimeline === void 0) return null;
|
|
@@ -485,9 +526,9 @@ function R(e) {
|
|
|
485
526
|
}
|
|
486
527
|
//#endregion
|
|
487
528
|
//#region src/animation/physics/decay.ts
|
|
488
|
-
var
|
|
489
|
-
function
|
|
490
|
-
let t = e.initial ?? 0, n = e.velocity, r = e.friction ??
|
|
529
|
+
var U = 5;
|
|
530
|
+
function W(e) {
|
|
531
|
+
let t = e.initial ?? 0, n = e.velocity, r = e.friction ?? U;
|
|
491
532
|
if (r <= 0) throw Error("decay() requires a friction coefficient > 0.");
|
|
492
533
|
let i = t + n / r;
|
|
493
534
|
return (e) => {
|
|
@@ -502,23 +543,23 @@ function B(e) {
|
|
|
502
543
|
};
|
|
503
544
|
};
|
|
504
545
|
}
|
|
505
|
-
function
|
|
506
|
-
let t = e.friction ??
|
|
546
|
+
function G(e) {
|
|
547
|
+
let t = e.friction ?? U;
|
|
507
548
|
if (t <= 0) throw Error("decayRest() requires a friction coefficient > 0.");
|
|
508
549
|
return (e.initial ?? 0) + e.velocity / t;
|
|
509
550
|
}
|
|
510
551
|
//#endregion
|
|
511
552
|
//#region src/animation/orchestration/sequence/transport.ts
|
|
512
|
-
function
|
|
553
|
+
function K(t, n) {
|
|
513
554
|
for (let { animation: r, at: i } of t) {
|
|
514
555
|
let t = e(n - i, 0, r.options.duration);
|
|
515
556
|
r.interpFrames(t, !0);
|
|
516
557
|
}
|
|
517
558
|
}
|
|
518
|
-
function
|
|
559
|
+
function q(e, t, n, r) {
|
|
519
560
|
e.fire(t, n, r);
|
|
520
561
|
}
|
|
521
|
-
function
|
|
562
|
+
function J(e, t, n) {
|
|
522
563
|
if (e === void 0) return t;
|
|
523
564
|
if (typeof e == "number") return e;
|
|
524
565
|
let r = /^([+-])=(\d*\.?\d+)$/.exec(e);
|
|
@@ -527,25 +568,25 @@ function W(e, t, n) {
|
|
|
527
568
|
if (i === void 0) throw Error(`Sequence: unknown position "${e}". Register it with .label("${e}", at) first, or pass a number / "+=n" / "-=n".`);
|
|
528
569
|
return i;
|
|
529
570
|
}
|
|
530
|
-
function
|
|
571
|
+
function ae(t, n, r, i) {
|
|
531
572
|
if (n <= 0) return 0;
|
|
532
573
|
let a = e(t, 0, n * r), o = Math.floor(a / n), s = a - o * n;
|
|
533
574
|
return s === 0 && o > 0 && (--o, s = n), i && o % 2 == 1 ? n - s : s;
|
|
534
575
|
}
|
|
535
|
-
function
|
|
576
|
+
function oe(e, t, n) {
|
|
536
577
|
return n && (t - 1) % 2 == 1 ? 0 : e;
|
|
537
578
|
}
|
|
538
|
-
function
|
|
579
|
+
function se(e, t, n) {
|
|
539
580
|
return e === 1 && t === 1 && !n;
|
|
540
581
|
}
|
|
541
|
-
function
|
|
582
|
+
function Y(e, t, n) {
|
|
542
583
|
return n === 0 ? e : e - t / n;
|
|
543
584
|
}
|
|
544
|
-
async function
|
|
545
|
-
e._playOrigin === void 0 && (e._playOrigin =
|
|
546
|
-
let n = (t - e._playOrigin) * e._rate, r = e.duration * e._repeatCount, i = e._rate >= 0 ? n >= r : n <= 0, a = i ? e._rate >= 0 ?
|
|
547
|
-
if (e._time = a,
|
|
548
|
-
if (
|
|
585
|
+
async function ce(e, t) {
|
|
586
|
+
e._playOrigin === void 0 && (e._playOrigin = Y(t, e._time, e._rate)), e._lastClock = t;
|
|
587
|
+
let n = (t - e._playOrigin) * e._rate, r = e.duration * e._repeatCount, i = e._rate >= 0 ? n >= r : n <= 0, a = i ? e._rate >= 0 ? oe(e.duration, e._repeatCount, e._yoyoOn) : 0 : ae(n, e.duration, e._repeatCount, e._yoyoOn);
|
|
588
|
+
if (e._time = a, se(e._rate, e._repeatCount, e._yoyoOn)) for (let { animation: t, at: n } of e.entries) a >= n && a - n < t.options.duration && await t.advanceTo(a);
|
|
589
|
+
if (q(e.events, e.entries, e.labels, a), K(e.entries, a), i) {
|
|
549
590
|
X(e);
|
|
550
591
|
let t = e._resolvePlay;
|
|
551
592
|
return e._resolvePlay = null, t?.(), !1;
|
|
@@ -563,50 +604,61 @@ function Z(e, t) {
|
|
|
563
604
|
e._playOrigin = void 0;
|
|
564
605
|
return;
|
|
565
606
|
}
|
|
566
|
-
e._playOrigin =
|
|
607
|
+
e._playOrigin = Y(n, e._time, e._rate);
|
|
608
|
+
}
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/animation/internal/transport/core.ts
|
|
611
|
+
function Q(e, t) {
|
|
612
|
+
if (e._playingPromise) return e._playingPromise;
|
|
613
|
+
let n = t();
|
|
614
|
+
return e._playingPromise = n, n.finally(() => {
|
|
615
|
+
e._playingPromise === n && (e._playingPromise = null);
|
|
616
|
+
}), n;
|
|
617
|
+
}
|
|
618
|
+
function le(e) {
|
|
619
|
+
return e.started && !e.paused;
|
|
620
|
+
}
|
|
621
|
+
function ue(e, t, n) {
|
|
622
|
+
e.paused ? n() : t();
|
|
567
623
|
}
|
|
568
624
|
//#endregion
|
|
569
625
|
//#region src/animation/orchestration/sequence/lifecycle.ts
|
|
570
|
-
function
|
|
626
|
+
function de(e) {
|
|
571
627
|
if (e._playingPromise) return e._playingPromise;
|
|
572
|
-
if (e.respectReducedMotion &&
|
|
628
|
+
if (e.respectReducedMotion && _()) return e.seek(e.duration), Promise.resolve();
|
|
573
629
|
for (let { animation: t, at: n } of e.entries) t.startTime = n, t.started = !0, t.managed = !0;
|
|
574
|
-
e._time = 0, e._paused = !1, e._playOrigin = void 0, e._lastClock = void 0
|
|
575
|
-
let t = new Promise((t) => {
|
|
630
|
+
return e._time = 0, e._paused = !1, e._playOrigin = void 0, e._lastClock = void 0, Q(e, () => new Promise((t) => {
|
|
576
631
|
e._resolvePlay = t, e.playback.loop(e._boundFrame);
|
|
577
|
-
});
|
|
578
|
-
return e._playingPromise = t, t.finally(() => {
|
|
579
|
-
e._playingPromise = null;
|
|
580
|
-
}), t;
|
|
632
|
+
}));
|
|
581
633
|
}
|
|
582
|
-
function
|
|
634
|
+
function fe(e) {
|
|
583
635
|
e.playback.stop(), X(e);
|
|
584
636
|
let t = e._resolvePlay;
|
|
585
637
|
e._resolvePlay = null, t?.();
|
|
586
638
|
}
|
|
587
|
-
function
|
|
639
|
+
function pe(e) {
|
|
588
640
|
!e._playingPromise || e._paused || (e._paused = !0, e.playback.stop(), e._playOrigin = void 0);
|
|
589
641
|
}
|
|
590
|
-
function
|
|
642
|
+
function $(e) {
|
|
591
643
|
!e._playingPromise || !e._paused || (e._paused = !1, e._playOrigin = void 0, e._lastClock = void 0, e.playback.loop(e._boundFrame));
|
|
592
644
|
}
|
|
593
|
-
function
|
|
645
|
+
function me(e, t) {
|
|
594
646
|
if (!Number.isFinite(t)) throw Error(`Sequence.timeScale(n): n must be a finite number, got ${t}.`);
|
|
595
647
|
e._rate = t, Z(e, e._playingPromise != null);
|
|
596
648
|
}
|
|
597
|
-
function
|
|
649
|
+
function he(e) {
|
|
598
650
|
e._rate = -e._rate, Z(e, e._playingPromise != null);
|
|
599
651
|
}
|
|
600
|
-
function
|
|
652
|
+
function ge(e, t) {
|
|
601
653
|
if (t !== Infinity && (!Number.isInteger(t) || t < 1)) throw Error(`Sequence.repeat(count): count must be a positive integer or Infinity, got ${t}.`);
|
|
602
654
|
e._repeatCount = t;
|
|
603
655
|
}
|
|
604
|
-
function
|
|
656
|
+
function _e(e, t) {
|
|
605
657
|
e._yoyoOn = t;
|
|
606
658
|
}
|
|
607
659
|
//#endregion
|
|
608
660
|
//#region src/animation/orchestration/sequence/events.ts
|
|
609
|
-
var
|
|
661
|
+
var ve = class {
|
|
610
662
|
subscribers = new Map([
|
|
611
663
|
["segment:enter", /* @__PURE__ */ new Set()],
|
|
612
664
|
["segment:leave", /* @__PURE__ */ new Set()],
|
|
@@ -641,18 +693,19 @@ var oe = class {
|
|
|
641
693
|
}
|
|
642
694
|
this._prevPhase = n;
|
|
643
695
|
}
|
|
644
|
-
},
|
|
696
|
+
}, ye = class {
|
|
645
697
|
entries = [];
|
|
646
698
|
labels = /* @__PURE__ */ new Map();
|
|
647
|
-
events = new
|
|
699
|
+
events = new ve();
|
|
648
700
|
cursor = 0;
|
|
649
701
|
_time = 0;
|
|
650
702
|
respectReducedMotion;
|
|
651
|
-
playback = new
|
|
703
|
+
playback = new b();
|
|
652
704
|
_boundFrame;
|
|
653
705
|
_resolvePlay = null;
|
|
654
706
|
_playOrigin = void 0;
|
|
655
707
|
_playingPromise = null;
|
|
708
|
+
_duration = 0;
|
|
656
709
|
_rate = 1;
|
|
657
710
|
_repeatCount = 1;
|
|
658
711
|
_yoyoOn = !1;
|
|
@@ -662,12 +715,7 @@ var oe = class {
|
|
|
662
715
|
this.respectReducedMotion = e?.respectReducedMotion ?? !1, this._boundFrame = this._frame.bind(this);
|
|
663
716
|
}
|
|
664
717
|
get duration() {
|
|
665
|
-
|
|
666
|
-
for (let t of this.entries) {
|
|
667
|
-
let n = t.at + t.animation.options.duration;
|
|
668
|
-
n > e && (e = n);
|
|
669
|
-
}
|
|
670
|
-
return e;
|
|
718
|
+
return this._duration;
|
|
671
719
|
}
|
|
672
720
|
get time() {
|
|
673
721
|
return this._time;
|
|
@@ -682,20 +730,20 @@ var oe = class {
|
|
|
682
730
|
return this._rate;
|
|
683
731
|
}
|
|
684
732
|
label(e, t) {
|
|
685
|
-
return this.labels.set(e,
|
|
733
|
+
return this.labels.set(e, J(t, this.cursor, this.labels)), this;
|
|
686
734
|
}
|
|
687
735
|
on(e, t) {
|
|
688
736
|
return this.events.subscribe(e, t);
|
|
689
737
|
}
|
|
690
738
|
add(e, t) {
|
|
691
|
-
let n =
|
|
739
|
+
let n = J(t, this.cursor, this.labels);
|
|
692
740
|
return this.entries.push({
|
|
693
741
|
animation: e,
|
|
694
742
|
at: n
|
|
695
|
-
}), this.entries.sort((e, t) => e.at - t.at), this.cursor = n + e.options.duration, this;
|
|
743
|
+
}), this.entries.sort((e, t) => e.at - t.at), this.cursor = n + e.options.duration, this._duration = Math.max(this._duration, this.cursor), this;
|
|
696
744
|
}
|
|
697
745
|
seek(e) {
|
|
698
|
-
return this._time = e,
|
|
746
|
+
return this._time = e, q(this.events, this.entries, this.labels, e), K(this.entries, e), this;
|
|
699
747
|
}
|
|
700
748
|
setTargets(...e) {
|
|
701
749
|
for (let { animation: t } of this.entries) t.setTargets(...e);
|
|
@@ -705,32 +753,32 @@ var oe = class {
|
|
|
705
753
|
return this._playingPromise ?? Promise.resolve();
|
|
706
754
|
}
|
|
707
755
|
play() {
|
|
708
|
-
return
|
|
756
|
+
return de(this);
|
|
709
757
|
}
|
|
710
758
|
async _frame(e) {
|
|
711
|
-
return
|
|
759
|
+
return ce(this, e);
|
|
712
760
|
}
|
|
713
761
|
stop() {
|
|
714
|
-
return
|
|
762
|
+
return fe(this), this;
|
|
715
763
|
}
|
|
716
764
|
pause() {
|
|
717
|
-
return
|
|
765
|
+
return pe(this), this;
|
|
718
766
|
}
|
|
719
767
|
resume() {
|
|
720
|
-
return
|
|
768
|
+
return $(this), this;
|
|
721
769
|
}
|
|
722
770
|
timeScale(e) {
|
|
723
|
-
return
|
|
771
|
+
return me(this, e), this;
|
|
724
772
|
}
|
|
725
773
|
reverse() {
|
|
726
|
-
return
|
|
774
|
+
return he(this), this;
|
|
727
775
|
}
|
|
728
776
|
repeat(e) {
|
|
729
|
-
return
|
|
777
|
+
return ge(this, e), this;
|
|
730
778
|
}
|
|
731
779
|
yoyo(e = !0) {
|
|
732
|
-
return
|
|
780
|
+
return _e(this, e), this;
|
|
733
781
|
}
|
|
734
782
|
};
|
|
735
783
|
//#endregion
|
|
736
|
-
export {
|
|
784
|
+
export { a as C, i as S, n as _, W as a, d as b, V as c, T as d, b as f, t as g, e as h, ue as i, B as l, y as m, Q as n, G as o, v as p, le as r, H as s, ye as t, R as u, ee as v, o as w, s as x, u as y };
|