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