@ssgoi/core 6.4.0 → 6.5.0-beta.1

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 (32) hide show
  1. package/README.md +73 -125
  2. package/dist/index.cjs +13 -13
  3. package/dist/index.js +865 -781
  4. package/dist/internal.cjs +1 -1
  5. package/dist/internal.js +447 -340
  6. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  7. package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -1
  8. package/dist/ssgoi-transition/visibility-observer.d.ts +66 -0
  9. package/dist/ssgoi-transition/visibility-observer.d.ts.map +1 -0
  10. package/dist/transitions/axis/provider/x/fluid.d.ts.map +1 -1
  11. package/dist/transitions/axis/provider/x/snappy.d.ts.map +1 -1
  12. package/dist/transitions/axis/provider/y/directional.d.ts.map +1 -1
  13. package/dist/transitions/axis/provider/y/non-directional.d.ts.map +1 -1
  14. package/dist/transitions/axis/provider/z/directional.d.ts.map +1 -1
  15. package/dist/transitions/axis/provider/z/non-directional.d.ts.map +1 -1
  16. package/dist/transitions/axis/transition.d.ts.map +1 -1
  17. package/dist/transitions/blind/transition.d.ts +1 -0
  18. package/dist/transitions/blind/transition.d.ts.map +1 -1
  19. package/dist/transitions/drill/transition.d.ts.map +1 -1
  20. package/dist/transitions/fade/transition.d.ts.map +1 -1
  21. package/dist/transitions/film/transition.d.ts.map +1 -1
  22. package/dist/transitions/hero/provider/chrome/static.d.ts.map +1 -1
  23. package/dist/transitions/jaemin/transition.d.ts.map +1 -1
  24. package/dist/transitions/rotate/transition.d.ts.map +1 -1
  25. package/dist/transitions/scroll/transition.d.ts.map +1 -1
  26. package/dist/transitions/sheet/transition.d.ts.map +1 -1
  27. package/dist/transitions/slide/transition.d.ts.map +1 -1
  28. package/dist/transitions/strip/transition.d.ts.map +1 -1
  29. package/dist/transitions/zoom/get-visual-rect.d.ts +25 -0
  30. package/dist/transitions/zoom/get-visual-rect.d.ts.map +1 -0
  31. package/dist/transitions/zoom/transition.d.ts.map +1 -1
  32. package/package.json +1 -1
package/dist/internal.js CHANGED
@@ -1,31 +1,31 @@
1
- var ft = Object.defineProperty;
2
- var dt = (t, n, e) => n in t ? ft(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var F = (t, n, e) => dt(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { A as ht } from "./multi-animation-CnxqLEka.js";
5
- import { M as $t, W as qt } from "./multi-animation-CnxqLEka.js";
6
- class mt extends ht {
1
+ var At = Object.defineProperty;
2
+ var Ct = (t, s, e) => s in t ? At(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var B = (t, s, e) => Ct(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import { A as xt } from "./multi-animation-CnxqLEka.js";
5
+ import { M as le, W as ce } from "./multi-animation-CnxqLEka.js";
6
+ class Mt extends xt {
7
7
  constructor() {
8
8
  super(...arguments);
9
- F(this, "child", null);
10
- F(this, "_state", "idle");
11
- F(this, "_settled", !1);
12
- F(this, "listeners", /* @__PURE__ */ new Set());
9
+ B(this, "child", null);
10
+ B(this, "_state", "idle");
11
+ B(this, "_settled", !1);
12
+ B(this, "listeners", /* @__PURE__ */ new Set());
13
13
  }
14
14
  attach(e) {
15
- const o = this.child;
16
- if (this.child = e, this._settled = !1, o) {
17
- const l = o.getPose();
18
- o.complete(), e.matchInto(l);
15
+ const n = this.child;
16
+ if (this.child = e, this._settled = !1, n) {
17
+ const c = n.getPose();
18
+ n.complete(), e.matchInto(c);
19
19
  }
20
20
  e.playbackRate = this.playbackRate;
21
- const i = e.onComplete;
21
+ const l = e.onComplete;
22
22
  e.onComplete = () => {
23
- i == null || i(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
23
+ l == null || l(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
24
  };
25
- const f = e.onUpdate;
26
- e.onUpdate = (l) => {
27
- var d;
28
- f == null || f(l), (d = this.onUpdate) == null || d.call(this, l), this.notify();
25
+ const d = e.onUpdate;
26
+ e.onUpdate = (c) => {
27
+ var y;
28
+ d == null || d(c), (y = this.onUpdate) == null || y.call(this, c), this.notify();
29
29
  }, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
30
30
  }
31
31
  play() {
@@ -63,8 +63,8 @@ class mt extends ht {
63
63
  return ((e = this.child) == null ? void 0 : e.progress) ?? 0;
64
64
  }
65
65
  findTimeForProgress(e) {
66
- var o;
67
- return ((o = this.child) == null ? void 0 : o.findTimeForProgress(e)) ?? null;
66
+ var n;
67
+ return ((n = this.child) == null ? void 0 : n.findTimeForProgress(e)) ?? null;
68
68
  }
69
69
  get playbackRate() {
70
70
  return super.playbackRate;
@@ -81,8 +81,8 @@ class mt extends ht {
81
81
  return ((e = this.child) == null ? void 0 : e.getTimeline()) ?? [];
82
82
  }
83
83
  matchInto(e) {
84
- var o;
85
- (o = this.child) == null || o.matchInto(e);
84
+ var n;
85
+ (n = this.child) == null || n.matchInto(e);
86
86
  }
87
87
  /** Currently attached child, or null when nothing is playing. */
88
88
  get activeChild() {
@@ -98,461 +98,568 @@ class mt extends ht {
98
98
  for (const e of this.listeners) e();
99
99
  }
100
100
  }
101
- const gt = (t, n) => {
101
+ const Lt = (t, s) => {
102
102
  var e;
103
- t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((e = n == null ? void 0 : n.scrollOffset) == null ? void 0 : e.y) ?? 0)}px`, t.style.left = "0";
104
- }, Q = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), yt = (t) => {
105
- let n = t.parentElement;
106
- for (; n && n !== document.body; ) {
107
- const e = window.getComputedStyle(n);
108
- if (Q.has(e.overflowY) || Q.has(e.overflowX))
109
- return n;
110
- n = n.parentElement;
103
+ t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((e = s == null ? void 0 : s.scrollOffset) == null ? void 0 : e.y) ?? 0)}px`, t.style.left = "0";
104
+ }, dt = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Ot = (t) => {
105
+ let s = t.parentElement;
106
+ for (; s && s !== document.body; ) {
107
+ const e = window.getComputedStyle(s);
108
+ if (dt.has(e.overflowY) || dt.has(e.overflowX))
109
+ return s;
110
+ s = s.parentElement;
111
111
  }
112
112
  return document.documentElement;
113
- }, pt = (t) => {
114
- let n = t.parentElement;
115
- for (; n && n !== document.body; ) {
116
- const e = window.getComputedStyle(n).position;
113
+ }, _t = (t) => {
114
+ let s = t.parentElement;
115
+ for (; s && s !== document.body; ) {
116
+ const e = window.getComputedStyle(s).position;
117
117
  if (e === "relative" || e === "absolute" || e === "fixed" || e === "sticky")
118
- return n;
119
- n = n.parentElement;
118
+ return s;
119
+ s = s.parentElement;
120
120
  }
121
121
  return document.body;
122
122
  };
123
- function Et(t) {
124
- const n = Object.keys(t);
125
- return Promise.all(n.map((e) => t[e])).then((e) => {
126
- const o = {};
127
- return n.forEach((i, f) => {
128
- o[i] = e[f];
129
- }), o;
123
+ function kt(t) {
124
+ const s = Object.keys(t);
125
+ return Promise.all(s.map((e) => t[e])).then((e) => {
126
+ const n = {};
127
+ return s.forEach((l, d) => {
128
+ n[l] = e[d];
129
+ }), n;
130
130
  });
131
131
  }
132
- function vt(t) {
133
- const n = t.filter((e) => e.symmetric).map((e) => ({
132
+ function Dt(t) {
133
+ const s = t.filter((e) => e.symmetric).map((e) => ({
134
134
  from: e.to,
135
135
  to: e.from,
136
136
  transition: e.transition
137
137
  }));
138
- return [...t, ...n];
138
+ return [...t, ...s];
139
139
  }
140
- function W(t, n) {
141
- if (n === "*")
140
+ function X(t, s) {
141
+ if (s === "*")
142
142
  return !0;
143
- if (n.endsWith("/*")) {
144
- const e = n.slice(0, -1);
143
+ if (s.endsWith("/*")) {
144
+ const e = s.slice(0, -1);
145
145
  return t.startsWith(e) && t.length > e.length;
146
146
  }
147
- return t === n;
147
+ return t === s;
148
148
  }
149
- function Tt(t, n, e) {
150
- for (const o of e)
151
- if (W(t, o.from) && W(n, o.to))
152
- return o.transition;
153
- for (const o of e)
154
- if ((o.from === "*" || W(t, o.from)) && (o.to === "*" || W(n, o.to)))
155
- return o.transition;
149
+ function Ht(t, s, e) {
150
+ for (const n of e)
151
+ if (X(t, n.from) && X(s, n.to))
152
+ return n.transition;
153
+ for (const n of e)
154
+ if ((n.from === "*" || X(t, n.from)) && (n.to === "*" || X(s, n.to)))
155
+ return n.transition;
156
156
  return null;
157
157
  }
158
- const bt = 768, wt = 10, St = 10;
159
- function Rt(t = {}) {
160
- const { preserveScroll: n = (c) => c } = t, e = typeof n == "function" ? n : () => n;
161
- let o = null, i = !1, f = !1;
162
- const l = () => {
163
- const c = (o == null ? void 0 : o.clientWidth) ?? 0, a = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
164
- return a > 0 && a < bt;
165
- }, d = () => (f || (i = l(), f = !0), i), g = (c) => {
166
- var v;
167
- const a = e(d());
168
- if (a === !1)
169
- return { preserves: !1, shared: !1, storageKey: `path:${c}` };
170
- if (a === !0)
171
- return { preserves: !0, shared: !1, storageKey: `path:${c}` };
172
- const p = ((v = a.exclude) == null ? void 0 : v.some((r) => W(c, r))) ?? !1, E = !p && !!a.key;
158
+ const Nt = 768, It = 10, Wt = 10;
159
+ function Ft(t = {}) {
160
+ const { preserveScroll: s = (a) => a } = t, e = typeof s == "function" ? s : () => s;
161
+ let n = null, l = !1, d = !1;
162
+ const c = () => {
163
+ const a = (n == null ? void 0 : n.clientWidth) ?? 0, u = a > 0 ? a : typeof window < "u" ? window.innerWidth : 0;
164
+ return u > 0 && u < Nt;
165
+ }, y = () => (d || (l = c(), d = !0), l), E = (a) => {
166
+ var w;
167
+ const u = e(y());
168
+ if (u === !1)
169
+ return { preserves: !1, shared: !1, storageKey: `path:${a}` };
170
+ if (u === !0)
171
+ return { preserves: !0, shared: !1, storageKey: `path:${a}` };
172
+ const v = ((w = u.exclude) == null ? void 0 : w.some((P) => X(a, P))) ?? !1, S = !v && !!u.key;
173
173
  return {
174
- preserves: !p,
175
- shared: E,
176
- storageKey: E ? `shared:${a.key}` : `path:${c}`
174
+ preserves: !v,
175
+ shared: S,
176
+ storageKey: S ? `shared:${u.key}` : `path:${a}`
177
177
  };
178
- }, L = (c) => g(c).preserves;
179
- let A = null;
180
- const y = /* @__PURE__ */ new Map();
181
- let S = null, O = !1, k = 0;
182
- const I = () => {
183
- o && S && !O && y.set(g(S).storageKey, {
184
- x: o.scrollLeft,
185
- y: o.scrollTop
178
+ }, O = (a) => E(a).preserves;
179
+ let _ = null;
180
+ const b = /* @__PURE__ */ new Map();
181
+ let M = null, k = !1, I = 0;
182
+ const W = () => {
183
+ n && M && !k && b.set(E(M).storageKey, {
184
+ x: n.scrollLeft,
185
+ y: n.scrollTop
186
186
  });
187
- }, _ = (c) => {
188
- if (!o) return;
189
- const a = g(c);
190
- if (a.preserves && a.shared && !y.has(a.storageKey))
187
+ }, T = (a) => {
188
+ if (!n) return;
189
+ const u = E(a);
190
+ if (u.preserves && u.shared && !b.has(u.storageKey))
191
191
  return;
192
- const p = a.preserves && y.has(a.storageKey) ? y.get(a.storageKey) : { x: 0, y: 0 };
193
- let E = 0;
194
- const v = () => {
195
- if (!o) return;
196
- o.scrollTo({
197
- top: p.y,
198
- left: p.x
199
- }), !(Math.abs(o.scrollTop - p.y) < 1 && Math.abs(o.scrollLeft - p.x) < 1) && E < wt && (E++, requestAnimationFrame(v));
192
+ const v = u.preserves && b.has(u.storageKey) ? b.get(u.storageKey) : { x: 0, y: 0 };
193
+ let S = 0;
194
+ const w = () => {
195
+ if (!n) return;
196
+ n.scrollTo({
197
+ top: v.y,
198
+ left: v.x
199
+ }), !(Math.abs(n.scrollTop - v.y) < 1 && Math.abs(n.scrollLeft - v.x) < 1) && S < It && (S++, requestAnimationFrame(w));
200
200
  };
201
- requestAnimationFrame(v);
201
+ requestAnimationFrame(w);
202
202
  };
203
203
  return {
204
- initializeContext: (c, a) => {
205
- O = !0;
206
- const p = ++k;
207
- A = c, o || (o = yt(c), i = l(), f = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
- i = l();
209
- }).observe(o), (o === document.documentElement ? window : o).addEventListener("scroll", I, {
204
+ initializeContext: (a, u) => {
205
+ k = !0;
206
+ const v = ++I;
207
+ _ = a, n || (n = Ot(a), l = c(), d = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
+ l = c();
209
+ }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", W, {
210
210
  passive: !0
211
- })), S = a, _(a);
212
- let E = 0;
213
- const v = () => {
214
- p === k && (E++, E >= St ? O = !1 : requestAnimationFrame(v));
211
+ })), M = u, T(u);
212
+ let S = 0;
213
+ const w = () => {
214
+ v === I && (S++, S >= Wt ? k = !1 : requestAnimationFrame(w));
215
215
  };
216
- requestAnimationFrame(v);
216
+ requestAnimationFrame(w);
217
217
  },
218
- calculateScrollOffset: (c, a) => {
219
- const p = c ? g(c).storageKey : null, E = p && y.has(p) ? y.get(p) : { x: 0, y: 0 }, v = a ? g(a) : null, r = v != null && v.preserves ? v.storageKey : null, s = r && y.has(r) ? y.get(r) : { x: 0, y: 0 };
218
+ calculateScrollOffset: (a, u) => {
219
+ const v = a ? E(a).storageKey : null, S = v && b.has(v) ? b.get(v) : { x: 0, y: 0 }, w = u ? E(u) : null, P = w != null && w.preserves ? w.storageKey : null, F = P && b.has(P) ? b.get(P) : { x: 0, y: 0 };
220
220
  return {
221
- x: -s.x + E.x,
222
- y: -s.y + E.y
221
+ x: -F.x + S.x,
222
+ y: -F.y + S.y
223
223
  };
224
224
  },
225
- evictScrollPosition: (c) => {
226
- y.delete(g(c).storageKey);
225
+ evictScrollPosition: (a) => {
226
+ b.delete(E(a).storageKey);
227
227
  },
228
- shouldPreserve: L,
229
- getScrollContainer: () => o,
230
- getPositionedParentElement: () => A ? pt(A) : document.body,
231
- getScrollPosition: (c) => {
232
- const a = c ? g(c).storageKey : null;
233
- return a && y.has(a) ? y.get(a) : { x: 0, y: 0 };
228
+ shouldPreserve: O,
229
+ getScrollContainer: () => n,
230
+ getPositionedParentElement: () => _ ? _t(_) : document.body,
231
+ getScrollPosition: (a) => {
232
+ const u = a ? E(a).storageKey : null;
233
+ return u && b.has(u) ? b.get(u) : { x: 0, y: 0 };
234
234
  }
235
235
  };
236
236
  }
237
- const tt = 30, et = 8, nt = 1.2, ot = 30, At = 600;
238
- function Ot() {
239
- let t = null, n = !1, e = !1, o = null, i = null, f = !1;
240
- const l = (u, h) => {
241
- for (let m = 0; m < u.length; m++) {
242
- const T = u.item(m);
243
- if (T && T.identifier === h) return T;
237
+ const ht = 30, yt = 8, pt = 1.2, mt = 30, Kt = 600;
238
+ function Bt() {
239
+ let t = null, s = !1, e = !1, n = null, l = null, d = !1;
240
+ const c = (f, g) => {
241
+ for (let p = 0; p < f.length; p++) {
242
+ const m = f.item(p);
243
+ if (m && m.identifier === g) return m;
244
244
  }
245
245
  return null;
246
- }, d = () => {
247
- o !== null && (clearTimeout(o), o = null);
248
- }, g = () => {
249
- i !== null && (clearTimeout(i), i = null);
250
- }, L = () => {
251
- n = !0, e = !0, d(), g(), o = setTimeout(() => {
252
- n = !1, e = !1, o = null;
253
- }, At);
254
- }, A = (u) => {
255
- if (u.touches.length !== 1) {
246
+ }, y = () => {
247
+ n !== null && (clearTimeout(n), n = null);
248
+ }, E = () => {
249
+ l !== null && (clearTimeout(l), l = null);
250
+ }, O = () => {
251
+ s = !0, e = !0, y(), E(), n = setTimeout(() => {
252
+ s = !1, e = !1, n = null;
253
+ }, Kt);
254
+ }, _ = (f) => {
255
+ if (f.touches.length !== 1) {
256
256
  t = null;
257
257
  return;
258
258
  }
259
- const h = u.touches.item(0);
260
- if (!h) {
259
+ const g = f.touches.item(0);
260
+ if (!g) {
261
261
  t = null;
262
262
  return;
263
263
  }
264
- const m = window.innerWidth, T = h.clientX <= tt, R = h.clientX >= m - tt;
265
- if (!T && !R) {
264
+ const p = window.innerWidth, m = g.clientX <= ht, R = g.clientX >= p - ht;
265
+ if (!m && !R) {
266
266
  t = null;
267
267
  return;
268
268
  }
269
269
  t = {
270
- identifier: h.identifier,
271
- startX: h.clientX,
272
- startY: h.clientY,
273
- fromLeftEdge: T,
270
+ identifier: g.identifier,
271
+ startX: g.clientX,
272
+ startY: g.clientY,
273
+ fromLeftEdge: m,
274
274
  moved: !1
275
275
  };
276
- }, y = (u) => {
276
+ }, b = (f) => {
277
277
  if (!t) return;
278
- if (u.touches.length !== 1) {
278
+ if (f.touches.length !== 1) {
279
279
  t = null;
280
280
  return;
281
281
  }
282
- const h = l(u.touches, t.identifier);
283
- if (!h) {
282
+ const g = c(f.touches, t.identifier);
283
+ if (!g) {
284
284
  t = null;
285
285
  return;
286
286
  }
287
- const m = h.clientX - t.startX, T = h.clientY - t.startY, R = Math.abs(m), c = Math.abs(T);
288
- if (c > et && c > R * nt) {
287
+ const p = g.clientX - t.startX, m = g.clientY - t.startY, R = Math.abs(p), a = Math.abs(m);
288
+ if (a > yt && a > R * pt) {
289
289
  t = null;
290
290
  return;
291
291
  }
292
- const a = t.fromLeftEdge ? m > 0 : m < 0;
293
- R > et && R > c * nt && a && (t.moved = !0);
294
- }, S = (u) => {
292
+ const u = t.fromLeftEdge ? p > 0 : p < 0;
293
+ R > yt && R > a * pt && u && (t.moved = !0);
294
+ }, M = (f) => {
295
295
  if (!t) return;
296
- const h = l(u.changedTouches, t.identifier);
297
- if (!h) {
296
+ const g = c(f.changedTouches, t.identifier);
297
+ if (!g) {
298
298
  t = null;
299
299
  return;
300
300
  }
301
- const m = h.clientX - t.startX, T = t.fromLeftEdge ? m > 0 : m < 0;
302
- if (t.moved && T && Math.abs(m) >= ot) {
303
- L(), t = null;
301
+ const p = g.clientX - t.startX, m = t.fromLeftEdge ? p > 0 : p < 0;
302
+ if (t.moved && m && Math.abs(p) >= mt) {
303
+ O(), t = null;
304
304
  return;
305
305
  }
306
- t.moved && Math.abs(m) >= ot && L(), t = null;
307
- }, O = () => {
308
- t && (t.moved && L(), t = null);
306
+ t.moved && Math.abs(p) >= mt && O(), t = null;
307
+ }, k = () => {
308
+ t && (t.moved && O(), t = null);
309
309
  };
310
310
  return { initialize: () => {
311
- if (typeof window > "u" || f) return;
312
- f = !0;
313
- const u = { passive: !0, capture: !0 };
314
- window.addEventListener("touchstart", A, u), window.addEventListener("touchmove", y, u), window.addEventListener("touchend", S, u), window.addEventListener("touchcancel", O, u);
311
+ if (typeof window > "u" || d) return;
312
+ d = !0;
313
+ const f = { passive: !0, capture: !0 };
314
+ window.addEventListener("touchstart", _, f), window.addEventListener("touchmove", b, f), window.addEventListener("touchend", M, f), window.addEventListener("touchcancel", k, f);
315
315
  }, destroy: () => {
316
- if (typeof window > "u" || !f) return;
317
- f = !1;
318
- const u = { capture: !0 };
319
- window.removeEventListener("touchstart", A, u), window.removeEventListener("touchmove", y, u), window.removeEventListener("touchend", S, u), window.removeEventListener("touchcancel", O, u), d(), g(), t = null, n = !1, e = !1;
316
+ if (typeof window > "u" || !d) return;
317
+ d = !1;
318
+ const f = { capture: !0 };
319
+ window.removeEventListener("touchstart", _, f), window.removeEventListener("touchmove", b, f), window.removeEventListener("touchend", M, f), window.removeEventListener("touchcancel", k, f), y(), E(), t = null, s = !1, e = !1;
320
320
  }, isSwipeBack: () => {
321
- const u = n || e;
322
- return u && d(), u;
321
+ const f = s || e;
322
+ return f && y(), f;
323
323
  }, onPageEnter: () => {
324
- n = !1, d(), g(), i = setTimeout(() => {
325
- e = !1, i = null;
324
+ s = !1, y(), E(), l = setTimeout(() => {
325
+ e = !1, l = null;
326
326
  }, 0);
327
327
  } };
328
328
  }
329
- function Pt() {
329
+ function Xt() {
330
330
  let t = null;
331
- function n() {
332
- var o, i;
333
- t && ((o = t.outResolve) == null || o.call(t, null), (i = t.inResolve) == null || i.call(t, null), t = null);
331
+ function s() {
332
+ var n, l;
333
+ t && ((n = t.outResolve) == null || n.call(t, null), (l = t.inResolve) == null || l.call(t, null), t = null);
334
334
  }
335
335
  function e() {
336
336
  if (t != null && t.from && (t != null && t.to) && (t != null && t.outResolve) && (t != null && t.inResolve)) {
337
337
  if (t.from === t.to) {
338
- n();
338
+ s();
339
339
  return;
340
340
  }
341
- const o = { from: t.from, to: t.to };
342
- t.outResolve(o), t.inResolve(o), t = null;
341
+ const n = { from: t.from, to: t.to };
342
+ t.outResolve(n), t.inResolve(n), t = null;
343
343
  }
344
344
  }
345
345
  return {
346
- trigger(o, i) {
347
- var l;
348
- i === "out" && (t == null ? void 0 : t.to) === o && !t.from && ((l = t.inResolve) == null || l.call(t, null), t = {}), t && (i === "out" && t.from && t.from !== o || i === "in" && t.to && t.to !== o) && n(), t || (t = {}), i === "out" ? t.from = o : t.to = o;
346
+ trigger(n, l) {
347
+ var c;
348
+ l === "out" && (t == null ? void 0 : t.to) === n && !t.from && ((c = t.inResolve) == null || c.call(t, null), t = {}), t && (l === "out" && t.from && t.from !== n || l === "in" && t.to && t.to !== n) && s(), t || (t = {}), l === "out" ? t.from = n : t.to = n;
349
349
  },
350
- get(o) {
351
- return new Promise((i) => {
352
- t || (t = {}), o === "out" ? t.outResolve = i : t.inResolve = i, e();
350
+ get(n) {
351
+ return new Promise((l) => {
352
+ t || (t = {}), n === "out" ? t.outResolve = l : t.inResolve = l, e();
353
353
  });
354
354
  }
355
355
  };
356
356
  }
357
- const B = /* @__PURE__ */ new Map();
358
- let H = null, rt = !1;
359
- function it(t) {
360
- if (t instanceof HTMLElement && B.has(t)) {
361
- const n = B.get(t);
362
- B.delete(t), queueMicrotask(n);
357
+ const $ = /* @__PURE__ */ new Map();
358
+ let Y = null, gt = !1;
359
+ function Et(t) {
360
+ if (t instanceof HTMLElement && $.has(t) && !t.isConnected) {
361
+ const s = $.get(t);
362
+ $.delete(t), queueMicrotask(s);
363
363
  }
364
- for (const n of Array.from(t.childNodes))
365
- it(n);
364
+ for (const s of Array.from(t.childNodes))
365
+ Et(s);
366
366
  }
367
- function Lt() {
368
- if (rt || typeof document > "u") return;
369
- rt = !0, H = new MutationObserver((n) => {
370
- for (const e of n)
371
- for (const o of Array.from(e.removedNodes))
372
- it(o);
367
+ function zt() {
368
+ if (gt || typeof document > "u") return;
369
+ gt = !0, Y = new MutationObserver((s) => {
370
+ for (const e of s)
371
+ for (const n of Array.from(e.removedNodes))
372
+ Et(n);
373
373
  });
374
374
  const t = () => {
375
- H == null || H.observe(document.body, { childList: !0, subtree: !0 });
375
+ Y == null || Y.observe(document.body, { childList: !0, subtree: !0 });
376
376
  };
377
377
  document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
378
378
  }
379
- function _t(t, n) {
380
- return Lt(), B.set(t, n), () => {
381
- B.delete(t);
379
+ function $t(t, s) {
380
+ return zt(), $.set(t, s), () => {
381
+ $.delete(t);
382
+ };
383
+ }
384
+ const ot = /* @__PURE__ */ new WeakMap();
385
+ let G = null;
386
+ const Z = "none !important";
387
+ function z(t) {
388
+ const s = t.style.getPropertyValue("display");
389
+ return t.style.getPropertyPriority("display") ? `${s} !important` : s;
390
+ }
391
+ function Vt() {
392
+ return G || (G = new MutationObserver((t) => {
393
+ for (const s of t) {
394
+ const e = s.target, n = ot.get(e);
395
+ if (!n) continue;
396
+ const l = z(e);
397
+ l !== n.accounted && (n.accounted = l, l === Z ? (n.reactHidden = !0, n.onHide()) : l !== "none" && n.reactHidden && (n.reactHidden = !1, n.onShow()));
398
+ }
399
+ }), G);
400
+ }
401
+ function qt(t, s) {
402
+ const e = z(t), n = {
403
+ accounted: e,
404
+ reactHidden: e === Z,
405
+ onHide: s.onHide,
406
+ onShow: s.onShow
407
+ };
408
+ return ot.set(t, n), Vt().observe(t, {
409
+ attributes: !0,
410
+ attributeFilter: ["style"]
411
+ }), {
412
+ get isHidden() {
413
+ return z(t) === Z;
414
+ },
415
+ setDisplay(l, d = !1) {
416
+ l === null ? t.style.removeProperty("display") : t.style.setProperty(
417
+ "display",
418
+ l,
419
+ d ? "important" : ""
420
+ ), n.accounted = z(t);
421
+ },
422
+ sync() {
423
+ n.accounted = z(t), n.reactHidden = n.accounted === Z;
424
+ },
425
+ stop() {
426
+ ot.delete(t);
427
+ }
382
428
  };
383
429
  }
384
- function Mt(t) {
430
+ function Ut(t) {
385
431
  return Array.isArray(t);
386
432
  }
387
- function lt(t) {
388
- const n = [];
433
+ function bt(t) {
434
+ const s = [];
389
435
  for (const e of t)
390
- Mt(e) ? n.push(...lt(e)) : n.push(e);
391
- return n;
436
+ Ut(e) ? s.push(...bt(e)) : s.push(e);
437
+ return s;
392
438
  }
393
- function Dt(t, n = {}) {
439
+ function se(t, s = {}) {
394
440
  const {
395
441
  transitions: e = [],
396
- middleware: o = (r, s) => ({ from: r, to: s }),
397
- preserveScroll: i = (r) => r
398
- } = t, f = n.host ?? new mt(), l = Pt(), d = vt(
399
- lt(e)
400
- ), g = Ot();
401
- g.initialize();
442
+ middleware: n = (o, i) => ({ from: o, to: i }),
443
+ preserveScroll: l = (o) => o
444
+ } = t, d = s.host ?? new Mt(), c = Xt(), y = Dt(
445
+ bt(e)
446
+ ), E = Bt();
447
+ E.initialize();
402
448
  const {
403
- initializeContext: L,
404
- calculateScrollOffset: A,
405
- evictScrollPosition: y,
406
- shouldPreserve: S,
407
- getScrollContainer: O,
408
- getPositionedParentElement: k,
409
- getScrollPosition: I
410
- } = Rt({ preserveScroll: i });
411
- let _ = null, x = null;
412
- const u = /* @__PURE__ */ new WeakMap(), h = (r) => {
413
- u.set(r, {
414
- parent: r.parentElement,
415
- nextSibling: r.nextElementSibling
449
+ initializeContext: O,
450
+ calculateScrollOffset: _,
451
+ evictScrollPosition: b,
452
+ shouldPreserve: M,
453
+ getScrollContainer: k,
454
+ getPositionedParentElement: I,
455
+ getScrollPosition: W
456
+ } = Ft({ preserveScroll: l });
457
+ let T = null, A = null;
458
+ const f = /* @__PURE__ */ new WeakMap(), g = (o) => {
459
+ f.set(o, {
460
+ parent: o.parentElement,
461
+ nextSibling: o.nextElementSibling
416
462
  });
417
- }, m = (r) => {
418
- const s = u.get(r);
419
- return s || {
420
- parent: r.parentElement,
421
- nextSibling: r.nextElementSibling
463
+ }, p = (o) => {
464
+ const i = f.get(o);
465
+ return i || {
466
+ parent: o.parentElement,
467
+ nextSibling: o.nextElementSibling
422
468
  };
423
- }, T = (r, s, w, b, D) => {
424
- const N = b.element, X = D.element, { parent: M, nextSibling: C } = b.parent ? { parent: b.parent, nextSibling: b.nextSibling } : m(N), P = N.cloneNode(!0);
425
- P.setAttribute("data-ssgoi-clone", "");
426
- const z = {
427
- scrollOffset: A(s, w),
428
- from: { scroll: I(s) },
429
- to: { scroll: I(w) },
469
+ }, m = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
470
+ let a = 0;
471
+ const u = (o) => {
472
+ const i = typeof getComputedStyle < "u" ? getComputedStyle(o).display : "";
473
+ return i && i !== "none" ? i : "block";
474
+ }, v = (o, i) => {
475
+ i.visibleDisplay = o.style.getPropertyValue("display"), i.computedDisplay = u(o);
476
+ }, S = (o, i) => {
477
+ if (R.get(o) !== i) return;
478
+ R.delete(o);
479
+ const r = m.get(o);
480
+ r && (r.savedCss !== null && (o.style.cssText = r.savedCss, r.savedCss = null), r.intent === "hidden" ? r.vis.setDisplay("none", !0) : r.visibleDisplay ? (r.vis.setDisplay(r.visibleDisplay, !1), v(o, r)) : (r.vis.setDisplay(null), v(o, r)));
481
+ }, w = (o, i, r, h, L) => {
482
+ const x = h.element, D = L.element, H = (h.mode ?? "unmount") === "hidden", { parent: V, nextSibling: J } = h.parent ? { parent: h.parent, nextSibling: h.nextSibling } : p(x), q = _(i, r), Q = {
483
+ scrollOffset: q,
484
+ from: { scroll: W(i) },
485
+ to: { scroll: W(r) },
430
486
  get scrollingElement() {
431
- return O() || document.documentElement;
487
+ return k() || document.documentElement;
432
488
  },
433
489
  get positionedParent() {
434
- return k();
490
+ return I();
435
491
  }
436
492
  };
437
- gt(P, z), S(s) || y(s);
438
- const Z = Promise.resolve(P), j = Promise.resolve(X), J = [], at = {
439
- from: Z,
440
- to: j,
441
- context: z,
442
- createElement: (($, q = "div") => {
443
- const K = document.createElement(q);
444
- return K.setAttribute("data-ssgoi-id", $), J.push(K), K;
493
+ let C;
494
+ if (H) {
495
+ C = x, C.style.top = `${-1 * ((q == null ? void 0 : q.y) ?? 0)}px`;
496
+ const N = m.get(D);
497
+ N && N.savedCss === null && (N.savedCss = D.style.cssText);
498
+ } else
499
+ C = x.cloneNode(!0), C.setAttribute("data-ssgoi-clone", ""), Lt(C, Q);
500
+ M(i) || b(i);
501
+ const U = H ? ++a : 0;
502
+ H && (R.set(D, U), R.set(x, U));
503
+ const at = Promise.resolve(C), ut = Promise.resolve(D), ft = [], Rt = {
504
+ from: at,
505
+ to: ut,
506
+ context: Q,
507
+ createElement: ((N, tt = "div") => {
508
+ const K = document.createElement(tt);
509
+ return K.setAttribute("data-ssgoi-id", N), ft.push(K), K;
445
510
  })
446
- }, ut = Promise.resolve(
447
- r.prepare ? r.prepare(at) : {}
511
+ }, Pt = Promise.resolve(
512
+ o.prepare ? o.prepare(Rt) : {}
448
513
  );
449
- Et({
450
- from: Z,
451
- to: j,
452
- extras: ut
453
- }).then(({ from: $, to: q, extras: K }) => {
454
- M && (C && M.contains(C) ? M.insertBefore(P, C) : M.appendChild(P));
455
- const U = r.animation({
456
- from: $,
457
- to: q,
458
- context: z,
514
+ kt({
515
+ from: at,
516
+ to: ut,
517
+ extras: Pt
518
+ }).then(({ from: N, to: tt, extras: K }) => {
519
+ !H && V && (J && V.contains(J) ? V.insertBefore(C, J) : V.appendChild(C));
520
+ const et = o.animation({
521
+ from: N,
522
+ to: tt,
523
+ context: Q,
459
524
  ...K
460
- }), Y = U.onComplete;
461
- U.onComplete = () => {
462
- Y == null || Y(), P.parentElement && P.parentElement.removeChild(P);
463
- for (const G of J)
464
- G.parentElement && G.parentElement.removeChild(G);
465
- }, f.attach(U);
525
+ }), nt = et.onComplete;
526
+ et.onComplete = () => {
527
+ nt == null || nt(), H ? (S(x, U), S(D, U)) : C.parentElement && C.parentElement.removeChild(C);
528
+ for (const st of ft)
529
+ st.parentElement && st.parentElement.removeChild(st);
530
+ }, d.attach(et);
466
531
  });
467
- }, R = (r, s) => {
468
- const w = g.isSwipeBack();
469
- l.trigger(r, s), l.get(s).then((b) => {
470
- if (s === "in" && g.onPageEnter(), !b) return;
471
- if (w) {
472
- s === "out" && b.from && !S(b.from) && y(b.from), _ = null, x = null;
532
+ }, P = (o, i) => {
533
+ const r = E.isSwipeBack();
534
+ c.trigger(o, i), c.get(i).then((h) => {
535
+ if (i === "in" && E.onPageEnter(), !h) return;
536
+ if (r) {
537
+ i === "out" && h.from && !M(h.from) && b(h.from), T = null, A = null;
473
538
  return;
474
539
  }
475
- if (s !== "in") return;
476
- const { from: D, to: N } = o(
477
- b.from,
478
- b.to
479
- ), X = Tt(
480
- D,
481
- N,
482
- d
483
- ), M = _, C = x;
484
- _ = null, x = null, !(!X || !M || !C) && T(X, D, N, M, C);
540
+ if (i !== "in") return;
541
+ const { from: L, to: x } = n(
542
+ h.from,
543
+ h.to
544
+ ), D = Ht(
545
+ L,
546
+ x,
547
+ y
548
+ ), j = T, H = A;
549
+ T = null, A = null, !(!D || !j || !H) && w(D, L, x, j, H);
485
550
  });
486
- }, c = (r, s) => {
487
- const w = m(r);
488
- _ = {
489
- element: r,
490
- parent: w.parent,
491
- nextSibling: w.nextSibling
551
+ }, F = (o, i) => {
552
+ const r = m.get(o);
553
+ if (!r) return;
554
+ const h = r.intent === "hidden";
555
+ if (r.intent = "hidden", r.savedCss === null && (r.savedCss = o.style.cssText), r.vis.setDisplay(r.computedDisplay || "block", !0), o.style.position = "absolute", o.style.width = "100%", o.style.left = "0", h) return;
556
+ const L = p(o);
557
+ T = {
558
+ element: o,
559
+ parent: L.parent,
560
+ nextSibling: L.nextSibling,
561
+ mode: "hidden"
562
+ };
563
+ const x = o.getAttribute("data-ssgoi-transition") ?? i;
564
+ P(x, "out");
565
+ }, St = (o, i) => {
566
+ const r = m.get(o);
567
+ if (!r || r.intent === "visible") return;
568
+ r.intent = "visible", v(o, r), r.savedCss !== null && (o.style.cssText = r.savedCss, r.visibleDisplay ? r.vis.setDisplay(r.visibleDisplay, !1) : r.vis.setDisplay(null)), O(o, i), A = {
569
+ element: o,
570
+ parent: o.parentElement,
571
+ nextSibling: o.nextElementSibling
572
+ };
573
+ const h = o.getAttribute("data-ssgoi-transition") ?? i;
574
+ P(h, "in");
575
+ }, Tt = (o, i) => {
576
+ const r = m.get(o);
577
+ if (r && (r.vis.stop(), m.delete(o), R.delete(o), r.intent === "hidden")) {
578
+ (T == null ? void 0 : T.element) === o && (T = null), (A == null ? void 0 : A.element) === o && (A = null);
579
+ return;
580
+ }
581
+ const h = p(o);
582
+ T = {
583
+ element: o,
584
+ parent: h.parent,
585
+ nextSibling: h.nextSibling,
586
+ mode: "unmount"
587
+ };
588
+ const L = o.getAttribute("data-ssgoi-transition") ?? i;
589
+ P(L, "out");
590
+ }, rt = /* @__PURE__ */ new WeakSet(), lt = (o, i) => {
591
+ if (rt.has(i)) return;
592
+ rt.add(i), g(i);
593
+ const r = qt(i, {
594
+ onHide: () => F(i, o),
595
+ onShow: () => St(i, o)
596
+ }), h = {
597
+ vis: r,
598
+ savedCss: null,
599
+ intent: r.isHidden ? "hidden" : "visible",
600
+ visibleDisplay: "",
601
+ computedDisplay: "block"
492
602
  };
493
- const b = r.getAttribute("data-ssgoi-transition") ?? s;
494
- R(b, "out");
495
- }, a = /* @__PURE__ */ new WeakSet(), p = (r, s) => {
496
- a.has(s) || (a.add(s), h(s), L(s, r), x = {
497
- element: s,
498
- parent: s.parentElement,
499
- nextSibling: s.nextElementSibling
500
- }, R(r, "in"), _t(s, () => c(s, r)));
501
- }, E = /* @__PURE__ */ new Map();
502
- return { register: p, refFor: (r) => {
503
- let s = E.get(r);
504
- return s || (s = (w) => {
505
- w && p(r, w);
506
- }, E.set(r, s)), s;
603
+ m.set(i, h), r.isHidden || (v(i, h), O(i, o), A = {
604
+ element: i,
605
+ parent: i.parentElement,
606
+ nextSibling: i.nextElementSibling
607
+ }, P(o, "in")), $t(i, () => Tt(i, o));
608
+ }, ct = /* @__PURE__ */ new Map();
609
+ return { register: lt, refFor: (o) => {
610
+ let i = ct.get(o);
611
+ return i || (i = (r) => {
612
+ r && lt(o, r);
613
+ }, ct.set(o, i)), i;
507
614
  } };
508
615
  }
509
- const ct = "data-ssgoi-root", xt = `[${ct}]`, V = "data-ssgoi-transition", st = `[${V}]`, Ct = "[data-ssgoi-clone]";
510
- function kt() {
616
+ const wt = "data-ssgoi-root", Yt = `[${wt}]`, it = "data-ssgoi-transition", vt = `[${it}]`, Gt = "[data-ssgoi-clone]";
617
+ function Zt() {
511
618
  return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
512
619
  }
513
- function It(t) {
620
+ function jt(t) {
514
621
  return t.nodeType === Node.ELEMENT_NODE;
515
622
  }
516
- function Nt(t) {
623
+ function Jt(t) {
517
624
  return t instanceof HTMLElement;
518
625
  }
519
- function Xt(t, n) {
520
- if (!kt()) return () => {
626
+ function oe(t, s) {
627
+ if (!Zt()) return () => {
521
628
  };
522
- t.setAttribute(ct, "");
523
- const e = (l) => l.closest(xt) === t, o = (l) => {
524
- if (!Nt(l) || !e(l) || l.closest(Ct))
629
+ t.setAttribute(wt, "");
630
+ const e = (c) => c.closest(Yt) === t, n = (c) => {
631
+ if (!Jt(c) || !e(c) || c.closest(Gt))
525
632
  return;
526
- const d = l.getAttribute(V);
527
- d !== null && n.register(d, l);
528
- }, i = (l) => {
529
- if (It(l)) {
530
- l.matches(st) && o(l);
531
- for (const d of l.querySelectorAll(st))
532
- o(d);
633
+ const y = c.getAttribute(it);
634
+ y !== null && s.register(y, c);
635
+ }, l = (c) => {
636
+ if (jt(c)) {
637
+ c.matches(vt) && n(c);
638
+ for (const y of c.querySelectorAll(vt))
639
+ n(y);
533
640
  }
534
- }, f = new MutationObserver((l) => {
535
- for (const d of l) {
536
- if (d.type === "attributes") {
537
- o(d.target);
641
+ }, d = new MutationObserver((c) => {
642
+ for (const y of c) {
643
+ if (y.type === "attributes") {
644
+ n(y.target);
538
645
  continue;
539
646
  }
540
- for (const g of d.addedNodes)
541
- i(g);
647
+ for (const E of y.addedNodes)
648
+ l(E);
542
649
  }
543
650
  });
544
- return f.observe(t, {
651
+ return d.observe(t, {
545
652
  childList: !0,
546
653
  subtree: !0,
547
654
  attributes: !0,
548
- attributeFilter: [V]
549
- }), i(t), () => f.disconnect();
655
+ attributeFilter: [it]
656
+ }), l(t), () => d.disconnect();
550
657
  }
551
658
  export {
552
- ht as Animation,
553
- mt as HostAnimation,
554
- $t as MultiAnimation,
555
- qt as WebAnimation,
556
- Dt as createSggoiTransitionContext,
557
- Xt as observeSsgoiTransitions
659
+ xt as Animation,
660
+ Mt as HostAnimation,
661
+ le as MultiAnimation,
662
+ ce as WebAnimation,
663
+ se as createSggoiTransitionContext,
664
+ oe as observeSsgoiTransitions
558
665
  };