@ssgoi/core 2.0.0 → 2.1.2
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/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/create-transition-callback.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +284 -238
- package/dist/transition-strategy.d.ts.map +1 -1
- package/dist/transition.d.ts +51 -11
- package/dist/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +3 -0
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +3 -0
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +3 -0
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +3 -0
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +121 -105
- package/dist/transitions/none.d.ts +3 -0
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +3 -0
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +3 -0
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +3 -0
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.d.ts +11 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils-8Eptbv7c.cjs +2 -0
- package/dist/utils-DTRMUQW4.js +31 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts +9 -0
- package/dist/view-transitions/drill.d.ts.map +1 -0
- package/dist/view-transitions/fade.d.ts +3 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +1 -1
- 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 +234 -169
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils-BSgyev81.cjs +0 -1
- package/dist/utils-DR41YsAh.js +0 -16
package/dist/index.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { animate as
|
|
5
|
-
import { g as
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var x = (i, t, o) => t in i ? M(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
|
|
3
|
+
var g = (i, t, o) => x(i, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { animate as E } from "popmotion";
|
|
5
|
+
import { p as U, g as _ } from "./utils-DTRMUQW4.js";
|
|
6
6
|
class V {
|
|
7
7
|
constructor(t) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
g(this, "options");
|
|
9
|
+
g(this, "currentValue");
|
|
10
|
+
g(this, "velocity");
|
|
11
|
+
g(this, "isAnimating", !1);
|
|
12
|
+
g(this, "controls", null);
|
|
13
13
|
// For object animations
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
g(this, "animationMap", null);
|
|
15
|
+
g(this, "activeAnimations", /* @__PURE__ */ new Set());
|
|
16
|
+
g(this, "completedAnimations", /* @__PURE__ */ new Set());
|
|
17
|
+
g(this, "updatedProperties", /* @__PURE__ */ new Set());
|
|
18
|
+
g(this, "animate", (t = !1) => {
|
|
19
19
|
!this.isAnimating && this.options.onStart && this.options.onStart(), this.isAnimating = !0;
|
|
20
|
-
const
|
|
20
|
+
const o = t ? this.options.from : this.options.to;
|
|
21
21
|
if (typeof this.currentValue == "object" && this.currentValue !== null) {
|
|
22
|
-
this.animateObject(
|
|
22
|
+
this.animateObject(o, t);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
const
|
|
25
|
+
let n = this.currentValue, e = performance.now();
|
|
26
|
+
const m = {
|
|
27
27
|
from: this.currentValue,
|
|
28
|
-
to:
|
|
28
|
+
to: o,
|
|
29
29
|
stiffness: this.options.spring.stiffness,
|
|
30
30
|
damping: this.options.spring.damping,
|
|
31
31
|
mass: 1
|
|
32
32
|
};
|
|
33
|
-
typeof this.velocity == "number" && (
|
|
34
|
-
...
|
|
35
|
-
onUpdate: (
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
if (typeof
|
|
39
|
-
const
|
|
40
|
-
this.velocity =
|
|
41
|
-
} else if (typeof
|
|
42
|
-
const
|
|
43
|
-
Object.keys(
|
|
44
|
-
const r =
|
|
45
|
-
if (typeof r == "number" && typeof
|
|
46
|
-
const
|
|
47
|
-
|
|
33
|
+
typeof this.velocity == "number" && (m.velocity = this.velocity * 1e3), this.controls = E({
|
|
34
|
+
...m,
|
|
35
|
+
onUpdate: (a) => {
|
|
36
|
+
const f = performance.now(), h = (f - e) / 1e3;
|
|
37
|
+
if (h > 0) {
|
|
38
|
+
if (typeof a == "number" && typeof n == "number") {
|
|
39
|
+
const c = (a - n) / h;
|
|
40
|
+
this.velocity = c / 1e3;
|
|
41
|
+
} else if (typeof a == "object" && a !== null) {
|
|
42
|
+
const c = {};
|
|
43
|
+
Object.keys(a).forEach((u) => {
|
|
44
|
+
const r = a[u], s = n[u];
|
|
45
|
+
if (typeof r == "number" && typeof s == "number") {
|
|
46
|
+
const p = (r - s) / h;
|
|
47
|
+
c[u] = p / 1e3;
|
|
48
48
|
}
|
|
49
|
-
}), this.velocity =
|
|
49
|
+
}), this.velocity = c;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
n = a, e = f;
|
|
52
52
|
}
|
|
53
|
-
this.currentValue =
|
|
53
|
+
this.currentValue = a, this.options.onUpdate(a);
|
|
54
54
|
},
|
|
55
55
|
onComplete: () => {
|
|
56
|
-
this.currentValue =
|
|
57
|
-
this.velocity[
|
|
56
|
+
this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((a) => {
|
|
57
|
+
this.velocity[a] = 0;
|
|
58
58
|
}) : this.velocity = 0, this.options.onComplete();
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
const
|
|
62
|
+
g(this, "animateObject", (t, o) => {
|
|
63
|
+
const n = this.currentValue, e = Object.keys(n);
|
|
64
64
|
this.animationMap = /* @__PURE__ */ new Map(), this.activeAnimations.clear(), this.completedAnimations.clear(), this.updatedProperties.clear();
|
|
65
|
-
const
|
|
66
|
-
let
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
65
|
+
const m = { ...n }, a = {};
|
|
66
|
+
let f = !1;
|
|
67
|
+
const h = () => {
|
|
68
|
+
const c = e.filter((r) => !this.completedAnimations.has(r));
|
|
69
|
+
if (c.every((r) => this.updatedProperties.has(r)) && c.length > 0) {
|
|
70
70
|
if (typeof this.velocity == "object" && this.velocity) {
|
|
71
71
|
const r = performance.now();
|
|
72
|
-
Object.keys(
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
typeof
|
|
72
|
+
Object.keys(m).forEach((s) => {
|
|
73
|
+
if (a[s]) {
|
|
74
|
+
const p = (r - a[s]) / 1e3, l = this.currentValue[s], d = m[s];
|
|
75
|
+
typeof l == "number" && typeof d == "number" && p > 0 && (this.velocity[s] = (d - l) / p / 1e3);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
a[s] = r;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
this.currentValue = { ...
|
|
80
|
+
this.currentValue = { ...m }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !f && this.options.onStart && (f = !0, this.options.onStart());
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
this.activeAnimations.add(
|
|
85
|
-
const
|
|
86
|
-
from:
|
|
87
|
-
to: t[
|
|
83
|
+
e.forEach((c) => {
|
|
84
|
+
this.activeAnimations.add(c);
|
|
85
|
+
const u = {
|
|
86
|
+
from: n[c],
|
|
87
|
+
to: t[c],
|
|
88
88
|
stiffness: this.options.spring.stiffness,
|
|
89
89
|
damping: this.options.spring.damping,
|
|
90
90
|
mass: 1
|
|
91
91
|
};
|
|
92
|
-
typeof this.velocity == "object" && this.velocity &&
|
|
93
|
-
const r =
|
|
94
|
-
...
|
|
95
|
-
onUpdate: (
|
|
96
|
-
|
|
92
|
+
typeof this.velocity == "object" && this.velocity && c in this.velocity && (u.velocity = this.velocity[c] * 1e3);
|
|
93
|
+
const r = E({
|
|
94
|
+
...u,
|
|
95
|
+
onUpdate: (s) => {
|
|
96
|
+
m[c] = s, this.updatedProperties.add(c), h();
|
|
97
97
|
},
|
|
98
98
|
onComplete: () => {
|
|
99
|
-
this.completedAnimations.add(
|
|
100
|
-
this.velocity[
|
|
99
|
+
this.completedAnimations.add(c), this.updatedProperties.delete(c), this.completedAnimations.size === e.length && (this.currentValue = t, this.isAnimating = !1, this.animationMap = null, typeof this.velocity == "object" && this.velocity && Object.keys(this.velocity).forEach((s) => {
|
|
100
|
+
this.velocity[s] = 0;
|
|
101
101
|
}), this.options.onComplete());
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
this.animationMap.set(
|
|
104
|
+
this.animationMap.set(c, r);
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
if (this.options = {
|
|
@@ -114,10 +114,10 @@ class V {
|
|
|
114
114
|
}),
|
|
115
115
|
onStart: t.onStart
|
|
116
116
|
}, this.currentValue = this.options.from, typeof this.options.from == "object" && this.options.from !== null) {
|
|
117
|
-
const
|
|
118
|
-
Object.keys(this.options.from).forEach((
|
|
119
|
-
n
|
|
120
|
-
}), this.velocity =
|
|
117
|
+
const o = {};
|
|
118
|
+
Object.keys(this.options.from).forEach((n) => {
|
|
119
|
+
o[n] = 0;
|
|
120
|
+
}), this.velocity = o;
|
|
121
121
|
} else
|
|
122
122
|
this.velocity = 0;
|
|
123
123
|
}
|
|
@@ -131,8 +131,8 @@ class V {
|
|
|
131
131
|
reverse() {
|
|
132
132
|
const t = this.options.from;
|
|
133
133
|
if (this.options.from = this.options.to, this.options.to = t, this.isAnimating) {
|
|
134
|
-
const
|
|
135
|
-
this.stop(), this.animate(!
|
|
134
|
+
const o = this.shouldReverse();
|
|
135
|
+
this.stop(), this.animate(!o);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
shouldReverse() {
|
|
@@ -171,256 +171,302 @@ class V {
|
|
|
171
171
|
// Configuration
|
|
172
172
|
updateOptions(t) {
|
|
173
173
|
if (this.options = { ...this.options, ...t }, this.isAnimating && this.controls) {
|
|
174
|
-
const
|
|
175
|
-
this.stop(), this.animate(!
|
|
174
|
+
const o = this.shouldReverse();
|
|
175
|
+
this.stop(), this.animate(!o);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
// Static factory method
|
|
179
|
-
static fromState(t,
|
|
180
|
-
const
|
|
181
|
-
return
|
|
179
|
+
static fromState(t, o) {
|
|
180
|
+
const n = new V(o);
|
|
181
|
+
return n.setValue(t.position), n.setVelocity(t.velocity), n;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
|
|
185
185
|
runIn: async (t) => {
|
|
186
|
-
const { currentAnimation:
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
186
|
+
const { currentAnimation: o } = i;
|
|
187
|
+
if (o && o.direction === "out") {
|
|
188
|
+
const a = o.animator.getCurrentState();
|
|
189
|
+
if (o.animator.stop(), t.out) {
|
|
190
|
+
const f = await t.out, { from: h = 1, to: c = 0 } = f;
|
|
191
191
|
return {
|
|
192
|
-
config:
|
|
193
|
-
state:
|
|
194
|
-
from:
|
|
192
|
+
config: f,
|
|
193
|
+
state: a,
|
|
194
|
+
from: h,
|
|
195
195
|
// OUT animation's from
|
|
196
|
-
to:
|
|
196
|
+
to: c,
|
|
197
197
|
// OUT animation's to
|
|
198
198
|
direction: "backward"
|
|
199
199
|
// Will actually go 0→1
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
203
|
+
const n = await t.in;
|
|
204
|
+
if (!n)
|
|
205
205
|
return {
|
|
206
|
-
state: {
|
|
206
|
+
state: {
|
|
207
|
+
position: 0,
|
|
208
|
+
velocity: 0
|
|
209
|
+
},
|
|
207
210
|
from: 0,
|
|
208
211
|
to: 1,
|
|
209
212
|
direction: "forward"
|
|
210
213
|
};
|
|
211
|
-
const { from:
|
|
214
|
+
const { from: e = 0, to: m = 1 } = n;
|
|
212
215
|
return {
|
|
213
|
-
config:
|
|
214
|
-
state: {
|
|
215
|
-
|
|
216
|
-
|
|
216
|
+
config: n,
|
|
217
|
+
state: {
|
|
218
|
+
position: e,
|
|
219
|
+
velocity: 0
|
|
220
|
+
},
|
|
221
|
+
from: e,
|
|
222
|
+
to: m,
|
|
217
223
|
direction: "forward"
|
|
218
224
|
};
|
|
219
225
|
},
|
|
220
226
|
runOut: async (t) => {
|
|
221
|
-
const { currentAnimation:
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
const
|
|
227
|
+
const { currentAnimation: o } = i;
|
|
228
|
+
if (o && o.direction === "in") {
|
|
229
|
+
const a = o.animator.getCurrentState();
|
|
230
|
+
if (o.animator.stop(), t.in) {
|
|
231
|
+
const f = await t.in, { from: h = 0, to: c = 1 } = f;
|
|
226
232
|
return {
|
|
227
|
-
config:
|
|
233
|
+
config: f,
|
|
228
234
|
state: {
|
|
229
|
-
position:
|
|
230
|
-
velocity:
|
|
235
|
+
position: a.position,
|
|
236
|
+
velocity: a.velocity
|
|
231
237
|
},
|
|
232
|
-
from:
|
|
238
|
+
from: h,
|
|
233
239
|
// IN animation's from
|
|
234
|
-
to:
|
|
240
|
+
to: c,
|
|
235
241
|
// IN animation's to
|
|
236
242
|
direction: "backward"
|
|
237
243
|
// Will actually go 1→0
|
|
238
244
|
};
|
|
239
245
|
}
|
|
240
246
|
}
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
247
|
+
const n = await t.out;
|
|
248
|
+
if (!n)
|
|
243
249
|
return {
|
|
244
|
-
state: {
|
|
250
|
+
state: {
|
|
251
|
+
position: 1,
|
|
252
|
+
velocity: 0
|
|
253
|
+
},
|
|
245
254
|
from: 1,
|
|
246
255
|
to: 0,
|
|
247
256
|
direction: "forward"
|
|
248
257
|
};
|
|
249
|
-
const { from:
|
|
258
|
+
const { from: e = 1, to: m = 0 } = n;
|
|
250
259
|
return {
|
|
251
|
-
config:
|
|
252
|
-
state: {
|
|
253
|
-
|
|
254
|
-
|
|
260
|
+
config: n,
|
|
261
|
+
state: {
|
|
262
|
+
position: e,
|
|
263
|
+
velocity: 0
|
|
264
|
+
},
|
|
265
|
+
from: e,
|
|
266
|
+
to: m,
|
|
255
267
|
direction: "forward"
|
|
256
268
|
};
|
|
257
269
|
}
|
|
258
270
|
});
|
|
259
|
-
function
|
|
260
|
-
var
|
|
261
|
-
let
|
|
262
|
-
const
|
|
271
|
+
function D(i, t) {
|
|
272
|
+
var u;
|
|
273
|
+
let o = null, n = null, e = null, m = null;
|
|
274
|
+
const a = {
|
|
263
275
|
get currentAnimation() {
|
|
264
|
-
return
|
|
276
|
+
return o;
|
|
265
277
|
}
|
|
266
|
-
},
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
in:
|
|
271
|
-
out:
|
|
272
|
-
},
|
|
273
|
-
if (!
|
|
278
|
+
}, f = ((u = t == null ? void 0 : t.strategy) == null ? void 0 : u.call(t, a)) || I(a), h = async (r) => {
|
|
279
|
+
var y, S;
|
|
280
|
+
n && (n.remove(), n = null);
|
|
281
|
+
const s = i(), p = {
|
|
282
|
+
in: s.in && Promise.resolve(s.in(r)),
|
|
283
|
+
out: s.out && Promise.resolve(s.out(r))
|
|
284
|
+
}, l = await f.runIn(p);
|
|
285
|
+
if (!l.config)
|
|
274
286
|
return;
|
|
275
|
-
(
|
|
276
|
-
const
|
|
277
|
-
from:
|
|
278
|
-
to:
|
|
279
|
-
spring:
|
|
280
|
-
onStart:
|
|
281
|
-
onUpdate:
|
|
287
|
+
(S = (y = l.config).prepare) == null || S.call(y, r), l.config.wait && await l.config.wait();
|
|
288
|
+
const d = V.fromState(l.state, {
|
|
289
|
+
from: l.from,
|
|
290
|
+
to: l.to,
|
|
291
|
+
spring: l.config.spring,
|
|
292
|
+
onStart: l.config.onStart,
|
|
293
|
+
onUpdate: l.config.tick,
|
|
282
294
|
onComplete: () => {
|
|
283
295
|
var v, w;
|
|
284
|
-
|
|
296
|
+
o = null, (w = (v = l.config) == null ? void 0 : v.onEnd) == null || w.call(v);
|
|
285
297
|
}
|
|
286
298
|
});
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
in:
|
|
293
|
-
out:
|
|
294
|
-
},
|
|
295
|
-
if (!
|
|
299
|
+
o = { animator: d, direction: "in" }, l.direction === "forward" ? d.forward() : d.backward();
|
|
300
|
+
}, c = async (r) => {
|
|
301
|
+
var S, v;
|
|
302
|
+
n = r;
|
|
303
|
+
const s = i(), p = {
|
|
304
|
+
in: s.in && Promise.resolve(s.in(r)),
|
|
305
|
+
out: s.out && Promise.resolve(s.out(r))
|
|
306
|
+
}, l = await f.runOut(p);
|
|
307
|
+
if (!l.config)
|
|
296
308
|
return;
|
|
297
|
-
(v = (
|
|
298
|
-
const
|
|
299
|
-
from:
|
|
300
|
-
to:
|
|
301
|
-
spring:
|
|
302
|
-
onStart:
|
|
303
|
-
onUpdate:
|
|
309
|
+
(v = (S = l.config).prepare) == null || v.call(S, r), y(), l.config.wait && await l.config.wait();
|
|
310
|
+
const d = V.fromState(l.state, {
|
|
311
|
+
from: l.from,
|
|
312
|
+
to: l.to,
|
|
313
|
+
spring: l.config.spring,
|
|
314
|
+
onStart: l.config.onStart,
|
|
315
|
+
onUpdate: l.config.tick,
|
|
304
316
|
onComplete: () => {
|
|
305
|
-
var w,
|
|
306
|
-
(
|
|
317
|
+
var w, T, O;
|
|
318
|
+
(T = (w = l.config) == null ? void 0 : w.onEnd) == null || T.call(w), n && (n.remove(), n = null), o = null, (O = t == null ? void 0 : t.onCleanupEnd) == null || O.call(t);
|
|
307
319
|
}
|
|
308
320
|
});
|
|
309
|
-
|
|
310
|
-
function
|
|
311
|
-
!
|
|
321
|
+
o = { animator: d, direction: "out" }, l.direction === "forward" ? d.forward() : d.backward();
|
|
322
|
+
function y() {
|
|
323
|
+
!e || !n || (m && e.contains(m) ? e.insertBefore(n, m) : e.appendChild(n));
|
|
312
324
|
}
|
|
313
325
|
};
|
|
314
326
|
return (r) => {
|
|
315
327
|
if (r)
|
|
316
|
-
return
|
|
317
|
-
const
|
|
318
|
-
|
|
328
|
+
return e = r.parentElement, m = r.nextElementSibling, h(r), () => {
|
|
329
|
+
const s = r.cloneNode(!0);
|
|
330
|
+
c(s);
|
|
319
331
|
};
|
|
320
332
|
};
|
|
321
333
|
}
|
|
322
334
|
const A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
323
|
-
function
|
|
324
|
-
A.set(
|
|
325
|
-
let
|
|
326
|
-
return
|
|
335
|
+
function N(i, t, o) {
|
|
336
|
+
A.set(i, t);
|
|
337
|
+
let n = C.get(i);
|
|
338
|
+
return n || (n = D(
|
|
327
339
|
() => {
|
|
328
|
-
const
|
|
329
|
-
return
|
|
340
|
+
const e = A.get(i);
|
|
341
|
+
return e || (console.warn(`Transition "${String(i)}" not found`), {});
|
|
330
342
|
},
|
|
331
343
|
{
|
|
332
|
-
strategy:
|
|
333
|
-
onCleanupEnd: () =>
|
|
344
|
+
strategy: o,
|
|
345
|
+
onCleanupEnd: () => P(i)
|
|
334
346
|
}
|
|
335
|
-
), C.set(
|
|
347
|
+
), C.set(i, n), n);
|
|
348
|
+
}
|
|
349
|
+
function P(i) {
|
|
350
|
+
A.delete(i), C.delete(i);
|
|
351
|
+
}
|
|
352
|
+
function $() {
|
|
353
|
+
const i = U(new Error().stack);
|
|
354
|
+
return i ? `auto_${i.file}_${i.line}_${i.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
|
|
336
355
|
}
|
|
337
|
-
|
|
338
|
-
|
|
356
|
+
const R = globalThis.FinalizationRegistry, j = R ? new R((i) => {
|
|
357
|
+
try {
|
|
358
|
+
P(i);
|
|
359
|
+
} catch {
|
|
360
|
+
}
|
|
361
|
+
}) : void 0;
|
|
362
|
+
function Y(i) {
|
|
363
|
+
const t = i.key ?? $();
|
|
364
|
+
if (i.ref && j)
|
|
365
|
+
try {
|
|
366
|
+
j.register(i.ref, t);
|
|
367
|
+
} catch {
|
|
368
|
+
}
|
|
369
|
+
return N(
|
|
370
|
+
t,
|
|
371
|
+
{
|
|
372
|
+
in: i.in,
|
|
373
|
+
out: i.out
|
|
374
|
+
},
|
|
375
|
+
i[k]
|
|
376
|
+
);
|
|
339
377
|
}
|
|
340
|
-
function
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
378
|
+
function F(i) {
|
|
379
|
+
const t = i.filter((o) => o.symmetric).map((o) => ({
|
|
380
|
+
from: o.to,
|
|
381
|
+
to: o.from,
|
|
382
|
+
transition: o.transition
|
|
383
|
+
}));
|
|
384
|
+
return [...i, ...t];
|
|
345
385
|
}
|
|
346
|
-
function
|
|
347
|
-
let
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
to: o.from,
|
|
355
|
-
transition: o.transition
|
|
356
|
-
// Don't add symmetric flag to the reverse to avoid infinite loop
|
|
357
|
-
}));
|
|
358
|
-
n.push(...i);
|
|
359
|
-
let a = null;
|
|
360
|
-
const u = /* @__PURE__ */ new Map();
|
|
361
|
-
let l = null;
|
|
362
|
-
const m = () => {
|
|
363
|
-
a && l && u.set(l, {
|
|
364
|
-
x: a.scrollLeft,
|
|
365
|
-
y: a.scrollTop
|
|
386
|
+
function L() {
|
|
387
|
+
let i = null;
|
|
388
|
+
const t = /* @__PURE__ */ new Map();
|
|
389
|
+
let o = null;
|
|
390
|
+
const n = () => {
|
|
391
|
+
i && o && t.set(o, {
|
|
392
|
+
x: i.scrollLeft,
|
|
393
|
+
y: i.scrollTop
|
|
366
394
|
});
|
|
367
|
-
}, p = (o, c) => {
|
|
368
|
-
a || (a = P(o), a.addEventListener("scroll", m, {
|
|
369
|
-
passive: !0
|
|
370
|
-
})), l = c;
|
|
371
|
-
}, f = () => {
|
|
372
|
-
const o = t == null ? void 0 : t.from, c = t == null ? void 0 : t.to, s = o && u.has(o) ? u.get(o) : { x: 0, y: 0 }, h = c && u.has(c) ? u.get(c) : { x: 0, y: 0 };
|
|
373
|
-
return {
|
|
374
|
-
x: -h.x + s.x,
|
|
375
|
-
y: -h.y + s.y
|
|
376
|
-
};
|
|
377
395
|
};
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
396
|
+
return {
|
|
397
|
+
startScrollTracking: (a, f) => {
|
|
398
|
+
i || (i = _(a), (i === document.documentElement ? window : i).addEventListener("scroll", n, {
|
|
399
|
+
passive: !0
|
|
400
|
+
})), o = f;
|
|
401
|
+
},
|
|
402
|
+
calculateScrollOffset: (a, f) => {
|
|
403
|
+
const h = a && t.has(a) ? t.get(a) : { x: 0, y: 0 }, c = f && t.has(f) ? t.get(f) : { x: 0, y: 0 };
|
|
404
|
+
return {
|
|
405
|
+
x: -c.x + h.x,
|
|
406
|
+
y: -c.y + h.y
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function B(i) {
|
|
412
|
+
const {
|
|
413
|
+
transitions: t = [],
|
|
414
|
+
defaultTransition: o,
|
|
415
|
+
middleware: n = (u, r) => ({ from: u, to: r })
|
|
416
|
+
// Identity function as default
|
|
417
|
+
} = i;
|
|
418
|
+
let e = null;
|
|
419
|
+
const m = F(t), { startScrollTracking: a, calculateScrollOffset: f } = L();
|
|
420
|
+
function h() {
|
|
421
|
+
if (e != null && e.from && (e != null && e.to)) {
|
|
422
|
+
const { from: u, to: r } = n(
|
|
423
|
+
e.from,
|
|
424
|
+
e.to
|
|
425
|
+
), p = z(
|
|
426
|
+
u,
|
|
427
|
+
r,
|
|
428
|
+
m
|
|
429
|
+
) || o, d = { scrollOffset: f(e.from, e.to) };
|
|
430
|
+
p && (p.out && e.outResolve && e.outResolve(
|
|
431
|
+
(y) => p.out(y, d)
|
|
432
|
+
), p.in && e.inResolve && e.inResolve(
|
|
433
|
+
(y) => p.in(y, d)
|
|
434
|
+
)), e = null;
|
|
390
435
|
}
|
|
391
436
|
}
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
})) : (
|
|
395
|
-
|
|
437
|
+
const c = async (u, r) => r === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), r === "out" ? (e.from = u, new Promise((s) => {
|
|
438
|
+
e.outResolve = s, h();
|
|
439
|
+
})) : (e.to = u, new Promise((s) => {
|
|
440
|
+
e.inResolve = s, h();
|
|
396
441
|
})));
|
|
397
|
-
return (
|
|
398
|
-
key:
|
|
399
|
-
in: async (
|
|
400
|
-
out: async (
|
|
442
|
+
return (u) => ({
|
|
443
|
+
key: u,
|
|
444
|
+
in: async (r) => (a(r, u), (await c(u, "in"))(r)),
|
|
445
|
+
out: async (r) => (await c(u, "out"))(r)
|
|
401
446
|
});
|
|
402
447
|
}
|
|
403
|
-
function
|
|
404
|
-
for (const
|
|
405
|
-
if (
|
|
406
|
-
return
|
|
407
|
-
for (const
|
|
408
|
-
if ((
|
|
409
|
-
return
|
|
448
|
+
function z(i, t, o) {
|
|
449
|
+
for (const n of o)
|
|
450
|
+
if (b(i, n.from) && b(t, n.to))
|
|
451
|
+
return n.transition;
|
|
452
|
+
for (const n of o)
|
|
453
|
+
if ((n.from === "*" || b(i, n.from)) && (n.to === "*" || b(t, n.to)))
|
|
454
|
+
return n.transition;
|
|
410
455
|
return null;
|
|
411
456
|
}
|
|
412
|
-
function
|
|
457
|
+
function b(i, t) {
|
|
413
458
|
if (t === "*")
|
|
414
459
|
return !0;
|
|
415
460
|
if (t.endsWith("/*")) {
|
|
416
|
-
const
|
|
417
|
-
return
|
|
461
|
+
const o = t.slice(0, -2);
|
|
462
|
+
return i === o || i.startsWith(o + "/");
|
|
418
463
|
}
|
|
419
|
-
return
|
|
464
|
+
return i === t;
|
|
420
465
|
}
|
|
421
466
|
export {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
467
|
+
k as TRANSITION_STRATEGY,
|
|
468
|
+
I as createDefaultStrategy,
|
|
469
|
+
B as createSggoiTransitionContext,
|
|
470
|
+
$ as generateAutoKey,
|
|
425
471
|
Y as transition
|
|
426
472
|
};
|