@ssgoi/core 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +10 -11
  2. package/dist/animator.d.ts.map +1 -1
  3. package/dist/create-ssgoi-transition-context.d.ts.map +1 -1
  4. package/dist/create-transition-callback.d.ts.map +1 -1
  5. package/dist/index.cjs +2 -1
  6. package/dist/index.js +204 -126
  7. package/dist/transition-strategy.d.ts +5 -0
  8. package/dist/transition-strategy.d.ts.map +1 -1
  9. package/dist/transition.d.ts.map +1 -1
  10. package/dist/transitions/blur.d.ts.map +1 -1
  11. package/dist/transitions/bounce.d.ts +1 -1
  12. package/dist/transitions/bounce.d.ts.map +1 -1
  13. package/dist/transitions/fly.d.ts.map +1 -1
  14. package/dist/transitions/index.cjs +1 -1
  15. package/dist/transitions/index.d.ts +1 -0
  16. package/dist/transitions/index.d.ts.map +1 -1
  17. package/dist/transitions/index.js +175 -119
  18. package/dist/transitions/mask.d.ts +31 -0
  19. package/dist/transitions/mask.d.ts.map +1 -0
  20. package/dist/transitions/none.d.ts.map +1 -1
  21. package/dist/transitions/rotate.d.ts +1 -1
  22. package/dist/transitions/scale.d.ts +1 -1
  23. package/dist/transitions/slide.d.ts +2 -2
  24. package/dist/transitions/slide.d.ts.map +1 -1
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/utils/get-rect.d.ts +7 -0
  27. package/dist/utils/get-rect.d.ts.map +1 -0
  28. package/dist/utils/get-scrolling-element.d.ts +6 -0
  29. package/dist/utils/get-scrolling-element.d.ts.map +1 -0
  30. package/dist/utils/index.d.ts +6 -0
  31. package/dist/utils/index.d.ts.map +1 -0
  32. package/dist/utils/parse-caller-location.d.ts +6 -0
  33. package/dist/utils/parse-caller-location.d.ts.map +1 -0
  34. package/dist/utils/prepare-outgoing.d.ts +6 -0
  35. package/dist/utils/prepare-outgoing.d.ts.map +1 -0
  36. package/dist/utils/sleep.d.ts +7 -0
  37. package/dist/utils/sleep.d.ts.map +1 -0
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/view-transitions/blind.d.ts +13 -0
  40. package/dist/view-transitions/blind.d.ts.map +1 -0
  41. package/dist/view-transitions/fade.d.ts.map +1 -1
  42. package/dist/view-transitions/hero.d.ts.map +1 -1
  43. package/dist/view-transitions/index.cjs +30 -1
  44. package/dist/view-transitions/index.d.ts +2 -0
  45. package/dist/view-transitions/index.d.ts.map +1 -1
  46. package/dist/view-transitions/index.js +371 -217
  47. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  48. package/dist/view-transitions/slide.d.ts +8 -0
  49. package/dist/view-transitions/slide.d.ts.map +1 -0
  50. package/package.json +8 -2
  51. package/dist/utils-8Eptbv7c.cjs +0 -2
  52. package/dist/utils-DTRMUQW4.js +0 -31
  53. package/dist/view-transitions/ripple.d.ts +0 -7
  54. package/dist/view-transitions/ripple.d.ts.map +0 -1
@@ -1,361 +1,515 @@
1
- import { a as x, s as Y } from "../utils-DTRMUQW4.js";
2
- const b = (t = {}) => {
3
- var l, r;
4
- const { opacity: n = !1, direction: s = "enter" } = t, e = {
5
- stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ?? 150,
6
- damping: ((r = t.spring) == null ? void 0 : r.damping) ?? 20
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 s === "enter" ? {
9
- in: (a) => ({
133
+ return l === "enter" ? {
134
+ in: (r) => ({
10
135
  spring: e,
11
- tick: (i) => {
12
- a.style.transform = `translateX(${(1 - i) * 100}%)`, n && (a.style.opacity = i.toString());
136
+ tick: (n) => {
137
+ r.style.transform = `translateX(${(1 - n) * 100}%)`, i && (r.style.opacity = n.toString());
13
138
  }
14
139
  }),
15
- out: (a) => ({
140
+ out: (r) => ({
16
141
  spring: e,
17
- prepare: (i) => {
18
- x(i), i.style.zIndex = "-1";
142
+ prepare: (n) => {
143
+ A(n), n.style.zIndex = "-1";
19
144
  },
20
- tick: (i) => {
21
- a.style.transform = `translateX(${-(1 - i) * 20}%)`, n && (a.style.opacity = i.toString());
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: (a) => ({
150
+ in: (r) => ({
26
151
  spring: {
27
152
  stiffness: 100,
28
153
  damping: 20
29
154
  },
30
- tick: (i) => {
31
- a.style.transform = `translateX(${-(1 - i) * 20}%)`, n && (a.style.opacity = i.toString());
155
+ tick: (n) => {
156
+ r.style.transform = `translateX(${-(1 - n) * 20}%)`, i && (r.style.opacity = n.toString());
32
157
  }
33
158
  }),
34
- out: (a) => ({
159
+ out: (r) => ({
35
160
  spring: {
36
161
  stiffness: 100,
37
162
  damping: 20
38
163
  },
39
- prepare: (i) => {
40
- x(i), i.style.zIndex = "100";
164
+ prepare: (n) => {
165
+ A(n), n.style.zIndex = "100";
41
166
  },
42
- tick: (i) => {
43
- a.style.transform = `translateX(${(1 - i) * 100}%)`, n && (a.style.opacity = i.toString());
167
+ tick: (n) => {
168
+ r.style.transform = `translateX(${(1 - n) * 100}%)`, i && (r.style.opacity = n.toString());
44
169
  }
45
170
  })
46
171
  };
47
- }, q = { stiffness: 400, damping: 20 }, F = { stiffness: 40, damping: 8 }, X = 100, v = (t = {}) => {
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: n = F,
50
- outSpring: s = q,
51
- transitionDelay: e = X
174
+ inSpring: i = q,
175
+ outSpring: l = N,
176
+ transitionDelay: e = B
52
177
  } = t;
53
- let l, r = null;
178
+ let s, o = null;
54
179
  return {
55
- in: (a) => ({
56
- spring: n,
57
- prepare: (i) => {
58
- i.style.opacity = "0";
180
+ in: (r) => ({
181
+ spring: i,
182
+ prepare: (n) => {
183
+ n.style.opacity = "0";
59
184
  },
60
185
  wait: async () => {
61
- l && (await l, await Y(e));
186
+ s && (await s, await C(e));
62
187
  },
63
- tick: (i) => {
64
- a.style.opacity = i.toString();
188
+ tick: (n) => {
189
+ r.style.opacity = n.toString();
65
190
  }
66
191
  }),
67
- out: (a) => (l = new Promise((i) => {
68
- r = i;
192
+ out: (r) => (s = new Promise((n) => {
193
+ o = n;
69
194
  }), {
70
- spring: s,
71
- tick: (i) => {
72
- a.style.opacity = i.toString();
195
+ spring: l,
196
+ tick: (n) => {
197
+ r.style.opacity = n.toString();
73
198
  },
74
- prepare: x,
199
+ prepare: A,
75
200
  onEnd: () => {
76
- r && r();
201
+ o && o();
77
202
  }
78
203
  })
79
204
  };
80
205
  };
81
- function z(t, n) {
82
- return t.querySelector(`[data-hero-key="${n}"]`);
83
- }
84
- function A(t, n) {
85
- const s = t.getBoundingClientRect(), e = n.getBoundingClientRect();
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
- e.left - s.left,
88
- e.top - s.top,
89
- e.width,
90
- e.height
217
+ s.left - e.left,
218
+ s.top - e.top,
219
+ s.width,
220
+ s.height
91
221
  );
92
222
  }
93
- const H = (t = {}) => {
94
- var r, a;
95
- const n = {
96
- stiffness: ((r = t.spring) == null ? void 0 : r.stiffness) ?? 300,
97
- damping: ((a = t.spring) == null ? void 0 : a.damping) ?? 30
98
- }, s = t.timeout ?? 300;
99
- let e = null, l = null;
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 (i, o) => {
102
- const c = i, y = Array.from(c.querySelectorAll("[data-hero-key]"));
103
- if (y.length === 0)
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: n,
238
+ spring: i,
106
239
  tick: () => {
107
240
  }
108
241
  // No hero elements, skip animation
109
242
  };
110
- if (!await new Promise((h) => {
111
- e ? h(!0) : (l = h, setTimeout(() => {
112
- l = null, h(!1);
113
- }, s));
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: n,
249
+ spring: i,
117
250
  tick: () => {
118
251
  }
119
252
  // No fromNode, skip animation
120
253
  };
121
- const p = y.map((h) => {
122
- const $ = h.getAttribute("data-hero-key");
123
- if (!$) return null;
124
- const u = z(e, $);
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 g = h, f = A(e, u), w = A(c, g), k = f.left - w.left - o.scrollOffset.x, T = f.top - w.top - o.scrollOffset.y, m = f.width / w.width, D = f.height / w.height, E = g.style.transform, B = g.style.position, L = g.style.transformOrigin, P = g.style.zIndex;
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: g,
129
- dx: k,
130
- dy: T,
131
- dw: m,
261
+ toEl: y,
262
+ dx: x,
263
+ dy: k,
264
+ dw: T,
132
265
  dh: D,
133
- originalTransform: E,
134
- originalPosition: B,
135
- originalTransformOrigin: L,
136
- originalZIndex: P
266
+ originalTransform: b,
267
+ originalPosition: L,
268
+ originalTransformOrigin: P,
269
+ originalZIndex: _
137
270
  };
138
271
  }).filter(Boolean);
139
- return e = null, p.length === 0 ? {
140
- spring: n,
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: n,
278
+ spring: i,
146
279
  prepare: () => {
147
- p.forEach(({ toEl: h }) => {
148
- h.style.position = "relative", h.style.transformOrigin = "top left", h.style.zIndex = "1000";
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: (h) => {
152
- p.forEach(({ toEl: $, dx: u, dy: g, dw: f, dh: w }) => {
153
- $.style.transform = `translate(${(1 - h) * u}px,${(1 - h) * g}px) scale(${h + (1 - h) * f}, ${h + (1 - h) * w})`;
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
- p.forEach(
290
+ h.forEach(
158
291
  ({
159
- toEl: h,
160
- originalTransform: $,
292
+ toEl: a,
293
+ originalTransform: f,
161
294
  originalPosition: u,
162
- originalTransformOrigin: g,
163
- originalZIndex: f
295
+ originalTransformOrigin: y,
296
+ originalZIndex: g
164
297
  }) => {
165
- h.style.transform = $, h.style.position = u, h.style.transformOrigin = g, h.style.zIndex = f;
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 (i) => ({
304
+ out: async (n) => ({
172
305
  onStart: () => {
173
- e = i, l && (l(!0), l = null);
306
+ e = n, s && (s(!0), s = null);
174
307
  },
175
- prepare: (o) => {
176
- x(o), o.style.opacity = "0";
308
+ prepare: (c) => {
309
+ A(c), c.style.opacity = "0";
177
310
  }
178
311
  })
179
312
  };
180
313
  };
181
- function S(t, n) {
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: n,
193
- pageRect: s,
316
+ galleryRect: i,
317
+ pageRect: l,
194
318
  scrollOffset: e
195
- }, l) {
196
- const r = n.left - t.left + (n.width - t.width) / 2 - e.x, a = n.top - t.top + (n.height - t.height) / 2 - e.y, i = n.width / t.width, o = n.height / t.height, c = Math.max(i, o), y = t.top / s.height * 100, d = (s.width - (t.left + t.width)) / s.width * 100, p = (s.height - (t.top + t.height)) / s.height * 100, h = t.left / s.width * 100;
197
- return l.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, ($) => {
198
- const u = 1 - $, g = y * u, f = d * u, w = p * u, k = h * u;
199
- l.style.clipPath = `inset(${g}% ${f}% ${w}% ${k}%)`, l.style.transform = `translate(${r * u}px, ${a * u}px) scale(${1 + (c - 1) * u})`;
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 M({
326
+ function H({
203
327
  galleryRect: t,
204
- detailRect: n,
205
- scrollOffset: s
328
+ detailRect: i,
329
+ scrollOffset: l
206
330
  }, e) {
207
- const l = n.left - t.left + (n.width - t.width) / 2 + s.x, r = n.top - t.top + (n.height - t.height) / 2 + s.y, a = n.width / t.width, i = n.height / t.height, o = Math.max(a, i);
208
- return (c) => {
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 y = 1 - c;
211
- e.style.transform = `translate(${l * y - s.x}px, ${r * y - s.y}px) scale(${1 + (o - 1) * y})`, e.style.opacity = `${1 - y}`;
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 O({
338
+ function W({
215
339
  galleryRect: t,
216
- detailRect: n,
217
- scrollOffset: s
340
+ detailRect: i,
341
+ scrollOffset: l
218
342
  }, e) {
219
- const l = n.left - t.left + (n.width - t.width) / 2 - s.x, r = n.top - t.top + (n.height - t.height) / 2 - s.y, a = n.width / t.width, i = n.height / t.height, o = Math.max(a, i);
220
- return (c) => {
221
- const y = 1 - c, d = c;
222
- e.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, e.style.transform = `translate(${l * y}px, ${r * y}px) scale(${1 + (o - 1) * y})`, e.style.opacity = `${d}`;
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: n,
228
- pageRect: s,
351
+ galleryRect: i,
352
+ pageRect: l,
229
353
  scrollOffset: e
230
- }, l) {
231
- const r = n.left - t.left + (n.width - t.width) / 2 + e.x, a = n.top - t.top + (n.height - t.height) / 2 + e.y, i = n.width / t.width, o = n.height / t.height, c = Math.min(i, o), y = t.top / s.height * 100, d = (s.width - (t.left + t.width)) / s.width * 100, p = (s.height - (t.top + t.height)) / s.height * 100, h = t.left / s.width * 100;
232
- return l.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, ($) => {
233
- const u = 1 - $, g = y * u, f = d * u, w = p * u, k = h * u;
234
- l.style.clipPath = `inset(${g}% ${f}% ${w}% ${k}%)`, l.style.transform = `translate(${r * u - e.x}px, ${a * u - e.y}px) scale(${1 + (c - 1) * u})`;
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 U(t, n, s) {
361
+ function j(t, i, l) {
238
362
  const e = t.querySelector(
239
363
  "[data-pinterest-detail-key]"
240
- ), l = n.querySelector(
364
+ ), s = i.querySelector(
241
365
  "[data-pinterest-detail-key]"
242
366
  );
243
- if (t.querySelectorAll("[data-pinterest-detail-key]").length > 1 || n.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 r = null, a = null, i = !1;
246
- if (!e && l) {
247
- a = l;
248
- const d = a.getAttribute("data-pinterest-detail-key");
249
- if (!d) return null;
250
- r = t.querySelector(
251
- `[data-pinterest-gallery-key="${d}"]`
252
- ), r && (i = !0);
253
- } else if (e && !l) {
254
- a = e;
255
- const d = a.getAttribute("data-pinterest-detail-key");
256
- if (!d) return null;
257
- r = n.querySelector(
258
- `[data-pinterest-gallery-key="${d}"]`
259
- ), r && (i = !1);
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 (!r || !a)
385
+ if (!o || !r)
262
386
  return null;
263
- const o = S(i ? t : n, r), c = S(i ? n : t, a), y = n.getBoundingClientRect();
264
- return i ? {
265
- inAnimation: C(
266
- { detailRect: c, galleryRect: o, pageRect: y, scrollOffset: s },
267
- n
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: M(
270
- { galleryRect: o, detailRect: c, scrollOffset: s },
393
+ outAnimation: H(
394
+ { galleryRect: c, detailRect: d, scrollOffset: l },
271
395
  t
272
396
  )
273
397
  } : {
274
- inAnimation: O(
275
- { galleryRect: o, detailRect: c, scrollOffset: s },
276
- n
398
+ inAnimation: W(
399
+ { galleryRect: c, detailRect: d, scrollOffset: l },
400
+ i
277
401
  ),
278
- outAnimation: _(
279
- { detailRect: c, galleryRect: o, pageRect: y, scrollOffset: s },
402
+ outAnimation: Z(
403
+ { detailRect: d, galleryRect: c, pageRect: p, scrollOffset: l },
280
404
  t
281
405
  )
282
406
  };
283
407
  }
284
- const N = (t = {}) => {
285
- var a, i;
286
- const n = {
287
- stiffness: ((a = t.spring) == null ? void 0 : a.stiffness) ?? 50,
288
- damping: ((i = t.spring) == null ? void 0 : i.damping) ?? 10
289
- }, s = t.timeout ?? 300;
290
- let e = null, l = null, r = 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 (o, { scrollOffset: c }) => {
293
- const y = o;
294
- return !await new Promise((p) => {
295
- e ? p(!0) : (l = p, setTimeout(() => {
296
- l = null, p(!1);
297
- }, s));
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: n,
423
+ spring: i,
300
424
  tick: () => {
301
425
  }
302
- }) : (r = U(e, y, c), r ? (e = null, {
303
- spring: n,
304
- tick: (p) => {
305
- r && r.inAnimation(p);
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: n,
432
+ spring: i,
309
433
  tick: () => {
310
434
  }
311
435
  });
312
436
  },
313
- out: async (o) => ({
314
- spring: n,
437
+ out: async (c) => ({
438
+ spring: i,
315
439
  onStart: () => {
316
- e = o, l && (l(!0), l = null);
440
+ e = c, s && (s(!0), s = null);
317
441
  },
318
- prepare: (c) => {
319
- x(c), c.style.zIndex = "-1";
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
- tick: (c) => {
322
- r && r.outAnimation(c);
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
- }, Z = (t = {}) => {
330
- var l, r;
331
- const n = t.direction ?? "up", s = {
332
- stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ?? I.stiffness,
333
- damping: ((r = t.spring) == null ? void 0 : r.damping) ?? I.damping
334
- }, e = n === "up";
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: (a) => ({
337
- spring: s,
338
- tick: (i) => {
339
- const o = e ? (1 - i) * 100 : (1 - i) * -100;
340
- a.style.transform = `translateY(${o}vh)`;
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: (a) => ({
344
- spring: s,
345
- tick: (i) => {
346
- const o = e ? (1 - i) * -100 : (1 - i) * 100;
347
- a.style.transform = `translateY(${o}vh)`;
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: (i) => {
350
- x(i), i.style.zIndex = e ? "-1" : "1";
501
+ prepare: (n) => {
502
+ E(n), n.style.zIndex = e ? "-1" : "1";
351
503
  }
352
504
  })
353
505
  };
354
506
  };
355
507
  export {
356
- b as drill,
357
- v as fade,
358
- H as hero,
359
- N as pinterest,
360
- Z as scroll
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
  };