@ssgoi/core 4.4.1 → 5.0.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/index.cjs +1 -1
- package/dist/index.js +385 -412
- package/dist/presets/index.cjs +1 -1
- package/dist/presets/index.d.ts +6 -0
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +31 -16
- package/dist/ssgoi-transition/create-context-manager.d.ts +6 -15
- package/dist/ssgoi-transition/create-context-manager.d.ts.map +1 -1
- package/dist/ssgoi-transition/create-navigation-direction-detector.d.ts.map +1 -1
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +1 -4
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/types.d.ts +15 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/view-transitions/depth.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +9 -9
- package/dist/view-transitions/index.js +320 -316
- package/dist/view-transitions/instagram.d.ts.map +1 -1
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/sheet.d.ts.map +1 -1
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/dist/view-transitions/snap.d.ts.map +1 -1
- package/dist/view-transitions/swap.d.ts.map +1 -1
- package/package.json +22 -15
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const g = (t,
|
|
1
|
+
const g = (t, n) => {
|
|
2
2
|
var r;
|
|
3
|
-
t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((r =
|
|
4
|
-
}, _ = (t) => new Promise((
|
|
5
|
-
function x(t,
|
|
6
|
-
function r(
|
|
3
|
+
t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((r = n == null ? void 0 : n.scrollOffset) == null ? void 0 : r.y) ?? 0)}px`, t.style.left = "0";
|
|
4
|
+
}, _ = (t) => new Promise((n) => setTimeout(n, t));
|
|
5
|
+
function x(t, n) {
|
|
6
|
+
function r(i) {
|
|
7
7
|
let e = 0, a = 0;
|
|
8
|
-
const l =
|
|
9
|
-
let o =
|
|
8
|
+
const l = i.offsetWidth, y = i.offsetHeight;
|
|
9
|
+
let o = i;
|
|
10
10
|
for (; o; )
|
|
11
11
|
e += o.offsetTop, a += o.offsetLeft, o = o.offsetParent;
|
|
12
12
|
return e -= window.scrollY, a -= window.scrollX, { top: e, left: a, width: l, height: y };
|
|
13
13
|
}
|
|
14
|
-
const c = r(t),
|
|
14
|
+
const c = r(t), s = r(n);
|
|
15
15
|
return new DOMRect(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
s.left - c.left,
|
|
17
|
+
s.top - c.top,
|
|
18
|
+
s.width,
|
|
19
|
+
s.height
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
function E() {
|
|
23
|
-
let t,
|
|
24
|
-
return { promise: new Promise((c,
|
|
25
|
-
t = c,
|
|
26
|
-
}), resolve: t, reject:
|
|
23
|
+
let t, n;
|
|
24
|
+
return { promise: new Promise((c, s) => {
|
|
25
|
+
t = c, n = s;
|
|
26
|
+
}), resolve: t, reject: n };
|
|
27
27
|
}
|
|
28
28
|
const H = {
|
|
29
29
|
spring: { stiffness: 200, damping: 22 }
|
|
@@ -31,11 +31,11 @@ const H = {
|
|
|
31
31
|
spring: { stiffness: 200, damping: 22 }
|
|
32
32
|
}, z = 300, W = 10, M = "horizontal", B = "#000000", Mt = (t = {}) => {
|
|
33
33
|
const {
|
|
34
|
-
transitionDelay:
|
|
34
|
+
transitionDelay: n = z,
|
|
35
35
|
blindCount: r = W,
|
|
36
36
|
direction: c = M,
|
|
37
|
-
blindColor:
|
|
38
|
-
} = t,
|
|
37
|
+
blindColor: s = B
|
|
38
|
+
} = t, i = t.physics ?? X, e = t.physics ?? H;
|
|
39
39
|
let a, l = null;
|
|
40
40
|
const y = (o, h, d = "left") => {
|
|
41
41
|
window.getComputedStyle(o).position === "static" && (o.style.position = "relative");
|
|
@@ -61,7 +61,7 @@ const H = {
|
|
|
61
61
|
left: 0;
|
|
62
62
|
width: 100%;
|
|
63
63
|
height: ${C};
|
|
64
|
-
background: ${
|
|
64
|
+
background: ${s};
|
|
65
65
|
transform: scaleX(${h === "hidden" ? 0 : 1});
|
|
66
66
|
transform-origin: ${d} center;
|
|
67
67
|
will-change: transform;
|
|
@@ -74,7 +74,7 @@ const H = {
|
|
|
74
74
|
left: ${b * $}%;
|
|
75
75
|
width: ${C};
|
|
76
76
|
height: 100%;
|
|
77
|
-
background: ${
|
|
77
|
+
background: ${s};
|
|
78
78
|
transform: scaleY(${h === "hidden" ? 0 : 1});
|
|
79
79
|
transform-origin: ${d === "left" ? "top" : "bottom"} center;
|
|
80
80
|
will-change: transform;
|
|
@@ -129,7 +129,7 @@ const H = {
|
|
|
129
129
|
};
|
|
130
130
|
return {
|
|
131
131
|
items: Array.from({ length: r }, (f, p) => ({
|
|
132
|
-
physics:
|
|
132
|
+
physics: i,
|
|
133
133
|
offset: 0.2,
|
|
134
134
|
css: {
|
|
135
135
|
// Use getter for lazy element access (evaluated after prepare)
|
|
@@ -146,7 +146,7 @@ const H = {
|
|
|
146
146
|
onStart: () => {
|
|
147
147
|
},
|
|
148
148
|
wait: async () => {
|
|
149
|
-
a && await a, await _(
|
|
149
|
+
a && await a, await _(n);
|
|
150
150
|
},
|
|
151
151
|
onEnd: () => {
|
|
152
152
|
h && h.container && h.container.remove();
|
|
@@ -188,25 +188,25 @@ const H = {
|
|
|
188
188
|
letterSpacing: "0.02em",
|
|
189
189
|
color: "#FFFFFF"
|
|
190
190
|
}, R = 0.4, S = 0.5, tt = 0.2;
|
|
191
|
-
function st(t,
|
|
191
|
+
function st(t, n) {
|
|
192
192
|
switch (t) {
|
|
193
193
|
case "circle":
|
|
194
|
-
return `circle(${
|
|
194
|
+
return `circle(${n * 100}% at 50% 50%)`;
|
|
195
195
|
case "square":
|
|
196
|
-
return `inset(${(1 -
|
|
196
|
+
return `inset(${(1 - n) * 50}% round ${10 * n}%)`;
|
|
197
197
|
case "triangle": {
|
|
198
|
-
const r =
|
|
198
|
+
const r = n * 100;
|
|
199
199
|
return `polygon(50% ${50 - r}%, ${50 - r}% ${50 + r}%, ${50 + r}% ${50 + r}%)`;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
const it = (t) => t.reduce((
|
|
203
|
+
const it = (t) => t.reduce((n, r) => n + r, 0), Bt = (t = {}) => {
|
|
204
204
|
const {
|
|
205
|
-
background:
|
|
205
|
+
background: n = N,
|
|
206
206
|
texts: r = [],
|
|
207
207
|
shape: c = G,
|
|
208
|
-
textStyle:
|
|
209
|
-
} = t,
|
|
208
|
+
textStyle: s = {}
|
|
209
|
+
} = t, i = t.physics ?? j, e = t.physics ?? q;
|
|
210
210
|
return {
|
|
211
211
|
out: (a, l) => {
|
|
212
212
|
const y = a.style.opacity;
|
|
@@ -233,15 +233,15 @@ const it = (t) => t.reduce((i, r) => i + r, 0), Bt = (t = {}) => {
|
|
|
233
233
|
);
|
|
234
234
|
let u = [];
|
|
235
235
|
const f = () => {
|
|
236
|
-
l = document.createElement("div"), l.id = k, Object.assign(l.style, Z, { background:
|
|
236
|
+
l = document.createElement("div"), l.id = k, Object.assign(l.style, Z, { background: n }), document.body.appendChild(l), y = document.createElement("div"), Object.assign(y.style, J), l.appendChild(y), o = document.createElement("div"), Object.assign(o.style, K), y.appendChild(o), r.forEach((p) => {
|
|
237
237
|
const $ = document.createElement("div");
|
|
238
|
-
$.textContent = p, Object.assign($.style, Q,
|
|
238
|
+
$.textContent = p, Object.assign($.style, Q, s), o.appendChild($);
|
|
239
239
|
}), u = Array.from(o.children).map(
|
|
240
240
|
(p) => p.getBoundingClientRect().width
|
|
241
241
|
);
|
|
242
242
|
};
|
|
243
243
|
return {
|
|
244
|
-
physics:
|
|
244
|
+
physics: i,
|
|
245
245
|
from: 0,
|
|
246
246
|
to: 1,
|
|
247
247
|
prepare: () => {
|
|
@@ -273,32 +273,32 @@ const it = (t) => t.reduce((i, r) => i + r, 0), Bt = (t = {}) => {
|
|
|
273
273
|
};
|
|
274
274
|
}, nt = {
|
|
275
275
|
spring: {
|
|
276
|
-
stiffness:
|
|
277
|
-
damping:
|
|
276
|
+
stiffness: 280,
|
|
277
|
+
damping: 30,
|
|
278
278
|
restDelta: 0.1,
|
|
279
279
|
restSpeed: 1e14
|
|
280
280
|
}
|
|
281
281
|
}, et = {
|
|
282
282
|
spring: {
|
|
283
|
-
stiffness:
|
|
284
|
-
damping:
|
|
283
|
+
stiffness: 280,
|
|
284
|
+
damping: 30,
|
|
285
285
|
restDelta: 0.1,
|
|
286
286
|
restSpeed: 1e14
|
|
287
287
|
}
|
|
288
288
|
}, at = 0.05;
|
|
289
289
|
function A(t) {
|
|
290
|
-
const
|
|
290
|
+
const n = x(document.body, t.positionedParent), r = t.scroll.y, c = window.innerHeight - n.top;
|
|
291
291
|
return {
|
|
292
292
|
top: r,
|
|
293
293
|
left: 0,
|
|
294
|
-
width:
|
|
294
|
+
width: n.width,
|
|
295
295
|
height: c
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
const qt = (t = {}) => {
|
|
299
|
-
const { direction:
|
|
300
|
-
let { promise:
|
|
301
|
-
return
|
|
299
|
+
const { direction: n = "enter" } = t, r = t.physics ?? (n === "enter" ? nt : et), c = t.scaleOffset ?? at;
|
|
300
|
+
let { promise: s, resolve: i } = E();
|
|
301
|
+
return n === "enter" ? {
|
|
302
302
|
// Entering page: scales up from small (0.8 → 1) with fade in
|
|
303
303
|
in: (e, a) => {
|
|
304
304
|
const l = A(a), y = l.left + l.width / 2, o = l.top + l.height / 2;
|
|
@@ -308,10 +308,10 @@ const qt = (t = {}) => {
|
|
|
308
308
|
e.style.opacity = "0", e.style.willChange = "transform, opacity", e.style.backfaceVisibility = "hidden", e.style.contain = "layout paint", e.style.transformOrigin = `${y}px ${o}px`;
|
|
309
309
|
},
|
|
310
310
|
wait: async () => {
|
|
311
|
-
if (
|
|
312
|
-
await
|
|
311
|
+
if (s) {
|
|
312
|
+
await s;
|
|
313
313
|
const h = E();
|
|
314
|
-
|
|
314
|
+
s = h.promise, i = h.resolve;
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
317
|
css: (h) => ({
|
|
@@ -336,7 +336,7 @@ const qt = (t = {}) => {
|
|
|
336
336
|
opacity: h
|
|
337
337
|
}),
|
|
338
338
|
onEnd: () => {
|
|
339
|
-
|
|
339
|
+
i && i();
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
342
|
}
|
|
@@ -350,10 +350,10 @@ const qt = (t = {}) => {
|
|
|
350
350
|
e.style.opacity = "0", e.style.willChange = "transform, opacity", e.style.backfaceVisibility = "hidden", e.style.contain = "layout paint", e.style.transformOrigin = `${y}px ${o}px`;
|
|
351
351
|
},
|
|
352
352
|
wait: async () => {
|
|
353
|
-
if (
|
|
354
|
-
await
|
|
353
|
+
if (s) {
|
|
354
|
+
await s;
|
|
355
355
|
const h = E();
|
|
356
|
-
|
|
356
|
+
s = h.promise, i = h.resolve;
|
|
357
357
|
}
|
|
358
358
|
},
|
|
359
359
|
css: (h) => ({
|
|
@@ -378,7 +378,7 @@ const qt = (t = {}) => {
|
|
|
378
378
|
opacity: h
|
|
379
379
|
}),
|
|
380
380
|
onEnd: () => {
|
|
381
|
-
|
|
381
|
+
i && i();
|
|
382
382
|
}
|
|
383
383
|
};
|
|
384
384
|
}
|
|
@@ -394,61 +394,61 @@ const qt = (t = {}) => {
|
|
|
394
394
|
damping: 22
|
|
395
395
|
}
|
|
396
396
|
}, jt = (t = {}) => {
|
|
397
|
-
const { opacity:
|
|
397
|
+
const { opacity: n = !1, direction: r = "enter" } = t, c = t.physics ?? (r === "enter" ? rt : ot);
|
|
398
398
|
return r === "enter" ? {
|
|
399
|
-
in: (
|
|
399
|
+
in: (s) => ({
|
|
400
400
|
physics: c,
|
|
401
401
|
prepare: () => {
|
|
402
|
-
|
|
402
|
+
s.style.willChange = n ? "transform, opacity" : "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint";
|
|
403
403
|
},
|
|
404
|
-
css: (
|
|
404
|
+
css: (i) => {
|
|
405
405
|
const e = {
|
|
406
|
-
transform: `translate3d(${(1 -
|
|
406
|
+
transform: `translate3d(${(1 - i) * 100}%, 0, 0)`
|
|
407
407
|
};
|
|
408
|
-
return
|
|
408
|
+
return n && (e.opacity = i), e;
|
|
409
409
|
},
|
|
410
410
|
onEnd: () => {
|
|
411
|
-
|
|
411
|
+
s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "";
|
|
412
412
|
}
|
|
413
413
|
}),
|
|
414
|
-
out: (
|
|
414
|
+
out: (s, i) => ({
|
|
415
415
|
physics: c,
|
|
416
416
|
prepare: () => {
|
|
417
|
-
g(
|
|
417
|
+
g(s, i), s.style.zIndex = "-1", s.style.willChange = n ? "transform, opacity" : "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.pointerEvents = "none";
|
|
418
418
|
},
|
|
419
419
|
css: (e) => {
|
|
420
420
|
const a = {
|
|
421
421
|
transform: `translate3d(${-(1 - e) * 20}%, 0, 0)`
|
|
422
422
|
};
|
|
423
|
-
return
|
|
423
|
+
return n && (a.opacity = e), a;
|
|
424
424
|
}
|
|
425
425
|
})
|
|
426
426
|
} : {
|
|
427
|
-
in: (
|
|
427
|
+
in: (s) => ({
|
|
428
428
|
physics: c,
|
|
429
429
|
prepare: () => {
|
|
430
|
-
|
|
430
|
+
s.style.willChange = n ? "transform, opacity" : "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint";
|
|
431
431
|
},
|
|
432
|
-
css: (
|
|
432
|
+
css: (i) => {
|
|
433
433
|
const e = {
|
|
434
|
-
transform: `translate3d(${-(1 -
|
|
434
|
+
transform: `translate3d(${-(1 - i) * 20}%, 0, 0)`
|
|
435
435
|
};
|
|
436
|
-
return
|
|
436
|
+
return n && (e.opacity = i), e;
|
|
437
437
|
},
|
|
438
438
|
onEnd: () => {
|
|
439
|
-
|
|
439
|
+
s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "";
|
|
440
440
|
}
|
|
441
441
|
}),
|
|
442
|
-
out: (
|
|
442
|
+
out: (s, i) => ({
|
|
443
443
|
physics: c,
|
|
444
444
|
prepare: () => {
|
|
445
|
-
g(
|
|
445
|
+
g(s, i), s.style.zIndex = "100", s.style.willChange = n ? "transform, opacity" : "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.pointerEvents = "none";
|
|
446
446
|
},
|
|
447
447
|
css: (e) => {
|
|
448
448
|
const a = {
|
|
449
449
|
transform: `translate3d(${(1 - e) * 100}%, 0, 0)`
|
|
450
450
|
};
|
|
451
|
-
return
|
|
451
|
+
return n && (a.opacity = e), a;
|
|
452
452
|
}
|
|
453
453
|
})
|
|
454
454
|
};
|
|
@@ -457,8 +457,8 @@ const qt = (t = {}) => {
|
|
|
457
457
|
}, ct = {
|
|
458
458
|
spring: { stiffness: 170, damping: 20, doubleSpring: !0 }
|
|
459
459
|
}, yt = 0, Nt = (t = {}) => {
|
|
460
|
-
const { transitionDelay:
|
|
461
|
-
let { promise:
|
|
460
|
+
const { transitionDelay: n = yt } = t, r = t.physics ?? ct, c = t.physics ?? lt;
|
|
461
|
+
let { promise: s, resolve: i } = E();
|
|
462
462
|
return {
|
|
463
463
|
in: (e) => ({
|
|
464
464
|
physics: r,
|
|
@@ -466,10 +466,10 @@ const qt = (t = {}) => {
|
|
|
466
466
|
e.style.opacity = "0", e.style.willChange = "opacity";
|
|
467
467
|
},
|
|
468
468
|
wait: async () => {
|
|
469
|
-
if (
|
|
470
|
-
await
|
|
469
|
+
if (s) {
|
|
470
|
+
await s;
|
|
471
471
|
const a = E();
|
|
472
|
-
|
|
472
|
+
s = a.promise, i = a.resolve, await _(n);
|
|
473
473
|
}
|
|
474
474
|
},
|
|
475
475
|
css: (a) => ({
|
|
@@ -488,7 +488,7 @@ const qt = (t = {}) => {
|
|
|
488
488
|
g(e, a), e.style.willChange = "opacity";
|
|
489
489
|
},
|
|
490
490
|
onEnd: () => {
|
|
491
|
-
|
|
491
|
+
i && i(), e.style.willChange = "auto";
|
|
492
492
|
}
|
|
493
493
|
})
|
|
494
494
|
};
|
|
@@ -507,10 +507,10 @@ const qt = (t = {}) => {
|
|
|
507
507
|
scaleUp: 0.8
|
|
508
508
|
// Start when translate is 70% complete
|
|
509
509
|
}, pt = 0.8, dt = "white", Gt = (t) => {
|
|
510
|
-
var
|
|
511
|
-
const
|
|
510
|
+
var s;
|
|
511
|
+
const n = ht, r = pt, c = ((s = t == null ? void 0 : t.border) == null ? void 0 : s.color) ?? dt;
|
|
512
512
|
return {
|
|
513
|
-
out: async (
|
|
513
|
+
out: async (i, e) => {
|
|
514
514
|
const a = v(e), l = x(document.body, e.positionedParent), y = ft(c, {
|
|
515
515
|
...a,
|
|
516
516
|
top: l.top
|
|
@@ -518,7 +518,7 @@ const qt = (t = {}) => {
|
|
|
518
518
|
scale: 1,
|
|
519
519
|
translateY: -a.top
|
|
520
520
|
}, h = () => {
|
|
521
|
-
|
|
521
|
+
i.style.transform = `translateY(${o.translateY}px) scale(${o.scale})`;
|
|
522
522
|
const d = (a.width - a.width * o.scale) / 2, u = (a.height - a.height * o.scale) / 2;
|
|
523
523
|
ut(y, d, u);
|
|
524
524
|
};
|
|
@@ -526,7 +526,7 @@ const qt = (t = {}) => {
|
|
|
526
526
|
items: [
|
|
527
527
|
// Spring 1: Scale Down (1 → scale)
|
|
528
528
|
{
|
|
529
|
-
physics: (t == null ? void 0 : t.physics) ?? { spring:
|
|
529
|
+
physics: (t == null ? void 0 : t.physics) ?? { spring: n.scaleDown },
|
|
530
530
|
offset: O.scaleDown,
|
|
531
531
|
tick: (d) => {
|
|
532
532
|
const u = 1 - d;
|
|
@@ -535,7 +535,7 @@ const qt = (t = {}) => {
|
|
|
535
535
|
},
|
|
536
536
|
// Spring 2: Translate (vertical movement)
|
|
537
537
|
{
|
|
538
|
-
physics: (t == null ? void 0 : t.physics) ?? { spring:
|
|
538
|
+
physics: (t == null ? void 0 : t.physics) ?? { spring: n.translate },
|
|
539
539
|
offset: O.translate,
|
|
540
540
|
tick: (d) => {
|
|
541
541
|
const u = 1 - d;
|
|
@@ -544,7 +544,7 @@ const qt = (t = {}) => {
|
|
|
544
544
|
},
|
|
545
545
|
// Spring 3: Scale Up (scale → 1)
|
|
546
546
|
{
|
|
547
|
-
physics: (t == null ? void 0 : t.physics) ?? { spring:
|
|
547
|
+
physics: (t == null ? void 0 : t.physics) ?? { spring: n.scaleUp },
|
|
548
548
|
offset: O.scaleUp,
|
|
549
549
|
tick: (d) => {
|
|
550
550
|
const u = 1 - d;
|
|
@@ -554,30 +554,30 @@ const qt = (t = {}) => {
|
|
|
554
554
|
],
|
|
555
555
|
schedule: "stagger",
|
|
556
556
|
prepare: () => {
|
|
557
|
-
g(
|
|
557
|
+
g(i), m(i, a), I(i, a), gt(i, a);
|
|
558
558
|
for (const d of y)
|
|
559
559
|
e.positionedParent.appendChild(d);
|
|
560
560
|
},
|
|
561
561
|
onEnd: () => {
|
|
562
|
-
|
|
562
|
+
i.style.clipPath = "", i.style.transformOrigin = "", setTimeout(() => {
|
|
563
563
|
for (const d of y)
|
|
564
564
|
e.positionedParent.removeChild(d);
|
|
565
565
|
}, 1e3);
|
|
566
566
|
}
|
|
567
567
|
};
|
|
568
568
|
},
|
|
569
|
-
in: async (
|
|
569
|
+
in: async (i, e) => {
|
|
570
570
|
const a = v(e), l = {
|
|
571
571
|
scale: r,
|
|
572
572
|
translateY: -a.top + a.height
|
|
573
573
|
}, y = () => {
|
|
574
|
-
|
|
574
|
+
i.style.transform = `translateY(${l.translateY}px) scale(${l.scale})`;
|
|
575
575
|
};
|
|
576
576
|
return {
|
|
577
577
|
items: [
|
|
578
578
|
// Spring 1: Scale Down (1 → scale) - element starts scaled, shrinks further
|
|
579
579
|
{
|
|
580
|
-
physics: (t == null ? void 0 : t.physics) ?? { spring:
|
|
580
|
+
physics: (t == null ? void 0 : t.physics) ?? { spring: n.scaleDown },
|
|
581
581
|
offset: O.scaleDown,
|
|
582
582
|
tick: (o) => {
|
|
583
583
|
l.scale = 1 - (1 - r) * o, y();
|
|
@@ -585,7 +585,7 @@ const qt = (t = {}) => {
|
|
|
585
585
|
},
|
|
586
586
|
// Spring 2: Translate (vertical movement from bottom to top)
|
|
587
587
|
{
|
|
588
|
-
physics: (t == null ? void 0 : t.physics) ?? { spring:
|
|
588
|
+
physics: (t == null ? void 0 : t.physics) ?? { spring: n.translate },
|
|
589
589
|
offset: O.translate,
|
|
590
590
|
tick: (o) => {
|
|
591
591
|
l.translateY = -a.top + a.height * (1 - o), y();
|
|
@@ -593,7 +593,7 @@ const qt = (t = {}) => {
|
|
|
593
593
|
},
|
|
594
594
|
// Spring 3: Scale Up (scale → 1) - element returns to full size
|
|
595
595
|
{
|
|
596
|
-
physics: (t == null ? void 0 : t.physics) ?? { spring:
|
|
596
|
+
physics: (t == null ? void 0 : t.physics) ?? { spring: n.scaleUp },
|
|
597
597
|
offset: O.scaleUp,
|
|
598
598
|
tick: (o) => {
|
|
599
599
|
l.scale = r + (1 - r) * o, y();
|
|
@@ -602,104 +602,104 @@ const qt = (t = {}) => {
|
|
|
602
602
|
],
|
|
603
603
|
schedule: "stagger",
|
|
604
604
|
prepare: () => {
|
|
605
|
-
m(
|
|
605
|
+
m(i, a), I(i, a), i.style.transform = `translateY(${-a.top + a.height}px) scale(${r})`;
|
|
606
606
|
},
|
|
607
607
|
onEnd: () => {
|
|
608
|
-
|
|
608
|
+
i.style.clipPath = "", i.style.transformOrigin = "", i.style.transform = "";
|
|
609
609
|
}
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
613
|
};
|
|
614
|
-
function ut(t,
|
|
615
|
-
const c =
|
|
616
|
-
t.topLeft.style.transform = `translate(${c}px, ${
|
|
614
|
+
function ut(t, n, r) {
|
|
615
|
+
const c = n * 0.7, s = r * 0.7;
|
|
616
|
+
t.topLeft.style.transform = `translate(${c}px, ${s}px)`, t.topRight.style.transform = `translate(${-c}px, ${s}px)`, t.bottomLeft.style.transform = `translate(${c}px, ${-s}px)`, t.bottomRight.style.transform = `translate(${-c}px, ${-s}px)`;
|
|
617
617
|
}
|
|
618
|
-
function ft(t = "white",
|
|
619
|
-
const n = document.createElement("div");
|
|
620
|
-
n.style.position = "fixed", n.style.pointerEvents = "none", n.style.zIndex = "9999", n.style.top = `${i.top - 1}px`, n.style.left = `${i.left - 1}px`, n.style.width = "15px", n.style.height = "15px";
|
|
618
|
+
function ft(t = "white", n) {
|
|
621
619
|
const s = document.createElement("div");
|
|
622
|
-
s.style.position = "
|
|
620
|
+
s.style.position = "fixed", s.style.pointerEvents = "none", s.style.zIndex = "9999", s.style.top = `${n.top - 1}px`, s.style.left = `${n.left - 1}px`, s.style.width = "15px", s.style.height = "15px";
|
|
621
|
+
const i = document.createElement("div");
|
|
622
|
+
i.style.position = "absolute", i.style.width = "15px", i.style.height = "1px", i.style.backgroundColor = t, i.style.top = "0", i.style.left = "0";
|
|
623
623
|
const e = document.createElement("div");
|
|
624
|
-
e.style.position = "absolute", e.style.width = "1px", e.style.height = "15px", e.style.backgroundColor = t, e.style.top = "0", e.style.left = "0",
|
|
624
|
+
e.style.position = "absolute", e.style.width = "1px", e.style.height = "15px", e.style.backgroundColor = t, e.style.top = "0", e.style.left = "0", s.appendChild(i), s.appendChild(e);
|
|
625
625
|
const a = document.createElement("div");
|
|
626
|
-
a.style.position = "fixed", a.style.pointerEvents = "none", a.style.zIndex = "9999", a.style.top = `${
|
|
626
|
+
a.style.position = "fixed", a.style.pointerEvents = "none", a.style.zIndex = "9999", a.style.top = `${n.top - 1}px`, a.style.left = `${n.left + n.width - 15 + 1}px`, a.style.width = "15px", a.style.height = "15px";
|
|
627
627
|
const l = document.createElement("div");
|
|
628
628
|
l.style.position = "absolute", l.style.width = "15px", l.style.height = "1px", l.style.backgroundColor = t, l.style.top = "0", l.style.right = "0";
|
|
629
629
|
const y = document.createElement("div");
|
|
630
630
|
y.style.position = "absolute", y.style.width = "1px", y.style.height = "15px", y.style.backgroundColor = t, y.style.top = "0", y.style.right = "0", a.appendChild(l), a.appendChild(y);
|
|
631
631
|
const o = document.createElement("div");
|
|
632
|
-
o.style.position = "fixed", o.style.pointerEvents = "none", o.style.zIndex = "9999", o.style.top = `${
|
|
632
|
+
o.style.position = "fixed", o.style.pointerEvents = "none", o.style.zIndex = "9999", o.style.top = `${n.top + n.height - 15 + 1}px`, o.style.left = `${n.left - 1}px`, o.style.width = "15px", o.style.height = "15px";
|
|
633
633
|
const h = document.createElement("div");
|
|
634
634
|
h.style.position = "absolute", h.style.width = "15px", h.style.height = "1px", h.style.backgroundColor = t, h.style.bottom = "0", h.style.left = "0";
|
|
635
635
|
const d = document.createElement("div");
|
|
636
636
|
d.style.position = "absolute", d.style.width = "1px", d.style.height = "15px", d.style.backgroundColor = t, d.style.bottom = "0", d.style.left = "0", o.appendChild(h), o.appendChild(d);
|
|
637
637
|
const u = document.createElement("div");
|
|
638
|
-
u.style.position = "fixed", u.style.pointerEvents = "none", u.style.zIndex = "9999", u.style.top = `${
|
|
638
|
+
u.style.position = "fixed", u.style.pointerEvents = "none", u.style.zIndex = "9999", u.style.top = `${n.top + n.height - 15 + 1}px`, u.style.left = `${n.left + n.width - 15 + 1}px`, u.style.width = "15px", u.style.height = "15px";
|
|
639
639
|
const f = document.createElement("div");
|
|
640
640
|
f.style.position = "absolute", f.style.width = "15px", f.style.height = "1px", f.style.backgroundColor = t, f.style.bottom = "0", f.style.right = "0";
|
|
641
641
|
const p = document.createElement("div");
|
|
642
642
|
return p.style.position = "absolute", p.style.width = "1px", p.style.height = "15px", p.style.backgroundColor = t, p.style.bottom = "0", p.style.right = "0", u.appendChild(f), u.appendChild(p), {
|
|
643
|
-
topLeft:
|
|
643
|
+
topLeft: s,
|
|
644
644
|
topRight: a,
|
|
645
645
|
bottomLeft: o,
|
|
646
646
|
bottomRight: u,
|
|
647
647
|
*[Symbol.iterator]() {
|
|
648
|
-
yield
|
|
648
|
+
yield s, yield a, yield o, yield u;
|
|
649
649
|
}
|
|
650
650
|
};
|
|
651
651
|
}
|
|
652
652
|
function v(t) {
|
|
653
|
-
const
|
|
653
|
+
const n = x(document.body, t.positionedParent);
|
|
654
654
|
return {
|
|
655
655
|
top: t.scroll.y,
|
|
656
656
|
left: 0,
|
|
657
|
-
width:
|
|
658
|
-
height: window.innerHeight -
|
|
657
|
+
width: n.width,
|
|
658
|
+
height: window.innerHeight - n.top
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
|
-
function m(t,
|
|
662
|
-
const r =
|
|
661
|
+
function m(t, n) {
|
|
662
|
+
const r = n.left + n.width / 2, c = n.top + n.height / 2;
|
|
663
663
|
t.style.transformOrigin = `${r}px ${c}px`;
|
|
664
664
|
}
|
|
665
|
-
function I(t,
|
|
665
|
+
function I(t, n) {
|
|
666
666
|
t.style.clipPath = `polygon(
|
|
667
|
-
${
|
|
668
|
-
${
|
|
669
|
-
${
|
|
670
|
-
${
|
|
667
|
+
${n.left}px ${n.top}px,
|
|
668
|
+
${n.left + n.width}px ${n.top}px,
|
|
669
|
+
${n.left + n.width}px ${n.top + n.height}px,
|
|
670
|
+
${n.left}px ${n.top + n.height}px
|
|
671
671
|
)`;
|
|
672
672
|
}
|
|
673
|
-
function gt(t,
|
|
674
|
-
t.style.transform = `translateY(${-
|
|
673
|
+
function gt(t, n) {
|
|
674
|
+
t.style.transform = `translateY(${-n.top}px)`;
|
|
675
675
|
}
|
|
676
676
|
const wt = {
|
|
677
677
|
spring: { stiffness: 300, damping: 30 }
|
|
678
678
|
};
|
|
679
|
-
function $t(t,
|
|
680
|
-
return t.querySelector(`[data-hero-key="${
|
|
679
|
+
function $t(t, n) {
|
|
680
|
+
return t.querySelector(`[data-hero-key="${n}"]`);
|
|
681
681
|
}
|
|
682
682
|
const Zt = (t = {}) => {
|
|
683
|
-
const
|
|
684
|
-
let c = null,
|
|
683
|
+
const n = t.physics ?? wt, r = t.maxDistance ?? 700;
|
|
684
|
+
let c = null, s = E();
|
|
685
685
|
return {
|
|
686
|
-
in: async (
|
|
687
|
-
const a =
|
|
688
|
-
await
|
|
686
|
+
in: async (i, e) => {
|
|
687
|
+
const a = i, l = Array.from(a.querySelectorAll("[data-hero-key]"));
|
|
688
|
+
await s.promise;
|
|
689
689
|
const y = l.map((o) => {
|
|
690
690
|
const h = o.getAttribute("data-hero-key");
|
|
691
691
|
if (!h) return null;
|
|
692
692
|
const d = $t(c, h);
|
|
693
693
|
if (!d) return null;
|
|
694
|
-
const u = o, f = x(c, d), p = x(a, u), $ = f.left - p.left - e.scrollOffset.x, w = f.top - p.top - e.scrollOffset.y, b = f.width / p.width, C = f.height / p.height,
|
|
694
|
+
const u = o, f = x(c, d), p = x(a, u), $ = f.left - p.left - e.scrollOffset.x, w = f.top - p.top - e.scrollOffset.y, b = f.width / p.width, C = f.height / p.height, Y = u.style.transform, D = u.style.position, F = u.style.transformOrigin, U = u.style.zIndex, V = u.style.willChange;
|
|
695
695
|
return {
|
|
696
696
|
toEl: u,
|
|
697
697
|
dx: $,
|
|
698
698
|
dy: w,
|
|
699
699
|
dw: b,
|
|
700
700
|
dh: C,
|
|
701
|
-
originalTransform:
|
|
702
|
-
originalPosition:
|
|
701
|
+
originalTransform: Y,
|
|
702
|
+
originalPosition: D,
|
|
703
703
|
originalTransformOrigin: F,
|
|
704
704
|
originalZIndex: U,
|
|
705
705
|
originalWillChange: V
|
|
@@ -707,14 +707,14 @@ const Zt = (t = {}) => {
|
|
|
707
707
|
}).filter(
|
|
708
708
|
(o) => o !== null && Math.abs(o.dy) <= r
|
|
709
709
|
);
|
|
710
|
-
return c = null,
|
|
711
|
-
physics:
|
|
710
|
+
return c = null, s = E(), y.length === 0 ? {
|
|
711
|
+
physics: n,
|
|
712
712
|
tick: () => {
|
|
713
713
|
}
|
|
714
714
|
// No matching hero elements
|
|
715
715
|
} : {
|
|
716
716
|
items: y.map(({ toEl: o, dx: h, dy: d, dw: u, dh: f }) => ({
|
|
717
|
-
physics:
|
|
717
|
+
physics: n,
|
|
718
718
|
tick: (p) => {
|
|
719
719
|
o.style.transform = `translate(${(1 - p) * h}px, ${(1 - p) * d}px) scale(${p + (1 - p) * u}, ${p + (1 - p) * f})`;
|
|
720
720
|
}
|
|
@@ -741,89 +741,89 @@ const Zt = (t = {}) => {
|
|
|
741
741
|
}
|
|
742
742
|
};
|
|
743
743
|
},
|
|
744
|
-
out: async (
|
|
745
|
-
physics:
|
|
744
|
+
out: async (i) => ({
|
|
745
|
+
physics: n,
|
|
746
746
|
tick: () => {
|
|
747
747
|
},
|
|
748
748
|
prepare: () => {
|
|
749
|
-
c =
|
|
749
|
+
c = i, s.resolve(), g(i), i.style.opacity = "0";
|
|
750
750
|
}
|
|
751
751
|
})
|
|
752
752
|
};
|
|
753
753
|
}, bt = {
|
|
754
|
-
spring: { stiffness:
|
|
754
|
+
spring: { stiffness: 220, damping: 24, doubleSpring: 1 }
|
|
755
755
|
};
|
|
756
756
|
function xt({
|
|
757
757
|
detailRect: t,
|
|
758
|
-
galleryRect:
|
|
758
|
+
galleryRect: n,
|
|
759
759
|
pageRect: r,
|
|
760
760
|
scrollOffset: c
|
|
761
761
|
}) {
|
|
762
|
-
const
|
|
762
|
+
const s = n.left - t.left + (n.width - t.width) / 2 - c.x, i = n.top - t.top + (n.height - t.height) / 2 - c.y, e = n.width / t.width, a = n.height / t.height, l = Math.max(e, a), y = t.top / r.height * 100, o = (r.width - (t.left + t.width)) / r.width * 100, h = (r.height - (t.top + t.height)) / r.height * 100, d = t.left / r.width * 100;
|
|
763
763
|
return {
|
|
764
764
|
transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
|
|
765
765
|
animate: (f) => {
|
|
766
766
|
const p = 1 - f;
|
|
767
767
|
return {
|
|
768
768
|
clipPath: `inset(${y * p}% ${o * p}% ${h * p}% ${d * p}%)`,
|
|
769
|
-
transform: `translate(${
|
|
769
|
+
transform: `translate(${s * p}px, ${i * p}px) scale(${1 + (l - 1) * p})`
|
|
770
770
|
};
|
|
771
771
|
}
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
774
|
function Et({
|
|
775
775
|
detailRect: t,
|
|
776
|
-
galleryRect:
|
|
776
|
+
galleryRect: n,
|
|
777
777
|
pageRect: r,
|
|
778
778
|
scrollOffset: c
|
|
779
779
|
}) {
|
|
780
|
-
const
|
|
780
|
+
const s = n.left - t.left + (n.width - t.width) / 2 + c.x, i = n.top - t.top + (n.height - t.height) / 2 + c.y, e = n.width / t.width, a = n.height / t.height, l = Math.min(e, a), y = t.top / r.height * 100, o = (r.width - (t.left + t.width)) / r.width * 100, h = (r.height - (t.top + t.height)) / r.height * 100, d = t.left / r.width * 100;
|
|
781
781
|
return {
|
|
782
782
|
transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
|
|
783
783
|
animate: (f) => {
|
|
784
784
|
const p = 1 - f;
|
|
785
785
|
return {
|
|
786
786
|
clipPath: `inset(${y * p}% ${o * p}% ${h * p}% ${d * p}%)`,
|
|
787
|
-
transform: `translate(${
|
|
787
|
+
transform: `translate(${s * p - c.x}px, ${i * p - c.y}px) scale(${1 + (l - 1) * p})`
|
|
788
788
|
};
|
|
789
789
|
}
|
|
790
790
|
};
|
|
791
791
|
}
|
|
792
|
-
function Ct(t,
|
|
792
|
+
function Ct(t, n, r) {
|
|
793
793
|
const c = t.querySelector(
|
|
794
794
|
"[data-instagram-detail-key]"
|
|
795
|
-
),
|
|
795
|
+
), s = n.querySelector(
|
|
796
796
|
"[data-instagram-detail-key]"
|
|
797
797
|
);
|
|
798
|
-
if (t.querySelectorAll("[data-instagram-detail-key]").length > 1 ||
|
|
798
|
+
if (t.querySelectorAll("[data-instagram-detail-key]").length > 1 || n.querySelectorAll("[data-instagram-detail-key]").length > 1)
|
|
799
799
|
return null;
|
|
800
|
-
let
|
|
801
|
-
if (!c &&
|
|
802
|
-
e =
|
|
800
|
+
let i = null, e = null, a = !1;
|
|
801
|
+
if (!c && s) {
|
|
802
|
+
e = s;
|
|
803
803
|
const o = e.getAttribute("data-instagram-detail-key");
|
|
804
804
|
if (!o) return null;
|
|
805
|
-
|
|
805
|
+
i = t.querySelector(
|
|
806
806
|
`[data-instagram-gallery-key="${o}"]`
|
|
807
|
-
),
|
|
808
|
-
} else if (c && !
|
|
807
|
+
), i && (a = !0);
|
|
808
|
+
} else if (c && !s) {
|
|
809
809
|
e = c;
|
|
810
810
|
const o = e.getAttribute("data-instagram-detail-key");
|
|
811
811
|
if (!o) return null;
|
|
812
|
-
|
|
812
|
+
i = n.querySelector(
|
|
813
813
|
`[data-instagram-gallery-key="${o}"]`
|
|
814
|
-
),
|
|
814
|
+
), i && (a = !1);
|
|
815
815
|
}
|
|
816
|
-
if (!
|
|
816
|
+
if (!i || !e)
|
|
817
817
|
return null;
|
|
818
|
-
const l = x(a ? t :
|
|
818
|
+
const l = x(a ? t : n, i), y = x(a ? n : t, e);
|
|
819
819
|
if (a) {
|
|
820
820
|
const o = xt({
|
|
821
821
|
detailRect: y,
|
|
822
822
|
galleryRect: l,
|
|
823
|
-
pageRect:
|
|
823
|
+
pageRect: n.getBoundingClientRect(),
|
|
824
824
|
scrollOffset: r
|
|
825
825
|
});
|
|
826
|
-
return
|
|
826
|
+
return n.style.transformOrigin = o.transformOrigin, {
|
|
827
827
|
isEnterMode: !0,
|
|
828
828
|
inAnimation: o.animate
|
|
829
829
|
// No outAnimation - gallery stays visible
|
|
@@ -843,23 +843,23 @@ function Ct(t, i, r) {
|
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
const Jt = (t = {}) => {
|
|
846
|
-
const
|
|
847
|
-
let c = null,
|
|
846
|
+
const n = t.physics ?? bt, r = t.timeout ?? 300;
|
|
847
|
+
let c = null, s = null, i = null, e = null;
|
|
848
848
|
return {
|
|
849
849
|
in: async (a, { scrollOffset: l }) => {
|
|
850
850
|
const y = a;
|
|
851
851
|
return !await new Promise((h) => {
|
|
852
|
-
c ? h(!0) : (
|
|
853
|
-
|
|
852
|
+
c ? h(!0) : (s = h, setTimeout(() => {
|
|
853
|
+
s = null, h(!1);
|
|
854
854
|
}, r));
|
|
855
855
|
}) || !c ? (e == null || e(), e = null, c = null, {
|
|
856
|
-
physics:
|
|
856
|
+
physics: n,
|
|
857
857
|
css: () => ({})
|
|
858
|
-
}) : (
|
|
859
|
-
physics:
|
|
860
|
-
css: (h) =>
|
|
858
|
+
}) : (i = Ct(c, y, l), e == null || e(), e = null, i ? (c = null, {
|
|
859
|
+
physics: n,
|
|
860
|
+
css: (h) => i != null && i.inAnimation ? i.inAnimation(h) : {}
|
|
861
861
|
}) : (c = null, {
|
|
862
|
-
physics:
|
|
862
|
+
physics: n,
|
|
863
863
|
css: () => ({})
|
|
864
864
|
}));
|
|
865
865
|
},
|
|
@@ -868,14 +868,14 @@ const Jt = (t = {}) => {
|
|
|
868
868
|
e = o;
|
|
869
869
|
});
|
|
870
870
|
return {
|
|
871
|
-
physics:
|
|
871
|
+
physics: n,
|
|
872
872
|
prepare: () => {
|
|
873
|
-
|
|
873
|
+
i != null && i.isEnterMode ? g(a) : (g(a, l), a.style.zIndex = "-1");
|
|
874
874
|
},
|
|
875
875
|
wait: async () => {
|
|
876
|
-
c = a,
|
|
876
|
+
c = a, s && (s(!0), s = null), await y;
|
|
877
877
|
},
|
|
878
|
-
css: (o) =>
|
|
878
|
+
css: (o) => i != null && i.outAnimation ? i.outAnimation(o) : {}
|
|
879
879
|
};
|
|
880
880
|
}
|
|
881
881
|
};
|
|
@@ -883,19 +883,19 @@ const Jt = (t = {}) => {
|
|
|
883
883
|
spring: { stiffness: 50, damping: 30 }
|
|
884
884
|
};
|
|
885
885
|
function St(t) {
|
|
886
|
-
const
|
|
886
|
+
const n = x(document.body, t.positionedParent);
|
|
887
887
|
return {
|
|
888
888
|
top: t.scroll.y,
|
|
889
889
|
left: 0,
|
|
890
|
-
width:
|
|
891
|
-
height: window.innerHeight -
|
|
890
|
+
width: n.width,
|
|
891
|
+
height: window.innerHeight - n.top
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
894
|
const Kt = (t = {}) => {
|
|
895
|
-
const
|
|
895
|
+
const n = t.physics ?? Ot, r = t.initialRotation ?? 45, c = t.initialScale ?? 0.01, s = t.rotationTriggerPoint ?? 0.8;
|
|
896
896
|
return {
|
|
897
|
-
out: async (
|
|
898
|
-
const a =
|
|
897
|
+
out: async (i, e) => {
|
|
898
|
+
const a = i.style.opacity;
|
|
899
899
|
return {
|
|
900
900
|
physics: {
|
|
901
901
|
spring: {
|
|
@@ -906,40 +906,40 @@ const Kt = (t = {}) => {
|
|
|
906
906
|
from: 1,
|
|
907
907
|
to: 0,
|
|
908
908
|
prepare: () => {
|
|
909
|
-
g(
|
|
909
|
+
g(i, e), i.style.opacity = "1";
|
|
910
910
|
},
|
|
911
911
|
tick: (l) => {
|
|
912
|
-
|
|
912
|
+
i.style.opacity = String(l);
|
|
913
913
|
},
|
|
914
914
|
onEnd: () => {
|
|
915
|
-
|
|
915
|
+
i.style.opacity = a;
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
918
|
},
|
|
919
|
-
in: async (
|
|
920
|
-
const a = St(e), l =
|
|
919
|
+
in: async (i, e) => {
|
|
920
|
+
const a = St(e), l = i.style.transform, y = i.style.transformOrigin, o = i.style.position, h = i.style.zIndex;
|
|
921
921
|
return {
|
|
922
|
-
physics:
|
|
922
|
+
physics: n,
|
|
923
923
|
from: 0,
|
|
924
924
|
to: 1,
|
|
925
925
|
prepare: () => {
|
|
926
926
|
const d = Math.min(a.width, a.height) * 0.4;
|
|
927
|
-
|
|
927
|
+
i.style.setProperty(
|
|
928
928
|
"--max-border-radius",
|
|
929
929
|
`${d}px`
|
|
930
|
-
),
|
|
930
|
+
), i.style.setProperty("--border-radius-scale", "1"), i.style.willChange = "transform", i.style.backfaceVisibility = "hidden";
|
|
931
931
|
const u = a.left + a.width / 2, f = a.top + a.height / 2;
|
|
932
|
-
|
|
932
|
+
i.style.transformOrigin = `${u}px ${f}px`, i.style.position = "fixed", i.style.top = `${a.top}px`, i.style.left = `${a.left}px`, i.style.width = `${a.width}px`, i.style.height = `${a.height}px`, i.style.zIndex = "1000", i.style.overflow = "hidden", i.style.transform = `rotate(${r}deg) scale(${c}) translateZ(0)`, i.style.borderRadius = "calc(var(--max-border-radius) * var(--border-radius-scale))", i.style.opacity = "1";
|
|
933
933
|
},
|
|
934
934
|
tick: (d) => {
|
|
935
935
|
let u;
|
|
936
936
|
if (d <= 0.05)
|
|
937
937
|
u = c;
|
|
938
|
-
else if (d <=
|
|
939
|
-
const w = (d - 0.05) / (
|
|
938
|
+
else if (d <= s) {
|
|
939
|
+
const w = (d - 0.05) / (s - 0.05), b = Math.pow(w, 9);
|
|
940
940
|
u = c + (0.8 - c) * b;
|
|
941
941
|
} else {
|
|
942
|
-
const w = (d -
|
|
942
|
+
const w = (d - s) / (1 - s);
|
|
943
943
|
u = 0.8 + 0.2 * (1 - Math.pow(1 - w, 3));
|
|
944
944
|
}
|
|
945
945
|
let f;
|
|
@@ -957,50 +957,50 @@ const Kt = (t = {}) => {
|
|
|
957
957
|
const w = (d - p) / (1 - p);
|
|
958
958
|
$ = 1 - Math.pow(w, 0.5);
|
|
959
959
|
}
|
|
960
|
-
|
|
960
|
+
i.style.transform = `rotate(${f.toFixed(2)}deg) scale(${u.toFixed(4)}) translateZ(0)`, i.style.setProperty(
|
|
961
961
|
"--border-radius-scale",
|
|
962
962
|
$.toFixed(4)
|
|
963
963
|
);
|
|
964
964
|
},
|
|
965
965
|
onEnd: () => {
|
|
966
|
-
|
|
966
|
+
i.style.willChange = "", i.style.backfaceVisibility = "", i.style.removeProperty("--max-border-radius"), i.style.removeProperty("--border-radius-scale"), i.style.transform = l, i.style.transformOrigin = y, i.style.position = o, i.style.zIndex = h, i.style.top = "", i.style.left = "", i.style.width = "", i.style.height = "", i.style.overflow = "", i.style.borderRadius = "";
|
|
967
967
|
}
|
|
968
968
|
};
|
|
969
969
|
}
|
|
970
970
|
};
|
|
971
971
|
}, At = {
|
|
972
|
-
spring: { stiffness:
|
|
972
|
+
spring: { stiffness: 220, damping: 24, doubleSpring: 1 }
|
|
973
973
|
};
|
|
974
974
|
function Tt({
|
|
975
975
|
detailRect: t,
|
|
976
|
-
galleryRect:
|
|
976
|
+
galleryRect: n,
|
|
977
977
|
pageRect: r,
|
|
978
978
|
scrollOffset: c
|
|
979
979
|
}) {
|
|
980
|
-
const
|
|
980
|
+
const s = n.left - t.left + (n.width - t.width) / 2 - c.x, i = n.top - t.top + (n.height - t.height) / 2 - c.y, e = n.width / t.width, a = n.height / t.height, l = Math.max(e, a), y = t.top / r.height * 100, o = (r.width - (t.left + t.width)) / r.width * 100, h = (r.height - (t.top + t.height)) / r.height * 100, d = t.left / r.width * 100;
|
|
981
981
|
return {
|
|
982
982
|
transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
|
|
983
983
|
animate: (f) => {
|
|
984
984
|
const p = 1 - f;
|
|
985
985
|
return {
|
|
986
986
|
clipPath: `inset(${y * p}% ${o * p}% ${h * p}% ${d * p}%)`,
|
|
987
|
-
transform: `translate(${
|
|
987
|
+
transform: `translate(${s * p}px, ${i * p}px) scale(${1 + (l - 1) * p})`
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
991
|
}
|
|
992
992
|
function Lt({
|
|
993
993
|
galleryRect: t,
|
|
994
|
-
detailRect:
|
|
994
|
+
detailRect: n,
|
|
995
995
|
scrollOffset: r
|
|
996
996
|
}) {
|
|
997
|
-
const c =
|
|
997
|
+
const c = n.left - t.left + (n.width - t.width) / 2 + r.x, s = n.top - t.top + (n.height - t.height) / 2 + r.y, i = n.width / t.width, e = n.height / t.height, a = Math.max(i, e);
|
|
998
998
|
return {
|
|
999
999
|
transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
|
|
1000
1000
|
animate: (y) => {
|
|
1001
1001
|
const o = 1 - y;
|
|
1002
1002
|
return {
|
|
1003
|
-
transform: `translate(${c * o - r.x}px, ${
|
|
1003
|
+
transform: `translate(${c * o - r.x}px, ${s * o - r.y}px) scale(${1 + (a - 1) * o})`,
|
|
1004
1004
|
opacity: `${1 - o}`
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
@@ -1008,16 +1008,16 @@ function Lt({
|
|
|
1008
1008
|
}
|
|
1009
1009
|
function Pt({
|
|
1010
1010
|
galleryRect: t,
|
|
1011
|
-
detailRect:
|
|
1011
|
+
detailRect: n,
|
|
1012
1012
|
scrollOffset: r
|
|
1013
1013
|
}) {
|
|
1014
|
-
const c =
|
|
1014
|
+
const c = n.left - t.left + (n.width - t.width) / 2 - r.x, s = n.top - t.top + (n.height - t.height) / 2 - r.y, i = n.width / t.width, e = n.height / t.height, a = Math.max(i, e);
|
|
1015
1015
|
return {
|
|
1016
1016
|
transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
|
|
1017
1017
|
animate: (y) => {
|
|
1018
1018
|
const o = 1 - y, h = y;
|
|
1019
1019
|
return {
|
|
1020
|
-
transform: `translate(${c * o}px, ${
|
|
1020
|
+
transform: `translate(${c * o}px, ${s * o}px) scale(${1 + (a - 1) * o})`,
|
|
1021
1021
|
opacity: `${h}`
|
|
1022
1022
|
};
|
|
1023
1023
|
}
|
|
@@ -1025,61 +1025,61 @@ function Pt({
|
|
|
1025
1025
|
}
|
|
1026
1026
|
function kt({
|
|
1027
1027
|
detailRect: t,
|
|
1028
|
-
galleryRect:
|
|
1028
|
+
galleryRect: n,
|
|
1029
1029
|
pageRect: r,
|
|
1030
1030
|
scrollOffset: c
|
|
1031
1031
|
}) {
|
|
1032
|
-
const
|
|
1032
|
+
const s = n.left - t.left + (n.width - t.width) / 2 + c.x, i = n.top - t.top + (n.height - t.height) / 2 + c.y, e = n.width / t.width, a = n.height / t.height, l = Math.min(e, a), y = t.top / r.height * 100, o = (r.width - (t.left + t.width)) / r.width * 100, h = (r.height - (t.top + t.height)) / r.height * 100, d = t.left / r.width * 100;
|
|
1033
1033
|
return {
|
|
1034
1034
|
transformOrigin: `${t.left + t.width / 2}px ${t.top + t.height / 2}px`,
|
|
1035
1035
|
animate: (f) => {
|
|
1036
1036
|
const p = 1 - f;
|
|
1037
1037
|
return {
|
|
1038
1038
|
clipPath: `inset(${y * p}% ${o * p}% ${h * p}% ${d * p}%)`,
|
|
1039
|
-
transform: `translate(${
|
|
1039
|
+
transform: `translate(${s * p - c.x}px, ${i * p - c.y}px) scale(${1 + (l - 1) * p})`
|
|
1040
1040
|
};
|
|
1041
1041
|
}
|
|
1042
1042
|
};
|
|
1043
1043
|
}
|
|
1044
|
-
function vt(t,
|
|
1044
|
+
function vt(t, n, r) {
|
|
1045
1045
|
const c = t.querySelector(
|
|
1046
1046
|
"[data-pinterest-detail-key]"
|
|
1047
|
-
),
|
|
1047
|
+
), s = n.querySelector(
|
|
1048
1048
|
"[data-pinterest-detail-key]"
|
|
1049
1049
|
);
|
|
1050
|
-
if (t.querySelectorAll("[data-pinterest-detail-key]").length > 1 ||
|
|
1050
|
+
if (t.querySelectorAll("[data-pinterest-detail-key]").length > 1 || n.querySelectorAll("[data-pinterest-detail-key]").length > 1)
|
|
1051
1051
|
return null;
|
|
1052
|
-
let
|
|
1053
|
-
if (!c &&
|
|
1054
|
-
e =
|
|
1052
|
+
let i = null, e = null, a = !1;
|
|
1053
|
+
if (!c && s) {
|
|
1054
|
+
e = s;
|
|
1055
1055
|
const o = e.getAttribute("data-pinterest-detail-key");
|
|
1056
1056
|
if (!o) return null;
|
|
1057
|
-
|
|
1057
|
+
i = t.querySelector(
|
|
1058
1058
|
`[data-pinterest-gallery-key="${o}"]`
|
|
1059
|
-
),
|
|
1060
|
-
} else if (c && !
|
|
1059
|
+
), i && (a = !0);
|
|
1060
|
+
} else if (c && !s) {
|
|
1061
1061
|
e = c;
|
|
1062
1062
|
const o = e.getAttribute("data-pinterest-detail-key");
|
|
1063
1063
|
if (!o) return null;
|
|
1064
|
-
|
|
1064
|
+
i = n.querySelector(
|
|
1065
1065
|
`[data-pinterest-gallery-key="${o}"]`
|
|
1066
|
-
),
|
|
1066
|
+
), i && (a = !1);
|
|
1067
1067
|
}
|
|
1068
|
-
if (!
|
|
1068
|
+
if (!i || !e)
|
|
1069
1069
|
return null;
|
|
1070
|
-
const l = x(a ? t :
|
|
1070
|
+
const l = x(a ? t : n, i), y = x(a ? n : t, e);
|
|
1071
1071
|
if (a) {
|
|
1072
1072
|
const o = Tt({
|
|
1073
1073
|
detailRect: y,
|
|
1074
1074
|
galleryRect: l,
|
|
1075
|
-
pageRect:
|
|
1075
|
+
pageRect: n.getBoundingClientRect(),
|
|
1076
1076
|
scrollOffset: r
|
|
1077
1077
|
}), h = Lt({
|
|
1078
1078
|
galleryRect: l,
|
|
1079
1079
|
detailRect: y,
|
|
1080
1080
|
scrollOffset: r
|
|
1081
1081
|
});
|
|
1082
|
-
return
|
|
1082
|
+
return n.style.transformOrigin = o.transformOrigin, t.style.transformOrigin = h.transformOrigin, {
|
|
1083
1083
|
inAnimation: o.animate,
|
|
1084
1084
|
outAnimation: h.animate
|
|
1085
1085
|
};
|
|
@@ -1094,30 +1094,30 @@ function vt(t, i, r) {
|
|
|
1094
1094
|
pageRect: t.getBoundingClientRect(),
|
|
1095
1095
|
scrollOffset: r
|
|
1096
1096
|
});
|
|
1097
|
-
return
|
|
1097
|
+
return n.style.transformOrigin = o.transformOrigin, t.style.transformOrigin = h.transformOrigin, {
|
|
1098
1098
|
inAnimation: o.animate,
|
|
1099
1099
|
outAnimation: h.animate
|
|
1100
1100
|
};
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
const Qt = (t = {}) => {
|
|
1104
|
-
const
|
|
1105
|
-
let c = null,
|
|
1104
|
+
const n = t.physics ?? At, r = t.timeout ?? 300;
|
|
1105
|
+
let c = null, s = null, i = null, e = null;
|
|
1106
1106
|
return {
|
|
1107
1107
|
in: async (a, { scrollOffset: l }) => {
|
|
1108
1108
|
const y = a;
|
|
1109
1109
|
return !await new Promise((h) => {
|
|
1110
|
-
c ? h(!0) : (
|
|
1111
|
-
|
|
1110
|
+
c ? h(!0) : (s = h, setTimeout(() => {
|
|
1111
|
+
s = null, h(!1);
|
|
1112
1112
|
}, r));
|
|
1113
1113
|
}) || !c ? (e == null || e(), e = null, c = null, {
|
|
1114
|
-
physics:
|
|
1114
|
+
physics: n,
|
|
1115
1115
|
css: () => ({})
|
|
1116
|
-
}) : (
|
|
1117
|
-
physics:
|
|
1118
|
-
css: (h) =>
|
|
1116
|
+
}) : (i = vt(c, y, l), e == null || e(), e = null, i ? (c = null, {
|
|
1117
|
+
physics: n,
|
|
1118
|
+
css: (h) => i ? i.inAnimation(h) : {}
|
|
1119
1119
|
}) : (c = null, {
|
|
1120
|
-
physics:
|
|
1120
|
+
physics: n,
|
|
1121
1121
|
css: () => ({})
|
|
1122
1122
|
}));
|
|
1123
1123
|
},
|
|
@@ -1126,24 +1126,24 @@ const Qt = (t = {}) => {
|
|
|
1126
1126
|
e = y;
|
|
1127
1127
|
});
|
|
1128
1128
|
return {
|
|
1129
|
-
physics:
|
|
1129
|
+
physics: n,
|
|
1130
1130
|
prepare: () => {
|
|
1131
|
-
g(a), a.style.zIndex = "-1", c = a,
|
|
1131
|
+
g(a), a.style.zIndex = "-1", c = a, s && (s(!0), s = null);
|
|
1132
1132
|
},
|
|
1133
1133
|
wait: async () => {
|
|
1134
1134
|
await l;
|
|
1135
1135
|
},
|
|
1136
|
-
css: (y) =>
|
|
1136
|
+
css: (y) => i ? i.outAnimation(y) : {}
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
};
|
|
1140
1140
|
}, mt = {
|
|
1141
1141
|
spring: { stiffness: 100, damping: 30 }
|
|
1142
1142
|
}, Rt = (t = {}) => {
|
|
1143
|
-
const
|
|
1143
|
+
const n = t.physics ?? mt;
|
|
1144
1144
|
return {
|
|
1145
1145
|
in: (r) => ({
|
|
1146
|
-
physics:
|
|
1146
|
+
physics: n,
|
|
1147
1147
|
prepare: () => {
|
|
1148
1148
|
r.style.opacity = "0", r.style.transform = "rotate(-180deg)", r.style.transformOrigin = "center center", r.style.willChange = "transform, opacity";
|
|
1149
1149
|
},
|
|
@@ -1157,14 +1157,14 @@ const Qt = (t = {}) => {
|
|
|
1157
1157
|
}
|
|
1158
1158
|
}),
|
|
1159
1159
|
out: (r, c) => ({
|
|
1160
|
-
physics:
|
|
1160
|
+
physics: n,
|
|
1161
1161
|
prepare: () => {
|
|
1162
1162
|
g(r, c), r.style.transformOrigin = "center center", r.style.willChange = "transform, opacity";
|
|
1163
1163
|
},
|
|
1164
|
-
css: (
|
|
1164
|
+
css: (s) => ({
|
|
1165
1165
|
// 0deg → 180deg, hide after 90deg (progress < 0.5)
|
|
1166
|
-
transform: `rotate(${(1 -
|
|
1167
|
-
opacity:
|
|
1166
|
+
transform: `rotate(${(1 - s) * 180}deg)`,
|
|
1167
|
+
opacity: s > 0.5 ? 1 : 0
|
|
1168
1168
|
}),
|
|
1169
1169
|
onEnd: () => {
|
|
1170
1170
|
r.style.willChange = "auto";
|
|
@@ -1174,16 +1174,16 @@ const Qt = (t = {}) => {
|
|
|
1174
1174
|
}, It = {
|
|
1175
1175
|
spring: { stiffness: 5, damping: 4 }
|
|
1176
1176
|
}, ts = (t = {}) => {
|
|
1177
|
-
const
|
|
1178
|
-
let
|
|
1177
|
+
const n = t.direction ?? "up", r = t.physics ?? It, c = n === "up";
|
|
1178
|
+
let s = null, i = null, e = null;
|
|
1179
1179
|
const a = () => {
|
|
1180
|
-
if (
|
|
1180
|
+
if (s === null || i === null)
|
|
1181
1181
|
return null;
|
|
1182
|
-
const l = Math.min(
|
|
1182
|
+
const l = Math.min(s, i), y = window.innerHeight;
|
|
1183
1183
|
return Math.max(l, y);
|
|
1184
1184
|
};
|
|
1185
1185
|
return {
|
|
1186
|
-
in: (l) => (
|
|
1186
|
+
in: (l) => (i = l.offsetHeight, s !== null && (e = a()), {
|
|
1187
1187
|
physics: r,
|
|
1188
1188
|
prepare: () => {
|
|
1189
1189
|
l.style.willChange = "transform", l.style.backfaceVisibility = "hidden", l.style.contain = "layout paint";
|
|
@@ -1205,56 +1205,60 @@ const Qt = (t = {}) => {
|
|
|
1205
1205
|
l.style.transform = `translate3d(0, ${d}px, 0)`;
|
|
1206
1206
|
},
|
|
1207
1207
|
prepare: () => {
|
|
1208
|
-
|
|
1208
|
+
s = l.offsetHeight, i !== null && (e = a()), g(l, y), l.style.zIndex = c ? "-1" : "1", l.style.willChange = "transform", l.style.backfaceVisibility = "hidden", l.style.contain = "layout paint", l.style.pointerEvents = "none";
|
|
1209
1209
|
}
|
|
1210
1210
|
})
|
|
1211
1211
|
};
|
|
1212
1212
|
}, _t = {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1213
|
+
spring: {
|
|
1214
|
+
stiffness: 200,
|
|
1215
|
+
damping: 24
|
|
1216
1216
|
}
|
|
1217
|
-
},
|
|
1217
|
+
}, Yt = {
|
|
1218
1218
|
inertia: {
|
|
1219
|
-
acceleration:
|
|
1220
|
-
resistance: 1
|
|
1219
|
+
acceleration: 25,
|
|
1220
|
+
resistance: 1.2
|
|
1221
1221
|
}
|
|
1222
|
-
},
|
|
1222
|
+
}, Dt = 0.2;
|
|
1223
1223
|
function T(t) {
|
|
1224
|
-
const
|
|
1225
|
-
return {
|
|
1224
|
+
const n = x(document.body, t.positionedParent), r = t.scroll.y, c = t.scrollingElement.offsetHeight - n.top, s = {
|
|
1226
1225
|
top: r,
|
|
1227
1226
|
left: 0,
|
|
1228
|
-
width:
|
|
1227
|
+
width: n.width,
|
|
1229
1228
|
height: c
|
|
1230
1229
|
};
|
|
1230
|
+
return {
|
|
1231
|
+
...s,
|
|
1232
|
+
centerX: s.left + s.width / 2,
|
|
1233
|
+
centerY: s.top + s.height / 2
|
|
1234
|
+
};
|
|
1231
1235
|
}
|
|
1232
1236
|
const ss = (t = {}) => {
|
|
1233
|
-
const { direction:
|
|
1234
|
-
return
|
|
1237
|
+
const { direction: n = "enter" } = t, r = t.physics ?? (n === "enter" ? _t : Yt), c = t.scaleOffset ?? Dt;
|
|
1238
|
+
return n === "enter" ? {
|
|
1235
1239
|
// Entering sheet: slides up from bottom
|
|
1236
|
-
in: (
|
|
1237
|
-
const
|
|
1240
|
+
in: (s, i) => {
|
|
1241
|
+
const e = T(i);
|
|
1238
1242
|
return {
|
|
1239
1243
|
physics: r,
|
|
1240
1244
|
prepare: () => {
|
|
1241
|
-
|
|
1245
|
+
s.style.willChange = "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.clipPath = `inset(${e.top}px 0 calc(100% - ${e.top + e.height}px) 0)`;
|
|
1242
1246
|
},
|
|
1243
|
-
css: (
|
|
1244
|
-
transform: `translate3d(0, ${(1 -
|
|
1247
|
+
css: (a) => ({
|
|
1248
|
+
transform: `translate3d(0, ${(1 - a) * e.height}px, 0)`
|
|
1245
1249
|
}),
|
|
1246
1250
|
onEnd: () => {
|
|
1247
|
-
|
|
1251
|
+
s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "", s.style.clipPath = "";
|
|
1248
1252
|
}
|
|
1249
1253
|
};
|
|
1250
1254
|
},
|
|
1251
1255
|
// Exiting background: scales down with fade
|
|
1252
|
-
out: (
|
|
1253
|
-
const e = T(
|
|
1256
|
+
out: (s, i) => {
|
|
1257
|
+
const e = T(i), a = e.left + e.width / 2, l = e.top + e.height / 2;
|
|
1254
1258
|
return {
|
|
1255
1259
|
physics: r,
|
|
1256
1260
|
prepare: () => {
|
|
1257
|
-
g(
|
|
1261
|
+
g(s, i), s.style.zIndex = "-1", s.style.willChange = "transform, opacity", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.pointerEvents = "none", s.style.transformOrigin = `${a}px ${l}px`;
|
|
1258
1262
|
},
|
|
1259
1263
|
css: (y) => ({
|
|
1260
1264
|
transform: `scale(${1 - c + y * c})`,
|
|
@@ -1264,77 +1268,77 @@ const ss = (t = {}) => {
|
|
|
1264
1268
|
}
|
|
1265
1269
|
} : {
|
|
1266
1270
|
// Entering background: scales up with fade
|
|
1267
|
-
in: (
|
|
1268
|
-
const e = T(
|
|
1271
|
+
in: (s, i) => {
|
|
1272
|
+
const e = T(i), a = e.left + e.width / 2, l = e.top + e.height / 2;
|
|
1269
1273
|
return {
|
|
1270
1274
|
physics: r,
|
|
1271
1275
|
prepare: () => {
|
|
1272
|
-
|
|
1276
|
+
s.style.willChange = "transform, opacity", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.transformOrigin = `${a}px ${l}px`;
|
|
1273
1277
|
},
|
|
1274
1278
|
css: (y) => ({
|
|
1275
1279
|
transform: `scale(${1 - c + y * c})`,
|
|
1276
1280
|
opacity: y
|
|
1277
1281
|
}),
|
|
1278
1282
|
onEnd: () => {
|
|
1279
|
-
|
|
1283
|
+
s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "", s.style.transformOrigin = "";
|
|
1280
1284
|
}
|
|
1281
1285
|
};
|
|
1282
1286
|
},
|
|
1283
1287
|
// Exiting sheet: slides down with high z-index
|
|
1284
|
-
out: (
|
|
1285
|
-
const a = T(
|
|
1288
|
+
out: (s, i) => {
|
|
1289
|
+
const a = T(i).height, l = i.scroll.y;
|
|
1286
1290
|
return {
|
|
1287
1291
|
physics: r,
|
|
1288
1292
|
prepare: () => {
|
|
1289
|
-
g(
|
|
1293
|
+
g(s, i), s.style.zIndex = "100", s.style.willChange = "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.pointerEvents = "none", s.style.clipPath = `inset(${l}px 0 calc(100% - ${l + a}px) 0)`;
|
|
1290
1294
|
},
|
|
1291
|
-
css: (
|
|
1292
|
-
transform: `translate3d(0, ${(1 -
|
|
1295
|
+
css: (y) => ({
|
|
1296
|
+
transform: `translate3d(0, ${(1 - y) * a}px, 0)`
|
|
1293
1297
|
})
|
|
1294
1298
|
};
|
|
1295
1299
|
}
|
|
1296
1300
|
};
|
|
1297
1301
|
}, Ft = {
|
|
1298
1302
|
spring: {
|
|
1299
|
-
stiffness:
|
|
1300
|
-
damping:
|
|
1303
|
+
stiffness: 170,
|
|
1304
|
+
damping: 22,
|
|
1301
1305
|
doubleSpring: 0.8
|
|
1302
1306
|
}
|
|
1303
1307
|
}, is = (t = {}) => {
|
|
1304
|
-
const
|
|
1308
|
+
const n = t.direction ?? "left", r = t.physics ?? Ft, c = n === "left";
|
|
1305
1309
|
return {
|
|
1306
|
-
in: (
|
|
1310
|
+
in: (s) => ({
|
|
1307
1311
|
physics: r,
|
|
1308
1312
|
prepare: () => {
|
|
1309
|
-
|
|
1313
|
+
s.style.willChange = "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint";
|
|
1310
1314
|
},
|
|
1311
|
-
css: (
|
|
1312
|
-
transform: `translate3d(${c ? (1 -
|
|
1315
|
+
css: (i) => ({
|
|
1316
|
+
transform: `translate3d(${c ? (1 - i) * 100 : (1 - i) * -100}%, 0, 0)`
|
|
1313
1317
|
}),
|
|
1314
1318
|
onEnd: () => {
|
|
1315
|
-
|
|
1319
|
+
s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "";
|
|
1316
1320
|
}
|
|
1317
1321
|
}),
|
|
1318
|
-
out: (
|
|
1322
|
+
out: (s, i) => ({
|
|
1319
1323
|
physics: r,
|
|
1320
1324
|
css: (e) => ({
|
|
1321
1325
|
transform: `translate3d(${c ? (1 - e) * -100 : (1 - e) * 100}%, 0, 0)`
|
|
1322
1326
|
}),
|
|
1323
1327
|
prepare: () => {
|
|
1324
|
-
g(
|
|
1328
|
+
g(s, i), s.style.willChange = "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.pointerEvents = "none";
|
|
1325
1329
|
}
|
|
1326
1330
|
})
|
|
1327
1331
|
};
|
|
1328
1332
|
}, Ut = 8, Vt = {
|
|
1329
1333
|
spring: {
|
|
1330
|
-
stiffness:
|
|
1331
|
-
damping:
|
|
1334
|
+
stiffness: 400,
|
|
1335
|
+
damping: 30,
|
|
1332
1336
|
restDelta: 0.1,
|
|
1333
1337
|
restSpeed: 1e14
|
|
1334
1338
|
}
|
|
1335
1339
|
}, ns = (t = {}) => {
|
|
1336
|
-
const
|
|
1337
|
-
let { promise:
|
|
1340
|
+
const n = t.direction ?? "left", r = t.physics ?? Vt, c = t.translateOffset ?? Ut, s = n === "left";
|
|
1341
|
+
let { promise: i, resolve: e } = E();
|
|
1338
1342
|
return {
|
|
1339
1343
|
// Entering page: fades in + slides from opposite direction
|
|
1340
1344
|
in: (a) => ({
|
|
@@ -1343,14 +1347,14 @@ const ss = (t = {}) => {
|
|
|
1343
1347
|
a.style.opacity = "0", a.style.willChange = "transform, opacity", a.style.backfaceVisibility = "hidden", a.style.contain = "layout paint";
|
|
1344
1348
|
},
|
|
1345
1349
|
wait: async () => {
|
|
1346
|
-
if (
|
|
1347
|
-
await
|
|
1350
|
+
if (i) {
|
|
1351
|
+
await i;
|
|
1348
1352
|
const l = E();
|
|
1349
|
-
|
|
1353
|
+
i = l.promise, e = l.resolve;
|
|
1350
1354
|
}
|
|
1351
1355
|
},
|
|
1352
1356
|
css: (l) => {
|
|
1353
|
-
const y =
|
|
1357
|
+
const y = s ? (1 - l) * c : (1 - l) * -c, o = `${l}`;
|
|
1354
1358
|
return {
|
|
1355
1359
|
transform: `translate3d(${y}px, 0, 0)`,
|
|
1356
1360
|
opacity: o
|
|
@@ -1367,7 +1371,7 @@ const ss = (t = {}) => {
|
|
|
1367
1371
|
g(a, l), a.style.willChange = "transform, opacity", a.style.backfaceVisibility = "hidden", a.style.contain = "layout paint", a.style.pointerEvents = "none";
|
|
1368
1372
|
},
|
|
1369
1373
|
css: (y) => {
|
|
1370
|
-
const o =
|
|
1374
|
+
const o = s ? (1 - y) * -c : (1 - y) * c, h = `${y}`;
|
|
1371
1375
|
return {
|
|
1372
1376
|
transform: `translate3d(${o}px, 0, 0)`,
|
|
1373
1377
|
opacity: h
|
|
@@ -1381,33 +1385,33 @@ const ss = (t = {}) => {
|
|
|
1381
1385
|
}, Ht = {
|
|
1382
1386
|
spring: { stiffness: 17, damping: 6 }
|
|
1383
1387
|
}, P = 20, L = 800, es = (t = {}) => {
|
|
1384
|
-
const
|
|
1388
|
+
const n = t.physics ?? Ht;
|
|
1385
1389
|
let r, c = null;
|
|
1386
1390
|
return {
|
|
1387
|
-
in: (
|
|
1388
|
-
physics:
|
|
1391
|
+
in: (s) => ({
|
|
1392
|
+
physics: n,
|
|
1389
1393
|
prepare: () => {
|
|
1390
|
-
|
|
1394
|
+
s.style.willChange = "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.transform = `perspective(${L}px) rotateY(${P}deg) translate3d(-100%, 0, 0)`;
|
|
1391
1395
|
},
|
|
1392
1396
|
wait: async () => {
|
|
1393
1397
|
r && await r;
|
|
1394
1398
|
},
|
|
1395
|
-
css: (
|
|
1396
|
-
const e = (1 -
|
|
1399
|
+
css: (i) => {
|
|
1400
|
+
const e = (1 - i) * P, a = -(1 - i) * 100;
|
|
1397
1401
|
return {
|
|
1398
1402
|
transform: `perspective(${L}px) rotateY(${e}deg) translate3d(${a}%, 0, 0)`
|
|
1399
1403
|
};
|
|
1400
1404
|
},
|
|
1401
1405
|
onEnd: () => {
|
|
1402
|
-
|
|
1406
|
+
s.style.transform = "", s.style.willChange = "auto", s.style.backfaceVisibility = "", s.style.contain = "";
|
|
1403
1407
|
}
|
|
1404
1408
|
}),
|
|
1405
|
-
out: (
|
|
1409
|
+
out: (s, i) => (r = new Promise((e) => {
|
|
1406
1410
|
c = e;
|
|
1407
1411
|
}), {
|
|
1408
|
-
physics:
|
|
1412
|
+
physics: n,
|
|
1409
1413
|
prepare: () => {
|
|
1410
|
-
g(
|
|
1414
|
+
g(s, i), s.style.willChange = "transform", s.style.backfaceVisibility = "hidden", s.style.contain = "layout paint", s.style.pointerEvents = "none", s.style.transform = `perspective(${L}px) rotateY(0deg) translate3d(0%, 0, 0)`;
|
|
1411
1415
|
},
|
|
1412
1416
|
css: (e) => {
|
|
1413
1417
|
const a = 1 - e, l = a * P, y = a * 100;
|
|
@@ -1416,44 +1420,44 @@ const ss = (t = {}) => {
|
|
|
1416
1420
|
};
|
|
1417
1421
|
},
|
|
1418
1422
|
onEnd: () => {
|
|
1419
|
-
c && c(),
|
|
1423
|
+
c && c(), s.style.transform = "";
|
|
1420
1424
|
}
|
|
1421
1425
|
})
|
|
1422
1426
|
};
|
|
1423
1427
|
}, Xt = {
|
|
1424
1428
|
spring: {
|
|
1425
|
-
stiffness:
|
|
1426
|
-
damping:
|
|
1429
|
+
stiffness: 350,
|
|
1430
|
+
damping: 32,
|
|
1427
1431
|
restDelta: 0.1,
|
|
1428
1432
|
restSpeed: 1e14
|
|
1429
1433
|
}
|
|
1430
1434
|
}, zt = 0.05;
|
|
1431
1435
|
function Wt(t) {
|
|
1432
|
-
const
|
|
1436
|
+
const n = x(document.body, t.positionedParent), r = t.scroll.y, c = window.innerHeight - n.top;
|
|
1433
1437
|
return {
|
|
1434
1438
|
top: r,
|
|
1435
1439
|
left: 0,
|
|
1436
|
-
width:
|
|
1440
|
+
width: n.width,
|
|
1437
1441
|
height: c
|
|
1438
1442
|
};
|
|
1439
1443
|
}
|
|
1440
1444
|
const as = (t = {}) => {
|
|
1441
|
-
const
|
|
1442
|
-
let { promise: c, resolve:
|
|
1445
|
+
const n = t.physics ?? Xt, r = t.scaleOffset ?? zt;
|
|
1446
|
+
let { promise: c, resolve: s } = E();
|
|
1443
1447
|
return {
|
|
1444
1448
|
// Entering page: scales up from small (0.95 → 1) with fade in
|
|
1445
|
-
in: (
|
|
1449
|
+
in: (i, e) => {
|
|
1446
1450
|
const a = Wt(e), l = a.left + a.width / 2, y = a.top + a.height / 2;
|
|
1447
1451
|
return {
|
|
1448
|
-
physics:
|
|
1452
|
+
physics: n,
|
|
1449
1453
|
prepare: () => {
|
|
1450
|
-
|
|
1454
|
+
i.style.opacity = "0", i.style.willChange = "transform, opacity", i.style.backfaceVisibility = "hidden", i.style.contain = "layout paint", i.style.transformOrigin = `${l}px ${y}px`;
|
|
1451
1455
|
},
|
|
1452
1456
|
wait: async () => {
|
|
1453
1457
|
if (c) {
|
|
1454
1458
|
await c;
|
|
1455
1459
|
const o = E();
|
|
1456
|
-
c = o.promise,
|
|
1460
|
+
c = o.promise, s = o.resolve;
|
|
1457
1461
|
}
|
|
1458
1462
|
},
|
|
1459
1463
|
css: (o) => ({
|
|
@@ -1461,21 +1465,21 @@ const as = (t = {}) => {
|
|
|
1461
1465
|
opacity: o
|
|
1462
1466
|
}),
|
|
1463
1467
|
onEnd: () => {
|
|
1464
|
-
|
|
1468
|
+
i.style.opacity = "1", i.style.willChange = "auto", i.style.backfaceVisibility = "", i.style.contain = "", i.style.transformOrigin = "";
|
|
1465
1469
|
}
|
|
1466
1470
|
};
|
|
1467
1471
|
},
|
|
1468
1472
|
// Exiting page: fade out only (no scale)
|
|
1469
|
-
out: (
|
|
1470
|
-
physics:
|
|
1473
|
+
out: (i, e) => ({
|
|
1474
|
+
physics: n,
|
|
1471
1475
|
prepare: () => {
|
|
1472
|
-
g(
|
|
1476
|
+
g(i, e), i.style.willChange = "opacity", i.style.backfaceVisibility = "hidden", i.style.contain = "layout paint", i.style.pointerEvents = "none";
|
|
1473
1477
|
},
|
|
1474
1478
|
css: (a) => ({
|
|
1475
1479
|
opacity: a
|
|
1476
1480
|
}),
|
|
1477
1481
|
onEnd: () => {
|
|
1478
|
-
|
|
1482
|
+
s && s();
|
|
1479
1483
|
}
|
|
1480
1484
|
})
|
|
1481
1485
|
};
|