@mkbabb/keyframes.js 5.1.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 +98 -8
- 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 +570 -323
- package/dist/engine/index.js +3710 -17
- package/dist/keyframes.d.ts +1043 -454
- package/dist/keyframes.js +277 -107
- package/dist/{sequence-C_DCiOIQ.js → sequence-CES7o7hs.js} +258 -182
- package/package.json +104 -100
- package/dist/animation-BGyzfzBq.js +0 -947
- package/dist/compile-CcSUwM8R.js +0 -276
- package/dist/delegation-DWwr4IXr.js +0 -263
- package/dist/draw-svg-GURj9nin.js +0 -45
- package/dist/easing-registry-y1p9McFy.js +0 -2
- package/dist/engine-DEVgCTUy.js +0 -156
- package/dist/engine-DrBtsKaf.js +0 -4
- package/dist/format-C-Gi9r7L.js +0 -123
- package/dist/grammar-BLucehC4.js +0 -23
- package/dist/group-vJcsHKN9.js +0 -360
- package/dist/ingest-S5hUe20K.js +0 -166
- package/dist/morph-svg-BToeumw5.js +0 -89
- package/dist/motion-path-pQVbamWT.js +0 -35
- package/dist/parse-flatten-DRMHFytp.js +0 -2
- package/dist/parse-flatten-ZZUSEQEL.js +0 -63
- package/dist/presets-BG2Fczzq.js +0 -275
- package/dist/scheduler-CUtVnuoU.js +0 -14
- package/dist/scroll-CxpYFO4u.js +0 -180
- package/dist/validate-DDeGnvSt.js +0 -39
package/dist/keyframes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, l as u, m as d, o as f, p, s as m, t as h, u as g, v as _, x as v } from "./sequence-CES7o7hs.js";
|
|
2
2
|
//#region src/animation/physics/numeric.ts
|
|
3
|
-
var
|
|
3
|
+
var y = class {
|
|
4
|
+
_out = new Float64Array();
|
|
4
5
|
keyframes;
|
|
5
6
|
segments;
|
|
6
7
|
positions;
|
|
@@ -9,14 +10,14 @@ var v = new Float64Array(), y = class {
|
|
|
9
10
|
_respectReducedMotion;
|
|
10
11
|
_easingFn;
|
|
11
12
|
_playback = new s();
|
|
12
|
-
constructor(e,
|
|
13
|
+
constructor(e, n) {
|
|
13
14
|
if (e.length < 2) throw Error("NumericAnimation requires at least 2 keyframes.");
|
|
14
|
-
this.keyframes = e.map((e) => ({ ...e })), this._duration =
|
|
15
|
-
let
|
|
16
|
-
if (typeof
|
|
17
|
-
if (this._easingFn =
|
|
18
|
-
if (
|
|
19
|
-
this.positions =
|
|
15
|
+
this.keyframes = e.map((e) => ({ ...e })), this._duration = n?.duration ?? 0, this._respectReducedMotion = n?.respectReducedMotion ?? !1;
|
|
16
|
+
let r = n?.timingFunction;
|
|
17
|
+
if (typeof r == "string") throw new t("timingFunction", r, "NumericAnimation accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
|
|
18
|
+
if (this._easingFn = r == null ? (e) => e : v(r).fn, n?.positions) {
|
|
19
|
+
if (n.positions.length !== e.length) throw Error("positions length must match keyframes length.");
|
|
20
|
+
this.positions = n.positions;
|
|
20
21
|
} else this.positions = e.map((t, n) => n / (e.length - 1) * 100);
|
|
21
22
|
this.result = { ...e[0] }, this.segments = this.buildSegments();
|
|
22
23
|
}
|
|
@@ -41,12 +42,12 @@ var v = new Float64Array(), y = class {
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
at(e) {
|
|
44
|
-
let t =
|
|
45
|
-
|
|
46
|
-
let
|
|
47
|
-
|
|
45
|
+
let t = l(e, 0, 1) * 100, r = _(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
|
|
46
|
+
r === -1 && (r = this.segments.length - 1);
|
|
47
|
+
let i = this.segments[r], a = n(l(t, i.startPos, i.stopPos), i.startPos, i.stopPos, 0, 1), o = i.timingFunction(a), s = i.keys.length;
|
|
48
|
+
this._out.length < s && (this._out = new Float64Array(s)), c(i.from, i.to, o, this._out);
|
|
48
49
|
let u = this.result;
|
|
49
|
-
for (let e = 0; e <
|
|
50
|
+
for (let e = 0; e < s; e++) u[i.keys[e]] = this._out[e];
|
|
50
51
|
return this.result;
|
|
51
52
|
}
|
|
52
53
|
updateKeyframe(e, t) {
|
|
@@ -65,13 +66,13 @@ var v = new Float64Array(), y = class {
|
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
//#endregion
|
|
68
|
-
//#region src/animation/physics/spring/reseat.ts
|
|
69
|
+
//#region src/animation/physics/spring/solver/reseat.ts
|
|
69
70
|
function b(e) {
|
|
70
71
|
let t = e.curr.time - e.prev.time;
|
|
71
72
|
return t <= 0 ? 0 : (e.curr.value - e.prev.value) / (t / 1e3);
|
|
72
73
|
}
|
|
73
74
|
function x(e, t, n) {
|
|
74
|
-
let r = b(e), i = new
|
|
75
|
+
let r = b(e), i = new g({
|
|
75
76
|
...n,
|
|
76
77
|
initial: e.curr.value,
|
|
77
78
|
initialVelocity: r
|
|
@@ -142,12 +143,12 @@ var S = (e) => {
|
|
|
142
143
|
boundaryEpsilon;
|
|
143
144
|
constructor(e) {
|
|
144
145
|
this.boundaryEpsilon = e?.boundaryEpsilon ?? .005;
|
|
145
|
-
let
|
|
146
|
-
if (typeof
|
|
147
|
-
this._easingFn =
|
|
146
|
+
let n = e?.easing;
|
|
147
|
+
if (typeof n == "string") throw new t("easing", n, "Timeline accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
|
|
148
|
+
this._easingFn = n == null ? (e) => e : v(n).fn, e?.smoothing === !1 ? this.smoother = null : this.smoother = new o(e?.smoothing);
|
|
148
149
|
}
|
|
149
150
|
applyPipeline() {
|
|
150
|
-
let e =
|
|
151
|
+
let e = l(this.sample(), 0, 1);
|
|
151
152
|
e = this._easingFn(e);
|
|
152
153
|
let t = this.boundaryEpsilon;
|
|
153
154
|
return e <= t ? e = 0 : e >= 1 - t && (e = 1), e;
|
|
@@ -200,17 +201,17 @@ var S = (e) => {
|
|
|
200
201
|
sample() {
|
|
201
202
|
return this.value;
|
|
202
203
|
}
|
|
203
|
-
},
|
|
204
|
-
function
|
|
204
|
+
}, ee = 2 * Math.PI;
|
|
205
|
+
function D(e, t) {
|
|
205
206
|
let n = e - Math.floor(e);
|
|
206
207
|
switch (t) {
|
|
207
|
-
case "sine": return Math.sin(
|
|
208
|
+
case "sine": return Math.sin(ee * n);
|
|
208
209
|
case "triangle": return n < .5 ? 4 * n - 1 : 3 - 4 * n;
|
|
209
210
|
case "square": return n < .5 ? 1 : -1;
|
|
210
211
|
case "sawtooth": return 2 * n - 1;
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
|
-
var
|
|
214
|
+
var O = class {
|
|
214
215
|
frequency;
|
|
215
216
|
waveform;
|
|
216
217
|
phase = 0;
|
|
@@ -222,43 +223,43 @@ var k = class {
|
|
|
222
223
|
return this.phase = t - Math.floor(t), this.phase;
|
|
223
224
|
}
|
|
224
225
|
get value() {
|
|
225
|
-
return
|
|
226
|
+
return D(this.phase, this.waveform);
|
|
226
227
|
}
|
|
227
228
|
sample(e) {
|
|
228
|
-
return
|
|
229
|
+
return D(e * this.frequency, this.waveform);
|
|
229
230
|
}
|
|
230
231
|
reset(e = 0) {
|
|
231
232
|
this.phase = e - Math.floor(e);
|
|
232
233
|
}
|
|
233
|
-
},
|
|
234
|
-
if (typeof e == "number") return
|
|
234
|
+
}, k = (e, t) => {
|
|
235
|
+
if (typeof e == "number") return l(e, 0, Math.max(0, t - 1));
|
|
235
236
|
switch (e) {
|
|
236
237
|
case "first": return 0;
|
|
237
238
|
case "last": return t - 1;
|
|
238
239
|
case "center": return (t - 1) / 2;
|
|
239
240
|
case "edges": return -1;
|
|
240
241
|
}
|
|
241
|
-
},
|
|
242
|
+
}, te = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - k(n, t)), ne = (e, t) => {
|
|
242
243
|
if (e <= 1) return 0;
|
|
243
244
|
if (t === "edges") return Math.floor((e - 1) / 2);
|
|
244
|
-
let n =
|
|
245
|
+
let n = k(t, e);
|
|
245
246
|
return Math.max(n, e - 1 - n);
|
|
246
247
|
};
|
|
247
|
-
function
|
|
248
|
-
let { each:
|
|
249
|
-
if (typeof
|
|
250
|
-
let
|
|
248
|
+
function A(e, n = {}) {
|
|
249
|
+
let { each: r = 100, from: i = "first", ease: a } = n;
|
|
250
|
+
if (typeof a == "string") throw new t("ease", a, "stagger accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
|
|
251
|
+
let o = a ? v(a).fn : void 0, s = typeof e == "number" ? e : e.length, c = (e, t) => {
|
|
251
252
|
if (t <= 1) return 0;
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
254
|
-
let
|
|
255
|
-
return
|
|
256
|
-
},
|
|
257
|
-
return
|
|
253
|
+
let n = ne(t, i);
|
|
254
|
+
if (n === 0) return 0;
|
|
255
|
+
let a = te(e, t, i);
|
|
256
|
+
return o ? o(a / n) * r * n : a * r;
|
|
257
|
+
}, l = ((e, t = s) => c(e, t));
|
|
258
|
+
return l.delays = (e = s) => Array.from({ length: e }, (t, n) => c(n, e)), l;
|
|
258
259
|
}
|
|
259
260
|
//#endregion
|
|
260
261
|
//#region src/animation/orchestration/flip.ts
|
|
261
|
-
var
|
|
262
|
+
var j = 300, M = (e) => {
|
|
262
263
|
let t = e.getBoundingClientRect();
|
|
263
264
|
return {
|
|
264
265
|
x: t.x,
|
|
@@ -266,21 +267,21 @@ var P = 300, F = (e) => {
|
|
|
266
267
|
width: t.width,
|
|
267
268
|
height: t.height
|
|
268
269
|
};
|
|
269
|
-
},
|
|
270
|
+
}, N = (e, t) => {
|
|
270
271
|
let n = e.at(1), r = n.translateX, i = n.translateY, a = n.scaleX, o = n.scaleY, s = e.at(t);
|
|
271
272
|
return `translate(${s.translateX - r}px, ${s.translateY - i}px) scale(${a === 0 ? 1 : s.scaleX / a}, ${o === 0 ? 1 : s.scaleY / o})`;
|
|
272
|
-
},
|
|
273
|
-
e.style.transform =
|
|
273
|
+
}, P = (e, t, n, r) => (e.style.transformOrigin = r, e.style.transform = N(t, 0), n <= 0 ? (e.style.transform = N(t, 1), Promise.resolve()) : new s().play(n, (n) => {
|
|
274
|
+
e.style.transform = N(t, n);
|
|
274
275
|
}));
|
|
275
|
-
function
|
|
276
|
-
let { duration: r =
|
|
277
|
-
return t(),
|
|
276
|
+
function F(e, t, n = {}) {
|
|
277
|
+
let { duration: r = j, timingFunction: i, transformOrigin: a = "top left" } = n, o = M(e);
|
|
278
|
+
return t(), P(e, new C(o, M(e), {
|
|
278
279
|
...i === void 0 ? {} : { timingFunction: i },
|
|
279
280
|
transformOrigin: a
|
|
280
281
|
}), r, a);
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
-
let { duration: r =
|
|
283
|
+
function I(e, t, n = {}) {
|
|
284
|
+
let { duration: r = j, timingFunction: i, transformOrigin: a = "top left" } = n, o = new C(M(e), M(t), {
|
|
284
285
|
...i === void 0 ? {} : { timingFunction: i },
|
|
285
286
|
duration: r,
|
|
286
287
|
transformOrigin: a
|
|
@@ -288,8 +289,222 @@ function z(e, t, n = {}) {
|
|
|
288
289
|
return o.apply(e, 0), r <= 0 ? (o.apply(e, 1), Promise.resolve()) : o.play(e, r);
|
|
289
290
|
}
|
|
290
291
|
//#endregion
|
|
292
|
+
//#region src/animation/orchestration/split-text/refuse.ts
|
|
293
|
+
var re = {
|
|
294
|
+
unmeasurable: "the container yielded no laid-out client rects (detached, display:none, or zero-area) — a line-split cannot group fragments without a measured line box. Use by:\"word\" (layout-independent), or split after the element is laid out.",
|
|
295
|
+
unstable: "the line measurement could not converge — the container's size depends on its own content flow (a container-query / intrinsic-size feedback loop), so the line grouping oscillates on every reflow. Refused rather than latch a stale line map.",
|
|
296
|
+
empty: "there is no text content to split into lines."
|
|
297
|
+
}, L = class e extends Error {
|
|
298
|
+
name = "SplitTextRefusalError";
|
|
299
|
+
reason;
|
|
300
|
+
constructor(t, n) {
|
|
301
|
+
super(`splitText refused a by:"line" split (${t}): ` + (n ?? re[t])), this.reason = t, Object.setPrototypeOf(this, e.prototype);
|
|
302
|
+
}
|
|
303
|
+
}, R = (e) => e.length === 0 || /^\s+$/u.test(e), z = typeof Intl < "u" && typeof Intl.Segmenter == "function";
|
|
304
|
+
function B(e, t) {
|
|
305
|
+
if (z) {
|
|
306
|
+
let n = new Intl.Segmenter(t, { granularity: "word" }), r = [];
|
|
307
|
+
for (let { segment: t } of n.segment(e)) r.push({
|
|
308
|
+
text: t,
|
|
309
|
+
kind: R(t) ? "space" : "unit"
|
|
310
|
+
});
|
|
311
|
+
return r;
|
|
312
|
+
}
|
|
313
|
+
return e.split(/(\s+)/u).filter((e) => e.length > 0).map((e) => ({
|
|
314
|
+
text: e,
|
|
315
|
+
kind: R(e) ? "space" : "unit"
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
function V(e, t) {
|
|
319
|
+
if (z) {
|
|
320
|
+
let n = new Intl.Segmenter(t, { granularity: "grapheme" }), r = [];
|
|
321
|
+
for (let { segment: t } of n.segment(e)) r.push({
|
|
322
|
+
text: t,
|
|
323
|
+
kind: R(t) ? "space" : "unit"
|
|
324
|
+
});
|
|
325
|
+
return r;
|
|
326
|
+
}
|
|
327
|
+
return Array.from(e).map((e) => ({
|
|
328
|
+
text: e,
|
|
329
|
+
kind: R(e) ? "space" : "unit"
|
|
330
|
+
}));
|
|
331
|
+
}
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/animation/orchestration/split-text/split-text.ts
|
|
334
|
+
var H = (e) => Math.round(e), U = (e) => e.some((e) => {
|
|
335
|
+
let t = e.getBoundingClientRect();
|
|
336
|
+
return t.width > 0 || t.height > 0;
|
|
337
|
+
});
|
|
338
|
+
function W(e, t, n, r) {
|
|
339
|
+
let i = e.createDocumentFragment(), a = [];
|
|
340
|
+
for (let o of t) {
|
|
341
|
+
if (o.kind === "space") {
|
|
342
|
+
i.appendChild(e.createTextNode(o.text));
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
let t = e.createElement("span");
|
|
346
|
+
t.className = n, t.style.display = "inline-block", t.textContent = o.text, r && t.setAttribute("aria-hidden", "true"), a.push(t), i.appendChild(t);
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
frag: i,
|
|
350
|
+
fragments: a
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function G(e, t, n, r, i) {
|
|
354
|
+
if (t.trim().length === 0) throw new L("empty");
|
|
355
|
+
let a = e.ownerDocument, o = B(t, n), s = [], c = [], l = /* @__PURE__ */ new Map();
|
|
356
|
+
for (let e of o) {
|
|
357
|
+
if (e.kind === "space") {
|
|
358
|
+
s.push(a.createTextNode(e.text));
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
let t = a.createElement("span");
|
|
362
|
+
t.textContent = e.text, c.push(t), l.set(t, e), s.push(t);
|
|
363
|
+
}
|
|
364
|
+
if (e.replaceChildren(...s), !e.isConnected || !U(c)) throw new L("unmeasurable");
|
|
365
|
+
let u = [], d = [], f = null;
|
|
366
|
+
for (let e of s) {
|
|
367
|
+
let t = e instanceof HTMLElement ? l.get(e) : {
|
|
368
|
+
text: e.textContent ?? "",
|
|
369
|
+
kind: "space"
|
|
370
|
+
};
|
|
371
|
+
if (t) {
|
|
372
|
+
if (t.kind === "unit" && e instanceof HTMLElement) {
|
|
373
|
+
let t = H(e.getBoundingClientRect().top);
|
|
374
|
+
f === null ? f = t : t !== f && (d.length > 0 && u.push(d), d = [], f = t);
|
|
375
|
+
}
|
|
376
|
+
d.push(t);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
d.length > 0 && u.push(d);
|
|
380
|
+
let p = a.createDocumentFragment(), m = [];
|
|
381
|
+
for (let e of u) {
|
|
382
|
+
let t = a.createElement("span");
|
|
383
|
+
t.className = r, t.style.display = "block", t.textContent = e.map((e) => e.text).join("").trimEnd(), i && t.setAttribute("aria-hidden", "true"), m.push(t), p.appendChild(t);
|
|
384
|
+
}
|
|
385
|
+
return e.replaceChildren(p), m;
|
|
386
|
+
}
|
|
387
|
+
function K(e, t, n) {
|
|
388
|
+
e.setAttribute("aria-label", t);
|
|
389
|
+
let r = e.hasAttribute("role");
|
|
390
|
+
return r || e.setAttribute("role", n), r;
|
|
391
|
+
}
|
|
392
|
+
function q(e, t = {}) {
|
|
393
|
+
let { by: n = "word", a11y: r = !0, role: i = "img", locale: a, stagger: o, fragmentClass: s = "kf-split", onRefuse: c } = t, l = e.ownerDocument, u = e.textContent ?? "", d = e.innerHTML, f;
|
|
394
|
+
if (n === "line") f = G(e, u, a, s, r);
|
|
395
|
+
else {
|
|
396
|
+
let t = W(l, n === "grapheme" ? V(u, a) : B(u, a), s, r);
|
|
397
|
+
e.replaceChildren(t.frag), f = t.fragments;
|
|
398
|
+
}
|
|
399
|
+
let p = r ? K(e, u, i) : e.hasAttribute("role"), m = A(f.length, o), h = m.delays(f.length), g = null, _ = 0, v = 0, y = () => {
|
|
400
|
+
n === "line" && (f = G(e, u, a, s, r), r && K(e, u, i), m = A(f.length, o), h = m.delays(f.length));
|
|
401
|
+
}, b = () => {
|
|
402
|
+
g?.disconnect(), g = null;
|
|
403
|
+
};
|
|
404
|
+
return n === "line" && typeof ResizeObserver < "u" && (g = new ResizeObserver(() => {
|
|
405
|
+
let e = typeof performance < "u" ? performance.now() : Date.now();
|
|
406
|
+
if (e - v > 500 && (v = e, _ = 0), ++_ > 12) {
|
|
407
|
+
let e = new L("unstable");
|
|
408
|
+
b(), c?.(e);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
y();
|
|
413
|
+
} catch (e) {
|
|
414
|
+
if (e instanceof L) {
|
|
415
|
+
b(), c?.(e);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
throw e;
|
|
419
|
+
}
|
|
420
|
+
}), g.observe(e)), {
|
|
421
|
+
container: e,
|
|
422
|
+
by: n,
|
|
423
|
+
text: u,
|
|
424
|
+
get fragments() {
|
|
425
|
+
return f;
|
|
426
|
+
},
|
|
427
|
+
get stagger() {
|
|
428
|
+
return m;
|
|
429
|
+
},
|
|
430
|
+
get delays() {
|
|
431
|
+
return h;
|
|
432
|
+
},
|
|
433
|
+
revert: () => {
|
|
434
|
+
b(), e.innerHTML = d, e.removeAttribute("aria-label"), r && !p && e.removeAttribute("role");
|
|
435
|
+
},
|
|
436
|
+
remeasure: y,
|
|
437
|
+
dispose: b
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/animation/orchestration/view-transition/view-transition.ts
|
|
442
|
+
var J = 300, Y = () => typeof document < "u" && typeof document.startViewTransition == "function", X = (e) => e.then(() => void 0, () => void 0);
|
|
443
|
+
function Z(e) {
|
|
444
|
+
let t = Promise.resolve(e()).then(() => void 0, () => void 0);
|
|
445
|
+
return {
|
|
446
|
+
ready: t,
|
|
447
|
+
finished: t,
|
|
448
|
+
updateCallbackDone: t,
|
|
449
|
+
skip: () => {},
|
|
450
|
+
backend: "immediate"
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function ie(e, t, n, r) {
|
|
454
|
+
if (t.length === 0) return Z(e);
|
|
455
|
+
let i = {
|
|
456
|
+
duration: n,
|
|
457
|
+
...r === void 0 ? {} : { timingFunction: r }
|
|
458
|
+
}, a = Promise.resolve(e()).then(() => void 0, () => void 0);
|
|
459
|
+
return {
|
|
460
|
+
ready: a,
|
|
461
|
+
finished: a.then(() => Promise.all(t.map(([e, t]) => I(e, t, i)))).then(() => void 0, () => void 0),
|
|
462
|
+
updateCallbackDone: a,
|
|
463
|
+
skip: () => {},
|
|
464
|
+
backend: "flip"
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
function ae(e, t = {}) {
|
|
468
|
+
let { types: n, duration: r = J, timingFunction: i, shared: a = [], fallback: o = "flip", respectReducedMotion: s = !0 } = t, c = () => {
|
|
469
|
+
if (typeof o == "function") {
|
|
470
|
+
let t = o(e).then(() => void 0, () => void 0);
|
|
471
|
+
return {
|
|
472
|
+
ready: t,
|
|
473
|
+
finished: t,
|
|
474
|
+
updateCallbackDone: t,
|
|
475
|
+
skip: () => {},
|
|
476
|
+
backend: "flip"
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
return o === "none" ? Z(e) : ie(e, a, r, i);
|
|
480
|
+
};
|
|
481
|
+
return d(s, () => Z(e), () => {
|
|
482
|
+
if (!Y()) return c();
|
|
483
|
+
let t = document.startViewTransition, r;
|
|
484
|
+
try {
|
|
485
|
+
r = n && n.length > 0 ? t({
|
|
486
|
+
update: e,
|
|
487
|
+
types: n
|
|
488
|
+
}) : t(e);
|
|
489
|
+
} catch {
|
|
490
|
+
try {
|
|
491
|
+
r = t(e);
|
|
492
|
+
} catch {
|
|
493
|
+
return c();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
ready: X(r.ready),
|
|
498
|
+
finished: X(r.finished),
|
|
499
|
+
updateCallbackDone: X(r.updateCallbackDone),
|
|
500
|
+
skip: () => r.skipTransition?.(),
|
|
501
|
+
backend: "view-transition"
|
|
502
|
+
};
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
//#endregion
|
|
291
506
|
//#region src/animation/orchestration/drag/draggable.ts
|
|
292
|
-
var
|
|
507
|
+
var oe = 100, se = .4, ce = 5, Q = class {
|
|
293
508
|
spring;
|
|
294
509
|
axis;
|
|
295
510
|
transform;
|
|
@@ -306,7 +521,7 @@ var B = 100, V = .4, H = 5, U = class {
|
|
|
306
521
|
onPointerMove = (e) => this.handleMove(e);
|
|
307
522
|
onPointerUp = (e) => this.handleUp(e);
|
|
308
523
|
constructor(e) {
|
|
309
|
-
this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ??
|
|
524
|
+
this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ?? oe, this.bounds = e?.bounds, this.rubberBand = e?.rubberBand ?? se, this.snap = e?.snap !== void 0 && e.snap.length > 0 ? e.snap : void 0, this.spring = e?.spring ?? new g(e?.springOptions);
|
|
310
525
|
}
|
|
311
526
|
get dragging() {
|
|
312
527
|
return this.capturedPointerId !== void 0;
|
|
@@ -369,14 +584,14 @@ var B = 100, V = .4, H = 5, U = class {
|
|
|
369
584
|
let e = f({
|
|
370
585
|
initial: n,
|
|
371
586
|
velocity: r,
|
|
372
|
-
friction:
|
|
587
|
+
friction: ce
|
|
373
588
|
}), t = this.nearestSnap(e);
|
|
374
|
-
this.bounds && (t =
|
|
589
|
+
this.bounds && (t = l(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
|
|
375
590
|
return;
|
|
376
591
|
}
|
|
377
592
|
if (this.spring.reset(n, r), this.bounds) {
|
|
378
593
|
let e = this.spring.value;
|
|
379
|
-
(e < this.bounds.min || e > this.bounds.max) && (this.spring.target =
|
|
594
|
+
(e < this.bounds.min || e > this.bounds.max) && (this.spring.target = l(e, this.bounds.min, this.bounds.max));
|
|
380
595
|
}
|
|
381
596
|
}
|
|
382
597
|
nearestSnap(e) {
|
|
@@ -406,17 +621,17 @@ var B = 100, V = .4, H = 5, U = class {
|
|
|
406
621
|
return r <= 0 ? 0 : (n.value - t.value) / r * 1e3;
|
|
407
622
|
}
|
|
408
623
|
};
|
|
409
|
-
function
|
|
410
|
-
let n = new
|
|
624
|
+
function le(e, t) {
|
|
625
|
+
let n = new Q(t);
|
|
411
626
|
return n.attach(e), n;
|
|
412
627
|
}
|
|
413
628
|
//#endregion
|
|
414
629
|
//#region src/animation/orchestration/drag/drag-2d.ts
|
|
415
|
-
function
|
|
416
|
-
let n = new
|
|
630
|
+
function ue(e, t) {
|
|
631
|
+
let n = new Q({
|
|
417
632
|
...t?.x,
|
|
418
633
|
axis: "x"
|
|
419
|
-
}), r = new
|
|
634
|
+
}), r = new Q({
|
|
420
635
|
...t?.y,
|
|
421
636
|
axis: "y"
|
|
422
637
|
});
|
|
@@ -453,53 +668,8 @@ function G(e, t) {
|
|
|
453
668
|
}
|
|
454
669
|
//#endregion
|
|
455
670
|
//#region src/animation/load-engine.ts
|
|
456
|
-
var
|
|
457
|
-
|
|
458
|
-
import("./group-vJcsHKN9.js").then((e) => e.t),
|
|
459
|
-
import("./motion-path-pQVbamWT.js").then((e) => e.r),
|
|
460
|
-
import("./draw-svg-GURj9nin.js").then((e) => e.n),
|
|
461
|
-
import("./morph-svg-BToeumw5.js").then((e) => e.r),
|
|
462
|
-
import("./ingest-S5hUe20K.js").then((e) => e.t),
|
|
463
|
-
import("./scroll-CxpYFO4u.js").then((e) => e.t),
|
|
464
|
-
import("./compile-CcSUwM8R.js").then((e) => e.t),
|
|
465
|
-
import("./validate-DDeGnvSt.js").then((e) => e.r),
|
|
466
|
-
import("./presets-BG2Fczzq.js").then((e) => e.t),
|
|
467
|
-
import("./format-C-Gi9r7L.js").then((e) => e.o),
|
|
468
|
-
import("./parse-flatten-DRMHFytp.js"),
|
|
469
|
-
import("./scheduler-CUtVnuoU.js").then((e) => e.t)
|
|
470
|
-
]).then(([e, t, n, r, i, a, o, s, c, l, u, d, f]) => Object.assign({
|
|
471
|
-
AnimationGroup: t.AnimationGroup,
|
|
472
|
-
MotionPath: n.MotionPath,
|
|
473
|
-
fromMotionPath: n.fromMotionPath,
|
|
474
|
-
DrawSVG: r.DrawSVG,
|
|
475
|
-
fromDrawSVG: r.fromDrawSVG,
|
|
476
|
-
MorphSVG: i.MorphSVG,
|
|
477
|
-
fromMorphSVG: i.fromMorphSVG,
|
|
478
|
-
fromStyleSheets: a.fromStyleSheets,
|
|
479
|
-
fromLiveAnimations: a.fromLiveAnimations,
|
|
480
|
-
resolveLiveKeyframes: a.resolveLiveKeyframes,
|
|
481
|
-
adoptRunning: a.adoptRunning,
|
|
482
|
-
ScrollScene: o.ScrollScene,
|
|
483
|
-
createScrollScene: o.createScrollScene,
|
|
484
|
-
parseScrollCSS: o.parseScrollCSS,
|
|
485
|
-
parseScrollTimeline: o.parseScrollTimeline,
|
|
486
|
-
parseScrollRange: o.parseScrollRange,
|
|
487
|
-
serializeScrollOptions: o.serializeScrollOptions,
|
|
488
|
-
roundTripScrollCSS: o.roundTripScrollCSS,
|
|
489
|
-
dispatchScrollBackend: o.dispatchScrollBackend,
|
|
490
|
-
resolveRange: o.resolveRange,
|
|
491
|
-
pinCSS: o.pinCSS,
|
|
492
|
-
compileToCSS: s.compileToCSS,
|
|
493
|
-
validate: c.validate,
|
|
494
|
-
explain: c.explain,
|
|
495
|
-
presets: l,
|
|
496
|
-
CSSKeyframesToString: u.CSSKeyframesToString,
|
|
497
|
-
CSSKeyframesToStrings: u.CSSKeyframesToStrings,
|
|
498
|
-
formatCSSKeyframeString: u.formatCSSKeyframeString,
|
|
499
|
-
transformTargetsStyle: d.transformTargetsStyle,
|
|
500
|
-
yieldToMain: f.yieldToMain
|
|
501
|
-
}, e)), X = () => {
|
|
502
|
-
Y();
|
|
671
|
+
var de, $ = () => de ??= import("./engine/index.js"), fe = () => {
|
|
672
|
+
$();
|
|
503
673
|
};
|
|
504
674
|
//#endregion
|
|
505
|
-
export {
|
|
675
|
+
export { t as AnimationOptionError, Q as Draggable, C as ElementMorph, T as KeyframesScrollTimeline, E as ManualTimeline, y as NumericAnimation, O as Oscillator, s as RAFPlayback, h as Sequence, o as SmoothProgress, L as SplitTextRefusalError, g as SpringProgress, w as Timeline, e as UnknownEasingError, m as createNativeTimeline, r as decay, f as decayRest, le as drag, ue as drag2D, F as flip, I as flipShared, $ as loadAnimationEngine, b as probeVelocity, p as reducedMotionScale, x as reseatToSpring, i as resolveEasing, q as splitText, u as springLinearStops, a as springTimingFunction, A as stagger, v as toEasing, ae as viewTransition, fe as warmEngine, D as waveformValue };
|