@pixerate/editor 0.29.0 → 0.30.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.
@@ -1,191 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
2
2
 
3
3
 
4
+ var _chunkXZ4L3R4Kcjs = require('./chunk-XZ4L3R4K.cjs');
5
+
4
6
 
5
- var _chunkA6PHCAGXcjs = require('./chunk-A6PHCAGX.cjs');
6
7
 
7
- // src/animation/easing.ts
8
- var ANIMATION_EASING_PRESETS = [
9
- "linear",
10
- "ease",
11
- "ease-in",
12
- "ease-out",
13
- "ease-in-out",
14
- "ease-in-back",
15
- "ease-out-back",
16
- "spring",
17
- "hold"
18
- ];
19
- var ANIMATION_EASING_LABELS = {
20
- linear: "Linear",
21
- hold: "Hold",
22
- ease: "Ease",
23
- "ease-in": "Ease in",
24
- "ease-out": "Ease out",
25
- "ease-in-out": "Ease in-out",
26
- "ease-in-back": "Back in",
27
- "ease-out-back": "Back out",
28
- spring: "Spring"
29
- };
30
- var CUBIC_BEZIER_PRESETS = {
31
- linear: [0, 0, 1, 1],
32
- ease: [0.25, 0.1, 0.25, 1],
33
- "ease-in": [0.42, 0, 1, 1],
34
- "ease-out": [0, 0, 0.58, 1],
35
- "ease-in-out": [0.42, 0, 0.58, 1],
36
- "ease-in-back": [0.36, 0, 0.66, -0.56],
37
- "ease-out-back": [0.34, 1.56, 0.64, 1]
38
- };
39
- var DEFAULT_SPRING = { stiffness: 170, damping: 26, mass: 1, velocity: 0 };
40
- var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
41
- var finite = (v, fallback) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
42
- function cubicBezierAt(x1, y1, x2, y2, x) {
43
- if (x <= 0) return 0;
44
- if (x >= 1) return 1;
45
- x1 = clamp(x1, 0, 1);
46
- x2 = clamp(x2, 0, 1);
47
- const bx = (s2) => 3 * (1 - s2) * (1 - s2) * s2 * x1 + 3 * (1 - s2) * s2 * s2 * x2 + s2 * s2 * s2;
48
- const by = (s2) => 3 * (1 - s2) * (1 - s2) * s2 * y1 + 3 * (1 - s2) * s2 * s2 * y2 + s2 * s2 * s2;
49
- const dbx = (s2) => 3 * (1 - s2) * (1 - s2) * x1 + 6 * (1 - s2) * s2 * (x2 - x1) + 3 * s2 * s2 * (1 - x2);
50
- let s = x;
51
- for (let i = 0; i < 8; i++) {
52
- const d = dbx(s);
53
- if (Math.abs(d) < 1e-9) break;
54
- const next = s - (bx(s) - x) / d;
55
- if (!(next >= 0 && next <= 1)) break;
56
- s = next;
57
- }
58
- if (Math.abs(bx(s) - x) > 1e-7) {
59
- let lo = 0;
60
- let hi = 1;
61
- for (let i = 0; i < 60; i++) {
62
- s = (lo + hi) / 2;
63
- if (bx(s) < x) lo = s;
64
- else hi = s;
65
- }
66
- }
67
- return by(s);
68
- }
69
- function springAt(spring, seconds) {
70
- const stiffness = Math.max(1e-6, finite(spring.stiffness, DEFAULT_SPRING.stiffness));
71
- const damping = Math.max(0, finite(spring.damping, DEFAULT_SPRING.damping));
72
- const mass = Math.max(1e-6, finite(spring.mass, DEFAULT_SPRING.mass));
73
- const v0 = -finite(spring.velocity, DEFAULT_SPRING.velocity);
74
- const t = Math.max(0, seconds);
75
- const w0 = Math.sqrt(stiffness / mass);
76
- const zeta = damping / (2 * Math.sqrt(stiffness * mass));
77
- let x;
78
- if (zeta < 1 - 1e-6) {
79
- const wd = w0 * Math.sqrt(1 - zeta * zeta);
80
- x = Math.exp(-zeta * w0 * t) * (Math.cos(wd * t) + (zeta * w0 + v0) / wd * Math.sin(wd * t));
81
- } else if (zeta <= 1 + 1e-6) {
82
- x = Math.exp(-w0 * t) * (1 + (w0 + v0) * t);
83
- } else {
84
- const r = Math.sqrt(zeta * zeta - 1);
85
- const s1 = -w0 * (zeta - r);
86
- const s2 = -w0 * (zeta + r);
87
- const c2 = (v0 - s1) / (s2 - s1);
88
- const c1 = 1 - c2;
89
- x = c1 * Math.exp(s1 * t) + c2 * Math.exp(s2 * t);
90
- }
91
- return 1 - x;
92
- }
93
- function resolveEasing(easing) {
94
- if (easing === "hold") return "hold";
95
- if (easing === "spring") return { type: "spring", ...DEFAULT_SPRING };
96
- if (typeof easing === "string") {
97
- const preset = CUBIC_BEZIER_PRESETS[easing];
98
- if (preset) return { type: "cubic-bezier", x1: preset[0], y1: preset[1], x2: preset[2], y2: preset[3] };
99
- const parsed = parseCssEasing(easing);
100
- return parsed ? resolveEasing(parsed) : { type: "cubic-bezier", x1: 0, y1: 0, x2: 1, y2: 1 };
101
- }
102
- if (easing && typeof easing === "object") {
103
- if (easing.type === "spring") {
104
- return {
105
- type: "spring",
106
- stiffness: finite(easing.stiffness, DEFAULT_SPRING.stiffness),
107
- damping: finite(easing.damping, DEFAULT_SPRING.damping),
108
- mass: finite(easing.mass, DEFAULT_SPRING.mass),
109
- velocity: finite(easing.velocity, DEFAULT_SPRING.velocity)
110
- };
111
- }
112
- if (easing.type === "cubic-bezier") {
113
- return {
114
- type: "cubic-bezier",
115
- x1: clamp(finite(easing.x1, 0), 0, 1),
116
- y1: finite(easing.y1, 0),
117
- x2: clamp(finite(easing.x2, 1), 0, 1),
118
- y2: finite(easing.y2, 1)
119
- };
120
- }
121
- }
122
- return { type: "cubic-bezier", x1: 0, y1: 0, x2: 1, y2: 1 };
123
- }
124
- function evaluateEasing(easing, u, durationMs = 1e3) {
125
- if (!(u > 0)) return 0;
126
- if (u >= 1) return 1;
127
- const resolved = resolveEasing(easing);
128
- if (resolved === "hold") return 0;
129
- if (resolved.type === "spring") return springAt(resolved, u * Math.max(0, durationMs) / 1e3);
130
- const { x1, y1, x2, y2 } = resolved;
131
- if (x1 === y1 && x2 === y2) return u;
132
- return cubicBezierAt(x1, y1, x2, y2, u);
133
- }
134
- function easingFromInfluence(outInfluence = 1 / 3, inInfluence = 1 / 3) {
135
- return {
136
- type: "cubic-bezier",
137
- x1: clamp(outInfluence, 0.01, 1),
138
- y1: 0,
139
- x2: 1 - clamp(inInfluence, 0.01, 1),
140
- y2: 1
141
- };
142
- }
143
- var NUMBER = String.raw`\s*(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)\s*`;
144
- var CUBIC_RE = new RegExp(`^cubic-bezier\\(${NUMBER},${NUMBER},${NUMBER},${NUMBER}\\)$`, "i");
145
- function parseCssEasing(text) {
146
- const value = text.trim().toLowerCase();
147
- if (value.length > 200) return null;
148
- if (ANIMATION_EASING_PRESETS.includes(value)) return value;
149
- if (value === "step-end" || /^steps\(\s*1\s*(,\s*(end|jump-end)\s*)?\)$/.test(value)) return "hold";
150
- const m = CUBIC_RE.exec(value);
151
- if (!m) return null;
152
- const [x1, y1, x2, y2] = m.slice(1).map(Number);
153
- if (![x1, y1, x2, y2].every(Number.isFinite) || x1 < 0 || x1 > 1 || x2 < 0 || x2 > 1) return null;
154
- return { type: "cubic-bezier", x1, y1, x2, y2 };
155
- }
156
- function isAnimationEasing(value) {
157
- if (typeof value === "string") return parseCssEasing(value) !== null;
158
- if (typeof value !== "object" || value === null) return false;
159
- const e = value;
160
- if (e.type === "spring") return true;
161
- return e.type === "cubic-bezier" && [e.x1, e.y1, e.x2, e.y2].every((v) => typeof v === "number" && Number.isFinite(v));
162
- }
163
- var round = (v, digits = 4) => {
164
- const p = 10 ** digits;
165
- return Math.round(v * p) / p;
166
- };
167
- function easingToCss(easing, durationMs = 1e3, samples = 24) {
168
- const resolved = resolveEasing(easing);
169
- if (resolved === "hold") return "steps(1, end)";
170
- if (resolved.type === "spring") {
171
- const n = Math.max(2, Math.floor(samples));
172
- const points = [];
173
- for (let i = 0; i <= n; i++) points.push(String(round(i === n ? 1 : springAt(resolved, i / n * durationMs / 1e3))));
174
- return `linear(${points.join(", ")})`;
175
- }
176
- const { x1, y1, x2, y2 } = resolved;
177
- for (const [name, p] of Object.entries(CUBIC_BEZIER_PRESETS)) {
178
- if (["linear", "ease", "ease-in", "ease-out", "ease-in-out"].includes(name) && p[0] === x1 && p[1] === y1 && p[2] === x2 && p[3] === y2) {
179
- return name;
180
- }
181
- }
182
- return `cubic-bezier(${round(x1)}, ${round(y1)}, ${round(x2)}, ${round(y2)})`;
183
- }
184
- function easingLabel(easing) {
185
- if (easing === void 0 || easing === null) return ANIMATION_EASING_LABELS.linear;
186
- if (typeof easing === "string") return _nullishCoalesce(ANIMATION_EASING_LABELS[easing], () => ( easing));
187
- return easing.type === "spring" ? "Spring" : "Custom";
188
- }
8
+
9
+ var _chunkA6PHCAGXcjs = require('./chunk-A6PHCAGX.cjs');
189
10
 
190
11
  // src/animation/color.ts
191
12
  var toLinear = (c) => c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
@@ -247,7 +68,7 @@ function isValue(value) {
247
68
  function isAnimationKeyframe(value) {
248
69
  if (typeof value !== "object" || value === null) return false;
249
70
  const k = value;
250
- return typeof k.time === "number" && Number.isFinite(k.time) && isValue(k.value) && (k.easing === void 0 || isAnimationEasing(k.easing));
71
+ return typeof k.time === "number" && Number.isFinite(k.time) && isValue(k.value) && (k.easing === void 0 || _chunkXZ4L3R4Kcjs.isAnimationEasing.call(void 0, k.easing));
251
72
  }
252
73
  var sortedCache = /* @__PURE__ */ new WeakMap();
253
74
  function normalizeKeyframes(keyframes) {
@@ -311,7 +132,7 @@ function evaluateTrack(track, time, type = "number") {
311
132
  const span = b.time - a.time;
312
133
  const u = (time - a.time) / span;
313
134
  if (a.easing === "hold") return a.value;
314
- return interpolateAnimationValue(a.value, b.value, evaluateEasing(a.easing, u, span), type);
135
+ return interpolateAnimationValue(a.value, b.value, _chunkXZ4L3R4Kcjs.evaluateEasing.call(void 0, a.easing, u, span), type);
315
136
  }
316
137
  function wrapAnimationTime(time, duration, loop = "none") {
317
138
  if (!Number.isFinite(time)) return 0;
@@ -621,17 +442,5 @@ function createAnimationPlayer(options) {
621
442
 
622
443
 
623
444
 
624
-
625
-
626
-
627
-
628
-
629
-
630
-
631
-
632
-
633
-
634
-
635
-
636
- exports.ANIMATION_EASING_PRESETS = ANIMATION_EASING_PRESETS; exports.ANIMATION_EASING_LABELS = ANIMATION_EASING_LABELS; exports.CUBIC_BEZIER_PRESETS = CUBIC_BEZIER_PRESETS; exports.cubicBezierAt = cubicBezierAt; exports.springAt = springAt; exports.resolveEasing = resolveEasing; exports.evaluateEasing = evaluateEasing; exports.easingFromInfluence = easingFromInfluence; exports.parseCssEasing = parseCssEasing; exports.isAnimationEasing = isAnimationEasing; exports.easingToCss = easingToCss; exports.easingLabel = easingLabel; exports.rgbToOklab = rgbToOklab; exports.oklabToRgb = oklabToRgb; exports.parseOklab = parseOklab; exports.formatOklab = formatOklab; exports.mixColorsOklab = mixColorsOklab; exports.ANIMATION_TIME_EPSILON = ANIMATION_TIME_EPSILON; exports.isAnimationKeyframe = isAnimationKeyframe; exports.normalizeKeyframes = normalizeKeyframes; exports.interpolateAnimationValue = interpolateAnimationValue; exports.evaluateTrack = evaluateTrack; exports.wrapAnimationTime = wrapAnimationTime; exports.pageHidden = pageHidden; exports.realClock = realClock; exports.ManualClock = ManualClock; exports.AnimationPlayer = AnimationPlayer; exports.createAnimationPlayer = createAnimationPlayer;
637
- //# sourceMappingURL=chunk-TTYCN6ZH.cjs.map
445
+ exports.rgbToOklab = rgbToOklab; exports.oklabToRgb = oklabToRgb; exports.parseOklab = parseOklab; exports.formatOklab = formatOklab; exports.mixColorsOklab = mixColorsOklab; exports.ANIMATION_TIME_EPSILON = ANIMATION_TIME_EPSILON; exports.isAnimationKeyframe = isAnimationKeyframe; exports.normalizeKeyframes = normalizeKeyframes; exports.interpolateAnimationValue = interpolateAnimationValue; exports.evaluateTrack = evaluateTrack; exports.wrapAnimationTime = wrapAnimationTime; exports.pageHidden = pageHidden; exports.realClock = realClock; exports.ManualClock = ManualClock; exports.AnimationPlayer = AnimationPlayer; exports.createAnimationPlayer = createAnimationPlayer;
446
+ //# sourceMappingURL=chunk-XHRZSB77.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/chunk-XHRZSB77.cjs","../src/animation/color.ts","../src/animation/keyframes.ts","../src/animation/evaluate.ts","../src/animation/clock.ts","../src/animation/player.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACOA,IAAM,SAAA,EAAW,CAAC,CAAA,EAAA,GAAe,EAAA,GAAK,QAAA,EAAU,EAAA,EAAI,MAAA,EAAA,CAAA,CAAU,EAAA,EAAI,KAAA,EAAA,EAAS,KAAA,EAAA,GAAU,GAAA;AACrF,IAAM,QAAA,EAAU,CAAC,CAAA,EAAA,GAAe,EAAA,GAAK,SAAA,EAAY,MAAA,EAAQ,EAAA,EAAI,MAAA,EAAQ,IAAA,CAAK,IAAA,CAAK,CAAC,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,CAAC,EAAA,GAAA,CAAM,EAAA,EAAI,GAAA,EAAA,EAAO,KAAA;AAGxG,SAAS,UAAA,CAAW,CAAA,EAAW,CAAA,EAAW,CAAA,EAAW,MAAA,EAAQ,CAAA,EAAe;AAClF,EAAA,MAAM,GAAA,EAAK,QAAA,CAAS,CAAC,CAAA;AACrB,EAAA,MAAM,GAAA,EAAK,QAAA,CAAS,CAAC,CAAA;AACrB,EAAA,MAAM,GAAA,EAAK,QAAA,CAAS,CAAC,CAAA;AACrB,EAAA,MAAM,EAAA,EAAI,IAAA,CAA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K,UAAA,IAAc,IAAA,CAAK,UAAA,GACxB,IAAA,CAAK,KAAA,IAAS,IAAA,CAAK,KAAA,GACnB,IAAA,CAAK,aAAA,IAAiB,IAAA,CAAK,aAAA,GAC3B,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,QAAA,EACtB;AACD,MAAA,MAAA;AAAA,IACD;AACA,IAAA,IAAA,CAAK,OAAA,EAAS,IAAA;AACd,IAAA,GAAA,CAAI,YAAA,GAAe,IAAA,CAAK,KAAA,IAAS,IAAA,CAAK,IAAA,kBAAM,IAAA,qBAAK,MAAA,0BAAA,CAAS,IAAA,CAAK,IAAI,GAAA;AACnE,IAAA,IAAA,CAAA,MAAW,SAAA,GAAY,IAAA,CAAK,SAAA,EAAW,QAAA,CAAS,IAAI,CAAA;AAAA,EACrD;AACD,WAAA;AAEO,SAAS,qBAAA,CAAsB,OAAA,EAAmD;AACxF,EAAA,OAAO,IAAI,eAAA,CAAgB,OAAO,CAAA;AACnC;ALwJA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,qqBAAC","file":"/home/runner/work/editor/editor/packages/core/dist/chunk-XHRZSB77.cjs","sourcesContent":[null,"import { hexToRgba, normalizeTokenColor, rgbaToHex } from '../tokens/color.js';\n\n/**\n * Colour interpolation in OKLab (Björn Ottosson's perceptual space, as CSS Color 4 uses for\n * `color-mix(in oklab, …)`), with premultiplied alpha so a fade to `transparent` does not\n * darken through black.\n */\n\nexport interface OklabColor {\n\t/** Lightness, 0–1. */\n\tl: number;\n\ta: number;\n\tb: number;\n\t/** Alpha, 0–1. */\n\talpha: number;\n}\n\nconst toLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);\nconst toGamma = (c: number) => (c <= 0.0031308 ? 12.92 * c : 1.055 * Math.sign(c) * Math.abs(c) ** (1 / 2.4) - 0.055);\n\n/** sRGB channels (0–1) to OKLab. */\nexport function rgbToOklab(r: number, g: number, b: number, alpha = 1): OklabColor {\n\tconst lr = toLinear(r);\n\tconst lg = toLinear(g);\n\tconst lb = toLinear(b);\n\tconst l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);\n\tconst m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);\n\tconst s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);\n\treturn {\n\t\tl: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,\n\t\ta: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,\n\t\tb: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,\n\t\talpha\n\t};\n}\n\n/** OKLab to sRGB channels (0–1, clamped into gamut). */\nexport function oklabToRgb(color: OklabColor): { r: number; g: number; b: number; a: number } {\n\tconst l_ = color.l + 0.3963377774 * color.a + 0.2158037573 * color.b;\n\tconst m_ = color.l - 0.1055613458 * color.a - 0.0638541728 * color.b;\n\tconst s_ = color.l - 0.0894841775 * color.a - 1.291485548 * color.b;\n\tconst l = l_ ** 3;\n\tconst m = m_ ** 3;\n\tconst s = s_ ** 3;\n\tconst clamp01 = (v: number) => Math.min(1, Math.max(0, v));\n\treturn {\n\t\tr: clamp01(toGamma(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s)),\n\t\tg: clamp01(toGamma(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s)),\n\t\tb: clamp01(toGamma(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)),\n\t\ta: clamp01(color.alpha)\n\t};\n}\n\n/** Parses a CSS colour (hex, `rgb()` / `rgba()`, `transparent`, `black`, `white`) to OKLab, or `null`. */\nexport function parseOklab(input: unknown): OklabColor | null {\n\tconst hex = normalizeTokenColor(input);\n\tif (hex === null) return null;\n\tconst c = hexToRgba(hex)!;\n\treturn rgbToOklab(c.r, c.g, c.b, c.a);\n}\n\n/** Formats OKLab as `#rrggbb` (or `#rrggbbaa` when translucent). */\nexport function formatOklab(color: OklabColor): string {\n\tconst { r, g, b, a } = oklabToRgb(color);\n\treturn rgbaToHex(r, g, b, a);\n}\n\n/**\n * Mixes two colours at `t` (0 = `from`, 1 = `to`) in OKLab with premultiplied alpha.\n * Returns `null` when either is not a readable colour.\n */\nexport function mixColorsOklab(from: unknown, to: unknown, t: number): string | null {\n\tconst a = parseOklab(from);\n\tconst b = parseOklab(to);\n\tif (!a || !b) return null;\n\tconst alpha = a.alpha + (b.alpha - a.alpha) * t;\n\tconst premul = (k: 'l' | 'a' | 'b') => a[k] * a.alpha + (b[k] * b.alpha - a[k] * a.alpha) * t;\n\tif (alpha <= 1e-9) return formatOklab({ l: a.l + (b.l - a.l) * t, a: 0, b: 0, alpha: 0 });\n\treturn formatOklab({ l: premul('l') / alpha, a: premul('a') / alpha, b: premul('b') / alpha, alpha });\n}\n","// Portions ported from filmcraft-main/crates/project/src/keyframe.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\nimport { isAnimationEasing, type AnimationEasing } from './easing.js';\n\n/**\n * Keyframe tracks, independent of what they animate: each track is a list of keyframes\n * `{ time (ms), value, easing }`, where the easing governs the segment *leaving* the keyframe\n * (filmcraft / After Effects convention).\n */\n\n/** Keyframe times closer than this (ms) are the same time. */\nexport const ANIMATION_TIME_EPSILON = 1e-6;\n\n/** A keyframe value: a number, or a CSS colour for colour properties. */\nexport type AnimationValue = number | string;\n\nexport interface AnimationKeyframe {\n\t/** Time in milliseconds from the start of the timeline. */\n\ttime: number;\n\tvalue: AnimationValue;\n\t/** Easing of the segment from this keyframe to the next (default `linear`). */\n\teasing?: AnimationEasing;\n}\n\nexport interface AnimationTrack {\n\tkeyframes: AnimationKeyframe[];\n\t/** Disabled tracks keep their keyframes but do not animate (default `true`). */\n\tenabled?: boolean;\n}\n\n/** How a track's values interpolate: numbers linearly, colours in OKLab. */\nexport type AnimationValueType = 'number' | 'color';\n\nfunction isValue(value: unknown): value is AnimationValue {\n\treturn (typeof value === 'number' && Number.isFinite(value)) || typeof value === 'string';\n}\n\n/** Whether `value` is a well-formed keyframe. */\nexport function isAnimationKeyframe(value: unknown): value is AnimationKeyframe {\n\tif (typeof value !== 'object' || value === null) return false;\n\tconst k = value as Record<string, unknown>;\n\treturn (\n\t\ttypeof k.time === 'number' &&\n\t\tNumber.isFinite(k.time) &&\n\t\tisValue(k.value) &&\n\t\t(k.easing === undefined || isAnimationEasing(k.easing))\n\t);\n}\n\nconst sortedCache = new WeakMap<readonly AnimationKeyframe[], { items: AnimationKeyframe[]; out: AnimationKeyframe[] }>();\n\n/**\n * Keyframes sorted by time, invalid entries dropped and duplicate times merged (the *later*\n * entry in the array wins, so appending a keyframe replaces one at the same time). Cached per\n * array (revalidated by element identity), so evaluating every frame does not re-sort; treat\n * keyframe objects as immutable.\n */\nexport function normalizeKeyframes(keyframes: readonly AnimationKeyframe[] | undefined | null): AnimationKeyframe[] {\n\tif (!Array.isArray(keyframes)) return [];\n\tconst cached = sortedCache.get(keyframes);\n\t// The array may have been edited in place since: reuse only while it holds the same keyframes.\n\tif (cached && cached.items.length === keyframes.length && cached.items.every((k, i) => k === keyframes[i])) return cached.out;\n\tconst indexed = keyframes\n\t\t.map((k, i) => ({ k, i }))\n\t\t.filter(({ k }) => isAnimationKeyframe(k))\n\t\t.sort((a, b) => a.k.time - b.k.time || a.i - b.i);\n\tconst out: AnimationKeyframe[] = [];\n\tlet lastIndex = -1;\n\tfor (const { k, i } of indexed) {\n\t\tconst prev = out[out.length - 1];\n\t\tif (prev && Math.abs(k.time - prev.time) <= ANIMATION_TIME_EPSILON) {\n\t\t\tif (i > lastIndex) {\n\t\t\t\tout[out.length - 1] = k;\n\t\t\t\tlastIndex = i;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tout.push(k);\n\t\tlastIndex = i;\n\t}\n\tsortedCache.set(keyframes, { items: [...keyframes], out });\n\treturn out;\n}\n","// Portions ported from filmcraft-main/crates/project/src/keyframe.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\nimport { mixColorsOklab } from './color.js';\nimport { evaluateEasing } from './easing.js';\nimport { normalizeKeyframes, type AnimationKeyframe, type AnimationTrack, type AnimationValue, type AnimationValueType } from './keyframes.js';\n\n/** How time past the end of the timeline maps back into it. */\nexport type AnimationLoopMode = 'none' | 'loop' | 'ping-pong';\n\n/**\n * Interpolates between two keyframe values: numbers linearly, colours in OKLab (premultiplied\n * alpha). Mismatched or unreadable values hold `from` until `t` reaches 1.\n */\nexport function interpolateAnimationValue(from: AnimationValue, to: AnimationValue, t: number, type: AnimationValueType = 'number'): AnimationValue {\n\t// Numbers extrapolate, so overshooting easings (back, spring) overshoot the value too.\n\tif (typeof from === 'number' && typeof to === 'number') return from + (to - from) * t;\n\tif (t <= 0) return from;\n\tif (t >= 1) return to;\n\tif (type === 'color' || (typeof from === 'string' && typeof to === 'string')) {\n\t\tconst mixed = mixColorsOklab(from, to, t);\n\t\tif (mixed !== null) return mixed;\n\t}\n\treturn from;\n}\n\n/** Index of the last keyframe at or before `time` (-1 before the first). Binary search. */\nfunction segmentIndex(keys: readonly AnimationKeyframe[], time: number): number {\n\tlet lo = 0;\n\tlet hi = keys.length - 1;\n\tlet found = -1;\n\twhile (lo <= hi) {\n\t\tconst mid = (lo + hi) >> 1;\n\t\tif (keys[mid].time <= time) {\n\t\t\tfound = mid;\n\t\t\tlo = mid + 1;\n\t\t} else hi = mid - 1;\n\t}\n\treturn found;\n}\n\n/**\n * A track's value at `time`. Before the first keyframe it holds the first value, after the\n * last the last value. Keyframes may be unsorted or share times (see `normalizeKeyframes`).\n * Returns `undefined` for a track without valid keyframes.\n */\nexport function evaluateTrack(track: AnimationTrack | readonly AnimationKeyframe[] | undefined | null, time: number, type: AnimationValueType = 'number'): AnimationValue | undefined {\n\tconst keyframes = Array.isArray(track) ? track : (track as AnimationTrack | undefined)?.keyframes;\n\tconst keys = normalizeKeyframes(keyframes as AnimationKeyframe[]);\n\tif (keys.length === 0) return undefined;\n\tif (!(time > keys[0].time)) return keys[0].value;\n\tconst last = keys[keys.length - 1];\n\tif (time >= last.time) return last.value;\n\tconst i = segmentIndex(keys, time);\n\tconst a = keys[i];\n\tconst b = keys[i + 1];\n\tif (time === a.time) return a.value;\n\tconst span = b.time - a.time;\n\tconst u = (time - a.time) / span;\n\tif (a.easing === 'hold') return a.value;\n\treturn interpolateAnimationValue(a.value, b.value, evaluateEasing(a.easing, u, span), type);\n}\n\n/**\n * Maps a running time onto the timeline `[0, duration]`: clamped (`none`), wrapped (`loop`)\n * or bounced (`ping-pong`).\n */\nexport function wrapAnimationTime(time: number, duration: number, loop: AnimationLoopMode = 'none'): number {\n\tif (!Number.isFinite(time)) return 0;\n\tif (!(duration > 0)) return 0;\n\tif (loop === 'loop') return ((time % duration) + duration) % duration;\n\tif (loop === 'ping-pong') {\n\t\tconst period = duration * 2;\n\t\tconst m = ((time % period) + period) % period;\n\t\treturn m <= duration ? m : period - m;\n\t}\n\treturn Math.min(duration, Math.max(0, time));\n}\n","/**\n * The time source that animations (and canvas agent performances) play on.\n *\n * Defaults to `realClock` (requestAnimationFrame and setTimeout).\n * A `ManualClock` moves only when told to via `advance(ms)` or `tick(fps)`,\n * enabling deterministic frame-by-frame stepping for testing, video generation,\n * or headless server environments.\n */\n\nexport interface Clock {\n\t/** Current time in milliseconds. */\n\tnow(): number;\n\t/** Resolves on the next animation frame. */\n\tframe(): Promise<void>;\n\t/** Resolves after `ms` milliseconds of this clock's time. */\n\tsleep(ms: number): Promise<void>;\n\t/**\n\t * Whether the clock follows wall time. Live clocks stop or degrade when the\n\t * tab is in the background (browsers pause animation frames), so transitions\n\t * can commit immediately rather than leaving operations hanging.\n\t */\n\treadonly live: boolean;\n}\n\n/** Whether the browser tab is hidden (where RAF pauses). */\nexport const pageHidden = (): boolean =>\n\ttypeof document !== 'undefined' && document.hidden;\n\n/** Real-time clock using requestAnimationFrame and setTimeout. */\nexport const realClock: Clock = {\n\tlive: true,\n\tnow: () => (typeof performance !== 'undefined' ? performance.now() : Date.now()),\n\tframe: () =>\n\t\tnew Promise<void>((resolve) => {\n\t\t\tif (typeof requestAnimationFrame === 'function' && !pageHidden()) {\n\t\t\t\trequestAnimationFrame(() => resolve());\n\t\t\t} else {\n\t\t\t\tsetTimeout(resolve, 16);\n\t\t\t}\n\t\t}),\n\tsleep: (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, Math.max(0, ms)))\n};\n\nconst settle = () => new Promise<void>((resolve) => setTimeout(resolve, 0));\n\n/**\n * A deterministic clock that only moves forward when `advance` or `tick` is called.\n * Allows step-by-step frame testing and video rendering without waiting for real time.\n */\nexport class ManualClock implements Clock {\n\treadonly live = false;\n\tprivate time: number;\n\tprivate frames: (() => void)[] = [];\n\tprivate sleepers: { at: number; seq: number; resolve: () => void }[] = [];\n\tprivate seq = 0;\n\n\tconstructor(start = 0) {\n\t\tthis.time = start;\n\t}\n\n\tpublic now(): number {\n\t\treturn this.time;\n\t}\n\n\tpublic frame(): Promise<void> {\n\t\treturn new Promise<void>((resolve) => this.frames.push(resolve));\n\t}\n\n\tpublic sleep(ms: number): Promise<void> {\n\t\treturn new Promise<void>((resolve) =>\n\t\t\tthis.sleepers.push({\n\t\t\t\tat: this.time + Math.max(0, ms),\n\t\t\t\tseq: this.seq++,\n\t\t\t\tresolve\n\t\t\t})\n\t\t);\n\t}\n\n\t/** Whether any frames or sleep timers are currently pending. */\n\tpublic get pending(): boolean {\n\t\treturn this.frames.length > 0 || this.sleepers.length > 0;\n\t}\n\n\t/** Advances time by `ms`, resolving due sleep timers in order, followed by queued frames. */\n\tpublic async advance(ms: number): Promise<void> {\n\t\tconst end = this.time + Math.max(0, ms);\n\t\tawait settle();\n\n\t\twhile (true) {\n\t\t\tlet next: (typeof this.sleepers)[number] | undefined;\n\t\t\tfor (const s of this.sleepers) {\n\t\t\t\tif (s.at <= end && (!next || s.at < next.at || (s.at === next.at && s.seq < next.seq))) {\n\t\t\t\t\tnext = s;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!next) break;\n\n\t\t\tthis.sleepers.splice(this.sleepers.indexOf(next), 1);\n\t\t\tthis.time = Math.max(this.time, next.at);\n\t\t\tnext.resolve();\n\t\t\tawait settle();\n\t\t}\n\n\t\tthis.time = end;\n\t\tconst dueFrames = this.frames.splice(0, this.frames.length);\n\t\tfor (const resolveFrame of dueFrames) {\n\t\t\tresolveFrame();\n\t\t}\n\t\tawait settle();\n\t}\n\n\t/** Convenience method to advance by 1 frame at a given fps (default: 60fps = 16.67ms). */\n\tpublic async tick(fps = 60): Promise<void> {\n\t\tawait this.advance(Math.round(1000 / fps));\n\t}\n}\n","import { realClock, type Clock } from './clock.js';\nimport { wrapAnimationTime, type AnimationLoopMode } from './evaluate.js';\n\nexport interface AnimationPlayerState {\n\t/** Playhead time in ms, inside `[0, duration]`. */\n\ttime: number;\n\tplaying: boolean;\n\t/** True between `scrub` and `endScrub`. */\n\tscrubbing: boolean;\n\tloop: AnimationLoopMode;\n\t/** Speed multiplier (negative plays backwards). */\n\tplaybackRate: number;\n\tduration: number;\n}\n\nexport interface AnimationPlayerOptions {\n\t/** Time source (default `realClock`: requestAnimationFrame). Pass a `ManualClock` in tests or for rendering. */\n\tclock?: Clock;\n\t/** Timeline length in ms, or a getter (e.g. the last keyframe time). Default 1000. */\n\tduration?: number | (() => number);\n\tloop?: AnimationLoopMode;\n\tplaybackRate?: number;\n\t/** Initial playhead time (default 0). */\n\ttime?: number;\n\t/** Called whenever the playhead moves (playback, seek, scrub). */\n\tonTime?: (time: number) => void;\n\t/** Called when non-looping playback reaches the end (or the start, playing backwards). */\n\tonEnd?: () => void;\n}\n\n/**\n * Plays a timeline on an injectable `Clock`: play / pause / seek / scrub with looping,\n * ping-pong and playback rate. It only asks the clock for frames while playing, so a\n * `ManualClock` steps it deterministically and the real clock's requestAnimationFrame is the\n * only place wall time enters.\n *\n * `getState()` returns a cached snapshot replaced on change (usable with `useSyncExternalStore`).\n */\nexport class AnimationPlayer {\n\tprivate readonly clock: Clock;\n\tprivate durationSource: number | (() => number);\n\tprivate onTime?: (time: number) => void;\n\tprivate onEnd?: () => void;\n\tprivate time: number;\n\tprivate playing = false;\n\tprivate scrubbing = false;\n\tprivate resumeAfterScrub = false;\n\tprivate loop: AnimationLoopMode;\n\tprivate rate: number;\n\t/** Unwrapped time at `anchorAt` (keeps the ping-pong direction across frames). */\n\tprivate anchorRaw = 0;\n\tprivate anchorAt = 0;\n\tprivate generation = 0;\n\tprivate cached: AnimationPlayerState;\n\tprivate listeners = new Set<(state: AnimationPlayerState) => void>();\n\n\tconstructor(options: AnimationPlayerOptions = {}) {\n\t\tthis.clock = options.clock ?? realClock;\n\t\tthis.durationSource = options.duration ?? 1000;\n\t\tthis.loop = options.loop ?? 'none';\n\t\tthis.rate = Number.isFinite(options.playbackRate) && options.playbackRate !== 0 ? options.playbackRate! : 1;\n\t\tthis.onTime = options.onTime;\n\t\tthis.onEnd = options.onEnd;\n\t\tthis.time = this.clamp(options.time ?? 0);\n\t\tthis.cached = this.snapshot();\n\t}\n\n\t/** Current timeline length (ms). */\n\tget duration(): number {\n\t\tconst d = typeof this.durationSource === 'function' ? this.durationSource() : this.durationSource;\n\t\treturn Number.isFinite(d) && d > 0 ? d : 0;\n\t}\n\n\tget currentTime(): number {\n\t\treturn this.time;\n\t}\n\n\tget isPlaying(): boolean {\n\t\treturn this.playing;\n\t}\n\n\tgetState(): AnimationPlayerState {\n\t\treturn this.cached;\n\t}\n\n\tsubscribe(listener: (state: AnimationPlayerState) => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\t/** Replaces the callbacks (hooks keep them current without recreating the player). */\n\tsetCallbacks(callbacks: { onTime?: (time: number) => void; onEnd?: () => void }): void {\n\t\tthis.onTime = callbacks.onTime;\n\t\tthis.onEnd = callbacks.onEnd;\n\t}\n\n\tsetDuration(duration: number | (() => number)): void {\n\t\tthis.durationSource = duration;\n\t\tthis.time = this.clamp(this.time);\n\t\tthis.emit(false);\n\t}\n\n\tsetLoop(loop: AnimationLoopMode): void {\n\t\tif (loop === this.loop) return;\n\t\tthis.reanchor();\n\t\tthis.loop = loop;\n\t\tthis.emit(false);\n\t}\n\n\tsetPlaybackRate(rate: number): void {\n\t\tif (!Number.isFinite(rate) || rate === 0 || rate === this.rate) return;\n\t\tthis.reanchor();\n\t\tthis.rate = rate;\n\t\tthis.emit(false);\n\t}\n\n\t/** Starts playing from the playhead (from the start again when a one-shot play had ended). */\n\tplay(): void {\n\t\tif (this.playing) return;\n\t\tconst d = this.duration;\n\t\tif (this.loop === 'none' && d > 0) {\n\t\t\tif (this.rate > 0 && this.time >= d) this.time = 0;\n\t\t\tif (this.rate < 0 && this.time <= 0) this.time = d;\n\t\t}\n\t\tthis.playing = true;\n\t\tthis.scrubbing = false;\n\t\tthis.anchorRaw = this.time;\n\t\tthis.anchorAt = this.clock.now();\n\t\tthis.emit(false);\n\t\tthis.schedule();\n\t}\n\n\tpause(): void {\n\t\tif (!this.playing) return;\n\t\tthis.tick(false);\n\t\tthis.playing = false;\n\t\tthis.generation++;\n\t\tthis.emit(true);\n\t}\n\n\ttoggle(): void {\n\t\tif (this.playing) this.pause();\n\t\telse this.play();\n\t}\n\n\t/** Pauses and returns to the start. */\n\tstop(): void {\n\t\tthis.playing = false;\n\t\tthis.generation++;\n\t\tthis.seek(0);\n\t}\n\n\t/** Moves the playhead (clamped to the timeline); playback continues from there. */\n\tseek(time: number): void {\n\t\tif (!Number.isFinite(time)) return;\n\t\tthis.time = this.clamp(time);\n\t\tthis.anchorRaw = this.time;\n\t\tthis.anchorAt = this.clock.now();\n\t\tthis.emit(true);\n\t}\n\n\t/** Seeks while dragging the playhead: playback pauses until `endScrub`. */\n\tscrub(time: number): void {\n\t\tif (!this.scrubbing) {\n\t\t\tthis.resumeAfterScrub = this.playing;\n\t\t\tif (this.playing) {\n\t\t\t\tthis.playing = false;\n\t\t\t\tthis.generation++;\n\t\t\t}\n\t\t\tthis.scrubbing = true;\n\t\t}\n\t\tthis.seek(time);\n\t}\n\n\t/** Ends a scrub, resuming playback if it was playing when the scrub began. */\n\tendScrub(): void {\n\t\tif (!this.scrubbing) return;\n\t\tthis.scrubbing = false;\n\t\tconst resume = this.resumeAfterScrub;\n\t\tthis.resumeAfterScrub = false;\n\t\tif (resume) this.play();\n\t\telse this.emit(false);\n\t}\n\n\t/** Stops scheduling frames and drops listeners. */\n\tdestroy(): void {\n\t\tthis.playing = false;\n\t\tthis.generation++;\n\t\tthis.listeners.clear();\n\t}\n\n\tprivate clamp(time: number): number {\n\t\treturn Math.min(this.duration, Math.max(0, Number.isFinite(time) ? time : 0));\n\t}\n\n\tprivate reanchor() {\n\t\tif (!this.playing) return;\n\t\tthis.tick(false);\n\t\tthis.anchorRaw = this.rawNow();\n\t\tthis.anchorAt = this.clock.now();\n\t}\n\n\tprivate rawNow(): number {\n\t\treturn this.anchorRaw + (this.clock.now() - this.anchorAt) * this.rate;\n\t}\n\n\tprivate schedule() {\n\t\tconst generation = this.generation;\n\t\tthis.clock.frame().then(() => {\n\t\t\tif (generation !== this.generation || !this.playing) return;\n\t\t\tthis.tick(true);\n\t\t\tif (this.playing) this.schedule();\n\t\t});\n\t}\n\n\t/** Advances the playhead to the clock's time; `notify` emits the change. */\n\tprivate tick(notify: boolean) {\n\t\tif (!this.playing) return;\n\t\tconst d = this.duration;\n\t\tconst raw = this.rawNow();\n\t\tlet ended = false;\n\t\tif (this.loop === 'none' || d <= 0) {\n\t\t\tif (this.rate > 0 && raw >= d) {\n\t\t\t\tthis.time = d;\n\t\t\t\tended = true;\n\t\t\t} else if (this.rate < 0 && raw <= 0) {\n\t\t\t\tthis.time = 0;\n\t\t\t\tended = true;\n\t\t\t} else this.time = this.clamp(raw);\n\t\t} else {\n\t\t\tthis.time = wrapAnimationTime(raw, d, this.loop);\n\t\t}\n\t\tif (ended) {\n\t\t\tthis.playing = false;\n\t\t\tthis.generation++;\n\t\t}\n\t\tif (notify || ended) this.emit(true);\n\t\tif (ended) this.onEnd?.();\n\t}\n\n\tprivate snapshot(): AnimationPlayerState {\n\t\treturn {\n\t\t\ttime: this.time,\n\t\t\tplaying: this.playing,\n\t\t\tscrubbing: this.scrubbing,\n\t\t\tloop: this.loop,\n\t\t\tplaybackRate: this.rate,\n\t\t\tduration: this.duration\n\t\t};\n\t}\n\n\tprivate emit(timeChanged: boolean) {\n\t\tconst next = this.snapshot();\n\t\tconst prev = this.cached;\n\t\tif (\n\t\t\tprev.time === next.time &&\n\t\t\tprev.playing === next.playing &&\n\t\t\tprev.scrubbing === next.scrubbing &&\n\t\t\tprev.loop === next.loop &&\n\t\t\tprev.playbackRate === next.playbackRate &&\n\t\t\tprev.duration === next.duration\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.cached = next;\n\t\tif (timeChanged && prev.time !== next.time) this.onTime?.(next.time);\n\t\tfor (const listener of this.listeners) listener(next);\n\t}\n}\n\nexport function createAnimationPlayer(options?: AnimationPlayerOptions): AnimationPlayer {\n\treturn new AnimationPlayer(options);\n}\n"]}
@@ -0,0 +1,262 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/animation/easing.ts
2
+ var ANIMATION_EASING_PRESETS = [
3
+ "linear",
4
+ "ease",
5
+ "ease-in",
6
+ "ease-out",
7
+ "ease-in-out",
8
+ "ease-in-back",
9
+ "ease-out-back",
10
+ "ease-out-elastic",
11
+ "ease-in-elastic",
12
+ "ease-in-out-elastic",
13
+ "elastic",
14
+ "spring",
15
+ "hold"
16
+ ];
17
+ var ANIMATION_EASING_LABELS = {
18
+ linear: "Linear",
19
+ hold: "Hold",
20
+ ease: "Ease",
21
+ "ease-in": "Ease in",
22
+ "ease-out": "Ease out",
23
+ "ease-in-out": "Ease in-out",
24
+ "ease-in-back": "Back in",
25
+ "ease-out-back": "Back out",
26
+ "ease-out-elastic": "Elastic out",
27
+ "ease-in-elastic": "Elastic in",
28
+ "ease-in-out-elastic": "Elastic in-out",
29
+ elastic: "Elastic",
30
+ spring: "Spring"
31
+ };
32
+ var CUBIC_BEZIER_PRESETS = {
33
+ linear: [0, 0, 1, 1],
34
+ ease: [0.25, 0.1, 0.25, 1],
35
+ "ease-in": [0.42, 0, 1, 1],
36
+ "ease-out": [0, 0, 0.58, 1],
37
+ "ease-in-out": [0.42, 0, 0.58, 1],
38
+ "ease-in-back": [0.36, 0, 0.66, -0.56],
39
+ "ease-out-back": [0.34, 1.56, 0.64, 1]
40
+ };
41
+ var DEFAULT_SPRING = { stiffness: 170, damping: 26, mass: 1, velocity: 0 };
42
+ var DEFAULT_ELASTIC = { amplitude: 1, period: 0.3, mode: "out" };
43
+ var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
44
+ var finite = (v, fallback) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
45
+ function elasticAt(elastic, t) {
46
+ if (t <= 0) return 0;
47
+ if (t >= 1) return 1;
48
+ const a = Math.max(1e-6, finite(elastic.amplitude, DEFAULT_ELASTIC.amplitude));
49
+ const p = Math.max(1e-6, finite(elastic.period, DEFAULT_ELASTIC.period));
50
+ const mode = _nullishCoalesce(elastic.mode, () => ( "out"));
51
+ const TAU = 2 * Math.PI;
52
+ const solveOut = (u, amp, per) => {
53
+ const s = amp < 1 ? per / 4 : per / TAU * Math.asin(1 / amp);
54
+ return amp * Math.pow(2, -10 * u) * Math.sin((u - s) * TAU / per) + 1;
55
+ };
56
+ const solveIn = (u, amp, per) => {
57
+ const s = amp < 1 ? per / 4 : per / TAU * Math.asin(1 / amp);
58
+ const adjusted = u - 1;
59
+ return -(amp * Math.pow(2, 10 * adjusted) * Math.sin((adjusted - s) * TAU / per));
60
+ };
61
+ if (mode === "in") {
62
+ return solveIn(t, a, p);
63
+ }
64
+ if (mode === "in-out") {
65
+ if (t < 0.5) {
66
+ return 0.5 * solveIn(t * 2, a, p);
67
+ }
68
+ return 0.5 + 0.5 * solveOut((t - 0.5) * 2, a, p);
69
+ }
70
+ return solveOut(t, a, p);
71
+ }
72
+ function cubicBezierAt(x1, y1, x2, y2, x) {
73
+ if (x <= 0) return 0;
74
+ if (x >= 1) return 1;
75
+ x1 = clamp(x1, 0, 1);
76
+ x2 = clamp(x2, 0, 1);
77
+ const bx = (s2) => 3 * (1 - s2) * (1 - s2) * s2 * x1 + 3 * (1 - s2) * s2 * s2 * x2 + s2 * s2 * s2;
78
+ const by = (s2) => 3 * (1 - s2) * (1 - s2) * s2 * y1 + 3 * (1 - s2) * s2 * s2 * y2 + s2 * s2 * s2;
79
+ const dbx = (s2) => 3 * (1 - s2) * (1 - s2) * x1 + 6 * (1 - s2) * s2 * (x2 - x1) + 3 * s2 * s2 * (1 - x2);
80
+ let s = x;
81
+ for (let i = 0; i < 8; i++) {
82
+ const d = dbx(s);
83
+ if (Math.abs(d) < 1e-9) break;
84
+ const next = s - (bx(s) - x) / d;
85
+ if (!(next >= 0 && next <= 1)) break;
86
+ s = next;
87
+ }
88
+ if (Math.abs(bx(s) - x) > 1e-7) {
89
+ let lo = 0;
90
+ let hi = 1;
91
+ for (let i = 0; i < 60; i++) {
92
+ s = (lo + hi) / 2;
93
+ if (bx(s) < x) lo = s;
94
+ else hi = s;
95
+ }
96
+ }
97
+ return by(s);
98
+ }
99
+ function springAt(spring, seconds) {
100
+ const stiffness = Math.max(1e-6, finite(spring.stiffness, DEFAULT_SPRING.stiffness));
101
+ const damping = Math.max(0, finite(spring.damping, DEFAULT_SPRING.damping));
102
+ const mass = Math.max(1e-6, finite(spring.mass, DEFAULT_SPRING.mass));
103
+ const v0 = -finite(spring.velocity, DEFAULT_SPRING.velocity);
104
+ const t = Math.max(0, seconds);
105
+ const w0 = Math.sqrt(stiffness / mass);
106
+ const zeta = damping / (2 * Math.sqrt(stiffness * mass));
107
+ let x;
108
+ if (zeta < 1 - 1e-6) {
109
+ const wd = w0 * Math.sqrt(1 - zeta * zeta);
110
+ x = Math.exp(-zeta * w0 * t) * (Math.cos(wd * t) + (zeta * w0 + v0) / wd * Math.sin(wd * t));
111
+ } else if (zeta <= 1 + 1e-6) {
112
+ x = Math.exp(-w0 * t) * (1 + (w0 + v0) * t);
113
+ } else {
114
+ const r = Math.sqrt(zeta * zeta - 1);
115
+ const s1 = -w0 * (zeta - r);
116
+ const s2 = -w0 * (zeta + r);
117
+ const c2 = (v0 - s1) / (s2 - s1);
118
+ const c1 = 1 - c2;
119
+ x = c1 * Math.exp(s1 * t) + c2 * Math.exp(s2 * t);
120
+ }
121
+ return 1 - x;
122
+ }
123
+ function resolveEasing(easing) {
124
+ if (easing === "hold") return "hold";
125
+ if (easing === "spring") return { type: "spring", ...DEFAULT_SPRING };
126
+ if (easing === "elastic" || easing === "ease-out-elastic") {
127
+ return { type: "elastic", ...DEFAULT_ELASTIC, mode: "out" };
128
+ }
129
+ if (easing === "ease-in-elastic") {
130
+ return { type: "elastic", ...DEFAULT_ELASTIC, mode: "in" };
131
+ }
132
+ if (easing === "ease-in-out-elastic") {
133
+ return { type: "elastic", ...DEFAULT_ELASTIC, mode: "in-out" };
134
+ }
135
+ if (typeof easing === "string") {
136
+ const preset = CUBIC_BEZIER_PRESETS[easing];
137
+ if (preset) return { type: "cubic-bezier", x1: preset[0], y1: preset[1], x2: preset[2], y2: preset[3] };
138
+ const parsed = parseCssEasing(easing);
139
+ return parsed ? resolveEasing(parsed) : { type: "cubic-bezier", x1: 0, y1: 0, x2: 1, y2: 1 };
140
+ }
141
+ if (easing && typeof easing === "object") {
142
+ if (easing.type === "spring") {
143
+ return {
144
+ type: "spring",
145
+ stiffness: finite(easing.stiffness, DEFAULT_SPRING.stiffness),
146
+ damping: finite(easing.damping, DEFAULT_SPRING.damping),
147
+ mass: finite(easing.mass, DEFAULT_SPRING.mass),
148
+ velocity: finite(easing.velocity, DEFAULT_SPRING.velocity)
149
+ };
150
+ }
151
+ if (easing.type === "elastic") {
152
+ return {
153
+ type: "elastic",
154
+ amplitude: finite(easing.amplitude, DEFAULT_ELASTIC.amplitude),
155
+ period: finite(easing.period, DEFAULT_ELASTIC.period),
156
+ mode: easing.mode === "in" || easing.mode === "in-out" ? easing.mode : "out"
157
+ };
158
+ }
159
+ if (easing.type === "cubic-bezier") {
160
+ return {
161
+ type: "cubic-bezier",
162
+ x1: clamp(finite(easing.x1, 0), 0, 1),
163
+ y1: finite(easing.y1, 0),
164
+ x2: clamp(finite(easing.x2, 1), 0, 1),
165
+ y2: finite(easing.y2, 1)
166
+ };
167
+ }
168
+ }
169
+ return { type: "cubic-bezier", x1: 0, y1: 0, x2: 1, y2: 1 };
170
+ }
171
+ function evaluateEasing(easing, u, durationMs = 1e3) {
172
+ if (!(u > 0)) return 0;
173
+ if (u >= 1) return 1;
174
+ const resolved = resolveEasing(easing);
175
+ if (resolved === "hold") return 0;
176
+ if (resolved.type === "spring") return springAt(resolved, u * Math.max(0, durationMs) / 1e3);
177
+ if (resolved.type === "elastic") return elasticAt(resolved, u);
178
+ const { x1, y1, x2, y2 } = resolved;
179
+ if (x1 === y1 && x2 === y2) return u;
180
+ return cubicBezierAt(x1, y1, x2, y2, u);
181
+ }
182
+ function easingFromInfluence(outInfluence = 1 / 3, inInfluence = 1 / 3) {
183
+ return {
184
+ type: "cubic-bezier",
185
+ x1: clamp(outInfluence, 0.01, 1),
186
+ y1: 0,
187
+ x2: 1 - clamp(inInfluence, 0.01, 1),
188
+ y2: 1
189
+ };
190
+ }
191
+ var NUMBER = String.raw`\s*(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)\s*`;
192
+ var CUBIC_RE = new RegExp(`^cubic-bezier\\(${NUMBER},${NUMBER},${NUMBER},${NUMBER}\\)$`, "i");
193
+ function parseCssEasing(text) {
194
+ const value = text.trim().toLowerCase();
195
+ if (value.length > 200) return null;
196
+ if (ANIMATION_EASING_PRESETS.includes(value)) return value;
197
+ if (value === "step-end" || /^steps\(\s*1\s*(,\s*(end|jump-end)\s*)?\)$/.test(value)) return "hold";
198
+ const m = CUBIC_RE.exec(value);
199
+ if (!m) return null;
200
+ const [x1, y1, x2, y2] = m.slice(1).map(Number);
201
+ if (![x1, y1, x2, y2].every(Number.isFinite) || x1 < 0 || x1 > 1 || x2 < 0 || x2 > 1) return null;
202
+ return { type: "cubic-bezier", x1, y1, x2, y2 };
203
+ }
204
+ function isAnimationEasing(value) {
205
+ if (typeof value === "string") return parseCssEasing(value) !== null;
206
+ if (typeof value !== "object" || value === null) return false;
207
+ const e = value;
208
+ if (e.type === "spring") return true;
209
+ if (e.type === "elastic") return true;
210
+ return e.type === "cubic-bezier" && [e.x1, e.y1, e.x2, e.y2].every((v) => typeof v === "number" && Number.isFinite(v));
211
+ }
212
+ var round = (v, digits = 4) => {
213
+ const p = 10 ** digits;
214
+ return Math.round(v * p) / p;
215
+ };
216
+ function easingToCss(easing, durationMs = 1e3, samples = 24) {
217
+ const resolved = resolveEasing(easing);
218
+ if (resolved === "hold") return "steps(1, end)";
219
+ if (resolved.type === "spring") {
220
+ const n = Math.max(2, Math.floor(samples));
221
+ const points = [];
222
+ for (let i = 0; i <= n; i++) points.push(String(round(i === n ? 1 : springAt(resolved, i / n * durationMs / 1e3))));
223
+ return `linear(${points.join(", ")})`;
224
+ }
225
+ if (resolved.type === "elastic") {
226
+ const n = Math.max(2, Math.floor(samples));
227
+ const points = [];
228
+ for (let i = 0; i <= n; i++) points.push(String(round(i === n ? 1 : elasticAt(resolved, i / n))));
229
+ return `linear(${points.join(", ")})`;
230
+ }
231
+ const { x1, y1, x2, y2 } = resolved;
232
+ for (const [name, p] of Object.entries(CUBIC_BEZIER_PRESETS)) {
233
+ if (["linear", "ease", "ease-in", "ease-out", "ease-in-out"].includes(name) && p[0] === x1 && p[1] === y1 && p[2] === x2 && p[3] === y2) {
234
+ return name;
235
+ }
236
+ }
237
+ return `cubic-bezier(${round(x1)}, ${round(y1)}, ${round(x2)}, ${round(y2)})`;
238
+ }
239
+ function easingLabel(easing) {
240
+ if (easing === void 0 || easing === null) return ANIMATION_EASING_LABELS.linear;
241
+ if (typeof easing === "string") return _nullishCoalesce(ANIMATION_EASING_LABELS[easing], () => ( easing));
242
+ if (easing.type === "spring") return "Spring";
243
+ if (easing.type === "elastic") return "Elastic";
244
+ return "Custom";
245
+ }
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+ exports.ANIMATION_EASING_PRESETS = ANIMATION_EASING_PRESETS; exports.ANIMATION_EASING_LABELS = ANIMATION_EASING_LABELS; exports.CUBIC_BEZIER_PRESETS = CUBIC_BEZIER_PRESETS; exports.elasticAt = elasticAt; exports.cubicBezierAt = cubicBezierAt; exports.springAt = springAt; exports.resolveEasing = resolveEasing; exports.evaluateEasing = evaluateEasing; exports.easingFromInfluence = easingFromInfluence; exports.parseCssEasing = parseCssEasing; exports.isAnimationEasing = isAnimationEasing; exports.easingToCss = easingToCss; exports.easingLabel = easingLabel;
262
+ //# sourceMappingURL=chunk-XZ4L3R4K.cjs.map