@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.
- package/README.md +64 -11
- package/dist/components/RouterOutlet.d.ts +1 -0
- package/dist/components/StackPageScope.d.ts +47 -0
- package/dist/composables/usePageHistoryState.d.ts +14 -0
- package/dist/index.d.ts +4 -2
- package/dist/router/pageHistory.d.ts +33 -0
- package/dist/vue-router-stack.cjs +1 -1
- package/dist/vue-router-stack.js +595 -374
- package/package.json +1 -1
package/dist/vue-router-stack.js
CHANGED
|
@@ -1,16 +1,167 @@
|
|
|
1
|
-
import { shallowRef as
|
|
2
|
-
import { createRouter as
|
|
3
|
-
import { RouterLink as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
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
|
|
10
|
-
function
|
|
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
|
|
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
|
-
},
|
|
174
|
+
}, ge = () => ({
|
|
24
175
|
entering: [{ opacity: 0 }, { opacity: 1 }],
|
|
25
176
|
leaving: [{ opacity: 1 }, { opacity: 0 }]
|
|
26
|
-
}),
|
|
27
|
-
const
|
|
177
|
+
}), De = ({ direction: e }) => {
|
|
178
|
+
const r = e === "back";
|
|
28
179
|
return {
|
|
29
|
-
entering:
|
|
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:
|
|
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
|
-
},
|
|
45
|
-
slide:
|
|
46
|
-
fade:
|
|
47
|
-
scale:
|
|
48
|
-
none:
|
|
195
|
+
}, Te = () => ({}), xe = {
|
|
196
|
+
slide: ve,
|
|
197
|
+
fade: ge,
|
|
198
|
+
scale: De,
|
|
199
|
+
none: Te
|
|
49
200
|
};
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
return
|
|
201
|
+
function Ae(e, r) {
|
|
202
|
+
const u = r[e];
|
|
203
|
+
return u || r[N];
|
|
53
204
|
}
|
|
54
|
-
function
|
|
55
|
-
if (!
|
|
205
|
+
function oe(e, r, u) {
|
|
206
|
+
if (!r || !e.animate || Number(u.duration) <= 0)
|
|
56
207
|
return Promise.resolve();
|
|
57
|
-
const
|
|
58
|
-
return
|
|
208
|
+
const h = e.animate(r, u);
|
|
209
|
+
return h.finished.then(() => h.cancel());
|
|
59
210
|
}
|
|
60
|
-
async function
|
|
61
|
-
const
|
|
62
|
-
duration:
|
|
63
|
-
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
|
-
...
|
|
216
|
+
...u.options
|
|
66
217
|
};
|
|
67
218
|
await Promise.all([
|
|
68
|
-
|
|
69
|
-
|
|
219
|
+
oe(r.enteringElement, u.entering, h),
|
|
220
|
+
oe(r.leavingElement, u.leaving, h)
|
|
70
221
|
]);
|
|
71
222
|
}
|
|
72
|
-
const
|
|
73
|
-
function
|
|
74
|
-
|
|
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
|
|
81
|
-
const
|
|
82
|
-
...
|
|
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
|
-
},
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
},
|
|
99
|
-
const
|
|
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:
|
|
102
|
-
key:
|
|
103
|
-
fullPath:
|
|
104
|
-
pathname:
|
|
105
|
-
params:
|
|
106
|
-
query:
|
|
107
|
-
action:
|
|
108
|
-
direction:
|
|
109
|
-
reuse: (
|
|
110
|
-
source: (
|
|
111
|
-
entryDirection:
|
|
112
|
-
lastPathname: (
|
|
113
|
-
pushedByRoute:
|
|
114
|
-
position:
|
|
115
|
-
delta:
|
|
116
|
-
transition: (
|
|
117
|
-
transitionDuration: (
|
|
118
|
-
transitionEasing: (
|
|
119
|
-
cache:
|
|
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
|
-
},
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
},
|
|
125
|
-
if (
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
if (
|
|
130
|
-
let
|
|
131
|
-
if (
|
|
132
|
-
for (let
|
|
133
|
-
if (
|
|
134
|
-
|
|
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
|
|
139
|
-
if (
|
|
140
|
-
|
|
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 (
|
|
144
|
-
const
|
|
145
|
-
|
|
298
|
+
if (n >= 0) {
|
|
299
|
+
const l = r[n];
|
|
300
|
+
r[n] = {
|
|
301
|
+
...l,
|
|
146
302
|
...s,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
158
|
-
...
|
|
312
|
+
r.push({
|
|
313
|
+
...s,
|
|
159
314
|
direction: "none",
|
|
160
315
|
entryDirection: "none",
|
|
161
316
|
transition: "none",
|
|
162
317
|
isStackFallback: !0
|
|
163
|
-
}),
|
|
164
|
-
} else if (
|
|
165
|
-
if (
|
|
166
|
-
|
|
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
|
-
|
|
324
|
+
p >= 0 ? r[p] = s : (r.push(s), p = 0);
|
|
170
325
|
} else
|
|
171
|
-
|
|
172
|
-
|
|
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((
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
335
|
+
l.type === "pop" ? "pop" : l.type,
|
|
336
|
+
w,
|
|
337
|
+
k,
|
|
183
338
|
void 0,
|
|
184
339
|
!1,
|
|
185
340
|
"external"
|
|
186
341
|
);
|
|
187
|
-
}),
|
|
188
|
-
if (
|
|
189
|
-
|
|
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
|
-
|
|
347
|
+
A(T(s, n)), c = void 0, S.restoreCurrent();
|
|
193
348
|
});
|
|
194
|
-
const g =
|
|
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
|
-
(
|
|
351
|
+
(n == null ? void 0 : n.direction) ?? "forward",
|
|
197
352
|
void 0,
|
|
198
|
-
|
|
199
|
-
), g(
|
|
353
|
+
n
|
|
354
|
+
), g(s)), F = async (s, n) => (await S.whenSettled(), R(
|
|
200
355
|
"replace",
|
|
201
|
-
(
|
|
356
|
+
(n == null ? void 0 : n.direction) ?? "root",
|
|
202
357
|
void 0,
|
|
203
|
-
|
|
204
|
-
),
|
|
205
|
-
const
|
|
206
|
-
let
|
|
207
|
-
for (let
|
|
208
|
-
if (
|
|
209
|
-
|
|
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 (
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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: (
|
|
386
|
+
direction: (n == null ? void 0 : n.direction) ?? "root",
|
|
228
387
|
source: "stack",
|
|
229
|
-
entryDirection: (
|
|
388
|
+
entryDirection: (n == null ? void 0 : n.direction) ?? "root",
|
|
230
389
|
delta: void 0,
|
|
231
|
-
reuse: (
|
|
232
|
-
transition: (
|
|
233
|
-
transitionDuration: (
|
|
234
|
-
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
|
|
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
|
-
(
|
|
401
|
+
(n == null ? void 0 : n.direction) ?? "root",
|
|
243
402
|
void 0,
|
|
244
|
-
|
|
403
|
+
n,
|
|
245
404
|
!0
|
|
246
|
-
),
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
|
426
|
+
return r;
|
|
264
427
|
},
|
|
265
|
-
canGoBack: (
|
|
266
|
-
push:
|
|
267
|
-
replace:
|
|
268
|
-
popTo:
|
|
269
|
-
resetRoot:
|
|
270
|
-
back:
|
|
271
|
-
forward:
|
|
272
|
-
},
|
|
273
|
-
return
|
|
274
|
-
|
|
275
|
-
},
|
|
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
|
|
278
|
-
function
|
|
279
|
-
if (!
|
|
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
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}),
|
|
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
|
|
287
|
-
return (
|
|
449
|
+
function U(e) {
|
|
450
|
+
return (r, u = pe()) => _e(e, r, u);
|
|
288
451
|
}
|
|
289
|
-
const
|
|
290
|
-
function
|
|
291
|
-
const e =
|
|
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
|
|
306
|
-
const e =
|
|
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
|
|
312
|
-
const
|
|
313
|
-
if (!
|
|
314
|
-
const
|
|
315
|
-
Array.isArray(
|
|
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
|
-
|
|
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
|
|
321
|
-
const
|
|
322
|
-
|
|
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
|
|
325
|
-
var
|
|
326
|
-
return (
|
|
515
|
+
function he(e) {
|
|
516
|
+
var r;
|
|
517
|
+
return (r = e.components) == null ? void 0 : r.default;
|
|
327
518
|
}
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
return
|
|
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
|
|
523
|
+
const qe = q({
|
|
333
524
|
name: "RouterOutlet",
|
|
334
525
|
setup() {
|
|
335
|
-
const e =
|
|
336
|
-
const t =
|
|
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
|
|
339
|
-
(
|
|
529
|
+
const o = r.matched.findIndex(
|
|
530
|
+
(i) => i === t
|
|
340
531
|
);
|
|
341
|
-
return
|
|
342
|
-
}),
|
|
343
|
-
for (let t =
|
|
344
|
-
const
|
|
345
|
-
if (!
|
|
346
|
-
return
|
|
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
|
|
349
|
-
}),
|
|
350
|
-
let
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
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
|
-
},
|
|
357
|
-
const
|
|
358
|
-
(
|
|
547
|
+
}, b = (t) => {
|
|
548
|
+
const o = e.history.findIndex(
|
|
549
|
+
(s) => s.id === t.routeInfo.id
|
|
359
550
|
);
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
e.history.slice(0,
|
|
551
|
+
if (o < 0) return;
|
|
552
|
+
const i = new Set(
|
|
553
|
+
e.history.slice(0, o + 1).map((s) => s.id)
|
|
363
554
|
);
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
[...
|
|
555
|
+
y.value.forEach((s) => {
|
|
556
|
+
s.routeIds = new Set(
|
|
557
|
+
[...s.routeIds].filter((n) => i.has(n))
|
|
367
558
|
);
|
|
368
|
-
}),
|
|
369
|
-
(
|
|
559
|
+
}), y.value = y.value.filter(
|
|
560
|
+
(s) => s === t || s.routeIds.size > 0
|
|
370
561
|
);
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
-
const
|
|
375
|
-
e.history.map((
|
|
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
|
-
|
|
378
|
-
|
|
379
|
-
[...
|
|
568
|
+
y.value.forEach((i) => {
|
|
569
|
+
i.routeIds = new Set(
|
|
570
|
+
[...i.routeIds].filter((s) => o.has(s))
|
|
380
571
|
);
|
|
381
|
-
}),
|
|
382
|
-
(
|
|
572
|
+
}), y.value = y.value.filter(
|
|
573
|
+
(i) => i === t || i.routeInfo.cache && i.routeIds.size > 0
|
|
383
574
|
);
|
|
384
|
-
},
|
|
385
|
-
var
|
|
386
|
-
const
|
|
387
|
-
return
|
|
388
|
-
},
|
|
389
|
-
var
|
|
390
|
-
const
|
|
391
|
-
return ((
|
|
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:
|
|
397
|
-
defaultResult:
|
|
398
|
-
})) ??
|
|
399
|
-
},
|
|
400
|
-
const
|
|
401
|
-
await
|
|
402
|
-
const
|
|
403
|
-
if (!
|
|
404
|
-
if (
|
|
405
|
-
|
|
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
|
|
409
|
-
|
|
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
|
-
|
|
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:
|
|
417
|
-
leavingElement:
|
|
418
|
-
duration:
|
|
419
|
-
easing:
|
|
420
|
-
}),
|
|
421
|
-
},
|
|
422
|
-
const t =
|
|
423
|
-
if (!t || !
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
426
|
-
const
|
|
427
|
-
let
|
|
428
|
-
!
|
|
429
|
-
id:
|
|
430
|
-
routeKey:
|
|
431
|
-
routeIds: /* @__PURE__ */ new Set([
|
|
432
|
-
routeInfo:
|
|
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:
|
|
435
|
-
props:
|
|
436
|
-
componentRef:
|
|
625
|
+
component: i,
|
|
626
|
+
props: g(t),
|
|
627
|
+
componentRef: z(),
|
|
437
628
|
mounted: !0
|
|
438
|
-
},
|
|
629
|
+
}, y.value = [...y.value, n]), p.value = n.id, await L(n, s);
|
|
439
630
|
};
|
|
440
|
-
return
|
|
631
|
+
return ke(
|
|
441
632
|
() => {
|
|
442
633
|
var t;
|
|
443
|
-
return [(t = e.current.value) == null ? void 0 : t.id,
|
|
634
|
+
return [(t = e.current.value) == null ? void 0 : t.id, D.value];
|
|
444
635
|
},
|
|
445
636
|
() => {
|
|
446
|
-
|
|
637
|
+
a();
|
|
447
638
|
},
|
|
448
639
|
{ immediate: !0 }
|
|
449
|
-
),
|
|
450
|
-
|
|
640
|
+
), me(() => {
|
|
641
|
+
c++, y.value = [];
|
|
451
642
|
}), {
|
|
452
|
-
injectedRoute:
|
|
453
|
-
viewItems:
|
|
454
|
-
|
|
455
|
-
|
|
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
|
|
652
|
+
return I(
|
|
461
653
|
"div",
|
|
462
654
|
{ class: "rs-outlet" },
|
|
463
655
|
this.viewItems.filter((e) => e.mounted).map(
|
|
464
|
-
(e) =>
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
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
|
-
}),
|
|
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:
|
|
482
|
-
const
|
|
483
|
-
return
|
|
484
|
-
var
|
|
485
|
-
|
|
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
|
|
488
|
-
return
|
|
690
|
+
var f;
|
|
691
|
+
return I(
|
|
489
692
|
"section",
|
|
490
693
|
{
|
|
491
|
-
...
|
|
492
|
-
ref:
|
|
493
|
-
class: ["rs-page",
|
|
694
|
+
...r,
|
|
695
|
+
ref: h,
|
|
696
|
+
class: ["rs-page", r.class]
|
|
494
697
|
},
|
|
495
|
-
(
|
|
698
|
+
(f = u.default) == null ? void 0 : f.call(u)
|
|
496
699
|
);
|
|
497
700
|
};
|
|
498
701
|
}
|
|
499
|
-
}),
|
|
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
|
|
711
|
+
const r = de(), u = z(e.initialOpen);
|
|
509
712
|
return () => {
|
|
510
|
-
const
|
|
511
|
-
return
|
|
512
|
-
|
|
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
|
-
|
|
721
|
+
u.value = !u.value;
|
|
519
722
|
}
|
|
520
723
|
},
|
|
521
|
-
|
|
724
|
+
u.value ? "Stack x" : "Stack"
|
|
522
725
|
),
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
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
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
|
|
737
|
+
I(
|
|
535
738
|
"ol",
|
|
536
|
-
|
|
537
|
-
(
|
|
739
|
+
r.history.map(
|
|
740
|
+
(f) => I(
|
|
538
741
|
"li",
|
|
539
742
|
{
|
|
540
|
-
key:
|
|
743
|
+
key: f.id,
|
|
541
744
|
class: {
|
|
542
|
-
"rs-debug-active":
|
|
543
|
-
"rs-debug-no-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
|
-
|
|
548
|
-
|
|
549
|
-
`${
|
|
550
|
-
` source:${
|
|
551
|
-
` entry:${
|
|
552
|
-
` cache:${
|
|
553
|
-
` 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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
Je as
|
|
581
|
-
|
|
582
|
-
|
|
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
|
};
|