@ssgoi/core 2.5.6 → 3.0.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/dist/animator/animation.d.ts +57 -0
- package/dist/animator/animation.d.ts.map +1 -0
- package/dist/animator/index.d.ts +4 -3
- package/dist/animator/index.d.ts.map +1 -1
- package/dist/animator/multi-animator.d.ts +98 -0
- package/dist/animator/multi-animator.d.ts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +565 -640
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/transition/transition-strategy.d.ts +20 -9
- package/dist/transition/transition-strategy.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +5 -5
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +5 -5
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +5 -5
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +5 -5
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +206 -207
- package/dist/transitions/mask.d.ts +5 -5
- package/dist/transitions/mask.d.ts.map +1 -1
- package/dist/transitions/none.d.ts +3 -3
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +5 -5
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +5 -5
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +5 -5
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +78 -78
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +63 -15
- package/dist/view-transitions/blind.d.ts +0 -1
- package/dist/view-transitions/blind.d.ts.map +1 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +13 -13
- package/dist/view-transitions/index.js +472 -479
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/dist/view-transitions/strip.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/animator/animation-scheduler.d.ts +0 -34
- package/dist/animator/animation-scheduler.d.ts.map +0 -1
- package/dist/test-utils.d.ts +0 -46
- package/dist/test-utils.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
|
-
var j = (n, t
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { isCssAnimation as vt,
|
|
6
|
-
import { j as
|
|
7
|
-
class
|
|
2
|
+
var j = (i, n, t) => n in i ? $(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t;
|
|
3
|
+
var d = (i, n, t) => j(i, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { normalizeToMultiSpring as V, normalizeMultiSpringSchedule as M } from "./types.js";
|
|
5
|
+
import { isCssAnimation as vt, isMultiSpring as St, isSingleSpring as Ct, isTickAnimation as At, validateAnimationMode as Et, validateSpringItem as Tt } from "./types.js";
|
|
6
|
+
import { j as bt } from "./jaemin-BWkrXq0V.js";
|
|
7
|
+
class W {
|
|
8
8
|
constructor() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
d(this, "listeners", /* @__PURE__ */ new Set());
|
|
10
|
+
d(this, "rafId", null);
|
|
11
|
+
d(this, "isRunning", !1);
|
|
12
12
|
// Timing
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
d(this, "startTime", Date.now());
|
|
14
|
+
d(this, "lastUpdate", this.startTime);
|
|
15
|
+
d(this, "elapsed", 0);
|
|
16
16
|
// Lag smoothing (mobile optimization)
|
|
17
|
-
|
|
17
|
+
d(this, "lagThreshold", 500);
|
|
18
18
|
// ms - detect tab switches, backgrounding
|
|
19
|
-
|
|
19
|
+
d(this, "adjustedLag", 33);
|
|
20
20
|
// ms - max time jump to prevent animation skip
|
|
21
|
-
|
|
21
|
+
d(this, "maxDeltaTime", 33);
|
|
22
22
|
// ms - clamp for physics stability (30fps minimum)
|
|
23
23
|
// FPS throttling
|
|
24
|
-
|
|
24
|
+
d(this, "gap", 1e3 / 240);
|
|
25
25
|
// max 240fps
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
let e =
|
|
30
|
-
e > this.lagThreshold || e < 0 ? (this.startTime += e - this.adjustedLag, e = this.adjustedLag) : e > this.maxDeltaTime && (e = this.maxDeltaTime), this.lastUpdate =
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
26
|
+
d(this, "nextTime", this.gap);
|
|
27
|
+
d(this, "tick", () => {
|
|
28
|
+
const n = Date.now();
|
|
29
|
+
let e = n - this.lastUpdate;
|
|
30
|
+
e > this.lagThreshold || e < 0 ? (this.startTime += e - this.adjustedLag, e = this.adjustedLag) : e > this.maxDeltaTime && (e = this.maxDeltaTime), this.lastUpdate = n;
|
|
31
|
+
const r = n - this.startTime, o = r - this.nextTime;
|
|
32
|
+
if (o > 0) {
|
|
33
33
|
const s = e / 1e3;
|
|
34
|
-
this.elapsed =
|
|
34
|
+
this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((a) => {
|
|
35
35
|
a(s, this.elapsed);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
subscribe(
|
|
42
|
-
return this.listeners.add(
|
|
43
|
-
this.unsubscribe(
|
|
41
|
+
subscribe(n) {
|
|
42
|
+
return this.listeners.add(n), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
|
|
43
|
+
this.unsubscribe(n);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
unsubscribe(
|
|
47
|
-
this.listeners.delete(
|
|
46
|
+
unsubscribe(n) {
|
|
47
|
+
this.listeners.delete(n), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Configure lag smoothing behavior
|
|
51
51
|
* @param threshold - Time threshold to detect lag (default: 500ms)
|
|
52
52
|
* @param adjustedLag - Max time jump when lag detected (default: 33ms)
|
|
53
53
|
*/
|
|
54
|
-
lagSmoothing(
|
|
55
|
-
this.lagThreshold =
|
|
54
|
+
lagSmoothing(n, t) {
|
|
55
|
+
this.lagThreshold = n, this.adjustedLag = Math.min(t, n);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Set maximum FPS
|
|
59
59
|
* @param fps - Target FPS (default: 240)
|
|
60
60
|
*/
|
|
61
|
-
fps(
|
|
62
|
-
this.gap = 1e3 /
|
|
61
|
+
fps(n) {
|
|
62
|
+
this.gap = 1e3 / n, this.nextTime = this.elapsed * 1e3 + this.gap;
|
|
63
63
|
}
|
|
64
64
|
getListenerCount() {
|
|
65
65
|
return this.listeners.size;
|
|
@@ -68,71 +68,71 @@ class B {
|
|
|
68
68
|
return this.elapsed;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
function z(
|
|
73
|
-
const
|
|
74
|
-
return { omega:
|
|
71
|
+
const P = new W();
|
|
72
|
+
function z(i) {
|
|
73
|
+
const n = i.stiffness, t = i.damping, e = 1, r = Math.sqrt(n / e), o = t / (2 * Math.sqrt(n * e));
|
|
74
|
+
return { omega: r, zeta: o };
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const { omega:
|
|
76
|
+
function _(i, n, t, e) {
|
|
77
|
+
const { omega: r, zeta: o } = t, { position: s, velocity: a } = i, c = Math.min(e, 0.033), u = -2 * c * o * r * a, h = c * r * r * (n - s), l = a + u + h;
|
|
78
78
|
return {
|
|
79
|
-
position: s + c *
|
|
80
|
-
velocity:
|
|
79
|
+
position: s + c * l,
|
|
80
|
+
velocity: l
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const K = 0.01, U = 0.01,
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
return
|
|
83
|
+
const K = 0.01, U = 0.01, H = 0.05;
|
|
84
|
+
function N(i, n) {
|
|
85
|
+
const t = Math.abs(n - i.position), e = Math.abs(i.velocity);
|
|
86
|
+
return t < K && e < U;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function G(i) {
|
|
89
89
|
const {
|
|
90
|
-
from:
|
|
91
|
-
to:
|
|
90
|
+
from: n,
|
|
91
|
+
to: t,
|
|
92
92
|
spring: e,
|
|
93
|
-
velocity:
|
|
94
|
-
onUpdate:
|
|
93
|
+
velocity: r = 0,
|
|
94
|
+
onUpdate: o,
|
|
95
95
|
onComplete: s,
|
|
96
96
|
onStart: a
|
|
97
|
-
} =
|
|
98
|
-
let c = { position:
|
|
99
|
-
const g = z(e),
|
|
100
|
-
if (
|
|
101
|
-
if (
|
|
102
|
-
if (h += Math.min(
|
|
103
|
-
c = { position:
|
|
97
|
+
} = i;
|
|
98
|
+
let c = { position: n, velocity: r }, u = !0, h = 0, l = !1;
|
|
99
|
+
const g = z(e), w = (p) => {
|
|
100
|
+
if (u) {
|
|
101
|
+
if (l || (l = !0, a == null || a()), c = _(c, t, g, p), N(c, t)) {
|
|
102
|
+
if (h += Math.min(p, 0.033), h >= H) {
|
|
103
|
+
c = { position: t, velocity: 0 }, u = !1, o(c.position), P.unsubscribe(w), s();
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
} else
|
|
107
107
|
h = 0;
|
|
108
|
-
|
|
108
|
+
o(c.position);
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
return
|
|
111
|
+
return P.subscribe(w), {
|
|
112
112
|
stop: () => {
|
|
113
|
-
|
|
113
|
+
u && (u = !1, P.unsubscribe(w));
|
|
114
114
|
},
|
|
115
115
|
getPosition: () => c.position,
|
|
116
116
|
getVelocity: () => c.velocity,
|
|
117
|
-
isRunning: () =>
|
|
117
|
+
isRunning: () => u
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
const
|
|
121
|
-
function
|
|
122
|
-
const
|
|
123
|
-
let s = { position:
|
|
120
|
+
const b = 1e3 / 60;
|
|
121
|
+
function B(i, n, t, e = 0) {
|
|
122
|
+
const r = z(t), o = 600;
|
|
123
|
+
let s = { position: i, velocity: e }, a = 0;
|
|
124
124
|
const c = [];
|
|
125
|
-
for (let
|
|
126
|
-
const h =
|
|
125
|
+
for (let u = 0; u < o; u++) {
|
|
126
|
+
const h = u * b;
|
|
127
127
|
if (c.push({
|
|
128
128
|
time: h,
|
|
129
129
|
position: s.position,
|
|
130
130
|
velocity: s.velocity
|
|
131
|
-
}), s =
|
|
132
|
-
if (a +=
|
|
131
|
+
}), s = _(s, n, r, b / 1e3), N(s, n)) {
|
|
132
|
+
if (a += b / 1e3, a >= H) {
|
|
133
133
|
c.push({
|
|
134
|
-
time: (
|
|
135
|
-
position:
|
|
134
|
+
time: (u + 1) * b,
|
|
135
|
+
position: n,
|
|
136
136
|
velocity: 0
|
|
137
137
|
});
|
|
138
138
|
break;
|
|
@@ -142,40 +142,40 @@ function G(n, t, i, e = 0) {
|
|
|
142
142
|
}
|
|
143
143
|
return c;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
if (
|
|
145
|
+
function O(i, n) {
|
|
146
|
+
if (i.length === 0)
|
|
147
147
|
return { position: 0, velocity: 0 };
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
150
|
-
return { position:
|
|
151
|
-
if (
|
|
148
|
+
const t = i[0], e = i[i.length - 1];
|
|
149
|
+
if (n <= 0)
|
|
150
|
+
return { position: t.position, velocity: t.velocity };
|
|
151
|
+
if (n >= e.time)
|
|
152
152
|
return { position: e.position, velocity: e.velocity };
|
|
153
|
-
let
|
|
154
|
-
for (;
|
|
155
|
-
const
|
|
156
|
-
|
|
153
|
+
let r = 0, o = i.length - 1;
|
|
154
|
+
for (; r < o - 1; ) {
|
|
155
|
+
const u = Math.floor((r + o) / 2);
|
|
156
|
+
i[u].time <= n ? r = u : o = u;
|
|
157
157
|
}
|
|
158
|
-
const s =
|
|
158
|
+
const s = i[r], a = i[o], c = (n - s.time) / (a.time - s.time);
|
|
159
159
|
return {
|
|
160
160
|
position: s.position + (a.position - s.position) * c,
|
|
161
161
|
velocity: s.velocity + (a.velocity - s.velocity) * c
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
-
function J(
|
|
165
|
-
return
|
|
164
|
+
function J(i, n) {
|
|
165
|
+
return i.map((t) => n(t.position));
|
|
166
166
|
}
|
|
167
|
-
function Q(
|
|
167
|
+
function Q(i) {
|
|
168
168
|
const {
|
|
169
|
-
element:
|
|
170
|
-
from:
|
|
169
|
+
element: n,
|
|
170
|
+
from: t,
|
|
171
171
|
to: e,
|
|
172
|
-
spring:
|
|
173
|
-
velocity:
|
|
172
|
+
spring: r,
|
|
173
|
+
velocity: o = 0,
|
|
174
174
|
style: s,
|
|
175
175
|
onComplete: a,
|
|
176
176
|
onStart: c
|
|
177
|
-
} =
|
|
178
|
-
if (
|
|
177
|
+
} = i, u = B(t, e, r, o);
|
|
178
|
+
if (u.length === 0)
|
|
179
179
|
return c == null || c(), a(), {
|
|
180
180
|
stop: () => {
|
|
181
181
|
},
|
|
@@ -183,71 +183,74 @@ function Q(n) {
|
|
|
183
183
|
getVelocity: () => 0,
|
|
184
184
|
isRunning: () => !1
|
|
185
185
|
};
|
|
186
|
-
const h = J(
|
|
186
|
+
const h = J(u, s), l = u[u.length - 1], g = l.time, w = n.animate(h, {
|
|
187
187
|
duration: g,
|
|
188
188
|
fill: "forwards",
|
|
189
189
|
easing: "linear"
|
|
190
190
|
// Spring physics already applied in keyframes
|
|
191
191
|
});
|
|
192
|
-
let
|
|
193
|
-
const
|
|
194
|
-
return c == null || c(),
|
|
195
|
-
|
|
192
|
+
let p = !0;
|
|
193
|
+
const y = performance.now();
|
|
194
|
+
return c == null || c(), w.onfinish = () => {
|
|
195
|
+
p && (p = !1, a());
|
|
196
196
|
}, {
|
|
197
197
|
stop: () => {
|
|
198
|
-
|
|
198
|
+
p && (p = !1, w.cancel());
|
|
199
199
|
},
|
|
200
200
|
getPosition: () => {
|
|
201
|
-
if (!
|
|
202
|
-
return
|
|
203
|
-
const
|
|
204
|
-
return
|
|
201
|
+
if (!p)
|
|
202
|
+
return l.position;
|
|
203
|
+
const m = performance.now() - y;
|
|
204
|
+
return O(u, m).position;
|
|
205
205
|
},
|
|
206
206
|
getVelocity: () => {
|
|
207
|
-
if (!
|
|
207
|
+
if (!p)
|
|
208
208
|
return 0;
|
|
209
|
-
const
|
|
210
|
-
return
|
|
209
|
+
const m = performance.now() - y;
|
|
210
|
+
return O(u, m).velocity;
|
|
211
211
|
},
|
|
212
|
-
isRunning: () =>
|
|
212
|
+
isRunning: () => p
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function Z(
|
|
216
|
-
const { from:
|
|
215
|
+
function Z(i) {
|
|
216
|
+
const { from: n, to: t, spring: e, velocity: r, onComplete: o, onStart: s, tick: a, css: c } = i;
|
|
217
217
|
if (a && c)
|
|
218
218
|
throw new Error("Cannot use both 'tick' and 'css' options together");
|
|
219
|
-
return !a && !c ? (s == null || s(),
|
|
219
|
+
return !a && !c ? (s == null || s(), o(), {
|
|
220
220
|
stop: () => {
|
|
221
221
|
},
|
|
222
|
-
getPosition: () =>
|
|
222
|
+
getPosition: () => t,
|
|
223
223
|
getVelocity: () => 0,
|
|
224
224
|
isRunning: () => !1
|
|
225
225
|
}) : c ? Q({
|
|
226
226
|
element: c.element,
|
|
227
|
-
from:
|
|
228
|
-
to:
|
|
227
|
+
from: n,
|
|
228
|
+
to: t,
|
|
229
229
|
spring: e,
|
|
230
|
-
velocity:
|
|
230
|
+
velocity: r,
|
|
231
231
|
style: c.style,
|
|
232
|
-
onComplete:
|
|
232
|
+
onComplete: o,
|
|
233
233
|
onStart: s
|
|
234
|
-
}) :
|
|
235
|
-
from:
|
|
236
|
-
to:
|
|
234
|
+
}) : G({
|
|
235
|
+
from: n,
|
|
236
|
+
to: t,
|
|
237
237
|
spring: e,
|
|
238
|
-
velocity:
|
|
238
|
+
velocity: r,
|
|
239
239
|
onUpdate: a,
|
|
240
|
-
onComplete:
|
|
240
|
+
onComplete: o,
|
|
241
241
|
onStart: s
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
-
class
|
|
244
|
+
class X {
|
|
245
|
+
}
|
|
246
|
+
class I extends X {
|
|
245
247
|
constructor(t) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
super();
|
|
249
|
+
d(this, "options");
|
|
250
|
+
d(this, "controls", null);
|
|
251
|
+
d(this, "isAnimating", !1);
|
|
252
|
+
d(this, "currentValue");
|
|
253
|
+
d(this, "currentVelocity", 0);
|
|
251
254
|
if (t.tick && t.css)
|
|
252
255
|
throw new Error("Cannot use both 'tick' and 'css' options together");
|
|
253
256
|
this.options = {
|
|
@@ -301,7 +304,6 @@ class k {
|
|
|
301
304
|
}
|
|
302
305
|
getCurrentState() {
|
|
303
306
|
return {
|
|
304
|
-
type: "single",
|
|
305
307
|
position: this.getCurrentValue(),
|
|
306
308
|
velocity: this.getVelocity(),
|
|
307
309
|
from: this.options.from,
|
|
@@ -317,724 +319,647 @@ class k {
|
|
|
317
319
|
updateOptions(t) {
|
|
318
320
|
this.options = { ...this.options, ...t };
|
|
319
321
|
}
|
|
320
|
-
static fromState(t,
|
|
321
|
-
const
|
|
322
|
-
return
|
|
322
|
+
static fromState(t, e) {
|
|
323
|
+
const r = new I(e);
|
|
324
|
+
return r.setValue(t.position), r.setVelocity(t.velocity), r;
|
|
323
325
|
}
|
|
324
326
|
}
|
|
325
|
-
class
|
|
327
|
+
class x extends X {
|
|
326
328
|
constructor(t) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
this
|
|
329
|
+
super();
|
|
330
|
+
d(this, "config");
|
|
331
|
+
d(this, "animators", /* @__PURE__ */ new Map());
|
|
332
|
+
d(this, "springOrder", []);
|
|
333
|
+
d(this, "completedCount", 0);
|
|
334
|
+
d(this, "completedAnimators", /* @__PURE__ */ new Set());
|
|
335
|
+
d(this, "direction", "forward");
|
|
336
|
+
d(this, "idCounter", 0);
|
|
337
|
+
d(this, "rafId", null);
|
|
338
|
+
d(this, "element");
|
|
339
|
+
d(this, "from");
|
|
340
|
+
d(this, "to");
|
|
341
|
+
this.config = t.config, this.from = t.from, this.to = t.to, this.element = t.element, this.initializeAnimators();
|
|
336
342
|
}
|
|
337
343
|
generateId() {
|
|
338
344
|
return `spring_${this.idCounter++}`;
|
|
339
345
|
}
|
|
340
346
|
initializeAnimators() {
|
|
341
347
|
this.config.springs.forEach((t) => {
|
|
342
|
-
const
|
|
343
|
-
from:
|
|
344
|
-
to:
|
|
348
|
+
const e = this.generateId(), r = new I({
|
|
349
|
+
from: this.from,
|
|
350
|
+
to: this.to,
|
|
345
351
|
spring: t.spring,
|
|
346
352
|
tick: t.tick,
|
|
347
|
-
|
|
353
|
+
css: t.css && this.element ? { element: this.element, style: t.css } : void 0,
|
|
354
|
+
onComplete: () => this.onAnimatorComplete(e),
|
|
348
355
|
onStart: t.onStart
|
|
349
356
|
});
|
|
350
|
-
this.animators.set(
|
|
351
|
-
id:
|
|
357
|
+
this.animators.set(e, {
|
|
358
|
+
id: e,
|
|
352
359
|
item: t,
|
|
353
|
-
animator:
|
|
354
|
-
|
|
355
|
-
}), this.springOrder.push(
|
|
360
|
+
animator: r,
|
|
361
|
+
started: !1
|
|
362
|
+
}), this.springOrder.push(e);
|
|
356
363
|
});
|
|
357
364
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const a = Math.max(
|
|
374
|
-
...Array.from(this.animators.values()).map((c) => c.item.offset ?? 0)
|
|
375
|
-
);
|
|
376
|
-
return { type: "offset", id: e, delay: a - s };
|
|
377
|
-
});
|
|
365
|
+
/**
|
|
366
|
+
* Calculate progress of an animator (0-1)
|
|
367
|
+
* Progress = |position - from| / |to - from|
|
|
368
|
+
*/
|
|
369
|
+
getAnimatorProgress(t) {
|
|
370
|
+
const e = t.animator.getCurrentState(), r = Math.abs(e.to - e.from);
|
|
371
|
+
return r === 0 ? 1 : Math.abs(e.position - e.from) / r;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Get order of springs based on direction
|
|
375
|
+
* Forward: 0, 1, 2, ...
|
|
376
|
+
* Backward: n-1, n-2, ..., 0
|
|
377
|
+
*/
|
|
378
|
+
getOrderedIds() {
|
|
379
|
+
return this.direction === "forward" ? this.springOrder : [...this.springOrder].reverse();
|
|
378
380
|
}
|
|
379
381
|
onAnimatorComplete(t) {
|
|
380
|
-
var
|
|
381
|
-
const
|
|
382
|
-
!
|
|
382
|
+
var r, o, s, a, c, u;
|
|
383
|
+
const e = this.animators.get(t);
|
|
384
|
+
!e || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = e.item).onComplete) == null || o.call(r), (a = (s = this.config).onProgress) == null || a.call(s, this.completedCount, this.config.springs.length), this.completedCount === this.config.springs.length && (this.stopScheduler(), (u = (c = this.config).onEnd) == null || u.call(c)));
|
|
383
385
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (e) {
|
|
397
|
-
const o = this.animators.get(e);
|
|
398
|
-
o && o.startTime === null && this.startBackwardAnimator(e);
|
|
386
|
+
/**
|
|
387
|
+
* Check and start springs based on previous spring's progress
|
|
388
|
+
* Called on each frame while animation is running
|
|
389
|
+
*/
|
|
390
|
+
checkAndStartSprings() {
|
|
391
|
+
const t = this.getOrderedIds();
|
|
392
|
+
for (let e = 0; e < t.length; e++) {
|
|
393
|
+
const r = t[e], o = this.animators.get(r);
|
|
394
|
+
if (!o || o.started) continue;
|
|
395
|
+
if (e === 0) {
|
|
396
|
+
this.startAnimator(r);
|
|
397
|
+
continue;
|
|
399
398
|
}
|
|
399
|
+
const s = t[e - 1], a = this.animators.get(s);
|
|
400
|
+
if (!a || !a.started) continue;
|
|
401
|
+
const c = this.getAnimatorProgress(a), u = o.item.normalizedOffset;
|
|
402
|
+
c >= u && this.startAnimator(r);
|
|
400
403
|
}
|
|
401
404
|
}
|
|
402
405
|
startAnimator(t) {
|
|
403
|
-
const
|
|
404
|
-
!
|
|
406
|
+
const e = this.animators.get(t);
|
|
407
|
+
!e || e.started || (e.started = !0, this.direction === "forward" ? e.animator.forward() : e.animator.backward());
|
|
405
408
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Start the scheduler loop that checks spring progress
|
|
411
|
+
*/
|
|
412
|
+
startScheduler() {
|
|
413
|
+
const t = () => {
|
|
414
|
+
this.checkAndStartSprings(), this.getIsAnimating() && (this.rafId = requestAnimationFrame(t));
|
|
415
|
+
};
|
|
416
|
+
this.rafId = requestAnimationFrame(t);
|
|
417
|
+
}
|
|
418
|
+
stopScheduler() {
|
|
419
|
+
this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
|
|
420
|
+
}
|
|
421
|
+
getFirstAnimator() {
|
|
422
|
+
var e;
|
|
423
|
+
const t = this.springOrder[0];
|
|
424
|
+
return t ? ((e = this.animators.get(t)) == null ? void 0 : e.animator) ?? null : null;
|
|
409
425
|
}
|
|
410
426
|
forward() {
|
|
411
|
-
var
|
|
412
|
-
this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), (e = (
|
|
413
|
-
if (o.type !== "wait")
|
|
414
|
-
if (o.delay === 0)
|
|
415
|
-
this.startAnimator(o.id);
|
|
416
|
-
else {
|
|
417
|
-
const r = window.setTimeout(
|
|
418
|
-
() => this.startAnimator(o.id),
|
|
419
|
-
o.delay
|
|
420
|
-
);
|
|
421
|
-
this.timeoutIds.push(r);
|
|
422
|
-
}
|
|
423
|
-
});
|
|
427
|
+
var t, e;
|
|
428
|
+
this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (e = (t = this.config).onStart) == null || e.call(t), this.startScheduler();
|
|
424
429
|
}
|
|
425
430
|
backward() {
|
|
426
|
-
var
|
|
427
|
-
this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), (e = (
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const r = window.setTimeout(
|
|
433
|
-
() => this.startBackwardAnimator(o.id),
|
|
434
|
-
o.delay
|
|
435
|
-
);
|
|
436
|
-
this.timeoutIds.push(r);
|
|
437
|
-
}
|
|
431
|
+
var t, e;
|
|
432
|
+
this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (e = (t = this.config).onStart) == null || e.call(t), this.startScheduler();
|
|
433
|
+
}
|
|
434
|
+
resetStartedFlags() {
|
|
435
|
+
this.animators.forEach((t) => {
|
|
436
|
+
t.started = !1;
|
|
438
437
|
});
|
|
439
438
|
}
|
|
440
439
|
stop() {
|
|
441
|
-
this.
|
|
442
|
-
t.animator.stop(), t.
|
|
440
|
+
this.stopScheduler(), this.animators.forEach((t) => {
|
|
441
|
+
t.animator.stop(), t.started = !1;
|
|
443
442
|
});
|
|
444
443
|
}
|
|
445
444
|
reverse() {
|
|
446
445
|
this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((t) => {
|
|
447
|
-
if (t.
|
|
446
|
+
if (!t.started)
|
|
448
447
|
return;
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
const o = k.fromState(
|
|
454
|
-
{ position: 1, velocity: 0 },
|
|
448
|
+
const e = t.animator.getCurrentState();
|
|
449
|
+
if (e.position === e.to) {
|
|
450
|
+
const o = t.item.css && this.element ? { element: this.element, style: t.item.css } : void 0, s = I.fromState(
|
|
451
|
+
{ position: this.to, velocity: 0 },
|
|
455
452
|
{
|
|
456
|
-
from:
|
|
457
|
-
to:
|
|
453
|
+
from: this.to,
|
|
454
|
+
to: this.from,
|
|
458
455
|
spring: t.item.spring,
|
|
459
456
|
tick: t.item.tick,
|
|
457
|
+
css: o,
|
|
460
458
|
onComplete: () => this.onAnimatorComplete(t.id),
|
|
461
459
|
onStart: t.item.onStart
|
|
462
460
|
}
|
|
463
461
|
);
|
|
464
|
-
|
|
462
|
+
s.forward(), t.animator = s;
|
|
465
463
|
} else
|
|
466
464
|
t.animator.reverse();
|
|
467
465
|
});
|
|
468
466
|
}
|
|
469
467
|
getCurrentState() {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
468
|
+
const t = this.getFirstAnimator();
|
|
469
|
+
return t ? t.getCurrentState() : {
|
|
470
|
+
position: 0,
|
|
471
|
+
velocity: 0,
|
|
472
|
+
from: 0,
|
|
473
|
+
to: 1
|
|
475
474
|
};
|
|
476
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Get current position value from first animator
|
|
478
|
+
*/
|
|
479
|
+
getCurrentValue() {
|
|
480
|
+
const t = this.getFirstAnimator();
|
|
481
|
+
return (t == null ? void 0 : t.getCurrentValue()) ?? 0;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Get current velocity from first animator
|
|
485
|
+
*/
|
|
486
|
+
getVelocity() {
|
|
487
|
+
const t = this.getFirstAnimator();
|
|
488
|
+
return (t == null ? void 0 : t.getVelocity()) ?? 0;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Set position value on first animator
|
|
492
|
+
* TODO: Support per-spring control
|
|
493
|
+
*/
|
|
494
|
+
setValue(t) {
|
|
495
|
+
const e = this.getFirstAnimator();
|
|
496
|
+
e == null || e.setValue(t);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Set velocity on first animator
|
|
500
|
+
* TODO: Support per-spring control
|
|
501
|
+
*/
|
|
502
|
+
setVelocity(t) {
|
|
503
|
+
const e = this.getFirstAnimator();
|
|
504
|
+
e == null || e.setVelocity(t);
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Check if any animation is currently running
|
|
508
|
+
*/
|
|
509
|
+
getIsAnimating() {
|
|
510
|
+
for (const t of this.animators.values())
|
|
511
|
+
if (t.animator.getIsAnimating())
|
|
512
|
+
return !0;
|
|
513
|
+
return !1;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Create MultiAnimator from existing state
|
|
517
|
+
* Uses first animator's state for initialization
|
|
518
|
+
*/
|
|
519
|
+
static fromState(t, e) {
|
|
520
|
+
const r = new x(e);
|
|
521
|
+
return r.setValue(t.position), r.setVelocity(t.velocity), r;
|
|
522
|
+
}
|
|
477
523
|
}
|
|
478
|
-
const
|
|
479
|
-
runIn: async (
|
|
480
|
-
const { currentAnimation:
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
if (
|
|
484
|
-
return i.controller.reverse(), {
|
|
485
|
-
state: {
|
|
486
|
-
position: 0,
|
|
487
|
-
velocity: 0
|
|
488
|
-
},
|
|
489
|
-
from: 0,
|
|
490
|
-
to: 1,
|
|
491
|
-
direction: "forward"
|
|
492
|
-
};
|
|
493
|
-
if (t.out) {
|
|
494
|
-
const a = await t.out, { from: c = 1, to: m = 0 } = a;
|
|
524
|
+
const Y = Symbol.for("TRANSITION_STRATEGY"), tt = (i) => ({
|
|
525
|
+
runIn: async (n) => {
|
|
526
|
+
const { currentAnimation: t } = i;
|
|
527
|
+
if (t && t.direction === "out") {
|
|
528
|
+
const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
|
|
529
|
+
if (t.controller.stop(), n.out)
|
|
495
530
|
return {
|
|
496
|
-
config:
|
|
497
|
-
state: {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
from: c,
|
|
502
|
-
// OUT animation's from
|
|
503
|
-
to: m,
|
|
504
|
-
// OUT animation's to
|
|
531
|
+
config: n.out,
|
|
532
|
+
state: { position: r, velocity: o },
|
|
533
|
+
from: 1,
|
|
534
|
+
to: 0,
|
|
505
535
|
direction: "backward"
|
|
506
536
|
// Will actually go 0→1 (backward means toward 'from')
|
|
507
537
|
};
|
|
508
|
-
}
|
|
509
538
|
}
|
|
510
|
-
const e =
|
|
511
|
-
|
|
512
|
-
return {
|
|
513
|
-
state: {
|
|
514
|
-
position: 0,
|
|
515
|
-
velocity: 0
|
|
516
|
-
},
|
|
517
|
-
from: 0,
|
|
518
|
-
to: 1,
|
|
519
|
-
direction: "forward"
|
|
520
|
-
};
|
|
521
|
-
if ("springs" in e)
|
|
522
|
-
return {
|
|
523
|
-
config: e,
|
|
524
|
-
state: {
|
|
525
|
-
position: 0,
|
|
526
|
-
velocity: 0
|
|
527
|
-
},
|
|
528
|
-
from: 0,
|
|
529
|
-
to: 1,
|
|
530
|
-
direction: "forward"
|
|
531
|
-
};
|
|
532
|
-
const { from: o = 0, to: r = 1 } = e;
|
|
533
|
-
return {
|
|
539
|
+
const e = n.in;
|
|
540
|
+
return e ? {
|
|
534
541
|
config: e,
|
|
535
542
|
state: {
|
|
536
|
-
position:
|
|
543
|
+
position: 0,
|
|
537
544
|
velocity: 0
|
|
538
545
|
},
|
|
539
|
-
from:
|
|
540
|
-
to:
|
|
546
|
+
from: 0,
|
|
547
|
+
to: 1,
|
|
548
|
+
direction: "forward"
|
|
549
|
+
} : {
|
|
550
|
+
state: {
|
|
551
|
+
position: 0,
|
|
552
|
+
velocity: 0
|
|
553
|
+
},
|
|
554
|
+
from: 0,
|
|
555
|
+
to: 1,
|
|
541
556
|
direction: "forward"
|
|
542
557
|
};
|
|
543
558
|
},
|
|
544
|
-
runOut: async (
|
|
545
|
-
const { currentAnimation:
|
|
546
|
-
if (
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
549
|
-
return i.controller.reverse(), {
|
|
550
|
-
state: {
|
|
551
|
-
position: 1,
|
|
552
|
-
velocity: 0
|
|
553
|
-
},
|
|
554
|
-
from: 1,
|
|
555
|
-
to: 0,
|
|
556
|
-
direction: "forward"
|
|
557
|
-
};
|
|
558
|
-
if (t.in) {
|
|
559
|
-
const a = await t.in, { from: c = 0, to: m = 1 } = a;
|
|
559
|
+
runOut: async (n) => {
|
|
560
|
+
const { currentAnimation: t } = i;
|
|
561
|
+
if (t && t.direction === "in") {
|
|
562
|
+
const r = t.controller.getCurrentValue(), o = t.controller.getVelocity();
|
|
563
|
+
if (t.controller.stop(), n.in)
|
|
560
564
|
return {
|
|
561
|
-
config:
|
|
562
|
-
state: {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
},
|
|
566
|
-
from: c,
|
|
567
|
-
// IN animation's from
|
|
568
|
-
to: m,
|
|
569
|
-
// IN animation's to
|
|
565
|
+
config: n.in,
|
|
566
|
+
state: { position: r, velocity: o },
|
|
567
|
+
from: 0,
|
|
568
|
+
to: 1,
|
|
570
569
|
direction: "backward"
|
|
571
570
|
// Will actually go 1→0 (backward means toward 'from')
|
|
572
571
|
};
|
|
573
|
-
}
|
|
574
572
|
}
|
|
575
|
-
const e =
|
|
576
|
-
|
|
577
|
-
return {
|
|
578
|
-
state: {
|
|
579
|
-
position: 1,
|
|
580
|
-
velocity: 0
|
|
581
|
-
},
|
|
582
|
-
from: 1,
|
|
583
|
-
to: 0,
|
|
584
|
-
direction: "forward"
|
|
585
|
-
};
|
|
586
|
-
if ("springs" in e)
|
|
587
|
-
return {
|
|
588
|
-
config: e,
|
|
589
|
-
state: {
|
|
590
|
-
position: 1,
|
|
591
|
-
velocity: 0
|
|
592
|
-
},
|
|
593
|
-
from: 1,
|
|
594
|
-
to: 0,
|
|
595
|
-
direction: "forward"
|
|
596
|
-
};
|
|
597
|
-
const { from: o = 1, to: r = 0 } = e;
|
|
598
|
-
return {
|
|
573
|
+
const e = n.out;
|
|
574
|
+
return e ? {
|
|
599
575
|
config: e,
|
|
600
576
|
state: {
|
|
601
|
-
position:
|
|
577
|
+
position: 1,
|
|
602
578
|
velocity: 0
|
|
603
579
|
},
|
|
604
|
-
from:
|
|
605
|
-
to:
|
|
580
|
+
from: 1,
|
|
581
|
+
to: 0,
|
|
582
|
+
direction: "forward"
|
|
583
|
+
} : {
|
|
584
|
+
state: {
|
|
585
|
+
position: 1,
|
|
586
|
+
velocity: 0
|
|
587
|
+
},
|
|
588
|
+
from: 1,
|
|
589
|
+
to: 0,
|
|
606
590
|
direction: "forward"
|
|
607
591
|
};
|
|
608
592
|
}
|
|
609
|
-
}),
|
|
610
|
-
runIn: async (
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
state: {
|
|
615
|
-
position: 0,
|
|
616
|
-
velocity: 0
|
|
617
|
-
},
|
|
618
|
-
from: 0,
|
|
619
|
-
to: 1,
|
|
620
|
-
direction: "forward"
|
|
621
|
-
};
|
|
622
|
-
if ("springs" in t)
|
|
623
|
-
return {
|
|
624
|
-
config: t,
|
|
625
|
-
state: {
|
|
626
|
-
position: 0,
|
|
627
|
-
velocity: 0
|
|
628
|
-
},
|
|
629
|
-
from: 0,
|
|
630
|
-
to: 1,
|
|
631
|
-
direction: "forward"
|
|
632
|
-
};
|
|
633
|
-
const { from: i = 0, to: e = 1 } = t;
|
|
634
|
-
return {
|
|
635
|
-
config: t,
|
|
593
|
+
}), et = () => ({
|
|
594
|
+
runIn: async (i) => {
|
|
595
|
+
const n = i.in;
|
|
596
|
+
return n ? {
|
|
597
|
+
config: n,
|
|
636
598
|
state: {
|
|
637
|
-
position:
|
|
599
|
+
position: 0,
|
|
638
600
|
velocity: 0
|
|
639
601
|
},
|
|
640
|
-
from:
|
|
641
|
-
to:
|
|
602
|
+
from: 0,
|
|
603
|
+
to: 1,
|
|
604
|
+
direction: "forward"
|
|
605
|
+
} : {
|
|
606
|
+
state: {
|
|
607
|
+
position: 0,
|
|
608
|
+
velocity: 0
|
|
609
|
+
},
|
|
610
|
+
from: 0,
|
|
611
|
+
to: 1,
|
|
642
612
|
direction: "forward"
|
|
643
613
|
};
|
|
644
614
|
},
|
|
645
|
-
runOut: async (
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
if ("springs" in t)
|
|
658
|
-
return {
|
|
659
|
-
config: t,
|
|
660
|
-
state: {
|
|
661
|
-
position: 1,
|
|
662
|
-
velocity: 0
|
|
663
|
-
},
|
|
664
|
-
from: 1,
|
|
665
|
-
to: 0,
|
|
666
|
-
direction: "forward"
|
|
667
|
-
};
|
|
668
|
-
const { from: i = 1, to: e = 0 } = t;
|
|
669
|
-
return {
|
|
670
|
-
config: t,
|
|
615
|
+
runOut: async (i) => {
|
|
616
|
+
const n = i.out;
|
|
617
|
+
return n ? {
|
|
618
|
+
config: n,
|
|
619
|
+
state: {
|
|
620
|
+
position: 1,
|
|
621
|
+
velocity: 0
|
|
622
|
+
},
|
|
623
|
+
from: 1,
|
|
624
|
+
to: 0,
|
|
625
|
+
direction: "forward"
|
|
626
|
+
} : {
|
|
671
627
|
state: {
|
|
672
|
-
position:
|
|
628
|
+
position: 1,
|
|
673
629
|
velocity: 0
|
|
674
630
|
},
|
|
675
|
-
from:
|
|
676
|
-
to:
|
|
631
|
+
from: 1,
|
|
632
|
+
to: 0,
|
|
677
633
|
direction: "forward"
|
|
678
634
|
};
|
|
679
635
|
}
|
|
680
636
|
});
|
|
681
|
-
function
|
|
637
|
+
function nt(i, n) {
|
|
682
638
|
var h;
|
|
683
|
-
let
|
|
639
|
+
let t = null, e = null, r = null, o = null;
|
|
684
640
|
const s = {
|
|
685
641
|
get currentAnimation() {
|
|
686
|
-
return
|
|
642
|
+
return t;
|
|
687
643
|
}
|
|
688
|
-
}, a = ((h =
|
|
689
|
-
var
|
|
644
|
+
}, a = ((h = n == null ? void 0 : n.strategy) == null ? void 0 : h.call(n, s)) || tt(s), c = async (l) => {
|
|
645
|
+
var C;
|
|
690
646
|
e && (e.remove(), e = null);
|
|
691
|
-
const g =
|
|
692
|
-
if (!
|
|
647
|
+
const g = i(), w = g.in && await g.in(l), p = !(n != null && n.strategy) && g.out ? await g.out(l) : void 0;
|
|
648
|
+
if (!w)
|
|
693
649
|
return;
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
i && (i.direction = "in");
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
(S = l.prepare) == null || S.call(l, u), l.wait && await l.wait();
|
|
704
|
-
const C = new L({
|
|
705
|
-
...l,
|
|
706
|
-
onEnd: () => {
|
|
707
|
-
var b;
|
|
708
|
-
i = null, (b = l.onEnd) == null || b.call(l);
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
|
-
i = { controller: C, direction: "in" }, C.forward();
|
|
650
|
+
const y = {
|
|
651
|
+
in: V(w),
|
|
652
|
+
out: p ? V(p) : void 0
|
|
653
|
+
}, m = await a.runIn(y);
|
|
654
|
+
if (!m.config) {
|
|
655
|
+
t && (t.direction = "in");
|
|
712
656
|
return;
|
|
713
657
|
}
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
const y = k.fromState(f.state, {
|
|
722
|
-
from: f.from,
|
|
723
|
-
to: f.to,
|
|
724
|
-
spring: f.config.spring,
|
|
725
|
-
tick: f.config.tick,
|
|
726
|
-
css: f.config.css ? { element: u, style: f.config.css } : void 0,
|
|
727
|
-
onStart: f.config.onStart,
|
|
728
|
-
onComplete: () => {
|
|
729
|
-
var v, T;
|
|
730
|
-
i = null, (T = (v = f.config) == null ? void 0 : v.onEnd) == null || T.call(v);
|
|
658
|
+
const f = m.config;
|
|
659
|
+
(C = f.prepare) == null || C.call(f, l), f.wait && await f.wait();
|
|
660
|
+
const S = M({
|
|
661
|
+
...f,
|
|
662
|
+
onEnd: () => {
|
|
663
|
+
var A;
|
|
664
|
+
t = null, (A = f.onEnd) == null || A.call(f);
|
|
731
665
|
}
|
|
666
|
+
}), v = x.fromState(m.state, {
|
|
667
|
+
config: S,
|
|
668
|
+
from: m.from,
|
|
669
|
+
to: m.to,
|
|
670
|
+
element: l
|
|
732
671
|
});
|
|
733
|
-
|
|
734
|
-
},
|
|
735
|
-
var
|
|
736
|
-
e =
|
|
737
|
-
const g =
|
|
738
|
-
if (!
|
|
672
|
+
t = { controller: v, direction: "in" }, m.direction === "forward" ? v.forward() : v.backward();
|
|
673
|
+
}, u = async (l) => {
|
|
674
|
+
var A;
|
|
675
|
+
e = l;
|
|
676
|
+
const g = i(), w = !(n != null && n.strategy) && g.in ? await g.in(l) : void 0, p = g.out && await g.out(l);
|
|
677
|
+
if (!p)
|
|
739
678
|
return;
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
i && (i.direction = "out"), e && (e.remove(), e = null);
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
(S = l.prepare) == null || S.call(l, u), y(), l.wait && await l.wait();
|
|
750
|
-
const C = new L({
|
|
751
|
-
...l,
|
|
752
|
-
onEnd: () => {
|
|
753
|
-
var b, O;
|
|
754
|
-
(b = l.onEnd) == null || b.call(l), e && (e.remove(), e = null), i = null, (O = t == null ? void 0 : t.onCleanupEnd) == null || O.call(t);
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
i = { controller: C, direction: "out" }, C.forward();
|
|
679
|
+
const y = {
|
|
680
|
+
in: w ? V(w) : void 0,
|
|
681
|
+
out: V(p)
|
|
682
|
+
}, m = await a.runOut(y);
|
|
683
|
+
if (!m.config) {
|
|
684
|
+
t && (t.direction = "out"), e && (e.remove(), e = null);
|
|
758
685
|
return;
|
|
759
686
|
}
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
const f = k.fromState(d.state, {
|
|
768
|
-
from: d.from,
|
|
769
|
-
to: d.to,
|
|
770
|
-
spring: d.config.spring,
|
|
771
|
-
tick: d.config.tick,
|
|
772
|
-
css: d.config.css ? { element: u, style: d.config.css } : void 0,
|
|
773
|
-
onStart: d.config.onStart,
|
|
774
|
-
onComplete: () => {
|
|
775
|
-
var v, T, C;
|
|
776
|
-
(T = (v = d.config) == null ? void 0 : v.onEnd) == null || T.call(v), e && (e.remove(), e = null), i = null, (C = t == null ? void 0 : t.onCleanupEnd) == null || C.call(t);
|
|
687
|
+
const f = m.config;
|
|
688
|
+
(A = f.prepare) == null || A.call(f, l), C(), f.wait && await f.wait();
|
|
689
|
+
const S = M({
|
|
690
|
+
...f,
|
|
691
|
+
onEnd: () => {
|
|
692
|
+
var T, E;
|
|
693
|
+
(T = f.onEnd) == null || T.call(f), e && (e.remove(), e = null), t = null, (E = n == null ? void 0 : n.onCleanupEnd) == null || E.call(n);
|
|
777
694
|
}
|
|
695
|
+
}), v = x.fromState(m.state, {
|
|
696
|
+
config: S,
|
|
697
|
+
from: m.from,
|
|
698
|
+
to: m.to,
|
|
699
|
+
element: l
|
|
778
700
|
});
|
|
779
|
-
|
|
780
|
-
function
|
|
781
|
-
!
|
|
701
|
+
t = { controller: v, direction: "out" }, m.direction === "forward" ? v.forward() : v.backward();
|
|
702
|
+
function C() {
|
|
703
|
+
!r || !e || (o && r.contains(o) ? r.insertBefore(e, o) : r.appendChild(e));
|
|
782
704
|
}
|
|
783
705
|
};
|
|
784
|
-
return (
|
|
785
|
-
if (
|
|
786
|
-
return
|
|
787
|
-
if (
|
|
788
|
-
const g =
|
|
789
|
-
|
|
706
|
+
return (l) => {
|
|
707
|
+
if (l)
|
|
708
|
+
return r = l.parentElement, o = l.nextElementSibling, c(l), () => {
|
|
709
|
+
if (l.isConnected) {
|
|
710
|
+
const g = l.cloneNode(!0);
|
|
711
|
+
u(g);
|
|
790
712
|
} else
|
|
791
|
-
|
|
713
|
+
u(l);
|
|
792
714
|
};
|
|
793
715
|
};
|
|
794
716
|
}
|
|
795
|
-
const
|
|
796
|
-
if (!
|
|
797
|
-
const
|
|
798
|
-
`).map((
|
|
799
|
-
for (let
|
|
800
|
-
const e = t
|
|
801
|
-
if (!
|
|
717
|
+
const it = 3, ot = (i) => {
|
|
718
|
+
if (!i) return null;
|
|
719
|
+
const n = i.split(`
|
|
720
|
+
`).map((t) => t.trim());
|
|
721
|
+
for (let t = it; t < Math.min(n.length, 6); t++) {
|
|
722
|
+
const e = n[t], r = e == null ? void 0 : e.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
|
|
723
|
+
if (!r)
|
|
802
724
|
continue;
|
|
803
|
-
const
|
|
804
|
-
return { file:
|
|
725
|
+
const o = r[1] ?? "", s = r[2] ?? "0", a = r[3] ?? "0";
|
|
726
|
+
return { file: o.split(/[\\/]/).pop() || o, line: s, column: a };
|
|
805
727
|
}
|
|
806
728
|
return null;
|
|
807
|
-
}, R = /* @__PURE__ */ new Map(),
|
|
808
|
-
function rt(n, t
|
|
809
|
-
R.set(
|
|
810
|
-
let e =
|
|
811
|
-
return e || (e =
|
|
729
|
+
}, R = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
730
|
+
function rt(i, n, t) {
|
|
731
|
+
R.set(i, n);
|
|
732
|
+
let e = F.get(i);
|
|
733
|
+
return e || (e = nt(
|
|
812
734
|
() => {
|
|
813
|
-
const
|
|
814
|
-
return
|
|
735
|
+
const r = R.get(i);
|
|
736
|
+
return r || (console.warn(`Transition "${String(i)}" not found`), {});
|
|
815
737
|
},
|
|
816
738
|
{
|
|
817
|
-
strategy:
|
|
818
|
-
onCleanupEnd: () =>
|
|
739
|
+
strategy: t,
|
|
740
|
+
onCleanupEnd: () => q(i)
|
|
819
741
|
}
|
|
820
|
-
),
|
|
742
|
+
), F.set(i, e), e);
|
|
821
743
|
}
|
|
822
|
-
function
|
|
823
|
-
R.delete(
|
|
744
|
+
function q(i) {
|
|
745
|
+
R.delete(i), F.delete(i);
|
|
824
746
|
}
|
|
825
747
|
function st() {
|
|
826
|
-
const
|
|
827
|
-
return
|
|
748
|
+
const i = ot(new Error().stack);
|
|
749
|
+
return i ? `auto_${i.file}_${i.line}_${i.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
|
|
828
750
|
}
|
|
829
|
-
const
|
|
751
|
+
const L = globalThis.FinalizationRegistry, D = L ? (
|
|
830
752
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
831
|
-
new
|
|
753
|
+
new L((i) => {
|
|
832
754
|
try {
|
|
833
|
-
|
|
755
|
+
q(i);
|
|
834
756
|
} catch {
|
|
835
757
|
}
|
|
836
758
|
})
|
|
837
759
|
) : void 0;
|
|
838
|
-
function gt(
|
|
839
|
-
const
|
|
840
|
-
if (
|
|
760
|
+
function gt(i) {
|
|
761
|
+
const n = i.key ?? st();
|
|
762
|
+
if (i.ref && D)
|
|
841
763
|
try {
|
|
842
|
-
|
|
764
|
+
D.register(i.ref, n);
|
|
843
765
|
} catch {
|
|
844
766
|
}
|
|
845
767
|
return rt(
|
|
846
|
-
|
|
768
|
+
n,
|
|
847
769
|
{
|
|
848
|
-
in:
|
|
849
|
-
out:
|
|
770
|
+
in: i.in,
|
|
771
|
+
out: i.out
|
|
850
772
|
},
|
|
851
|
-
|
|
773
|
+
i[Y]
|
|
852
774
|
);
|
|
853
775
|
}
|
|
854
|
-
function ct(
|
|
855
|
-
const
|
|
856
|
-
from:
|
|
857
|
-
to:
|
|
858
|
-
transition:
|
|
776
|
+
function ct(i) {
|
|
777
|
+
const n = i.filter((t) => t.symmetric).map((t) => ({
|
|
778
|
+
from: t.to,
|
|
779
|
+
to: t.from,
|
|
780
|
+
transition: t.transition
|
|
859
781
|
}));
|
|
860
|
-
return [...
|
|
782
|
+
return [...i, ...n];
|
|
861
783
|
}
|
|
862
|
-
function at(
|
|
863
|
-
let
|
|
864
|
-
const
|
|
865
|
-
if (!
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
}, a = (
|
|
869
|
-
if (!
|
|
870
|
-
const
|
|
871
|
-
if (!
|
|
872
|
-
const
|
|
873
|
-
|
|
784
|
+
function at(i) {
|
|
785
|
+
let n = !1, t = 0, e = 0, r = !1;
|
|
786
|
+
const o = 50, s = (p) => {
|
|
787
|
+
if (!i) return;
|
|
788
|
+
const y = p.touches[0];
|
|
789
|
+
y && (r = y.clientX < o, r && (t = y.clientX, e = y.clientY));
|
|
790
|
+
}, a = (p) => {
|
|
791
|
+
if (!i || !r) return;
|
|
792
|
+
const y = p.touches[0];
|
|
793
|
+
if (!y) return;
|
|
794
|
+
const m = y.clientX - t, f = y.clientY - e;
|
|
795
|
+
m > window.outerWidth / 2 - 5 && Math.abs(m) > Math.abs(f) ? n = !0 : n = !1;
|
|
874
796
|
}, c = () => {
|
|
875
|
-
|
|
876
|
-
},
|
|
877
|
-
typeof window > "u" ||
|
|
878
|
-
},
|
|
797
|
+
i && (r = !1, t = 0, e = 0);
|
|
798
|
+
}, u = () => n, h = () => {
|
|
799
|
+
typeof window > "u" || i && (window.addEventListener("touchstart", s, { passive: !0 }), window.addEventListener("touchmove", a, { passive: !0 }), window.addEventListener("touchend", c, { passive: !0 }));
|
|
800
|
+
}, l = () => {
|
|
879
801
|
typeof window > "u" || (window.removeEventListener("touchstart", s), window.removeEventListener("touchmove", a), window.removeEventListener("touchend", c));
|
|
880
802
|
};
|
|
881
803
|
let g = 0;
|
|
882
804
|
return {
|
|
883
805
|
initialize: h,
|
|
884
|
-
cleanup:
|
|
885
|
-
isSwipePending:
|
|
806
|
+
cleanup: l,
|
|
807
|
+
isSwipePending: u,
|
|
886
808
|
resetSwipeDetection: () => {
|
|
887
|
-
g++, g > 1 && (g = 0,
|
|
809
|
+
g++, g > 1 && (g = 0, n = !1);
|
|
888
810
|
}
|
|
889
811
|
};
|
|
890
812
|
}
|
|
891
|
-
const lt = (
|
|
892
|
-
let
|
|
893
|
-
for (;
|
|
894
|
-
const
|
|
895
|
-
if (e.includes("auto") || e.includes("scroll") ||
|
|
896
|
-
return
|
|
897
|
-
|
|
813
|
+
const lt = (i) => {
|
|
814
|
+
let n = i.parentElement;
|
|
815
|
+
for (; n && n !== document.body; ) {
|
|
816
|
+
const t = window.getComputedStyle(n), e = t.overflow + t.overflowY + t.overflowX;
|
|
817
|
+
if (e.includes("auto") || e.includes("scroll") || n.scrollHeight > n.clientHeight || n.scrollWidth > n.clientWidth)
|
|
818
|
+
return n;
|
|
819
|
+
n = n.parentElement;
|
|
898
820
|
}
|
|
899
821
|
return document.documentElement;
|
|
900
|
-
}, ut = (
|
|
901
|
-
let
|
|
902
|
-
for (;
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
return
|
|
906
|
-
|
|
822
|
+
}, ut = (i) => {
|
|
823
|
+
let n = i.parentElement;
|
|
824
|
+
for (; n && n !== document.body; ) {
|
|
825
|
+
const t = window.getComputedStyle(n).position;
|
|
826
|
+
if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
|
|
827
|
+
return n;
|
|
828
|
+
n = n.parentElement;
|
|
907
829
|
}
|
|
908
830
|
return document.body;
|
|
909
831
|
};
|
|
910
832
|
function ft() {
|
|
911
|
-
let
|
|
912
|
-
const
|
|
833
|
+
let i = null, n = null;
|
|
834
|
+
const t = /* @__PURE__ */ new Map();
|
|
913
835
|
let e = null;
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
x:
|
|
917
|
-
y:
|
|
836
|
+
const r = () => {
|
|
837
|
+
i && e && t.set(e, {
|
|
838
|
+
x: i.scrollLeft,
|
|
839
|
+
y: i.scrollTop
|
|
918
840
|
});
|
|
919
841
|
};
|
|
920
842
|
return {
|
|
921
|
-
initializeContext: (h,
|
|
922
|
-
|
|
843
|
+
initializeContext: (h, l) => {
|
|
844
|
+
n = h, i || (i = lt(h), (i === document.documentElement ? window : i).addEventListener("scroll", r, {
|
|
923
845
|
passive: !0
|
|
924
|
-
})), e =
|
|
846
|
+
})), e = l;
|
|
925
847
|
},
|
|
926
|
-
calculateScrollOffset: (h,
|
|
927
|
-
const g = h &&
|
|
848
|
+
calculateScrollOffset: (h, l) => {
|
|
849
|
+
const g = h && t.has(h) ? t.get(h) : { x: 0, y: 0 }, w = l && t.has(l) ? t.get(l) : { x: 0, y: 0 };
|
|
928
850
|
return {
|
|
929
|
-
x: -
|
|
930
|
-
y: -
|
|
851
|
+
x: -w.x + g.x,
|
|
852
|
+
y: -w.y + g.y
|
|
931
853
|
};
|
|
932
854
|
},
|
|
933
|
-
getScrollContainer: () =>
|
|
934
|
-
getPositionedParentElement: () =>
|
|
935
|
-
getScrollPosition: (h) => h &&
|
|
855
|
+
getScrollContainer: () => i,
|
|
856
|
+
getPositionedParentElement: () => n ? ut(n) : document.body,
|
|
857
|
+
getScrollPosition: (h) => h && t.has(h) ? t.get(h) : { x: 0, y: 0 }
|
|
936
858
|
};
|
|
937
859
|
}
|
|
938
|
-
function
|
|
939
|
-
if (
|
|
860
|
+
function k(i, n) {
|
|
861
|
+
if (n === "*")
|
|
940
862
|
return !0;
|
|
941
|
-
if (
|
|
942
|
-
const
|
|
943
|
-
return
|
|
863
|
+
if (n.endsWith("/*")) {
|
|
864
|
+
const t = n.slice(0, -2);
|
|
865
|
+
return i === t || i.startsWith(t + "/");
|
|
944
866
|
}
|
|
945
|
-
return
|
|
867
|
+
return i === n;
|
|
946
868
|
}
|
|
947
|
-
function mt(n, t
|
|
948
|
-
for (const e of
|
|
949
|
-
if (
|
|
869
|
+
function mt(i, n, t) {
|
|
870
|
+
for (const e of t)
|
|
871
|
+
if (k(i, e.from) && k(n, e.to))
|
|
950
872
|
return e.transition;
|
|
951
|
-
for (const e of
|
|
952
|
-
if ((e.from === "*" ||
|
|
873
|
+
for (const e of t)
|
|
874
|
+
if ((e.from === "*" || k(i, e.from)) && (e.to === "*" || k(n, e.to)))
|
|
953
875
|
return e.transition;
|
|
954
876
|
return null;
|
|
955
877
|
}
|
|
956
|
-
function pt(
|
|
878
|
+
function pt(i) {
|
|
957
879
|
const {
|
|
958
|
-
transitions:
|
|
959
|
-
defaultTransition:
|
|
960
|
-
middleware: e = (
|
|
880
|
+
transitions: n = [],
|
|
881
|
+
defaultTransition: t,
|
|
882
|
+
middleware: e = (m, f) => ({ from: m, to: f }),
|
|
961
883
|
// Identity function as default
|
|
962
|
-
skipOnIosSwipe:
|
|
884
|
+
skipOnIosSwipe: r = !0
|
|
963
885
|
// Default to true - skip animations on iOS swipe
|
|
964
|
-
} =
|
|
965
|
-
let
|
|
966
|
-
const s = ct(
|
|
886
|
+
} = i;
|
|
887
|
+
let o = null;
|
|
888
|
+
const s = ct(n), {
|
|
967
889
|
initializeContext: a,
|
|
968
890
|
calculateScrollOffset: c,
|
|
969
|
-
getScrollContainer:
|
|
891
|
+
getScrollContainer: u,
|
|
970
892
|
getPositionedParentElement: h,
|
|
971
|
-
getScrollPosition:
|
|
972
|
-
} = ft(), g = at(
|
|
893
|
+
getScrollPosition: l
|
|
894
|
+
} = ft(), g = at(r);
|
|
973
895
|
g.initialize();
|
|
974
|
-
function
|
|
975
|
-
if (
|
|
976
|
-
const { from:
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
),
|
|
896
|
+
function w() {
|
|
897
|
+
if (o != null && o.from && (o != null && o.to)) {
|
|
898
|
+
const { from: m, to: f } = e(
|
|
899
|
+
o.from,
|
|
900
|
+
o.to
|
|
901
|
+
), v = mt(
|
|
902
|
+
m,
|
|
980
903
|
f,
|
|
981
|
-
y,
|
|
982
904
|
s
|
|
983
|
-
) ||
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
),
|
|
987
|
-
scrollOffset:
|
|
988
|
-
scroll:
|
|
905
|
+
) || t, C = c(
|
|
906
|
+
o.from,
|
|
907
|
+
o.to
|
|
908
|
+
), A = {
|
|
909
|
+
scrollOffset: C,
|
|
910
|
+
scroll: l(o.from),
|
|
989
911
|
get scrollingElement() {
|
|
990
|
-
return
|
|
912
|
+
return u() || document.documentElement;
|
|
991
913
|
},
|
|
992
914
|
get positionedParent() {
|
|
993
915
|
return h();
|
|
994
916
|
}
|
|
995
917
|
}, T = {
|
|
996
|
-
scrollOffset:
|
|
918
|
+
scrollOffset: C,
|
|
997
919
|
get scroll() {
|
|
998
|
-
return
|
|
920
|
+
return o ? l(o.to) : { x: 0, y: 0 };
|
|
999
921
|
},
|
|
1000
922
|
get scrollingElement() {
|
|
1001
|
-
return
|
|
923
|
+
return u() || document.documentElement;
|
|
1002
924
|
},
|
|
1003
925
|
get positionedParent() {
|
|
1004
926
|
return h();
|
|
1005
927
|
}
|
|
1006
928
|
};
|
|
1007
|
-
|
|
1008
|
-
(
|
|
1009
|
-
),
|
|
1010
|
-
(
|
|
1011
|
-
)),
|
|
929
|
+
v && (v.out && o.outResolve && o.outResolve(
|
|
930
|
+
(E) => v.out(E, A)
|
|
931
|
+
), v.in && o.inResolve && o.inResolve(
|
|
932
|
+
(E) => v.in(E, T)
|
|
933
|
+
)), o = null;
|
|
1012
934
|
}
|
|
1013
935
|
}
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
})) : (
|
|
1017
|
-
|
|
936
|
+
const p = async (m, f) => g.isSwipePending() ? (g.resetSwipeDetection(), () => ({})) : f === "in" && (!o || !o.from) ? () => ({}) : (o || (o = {}), f === "out" ? (o.from = m, new Promise((S) => {
|
|
937
|
+
o.outResolve = S, w();
|
|
938
|
+
})) : (o.to = m, new Promise((S) => {
|
|
939
|
+
o.inResolve = S, w();
|
|
1018
940
|
})));
|
|
1019
|
-
return (
|
|
1020
|
-
key:
|
|
1021
|
-
in: async (
|
|
1022
|
-
out: async (
|
|
941
|
+
return (m) => ({
|
|
942
|
+
key: m,
|
|
943
|
+
in: async (f) => (a(f, m), (await p(m, "in"))(f)),
|
|
944
|
+
out: async (f) => (await p(m, "out"))(f),
|
|
1023
945
|
// Add page transition strategy for page-level transitions
|
|
1024
|
-
[
|
|
946
|
+
[Y]: et
|
|
1025
947
|
});
|
|
1026
948
|
}
|
|
1027
949
|
export {
|
|
1028
|
-
|
|
950
|
+
Y as TRANSITION_STRATEGY,
|
|
1029
951
|
tt as createDefaultStrategy,
|
|
1030
|
-
|
|
952
|
+
et as createPageTransitionStrategy,
|
|
1031
953
|
pt as createSggoiTransitionContext,
|
|
1032
954
|
st as generateAutoKey,
|
|
1033
955
|
vt as isCssAnimation,
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
956
|
+
St as isMultiSpring,
|
|
957
|
+
Ct as isSingleSpring,
|
|
958
|
+
At as isTickAnimation,
|
|
959
|
+
bt as jaeminInternal,
|
|
960
|
+
M as normalizeMultiSpringSchedule,
|
|
961
|
+
V as normalizeToMultiSpring,
|
|
1038
962
|
gt as transition,
|
|
1039
|
-
Et as validateAnimationMode
|
|
963
|
+
Et as validateAnimationMode,
|
|
964
|
+
Tt as validateSpringItem
|
|
1040
965
|
};
|