@ssgoi/core 2.5.2 → 2.5.4

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 (61) hide show
  1. package/dist/animator/animate.d.ts.map +1 -0
  2. package/dist/{animation-scheduler.d.ts → animator/animation-scheduler.d.ts} +1 -1
  3. package/dist/animator/animation-scheduler.d.ts.map +1 -0
  4. package/dist/{animator.d.ts → animator/index.d.ts} +2 -2
  5. package/dist/animator/index.d.ts.map +1 -0
  6. package/dist/animator/ticker.d.ts.map +1 -0
  7. package/dist/index.cjs +2 -2
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +279 -267
  11. package/dist/presets/index.cjs +1 -1
  12. package/dist/presets/index.js +2 -2
  13. package/dist/ssgoi-transition/create-context-manager.d.ts +18 -0
  14. package/dist/ssgoi-transition/create-context-manager.d.ts.map +1 -0
  15. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +46 -0
  16. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -0
  17. package/dist/ssgoi-transition/create-swipe-detector.d.ts +10 -0
  18. package/dist/ssgoi-transition/create-swipe-detector.d.ts.map +1 -0
  19. package/dist/ssgoi-transition/find-matching-transition.d.ts +24 -0
  20. package/dist/ssgoi-transition/find-matching-transition.d.ts.map +1 -0
  21. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +7 -0
  22. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +1 -0
  23. package/dist/ssgoi-transition/types.d.ts +8 -0
  24. package/dist/ssgoi-transition/types.d.ts.map +1 -0
  25. package/dist/{create-transition-callback.d.ts → transition/create-transition-callback.d.ts} +1 -1
  26. package/dist/transition/create-transition-callback.d.ts.map +1 -0
  27. package/dist/{transition-strategy.d.ts → transition/transition-strategy.d.ts} +1 -1
  28. package/dist/transition/transition-strategy.d.ts.map +1 -0
  29. package/dist/{transition.d.ts → transition/transition.d.ts} +1 -1
  30. package/dist/transition/transition.d.ts.map +1 -0
  31. package/dist/utils/index.d.ts +1 -0
  32. package/dist/utils/index.d.ts.map +1 -1
  33. package/dist/utils/number.d.ts +46 -0
  34. package/dist/utils/number.d.ts.map +1 -0
  35. package/dist/view-transitions/drill.d.ts.map +1 -1
  36. package/dist/view-transitions/fade.d.ts.map +1 -1
  37. package/dist/view-transitions/hero.d.ts.map +1 -1
  38. package/dist/view-transitions/index.cjs +15 -15
  39. package/dist/view-transitions/index.d.ts +1 -0
  40. package/dist/view-transitions/index.d.ts.map +1 -1
  41. package/dist/view-transitions/index.js +646 -480
  42. package/dist/view-transitions/instagram.d.ts +8 -0
  43. package/dist/view-transitions/instagram.d.ts.map +1 -0
  44. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  45. package/dist/view-transitions/scroll.d.ts.map +1 -1
  46. package/dist/view-transitions/slide.d.ts.map +1 -1
  47. package/dist/view-transitions/strip.d.ts.map +1 -1
  48. package/package.json +1 -1
  49. package/dist/animate.d.ts.map +0 -1
  50. package/dist/animation-scheduler.d.ts.map +0 -1
  51. package/dist/animator.d.ts.map +0 -1
  52. package/dist/create-ssgoi-transition-context.d.ts +0 -15
  53. package/dist/create-ssgoi-transition-context.d.ts.map +0 -1
  54. package/dist/create-transition-callback.d.ts.map +0 -1
  55. package/dist/ticker.d.ts.map +0 -1
  56. package/dist/transition-strategy.d.ts.map +0 -1
  57. package/dist/transition.d.ts.map +0 -1
  58. package/dist/utils.d.ts +0 -17
  59. package/dist/utils.d.ts.map +0 -1
  60. /package/dist/{animate.d.ts → animator/animate.d.ts} +0 -0
  61. /package/dist/{ticker.d.ts → animator/ticker.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,36 +1,36 @@
1
1
  var _ = Object.defineProperty;
2
2
  var $ = (n, t, e) => t in n ? _(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var d = (n, t, e) => $(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { isMultiSpring as R } from "./types.js";
3
+ var m = (n, t, e) => $(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import { isMultiSpring as V } from "./types.js";
5
5
  import { isSingleSpring as at } from "./types.js";
6
6
  import { j as lt } from "./jaemin-BAi8PTrj.js";
7
- class F {
7
+ class H {
8
8
  constructor() {
9
- d(this, "listeners", /* @__PURE__ */ new Set());
10
- d(this, "rafId", null);
11
- d(this, "isRunning", !1);
9
+ m(this, "listeners", /* @__PURE__ */ new Set());
10
+ m(this, "rafId", null);
11
+ m(this, "isRunning", !1);
12
12
  // Timing
13
- d(this, "startTime", Date.now());
14
- d(this, "lastUpdate", this.startTime);
15
- d(this, "elapsed", 0);
13
+ m(this, "startTime", Date.now());
14
+ m(this, "lastUpdate", this.startTime);
15
+ m(this, "elapsed", 0);
16
16
  // Lag smoothing (mobile optimization)
17
- d(this, "lagThreshold", 500);
17
+ m(this, "lagThreshold", 500);
18
18
  // ms - detect tab switches, backgrounding
19
- d(this, "adjustedLag", 33);
19
+ m(this, "adjustedLag", 33);
20
20
  // ms - max time jump to prevent animation skip
21
21
  // FPS throttling
22
- d(this, "gap", 1e3 / 240);
22
+ m(this, "gap", 1e3 / 240);
23
23
  // max 240fps
24
- d(this, "nextTime", this.gap);
25
- d(this, "tick", () => {
24
+ m(this, "nextTime", this.gap);
25
+ m(this, "tick", () => {
26
26
  const t = Date.now();
27
27
  let e = t - this.lastUpdate;
28
28
  (e > this.lagThreshold || e < 0) && (this.startTime += e - this.adjustedLag, e = this.adjustedLag), this.lastUpdate = t;
29
- const i = t - this.startTime, r = i - this.nextTime;
30
- if (r > 0) {
31
- const o = e / 1e3;
32
- this.elapsed = i / 1e3, this.nextTime += r + (r >= this.gap ? 4 : this.gap - r), this.listeners.forEach((s) => {
33
- s(o, this.elapsed);
29
+ const i = t - this.startTime, o = i - this.nextTime;
30
+ if (o > 0) {
31
+ const r = e / 1e3;
32
+ this.elapsed = i / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((s) => {
33
+ s(r, this.elapsed);
34
34
  });
35
35
  }
36
36
  this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
@@ -66,72 +66,72 @@ class F {
66
66
  return this.elapsed;
67
67
  }
68
68
  }
69
- const I = new F();
69
+ const I = new H();
70
70
  function k(n) {
71
71
  const {
72
72
  from: t,
73
73
  to: e,
74
74
  stiffness: i,
75
- damping: r,
76
- mass: o,
75
+ damping: o,
76
+ mass: r,
77
77
  velocity: s = 0,
78
- onUpdate: m,
78
+ onUpdate: d,
79
79
  onComplete: l
80
80
  } = n;
81
81
  let h = t, u = s, a = !0;
82
- const p = Math.sqrt(i / o), c = r / (2 * Math.sqrt(i * o)), S = 0.01, w = 0.01;
82
+ const p = Math.sqrt(i / r), c = o / (2 * Math.sqrt(i * r)), g = 0.01, w = 0.01;
83
83
  let f = 0;
84
- const g = 0.05, v = (A) => {
84
+ const y = 0.05, S = (C) => {
85
85
  if (!a) return;
86
- const C = Math.min(A, 0.033), y = -2 * C * c * p * u, b = C * p * p * (e - h);
87
- u += y + b, h += C * u;
88
- const E = Math.abs(e - h), T = Math.abs(u);
89
- if (E < S && T < w) {
90
- if (f += C, f >= g) {
91
- h = e, u = 0, a = !1, m(h), I.unsubscribe(v), l();
86
+ const T = Math.min(C, 0.033), v = -2 * T * c * p * u, b = T * p * p * (e - h);
87
+ u += v + b, h += T * u;
88
+ const E = Math.abs(e - h), A = Math.abs(u);
89
+ if (E < g && A < w) {
90
+ if (f += T, f >= y) {
91
+ h = e, u = 0, a = !1, d(h), I.unsubscribe(S), l();
92
92
  return;
93
93
  }
94
94
  } else
95
95
  f = 0;
96
- m(h);
96
+ d(h);
97
97
  };
98
- return I.subscribe(v), {
98
+ return I.subscribe(S), {
99
99
  stop: () => {
100
- a && (a = !1, I.unsubscribe(v));
100
+ a && (a = !1, I.unsubscribe(S));
101
101
  }
102
102
  };
103
103
  }
104
104
  class O {
105
105
  constructor(t) {
106
- d(this, "options");
107
- d(this, "currentValue");
108
- d(this, "velocity");
109
- d(this, "isAnimating", !1);
110
- d(this, "controls", null);
106
+ m(this, "options");
107
+ m(this, "currentValue");
108
+ m(this, "velocity");
109
+ m(this, "isAnimating", !1);
110
+ m(this, "controls", null);
111
111
  // For object animations
112
- d(this, "animationMap", null);
113
- d(this, "activeAnimations", /* @__PURE__ */ new Set());
114
- d(this, "completedAnimations", /* @__PURE__ */ new Set());
115
- d(this, "updatedProperties", /* @__PURE__ */ new Set());
116
- d(this, "animate", (t = !1) => {
112
+ m(this, "animationMap", null);
113
+ m(this, "activeAnimations", /* @__PURE__ */ new Set());
114
+ m(this, "completedAnimations", /* @__PURE__ */ new Set());
115
+ m(this, "updatedProperties", /* @__PURE__ */ new Set());
116
+ m(this, "animate", (t = !1) => {
117
117
  !this.isAnimating && this.options.onStart && this.options.onStart(), this.isAnimating = !0;
118
118
  const e = t ? this.options.from : this.options.to;
119
119
  if (typeof this.currentValue == "object" && this.currentValue !== null) {
120
120
  this.animateObject(e);
121
121
  return;
122
122
  }
123
- let i = this.currentValue, r = performance.now();
124
- const o = {
123
+ let i = this.currentValue, o = performance.now();
124
+ const r = {
125
125
  from: this.currentValue,
126
126
  to: e,
127
127
  stiffness: this.options.spring.stiffness,
128
128
  damping: this.options.spring.damping,
129
129
  mass: 1
130
130
  };
131
- typeof this.velocity == "number" && (o.velocity = this.velocity * 1e3), this.controls = k({
132
- ...o,
131
+ typeof this.velocity == "number" && (r.velocity = this.velocity * 1e3), this.controls = k({
132
+ ...r,
133
133
  onUpdate: (s) => {
134
- const m = performance.now(), l = (m - r) / 1e3;
134
+ const d = performance.now(), l = (d - o) / 1e3;
135
135
  if (l > 0) {
136
136
  if (typeof s == "number" && typeof i == "number") {
137
137
  const h = (s - i) / l;
@@ -146,7 +146,7 @@ class O {
146
146
  }
147
147
  }), this.velocity = h;
148
148
  }
149
- i = s, r = m;
149
+ i = s, o = d;
150
150
  }
151
151
  this.currentValue = s, this.options.onUpdate(s);
152
152
  },
@@ -157,27 +157,27 @@ class O {
157
157
  }
158
158
  });
159
159
  });
160
- d(this, "animateObject", (t) => {
160
+ m(this, "animateObject", (t) => {
161
161
  const e = this.currentValue, i = Object.keys(e);
162
162
  this.animationMap = /* @__PURE__ */ new Map(), this.activeAnimations.clear(), this.completedAnimations.clear(), this.updatedProperties.clear();
163
- const r = { ...e }, o = {};
163
+ const o = { ...e }, r = {};
164
164
  let s = !1;
165
- const m = () => {
165
+ const d = () => {
166
166
  const l = i.filter((u) => !this.completedAnimations.has(u));
167
167
  if (l.every(
168
168
  (u) => this.updatedProperties.has(u)
169
169
  ) && l.length > 0) {
170
170
  if (typeof this.velocity == "object" && this.velocity) {
171
171
  const u = performance.now();
172
- Object.keys(r).forEach((a) => {
173
- if (o[a]) {
174
- const p = (u - o[a]) / 1e3, c = this.currentValue[a], S = r[a];
175
- typeof c == "number" && typeof S == "number" && p > 0 && (this.velocity[a] = (S - c) / p / 1e3);
172
+ Object.keys(o).forEach((a) => {
173
+ if (r[a]) {
174
+ const p = (u - r[a]) / 1e3, c = this.currentValue[a], g = o[a];
175
+ typeof c == "number" && typeof g == "number" && p > 0 && (this.velocity[a] = (g - c) / p / 1e3);
176
176
  }
177
- o[a] = u;
177
+ r[a] = u;
178
178
  });
179
179
  }
180
- this.currentValue = { ...r }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !s && this.options.onStart && (s = !0, this.options.onStart());
180
+ this.currentValue = { ...o }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !s && this.options.onStart && (s = !0, this.options.onStart());
181
181
  }
182
182
  };
183
183
  i.forEach((l) => {
@@ -193,7 +193,7 @@ class O {
193
193
  const u = k({
194
194
  ...h,
195
195
  onUpdate: (a) => {
196
- r[l] = a, this.updatedProperties.add(l), m();
196
+ o[l] = a, this.updatedProperties.add(l), d();
197
197
  },
198
198
  onComplete: () => {
199
199
  this.completedAnimations.add(l), this.updatedProperties.delete(l), 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((a) => {
@@ -284,14 +284,14 @@ class O {
284
284
  }
285
285
  class j {
286
286
  constructor(t) {
287
- d(this, "config");
288
- d(this, "animators", /* @__PURE__ */ new Map());
289
- d(this, "springOrder", []);
290
- d(this, "completedCount", 0);
291
- d(this, "completedAnimators", /* @__PURE__ */ new Set());
292
- d(this, "direction", "forward");
293
- d(this, "idCounter", 0);
294
- d(this, "timeoutIds", []);
287
+ m(this, "config");
288
+ m(this, "animators", /* @__PURE__ */ new Map());
289
+ m(this, "springOrder", []);
290
+ m(this, "completedCount", 0);
291
+ m(this, "completedAnimators", /* @__PURE__ */ new Set());
292
+ m(this, "direction", "forward");
293
+ m(this, "idCounter", 0);
294
+ m(this, "timeoutIds", []);
295
295
  this.config = t, this.initializeAnimators();
296
296
  }
297
297
  generateId() {
@@ -323,9 +323,9 @@ class j {
323
323
  */
324
324
  normalizeSchedule(t) {
325
325
  const e = this.config.schedule ?? "overlap";
326
- return this.springOrder.map((i, r) => {
327
- const o = this.animators.get(i);
328
- if (!o)
326
+ return this.springOrder.map((i, o) => {
327
+ const r = this.animators.get(i);
328
+ if (!r)
329
329
  throw new Error(
330
330
  `AnimationScheduler: animator with id "${i}" not found during normalization`
331
331
  );
@@ -336,11 +336,11 @@ class j {
336
336
  delay: 0
337
337
  };
338
338
  if (e === "wait")
339
- return t === "forward" && r === 0 ? {
339
+ return t === "forward" && o === 0 ? {
340
340
  type: "offset",
341
341
  id: i,
342
342
  delay: 0
343
- } : t === "backward" && r === this.springOrder.length - 1 ? {
343
+ } : t === "backward" && o === this.springOrder.length - 1 ? {
344
344
  type: "offset",
345
345
  id: i,
346
346
  delay: 0
@@ -348,14 +348,14 @@ class j {
348
348
  type: "wait",
349
349
  id: i
350
350
  };
351
- const s = o.item.offset ?? 0;
351
+ const s = r.item.offset ?? 0;
352
352
  if (t === "forward")
353
353
  return {
354
354
  type: "offset",
355
355
  id: i,
356
356
  delay: s
357
357
  };
358
- const m = this.animators.size === 0 ? 0 : Math.max(
358
+ const d = this.animators.size === 0 ? 0 : Math.max(
359
359
  ...Array.from(this.animators.values()).map(
360
360
  (l) => l.item.offset ?? 0
361
361
  )
@@ -363,12 +363,12 @@ class j {
363
363
  return {
364
364
  type: "offset",
365
365
  id: i,
366
- delay: m - s
366
+ delay: d - s
367
367
  };
368
368
  });
369
369
  }
370
370
  onAnimatorComplete(t) {
371
- var i, r, o, s, m, l;
371
+ var i, o, r, s, d, l;
372
372
  const e = this.animators.get(t);
373
373
  if (!e) {
374
374
  console.warn(
@@ -376,7 +376,7 @@ class j {
376
376
  );
377
377
  return;
378
378
  }
379
- this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (r = (i = e.item).onComplete) == null || r.call(i), (s = (o = this.config).onProgress) == null || s.call(o, this.completedCount, this.config.springs.length), this.handleWaitModeChaining(t), this.completedCount === this.config.springs.length && ((l = (m = this.config).onEnd) == null || l.call(m)));
379
+ this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (i = e.item).onComplete) == null || o.call(i), (s = (r = this.config).onProgress) == null || s.call(r, this.completedCount, this.config.springs.length), this.handleWaitModeChaining(t), this.completedCount === this.config.springs.length && ((l = (d = this.config).onEnd) == null || l.call(d)));
380
380
  }
381
381
  /**
382
382
  * Handle wait mode chaining: start next/previous spring after completion
@@ -386,18 +386,18 @@ class j {
386
386
  return;
387
387
  const e = this.springOrder.indexOf(t);
388
388
  if (this.direction === "forward") {
389
- const o = this.springOrder[e + 1];
390
- if (!o)
389
+ const r = this.springOrder[e + 1];
390
+ if (!r)
391
391
  return;
392
- const s = this.animators.get(o);
393
- s && s.startTime === null && this.startAnimator(o);
392
+ const s = this.animators.get(r);
393
+ s && s.startTime === null && this.startAnimator(r);
394
394
  return;
395
395
  }
396
396
  const i = this.springOrder[e - 1];
397
397
  if (!i)
398
398
  return;
399
- const r = this.animators.get(i);
400
- r && r.startTime === null && this.startBackwardAnimator(i);
399
+ const o = this.animators.get(i);
400
+ o && o.startTime === null && this.startBackwardAnimator(i);
401
401
  }
402
402
  startAnimator(t) {
403
403
  const e = this.animators.get(t);
@@ -433,34 +433,34 @@ class j {
433
433
  }
434
434
  forward() {
435
435
  var e, i;
436
- this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), (i = (e = this.config).onStart) == null || i.call(e), this.normalizeSchedule("forward").forEach((r) => {
437
- if (r.type === "wait")
436
+ this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), (i = (e = this.config).onStart) == null || i.call(e), this.normalizeSchedule("forward").forEach((o) => {
437
+ if (o.type === "wait")
438
438
  return;
439
- if (r.delay === 0) {
440
- this.startAnimator(r.id);
439
+ if (o.delay === 0) {
440
+ this.startAnimator(o.id);
441
441
  return;
442
442
  }
443
- const o = window.setTimeout(
444
- () => this.startAnimator(r.id),
445
- r.delay
443
+ const r = window.setTimeout(
444
+ () => this.startAnimator(o.id),
445
+ o.delay
446
446
  );
447
- this.timeoutIds.push(o);
447
+ this.timeoutIds.push(r);
448
448
  });
449
449
  }
450
450
  backward() {
451
451
  var e, i;
452
- this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), (i = (e = this.config).onStart) == null || i.call(e), this.normalizeSchedule("backward").forEach((r) => {
453
- if (r.type === "wait")
452
+ this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), (i = (e = this.config).onStart) == null || i.call(e), this.normalizeSchedule("backward").forEach((o) => {
453
+ if (o.type === "wait")
454
454
  return;
455
- if (r.delay === 0) {
456
- this.startBackwardAnimator(r.id);
455
+ if (o.delay === 0) {
456
+ this.startBackwardAnimator(o.id);
457
457
  return;
458
458
  }
459
- const o = window.setTimeout(
460
- () => this.startBackwardAnimator(r.id),
461
- r.delay
459
+ const r = window.setTimeout(
460
+ () => this.startBackwardAnimator(o.id),
461
+ o.delay
462
462
  );
463
- this.timeoutIds.push(o);
463
+ this.timeoutIds.push(r);
464
464
  });
465
465
  }
466
466
  stop() {
@@ -474,10 +474,10 @@ class j {
474
474
  ), this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((i) => {
475
475
  if (i.startTime === null)
476
476
  return;
477
- const r = i.animator.getCurrentState();
478
- if (r.type !== "single")
477
+ const o = i.animator.getCurrentState();
478
+ if (o.type !== "single")
479
479
  return;
480
- if (r.position === r.to) {
480
+ if (o.position === o.to) {
481
481
  const s = O.fromState(
482
482
  {
483
483
  position: 1,
@@ -507,7 +507,7 @@ class j {
507
507
  };
508
508
  }
509
509
  }
510
- const L = Symbol.for("TRANSITION_STRATEGY"), N = (n) => ({
510
+ const z = Symbol.for("TRANSITION_STRATEGY"), F = (n) => ({
511
511
  runIn: async (t) => {
512
512
  const { currentAnimation: e } = n;
513
513
  if (e && e.direction === "out") {
@@ -523,9 +523,9 @@ const L = Symbol.for("TRANSITION_STRATEGY"), N = (n) => ({
523
523
  direction: "forward"
524
524
  };
525
525
  if (t.out) {
526
- const m = await t.out, { from: l = 1, to: h = 0 } = m;
526
+ const d = await t.out, { from: l = 1, to: h = 0 } = d;
527
527
  return {
528
- config: m,
528
+ config: d,
529
529
  state: {
530
530
  position: s.position,
531
531
  velocity: s.velocity
@@ -561,15 +561,15 @@ const L = Symbol.for("TRANSITION_STRATEGY"), N = (n) => ({
561
561
  to: 1,
562
562
  direction: "forward"
563
563
  };
564
- const { from: r = 0, to: o = 1 } = i;
564
+ const { from: o = 0, to: r = 1 } = i;
565
565
  return {
566
566
  config: i,
567
567
  state: {
568
- position: r,
568
+ position: o,
569
569
  velocity: 0
570
570
  },
571
- from: r,
572
- to: o,
571
+ from: o,
572
+ to: r,
573
573
  direction: "forward"
574
574
  };
575
575
  },
@@ -588,9 +588,9 @@ const L = Symbol.for("TRANSITION_STRATEGY"), N = (n) => ({
588
588
  direction: "forward"
589
589
  };
590
590
  if (t.in) {
591
- const m = await t.in, { from: l = 0, to: h = 1 } = m;
591
+ const d = await t.in, { from: l = 0, to: h = 1 } = d;
592
592
  return {
593
- config: m,
593
+ config: d,
594
594
  state: {
595
595
  position: s.position,
596
596
  velocity: s.velocity
@@ -626,19 +626,19 @@ const L = Symbol.for("TRANSITION_STRATEGY"), N = (n) => ({
626
626
  to: 0,
627
627
  direction: "forward"
628
628
  };
629
- const { from: r = 1, to: o = 0 } = i;
629
+ const { from: o = 1, to: r = 0 } = i;
630
630
  return {
631
631
  config: i,
632
632
  state: {
633
- position: r,
633
+ position: o,
634
634
  velocity: 0
635
635
  },
636
- from: r,
637
- to: o,
636
+ from: o,
637
+ to: r,
638
638
  direction: "forward"
639
639
  };
640
640
  }
641
- }), H = () => ({
641
+ }), N = () => ({
642
642
  runIn: async (n) => {
643
643
  const t = await n.in;
644
644
  if (!t)
@@ -712,32 +712,32 @@ const L = Symbol.for("TRANSITION_STRATEGY"), N = (n) => ({
712
712
  });
713
713
  function W(n, t) {
714
714
  var u;
715
- let e = null, i = null, r = null, o = null;
715
+ let e = null, i = null, o = null, r = null;
716
716
  const s = {
717
717
  get currentAnimation() {
718
718
  return e;
719
719
  }
720
- }, m = ((u = t == null ? void 0 : t.strategy) == null ? void 0 : u.call(t, s)) || N(s), l = async (a) => {
721
- var v, A, C;
720
+ }, d = ((u = t == null ? void 0 : t.strategy) == null ? void 0 : u.call(t, s)) || F(s), l = async (a) => {
721
+ var S, C, T;
722
722
  i && (i.remove(), i = null);
723
- const p = n(), c = p.in && await p.in(a), S = !(t != null && t.strategy) && p.out ? await p.out(a) : void 0;
723
+ const p = n(), c = p.in && await p.in(a), g = !(t != null && t.strategy) && p.out ? p.out(a) : void 0;
724
724
  if (!c)
725
725
  return;
726
- if (R(c)) {
727
- const y = {
726
+ if (V(c)) {
727
+ const v = {
728
728
  in: Promise.resolve(c),
729
- out: S && Promise.resolve(S)
729
+ out: g && Promise.resolve(g)
730
730
  };
731
- if (!(await m.runIn(y)).config) {
731
+ if (!(await d.runIn(v)).config) {
732
732
  e && (e.direction = "in");
733
733
  return;
734
734
  }
735
- (v = c.prepare) == null || v.call(c, a), c.wait && await c.wait();
735
+ (S = c.prepare) == null || S.call(c, a), c.wait && await c.wait();
736
736
  const E = new j({
737
737
  ...c,
738
738
  onEnd: () => {
739
- var T;
740
- e = null, (T = c.onEnd) == null || T.call(c);
739
+ var A;
740
+ e = null, (A = c.onEnd) == null || A.call(c);
741
741
  }
742
742
  });
743
743
  e = {
@@ -748,49 +748,49 @@ function W(n, t) {
748
748
  }
749
749
  const w = {
750
750
  in: Promise.resolve(c),
751
- out: S && Promise.resolve(S)
752
- }, f = await m.runIn(w);
751
+ out: g && Promise.resolve(g)
752
+ }, f = await d.runIn(w);
753
753
  if (!f.config)
754
754
  return;
755
755
  if ("springs" in f.config) {
756
756
  console.error("Unexpected MultiSpringConfig in single-spring path");
757
757
  return;
758
758
  }
759
- (C = (A = f.config).prepare) == null || C.call(A, a), f.config.wait && await f.config.wait();
760
- const g = O.fromState(f.state, {
759
+ (T = (C = f.config).prepare) == null || T.call(C, a), f.config.wait && await f.config.wait();
760
+ const y = O.fromState(f.state, {
761
761
  from: f.from,
762
762
  to: f.to,
763
763
  spring: f.config.spring,
764
764
  onStart: f.config.onStart,
765
765
  onUpdate: f.config.tick,
766
766
  onComplete: () => {
767
- var y, b;
768
- e = null, (b = (y = f.config) == null ? void 0 : y.onEnd) == null || b.call(y);
767
+ var v, b;
768
+ e = null, (b = (v = f.config) == null ? void 0 : v.onEnd) == null || b.call(v);
769
769
  }
770
770
  });
771
- e = { controller: g, direction: "in" }, f.direction === "forward" ? g.forward() : g.backward();
771
+ e = { controller: y, direction: "in" }, f.direction === "forward" ? y.forward() : y.backward();
772
772
  }, h = async (a) => {
773
- var v, A, C;
773
+ var S, C, T;
774
774
  i = a;
775
775
  const p = n(), c = p.out && await p.out(a);
776
776
  if (!c)
777
777
  return;
778
- if (R(c)) {
779
- const y = {
778
+ if (V(c)) {
779
+ const v = {
780
780
  in: void 0,
781
781
  // Don't fetch IN config for exit transitions
782
782
  out: Promise.resolve(c)
783
783
  };
784
- if (!(await m.runOut(y)).config) {
784
+ if (!(await d.runOut(v)).config) {
785
785
  e && (e.direction = "out"), i && (i.remove(), i = null);
786
786
  return;
787
787
  }
788
- (v = c.prepare) == null || v.call(c, a), g(), c.wait && await c.wait();
788
+ (S = c.prepare) == null || S.call(c, a), y(), c.wait && await c.wait();
789
789
  const E = new j({
790
790
  ...c,
791
791
  onEnd: () => {
792
- var T, x;
793
- (T = c.onEnd) == null || T.call(c), i && (i.remove(), i = null), e = null, (x = t == null ? void 0 : t.onCleanupEnd) == null || x.call(t);
792
+ var A, x;
793
+ (A = c.onEnd) == null || A.call(c), i && (i.remove(), i = null), e = null, (x = t == null ? void 0 : t.onCleanupEnd) == null || x.call(t);
794
794
  }
795
795
  });
796
796
  e = {
@@ -799,18 +799,18 @@ function W(n, t) {
799
799
  }, E.forward();
800
800
  return;
801
801
  }
802
- const S = {
802
+ const g = {
803
803
  in: void 0,
804
804
  // Don't fetch IN config for exit transitions
805
805
  out: Promise.resolve(c)
806
- }, w = await m.runOut(S);
806
+ }, w = await d.runOut(g);
807
807
  if (!w.config)
808
808
  return;
809
809
  if ("springs" in w.config) {
810
810
  console.error("Unexpected MultiSpringConfig in single-spring path");
811
811
  return;
812
812
  }
813
- (C = (A = w.config).prepare) == null || C.call(A, a), g(), w.config.wait && await w.config.wait();
813
+ (T = (C = w.config).prepare) == null || T.call(C, a), y(), w.config.wait && await w.config.wait();
814
814
  const f = O.fromState(w.state, {
815
815
  from: w.from,
816
816
  to: w.to,
@@ -818,99 +818,86 @@ function W(n, t) {
818
818
  onStart: w.config.onStart,
819
819
  onUpdate: w.config.tick,
820
820
  onComplete: () => {
821
- var y, b, E;
822
- (b = (y = w.config) == null ? void 0 : y.onEnd) == null || b.call(y), i && (i.remove(), i = null), e = null, (E = t == null ? void 0 : t.onCleanupEnd) == null || E.call(t);
821
+ var v, b, E;
822
+ (b = (v = w.config) == null ? void 0 : v.onEnd) == null || b.call(v), i && (i.remove(), i = null), e = null, (E = t == null ? void 0 : t.onCleanupEnd) == null || E.call(t);
823
823
  }
824
824
  });
825
825
  e = { controller: f, direction: "out" }, w.direction === "forward" ? f.forward() : f.backward();
826
- function g() {
827
- !r || !i || (o && r.contains(o) ? r.insertBefore(i, o) : r.appendChild(i));
826
+ function y() {
827
+ !o || !i || (r && o.contains(r) ? o.insertBefore(i, r) : o.appendChild(i));
828
828
  }
829
829
  };
830
830
  return (a) => {
831
831
  if (a)
832
- return r = a.parentElement, o = a.nextElementSibling, l(a), () => {
833
- const p = a.cloneNode(!0);
834
- h(p);
832
+ return o = a.parentElement, r = a.nextElementSibling, l(a), () => {
833
+ if (a.isConnected) {
834
+ const p = a.cloneNode(!0);
835
+ h(p);
836
+ } else
837
+ h(a);
835
838
  };
836
839
  };
837
840
  }
838
- const B = 3, K = (n) => {
841
+ const Y = 3, X = (n) => {
839
842
  if (!n) return null;
840
843
  const t = n.split(`
841
844
  `).map((e) => e.trim());
842
- for (let e = B; e < Math.min(t.length, 6); e++) {
843
- const i = t[e], r = i == null ? void 0 : i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
844
- if (!r)
845
+ for (let e = Y; e < Math.min(t.length, 6); e++) {
846
+ const i = t[e], o = i == null ? void 0 : i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
847
+ if (!o)
845
848
  continue;
846
- const o = r[1] ?? "", s = r[2] ?? "0", m = r[3] ?? "0";
847
- return { file: o.split(/[\\/]/).pop() || o, line: s, column: m };
849
+ const r = o[1] ?? "", s = o[2] ?? "0", d = o[3] ?? "0";
850
+ return { file: r.split(/[\\/]/).pop() || r, line: s, column: d };
848
851
  }
849
852
  return null;
850
- }, V = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
851
- function q(n, t, e) {
852
- V.set(n, t);
853
- let i = M.get(n);
853
+ }, M = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
854
+ function B(n, t, e) {
855
+ M.set(n, t);
856
+ let i = R.get(n);
854
857
  return i || (i = W(
855
858
  () => {
856
- const r = V.get(n);
857
- return r || (console.warn(`Transition "${String(n)}" not found`), {});
859
+ const o = M.get(n);
860
+ return o || (console.warn(`Transition "${String(n)}" not found`), {});
858
861
  },
859
862
  {
860
863
  strategy: e,
861
864
  onCleanupEnd: () => D(n)
862
865
  }
863
- ), M.set(n, i), i);
866
+ ), R.set(n, i), i);
864
867
  }
865
868
  function D(n) {
866
- V.delete(n), M.delete(n);
869
+ M.delete(n), R.delete(n);
867
870
  }
868
- function Y() {
869
- const n = K(new Error().stack);
871
+ function K() {
872
+ const n = X(new Error().stack);
870
873
  return n ? `auto_${n.file}_${n.line}_${n.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
871
874
  }
872
- const U = globalThis.FinalizationRegistry, z = U ? new U((n) => {
873
- try {
874
- D(n);
875
- } catch {
876
- }
877
- }) : void 0;
875
+ const L = globalThis.FinalizationRegistry, U = L ? (
876
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
877
+ new L((n) => {
878
+ try {
879
+ D(n);
880
+ } catch {
881
+ }
882
+ })
883
+ ) : void 0;
878
884
  function nt(n) {
879
- const t = n.key ?? Y();
880
- if (n.ref && z)
885
+ const t = n.key ?? K();
886
+ if (n.ref && U)
881
887
  try {
882
- z.register(n.ref, t);
888
+ U.register(n.ref, t);
883
889
  } catch {
884
890
  }
885
- return q(
891
+ return B(
886
892
  t,
887
893
  {
888
894
  in: n.in,
889
895
  out: n.out
890
896
  },
891
- n[L]
897
+ n[z]
892
898
  );
893
899
  }
894
- const X = (n) => {
895
- let t = n.parentElement;
896
- for (; t && t !== document.body; ) {
897
- const e = window.getComputedStyle(t), i = e.overflow + e.overflowY + e.overflowX;
898
- if (i.includes("auto") || i.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
899
- return t;
900
- t = t.parentElement;
901
- }
902
- return document.documentElement;
903
- }, G = (n) => {
904
- let t = n.parentElement;
905
- for (; t && t !== document.body; ) {
906
- const e = window.getComputedStyle(t).position;
907
- if (e === "relative" || e === "absolute" || e === "fixed" || e === "sticky")
908
- return t;
909
- t = t.parentElement;
910
- }
911
- return document.body;
912
- };
913
- function J(n) {
900
+ function q(n) {
914
901
  const t = n.filter((e) => e.symmetric).map((e) => ({
915
902
  from: e.to,
916
903
  to: e.from,
@@ -918,32 +905,57 @@ function J(n) {
918
905
  }));
919
906
  return [...n, ...t];
920
907
  }
921
- function Q(n) {
922
- let t = !1, e = !1;
923
- const i = (l) => {
908
+ function G(n) {
909
+ let t = !1, e = 0, i = 0, o = !1;
910
+ const r = 50, s = 50, d = (c) => {
924
911
  if (!n) return;
925
- const h = l.touches[0];
926
- h && (e = h.clientX < 50);
927
- }, r = () => {
928
- n && (e && (t = !0, setTimeout(() => {
912
+ const g = c.touches[0];
913
+ g && (o = g.clientX < s, o && (e = g.clientX, i = g.clientY));
914
+ }, l = (c) => {
915
+ if (!n || !o || t) return;
916
+ const g = c.touches[0];
917
+ if (!g) return;
918
+ const w = g.clientX - e, f = g.clientY - i;
919
+ w > r && Math.abs(w) > Math.abs(f) && (t = !0, setTimeout(() => {
929
920
  t = !1;
930
- }, 500)), e = !1);
921
+ }, 500));
922
+ }, h = () => {
923
+ n && (o = !1, e = 0, i = 0);
931
924
  };
932
925
  return {
933
926
  initialize: () => {
934
- typeof window > "u" || n && (window.addEventListener("touchstart", i, { passive: !0 }), window.addEventListener("touchend", r, { passive: !0 }));
927
+ typeof window > "u" || n && (window.addEventListener("touchstart", d, { passive: !0 }), window.addEventListener("touchmove", l, { passive: !0 }), window.addEventListener("touchend", h, { passive: !0 }));
935
928
  },
936
929
  cleanup: () => {
937
- typeof window > "u" || (window.removeEventListener("touchstart", i), window.removeEventListener("touchend", r));
930
+ typeof window > "u" || (window.removeEventListener("touchstart", d), window.removeEventListener("touchmove", l), window.removeEventListener("touchend", h));
938
931
  },
939
932
  isSwipePending: () => t
940
933
  };
941
934
  }
935
+ const J = (n) => {
936
+ let t = n.parentElement;
937
+ for (; t && t !== document.body; ) {
938
+ const e = window.getComputedStyle(t), i = e.overflow + e.overflowY + e.overflowX;
939
+ if (i.includes("auto") || i.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
940
+ return t;
941
+ t = t.parentElement;
942
+ }
943
+ return document.documentElement;
944
+ }, Q = (n) => {
945
+ let t = n.parentElement;
946
+ for (; t && t !== document.body; ) {
947
+ const e = window.getComputedStyle(t).position;
948
+ if (e === "relative" || e === "absolute" || e === "fixed" || e === "sticky")
949
+ return t;
950
+ t = t.parentElement;
951
+ }
952
+ return document.body;
953
+ };
942
954
  function Z() {
943
955
  let n = null, t = null;
944
956
  const e = /* @__PURE__ */ new Map();
945
957
  let i = null;
946
- const r = () => {
958
+ const o = () => {
947
959
  n && i && e.set(i, {
948
960
  x: n.scrollLeft,
949
961
  y: n.scrollTop
@@ -951,7 +963,7 @@ function Z() {
951
963
  };
952
964
  return {
953
965
  initializeContext: (u, a) => {
954
- t = u, n || (n = X(u), (n === document.documentElement ? window : n).addEventListener("scroll", r, {
966
+ t = u, n || (n = J(u), (n === document.documentElement ? window : n).addEventListener("scroll", o, {
955
967
  passive: !0
956
968
  })), i = a;
957
969
  },
@@ -963,43 +975,61 @@ function Z() {
963
975
  };
964
976
  },
965
977
  getScrollContainer: () => n,
966
- getPositionedParentElement: () => t ? G(t) : document.body,
978
+ getPositionedParentElement: () => t ? Q(t) : document.body,
967
979
  getScrollPosition: (u) => u && e.has(u) ? e.get(u) : { x: 0, y: 0 }
968
980
  };
969
981
  }
982
+ function P(n, t) {
983
+ if (t === "*")
984
+ return !0;
985
+ if (t.endsWith("/*")) {
986
+ const e = t.slice(0, -2);
987
+ return n === e || n.startsWith(e + "/");
988
+ }
989
+ return n === t;
990
+ }
991
+ function tt(n, t, e) {
992
+ for (const i of e)
993
+ if (P(n, i.from) && P(t, i.to))
994
+ return i.transition;
995
+ for (const i of e)
996
+ if ((i.from === "*" || P(n, i.from)) && (i.to === "*" || P(t, i.to)))
997
+ return i.transition;
998
+ return null;
999
+ }
970
1000
  function ot(n) {
971
1001
  const {
972
1002
  transitions: t = [],
973
1003
  defaultTransition: e,
974
- middleware: i = (f, g) => ({ from: f, to: g }),
1004
+ middleware: i = (f, y) => ({ from: f, to: y }),
975
1005
  // Identity function as default
976
- skipOnIosSwipe: r = !1
1006
+ skipOnIosSwipe: o = !0
977
1007
  // Default to true - skip animations on iOS swipe
978
1008
  } = n;
979
- let o = null;
980
- const s = J(t), {
981
- initializeContext: m,
1009
+ let r = null;
1010
+ const s = q(t), {
1011
+ initializeContext: d,
982
1012
  calculateScrollOffset: l,
983
1013
  getScrollContainer: h,
984
1014
  getPositionedParentElement: u,
985
1015
  getScrollPosition: a
986
- } = Z(), p = Q(r);
1016
+ } = Z(), p = G(o);
987
1017
  p.initialize();
988
1018
  function c() {
989
- if (o != null && o.from && (o != null && o.to)) {
990
- const { from: f, to: g } = i(
991
- o.from,
992
- o.to
993
- ), A = tt(
1019
+ if (r != null && r.from && (r != null && r.to)) {
1020
+ const { from: f, to: y } = i(
1021
+ r.from,
1022
+ r.to
1023
+ ), C = tt(
994
1024
  f,
995
- g,
1025
+ y,
996
1026
  s
997
- ) || e, C = l(
998
- o.from,
999
- o.to
1000
- ), y = {
1001
- scrollOffset: C,
1002
- scroll: a(o.from),
1027
+ ) || e, T = l(
1028
+ r.from,
1029
+ r.to
1030
+ ), v = {
1031
+ scrollOffset: T,
1032
+ scroll: a(r.from),
1003
1033
  get scrollingElement() {
1004
1034
  return h() || document.documentElement;
1005
1035
  },
@@ -1007,9 +1037,9 @@ function ot(n) {
1007
1037
  return u();
1008
1038
  }
1009
1039
  }, b = {
1010
- scrollOffset: C,
1040
+ scrollOffset: T,
1011
1041
  get scroll() {
1012
- return o ? a(o.to) : { x: 0, y: 0 };
1042
+ return r ? a(r.to) : { x: 0, y: 0 };
1013
1043
  },
1014
1044
  get scrollingElement() {
1015
1045
  return h() || document.documentElement;
@@ -1018,51 +1048,33 @@ function ot(n) {
1018
1048
  return u();
1019
1049
  }
1020
1050
  };
1021
- A && (A.out && o.outResolve && o.outResolve(
1022
- (E) => A.out(E, y)
1023
- ), A.in && o.inResolve && o.inResolve(
1024
- (E) => A.in(E, b)
1025
- )), o = null;
1051
+ C && (C.out && r.outResolve && r.outResolve(
1052
+ (E) => C.out(E, v)
1053
+ ), C.in && r.inResolve && r.inResolve(
1054
+ (E) => C.in(E, b)
1055
+ )), r = null;
1026
1056
  }
1027
1057
  }
1028
- const S = async (f, g) => p.isSwipePending() ? () => ({}) : g === "in" && (!o || !o.from) ? () => ({}) : (o || (o = {}), g === "out" ? (o.from = f, new Promise((v) => {
1029
- o.outResolve = v, c();
1030
- })) : (o.to = f, new Promise((v) => {
1031
- o.inResolve = v, c();
1058
+ const g = async (f, y) => p.isSwipePending() ? () => ({}) : y === "in" && (!r || !r.from) ? () => ({}) : (r || (r = {}), y === "out" ? (r.from = f, new Promise((S) => {
1059
+ r.outResolve = S, c();
1060
+ })) : (r.to = f, new Promise((S) => {
1061
+ r.inResolve = S, c();
1032
1062
  })));
1033
1063
  return (f) => ({
1034
1064
  key: f,
1035
- in: async (g) => (m(g, f), (await S(f, "in"))(g)),
1036
- out: async (g) => (await S(f, "out"))(g),
1065
+ in: async (y) => (d(y, f), (await g(f, "in"))(y)),
1066
+ out: async (y) => (await g(f, "out"))(y),
1037
1067
  // Add page transition strategy for page-level transitions
1038
- [L]: H
1068
+ [z]: N
1039
1069
  });
1040
1070
  }
1041
- function tt(n, t, e) {
1042
- for (const i of e)
1043
- if (P(n, i.from) && P(t, i.to))
1044
- return i.transition;
1045
- for (const i of e)
1046
- if ((i.from === "*" || P(n, i.from)) && (i.to === "*" || P(t, i.to)))
1047
- return i.transition;
1048
- return null;
1049
- }
1050
- function P(n, t) {
1051
- if (t === "*")
1052
- return !0;
1053
- if (t.endsWith("/*")) {
1054
- const e = t.slice(0, -2);
1055
- return n === e || n.startsWith(e + "/");
1056
- }
1057
- return n === t;
1058
- }
1059
1071
  export {
1060
- L as TRANSITION_STRATEGY,
1061
- N as createDefaultStrategy,
1062
- H as createPageTransitionStrategy,
1072
+ z as TRANSITION_STRATEGY,
1073
+ F as createDefaultStrategy,
1074
+ N as createPageTransitionStrategy,
1063
1075
  ot as createSggoiTransitionContext,
1064
- Y as generateAutoKey,
1065
- R as isMultiSpring,
1076
+ K as generateAutoKey,
1077
+ V as isMultiSpring,
1066
1078
  at as isSingleSpring,
1067
1079
  lt as jaeminInternal,
1068
1080
  nt as transition