@mkbabb/keyframes.js 4.3.0 → 4.4.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 +28 -1
- package/dist/animate-CuUJt2Tb.js +26 -0
- package/dist/{animations-DaMcGoCd.js → animations-5nf2kBkv.js} +3 -3
- package/dist/compile-DgNRG6Lo.js +251 -0
- package/dist/{draw-svg-CF2cTJj-.js → draw-svg-DYRDxBlL.js} +1 -1
- package/dist/engine-CNHvTgpw.js +1122 -0
- package/dist/errors-W8zkvPw4.js +21 -0
- package/dist/format-BUgCTjmr.js +123 -0
- package/dist/ingest-CNM5xkQT.js +160 -0
- package/dist/keyframes.d.ts +2044 -1271
- package/dist/keyframes.js +226 -90
- package/dist/morph-svg-DRjl9Hfz.js +62 -0
- package/dist/{motion-path-CqmlG74k.js → motion-path-J-RSNmRQ.js} +1 -1
- package/dist/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/scheduler-7eIr_q1g.js +14 -0
- package/dist/scroll-grammar-B4kPvGh5.js +23 -0
- package/dist/{scroll-scene-JpRpH1uU.js → scroll-scene-CXEgM49Q.js} +18 -39
- package/dist/{sequence-COn8zk5o.js → sequence-CF5hazqz.js} +49 -7
- package/dist/{springTimingFunction-CcJEvGwN.js → springTimingFunction-CDHZ00JQ.js} +23 -11
- package/dist/{timeline-BjcmprQ6.js → timeline-B7SV3T_E.js} +127 -101
- package/dist/utils-D7nuAND5.js +97 -0
- package/dist/validate-8r6Yo-uc.js +35 -0
- package/dist/{waapi-Bd5QadtA.js → waapi-D9MHMm_9.js} +1 -1
- package/package.json +31 -6
- package/dist/animate-D5KoLKwi.js +0 -21
- package/dist/binarySearch-DOP8erk-.js +0 -13
- package/dist/compile-C0xOTIC4.js +0 -249
- package/dist/engine-BKm1GcJT.js +0 -1028
- package/dist/ingest-BFBYGTH-.js +0 -139
package/dist/keyframes.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { n as v, t as y } from "./springTimingFunction-
|
|
1
|
+
import { n as e, t } from "./errors-W8zkvPw4.js";
|
|
2
|
+
import { _ as n, a as r, c as i, f as a, g 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 } from "./timeline-B7SV3T_E.js";
|
|
3
|
+
import { n as _, r as v, t as y } from "./springTimingFunction-CDHZ00JQ.js";
|
|
4
4
|
import { n as b, t as x } from "./decay-BvNmFk51.js";
|
|
5
|
-
import { t as S } from "./sequence-
|
|
5
|
+
import { t as S } from "./sequence-CF5hazqz.js";
|
|
6
6
|
//#region src/animation/numeric.ts
|
|
7
|
-
var C = class {
|
|
7
|
+
var C = new Float64Array(), w = class {
|
|
8
8
|
keyframes;
|
|
9
9
|
segments;
|
|
10
10
|
positions;
|
|
@@ -12,17 +12,17 @@ var C = class {
|
|
|
12
12
|
_duration;
|
|
13
13
|
_respectReducedMotion;
|
|
14
14
|
_easingFn;
|
|
15
|
-
_playback = new
|
|
16
|
-
constructor(
|
|
17
|
-
if (
|
|
18
|
-
this.keyframes =
|
|
19
|
-
let
|
|
20
|
-
if (typeof
|
|
21
|
-
if (this._easingFn =
|
|
22
|
-
if (
|
|
23
|
-
this.positions =
|
|
24
|
-
} else this.positions =
|
|
25
|
-
this.result = { ...
|
|
15
|
+
_playback = new c();
|
|
16
|
+
constructor(e, r) {
|
|
17
|
+
if (e.length < 2) throw Error("NumericAnimation requires at least 2 keyframes.");
|
|
18
|
+
this.keyframes = e.map((e) => ({ ...e })), this._duration = r?.duration ?? 0, this._respectReducedMotion = r?.respectReducedMotion ?? !1;
|
|
19
|
+
let i = r?.timingFunction;
|
|
20
|
+
if (typeof i == "string") throw new t("timingFunction", i, "NumericAnimation accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
|
|
21
|
+
if (this._easingFn = i == null ? (e) => e : n(i).fn, r?.positions) {
|
|
22
|
+
if (r.positions.length !== e.length) throw Error("positions length must match keyframes length.");
|
|
23
|
+
this.positions = r.positions;
|
|
24
|
+
} else this.positions = e.map((t, n) => n / (e.length - 1) * 100);
|
|
25
|
+
this.result = { ...e[0] }, this.segments = this.buildSegments();
|
|
26
26
|
}
|
|
27
27
|
buildSegments() {
|
|
28
28
|
let e = [];
|
|
@@ -30,21 +30,27 @@ var C = class {
|
|
|
30
30
|
return e;
|
|
31
31
|
}
|
|
32
32
|
buildSegment(e) {
|
|
33
|
-
let t = this.keyframes[e], n = this.keyframes[e + 1], r = Object.keys(t);
|
|
33
|
+
let t = this.keyframes[e], n = this.keyframes[e + 1], r = Object.keys(t), i = new Float64Array(r.length), a = new Float64Array(r.length);
|
|
34
|
+
for (let e = 0; e < r.length; e++) {
|
|
35
|
+
let o = r[e];
|
|
36
|
+
i[e] = t[o], a[e] = n[o];
|
|
37
|
+
}
|
|
34
38
|
return {
|
|
35
39
|
startPos: this.positions[e],
|
|
36
40
|
stopPos: this.positions[e + 1],
|
|
37
41
|
keys: r,
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
from: i,
|
|
43
|
+
to: a,
|
|
40
44
|
timingFunction: this._easingFn
|
|
41
45
|
};
|
|
42
46
|
}
|
|
43
47
|
at(e) {
|
|
44
|
-
let t =
|
|
48
|
+
let t = a(e, 0, 1) * 100, n = v(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
|
|
45
49
|
n === -1 && (n = this.segments.length - 1);
|
|
46
|
-
let
|
|
47
|
-
|
|
50
|
+
let r = this.segments[n], i = l(a(t, r.startPos, r.stopPos), r.startPos, r.stopPos, 0, 1), o = r.timingFunction(i), s = r.keys.length;
|
|
51
|
+
C.length < s && (C = new Float64Array(s)), f(r.from, r.to, o, C);
|
|
52
|
+
let c = this.result;
|
|
53
|
+
for (let e = 0; e < s; e++) c[r.keys[e]] = C[e];
|
|
48
54
|
return this.result;
|
|
49
55
|
}
|
|
50
56
|
updateKeyframe(e, t) {
|
|
@@ -61,7 +67,7 @@ var C = class {
|
|
|
61
67
|
stop() {
|
|
62
68
|
this._playback.stop();
|
|
63
69
|
}
|
|
64
|
-
},
|
|
70
|
+
}, T = (e) => {
|
|
65
71
|
if (e instanceof HTMLElement) {
|
|
66
72
|
let t = e.getBoundingClientRect();
|
|
67
73
|
return {
|
|
@@ -72,7 +78,7 @@ var C = class {
|
|
|
72
78
|
};
|
|
73
79
|
}
|
|
74
80
|
return e;
|
|
75
|
-
},
|
|
81
|
+
}, E = class {
|
|
76
82
|
animation;
|
|
77
83
|
transformOrigin;
|
|
78
84
|
timingFunction;
|
|
@@ -81,8 +87,8 @@ var C = class {
|
|
|
81
87
|
this.transformOrigin = n?.transformOrigin ?? "top left", this.timingFunction = n?.timingFunction, this.duration = n?.duration ?? 0, this.measure(e, t);
|
|
82
88
|
}
|
|
83
89
|
measure(e, t) {
|
|
84
|
-
let n =
|
|
85
|
-
return this.animation = new
|
|
90
|
+
let n = T(e), r = T(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;
|
|
91
|
+
return this.animation = new w([{
|
|
86
92
|
translateX: 0,
|
|
87
93
|
translateY: 0,
|
|
88
94
|
scaleX: 1,
|
|
@@ -116,35 +122,65 @@ var C = class {
|
|
|
116
122
|
stop() {
|
|
117
123
|
this.animation.stop();
|
|
118
124
|
}
|
|
119
|
-
},
|
|
120
|
-
|
|
125
|
+
}, D = 2 * Math.PI;
|
|
126
|
+
function O(e, t) {
|
|
127
|
+
let n = e - Math.floor(e);
|
|
128
|
+
switch (t) {
|
|
129
|
+
case "sine": return Math.sin(D * n);
|
|
130
|
+
case "triangle": return n < .5 ? 4 * n - 1 : 3 - 4 * n;
|
|
131
|
+
case "square": return n < .5 ? 1 : -1;
|
|
132
|
+
case "sawtooth": return 2 * n - 1;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
var k = class {
|
|
136
|
+
frequency;
|
|
137
|
+
waveform;
|
|
138
|
+
phase = 0;
|
|
139
|
+
constructor(e) {
|
|
140
|
+
this.frequency = e.frequency, this.waveform = e.waveform ?? "sine";
|
|
141
|
+
}
|
|
142
|
+
tick(e) {
|
|
143
|
+
let t = this.phase + this.frequency * e;
|
|
144
|
+
return this.phase = t - Math.floor(t), this.phase;
|
|
145
|
+
}
|
|
146
|
+
get value() {
|
|
147
|
+
return O(this.phase, this.waveform);
|
|
148
|
+
}
|
|
149
|
+
sample(e) {
|
|
150
|
+
return O(e * this.frequency, this.waveform);
|
|
151
|
+
}
|
|
152
|
+
reset(e = 0) {
|
|
153
|
+
this.phase = e - Math.floor(e);
|
|
154
|
+
}
|
|
155
|
+
}, A = (e, t) => {
|
|
156
|
+
if (typeof e == "number") return a(e, 0, Math.max(0, t - 1));
|
|
121
157
|
switch (e) {
|
|
122
158
|
case "first": return 0;
|
|
123
159
|
case "last": return t - 1;
|
|
124
160
|
case "center": return (t - 1) / 2;
|
|
125
161
|
case "edges": return -1;
|
|
126
162
|
}
|
|
127
|
-
},
|
|
163
|
+
}, ee = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - A(n, t)), j = (e, t) => {
|
|
128
164
|
if (e <= 1) return 0;
|
|
129
165
|
if (t === "edges") return Math.floor((e - 1) / 2);
|
|
130
|
-
let n =
|
|
166
|
+
let n = A(t, e);
|
|
131
167
|
return Math.max(n, e - 1 - n);
|
|
132
168
|
};
|
|
133
|
-
function
|
|
134
|
-
let { each:
|
|
135
|
-
if (typeof
|
|
136
|
-
let
|
|
169
|
+
function M(e, r = {}) {
|
|
170
|
+
let { each: i = 100, from: a = "first", ease: o } = r;
|
|
171
|
+
if (typeof o == "string") throw new t("ease", o, "stagger accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
|
|
172
|
+
let s = o ? n(o).fn : void 0, c = typeof e == "number" ? e : e.length, l = (e, t) => {
|
|
137
173
|
if (t <= 1) return 0;
|
|
138
|
-
let n =
|
|
174
|
+
let n = j(t, a);
|
|
139
175
|
if (n === 0) return 0;
|
|
140
|
-
let
|
|
141
|
-
return
|
|
142
|
-
},
|
|
143
|
-
return
|
|
176
|
+
let r = ee(e, t, a);
|
|
177
|
+
return s ? s(r / n) * i * n : r * i;
|
|
178
|
+
}, u = ((e, t = c) => l(e, t));
|
|
179
|
+
return u.delays = (e = c) => Array.from({ length: e }, (t, n) => l(n, e)), u;
|
|
144
180
|
}
|
|
145
181
|
//#endregion
|
|
146
182
|
//#region src/animation/flip.ts
|
|
147
|
-
var
|
|
183
|
+
var N = 300, P = (e) => {
|
|
148
184
|
let t = e.getBoundingClientRect();
|
|
149
185
|
return {
|
|
150
186
|
x: t.x,
|
|
@@ -152,21 +188,21 @@ var A = 300, j = (e) => {
|
|
|
152
188
|
width: t.width,
|
|
153
189
|
height: t.height
|
|
154
190
|
};
|
|
155
|
-
},
|
|
191
|
+
}, F = (e, t) => {
|
|
156
192
|
let n = e.at(1), r = n.translateX, i = n.translateY, a = n.scaleX, o = n.scaleY, s = e.at(t);
|
|
157
193
|
return `translate(${s.translateX - r}px, ${s.translateY - i}px) scale(${a === 0 ? 1 : s.scaleX / a}, ${o === 0 ? 1 : s.scaleY / o})`;
|
|
158
|
-
},
|
|
159
|
-
e.style.transform =
|
|
194
|
+
}, I = (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) => {
|
|
195
|
+
e.style.transform = F(t, n);
|
|
160
196
|
}));
|
|
161
|
-
function
|
|
162
|
-
let { duration: r =
|
|
163
|
-
return t(),
|
|
197
|
+
function L(e, t, n = {}) {
|
|
198
|
+
let { duration: r = N, timingFunction: i, transformOrigin: a = "top left" } = n, o = P(e);
|
|
199
|
+
return t(), I(e, new E(o, P(e), {
|
|
164
200
|
...i === void 0 ? {} : { timingFunction: i },
|
|
165
201
|
transformOrigin: a
|
|
166
202
|
}), r, a);
|
|
167
203
|
}
|
|
168
|
-
function
|
|
169
|
-
let { duration: r =
|
|
204
|
+
function R(e, t, n = {}) {
|
|
205
|
+
let { duration: r = N, timingFunction: i, transformOrigin: a = "top left" } = n, o = new E(P(e), P(t), {
|
|
170
206
|
...i === void 0 ? {} : { timingFunction: i },
|
|
171
207
|
duration: r,
|
|
172
208
|
transformOrigin: a
|
|
@@ -174,12 +210,56 @@ function F(e, t, n = {}) {
|
|
|
174
210
|
return o.apply(e, 0), r <= 0 ? (o.apply(e, 1), Promise.resolve()) : o.play(e, r);
|
|
175
211
|
}
|
|
176
212
|
//#endregion
|
|
213
|
+
//#region src/animation/drag-2d.ts
|
|
214
|
+
function z(e, t) {
|
|
215
|
+
let n = new U({
|
|
216
|
+
...t?.x,
|
|
217
|
+
axis: "x"
|
|
218
|
+
}), r = new U({
|
|
219
|
+
...t?.y,
|
|
220
|
+
axis: "y"
|
|
221
|
+
});
|
|
222
|
+
n.attach(e), r.attach(e);
|
|
223
|
+
let i = /* @__PURE__ */ new Set(), a = (e) => e.dragging ? e.spring.target : e.spring.value, o = () => {
|
|
224
|
+
let e = a(n), t = a(r), o = n.velocity, s = r.velocity;
|
|
225
|
+
for (let n of i) n(e, t, o, s);
|
|
226
|
+
}, s = n.subscribe(() => o()), c = r.subscribe(() => o());
|
|
227
|
+
return {
|
|
228
|
+
x: n,
|
|
229
|
+
y: r,
|
|
230
|
+
get value() {
|
|
231
|
+
return {
|
|
232
|
+
x: a(n),
|
|
233
|
+
y: a(r)
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
get velocity() {
|
|
237
|
+
return {
|
|
238
|
+
x: n.velocity,
|
|
239
|
+
y: r.velocity
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
get settled() {
|
|
243
|
+
return n.settled && r.settled;
|
|
244
|
+
},
|
|
245
|
+
subscribe(e) {
|
|
246
|
+
return i.add(e), () => i.delete(e);
|
|
247
|
+
},
|
|
248
|
+
dispose() {
|
|
249
|
+
i.clear(), s(), c(), n.dispose(), r.dispose();
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
177
254
|
//#region src/animation/drag.ts
|
|
178
|
-
var
|
|
255
|
+
var B = 100, V = .4, H = 5, U = class {
|
|
179
256
|
spring;
|
|
180
257
|
axis;
|
|
181
258
|
transform;
|
|
182
259
|
velocityWindow;
|
|
260
|
+
bounds;
|
|
261
|
+
rubberBand;
|
|
262
|
+
snap;
|
|
183
263
|
element;
|
|
184
264
|
capturedPointerId;
|
|
185
265
|
samples = [];
|
|
@@ -189,7 +269,7 @@ var I = 100, L = class {
|
|
|
189
269
|
onPointerMove = (e) => this.handleMove(e);
|
|
190
270
|
onPointerUp = (e) => this.handleUp(e);
|
|
191
271
|
constructor(e) {
|
|
192
|
-
this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ??
|
|
272
|
+
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 r(e?.springOptions);
|
|
193
273
|
}
|
|
194
274
|
get dragging() {
|
|
195
275
|
return this.capturedPointerId !== void 0;
|
|
@@ -237,14 +317,38 @@ var I = 100, L = class {
|
|
|
237
317
|
handleMove(e) {
|
|
238
318
|
if (e.pointerId !== this.capturedPointerId) return;
|
|
239
319
|
let t = this.coordOf(e);
|
|
240
|
-
this.spring.target = t, this.pushSample(t, e.timeStamp);
|
|
320
|
+
this.spring.target = this.applyBounds(t), this.pushSample(t, e.timeStamp);
|
|
321
|
+
}
|
|
322
|
+
applyBounds(e) {
|
|
323
|
+
let t = this.bounds;
|
|
324
|
+
return t ? e < t.min ? t.min + (e - t.min) * this.rubberBand : e > t.max ? t.max + (e - t.max) * this.rubberBand : e : e;
|
|
241
325
|
}
|
|
242
326
|
handleUp(e) {
|
|
243
327
|
if (e.pointerId !== this.capturedPointerId) return;
|
|
244
328
|
let t = this.element, n = this.coordOf(e);
|
|
245
329
|
this.pushSample(n, e.timeStamp);
|
|
246
330
|
let r = this.estimateVelocity();
|
|
247
|
-
t && this.endGesture(t), this.
|
|
331
|
+
if (t && this.endGesture(t), this.snap) {
|
|
332
|
+
let e = b({
|
|
333
|
+
initial: n,
|
|
334
|
+
velocity: r,
|
|
335
|
+
friction: H
|
|
336
|
+
}), t = this.nearestSnap(e);
|
|
337
|
+
this.bounds && (t = a(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (this.spring.reset(n, r), this.bounds) {
|
|
341
|
+
let e = this.spring.value;
|
|
342
|
+
(e < this.bounds.min || e > this.bounds.max) && (this.spring.target = a(e, this.bounds.min, this.bounds.max));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
nearestSnap(e) {
|
|
346
|
+
let t = this.snap, n = t[0], r = Math.abs(e - n);
|
|
347
|
+
for (let i = 1; i < t.length; i++) {
|
|
348
|
+
let a = t[i], o = Math.abs(e - a);
|
|
349
|
+
o < r && (n = a, r = o);
|
|
350
|
+
}
|
|
351
|
+
return n;
|
|
248
352
|
}
|
|
249
353
|
endGesture(e) {
|
|
250
354
|
this.capturedPointerId !== void 0 && e.releasePointerCapture?.(this.capturedPointerId), e.removeEventListener("pointermove", this.onPointerMove), e.removeEventListener("pointerup", this.onPointerUp), e.removeEventListener("pointercancel", this.onPointerUp), this.capturedPointerId = void 0;
|
|
@@ -265,46 +369,78 @@ var I = 100, L = class {
|
|
|
265
369
|
return r <= 0 ? 0 : (n.value - t.value) / r * 1e3;
|
|
266
370
|
}
|
|
267
371
|
};
|
|
268
|
-
function
|
|
269
|
-
let n = new
|
|
372
|
+
function W(e, t) {
|
|
373
|
+
let n = new U(t);
|
|
270
374
|
return n.attach(e), n;
|
|
271
375
|
}
|
|
272
376
|
//#endregion
|
|
273
|
-
//#region src/animation/
|
|
274
|
-
var
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
377
|
+
//#region src/animation/load-engine.ts
|
|
378
|
+
var G = null, K = null, q = null, J = null, Y = () => G ??= import("./engine-CNHvTgpw.js"), X = null, Z = () => X ??= Y(), Q = null, te = () => Q ??= Promise.all([Y(), K ??= import("./compile-DgNRG6Lo.js")]).then(([e, t]) => Object.assign({ compileToCSS: t.compileToCSS }, e)), ne = null, re = () => ne ??= Promise.all([
|
|
379
|
+
Y(),
|
|
380
|
+
q ??= import("./ingest-CNM5xkQT.js"),
|
|
381
|
+
J ??= import("./scroll-scene-CXEgM49Q.js")
|
|
382
|
+
]).then(([e, t, n]) => Object.assign({
|
|
383
|
+
fromStyleSheets: t.fromStyleSheets,
|
|
384
|
+
fromLiveAnimations: t.fromLiveAnimations,
|
|
385
|
+
resolveLiveKeyframes: t.resolveLiveKeyframes,
|
|
386
|
+
adoptRunning: t.adoptRunning,
|
|
387
|
+
ScrollScene: n.ScrollScene,
|
|
388
|
+
createScrollScene: n.createScrollScene,
|
|
389
|
+
parseScrollCSS: n.parseScrollCSS,
|
|
390
|
+
parseScrollTimeline: n.parseScrollTimeline,
|
|
391
|
+
parseScrollRange: n.parseScrollRange,
|
|
392
|
+
serializeScrollOptions: n.serializeScrollOptions,
|
|
393
|
+
roundTripScrollCSS: n.roundTripScrollCSS,
|
|
394
|
+
dispatchScrollBackend: n.dispatchScrollBackend,
|
|
395
|
+
resolveRange: n.resolveRange,
|
|
396
|
+
pinCSS: n.pinCSS
|
|
397
|
+
}, e)), ie = null, $ = () => ie ??= Promise.all([
|
|
398
|
+
Y(),
|
|
399
|
+
import("./animate-CuUJt2Tb.js"),
|
|
400
|
+
import("./motion-path-J-RSNmRQ.js"),
|
|
401
|
+
import("./draw-svg-DYRDxBlL.js"),
|
|
402
|
+
import("./morph-svg-DRjl9Hfz.js"),
|
|
403
|
+
q ??= import("./ingest-CNM5xkQT.js"),
|
|
404
|
+
J ??= import("./scroll-scene-CXEgM49Q.js"),
|
|
405
|
+
K ??= import("./compile-DgNRG6Lo.js"),
|
|
406
|
+
import("./validate-8r6Yo-uc.js"),
|
|
407
|
+
import("./animations-5nf2kBkv.js"),
|
|
408
|
+
import("./format-BUgCTjmr.js").then((e) => e.r),
|
|
409
|
+
import("./utils-D7nuAND5.js").then((e) => e.o),
|
|
410
|
+
import("./scheduler-7eIr_q1g.js").then((e) => e.t)
|
|
411
|
+
]).then(([e, t, n, r, i, a, o, s, c, l, u, d, f]) => Object.assign({
|
|
412
|
+
animate: t.animate,
|
|
413
|
+
MotionPath: n.MotionPath,
|
|
414
|
+
fromMotionPath: n.fromMotionPath,
|
|
415
|
+
DrawSVG: r.DrawSVG,
|
|
416
|
+
fromDrawSVG: r.fromDrawSVG,
|
|
417
|
+
MorphSVG: i.MorphSVG,
|
|
418
|
+
fromMorphSVG: i.fromMorphSVG,
|
|
419
|
+
fromStyleSheets: a.fromStyleSheets,
|
|
420
|
+
fromLiveAnimations: a.fromLiveAnimations,
|
|
421
|
+
resolveLiveKeyframes: a.resolveLiveKeyframes,
|
|
422
|
+
adoptRunning: a.adoptRunning,
|
|
423
|
+
ScrollScene: o.ScrollScene,
|
|
424
|
+
createScrollScene: o.createScrollScene,
|
|
425
|
+
parseScrollCSS: o.parseScrollCSS,
|
|
426
|
+
parseScrollTimeline: o.parseScrollTimeline,
|
|
427
|
+
parseScrollRange: o.parseScrollRange,
|
|
428
|
+
serializeScrollOptions: o.serializeScrollOptions,
|
|
429
|
+
roundTripScrollCSS: o.roundTripScrollCSS,
|
|
430
|
+
dispatchScrollBackend: o.dispatchScrollBackend,
|
|
431
|
+
resolveRange: o.resolveRange,
|
|
432
|
+
pinCSS: o.pinCSS,
|
|
433
|
+
compileToCSS: s.compileToCSS,
|
|
434
|
+
validate: c.validate,
|
|
435
|
+
explain: c.explain,
|
|
436
|
+
presets: l,
|
|
437
|
+
CSSKeyframesToString: u.CSSKeyframesToString,
|
|
438
|
+
CSSKeyframesToStrings: u.CSSKeyframesToStrings,
|
|
439
|
+
formatCSSKeyframeString: u.formatCSSKeyframeString,
|
|
440
|
+
transformTargetsStyle: d.transformTargetsStyle,
|
|
441
|
+
yieldToMain: f.yieldToMain
|
|
442
|
+
}, e)), ae = () => {
|
|
443
|
+
$();
|
|
308
444
|
};
|
|
309
445
|
//#endregion
|
|
310
|
-
export {
|
|
446
|
+
export { t as AnimationOptionError, U as Draggable, E as ElementMorph, h as KeyframesScrollTimeline, h as ScrollTimeline, u as ManualTimeline, w as NumericAnimation, k as Oscillator, c as RAFPlayback, S as Sequence, i as SmoothProgress, r as SpringProgress, p as Timeline, e as UnknownEasingError, s as createNativeTimeline, x as decay, b as decayRest, W as drag, z as drag2D, L as flip, R as flipShared, $ as loadAnimationEngine, te as loadCompiler, Z as loadEngine, re as loadIngest, d as probeVelocity, g as reducedMotionScale, m as reseatToSpring, o as resolveEasing, _ as springLinearStops, y as springTimingFunction, M as stagger, n as toEasing, ae as warmEngine, O as waveformValue };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { t as e } from "./errors-W8zkvPw4.js";
|
|
2
|
+
import { CSSKeyframesAnimation as t } from "./engine-CNHvTgpw.js";
|
|
3
|
+
import { PathGeometry as n } from "@mkbabb/value.js";
|
|
4
|
+
//#region src/animation/morph-svg.ts
|
|
5
|
+
var r = 64, i = (e) => `--morph-${e}-x`, a = (e) => `--morph-${e}-y`, o = (e, t) => {
|
|
6
|
+
let n = Array(t + 1);
|
|
7
|
+
for (let r = 0; r <= t; r++) n[r] = e.getPointAtT(r / t);
|
|
8
|
+
return n;
|
|
9
|
+
}, s = (e) => {
|
|
10
|
+
if (e.length === 0) return "";
|
|
11
|
+
let t = (e) => Number.isInteger(e) ? `${e}` : e.toFixed(3), n = `M ${t(e[0].x)} ${t(e[0].y)}`;
|
|
12
|
+
for (let r = 1; r < e.length; r++) n += ` L ${t(e[r].x)} ${t(e[r].y)}`;
|
|
13
|
+
return n;
|
|
14
|
+
};
|
|
15
|
+
function c(s, c, l = {}) {
|
|
16
|
+
let { samples: u = r, target: d, autoPlay: f = !0, ...p } = l;
|
|
17
|
+
if (typeof s != "string" || s.length === 0) throw new e("from", s, "fromMorphSVG(): `from` must be a non-empty SVG path `d` string.");
|
|
18
|
+
if (typeof c != "string" || c.length === 0) throw new e("to", c, "fromMorphSVG(): `to` must be a non-empty SVG path `d` string.");
|
|
19
|
+
if (!Number.isInteger(u) || u < 2) throw new e("samples", u, "fromMorphSVG(): `samples` must be an integer >= 2 (a 1-sample morph is just the two endpoints, with no body to interpolate).");
|
|
20
|
+
let m = new n(s), h = new n(c);
|
|
21
|
+
if (m.totalLength === 0) throw new e("from", s, "fromMorphSVG(): the `from` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
|
|
22
|
+
if (h.totalLength === 0) throw new e("to", c, "fromMorphSVG(): the `to` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
|
|
23
|
+
let g = o(m, u), _ = o(h, u), v = {}, y = {};
|
|
24
|
+
for (let e = 0; e <= u; e++) v[i(e)] = g[e].x, v[a(e)] = g[e].y, y[i(e)] = _[e].x, y[a(e)] = _[e].y;
|
|
25
|
+
let b = {
|
|
26
|
+
"0%": v,
|
|
27
|
+
"100%": y
|
|
28
|
+
}, x = new t(p).fromKeyframes(b);
|
|
29
|
+
return d != null && x.setTargets(d), f && x.play(), x;
|
|
30
|
+
}
|
|
31
|
+
var l = class {
|
|
32
|
+
animation;
|
|
33
|
+
samples;
|
|
34
|
+
constructor(e, t, n = {}) {
|
|
35
|
+
this.animation = c(e, t, n), this.samples = n.samples ?? r;
|
|
36
|
+
}
|
|
37
|
+
sampleD(e) {
|
|
38
|
+
let t = (e < 0 ? 0 : e > 1 ? 1 : e) * this.animation.options.duration, n = this.animation.interpFrames(t, !1), r = Array(this.samples + 1);
|
|
39
|
+
for (let e = 0; e <= this.samples; e++) {
|
|
40
|
+
let t = n[i(e)]?.[0]?.value, o = n[a(e)]?.[0]?.value;
|
|
41
|
+
r[e] = {
|
|
42
|
+
x: t ?? 0,
|
|
43
|
+
y: o ?? 0
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return s(r);
|
|
47
|
+
}
|
|
48
|
+
play() {
|
|
49
|
+
return this.animation.play();
|
|
50
|
+
}
|
|
51
|
+
pause() {
|
|
52
|
+
return this.animation.pause(), this;
|
|
53
|
+
}
|
|
54
|
+
stop() {
|
|
55
|
+
return this.animation.stop(), this;
|
|
56
|
+
}
|
|
57
|
+
get finished() {
|
|
58
|
+
return this.animation.finished;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { l as MorphSVG, c as fromMorphSVG };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
//#region src/animation/internal/scheduler.ts
|
|
3
|
+
var t = /* @__PURE__ */ e({ yieldToMain: () => i }), n = null, r = () => typeof MessageChannel == "function" ? () => new Promise((e) => {
|
|
4
|
+
let t = new MessageChannel();
|
|
5
|
+
t.port1.onmessage = () => {
|
|
6
|
+
t.port1.close(), e();
|
|
7
|
+
}, t.port2.postMessage(void 0);
|
|
8
|
+
}) : () => new Promise((e) => setTimeout(e, 0));
|
|
9
|
+
function i() {
|
|
10
|
+
let e = globalThis.scheduler;
|
|
11
|
+
return e && typeof e.yield == "function" ? e.yield() : (n ??= r(), n());
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as n, t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { extractTimelineOptions as e, parseAnimationRange as t, parseAnimationTimeline as n, parseCSSStylesheet as r, serializeTimelineOptions as i } from "@mkbabb/value.js";
|
|
2
|
+
//#region src/animation/scroll-grammar.ts
|
|
3
|
+
function a(e) {
|
|
4
|
+
return n(e);
|
|
5
|
+
}
|
|
6
|
+
function o(e) {
|
|
7
|
+
return t(e);
|
|
8
|
+
}
|
|
9
|
+
function s(t) {
|
|
10
|
+
return e(typeof t == "string" ? r(t) : t);
|
|
11
|
+
}
|
|
12
|
+
function c(e) {
|
|
13
|
+
return i(e);
|
|
14
|
+
}
|
|
15
|
+
function l(e) {
|
|
16
|
+
let t = s(e);
|
|
17
|
+
return {
|
|
18
|
+
options: t,
|
|
19
|
+
declarations: c(t)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { c as a, l as i, o as n, a as r, s as t };
|