@lazycatcloud/vue-router-stack 0.0.7 → 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 U, 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 Me, createMemoryHistory as Ue, createWebHashHistory as Xe, createWebHistory as qe, useRoute as Je, useRouter as Qe } from "vue-router";
4
- const O = {};
5
- function J(e = "route") {
6
- const o = (O[e] ?? 0) + 1;
7
- return O[e] = o, `${e}-${o}`;
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 o = e === "back";
177
+ }), De = ({ direction: e }) => {
178
+ const r = e === "back";
28
179
  return {
29
- entering: o ? [
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: o ? [
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, o) {
51
- const c = o[e];
52
- return c || o[Z];
201
+ function Ae(e, r) {
202
+ const u = r[e];
203
+ return u || r[N];
53
204
  }
54
- function ee(e, o, c) {
55
- if (!o || !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(o, 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, o) {
61
- const c = e(o), u = {
62
- duration: o.duration,
63
- easing: o.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(o.enteringElement, c.entering, u),
69
- ee(o.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 X(e, o) {
78
- return o || (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 o = 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 = (a, r, s, l, h = !1, k = "stack") => {
87
- i = {
88
- action: a,
89
- direction: X(a, 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 = (a, r) => {
99
- const s = (i == null ? void 0 : i.action) ?? "push", l = X(s, i == null ? void 0 : i.direction), h = u.value, k = s === "push" && l === "forward", M = T(a);
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: a.fullPath,
103
- fullPath: a.fullPath,
104
- pathname: a.path,
105
- params: a.params,
106
- query: a.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: M
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 = (a) => {
122
- const r = a.meta.stack;
123
- return a.meta.stackCache !== !1 && (r == null ? void 0 : r.cache) !== !1;
124
- }, $ = () => {
125
- if (w <= 0 || c.length <= w) return;
126
- const a = c.length - w;
127
- c.splice(0, a), f = Math.max(0, f - a);
128
- }, W = (a) => {
129
- if (a.action === "pop") {
130
- let r = -1;
131
- if (a.direction === "forward" || (a.delta ?? 0) > 0) {
132
- for (let s = f + 1; s < c.length; s++)
133
- if (c[s].key === a.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 === a.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
- ...a,
148
- id: s.id,
149
- reuse: s.reuse,
150
- source: a.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
- ...a,
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 (a.action === "replace") {
165
- if (i != null && i.resetRoot) {
166
- c.splice(0, c.length, a), 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] = a : (c.push(a), 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(a), 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((a, 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 = X(
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
- }), o.beforeEach((a) => !((i == null ? void 0 : i.action) === "pop" && b && !c.some((r) => r.fullPath === a.fullPath))), o.afterEach((a, 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(a, r)), i = void 0;
347
+ A(T(s, n)), c = void 0, S.restoreCurrent();
193
348
  });
194
- const g = o.push.bind(o), I = o.replace.bind(o), z = o.back.bind(o), x = o.forward.bind(o), j = o.go.bind(o), L = (a, 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(a)), A = (a, 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(a)), B = (a, r) => {
205
- const s = o.resolve(a).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
- }, _ = (a, r) => {
221
- const s = o.resolve(a).fullPath;
222
- if (f >= 0 && o.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(a);
247
- }, V = () => {
248
- R("pop", "back", -1), z();
249
- }, F = () => {
250
- R("pop", "forward", 1), x();
251
- }, p = o;
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: (a = 1) => f - a >= 0,
266
- push: L,
267
- replace: A,
268
- popTo: B,
269
- resetRoot: _,
270
- back: V,
271
- forward: F
272
- }, n = o.install.bind(o);
273
- return o.install = (a) => {
274
- a.provide(N, t), n(a);
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, o, 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 || o();
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 (o, c = ie()) => Te(e, o, 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,175 +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, o) {
312
- const c = e.value;
313
- if (!c) return;
314
- const u = c[o];
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
- const o = e.ownerDocument.activeElement;
322
- o instanceof HTMLElement && e.contains(o) && o.blur(), 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");
323
514
  }
324
- function ce(e) {
325
- var o;
326
- return (o = e.components) == null ? void 0 : o.default;
515
+ function he(e) {
516
+ var r;
517
+ return (r = e.components) == null ? void 0 : r.default;
327
518
  }
328
- function ge(e) {
329
- const o = ce(e);
330
- return o !== void 0 && typeof o == "object" && "name" in o && o.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";
331
522
  }
332
- const He = Y({
523
+ const qe = q({
333
524
  name: "RouterOutlet",
334
525
  setup() {
335
- const e = ae(), o = ye(), c = C(ke), u = C(v, void 0), d = U(() => {
336
- 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;
337
528
  if (!t) return 0;
338
- const n = o.matched.findIndex(
339
- (a) => a === t
529
+ const o = r.matched.findIndex(
530
+ (i) => i === t
340
531
  );
341
- return n >= 0 ? n + 1 : 0;
342
- }), D = U(() => o.matched[d.value]), E = U(() => {
343
- for (let t = d.value; t < o.matched.length; t++) {
344
- const n = o.matched[t];
345
- if (!ge(n))
346
- return n;
532
+ return o >= 0 ? o + 1 : 0;
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))
537
+ return o;
347
538
  }
348
- return D.value;
349
- }), m = te([]), w = G("");
350
- let f = 0;
351
- ue(v, E);
352
- const i = (t) => m.value.find((n) => n.id === t), b = (t) => m.value.find((n) => n.routeIds.has(t)), R = (t) => m.value.find((n) => n.routeKey === t), K = (t) => t.action === "push" && t.direction === "forward" && !t.reuse && m.value.some((n) => n.routeKey === t.key), T = (t) => {
353
- m.value.forEach((n) => {
354
- n.pageElement && (n === t ? S(n.pageElement) : q(n.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));
355
546
  });
356
- }, $ = (t) => {
357
- const n = e.history.findIndex(
358
- (r) => r.id === t.routeInfo.id
547
+ }, b = (t) => {
548
+ const o = e.history.findIndex(
549
+ (s) => s.id === t.routeInfo.id
359
550
  );
360
- if (n < 0) return;
361
- const a = new Set(
362
- e.history.slice(0, n + 1).map((r) => r.id)
551
+ if (o < 0) return;
552
+ const i = new Set(
553
+ e.history.slice(0, o + 1).map((s) => s.id)
363
554
  );
364
- m.value.forEach((r) => {
365
- r.routeIds = new Set(
366
- [...r.routeIds].filter((s) => a.has(s))
555
+ y.value.forEach((s) => {
556
+ s.routeIds = new Set(
557
+ [...s.routeIds].filter((n) => i.has(n))
367
558
  );
368
- }), m.value = m.value.filter(
369
- (r) => r === t || r.routeIds.size > 0
559
+ }), y.value = y.value.filter(
560
+ (s) => s === t || s.routeIds.size > 0
370
561
  );
371
- }, W = (t) => {
372
- m.value = m.value.filter((n) => n !== t);
373
- }, g = (t) => {
374
- const n = new Set(
375
- e.history.map((a) => a.id)
562
+ }, x = (t) => {
563
+ y.value = y.value.filter((o) => o !== t);
564
+ }, A = (t) => {
565
+ const o = new Set(
566
+ e.history.map((i) => i.id)
376
567
  );
377
- m.value.forEach((a) => {
378
- a.routeIds = new Set(
379
- [...a.routeIds].filter((r) => n.has(r))
568
+ y.value.forEach((i) => {
569
+ i.routeIds = new Set(
570
+ [...i.routeIds].filter((s) => o.has(s))
380
571
  );
381
- }), m.value = m.value.filter(
382
- (a) => a === t || a.routeInfo.cache && a.routeIds.size > 0
572
+ }), y.value = y.value.filter(
573
+ (i) => i === t || i.routeInfo.cache && i.routeIds.size > 0
383
574
  );
384
- }, I = (t) => {
385
- var a;
386
- const n = t.props.default;
387
- return n ? n === !0 ? ((a = e.current.value) == null ? void 0 : a.params) ?? {} : typeof n == "function" ? n(c) : n : {};
388
- }, z = (t, n) => t.routeInfo.action === "pop" ? n.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, n) => t.routeInfo.direction === "forward" ? x(t.routeInfo) : x(n.routeInfo), L = (t, n) => !(t.routeInfo.isStackFallback || t.routeInfo.direction === "none" || t.routeInfo.direction === "root" || t.routeInfo.action === "pop" && j(t, n)), A = (t, n) => {
389
- var r;
390
- const a = L(t, n);
391
- return ((r = e.shouldTransition) == null ? void 0 : r.call(e, {
575
+ }, g = (t) => {
576
+ var i;
577
+ const o = t.props.default;
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, {
392
583
  action: t.routeInfo.action,
393
584
  direction: t.routeInfo.direction,
394
585
  source: t.routeInfo.source,
395
586
  entering: t.routeInfo,
396
- leaving: n.routeInfo,
397
- defaultResult: a
398
- })) ?? a;
399
- }, B = (t, n) => t.routeInfo.action === "pop" ? n.routeInfo.transitionDuration ?? t.routeInfo.transitionDuration ?? e.transitionDuration : t.routeInfo.transitionDuration ?? e.transitionDuration, _ = (t, n) => t.routeInfo.action === "pop" ? n.routeInfo.transitionEasing ?? t.routeInfo.transitionEasing ?? e.transitionEasing : t.routeInfo.transitionEasing ?? e.transitionEasing, V = async (t, n) => {
400
- const a = ++f;
401
- await fe();
402
- const r = t.pageElement;
403
- if (!r) return;
404
- if (P(t.componentRef, re), !n || n === t || !n.pageElement) {
405
- S(r), P(t.componentRef, Q), g(t), T(t);
587
+ leaving: o.routeInfo,
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);
406
597
  return;
407
598
  }
408
- const s = n.pageElement, l = A(t, n), h = l ? z(t, n) : "none", k = l ? B(t, n) : 0, M = _(t, n), se = Pe(
409
- 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,
410
601
  e.transitions
411
602
  );
412
- P(n.componentRef, oe), S(r), S(s), await Se(se, {
603
+ j(o.componentRef, ie), M(s), M(n), await Le(X, {
413
604
  direction: t.routeInfo.direction,
414
605
  action: t.routeInfo.action,
415
606
  routeInfo: t.routeInfo,
416
- enteringElement: r,
417
- leavingElement: s,
418
- duration: k,
419
- easing: M
420
- }), a === f && (q(s), P(n.componentRef, ne), P(t.componentRef, Q), t.routeInfo.action === "pop" ? $(t) : t.routeInfo.action === "replace" && W(n), g(t), T(t));
421
- }, F = async () => {
422
- const t = E.value, n = e.current.value;
423
- if (!t || !n) return;
424
- const a = ce(t);
425
- if (!a) return;
426
- const r = i(w.value);
427
- let s = b(n.id);
428
- !s && !K(n) && (s = R(n.key)), s ? (s.routeIds.add(n.id), s.routeKey = n.key, s.routeInfo = n, s.matchedRoute = t, s.component = a, s.props = I(t), s.mounted = !0) : (s = {
429
- id: J("view"),
430
- routeKey: n.key,
431
- routeIds: /* @__PURE__ */ new Set([n.id]),
432
- routeInfo: n,
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;
614
+ if (!t || !o) return;
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"),
621
+ routeKey: o.key,
622
+ routeIds: /* @__PURE__ */ new Set([o.id]),
623
+ routeInfo: o,
433
624
  matchedRoute: t,
434
- component: a,
435
- props: I(t),
436
- componentRef: G(),
625
+ component: i,
626
+ props: g(t),
627
+ componentRef: z(),
437
628
  mounted: !0
438
- }, 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);
439
630
  };
440
- return le(
631
+ return ke(
441
632
  () => {
442
633
  var t;
443
- 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];
444
635
  },
445
636
  () => {
446
- F();
637
+ a();
447
638
  },
448
639
  { immediate: !0 }
449
- ), de(() => {
450
- f++, m.value = [];
640
+ ), me(() => {
641
+ c++, y.value = [];
451
642
  }), {
452
- injectedRoute: c,
453
- viewItems: m,
454
- registerStackPage: (t, n) => {
455
- t.pageElement = n, t.id === w.value ? S(n) : q(n);
643
+ injectedRoute: u,
644
+ viewItems: y,
645
+ activeViewId: p,
646
+ registerStackPage: (t, o) => {
647
+ t.pageElement = o, t.id === p.value ? M(o) : Y(o);
456
648
  }
457
649
  };
458
650
  },
459
651
  render() {
460
- return y(
652
+ return I(
461
653
  "div",
462
654
  { class: "rs-outlet" },
463
655
  this.viewItems.filter((e) => e.mounted).map(
464
- (e) => y(e.component, {
465
- key: e.id,
466
- ref: e.componentRef,
467
- ...e.props,
468
- registerStackPage: (o) => this.registerStackPage(e, o)
469
- })
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
+ )
470
673
  )
471
674
  );
472
675
  }
473
- }), Ke = Y({
676
+ }), Ue = q({
474
677
  name: "RouterPage",
475
678
  props: {
476
679
  registerStackPage: {
@@ -478,25 +681,25 @@ const He = Y({
478
681
  default: void 0
479
682
  }
480
683
  },
481
- setup(e, { attrs: o, slots: c }) {
482
- const u = G();
483
- return he(() => {
484
- var d;
485
- 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));
486
689
  }), () => {
487
- var d;
488
- return y(
690
+ var f;
691
+ return I(
489
692
  "section",
490
693
  {
491
- ...o,
492
- ref: u,
493
- class: ["rs-page", o.class]
694
+ ...r,
695
+ ref: h,
696
+ class: ["rs-page", r.class]
494
697
  },
495
- (d = c.default) == null ? void 0 : d.call(c)
698
+ (f = u.default) == null ? void 0 : f.call(u)
496
699
  );
497
700
  };
498
701
  }
499
- }), $e = Y({
702
+ }), Xe = q({
500
703
  name: "StackRouterDebugPanel",
501
704
  props: {
502
705
  initialOpen: {
@@ -505,52 +708,52 @@ const He = Y({
505
708
  }
506
709
  },
507
710
  setup(e) {
508
- const o = ae(), c = G(e.initialOpen);
711
+ const r = de(), u = z(e.initialOpen);
509
712
  return () => {
510
- const u = o.current.value;
511
- return y("aside", { class: "rs-debug-panel" }, [
512
- y(
713
+ const h = r.current.value;
714
+ return I("aside", { class: "rs-debug-panel" }, [
715
+ I(
513
716
  "button",
514
717
  {
515
718
  class: "rs-debug-toggle",
516
719
  type: "button",
517
720
  onClick: () => {
518
- c.value = !c.value;
721
+ u.value = !u.value;
519
722
  }
520
723
  },
521
- c.value ? "Stack x" : "Stack"
724
+ u.value ? "Stack x" : "Stack"
522
725
  ),
523
- c.value ? y("section", { class: "rs-debug-body" }, [
524
- y("header", [
525
- y("strong", "Router Stack"),
526
- y("span", `${o.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`)
527
730
  ]),
528
- y("dl", [
529
- y("dt", "current"),
530
- y("dd", (u == null ? void 0 : u.fullPath) ?? "-"),
531
- y("dt", "canGoBack"),
532
- y("dd", String(o.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()))
533
736
  ]),
534
- y(
737
+ I(
535
738
  "ol",
536
- o.history.map(
537
- (d) => y(
739
+ r.history.map(
740
+ (f) => I(
538
741
  "li",
539
742
  {
540
- key: d.id,
743
+ key: f.id,
541
744
  class: {
542
- "rs-debug-active": d.id === (u == null ? void 0 : u.id),
543
- "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
544
747
  }
545
748
  },
546
749
  [
547
- y("code", d.fullPath),
548
- y("span", [
549
- `${d.action}/${d.direction}`,
550
- ` source:${d.source}`,
551
- ` entry:${d.entryDirection}`,
552
- ` cache:${d.cache ? "yes" : "no"}`,
553
- ` 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 ?? "-"}`
554
757
  ])
555
758
  ]
556
759
  )
@@ -561,23 +764,41 @@ const He = Y({
561
764
  };
562
765
  }
563
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
+ }
564
784
  export {
565
- je as RouterLink,
566
- He as RouterOutlet,
567
- Ke as RouterPage,
568
- Me as RouterView,
569
- $e as StackRouterDebugPanel,
570
- Ue as createMemoryHistory,
571
- Be as createStackRouter,
572
- Xe as createWebHashHistory,
573
- qe as createWebHistory,
574
- Ae as defineStackTransition,
575
- Ve as onPageDidEnter,
576
- Ce as onPageDidLeave,
577
- _e as onPageWillEnter,
578
- Fe as onPageWillLeave,
579
- N as stackRouterKey,
580
- Je as useRoute,
581
- Qe as useRouter,
582
- 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
583
804
  };