@ssgoi/core 6.3.1 → 6.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +93 -140
  2. package/dist/index.cjs +13 -13
  3. package/dist/index.js +792 -717
  4. package/dist/internal.cjs +1 -1
  5. package/dist/internal.d.ts +1 -0
  6. package/dist/internal.d.ts.map +1 -1
  7. package/dist/internal.js +515 -363
  8. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  9. package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts +3 -0
  10. package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts.map +1 -0
  11. package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -1
  12. package/dist/ssgoi-transition/visibility-observer.d.ts +66 -0
  13. package/dist/ssgoi-transition/visibility-observer.d.ts.map +1 -0
  14. package/dist/transitions/axis/provider/x/fluid.d.ts.map +1 -1
  15. package/dist/transitions/axis/provider/x/snappy.d.ts.map +1 -1
  16. package/dist/transitions/axis/provider/y/directional.d.ts.map +1 -1
  17. package/dist/transitions/axis/provider/y/non-directional.d.ts.map +1 -1
  18. package/dist/transitions/axis/provider/z/directional.d.ts.map +1 -1
  19. package/dist/transitions/axis/provider/z/non-directional.d.ts.map +1 -1
  20. package/dist/transitions/axis/transition.d.ts.map +1 -1
  21. package/dist/transitions/blind/transition.d.ts +1 -0
  22. package/dist/transitions/blind/transition.d.ts.map +1 -1
  23. package/dist/transitions/drill/transition.d.ts.map +1 -1
  24. package/dist/transitions/fade/transition.d.ts.map +1 -1
  25. package/dist/transitions/film/transition.d.ts.map +1 -1
  26. package/dist/transitions/hero/provider/chrome/static.d.ts.map +1 -1
  27. package/dist/transitions/jaemin/transition.d.ts.map +1 -1
  28. package/dist/transitions/rotate/transition.d.ts.map +1 -1
  29. package/dist/transitions/scroll/transition.d.ts.map +1 -1
  30. package/dist/transitions/sheet/transition.d.ts.map +1 -1
  31. package/dist/transitions/slide/transition.d.ts.map +1 -1
  32. package/dist/transitions/strip/transition.d.ts.map +1 -1
  33. package/dist/transitions/zoom/transition.d.ts.map +1 -1
  34. package/package.json +1 -1
package/dist/internal.js CHANGED
@@ -1,52 +1,52 @@
1
- var ce = Object.defineProperty;
2
- var ae = (e, n, t) => n in e ? ce(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var W = (e, n, t) => ae(e, typeof n != "symbol" ? n + "" : n, t);
4
- import { A as ue } from "./multi-animation-CnxqLEka.js";
5
- import { M as Ke, W as Ne } from "./multi-animation-CnxqLEka.js";
6
- class fe extends ue {
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
- W(this, "child", null);
10
- W(this, "_state", "idle");
11
- W(this, "_settled", !1);
12
- W(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
- attach(t) {
15
- const o = this.child;
16
- if (this.child = t, this._settled = !1, o) {
17
- const h = o.getPose();
18
- o.complete(), t.matchInto(h);
14
+ attach(e) {
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
- t.playbackRate = this.playbackRate;
21
- const c = t.onComplete;
22
- t.onComplete = () => {
23
- c == null || c(), this.child === t && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
20
+ e.playbackRate = this.playbackRate;
21
+ const l = e.onComplete;
22
+ e.onComplete = () => {
23
+ l == null || l(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
24
  };
25
- const d = t.onUpdate;
26
- t.onUpdate = (h) => {
27
- var S;
28
- d == null || d(h), (S = this.onUpdate) == null || S.call(this, h), this.notify();
29
- }, this._state === "paused" ? t.pause() : this._state === "reversing" ? t.reverse() : (this._state = "playing", t.play()), 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
+ }, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
30
30
  }
31
31
  play() {
32
- var t;
33
- this._state = "playing", this._settled = !1, (t = this.child) == null || t.play(), this.notify();
32
+ var e;
33
+ this._state = "playing", this._settled = !1, (e = this.child) == null || e.play(), this.notify();
34
34
  }
35
35
  reverse() {
36
- var t;
37
- this._state = "reversing", this._settled = !1, (t = this.child) == null || t.reverse(), this.notify();
36
+ var e;
37
+ this._state = "reversing", this._settled = !1, (e = this.child) == null || e.reverse(), this.notify();
38
38
  }
39
39
  pause() {
40
- var t;
41
- this._state = "paused", (t = this.child) == null || t.pause(), this.notify();
40
+ var e;
41
+ this._state = "paused", (e = this.child) == null || e.pause(), this.notify();
42
42
  }
43
43
  complete() {
44
- var t;
45
- (t = this.child) == null || t.complete(), this.notify();
44
+ var e;
45
+ (e = this.child) == null || e.complete(), this.notify();
46
46
  }
47
47
  get isAnimating() {
48
- var t;
49
- return ((t = this.child) == null ? void 0 : t.isAnimating) ?? !1;
48
+ var e;
49
+ return ((e = this.child) == null ? void 0 : e.isAnimating) ?? !1;
50
50
  }
51
51
  get isPaused() {
52
52
  return this._state === "paused";
@@ -55,459 +55,611 @@ class fe extends ue {
55
55
  return this._settled && !this.child;
56
56
  }
57
57
  get isReversing() {
58
- var t;
59
- return ((t = this.child) == null ? void 0 : t.isReversing) ?? this._state === "reversing";
58
+ var e;
59
+ return ((e = this.child) == null ? void 0 : e.isReversing) ?? this._state === "reversing";
60
60
  }
61
61
  get progress() {
62
- var t;
63
- return ((t = this.child) == null ? void 0 : t.progress) ?? 0;
62
+ var e;
63
+ return ((e = this.child) == null ? void 0 : e.progress) ?? 0;
64
64
  }
65
- findTimeForProgress(t) {
66
- var o;
67
- return ((o = this.child) == null ? void 0 : o.findTimeForProgress(t)) ?? null;
65
+ findTimeForProgress(e) {
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;
71
71
  }
72
- set playbackRate(t) {
73
- super.playbackRate = t, this.child && (this.child.playbackRate = t), this.notify();
72
+ set playbackRate(e) {
73
+ super.playbackRate = e, this.child && (this.child.playbackRate = e), this.notify();
74
74
  }
75
75
  getPose() {
76
- var t;
77
- return ((t = this.child) == null ? void 0 : t.getPose()) ?? [];
76
+ var e;
77
+ return ((e = this.child) == null ? void 0 : e.getPose()) ?? [];
78
78
  }
79
79
  getTimeline() {
80
- var t;
81
- return ((t = this.child) == null ? void 0 : t.getTimeline()) ?? [];
80
+ var e;
81
+ return ((e = this.child) == null ? void 0 : e.getTimeline()) ?? [];
82
82
  }
83
- matchInto(t) {
84
- var o;
85
- (o = this.child) == null || o.matchInto(t);
83
+ 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() {
89
89
  return this.child;
90
90
  }
91
91
  /** Subscribe to host state changes. Returns an unsubscribe fn. */
92
- subscribe(t) {
93
- return this.listeners.add(t), () => {
94
- this.listeners.delete(t);
92
+ subscribe(e) {
93
+ return this.listeners.add(e), () => {
94
+ this.listeners.delete(e);
95
95
  };
96
96
  }
97
97
  notify() {
98
- for (const t of this.listeners) t();
98
+ for (const e of this.listeners) e();
99
99
  }
100
100
  }
101
- const de = (e, n) => {
102
- var t;
103
- e.style.position = "absolute", e.style.width = "100%", e.style.top = `${-1 * (((t = n == null ? void 0 : n.scrollOffset) == null ? void 0 : t.y) ?? 0)}px`, e.style.left = "0";
104
- }, J = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), he = (e) => {
105
- let n = e.parentElement;
106
- for (; n && n !== document.body; ) {
107
- const t = window.getComputedStyle(n);
108
- if (J.has(t.overflowY) || J.has(t.overflowX))
109
- return n;
110
- n = n.parentElement;
101
+ const Lt = (t, s) => {
102
+ var e;
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
- }, me = (e) => {
114
- let n = e.parentElement;
115
- for (; n && n !== document.body; ) {
116
- const t = window.getComputedStyle(n).position;
117
- if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
118
- return n;
119
- n = n.parentElement;
113
+ }, _t = (t) => {
114
+ let s = t.parentElement;
115
+ for (; s && s !== document.body; ) {
116
+ const e = window.getComputedStyle(s).position;
117
+ if (e === "relative" || e === "absolute" || e === "fixed" || e === "sticky")
118
+ return s;
119
+ s = s.parentElement;
120
120
  }
121
121
  return document.body;
122
122
  };
123
- function ge(e) {
124
- const n = Object.keys(e);
125
- return Promise.all(n.map((t) => e[t])).then((t) => {
126
- const o = {};
127
- return n.forEach((c, d) => {
128
- o[c] = t[d];
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 ye(e) {
133
- const n = e.filter((t) => t.symmetric).map((t) => ({
134
- from: t.to,
135
- to: t.from,
136
- transition: t.transition
132
+ function Dt(t) {
133
+ const s = t.filter((e) => e.symmetric).map((e) => ({
134
+ from: e.to,
135
+ to: e.from,
136
+ transition: e.transition
137
137
  }));
138
- return [...e, ...n];
138
+ return [...t, ...s];
139
139
  }
140
- function F(e, n) {
141
- if (n === "*")
140
+ function X(t, s) {
141
+ if (s === "*")
142
142
  return !0;
143
- if (n.endsWith("/*")) {
144
- const t = n.slice(0, -1);
145
- return e.startsWith(t) && e.length > t.length;
143
+ if (s.endsWith("/*")) {
144
+ const e = s.slice(0, -1);
145
+ return t.startsWith(e) && t.length > e.length;
146
146
  }
147
- return e === n;
147
+ return t === s;
148
148
  }
149
- function pe(e, n, t) {
150
- for (const o of t)
151
- if (F(e, o.from) && F(n, o.to))
152
- return o.transition;
153
- for (const o of t)
154
- if ((o.from === "*" || F(e, o.from)) && (o.to === "*" || F(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 ve = 768, Ee = 10, we = 10;
159
- function Se(e = {}) {
160
- const { preserveScroll: n = (i) => i } = e, t = typeof n == "function" ? n : () => n;
161
- let o = null, c = !1, d = !1;
162
- const h = () => {
163
- const i = (o == null ? void 0 : o.clientWidth) ?? 0, l = i > 0 ? i : typeof window < "u" ? window.innerWidth : 0;
164
- return l > 0 && l < ve;
165
- }, S = () => (d || (c = h(), d = !0), c), y = (i) => {
166
- var v;
167
- const l = t(S());
168
- if (l === !1)
169
- return { preserves: !1, shared: !1, storageKey: `path:${i}` };
170
- if (l === !0)
171
- return { preserves: !0, shared: !1, storageKey: `path:${i}` };
172
- const g = ((v = l.exclude) == null ? void 0 : v.some((r) => F(i, r))) ?? !1, p = !g && !!l.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: !g,
175
- shared: p,
176
- storageKey: p ? `shared:${l.key}` : `path:${i}`
174
+ preserves: !v,
175
+ shared: S,
176
+ storageKey: S ? `shared:${u.key}` : `path:${a}`
177
177
  };
178
- }, x = (i) => y(i).preserves;
179
- let R = null;
180
- const m = /* @__PURE__ */ new Map();
181
- let T = null, A = !1, O = 0;
182
- const I = () => {
183
- o && T && !A && m.set(y(T).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
- }, L = (i) => {
188
- if (!o) return;
189
- const l = y(i);
190
- if (l.preserves && l.shared && !m.has(l.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 g = l.preserves && m.has(l.storageKey) ? m.get(l.storageKey) : { x: 0, y: 0 };
193
- let p = 0;
194
- const v = () => {
195
- if (!o) return;
196
- o.scrollTo({
197
- top: g.y,
198
- left: g.x
199
- }), !(Math.abs(o.scrollTop - g.y) < 1 && Math.abs(o.scrollLeft - g.x) < 1) && p < Ee && (p++, 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: (i, l) => {
205
- A = !0;
206
- const g = ++O;
207
- R = i, o || (o = he(i), c = h(), d = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
- c = h();
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
- })), T = l, L(l);
212
- let p = 0;
213
- const v = () => {
214
- g === O && (p++, p >= we ? A = !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: (i, l) => {
219
- const g = i ? y(i).storageKey : null, p = g && m.has(g) ? m.get(g) : { x: 0, y: 0 }, v = l ? y(l) : null, r = v != null && v.preserves ? v.storageKey : null, s = r && m.has(r) ? m.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 + p.x,
222
- y: -s.y + p.y
221
+ x: -F.x + S.x,
222
+ y: -F.y + S.y
223
223
  };
224
224
  },
225
- evictScrollPosition: (i) => {
226
- m.delete(y(i).storageKey);
225
+ evictScrollPosition: (a) => {
226
+ b.delete(E(a).storageKey);
227
227
  },
228
- shouldPreserve: x,
229
- getScrollContainer: () => o,
230
- getPositionedParentElement: () => R ? me(R) : document.body,
231
- getScrollPosition: (i) => {
232
- const l = i ? y(i).storageKey : null;
233
- return l && m.has(l) ? m.get(l) : { 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 Q = 30, ee = 8, te = 1.2, ne = 30, be = 600;
238
- function Te() {
239
- let e = null, n = !1, t = !1, o = null, c = null, d = !1;
240
- const h = (a, u) => {
241
- for (let f = 0; f < a.length; f++) {
242
- const E = a.item(f);
243
- if (E && E.identifier === u) return E;
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
- }, S = () => {
247
- o !== null && (clearTimeout(o), o = null);
248
246
  }, y = () => {
249
- c !== null && (clearTimeout(c), c = null);
250
- }, x = () => {
251
- n = !0, t = !0, S(), y(), o = setTimeout(() => {
252
- n = !1, t = !1, o = null;
253
- }, be);
254
- }, R = (a) => {
255
- if (a.touches.length !== 1) {
256
- e = null;
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
+ t = null;
257
257
  return;
258
258
  }
259
- const u = a.touches.item(0);
260
- if (!u) {
261
- e = null;
259
+ const g = f.touches.item(0);
260
+ if (!g) {
261
+ t = null;
262
262
  return;
263
263
  }
264
- const f = window.innerWidth, E = u.clientX <= Q, P = u.clientX >= f - Q;
265
- if (!E && !P) {
266
- e = null;
264
+ const p = window.innerWidth, m = g.clientX <= ht, R = g.clientX >= p - ht;
265
+ if (!m && !R) {
266
+ t = null;
267
267
  return;
268
268
  }
269
- e = {
270
- identifier: u.identifier,
271
- startX: u.clientX,
272
- startY: u.clientY,
273
- fromLeftEdge: E,
269
+ t = {
270
+ identifier: g.identifier,
271
+ startX: g.clientX,
272
+ startY: g.clientY,
273
+ fromLeftEdge: m,
274
274
  moved: !1
275
275
  };
276
- }, m = (a) => {
277
- if (!e) return;
278
- if (a.touches.length !== 1) {
279
- e = null;
276
+ }, b = (f) => {
277
+ if (!t) return;
278
+ if (f.touches.length !== 1) {
279
+ t = null;
280
280
  return;
281
281
  }
282
- const u = h(a.touches, e.identifier);
283
- if (!u) {
284
- e = null;
282
+ const g = c(f.touches, t.identifier);
283
+ if (!g) {
284
+ t = null;
285
285
  return;
286
286
  }
287
- const f = u.clientX - e.startX, E = u.clientY - e.startY, P = Math.abs(f), i = Math.abs(E);
288
- if (i > ee && i > P * te) {
289
- e = null;
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
+ t = null;
290
290
  return;
291
291
  }
292
- const l = e.fromLeftEdge ? f > 0 : f < 0;
293
- P > ee && P > i * te && l && (e.moved = !0);
294
- }, T = (a) => {
295
- if (!e) return;
296
- const u = h(a.changedTouches, e.identifier);
297
- if (!u) {
298
- e = null;
292
+ const u = t.fromLeftEdge ? p > 0 : p < 0;
293
+ R > yt && R > a * pt && u && (t.moved = !0);
294
+ }, M = (f) => {
295
+ if (!t) return;
296
+ const g = c(f.changedTouches, t.identifier);
297
+ if (!g) {
298
+ t = null;
299
299
  return;
300
300
  }
301
- const f = u.clientX - e.startX, E = e.fromLeftEdge ? f > 0 : f < 0;
302
- if (e.moved && E && Math.abs(f) >= ne) {
303
- x(), e = 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
- e.moved && Math.abs(f) >= ne && x(), e = null;
307
- }, A = () => {
308
- e && (e.moved && x(), e = 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
311
  if (typeof window > "u" || d) return;
312
312
  d = !0;
313
- const a = { passive: !0, capture: !0 };
314
- window.addEventListener("touchstart", R, a), window.addEventListener("touchmove", m, a), window.addEventListener("touchend", T, a), window.addEventListener("touchcancel", A, a);
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
316
  if (typeof window > "u" || !d) return;
317
317
  d = !1;
318
- const a = { capture: !0 };
319
- window.removeEventListener("touchstart", R, a), window.removeEventListener("touchmove", m, a), window.removeEventListener("touchend", T, a), window.removeEventListener("touchcancel", A, a), S(), y(), e = null, n = !1, t = !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 a = n || t;
322
- return a && S(), a;
321
+ const f = s || e;
322
+ return f && y(), f;
323
323
  }, onPageEnter: () => {
324
- n = !1, S(), y(), c = setTimeout(() => {
325
- t = !1, c = null;
324
+ s = !1, y(), E(), l = setTimeout(() => {
325
+ e = !1, l = null;
326
326
  }, 0);
327
327
  } };
328
328
  }
329
- function Pe() {
330
- let e = null;
331
- function n() {
332
- var o, c;
333
- e && ((o = e.outResolve) == null || o.call(e, null), (c = e.inResolve) == null || c.call(e, null), e = null);
329
+ function Xt() {
330
+ let 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
- function t() {
336
- if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
337
- if (e.from === e.to) {
338
- n();
335
+ function e() {
336
+ if (t != null && t.from && (t != null && t.to) && (t != null && t.outResolve) && (t != null && t.inResolve)) {
337
+ if (t.from === t.to) {
338
+ s();
339
339
  return;
340
340
  }
341
- const o = { from: e.from, to: e.to };
342
- e.outResolve(o), e.inResolve(o), e = 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, c) {
347
- var h;
348
- c === "out" && (e == null ? void 0 : e.to) === o && !e.from && ((h = e.inResolve) == null || h.call(e, null), e = {}), e && (c === "out" && e.from && e.from !== o || c === "in" && e.to && e.to !== o) && n(), e || (e = {}), c === "out" ? e.from = o : e.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((c) => {
352
- e || (e = {}), o === "out" ? e.outResolve = c : e.inResolve = c, t();
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 X = /* @__PURE__ */ new Map();
358
- let z = null, oe = !1;
359
- function re(e) {
360
- if (e instanceof HTMLElement && X.has(e)) {
361
- const n = X.get(e);
362
- X.delete(e), 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(e.childNodes))
365
- re(n);
364
+ for (const s of Array.from(t.childNodes))
365
+ Et(s);
366
366
  }
367
- function Re() {
368
- if (oe || typeof document > "u") return;
369
- oe = !0, z = new MutationObserver((n) => {
370
- for (const t of n)
371
- for (const o of Array.from(t.removedNodes))
372
- re(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
- const e = () => {
375
- z == null || z.observe(document.body, { childList: !0, subtree: !0 });
374
+ const t = () => {
375
+ Y == null || Y.observe(document.body, { childList: !0, subtree: !0 });
376
+ };
377
+ document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
378
+ }
379
+ function $t(t, s) {
380
+ return zt(), $.set(t, s), () => {
381
+ $.delete(t);
376
382
  };
377
- document.body ? e() : document.addEventListener("DOMContentLoaded", e, { once: !0 });
378
383
  }
379
- function Ae(e, n) {
380
- return Re(), X.set(e, n), () => {
381
- X.delete(e);
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 xe(e) {
385
- return Array.isArray(e);
430
+ function Ut(t) {
431
+ return Array.isArray(t);
386
432
  }
387
- function se(e) {
388
- const n = [];
389
- for (const t of e)
390
- xe(t) ? n.push(...se(t)) : n.push(t);
391
- return n;
433
+ function bt(t) {
434
+ const s = [];
435
+ for (const e of t)
436
+ Ut(e) ? s.push(...bt(e)) : s.push(e);
437
+ return s;
392
438
  }
393
- function Ce(e, n = {}) {
439
+ function se(t, s = {}) {
394
440
  const {
395
- transitions: t = [],
396
- middleware: o = (r, s) => ({ from: r, to: s }),
397
- preserveScroll: c = (r) => r
398
- } = e, d = n.host ?? new fe(), h = Pe(), S = ye(
399
- se(t)
400
- ), y = Te();
401
- y.initialize();
441
+ transitions: e = [],
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: x,
404
- calculateScrollOffset: R,
405
- evictScrollPosition: m,
406
- shouldPreserve: T,
407
- getScrollContainer: A,
408
- getPositionedParentElement: O,
409
- getScrollPosition: I
410
- } = Se({ preserveScroll: c });
411
- let L = null, k = null;
412
- const a = /* @__PURE__ */ new WeakMap(), u = (r) => {
413
- a.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
- }, f = (r) => {
418
- const s = a.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
- }, E = (r, s, b, w, B) => {
424
- const K = w.element, D = B.element, { parent: _, nextSibling: C } = w.parent ? { parent: w.parent, nextSibling: w.nextSibling } : f(K), M = K.cloneNode(!0), H = {
425
- scrollOffset: R(s, b),
426
- from: { scroll: I(s) },
427
- to: { scroll: I(b) },
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) },
428
486
  get scrollingElement() {
429
- return A() || document.documentElement;
487
+ return k() || document.documentElement;
430
488
  },
431
489
  get positionedParent() {
432
- return O();
490
+ return I();
433
491
  }
434
492
  };
435
- de(M, H), T(s) || m(s);
436
- const V = Promise.resolve(M), Z = Promise.resolve(D), j = [], ie = {
437
- from: V,
438
- to: Z,
439
- context: H,
440
- createElement: ((q, Y = "div") => {
441
- const N = document.createElement(Y);
442
- return N.setAttribute("data-ssgoi-id", q), j.push(N), N;
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;
443
510
  })
444
- }, le = Promise.resolve(
445
- r.prepare ? r.prepare(ie) : {}
511
+ }, Pt = Promise.resolve(
512
+ o.prepare ? o.prepare(Rt) : {}
446
513
  );
447
- ge({
448
- from: V,
449
- to: Z,
450
- extras: le
451
- }).then(({ from: q, to: Y, extras: N }) => {
452
- _ && (C && _.contains(C) ? _.insertBefore(M, C) : _.appendChild(M));
453
- const $ = r.animation({
454
- from: q,
455
- to: Y,
456
- context: H,
457
- ...N
458
- }), G = $.onComplete;
459
- $.onComplete = () => {
460
- G == null || G(), M.parentElement && M.parentElement.removeChild(M);
461
- for (const U of j)
462
- U.parentElement && U.parentElement.removeChild(U);
463
- }, d.attach($);
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,
524
+ ...K
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);
464
531
  });
465
- }, P = (r, s) => {
466
- const b = y.isSwipeBack();
467
- h.trigger(r, s), h.get(s).then((w) => {
468
- if (s === "in" && y.onPageEnter(), !w) return;
469
- if (b) {
470
- s === "out" && w.from && !T(w.from) && m(w.from), L = null, k = 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;
471
538
  return;
472
539
  }
473
- if (s !== "in") return;
474
- const { from: B, to: K } = o(
475
- w.from,
476
- w.to
477
- ), D = pe(
478
- B,
479
- K,
480
- S
481
- ), _ = L, C = k;
482
- L = null, k = null, !(!D || !_ || !C) && E(D, B, K, _, 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);
483
550
  });
484
- }, i = (r, s) => {
485
- const b = f(r);
486
- L = {
487
- element: r,
488
- parent: b.parent,
489
- nextSibling: b.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
490
572
  };
491
- const w = r.getAttribute("data-ssgoi-transition") ?? s;
492
- P(w, "out");
493
- }, l = /* @__PURE__ */ new WeakSet(), g = (r, s) => {
494
- l.has(s) || (l.add(s), u(s), x(s, r), k = {
495
- element: s,
496
- parent: s.parentElement,
497
- nextSibling: s.nextElementSibling
498
- }, P(r, "in"), Ae(s, () => i(s, r)));
499
- }, p = /* @__PURE__ */ new Map();
500
- return { register: g, refFor: (r) => {
501
- let s = p.get(r);
502
- return s || (s = (b) => {
503
- b && g(r, b);
504
- }, p.set(r, s)), s;
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"
602
+ };
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;
505
614
  } };
506
615
  }
616
+ const wt = "data-ssgoi-root", Yt = `[${wt}]`, it = "data-ssgoi-transition", vt = `[${it}]`, Gt = "[data-ssgoi-clone]";
617
+ function Zt() {
618
+ return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
619
+ }
620
+ function jt(t) {
621
+ return t.nodeType === Node.ELEMENT_NODE;
622
+ }
623
+ function Jt(t) {
624
+ return t instanceof HTMLElement;
625
+ }
626
+ function oe(t, s) {
627
+ if (!Zt()) return () => {
628
+ };
629
+ t.setAttribute(wt, "");
630
+ const e = (c) => c.closest(Yt) === t, n = (c) => {
631
+ if (!Jt(c) || !e(c) || c.closest(Gt))
632
+ return;
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);
640
+ }
641
+ }, d = new MutationObserver((c) => {
642
+ for (const y of c) {
643
+ if (y.type === "attributes") {
644
+ n(y.target);
645
+ continue;
646
+ }
647
+ for (const E of y.addedNodes)
648
+ l(E);
649
+ }
650
+ });
651
+ return d.observe(t, {
652
+ childList: !0,
653
+ subtree: !0,
654
+ attributes: !0,
655
+ attributeFilter: [it]
656
+ }), l(t), () => d.disconnect();
657
+ }
507
658
  export {
508
- ue as Animation,
509
- fe as HostAnimation,
510
- Ke as MultiAnimation,
511
- Ne as WebAnimation,
512
- Ce as createSggoiTransitionContext
659
+ xt as Animation,
660
+ Mt as HostAnimation,
661
+ le as MultiAnimation,
662
+ ce as WebAnimation,
663
+ se as createSggoiTransitionContext,
664
+ oe as observeSsgoiTransitions
513
665
  };