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