@ssgoi/core 2.2.0 → 2.3.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.
package/dist/index.js CHANGED
@@ -1,108 +1,108 @@
1
- var _ = Object.defineProperty;
2
- var x = (i, t, o) => t in i ? _(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
3
- var g = (i, t, o) => x(i, typeof t != "symbol" ? t + "" : t, o);
4
- import { animate as O } from "popmotion";
5
- class A {
1
+ var U = Object.defineProperty;
2
+ var _ = (n, t, o) => t in n ? U(n, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[t] = o;
3
+ var y = (n, t, o) => _(n, typeof t != "symbol" ? t + "" : t, o);
4
+ import { animate as P } from "popmotion";
5
+ class C {
6
6
  constructor(t) {
7
- g(this, "options");
8
- g(this, "currentValue");
9
- g(this, "velocity");
10
- g(this, "isAnimating", !1);
11
- g(this, "controls", null);
7
+ y(this, "options");
8
+ y(this, "currentValue");
9
+ y(this, "velocity");
10
+ y(this, "isAnimating", !1);
11
+ y(this, "controls", null);
12
12
  // For object animations
13
- g(this, "animationMap", null);
14
- g(this, "activeAnimations", /* @__PURE__ */ new Set());
15
- g(this, "completedAnimations", /* @__PURE__ */ new Set());
16
- g(this, "updatedProperties", /* @__PURE__ */ new Set());
17
- g(this, "animate", (t = !1) => {
13
+ y(this, "animationMap", null);
14
+ y(this, "activeAnimations", /* @__PURE__ */ new Set());
15
+ y(this, "completedAnimations", /* @__PURE__ */ new Set());
16
+ y(this, "updatedProperties", /* @__PURE__ */ new Set());
17
+ y(this, "animate", (t = !1) => {
18
18
  !this.isAnimating && this.options.onStart && this.options.onStart(), this.isAnimating = !0;
19
19
  const o = t ? this.options.from : this.options.to;
20
20
  if (typeof this.currentValue == "object" && this.currentValue !== null) {
21
- this.animateObject(o, t);
21
+ this.animateObject(o);
22
22
  return;
23
23
  }
24
- let n = this.currentValue, e = performance.now();
25
- const u = {
24
+ let i = this.currentValue, e = performance.now();
25
+ const m = {
26
26
  from: this.currentValue,
27
27
  to: o,
28
28
  stiffness: this.options.spring.stiffness,
29
29
  damping: this.options.spring.damping,
30
30
  mass: 1
31
31
  };
32
- typeof this.velocity == "number" && (u.velocity = this.velocity * 1e3), this.controls = O({
33
- ...u,
34
- onUpdate: (s) => {
35
- const f = performance.now(), h = (f - e) / 1e3;
36
- if (h > 0) {
37
- if (typeof s == "number" && typeof n == "number") {
38
- const a = (s - n) / h;
39
- this.velocity = a / 1e3;
40
- } else if (typeof s == "object" && s !== null) {
41
- const a = {};
42
- Object.keys(s).forEach((m) => {
43
- const r = s[m], c = n[m];
44
- if (typeof r == "number" && typeof c == "number") {
45
- const p = (r - c) / h;
46
- a[m] = p / 1e3;
32
+ typeof this.velocity == "number" && (m.velocity = this.velocity * 1e3), this.controls = P({
33
+ ...m,
34
+ onUpdate: (l) => {
35
+ const p = performance.now(), r = (p - e) / 1e3;
36
+ if (r > 0) {
37
+ if (typeof l == "number" && typeof i == "number") {
38
+ const u = (l - i) / r;
39
+ this.velocity = u / 1e3;
40
+ } else if (typeof l == "object" && l !== null) {
41
+ const u = {};
42
+ Object.keys(l).forEach((f) => {
43
+ const c = l[f], a = i[f];
44
+ if (typeof c == "number" && typeof a == "number") {
45
+ const h = (c - a) / r;
46
+ u[f] = h / 1e3;
47
47
  }
48
- }), this.velocity = a;
48
+ }), this.velocity = u;
49
49
  }
50
- n = s, e = f;
50
+ i = l, e = p;
51
51
  }
52
- this.currentValue = s, this.options.onUpdate(s);
52
+ this.currentValue = l, this.options.onUpdate(l);
53
53
  },
54
54
  onComplete: () => {
55
- this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((s) => {
56
- this.velocity[s] = 0;
55
+ this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((l) => {
56
+ this.velocity[l] = 0;
57
57
  }) : this.velocity = 0, this.options.onComplete();
58
58
  }
59
59
  });
60
60
  });
61
- g(this, "animateObject", (t, o) => {
62
- const n = this.currentValue, e = Object.keys(n);
61
+ y(this, "animateObject", (t) => {
62
+ const o = this.currentValue, i = Object.keys(o);
63
63
  this.animationMap = /* @__PURE__ */ new Map(), this.activeAnimations.clear(), this.completedAnimations.clear(), this.updatedProperties.clear();
64
- const u = { ...n }, s = {};
65
- let f = !1;
66
- const h = () => {
67
- const a = e.filter((r) => !this.completedAnimations.has(r));
68
- if (a.every(
69
- (r) => this.updatedProperties.has(r)
70
- ) && a.length > 0) {
64
+ const e = { ...o }, m = {};
65
+ let l = !1;
66
+ const p = () => {
67
+ const r = i.filter((f) => !this.completedAnimations.has(f));
68
+ if (r.every(
69
+ (f) => this.updatedProperties.has(f)
70
+ ) && r.length > 0) {
71
71
  if (typeof this.velocity == "object" && this.velocity) {
72
- const r = performance.now();
73
- Object.keys(u).forEach((c) => {
74
- if (s[c]) {
75
- const p = (r - s[c]) / 1e3, l = this.currentValue[c], d = u[c];
76
- typeof l == "number" && typeof d == "number" && p > 0 && (this.velocity[c] = (d - l) / p / 1e3);
72
+ const f = performance.now();
73
+ Object.keys(e).forEach((c) => {
74
+ if (m[c]) {
75
+ const a = (f - m[c]) / 1e3, h = this.currentValue[c], s = e[c];
76
+ typeof h == "number" && typeof s == "number" && a > 0 && (this.velocity[c] = (s - h) / a / 1e3);
77
77
  }
78
- s[c] = r;
78
+ m[c] = f;
79
79
  });
80
80
  }
81
- this.currentValue = { ...u }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !f && this.options.onStart && (f = !0, this.options.onStart());
81
+ this.currentValue = { ...e }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !l && this.options.onStart && (l = !0, this.options.onStart());
82
82
  }
83
83
  };
84
- e.forEach((a) => {
85
- this.activeAnimations.add(a);
86
- const m = {
87
- from: n[a],
88
- to: t[a],
84
+ i.forEach((r) => {
85
+ this.activeAnimations.add(r);
86
+ const u = {
87
+ from: o[r],
88
+ to: t[r],
89
89
  stiffness: this.options.spring.stiffness,
90
90
  damping: this.options.spring.damping,
91
91
  mass: 1
92
92
  };
93
- typeof this.velocity == "object" && this.velocity && a in this.velocity && (m.velocity = this.velocity[a] * 1e3);
94
- const r = O({
95
- ...m,
93
+ typeof this.velocity == "object" && this.velocity && r in this.velocity && (u.velocity = this.velocity[r] * 1e3);
94
+ const f = P({
95
+ ...u,
96
96
  onUpdate: (c) => {
97
- u[a] = c, this.updatedProperties.add(a), h();
97
+ e[r] = c, this.updatedProperties.add(r), p();
98
98
  },
99
99
  onComplete: () => {
100
- this.completedAnimations.add(a), this.updatedProperties.delete(a), this.completedAnimations.size === e.length && (this.currentValue = t, this.isAnimating = !1, this.animationMap = null, typeof this.velocity == "object" && this.velocity && Object.keys(this.velocity).forEach((c) => {
100
+ this.completedAnimations.add(r), this.updatedProperties.delete(r), this.completedAnimations.size === i.length && (this.currentValue = t, this.isAnimating = !1, this.animationMap = null, typeof this.velocity == "object" && this.velocity && Object.keys(this.velocity).forEach((c) => {
101
101
  this.velocity[c] = 0;
102
102
  }), this.options.onComplete());
103
103
  }
104
104
  });
105
- this.animationMap.set(a, r);
105
+ this.animationMap.set(r, f);
106
106
  });
107
107
  });
108
108
  if (this.options = {
@@ -116,8 +116,8 @@ class A {
116
116
  onStart: t.onStart
117
117
  }, this.currentValue = this.options.from, typeof this.options.from == "object" && this.options.from !== null) {
118
118
  const o = {};
119
- Object.keys(this.options.from).forEach((n) => {
120
- o[n] = 0;
119
+ Object.keys(this.options.from).forEach((i) => {
120
+ o[i] = 0;
121
121
  }), this.velocity = o;
122
122
  } else
123
123
  this.velocity = 0;
@@ -178,31 +178,31 @@ class A {
178
178
  }
179
179
  // Static factory method
180
180
  static fromState(t, o) {
181
- const n = new A(o);
182
- return n.setValue(t.position), n.setVelocity(t.velocity), n;
181
+ const i = new C(o);
182
+ return i.setValue(t.position), i.setVelocity(t.velocity), i;
183
183
  }
184
184
  }
185
- const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
185
+ const x = Symbol.for("TRANSITION_STRATEGY"), I = (n) => ({
186
186
  runIn: async (t) => {
187
- const { currentAnimation: o } = i;
187
+ const { currentAnimation: o } = n;
188
188
  if (o && o.direction === "out") {
189
- const s = o.animator.getCurrentState();
189
+ const l = o.animator.getCurrentState();
190
190
  if (o.animator.stop(), t.out) {
191
- const f = await t.out, { from: h = 1, to: a = 0 } = f;
191
+ const p = await t.out, { from: r = 1, to: u = 0 } = p;
192
192
  return {
193
- config: f,
194
- state: s,
195
- from: h,
193
+ config: p,
194
+ state: l,
195
+ from: r,
196
196
  // OUT animation's from
197
- to: a,
197
+ to: u,
198
198
  // OUT animation's to
199
199
  direction: "backward"
200
200
  // Will actually go 0→1
201
201
  };
202
202
  }
203
203
  }
204
- const n = await t.in;
205
- if (!n)
204
+ const i = await t.in;
205
+ if (!i)
206
206
  return {
207
207
  state: {
208
208
  position: 0,
@@ -212,41 +212,41 @@ const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
212
212
  to: 1,
213
213
  direction: "forward"
214
214
  };
215
- const { from: e = 0, to: u = 1 } = n;
215
+ const { from: e = 0, to: m = 1 } = i;
216
216
  return {
217
- config: n,
217
+ config: i,
218
218
  state: {
219
219
  position: e,
220
220
  velocity: 0
221
221
  },
222
222
  from: e,
223
- to: u,
223
+ to: m,
224
224
  direction: "forward"
225
225
  };
226
226
  },
227
227
  runOut: async (t) => {
228
- const { currentAnimation: o } = i;
228
+ const { currentAnimation: o } = n;
229
229
  if (o && o.direction === "in") {
230
- const s = o.animator.getCurrentState();
230
+ const l = o.animator.getCurrentState();
231
231
  if (o.animator.stop(), t.in) {
232
- const f = await t.in, { from: h = 0, to: a = 1 } = f;
232
+ const p = await t.in, { from: r = 0, to: u = 1 } = p;
233
233
  return {
234
- config: f,
234
+ config: p,
235
235
  state: {
236
- position: s.position,
237
- velocity: s.velocity
236
+ position: l.position,
237
+ velocity: l.velocity
238
238
  },
239
- from: h,
239
+ from: r,
240
240
  // IN animation's from
241
- to: a,
241
+ to: u,
242
242
  // IN animation's to
243
243
  direction: "backward"
244
244
  // Will actually go 1→0
245
245
  };
246
246
  }
247
247
  }
248
- const n = await t.out;
249
- if (!n)
248
+ const i = await t.out;
249
+ if (!i)
250
250
  return {
251
251
  state: {
252
252
  position: 1,
@@ -256,22 +256,22 @@ const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
256
256
  to: 0,
257
257
  direction: "forward"
258
258
  };
259
- const { from: e = 1, to: u = 0 } = n;
259
+ const { from: e = 1, to: m = 0 } = i;
260
260
  return {
261
- config: n,
261
+ config: i,
262
262
  state: {
263
263
  position: e,
264
264
  velocity: 0
265
265
  },
266
266
  from: e,
267
- to: u,
267
+ to: m,
268
268
  direction: "forward"
269
269
  };
270
270
  }
271
- }), I = (i) => ({
272
- runIn: async (t) => {
273
- const o = await t.in;
274
- if (!o)
271
+ }), N = () => ({
272
+ runIn: async (n) => {
273
+ const t = await n.in;
274
+ if (!t)
275
275
  return {
276
276
  state: {
277
277
  position: 0,
@@ -281,21 +281,21 @@ const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
281
281
  to: 1,
282
282
  direction: "forward"
283
283
  };
284
- const { from: n = 0, to: e = 1 } = o;
284
+ const { from: o = 0, to: i = 1 } = t;
285
285
  return {
286
- config: o,
286
+ config: t,
287
287
  state: {
288
- position: n,
288
+ position: o,
289
289
  velocity: 0
290
290
  },
291
- from: n,
292
- to: e,
291
+ from: o,
292
+ to: i,
293
293
  direction: "forward"
294
294
  };
295
295
  },
296
- runOut: async (t) => {
297
- const o = await t.out;
298
- if (!o)
296
+ runOut: async (n) => {
297
+ const t = await n.out;
298
+ if (!t)
299
299
  return {
300
300
  state: {
301
301
  position: 1,
@@ -305,246 +305,282 @@ const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
305
305
  to: 0,
306
306
  direction: "forward"
307
307
  };
308
- const { from: n = 1, to: e = 0 } = o;
308
+ const { from: o = 1, to: i = 0 } = t;
309
309
  return {
310
- config: o,
310
+ config: t,
311
311
  state: {
312
- position: n,
312
+ position: o,
313
313
  velocity: 0
314
314
  },
315
- from: n,
316
- to: e,
315
+ from: o,
316
+ to: i,
317
317
  direction: "forward"
318
318
  };
319
319
  }
320
320
  });
321
- function N(i, t) {
322
- var m;
323
- let o = null, n = null, e = null, u = null;
324
- const s = {
321
+ function k(n, t) {
322
+ var f;
323
+ let o = null, i = null, e = null, m = null;
324
+ const l = {
325
325
  get currentAnimation() {
326
326
  return o;
327
327
  }
328
- }, f = ((m = t == null ? void 0 : t.strategy) == null ? void 0 : m.call(t, s)) || U(s), h = async (r) => {
329
- var y, S;
330
- n && (n.remove(), n = null);
331
- const c = i(), p = {
332
- in: c.in && Promise.resolve(c.in(r)),
333
- out: c.out && Promise.resolve(c.out(r))
334
- }, l = await f.runIn(p);
335
- if (!l.config)
328
+ }, p = ((f = t == null ? void 0 : t.strategy) == null ? void 0 : f.call(t, l)) || I(l), r = async (c) => {
329
+ var w, S;
330
+ i && (i.remove(), i = null);
331
+ const a = n(), h = {
332
+ in: a.in && Promise.resolve(a.in(c)),
333
+ out: a.out && Promise.resolve(a.out(c))
334
+ }, s = await p.runIn(h);
335
+ if (!s.config)
336
336
  return;
337
- (S = (y = l.config).prepare) == null || S.call(y, r), l.config.wait && await l.config.wait();
338
- const d = A.fromState(l.state, {
339
- from: l.from,
340
- to: l.to,
341
- spring: l.config.spring,
342
- onStart: l.config.onStart,
343
- onUpdate: l.config.tick,
337
+ (S = (w = s.config).prepare) == null || S.call(w, c), s.config.wait && await s.config.wait();
338
+ const g = C.fromState(s.state, {
339
+ from: s.from,
340
+ to: s.to,
341
+ spring: s.config.spring,
342
+ onStart: s.config.onStart,
343
+ onUpdate: s.config.tick,
344
344
  onComplete: () => {
345
- var v, w;
346
- o = null, (w = (v = l.config) == null ? void 0 : v.onEnd) == null || w.call(v);
345
+ var v, d;
346
+ o = null, (d = (v = s.config) == null ? void 0 : v.onEnd) == null || d.call(v);
347
347
  }
348
348
  });
349
- o = { animator: d, direction: "in" }, l.direction === "forward" ? d.forward() : d.backward();
350
- }, a = async (r) => {
349
+ o = { animator: g, direction: "in" }, s.direction === "forward" ? g.forward() : g.backward();
350
+ }, u = async (c) => {
351
351
  var S, v;
352
- n = r;
353
- const c = i(), p = {
354
- in: c.in && Promise.resolve(c.in(r)),
355
- out: c.out && Promise.resolve(c.out(r))
356
- }, l = await f.runOut(p);
357
- if (!l.config)
352
+ i = c;
353
+ const a = n(), h = {
354
+ in: a.in && Promise.resolve(a.in(c)),
355
+ out: a.out && Promise.resolve(a.out(c))
356
+ }, s = await p.runOut(h);
357
+ if (!s.config)
358
358
  return;
359
- (v = (S = l.config).prepare) == null || v.call(S, r), y(), l.config.wait && await l.config.wait();
360
- const d = A.fromState(l.state, {
361
- from: l.from,
362
- to: l.to,
363
- spring: l.config.spring,
364
- onStart: l.config.onStart,
365
- onUpdate: l.config.tick,
359
+ (v = (S = s.config).prepare) == null || v.call(S, c), w(), s.config.wait && await s.config.wait();
360
+ const g = C.fromState(s.state, {
361
+ from: s.from,
362
+ to: s.to,
363
+ spring: s.config.spring,
364
+ onStart: s.config.onStart,
365
+ onUpdate: s.config.tick,
366
366
  onComplete: () => {
367
- var w, T, E;
368
- (T = (w = l.config) == null ? void 0 : w.onEnd) == null || T.call(w), n && (n.remove(), n = null), o = null, (E = t == null ? void 0 : t.onCleanupEnd) == null || E.call(t);
367
+ var d, V, T;
368
+ (V = (d = s.config) == null ? void 0 : d.onEnd) == null || V.call(d), i && (i.remove(), i = null), o = null, (T = t == null ? void 0 : t.onCleanupEnd) == null || T.call(t);
369
369
  }
370
370
  });
371
- o = { animator: d, direction: "out" }, l.direction === "forward" ? d.forward() : d.backward();
372
- function y() {
373
- !e || !n || (u && e.contains(u) ? e.insertBefore(n, u) : e.appendChild(n));
371
+ o = { animator: g, direction: "out" }, s.direction === "forward" ? g.forward() : g.backward();
372
+ function w() {
373
+ !e || !i || (m && e.contains(m) ? e.insertBefore(i, m) : e.appendChild(i));
374
374
  }
375
375
  };
376
- return (r) => {
377
- if (r)
378
- return e = r.parentElement, u = r.nextElementSibling, h(r), () => {
379
- const c = r.cloneNode(!0);
380
- a(c);
376
+ return (c) => {
377
+ if (c)
378
+ return e = c.parentElement, m = c.nextElementSibling, r(c), () => {
379
+ const a = c.cloneNode(!0);
380
+ u(a);
381
381
  };
382
382
  };
383
383
  }
384
- const D = 3, k = (i) => {
385
- if (!i) return null;
386
- const t = i.split(`
384
+ const D = 3, $ = (n) => {
385
+ if (!n) return null;
386
+ const t = n.split(`
387
387
  `).map((o) => o.trim());
388
388
  for (let o = D; o < Math.min(t.length, 6); o++) {
389
- const n = t[o], e = n == null ? void 0 : n.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
389
+ const i = t[o], e = i == null ? void 0 : i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
390
390
  if (!e)
391
391
  continue;
392
- const u = e[1] ?? "", s = e[2] ?? "0", f = e[3] ?? "0";
393
- return { file: u.split(/[\\/]/).pop() || u, line: s, column: f };
392
+ const m = e[1] ?? "", l = e[2] ?? "0", p = e[3] ?? "0";
393
+ return { file: m.split(/[\\/]/).pop() || m, line: l, column: p };
394
394
  }
395
395
  return null;
396
- }, V = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
397
- function $(i, t, o) {
398
- V.set(i, t);
399
- let n = C.get(i);
400
- return n || (n = N(
396
+ }, A = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
397
+ function F(n, t, o) {
398
+ A.set(n, t);
399
+ let i = E.get(n);
400
+ return i || (i = k(
401
401
  () => {
402
- const e = V.get(i);
403
- return e || (console.warn(`Transition "${String(i)}" not found`), {});
402
+ const e = A.get(n);
403
+ return e || (console.warn(`Transition "${String(n)}" not found`), {});
404
404
  },
405
405
  {
406
406
  strategy: o,
407
- onCleanupEnd: () => M(i)
407
+ onCleanupEnd: () => M(n)
408
408
  }
409
- ), C.set(i, n), n);
409
+ ), E.set(n, i), i);
410
410
  }
411
- function M(i) {
412
- V.delete(i), C.delete(i);
411
+ function M(n) {
412
+ A.delete(n), E.delete(n);
413
413
  }
414
- function F() {
415
- const i = k(new Error().stack);
416
- return i ? `auto_${i.file}_${i.line}_${i.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
414
+ function K() {
415
+ const n = $(new Error().stack);
416
+ return n ? `auto_${n.file}_${n.line}_${n.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
417
417
  }
418
- const R = globalThis.FinalizationRegistry, P = R ? new R((i) => {
418
+ const R = globalThis.FinalizationRegistry, O = R ? new R((n) => {
419
419
  try {
420
- M(i);
420
+ M(n);
421
421
  } catch {
422
422
  }
423
423
  }) : void 0;
424
- function H(i) {
425
- const t = i.key ?? F();
426
- if (i.ref && P)
424
+ function X(n) {
425
+ const t = n.key ?? K();
426
+ if (n.ref && O)
427
427
  try {
428
- P.register(i.ref, t);
428
+ O.register(n.ref, t);
429
429
  } catch {
430
430
  }
431
- return $(
431
+ return F(
432
432
  t,
433
433
  {
434
- in: i.in,
435
- out: i.out
434
+ in: n.in,
435
+ out: n.out
436
436
  },
437
- i[j]
437
+ n[x]
438
438
  );
439
439
  }
440
- const K = (i) => {
441
- let t = i.parentElement;
440
+ const W = (n) => {
441
+ let t = n.parentElement;
442
442
  for (; t && t !== document.body; ) {
443
- const o = window.getComputedStyle(t), n = o.overflow + o.overflowY + o.overflowX;
444
- if (n.includes("auto") || n.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
443
+ const o = window.getComputedStyle(t), i = o.overflow + o.overflowY + o.overflowX;
444
+ if (i.includes("auto") || i.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
445
445
  return t;
446
446
  t = t.parentElement;
447
447
  }
448
448
  return document.documentElement;
449
+ }, j = (n) => {
450
+ let t = n.parentElement;
451
+ for (; t && t !== document.body; ) {
452
+ const o = window.getComputedStyle(t).position;
453
+ if (o === "relative" || o === "absolute" || o === "fixed" || o === "sticky")
454
+ return t;
455
+ t = t.parentElement;
456
+ }
457
+ return document.body;
449
458
  };
450
- function W(i) {
451
- const t = i.filter((o) => o.symmetric).map((o) => ({
459
+ function L(n) {
460
+ const t = n.filter((o) => o.symmetric).map((o) => ({
452
461
  from: o.to,
453
462
  to: o.from,
454
463
  transition: o.transition
455
464
  }));
456
- return [...i, ...t];
465
+ return [...n, ...t];
457
466
  }
458
- function L() {
459
- let i = null;
467
+ function z() {
468
+ let n = null;
460
469
  const t = /* @__PURE__ */ new Map();
461
470
  let o = null;
462
- const n = () => {
463
- i && o && t.set(o, {
464
- x: i.scrollLeft,
465
- y: i.scrollTop
471
+ const i = () => {
472
+ n && o && t.set(o, {
473
+ x: n.scrollLeft,
474
+ y: n.scrollTop
466
475
  });
467
476
  };
468
477
  return {
469
- startScrollTracking: (s, f) => {
470
- i || (i = K(s), (i === document.documentElement ? window : i).addEventListener("scroll", n, {
478
+ startScrollTracking: (r, u) => {
479
+ n || (n = W(r), (n === document.documentElement ? window : n).addEventListener("scroll", i, {
471
480
  passive: !0
472
- })), o = f;
481
+ })), o = u;
473
482
  },
474
- calculateScrollOffset: (s, f) => {
475
- const h = s && t.has(s) ? t.get(s) : { x: 0, y: 0 }, a = f && t.has(f) ? t.get(f) : { x: 0, y: 0 };
483
+ calculateScrollOffset: (r, u) => {
484
+ const f = r && t.has(r) ? t.get(r) : { x: 0, y: 0 }, c = u && t.has(u) ? t.get(u) : { x: 0, y: 0 };
476
485
  return {
477
- x: -a.x + h.x,
478
- y: -a.y + h.y
486
+ x: -c.x + f.x,
487
+ y: -c.y + f.y
479
488
  };
480
- }
489
+ },
490
+ getScrollContainer: () => n,
491
+ getScrollPosition: (r) => r && t.has(r) ? t.get(r) : { x: 0, y: 0 }
481
492
  };
482
493
  }
483
- function X(i) {
494
+ function B(n) {
484
495
  const {
485
496
  transitions: t = [],
486
497
  defaultTransition: o,
487
- middleware: n = (m, r) => ({ from: m, to: r })
498
+ middleware: i = (a, h) => ({ from: a, to: h })
488
499
  // Identity function as default
489
- } = i;
500
+ } = n;
490
501
  let e = null;
491
- const u = W(t), { startScrollTracking: s, calculateScrollOffset: f } = L();
492
- function h() {
502
+ const m = L(t), {
503
+ startScrollTracking: l,
504
+ calculateScrollOffset: p,
505
+ getScrollContainer: r,
506
+ getScrollPosition: u
507
+ } = z();
508
+ function f() {
493
509
  if (e != null && e.from && (e != null && e.to)) {
494
- const { from: m, to: r } = n(
510
+ const { from: a, to: h } = i(
495
511
  e.from,
496
512
  e.to
497
- ), p = z(
498
- m,
499
- r,
500
- u
501
- ) || o, d = { scrollOffset: f(
513
+ ), g = Y(
514
+ a,
515
+ h,
516
+ m
517
+ ) || o, w = p(
502
518
  e.from,
503
519
  e.to
504
- ) };
505
- p && (p.out && e.outResolve && e.outResolve(
506
- (y) => p.out(y, d)
507
- ), p.in && e.inResolve && e.inResolve(
508
- (y) => p.in(y, d)
520
+ ), S = {
521
+ scrollOffset: w,
522
+ scroll: u(e.from),
523
+ get scrollingElement() {
524
+ return r() || document.documentElement;
525
+ },
526
+ get positionedParent() {
527
+ const d = r();
528
+ return d ? j(d) : document.body;
529
+ }
530
+ }, v = {
531
+ scrollOffset: w,
532
+ scroll: u(e.to),
533
+ get scrollingElement() {
534
+ return r() || document.documentElement;
535
+ },
536
+ get positionedParent() {
537
+ const d = r();
538
+ return d ? j(d) : document.body;
539
+ }
540
+ };
541
+ g && (g.out && e.outResolve && e.outResolve(
542
+ (d) => g.out(d, S)
543
+ ), g.in && e.inResolve && e.inResolve(
544
+ (d) => g.in(d, v)
509
545
  )), e = null;
510
546
  }
511
547
  }
512
- const a = async (m, r) => r === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), r === "out" ? (e.from = m, new Promise((c) => {
513
- e.outResolve = c, h();
514
- })) : (e.to = m, new Promise((c) => {
515
- e.inResolve = c, h();
548
+ const c = async (a, h) => h === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), h === "out" ? (e.from = a, new Promise((s) => {
549
+ e.outResolve = s, f();
550
+ })) : (e.to = a, new Promise((s) => {
551
+ e.inResolve = s, f();
516
552
  })));
517
- return (m) => ({
518
- key: m,
519
- in: async (r) => (s(r, m), (await a(m, "in"))(r)),
520
- out: async (r) => (await a(m, "out"))(r),
553
+ return (a) => ({
554
+ key: a,
555
+ in: async (h) => (l(h, a), (await c(a, "in"))(h)),
556
+ out: async (h) => (await c(a, "out"))(h),
521
557
  // Add page transition strategy for page-level transitions
522
- [j]: I
558
+ [x]: N
523
559
  });
524
560
  }
525
- function z(i, t, o) {
526
- for (const n of o)
527
- if (b(i, n.from) && b(t, n.to))
528
- return n.transition;
529
- for (const n of o)
530
- if ((n.from === "*" || b(i, n.from)) && (n.to === "*" || b(t, n.to)))
531
- return n.transition;
561
+ function Y(n, t, o) {
562
+ for (const i of o)
563
+ if (b(n, i.from) && b(t, i.to))
564
+ return i.transition;
565
+ for (const i of o)
566
+ if ((i.from === "*" || b(n, i.from)) && (i.to === "*" || b(t, i.to)))
567
+ return i.transition;
532
568
  return null;
533
569
  }
534
- function b(i, t) {
570
+ function b(n, t) {
535
571
  if (t === "*")
536
572
  return !0;
537
573
  if (t.endsWith("/*")) {
538
574
  const o = t.slice(0, -2);
539
- return i === o || i.startsWith(o + "/");
575
+ return n === o || n.startsWith(o + "/");
540
576
  }
541
- return i === t;
577
+ return n === t;
542
578
  }
543
579
  export {
544
- j as TRANSITION_STRATEGY,
545
- U as createDefaultStrategy,
546
- I as createPageTransitionStrategy,
547
- X as createSggoiTransitionContext,
548
- F as generateAutoKey,
549
- H as transition
580
+ x as TRANSITION_STRATEGY,
581
+ I as createDefaultStrategy,
582
+ N as createPageTransitionStrategy,
583
+ B as createSggoiTransitionContext,
584
+ K as generateAutoKey,
585
+ X as transition
550
586
  };