@ssgoi/core 2.0.0 → 2.1.2

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 (44) hide show
  1. package/dist/create-ssgoi-transition-context.d.ts.map +1 -1
  2. package/dist/create-transition-callback.d.ts.map +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.js +284 -238
  5. package/dist/transition-strategy.d.ts.map +1 -1
  6. package/dist/transition.d.ts +51 -11
  7. package/dist/transition.d.ts.map +1 -1
  8. package/dist/transitions/blur.d.ts +3 -0
  9. package/dist/transitions/blur.d.ts.map +1 -1
  10. package/dist/transitions/bounce.d.ts +3 -0
  11. package/dist/transitions/bounce.d.ts.map +1 -1
  12. package/dist/transitions/fade.d.ts +3 -0
  13. package/dist/transitions/fade.d.ts.map +1 -1
  14. package/dist/transitions/fly.d.ts +3 -0
  15. package/dist/transitions/fly.d.ts.map +1 -1
  16. package/dist/transitions/index.cjs +1 -1
  17. package/dist/transitions/index.js +121 -105
  18. package/dist/transitions/none.d.ts +3 -0
  19. package/dist/transitions/none.d.ts.map +1 -1
  20. package/dist/transitions/rotate.d.ts +3 -0
  21. package/dist/transitions/rotate.d.ts.map +1 -1
  22. package/dist/transitions/scale.d.ts +3 -0
  23. package/dist/transitions/scale.d.ts.map +1 -1
  24. package/dist/transitions/slide.d.ts +3 -0
  25. package/dist/transitions/slide.d.ts.map +1 -1
  26. package/dist/types.d.ts +11 -1
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/utils-8Eptbv7c.cjs +2 -0
  29. package/dist/utils-DTRMUQW4.js +31 -0
  30. package/dist/utils.d.ts +11 -0
  31. package/dist/utils.d.ts.map +1 -1
  32. package/dist/view-transitions/drill.d.ts +9 -0
  33. package/dist/view-transitions/drill.d.ts.map +1 -0
  34. package/dist/view-transitions/fade.d.ts +3 -1
  35. package/dist/view-transitions/fade.d.ts.map +1 -1
  36. package/dist/view-transitions/hero.d.ts.map +1 -1
  37. package/dist/view-transitions/index.cjs +1 -1
  38. package/dist/view-transitions/index.d.ts +1 -0
  39. package/dist/view-transitions/index.d.ts.map +1 -1
  40. package/dist/view-transitions/index.js +234 -169
  41. package/dist/view-transitions/scroll.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/utils-BSgyev81.cjs +0 -1
  44. package/dist/utils-DR41YsAh.js +0 -16
@@ -1,84 +1,142 @@
1
- import { p as k } from "../utils-DR41YsAh.js";
2
- const X = (t = {}) => {
3
- var e, i;
4
- const n = {
5
- stiffness: ((e = t.spring) == null ? void 0 : e.stiffness) ?? 300,
6
- damping: ((i = t.spring) == null ? void 0 : i.damping) ?? 30
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
7
+ };
8
+ return s === "enter" ? {
9
+ in: (a) => ({
10
+ spring: e,
11
+ tick: (i) => {
12
+ a.style.transform = `translateX(${(1 - i) * 100}%)`, n && (a.style.opacity = i.toString());
13
+ }
14
+ }),
15
+ out: (a) => ({
16
+ spring: e,
17
+ prepare: (i) => {
18
+ x(i), i.style.zIndex = "-1";
19
+ },
20
+ tick: (i) => {
21
+ a.style.transform = `translateX(${-(1 - i) * 20}%)`, n && (a.style.opacity = i.toString());
22
+ }
23
+ })
24
+ } : {
25
+ in: (a) => ({
26
+ spring: {
27
+ stiffness: 100,
28
+ damping: 20
29
+ },
30
+ tick: (i) => {
31
+ a.style.transform = `translateX(${-(1 - i) * 20}%)`, n && (a.style.opacity = i.toString());
32
+ }
33
+ }),
34
+ out: (a) => ({
35
+ spring: {
36
+ stiffness: 100,
37
+ damping: 20
38
+ },
39
+ prepare: (i) => {
40
+ x(i), i.style.zIndex = "100";
41
+ },
42
+ tick: (i) => {
43
+ a.style.transform = `translateX(${(1 - i) * 100}%)`, n && (a.style.opacity = i.toString());
44
+ }
45
+ })
7
46
  };
47
+ }, q = { stiffness: 400, damping: 20 }, F = { stiffness: 40, damping: 8 }, X = 100, v = (t = {}) => {
48
+ const {
49
+ inSpring: n = F,
50
+ outSpring: s = q,
51
+ transitionDelay: e = X
52
+ } = t;
53
+ let l, r = null;
8
54
  return {
9
- in: (s) => ({
55
+ in: (a) => ({
10
56
  spring: n,
11
- tick: (l) => {
12
- s.style.opacity = l.toString();
57
+ prepare: (i) => {
58
+ i.style.opacity = "0";
59
+ },
60
+ wait: async () => {
61
+ l && (await l, await Y(e));
62
+ },
63
+ tick: (i) => {
64
+ a.style.opacity = i.toString();
13
65
  }
14
66
  }),
15
- out: (s) => ({
16
- spring: n,
17
- tick: (l) => {
18
- s.style.opacity = l.toString();
67
+ out: (a) => (l = new Promise((i) => {
68
+ r = i;
69
+ }), {
70
+ spring: s,
71
+ tick: (i) => {
72
+ a.style.opacity = i.toString();
19
73
  },
20
- prepare: k
74
+ prepare: x,
75
+ onEnd: () => {
76
+ r && r();
77
+ }
21
78
  })
22
79
  };
23
80
  };
24
- function M(t, n) {
81
+ function z(t, n) {
25
82
  return t.querySelector(`[data-hero-key="${n}"]`);
26
83
  }
27
84
  function A(t, n) {
28
- const e = t.getBoundingClientRect(), i = n.getBoundingClientRect();
85
+ const s = t.getBoundingClientRect(), e = n.getBoundingClientRect();
29
86
  return new DOMRect(
30
- i.left - e.left,
31
- i.top - e.top,
32
- i.width,
33
- i.height
87
+ e.left - s.left,
88
+ e.top - s.top,
89
+ e.width,
90
+ e.height
34
91
  );
35
92
  }
36
- const b = (t = {}) => {
37
- var l, h;
93
+ const H = (t = {}) => {
94
+ var r, a;
38
95
  const n = {
39
- stiffness: ((l = t.spring) == null ? void 0 : l.stiffness) ?? 300,
40
- damping: ((h = t.spring) == null ? void 0 : h.damping) ?? 30
41
- }, e = t.timeout ?? 300;
42
- let i = null, s = null;
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;
43
100
  return {
44
- in: async (a, r) => {
45
- const u = a, g = Array.from(u.querySelectorAll("[data-hero-key]"));
46
- if (g.length === 0)
101
+ in: async (i, o) => {
102
+ const c = i, y = Array.from(c.querySelectorAll("[data-hero-key]"));
103
+ if (y.length === 0)
47
104
  return {
48
105
  spring: n,
49
106
  tick: () => {
50
107
  }
51
108
  // No hero elements, skip animation
52
109
  };
53
- if (!await new Promise((o) => {
54
- i ? o(!0) : (s = o, setTimeout(() => {
55
- s = null, o(!1);
56
- }, e));
57
- }) || !i)
58
- return i = null, {
110
+ if (!await new Promise((h) => {
111
+ e ? h(!0) : (l = h, setTimeout(() => {
112
+ l = null, h(!1);
113
+ }, s));
114
+ }) || !e)
115
+ return e = null, {
59
116
  spring: n,
60
117
  tick: () => {
61
118
  }
62
119
  // No fromNode, skip animation
63
120
  };
64
- const y = g.map((o) => {
65
- const $ = o.getAttribute("data-hero-key");
121
+ const p = y.map((h) => {
122
+ const $ = h.getAttribute("data-hero-key");
66
123
  if (!$) return null;
67
- const c = M(i, $);
68
- if (!c) return null;
69
- const d = o, w = A(i, c), f = A(u, d), x = w.left - f.left - r.scrollOffset.x, B = w.top - f.top - r.scrollOffset.y, q = w.width / f.width, T = w.height / f.height, Y = d.style.transform, m = d.style.position, E = d.style.transformOrigin;
124
+ const u = z(e, $);
125
+ 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;
70
127
  return {
71
- toEl: d,
72
- dx: x,
73
- dy: B,
74
- dw: q,
75
- dh: T,
76
- originalTransform: Y,
77
- originalPosition: m,
78
- originalTransformOrigin: E
128
+ toEl: g,
129
+ dx: k,
130
+ dy: T,
131
+ dw: m,
132
+ dh: D,
133
+ originalTransform: E,
134
+ originalPosition: B,
135
+ originalTransformOrigin: L,
136
+ originalZIndex: P
79
137
  };
80
138
  }).filter(Boolean);
81
- return i = null, y.length === 0 ? {
139
+ return e = null, p.length === 0 ? {
82
140
  spring: n,
83
141
  tick: () => {
84
142
  }
@@ -86,164 +144,165 @@ const b = (t = {}) => {
86
144
  } : {
87
145
  spring: n,
88
146
  prepare: () => {
89
- y.forEach(({ toEl: o }) => {
90
- o.style.position = "relative", o.style.transformOrigin = "top left";
147
+ p.forEach(({ toEl: h }) => {
148
+ h.style.position = "relative", h.style.transformOrigin = "top left", h.style.zIndex = "1000";
91
149
  });
92
150
  },
93
- tick: (o) => {
94
- y.forEach(({ toEl: $, dx: c, dy: d, dw: w, dh: f }) => {
95
- $.style.transform = `translate(${(1 - o) * c}px,${(1 - o) * d}px) scale(${o + (1 - o) * w}, ${o + (1 - o) * f})`;
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})`;
96
154
  });
97
155
  },
98
156
  onEnd: () => {
99
- y.forEach(
157
+ p.forEach(
100
158
  ({
101
- toEl: o,
159
+ toEl: h,
102
160
  originalTransform: $,
103
- originalPosition: c,
104
- originalTransformOrigin: d
161
+ originalPosition: u,
162
+ originalTransformOrigin: g,
163
+ originalZIndex: f
105
164
  }) => {
106
- o.style.transform = $, o.style.position = c, o.style.transformOrigin = d;
165
+ h.style.transform = $, h.style.position = u, h.style.transformOrigin = g, h.style.zIndex = f;
107
166
  }
108
167
  );
109
168
  }
110
169
  };
111
170
  },
112
- out: async (a) => ({
171
+ out: async (i) => ({
113
172
  onStart: () => {
114
- i = a, s && (s(!0), s = null);
173
+ e = i, l && (l(!0), l = null);
115
174
  },
116
- prepare: (r) => {
117
- k(r), r.style.opacity = "0";
175
+ prepare: (o) => {
176
+ x(o), o.style.opacity = "0";
118
177
  }
119
178
  })
120
179
  };
121
180
  };
122
181
  function S(t, n) {
123
- const e = t.getBoundingClientRect(), i = n.getBoundingClientRect();
182
+ const s = t.getBoundingClientRect(), e = n.getBoundingClientRect();
124
183
  return new DOMRect(
125
- i.left - e.left,
126
- i.top - e.top,
127
- i.width,
128
- i.height
184
+ e.left - s.left,
185
+ e.top - s.top,
186
+ e.width,
187
+ e.height
129
188
  );
130
189
  }
131
190
  function C({
132
191
  detailRect: t,
133
192
  galleryRect: n,
134
- pageRect: e,
135
- scrollOffset: i
136
- }, s) {
137
- const l = n.left - t.left + (n.width - t.width) / 2 - i.x, h = n.top - t.top + (n.height - t.height) / 2 - i.y, a = n.width / t.width, r = n.height / t.height, u = Math.max(a, r), g = t.top / e.height * 100, p = (e.width - (t.left + t.width)) / e.width * 100, y = (e.height - (t.top + t.height)) / e.height * 100, o = t.left / e.width * 100;
138
- return s.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, ($) => {
139
- const c = 1 - $, d = g * c, w = p * c, f = y * c, x = o * c;
140
- s.style.clipPath = `inset(${d}% ${w}% ${f}% ${x}%)`, s.style.transform = `translate(${l * c}px, ${h * c}px) scale(${1 + (u - 1) * c})`;
193
+ pageRect: s,
194
+ 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})`;
141
200
  };
142
201
  }
143
- function D({
202
+ function M({
144
203
  galleryRect: t,
145
204
  detailRect: n,
146
- scrollOffset: e
147
- }, i) {
148
- const s = n.left - t.left + (n.width - t.width) / 2 + e.x, l = n.top - t.top + (n.height - t.height) / 2 + e.y, h = n.width / t.width, a = n.height / t.height, r = Math.max(h, a);
149
- return (u) => {
150
- i.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`;
151
- const g = 1 - u;
152
- i.style.transform = `translate(${s * g - e.x}px, ${l * g - e.y}px) scale(${1 + (r - 1) * g})`, i.style.opacity = `${1 - g}`;
205
+ scrollOffset: s
206
+ }, 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) => {
209
+ 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}`;
153
212
  };
154
213
  }
155
- function P({
214
+ function O({
156
215
  galleryRect: t,
157
216
  detailRect: n,
158
- scrollOffset: e
159
- }, i) {
160
- const s = n.left - t.left + (n.width - t.width) / 2 - e.x, l = n.top - t.top + (n.height - t.height) / 2 - e.y, h = n.width / t.width, a = n.height / t.height, r = Math.max(h, a);
161
- return (u) => {
162
- const g = 1 - u, p = u;
163
- i.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, i.style.transform = `translate(${s * g}px, ${l * g}px) scale(${1 + (r - 1) * g})`, i.style.opacity = `${p}`;
217
+ scrollOffset: s
218
+ }, 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}`;
164
223
  };
165
224
  }
166
- function F({
225
+ function _({
167
226
  detailRect: t,
168
227
  galleryRect: n,
169
- pageRect: e,
170
- scrollOffset: i
171
- }, s) {
172
- const l = n.left - t.left + (n.width - t.width) / 2 + i.x, h = n.top - t.top + (n.height - t.height) / 2 + i.y, a = n.width / t.width, r = n.height / t.height, u = Math.min(a, r), g = t.top / e.height * 100, p = (e.width - (t.left + t.width)) / e.width * 100, y = (e.height - (t.top + t.height)) / e.height * 100, o = t.left / e.width * 100;
173
- return s.style.transformOrigin = `${t.left + t.width / 2}px ${t.top + t.height / 2}px`, ($) => {
174
- const c = 1 - $, d = g * c, w = p * c, f = y * c, x = o * c;
175
- s.style.clipPath = `inset(${d}% ${w}% ${f}% ${x}%)`, s.style.transform = `translate(${l * c - i.x}px, ${h * c - i.y}px) scale(${1 + (u - 1) * c})`;
228
+ pageRect: s,
229
+ 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})`;
176
235
  };
177
236
  }
178
- function L(t, n, e) {
179
- const i = t.querySelector(
237
+ function U(t, n, s) {
238
+ const e = t.querySelector(
180
239
  "[data-pinterest-detail-key]"
181
- ), s = n.querySelector(
240
+ ), l = n.querySelector(
182
241
  "[data-pinterest-detail-key]"
183
242
  );
184
243
  if (t.querySelectorAll("[data-pinterest-detail-key]").length > 1 || n.querySelectorAll("[data-pinterest-detail-key]").length > 1)
185
244
  return null;
186
- let l = null, h = null, a = !1;
187
- if (!i && s) {
188
- h = s;
189
- const p = h.getAttribute("data-pinterest-detail-key");
190
- if (!p) return null;
191
- l = t.querySelector(
192
- `[data-pinterest-gallery-key="${p}"]`
193
- ), l && (a = !0);
194
- } else if (i && !s) {
195
- h = i;
196
- const p = h.getAttribute("data-pinterest-detail-key");
197
- if (!p) return null;
198
- l = n.querySelector(
199
- `[data-pinterest-gallery-key="${p}"]`
200
- ), l && (a = !1);
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);
201
260
  }
202
- if (!l || !h)
261
+ if (!r || !a)
203
262
  return null;
204
- const r = S(a ? t : n, l), u = S(a ? n : t, h), g = n.getBoundingClientRect();
205
- return a ? {
263
+ const o = S(i ? t : n, r), c = S(i ? n : t, a), y = n.getBoundingClientRect();
264
+ return i ? {
206
265
  inAnimation: C(
207
- { detailRect: u, galleryRect: r, pageRect: g, scrollOffset: e },
266
+ { detailRect: c, galleryRect: o, pageRect: y, scrollOffset: s },
208
267
  n
209
268
  ),
210
- outAnimation: D(
211
- { galleryRect: r, detailRect: u, scrollOffset: e },
269
+ outAnimation: M(
270
+ { galleryRect: o, detailRect: c, scrollOffset: s },
212
271
  t
213
272
  )
214
273
  } : {
215
- inAnimation: P(
216
- { galleryRect: r, detailRect: u, scrollOffset: e },
274
+ inAnimation: O(
275
+ { galleryRect: o, detailRect: c, scrollOffset: s },
217
276
  n
218
277
  ),
219
- outAnimation: F(
220
- { detailRect: u, galleryRect: r, pageRect: g, scrollOffset: e },
278
+ outAnimation: _(
279
+ { detailRect: c, galleryRect: o, pageRect: y, scrollOffset: s },
221
280
  t
222
281
  )
223
282
  };
224
283
  }
225
- const I = (t = {}) => {
226
- var h, a;
284
+ const N = (t = {}) => {
285
+ var a, i;
227
286
  const n = {
228
- stiffness: ((h = t.spring) == null ? void 0 : h.stiffness) ?? 50,
229
- damping: ((a = t.spring) == null ? void 0 : a.damping) ?? 10
230
- }, e = t.timeout ?? 300;
231
- let i = null, s = null, l = null;
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;
232
291
  return {
233
- in: async (r, { scrollOffset: u }) => {
234
- const g = r;
235
- return !await new Promise((y) => {
236
- i ? y(!0) : (s = y, setTimeout(() => {
237
- s = null, y(!1);
238
- }, e));
239
- }) || !i ? (i = null, {
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));
298
+ }) || !e ? (e = null, {
240
299
  spring: n,
241
300
  tick: () => {
242
301
  }
243
- }) : (l = L(i, g, u), l ? (i = null, {
302
+ }) : (r = U(e, y, c), r ? (e = null, {
244
303
  spring: n,
245
- tick: (y) => {
246
- l && l.inAnimation(y);
304
+ tick: (p) => {
305
+ r && r.inAnimation(p);
247
306
  }
248
307
  }) : {
249
308
  spring: n,
@@ -251,46 +310,52 @@ const I = (t = {}) => {
251
310
  }
252
311
  });
253
312
  },
254
- out: async (r) => ({
313
+ out: async (o) => ({
255
314
  spring: n,
256
315
  onStart: () => {
257
- i = r, s && (s(!0), s = null);
316
+ e = o, l && (l(!0), l = null);
258
317
  },
259
- prepare: (u) => {
260
- k(u), u.style.zIndex = "-1";
318
+ prepare: (c) => {
319
+ x(c), c.style.zIndex = "-1";
261
320
  },
262
- tick: (u) => {
263
- l && l.outAnimation(u);
321
+ tick: (c) => {
322
+ r && r.outAnimation(c);
264
323
  }
265
324
  })
266
325
  };
267
- }, G = (t = {}) => {
268
- var s, l;
269
- const n = t.direction ?? "up", e = {
270
- stiffness: ((s = t.spring) == null ? void 0 : s.stiffness) ?? 300,
271
- damping: ((l = t.spring) == null ? void 0 : l.damping) ?? 30
272
- }, i = n === "up";
326
+ }, I = {
327
+ stiffness: 30,
328
+ 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";
273
335
  return {
274
- in: (h) => ({
275
- spring: e,
276
- tick: (a) => {
277
- const r = i ? (1 - a) * 100 : (1 - a) * -100;
278
- h.style.transform = `translateY(${r}%)`;
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)`;
279
341
  }
280
342
  }),
281
- out: (h) => ({
282
- spring: e,
283
- tick: (a) => {
284
- const r = i ? (1 - a) * -100 : (1 - a) * 100;
285
- h.style.transform = `translateY(${r}%)`;
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)`;
286
348
  },
287
- prepare: k
349
+ prepare: (i) => {
350
+ x(i), i.style.zIndex = e ? "-1" : "1";
351
+ }
288
352
  })
289
353
  };
290
354
  };
291
355
  export {
292
- X as fade,
293
- b as hero,
294
- I as pinterest,
295
- G as scroll
356
+ b as drill,
357
+ v as fade,
358
+ H as hero,
359
+ N as pinterest,
360
+ Z as scroll
296
361
  };
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,MAAM,GAAI,UAAS,aAAkB,KAAG,eA8BpD,CAAC"}
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAOD,eAAO,MAAM,MAAM,GAAI,UAAS,aAAkB,KAAG,eAkCpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/core",
3
- "version": "2.0.0",
3
+ "version": "2.1.2",
4
4
  "description": "Core animation engine for SSGOI - Native app-like page transitions with spring physics",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- "use strict";const n=e=>{e.style.position="absolute",e.style.width="100%",e.style.top="0",e.style.left="0"},r=e=>{let t=e.parentElement;for(;t&&t!==document.body;){const l=window.getComputedStyle(t),o=l.overflow+l.overflowY+l.overflowX;if(o.includes("auto")||o.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement};exports.getScrollingElement=r;exports.prepareOutgoing=n;
@@ -1,16 +0,0 @@
1
- const n = (e) => {
2
- e.style.position = "absolute", e.style.width = "100%", e.style.top = "0", e.style.left = "0";
3
- }, r = (e) => {
4
- let t = e.parentElement;
5
- for (; t && t !== document.body; ) {
6
- const o = window.getComputedStyle(t), l = o.overflow + o.overflowY + o.overflowX;
7
- if (l.includes("auto") || l.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
8
- return t;
9
- t = t.parentElement;
10
- }
11
- return document.documentElement;
12
- };
13
- export {
14
- r as g,
15
- n as p
16
- };