@mkbabb/keyframes.js 5.0.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.
- package/README.md +112 -217
- package/dist/backward-color-BtbRcnna.js +108 -0
- package/dist/compile-BHCTPerD.js +30 -0
- package/dist/{waapi-D0ssxKy1.js → delegation-BQYCrP2p.js} +117 -99
- package/dist/{draw-svg-Dat9mHgi.js → draw-svg-CK9Qrly8.js} +18 -26
- package/dist/easing-registry-DHV2-5gA.js +27 -0
- package/dist/easing-registry-y1p9McFy.js +2 -0
- package/dist/easing-serialize-D4LZCB6i.js +21 -0
- package/dist/engine/index.d.ts +3139 -0
- package/dist/engine/index.js +16 -0
- package/dist/engine-CPK_udUQ.js +1172 -0
- package/dist/engine-DlpimZtM.js +3 -0
- package/dist/entry-D82NKUhP.js +148 -0
- package/dist/format-BdIvdLzG.js +114 -0
- package/dist/group-HM7N4uOE.js +390 -0
- package/dist/handle-D4xrf_ya.js +21 -0
- package/dist/{ingest-CU-kdYcM.js → ingest-_g6tfk2e.js} +62 -56
- package/dist/keyframes.d.ts +1156 -1099
- package/dist/keyframes.js +412 -132
- package/dist/morph-svg-KUrH9KnK.js +79 -0
- package/dist/motion-path-wM5tPfrY.js +26 -0
- package/dist/parse-flatten-DRMHFytp.js +2 -0
- package/dist/parse-flatten-ZZUSEQEL.js +63 -0
- package/dist/presets-DeDJYL4G.js +275 -0
- package/dist/{scheduler-7eIr_q1g.js → scheduler-CfGIC3GX.js} +1 -1
- package/dist/scroll-BEyCx0b_.js +287 -0
- package/dist/sequence-s0bL7Uul.js +736 -0
- package/dist/{validate-B1pE-Y_T.js → validate-xFZ_Ld1k.js} +17 -13
- package/dist/view-transition-BPJQxUTC.js +305 -0
- package/package.json +123 -84
- package/dist/animate-CTWr6K7j.js +0 -26
- package/dist/animations-CZxf0rep.js +0 -224
- package/dist/compile-YRJRdpKF.js +0 -251
- package/dist/decay-BvNmFk51.js +0 -25
- package/dist/engine-DQcb7CLW.js +0 -1349
- package/dist/errors-W8zkvPw4.js +0 -21
- package/dist/format-BUgCTjmr.js +0 -123
- package/dist/morph-svg-83uyYxoW.js +0 -84
- package/dist/motion-path-C0OHqcA3.js +0 -31
- package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
- package/dist/scroll-grammar-B4kPvGh5.js +0 -23
- package/dist/scroll-scene-DQxhxn9I.js +0 -176
- package/dist/sequence-cBr7thU8.js +0 -198
- package/dist/springTimingFunction-D26gPkAy.js +0 -63
- package/dist/timeline-vY3eD3Ax.js +0 -430
- package/dist/utils-BPRImVl5.js +0 -100
package/dist/keyframes.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { n as y, t as b } from "./decay-BvNmFk51.js";
|
|
5
|
-
import { t as x } from "./sequence-cBr7thU8.js";
|
|
6
|
-
//#region src/animation/numeric.ts
|
|
7
|
-
var S = new Float64Array(), C = class {
|
|
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
|
+
//#region src/animation/physics/numeric.ts
|
|
3
|
+
var y = new Float64Array(), b = class {
|
|
8
4
|
keyframes;
|
|
9
5
|
segments;
|
|
10
6
|
positions;
|
|
@@ -13,14 +9,14 @@ var S = new Float64Array(), C = class {
|
|
|
13
9
|
_respectReducedMotion;
|
|
14
10
|
_easingFn;
|
|
15
11
|
_playback = new c();
|
|
16
|
-
constructor(e,
|
|
12
|
+
constructor(e, t) {
|
|
17
13
|
if (e.length < 2) throw Error("NumericAnimation requires at least 2 keyframes.");
|
|
18
|
-
this.keyframes = e.map((e) => ({ ...e })), this._duration =
|
|
19
|
-
let
|
|
20
|
-
if (typeof
|
|
21
|
-
if (this._easingFn =
|
|
22
|
-
if (
|
|
23
|
-
this.positions =
|
|
14
|
+
this.keyframes = e.map((e) => ({ ...e })), this._duration = t?.duration ?? 0, this._respectReducedMotion = t?.respectReducedMotion ?? !1;
|
|
15
|
+
let n = t?.timingFunction;
|
|
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
|
+
if (t.positions.length !== e.length) throw Error("positions length must match keyframes length.");
|
|
19
|
+
this.positions = t.positions;
|
|
24
20
|
} else this.positions = e.map((t, n) => n / (e.length - 1) * 100);
|
|
25
21
|
this.result = { ...e[0] }, this.segments = this.buildSegments();
|
|
26
22
|
}
|
|
@@ -45,12 +41,12 @@ var S = new Float64Array(), C = class {
|
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
at(e) {
|
|
48
|
-
let t = a(e, 0, 1) * 100, n =
|
|
44
|
+
let t = a(e, 0, 1) * 100, n = o(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
|
|
49
45
|
n === -1 && (n = this.segments.length - 1);
|
|
50
|
-
let r = this.segments[n], i = l(a(t, r.startPos, r.stopPos), r.startPos, r.stopPos, 0, 1),
|
|
51
|
-
|
|
52
|
-
let
|
|
53
|
-
for (let e = 0; e <
|
|
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
|
+
let u = this.result;
|
|
49
|
+
for (let e = 0; e < c; e++) u[r.keys[e]] = y[e];
|
|
54
50
|
return this.result;
|
|
55
51
|
}
|
|
56
52
|
updateKeyframe(e, t) {
|
|
@@ -67,7 +63,24 @@ var S = new Float64Array(), C = class {
|
|
|
67
63
|
stop() {
|
|
68
64
|
this._playback.stop();
|
|
69
65
|
}
|
|
70
|
-
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/animation/physics/spring/reseat.ts
|
|
69
|
+
function x(e) {
|
|
70
|
+
let t = e.curr.time - e.prev.time;
|
|
71
|
+
return t <= 0 ? 0 : (e.curr.value - e.prev.value) / (t / 1e3);
|
|
72
|
+
}
|
|
73
|
+
function S(e, t, n) {
|
|
74
|
+
let r = x(e), i = new m({
|
|
75
|
+
...n,
|
|
76
|
+
initial: e.curr.value,
|
|
77
|
+
initialVelocity: r
|
|
78
|
+
});
|
|
79
|
+
return i.target = t, i;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/animation/physics/morph.ts
|
|
83
|
+
var C = (e) => {
|
|
71
84
|
if (e instanceof HTMLElement) {
|
|
72
85
|
let t = e.getBoundingClientRect();
|
|
73
86
|
return {
|
|
@@ -78,7 +91,7 @@ var S = new Float64Array(), C = class {
|
|
|
78
91
|
};
|
|
79
92
|
}
|
|
80
93
|
return e;
|
|
81
|
-
},
|
|
94
|
+
}, w = class {
|
|
82
95
|
animation;
|
|
83
96
|
transformOrigin;
|
|
84
97
|
timingFunction;
|
|
@@ -87,8 +100,8 @@ var S = new Float64Array(), C = class {
|
|
|
87
100
|
this.transformOrigin = n?.transformOrigin ?? "top left", this.timingFunction = n?.timingFunction, this.duration = n?.duration ?? 0, this.measure(e, t);
|
|
88
101
|
}
|
|
89
102
|
measure(e, t) {
|
|
90
|
-
let n =
|
|
91
|
-
return this.animation = new
|
|
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([{
|
|
92
105
|
translateX: 0,
|
|
93
106
|
translateY: 0,
|
|
94
107
|
scaleX: 1,
|
|
@@ -122,17 +135,82 @@ var S = new Float64Array(), C = class {
|
|
|
122
135
|
stop() {
|
|
123
136
|
this.animation.stop();
|
|
124
137
|
}
|
|
125
|
-
},
|
|
126
|
-
|
|
138
|
+
}, T = class {
|
|
139
|
+
smoother;
|
|
140
|
+
_easingFn;
|
|
141
|
+
currentProgress = 0;
|
|
142
|
+
boundaryEpsilon;
|
|
143
|
+
constructor(e) {
|
|
144
|
+
this.boundaryEpsilon = e?.boundaryEpsilon ?? .005;
|
|
145
|
+
let t = e?.easing;
|
|
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
|
+
}
|
|
149
|
+
applyPipeline() {
|
|
150
|
+
let e = a(this.sample(), 0, 1);
|
|
151
|
+
e = this._easingFn(e);
|
|
152
|
+
let t = this.boundaryEpsilon;
|
|
153
|
+
return e <= t ? e = 0 : e >= 1 - t && (e = 1), e;
|
|
154
|
+
}
|
|
155
|
+
_advance(e) {
|
|
156
|
+
let t = this.applyPipeline();
|
|
157
|
+
return this.smoother ? (this.smoother.setTarget(t), t <= 0 || t >= 1 ? this.smoother.snap() : this.smoother.tickDt(e), this.currentProgress = this.smoother.current) : this.currentProgress = t, this.currentProgress;
|
|
158
|
+
}
|
|
159
|
+
tick() {
|
|
160
|
+
return this._advance(16.667);
|
|
161
|
+
}
|
|
162
|
+
tickDt(e) {
|
|
163
|
+
return this._advance(e);
|
|
164
|
+
}
|
|
165
|
+
get progress() {
|
|
166
|
+
return this.currentProgress;
|
|
167
|
+
}
|
|
168
|
+
get settled() {
|
|
169
|
+
return this.smoother == null || this.smoother.settled;
|
|
170
|
+
}
|
|
171
|
+
snap() {
|
|
172
|
+
this.smoother?.snap(), this.smoother && (this.currentProgress = this.smoother.current);
|
|
173
|
+
}
|
|
174
|
+
reset(e) {
|
|
175
|
+
let t = e ?? 0;
|
|
176
|
+
this.smoother && this.smoother.reset(t), this.currentProgress = t;
|
|
177
|
+
}
|
|
178
|
+
}, ee = class extends T {
|
|
179
|
+
threshold;
|
|
180
|
+
getScrollY;
|
|
181
|
+
getViewportHeight;
|
|
182
|
+
constructor(e) {
|
|
183
|
+
super(e), this.threshold = e?.threshold ?? .35, this.getScrollY = e?.getScrollY ?? (() => window.scrollY), this.getViewportHeight = e?.getViewportHeight ?? (() => window.innerHeight);
|
|
184
|
+
}
|
|
185
|
+
sample() {
|
|
186
|
+
let e = this.getViewportHeight() * this.threshold;
|
|
187
|
+
return e <= 0 ? 0 : this.getScrollY() / e;
|
|
188
|
+
}
|
|
189
|
+
}, E = class extends T {
|
|
190
|
+
value = 0;
|
|
191
|
+
constructor(e) {
|
|
192
|
+
super({
|
|
193
|
+
smoothing: !1,
|
|
194
|
+
...e
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
set(e) {
|
|
198
|
+
this.value = e;
|
|
199
|
+
}
|
|
200
|
+
sample() {
|
|
201
|
+
return this.value;
|
|
202
|
+
}
|
|
203
|
+
}, D = 2 * Math.PI;
|
|
204
|
+
function O(e, t) {
|
|
127
205
|
let n = e - Math.floor(e);
|
|
128
206
|
switch (t) {
|
|
129
|
-
case "sine": return Math.sin(
|
|
207
|
+
case "sine": return Math.sin(D * n);
|
|
130
208
|
case "triangle": return n < .5 ? 4 * n - 1 : 3 - 4 * n;
|
|
131
209
|
case "square": return n < .5 ? 1 : -1;
|
|
132
210
|
case "sawtooth": return 2 * n - 1;
|
|
133
211
|
}
|
|
134
212
|
}
|
|
135
|
-
var
|
|
213
|
+
var k = class {
|
|
136
214
|
frequency;
|
|
137
215
|
waveform;
|
|
138
216
|
phase = 0;
|
|
@@ -144,15 +222,15 @@ var O = class {
|
|
|
144
222
|
return this.phase = t - Math.floor(t), this.phase;
|
|
145
223
|
}
|
|
146
224
|
get value() {
|
|
147
|
-
return
|
|
225
|
+
return O(this.phase, this.waveform);
|
|
148
226
|
}
|
|
149
227
|
sample(e) {
|
|
150
|
-
return
|
|
228
|
+
return O(e * this.frequency, this.waveform);
|
|
151
229
|
}
|
|
152
230
|
reset(e = 0) {
|
|
153
231
|
this.phase = e - Math.floor(e);
|
|
154
232
|
}
|
|
155
|
-
},
|
|
233
|
+
}, A = (e, t) => {
|
|
156
234
|
if (typeof e == "number") return a(e, 0, Math.max(0, t - 1));
|
|
157
235
|
switch (e) {
|
|
158
236
|
case "first": return 0;
|
|
@@ -160,26 +238,26 @@ var O = class {
|
|
|
160
238
|
case "center": return (t - 1) / 2;
|
|
161
239
|
case "edges": return -1;
|
|
162
240
|
}
|
|
163
|
-
},
|
|
241
|
+
}, te = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - A(n, t)), j = (e, t) => {
|
|
164
242
|
if (e <= 1) return 0;
|
|
165
243
|
if (t === "edges") return Math.floor((e - 1) / 2);
|
|
166
|
-
let n =
|
|
244
|
+
let n = A(t, e);
|
|
167
245
|
return Math.max(n, e - 1 - n);
|
|
168
246
|
};
|
|
169
|
-
function M(e,
|
|
170
|
-
let { each:
|
|
171
|
-
if (typeof
|
|
172
|
-
let
|
|
247
|
+
function M(e, t = {}) {
|
|
248
|
+
let { each: n = 100, from: r = "first", ease: i } = 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) => {
|
|
173
251
|
if (t <= 1) return 0;
|
|
174
|
-
let
|
|
175
|
-
if (
|
|
176
|
-
let
|
|
177
|
-
return
|
|
178
|
-
},
|
|
179
|
-
return
|
|
252
|
+
let i = j(t, r);
|
|
253
|
+
if (i === 0) return 0;
|
|
254
|
+
let o = te(e, t, r);
|
|
255
|
+
return a ? a(o / i) * n * i : o * n;
|
|
256
|
+
}, c = ((e, t = o) => s(e, t));
|
|
257
|
+
return c.delays = (e = o) => Array.from({ length: e }, (t, n) => s(n, e)), c;
|
|
180
258
|
}
|
|
181
259
|
//#endregion
|
|
182
|
-
//#region src/animation/flip.ts
|
|
260
|
+
//#region src/animation/orchestration/flip.ts
|
|
183
261
|
var N = 300, P = (e) => {
|
|
184
262
|
let t = e.getBoundingClientRect();
|
|
185
263
|
return {
|
|
@@ -191,18 +269,18 @@ var N = 300, P = (e) => {
|
|
|
191
269
|
}, F = (e, t) => {
|
|
192
270
|
let n = e.at(1), r = n.translateX, i = n.translateY, a = n.scaleX, o = n.scaleY, s = e.at(t);
|
|
193
271
|
return `translate(${s.translateX - r}px, ${s.translateY - i}px) scale(${a === 0 ? 1 : s.scaleX / a}, ${o === 0 ? 1 : s.scaleY / o})`;
|
|
194
|
-
},
|
|
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) => {
|
|
195
273
|
e.style.transform = F(t, n);
|
|
196
274
|
}));
|
|
197
|
-
function
|
|
275
|
+
function re(e, t, n = {}) {
|
|
198
276
|
let { duration: r = N, timingFunction: i, transformOrigin: a = "top left" } = n, o = P(e);
|
|
199
|
-
return t(),
|
|
277
|
+
return t(), ne(e, new w(o, P(e), {
|
|
200
278
|
...i === void 0 ? {} : { timingFunction: i },
|
|
201
279
|
transformOrigin: a
|
|
202
280
|
}), r, a);
|
|
203
281
|
}
|
|
204
|
-
function
|
|
205
|
-
let { duration: r = N, timingFunction: i, transformOrigin: a = "top left" } = n, o = new
|
|
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), {
|
|
206
284
|
...i === void 0 ? {} : { timingFunction: i },
|
|
207
285
|
duration: r,
|
|
208
286
|
transformOrigin: a
|
|
@@ -210,49 +288,222 @@ function R(e, t, n = {}) {
|
|
|
210
288
|
return o.apply(e, 0), r <= 0 ? (o.apply(e, 1), Promise.resolve()) : o.play(e, r);
|
|
211
289
|
}
|
|
212
290
|
//#endregion
|
|
213
|
-
//#region src/animation/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
}
|
|
227
347
|
return {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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;
|
|
235
425
|
},
|
|
236
|
-
get
|
|
237
|
-
return
|
|
238
|
-
x: n.velocity,
|
|
239
|
-
y: r.velocity
|
|
240
|
-
};
|
|
426
|
+
get stagger() {
|
|
427
|
+
return m;
|
|
241
428
|
},
|
|
242
|
-
get
|
|
243
|
-
return
|
|
429
|
+
get delays() {
|
|
430
|
+
return h;
|
|
244
431
|
},
|
|
245
|
-
|
|
246
|
-
|
|
432
|
+
revert: () => {
|
|
433
|
+
b(), e.innerHTML = d, e.removeAttribute("aria-label"), r && !p && e.removeAttribute("role");
|
|
247
434
|
},
|
|
248
|
-
|
|
249
|
-
|
|
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
|
+
};
|
|
250
477
|
}
|
|
478
|
+
return s === "none" ? X(e) : oe(e, o, r, a);
|
|
251
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
|
+
});
|
|
252
503
|
}
|
|
253
504
|
//#endregion
|
|
254
|
-
//#region src/animation/drag.ts
|
|
255
|
-
var
|
|
505
|
+
//#region src/animation/orchestration/drag/draggable.ts
|
|
506
|
+
var ce = 100, le = .4, ue = 5, Z = class {
|
|
256
507
|
spring;
|
|
257
508
|
axis;
|
|
258
509
|
transform;
|
|
@@ -269,7 +520,7 @@ var B = 100, V = .4, H = 5, U = class {
|
|
|
269
520
|
onPointerMove = (e) => this.handleMove(e);
|
|
270
521
|
onPointerUp = (e) => this.handleUp(e);
|
|
271
522
|
constructor(e) {
|
|
272
|
-
this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ??
|
|
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);
|
|
273
524
|
}
|
|
274
525
|
get dragging() {
|
|
275
526
|
return this.capturedPointerId !== void 0;
|
|
@@ -329,10 +580,10 @@ var B = 100, V = .4, H = 5, U = class {
|
|
|
329
580
|
this.pushSample(n, e.timeStamp);
|
|
330
581
|
let r = this.estimateVelocity();
|
|
331
582
|
if (t && this.endGesture(t), this.snap) {
|
|
332
|
-
let e =
|
|
583
|
+
let e = p({
|
|
333
584
|
initial: n,
|
|
334
585
|
velocity: r,
|
|
335
|
-
friction:
|
|
586
|
+
friction: ue
|
|
336
587
|
}), t = this.nearestSnap(e);
|
|
337
588
|
this.bounds && (t = a(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
|
|
338
589
|
return;
|
|
@@ -369,47 +620,71 @@ var B = 100, V = .4, H = 5, U = class {
|
|
|
369
620
|
return r <= 0 ? 0 : (n.value - t.value) / r * 1e3;
|
|
370
621
|
}
|
|
371
622
|
};
|
|
372
|
-
function
|
|
373
|
-
let n = new
|
|
623
|
+
function Q(e, t) {
|
|
624
|
+
let n = new Z(t);
|
|
374
625
|
return n.attach(e), n;
|
|
375
626
|
}
|
|
376
627
|
//#endregion
|
|
628
|
+
//#region src/animation/orchestration/drag/drag-2d.ts
|
|
629
|
+
function de(e, t) {
|
|
630
|
+
let n = new Z({
|
|
631
|
+
...t?.x,
|
|
632
|
+
axis: "x"
|
|
633
|
+
}), r = new Z({
|
|
634
|
+
...t?.y,
|
|
635
|
+
axis: "y"
|
|
636
|
+
});
|
|
637
|
+
n.attach(e), r.attach(e);
|
|
638
|
+
let i = /* @__PURE__ */ new Set(), a = (e) => e.dragging ? e.spring.target : e.spring.value, o = () => {
|
|
639
|
+
let e = a(n), t = a(r), o = n.velocity, s = r.velocity;
|
|
640
|
+
for (let n of i) n(e, t, o, s);
|
|
641
|
+
}, s = n.subscribe(() => o()), c = r.subscribe(() => o());
|
|
642
|
+
return {
|
|
643
|
+
x: n,
|
|
644
|
+
y: r,
|
|
645
|
+
get value() {
|
|
646
|
+
return {
|
|
647
|
+
x: a(n),
|
|
648
|
+
y: a(r)
|
|
649
|
+
};
|
|
650
|
+
},
|
|
651
|
+
get velocity() {
|
|
652
|
+
return {
|
|
653
|
+
x: n.velocity,
|
|
654
|
+
y: r.velocity
|
|
655
|
+
};
|
|
656
|
+
},
|
|
657
|
+
get settled() {
|
|
658
|
+
return n.settled && r.settled;
|
|
659
|
+
},
|
|
660
|
+
subscribe(e) {
|
|
661
|
+
return i.add(e), () => i.delete(e);
|
|
662
|
+
},
|
|
663
|
+
dispose() {
|
|
664
|
+
i.clear(), s(), c(), n.dispose(), r.dispose();
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
//#endregion
|
|
377
669
|
//#region src/animation/load-engine.ts
|
|
378
|
-
var
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
pinCSS: n.pinCSS
|
|
397
|
-
}, e)), ie = null, $ = () => ie ??= Promise.all([
|
|
398
|
-
Y(),
|
|
399
|
-
import("./animate-CTWr6K7j.js"),
|
|
400
|
-
import("./motion-path-C0OHqcA3.js"),
|
|
401
|
-
import("./draw-svg-Dat9mHgi.js"),
|
|
402
|
-
import("./morph-svg-83uyYxoW.js"),
|
|
403
|
-
q ??= import("./ingest-CU-kdYcM.js"),
|
|
404
|
-
J ??= import("./scroll-scene-DQxhxn9I.js"),
|
|
405
|
-
K ??= import("./compile-YRJRdpKF.js"),
|
|
406
|
-
import("./validate-B1pE-Y_T.js"),
|
|
407
|
-
import("./animations-CZxf0rep.js"),
|
|
408
|
-
import("./format-BUgCTjmr.js").then((e) => e.r),
|
|
409
|
-
import("./utils-BPRImVl5.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,
|
|
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),
|
|
684
|
+
import("./parse-flatten-DRMHFytp.js"),
|
|
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({
|
|
687
|
+
AnimationGroup: t.AnimationGroup,
|
|
413
688
|
MotionPath: n.MotionPath,
|
|
414
689
|
fromMotionPath: n.fromMotionPath,
|
|
415
690
|
DrawSVG: r.DrawSVG,
|
|
@@ -430,17 +705,22 @@ var G = null, K = null, q = null, J = null, Y = () => G ??= import("./engine-DQc
|
|
|
430
705
|
dispatchScrollBackend: o.dispatchScrollBackend,
|
|
431
706
|
resolveRange: o.resolveRange,
|
|
432
707
|
pinCSS: o.pinCSS,
|
|
708
|
+
TriggerScene: o.TriggerScene,
|
|
709
|
+
createTriggerScene: o.createTriggerScene,
|
|
710
|
+
supportsNativeTrigger: o.supportsNativeTrigger,
|
|
433
711
|
compileToCSS: s.compileToCSS,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
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 = () => {
|
|
443
723
|
$();
|
|
444
724
|
};
|
|
445
725
|
//#endregion
|
|
446
|
-
export {
|
|
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 };
|