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