@mkbabb/keyframes.js 5.1.0 → 5.2.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.
Files changed (35) hide show
  1. package/README.md +83 -3
  2. package/dist/backward-color-BtbRcnna.js +108 -0
  3. package/dist/compile-BHCTPerD.js +30 -0
  4. package/dist/{delegation-DWwr4IXr.js → delegation-BQYCrP2p.js} +5 -9
  5. package/dist/{draw-svg-GURj9nin.js → draw-svg-CK9Qrly8.js} +13 -25
  6. package/dist/easing-serialize-D4LZCB6i.js +21 -0
  7. package/dist/engine/index.d.ts +422 -156
  8. package/dist/engine/index.js +16 -17
  9. package/dist/engine-CPK_udUQ.js +1172 -0
  10. package/dist/engine-DlpimZtM.js +3 -0
  11. package/dist/entry-D82NKUhP.js +148 -0
  12. package/dist/format-BdIvdLzG.js +114 -0
  13. package/dist/{group-vJcsHKN9.js → group-HM7N4uOE.js} +153 -123
  14. package/dist/handle-D4xrf_ya.js +21 -0
  15. package/dist/{ingest-S5hUe20K.js → ingest-_g6tfk2e.js} +2 -2
  16. package/dist/keyframes.d.ts +702 -178
  17. package/dist/keyframes.js +295 -74
  18. package/dist/morph-svg-KUrH9KnK.js +79 -0
  19. package/dist/motion-path-wM5tPfrY.js +26 -0
  20. package/dist/presets-DeDJYL4G.js +275 -0
  21. package/dist/{scheduler-CUtVnuoU.js → scheduler-CfGIC3GX.js} +1 -1
  22. package/dist/{scroll-CxpYFO4u.js → scroll-BEyCx0b_.js} +165 -58
  23. package/dist/{sequence-C_DCiOIQ.js → sequence-s0bL7Uul.js} +118 -90
  24. package/dist/{validate-DDeGnvSt.js → validate-xFZ_Ld1k.js} +7 -7
  25. package/dist/view-transition-BPJQxUTC.js +305 -0
  26. package/package.json +113 -83
  27. package/dist/animation-BGyzfzBq.js +0 -947
  28. package/dist/compile-CcSUwM8R.js +0 -276
  29. package/dist/engine-DEVgCTUy.js +0 -156
  30. package/dist/engine-DrBtsKaf.js +0 -4
  31. package/dist/format-C-Gi9r7L.js +0 -123
  32. package/dist/grammar-BLucehC4.js +0 -23
  33. package/dist/morph-svg-BToeumw5.js +0 -89
  34. package/dist/motion-path-pQVbamWT.js +0 -35
  35. package/dist/presets-BG2Fczzq.js +0 -275
package/dist/keyframes.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as e, a as t, b as n, c as r, f as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, v as g, y as _ } from "./sequence-C_DCiOIQ.js";
1
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./sequence-s0bL7Uul.js";
2
2
  //#region src/animation/physics/numeric.ts
3
- var v = new Float64Array(), y = class {
3
+ var y = new Float64Array(), b = class {
4
4
  keyframes;
5
5
  segments;
6
6
  positions;
@@ -8,13 +8,13 @@ var v = new Float64Array(), y = class {
8
8
  _duration;
9
9
  _respectReducedMotion;
10
10
  _easingFn;
11
- _playback = new s();
11
+ _playback = new c();
12
12
  constructor(e, t) {
13
13
  if (e.length < 2) throw Error("NumericAnimation requires at least 2 keyframes.");
14
14
  this.keyframes = e.map((e) => ({ ...e })), this._duration = t?.duration ?? 0, this._respectReducedMotion = t?.respectReducedMotion ?? !1;
15
15
  let n = t?.timingFunction;
16
- if (typeof n == "string") throw new _("timingFunction", n, "NumericAnimation accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
17
- if (this._easingFn = n == null ? (e) => e : g(n).fn, t?.positions) {
16
+ if (typeof n == "string") throw new v("timingFunction", n, "NumericAnimation accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
17
+ if (this._easingFn = n == null ? (e) => e : _(n).fn, t?.positions) {
18
18
  if (t.positions.length !== e.length) throw Error("positions length must match keyframes length.");
19
19
  this.positions = t.positions;
20
20
  } else this.positions = e.map((t, n) => n / (e.length - 1) * 100);
@@ -41,12 +41,12 @@ var v = new Float64Array(), y = class {
41
41
  };
42
42
  }
43
43
  at(e) {
44
- let t = i(e, 0, 1) * 100, n = a(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
44
+ let t = a(e, 0, 1) * 100, n = o(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
45
45
  n === -1 && (n = this.segments.length - 1);
46
- let r = this.segments[n], o = c(i(t, r.startPos, r.stopPos), r.startPos, r.stopPos, 0, 1), s = r.timingFunction(o), l = r.keys.length;
47
- v.length < l && (v = new Float64Array(l)), d(r.from, r.to, s, v);
46
+ let r = this.segments[n], i = l(a(t, r.startPos, r.stopPos), r.startPos, r.stopPos, 0, 1), s = r.timingFunction(i), c = r.keys.length;
47
+ y.length < c && (y = new Float64Array(c)), f(r.from, r.to, s, y);
48
48
  let u = this.result;
49
- for (let e = 0; e < l; e++) u[r.keys[e]] = v[e];
49
+ for (let e = 0; e < c; e++) u[r.keys[e]] = y[e];
50
50
  return this.result;
51
51
  }
52
52
  updateKeyframe(e, t) {
@@ -66,12 +66,12 @@ var v = new Float64Array(), y = class {
66
66
  };
67
67
  //#endregion
68
68
  //#region src/animation/physics/spring/reseat.ts
69
- function b(e) {
69
+ function x(e) {
70
70
  let t = e.curr.time - e.prev.time;
71
71
  return t <= 0 ? 0 : (e.curr.value - e.prev.value) / (t / 1e3);
72
72
  }
73
- function x(e, t, n) {
74
- let r = b(e), i = new p({
73
+ function S(e, t, n) {
74
+ let r = x(e), i = new m({
75
75
  ...n,
76
76
  initial: e.curr.value,
77
77
  initialVelocity: r
@@ -80,7 +80,7 @@ function x(e, t, n) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/animation/physics/morph.ts
83
- var S = (e) => {
83
+ var C = (e) => {
84
84
  if (e instanceof HTMLElement) {
85
85
  let t = e.getBoundingClientRect();
86
86
  return {
@@ -91,7 +91,7 @@ var S = (e) => {
91
91
  };
92
92
  }
93
93
  return e;
94
- }, C = class {
94
+ }, w = class {
95
95
  animation;
96
96
  transformOrigin;
97
97
  timingFunction;
@@ -100,8 +100,8 @@ var S = (e) => {
100
100
  this.transformOrigin = n?.transformOrigin ?? "top left", this.timingFunction = n?.timingFunction, this.duration = n?.duration ?? 0, this.measure(e, t);
101
101
  }
102
102
  measure(e, t) {
103
- let n = S(e), r = S(t), i = r.x - n.x, a = r.y - n.y, o = n.width === 0 ? 1 : r.width / n.width, s = n.height === 0 ? 1 : r.height / n.height;
104
- return this.animation = new y([{
103
+ let n = C(e), r = C(t), i = r.x - n.x, a = r.y - n.y, o = n.width === 0 ? 1 : r.width / n.width, s = n.height === 0 ? 1 : r.height / n.height;
104
+ return this.animation = new b([{
105
105
  translateX: 0,
106
106
  translateY: 0,
107
107
  scaleX: 1,
@@ -135,7 +135,7 @@ var S = (e) => {
135
135
  stop() {
136
136
  this.animation.stop();
137
137
  }
138
- }, w = class {
138
+ }, T = class {
139
139
  smoother;
140
140
  _easingFn;
141
141
  currentProgress = 0;
@@ -143,11 +143,11 @@ var S = (e) => {
143
143
  constructor(e) {
144
144
  this.boundaryEpsilon = e?.boundaryEpsilon ?? .005;
145
145
  let t = e?.easing;
146
- if (typeof t == "string") throw new _("easing", t, "Timeline accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
147
- this._easingFn = t == null ? (e) => e : g(t).fn, e?.smoothing === !1 ? this.smoother = null : this.smoother = new r(e?.smoothing);
146
+ if (typeof t == "string") throw new v("easing", t, "Timeline accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
147
+ this._easingFn = t == null ? (e) => e : _(t).fn, e?.smoothing === !1 ? this.smoother = null : this.smoother = new r(e?.smoothing);
148
148
  }
149
149
  applyPipeline() {
150
- let e = i(this.sample(), 0, 1);
150
+ let e = a(this.sample(), 0, 1);
151
151
  e = this._easingFn(e);
152
152
  let t = this.boundaryEpsilon;
153
153
  return e <= t ? e = 0 : e >= 1 - t && (e = 1), e;
@@ -175,7 +175,7 @@ var S = (e) => {
175
175
  let t = e ?? 0;
176
176
  this.smoother && this.smoother.reset(t), this.currentProgress = t;
177
177
  }
178
- }, T = class extends w {
178
+ }, ee = class extends T {
179
179
  threshold;
180
180
  getScrollY;
181
181
  getViewportHeight;
@@ -186,7 +186,7 @@ var S = (e) => {
186
186
  let e = this.getViewportHeight() * this.threshold;
187
187
  return e <= 0 ? 0 : this.getScrollY() / e;
188
188
  }
189
- }, E = class extends w {
189
+ }, E = class extends T {
190
190
  value = 0;
191
191
  constructor(e) {
192
192
  super({
@@ -231,34 +231,34 @@ var k = class {
231
231
  this.phase = e - Math.floor(e);
232
232
  }
233
233
  }, A = (e, t) => {
234
- if (typeof e == "number") return i(e, 0, Math.max(0, t - 1));
234
+ if (typeof e == "number") return a(e, 0, Math.max(0, t - 1));
235
235
  switch (e) {
236
236
  case "first": return 0;
237
237
  case "last": return t - 1;
238
238
  case "center": return (t - 1) / 2;
239
239
  case "edges": return -1;
240
240
  }
241
- }, j = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - A(n, t)), M = (e, t) => {
241
+ }, te = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - A(n, t)), j = (e, t) => {
242
242
  if (e <= 1) return 0;
243
243
  if (t === "edges") return Math.floor((e - 1) / 2);
244
244
  let n = A(t, e);
245
245
  return Math.max(n, e - 1 - n);
246
246
  };
247
- function N(e, t = {}) {
247
+ function M(e, t = {}) {
248
248
  let { each: n = 100, from: r = "first", ease: i } = t;
249
- if (typeof i == "string") throw new _("ease", i, "stagger accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
250
- let a = i ? g(i).fn : void 0, o = typeof e == "number" ? e : e.length, s = (e, t) => {
249
+ if (typeof i == "string") throw new v("ease", i, "stagger accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
250
+ let a = i ? _(i).fn : void 0, o = typeof e == "number" ? e : e.length, s = (e, t) => {
251
251
  if (t <= 1) return 0;
252
- let i = M(t, r);
252
+ let i = j(t, r);
253
253
  if (i === 0) return 0;
254
- let o = j(e, t, r);
254
+ let o = te(e, t, r);
255
255
  return a ? a(o / i) * n * i : o * n;
256
256
  }, c = ((e, t = o) => s(e, t));
257
257
  return c.delays = (e = o) => Array.from({ length: e }, (t, n) => s(n, e)), c;
258
258
  }
259
259
  //#endregion
260
260
  //#region src/animation/orchestration/flip.ts
261
- var P = 300, F = (e) => {
261
+ var N = 300, P = (e) => {
262
262
  let t = e.getBoundingClientRect();
263
263
  return {
264
264
  x: t.x,
@@ -266,21 +266,21 @@ var P = 300, F = (e) => {
266
266
  width: t.width,
267
267
  height: t.height
268
268
  };
269
- }, I = (e, t) => {
269
+ }, F = (e, t) => {
270
270
  let n = e.at(1), r = n.translateX, i = n.translateY, a = n.scaleX, o = n.scaleY, s = e.at(t);
271
271
  return `translate(${s.translateX - r}px, ${s.translateY - i}px) scale(${a === 0 ? 1 : s.scaleX / a}, ${o === 0 ? 1 : s.scaleY / o})`;
272
- }, L = (e, t, n, r) => (e.style.transformOrigin = r, e.style.transform = I(t, 0), n <= 0 ? (e.style.transform = I(t, 1), Promise.resolve()) : new s().play(n, (n) => {
273
- e.style.transform = I(t, n);
272
+ }, ne = (e, t, n, r) => (e.style.transformOrigin = r, e.style.transform = F(t, 0), n <= 0 ? (e.style.transform = F(t, 1), Promise.resolve()) : new c().play(n, (n) => {
273
+ e.style.transform = F(t, n);
274
274
  }));
275
- function R(e, t, n = {}) {
276
- let { duration: r = P, timingFunction: i, transformOrigin: a = "top left" } = n, o = F(e);
277
- return t(), L(e, new C(o, F(e), {
275
+ function re(e, t, n = {}) {
276
+ let { duration: r = N, timingFunction: i, transformOrigin: a = "top left" } = n, o = P(e);
277
+ return t(), ne(e, new w(o, P(e), {
278
278
  ...i === void 0 ? {} : { timingFunction: i },
279
279
  transformOrigin: a
280
280
  }), r, a);
281
281
  }
282
- function z(e, t, n = {}) {
283
- let { duration: r = P, timingFunction: i, transformOrigin: a = "top left" } = n, o = new C(F(e), F(t), {
282
+ function I(e, t, n = {}) {
283
+ let { duration: r = N, timingFunction: i, transformOrigin: a = "top left" } = n, o = new w(P(e), P(t), {
284
284
  ...i === void 0 ? {} : { timingFunction: i },
285
285
  duration: r,
286
286
  transformOrigin: a
@@ -288,8 +288,222 @@ function z(e, t, n = {}) {
288
288
  return o.apply(e, 0), r <= 0 ? (o.apply(e, 1), Promise.resolve()) : o.play(e, r);
289
289
  }
290
290
  //#endregion
291
+ //#region src/animation/orchestration/split-text/refuse.ts
292
+ var ie = {
293
+ 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.",
294
+ 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.",
295
+ empty: "there is no text content to split into lines."
296
+ }, L = class e extends Error {
297
+ name = "SplitTextRefusalError";
298
+ reason;
299
+ constructor(t, n) {
300
+ super(`splitText refused a by:"line" split (${t}): ` + (n ?? ie[t])), this.reason = t, Object.setPrototypeOf(this, e.prototype);
301
+ }
302
+ }, R = (e) => e.length === 0 || /^\s+$/u.test(e), z = typeof Intl < "u" && typeof Intl.Segmenter == "function";
303
+ function B(e, t) {
304
+ if (z) {
305
+ let n = new Intl.Segmenter(t, { granularity: "word" }), r = [];
306
+ for (let { segment: t } of n.segment(e)) r.push({
307
+ text: t,
308
+ kind: R(t) ? "space" : "unit"
309
+ });
310
+ return r;
311
+ }
312
+ return e.split(/(\s+)/u).filter((e) => e.length > 0).map((e) => ({
313
+ text: e,
314
+ kind: R(e) ? "space" : "unit"
315
+ }));
316
+ }
317
+ function V(e, t) {
318
+ if (z) {
319
+ let n = new Intl.Segmenter(t, { granularity: "grapheme" }), r = [];
320
+ for (let { segment: t } of n.segment(e)) r.push({
321
+ text: t,
322
+ kind: R(t) ? "space" : "unit"
323
+ });
324
+ return r;
325
+ }
326
+ return Array.from(e).map((e) => ({
327
+ text: e,
328
+ kind: R(e) ? "space" : "unit"
329
+ }));
330
+ }
331
+ //#endregion
332
+ //#region src/animation/orchestration/split-text/split-text.ts
333
+ var H = (e) => Math.round(e), U = (e) => e.some((e) => {
334
+ let t = e.getBoundingClientRect();
335
+ return t.width > 0 || t.height > 0;
336
+ });
337
+ function W(e, t, n, r) {
338
+ let i = e.createDocumentFragment(), a = [];
339
+ for (let o of t) {
340
+ if (o.kind === "space") {
341
+ i.appendChild(e.createTextNode(o.text));
342
+ continue;
343
+ }
344
+ let t = e.createElement("span");
345
+ t.className = n, t.style.display = "inline-block", t.textContent = o.text, r && t.setAttribute("aria-hidden", "true"), a.push(t), i.appendChild(t);
346
+ }
347
+ return {
348
+ frag: i,
349
+ fragments: a
350
+ };
351
+ }
352
+ function G(e, t, n, r, i) {
353
+ if (t.trim().length === 0) throw new L("empty");
354
+ let a = e.ownerDocument, o = B(t, n), s = [], c = [], l = /* @__PURE__ */ new Map();
355
+ for (let e of o) {
356
+ if (e.kind === "space") {
357
+ s.push(a.createTextNode(e.text));
358
+ continue;
359
+ }
360
+ let t = a.createElement("span");
361
+ t.textContent = e.text, c.push(t), l.set(t, e), s.push(t);
362
+ }
363
+ if (e.replaceChildren(...s), !e.isConnected || !U(c)) throw new L("unmeasurable");
364
+ let u = [], d = [], f = null;
365
+ for (let e of s) {
366
+ let t = e instanceof HTMLElement ? l.get(e) : {
367
+ text: e.textContent ?? "",
368
+ kind: "space"
369
+ };
370
+ if (t) {
371
+ if (t.kind === "unit" && e instanceof HTMLElement) {
372
+ let t = H(e.getBoundingClientRect().top);
373
+ f === null ? f = t : t !== f && (d.length > 0 && u.push(d), d = [], f = t);
374
+ }
375
+ d.push(t);
376
+ }
377
+ }
378
+ d.length > 0 && u.push(d);
379
+ let p = a.createDocumentFragment(), m = [];
380
+ for (let e of u) {
381
+ let t = a.createElement("span");
382
+ 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);
383
+ }
384
+ return e.replaceChildren(p), m;
385
+ }
386
+ function K(e, t, n) {
387
+ e.setAttribute("aria-label", t);
388
+ let r = e.hasAttribute("role");
389
+ return r || e.setAttribute("role", n), r;
390
+ }
391
+ function q(e, t = {}) {
392
+ 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;
393
+ if (n === "line") f = G(e, u, a, s, r);
394
+ else {
395
+ let t = W(l, n === "grapheme" ? V(u, a) : B(u, a), s, r);
396
+ e.replaceChildren(t.frag), f = t.fragments;
397
+ }
398
+ let p = r ? K(e, u, i) : e.hasAttribute("role"), m = M(f.length, o), h = m.delays(f.length), g = null, _ = 0, v = 0, y = () => {
399
+ n === "line" && (f = G(e, u, a, s, r), r && K(e, u, i), m = M(f.length, o), h = m.delays(f.length));
400
+ }, b = () => {
401
+ g?.disconnect(), g = null;
402
+ };
403
+ return n === "line" && typeof ResizeObserver < "u" && (g = new ResizeObserver(() => {
404
+ let e = typeof performance < "u" ? performance.now() : Date.now();
405
+ if (e - v > 500 && (v = e, _ = 0), ++_ > 12) {
406
+ let e = new L("unstable");
407
+ b(), c?.(e);
408
+ return;
409
+ }
410
+ try {
411
+ y();
412
+ } catch (e) {
413
+ if (e instanceof L) {
414
+ b(), c?.(e);
415
+ return;
416
+ }
417
+ throw e;
418
+ }
419
+ }), g.observe(e)), {
420
+ container: e,
421
+ by: n,
422
+ text: u,
423
+ get fragments() {
424
+ return f;
425
+ },
426
+ get stagger() {
427
+ return m;
428
+ },
429
+ get delays() {
430
+ return h;
431
+ },
432
+ revert: () => {
433
+ b(), e.innerHTML = d, e.removeAttribute("aria-label"), r && !p && e.removeAttribute("role");
434
+ },
435
+ remeasure: y,
436
+ dispose: b
437
+ };
438
+ }
439
+ //#endregion
440
+ //#region src/animation/orchestration/view-transition/view-transition.ts
441
+ var J = 300, ae = () => typeof document < "u" && typeof document.startViewTransition == "function", Y = (e) => e.then(() => void 0, () => void 0);
442
+ function X(e) {
443
+ let t = Promise.resolve(e()).then(() => void 0, () => void 0);
444
+ return {
445
+ ready: t,
446
+ finished: t,
447
+ updateCallbackDone: t,
448
+ skip: () => {},
449
+ backend: "immediate"
450
+ };
451
+ }
452
+ function oe(e, t, n, r) {
453
+ if (t.length === 0) return X(e);
454
+ let i = {
455
+ duration: n,
456
+ ...r === void 0 ? {} : { timingFunction: r }
457
+ }, a = Promise.resolve(e()).then(() => void 0, () => void 0);
458
+ return {
459
+ ready: a,
460
+ finished: a.then(() => Promise.all(t.map(([e, t]) => I(e, t, i)))).then(() => void 0, () => void 0),
461
+ updateCallbackDone: a,
462
+ skip: () => {},
463
+ backend: "flip"
464
+ };
465
+ }
466
+ function se(e, t = {}) {
467
+ let { types: n, duration: r = J, timingFunction: a, shared: o = [], fallback: s = "flip", respectReducedMotion: c = !0 } = t, l = () => {
468
+ if (typeof s == "function") {
469
+ let t = s(e).then(() => void 0, () => void 0);
470
+ return {
471
+ ready: t,
472
+ finished: t,
473
+ updateCallbackDone: t,
474
+ skip: () => {},
475
+ backend: "flip"
476
+ };
477
+ }
478
+ return s === "none" ? X(e) : oe(e, o, r, a);
479
+ };
480
+ return i(c, () => X(e), () => {
481
+ if (!ae()) return l();
482
+ let t = document.startViewTransition, r;
483
+ try {
484
+ r = n && n.length > 0 ? t({
485
+ update: e,
486
+ types: n
487
+ }) : t(e);
488
+ } catch {
489
+ try {
490
+ r = t(e);
491
+ } catch {
492
+ return l();
493
+ }
494
+ }
495
+ return {
496
+ ready: Y(r.ready),
497
+ finished: Y(r.finished),
498
+ updateCallbackDone: Y(r.updateCallbackDone),
499
+ skip: () => r.skipTransition?.(),
500
+ backend: "view-transition"
501
+ };
502
+ });
503
+ }
504
+ //#endregion
291
505
  //#region src/animation/orchestration/drag/draggable.ts
292
- var B = 100, V = .4, H = 5, U = class {
506
+ var ce = 100, le = .4, ue = 5, Z = class {
293
507
  spring;
294
508
  axis;
295
509
  transform;
@@ -306,7 +520,7 @@ var B = 100, V = .4, H = 5, U = class {
306
520
  onPointerMove = (e) => this.handleMove(e);
307
521
  onPointerUp = (e) => this.handleUp(e);
308
522
  constructor(e) {
309
- this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ?? B, this.bounds = e?.bounds, this.rubberBand = e?.rubberBand ?? V, this.snap = e?.snap !== void 0 && e.snap.length > 0 ? e.snap : void 0, this.spring = e?.spring ?? new p(e?.springOptions);
523
+ this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ?? ce, this.bounds = e?.bounds, this.rubberBand = e?.rubberBand ?? le, this.snap = e?.snap !== void 0 && e.snap.length > 0 ? e.snap : void 0, this.spring = e?.spring ?? new m(e?.springOptions);
310
524
  }
311
525
  get dragging() {
312
526
  return this.capturedPointerId !== void 0;
@@ -366,17 +580,17 @@ var B = 100, V = .4, H = 5, U = class {
366
580
  this.pushSample(n, e.timeStamp);
367
581
  let r = this.estimateVelocity();
368
582
  if (t && this.endGesture(t), this.snap) {
369
- let e = f({
583
+ let e = p({
370
584
  initial: n,
371
585
  velocity: r,
372
- friction: H
586
+ friction: ue
373
587
  }), t = this.nearestSnap(e);
374
- this.bounds && (t = i(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
588
+ this.bounds && (t = a(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
375
589
  return;
376
590
  }
377
591
  if (this.spring.reset(n, r), this.bounds) {
378
592
  let e = this.spring.value;
379
- (e < this.bounds.min || e > this.bounds.max) && (this.spring.target = i(e, this.bounds.min, this.bounds.max));
593
+ (e < this.bounds.min || e > this.bounds.max) && (this.spring.target = a(e, this.bounds.min, this.bounds.max));
380
594
  }
381
595
  }
382
596
  nearestSnap(e) {
@@ -406,17 +620,17 @@ var B = 100, V = .4, H = 5, U = class {
406
620
  return r <= 0 ? 0 : (n.value - t.value) / r * 1e3;
407
621
  }
408
622
  };
409
- function W(e, t) {
410
- let n = new U(t);
623
+ function Q(e, t) {
624
+ let n = new Z(t);
411
625
  return n.attach(e), n;
412
626
  }
413
627
  //#endregion
414
628
  //#region src/animation/orchestration/drag/drag-2d.ts
415
- function G(e, t) {
416
- let n = new U({
629
+ function de(e, t) {
630
+ let n = new Z({
417
631
  ...t?.x,
418
632
  axis: "x"
419
- }), r = new U({
633
+ }), r = new Z({
420
634
  ...t?.y,
421
635
  axis: "y"
422
636
  });
@@ -453,21 +667,23 @@ function G(e, t) {
453
667
  }
454
668
  //#endregion
455
669
  //#region src/animation/load-engine.ts
456
- var K = null, q = () => K ??= import("./engine-DrBtsKaf.js"), J = null, Y = () => J ??= Promise.all([
457
- q(),
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),
670
+ var fe = null, pe = () => fe ??= import("./engine-DlpimZtM.js"), me = null, $ = () => me ??= Promise.all([
671
+ pe(),
672
+ import("./group-HM7N4uOE.js").then((e) => e.t),
673
+ import("./motion-path-wM5tPfrY.js").then((e) => e.r),
674
+ import("./draw-svg-CK9Qrly8.js").then((e) => e.n),
675
+ import("./morph-svg-KUrH9KnK.js").then((e) => e.r),
676
+ import("./ingest-_g6tfk2e.js").then((e) => e.t),
677
+ import("./scroll-BEyCx0b_.js").then((e) => e.t),
678
+ import("./compile-BHCTPerD.js").then((e) => e.t),
679
+ import("./view-transition-BPJQxUTC.js").then((e) => e.n),
680
+ import("./entry-D82NKUhP.js").then((e) => e.n),
681
+ import("./validate-xFZ_Ld1k.js").then((e) => e.r),
682
+ import("./presets-DeDJYL4G.js").then((e) => e.t),
683
+ import("./format-BdIvdLzG.js").then((e) => e.a),
468
684
  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({
685
+ import("./scheduler-CfGIC3GX.js").then((e) => e.t)
686
+ ]).then(([e, t, n, r, i, a, o, s, c, l, u, d, f, p, m]) => Object.assign({
471
687
  AnimationGroup: t.AnimationGroup,
472
688
  MotionPath: n.MotionPath,
473
689
  fromMotionPath: n.fromMotionPath,
@@ -489,17 +705,22 @@ var K = null, q = () => K ??= import("./engine-DrBtsKaf.js"), J = null, Y = () =
489
705
  dispatchScrollBackend: o.dispatchScrollBackend,
490
706
  resolveRange: o.resolveRange,
491
707
  pinCSS: o.pinCSS,
708
+ TriggerScene: o.TriggerScene,
709
+ createTriggerScene: o.createTriggerScene,
710
+ supportsNativeTrigger: o.supportsNativeTrigger,
492
711
  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();
712
+ compileToViewTransition: c.compileToViewTransition,
713
+ compileToEntry: l.compileToEntry,
714
+ validate: u.validate,
715
+ explain: u.explain,
716
+ presets: d,
717
+ CSSKeyframesToString: f.CSSKeyframesToString,
718
+ CSSKeyframesToStrings: f.CSSKeyframesToStrings,
719
+ formatCSSKeyframeString: f.formatCSSKeyframeString,
720
+ transformTargetsStyle: p.transformTargetsStyle,
721
+ yieldToMain: m.yieldToMain
722
+ }, e)), he = () => {
723
+ $();
503
724
  };
504
725
  //#endregion
505
- export { _ as AnimationOptionError, U as Draggable, C as ElementMorph, T as KeyframesScrollTimeline, E as ManualTimeline, y as NumericAnimation, k as Oscillator, s as RAFPlayback, m as Sequence, r as SmoothProgress, p as SpringProgress, w as Timeline, n as UnknownEasingError, o as createNativeTimeline, l as decay, f as decayRest, W as drag, G as drag2D, R as flip, z as flipShared, Y as loadAnimationEngine, b as probeVelocity, h as reducedMotionScale, x as reseatToSpring, e as resolveEasing, u as springLinearStops, t as springTimingFunction, N as stagger, g as toEasing, X as warmEngine, O as waveformValue };
726
+ export { v as AnimationOptionError, Z as Draggable, w as ElementMorph, ee as KeyframesScrollTimeline, E as ManualTimeline, b as NumericAnimation, k as Oscillator, c as RAFPlayback, h as Sequence, r as SmoothProgress, L as SplitTextRefusalError, m as SpringProgress, T as Timeline, n as UnknownEasingError, s as createNativeTimeline, u as decay, p as decayRest, Q as drag, de as drag2D, re as flip, I as flipShared, $ as loadAnimationEngine, x as probeVelocity, g as reducedMotionScale, S as reseatToSpring, e as resolveEasing, q as splitText, d as springLinearStops, t as springTimingFunction, M as stagger, _ as toEasing, se as viewTransition, he as warmEngine, O as waveformValue };
@@ -0,0 +1,79 @@
1
+ import { n as e } from "./presets-DeDJYL4G.js";
2
+ import { y as t } from "./sequence-s0bL7Uul.js";
3
+ import { t as n } from "./engine-CPK_udUQ.js";
4
+ import { t as r } from "./handle-D4xrf_ya.js";
5
+ import { PathGeometry as i } from "@mkbabb/value.js";
6
+ //#region src/animation/svg/morph-geometry.ts
7
+ var a = (e) => `--morph-${e}-x`, o = (e) => `--morph-${e}-y`, s = (e) => `--morph-${e}-angle`, c = (e, t, n) => {
8
+ let r = Array(t + 1);
9
+ for (let i = 0; i <= t; i++) if (n) {
10
+ let n = e.sampleAtLength(e.totalLength * (i / t));
11
+ r[i] = {
12
+ x: n.x,
13
+ y: n.y,
14
+ angle: n.angle
15
+ };
16
+ } else r[i] = e.getPointAtT(i / t);
17
+ return r;
18
+ }, l = (e) => Number.isInteger(e) ? `${e}` : e.toFixed(3), u = (e) => {
19
+ if (e.length === 0) return "";
20
+ let t = `M ${l(e[0].x)} ${l(e[0].y)}`;
21
+ for (let n = 1; n < e.length; n++) t += ` L ${l(e[n].x)} ${l(e[n].y)}`;
22
+ return t;
23
+ }, d = (e, t) => {
24
+ let n = Array(t + 1);
25
+ for (let e = 0; e <= t; e++) n[e] = {
26
+ x: 0,
27
+ y: 0
28
+ };
29
+ return (r) => {
30
+ let i = r;
31
+ for (let e = 0; e <= t; e++) {
32
+ let t = n[e], r = i[a(e)], s = i[o(e)];
33
+ if (typeof r != "number" || typeof s != "number") throw Error(`morph render: point ${e} lost its coordinate leaf (engine invariant violated — xKey/yKey seeded at construction)`);
34
+ t.x = r, t.y = s;
35
+ }
36
+ let s = u(n);
37
+ e.style.setProperty("--morph-d", s), e.style.setProperty("d", `path("${s}")`);
38
+ };
39
+ }, f = /* @__PURE__ */ e({
40
+ MorphSVG: () => m,
41
+ fromMorphSVG: () => p
42
+ });
43
+ function p(e, r, l = {}) {
44
+ let { samples: u = 64, target: f, orient: p = !1, autoPlay: m = !0, ...h } = l;
45
+ if (typeof e != "string" || e.length === 0) throw new t("from", e, "fromMorphSVG(): `from` must be a non-empty SVG path `d` string.");
46
+ if (typeof r != "string" || r.length === 0) throw new t("to", r, "fromMorphSVG(): `to` must be a non-empty SVG path `d` string.");
47
+ if (!Number.isInteger(u) || u < 2) throw new t("samples", u, "fromMorphSVG(): `samples` must be an integer >= 2 (a 1-sample morph is just the two endpoints, with no body to interpolate).");
48
+ let g = new i(e), _ = new i(r);
49
+ if (g.totalLength === 0) throw new t("from", e, "fromMorphSVG(): the `from` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
50
+ if (_.totalLength === 0) throw new t("to", r, "fromMorphSVG(): the `to` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
51
+ let v = c(g, u, p), y = c(_, u, p), b = {}, x = {};
52
+ for (let e = 0; e <= u; e++) b[a(e)] = v[e].x, b[o(e)] = v[e].y, x[a(e)] = y[e].x, x[o(e)] = y[e].y, p && (b[s(e)] = v[e].angle ?? 0, x[s(e)] = y[e].angle ?? 0);
53
+ let S = {
54
+ "0%": b,
55
+ "100%": x
56
+ }, C = f == null ? void 0 : d(f, u), w = f;
57
+ f != null && typeof w.setAttribute == "function" && w.setAttribute("d", e);
58
+ let T = new n(h).fromKeyframes(S, C);
59
+ return m && T.play(), T;
60
+ }
61
+ var m = class extends r {
62
+ samples;
63
+ constructor(e, t, n = {}) {
64
+ super(p(e, t, n)), this.samples = n.samples ?? 64;
65
+ }
66
+ sampleD(e) {
67
+ let t = (e < 0 ? 0 : e > 1 ? 1 : e) * this.animation.options.duration, n = this.animation.interpFrames(t, !1), r = Array(this.samples + 1);
68
+ for (let e = 0; e <= this.samples; e++) {
69
+ let t = n[a(e)]?.[0]?.value, i = n[o(e)]?.[0]?.value;
70
+ r[e] = {
71
+ x: t ?? 0,
72
+ y: i ?? 0
73
+ };
74
+ }
75
+ return u(r);
76
+ }
77
+ };
78
+ //#endregion
79
+ export { p as n, f as r, m as t };
@@ -0,0 +1,26 @@
1
+ import { n as e } from "./presets-DeDJYL4G.js";
2
+ import { t } from "./engine-CPK_udUQ.js";
3
+ import { t as n } from "./handle-D4xrf_ya.js";
4
+ //#region src/animation/svg/motion-path.ts
5
+ var r = /* @__PURE__ */ e({
6
+ MotionPath: () => o,
7
+ fromMotionPath: () => a
8
+ }), i = (e) => typeof e == "number" ? `${e}%` : e;
9
+ function a(e, n) {
10
+ let { path: r, from: a = "0%", to: o = "100%", rotate: s, autoPlay: c = !0, ...l } = n;
11
+ if (typeof r != "string" || r.length === 0) throw Error("fromMotionPath(): `path` is required — pass an offset-path value (a path()/ray()/url(#id) string).");
12
+ let u = Array.isArray(e) ? e : [e];
13
+ for (let e of u) e.style.offsetPath = r, s !== void 0 && (e.style.offsetRotate = s);
14
+ let d = {
15
+ "0%": { "offset-distance": i(a) },
16
+ "100%": { "offset-distance": i(o) }
17
+ }, f = new t(l).fromKeyframes(d);
18
+ return f.setTargets(...u), c && f.play(), f;
19
+ }
20
+ var o = class extends n {
21
+ constructor(e, t) {
22
+ super(a(e, t));
23
+ }
24
+ };
25
+ //#endregion
26
+ export { a as n, r, o as t };