@ssgoi/core 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/animator/integrator/double-spring-integrator.d.ts +25 -0
  2. package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -0
  3. package/dist/animator/integrator/index.d.ts +13 -0
  4. package/dist/animator/integrator/index.d.ts.map +1 -0
  5. package/dist/animator/integrator/inertia-integrator.d.ts +19 -0
  6. package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -0
  7. package/dist/animator/integrator/provider.d.ts +22 -0
  8. package/dist/animator/integrator/provider.d.ts.map +1 -0
  9. package/dist/animator/integrator/spring-integrator.d.ts +13 -0
  10. package/dist/animator/integrator/spring-integrator.d.ts.map +1 -0
  11. package/dist/animator/integrator/types.d.ts +34 -0
  12. package/dist/animator/integrator/types.d.ts.map +1 -0
  13. package/dist/animator/multi-animator.d.ts +2 -2
  14. package/dist/animator/multi-animator.d.ts.map +1 -1
  15. package/dist/animator/{animate → runner}/css-runner.d.ts +2 -2
  16. package/dist/animator/runner/css-runner.d.ts.map +1 -0
  17. package/dist/animator/runner/provider.d.ts +35 -0
  18. package/dist/animator/runner/provider.d.ts.map +1 -0
  19. package/dist/animator/{animate → runner}/tick-runner.d.ts +2 -2
  20. package/dist/animator/runner/tick-runner.d.ts.map +1 -0
  21. package/dist/animator/runner/ticker.d.ts.map +1 -0
  22. package/dist/animator/{animate → runner}/types.d.ts +6 -3
  23. package/dist/animator/runner/types.d.ts.map +1 -0
  24. package/dist/animator/{index.d.ts → single-animator.d.ts} +17 -9
  25. package/dist/animator/single-animator.d.ts.map +1 -0
  26. package/dist/animator/{animation.d.ts → types.d.ts} +2 -2
  27. package/dist/animator/types.d.ts.map +1 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.js +479 -532
  30. package/dist/provider-B6Xnh0BA.cjs +1 -0
  31. package/dist/provider-CMBovM_W.js +134 -0
  32. package/dist/transition/transition-strategy.d.ts +2 -2
  33. package/dist/transition/transition-strategy.d.ts.map +1 -1
  34. package/dist/transitions/blur.d.ts +4 -4
  35. package/dist/transitions/blur.d.ts.map +1 -1
  36. package/dist/transitions/bounce.d.ts +4 -4
  37. package/dist/transitions/bounce.d.ts.map +1 -1
  38. package/dist/transitions/fade.d.ts +4 -4
  39. package/dist/transitions/fade.d.ts.map +1 -1
  40. package/dist/transitions/index.cjs +1 -1
  41. package/dist/transitions/index.d.ts +5 -0
  42. package/dist/transitions/index.d.ts.map +1 -1
  43. package/dist/transitions/index.js +141 -191
  44. package/dist/transitions/rotate.d.ts +4 -4
  45. package/dist/transitions/rotate.d.ts.map +1 -1
  46. package/dist/transitions/scale.d.ts +4 -4
  47. package/dist/transitions/scale.d.ts.map +1 -1
  48. package/dist/transitions/slide.d.ts +4 -4
  49. package/dist/transitions/slide.d.ts.map +1 -1
  50. package/dist/transitions/utils.d.ts +8 -0
  51. package/dist/transitions/utils.d.ts.map +1 -0
  52. package/dist/types.cjs +1 -1
  53. package/dist/types.d.ts +59 -3
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/types.js +6 -6
  56. package/dist/view-transitions/blind.d.ts +2 -3
  57. package/dist/view-transitions/blind.d.ts.map +1 -1
  58. package/dist/view-transitions/curtain-reveal.d.ts +2 -3
  59. package/dist/view-transitions/curtain-reveal.d.ts.map +1 -1
  60. package/dist/view-transitions/depth.d.ts +2 -2
  61. package/dist/view-transitions/depth.d.ts.map +1 -1
  62. package/dist/view-transitions/drill.d.ts +2 -2
  63. package/dist/view-transitions/drill.d.ts.map +1 -1
  64. package/dist/view-transitions/fade.d.ts +2 -3
  65. package/dist/view-transitions/fade.d.ts.map +1 -1
  66. package/dist/view-transitions/film.d.ts +2 -1
  67. package/dist/view-transitions/film.d.ts.map +1 -1
  68. package/dist/view-transitions/hero.d.ts +2 -2
  69. package/dist/view-transitions/hero.d.ts.map +1 -1
  70. package/dist/view-transitions/index.cjs +13 -13
  71. package/dist/view-transitions/index.d.ts +1 -0
  72. package/dist/view-transitions/index.d.ts.map +1 -1
  73. package/dist/view-transitions/index.js +867 -847
  74. package/dist/view-transitions/instagram.d.ts +2 -2
  75. package/dist/view-transitions/instagram.d.ts.map +1 -1
  76. package/dist/view-transitions/jaemin.d.ts +2 -2
  77. package/dist/view-transitions/jaemin.d.ts.map +1 -1
  78. package/dist/view-transitions/pinterest.d.ts +2 -2
  79. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  80. package/dist/view-transitions/rotate.d.ts +5 -2
  81. package/dist/view-transitions/rotate.d.ts.map +1 -1
  82. package/dist/view-transitions/scroll.d.ts +2 -2
  83. package/dist/view-transitions/scroll.d.ts.map +1 -1
  84. package/dist/view-transitions/sheet.d.ts +2 -2
  85. package/dist/view-transitions/sheet.d.ts.map +1 -1
  86. package/dist/view-transitions/slide.d.ts +2 -2
  87. package/dist/view-transitions/slide.d.ts.map +1 -1
  88. package/dist/view-transitions/snap.d.ts +14 -0
  89. package/dist/view-transitions/snap.d.ts.map +1 -0
  90. package/dist/view-transitions/strip.d.ts +6 -2
  91. package/dist/view-transitions/strip.d.ts.map +1 -1
  92. package/dist/view-transitions/swap.d.ts +2 -2
  93. package/dist/view-transitions/swap.d.ts.map +1 -1
  94. package/package.json +1 -1
  95. package/dist/animator/animate/css-runner.d.ts.map +0 -1
  96. package/dist/animator/animate/index.d.ts +0 -42
  97. package/dist/animator/animate/index.d.ts.map +0 -1
  98. package/dist/animator/animate/tick-runner.d.ts.map +0 -1
  99. package/dist/animator/animate/types.d.ts.map +0 -1
  100. package/dist/animator/animation.d.ts.map +0 -1
  101. package/dist/animator/index.d.ts.map +0 -1
  102. package/dist/animator/spring-core.d.ts +0 -82
  103. package/dist/animator/spring-core.d.ts.map +0 -1
  104. package/dist/animator/ticker.d.ts.map +0 -1
  105. /package/dist/animator/{ticker.d.ts → runner/ticker.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,64 +1,65 @@
1
- var nt = Object.defineProperty;
2
- var it = (i, e, t) => e in i ? nt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var m = (i, e, t) => it(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { normalizeToMultiSpring as P, normalizeMultiSpringSchedule as Y } from "./types.js";
5
- import { isCssAnimation as zt, isMultiSpring as Dt, isSingleSpring as _t, isTickAnimation as qt, validateAnimationMode as Ht, validateSpringItem as Nt } from "./types.js";
6
- class ot {
1
+ var K = Object.defineProperty;
2
+ var J = (n, i, t) => i in n ? K(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
3
+ var d = (n, i, t) => J(n, typeof i != "symbol" ? i + "" : i, t);
4
+ import { normalizeToMultiSpring as P, normalizeMultiSpringSchedule as U } from "./types.js";
5
+ import { isCssAnimation as Ot, isMultiSpring as Lt, isSingleSpring as Dt, isTickAnimation as zt, validateAnimationMode as Nt, validateSpringItem as qt } from "./types.js";
6
+ import { S as X, I as Q, a as Z } from "./provider-CMBovM_W.js";
7
+ class tt {
7
8
  constructor() {
8
- m(this, "listeners", /* @__PURE__ */ new Set());
9
- m(this, "rafId", null);
10
- m(this, "isRunning", !1);
9
+ d(this, "listeners", /* @__PURE__ */ new Set());
10
+ d(this, "rafId", null);
11
+ d(this, "isRunning", !1);
11
12
  // Timing
12
- m(this, "startTime", Date.now());
13
- m(this, "lastUpdate", this.startTime);
14
- m(this, "elapsed", 0);
13
+ d(this, "startTime", Date.now());
14
+ d(this, "lastUpdate", this.startTime);
15
+ d(this, "elapsed", 0);
15
16
  // Lag smoothing (mobile optimization)
16
- m(this, "lagThreshold", 500);
17
+ d(this, "lagThreshold", 500);
17
18
  // ms - detect tab switches, backgrounding
18
- m(this, "adjustedLag", 33);
19
+ d(this, "adjustedLag", 33);
19
20
  // ms - max time jump to prevent animation skip
20
- m(this, "maxDeltaTime", 33);
21
+ d(this, "maxDeltaTime", 33);
21
22
  // ms - clamp for physics stability (30fps minimum)
22
23
  // FPS throttling
23
- m(this, "gap", 1e3 / 240);
24
+ d(this, "gap", 1e3 / 240);
24
25
  // max 240fps
25
- m(this, "nextTime", this.gap);
26
- m(this, "tick", () => {
27
- const e = Date.now();
28
- let n = e - this.lastUpdate;
29
- n > this.lagThreshold || n < 0 ? (this.startTime += n - this.adjustedLag, n = this.adjustedLag) : n > this.maxDeltaTime && (n = this.maxDeltaTime), this.lastUpdate = e;
30
- const r = e - this.startTime, s = r - this.nextTime;
26
+ d(this, "nextTime", this.gap);
27
+ d(this, "tick", () => {
28
+ const i = Date.now();
29
+ let e = i - this.lastUpdate;
30
+ e > this.lagThreshold || e < 0 ? (this.startTime += e - this.adjustedLag, e = this.adjustedLag) : e > this.maxDeltaTime && (e = this.maxDeltaTime), this.lastUpdate = i;
31
+ const o = i - this.startTime, s = o - this.nextTime;
31
32
  if (s > 0) {
32
- const a = n / 1e3;
33
- this.elapsed = r / 1e3, this.nextTime += s + (s >= this.gap ? 4 : this.gap - s), this.listeners.forEach((o) => {
34
- o(a, this.elapsed);
33
+ const l = e / 1e3;
34
+ this.elapsed = o / 1e3, this.nextTime += s + (s >= this.gap ? 4 : this.gap - s), this.listeners.forEach((r) => {
35
+ r(l, this.elapsed);
35
36
  });
36
37
  }
37
38
  this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
38
39
  });
39
40
  }
40
- subscribe(e) {
41
- return this.listeners.add(e), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
42
- this.unsubscribe(e);
41
+ subscribe(i) {
42
+ return this.listeners.add(i), this.isRunning || (this.isRunning = !0, this.rafId = requestAnimationFrame(this.tick)), () => {
43
+ this.unsubscribe(i);
43
44
  };
44
45
  }
45
- unsubscribe(e) {
46
- this.listeners.delete(e), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
46
+ unsubscribe(i) {
47
+ this.listeners.delete(i), this.listeners.size === 0 && this.rafId !== null && (cancelAnimationFrame(this.rafId), this.isRunning = !1, this.rafId = null);
47
48
  }
48
49
  /**
49
50
  * Configure lag smoothing behavior
50
51
  * @param threshold - Time threshold to detect lag (default: 500ms)
51
52
  * @param adjustedLag - Max time jump when lag detected (default: 33ms)
52
53
  */
53
- lagSmoothing(e, t) {
54
- this.lagThreshold = e, this.adjustedLag = Math.min(t, e);
54
+ lagSmoothing(i, t) {
55
+ this.lagThreshold = i, this.adjustedLag = Math.min(t, i);
55
56
  }
56
57
  /**
57
58
  * Set maximum FPS
58
59
  * @param fps - Target FPS (default: 240)
59
60
  */
60
- fps(e) {
61
- this.gap = 1e3 / e, this.nextTime = this.elapsed * 1e3 + this.gap;
61
+ fps(i) {
62
+ this.gap = 1e3 / i, this.nextTime = this.elapsed * 1e3 + this.gap;
62
63
  }
63
64
  getListenerCount() {
64
65
  return this.listeners.size;
@@ -67,254 +68,200 @@ class ot {
67
68
  return this.elapsed;
68
69
  }
69
70
  }
70
- const D = new ot();
71
- function j(i) {
72
- const e = i.stiffness, t = i.damping, n = 1, r = Math.sqrt(e / n), s = t / (2 * Math.sqrt(e * n)), a = { omega: r, zeta: s };
73
- if (i.doubleSpring) {
74
- const o = typeof i.doubleSpring == "number" ? i.doubleSpring : 1, c = e * o, u = Math.sqrt(c / n), f = t / (2 * Math.sqrt(c * n));
75
- a.follower = { omega: u, zeta: f };
76
- }
77
- return a;
78
- }
79
- function _(i, e, t, n, r, s) {
80
- const a = -2 * s * r * n * e, o = s * n * n * (t - i), c = e + a + o;
81
- return { position: i + s * c, velocity: c };
82
- }
83
- function G(i, e, t, n) {
84
- const r = Math.min(n, 0.033);
85
- if (t.follower) {
86
- const u = i._leader ?? {
87
- position: i.position,
88
- velocity: i.velocity
89
- }, f = _(
90
- u.position,
91
- u.velocity,
92
- e,
93
- t.omega,
94
- t.zeta,
95
- r
96
- ), h = _(
97
- i.position,
98
- i.velocity,
99
- f.position,
100
- t.follower.omega,
101
- t.follower.zeta,
102
- r
103
- );
104
- return {
105
- position: h.position,
106
- velocity: h.velocity,
107
- _leader: f
108
- };
109
- }
110
- const { omega: s, zeta: a } = t, o = _(
111
- i.position,
112
- i.velocity,
113
- e,
114
- s,
115
- a,
116
- r
117
- );
118
- return {
119
- position: o.position,
120
- velocity: o.velocity
121
- };
122
- }
123
- const U = 0.01, W = 0.01, $ = 0.05;
124
- function B(i, e) {
125
- const t = Math.abs(e - i.position), n = Math.abs(i.velocity), r = t < U && n < W, s = i;
126
- if (s._leader) {
127
- const a = Math.abs(e - s._leader.position), o = Math.abs(s._leader.velocity);
128
- return a < U && o < W && r;
129
- }
130
- return r;
131
- }
132
- function rt(i) {
71
+ const z = new tt();
72
+ function et(n) {
133
73
  const {
134
- from: e,
135
- to: t,
136
- spring: n,
137
- velocity: r = 0,
74
+ integrator: i,
75
+ from: t,
76
+ to: e,
77
+ velocity: o = 0,
138
78
  onUpdate: s,
139
- onComplete: a,
140
- onStart: o
141
- } = i;
142
- let c = { position: e, velocity: r }, u = !0, f = 0, h = !1;
143
- const y = j(n), v = (l) => {
79
+ onComplete: l,
80
+ onStart: r
81
+ } = n;
82
+ let c = { position: t, velocity: o }, u = !0, m = 0, g = !1;
83
+ const y = (S) => {
144
84
  if (u) {
145
- if (h || (h = !0, o == null || o()), c = G(c, t, y, l), B(c, t)) {
146
- if (f += Math.min(l, 0.033), f >= $) {
147
- c = { position: t, velocity: 0 }, u = !1, s(c.position), D.unsubscribe(v), a();
85
+ if (g || (g = !0, r == null || r()), c = i.step(c, e, S), i.isSettled(c, e)) {
86
+ if (m += Math.min(S, 0.033), m >= X) {
87
+ c = { position: e, velocity: 0 }, u = !1, s(c.position), z.unsubscribe(y), l();
148
88
  return;
149
89
  }
150
90
  } else
151
- f = 0;
91
+ m = 0;
152
92
  s(c.position);
153
93
  }
154
94
  };
155
- return D.subscribe(v), {
95
+ return z.subscribe(y), {
156
96
  stop: () => {
157
- u && (u = !1, D.unsubscribe(v));
97
+ u && (u = !1, z.unsubscribe(y));
158
98
  },
159
99
  getPosition: () => c.position,
160
100
  getVelocity: () => c.velocity,
161
101
  isRunning: () => u
162
102
  };
163
103
  }
164
- const I = 1e3 / 60;
165
- function st(i, e, t, n = 0) {
166
- const r = j(t), s = 600;
167
- let a = { position: i, velocity: n }, o = 0;
168
- const c = [];
169
- for (let u = 0; u < s; u++) {
170
- const f = u * I;
171
- if (c.push({
172
- time: f,
173
- position: a.position,
174
- velocity: a.velocity
175
- }), a = G(a, e, r, I / 1e3), B(a, e)) {
176
- if (o += I / 1e3, o >= $) {
177
- c.push({
178
- time: (u + 1) * I,
179
- position: e,
104
+ const x = 1e3 / 60;
105
+ function it(n, i, t, e = 0) {
106
+ let s = { position: i, velocity: e }, l = 0;
107
+ const r = [];
108
+ for (let c = 0; c < 600; c++) {
109
+ const u = c * x;
110
+ if (r.push({
111
+ time: u,
112
+ position: s.position,
113
+ velocity: s.velocity
114
+ }), s = n.step(s, t, x / 1e3), n.isSettled(s, t)) {
115
+ if (l += x / 1e3, l >= X) {
116
+ r.push({
117
+ time: (c + 1) * x,
118
+ position: t,
180
119
  velocity: 0
181
120
  });
182
121
  break;
183
122
  }
184
123
  } else
185
- o = 0;
124
+ l = 0;
186
125
  }
187
- return c;
126
+ return r;
188
127
  }
189
- function X(i, e) {
190
- if (i.length === 0)
128
+ function H(n, i) {
129
+ if (n.length === 0)
191
130
  return { position: 0, velocity: 0 };
192
- const t = i[0], n = i[i.length - 1];
193
- if (e <= 0)
131
+ const t = n[0], e = n[n.length - 1];
132
+ if (i <= 0)
194
133
  return { position: t.position, velocity: t.velocity };
195
- if (e >= n.time)
196
- return { position: n.position, velocity: n.velocity };
197
- let r = 0, s = i.length - 1;
198
- for (; r < s - 1; ) {
199
- const u = Math.floor((r + s) / 2);
200
- i[u].time <= e ? r = u : s = u;
134
+ if (i >= e.time)
135
+ return { position: e.position, velocity: e.velocity };
136
+ let o = 0, s = n.length - 1;
137
+ for (; o < s - 1; ) {
138
+ const u = Math.floor((o + s) / 2);
139
+ n[u].time <= i ? o = u : s = u;
201
140
  }
202
- const a = i[r], o = i[s], c = (e - a.time) / (o.time - a.time);
141
+ const l = n[o], r = n[s], c = (i - l.time) / (r.time - l.time);
203
142
  return {
204
- position: a.position + (o.position - a.position) * c,
205
- velocity: a.velocity + (o.velocity - a.velocity) * c
143
+ position: l.position + (r.position - l.position) * c,
144
+ velocity: l.velocity + (r.velocity - l.velocity) * c
206
145
  };
207
146
  }
208
- function ct(i, e) {
209
- return i.map((t) => e(t.position));
147
+ function nt(n, i) {
148
+ return n.map((t) => i(t.position));
210
149
  }
211
- function at(i) {
150
+ function rt(n) {
212
151
  const {
213
- element: e,
214
- from: t,
215
- to: n,
216
- spring: r,
152
+ integrator: i,
153
+ element: t,
154
+ from: e,
155
+ to: o,
217
156
  velocity: s = 0,
218
- style: a,
219
- onComplete: o,
157
+ style: l,
158
+ onComplete: r,
220
159
  onStart: c
221
- } = i, u = st(t, n, r, s);
160
+ } = n, u = it(i, e, o, s);
222
161
  if (u.length === 0)
223
- return c == null || c(), o(), {
162
+ return c == null || c(), r(), {
224
163
  stop: () => {
225
164
  },
226
- getPosition: () => n,
165
+ getPosition: () => o,
227
166
  getVelocity: () => 0,
228
167
  isRunning: () => !1
229
168
  };
230
- const f = ct(u, a), h = u[u.length - 1], y = h.time, v = e.animate(f, {
169
+ const m = nt(u, l), g = u[u.length - 1], y = g.time, S = t.animate(m, {
231
170
  duration: y,
232
171
  fill: "forwards",
233
172
  easing: "linear"
234
173
  });
235
- let l = !0;
236
- const d = performance.now();
237
- return c == null || c(), v.onfinish = () => {
238
- l && (l = !1, o());
174
+ let a = !0;
175
+ const f = performance.now();
176
+ return c == null || c(), S.onfinish = () => {
177
+ a && (a = !1, r());
239
178
  }, {
240
179
  stop: () => {
241
- l && (l = !1, v.cancel());
180
+ a && (a = !1, S.cancel());
242
181
  },
243
182
  getPosition: () => {
244
- if (!l)
245
- return h.position;
246
- const A = performance.now() - d;
247
- return X(u, A).position;
183
+ if (!a)
184
+ return g.position;
185
+ const A = performance.now() - f;
186
+ return H(u, A).position;
248
187
  },
249
188
  getVelocity: () => {
250
- if (!l)
189
+ if (!a)
251
190
  return 0;
252
- const A = performance.now() - d;
253
- return X(u, A).velocity;
191
+ const A = performance.now() - f;
192
+ return H(u, A).velocity;
254
193
  },
255
- isRunning: () => l
194
+ isRunning: () => a
256
195
  };
257
196
  }
258
- function lt(i) {
259
- const { from: e, to: t, spring: n, velocity: r, onComplete: s, onStart: a, tick: o, css: c } = i;
260
- if (o && c)
261
- throw new Error("Cannot use both 'tick' and 'css' options together");
262
- return !o && !c ? (a == null || a(), s(), {
263
- stop: () => {
264
- },
265
- getPosition: () => t,
266
- getVelocity: () => 0,
267
- isRunning: () => !1
268
- }) : c ? at({
269
- element: c.element,
270
- from: e,
271
- to: t,
272
- spring: n,
273
- velocity: r,
274
- style: c.style,
275
- onComplete: s,
276
- onStart: a
277
- }) : rt({
278
- from: e,
279
- to: t,
280
- spring: n,
281
- velocity: r,
282
- onUpdate: o,
283
- onComplete: s,
284
- onStart: a
285
- });
197
+ class ot {
198
+ /**
199
+ * Get bound runner based on animation mode
200
+ *
201
+ * @param options Animation mode options (tick or css)
202
+ * @returns Bound runner function or null if no animation mode specified
203
+ * @throws Error if both tick and css are provided
204
+ */
205
+ static from(i) {
206
+ const { tick: t, css: e } = i;
207
+ if (t && e)
208
+ throw new Error("Cannot use both 'tick' and 'css' options together");
209
+ return e ? (o) => rt({
210
+ ...o,
211
+ element: e.element,
212
+ style: e.style
213
+ }) : t ? (o) => et({
214
+ ...o,
215
+ onUpdate: t
216
+ }) : null;
217
+ }
286
218
  }
287
- class K {
219
+ class Y {
288
220
  }
289
- class F extends K {
221
+ const st = { stiffness: 300, damping: 30 };
222
+ class O extends Y {
290
223
  constructor(t) {
291
224
  super();
292
- m(this, "options");
293
- m(this, "controls", null);
294
- m(this, "isAnimating", !1);
295
- m(this, "currentValue");
296
- m(this, "currentVelocity", 0);
297
- if (t.tick && t.css)
298
- throw new Error("Cannot use both 'tick' and 'css' options together");
225
+ d(this, "options");
226
+ d(this, "runner");
227
+ d(this, "controls", null);
228
+ d(this, "isAnimating", !1);
229
+ d(this, "currentValue");
230
+ d(this, "currentVelocity", 0);
299
231
  this.options = {
300
232
  from: t.from ?? 0,
301
233
  to: t.to ?? 1,
302
- spring: t.spring ?? { stiffness: 300, damping: 30 },
303
- tick: t.tick,
304
- css: t.css,
234
+ physics: t.physics,
305
235
  onComplete: t.onComplete ?? (() => {
306
236
  }),
307
237
  onStart: t.onStart
308
- }, this.currentValue = this.options.from;
238
+ }, this.currentValue = this.options.from, this.runner = ot.from({
239
+ tick: t.tick,
240
+ css: t.css
241
+ });
242
+ }
243
+ /**
244
+ * Create Integrator from physics options
245
+ * Priority: integrator factory > inertia/spring config > default spring
246
+ */
247
+ createIntegrator() {
248
+ const t = this.options.physics;
249
+ return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? Q.from({
250
+ spring: t.spring,
251
+ inertia: t.inertia
252
+ }) : new Z(st);
309
253
  }
310
254
  runAnimation(t) {
311
- this.isAnimating = !0, this.controls = lt({
255
+ var e, o;
256
+ if (this.isAnimating = !0, !this.runner) {
257
+ (o = (e = this.options).onStart) == null || o.call(e), this.currentValue = t, this.currentVelocity = 0, this.isAnimating = !1, this.options.onComplete();
258
+ return;
259
+ }
260
+ this.controls = this.runner({
261
+ integrator: this.createIntegrator(),
312
262
  from: this.currentValue,
313
263
  to: t,
314
- spring: this.options.spring,
315
264
  velocity: this.currentVelocity,
316
- tick: this.options.tick,
317
- css: this.options.css,
318
265
  onStart: this.options.onStart,
319
266
  onComplete: () => {
320
267
  this.currentValue = t, this.currentVelocity = 0, this.isAnimating = !1, this.controls = null, this.options.onComplete();
@@ -362,24 +309,24 @@ class F extends K {
362
309
  updateOptions(t) {
363
310
  this.options = { ...this.options, ...t };
364
311
  }
365
- static fromState(t, n) {
366
- const r = new F(n);
367
- return r.setValue(t.position), r.setVelocity(t.velocity), r;
312
+ static fromState(t, e) {
313
+ const o = new O(e);
314
+ return o.setValue(t.position), o.setVelocity(t.velocity), o;
368
315
  }
369
316
  }
370
- class L extends K {
317
+ class L extends Y {
371
318
  constructor(t) {
372
319
  super();
373
- m(this, "config");
374
- m(this, "animators", /* @__PURE__ */ new Map());
375
- m(this, "springOrder", []);
376
- m(this, "completedCount", 0);
377
- m(this, "completedAnimators", /* @__PURE__ */ new Set());
378
- m(this, "direction", "forward");
379
- m(this, "idCounter", 0);
380
- m(this, "rafId", null);
381
- m(this, "from");
382
- m(this, "to");
320
+ d(this, "config");
321
+ d(this, "animators", /* @__PURE__ */ new Map());
322
+ d(this, "springOrder", []);
323
+ d(this, "completedCount", 0);
324
+ d(this, "completedAnimators", /* @__PURE__ */ new Set());
325
+ d(this, "direction", "forward");
326
+ d(this, "idCounter", 0);
327
+ d(this, "rafId", null);
328
+ d(this, "from");
329
+ d(this, "to");
383
330
  this.config = t.config, this.from = t.from, this.to = t.to, this.initializeAnimators();
384
331
  }
385
332
  generateId() {
@@ -387,21 +334,21 @@ class L extends K {
387
334
  }
388
335
  initializeAnimators() {
389
336
  this.config.springs.forEach((t) => {
390
- const n = this.generateId(), r = new F({
337
+ const e = this.generateId(), o = new O({
391
338
  from: this.from,
392
339
  to: this.to,
393
- spring: t.spring,
340
+ physics: t.physics,
394
341
  tick: t.tick,
395
342
  css: t.css,
396
- onComplete: () => this.onAnimatorComplete(n),
343
+ onComplete: () => this.onAnimatorComplete(e),
397
344
  onStart: t.onStart
398
345
  });
399
- this.animators.set(n, {
400
- id: n,
346
+ this.animators.set(e, {
347
+ id: e,
401
348
  item: t,
402
- animator: r,
349
+ animator: o,
403
350
  started: !1
404
- }), this.springOrder.push(n);
351
+ }), this.springOrder.push(e);
405
352
  });
406
353
  }
407
354
  /**
@@ -409,8 +356,8 @@ class L extends K {
409
356
  * Progress = |position - from| / |to - from|
410
357
  */
411
358
  getAnimatorProgress(t) {
412
- const n = t.animator.getCurrentState(), r = Math.abs(n.to - n.from);
413
- return r === 0 ? 1 : Math.abs(n.position - n.from) / r;
359
+ const e = t.animator.getCurrentState(), o = Math.abs(e.to - e.from);
360
+ return o === 0 ? 1 : Math.abs(e.position - e.from) / o;
414
361
  }
415
362
  /**
416
363
  * Get order of springs based on direction
@@ -421,9 +368,9 @@ class L extends K {
421
368
  return this.direction === "forward" ? this.springOrder : [...this.springOrder].reverse();
422
369
  }
423
370
  onAnimatorComplete(t) {
424
- var r, s, a, o, c, u;
425
- const n = this.animators.get(t);
426
- !n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (s = (r = n.item).onComplete) == null || s.call(r), (o = (a = this.config).onProgress) == null || o.call(a, this.completedCount, this.config.springs.length), this.completedCount === this.config.springs.length && (this.stopScheduler(), (u = (c = this.config).onEnd) == null || u.call(c)));
371
+ var o, s, l, r, c, u;
372
+ const e = this.animators.get(t);
373
+ !e || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (s = (o = e.item).onComplete) == null || s.call(o), (r = (l = this.config).onProgress) == null || r.call(l, this.completedCount, this.config.springs.length), this.completedCount === this.config.springs.length && (this.stopScheduler(), (u = (c = this.config).onEnd) == null || u.call(c)));
427
374
  }
428
375
  /**
429
376
  * Check and start springs based on previous spring's progress
@@ -431,22 +378,22 @@ class L extends K {
431
378
  */
432
379
  checkAndStartSprings() {
433
380
  const t = this.getOrderedIds();
434
- for (let n = 0; n < t.length; n++) {
435
- const r = t[n], s = this.animators.get(r);
381
+ for (let e = 0; e < t.length; e++) {
382
+ const o = t[e], s = this.animators.get(o);
436
383
  if (!s || s.started) continue;
437
- if (n === 0) {
438
- this.startAnimator(r);
384
+ if (e === 0) {
385
+ this.startAnimator(o);
439
386
  continue;
440
387
  }
441
- const a = t[n - 1], o = this.animators.get(a);
442
- if (!o || !o.started) continue;
443
- const c = this.getAnimatorProgress(o), u = s.item.normalizedOffset;
444
- c >= u && this.startAnimator(r);
388
+ const l = t[e - 1], r = this.animators.get(l);
389
+ if (!r || !r.started) continue;
390
+ const c = this.getAnimatorProgress(r), u = s.item.normalizedOffset;
391
+ c >= u && this.startAnimator(o);
445
392
  }
446
393
  }
447
394
  startAnimator(t) {
448
- const n = this.animators.get(t);
449
- !n || n.started || (n.started = !0, this.direction === "forward" ? n.animator.forward() : n.animator.backward());
395
+ const e = this.animators.get(t);
396
+ !e || e.started || (e.started = !0, this.direction === "forward" ? e.animator.forward() : e.animator.backward());
450
397
  }
451
398
  /**
452
399
  * Start the scheduler loop that checks spring progress
@@ -461,17 +408,17 @@ class L extends K {
461
408
  this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
462
409
  }
463
410
  getFirstAnimator() {
464
- var n;
411
+ var e;
465
412
  const t = this.springOrder[0];
466
- return t ? ((n = this.animators.get(t)) == null ? void 0 : n.animator) ?? null : null;
413
+ return t ? ((e = this.animators.get(t)) == null ? void 0 : e.animator) ?? null : null;
467
414
  }
468
415
  forward() {
469
- var t, n;
470
- this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (n = (t = this.config).onStart) == null || n.call(t), this.startScheduler();
416
+ var t, e;
417
+ this.stop(), this.direction = "forward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (e = (t = this.config).onStart) == null || e.call(t), this.startScheduler();
471
418
  }
472
419
  backward() {
473
- var t, n;
474
- this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (n = (t = this.config).onStart) == null || n.call(t), this.startScheduler();
420
+ var t, e;
421
+ this.stop(), this.direction = "backward", this.completedCount = 0, this.completedAnimators.clear(), this.resetStartedFlags(), (e = (t = this.config).onStart) == null || e.call(t), this.startScheduler();
475
422
  }
476
423
  resetStartedFlags() {
477
424
  this.animators.forEach((t) => {
@@ -487,14 +434,14 @@ class L extends K {
487
434
  this.direction = this.direction === "forward" ? "backward" : "forward", this.animators.forEach((t) => {
488
435
  if (!t.started)
489
436
  return;
490
- const n = t.animator.getCurrentState();
491
- if (n.position === n.to) {
492
- const s = F.fromState(
437
+ const e = t.animator.getCurrentState();
438
+ if (e.position === e.to) {
439
+ const s = O.fromState(
493
440
  { position: this.to, velocity: 0 },
494
441
  {
495
442
  from: this.to,
496
443
  to: this.from,
497
- spring: t.item.spring,
444
+ physics: t.item.physics,
498
445
  tick: t.item.tick,
499
446
  css: t.item.css,
500
447
  onComplete: () => this.onAnimatorComplete(t.id),
@@ -534,16 +481,16 @@ class L extends K {
534
481
  * TODO: Support per-spring control
535
482
  */
536
483
  setValue(t) {
537
- const n = this.getFirstAnimator();
538
- n == null || n.setValue(t);
484
+ const e = this.getFirstAnimator();
485
+ e == null || e.setValue(t);
539
486
  }
540
487
  /**
541
488
  * Set velocity on first animator
542
489
  * TODO: Support per-spring control
543
490
  */
544
491
  setVelocity(t) {
545
- const n = this.getFirstAnimator();
546
- n == null || n.setVelocity(t);
492
+ const e = this.getFirstAnimator();
493
+ e == null || e.setVelocity(t);
547
494
  }
548
495
  /**
549
496
  * Check if any animation is currently running
@@ -558,28 +505,28 @@ class L extends K {
558
505
  * Create MultiAnimator from existing state
559
506
  * Uses first animator's state for initialization
560
507
  */
561
- static fromState(t, n) {
562
- const r = new L(n);
563
- return r.setValue(t.position), r.setVelocity(t.velocity), r;
508
+ static fromState(t, e) {
509
+ const o = new L(e);
510
+ return o.setValue(t.position), o.setVelocity(t.velocity), o;
564
511
  }
565
512
  }
566
- const Z = Symbol.for("TRANSITION_STRATEGY"), ut = (i) => ({
567
- runIn: async (e) => {
568
- const { currentAnimation: t } = i;
513
+ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
514
+ runIn: async (i) => {
515
+ const { currentAnimation: t } = n;
569
516
  if (t && t.direction === "out") {
570
- const r = t.controller.getCurrentValue(), s = t.controller.getVelocity();
571
- if (t.controller.stop(), e.out)
517
+ const o = t.controller.getCurrentValue(), s = t.controller.getVelocity();
518
+ if (t.controller.stop(), i.out)
572
519
  return {
573
- config: await e.out,
574
- state: { position: r, velocity: s },
520
+ config: await i.out,
521
+ state: { position: o, velocity: s },
575
522
  from: 1,
576
523
  to: 0,
577
524
  direction: "backward"
578
525
  // Will actually go 0→1 (backward means toward 'from')
579
526
  };
580
527
  }
581
- return e.in ? {
582
- config: await e.in,
528
+ return i.in ? {
529
+ config: await i.in,
583
530
  state: {
584
531
  position: 0,
585
532
  velocity: 0
@@ -597,22 +544,22 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ut = (i) => ({
597
544
  direction: "forward"
598
545
  };
599
546
  },
600
- runOut: async (e) => {
601
- const { currentAnimation: t } = i;
547
+ runOut: async (i) => {
548
+ const { currentAnimation: t } = n;
602
549
  if (t && t.direction === "in") {
603
- const r = t.controller.getCurrentValue(), s = t.controller.getVelocity();
604
- if (t.controller.stop(), e.in)
550
+ const o = t.controller.getCurrentValue(), s = t.controller.getVelocity();
551
+ if (t.controller.stop(), i.in)
605
552
  return {
606
- config: await e.in,
607
- state: { position: r, velocity: s },
553
+ config: await i.in,
554
+ state: { position: o, velocity: s },
608
555
  from: 0,
609
556
  to: 1,
610
557
  direction: "backward"
611
558
  // Will actually go 1→0 (backward means toward 'from')
612
559
  };
613
560
  }
614
- return e.out ? {
615
- config: await e.out,
561
+ return i.out ? {
562
+ config: await i.out,
616
563
  state: {
617
564
  position: 1,
618
565
  velocity: 0
@@ -630,9 +577,9 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ut = (i) => ({
630
577
  direction: "forward"
631
578
  };
632
579
  }
633
- }), ft = () => ({
634
- runIn: async (i) => i.in ? {
635
- config: await i.in,
580
+ }), ct = () => ({
581
+ runIn: async (n) => n.in ? {
582
+ config: await n.in,
636
583
  state: {
637
584
  position: 0,
638
585
  velocity: 0
@@ -649,8 +596,8 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ut = (i) => ({
649
596
  to: 1,
650
597
  direction: "forward"
651
598
  },
652
- runOut: async (i) => i.out ? {
653
- config: await i.out,
599
+ runOut: async (n) => n.out ? {
600
+ config: await n.out,
654
601
  state: {
655
602
  position: 1,
656
603
  velocity: 0
@@ -667,48 +614,48 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ut = (i) => ({
667
614
  to: 0,
668
615
  direction: "forward"
669
616
  }
670
- }), J = "data-ssgoi-scope", Q = "data-ssgoi-scope-ready";
671
- function Vt() {
672
- return (i) => {
673
- if (i)
674
- return i.setAttribute(J, ""), queueMicrotask(() => {
617
+ }), j = "data-ssgoi-scope", G = "data-ssgoi-scope-ready";
618
+ function bt() {
619
+ return (n) => {
620
+ if (n)
621
+ return n.setAttribute(j, ""), queueMicrotask(() => {
675
622
  queueMicrotask(() => {
676
- i.setAttribute(Q, "true");
623
+ n.setAttribute(G, "true");
677
624
  });
678
625
  }), () => {
679
626
  };
680
627
  };
681
628
  }
682
- function dt(i) {
683
- return i.hasAttribute(Q);
629
+ function lt(n) {
630
+ return n.hasAttribute(G);
684
631
  }
685
- function mt(i) {
686
- return i.closest(`[${J}]`);
632
+ function ut(n) {
633
+ return n.closest(`[${j}]`);
687
634
  }
688
- function ht(i, e) {
689
- var v;
690
- let t = null, n = null, r = null, s = null;
691
- const a = {
635
+ function ft(n, i) {
636
+ var S;
637
+ let t = null, e = null, o = null, s = null;
638
+ const l = {
692
639
  get currentAnimation() {
693
640
  return t;
694
641
  }
695
- }, o = ((v = e == null ? void 0 : e.strategy) == null ? void 0 : v.call(e, a)) || ut(a), c = async (l) => {
642
+ }, r = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, l)) || at(l), c = async (a) => {
696
643
  var E;
697
- n && (n.remove(), n = null);
698
- const d = i(), A = d.in && d.in(l), k = !(e != null && e.strategy) && d.out ? d.out(l) : void 0;
644
+ e && (e.remove(), e = null);
645
+ const f = n(), A = f.in && f.in(a), k = !(i != null && i.strategy) && f.out ? f.out(a) : void 0;
699
646
  if (!A)
700
647
  return;
701
- const M = {
648
+ const R = {
702
649
  in: P(A),
703
650
  out: k ? P(k) : void 0
704
- }, S = await o.runIn(M);
705
- if (!S.config) {
651
+ }, v = await r.runIn(R);
652
+ if (!v.config) {
706
653
  t && (t.direction = "in");
707
654
  return;
708
655
  }
709
- const p = S.config;
710
- (E = p.prepare) == null || E.call(p, l), p.wait && await p.wait();
711
- const w = Y(
656
+ const p = v.config;
657
+ (E = p.prepare) == null || E.call(p, a), p.wait && await p.wait();
658
+ const w = U(
712
659
  {
713
660
  ...p,
714
661
  onEnd: () => {
@@ -716,88 +663,88 @@ function ht(i, e) {
716
663
  t = null, (C = p.onEnd) == null || C.call(p);
717
664
  }
718
665
  },
719
- l
720
- ), g = L.fromState(S.state, {
666
+ a
667
+ ), h = L.fromState(v.state, {
721
668
  config: w,
722
- from: S.from,
723
- to: S.to
669
+ from: v.from,
670
+ to: v.to
724
671
  });
725
- t = { controller: g, direction: "in" }, S.direction === "forward" ? g.forward() : g.backward();
726
- }, u = async (l) => {
672
+ t = { controller: h, direction: "in" }, v.direction === "forward" ? h.forward() : h.backward();
673
+ }, u = async (a) => {
727
674
  var C;
728
- n = l;
729
- const d = i(), A = !(e != null && e.strategy) && d.in ? d.in(l) : void 0, k = d.out && d.out(l);
675
+ e = a;
676
+ const f = n(), A = !(i != null && i.strategy) && f.in ? f.in(a) : void 0, k = f.out && f.out(a);
730
677
  if (!k)
731
678
  return;
732
- const M = {
679
+ const R = {
733
680
  in: A ? P(A) : void 0,
734
681
  out: P(k)
735
- }, S = await o.runOut(M);
736
- if (!S.config) {
737
- t && (t.direction = "out"), n && (n.remove(), n = null);
682
+ }, v = await r.runOut(R);
683
+ if (!v.config) {
684
+ t && (t.direction = "out"), e && (e.remove(), e = null);
738
685
  return;
739
686
  }
740
- const p = S.config;
741
- (C = p.prepare) == null || C.call(p, l), E(), p.wait && await p.wait();
742
- const w = Y(
687
+ const p = v.config;
688
+ (C = p.prepare) == null || C.call(p, a), E(), p.wait && await p.wait();
689
+ const w = U(
743
690
  {
744
691
  ...p,
745
692
  onEnd: () => {
746
- var V, R;
747
- (V = p.onEnd) == null || V.call(p), n && (n.remove(), n = null), t = null, (R = e == null ? void 0 : e.onCleanupEnd) == null || R.call(e);
693
+ var V, I;
694
+ (V = p.onEnd) == null || V.call(p), e && (e.remove(), e = null), t = null, (I = i == null ? void 0 : i.onCleanupEnd) == null || I.call(i);
748
695
  }
749
696
  },
750
- l
751
- ), g = L.fromState(S.state, {
697
+ a
698
+ ), h = L.fromState(v.state, {
752
699
  config: w,
753
- from: S.from,
754
- to: S.to
700
+ from: v.from,
701
+ to: v.to
755
702
  });
756
- t = { controller: g, direction: "out" }, S.direction === "forward" ? g.forward() : g.backward();
703
+ t = { controller: h, direction: "out" }, v.direction === "forward" ? h.forward() : h.backward();
757
704
  function E() {
758
- !r || !n || (s && r.contains(s) ? r.insertBefore(n, s) : r.appendChild(n));
705
+ !o || !e || (s && o.contains(s) ? o.insertBefore(e, s) : o.appendChild(e));
759
706
  }
760
707
  };
761
- let f = null, h = !1;
762
- const y = (l) => () => {
763
- if (h) return;
764
- h = !0;
765
- const d = l.cloneNode(!0);
766
- f ? queueMicrotask(() => {
767
- document.contains(f) && u(d);
768
- }) : u(d);
708
+ let m = null, g = !1;
709
+ const y = (a) => () => {
710
+ if (g) return;
711
+ g = !0;
712
+ const f = a.cloneNode(!0);
713
+ m ? queueMicrotask(() => {
714
+ document.contains(m) && u(f);
715
+ }) : u(f);
769
716
  };
770
- return (l) => {
771
- if (l)
717
+ return (a) => {
718
+ if (a)
772
719
  return requestAnimationFrame(() => {
773
- r = l.parentElement, s = l.nextElementSibling;
774
- }), h = !1, (e == null ? void 0 : e.scope) === "local" ? queueMicrotask(() => {
775
- f = mt(l), !(f && !dt(f)) && c(l);
776
- }) : c(l), y(l);
720
+ o = a.parentElement, s = a.nextElementSibling;
721
+ }), g = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
722
+ m = ut(a), !(m && !lt(m)) && c(a);
723
+ }) : c(a), y(a);
777
724
  };
778
725
  }
779
726
  const b = /* @__PURE__ */ new Map();
780
- let T = null, q = !1;
781
- function tt(i) {
782
- if (i instanceof HTMLElement && b.has(i)) {
783
- const t = b.get(i);
784
- b.delete(i), queueMicrotask(() => {
727
+ let T = null, N = !1;
728
+ function $(n) {
729
+ if (n instanceof HTMLElement && b.has(n)) {
730
+ const t = b.get(n);
731
+ b.delete(n), queueMicrotask(() => {
785
732
  t();
786
733
  });
787
734
  }
788
- const e = i.childNodes;
789
- for (let t = 0; t < e.length; t++) {
790
- const n = e[t];
791
- n && tt(n);
735
+ const i = n.childNodes;
736
+ for (let t = 0; t < i.length; t++) {
737
+ const e = i[t];
738
+ e && $(e);
792
739
  }
793
740
  }
794
- function gt() {
795
- q || typeof document > "u" || (q = !0, T = new MutationObserver((i) => {
796
- for (const e of i) {
797
- const t = e.removedNodes;
798
- for (let n = 0; n < t.length; n++) {
799
- const r = t[n];
800
- r && tt(r);
741
+ function dt() {
742
+ N || typeof document > "u" || (N = !0, T = new MutationObserver((n) => {
743
+ for (const i of n) {
744
+ const t = i.removedNodes;
745
+ for (let e = 0; e < t.length; e++) {
746
+ const o = t[e];
747
+ o && $(o);
801
748
  }
802
749
  }
803
750
  }), document.body ? T.observe(document.body, {
@@ -814,270 +761,270 @@ function gt() {
814
761
  { once: !0 }
815
762
  ));
816
763
  }
817
- function pt(i, e) {
818
- gt(), b.set(i, e);
764
+ function mt(n, i) {
765
+ dt(), b.set(n, i);
819
766
  }
820
- function Mt(i) {
821
- return b.has(i);
767
+ function kt(n) {
768
+ return b.has(n);
822
769
  }
823
- function Rt() {
770
+ function Vt() {
824
771
  return b.size;
825
772
  }
826
- function Pt(i) {
827
- const e = b.get(i);
828
- return e ? (b.delete(i), e(), !0) : !1;
773
+ function Rt(n) {
774
+ const i = b.get(n);
775
+ return i ? (b.delete(n), i(), !0) : !1;
829
776
  }
830
777
  function It() {
831
- b.clear(), T == null || T.disconnect(), T = null, q = !1;
778
+ b.clear(), T == null || T.disconnect(), T = null, N = !1;
832
779
  }
833
- const x = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
834
- function wt(i, e, t) {
835
- x.set(i, e);
836
- let n = H.get(i);
837
- if (n)
838
- return n;
839
- const r = e;
840
- return n = ht(
780
+ const F = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
781
+ function ht(n, i, t) {
782
+ F.set(n, i);
783
+ let e = q.get(n);
784
+ if (e)
785
+ return e;
786
+ const o = i;
787
+ return e = ft(
841
788
  () => {
842
- const s = x.get(i);
843
- return s || (console.warn(`Transition "${String(i)}" not found`), {});
789
+ const s = F.get(n);
790
+ return s || (console.warn(`Transition "${String(n)}" not found`), {});
844
791
  },
845
792
  {
846
793
  strategy: t == null ? void 0 : t.strategy,
847
794
  scope: t == null ? void 0 : t.scope,
848
795
  onCleanupEnd: () => {
849
- x.get(i) === r && yt(i);
796
+ F.get(n) === o && gt(n);
850
797
  }
851
798
  }
852
- ), H.set(i, n), n;
799
+ ), q.set(n, e), e;
853
800
  }
854
- function yt(i) {
855
- x.delete(i), H.delete(i), N.delete(i);
801
+ function gt(n) {
802
+ F.delete(n), q.delete(n), _.delete(n);
856
803
  }
857
- function Ot(i, e = "manual") {
858
- const t = wt(
859
- i.key,
804
+ function Pt(n, i = "manual") {
805
+ const t = ht(
806
+ n.key,
860
807
  {
861
- in: i.in,
862
- out: i.out
808
+ in: n.in,
809
+ out: n.out
863
810
  },
864
811
  {
865
- strategy: i[Z],
866
- scope: i.scope
812
+ strategy: n[W],
813
+ scope: n.scope
867
814
  }
868
815
  );
869
- if (e === "manual")
816
+ if (i === "manual")
870
817
  return t;
871
- let n = N.get(i.key);
872
- return n || (n = (r) => {
873
- if (r) {
874
- const s = t(r);
875
- s && pt(r, s);
818
+ let e = _.get(n.key);
819
+ return e || (e = (o) => {
820
+ if (o) {
821
+ const s = t(o);
822
+ s && mt(o, s);
876
823
  }
877
- }, N.set(i.key, n), n);
824
+ }, _.set(n.key, e), e);
878
825
  }
879
- function vt(i) {
880
- const e = i.filter((t) => t.symmetric).map((t) => ({
826
+ function pt(n) {
827
+ const i = n.filter((t) => t.symmetric).map((t) => ({
881
828
  from: t.to,
882
829
  to: t.from,
883
830
  transition: t.transition
884
831
  }));
885
- return [...i, ...e];
832
+ return [...n, ...i];
886
833
  }
887
- function St(i) {
888
- let e = !1, t = 0, n = 0, r = !1;
889
- const s = 50, a = (l) => {
890
- if (!i) return;
891
- const d = l.touches[0];
892
- d && (r = d.clientX < s, r && (t = d.clientX, n = d.clientY));
893
- }, o = (l) => {
894
- if (!i || !r) return;
895
- const d = l.touches[0];
896
- if (!d) return;
897
- const A = d.clientX - t, k = d.clientY - n;
898
- A > window.outerWidth / 2 - 5 && Math.abs(A) > Math.abs(k) ? e = !0 : e = !1;
834
+ function wt(n) {
835
+ let i = !1, t = 0, e = 0, o = !1;
836
+ const s = 50, l = (a) => {
837
+ if (!n) return;
838
+ const f = a.touches[0];
839
+ f && (o = f.clientX < s, o && (t = f.clientX, e = f.clientY));
840
+ }, r = (a) => {
841
+ if (!n || !o) return;
842
+ const f = a.touches[0];
843
+ if (!f) return;
844
+ const A = f.clientX - t, k = f.clientY - e;
845
+ A > window.outerWidth / 2 - 5 && Math.abs(A) > Math.abs(k) ? i = !0 : i = !1;
899
846
  }, c = () => {
900
- i && (r = !1, t = 0, n = 0);
901
- }, u = () => e, f = () => {
902
- typeof window > "u" || i && (window.addEventListener("touchstart", a, { passive: !0 }), window.addEventListener("touchmove", o, { passive: !0 }), window.addEventListener("touchend", c, { passive: !0 }));
903
- }, h = () => {
904
- typeof window > "u" || (window.removeEventListener("touchstart", a), window.removeEventListener("touchmove", o), window.removeEventListener("touchend", c));
847
+ n && (o = !1, t = 0, e = 0);
848
+ }, u = () => i, m = () => {
849
+ typeof window > "u" || n && (window.addEventListener("touchstart", l, { passive: !0 }), window.addEventListener("touchmove", r, { passive: !0 }), window.addEventListener("touchend", c, { passive: !0 }));
850
+ }, g = () => {
851
+ typeof window > "u" || (window.removeEventListener("touchstart", l), window.removeEventListener("touchmove", r), window.removeEventListener("touchend", c));
905
852
  };
906
853
  let y = 0;
907
854
  return {
908
- initialize: f,
909
- cleanup: h,
855
+ initialize: m,
856
+ cleanup: g,
910
857
  isSwipePending: u,
911
858
  resetSwipeDetection: () => {
912
- y++, y > 1 && (y = 0, e = !1);
859
+ y++, y > 1 && (y = 0, i = !1);
913
860
  }
914
861
  };
915
862
  }
916
- const Ct = (i) => {
917
- let e = i.parentElement;
918
- for (; e && e !== document.body; ) {
919
- const t = window.getComputedStyle(e), n = t.overflow + t.overflowY + t.overflowX;
920
- if (n.includes("auto") || n.includes("scroll") || e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth)
921
- return e;
922
- e = e.parentElement;
863
+ const yt = (n) => {
864
+ let i = n.parentElement;
865
+ for (; i && i !== document.body; ) {
866
+ const t = window.getComputedStyle(i), e = t.overflow + t.overflowY + t.overflowX;
867
+ if (e.includes("auto") || e.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
868
+ return i;
869
+ i = i.parentElement;
923
870
  }
924
871
  return document.documentElement;
925
- }, At = (i) => {
926
- let e = i.parentElement;
927
- for (; e && e !== document.body; ) {
928
- const t = window.getComputedStyle(e).position;
872
+ }, vt = (n) => {
873
+ let i = n.parentElement;
874
+ for (; i && i !== document.body; ) {
875
+ const t = window.getComputedStyle(i).position;
929
876
  if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
930
- return e;
931
- e = e.parentElement;
877
+ return i;
878
+ i = i.parentElement;
932
879
  }
933
880
  return document.body;
934
881
  };
935
- function Et() {
936
- let i = null, e = null;
882
+ function St() {
883
+ let n = null, i = null;
937
884
  const t = /* @__PURE__ */ new Map();
938
- let n = null;
939
- const r = () => {
940
- i && n && t.set(n, {
941
- x: i.scrollLeft,
942
- y: i.scrollTop
885
+ let e = null;
886
+ const o = () => {
887
+ n && e && t.set(e, {
888
+ x: n.scrollLeft,
889
+ y: n.scrollTop
943
890
  });
944
891
  };
945
892
  return {
946
- initializeContext: (f, h) => {
947
- e = f, i || (i = Ct(f), (i === document.documentElement ? window : i).addEventListener("scroll", r, {
893
+ initializeContext: (m, g) => {
894
+ i = m, n || (n = yt(m), (n === document.documentElement ? window : n).addEventListener("scroll", o, {
948
895
  passive: !0
949
- })), n = h;
896
+ })), e = g;
950
897
  },
951
- calculateScrollOffset: (f, h) => {
952
- const y = f && t.has(f) ? t.get(f) : { x: 0, y: 0 }, v = h && t.has(h) ? t.get(h) : { x: 0, y: 0 };
898
+ calculateScrollOffset: (m, g) => {
899
+ const y = m && t.has(m) ? t.get(m) : { x: 0, y: 0 }, S = g && t.has(g) ? t.get(g) : { x: 0, y: 0 };
953
900
  return {
954
- x: -v.x + y.x,
955
- y: -v.y + y.y
901
+ x: -S.x + y.x,
902
+ y: -S.y + y.y
956
903
  };
957
904
  },
958
- getScrollContainer: () => i,
959
- getPositionedParentElement: () => e ? At(e) : document.body,
960
- getScrollPosition: (f) => f && t.has(f) ? t.get(f) : { x: 0, y: 0 }
905
+ getScrollContainer: () => n,
906
+ getPositionedParentElement: () => i ? vt(i) : document.body,
907
+ getScrollPosition: (m) => m && t.has(m) ? t.get(m) : { x: 0, y: 0 }
961
908
  };
962
909
  }
963
- function O(i, e) {
964
- if (e === "*")
910
+ function M(n, i) {
911
+ if (i === "*")
965
912
  return !0;
966
- if (e.endsWith("/*")) {
967
- const t = e.slice(0, -2);
968
- return i === t || i.startsWith(t + "/");
913
+ if (i.endsWith("/*")) {
914
+ const t = i.slice(0, -2);
915
+ return n === t || n.startsWith(t + "/");
969
916
  }
970
- return i === e;
917
+ return n === i;
971
918
  }
972
- function Tt(i, e, t) {
973
- for (const n of t)
974
- if (O(i, n.from) && O(e, n.to))
975
- return n.transition;
976
- for (const n of t)
977
- if ((n.from === "*" || O(i, n.from)) && (n.to === "*" || O(e, n.to)))
978
- return n.transition;
919
+ function Ct(n, i, t) {
920
+ for (const e of t)
921
+ if (M(n, e.from) && M(i, e.to))
922
+ return e.transition;
923
+ for (const e of t)
924
+ if ((e.from === "*" || M(n, e.from)) && (e.to === "*" || M(i, e.to)))
925
+ return e.transition;
979
926
  return null;
980
927
  }
981
- function xt(i, e) {
928
+ function xt(n, i) {
982
929
  const {
983
930
  transitions: t = [],
984
- defaultTransition: n,
985
- middleware: r = (w, g) => ({ from: w, to: g }),
931
+ defaultTransition: e,
932
+ middleware: o = (w, h) => ({ from: w, to: h }),
986
933
  // Identity function as default
987
934
  skipOnIosSwipe: s = !0
988
935
  // Default to true - skip animations on iOS swipe
989
- } = i, { outFirst: a = !0 } = e || {};
990
- let o = null;
991
- const c = vt(t), {
936
+ } = n, { outFirst: l = !0 } = i || {};
937
+ let r = null;
938
+ const c = pt(t), {
992
939
  initializeContext: u,
993
- calculateScrollOffset: f,
994
- getScrollContainer: h,
940
+ calculateScrollOffset: m,
941
+ getScrollContainer: g,
995
942
  getPositionedParentElement: y,
996
- getScrollPosition: v
997
- } = Et(), l = St(s);
998
- l.initialize();
999
- function d() {
1000
- if (o != null && o.from && (o != null && o.to)) {
1001
- const { from: w, to: g } = r(
1002
- o.from,
1003
- o.to
1004
- ), C = Tt(
943
+ getScrollPosition: S
944
+ } = St(), a = wt(s);
945
+ a.initialize();
946
+ function f() {
947
+ if (r != null && r.from && (r != null && r.to)) {
948
+ const { from: w, to: h } = o(
949
+ r.from,
950
+ r.to
951
+ ), C = Ct(
1005
952
  w,
1006
- g,
953
+ h,
1007
954
  c
1008
- ) || n, V = f(
1009
- o.from,
1010
- o.to
1011
- ), R = {
955
+ ) || e, V = m(
956
+ r.from,
957
+ r.to
958
+ ), I = {
1012
959
  scrollOffset: V,
1013
- scroll: v(o.from),
960
+ scroll: S(r.from),
1014
961
  get scrollingElement() {
1015
- return h() || document.documentElement;
962
+ return g() || document.documentElement;
1016
963
  },
1017
964
  get positionedParent() {
1018
965
  return y();
1019
966
  }
1020
- }, et = {
967
+ }, B = {
1021
968
  scrollOffset: V,
1022
969
  get scroll() {
1023
- return o ? v(o.to) : { x: 0, y: 0 };
970
+ return r ? S(r.to) : { x: 0, y: 0 };
1024
971
  },
1025
972
  get scrollingElement() {
1026
- return h() || document.documentElement;
973
+ return g() || document.documentElement;
1027
974
  },
1028
975
  get positionedParent() {
1029
976
  return y();
1030
977
  }
1031
978
  };
1032
- C && (C.out && o.outResolve && o.outResolve(
1033
- (z) => C.out(z, R)
1034
- ), C.in && o.inResolve && o.inResolve(
1035
- (z) => C.in(z, et)
1036
- )), o = null;
979
+ C && (C.out && r.outResolve && r.outResolve(
980
+ (D) => C.out(D, I)
981
+ ), C.in && r.inResolve && r.inResolve(
982
+ (D) => C.in(D, B)
983
+ )), r = null;
1037
984
  }
1038
985
  }
1039
986
  function A() {
1040
- o && (o.inResolve && o.inResolve(() => ({})), o.outResolve && o.outResolve(() => ({})), o = null);
987
+ r && (r.inResolve && r.inResolve(() => ({})), r.outResolve && r.outResolve(() => ({})), r = null);
1041
988
  }
1042
- const S = a ? async (w, g) => l.isSwipePending() ? (l.resetSwipeDetection(), () => ({})) : g === "in" && (!o || !o.from) ? () => ({}) : (o || (o = {}), g === "out" ? (o.from = w, new Promise((E) => {
1043
- o.outResolve = E, d();
1044
- })) : (o.to = w, new Promise((E) => {
1045
- o.inResolve = E, d();
1046
- }))) : async (w, g) => l.isSwipePending() ? (l.resetSwipeDetection(), () => ({})) : (o && (g === "out" && o.from && o.from !== w || g === "in" && o.to && o.to !== w) && A(), o || (o = {}), g === "out" ? (o.from = w, new Promise((C) => {
1047
- o.outResolve = C, d();
1048
- })) : (o.to = w, new Promise((C) => {
1049
- o.inResolve = C, d();
989
+ const v = l ? async (w, h) => a.isSwipePending() ? (a.resetSwipeDetection(), () => ({})) : h === "in" && (!r || !r.from) ? () => ({}) : (r || (r = {}), h === "out" ? (r.from = w, new Promise((E) => {
990
+ r.outResolve = E, f();
991
+ })) : (r.to = w, new Promise((E) => {
992
+ r.inResolve = E, f();
993
+ }))) : async (w, h) => a.isSwipePending() ? (a.resetSwipeDetection(), () => ({})) : (r && (h === "out" && r.from && r.from !== w || h === "in" && r.to && r.to !== w) && A(), r || (r = {}), h === "out" ? (r.from = w, new Promise((C) => {
994
+ r.outResolve = C, f();
995
+ })) : (r.to = w, new Promise((C) => {
996
+ r.inResolve = C, f();
1050
997
  })));
1051
998
  return (w) => ({
1052
999
  key: w,
1053
- in: async (g) => (u(g, w), (await S(w, "in"))(g)),
1054
- out: async (g) => (await S(w, "out"))(g),
1000
+ in: async (h) => (u(h, w), (await v(w, "in"))(h)),
1001
+ out: async (h) => (await v(w, "out"))(h),
1055
1002
  // Add page transition strategy for page-level transitions
1056
- [Z]: ft
1003
+ [W]: ct
1057
1004
  });
1058
1005
  }
1059
1006
  export {
1060
- J as SCOPE_ATTR,
1061
- Q as SCOPE_READY_ATTR,
1062
- Z as TRANSITION_STRATEGY,
1063
- ut as createDefaultStrategy,
1064
- ft as createPageTransitionStrategy,
1007
+ j as SCOPE_ATTR,
1008
+ G as SCOPE_READY_ATTR,
1009
+ W as TRANSITION_STRATEGY,
1010
+ at as createDefaultStrategy,
1011
+ ct as createPageTransitionStrategy,
1065
1012
  xt as createSggoiTransitionContext,
1066
- Vt as createTransitionScope,
1067
- mt as findScope,
1068
- Rt as getWatchedCount,
1069
- zt as isCssAnimation,
1070
- Dt as isMultiSpring,
1071
- dt as isScopeReady,
1072
- _t as isSingleSpring,
1073
- qt as isTickAnimation,
1074
- Mt as isWatched,
1075
- Y as normalizeMultiSpringSchedule,
1013
+ bt as createTransitionScope,
1014
+ ut as findScope,
1015
+ Vt as getWatchedCount,
1016
+ Ot as isCssAnimation,
1017
+ Lt as isMultiSpring,
1018
+ lt as isScopeReady,
1019
+ Dt as isSingleSpring,
1020
+ zt as isTickAnimation,
1021
+ kt as isWatched,
1022
+ U as normalizeMultiSpringSchedule,
1076
1023
  P as normalizeToMultiSpring,
1077
1024
  It as resetObserver,
1078
- Ot as transition,
1079
- Pt as triggerUnmount,
1080
- Ht as validateAnimationMode,
1081
- Nt as validateSpringItem,
1082
- pt as watchUnmount
1025
+ Pt as transition,
1026
+ Rt as triggerUnmount,
1027
+ Nt as validateAnimationMode,
1028
+ qt as validateSpringItem,
1029
+ mt as watchUnmount
1083
1030
  };