@lazycatcloud/vue-router-stack 0.0.6 → 0.0.8

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.
@@ -1,16 +1,167 @@
1
- import { shallowRef as te, getCurrentInstance as ie, inject as C, defineComponent as Y, h as y, computed as X, ref as G, provide as ue, watch as le, onUnmounted as de, nextTick as fe, onMounted as he } from "vue";
2
- import { createRouter as me, useRoute as ye, routeLocationKey as ke, matchedRouteKey as v } from "vue-router";
3
- import { RouterLink as je, RouterView as Ue, createMemoryHistory as Xe, createWebHashHistory as Me, createWebHistory as qe, useRoute as Je, useRouter as Qe } from "vue-router";
4
- const O = {};
5
- function J(e = "route") {
6
- const a = (O[e] ?? 0) + 1;
7
- return O[e] = a, `${e}-${a}`;
1
+ import { shallowRef as re, getCurrentInstance as pe, inject as $, defineComponent as q, ref as z, onBeforeUnmount as ne, provide as se, computed as G, h as I, watch as ke, onUnmounted as me, nextTick as ye, onMounted as ae, readonly as we } from "vue";
2
+ import { createRouter as Ie, useRoute as Se, routeLocationKey as Re, matchedRouteKey as ee } from "vue-router";
3
+ import { RouterLink as Ze, RouterView as Ne, createMemoryHistory as Oe, createWebHashHistory as et, createWebHistory as tt, useRoute as ot, useRouter as rt } from "vue-router";
4
+ const te = {};
5
+ function W(e = "route") {
6
+ const r = (te[e] ?? 0) + 1;
7
+ return te[e] = r, `${e}-${r}`;
8
8
  }
9
- const Z = "slide", Re = "cubic-bezier(0.3, 0, 0.66, 1)";
10
- function Ae(e) {
9
+ const J = "__stack_page_state__", ce = Symbol("stack-page-history");
10
+ function be(e, r) {
11
+ return e.states.length === r.states.length && e.states.every((u, h) => {
12
+ const f = r.states[h];
13
+ return u.ownerId === f.ownerId && u.key === f.key && Object.is(u.value, f.value);
14
+ });
15
+ }
16
+ function Pe(e, r, u) {
17
+ const h = e.push.bind(e), f = e.replace.bind(e), v = e.go.bind(e), D = e.listen.bind(e), y = e.destroy.bind(e), p = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map(), T = [];
18
+ let b = 0, x = 0;
19
+ const A = (a) => {
20
+ const d = a[J];
21
+ return typeof d == "string" && c.has(d) ? d : "";
22
+ }, g = () => P.has(b) ? P.get(b) : "", _ = () => {
23
+ const a = new Set(P.values());
24
+ for (const d of c.keys())
25
+ a.has(d) || c.delete(d);
26
+ }, B = (a) => {
27
+ const d = W("page-state");
28
+ return c.set(d, a), { [J]: d };
29
+ }, C = (a, d, t) => {
30
+ const o = d.states.findIndex(
31
+ (n) => n.ownerId === a.scope.id && n.key === a.key
32
+ ), i = o >= 0, s = a.active !== i || i && !Object.is(a.value, d.states[o].value);
33
+ a.active = i, i && (a.value = d.states[o].value), a.change(
34
+ i ? { active: !0, value: d.states[o].value } : { active: !1 },
35
+ t && s
36
+ );
37
+ }, H = (a, d) => {
38
+ for (const t of S)
39
+ t.scope.routeIds.value.has(a.routeId) && C(t, a, d);
40
+ };
41
+ e.push = (a, d = {}) => {
42
+ h(a, d), b++;
43
+ for (const t of P.keys())
44
+ t > b && P.delete(t);
45
+ P.set(b, A(d)), _();
46
+ }, e.replace = (a, d = {}) => {
47
+ f(a, { ...d, [J]: A(d) }), P.set(b, A(d)), _();
48
+ }, e.go = (a, d = !0) => {
49
+ d || (b += a), v(a, d);
50
+ }, e.listen = (a) => (p.add(a), () => p.delete(a));
51
+ const V = (a) => {
52
+ for (const t of a) m.delete(t);
53
+ if (m.size > 0) return;
54
+ const d = [...R];
55
+ R.clear();
56
+ for (const [t, o] of d) F(t, o);
57
+ for (const t of T.splice(0)) t();
58
+ };
59
+ D((a, d, t) => {
60
+ const o = [...m], i = g();
61
+ b += t.delta;
62
+ const s = g();
63
+ if (a === d && c.has(i) && c.has(s) && c.get(i).routeId === c.get(s).routeId) {
64
+ const l = Math.sign(t.delta);
65
+ if (o.length === 0 && l !== 0 && P.has(b + l) && be(c.get(i), c.get(s))) {
66
+ x += t.delta, e.go(l);
67
+ return;
68
+ }
69
+ x = 0, r(), u(b), H(c.get(s), !0), V(o);
70
+ return;
71
+ }
72
+ V(o);
73
+ const n = { ...t, delta: t.delta + x };
74
+ x = 0;
75
+ for (const l of p) l(a, d, n);
76
+ }), e.destroy = () => {
77
+ p.clear(), S.clear(), c.clear(), P.clear(), R.clear(), m.clear();
78
+ for (const a of T.splice(0)) a();
79
+ y();
80
+ };
81
+ function F(a, d) {
82
+ if (!a.scope.isActive.value || e.location !== a.scope.fullPath.value)
83
+ return;
84
+ if (m.size > 0) {
85
+ R.set(a, d);
86
+ return;
87
+ }
88
+ if (a.active) return;
89
+ const t = a.scope.routeId.value, o = g(), i = c.has(o) && c.get(o).routeId === t ? c.get(o) : { routeId: t, states: [] };
90
+ (!c.has(o) || c.get(o).routeId !== t) && e.replace(e.location, { ...e.state, ...B(i) });
91
+ const s = {
92
+ routeId: t,
93
+ states: [
94
+ ...i.states,
95
+ { ownerId: a.scope.id, key: a.key, value: d }
96
+ ]
97
+ };
98
+ e.push(e.location, B(s)), u(b), H(s, !1);
99
+ }
100
+ function K(a) {
101
+ if (R.delete(a), !a.active) return;
102
+ a.active = !1, a.change({ active: !1 }, !1);
103
+ const d = g();
104
+ if (!a.scope.isActive.value || e.location !== a.scope.fullPath.value || !c.has(d)) {
105
+ L(a);
106
+ return;
107
+ }
108
+ const t = c.get(d);
109
+ a.scope.routeIds.value.has(t.routeId) && (t.states.length > 0 && t.states[t.states.length - 1].ownerId === a.scope.id && t.states[t.states.length - 1].key === a.key ? (m.add(a), e.go(-1)) : L(a));
110
+ }
111
+ function L(a) {
112
+ for (const d of c.values())
113
+ d.states = d.states.filter(
114
+ (t) => t.ownerId !== a.scope.id || t.key !== a.key
115
+ );
116
+ }
117
+ return {
118
+ get position() {
119
+ return b;
120
+ },
121
+ whenSettled: () => m.size === 0 ? Promise.resolve() : new Promise((a) => T.push(a)),
122
+ restoreCurrent() {
123
+ const a = g();
124
+ c.has(a) && H(c.get(a), !0);
125
+ },
126
+ register(a, d, t) {
127
+ for (const i of S)
128
+ if (i.scope === a && i.key === d)
129
+ throw new Error(`Duplicate page history state key: ${d}`);
130
+ const o = {
131
+ scope: a,
132
+ key: d,
133
+ active: !1,
134
+ value: null,
135
+ change: t
136
+ };
137
+ return S.add(o), {
138
+ push: (i) => F(o, i),
139
+ remove: () => K(o),
140
+ replace(i) {
141
+ const s = g();
142
+ if (!a.isActive.value || e.location !== a.fullPath.value || !o.active || !c.has(s))
143
+ return;
144
+ const n = c.get(s);
145
+ n.states = n.states.map(
146
+ (l) => l.ownerId === a.id && l.key === d ? { ...l, value: i } : l
147
+ ), C(o, n, !1);
148
+ },
149
+ restore() {
150
+ const i = g();
151
+ c.has(i) && a.routeIds.value.has(c.get(i).routeId) && C(o, c.get(i), !0);
152
+ },
153
+ dispose() {
154
+ K(o), S.delete(o), R.delete(o), L(o);
155
+ }
156
+ };
157
+ }
158
+ };
159
+ }
160
+ const N = "slide", Ee = "cubic-bezier(0.3, 0, 0.66, 1)";
161
+ function Ke(e) {
11
162
  return e;
12
163
  }
13
- const pe = ({ direction: e }) => e === "back" ? {
164
+ const ve = ({ direction: e }) => e === "back" ? {
14
165
  leaving: [
15
166
  { transform: "translateX(0)" },
16
167
  { transform: "translateX(100%)" }
@@ -20,20 +171,20 @@ const pe = ({ direction: e }) => e === "back" ? {
20
171
  { transform: "translateX(100%)" },
21
172
  { transform: "translateX(0)" }
22
173
  ]
23
- }, we = () => ({
174
+ }, ge = () => ({
24
175
  entering: [{ opacity: 0 }, { opacity: 1 }],
25
176
  leaving: [{ opacity: 1 }, { opacity: 0 }]
26
- }), Ee = ({ direction: e }) => {
27
- const a = e === "back";
177
+ }), De = ({ direction: e }) => {
178
+ const r = e === "back";
28
179
  return {
29
- entering: a ? [
180
+ entering: r ? [
30
181
  { transform: "scale(0.98)", opacity: 0 },
31
182
  { transform: "scale(1)", opacity: 1 }
32
183
  ] : [
33
184
  { transform: "scale(1.04)", opacity: 0 },
34
185
  { transform: "scale(1)", opacity: 1 }
35
186
  ],
36
- leaving: a ? [
187
+ leaving: r ? [
37
188
  { transform: "scale(1)", opacity: 1 },
38
189
  { transform: "scale(1.04)", opacity: 0 }
39
190
  ] : [
@@ -41,254 +192,266 @@ const pe = ({ direction: e }) => e === "back" ? {
41
192
  { transform: "scale(0.98)", opacity: 0 }
42
193
  ]
43
194
  };
44
- }, be = () => ({}), Ie = {
45
- slide: pe,
46
- fade: we,
47
- scale: Ee,
48
- none: be
195
+ }, Te = () => ({}), xe = {
196
+ slide: ve,
197
+ fade: ge,
198
+ scale: De,
199
+ none: Te
49
200
  };
50
- function Pe(e, a) {
51
- const c = a[e];
52
- return c || a[Z];
201
+ function Ae(e, r) {
202
+ const u = r[e];
203
+ return u || r[N];
53
204
  }
54
- function ee(e, a, c) {
55
- if (!a || !e.animate || Number(c.duration) <= 0)
205
+ function oe(e, r, u) {
206
+ if (!r || !e.animate || Number(u.duration) <= 0)
56
207
  return Promise.resolve();
57
- const u = e.animate(a, c);
58
- return u.finished.then(() => u.cancel());
208
+ const h = e.animate(r, u);
209
+ return h.finished.then(() => h.cancel());
59
210
  }
60
- async function Se(e, a) {
61
- const c = e(a), u = {
62
- duration: a.duration,
63
- easing: a.easing,
211
+ async function Le(e, r) {
212
+ const u = e(r), h = {
213
+ duration: r.duration,
214
+ easing: r.easing,
64
215
  fill: "both",
65
- ...c.options
216
+ ...u.options
66
217
  };
67
218
  await Promise.all([
68
- ee(a.enteringElement, c.entering, u),
69
- ee(a.leavingElement, c.leaving, u)
219
+ oe(r.enteringElement, u.entering, h),
220
+ oe(r.leavingElement, u.leaving, h)
70
221
  ]);
71
222
  }
72
- const N = Symbol("stack-router");
73
- function De() {
74
- const e = window.history.state;
75
- return typeof (e == null ? void 0 : e.position) == "number" ? e.position : window.history.length;
76
- }
77
- function M(e, a) {
78
- return a || (e === "pop" ? "back" : e === "replace" ? "none" : "forward");
223
+ const O = Symbol("stack-router");
224
+ function Q(e, r) {
225
+ return r || (e === "pop" ? "back" : e === "replace" ? "none" : "forward");
79
226
  }
80
- function Be(e) {
81
- const a = me(e), c = [], u = te(), d = e.transitionDuration ?? 210, D = e.transitionEasing ?? Re, E = e.transition ?? Z, m = {
82
- ...Ie,
227
+ function Ge(e) {
228
+ const r = [], u = re(), h = e.transitionDuration ?? 210, f = e.transitionEasing ?? Ee, v = e.transition ?? N, D = {
229
+ ...xe,
83
230
  ...e.transitions
84
- }, w = e.maxStackSize ?? 30;
85
- let f = -1, i, b = !1;
86
- const R = (n, r, s, l, h = !1, k = "stack") => {
87
- i = {
88
- action: n,
89
- direction: M(n, r),
90
- source: k,
91
- delta: s,
92
- reuse: l == null ? void 0 : l.reuse,
93
- transition: l == null ? void 0 : l.transition,
94
- duration: l == null ? void 0 : l.duration,
95
- easing: l == null ? void 0 : l.easing,
96
- resetRoot: h
231
+ }, y = e.maxStackSize ?? 30;
232
+ let p = -1, c, P = !1;
233
+ const S = Pe(
234
+ e.history,
235
+ () => {
236
+ c = void 0;
237
+ },
238
+ (s) => {
239
+ p >= 0 && (r[p].position = s);
240
+ }
241
+ ), m = Ie(e), R = (s, n, l, k, w = !1, E = "stack") => {
242
+ c = {
243
+ action: s,
244
+ direction: Q(s, n),
245
+ source: E,
246
+ delta: l,
247
+ reuse: k == null ? void 0 : k.reuse,
248
+ transition: k == null ? void 0 : k.transition,
249
+ duration: k == null ? void 0 : k.duration,
250
+ easing: k == null ? void 0 : k.easing,
251
+ resetRoot: w
97
252
  };
98
- }, K = (n, r) => {
99
- const s = (i == null ? void 0 : i.action) ?? "push", l = M(s, i == null ? void 0 : i.direction), h = u.value, k = s === "push" && l === "forward", U = T(n);
253
+ }, T = (s, n) => {
254
+ const l = (c == null ? void 0 : c.action) ?? "push", k = Q(l, c == null ? void 0 : c.direction), w = u.value, E = l === "push" && k === "forward", X = b(s);
100
255
  return {
101
- id: J("route"),
102
- key: n.fullPath,
103
- fullPath: n.fullPath,
104
- pathname: n.path,
105
- params: n.params,
106
- query: n.query,
107
- action: s,
108
- direction: l,
109
- reuse: (i == null ? void 0 : i.reuse) ?? !1,
110
- source: (i == null ? void 0 : i.source) ?? "stack",
111
- entryDirection: l,
112
- lastPathname: (h == null ? void 0 : h.pathname) || (r.name ? r.path : void 0),
113
- pushedByRoute: k ? h == null ? void 0 : h.pathname : h == null ? void 0 : h.pushedByRoute,
114
- position: De(),
115
- delta: i == null ? void 0 : i.delta,
116
- transition: (i == null ? void 0 : i.transition) ?? E,
117
- transitionDuration: (i == null ? void 0 : i.duration) ?? d,
118
- transitionEasing: (i == null ? void 0 : i.easing) ?? D,
119
- cache: U
256
+ id: W("route"),
257
+ key: s.fullPath,
258
+ fullPath: s.fullPath,
259
+ pathname: s.path,
260
+ params: s.params,
261
+ query: s.query,
262
+ action: l,
263
+ direction: k,
264
+ reuse: (c == null ? void 0 : c.reuse) ?? !1,
265
+ source: (c == null ? void 0 : c.source) ?? "stack",
266
+ entryDirection: k,
267
+ lastPathname: (w == null ? void 0 : w.pathname) || (n.name ? n.path : void 0),
268
+ pushedByRoute: E ? w == null ? void 0 : w.pathname : w == null ? void 0 : w.pushedByRoute,
269
+ position: S.position,
270
+ delta: c == null ? void 0 : c.delta,
271
+ transition: (c == null ? void 0 : c.transition) ?? v,
272
+ transitionDuration: (c == null ? void 0 : c.duration) ?? h,
273
+ transitionEasing: (c == null ? void 0 : c.easing) ?? f,
274
+ cache: X
120
275
  };
121
- }, T = (n) => {
122
- const r = n.meta.stack;
123
- return n.meta.stackCache !== !1 && (r == null ? void 0 : r.cache) !== !1;
124
- }, $ = () => {
125
- if (w <= 0 || c.length <= w) return;
126
- const n = c.length - w;
127
- c.splice(0, n), f = Math.max(0, f - n);
128
- }, W = (n) => {
129
- if (n.action === "pop") {
130
- let r = -1;
131
- if (n.direction === "forward" || (n.delta ?? 0) > 0) {
132
- for (let s = f + 1; s < c.length; s++)
133
- if (c[s].key === n.key) {
134
- r = s;
276
+ }, b = (s) => {
277
+ const n = s.meta.stack;
278
+ return s.meta.stackCache !== !1 && (n == null ? void 0 : n.cache) !== !1;
279
+ }, x = () => {
280
+ if (y <= 0 || r.length <= y) return;
281
+ const s = r.length - y;
282
+ r.splice(0, s), p = Math.max(0, p - s);
283
+ }, A = (s) => {
284
+ if (s.action === "pop") {
285
+ let n = -1;
286
+ if (s.direction === "forward" || (s.delta ?? 0) > 0) {
287
+ for (let l = p + 1; l < r.length; l++)
288
+ if (r[l].key === s.key) {
289
+ n = l;
135
290
  break;
136
291
  }
137
292
  } else
138
- for (let s = f - 1; s >= 0; s--)
139
- if (c[s].key === n.key) {
140
- r = s;
293
+ for (let l = p - 1; l >= 0; l--)
294
+ if (r[l].key === s.key) {
295
+ n = l;
141
296
  break;
142
297
  }
143
- if (r >= 0) {
144
- const s = c[r];
145
- c[r] = {
298
+ if (n >= 0) {
299
+ const l = r[n];
300
+ r[n] = {
301
+ ...l,
146
302
  ...s,
147
- ...n,
148
- id: s.id,
149
- reuse: s.reuse,
150
- source: n.source,
151
- entryDirection: s.entryDirection,
152
- transition: s.transition,
153
- transitionDuration: s.transitionDuration,
154
- transitionEasing: s.transitionEasing
155
- }, f = r;
303
+ id: l.id,
304
+ reuse: l.reuse,
305
+ source: s.source,
306
+ entryDirection: l.entryDirection,
307
+ transition: l.transition,
308
+ transitionDuration: l.transitionDuration,
309
+ transitionEasing: l.transitionEasing
310
+ }, p = n;
156
311
  } else
157
- c.push({
158
- ...n,
312
+ r.push({
313
+ ...s,
159
314
  direction: "none",
160
315
  entryDirection: "none",
161
316
  transition: "none",
162
317
  isStackFallback: !0
163
- }), f = c.length - 1;
164
- } else if (n.action === "replace") {
165
- if (i != null && i.resetRoot) {
166
- c.splice(0, c.length, n), f = 0, u.value = c[f];
318
+ }), p = r.length - 1;
319
+ } else if (s.action === "replace") {
320
+ if (c != null && c.resetRoot) {
321
+ r.splice(0, r.length, s), p = 0, u.value = r[p];
167
322
  return;
168
323
  }
169
- f >= 0 ? c[f] = n : (c.push(n), f = 0);
324
+ p >= 0 ? r[p] = s : (r.push(s), p = 0);
170
325
  } else
171
- f < c.length - 1 && c.splice(f + 1), c.push(n), f = c.length - 1;
172
- $(), u.value = c[f];
326
+ p < r.length - 1 && r.splice(p + 1), r.push(s), p = r.length - 1;
327
+ x(), u.value = r[p];
173
328
  };
174
- e.history.listen((n, r, s) => {
175
- const l = "delta" in s ? s.delta : void 0, h = s.direction === "back" ? "back" : s.direction === "forward" ? "forward" : void 0;
176
- i ? (i.delta = l, i.direction = M(
177
- i.action,
178
- i.direction ?? h
329
+ e.history.listen((s, n, l) => {
330
+ const k = "delta" in l ? l.delta : void 0, w = l.direction === "back" ? "back" : l.direction === "forward" ? "forward" : void 0;
331
+ c ? (c.delta = k, c.direction = Q(
332
+ c.action,
333
+ c.direction ?? w
179
334
  )) : R(
180
- s.type === "pop" ? "pop" : s.type,
181
- h,
182
- l,
335
+ l.type === "pop" ? "pop" : l.type,
336
+ w,
337
+ k,
183
338
  void 0,
184
339
  !1,
185
340
  "external"
186
341
  );
187
- }), a.beforeEach((n) => !((i == null ? void 0 : i.action) === "pop" && b && !c.some((r) => r.fullPath === n.fullPath))), a.afterEach((n, r, s) => {
188
- if (s) {
189
- i = void 0;
342
+ }), m.beforeEach((s) => !((c == null ? void 0 : c.action) === "pop" && P && !r.some((n) => n.fullPath === s.fullPath))), m.afterEach((s, n, l) => {
343
+ if (l) {
344
+ c = void 0;
190
345
  return;
191
346
  }
192
- W(K(n, r)), i = void 0;
347
+ A(T(s, n)), c = void 0, S.restoreCurrent();
193
348
  });
194
- const g = a.push.bind(a), I = a.replace.bind(a), z = a.back.bind(a), x = a.forward.bind(a), j = a.go.bind(a), L = (n, r) => (R(
349
+ const g = m.push.bind(m), _ = m.replace.bind(m), B = m.back.bind(m), C = m.forward.bind(m), H = m.go.bind(m), V = async (s, n) => (await S.whenSettled(), R(
195
350
  "push",
196
- (r == null ? void 0 : r.direction) ?? "forward",
351
+ (n == null ? void 0 : n.direction) ?? "forward",
197
352
  void 0,
198
- r
199
- ), g(n)), A = (n, r) => (R(
353
+ n
354
+ ), g(s)), F = async (s, n) => (await S.whenSettled(), R(
200
355
  "replace",
201
- (r == null ? void 0 : r.direction) ?? "root",
356
+ (n == null ? void 0 : n.direction) ?? "root",
202
357
  void 0,
203
- r
204
- ), I(n)), B = (n, r) => {
205
- const s = a.resolve(n).fullPath;
206
- let l = -1;
207
- for (let k = f; k >= 0; k--)
208
- if (c[k].fullPath === s) {
209
- l = k;
358
+ n
359
+ ), _(s)), K = (s, n) => {
360
+ const l = m.resolve(s).fullPath;
361
+ let k = -1;
362
+ for (let E = p; E >= 0; E--)
363
+ if (r[E].fullPath === l) {
364
+ k = E;
210
365
  break;
211
366
  }
212
- if (l < 0) return !1;
213
- const h = l - f;
214
- return h === 0 || (R(
215
- "pop",
216
- (r == null ? void 0 : r.direction) ?? "back",
217
- h,
218
- r
219
- ), j(h)), !0;
220
- }, _ = (n, r) => {
221
- const s = a.resolve(n).fullPath;
222
- if (f >= 0 && a.currentRoute.value.fullPath === s) {
223
- const l = c[f], h = {
224
- ...l,
225
- id: J("route"),
367
+ if (k < 0) return !1;
368
+ const w = r[k];
369
+ return S.whenSettled().then(() => {
370
+ const E = w.position - S.position;
371
+ E !== 0 && (R(
372
+ "pop",
373
+ (n == null ? void 0 : n.direction) ?? "back",
374
+ E,
375
+ n
376
+ ), H(E));
377
+ }), !0;
378
+ }, L = async (s, n) => {
379
+ await S.whenSettled();
380
+ const l = m.resolve(s).fullPath;
381
+ if (p >= 0 && m.currentRoute.value.fullPath === l) {
382
+ const k = r[p], w = {
383
+ ...k,
384
+ id: W("route"),
226
385
  action: "replace",
227
- direction: (r == null ? void 0 : r.direction) ?? "root",
386
+ direction: (n == null ? void 0 : n.direction) ?? "root",
228
387
  source: "stack",
229
- entryDirection: (r == null ? void 0 : r.direction) ?? "root",
388
+ entryDirection: (n == null ? void 0 : n.direction) ?? "root",
230
389
  delta: void 0,
231
- reuse: (r == null ? void 0 : r.reuse) ?? l.reuse,
232
- transition: (r == null ? void 0 : r.transition) ?? l.transition,
233
- transitionDuration: (r == null ? void 0 : r.duration) ?? l.transitionDuration,
234
- transitionEasing: (r == null ? void 0 : r.easing) ?? l.transitionEasing,
390
+ reuse: (n == null ? void 0 : n.reuse) ?? k.reuse,
391
+ transition: (n == null ? void 0 : n.transition) ?? k.transition,
392
+ transitionDuration: (n == null ? void 0 : n.duration) ?? k.transitionDuration,
393
+ transitionEasing: (n == null ? void 0 : n.easing) ?? k.transitionEasing,
235
394
  cache: !0,
236
395
  isStackFallback: !1
237
396
  };
238
- return c.splice(0, c.length, h), f = 0, b = !0, u.value = h, Promise.resolve(void 0);
397
+ return r.splice(0, r.length, w), p = 0, P = !0, u.value = w, Promise.resolve(void 0);
239
398
  }
240
399
  return R(
241
400
  "replace",
242
- (r == null ? void 0 : r.direction) ?? "root",
401
+ (n == null ? void 0 : n.direction) ?? "root",
243
402
  void 0,
244
- r,
403
+ n,
245
404
  !0
246
- ), b = !0, I(n);
247
- }, V = () => {
248
- R("pop", "back", -1), z();
249
- }, F = () => {
250
- R("pop", "forward", 1), x();
251
- }, p = a;
252
- p.push = L, p.replace = A, p.popTo = B, p.resetRoot = _, p.back = V, p.forward = F;
253
- const t = {
254
- router: p,
255
- transitionDuration: d,
256
- transitionEasing: D,
257
- transition: E,
258
- transitions: m,
259
- maxStackSize: w,
405
+ ), P = !0, _(s);
406
+ }, a = () => {
407
+ S.whenSettled().then(() => {
408
+ R("pop", "back", -1), B();
409
+ });
410
+ }, d = () => {
411
+ S.whenSettled().then(() => {
412
+ R("pop", "forward", 1), C();
413
+ });
414
+ }, t = m;
415
+ t.push = V, t.replace = F, t.popTo = K, t.resetRoot = L, t.back = a, t.forward = d;
416
+ const o = {
417
+ router: t,
418
+ transitionDuration: h,
419
+ transitionEasing: f,
420
+ transition: v,
421
+ transitions: D,
422
+ maxStackSize: y,
260
423
  shouldTransition: e.shouldTransition,
261
424
  current: u,
262
425
  get history() {
263
- return c;
426
+ return r;
264
427
  },
265
- canGoBack: (n = 1) => f - n >= 0,
266
- push: L,
267
- replace: A,
268
- popTo: B,
269
- resetRoot: _,
270
- back: V,
271
- forward: F
272
- }, o = a.install.bind(a);
273
- return a.install = (n) => {
274
- n.provide(N, t), o(n);
275
- }, p;
428
+ canGoBack: (s = 1) => p - s >= 0,
429
+ push: V,
430
+ replace: F,
431
+ popTo: K,
432
+ resetRoot: L,
433
+ back: a,
434
+ forward: d
435
+ }, i = m.install.bind(m);
436
+ return m.install = (s) => {
437
+ s.provide(O, o), s.provide(ce, S), i(s);
438
+ }, t;
276
439
  }
277
- const re = "onPageWillEnter", Q = "onPageDidEnter", oe = "onPageWillLeave", ne = "onPageDidLeave";
278
- function Te(e, a, c) {
279
- if (!c)
440
+ const ue = "onPageWillEnter", Z = "onPageDidEnter", ie = "onPageWillLeave", le = "onPageDidLeave";
441
+ function _e(e, r, u) {
442
+ if (!u)
280
443
  throw new Error(`${e} must be called inside setup().`);
281
- const u = c.proxy, d = u[e] ?? [];
282
- d.push(() => {
283
- c.isUnmounted || a();
284
- }), u[e] = d, c.exposed && (c.exposed[e] = d);
444
+ const h = u.proxy, f = h[e] ?? [];
445
+ f.push(() => {
446
+ u.isUnmounted || r();
447
+ }), h[e] = f, u.exposed && (u.exposed[e] = f);
285
448
  }
286
- function H(e) {
287
- return (a, c = ie()) => Te(e, a, c);
449
+ function U(e) {
450
+ return (r, u = pe()) => _e(e, r, u);
288
451
  }
289
- const _e = H(re), Ve = H(Q), Fe = H(oe), Ce = H(ne);
290
- function Ge() {
291
- const e = C(N);
452
+ const $e = U(ue), ze = U(Z), je = U(ie), Me = U(le);
453
+ function We() {
454
+ const e = $(O);
292
455
  if (!e)
293
456
  throw new Error("useStackRouter must be used after createStackRouter().");
294
457
  return {
@@ -302,174 +465,215 @@ function Ge() {
302
465
  forward: e.forward
303
466
  };
304
467
  }
305
- function ae() {
306
- const e = C(N);
468
+ function de() {
469
+ const e = $(O);
307
470
  if (!e)
308
471
  throw new Error("RouterOutlet must be used with createStackRouter().");
309
472
  return e;
310
473
  }
311
- function P(e, a) {
312
- const c = e.value;
313
- if (!c) return;
314
- const u = c[a];
315
- Array.isArray(u) ? u.forEach((d) => d()) : typeof u == "function" && u.call(c);
474
+ function j(e, r) {
475
+ const u = e.value;
476
+ if (!u) return;
477
+ const h = u[r];
478
+ Array.isArray(h) ? h.forEach((f) => f()) : typeof h == "function" && h.call(u);
479
+ }
480
+ const fe = Symbol("stack-page-scope");
481
+ function Be() {
482
+ const e = $(fe);
483
+ if (!e)
484
+ throw new Error("Page history state must be used inside RouterOutlet.");
485
+ return e;
316
486
  }
317
- function S(e) {
487
+ const Ce = q({
488
+ name: "StackPageScope",
489
+ props: {
490
+ id: { type: String, required: !0 },
491
+ routeInfo: { type: Object, required: !0 },
492
+ routeIds: { type: Object, required: !0 },
493
+ active: { type: Boolean, required: !0 }
494
+ },
495
+ setup(e, { slots: r }) {
496
+ const u = z(!1);
497
+ return ne(() => {
498
+ u.value = !0;
499
+ }), se(fe, {
500
+ id: e.id,
501
+ routeId: G(() => e.routeInfo.id),
502
+ fullPath: G(() => e.routeInfo.fullPath),
503
+ routeIds: G(() => e.routeIds),
504
+ isActive: G(() => e.active && !u.value)
505
+ }), () => r.default();
506
+ }
507
+ });
508
+ function M(e) {
318
509
  e.classList.remove("rs-page-hidden", "rs-page-invisible"), e.removeAttribute("aria-hidden");
319
510
  }
320
- function q(e) {
321
- e.classList.add("rs-page-hidden"), e.setAttribute("aria-hidden", "true");
511
+ function Y(e) {
512
+ const r = e.ownerDocument.activeElement;
513
+ r instanceof HTMLElement && e.contains(r) && r.blur(), e.classList.add("rs-page-hidden"), e.setAttribute("aria-hidden", "true");
322
514
  }
323
- function ce(e) {
324
- var a;
325
- return (a = e.components) == null ? void 0 : a.default;
515
+ function he(e) {
516
+ var r;
517
+ return (r = e.components) == null ? void 0 : r.default;
326
518
  }
327
- function ge(e) {
328
- const a = ce(e);
329
- return a !== void 0 && typeof a == "object" && "name" in a && a.name === "RouterView";
519
+ function He(e) {
520
+ const r = he(e);
521
+ return r !== void 0 && typeof r == "object" && "name" in r && r.name === "RouterView";
330
522
  }
331
- const He = Y({
523
+ const qe = q({
332
524
  name: "RouterOutlet",
333
525
  setup() {
334
- const e = ae(), a = ye(), c = C(ke), u = C(v, void 0), d = X(() => {
335
- const t = u == null ? void 0 : u.value;
526
+ const e = de(), r = Se(), u = $(Re), h = $(ee, void 0), f = G(() => {
527
+ const t = h == null ? void 0 : h.value;
336
528
  if (!t) return 0;
337
- const o = a.matched.findIndex(
338
- (n) => n === t
529
+ const o = r.matched.findIndex(
530
+ (i) => i === t
339
531
  );
340
532
  return o >= 0 ? o + 1 : 0;
341
- }), D = X(() => a.matched[d.value]), E = X(() => {
342
- for (let t = d.value; t < a.matched.length; t++) {
343
- const o = a.matched[t];
344
- if (!ge(o))
533
+ }), v = G(() => r.matched[f.value]), D = G(() => {
534
+ for (let t = f.value; t < r.matched.length; t++) {
535
+ const o = r.matched[t];
536
+ if (!He(o))
345
537
  return o;
346
538
  }
347
- return D.value;
348
- }), m = te([]), w = G("");
349
- let f = 0;
350
- ue(v, E);
351
- const i = (t) => m.value.find((o) => o.id === t), b = (t) => m.value.find((o) => o.routeIds.has(t)), R = (t) => m.value.find((o) => o.routeKey === t), K = (t) => t.action === "push" && t.direction === "forward" && !t.reuse && m.value.some((o) => o.routeKey === t.key), T = (t) => {
352
- m.value.forEach((o) => {
353
- o.pageElement && (o === t ? S(o.pageElement) : q(o.pageElement));
539
+ return v.value;
540
+ }), y = re([]), p = z("");
541
+ let c = 0;
542
+ se(ee, D);
543
+ const P = (t) => y.value.find((o) => o.id === t), S = (t) => y.value.find((o) => o.routeIds.has(t)), m = (t) => y.value.find((o) => o.routeKey === t), R = (t) => t.action === "push" && t.direction === "forward" && !t.reuse && y.value.some((o) => o.routeKey === t.key), T = (t) => {
544
+ y.value.forEach((o) => {
545
+ o.pageElement && (o === t ? M(o.pageElement) : Y(o.pageElement));
354
546
  });
355
- }, $ = (t) => {
547
+ }, b = (t) => {
356
548
  const o = e.history.findIndex(
357
- (r) => r.id === t.routeInfo.id
549
+ (s) => s.id === t.routeInfo.id
358
550
  );
359
551
  if (o < 0) return;
360
- const n = new Set(
361
- e.history.slice(0, o + 1).map((r) => r.id)
552
+ const i = new Set(
553
+ e.history.slice(0, o + 1).map((s) => s.id)
362
554
  );
363
- m.value.forEach((r) => {
364
- r.routeIds = new Set(
365
- [...r.routeIds].filter((s) => n.has(s))
555
+ y.value.forEach((s) => {
556
+ s.routeIds = new Set(
557
+ [...s.routeIds].filter((n) => i.has(n))
366
558
  );
367
- }), m.value = m.value.filter(
368
- (r) => r === t || r.routeIds.size > 0
559
+ }), y.value = y.value.filter(
560
+ (s) => s === t || s.routeIds.size > 0
369
561
  );
370
- }, W = (t) => {
371
- m.value = m.value.filter((o) => o !== t);
372
- }, g = (t) => {
562
+ }, x = (t) => {
563
+ y.value = y.value.filter((o) => o !== t);
564
+ }, A = (t) => {
373
565
  const o = new Set(
374
- e.history.map((n) => n.id)
566
+ e.history.map((i) => i.id)
375
567
  );
376
- m.value.forEach((n) => {
377
- n.routeIds = new Set(
378
- [...n.routeIds].filter((r) => o.has(r))
568
+ y.value.forEach((i) => {
569
+ i.routeIds = new Set(
570
+ [...i.routeIds].filter((s) => o.has(s))
379
571
  );
380
- }), m.value = m.value.filter(
381
- (n) => n === t || n.routeInfo.cache && n.routeIds.size > 0
572
+ }), y.value = y.value.filter(
573
+ (i) => i === t || i.routeInfo.cache && i.routeIds.size > 0
382
574
  );
383
- }, I = (t) => {
384
- var n;
575
+ }, g = (t) => {
576
+ var i;
385
577
  const o = t.props.default;
386
- return o ? o === !0 ? ((n = e.current.value) == null ? void 0 : n.params) ?? {} : typeof o == "function" ? o(c) : o : {};
387
- }, z = (t, o) => t.routeInfo.action === "pop" ? o.routeInfo.transition ?? t.routeInfo.transition ?? e.transition : t.routeInfo.transition ?? e.transition, x = (t) => t.entryDirection === "none" || t.entryDirection === "root" || t.transition === "none", j = (t, o) => t.routeInfo.direction === "forward" ? x(t.routeInfo) : x(o.routeInfo), L = (t, o) => !(t.routeInfo.isStackFallback || t.routeInfo.direction === "none" || t.routeInfo.direction === "root" || t.routeInfo.action === "pop" && j(t, o)), A = (t, o) => {
388
- var r;
389
- const n = L(t, o);
390
- return ((r = e.shouldTransition) == null ? void 0 : r.call(e, {
578
+ return o ? o === !0 ? ((i = e.current.value) == null ? void 0 : i.params) ?? {} : typeof o == "function" ? o(u) : o : {};
579
+ }, _ = (t, o) => t.routeInfo.action === "pop" ? o.routeInfo.transition ?? t.routeInfo.transition ?? e.transition : t.routeInfo.transition ?? e.transition, B = (t) => t.entryDirection === "none" || t.entryDirection === "root" || t.transition === "none", C = (t, o) => t.routeInfo.direction === "forward" ? B(t.routeInfo) : B(o.routeInfo), H = (t, o) => !(t.routeInfo.isStackFallback || t.routeInfo.direction === "none" || t.routeInfo.direction === "root" || t.routeInfo.action === "pop" && C(t, o)), V = (t, o) => {
580
+ var s;
581
+ const i = H(t, o);
582
+ return ((s = e.shouldTransition) == null ? void 0 : s.call(e, {
391
583
  action: t.routeInfo.action,
392
584
  direction: t.routeInfo.direction,
393
585
  source: t.routeInfo.source,
394
586
  entering: t.routeInfo,
395
587
  leaving: o.routeInfo,
396
- defaultResult: n
397
- })) ?? n;
398
- }, B = (t, o) => t.routeInfo.action === "pop" ? o.routeInfo.transitionDuration ?? t.routeInfo.transitionDuration ?? e.transitionDuration : t.routeInfo.transitionDuration ?? e.transitionDuration, _ = (t, o) => t.routeInfo.action === "pop" ? o.routeInfo.transitionEasing ?? t.routeInfo.transitionEasing ?? e.transitionEasing : t.routeInfo.transitionEasing ?? e.transitionEasing, V = async (t, o) => {
399
- const n = ++f;
400
- await fe();
401
- const r = t.pageElement;
402
- if (!r) return;
403
- if (P(t.componentRef, re), !o || o === t || !o.pageElement) {
404
- S(r), P(t.componentRef, Q), g(t), T(t);
588
+ defaultResult: i
589
+ })) ?? i;
590
+ }, F = (t, o) => t.routeInfo.action === "pop" ? o.routeInfo.transitionDuration ?? t.routeInfo.transitionDuration ?? e.transitionDuration : t.routeInfo.transitionDuration ?? e.transitionDuration, K = (t, o) => t.routeInfo.action === "pop" ? o.routeInfo.transitionEasing ?? t.routeInfo.transitionEasing ?? e.transitionEasing : t.routeInfo.transitionEasing ?? e.transitionEasing, L = async (t, o) => {
591
+ const i = ++c;
592
+ await ye();
593
+ const s = t.pageElement;
594
+ if (!s) return;
595
+ if (j(t.componentRef, ue), !o || o === t || !o.pageElement) {
596
+ M(s), j(t.componentRef, Z), A(t), T(t);
405
597
  return;
406
598
  }
407
- const s = o.pageElement, l = A(t, o), h = l ? z(t, o) : "none", k = l ? B(t, o) : 0, U = _(t, o), se = Pe(
408
- h || Z,
599
+ const n = o.pageElement, l = V(t, o), k = l ? _(t, o) : "none", w = l ? F(t, o) : 0, E = K(t, o), X = Ae(
600
+ k || N,
409
601
  e.transitions
410
602
  );
411
- P(o.componentRef, oe), S(r), S(s), await Se(se, {
603
+ j(o.componentRef, ie), M(s), M(n), await Le(X, {
412
604
  direction: t.routeInfo.direction,
413
605
  action: t.routeInfo.action,
414
606
  routeInfo: t.routeInfo,
415
- enteringElement: r,
416
- leavingElement: s,
417
- duration: k,
418
- easing: U
419
- }), n === f && (q(s), P(o.componentRef, ne), P(t.componentRef, Q), t.routeInfo.action === "pop" ? $(t) : t.routeInfo.action === "replace" && W(o), g(t), T(t));
420
- }, F = async () => {
421
- const t = E.value, o = e.current.value;
607
+ enteringElement: s,
608
+ leavingElement: n,
609
+ duration: w,
610
+ easing: E
611
+ }), i === c && (Y(n), j(o.componentRef, le), j(t.componentRef, Z), t.routeInfo.action === "pop" ? b(t) : t.routeInfo.action === "replace" && x(o), A(t), T(t));
612
+ }, a = async () => {
613
+ const t = D.value, o = e.current.value;
422
614
  if (!t || !o) return;
423
- const n = ce(t);
424
- if (!n) return;
425
- const r = i(w.value);
426
- let s = b(o.id);
427
- !s && !K(o) && (s = R(o.key)), s ? (s.routeIds.add(o.id), s.routeKey = o.key, s.routeInfo = o, s.matchedRoute = t, s.component = n, s.props = I(t), s.mounted = !0) : (s = {
428
- id: J("view"),
615
+ const i = he(t);
616
+ if (!i) return;
617
+ const s = P(p.value);
618
+ let n = S(o.id);
619
+ !n && !R(o) && (n = m(o.key)), n ? (n.routeIds.add(o.id), n.routeKey = o.key, n.routeInfo = o, n.matchedRoute = t, n.component = i, n.props = g(t), n.mounted = !0) : (n = {
620
+ id: W("view"),
429
621
  routeKey: o.key,
430
622
  routeIds: /* @__PURE__ */ new Set([o.id]),
431
623
  routeInfo: o,
432
624
  matchedRoute: t,
433
- component: n,
434
- props: I(t),
435
- componentRef: G(),
625
+ component: i,
626
+ props: g(t),
627
+ componentRef: z(),
436
628
  mounted: !0
437
- }, m.value = [...m.value, s]), w.value = s.id, await V(s, r);
629
+ }, y.value = [...y.value, n]), p.value = n.id, await L(n, s);
438
630
  };
439
- return le(
631
+ return ke(
440
632
  () => {
441
633
  var t;
442
- return [(t = e.current.value) == null ? void 0 : t.id, E.value];
634
+ return [(t = e.current.value) == null ? void 0 : t.id, D.value];
443
635
  },
444
636
  () => {
445
- F();
637
+ a();
446
638
  },
447
639
  { immediate: !0 }
448
- ), de(() => {
449
- f++, m.value = [];
640
+ ), me(() => {
641
+ c++, y.value = [];
450
642
  }), {
451
- injectedRoute: c,
452
- viewItems: m,
643
+ injectedRoute: u,
644
+ viewItems: y,
645
+ activeViewId: p,
453
646
  registerStackPage: (t, o) => {
454
- t.pageElement = o, t.id === w.value ? S(o) : q(o);
647
+ t.pageElement = o, t.id === p.value ? M(o) : Y(o);
455
648
  }
456
649
  };
457
650
  },
458
651
  render() {
459
- return y(
652
+ return I(
460
653
  "div",
461
654
  { class: "rs-outlet" },
462
655
  this.viewItems.filter((e) => e.mounted).map(
463
- (e) => y(e.component, {
464
- key: e.id,
465
- ref: e.componentRef,
466
- ...e.props,
467
- registerStackPage: (a) => this.registerStackPage(e, a)
468
- })
656
+ (e) => I(
657
+ Ce,
658
+ {
659
+ key: e.id,
660
+ id: e.id,
661
+ routeInfo: e.routeInfo,
662
+ routeIds: e.routeIds,
663
+ active: e.id === this.activeViewId
664
+ },
665
+ {
666
+ default: () => I(e.component, {
667
+ ref: e.componentRef,
668
+ ...e.props,
669
+ registerStackPage: (r) => this.registerStackPage(e, r)
670
+ })
671
+ }
672
+ )
469
673
  )
470
674
  );
471
675
  }
472
- }), Ke = Y({
676
+ }), Ue = q({
473
677
  name: "RouterPage",
474
678
  props: {
475
679
  registerStackPage: {
@@ -477,25 +681,25 @@ const He = Y({
477
681
  default: void 0
478
682
  }
479
683
  },
480
- setup(e, { attrs: a, slots: c }) {
481
- const u = G();
482
- return he(() => {
483
- var d;
484
- u.value && ((d = e.registerStackPage) == null || d.call(e, u.value));
684
+ setup(e, { attrs: r, slots: u }) {
685
+ const h = z();
686
+ return ae(() => {
687
+ var f;
688
+ h.value && ((f = e.registerStackPage) == null || f.call(e, h.value));
485
689
  }), () => {
486
- var d;
487
- return y(
690
+ var f;
691
+ return I(
488
692
  "section",
489
693
  {
490
- ...a,
491
- ref: u,
492
- class: ["rs-page", a.class]
694
+ ...r,
695
+ ref: h,
696
+ class: ["rs-page", r.class]
493
697
  },
494
- (d = c.default) == null ? void 0 : d.call(c)
698
+ (f = u.default) == null ? void 0 : f.call(u)
495
699
  );
496
700
  };
497
701
  }
498
- }), $e = Y({
702
+ }), Xe = q({
499
703
  name: "StackRouterDebugPanel",
500
704
  props: {
501
705
  initialOpen: {
@@ -504,52 +708,52 @@ const He = Y({
504
708
  }
505
709
  },
506
710
  setup(e) {
507
- const a = ae(), c = G(e.initialOpen);
711
+ const r = de(), u = z(e.initialOpen);
508
712
  return () => {
509
- const u = a.current.value;
510
- return y("aside", { class: "rs-debug-panel" }, [
511
- y(
713
+ const h = r.current.value;
714
+ return I("aside", { class: "rs-debug-panel" }, [
715
+ I(
512
716
  "button",
513
717
  {
514
718
  class: "rs-debug-toggle",
515
719
  type: "button",
516
720
  onClick: () => {
517
- c.value = !c.value;
721
+ u.value = !u.value;
518
722
  }
519
723
  },
520
- c.value ? "Stack x" : "Stack"
724
+ u.value ? "Stack x" : "Stack"
521
725
  ),
522
- c.value ? y("section", { class: "rs-debug-body" }, [
523
- y("header", [
524
- y("strong", "Router Stack"),
525
- y("span", `${a.history.length} pages`)
726
+ u.value ? I("section", { class: "rs-debug-body" }, [
727
+ I("header", [
728
+ I("strong", "Router Stack"),
729
+ I("span", `${r.history.length} pages`)
526
730
  ]),
527
- y("dl", [
528
- y("dt", "current"),
529
- y("dd", (u == null ? void 0 : u.fullPath) ?? "-"),
530
- y("dt", "canGoBack"),
531
- y("dd", String(a.canGoBack()))
731
+ I("dl", [
732
+ I("dt", "current"),
733
+ I("dd", (h == null ? void 0 : h.fullPath) ?? "-"),
734
+ I("dt", "canGoBack"),
735
+ I("dd", String(r.canGoBack()))
532
736
  ]),
533
- y(
737
+ I(
534
738
  "ol",
535
- a.history.map(
536
- (d) => y(
739
+ r.history.map(
740
+ (f) => I(
537
741
  "li",
538
742
  {
539
- key: d.id,
743
+ key: f.id,
540
744
  class: {
541
- "rs-debug-active": d.id === (u == null ? void 0 : u.id),
542
- "rs-debug-no-cache": !d.cache
745
+ "rs-debug-active": f.id === (h == null ? void 0 : h.id),
746
+ "rs-debug-no-cache": !f.cache
543
747
  }
544
748
  },
545
749
  [
546
- y("code", d.fullPath),
547
- y("span", [
548
- `${d.action}/${d.direction}`,
549
- ` source:${d.source}`,
550
- ` entry:${d.entryDirection}`,
551
- ` cache:${d.cache ? "yes" : "no"}`,
552
- ` transition:${d.transition ?? "-"}`
750
+ I("code", f.fullPath),
751
+ I("span", [
752
+ `${f.action}/${f.direction}`,
753
+ ` source:${f.source}`,
754
+ ` entry:${f.entryDirection}`,
755
+ ` cache:${f.cache ? "yes" : "no"}`,
756
+ ` transition:${f.transition ?? "-"}`
553
757
  ])
554
758
  ]
555
759
  )
@@ -560,23 +764,41 @@ const He = Y({
560
764
  };
561
765
  }
562
766
  });
767
+ function Je(e) {
768
+ const r = Be(), u = $(ce);
769
+ if (!u)
770
+ throw new Error(
771
+ "usePageHistoryState must be used after createStackRouter()."
772
+ );
773
+ const h = z(!1), f = u.register(r, e.key, (v, D) => {
774
+ h.value = v.active, D && e.onChange(v);
775
+ });
776
+ return ae(f.restore), ne(f.dispose), {
777
+ active: we(h),
778
+ isCurrentPage: r.isActive,
779
+ pushState: (v) => f.push(v),
780
+ removeState: f.remove,
781
+ replaceState: (v) => f.replace(v)
782
+ };
783
+ }
563
784
  export {
564
- je as RouterLink,
565
- He as RouterOutlet,
566
- Ke as RouterPage,
567
- Ue as RouterView,
568
- $e as StackRouterDebugPanel,
569
- Xe as createMemoryHistory,
570
- Be as createStackRouter,
571
- Me as createWebHashHistory,
572
- qe as createWebHistory,
573
- Ae as defineStackTransition,
574
- Ve as onPageDidEnter,
575
- Ce as onPageDidLeave,
576
- _e as onPageWillEnter,
577
- Fe as onPageWillLeave,
578
- N as stackRouterKey,
579
- Je as useRoute,
580
- Qe as useRouter,
581
- Ge as useStackRouter
785
+ Ze as RouterLink,
786
+ qe as RouterOutlet,
787
+ Ue as RouterPage,
788
+ Ne as RouterView,
789
+ Xe as StackRouterDebugPanel,
790
+ Oe as createMemoryHistory,
791
+ Ge as createStackRouter,
792
+ et as createWebHashHistory,
793
+ tt as createWebHistory,
794
+ Ke as defineStackTransition,
795
+ ze as onPageDidEnter,
796
+ Me as onPageDidLeave,
797
+ $e as onPageWillEnter,
798
+ je as onPageWillLeave,
799
+ O as stackRouterKey,
800
+ Je as usePageHistoryState,
801
+ ot as useRoute,
802
+ rt as useRouter,
803
+ We as useStackRouter
582
804
  };