@ssgoi/core 3.4.0 → 4.0.0

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