@ssgoi/core 2.1.2 → 2.2.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/README.md +10 -11
- package/dist/animator.d.ts.map +1 -1
- 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 +2 -1
- package/dist/index.js +204 -126
- package/dist/transition-strategy.d.ts +5 -0
- package/dist/transition-strategy.d.ts.map +1 -1
- package/dist/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +1 -1
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.d.ts +1 -0
- package/dist/transitions/index.d.ts.map +1 -1
- package/dist/transitions/index.js +175 -119
- package/dist/transitions/mask.d.ts +31 -0
- package/dist/transitions/mask.d.ts.map +1 -0
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +1 -1
- package/dist/transitions/scale.d.ts +1 -1
- package/dist/transitions/slide.d.ts +2 -2
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/get-rect.d.ts +7 -0
- package/dist/utils/get-rect.d.ts.map +1 -0
- package/dist/utils/get-scrolling-element.d.ts +6 -0
- package/dist/utils/get-scrolling-element.d.ts.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/parse-caller-location.d.ts +6 -0
- package/dist/utils/parse-caller-location.d.ts.map +1 -0
- package/dist/utils/prepare-outgoing.d.ts +6 -0
- package/dist/utils/prepare-outgoing.d.ts.map +1 -0
- package/dist/utils/sleep.d.ts +7 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/view-transitions/blind.d.ts +13 -0
- package/dist/view-transitions/blind.d.ts.map +1 -0
- 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 +30 -1
- package/dist/view-transitions/index.d.ts +2 -0
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +371 -217
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/slide.d.ts +8 -0
- package/dist/view-transitions/slide.d.ts.map +1 -0
- package/package.json +8 -2
- package/dist/utils-8Eptbv7c.cjs +0 -2
- package/dist/utils-DTRMUQW4.js +0 -31
- package/dist/view-transitions/ripple.d.ts +0 -7
- package/dist/view-transitions/ripple.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var x = (i, t, o) => t in i ?
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var x = (i, t, o) => t in i ? _(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
|
|
3
3
|
var g = (i, t, o) => x(i, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
-
import { animate as
|
|
5
|
-
|
|
6
|
-
class V {
|
|
4
|
+
import { animate as O } from "popmotion";
|
|
5
|
+
class A {
|
|
7
6
|
constructor(t) {
|
|
8
7
|
g(this, "options");
|
|
9
8
|
g(this, "currentValue");
|
|
@@ -23,38 +22,38 @@ class V {
|
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
24
|
let n = this.currentValue, e = performance.now();
|
|
26
|
-
const
|
|
25
|
+
const u = {
|
|
27
26
|
from: this.currentValue,
|
|
28
27
|
to: o,
|
|
29
28
|
stiffness: this.options.spring.stiffness,
|
|
30
29
|
damping: this.options.spring.damping,
|
|
31
30
|
mass: 1
|
|
32
31
|
};
|
|
33
|
-
typeof this.velocity == "number" && (
|
|
34
|
-
...
|
|
35
|
-
onUpdate: (
|
|
32
|
+
typeof this.velocity == "number" && (u.velocity = this.velocity * 1e3), this.controls = O({
|
|
33
|
+
...u,
|
|
34
|
+
onUpdate: (s) => {
|
|
36
35
|
const f = performance.now(), h = (f - e) / 1e3;
|
|
37
36
|
if (h > 0) {
|
|
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 p = (r -
|
|
47
|
-
|
|
37
|
+
if (typeof s == "number" && typeof n == "number") {
|
|
38
|
+
const a = (s - n) / h;
|
|
39
|
+
this.velocity = a / 1e3;
|
|
40
|
+
} else if (typeof s == "object" && s !== null) {
|
|
41
|
+
const a = {};
|
|
42
|
+
Object.keys(s).forEach((m) => {
|
|
43
|
+
const r = s[m], c = n[m];
|
|
44
|
+
if (typeof r == "number" && typeof c == "number") {
|
|
45
|
+
const p = (r - c) / h;
|
|
46
|
+
a[m] = p / 1e3;
|
|
48
47
|
}
|
|
49
|
-
}), this.velocity =
|
|
48
|
+
}), this.velocity = a;
|
|
50
49
|
}
|
|
51
|
-
n =
|
|
50
|
+
n = s, e = f;
|
|
52
51
|
}
|
|
53
|
-
this.currentValue =
|
|
52
|
+
this.currentValue = s, this.options.onUpdate(s);
|
|
54
53
|
},
|
|
55
54
|
onComplete: () => {
|
|
56
|
-
this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((
|
|
57
|
-
this.velocity[
|
|
55
|
+
this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((s) => {
|
|
56
|
+
this.velocity[s] = 0;
|
|
58
57
|
}) : this.velocity = 0, this.options.onComplete();
|
|
59
58
|
}
|
|
60
59
|
});
|
|
@@ -62,46 +61,48 @@ class V {
|
|
|
62
61
|
g(this, "animateObject", (t, o) => {
|
|
63
62
|
const n = this.currentValue, e = Object.keys(n);
|
|
64
63
|
this.animationMap = /* @__PURE__ */ new Map(), this.activeAnimations.clear(), this.completedAnimations.clear(), this.updatedProperties.clear();
|
|
65
|
-
const
|
|
64
|
+
const u = { ...n }, s = {};
|
|
66
65
|
let f = !1;
|
|
67
66
|
const h = () => {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
67
|
+
const a = e.filter((r) => !this.completedAnimations.has(r));
|
|
68
|
+
if (a.every(
|
|
69
|
+
(r) => this.updatedProperties.has(r)
|
|
70
|
+
) && a.length > 0) {
|
|
70
71
|
if (typeof this.velocity == "object" && this.velocity) {
|
|
71
72
|
const r = performance.now();
|
|
72
|
-
Object.keys(
|
|
73
|
-
if (
|
|
74
|
-
const p = (r -
|
|
75
|
-
typeof l == "number" && typeof d == "number" && p > 0 && (this.velocity[
|
|
73
|
+
Object.keys(u).forEach((c) => {
|
|
74
|
+
if (s[c]) {
|
|
75
|
+
const p = (r - s[c]) / 1e3, l = this.currentValue[c], d = u[c];
|
|
76
|
+
typeof l == "number" && typeof d == "number" && p > 0 && (this.velocity[c] = (d - l) / p / 1e3);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
s[c] = r;
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
|
-
this.currentValue = { ...
|
|
81
|
+
this.currentValue = { ...u }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !f && this.options.onStart && (f = !0, this.options.onStart());
|
|
81
82
|
}
|
|
82
83
|
};
|
|
83
|
-
e.forEach((
|
|
84
|
-
this.activeAnimations.add(
|
|
85
|
-
const
|
|
86
|
-
from: n[
|
|
87
|
-
to: t[
|
|
84
|
+
e.forEach((a) => {
|
|
85
|
+
this.activeAnimations.add(a);
|
|
86
|
+
const m = {
|
|
87
|
+
from: n[a],
|
|
88
|
+
to: t[a],
|
|
88
89
|
stiffness: this.options.spring.stiffness,
|
|
89
90
|
damping: this.options.spring.damping,
|
|
90
91
|
mass: 1
|
|
91
92
|
};
|
|
92
|
-
typeof this.velocity == "object" && this.velocity &&
|
|
93
|
-
const r =
|
|
94
|
-
...
|
|
95
|
-
onUpdate: (
|
|
96
|
-
|
|
93
|
+
typeof this.velocity == "object" && this.velocity && a in this.velocity && (m.velocity = this.velocity[a] * 1e3);
|
|
94
|
+
const r = O({
|
|
95
|
+
...m,
|
|
96
|
+
onUpdate: (c) => {
|
|
97
|
+
u[a] = c, this.updatedProperties.add(a), h();
|
|
97
98
|
},
|
|
98
99
|
onComplete: () => {
|
|
99
|
-
this.completedAnimations.add(
|
|
100
|
-
this.velocity[
|
|
100
|
+
this.completedAnimations.add(a), this.updatedProperties.delete(a), 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((c) => {
|
|
101
|
+
this.velocity[c] = 0;
|
|
101
102
|
}), this.options.onComplete());
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
|
-
this.animationMap.set(
|
|
105
|
+
this.animationMap.set(a, r);
|
|
105
106
|
});
|
|
106
107
|
});
|
|
107
108
|
if (this.options = {
|
|
@@ -177,23 +178,23 @@ class V {
|
|
|
177
178
|
}
|
|
178
179
|
// Static factory method
|
|
179
180
|
static fromState(t, o) {
|
|
180
|
-
const n = new
|
|
181
|
+
const n = new A(o);
|
|
181
182
|
return n.setValue(t.position), n.setVelocity(t.velocity), n;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
|
-
const
|
|
185
|
+
const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
|
|
185
186
|
runIn: async (t) => {
|
|
186
187
|
const { currentAnimation: o } = i;
|
|
187
188
|
if (o && o.direction === "out") {
|
|
188
|
-
const
|
|
189
|
+
const s = o.animator.getCurrentState();
|
|
189
190
|
if (o.animator.stop(), t.out) {
|
|
190
|
-
const f = await t.out, { from: h = 1, to:
|
|
191
|
+
const f = await t.out, { from: h = 1, to: a = 0 } = f;
|
|
191
192
|
return {
|
|
192
193
|
config: f,
|
|
193
|
-
state:
|
|
194
|
+
state: s,
|
|
194
195
|
from: h,
|
|
195
196
|
// OUT animation's from
|
|
196
|
-
to:
|
|
197
|
+
to: a,
|
|
197
198
|
// OUT animation's to
|
|
198
199
|
direction: "backward"
|
|
199
200
|
// Will actually go 0→1
|
|
@@ -211,7 +212,7 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
|
|
|
211
212
|
to: 1,
|
|
212
213
|
direction: "forward"
|
|
213
214
|
};
|
|
214
|
-
const { from: e = 0, to:
|
|
215
|
+
const { from: e = 0, to: u = 1 } = n;
|
|
215
216
|
return {
|
|
216
217
|
config: n,
|
|
217
218
|
state: {
|
|
@@ -219,25 +220,25 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
|
|
|
219
220
|
velocity: 0
|
|
220
221
|
},
|
|
221
222
|
from: e,
|
|
222
|
-
to:
|
|
223
|
+
to: u,
|
|
223
224
|
direction: "forward"
|
|
224
225
|
};
|
|
225
226
|
},
|
|
226
227
|
runOut: async (t) => {
|
|
227
228
|
const { currentAnimation: o } = i;
|
|
228
229
|
if (o && o.direction === "in") {
|
|
229
|
-
const
|
|
230
|
+
const s = o.animator.getCurrentState();
|
|
230
231
|
if (o.animator.stop(), t.in) {
|
|
231
|
-
const f = await t.in, { from: h = 0, to:
|
|
232
|
+
const f = await t.in, { from: h = 0, to: a = 1 } = f;
|
|
232
233
|
return {
|
|
233
234
|
config: f,
|
|
234
235
|
state: {
|
|
235
|
-
position:
|
|
236
|
-
velocity:
|
|
236
|
+
position: s.position,
|
|
237
|
+
velocity: s.velocity
|
|
237
238
|
},
|
|
238
239
|
from: h,
|
|
239
240
|
// IN animation's from
|
|
240
|
-
to:
|
|
241
|
+
to: a,
|
|
241
242
|
// IN animation's to
|
|
242
243
|
direction: "backward"
|
|
243
244
|
// Will actually go 1→0
|
|
@@ -255,7 +256,7 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
|
|
|
255
256
|
to: 0,
|
|
256
257
|
direction: "forward"
|
|
257
258
|
};
|
|
258
|
-
const { from: e = 1, to:
|
|
259
|
+
const { from: e = 1, to: u = 0 } = n;
|
|
259
260
|
return {
|
|
260
261
|
config: n,
|
|
261
262
|
state: {
|
|
@@ -263,29 +264,78 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
|
|
|
263
264
|
velocity: 0
|
|
264
265
|
},
|
|
265
266
|
from: e,
|
|
266
|
-
to:
|
|
267
|
+
to: u,
|
|
268
|
+
direction: "forward"
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}), I = (i) => ({
|
|
272
|
+
runIn: async (t) => {
|
|
273
|
+
const o = await t.in;
|
|
274
|
+
if (!o)
|
|
275
|
+
return {
|
|
276
|
+
state: {
|
|
277
|
+
position: 0,
|
|
278
|
+
velocity: 0
|
|
279
|
+
},
|
|
280
|
+
from: 0,
|
|
281
|
+
to: 1,
|
|
282
|
+
direction: "forward"
|
|
283
|
+
};
|
|
284
|
+
const { from: n = 0, to: e = 1 } = o;
|
|
285
|
+
return {
|
|
286
|
+
config: o,
|
|
287
|
+
state: {
|
|
288
|
+
position: n,
|
|
289
|
+
velocity: 0
|
|
290
|
+
},
|
|
291
|
+
from: n,
|
|
292
|
+
to: e,
|
|
293
|
+
direction: "forward"
|
|
294
|
+
};
|
|
295
|
+
},
|
|
296
|
+
runOut: async (t) => {
|
|
297
|
+
const o = await t.out;
|
|
298
|
+
if (!o)
|
|
299
|
+
return {
|
|
300
|
+
state: {
|
|
301
|
+
position: 1,
|
|
302
|
+
velocity: 0
|
|
303
|
+
},
|
|
304
|
+
from: 1,
|
|
305
|
+
to: 0,
|
|
306
|
+
direction: "forward"
|
|
307
|
+
};
|
|
308
|
+
const { from: n = 1, to: e = 0 } = o;
|
|
309
|
+
return {
|
|
310
|
+
config: o,
|
|
311
|
+
state: {
|
|
312
|
+
position: n,
|
|
313
|
+
velocity: 0
|
|
314
|
+
},
|
|
315
|
+
from: n,
|
|
316
|
+
to: e,
|
|
267
317
|
direction: "forward"
|
|
268
318
|
};
|
|
269
319
|
}
|
|
270
320
|
});
|
|
271
|
-
function
|
|
272
|
-
var
|
|
273
|
-
let o = null, n = null, e = null,
|
|
274
|
-
const
|
|
321
|
+
function N(i, t) {
|
|
322
|
+
var m;
|
|
323
|
+
let o = null, n = null, e = null, u = null;
|
|
324
|
+
const s = {
|
|
275
325
|
get currentAnimation() {
|
|
276
326
|
return o;
|
|
277
327
|
}
|
|
278
|
-
}, f = ((
|
|
328
|
+
}, f = ((m = t == null ? void 0 : t.strategy) == null ? void 0 : m.call(t, s)) || U(s), h = async (r) => {
|
|
279
329
|
var y, S;
|
|
280
330
|
n && (n.remove(), n = null);
|
|
281
|
-
const
|
|
282
|
-
in:
|
|
283
|
-
out:
|
|
331
|
+
const c = i(), p = {
|
|
332
|
+
in: c.in && Promise.resolve(c.in(r)),
|
|
333
|
+
out: c.out && Promise.resolve(c.out(r))
|
|
284
334
|
}, l = await f.runIn(p);
|
|
285
335
|
if (!l.config)
|
|
286
336
|
return;
|
|
287
337
|
(S = (y = l.config).prepare) == null || S.call(y, r), l.config.wait && await l.config.wait();
|
|
288
|
-
const d =
|
|
338
|
+
const d = A.fromState(l.state, {
|
|
289
339
|
from: l.from,
|
|
290
340
|
to: l.to,
|
|
291
341
|
spring: l.config.spring,
|
|
@@ -297,85 +347,107 @@ function D(i, t) {
|
|
|
297
347
|
}
|
|
298
348
|
});
|
|
299
349
|
o = { animator: d, direction: "in" }, l.direction === "forward" ? d.forward() : d.backward();
|
|
300
|
-
},
|
|
350
|
+
}, a = async (r) => {
|
|
301
351
|
var S, v;
|
|
302
352
|
n = r;
|
|
303
|
-
const
|
|
304
|
-
in:
|
|
305
|
-
out:
|
|
353
|
+
const c = i(), p = {
|
|
354
|
+
in: c.in && Promise.resolve(c.in(r)),
|
|
355
|
+
out: c.out && Promise.resolve(c.out(r))
|
|
306
356
|
}, l = await f.runOut(p);
|
|
307
357
|
if (!l.config)
|
|
308
358
|
return;
|
|
309
359
|
(v = (S = l.config).prepare) == null || v.call(S, r), y(), l.config.wait && await l.config.wait();
|
|
310
|
-
const d =
|
|
360
|
+
const d = A.fromState(l.state, {
|
|
311
361
|
from: l.from,
|
|
312
362
|
to: l.to,
|
|
313
363
|
spring: l.config.spring,
|
|
314
364
|
onStart: l.config.onStart,
|
|
315
365
|
onUpdate: l.config.tick,
|
|
316
366
|
onComplete: () => {
|
|
317
|
-
var w, T,
|
|
318
|
-
(T = (w = l.config) == null ? void 0 : w.onEnd) == null || T.call(w), n && (n.remove(), n = null), o = null, (
|
|
367
|
+
var w, T, E;
|
|
368
|
+
(T = (w = l.config) == null ? void 0 : w.onEnd) == null || T.call(w), n && (n.remove(), n = null), o = null, (E = t == null ? void 0 : t.onCleanupEnd) == null || E.call(t);
|
|
319
369
|
}
|
|
320
370
|
});
|
|
321
371
|
o = { animator: d, direction: "out" }, l.direction === "forward" ? d.forward() : d.backward();
|
|
322
372
|
function y() {
|
|
323
|
-
!e || !n || (
|
|
373
|
+
!e || !n || (u && e.contains(u) ? e.insertBefore(n, u) : e.appendChild(n));
|
|
324
374
|
}
|
|
325
375
|
};
|
|
326
376
|
return (r) => {
|
|
327
377
|
if (r)
|
|
328
|
-
return e = r.parentElement,
|
|
329
|
-
const
|
|
330
|
-
c
|
|
378
|
+
return e = r.parentElement, u = r.nextElementSibling, h(r), () => {
|
|
379
|
+
const c = r.cloneNode(!0);
|
|
380
|
+
a(c);
|
|
331
381
|
};
|
|
332
382
|
};
|
|
333
383
|
}
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
384
|
+
const D = 3, k = (i) => {
|
|
385
|
+
if (!i) return null;
|
|
386
|
+
const t = i.split(`
|
|
387
|
+
`).map((o) => o.trim());
|
|
388
|
+
for (let o = D; o < Math.min(t.length, 6); o++) {
|
|
389
|
+
const n = t[o], e = n == null ? void 0 : n.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
|
|
390
|
+
if (!e)
|
|
391
|
+
continue;
|
|
392
|
+
const u = e[1] ?? "", s = e[2] ?? "0", f = e[3] ?? "0";
|
|
393
|
+
return { file: u.split(/[\\/]/).pop() || u, line: s, column: f };
|
|
394
|
+
}
|
|
395
|
+
return null;
|
|
396
|
+
}, V = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
397
|
+
function $(i, t, o) {
|
|
398
|
+
V.set(i, t);
|
|
337
399
|
let n = C.get(i);
|
|
338
|
-
return n || (n =
|
|
400
|
+
return n || (n = N(
|
|
339
401
|
() => {
|
|
340
|
-
const e =
|
|
402
|
+
const e = V.get(i);
|
|
341
403
|
return e || (console.warn(`Transition "${String(i)}" not found`), {});
|
|
342
404
|
},
|
|
343
405
|
{
|
|
344
406
|
strategy: o,
|
|
345
|
-
onCleanupEnd: () =>
|
|
407
|
+
onCleanupEnd: () => M(i)
|
|
346
408
|
}
|
|
347
409
|
), C.set(i, n), n);
|
|
348
410
|
}
|
|
349
|
-
function
|
|
350
|
-
|
|
411
|
+
function M(i) {
|
|
412
|
+
V.delete(i), C.delete(i);
|
|
351
413
|
}
|
|
352
|
-
function
|
|
353
|
-
const i =
|
|
414
|
+
function F() {
|
|
415
|
+
const i = k(new Error().stack);
|
|
354
416
|
return i ? `auto_${i.file}_${i.line}_${i.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
|
|
355
417
|
}
|
|
356
|
-
const R = globalThis.FinalizationRegistry,
|
|
418
|
+
const R = globalThis.FinalizationRegistry, P = R ? new R((i) => {
|
|
357
419
|
try {
|
|
358
|
-
|
|
420
|
+
M(i);
|
|
359
421
|
} catch {
|
|
360
422
|
}
|
|
361
423
|
}) : void 0;
|
|
362
|
-
function
|
|
363
|
-
const t = i.key ??
|
|
364
|
-
if (i.ref &&
|
|
424
|
+
function H(i) {
|
|
425
|
+
const t = i.key ?? F();
|
|
426
|
+
if (i.ref && P)
|
|
365
427
|
try {
|
|
366
|
-
|
|
428
|
+
P.register(i.ref, t);
|
|
367
429
|
} catch {
|
|
368
430
|
}
|
|
369
|
-
return
|
|
431
|
+
return $(
|
|
370
432
|
t,
|
|
371
433
|
{
|
|
372
434
|
in: i.in,
|
|
373
435
|
out: i.out
|
|
374
436
|
},
|
|
375
|
-
i[
|
|
437
|
+
i[j]
|
|
376
438
|
);
|
|
377
439
|
}
|
|
378
|
-
|
|
440
|
+
const K = (i) => {
|
|
441
|
+
let t = i.parentElement;
|
|
442
|
+
for (; t && t !== document.body; ) {
|
|
443
|
+
const o = window.getComputedStyle(t), n = o.overflow + o.overflowY + o.overflowX;
|
|
444
|
+
if (n.includes("auto") || n.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
|
|
445
|
+
return t;
|
|
446
|
+
t = t.parentElement;
|
|
447
|
+
}
|
|
448
|
+
return document.documentElement;
|
|
449
|
+
};
|
|
450
|
+
function W(i) {
|
|
379
451
|
const t = i.filter((o) => o.symmetric).map((o) => ({
|
|
380
452
|
from: o.to,
|
|
381
453
|
to: o.from,
|
|
@@ -394,39 +466,42 @@ function L() {
|
|
|
394
466
|
});
|
|
395
467
|
};
|
|
396
468
|
return {
|
|
397
|
-
startScrollTracking: (
|
|
398
|
-
i || (i =
|
|
469
|
+
startScrollTracking: (s, f) => {
|
|
470
|
+
i || (i = K(s), (i === document.documentElement ? window : i).addEventListener("scroll", n, {
|
|
399
471
|
passive: !0
|
|
400
472
|
})), o = f;
|
|
401
473
|
},
|
|
402
|
-
calculateScrollOffset: (
|
|
403
|
-
const h =
|
|
474
|
+
calculateScrollOffset: (s, f) => {
|
|
475
|
+
const h = s && t.has(s) ? t.get(s) : { x: 0, y: 0 }, a = f && t.has(f) ? t.get(f) : { x: 0, y: 0 };
|
|
404
476
|
return {
|
|
405
|
-
x: -
|
|
406
|
-
y: -
|
|
477
|
+
x: -a.x + h.x,
|
|
478
|
+
y: -a.y + h.y
|
|
407
479
|
};
|
|
408
480
|
}
|
|
409
481
|
};
|
|
410
482
|
}
|
|
411
|
-
function
|
|
483
|
+
function X(i) {
|
|
412
484
|
const {
|
|
413
485
|
transitions: t = [],
|
|
414
486
|
defaultTransition: o,
|
|
415
|
-
middleware: n = (
|
|
487
|
+
middleware: n = (m, r) => ({ from: m, to: r })
|
|
416
488
|
// Identity function as default
|
|
417
489
|
} = i;
|
|
418
490
|
let e = null;
|
|
419
|
-
const
|
|
491
|
+
const u = W(t), { startScrollTracking: s, calculateScrollOffset: f } = L();
|
|
420
492
|
function h() {
|
|
421
493
|
if (e != null && e.from && (e != null && e.to)) {
|
|
422
|
-
const { from:
|
|
494
|
+
const { from: m, to: r } = n(
|
|
423
495
|
e.from,
|
|
424
496
|
e.to
|
|
425
497
|
), p = z(
|
|
426
|
-
|
|
498
|
+
m,
|
|
427
499
|
r,
|
|
428
|
-
|
|
429
|
-
) || o, d = { scrollOffset: f(
|
|
500
|
+
u
|
|
501
|
+
) || o, d = { scrollOffset: f(
|
|
502
|
+
e.from,
|
|
503
|
+
e.to
|
|
504
|
+
) };
|
|
430
505
|
p && (p.out && e.outResolve && e.outResolve(
|
|
431
506
|
(y) => p.out(y, d)
|
|
432
507
|
), p.in && e.inResolve && e.inResolve(
|
|
@@ -434,15 +509,17 @@ function B(i) {
|
|
|
434
509
|
)), e = null;
|
|
435
510
|
}
|
|
436
511
|
}
|
|
437
|
-
const
|
|
438
|
-
e.outResolve =
|
|
439
|
-
})) : (e.to =
|
|
440
|
-
e.inResolve =
|
|
512
|
+
const a = async (m, r) => r === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), r === "out" ? (e.from = m, new Promise((c) => {
|
|
513
|
+
e.outResolve = c, h();
|
|
514
|
+
})) : (e.to = m, new Promise((c) => {
|
|
515
|
+
e.inResolve = c, h();
|
|
441
516
|
})));
|
|
442
|
-
return (
|
|
443
|
-
key:
|
|
444
|
-
in: async (r) => (
|
|
445
|
-
out: async (r) => (await
|
|
517
|
+
return (m) => ({
|
|
518
|
+
key: m,
|
|
519
|
+
in: async (r) => (s(r, m), (await a(m, "in"))(r)),
|
|
520
|
+
out: async (r) => (await a(m, "out"))(r),
|
|
521
|
+
// Add page transition strategy for page-level transitions
|
|
522
|
+
[j]: I
|
|
446
523
|
});
|
|
447
524
|
}
|
|
448
525
|
function z(i, t, o) {
|
|
@@ -464,9 +541,10 @@ function b(i, t) {
|
|
|
464
541
|
return i === t;
|
|
465
542
|
}
|
|
466
543
|
export {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
544
|
+
j as TRANSITION_STRATEGY,
|
|
545
|
+
U as createDefaultStrategy,
|
|
546
|
+
I as createPageTransitionStrategy,
|
|
547
|
+
X as createSggoiTransitionContext,
|
|
548
|
+
F as generateAutoKey,
|
|
549
|
+
H as transition
|
|
472
550
|
};
|
|
@@ -57,4 +57,9 @@ export interface TransitionStrategy<TAnimationValue = number> {
|
|
|
57
57
|
* - Cleanup callback: Handles exit transitions
|
|
58
58
|
*/
|
|
59
59
|
export declare const createDefaultStrategy: <TAnimationValue = number>(context: StrategyContext<TAnimationValue>) => TransitionStrategy<TAnimationValue>;
|
|
60
|
+
/**
|
|
61
|
+
* Page transition strategy - Always starts fresh without checking current animations
|
|
62
|
+
* This is used for page-level transitions where each transition should be independent
|
|
63
|
+
*/
|
|
64
|
+
export declare const createPageTransitionStrategy: <TAnimationValue = number>(_: StrategyContext<TAnimationValue>) => TransitionStrategy<TAnimationValue>;
|
|
60
65
|
//# sourceMappingURL=transition-strategy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../src/lib/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,mBAAmB,eAAoC,CAAC;AAErE,MAAM,WAAW,eAAe,CAAC,eAAe,GAAG,MAAM;IAEvD,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,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,eAAO,MAAM,qBAAqB,GAAI,eAAe,GAAG,MAAM,EAC5D,SAAS,eAAe,CAAC,eAAe,CAAC,KACxC,kBAAkB,CAAC,eAAe,CA0HpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GAAI,eAAe,GAAG,MAAM,EACnE,GAAG,eAAe,CAAC,eAAe,CAAC,KAClC,kBAAkB,CAAC,eAAe,CAkEpC,CAAC"}
|
package/dist/transition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgE7C,wBAAgB,eAAe,IAAI,aAAa,CAY/C;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,UAAU,CAAC,eAAe,GAAG,MAAM,EACjD,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG;IACvD,CAAC,mBAAmB,CAAC,CAAC,EAAE,CACtB,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,CAkBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBAe5B,WAAW;;wBArBb,MAAM;sBACR,MAAM;;yBAsBG,MAAM;;
|
|
1
|
+
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBAe5B,WAAW;;wBArBb,MAAM;sBACR,MAAM;;yBAsBG,MAAM;;mBAwBV,WAAW;;wBA/Cd,MAAM;sBACR,MAAM;;yBAgDG,MAAM;;CA0B5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounce.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/bounce.ts"],"names":[],"mappings":"AAAA,O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file":"fly.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,UAAU;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,GAAG,GAAI,UAAS,UAAe;;kBAkB1B,WAAW;;wBAxBb,MAAM;sBACR,MAAM;;yBAyBG,MAAM;;
|
|
1
|
+
{"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,UAAU;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,GAAG,GAAI,UAAS,UAAe;;kBAkB1B,WAAW;;wBAxBb,MAAM;sBACR,MAAM;;yBAyBG,MAAM;;mBAcV,WAAW;;wBAxCd,MAAM;sBACR,MAAM;;yBAyCG,MAAM;;CAgB5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=($={})=>{const{from:e=0,to:s=1,spring:o={stiffness:300,damping:30},key:l}=$;return{in:u=>({spring:o,tick:y=>{const a=e+(s-e)*y;u.style.opacity=a.toString()}}),out:u=>({spring:o,tick:y=>{const a=e+(s-e)*y;u.style.opacity=a.toString()}}),...l&&{key:l}}},h=($={})=>{const{start:e=0,opacity:s=0,axis:o="both",spring:l={stiffness:300,damping:30},key:u}=$,y=a=>{switch(o){case"x":return`scaleX(${a})`;case"y":return`scaleY(${a})`;case"both":default:return`scale(${a})`}};return{in:a=>({spring:l,tick:n=>{const t=e+(1-e)*n;a.style.transform=y(t),a.style.opacity=(s+(1-s)*n).toString()}}),out:a=>({spring:l,tick:n=>{const t=e+(1-e)*n;a.style.transform=y(t),a.style.opacity=(s+(1-s)*n).toString()}}),...u&&{key:u}}},x=($={})=>{const{direction:e,distance:s=100,opacity:o=0,fade:l=!0,axis:u,spring:y={stiffness:400,damping:35},key:a}=$,t=e||(u==="x"?"left":u==="y"?"up":"left"),c=i=>typeof i=="number"?`${i}px`:i,f=i=>{const r=1-i,p=typeof s=="number"?r*s:`calc(${c(s)} * ${r})`;switch(t){case"left":return typeof s=="number"?`translateX(${-p}px)`:`translateX(calc(-1 * ${p}))`;case"right":return typeof s=="number"?`translateX(${p}px)`:`translateX(${p})`;case"up":return typeof s=="number"?`translateY(${-p}px)`:`translateY(calc(-1 * ${p}))`;case"down":return typeof s=="number"?`translateY(${p}px)`:`translateY(${p})`}};return{in:i=>({spring:y,tick:r=>{i.style.transform=f(r),l&&(i.style.opacity=(o+(1-o)*r).toString())}}),out:i=>({spring:y,tick:r=>{i.style.transform=f(r),l&&(i.style.opacity=(o+(1-o)*r).toString())}}),...a&&{key:a}}},k=($={})=>{const{degrees:e=360,clockwise:s=!0,scale:o=!1,fade:l=!0,origin:u="center",axis:y="2d",perspective:a=800,spring:n={stiffness:500,damping:25},key:t}=$,c=s?e:-e,f=i=>{const r=(1-i)*c;switch(y){case"x":return`perspective(${a}px) rotateX(${r}deg)`;case"y":return`perspective(${a}px) rotateY(${r}deg)`;case"z":return`rotateZ(${r}deg)`;case"2d":default:return`rotate(${r}deg)`}};return{in:i=>({spring:n,tick:r=>{const p=[f(r)];o&&p.push(`scale(${r})`),i.style.transform=p.join(" "),i.style.transformOrigin=u,l&&(i.style.opacity=r.toString())}}),out:i=>({spring:n,tick:r=>{const p=[f(r)];o&&p.push(`scale(${r})`),i.style.transform=p.join(" "),i.style.transformOrigin=u,l&&(i.style.opacity=r.toString())}}),...t&&{key:t}}},S=($={})=>{const{height:e=20,intensity:s=1,scale:o=!0,fade:l=!0,direction:u="up",spring:y={stiffness:800,damping:15},key:a}=$;return{in:n=>({spring:y,tick:t=>{const c=[],f=Math.sin(t*Math.PI*(1+s)),i=1-t,r=f*e*i;if(u==="up"?c.push(`translateY(${-Math.abs(r)}px)`):c.push(`translateY(${Math.abs(r)}px)`),o){const p=.8+t*.2+f*.05*i;c.push(`scale(${p})`)}n.style.transform=c.join(" "),l&&(n.style.opacity=t.toString())}}),out:n=>({spring:y,tick:t=>{const c=[],f=Math.sin(t*Math.PI*(1+s)),i=1-t,r=f*e*i;if(u==="up"?c.push(`translateY(${-Math.abs(r)}px)`):c.push(`translateY(${Math.abs(r)}px)`),o){const p=.8+t*.2+f*.05*i;c.push(`scale(${p})`)}n.style.transform=c.join(" "),l&&(n.style.opacity=t.toString())}}),...a&&{key:a}}},M=($={})=>{const{amount:e=10,opacity:s=0,scale:o=!1,fade:l=!0,spring:u={stiffness:300,damping:30},key:y}=$,a=n=>typeof n=="number"?`${n}px`:n;return{in:n=>({spring:u,tick:t=>{const c=1-t,f=typeof e=="number"?c*e:`calc(${a(e)} * ${c})`;n.style.filter=typeof e=="number"?`blur(${f}px)`:`blur(${f})`,o&&(n.style.transform=`scale(${.8+t*.2})`),l&&(n.style.opacity=(s+(1-s)*t).toString())}}),out:n=>({spring:u,tick:t=>{const c=1-t,f=typeof e=="number"?c*e:`calc(${a(e)} * ${c})`;n.style.filter=typeof e=="number"?`blur(${f}px)`:`blur(${f})`,o&&(n.style.transform=`scale(${.8+t*.2})`),l&&(n.style.opacity=(s+(1-s)*t).toString())}}),...y&&{key:y}}},Y=($={})=>{const{x:e=0,y:s=-100,opacity:o=0,spring:l={stiffness:400,damping:35},key:u}=$,y=n=>typeof n=="number"?`${n}px`:n,a=n=>typeof n=="number"?`${n}px`:n;return{in:n=>({spring:l,tick:t=>{const c=typeof e=="number"?(1-t)*e:`calc(${y(e)} * ${1-t})`,f=typeof s=="number"?(1-t)*s:`calc(${a(s)} * ${1-t})`;n.style.transform=`translate(${typeof e=="number"?c+"px":c}, ${typeof s=="number"?f+"px":f})`,n.style.opacity=(o+(1-o)*t).toString()}}),out:n=>({spring:l,tick:t=>{const c=typeof e=="number"?(1-t)*e:`calc(${y(e)} * ${1-t})`,f=typeof s=="number"?(1-t)*s:`calc(${a(s)} * ${1-t})`;n.style.transform=`translate(${typeof e=="number"?c+"px":c}, ${typeof s=="number"?f+"px":f})`,n.style.opacity=(o+(1-o)*t).toString()}}),...u&&{key:u}}},O=($={})=>{const{shape:e="circle",origin:s="center",scale:o=1.5,fade:l=!1,spring:u={stiffness:300,damping:30},key:y}=$,a=()=>{switch(s){case"top":return"50% 0%";case"bottom":return"50% 100%";case"left":return"0% 50%";case"right":return"100% 50%";case"top-left":return"0% 0%";case"top-right":return"100% 0%";case"bottom-left":return"0% 100%";case"bottom-right":return"100% 100%";case"center":default:return"50% 50%"}},n=t=>{const c=t*o*100,f=a();switch(e){case"ellipse":return`ellipse(${c}% ${c*.75}% at ${f})`;case"square":const i=t*o*100,[r,p]=f.split(" "),m=parseFloat(r),g=parseFloat(p),b=i/2;return`polygon(${m-b}% ${g-b}%, ${m+b}% ${g-b}%, ${m+b}% ${g+b}%, ${m-b}% ${g+b}%)`;case"circle":default:return`circle(${c}% at ${f})`}};return{in:t=>({spring:u,tick:c=>{t.style.clipPath=n(c),l&&(t.style.opacity=c.toString())}}),out:t=>({spring:u,tick:c=>{t.style.clipPath=n(c),l&&(t.style.opacity=c.toString())}}),...y&&{key:y}}},V=($={})=>{const{spring:e={stiffness:1e3,damping:100},key:s}=$;return{in:o=>({spring:e,tick:l=>{}}),out:o=>({spring:e,tick:l=>{}}),...s&&{key:s}}};exports.blur=M;exports.bounce=S;exports.fade=d;exports.fly=Y;exports.mask=O;exports.none=V;exports.rotate=k;exports.scale=h;exports.slide=x;
|