@ssgoi/core 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animator/spring-core.d.ts +23 -4
- package/dist/animator/spring-core.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +166 -122
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +13 -13
- package/dist/view-transitions/index.js +406 -391
- package/dist/view-transitions/instagram.d.ts.map +1 -1
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (i, e, t) =>
|
|
4
|
-
import { normalizeToMultiSpring as
|
|
5
|
-
import { isCssAnimation as
|
|
6
|
-
import { j as
|
|
7
|
-
class
|
|
1
|
+
var nt = Object.defineProperty;
|
|
2
|
+
var it = (i, e, t) => e in i ? nt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var m = (i, e, t) => it(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { normalizeToMultiSpring as P, normalizeMultiSpringSchedule as Y } from "./types.js";
|
|
5
|
+
import { isCssAnimation as zt, isMultiSpring as Dt, isSingleSpring as _t, isTickAnimation as qt, validateAnimationMode as Ht, validateSpringItem as Nt } from "./types.js";
|
|
6
|
+
import { j as Ut } from "./jaemin-BWkrXq0V.js";
|
|
7
|
+
class ot {
|
|
8
8
|
constructor() {
|
|
9
9
|
m(this, "listeners", /* @__PURE__ */ new Set());
|
|
10
10
|
m(this, "rafId", null);
|
|
@@ -68,24 +68,69 @@ class et {
|
|
|
68
68
|
return this.elapsed;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
function
|
|
73
|
-
const e = i.stiffness, t = i.damping, n = 1, r = Math.sqrt(e / n), s = t / (2 * Math.sqrt(e * n));
|
|
74
|
-
|
|
71
|
+
const D = new ot();
|
|
72
|
+
function j(i) {
|
|
73
|
+
const e = i.stiffness, t = i.damping, n = 1, r = Math.sqrt(e / n), s = t / (2 * Math.sqrt(e * n)), a = { omega: r, zeta: s };
|
|
74
|
+
if (i.doubleSpring) {
|
|
75
|
+
const o = typeof i.doubleSpring == "number" ? i.doubleSpring : 1, c = e * o, u = Math.sqrt(c / n), f = t / (2 * Math.sqrt(c * n));
|
|
76
|
+
a.follower = { omega: u, zeta: f };
|
|
77
|
+
}
|
|
78
|
+
return a;
|
|
79
|
+
}
|
|
80
|
+
function _(i, e, t, n, r, s) {
|
|
81
|
+
const a = -2 * s * r * n * e, o = s * n * n * (t - i), c = e + a + o;
|
|
82
|
+
return { position: i + s * c, velocity: c };
|
|
75
83
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
84
|
+
function G(i, e, t, n) {
|
|
85
|
+
const r = Math.min(n, 0.033);
|
|
86
|
+
if (t.follower) {
|
|
87
|
+
const u = i._leader ?? {
|
|
88
|
+
position: i.position,
|
|
89
|
+
velocity: i.velocity
|
|
90
|
+
}, f = _(
|
|
91
|
+
u.position,
|
|
92
|
+
u.velocity,
|
|
93
|
+
e,
|
|
94
|
+
t.omega,
|
|
95
|
+
t.zeta,
|
|
96
|
+
r
|
|
97
|
+
), h = _(
|
|
98
|
+
i.position,
|
|
99
|
+
i.velocity,
|
|
100
|
+
f.position,
|
|
101
|
+
t.follower.omega,
|
|
102
|
+
t.follower.zeta,
|
|
103
|
+
r
|
|
104
|
+
);
|
|
105
|
+
return {
|
|
106
|
+
position: h.position,
|
|
107
|
+
velocity: h.velocity,
|
|
108
|
+
_leader: f
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const { omega: s, zeta: a } = t, o = _(
|
|
112
|
+
i.position,
|
|
113
|
+
i.velocity,
|
|
114
|
+
e,
|
|
115
|
+
s,
|
|
116
|
+
a,
|
|
117
|
+
r
|
|
118
|
+
);
|
|
78
119
|
return {
|
|
79
|
-
position:
|
|
80
|
-
velocity:
|
|
120
|
+
position: o.position,
|
|
121
|
+
velocity: o.velocity
|
|
81
122
|
};
|
|
82
123
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
85
|
-
const t = Math.abs(e - i.position), n = Math.abs(i.velocity);
|
|
86
|
-
|
|
124
|
+
const U = 0.01, W = 0.01, $ = 0.05;
|
|
125
|
+
function B(i, e) {
|
|
126
|
+
const t = Math.abs(e - i.position), n = Math.abs(i.velocity), r = t < U && n < W, s = i;
|
|
127
|
+
if (s._leader) {
|
|
128
|
+
const a = Math.abs(e - s._leader.position), o = Math.abs(s._leader.velocity);
|
|
129
|
+
return a < U && o < W && r;
|
|
130
|
+
}
|
|
131
|
+
return r;
|
|
87
132
|
}
|
|
88
|
-
function
|
|
133
|
+
function rt(i) {
|
|
89
134
|
const {
|
|
90
135
|
from: e,
|
|
91
136
|
to: t,
|
|
@@ -96,11 +141,11 @@ function ot(i) {
|
|
|
96
141
|
onStart: o
|
|
97
142
|
} = i;
|
|
98
143
|
let c = { position: e, velocity: r }, u = !0, f = 0, h = !1;
|
|
99
|
-
const y =
|
|
144
|
+
const y = j(n), v = (l) => {
|
|
100
145
|
if (u) {
|
|
101
|
-
if (h || (h = !0, o == null || o()), c =
|
|
102
|
-
if (f += Math.min(l, 0.033), f >=
|
|
103
|
-
c = { position: t, velocity: 0 }, u = !1, s(c.position),
|
|
146
|
+
if (h || (h = !0, o == null || o()), c = G(c, t, y, l), B(c, t)) {
|
|
147
|
+
if (f += Math.min(l, 0.033), f >= $) {
|
|
148
|
+
c = { position: t, velocity: 0 }, u = !1, s(c.position), D.unsubscribe(v), a();
|
|
104
149
|
return;
|
|
105
150
|
}
|
|
106
151
|
} else
|
|
@@ -108,30 +153,30 @@ function ot(i) {
|
|
|
108
153
|
s(c.position);
|
|
109
154
|
}
|
|
110
155
|
};
|
|
111
|
-
return
|
|
156
|
+
return D.subscribe(v), {
|
|
112
157
|
stop: () => {
|
|
113
|
-
u && (u = !1,
|
|
158
|
+
u && (u = !1, D.unsubscribe(v));
|
|
114
159
|
},
|
|
115
160
|
getPosition: () => c.position,
|
|
116
161
|
getVelocity: () => c.velocity,
|
|
117
162
|
isRunning: () => u
|
|
118
163
|
};
|
|
119
164
|
}
|
|
120
|
-
const
|
|
121
|
-
function
|
|
122
|
-
const r =
|
|
165
|
+
const I = 1e3 / 60;
|
|
166
|
+
function st(i, e, t, n = 0) {
|
|
167
|
+
const r = j(t), s = 600;
|
|
123
168
|
let a = { position: i, velocity: n }, o = 0;
|
|
124
169
|
const c = [];
|
|
125
170
|
for (let u = 0; u < s; u++) {
|
|
126
|
-
const f = u *
|
|
171
|
+
const f = u * I;
|
|
127
172
|
if (c.push({
|
|
128
173
|
time: f,
|
|
129
174
|
position: a.position,
|
|
130
175
|
velocity: a.velocity
|
|
131
|
-
}), a =
|
|
132
|
-
if (o +=
|
|
176
|
+
}), a = G(a, e, r, I / 1e3), B(a, e)) {
|
|
177
|
+
if (o += I / 1e3, o >= $) {
|
|
133
178
|
c.push({
|
|
134
|
-
time: (u + 1) *
|
|
179
|
+
time: (u + 1) * I,
|
|
135
180
|
position: e,
|
|
136
181
|
velocity: 0
|
|
137
182
|
});
|
|
@@ -142,7 +187,7 @@ function rt(i, e, t, n = 0) {
|
|
|
142
187
|
}
|
|
143
188
|
return c;
|
|
144
189
|
}
|
|
145
|
-
function
|
|
190
|
+
function X(i, e) {
|
|
146
191
|
if (i.length === 0)
|
|
147
192
|
return { position: 0, velocity: 0 };
|
|
148
193
|
const t = i[0], n = i[i.length - 1];
|
|
@@ -161,10 +206,10 @@ function Y(i, e) {
|
|
|
161
206
|
velocity: a.velocity + (o.velocity - a.velocity) * c
|
|
162
207
|
};
|
|
163
208
|
}
|
|
164
|
-
function
|
|
209
|
+
function ct(i, e) {
|
|
165
210
|
return i.map((t) => e(t.position));
|
|
166
211
|
}
|
|
167
|
-
function
|
|
212
|
+
function at(i) {
|
|
168
213
|
const {
|
|
169
214
|
element: e,
|
|
170
215
|
from: t,
|
|
@@ -174,7 +219,7 @@ function ct(i) {
|
|
|
174
219
|
style: a,
|
|
175
220
|
onComplete: o,
|
|
176
221
|
onStart: c
|
|
177
|
-
} = i, u =
|
|
222
|
+
} = i, u = st(t, n, r, s);
|
|
178
223
|
if (u.length === 0)
|
|
179
224
|
return c == null || c(), o(), {
|
|
180
225
|
stop: () => {
|
|
@@ -183,11 +228,10 @@ function ct(i) {
|
|
|
183
228
|
getVelocity: () => 0,
|
|
184
229
|
isRunning: () => !1
|
|
185
230
|
};
|
|
186
|
-
const f =
|
|
231
|
+
const f = ct(u, a), h = u[u.length - 1], y = h.time, v = e.animate(f, {
|
|
187
232
|
duration: y,
|
|
188
233
|
fill: "forwards",
|
|
189
234
|
easing: "linear"
|
|
190
|
-
// Spring physics already applied in keyframes
|
|
191
235
|
});
|
|
192
236
|
let l = !0;
|
|
193
237
|
const d = performance.now();
|
|
@@ -201,18 +245,18 @@ function ct(i) {
|
|
|
201
245
|
if (!l)
|
|
202
246
|
return h.position;
|
|
203
247
|
const A = performance.now() - d;
|
|
204
|
-
return
|
|
248
|
+
return X(u, A).position;
|
|
205
249
|
},
|
|
206
250
|
getVelocity: () => {
|
|
207
251
|
if (!l)
|
|
208
252
|
return 0;
|
|
209
253
|
const A = performance.now() - d;
|
|
210
|
-
return
|
|
254
|
+
return X(u, A).velocity;
|
|
211
255
|
},
|
|
212
256
|
isRunning: () => l
|
|
213
257
|
};
|
|
214
258
|
}
|
|
215
|
-
function
|
|
259
|
+
function lt(i) {
|
|
216
260
|
const { from: e, to: t, spring: n, velocity: r, onComplete: s, onStart: a, tick: o, css: c } = i;
|
|
217
261
|
if (o && c)
|
|
218
262
|
throw new Error("Cannot use both 'tick' and 'css' options together");
|
|
@@ -222,7 +266,7 @@ function at(i) {
|
|
|
222
266
|
getPosition: () => t,
|
|
223
267
|
getVelocity: () => 0,
|
|
224
268
|
isRunning: () => !1
|
|
225
|
-
}) : c ?
|
|
269
|
+
}) : c ? at({
|
|
226
270
|
element: c.element,
|
|
227
271
|
from: e,
|
|
228
272
|
to: t,
|
|
@@ -231,7 +275,7 @@ function at(i) {
|
|
|
231
275
|
style: c.style,
|
|
232
276
|
onComplete: s,
|
|
233
277
|
onStart: a
|
|
234
|
-
}) :
|
|
278
|
+
}) : rt({
|
|
235
279
|
from: e,
|
|
236
280
|
to: t,
|
|
237
281
|
spring: n,
|
|
@@ -241,9 +285,9 @@ function at(i) {
|
|
|
241
285
|
onStart: a
|
|
242
286
|
});
|
|
243
287
|
}
|
|
244
|
-
class
|
|
288
|
+
class K {
|
|
245
289
|
}
|
|
246
|
-
class F extends
|
|
290
|
+
class F extends K {
|
|
247
291
|
constructor(t) {
|
|
248
292
|
super();
|
|
249
293
|
m(this, "options");
|
|
@@ -265,7 +309,7 @@ class F extends G {
|
|
|
265
309
|
}, this.currentValue = this.options.from;
|
|
266
310
|
}
|
|
267
311
|
runAnimation(t) {
|
|
268
|
-
this.isAnimating = !0, this.controls =
|
|
312
|
+
this.isAnimating = !0, this.controls = lt({
|
|
269
313
|
from: this.currentValue,
|
|
270
314
|
to: t,
|
|
271
315
|
spring: this.options.spring,
|
|
@@ -324,7 +368,7 @@ class F extends G {
|
|
|
324
368
|
return r.setValue(t.position), r.setVelocity(t.velocity), r;
|
|
325
369
|
}
|
|
326
370
|
}
|
|
327
|
-
class L extends
|
|
371
|
+
class L extends K {
|
|
328
372
|
constructor(t) {
|
|
329
373
|
super();
|
|
330
374
|
m(this, "config");
|
|
@@ -520,7 +564,7 @@ class L extends G {
|
|
|
520
564
|
return r.setValue(t.position), r.setVelocity(t.velocity), r;
|
|
521
565
|
}
|
|
522
566
|
}
|
|
523
|
-
const
|
|
567
|
+
const Z = Symbol.for("TRANSITION_STRATEGY"), ut = (i) => ({
|
|
524
568
|
runIn: async (e) => {
|
|
525
569
|
const { currentAnimation: t } = i;
|
|
526
570
|
if (t && t.direction === "out") {
|
|
@@ -587,7 +631,7 @@ const $ = Symbol.for("TRANSITION_STRATEGY"), lt = (i) => ({
|
|
|
587
631
|
direction: "forward"
|
|
588
632
|
};
|
|
589
633
|
}
|
|
590
|
-
}),
|
|
634
|
+
}), ft = () => ({
|
|
591
635
|
runIn: async (i) => i.in ? {
|
|
592
636
|
config: await i.in,
|
|
593
637
|
state: {
|
|
@@ -624,48 +668,48 @@ const $ = Symbol.for("TRANSITION_STRATEGY"), lt = (i) => ({
|
|
|
624
668
|
to: 0,
|
|
625
669
|
direction: "forward"
|
|
626
670
|
}
|
|
627
|
-
}),
|
|
628
|
-
function
|
|
671
|
+
}), J = "data-ssgoi-scope", Q = "data-ssgoi-scope-ready";
|
|
672
|
+
function Vt() {
|
|
629
673
|
return (i) => {
|
|
630
674
|
if (i)
|
|
631
|
-
return i.setAttribute(
|
|
675
|
+
return i.setAttribute(J, ""), queueMicrotask(() => {
|
|
632
676
|
queueMicrotask(() => {
|
|
633
|
-
i.setAttribute(
|
|
677
|
+
i.setAttribute(Q, "true");
|
|
634
678
|
});
|
|
635
679
|
}), () => {
|
|
636
680
|
};
|
|
637
681
|
};
|
|
638
682
|
}
|
|
639
|
-
function ft(i) {
|
|
640
|
-
return i.hasAttribute(K);
|
|
641
|
-
}
|
|
642
683
|
function dt(i) {
|
|
643
|
-
return i.
|
|
684
|
+
return i.hasAttribute(Q);
|
|
644
685
|
}
|
|
645
|
-
function mt(i
|
|
686
|
+
function mt(i) {
|
|
687
|
+
return i.closest(`[${J}]`);
|
|
688
|
+
}
|
|
689
|
+
function ht(i, e) {
|
|
646
690
|
var v;
|
|
647
691
|
let t = null, n = null, r = null, s = null;
|
|
648
692
|
const a = {
|
|
649
693
|
get currentAnimation() {
|
|
650
694
|
return t;
|
|
651
695
|
}
|
|
652
|
-
}, o = ((v = e == null ? void 0 : e.strategy) == null ? void 0 : v.call(e, a)) ||
|
|
696
|
+
}, o = ((v = e == null ? void 0 : e.strategy) == null ? void 0 : v.call(e, a)) || ut(a), c = async (l) => {
|
|
653
697
|
var E;
|
|
654
698
|
n && (n.remove(), n = null);
|
|
655
699
|
const d = i(), A = d.in && d.in(l), k = !(e != null && e.strategy) && d.out ? d.out(l) : void 0;
|
|
656
700
|
if (!A)
|
|
657
701
|
return;
|
|
658
|
-
const
|
|
659
|
-
in:
|
|
660
|
-
out: k ?
|
|
661
|
-
}, S = await o.runIn(
|
|
702
|
+
const M = {
|
|
703
|
+
in: P(A),
|
|
704
|
+
out: k ? P(k) : void 0
|
|
705
|
+
}, S = await o.runIn(M);
|
|
662
706
|
if (!S.config) {
|
|
663
707
|
t && (t.direction = "in");
|
|
664
708
|
return;
|
|
665
709
|
}
|
|
666
710
|
const p = S.config;
|
|
667
711
|
(E = p.prepare) == null || E.call(p, l), p.wait && await p.wait();
|
|
668
|
-
const w =
|
|
712
|
+
const w = Y(
|
|
669
713
|
{
|
|
670
714
|
...p,
|
|
671
715
|
onEnd: () => {
|
|
@@ -686,22 +730,22 @@ function mt(i, e) {
|
|
|
686
730
|
const d = i(), A = !(e != null && e.strategy) && d.in ? d.in(l) : void 0, k = d.out && d.out(l);
|
|
687
731
|
if (!k)
|
|
688
732
|
return;
|
|
689
|
-
const
|
|
690
|
-
in: A ?
|
|
691
|
-
out:
|
|
692
|
-
}, S = await o.runOut(
|
|
733
|
+
const M = {
|
|
734
|
+
in: A ? P(A) : void 0,
|
|
735
|
+
out: P(k)
|
|
736
|
+
}, S = await o.runOut(M);
|
|
693
737
|
if (!S.config) {
|
|
694
738
|
t && (t.direction = "out"), n && (n.remove(), n = null);
|
|
695
739
|
return;
|
|
696
740
|
}
|
|
697
741
|
const p = S.config;
|
|
698
742
|
(C = p.prepare) == null || C.call(p, l), E(), p.wait && await p.wait();
|
|
699
|
-
const w =
|
|
743
|
+
const w = Y(
|
|
700
744
|
{
|
|
701
745
|
...p,
|
|
702
746
|
onEnd: () => {
|
|
703
|
-
var V,
|
|
704
|
-
(V = p.onEnd) == null || V.call(p), n && (n.remove(), n = null), t = null, (
|
|
747
|
+
var V, R;
|
|
748
|
+
(V = p.onEnd) == null || V.call(p), n && (n.remove(), n = null), t = null, (R = e == null ? void 0 : e.onCleanupEnd) == null || R.call(e);
|
|
705
749
|
}
|
|
706
750
|
},
|
|
707
751
|
l
|
|
@@ -729,13 +773,13 @@ function mt(i, e) {
|
|
|
729
773
|
return requestAnimationFrame(() => {
|
|
730
774
|
r = l.parentElement, s = l.nextElementSibling;
|
|
731
775
|
}), h = !1, (e == null ? void 0 : e.scope) === "local" ? queueMicrotask(() => {
|
|
732
|
-
f =
|
|
776
|
+
f = mt(l), !(f && !dt(f)) && c(l);
|
|
733
777
|
}) : c(l), y(l);
|
|
734
778
|
};
|
|
735
779
|
}
|
|
736
780
|
const b = /* @__PURE__ */ new Map();
|
|
737
781
|
let T = null, q = !1;
|
|
738
|
-
function
|
|
782
|
+
function tt(i) {
|
|
739
783
|
if (i instanceof HTMLElement && b.has(i)) {
|
|
740
784
|
const t = b.get(i);
|
|
741
785
|
b.delete(i), queueMicrotask(() => {
|
|
@@ -745,16 +789,16 @@ function J(i) {
|
|
|
745
789
|
const e = i.childNodes;
|
|
746
790
|
for (let t = 0; t < e.length; t++) {
|
|
747
791
|
const n = e[t];
|
|
748
|
-
n &&
|
|
792
|
+
n && tt(n);
|
|
749
793
|
}
|
|
750
794
|
}
|
|
751
|
-
function
|
|
795
|
+
function gt() {
|
|
752
796
|
q || typeof document > "u" || (q = !0, T = new MutationObserver((i) => {
|
|
753
797
|
for (const e of i) {
|
|
754
798
|
const t = e.removedNodes;
|
|
755
799
|
for (let n = 0; n < t.length; n++) {
|
|
756
800
|
const r = t[n];
|
|
757
|
-
r &&
|
|
801
|
+
r && tt(r);
|
|
758
802
|
}
|
|
759
803
|
}
|
|
760
804
|
}), document.body ? T.observe(document.body, {
|
|
@@ -771,10 +815,10 @@ function ht() {
|
|
|
771
815
|
{ once: !0 }
|
|
772
816
|
));
|
|
773
817
|
}
|
|
774
|
-
function
|
|
775
|
-
|
|
818
|
+
function pt(i, e) {
|
|
819
|
+
gt(), b.set(i, e);
|
|
776
820
|
}
|
|
777
|
-
function
|
|
821
|
+
function Mt(i) {
|
|
778
822
|
return b.has(i);
|
|
779
823
|
}
|
|
780
824
|
function Rt() {
|
|
@@ -788,13 +832,13 @@ function It() {
|
|
|
788
832
|
b.clear(), T == null || T.disconnect(), T = null, q = !1;
|
|
789
833
|
}
|
|
790
834
|
const O = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
|
|
791
|
-
function
|
|
835
|
+
function wt(i, e, t) {
|
|
792
836
|
O.set(i, e);
|
|
793
837
|
let n = H.get(i);
|
|
794
838
|
if (n)
|
|
795
839
|
return n;
|
|
796
840
|
const r = e;
|
|
797
|
-
return n =
|
|
841
|
+
return n = ht(
|
|
798
842
|
() => {
|
|
799
843
|
const s = O.get(i);
|
|
800
844
|
return s || (console.warn(`Transition "${String(i)}" not found`), {});
|
|
@@ -803,23 +847,23 @@ function pt(i, e, t) {
|
|
|
803
847
|
strategy: t == null ? void 0 : t.strategy,
|
|
804
848
|
scope: t == null ? void 0 : t.scope,
|
|
805
849
|
onCleanupEnd: () => {
|
|
806
|
-
O.get(i) === r &&
|
|
850
|
+
O.get(i) === r && yt(i);
|
|
807
851
|
}
|
|
808
852
|
}
|
|
809
853
|
), H.set(i, n), n;
|
|
810
854
|
}
|
|
811
|
-
function
|
|
855
|
+
function yt(i) {
|
|
812
856
|
O.delete(i), H.delete(i), N.delete(i);
|
|
813
857
|
}
|
|
814
|
-
function
|
|
815
|
-
const t =
|
|
858
|
+
function xt(i, e = "manual") {
|
|
859
|
+
const t = wt(
|
|
816
860
|
i.key,
|
|
817
861
|
{
|
|
818
862
|
in: i.in,
|
|
819
863
|
out: i.out
|
|
820
864
|
},
|
|
821
865
|
{
|
|
822
|
-
strategy: i[
|
|
866
|
+
strategy: i[Z],
|
|
823
867
|
scope: i.scope
|
|
824
868
|
}
|
|
825
869
|
);
|
|
@@ -829,11 +873,11 @@ function Mt(i, e = "manual") {
|
|
|
829
873
|
return n || (n = (r) => {
|
|
830
874
|
if (r) {
|
|
831
875
|
const s = t(r);
|
|
832
|
-
s &&
|
|
876
|
+
s && pt(r, s);
|
|
833
877
|
}
|
|
834
878
|
}, N.set(i.key, n), n);
|
|
835
879
|
}
|
|
836
|
-
function
|
|
880
|
+
function vt(i) {
|
|
837
881
|
const e = i.filter((t) => t.symmetric).map((t) => ({
|
|
838
882
|
from: t.to,
|
|
839
883
|
to: t.from,
|
|
@@ -841,7 +885,7 @@ function yt(i) {
|
|
|
841
885
|
}));
|
|
842
886
|
return [...i, ...e];
|
|
843
887
|
}
|
|
844
|
-
function
|
|
888
|
+
function St(i) {
|
|
845
889
|
let e = !1, t = 0, n = 0, r = !1;
|
|
846
890
|
const s = 50, a = (l) => {
|
|
847
891
|
if (!i) return;
|
|
@@ -870,7 +914,7 @@ function vt(i) {
|
|
|
870
914
|
}
|
|
871
915
|
};
|
|
872
916
|
}
|
|
873
|
-
const
|
|
917
|
+
const Ct = (i) => {
|
|
874
918
|
let e = i.parentElement;
|
|
875
919
|
for (; e && e !== document.body; ) {
|
|
876
920
|
const t = window.getComputedStyle(e), n = t.overflow + t.overflowY + t.overflowX;
|
|
@@ -879,7 +923,7 @@ const St = (i) => {
|
|
|
879
923
|
e = e.parentElement;
|
|
880
924
|
}
|
|
881
925
|
return document.documentElement;
|
|
882
|
-
},
|
|
926
|
+
}, At = (i) => {
|
|
883
927
|
let e = i.parentElement;
|
|
884
928
|
for (; e && e !== document.body; ) {
|
|
885
929
|
const t = window.getComputedStyle(e).position;
|
|
@@ -889,7 +933,7 @@ const St = (i) => {
|
|
|
889
933
|
}
|
|
890
934
|
return document.body;
|
|
891
935
|
};
|
|
892
|
-
function
|
|
936
|
+
function Et() {
|
|
893
937
|
let i = null, e = null;
|
|
894
938
|
const t = /* @__PURE__ */ new Map();
|
|
895
939
|
let n = null;
|
|
@@ -901,7 +945,7 @@ function At() {
|
|
|
901
945
|
};
|
|
902
946
|
return {
|
|
903
947
|
initializeContext: (f, h) => {
|
|
904
|
-
e = f, i || (i =
|
|
948
|
+
e = f, i || (i = Ct(f), (i === document.documentElement ? window : i).addEventListener("scroll", r, {
|
|
905
949
|
passive: !0
|
|
906
950
|
})), n = h;
|
|
907
951
|
},
|
|
@@ -913,7 +957,7 @@ function At() {
|
|
|
913
957
|
};
|
|
914
958
|
},
|
|
915
959
|
getScrollContainer: () => i,
|
|
916
|
-
getPositionedParentElement: () => e ?
|
|
960
|
+
getPositionedParentElement: () => e ? At(e) : document.body,
|
|
917
961
|
getScrollPosition: (f) => f && t.has(f) ? t.get(f) : { x: 0, y: 0 }
|
|
918
962
|
};
|
|
919
963
|
}
|
|
@@ -926,7 +970,7 @@ function x(i, e) {
|
|
|
926
970
|
}
|
|
927
971
|
return i === e;
|
|
928
972
|
}
|
|
929
|
-
function
|
|
973
|
+
function Tt(i, e, t) {
|
|
930
974
|
for (const n of t)
|
|
931
975
|
if (x(i, n.from) && x(e, n.to))
|
|
932
976
|
return n.transition;
|
|
@@ -935,7 +979,7 @@ function Et(i, e, t) {
|
|
|
935
979
|
return n.transition;
|
|
936
980
|
return null;
|
|
937
981
|
}
|
|
938
|
-
function
|
|
982
|
+
function Ot(i, e) {
|
|
939
983
|
const {
|
|
940
984
|
transitions: t = [],
|
|
941
985
|
defaultTransition: n,
|
|
@@ -945,27 +989,27 @@ function xt(i, e) {
|
|
|
945
989
|
// Default to true - skip animations on iOS swipe
|
|
946
990
|
} = i, { outFirst: a = !0 } = e || {};
|
|
947
991
|
let o = null;
|
|
948
|
-
const c =
|
|
992
|
+
const c = vt(t), {
|
|
949
993
|
initializeContext: u,
|
|
950
994
|
calculateScrollOffset: f,
|
|
951
995
|
getScrollContainer: h,
|
|
952
996
|
getPositionedParentElement: y,
|
|
953
997
|
getScrollPosition: v
|
|
954
|
-
} =
|
|
998
|
+
} = Et(), l = St(s);
|
|
955
999
|
l.initialize();
|
|
956
1000
|
function d() {
|
|
957
1001
|
if (o != null && o.from && (o != null && o.to)) {
|
|
958
1002
|
const { from: w, to: g } = r(
|
|
959
1003
|
o.from,
|
|
960
1004
|
o.to
|
|
961
|
-
), C =
|
|
1005
|
+
), C = Tt(
|
|
962
1006
|
w,
|
|
963
1007
|
g,
|
|
964
1008
|
c
|
|
965
1009
|
) || n, V = f(
|
|
966
1010
|
o.from,
|
|
967
1011
|
o.to
|
|
968
|
-
),
|
|
1012
|
+
), R = {
|
|
969
1013
|
scrollOffset: V,
|
|
970
1014
|
scroll: v(o.from),
|
|
971
1015
|
get scrollingElement() {
|
|
@@ -974,7 +1018,7 @@ function xt(i, e) {
|
|
|
974
1018
|
get positionedParent() {
|
|
975
1019
|
return y();
|
|
976
1020
|
}
|
|
977
|
-
},
|
|
1021
|
+
}, et = {
|
|
978
1022
|
scrollOffset: V,
|
|
979
1023
|
get scroll() {
|
|
980
1024
|
return o ? v(o.to) : { x: 0, y: 0 };
|
|
@@ -987,9 +1031,9 @@ function xt(i, e) {
|
|
|
987
1031
|
}
|
|
988
1032
|
};
|
|
989
1033
|
C && (C.out && o.outResolve && o.outResolve(
|
|
990
|
-
(
|
|
1034
|
+
(z) => C.out(z, R)
|
|
991
1035
|
), C.in && o.inResolve && o.inResolve(
|
|
992
|
-
(
|
|
1036
|
+
(z) => C.in(z, et)
|
|
993
1037
|
)), o = null;
|
|
994
1038
|
}
|
|
995
1039
|
}
|
|
@@ -1010,32 +1054,32 @@ function xt(i, e) {
|
|
|
1010
1054
|
in: async (g) => (u(g, w), (await S(w, "in"))(g)),
|
|
1011
1055
|
out: async (g) => (await S(w, "out"))(g),
|
|
1012
1056
|
// Add page transition strategy for page-level transitions
|
|
1013
|
-
[
|
|
1057
|
+
[Z]: ft
|
|
1014
1058
|
});
|
|
1015
1059
|
}
|
|
1016
1060
|
export {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1061
|
+
J as SCOPE_ATTR,
|
|
1062
|
+
Q as SCOPE_READY_ATTR,
|
|
1063
|
+
Z as TRANSITION_STRATEGY,
|
|
1064
|
+
ut as createDefaultStrategy,
|
|
1065
|
+
ft as createPageTransitionStrategy,
|
|
1066
|
+
Ot as createSggoiTransitionContext,
|
|
1067
|
+
Vt as createTransitionScope,
|
|
1068
|
+
mt as findScope,
|
|
1025
1069
|
Rt as getWatchedCount,
|
|
1026
|
-
|
|
1070
|
+
zt as isCssAnimation,
|
|
1027
1071
|
Dt as isMultiSpring,
|
|
1028
|
-
|
|
1029
|
-
|
|
1072
|
+
dt as isScopeReady,
|
|
1073
|
+
_t as isSingleSpring,
|
|
1030
1074
|
qt as isTickAnimation,
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1075
|
+
Mt as isWatched,
|
|
1076
|
+
Ut as jaeminInternal,
|
|
1077
|
+
Y as normalizeMultiSpringSchedule,
|
|
1078
|
+
P as normalizeToMultiSpring,
|
|
1035
1079
|
It as resetObserver,
|
|
1036
|
-
|
|
1080
|
+
xt as transition,
|
|
1037
1081
|
Pt as triggerUnmount,
|
|
1038
1082
|
Ht as validateAnimationMode,
|
|
1039
1083
|
Nt as validateSpringItem,
|
|
1040
|
-
|
|
1084
|
+
pt as watchUnmount
|
|
1041
1085
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,20 @@ export type TransitionKey = string | symbol;
|
|
|
2
2
|
export type SpringConfig = {
|
|
3
3
|
stiffness: number;
|
|
4
4
|
damping: number;
|
|
5
|
+
/**
|
|
6
|
+
* Enable double spring for ease-in-out effect (Chained/Lagged Spring)
|
|
7
|
+
*
|
|
8
|
+
* - true: same stiffness for both springs
|
|
9
|
+
* - number (0-1): follower stiffness ratio (smaller = stronger ease-in)
|
|
10
|
+
* - 1.0: same as true
|
|
11
|
+
* - 0.5: follower has half stiffness → stronger ease-in
|
|
12
|
+
* - 0.3: even stronger ease-in
|
|
13
|
+
*
|
|
14
|
+
* Creates a two-spring system:
|
|
15
|
+
* - Leader spring: tracks the target directly
|
|
16
|
+
* - Follower spring: tracks the leader's position (this is the output)
|
|
17
|
+
*/
|
|
18
|
+
doubleSpring?: boolean | number;
|
|
5
19
|
};
|
|
6
20
|
/**
|
|
7
21
|
* CSS style object type
|