@ssgoi/core 6.7.0-beta.1 → 7.0.0-beta.1
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 +80 -230
- package/dist/animation/animation.d.ts +2 -2
- package/dist/animation/frame-scheduler.d.ts +36 -0
- package/dist/animation/frame-scheduler.d.ts.map +1 -0
- package/dist/animation/multi-animation.d.ts +3 -2
- package/dist/animation/multi-animation.d.ts.map +1 -1
- package/dist/animation/web-animation.d.ts +16 -4
- package/dist/animation/web-animation.d.ts.map +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1282 -1125
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +692 -521
- package/dist/multi-animation-6124HEke.cjs +1 -0
- package/dist/multi-animation-ZFZBDBGr.js +439 -0
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +24 -9
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-direction.d.ts +13 -0
- package/dist/ssgoi-transition/navigation-direction.d.ts.map +1 -0
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts +1 -0
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts.map +1 -1
- package/dist/ssgoi-transition/path-pattern.d.ts +15 -0
- package/dist/ssgoi-transition/path-pattern.d.ts.map +1 -0
- package/dist/ssgoi-transition/resolve-transition-rule.d.ts +16 -0
- package/dist/ssgoi-transition/resolve-transition-rule.d.ts.map +1 -0
- package/dist/ssgoi-transition/unmount-observer.d.ts +11 -2
- package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -1
- package/dist/transitions/axis/index.d.ts +5 -7
- package/dist/transitions/axis/index.d.ts.map +1 -1
- package/dist/transitions/axis/types.d.ts +0 -1
- package/dist/transitions/axis/types.d.ts.map +1 -1
- package/dist/transitions/blind/index.d.ts +2 -3
- package/dist/transitions/blind/index.d.ts.map +1 -1
- package/dist/transitions/drill/index.d.ts +6 -7
- package/dist/transitions/drill/index.d.ts.map +1 -1
- package/dist/transitions/drill/provider/crossfade.d.ts.map +1 -1
- package/dist/transitions/drill/provider/parallax.d.ts.map +1 -1
- package/dist/transitions/drill/transition.d.ts.map +1 -1
- package/dist/transitions/drill/types.d.ts +0 -1
- package/dist/transitions/drill/types.d.ts.map +1 -1
- package/dist/transitions/fade/index.d.ts +3 -5
- package/dist/transitions/fade/index.d.ts.map +1 -1
- package/dist/transitions/film/index.d.ts +3 -5
- package/dist/transitions/film/index.d.ts.map +1 -1
- package/dist/transitions/hero/fit.d.ts +5 -0
- package/dist/transitions/hero/fit.d.ts.map +1 -0
- package/dist/transitions/hero/index.d.ts +3 -5
- package/dist/transitions/hero/index.d.ts.map +1 -1
- package/dist/transitions/hero/transition.d.ts +12 -1
- package/dist/transitions/hero/transition.d.ts.map +1 -1
- package/dist/transitions/hero/types.d.ts +2 -1
- package/dist/transitions/hero/types.d.ts.map +1 -1
- package/dist/transitions/jaemin/index.d.ts +3 -5
- package/dist/transitions/jaemin/index.d.ts.map +1 -1
- package/dist/transitions/media-geometry.d.ts +55 -0
- package/dist/transitions/media-geometry.d.ts.map +1 -0
- package/dist/transitions/rotate/index.d.ts +3 -5
- package/dist/transitions/rotate/index.d.ts.map +1 -1
- package/dist/transitions/scroll/index.d.ts +4 -5
- package/dist/transitions/scroll/index.d.ts.map +1 -1
- package/dist/transitions/scroll/transition.d.ts +1 -1
- package/dist/transitions/scroll/transition.d.ts.map +1 -1
- package/dist/transitions/sheet/index.d.ts +6 -7
- package/dist/transitions/sheet/index.d.ts.map +1 -1
- package/dist/transitions/sheet/provider/static.d.ts.map +1 -1
- package/dist/transitions/sheet/transition.d.ts.map +1 -1
- package/dist/transitions/sheet/types.d.ts +0 -1
- package/dist/transitions/sheet/types.d.ts.map +1 -1
- package/dist/transitions/slide/index.d.ts +3 -5
- package/dist/transitions/slide/index.d.ts.map +1 -1
- package/dist/transitions/slide/transition.d.ts +0 -1
- package/dist/transitions/slide/transition.d.ts.map +1 -1
- package/dist/transitions/strip/index.d.ts +3 -5
- package/dist/transitions/strip/index.d.ts.map +1 -1
- package/dist/transitions/utils.d.ts +3 -21
- package/dist/transitions/utils.d.ts.map +1 -1
- package/dist/transitions/zoom/index.d.ts +3 -4
- package/dist/transitions/zoom/index.d.ts.map +1 -1
- package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
- package/dist/transitions/zoom/transition.d.ts +6 -1
- package/dist/transitions/zoom/transition.d.ts.map +1 -1
- package/dist/transitions/zoom/types.d.ts +5 -0
- package/dist/transitions/zoom/types.d.ts.map +1 -1
- package/dist/transitions/zoom/zoom-element.d.ts +2 -2
- package/dist/transitions/zoom/zoom-element.d.ts.map +1 -1
- package/dist/types/index.d.ts +66 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/wait-paint.d.ts +8 -7
- package/dist/utils/wait-paint.d.ts.map +1 -1
- package/package.json +13 -14
- package/dist/multi-animation-1FueEz2Q.js +0 -367
- package/dist/multi-animation-qtH1IKNG.cjs +0 -1
- package/dist/ssgoi-transition/find-matching-transition.d.ts +0 -30
- package/dist/ssgoi-transition/find-matching-transition.d.ts.map +0 -1
- package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +0 -7
- package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +0 -1
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
var g = Object.defineProperty;
|
|
2
|
-
var y = (n, r, t) => r in n ? g(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
|
|
3
|
-
var s = (n, r, t) => y(n, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
class m {
|
|
5
|
-
constructor() {
|
|
6
|
-
/** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
|
|
7
|
-
s(this, "_playbackRate", 1);
|
|
8
|
-
/** Fired every frame with the most recent value. Optional. */
|
|
9
|
-
s(this, "onUpdate");
|
|
10
|
-
/** Fired once when the animation settles. */
|
|
11
|
-
s(this, "onComplete");
|
|
12
|
-
}
|
|
13
|
-
get playbackRate() {
|
|
14
|
-
return this._playbackRate;
|
|
15
|
-
}
|
|
16
|
-
set playbackRate(r) {
|
|
17
|
-
this._playbackRate = r;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const b = 0.01, C = 0.01, v = 0.05;
|
|
21
|
-
function w(n) {
|
|
22
|
-
return new Promise((r) => {
|
|
23
|
-
requestAnimationFrame(() => {
|
|
24
|
-
requestAnimationFrame(() => {
|
|
25
|
-
r();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
const p = 1e3 / 60;
|
|
31
|
-
class k extends m {
|
|
32
|
-
constructor(t) {
|
|
33
|
-
super();
|
|
34
|
-
s(this, "element");
|
|
35
|
-
s(this, "integrator");
|
|
36
|
-
s(this, "styleFn");
|
|
37
|
-
s(this, "lowerBound");
|
|
38
|
-
s(this, "upperBound");
|
|
39
|
-
s(this, "currentValue");
|
|
40
|
-
s(this, "currentVelocity", 0);
|
|
41
|
-
s(this, "frames", []);
|
|
42
|
-
s(this, "waapi", null);
|
|
43
|
-
s(this, "runId", 0);
|
|
44
|
-
s(this, "waitingForStart", !1);
|
|
45
|
-
s(this, "startReady", !1);
|
|
46
|
-
s(this, "pendingFirstFrame");
|
|
47
|
-
s(this, "running", !1);
|
|
48
|
-
s(this, "paused", !1);
|
|
49
|
-
s(this, "settled", !1);
|
|
50
|
-
s(this, "reversing", !1);
|
|
51
|
-
this.element = t.element, this.integrator = t.integrator, this.styleFn = t.style, this.lowerBound = t.lowerBound ?? 0, this.upperBound = t.upperBound ?? 1, this.currentValue = this.lowerBound, this.onUpdate = t.onUpdate, this.onComplete = t.onComplete;
|
|
52
|
-
}
|
|
53
|
-
play() {
|
|
54
|
-
if (this.reversing = !1, this.paused && this.waapi) {
|
|
55
|
-
if (this.paused = !1, this.running = !0, this.waitingForStart) {
|
|
56
|
-
this.startReady && this.playPreparedWaapi(this.waapi);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.waapi.play();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.runToward(this.upperBound);
|
|
63
|
-
}
|
|
64
|
-
reverse() {
|
|
65
|
-
this.reversing = !0, this.runToward(this.lowerBound);
|
|
66
|
-
}
|
|
67
|
-
pause() {
|
|
68
|
-
var t;
|
|
69
|
-
this.running && (this.captureLiveState(), (t = this.waapi) == null || t.pause(), this.running = !1, this.paused = !0);
|
|
70
|
-
}
|
|
71
|
-
complete() {
|
|
72
|
-
var t;
|
|
73
|
-
this.clearWaapi(), this.running = !1, this.paused = !1, this.currentValue = this.upperBound, this.currentVelocity = 0, this.applyStyleAt(this.currentValue), this.settled = !0, (t = this.onComplete) == null || t.call(this);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Drop the WAAPI forwards-fill after the run has settled, letting inline
|
|
77
|
-
* styles govern the resting visual. Call only from `onComplete` (the run is
|
|
78
|
-
* already finished) — otherwise it cancels mid-flight. Unlike `complete()`,
|
|
79
|
-
* it writes no final frame, so a caller can reset the element to its natural
|
|
80
|
-
* state without the lingering fill clobbering it.
|
|
81
|
-
*/
|
|
82
|
-
releaseFill() {
|
|
83
|
-
this.clearWaapi();
|
|
84
|
-
}
|
|
85
|
-
get isAnimating() {
|
|
86
|
-
return this.running;
|
|
87
|
-
}
|
|
88
|
-
get isPaused() {
|
|
89
|
-
return this.paused;
|
|
90
|
-
}
|
|
91
|
-
get isComplete() {
|
|
92
|
-
return this.settled;
|
|
93
|
-
}
|
|
94
|
-
get isReversing() {
|
|
95
|
-
return this.reversing;
|
|
96
|
-
}
|
|
97
|
-
get progress() {
|
|
98
|
-
this.running && this.captureLiveState();
|
|
99
|
-
const t = this.upperBound - this.lowerBound;
|
|
100
|
-
if (t === 0) return 0;
|
|
101
|
-
const e = (this.currentValue - this.lowerBound) / t;
|
|
102
|
-
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
103
|
-
}
|
|
104
|
-
findTimeForProgress(t) {
|
|
105
|
-
if (this.frames.length < 2) return null;
|
|
106
|
-
const e = this.upperBound - this.lowerBound;
|
|
107
|
-
if (e === 0) return 0;
|
|
108
|
-
for (const i of this.frames)
|
|
109
|
-
if ((i.position - this.lowerBound) / e >= t) return i.time;
|
|
110
|
-
return this.frames[this.frames.length - 1].time;
|
|
111
|
-
}
|
|
112
|
-
get playbackRate() {
|
|
113
|
-
return super.playbackRate;
|
|
114
|
-
}
|
|
115
|
-
set playbackRate(t) {
|
|
116
|
-
super.playbackRate = t, this.waapi && (this.waapi.playbackRate = t);
|
|
117
|
-
}
|
|
118
|
-
getPose() {
|
|
119
|
-
return this.running && this.captureLiveState(), [
|
|
120
|
-
{
|
|
121
|
-
element: this.element,
|
|
122
|
-
value: this.currentValue,
|
|
123
|
-
velocity: this.currentVelocity
|
|
124
|
-
}
|
|
125
|
-
];
|
|
126
|
-
}
|
|
127
|
-
getTimeline() {
|
|
128
|
-
const t = this.frames.map((e) => {
|
|
129
|
-
const i = e.position, a = this.lowerBound + this.upperBound - i;
|
|
130
|
-
return {
|
|
131
|
-
time: e.time,
|
|
132
|
-
value: e.position,
|
|
133
|
-
velocity: e.velocity,
|
|
134
|
-
style: this.styleFn(i, a)
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
return [{ element: this.element, frames: t }];
|
|
138
|
-
}
|
|
139
|
-
matchInto(t) {
|
|
140
|
-
const e = t.find((i) => i.element === this.element);
|
|
141
|
-
e && (this.currentValue = e.value, this.currentVelocity = e.velocity);
|
|
142
|
-
}
|
|
143
|
-
/* ───────────────────────────────────────────────────────── private */
|
|
144
|
-
runToward(t) {
|
|
145
|
-
var u;
|
|
146
|
-
if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames = F(
|
|
147
|
-
this.integrator,
|
|
148
|
-
this.currentValue,
|
|
149
|
-
t,
|
|
150
|
-
this.currentVelocity
|
|
151
|
-
), this.frames.length === 0) {
|
|
152
|
-
this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (u = this.onComplete) == null || u.call(this);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const e = this.frames.map((c) => {
|
|
156
|
-
const d = c.position, f = this.lowerBound + this.upperBound - d;
|
|
157
|
-
return this.styleFn(d, f);
|
|
158
|
-
}), i = e[0], a = this.frames[this.frames.length - 1], l = a.time, o = ++this.runId, h = this.element.animate(e, {
|
|
159
|
-
duration: l,
|
|
160
|
-
fill: "both",
|
|
161
|
-
easing: "linear",
|
|
162
|
-
composite: "replace"
|
|
163
|
-
});
|
|
164
|
-
h.playbackRate = this.playbackRate, h.pause(), h.currentTime = 0, this.waapi = h, this.waitingForStart = !0, this.startReady = !1, this.pendingFirstFrame = i, this.running = !0, h.onfinish = () => {
|
|
165
|
-
var c;
|
|
166
|
-
!this.running || this.waapi !== h || (this.running = !1, this.settled = !0, this.currentValue = a.position, this.currentVelocity = 0, (c = this.onComplete) == null || c.call(this));
|
|
167
|
-
}, this.startWhenReady(h, o);
|
|
168
|
-
}
|
|
169
|
-
clearWaapi() {
|
|
170
|
-
var t;
|
|
171
|
-
this.runId++, (t = this.waapi) == null || t.cancel(), this.waapi = null, this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0;
|
|
172
|
-
}
|
|
173
|
-
captureLiveState() {
|
|
174
|
-
if (this.frames.length === 0) return;
|
|
175
|
-
const t = S(this.waapi);
|
|
176
|
-
if (t === null) return;
|
|
177
|
-
const { position: e, velocity: i } = R(this.frames, t);
|
|
178
|
-
this.currentValue = e, this.currentVelocity = i;
|
|
179
|
-
}
|
|
180
|
-
async startWhenReady(t, e) {
|
|
181
|
-
try {
|
|
182
|
-
await t.ready, typeof requestAnimationFrame < "u" && await w(this.element);
|
|
183
|
-
} catch {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
this.runId !== e || this.waapi !== t || (this.startReady = !0, !(!this.running || this.paused) && this.playPreparedWaapi(t));
|
|
187
|
-
}
|
|
188
|
-
playPreparedWaapi(t) {
|
|
189
|
-
if (!(this.waapi !== t || !this.waitingForStart || !this.startReady)) {
|
|
190
|
-
if (this.pendingFirstFrame)
|
|
191
|
-
for (const e of Object.keys(this.pendingFirstFrame))
|
|
192
|
-
this.element.style[e] = "";
|
|
193
|
-
this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0, t.play();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
applyStyleAt(t) {
|
|
197
|
-
const e = this.lowerBound + this.upperBound - t, i = this.styleFn(t, e);
|
|
198
|
-
for (const [a, l] of Object.entries(i))
|
|
199
|
-
this.element.style[a] = typeof l == "number" ? String(l) : l;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function F(n, r, t, e) {
|
|
203
|
-
if (r === t && e === 0) return [];
|
|
204
|
-
const i = 600;
|
|
205
|
-
let a = { position: r, velocity: e }, l = 0;
|
|
206
|
-
const o = [];
|
|
207
|
-
for (let h = 0; h < i; h++) {
|
|
208
|
-
const u = h * p;
|
|
209
|
-
if (o.push({ time: u, position: a.position, velocity: a.velocity }), a = n.step(a, t, p / 1e3), n.isSettled(a, t)) {
|
|
210
|
-
if (l += p / 1e3, l >= v) {
|
|
211
|
-
o.push({
|
|
212
|
-
time: (h + 1) * p,
|
|
213
|
-
position: t,
|
|
214
|
-
velocity: 0
|
|
215
|
-
});
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
} else
|
|
219
|
-
l = 0;
|
|
220
|
-
}
|
|
221
|
-
return o;
|
|
222
|
-
}
|
|
223
|
-
function R(n, r) {
|
|
224
|
-
if (n.length === 0) return { position: 0, velocity: 0 };
|
|
225
|
-
const t = n[0], e = n[n.length - 1];
|
|
226
|
-
if (r <= 0)
|
|
227
|
-
return { position: t.position, velocity: t.velocity };
|
|
228
|
-
if (r >= e.time)
|
|
229
|
-
return { position: e.position, velocity: e.velocity };
|
|
230
|
-
let i = 0, a = n.length - 1;
|
|
231
|
-
for (; i < a - 1; ) {
|
|
232
|
-
const u = i + a >> 1;
|
|
233
|
-
n[u].time <= r ? i = u : a = u;
|
|
234
|
-
}
|
|
235
|
-
const l = n[i], o = n[a], h = (r - l.time) / (o.time - l.time);
|
|
236
|
-
return {
|
|
237
|
-
position: l.position + (o.position - l.position) * h,
|
|
238
|
-
velocity: l.velocity + (o.velocity - l.velocity) * h
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function S(n) {
|
|
242
|
-
const r = n == null ? void 0 : n.currentTime;
|
|
243
|
-
return typeof r == "number" ? r : null;
|
|
244
|
-
}
|
|
245
|
-
class A extends m {
|
|
246
|
-
constructor(t, e = {}) {
|
|
247
|
-
super();
|
|
248
|
-
s(this, "children");
|
|
249
|
-
s(this, "startAt");
|
|
250
|
-
s(this, "pendingComplete", 0);
|
|
251
|
-
s(this, "running", !1);
|
|
252
|
-
s(this, "pendingStartTimers", []);
|
|
253
|
-
this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((i, a) => a === 0 ? 0 : 1) : this.startAt = e.startAt ?? [];
|
|
254
|
-
}
|
|
255
|
-
play() {
|
|
256
|
-
this.startRun("play");
|
|
257
|
-
}
|
|
258
|
-
reverse() {
|
|
259
|
-
this.startRun("reverse");
|
|
260
|
-
}
|
|
261
|
-
pause() {
|
|
262
|
-
this.running = !1, this.clearPendingStartTimers();
|
|
263
|
-
for (const t of this.children) t.pause();
|
|
264
|
-
}
|
|
265
|
-
complete() {
|
|
266
|
-
var t;
|
|
267
|
-
this.running = !1, this.clearPendingStartTimers();
|
|
268
|
-
for (const e of this.children) e.complete();
|
|
269
|
-
(t = this.onComplete) == null || t.call(this);
|
|
270
|
-
}
|
|
271
|
-
get progress() {
|
|
272
|
-
if (this.children.length === 0) return 0;
|
|
273
|
-
let t = 0;
|
|
274
|
-
for (const e of this.children) t += e.progress;
|
|
275
|
-
return t / this.children.length;
|
|
276
|
-
}
|
|
277
|
-
getPose() {
|
|
278
|
-
return this.children.flatMap((t) => t.getPose());
|
|
279
|
-
}
|
|
280
|
-
getTimeline() {
|
|
281
|
-
return this.children.flatMap((t) => t.getTimeline());
|
|
282
|
-
}
|
|
283
|
-
matchInto(t) {
|
|
284
|
-
}
|
|
285
|
-
get isAnimating() {
|
|
286
|
-
return this.children.some((t) => t.isAnimating);
|
|
287
|
-
}
|
|
288
|
-
get isPaused() {
|
|
289
|
-
return this.children.some((t) => t.isPaused) && this.children.every((t) => t.isPaused || t.isComplete);
|
|
290
|
-
}
|
|
291
|
-
get isComplete() {
|
|
292
|
-
return this.children.every((t) => t.isComplete);
|
|
293
|
-
}
|
|
294
|
-
get isReversing() {
|
|
295
|
-
return this.children.some((t) => t.isReversing);
|
|
296
|
-
}
|
|
297
|
-
get playbackRate() {
|
|
298
|
-
return super.playbackRate;
|
|
299
|
-
}
|
|
300
|
-
set playbackRate(t) {
|
|
301
|
-
super.playbackRate = t;
|
|
302
|
-
for (const e of this.children) e.playbackRate = t;
|
|
303
|
-
}
|
|
304
|
-
/* ───────────────────────────────────────────────────────── private */
|
|
305
|
-
startRun(t) {
|
|
306
|
-
if (this.running && this.pause(), this.running = !0, this.pendingComplete = this.children.length, this.pendingComplete === 0) {
|
|
307
|
-
this.handleFinished();
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
for (const e of this.children) {
|
|
311
|
-
const i = e.onComplete;
|
|
312
|
-
e.onComplete = () => {
|
|
313
|
-
i == null || i(), this.handleChildComplete();
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
this.scheduleStart(0, t);
|
|
317
|
-
}
|
|
318
|
-
// Chained start: play child `index`, then schedule the next one based on
|
|
319
|
-
// *this* child's freshly computed timeline. Doing this lazily (rather than
|
|
320
|
-
// up-front for the whole chain) is what makes it correct for >2 children —
|
|
321
|
-
// child[i+1]'s trigger ms is only knowable after child[i].play() has run
|
|
322
|
-
// `simulate()`. Single setTimeout per gap, no polling.
|
|
323
|
-
scheduleStart(t, e) {
|
|
324
|
-
if (!this.running || t >= this.children.length) return;
|
|
325
|
-
this.children[t][e]();
|
|
326
|
-
const i = t + 1;
|
|
327
|
-
if (i >= this.children.length) return;
|
|
328
|
-
const a = this.startAt[i];
|
|
329
|
-
if (a === void 0 || a <= 0) {
|
|
330
|
-
this.scheduleStart(i, e);
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
const l = this.children[t].findTimeForProgress(a);
|
|
334
|
-
if (l === null || l <= 0) {
|
|
335
|
-
this.scheduleStart(i, e);
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
const o = Math.abs(this.playbackRate) || 1, h = l / o, u = setTimeout(() => {
|
|
339
|
-
this.pendingStartTimers = this.pendingStartTimers.filter(
|
|
340
|
-
(c) => c !== u
|
|
341
|
-
), this.running && this.scheduleStart(i, e);
|
|
342
|
-
}, h);
|
|
343
|
-
this.pendingStartTimers.push(u);
|
|
344
|
-
}
|
|
345
|
-
clearPendingStartTimers() {
|
|
346
|
-
for (const t of this.pendingStartTimers) clearTimeout(t);
|
|
347
|
-
this.pendingStartTimers = [];
|
|
348
|
-
}
|
|
349
|
-
handleChildComplete() {
|
|
350
|
-
this.pendingComplete--, this.pendingComplete <= 0 && this.handleFinished();
|
|
351
|
-
}
|
|
352
|
-
handleFinished() {
|
|
353
|
-
var t;
|
|
354
|
-
this.running = !1, this.clearPendingStartTimers(), (t = this.onComplete) == null || t.call(this);
|
|
355
|
-
}
|
|
356
|
-
findTimeForProgress(t) {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
export {
|
|
361
|
-
m as A,
|
|
362
|
-
A as M,
|
|
363
|
-
b as P,
|
|
364
|
-
v as S,
|
|
365
|
-
C as V,
|
|
366
|
-
k as W
|
|
367
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var S=(n,r,t)=>r in n?y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[r]=t;var s=(n,r,t)=>S(n,typeof r!="symbol"?r+"":r,t);class d{constructor(){s(this,"_playbackRate",1);s(this,"onUpdate");s(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(r){this._playbackRate=r}}const v=.01,R=.01,f=.05;function T(n){return new Promise(r=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})})}const p=1e3/60;class w extends d{constructor(t){super();s(this,"element");s(this,"integrator");s(this,"styleFn");s(this,"lowerBound");s(this,"upperBound");s(this,"currentValue");s(this,"currentVelocity",0);s(this,"frames",[]);s(this,"waapi",null);s(this,"runId",0);s(this,"waitingForStart",!1);s(this,"startReady",!1);s(this,"pendingFirstFrame");s(this,"running",!1);s(this,"paused",!1);s(this,"settled",!1);s(this,"reversing",!1);this.element=t.element,this.integrator=t.integrator,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete}play(){if(this.reversing=!1,this.paused&&this.waapi){if(this.paused=!1,this.running=!0,this.waitingForStart){this.startReady&&this.playPreparedWaapi(this.waapi);return}this.waapi.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),this.running=!1,this.paused=!0)}complete(){var t;this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,(t=this.onComplete)==null||t.call(this)}releaseFill(){this.clearWaapi()}get isAnimating(){return this.running}get isPaused(){return this.paused}get isComplete(){return this.settled}get isReversing(){return this.reversing}get progress(){this.running&&this.captureLiveState();const t=this.upperBound-this.lowerBound;if(t===0)return 0;const e=(this.currentValue-this.lowerBound)/t;return e<0?0:e>1?1:e}findTimeForProgress(t){if(this.frames.length<2)return null;const e=this.upperBound-this.lowerBound;if(e===0)return 0;for(const i of this.frames)if((i.position-this.lowerBound)/e>=t)return i.time;return this.frames[this.frames.length-1].time}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.waapi&&(this.waapi.playbackRate=t)}getPose(){return this.running&&this.captureLiveState(),[{element:this.element,value:this.currentValue,velocity:this.currentVelocity}]}getTimeline(){const t=this.frames.map(e=>{const i=e.position,a=this.lowerBound+this.upperBound-i;return{time:e.time,value:e.position,velocity:e.velocity,style:this.styleFn(i,a)}});return[{element:this.element,frames:t}]}matchInto(t){const e=t.find(i=>i.element===this.element);e&&(this.currentValue=e.value,this.currentVelocity=e.velocity)}runToward(t){var u;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=F(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(u=this.onComplete)==null||u.call(this);return}const e=this.frames.map(c=>{const m=c.position,g=this.lowerBound+this.upperBound-m;return this.styleFn(m,g)}),i=e[0],a=this.frames[this.frames.length-1],l=a.time,o=++this.runId,h=this.element.animate(e,{duration:l,fill:"both",easing:"linear",composite:"replace"});h.playbackRate=this.playbackRate,h.pause(),h.currentTime=0,this.waapi=h,this.waitingForStart=!0,this.startReady=!1,this.pendingFirstFrame=i,this.running=!0,h.onfinish=()=>{var c;!this.running||this.waapi!==h||(this.running=!1,this.settled=!0,this.currentValue=a.position,this.currentVelocity=0,(c=this.onComplete)==null||c.call(this))},this.startWhenReady(h,o)}clearWaapi(){var t;this.runId++,(t=this.waapi)==null||t.cancel(),this.waapi=null,this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0}captureLiveState(){if(this.frames.length===0)return;const t=A(this.waapi);if(t===null)return;const{position:e,velocity:i}=b(this.frames,t);this.currentValue=e,this.currentVelocity=i}async startWhenReady(t,e){try{await t.ready,typeof requestAnimationFrame<"u"&&await T(this.element)}catch{return}this.runId!==e||this.waapi!==t||(this.startReady=!0,!(!this.running||this.paused)&&this.playPreparedWaapi(t))}playPreparedWaapi(t){if(!(this.waapi!==t||!this.waitingForStart||!this.startReady)){if(this.pendingFirstFrame)for(const e of Object.keys(this.pendingFirstFrame))this.element.style[e]="";this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0,t.play()}}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[a,l]of Object.entries(i))this.element.style[a]=typeof l=="number"?String(l):l}}function F(n,r,t,e){if(r===t&&e===0)return[];const i=600;let a={position:r,velocity:e},l=0;const o=[];for(let h=0;h<i;h++){const u=h*p;if(o.push({time:u,position:a.position,velocity:a.velocity}),a=n.step(a,t,p/1e3),n.isSettled(a,t)){if(l+=p/1e3,l>=f){o.push({time:(h+1)*p,position:t,velocity:0});break}}else l=0}return o}function b(n,r){if(n.length===0)return{position:0,velocity:0};const t=n[0],e=n[n.length-1];if(r<=0)return{position:t.position,velocity:t.velocity};if(r>=e.time)return{position:e.position,velocity:e.velocity};let i=0,a=n.length-1;for(;i<a-1;){const u=i+a>>1;n[u].time<=r?i=u:a=u}const l=n[i],o=n[a],h=(r-l.time)/(o.time-l.time);return{position:l.position+(o.position-l.position)*h,velocity:l.velocity+(o.velocity-l.velocity)*h}}function A(n){const r=n==null?void 0:n.currentTime;return typeof r=="number"?r:null}class C extends d{constructor(t,e={}){super();s(this,"children");s(this,"startAt");s(this,"pendingComplete",0);s(this,"running",!1);s(this,"pendingStartTimers",[]);this.children=t,(e.mode??"parallel")==="sequence"?this.startAt=t.map((i,a)=>a===0?0:1):this.startAt=e.startAt??[]}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.running=!1,this.clearPendingStartTimers();for(const t of this.children)t.pause()}complete(){var t;this.running=!1,this.clearPendingStartTimers();for(const e of this.children)e.complete();(t=this.onComplete)==null||t.call(this)}get progress(){if(this.children.length===0)return 0;let t=0;for(const e of this.children)t+=e.progress;return t/this.children.length}getPose(){return this.children.flatMap(t=>t.getPose())}getTimeline(){return this.children.flatMap(t=>t.getTimeline())}matchInto(t){}get isAnimating(){return this.children.some(t=>t.isAnimating)}get isPaused(){return this.children.some(t=>t.isPaused)&&this.children.every(t=>t.isPaused||t.isComplete)}get isComplete(){return this.children.every(t=>t.isComplete)}get isReversing(){return this.children.some(t=>t.isReversing)}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t;for(const e of this.children)e.playbackRate=t}startRun(t){if(this.running&&this.pause(),this.running=!0,this.pendingComplete=this.children.length,this.pendingComplete===0){this.handleFinished();return}for(const e of this.children){const i=e.onComplete;e.onComplete=()=>{i==null||i(),this.handleChildComplete()}}this.scheduleStart(0,t)}scheduleStart(t,e){if(!this.running||t>=this.children.length)return;this.children[t][e]();const i=t+1;if(i>=this.children.length)return;const a=this.startAt[i];if(a===void 0||a<=0){this.scheduleStart(i,e);return}const l=this.children[t].findTimeForProgress(a);if(l===null||l<=0){this.scheduleStart(i,e);return}const o=Math.abs(this.playbackRate)||1,h=l/o,u=setTimeout(()=>{this.pendingStartTimers=this.pendingStartTimers.filter(c=>c!==u),this.running&&this.scheduleStart(i,e)},h);this.pendingStartTimers.push(u)}clearPendingStartTimers(){for(const t of this.pendingStartTimers)clearTimeout(t);this.pendingStartTimers=[]}handleChildComplete(){this.pendingComplete--,this.pendingComplete<=0&&this.handleFinished()}handleFinished(){var t;this.running=!1,this.clearPendingStartTimers(),(t=this.onComplete)==null||t.call(this)}findTimeForProgress(t){return null}}exports.Animation=d;exports.MultiAnimation=C;exports.POSITION_THRESHOLD=v;exports.SETTLE_THRESHOLD=f;exports.VELOCITY_THRESHOLD=R;exports.WebAnimation=w;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { TransitionConfig } from '../types/index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Matches a path against a pattern
|
|
4
|
-
* Supports exact matches, wildcard patterns, and common route segment params
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* matchPath('/products', '/products') // true
|
|
8
|
-
* matchPath('/products/123', '/products/*') // true
|
|
9
|
-
* matchPath('/products', '/products/**') // true
|
|
10
|
-
* matchPath('/products/123/reviews', '/products/**') // true
|
|
11
|
-
* matchPath('/products/123', '/products/:id') // true
|
|
12
|
-
* matchPath('/products/123', '/products/[id]') // true
|
|
13
|
-
* matchPath('/products/123', '/products/{id}') // true
|
|
14
|
-
* matchPath('/products/123', '/products') // false
|
|
15
|
-
* matchPath('/anything', '*') // true
|
|
16
|
-
*/
|
|
17
|
-
export declare function matchPath(path: string, pattern: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Finds a matching transition configuration for the given from and to paths
|
|
20
|
-
*
|
|
21
|
-
* Chooses the most specific matching config. Exact paths outrank wildcard
|
|
22
|
-
* paths, deeper static wildcard prefixes outrank broader fallbacks, and equal
|
|
23
|
-
* specificity preserves the original config order.
|
|
24
|
-
*/
|
|
25
|
-
export declare function findMatchingTransition(from: string, to: string, transitions: Array<{
|
|
26
|
-
from: string;
|
|
27
|
-
to: string;
|
|
28
|
-
transition: TransitionConfig;
|
|
29
|
-
}>): TransitionConfig | null;
|
|
30
|
-
//# sourceMappingURL=find-matching-transition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-matching-transition.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/find-matching-transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AA6H/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC,GACD,gBAAgB,GAAG,IAAI,CAsBzB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SsgoiPathTransition } from '../types/index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Processes symmetric transitions to create bidirectional navigation
|
|
4
|
-
* For each symmetric transition, creates a reverse transition automatically
|
|
5
|
-
*/
|
|
6
|
-
export declare function processSymmetricTransitions(transitions: readonly SsgoiPathTransition[]): Omit<SsgoiPathTransition, "symmetric">[];
|
|
7
|
-
//# sourceMappingURL=process-symmetric-transitions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process-symmetric-transitions.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/process-symmetric-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,SAAS,mBAAmB,EAAE,GAC1C,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,EAAE,CAU1C"}
|