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