@ssgoi/core 2.1.2 → 2.3.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 +326 -212
- 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 +199 -142
- package/dist/transitions/mask.d.ts +31 -0
- package/dist/transitions/mask.d.ts.map +1 -0
- package/dist/transitions/none.d.ts +4 -4
- 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 +31 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/get-positioned-parent.d.ts +7 -0
- package/dist/utils/get-positioned-parent.d.ts.map +1 -0
- 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 +7 -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/film.d.ts +8 -0
- package/dist/view-transitions/film.d.ts.map +1 -0
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +35 -1
- package/dist/view-transitions/index.d.ts +3 -0
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +448 -202
- 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 +15 -8
- 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
|
@@ -1,142 +1,366 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const {
|
|
1
|
+
const D = (t) => {
|
|
2
|
+
t.style.position = "absolute", t.style.width = "100%", t.style.top = "0", t.style.left = "0";
|
|
3
|
+
}, N = (t) => new Promise((n) => setTimeout(n, t)), C = { stiffness: 80, damping: 25 }, v = { stiffness: 75, damping: 25 }, G = 300, q = 10, B = "horizontal", M = "#000000", st = (t = {}) => {
|
|
4
|
+
const {
|
|
5
|
+
inSpring: n = v,
|
|
6
|
+
outSpring: e = C,
|
|
7
|
+
transitionDelay: i = G,
|
|
8
|
+
blindCount: l = q,
|
|
9
|
+
direction: a = B,
|
|
10
|
+
staggerDelay: r = 100,
|
|
11
|
+
blindColor: s = M
|
|
12
|
+
} = t;
|
|
13
|
+
let o, h = null;
|
|
14
|
+
const d = (p, c, f, u = !1) => {
|
|
15
|
+
const y = Math.min(0.5, r * f / 1e3), g = 1 - y, x = (u ? f - 1 - c : c) / f * y, S = x + g;
|
|
16
|
+
return p <= x ? 0 : p >= S ? 1 : (p - x) / g;
|
|
17
|
+
}, $ = (p, c, f = "left") => {
|
|
18
|
+
window.getComputedStyle(p).position === "static" && (p.style.position = "relative");
|
|
19
|
+
const y = document.createElement("div");
|
|
20
|
+
y.className = "blind-container", y.style.cssText = `
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
z-index: 9999;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
`;
|
|
30
|
+
const g = [];
|
|
31
|
+
for (let w = 0; w < l; w++) {
|
|
32
|
+
const x = document.createElement("div");
|
|
33
|
+
if (a === "horizontal") {
|
|
34
|
+
const S = 100 / l, A = `calc(${S}% + 1px)`;
|
|
35
|
+
x.style.cssText = `
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: ${S * w}%;
|
|
38
|
+
left: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: ${A};
|
|
41
|
+
background: ${s};
|
|
42
|
+
transform: scaleX(${c === "hidden" ? 0 : 1});
|
|
43
|
+
transform-origin: ${f} center;
|
|
44
|
+
will-change: transform;
|
|
45
|
+
`;
|
|
46
|
+
} else {
|
|
47
|
+
const S = 100 / l, A = `calc(${S}% + 1px)`;
|
|
48
|
+
x.style.cssText = `
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
left: ${S * w}%;
|
|
52
|
+
width: ${A};
|
|
53
|
+
height: 100%;
|
|
54
|
+
background: ${s};
|
|
55
|
+
transform: scaleY(${c === "hidden" ? 0 : 1});
|
|
56
|
+
transform-origin: ${f === "left" ? "top" : "bottom"} center;
|
|
57
|
+
will-change: transform;
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
g.push(x), y.appendChild(x);
|
|
61
|
+
}
|
|
62
|
+
return p.appendChild(y), { container: y, blinds: g };
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
out: () => {
|
|
66
|
+
let p = null;
|
|
67
|
+
return o = new Promise((c) => {
|
|
68
|
+
h = c;
|
|
69
|
+
}), {
|
|
70
|
+
spring: e,
|
|
71
|
+
prepare: (c) => {
|
|
72
|
+
D(c), c.style.zIndex = "1000", p = $(c, "hidden", "left");
|
|
73
|
+
},
|
|
74
|
+
onStart: () => {
|
|
75
|
+
},
|
|
76
|
+
tick: (c) => {
|
|
77
|
+
if (!p) return;
|
|
78
|
+
const f = 1 - c;
|
|
79
|
+
p.blinds.forEach((u, y) => {
|
|
80
|
+
const g = d(
|
|
81
|
+
f,
|
|
82
|
+
y,
|
|
83
|
+
l,
|
|
84
|
+
!1
|
|
85
|
+
// not reversed - left to right
|
|
86
|
+
);
|
|
87
|
+
a === "horizontal" ? u.style.transform = `scaleX(${g})` : u.style.transform = `scaleY(${g})`;
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
onEnd: () => {
|
|
91
|
+
h && h();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
in: () => {
|
|
96
|
+
let p = null;
|
|
97
|
+
return {
|
|
98
|
+
spring: n,
|
|
99
|
+
prepare: (c) => {
|
|
100
|
+
c.style.position = "relative", c.style.zIndex = "0", p = $(c, "closed", "right");
|
|
101
|
+
},
|
|
102
|
+
onStart: () => {
|
|
103
|
+
},
|
|
104
|
+
wait: async () => {
|
|
105
|
+
o && await o, await N(i);
|
|
106
|
+
},
|
|
107
|
+
tick: (c) => {
|
|
108
|
+
p && p.blinds.forEach((f, u) => {
|
|
109
|
+
const y = d(
|
|
110
|
+
c,
|
|
111
|
+
u,
|
|
112
|
+
l,
|
|
113
|
+
!1
|
|
114
|
+
// same direction as OUT - left to right
|
|
115
|
+
);
|
|
116
|
+
a === "horizontal" ? f.style.transform = `scaleX(${1 - y})` : f.style.transform = `scaleY(${1 - y})`;
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
onEnd: () => {
|
|
120
|
+
p && p.container && p.container.remove();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, k = (t) => {
|
|
126
|
+
t.style.position = "absolute", t.style.width = "100%", t.style.top = "0", t.style.left = "0";
|
|
127
|
+
}, it = (t = {}) => {
|
|
128
|
+
var l, a;
|
|
129
|
+
const { opacity: n = !1, direction: e = "enter" } = t, i = {
|
|
5
130
|
stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ?? 150,
|
|
6
|
-
damping: ((
|
|
131
|
+
damping: ((a = t.spring) == null ? void 0 : a.damping) ?? 20
|
|
7
132
|
};
|
|
8
|
-
return
|
|
9
|
-
in: (
|
|
10
|
-
spring:
|
|
11
|
-
tick: (
|
|
12
|
-
|
|
133
|
+
return e === "enter" ? {
|
|
134
|
+
in: (r) => ({
|
|
135
|
+
spring: i,
|
|
136
|
+
tick: (s) => {
|
|
137
|
+
r.style.transform = `translateX(${(1 - s) * 100}%)`, n && (r.style.opacity = s.toString());
|
|
13
138
|
}
|
|
14
139
|
}),
|
|
15
|
-
out: (
|
|
16
|
-
spring:
|
|
17
|
-
prepare: (
|
|
18
|
-
|
|
140
|
+
out: (r) => ({
|
|
141
|
+
spring: i,
|
|
142
|
+
prepare: (s) => {
|
|
143
|
+
k(s), s.style.zIndex = "-1";
|
|
19
144
|
},
|
|
20
|
-
tick: (
|
|
21
|
-
|
|
145
|
+
tick: (s) => {
|
|
146
|
+
r.style.transform = `translateX(${-(1 - s) * 20}%)`, n && (r.style.opacity = s.toString());
|
|
22
147
|
}
|
|
23
148
|
})
|
|
24
149
|
} : {
|
|
25
|
-
in: (
|
|
150
|
+
in: (r) => ({
|
|
26
151
|
spring: {
|
|
27
152
|
stiffness: 100,
|
|
28
153
|
damping: 20
|
|
29
154
|
},
|
|
30
|
-
tick: (
|
|
31
|
-
|
|
155
|
+
tick: (s) => {
|
|
156
|
+
r.style.transform = `translateX(${-(1 - s) * 20}%)`, n && (r.style.opacity = s.toString());
|
|
32
157
|
}
|
|
33
158
|
}),
|
|
34
|
-
out: (
|
|
159
|
+
out: (r) => ({
|
|
35
160
|
spring: {
|
|
36
161
|
stiffness: 100,
|
|
37
162
|
damping: 20
|
|
38
163
|
},
|
|
39
|
-
prepare: (
|
|
40
|
-
|
|
164
|
+
prepare: (s) => {
|
|
165
|
+
k(s), s.style.zIndex = "100";
|
|
41
166
|
},
|
|
42
|
-
tick: (
|
|
43
|
-
|
|
167
|
+
tick: (s) => {
|
|
168
|
+
r.style.transform = `translateX(${(1 - s) * 100}%)`, n && (r.style.opacity = s.toString());
|
|
44
169
|
}
|
|
45
170
|
})
|
|
46
171
|
};
|
|
47
|
-
},
|
|
172
|
+
}, H = (t) => new Promise((n) => setTimeout(n, t)), W = { stiffness: 400, damping: 20 }, Z = { stiffness: 40, damping: 8 }, j = 100, et = (t = {}) => {
|
|
48
173
|
const {
|
|
49
|
-
inSpring: n =
|
|
50
|
-
outSpring:
|
|
51
|
-
transitionDelay:
|
|
174
|
+
inSpring: n = Z,
|
|
175
|
+
outSpring: e = W,
|
|
176
|
+
transitionDelay: i = j
|
|
52
177
|
} = t;
|
|
53
|
-
let l,
|
|
178
|
+
let l, a = null;
|
|
54
179
|
return {
|
|
55
|
-
in: (
|
|
180
|
+
in: (r) => ({
|
|
56
181
|
spring: n,
|
|
57
|
-
prepare: (
|
|
58
|
-
|
|
182
|
+
prepare: (s) => {
|
|
183
|
+
s.style.opacity = "0";
|
|
59
184
|
},
|
|
60
185
|
wait: async () => {
|
|
61
|
-
l && (await l, await
|
|
186
|
+
l && (await l, await H(i));
|
|
62
187
|
},
|
|
63
|
-
tick: (
|
|
64
|
-
|
|
188
|
+
tick: (s) => {
|
|
189
|
+
r.style.opacity = s.toString();
|
|
65
190
|
}
|
|
66
191
|
}),
|
|
67
|
-
out: (
|
|
68
|
-
|
|
192
|
+
out: (r) => (l = new Promise((s) => {
|
|
193
|
+
a = s;
|
|
69
194
|
}), {
|
|
70
|
-
spring:
|
|
71
|
-
tick: (
|
|
72
|
-
|
|
195
|
+
spring: e,
|
|
196
|
+
tick: (s) => {
|
|
197
|
+
r.style.opacity = s.toString();
|
|
73
198
|
},
|
|
74
|
-
prepare:
|
|
199
|
+
prepare: k,
|
|
75
200
|
onEnd: () => {
|
|
76
|
-
|
|
201
|
+
a && a();
|
|
77
202
|
}
|
|
78
203
|
})
|
|
79
204
|
};
|
|
80
205
|
};
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
206
|
+
function P(t, n) {
|
|
207
|
+
function e(a) {
|
|
208
|
+
let r = 0, s = 0;
|
|
209
|
+
const o = a.offsetWidth, h = a.offsetHeight;
|
|
210
|
+
let d = a;
|
|
211
|
+
for (; d; )
|
|
212
|
+
r += d.offsetTop, s += d.offsetLeft, d = d.offsetParent;
|
|
213
|
+
return r -= window.scrollY, s -= window.scrollX, { top: r, left: s, width: o, height: h };
|
|
214
|
+
}
|
|
215
|
+
const i = e(t), l = e(n);
|
|
86
216
|
return new DOMRect(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
217
|
+
l.left - i.left,
|
|
218
|
+
l.top - i.top,
|
|
219
|
+
l.width,
|
|
220
|
+
l.height
|
|
91
221
|
);
|
|
92
222
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
223
|
+
const J = {
|
|
224
|
+
stiffness: 10,
|
|
225
|
+
// Lower stiffness for smoother motion
|
|
226
|
+
damping: 5
|
|
227
|
+
// Lower damping for more fluid movement
|
|
228
|
+
}, m = 0.2, T = 0.82;
|
|
229
|
+
function I(t) {
|
|
230
|
+
const n = P(document.body, t.positionedParent);
|
|
231
|
+
return {
|
|
232
|
+
top: t.scroll.y,
|
|
233
|
+
left: 0,
|
|
234
|
+
width: n.width,
|
|
235
|
+
height: window.innerHeight - n.top
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function b(t, n) {
|
|
239
|
+
const e = n.left + n.width / 2, i = n.top + n.height / 2;
|
|
240
|
+
t.style.transformOrigin = `${e}px ${i}px`;
|
|
241
|
+
}
|
|
242
|
+
function Y(t, n) {
|
|
243
|
+
t.style.clipPath = `polygon(
|
|
244
|
+
${n.left}px ${n.top}px,
|
|
245
|
+
${n.left + n.width}px ${n.top}px,
|
|
246
|
+
${n.left + n.width}px ${n.top + n.height}px,
|
|
247
|
+
${n.left}px ${n.top + n.height}px
|
|
248
|
+
)`;
|
|
249
|
+
}
|
|
250
|
+
function E(t, n, e) {
|
|
251
|
+
return t <= n ? 0 : t >= e ? 1 : (t - n) / (e - n);
|
|
252
|
+
}
|
|
253
|
+
const rt = (t) => {
|
|
254
|
+
const n = (t == null ? void 0 : t.spring) ?? J, e = (t == null ? void 0 : t.scale) ?? 0.9;
|
|
255
|
+
return {
|
|
256
|
+
out: async (i, l) => {
|
|
257
|
+
const a = I(l);
|
|
258
|
+
return {
|
|
259
|
+
spring: n,
|
|
260
|
+
prepare: () => {
|
|
261
|
+
D(i), b(i, a), Y(i, a);
|
|
262
|
+
},
|
|
263
|
+
onEnd: () => {
|
|
264
|
+
i.style.clipPath = "", i.style.transformOrigin = "";
|
|
265
|
+
},
|
|
266
|
+
tick: (r) => {
|
|
267
|
+
const s = 1 - r;
|
|
268
|
+
if (s < m) {
|
|
269
|
+
const o = E(s, 0, m), h = 1 - (1 - e) * o;
|
|
270
|
+
i.style.transform = `scale(${h})`;
|
|
271
|
+
} else if (s < T) {
|
|
272
|
+
const o = E(
|
|
273
|
+
s,
|
|
274
|
+
m,
|
|
275
|
+
T
|
|
276
|
+
), h = -a.height * o;
|
|
277
|
+
i.style.transform = `translateY(${h}px) scale(${e})`;
|
|
278
|
+
} else {
|
|
279
|
+
const o = E(s, T, 1), h = e + (1 - e) * o;
|
|
280
|
+
i.style.transform = `translateY(${-a.height}px) scale(${h})`;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
in: async (i, l) => {
|
|
286
|
+
const a = I(l);
|
|
287
|
+
return {
|
|
288
|
+
spring: n,
|
|
289
|
+
prepare: () => {
|
|
290
|
+
b(i, a), Y(i, a), i.style.transform = `translateY(${a.height}px) scale(${e})`;
|
|
291
|
+
},
|
|
292
|
+
onEnd: () => {
|
|
293
|
+
i.style.clipPath = "", i.style.transformOrigin = "";
|
|
294
|
+
},
|
|
295
|
+
tick: (r) => {
|
|
296
|
+
if (r < m)
|
|
297
|
+
i.style.transform = `translateY(${a.height}px) scale(${e})`, i.style.opacity = "0";
|
|
298
|
+
else if (r < T) {
|
|
299
|
+
const s = E(
|
|
300
|
+
r,
|
|
301
|
+
m,
|
|
302
|
+
T
|
|
303
|
+
), o = a.height * (1 - s);
|
|
304
|
+
i.style.transform = `translateY(${o}px) scale(${e})`, i.style.opacity = "1";
|
|
305
|
+
} else {
|
|
306
|
+
const s = E(r, T, 1), o = e + (1 - e) * s;
|
|
307
|
+
i.style.transform = `scale(${o})`, i.style.opacity = "1";
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
function K(t, n) {
|
|
315
|
+
return t.querySelector(`[data-hero-key="${n}"]`);
|
|
316
|
+
}
|
|
317
|
+
const at = (t = {}) => {
|
|
318
|
+
var a, r;
|
|
95
319
|
const n = {
|
|
96
|
-
stiffness: ((
|
|
97
|
-
damping: ((
|
|
98
|
-
},
|
|
99
|
-
let
|
|
320
|
+
stiffness: ((a = t.spring) == null ? void 0 : a.stiffness) ?? 300,
|
|
321
|
+
damping: ((r = t.spring) == null ? void 0 : r.damping) ?? 30
|
|
322
|
+
}, e = t.timeout ?? 300;
|
|
323
|
+
let i = null, l = null;
|
|
100
324
|
return {
|
|
101
|
-
in: async (
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
325
|
+
in: async (s, o) => {
|
|
326
|
+
const h = s, d = Array.from(h.querySelectorAll("[data-hero-key]"));
|
|
327
|
+
if (d.length === 0)
|
|
104
328
|
return {
|
|
105
329
|
spring: n,
|
|
106
330
|
tick: () => {
|
|
107
331
|
}
|
|
108
332
|
// No hero elements, skip animation
|
|
109
333
|
};
|
|
110
|
-
if (!await new Promise((
|
|
111
|
-
|
|
112
|
-
l = null,
|
|
113
|
-
},
|
|
114
|
-
}) || !
|
|
115
|
-
return
|
|
334
|
+
if (!await new Promise((c) => {
|
|
335
|
+
i ? c(!0) : (l = c, setTimeout(() => {
|
|
336
|
+
l = null, c(!1);
|
|
337
|
+
}, e));
|
|
338
|
+
}) || !i)
|
|
339
|
+
return i = null, {
|
|
116
340
|
spring: n,
|
|
117
341
|
tick: () => {
|
|
118
342
|
}
|
|
119
343
|
// No fromNode, skip animation
|
|
120
344
|
};
|
|
121
|
-
const p =
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
const u =
|
|
345
|
+
const p = d.map((c) => {
|
|
346
|
+
const f = c.getAttribute("data-hero-key");
|
|
347
|
+
if (!f) return null;
|
|
348
|
+
const u = K(i, f);
|
|
125
349
|
if (!u) return null;
|
|
126
|
-
const
|
|
350
|
+
const y = c, g = P(i, u), w = P(h, y), x = g.left - w.left - o.scrollOffset.x, S = g.top - w.top - o.scrollOffset.y, A = g.width / w.width, F = g.height / w.height, O = y.style.transform, X = y.style.position, U = y.style.transformOrigin, z = y.style.zIndex;
|
|
127
351
|
return {
|
|
128
|
-
toEl:
|
|
129
|
-
dx:
|
|
130
|
-
dy:
|
|
131
|
-
dw:
|
|
132
|
-
dh:
|
|
133
|
-
originalTransform:
|
|
134
|
-
originalPosition:
|
|
135
|
-
originalTransformOrigin:
|
|
136
|
-
originalZIndex:
|
|
352
|
+
toEl: y,
|
|
353
|
+
dx: x,
|
|
354
|
+
dy: S,
|
|
355
|
+
dw: A,
|
|
356
|
+
dh: F,
|
|
357
|
+
originalTransform: O,
|
|
358
|
+
originalPosition: X,
|
|
359
|
+
originalTransformOrigin: U,
|
|
360
|
+
originalZIndex: z
|
|
137
361
|
};
|
|
138
362
|
}).filter(Boolean);
|
|
139
|
-
return
|
|
363
|
+
return i = null, p.length === 0 ? {
|
|
140
364
|
spring: n,
|
|
141
365
|
tick: () => {
|
|
142
366
|
}
|
|
@@ -144,165 +368,156 @@ const H = (t = {}) => {
|
|
|
144
368
|
} : {
|
|
145
369
|
spring: n,
|
|
146
370
|
prepare: () => {
|
|
147
|
-
p.forEach(({ toEl:
|
|
148
|
-
|
|
371
|
+
p.forEach(({ toEl: c }) => {
|
|
372
|
+
c.style.position = "relative", c.style.transformOrigin = "top left", c.style.zIndex = "1000";
|
|
149
373
|
});
|
|
150
374
|
},
|
|
151
|
-
tick: (
|
|
152
|
-
p.forEach(({ toEl:
|
|
153
|
-
|
|
375
|
+
tick: (c) => {
|
|
376
|
+
p.forEach(({ toEl: f, dx: u, dy: y, dw: g, dh: w }) => {
|
|
377
|
+
f.style.transform = `translate(${(1 - c) * u}px,${(1 - c) * y}px) scale(${c + (1 - c) * g}, ${c + (1 - c) * w})`;
|
|
154
378
|
});
|
|
155
379
|
},
|
|
156
380
|
onEnd: () => {
|
|
157
381
|
p.forEach(
|
|
158
382
|
({
|
|
159
|
-
toEl:
|
|
160
|
-
originalTransform:
|
|
383
|
+
toEl: c,
|
|
384
|
+
originalTransform: f,
|
|
161
385
|
originalPosition: u,
|
|
162
|
-
originalTransformOrigin:
|
|
163
|
-
originalZIndex:
|
|
386
|
+
originalTransformOrigin: y,
|
|
387
|
+
originalZIndex: g
|
|
164
388
|
}) => {
|
|
165
|
-
|
|
389
|
+
c.style.transform = f, c.style.position = u, c.style.transformOrigin = y, c.style.zIndex = g;
|
|
166
390
|
}
|
|
167
391
|
);
|
|
168
392
|
}
|
|
169
393
|
};
|
|
170
394
|
},
|
|
171
|
-
out: async (
|
|
395
|
+
out: async (s) => ({
|
|
172
396
|
onStart: () => {
|
|
173
|
-
|
|
397
|
+
i = s, l && (l(!0), l = null);
|
|
174
398
|
},
|
|
175
399
|
prepare: (o) => {
|
|
176
|
-
|
|
400
|
+
k(o), o.style.opacity = "0";
|
|
177
401
|
}
|
|
178
402
|
})
|
|
179
403
|
};
|
|
180
404
|
};
|
|
181
|
-
function
|
|
182
|
-
const s = t.getBoundingClientRect(), e = n.getBoundingClientRect();
|
|
183
|
-
return new DOMRect(
|
|
184
|
-
e.left - s.left,
|
|
185
|
-
e.top - s.top,
|
|
186
|
-
e.width,
|
|
187
|
-
e.height
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
function C({
|
|
405
|
+
function Q({
|
|
191
406
|
detailRect: t,
|
|
192
407
|
galleryRect: n,
|
|
193
|
-
pageRect:
|
|
194
|
-
scrollOffset:
|
|
408
|
+
pageRect: e,
|
|
409
|
+
scrollOffset: i
|
|
195
410
|
}, l) {
|
|
196
|
-
const
|
|
197
|
-
return l.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, (
|
|
198
|
-
const u = 1 -
|
|
199
|
-
l.style.clipPath = `inset(${
|
|
411
|
+
const a = n.left - t.left + (n.width - t.width) / 2 - i.x, r = n.top - t.top + (n.height - t.height) / 2 - i.y, s = n.width / t.width, o = n.height / t.height, h = Math.max(s, o), d = t.top / e.height * 100, $ = (e.width - (t.left + t.width)) / e.width * 100, p = (e.height - (t.top + t.height)) / e.height * 100, c = t.left / e.width * 100;
|
|
412
|
+
return l.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, (f) => {
|
|
413
|
+
const u = 1 - f, y = d * u, g = $ * u, w = p * u, x = c * u;
|
|
414
|
+
l.style.clipPath = `inset(${y}% ${g}% ${w}% ${x}%)`, l.style.transform = `translate(${a * u}px, ${r * u}px) scale(${1 + (h - 1) * u})`;
|
|
200
415
|
};
|
|
201
416
|
}
|
|
202
|
-
function
|
|
417
|
+
function V({
|
|
203
418
|
galleryRect: t,
|
|
204
419
|
detailRect: n,
|
|
205
|
-
scrollOffset:
|
|
206
|
-
},
|
|
207
|
-
const l = n.left - t.left + (n.width - t.width) / 2 +
|
|
208
|
-
return (
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
|
|
420
|
+
scrollOffset: e
|
|
421
|
+
}, i) {
|
|
422
|
+
const l = n.left - t.left + (n.width - t.width) / 2 + e.x, a = n.top - t.top + (n.height - t.height) / 2 + e.y, r = n.width / t.width, s = n.height / t.height, o = Math.max(r, s);
|
|
423
|
+
return (h) => {
|
|
424
|
+
i.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`;
|
|
425
|
+
const d = 1 - h;
|
|
426
|
+
i.style.transform = `translate(${l * d - e.x}px, ${a * d - e.y}px) scale(${1 + (o - 1) * d})`, i.style.opacity = `${1 - d}`;
|
|
212
427
|
};
|
|
213
428
|
}
|
|
214
|
-
function
|
|
429
|
+
function R({
|
|
215
430
|
galleryRect: t,
|
|
216
431
|
detailRect: n,
|
|
217
|
-
scrollOffset:
|
|
218
|
-
},
|
|
219
|
-
const l = n.left - t.left + (n.width - t.width) / 2 -
|
|
220
|
-
return (
|
|
221
|
-
const
|
|
222
|
-
|
|
432
|
+
scrollOffset: e
|
|
433
|
+
}, i) {
|
|
434
|
+
const l = n.left - t.left + (n.width - t.width) / 2 - e.x, a = n.top - t.top + (n.height - t.height) / 2 - e.y, r = n.width / t.width, s = n.height / t.height, o = Math.max(r, s);
|
|
435
|
+
return (h) => {
|
|
436
|
+
const d = 1 - h, $ = h;
|
|
437
|
+
i.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, i.style.transform = `translate(${l * d}px, ${a * d}px) scale(${1 + (o - 1) * d})`, i.style.opacity = `${$}`;
|
|
223
438
|
};
|
|
224
439
|
}
|
|
225
|
-
function
|
|
440
|
+
function tt({
|
|
226
441
|
detailRect: t,
|
|
227
442
|
galleryRect: n,
|
|
228
|
-
pageRect:
|
|
229
|
-
scrollOffset:
|
|
443
|
+
pageRect: e,
|
|
444
|
+
scrollOffset: i
|
|
230
445
|
}, l) {
|
|
231
|
-
const
|
|
232
|
-
return l.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, (
|
|
233
|
-
const u = 1 -
|
|
234
|
-
l.style.clipPath = `inset(${
|
|
446
|
+
const a = n.left - t.left + (n.width - t.width) / 2 + i.x, r = n.top - t.top + (n.height - t.height) / 2 + i.y, s = n.width / t.width, o = n.height / t.height, h = Math.min(s, o), d = t.top / e.height * 100, $ = (e.width - (t.left + t.width)) / e.width * 100, p = (e.height - (t.top + t.height)) / e.height * 100, c = t.left / e.width * 100;
|
|
447
|
+
return l.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, (f) => {
|
|
448
|
+
const u = 1 - f, y = d * u, g = $ * u, w = p * u, x = c * u;
|
|
449
|
+
l.style.clipPath = `inset(${y}% ${g}% ${w}% ${x}%)`, l.style.transform = `translate(${a * u - i.x}px, ${r * u - i.y}px) scale(${1 + (h - 1) * u})`;
|
|
235
450
|
};
|
|
236
451
|
}
|
|
237
|
-
function
|
|
238
|
-
const
|
|
452
|
+
function nt(t, n, e) {
|
|
453
|
+
const i = t.querySelector(
|
|
239
454
|
"[data-pinterest-detail-key]"
|
|
240
455
|
), l = n.querySelector(
|
|
241
456
|
"[data-pinterest-detail-key]"
|
|
242
457
|
);
|
|
243
458
|
if (t.querySelectorAll("[data-pinterest-detail-key]").length > 1 || n.querySelectorAll("[data-pinterest-detail-key]").length > 1)
|
|
244
459
|
return null;
|
|
245
|
-
let
|
|
246
|
-
if (!
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
`[data-pinterest-gallery-key="${
|
|
252
|
-
),
|
|
253
|
-
} else if (
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
`[data-pinterest-gallery-key="${
|
|
259
|
-
),
|
|
460
|
+
let a = null, r = null, s = !1;
|
|
461
|
+
if (!i && l) {
|
|
462
|
+
r = l;
|
|
463
|
+
const $ = r.getAttribute("data-pinterest-detail-key");
|
|
464
|
+
if (!$) return null;
|
|
465
|
+
a = t.querySelector(
|
|
466
|
+
`[data-pinterest-gallery-key="${$}"]`
|
|
467
|
+
), a && (s = !0);
|
|
468
|
+
} else if (i && !l) {
|
|
469
|
+
r = i;
|
|
470
|
+
const $ = r.getAttribute("data-pinterest-detail-key");
|
|
471
|
+
if (!$) return null;
|
|
472
|
+
a = n.querySelector(
|
|
473
|
+
`[data-pinterest-gallery-key="${$}"]`
|
|
474
|
+
), a && (s = !1);
|
|
260
475
|
}
|
|
261
|
-
if (!
|
|
476
|
+
if (!a || !r)
|
|
262
477
|
return null;
|
|
263
|
-
const o =
|
|
264
|
-
return
|
|
265
|
-
inAnimation:
|
|
266
|
-
{ detailRect:
|
|
478
|
+
const o = P(s ? t : n, a), h = P(s ? n : t, r), d = n.getBoundingClientRect();
|
|
479
|
+
return s ? {
|
|
480
|
+
inAnimation: Q(
|
|
481
|
+
{ detailRect: h, galleryRect: o, pageRect: d, scrollOffset: e },
|
|
267
482
|
n
|
|
268
483
|
),
|
|
269
|
-
outAnimation:
|
|
270
|
-
{ galleryRect: o, detailRect:
|
|
484
|
+
outAnimation: V(
|
|
485
|
+
{ galleryRect: o, detailRect: h, scrollOffset: e },
|
|
271
486
|
t
|
|
272
487
|
)
|
|
273
488
|
} : {
|
|
274
|
-
inAnimation:
|
|
275
|
-
{ galleryRect: o, detailRect:
|
|
489
|
+
inAnimation: R(
|
|
490
|
+
{ galleryRect: o, detailRect: h, scrollOffset: e },
|
|
276
491
|
n
|
|
277
492
|
),
|
|
278
|
-
outAnimation:
|
|
279
|
-
{ detailRect:
|
|
493
|
+
outAnimation: tt(
|
|
494
|
+
{ detailRect: h, galleryRect: o, pageRect: d, scrollOffset: e },
|
|
280
495
|
t
|
|
281
496
|
)
|
|
282
497
|
};
|
|
283
498
|
}
|
|
284
|
-
const
|
|
285
|
-
var
|
|
499
|
+
const lt = (t = {}) => {
|
|
500
|
+
var r, s;
|
|
286
501
|
const n = {
|
|
287
|
-
stiffness: ((
|
|
288
|
-
damping: ((
|
|
289
|
-
},
|
|
290
|
-
let
|
|
502
|
+
stiffness: ((r = t.spring) == null ? void 0 : r.stiffness) ?? 50,
|
|
503
|
+
damping: ((s = t.spring) == null ? void 0 : s.damping) ?? 10
|
|
504
|
+
}, e = t.timeout ?? 300;
|
|
505
|
+
let i = null, l = null, a = null;
|
|
291
506
|
return {
|
|
292
|
-
in: async (o, { scrollOffset:
|
|
293
|
-
const
|
|
507
|
+
in: async (o, { scrollOffset: h }) => {
|
|
508
|
+
const d = o;
|
|
294
509
|
return !await new Promise((p) => {
|
|
295
|
-
|
|
510
|
+
i ? p(!0) : (l = p, setTimeout(() => {
|
|
296
511
|
l = null, p(!1);
|
|
297
|
-
},
|
|
298
|
-
}) || !
|
|
512
|
+
}, e));
|
|
513
|
+
}) || !i ? (i = null, {
|
|
299
514
|
spring: n,
|
|
300
515
|
tick: () => {
|
|
301
516
|
}
|
|
302
|
-
}) : (
|
|
517
|
+
}) : (a = nt(i, d, h), a ? (i = null, {
|
|
303
518
|
spring: n,
|
|
304
519
|
tick: (p) => {
|
|
305
|
-
|
|
520
|
+
a && a.inAnimation(p);
|
|
306
521
|
}
|
|
307
522
|
}) : {
|
|
308
523
|
spring: n,
|
|
@@ -313,49 +528,80 @@ const N = (t = {}) => {
|
|
|
313
528
|
out: async (o) => ({
|
|
314
529
|
spring: n,
|
|
315
530
|
onStart: () => {
|
|
316
|
-
|
|
531
|
+
i = o, l && (l(!0), l = null);
|
|
317
532
|
},
|
|
318
|
-
prepare: (
|
|
319
|
-
|
|
533
|
+
prepare: (h) => {
|
|
534
|
+
k(h), h.style.zIndex = "-1";
|
|
320
535
|
},
|
|
321
|
-
tick: (
|
|
322
|
-
|
|
536
|
+
tick: (h) => {
|
|
537
|
+
a && a.outAnimation(h);
|
|
323
538
|
}
|
|
324
539
|
})
|
|
325
540
|
};
|
|
326
|
-
},
|
|
541
|
+
}, _ = {
|
|
327
542
|
stiffness: 30,
|
|
328
543
|
damping: 7
|
|
329
|
-
},
|
|
330
|
-
var l,
|
|
331
|
-
const n = t.direction ?? "up",
|
|
332
|
-
stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ??
|
|
333
|
-
damping: ((
|
|
334
|
-
},
|
|
544
|
+
}, ot = (t = {}) => {
|
|
545
|
+
var l, a;
|
|
546
|
+
const n = t.direction ?? "up", e = {
|
|
547
|
+
stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ?? _.stiffness,
|
|
548
|
+
damping: ((a = t.spring) == null ? void 0 : a.damping) ?? _.damping
|
|
549
|
+
}, i = n === "up";
|
|
335
550
|
return {
|
|
336
|
-
in: (
|
|
337
|
-
spring:
|
|
338
|
-
tick: (
|
|
339
|
-
const o =
|
|
340
|
-
|
|
551
|
+
in: (r) => ({
|
|
552
|
+
spring: e,
|
|
553
|
+
tick: (s) => {
|
|
554
|
+
const o = i ? (1 - s) * 100 : (1 - s) * -100;
|
|
555
|
+
r.style.transform = `translateY(${o}vh)`;
|
|
341
556
|
}
|
|
342
557
|
}),
|
|
343
|
-
out: (
|
|
344
|
-
spring:
|
|
345
|
-
tick: (
|
|
346
|
-
const o =
|
|
347
|
-
|
|
558
|
+
out: (r) => ({
|
|
559
|
+
spring: e,
|
|
560
|
+
tick: (s) => {
|
|
561
|
+
const o = i ? (1 - s) * -100 : (1 - s) * 100;
|
|
562
|
+
r.style.transform = `translateY(${o}vh)`;
|
|
563
|
+
},
|
|
564
|
+
prepare: (s) => {
|
|
565
|
+
k(s), s.style.zIndex = i ? "-1" : "1";
|
|
566
|
+
}
|
|
567
|
+
})
|
|
568
|
+
};
|
|
569
|
+
}, L = {
|
|
570
|
+
stiffness: 30,
|
|
571
|
+
damping: 7
|
|
572
|
+
}, ct = (t = {}) => {
|
|
573
|
+
var l, a;
|
|
574
|
+
const n = t.direction ?? "left", e = {
|
|
575
|
+
stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ?? L.stiffness,
|
|
576
|
+
damping: ((a = t.spring) == null ? void 0 : a.damping) ?? L.damping
|
|
577
|
+
}, i = n === "left";
|
|
578
|
+
return {
|
|
579
|
+
in: (r) => ({
|
|
580
|
+
spring: e,
|
|
581
|
+
tick: (s) => {
|
|
582
|
+
const o = i ? (1 - s) * 100 : (1 - s) * -100;
|
|
583
|
+
r.style.transform = `translateX(${o}%)`;
|
|
584
|
+
}
|
|
585
|
+
}),
|
|
586
|
+
out: (r) => ({
|
|
587
|
+
spring: e,
|
|
588
|
+
tick: (s) => {
|
|
589
|
+
const o = i ? (1 - s) * -100 : (1 - s) * 100;
|
|
590
|
+
r.style.transform = `translateX(${o}%)`;
|
|
348
591
|
},
|
|
349
|
-
prepare: (
|
|
350
|
-
|
|
592
|
+
prepare: (s) => {
|
|
593
|
+
D(s), s.style.zIndex = i ? "-1" : "1";
|
|
351
594
|
}
|
|
352
595
|
})
|
|
353
596
|
};
|
|
354
597
|
};
|
|
355
598
|
export {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
599
|
+
st as blind,
|
|
600
|
+
it as drill,
|
|
601
|
+
et as fade,
|
|
602
|
+
rt as film,
|
|
603
|
+
at as hero,
|
|
604
|
+
lt as pinterest,
|
|
605
|
+
ot as scroll,
|
|
606
|
+
ct as slide
|
|
361
607
|
};
|