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