vue-micro-router 1.0.56 → 1.0.57
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/dist/index.mjs +470 -460
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import { shallowReactive as U, computed as
|
|
2
|
-
import { i as De, s as
|
|
1
|
+
import { shallowReactive as U, computed as C, defineAsyncComponent as me, reactive as pe, nextTick as k, ref as ee, inject as V, watch as X, onMounted as q, onBeforeUnmount as he, provide as N, toRefs as Oe, toRef as Ke, defineComponent as oe, openBlock as I, createBlock as z, resolveDynamicComponent as ye, mergeProps as Pe, Teleport as We, createElementVNode as j, withModifiers as le, normalizeStyle as be, normalizeClass as Q, createElementBlock as x, createCommentVNode as $e, renderSlot as we, Fragment as te, createVNode as Re, TransitionGroup as Ee, withCtx as ce, renderList as ue, unref as Y } from "vue";
|
|
2
|
+
import { i as De, s as Ae, g as H, w as ne, p as B, b as K, n as W, u as Ye } from "./use-audio-manager.mjs";
|
|
3
3
|
const Me = Symbol("micro-router");
|
|
4
|
-
function
|
|
4
|
+
function ht() {
|
|
5
5
|
return Symbol("micro-router-nested");
|
|
6
6
|
}
|
|
7
|
-
const de = Symbol("micro-router-root"), Le = Symbol("micro-route-path"), Te = Symbol("micro-dialog-path"), _e = Symbol("micro-control-name"), ae = Symbol("micro-attrs-read"), ie = Symbol("micro-attrs-write"),
|
|
8
|
-
function
|
|
7
|
+
const de = Symbol("micro-router-root"), Le = Symbol("micro-route-path"), Te = Symbol("micro-dialog-path"), _e = Symbol("micro-control-name"), ae = Symbol("micro-attrs-read"), ie = Symbol("micro-attrs-write"), Ue = 550;
|
|
8
|
+
function Ce() {
|
|
9
9
|
const e = /* @__PURE__ */ new Set();
|
|
10
|
-
function
|
|
10
|
+
function n(i, t) {
|
|
11
11
|
const c = setTimeout(() => {
|
|
12
12
|
e.delete(c), i();
|
|
13
13
|
}, t);
|
|
14
14
|
return e.add(c), c;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function o() {
|
|
17
17
|
e.forEach(clearTimeout), e.clear();
|
|
18
18
|
}
|
|
19
|
-
return { schedule:
|
|
19
|
+
return { schedule: n, cleanup: o };
|
|
20
20
|
}
|
|
21
21
|
function fe(e) {
|
|
22
|
-
return new Promise((
|
|
22
|
+
return new Promise((n) => setTimeout(n, e));
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
24
|
+
function Xe(e, n) {
|
|
25
|
+
const o = e.defaultControlName, i = e.onboardingControlName, t = 300, c = Ce();
|
|
26
26
|
let u = !1;
|
|
27
27
|
const s = U(/* @__PURE__ */ new Map()), f = U(
|
|
28
28
|
/* @__PURE__ */ new Map()
|
|
29
|
-
), a =
|
|
30
|
-
const
|
|
31
|
-
for (const
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
}), d = a, R =
|
|
35
|
-
() => a.value.some((
|
|
36
|
-
),
|
|
37
|
-
const
|
|
38
|
-
return (
|
|
29
|
+
), a = C(() => {
|
|
30
|
+
const r = [];
|
|
31
|
+
for (const l of s.values())
|
|
32
|
+
l.activated && r.push(l);
|
|
33
|
+
return r;
|
|
34
|
+
}), d = a, R = C(
|
|
35
|
+
() => a.value.some((r) => r.name !== o)
|
|
36
|
+
), M = C(() => {
|
|
37
|
+
const r = a.value.find((l) => l.name !== o);
|
|
38
|
+
return (r == null ? void 0 : r.name) ?? o;
|
|
39
39
|
});
|
|
40
|
-
function
|
|
41
|
-
var h,
|
|
42
|
-
if (!(
|
|
43
|
-
|
|
40
|
+
function L(r, l, P) {
|
|
41
|
+
var h, A, m;
|
|
42
|
+
if (!(l && u)) {
|
|
43
|
+
l && (u = !0);
|
|
44
44
|
try {
|
|
45
|
-
const y = s.get(
|
|
45
|
+
const y = s.get(r);
|
|
46
46
|
if (!y) return;
|
|
47
|
-
const v = s.get(
|
|
48
|
-
if (
|
|
49
|
-
(h =
|
|
47
|
+
const v = s.get(o), D = r === o || r === i;
|
|
48
|
+
if (l)
|
|
49
|
+
(h = n == null ? void 0 : n.trackGuiEnter) == null || h.call(n, r), D ? s.forEach((w) => {
|
|
50
50
|
var b;
|
|
51
|
-
w.name !==
|
|
51
|
+
w.name !== o && w.activated && ((b = n == null ? void 0 : n.trackGuiLeave) == null || b.call(n, w.name), s.set(w.name, {
|
|
52
52
|
...w,
|
|
53
53
|
activated: !1,
|
|
54
54
|
attrs: void 0
|
|
55
55
|
}));
|
|
56
|
-
}) : v != null && v.activated && ((
|
|
56
|
+
}) : v != null && v.activated && ((A = n == null ? void 0 : n.trackGuiLeave) == null || A.call(n, o), s.set(o, { ...v, activated: !1 })), P && f.set(r, { ...P }), s.set(r, {
|
|
57
57
|
...y,
|
|
58
58
|
activated: !0,
|
|
59
59
|
componentKey: (y.componentKey || 0) + 1,
|
|
60
60
|
attrs: P ? { ...P } : void 0
|
|
61
61
|
});
|
|
62
62
|
else {
|
|
63
|
-
(m =
|
|
64
|
-
const w = s.get(
|
|
63
|
+
(m = n == null ? void 0 : n.trackGuiLeave) == null || m.call(n, r), f.delete(r), s.set(r, { ...y, activated: !1, attrs: void 0 });
|
|
64
|
+
const w = s.get(o);
|
|
65
65
|
if (!D && w && !w.activated) {
|
|
66
66
|
if (w.name === i) return;
|
|
67
|
-
s.set(
|
|
67
|
+
s.set(o, { ...w, activated: !0 });
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
} finally {
|
|
71
|
-
|
|
71
|
+
l && c.schedule(() => {
|
|
72
72
|
u = !1;
|
|
73
73
|
}, t);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function _(
|
|
78
|
-
s.has(
|
|
79
|
-
let { component:
|
|
80
|
-
De(
|
|
81
|
-
...
|
|
82
|
-
component:
|
|
77
|
+
function _(r) {
|
|
78
|
+
s.has(r.name) && console.warn(`[vue-micro-router] Control "${r.name}" already registered. Overwriting.`);
|
|
79
|
+
let { component: l } = r;
|
|
80
|
+
De(l) && (l = me(l)), s.set(r.name, {
|
|
81
|
+
...r,
|
|
82
|
+
component: Ae(l)
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
function T(
|
|
86
|
-
|
|
85
|
+
function T(r) {
|
|
86
|
+
r.forEach(_);
|
|
87
87
|
}
|
|
88
|
-
function g(
|
|
89
|
-
return f.get(
|
|
88
|
+
function g(r) {
|
|
89
|
+
return f.get(r);
|
|
90
90
|
}
|
|
91
|
-
function p(
|
|
92
|
-
const P = f.get(
|
|
93
|
-
f.set(
|
|
91
|
+
function p(r, l) {
|
|
92
|
+
const P = f.get(r);
|
|
93
|
+
f.set(r, { ...P, ...l });
|
|
94
94
|
}
|
|
95
95
|
return {
|
|
96
96
|
resolveControls: d,
|
|
97
97
|
activeControl: R,
|
|
98
|
-
currentControl:
|
|
99
|
-
toggleControl:
|
|
98
|
+
currentControl: M,
|
|
99
|
+
toggleControl: L,
|
|
100
100
|
registerControl: _,
|
|
101
101
|
registerControls: T,
|
|
102
102
|
getControlAttrs: g,
|
|
@@ -104,35 +104,35 @@ function Ue(e, o) {
|
|
|
104
104
|
cleanup: c.cleanup
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
const ge = "micro-router-inspector",
|
|
107
|
+
const ge = "micro-router-inspector", Fe = "micro-router-events";
|
|
108
108
|
async function ze(e) {
|
|
109
109
|
if (typeof import.meta < "u") return;
|
|
110
|
-
let
|
|
110
|
+
let n;
|
|
111
111
|
try {
|
|
112
|
-
|
|
112
|
+
n = (await import(
|
|
113
113
|
/* @vite-ignore */
|
|
114
114
|
"@vue/devtools-api"
|
|
115
115
|
)).setupDevtoolsPlugin;
|
|
116
116
|
} catch {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
n && n(
|
|
120
120
|
{
|
|
121
121
|
id: "vue-micro-router",
|
|
122
122
|
label: "Micro Router",
|
|
123
123
|
packageName: "vue-micro-router",
|
|
124
124
|
homepage: "https://github.com/danh121097/vue-micro-router"
|
|
125
125
|
},
|
|
126
|
-
(
|
|
127
|
-
|
|
126
|
+
(o) => {
|
|
127
|
+
o.addInspector({
|
|
128
128
|
id: ge,
|
|
129
129
|
label: "Micro Router",
|
|
130
130
|
icon: "route"
|
|
131
|
-
}),
|
|
132
|
-
id:
|
|
131
|
+
}), o.addTimelineLayer({
|
|
132
|
+
id: Fe,
|
|
133
133
|
label: "Micro Router",
|
|
134
134
|
color: 4372611
|
|
135
|
-
}),
|
|
135
|
+
}), o.on.getInspectorTree((i) => {
|
|
136
136
|
i.inspectorId === ge && (i.rootNodes = [
|
|
137
137
|
{
|
|
138
138
|
id: "routes",
|
|
@@ -159,7 +159,7 @@ async function ze(e) {
|
|
|
159
159
|
}))
|
|
160
160
|
}
|
|
161
161
|
]);
|
|
162
|
-
}),
|
|
162
|
+
}), o.on.getInspectorState((i) => {
|
|
163
163
|
if (i.inspectorId === ge) {
|
|
164
164
|
if (i.nodeId === "routes")
|
|
165
165
|
i.state = {
|
|
@@ -200,11 +200,11 @@ async function ze(e) {
|
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
const
|
|
205
|
-
for (const s of
|
|
203
|
+
function Ve(e) {
|
|
204
|
+
const n = e.activePath.value.split("/").filter(Boolean), o = {};
|
|
205
|
+
for (const s of n) {
|
|
206
206
|
const f = e.getRouteAttrs(s);
|
|
207
|
-
f && (
|
|
207
|
+
f && (o[s] = { ...f });
|
|
208
208
|
}
|
|
209
209
|
const i = [], t = {};
|
|
210
210
|
for (const s of e.resolveDialogs.value) {
|
|
@@ -221,31 +221,31 @@ function Fe(e) {
|
|
|
221
221
|
}
|
|
222
222
|
return {
|
|
223
223
|
version: 1,
|
|
224
|
-
navigation: { activePath: e.activePath.value, routeAttrs:
|
|
224
|
+
navigation: { activePath: e.activePath.value, routeAttrs: o },
|
|
225
225
|
dialogs: { stack: i, attrs: t },
|
|
226
226
|
controls: { active: c, attrs: u }
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
async function xe(e,
|
|
230
|
-
if (
|
|
231
|
-
console.warn("[vue-micro-router] Unknown serialized state version:",
|
|
229
|
+
async function xe(e, n) {
|
|
230
|
+
if (n.version !== 1) {
|
|
231
|
+
console.warn("[vue-micro-router] Unknown serialized state version:", n.version);
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
const { activePath:
|
|
235
|
-
await e.push(
|
|
234
|
+
const { activePath: o, routeAttrs: i } = n.navigation;
|
|
235
|
+
await e.push(o);
|
|
236
236
|
for (const [t, c] of Object.entries(i))
|
|
237
237
|
e.updateRouteAttrs(t, c);
|
|
238
|
-
for (const t of
|
|
239
|
-
const c =
|
|
238
|
+
for (const t of n.dialogs.stack) {
|
|
239
|
+
const c = n.dialogs.attrs[t];
|
|
240
240
|
e.openDialog(t, c);
|
|
241
241
|
}
|
|
242
|
-
for (const t of
|
|
243
|
-
const c =
|
|
242
|
+
for (const t of n.controls.active) {
|
|
243
|
+
const c = n.controls.attrs[t];
|
|
244
244
|
e.toggleControl(t, !0, c);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
247
|
+
function je(e) {
|
|
248
|
+
const o = Ce();
|
|
249
249
|
let i = !1;
|
|
250
250
|
const t = pe({
|
|
251
251
|
activeDialog: "",
|
|
@@ -257,33 +257,33 @@ function Ve(e) {
|
|
|
257
257
|
dialogs: U(/* @__PURE__ */ new Map()),
|
|
258
258
|
/** Attrs stored separately for useMicroState access inside dialog components */
|
|
259
259
|
dialogAttrs: U(/* @__PURE__ */ new Map())
|
|
260
|
-
}), c =
|
|
260
|
+
}), c = C(() => {
|
|
261
261
|
const g = [], p = /* @__PURE__ */ new Set();
|
|
262
|
-
for (const
|
|
263
|
-
const
|
|
264
|
-
|
|
262
|
+
for (const r of t.dialogStack) {
|
|
263
|
+
const l = t.dialogs.get(r);
|
|
264
|
+
l && (l.activated || l.closing) && (g.push(l), p.add(r));
|
|
265
265
|
}
|
|
266
|
-
for (const
|
|
267
|
-
|
|
266
|
+
for (const r of t.dialogs.values())
|
|
267
|
+
r.closing && !p.has(r.path) && g.push(r);
|
|
268
268
|
return g;
|
|
269
|
-
}), u =
|
|
269
|
+
}), u = o.schedule;
|
|
270
270
|
function s(g, p) {
|
|
271
271
|
return { path: g, attrs: p };
|
|
272
272
|
}
|
|
273
|
-
function f({ path: g, open: p, attrs:
|
|
274
|
-
const
|
|
275
|
-
return
|
|
273
|
+
function f({ path: g, open: p, attrs: r }) {
|
|
274
|
+
const l = t.dialogs.get(g);
|
|
275
|
+
return l && k(() => {
|
|
276
276
|
if (p)
|
|
277
|
-
t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g,
|
|
278
|
-
...
|
|
277
|
+
t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g, r && t.dialogAttrs.set(g, { ...r }), t.dialogs.set(g, {
|
|
278
|
+
...l,
|
|
279
279
|
activated: !0,
|
|
280
280
|
closing: !1,
|
|
281
|
-
componentKey: (
|
|
281
|
+
componentKey: (l.componentKey || 0) + 1,
|
|
282
282
|
attrs: {
|
|
283
283
|
path: g,
|
|
284
|
-
...
|
|
284
|
+
...r,
|
|
285
285
|
onClose: () => {
|
|
286
|
-
d(g),
|
|
286
|
+
d(g), r != null && r.onClose && typeof r.onClose == "function" && r.onClose();
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
});
|
|
@@ -291,32 +291,32 @@ function Ve(e) {
|
|
|
291
291
|
t.fromDialog = t.activeDialog;
|
|
292
292
|
const P = t.dialogStack.indexOf(g);
|
|
293
293
|
P > -1 && t.dialogStack.splice(P, 1), t.activeDialog = t.dialogStack.at(-1) ?? "", t.toDialog = t.activeDialog;
|
|
294
|
-
const h =
|
|
294
|
+
const h = l.transitionDuration ?? (l.transition === "slide" ? 500 : 300);
|
|
295
295
|
t.dialogs.set(g, {
|
|
296
|
-
...
|
|
296
|
+
...l,
|
|
297
297
|
activated: !1,
|
|
298
298
|
closing: !0,
|
|
299
299
|
attrs: void 0
|
|
300
300
|
}), u(() => {
|
|
301
|
-
const
|
|
302
|
-
|
|
301
|
+
const A = t.dialogs.get(g);
|
|
302
|
+
A && !A.activated && t.dialogs.set(g, { ...A, closing: !1 });
|
|
303
303
|
}, h + 200);
|
|
304
304
|
}
|
|
305
|
-
}), s(g,
|
|
305
|
+
}), s(g, r);
|
|
306
306
|
}
|
|
307
307
|
function a(g, p) {
|
|
308
|
-
var
|
|
308
|
+
var r;
|
|
309
309
|
if (i) return s(g, p);
|
|
310
310
|
i = !0;
|
|
311
311
|
try {
|
|
312
|
-
const
|
|
313
|
-
(
|
|
312
|
+
const l = t.activeDialog || "";
|
|
313
|
+
(r = e == null ? void 0 : e.trackDialogEnter) == null || r.call(e, g, l, g);
|
|
314
314
|
const P = f({ path: g, open: !0, attrs: p });
|
|
315
315
|
return u(() => {
|
|
316
316
|
i = !1;
|
|
317
317
|
}, 300), P;
|
|
318
|
-
} catch (
|
|
319
|
-
throw i = !1,
|
|
318
|
+
} catch (l) {
|
|
319
|
+
throw i = !1, l;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function d(g) {
|
|
@@ -325,65 +325,65 @@ function Ve(e) {
|
|
|
325
325
|
}
|
|
326
326
|
function R() {
|
|
327
327
|
const g = [], p = [];
|
|
328
|
-
t.dialogs.forEach((
|
|
328
|
+
t.dialogs.forEach((r, l) => {
|
|
329
329
|
var P, h;
|
|
330
|
-
if (
|
|
331
|
-
(P = e == null ? void 0 : e.trackDialogLeave) == null || P.call(e,
|
|
332
|
-
const
|
|
333
|
-
typeof
|
|
334
|
-
...
|
|
330
|
+
if (r.activated) {
|
|
331
|
+
(P = e == null ? void 0 : e.trackDialogLeave) == null || P.call(e, l, l, "");
|
|
332
|
+
const A = (h = r.attrs) == null ? void 0 : h.onClose;
|
|
333
|
+
typeof A == "function" && p.push(A), t.dialogs.set(l, {
|
|
334
|
+
...r,
|
|
335
335
|
activated: !1,
|
|
336
336
|
closing: !0,
|
|
337
337
|
attrs: void 0
|
|
338
|
-
}), g.push(
|
|
338
|
+
}), g.push(l);
|
|
339
339
|
}
|
|
340
|
-
}), p.forEach((
|
|
341
|
-
g.forEach((
|
|
342
|
-
const
|
|
343
|
-
|
|
340
|
+
}), p.forEach((r) => r()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], u(() => {
|
|
341
|
+
g.forEach((r) => {
|
|
342
|
+
const l = t.dialogs.get(r);
|
|
343
|
+
l && !l.activated && t.dialogs.set(r, { ...l, closing: !1 });
|
|
344
344
|
});
|
|
345
345
|
}, 500);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function M(g) {
|
|
348
348
|
t.dialogs.has(g.path) && console.warn(`[vue-micro-router] Dialog "${g.path}" already registered. Overwriting.`);
|
|
349
349
|
let { component: p } = g;
|
|
350
350
|
De(p) && (p = me(p)), t.dialogs.set(g.path, {
|
|
351
351
|
persistent: !0,
|
|
352
352
|
...g,
|
|
353
|
-
component:
|
|
353
|
+
component: Ae(p)
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
g.forEach(
|
|
356
|
+
function L(g) {
|
|
357
|
+
g.forEach(M);
|
|
358
358
|
}
|
|
359
359
|
function _(g) {
|
|
360
360
|
return t.dialogAttrs.get(g);
|
|
361
361
|
}
|
|
362
362
|
function T(g, p) {
|
|
363
|
-
const
|
|
364
|
-
t.dialogAttrs.set(g, { ...
|
|
363
|
+
const r = t.dialogAttrs.get(g);
|
|
364
|
+
t.dialogAttrs.set(g, { ...r, ...p });
|
|
365
365
|
}
|
|
366
366
|
return {
|
|
367
|
-
activeDialog:
|
|
368
|
-
fromDialog:
|
|
369
|
-
toDialog:
|
|
367
|
+
activeDialog: C(() => t.activeDialog),
|
|
368
|
+
fromDialog: C(() => t.fromDialog),
|
|
369
|
+
toDialog: C(() => t.toDialog),
|
|
370
370
|
resolveDialogs: c,
|
|
371
371
|
openDialog: a,
|
|
372
372
|
closeDialog: d,
|
|
373
373
|
closeAllDialogs: R,
|
|
374
|
-
registerDialog:
|
|
375
|
-
registerDialogs:
|
|
374
|
+
registerDialog: M,
|
|
375
|
+
registerDialogs: L,
|
|
376
376
|
getDialogAttrs: _,
|
|
377
377
|
updateDialogAttrs: T,
|
|
378
|
-
cleanup:
|
|
378
|
+
cleanup: o.cleanup
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
381
|
const Be = 5e3;
|
|
382
|
-
async function ve(e,
|
|
382
|
+
async function ve(e, n, o, i) {
|
|
383
383
|
let t;
|
|
384
384
|
try {
|
|
385
385
|
const c = await Promise.race([
|
|
386
|
-
Promise.resolve(e(
|
|
386
|
+
Promise.resolve(e(n, o)),
|
|
387
387
|
new Promise((u, s) => {
|
|
388
388
|
t = setTimeout(() => s(new Error("Navigation guard timed out")), i);
|
|
389
389
|
})
|
|
@@ -393,62 +393,62 @@ async function ve(e, o, n, i) {
|
|
|
393
393
|
return clearTimeout(t), !1;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
async function
|
|
396
|
+
async function He(e, n, o, i = Be) {
|
|
397
397
|
for (const t of e)
|
|
398
|
-
if (!await ve(t,
|
|
398
|
+
if (!await ve(t, n, o, i)) return !1;
|
|
399
399
|
return !0;
|
|
400
400
|
}
|
|
401
|
-
async function
|
|
401
|
+
async function Se(e, n, o, i) {
|
|
402
402
|
var s;
|
|
403
|
-
const t =
|
|
404
|
-
if ((s =
|
|
403
|
+
const t = o.guardTimeout ?? Be;
|
|
404
|
+
if ((s = o.beforeEach) != null && s.length && !await He(o.beforeEach, e, n, t))
|
|
405
405
|
return !1;
|
|
406
406
|
const c = H(e);
|
|
407
407
|
if (c) {
|
|
408
408
|
const f = i.getRoute(c);
|
|
409
|
-
if (f != null && f.beforeEnter && !await ve(f.beforeEnter, e,
|
|
409
|
+
if (f != null && f.beforeEnter && !await ve(f.beforeEnter, e, n, t))
|
|
410
410
|
return !1;
|
|
411
411
|
}
|
|
412
|
-
const u = H(
|
|
412
|
+
const u = H(n);
|
|
413
413
|
if (u) {
|
|
414
414
|
const f = i.getRoute(u);
|
|
415
|
-
if (f != null && f.beforeLeave && !await ve(f.beforeLeave, e,
|
|
415
|
+
if (f != null && f.beforeLeave && !await ve(f.beforeLeave, e, n, t))
|
|
416
416
|
return !1;
|
|
417
417
|
}
|
|
418
418
|
return !0;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
if (
|
|
422
|
-
for (const i of
|
|
420
|
+
function qe(e, n, o) {
|
|
421
|
+
if (o != null && o.length)
|
|
422
|
+
for (const i of o)
|
|
423
423
|
try {
|
|
424
|
-
i(e,
|
|
424
|
+
i(e, n);
|
|
425
425
|
} catch {
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
const
|
|
428
|
+
function Je(e, n) {
|
|
429
|
+
const o = e.maxEntries ?? 50, i = [];
|
|
430
430
|
let t = -1, c = !1;
|
|
431
431
|
const u = ee(0);
|
|
432
432
|
function s(g, p) {
|
|
433
|
-
!e.enabled || c || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: p ? { ...p } : void 0 }), t = i.length - 1, i.length >
|
|
433
|
+
!e.enabled || c || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: p ? { ...p } : void 0 }), t = i.length - 1, i.length > o && (i.shift(), t--), u.value++);
|
|
434
434
|
}
|
|
435
|
-
const f =
|
|
435
|
+
const f = C(() => (u.value, [...i])), a = C(() => (u.value, t > 0)), d = C(() => (u.value, t < i.length - 1));
|
|
436
436
|
async function R(g) {
|
|
437
437
|
if (g < 0 || g >= i.length) return;
|
|
438
438
|
const p = i[g];
|
|
439
439
|
if (p) {
|
|
440
440
|
t = g, c = !0, u.value++;
|
|
441
441
|
try {
|
|
442
|
-
await
|
|
442
|
+
await n(p.path);
|
|
443
443
|
} finally {
|
|
444
444
|
c = !1;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
async function
|
|
448
|
+
async function M() {
|
|
449
449
|
a.value && await R(t - 1);
|
|
450
450
|
}
|
|
451
|
-
async function
|
|
451
|
+
async function L() {
|
|
452
452
|
d.value && await R(t + 1);
|
|
453
453
|
}
|
|
454
454
|
async function _(g) {
|
|
@@ -458,37 +458,37 @@ function qe(e, o) {
|
|
|
458
458
|
function T() {
|
|
459
459
|
i.length = 0, t = -1, u.value++;
|
|
460
460
|
}
|
|
461
|
-
return { entries: f, canGoBack: a, canGoForward: d, back:
|
|
461
|
+
return { entries: f, canGoBack: a, canGoForward: d, back: M, forward: L, go: _, clear: T, record: s };
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
const e = U(/* @__PURE__ */ new Map()),
|
|
465
|
-
function
|
|
463
|
+
function Qe() {
|
|
464
|
+
const e = U(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Map();
|
|
465
|
+
function o(u) {
|
|
466
466
|
e.has(u.path) && console.warn(`[vue-micro-router] Route "${u.path}" already registered. Overwriting.`);
|
|
467
467
|
let { component: s } = u;
|
|
468
|
-
De(s) && (
|
|
468
|
+
De(s) && (n.set(u.path, s), s = me(s)), e.set(u.path, {
|
|
469
469
|
...u,
|
|
470
|
-
component:
|
|
471
|
-
}), u.preload === "eager" &&
|
|
470
|
+
component: Ae(s)
|
|
471
|
+
}), u.preload === "eager" && n.has(u.path) && ne(n.get(u.path));
|
|
472
472
|
}
|
|
473
473
|
function i(u) {
|
|
474
|
-
u.forEach(
|
|
474
|
+
u.forEach(o);
|
|
475
475
|
}
|
|
476
476
|
async function t(u) {
|
|
477
|
-
const s =
|
|
477
|
+
const s = n.get(u);
|
|
478
478
|
s && await ne(s);
|
|
479
479
|
}
|
|
480
480
|
function c(u) {
|
|
481
481
|
for (const [s, f] of e.entries())
|
|
482
482
|
if (f.preload === "adjacent" && !u.includes(s)) {
|
|
483
|
-
const a =
|
|
483
|
+
const a = n.get(s);
|
|
484
484
|
a && ne(a);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
return { routes: e, asyncLoaders:
|
|
487
|
+
return { routes: e, asyncLoaders: n, registerRoute: o, registerRoutes: i, preloadRoute: t, preloadAdjacent: c };
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
const
|
|
491
|
-
async function
|
|
489
|
+
function Ze(e) {
|
|
490
|
+
const n = e.stepWiseDelay ?? Math.max(e.stepDelay * 1.2, e.stepDelay + 100);
|
|
491
|
+
async function o(t, c) {
|
|
492
492
|
if (!t || e.isLocked()) return;
|
|
493
493
|
const u = W(t);
|
|
494
494
|
if (e.getActivePath() !== u) {
|
|
@@ -509,7 +509,7 @@ function Qe(e) {
|
|
|
509
509
|
);
|
|
510
510
|
if (e.getActivePath() === d) continue;
|
|
511
511
|
const R = a === f.length - 1;
|
|
512
|
-
await e.pushCore(d, R ? c : void 0), R || await fe(
|
|
512
|
+
await e.pushCore(d, R ? c : void 0), R || await fe(n);
|
|
513
513
|
}
|
|
514
514
|
else {
|
|
515
515
|
const a = f.filter(
|
|
@@ -521,7 +521,7 @@ function Qe(e) {
|
|
|
521
521
|
}
|
|
522
522
|
for (let d = 0; d < a.length; d++) {
|
|
523
523
|
const R = d === a.length - 1;
|
|
524
|
-
await e.pushCore(a[d], R ? c : void 0), R || await fe(
|
|
524
|
+
await e.pushCore(a[d], R ? c : void 0), R || await fe(n);
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
e.scheduleUnlock();
|
|
@@ -544,36 +544,36 @@ function Qe(e) {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
for (let s = 0; s < u; s++)
|
|
547
|
-
await e.pushCore(-1), s < u - 1 && await fe(
|
|
547
|
+
await e.pushCore(-1), s < u - 1 && await fe(n);
|
|
548
548
|
e.scheduleUnlock();
|
|
549
549
|
} catch (s) {
|
|
550
550
|
throw e.unlock(), s;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
return { stepWisePush:
|
|
554
|
+
return { stepWisePush: o, stepWiseBack: i };
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
const
|
|
558
|
-
activePath:
|
|
559
|
-
fromPath:
|
|
560
|
-
toPath:
|
|
556
|
+
function ke(e, n) {
|
|
557
|
+
const o = e.defaultPath, i = e.stepDelay ?? Ue, t = e.guards ?? {}, c = e.history ?? {}, u = Ce(), s = Qe(), f = ee(!1), a = pe({
|
|
558
|
+
activePath: o,
|
|
559
|
+
fromPath: o,
|
|
560
|
+
toPath: o,
|
|
561
561
|
/** Attrs stored separately — changes here do NOT invalidate resolveRoutes computed */
|
|
562
562
|
routeAttrs: U(/* @__PURE__ */ new Map()),
|
|
563
563
|
/** Version stamp per segment — incremented on re-navigation to same segment (forces transition) */
|
|
564
564
|
routeKeys: U(/* @__PURE__ */ new Map()),
|
|
565
565
|
/** Component key per segment — incremented to force Vue full remount (resets local state) */
|
|
566
566
|
componentKeys: U(/* @__PURE__ */ new Map())
|
|
567
|
-
}), d = /* @__PURE__ */ new Map(), R =
|
|
567
|
+
}), d = /* @__PURE__ */ new Map(), R = C(() => {
|
|
568
568
|
const m = B(a.activePath), y = [];
|
|
569
569
|
for (const v of m) {
|
|
570
570
|
const D = s.routes.get(v);
|
|
571
571
|
if (!D) continue;
|
|
572
|
-
const w = a.routeKeys.get(v) || 0, b = a.componentKeys.get(v) || 0,
|
|
573
|
-
if (
|
|
574
|
-
y.push(
|
|
572
|
+
const w = a.routeKeys.get(v) || 0, b = a.componentKeys.get(v) || 0, S = `${D.path}-${w}`, E = d.get(v);
|
|
573
|
+
if (E && E.key === S && E.componentKey === b)
|
|
574
|
+
y.push(E);
|
|
575
575
|
else {
|
|
576
|
-
const O = { ...D, key:
|
|
576
|
+
const O = { ...D, key: S, componentKey: b };
|
|
577
577
|
d.set(v, O), y.push(O);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
@@ -581,32 +581,32 @@ function Ze(e, o) {
|
|
|
581
581
|
m.includes(v) || d.delete(v);
|
|
582
582
|
return y;
|
|
583
583
|
});
|
|
584
|
-
function
|
|
585
|
-
var O,
|
|
584
|
+
function M(m, y) {
|
|
585
|
+
var O, G;
|
|
586
586
|
const v = B(a.activePath), D = Math.min(m, v.length - 1);
|
|
587
587
|
if (D <= 0) return;
|
|
588
588
|
const w = v.slice(0, -D), b = K(w);
|
|
589
589
|
for (let $ = v.length - D; $ < v.length; $++)
|
|
590
590
|
a.routeAttrs.delete(v[$]);
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
593
|
-
const $ = a.routeAttrs.get(
|
|
594
|
-
a.routeAttrs.set(
|
|
595
|
-
|
|
596
|
-
(a.componentKeys.get(
|
|
591
|
+
const S = w.at(-1);
|
|
592
|
+
if (S && y) {
|
|
593
|
+
const $ = a.routeAttrs.get(S);
|
|
594
|
+
a.routeAttrs.set(S, { ...$, ...y }), a.componentKeys.set(
|
|
595
|
+
S,
|
|
596
|
+
(a.componentKeys.get(S) || 0) + 1
|
|
597
597
|
);
|
|
598
598
|
}
|
|
599
|
-
const
|
|
600
|
-
(O =
|
|
599
|
+
const E = a.activePath;
|
|
600
|
+
(O = n == null ? void 0 : n.trackPageLeave) == null || O.call(n, E, E, b), a.fromPath = E, a.toPath = b, a.activePath = b, (G = n == null ? void 0 : n.trackPageEnter) == null || G.call(n, b, E, b);
|
|
601
601
|
}
|
|
602
|
-
async function
|
|
603
|
-
var b,
|
|
602
|
+
async function L(m, y) {
|
|
603
|
+
var b, S;
|
|
604
604
|
const v = W(m), D = B(v);
|
|
605
605
|
await Promise.all(
|
|
606
|
-
D.map((
|
|
606
|
+
D.map((E) => s.asyncLoaders.get(E)).filter((E) => !!E).map((E) => ne(E))
|
|
607
607
|
);
|
|
608
608
|
const w = a.activePath;
|
|
609
|
-
w !== v && ((b =
|
|
609
|
+
w !== v && ((b = n == null ? void 0 : n.trackPageLeave) == null || b.call(n, w, w, v)), a.fromPath = w, a.toPath = v, a.activePath = v, y && _(v, y), (S = n == null ? void 0 : n.trackPageEnter) == null || S.call(n, v, w, v);
|
|
610
610
|
}
|
|
611
611
|
function _(m, y) {
|
|
612
612
|
const v = B(m).at(-1);
|
|
@@ -624,51 +624,51 @@ function Ze(e, o) {
|
|
|
624
624
|
async function p(m, y) {
|
|
625
625
|
if (!m && m !== 0) return;
|
|
626
626
|
if (typeof m == "number" && m < 0) {
|
|
627
|
-
|
|
627
|
+
M(Math.abs(m), y);
|
|
628
628
|
return;
|
|
629
629
|
}
|
|
630
630
|
const v = m.toString();
|
|
631
631
|
if (v.startsWith("/")) {
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
if (
|
|
635
|
-
|
|
632
|
+
const S = B(v), E = B(a.activePath);
|
|
633
|
+
if (S.length < E.length && S.every(($, se) => E[se] === $)) {
|
|
634
|
+
if (E.length - S.length === 1)
|
|
635
|
+
M(1, y);
|
|
636
636
|
else {
|
|
637
|
-
const se =
|
|
638
|
-
for (let re =
|
|
639
|
-
a.routeAttrs.delete(
|
|
640
|
-
a.activePath =
|
|
637
|
+
const se = E.slice(0, S.length + 1), Ne = K(se);
|
|
638
|
+
for (let re = S.length + 1; re < E.length; re++)
|
|
639
|
+
a.routeAttrs.delete(E[re]);
|
|
640
|
+
a.activePath = Ne, await k(), M(1, y);
|
|
641
641
|
}
|
|
642
642
|
return;
|
|
643
643
|
}
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
(a.routeKeys.get(
|
|
648
|
-
), await
|
|
644
|
+
const G = S.at(-1);
|
|
645
|
+
G && E.at(-1) === G && a.routeKeys.set(
|
|
646
|
+
G,
|
|
647
|
+
(a.routeKeys.get(G) || 0) + 1
|
|
648
|
+
), await L(v, y);
|
|
649
649
|
return;
|
|
650
650
|
}
|
|
651
651
|
const D = B(a.activePath), w = D.indexOf(v);
|
|
652
652
|
if (w !== -1) {
|
|
653
|
-
const
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
else if (
|
|
657
|
-
const
|
|
658
|
-
for (let
|
|
659
|
-
a.routeAttrs.delete(D[
|
|
660
|
-
a.activePath = O, await k(),
|
|
653
|
+
const S = D.length - (w + 1);
|
|
654
|
+
if (S === 1)
|
|
655
|
+
M(1, y);
|
|
656
|
+
else if (S > 1) {
|
|
657
|
+
const E = D.slice(0, w + 2), O = K(E);
|
|
658
|
+
for (let G = w + 2; G < D.length; G++)
|
|
659
|
+
a.routeAttrs.delete(D[G]);
|
|
660
|
+
a.activePath = O, await k(), M(1, y);
|
|
661
661
|
} else
|
|
662
|
-
a.routeKeys.set(v, (a.routeKeys.get(v) || 0) + 1), await
|
|
662
|
+
a.routeKeys.set(v, (a.routeKeys.get(v) || 0) + 1), await L(
|
|
663
663
|
K(D.slice(0, w + 1)),
|
|
664
664
|
y
|
|
665
665
|
);
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
668
668
|
const b = K([...D, v]);
|
|
669
|
-
await
|
|
669
|
+
await L(b, y);
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function r(m) {
|
|
672
672
|
if (typeof m == "number" && m < 0) {
|
|
673
673
|
const w = B(a.activePath), b = Math.min(Math.abs(m), w.length - 1);
|
|
674
674
|
return b <= 0 ? a.activePath : K(w.slice(0, -b));
|
|
@@ -678,7 +678,7 @@ function Ze(e, o) {
|
|
|
678
678
|
const v = B(a.activePath), D = v.indexOf(y);
|
|
679
679
|
return D !== -1 ? K(v.slice(0, D + 1)) : K([...v, y]);
|
|
680
680
|
}
|
|
681
|
-
const
|
|
681
|
+
const l = { getRoute: (m) => s.routes.get(m) };
|
|
682
682
|
async function P(m, y) {
|
|
683
683
|
var v;
|
|
684
684
|
if (!f.value) {
|
|
@@ -686,16 +686,16 @@ function Ze(e, o) {
|
|
|
686
686
|
try {
|
|
687
687
|
const D = (((v = t.beforeEach) == null ? void 0 : v.length) ?? 0) > 0, w = s.routes.size > 0;
|
|
688
688
|
if ((D || w) && m) {
|
|
689
|
-
const
|
|
690
|
-
if (!await
|
|
689
|
+
const E = r(m), O = W(a.activePath);
|
|
690
|
+
if (!await Se(E, O, t, l)) {
|
|
691
691
|
f.value = !1;
|
|
692
692
|
return;
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
695
|
const b = W(a.activePath);
|
|
696
696
|
await p(m, y);
|
|
697
|
-
const
|
|
698
|
-
h == null || h.record(
|
|
697
|
+
const S = W(a.activePath);
|
|
698
|
+
h == null || h.record(S, y), qe(S, b, t.afterEach), s.preloadAdjacent(B(a.activePath)), u.schedule(() => {
|
|
699
699
|
f.value = !1;
|
|
700
700
|
}, i);
|
|
701
701
|
} catch (D) {
|
|
@@ -703,7 +703,7 @@ function Ze(e, o) {
|
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
const h = c.enabled ?
|
|
706
|
+
const h = c.enabled ? Je(c, async (m) => {
|
|
707
707
|
const y = B(a.activePath), v = B(m);
|
|
708
708
|
if (v.length < y.length && v.every((w, b) => y[b] === w)) {
|
|
709
709
|
const w = y.length - v.length;
|
|
@@ -711,11 +711,11 @@ function Ze(e, o) {
|
|
|
711
711
|
} else
|
|
712
712
|
await P(m);
|
|
713
713
|
}) : void 0;
|
|
714
|
-
h && h.record(W(
|
|
715
|
-
const
|
|
714
|
+
h && h.record(W(o));
|
|
715
|
+
const A = Ze({
|
|
716
716
|
getActivePath: () => a.activePath,
|
|
717
717
|
pushCore: p,
|
|
718
|
-
runGuards: (m, y) =>
|
|
718
|
+
runGuards: (m, y) => Se(m, y, t, l),
|
|
719
719
|
scheduleUnlock: () => u.schedule(() => {
|
|
720
720
|
f.value = !1;
|
|
721
721
|
}, i),
|
|
@@ -729,17 +729,17 @@ function Ze(e, o) {
|
|
|
729
729
|
stepDelay: i
|
|
730
730
|
});
|
|
731
731
|
return {
|
|
732
|
-
activePath:
|
|
733
|
-
fromPath:
|
|
734
|
-
toPath:
|
|
735
|
-
activePage:
|
|
736
|
-
fromPage:
|
|
737
|
-
toPage:
|
|
738
|
-
isNavigating:
|
|
732
|
+
activePath: C(() => a.activePath),
|
|
733
|
+
fromPath: C(() => a.fromPath),
|
|
734
|
+
toPath: C(() => a.toPath),
|
|
735
|
+
activePage: C(() => H(a.activePath)),
|
|
736
|
+
fromPage: C(() => H(a.fromPath)),
|
|
737
|
+
toPage: C(() => H(a.toPath)),
|
|
738
|
+
isNavigating: C(() => f.value),
|
|
739
739
|
resolveRoutes: R,
|
|
740
740
|
push: P,
|
|
741
|
-
stepWisePush:
|
|
742
|
-
stepWiseBack:
|
|
741
|
+
stepWisePush: A.stepWisePush,
|
|
742
|
+
stepWiseBack: A.stepWiseBack,
|
|
743
743
|
registerRoute: s.registerRoute,
|
|
744
744
|
registerRoutes: s.registerRoutes,
|
|
745
745
|
updateRouteAttrs: T,
|
|
@@ -750,68 +750,68 @@ function Ze(e, o) {
|
|
|
750
750
|
cleanup: u.cleanup
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
|
-
const
|
|
753
|
+
const F = () => {
|
|
754
754
|
};
|
|
755
|
-
function
|
|
755
|
+
function et(e) {
|
|
756
756
|
return {
|
|
757
|
-
trackPageEnter: (e == null ? void 0 : e.trackPageEnter) ??
|
|
758
|
-
trackPageLeave: (e == null ? void 0 : e.trackPageLeave) ??
|
|
759
|
-
trackDialogEnter: (e == null ? void 0 : e.trackDialogEnter) ??
|
|
760
|
-
trackDialogLeave: (e == null ? void 0 : e.trackDialogLeave) ??
|
|
761
|
-
trackGuiEnter: (e == null ? void 0 : e.trackGuiEnter) ??
|
|
762
|
-
trackGuiLeave: (e == null ? void 0 : e.trackGuiLeave) ??
|
|
763
|
-
cleanupAllSessions: (e == null ? void 0 : e.cleanupAllSessions) ??
|
|
757
|
+
trackPageEnter: (e == null ? void 0 : e.trackPageEnter) ?? F,
|
|
758
|
+
trackPageLeave: (e == null ? void 0 : e.trackPageLeave) ?? F,
|
|
759
|
+
trackDialogEnter: (e == null ? void 0 : e.trackDialogEnter) ?? F,
|
|
760
|
+
trackDialogLeave: (e == null ? void 0 : e.trackDialogLeave) ?? F,
|
|
761
|
+
trackGuiEnter: (e == null ? void 0 : e.trackGuiEnter) ?? F,
|
|
762
|
+
trackGuiLeave: (e == null ? void 0 : e.trackGuiLeave) ?? F,
|
|
763
|
+
cleanupAllSessions: (e == null ? void 0 : e.cleanupAllSessions) ?? F
|
|
764
764
|
};
|
|
765
765
|
}
|
|
766
|
-
function
|
|
767
|
-
const
|
|
766
|
+
function tt(e) {
|
|
767
|
+
const n = et(e.tracker), o = ke(
|
|
768
768
|
{
|
|
769
769
|
defaultPath: e.defaultPath,
|
|
770
770
|
stepDelay: e.stepDelay,
|
|
771
771
|
guards: e.guards,
|
|
772
772
|
history: e.history
|
|
773
773
|
},
|
|
774
|
-
|
|
775
|
-
), i =
|
|
774
|
+
n
|
|
775
|
+
), i = je(n), t = Xe(
|
|
776
776
|
{
|
|
777
777
|
defaultControlName: e.defaultControlName,
|
|
778
778
|
onboardingControlName: e.onboardingControlName
|
|
779
779
|
},
|
|
780
|
-
|
|
781
|
-
), c = e.volumeRef ?
|
|
780
|
+
n
|
|
781
|
+
), c = e.volumeRef ? Ye({
|
|
782
782
|
volumeRef: e.volumeRef,
|
|
783
783
|
defaultBgm: e.defaultBgm
|
|
784
784
|
}) : null, u = {
|
|
785
785
|
// Navigation
|
|
786
|
-
activePath:
|
|
787
|
-
fromPath:
|
|
788
|
-
toPath:
|
|
789
|
-
activePage:
|
|
790
|
-
fromPage:
|
|
791
|
-
toPage:
|
|
792
|
-
isNavigating:
|
|
793
|
-
resolveRoutes:
|
|
786
|
+
activePath: o.activePath,
|
|
787
|
+
fromPath: o.fromPath,
|
|
788
|
+
toPath: o.toPath,
|
|
789
|
+
activePage: o.activePage,
|
|
790
|
+
fromPage: o.fromPage,
|
|
791
|
+
toPage: o.toPage,
|
|
792
|
+
isNavigating: o.isNavigating,
|
|
793
|
+
resolveRoutes: o.resolveRoutes,
|
|
794
794
|
push: async (a, d) => {
|
|
795
|
-
await
|
|
795
|
+
await o.push(a, d), c && c.updateBackgroundMusic(o.activePath.value, o.routes);
|
|
796
796
|
},
|
|
797
797
|
stepWisePush: async (a, d) => {
|
|
798
|
-
await
|
|
798
|
+
await o.stepWisePush(a, d), c && c.updateBackgroundMusic(o.activePath.value, o.routes);
|
|
799
799
|
},
|
|
800
800
|
stepWiseBack: async (a) => {
|
|
801
|
-
await
|
|
801
|
+
await o.stepWiseBack(a), c && c.updateBackgroundMusic(o.activePath.value, o.routes);
|
|
802
802
|
},
|
|
803
|
-
registerRoute:
|
|
804
|
-
registerRoutes:
|
|
805
|
-
updateRouteAttrs:
|
|
806
|
-
getRouteAttrs:
|
|
807
|
-
preloadRoute:
|
|
803
|
+
registerRoute: o.registerRoute,
|
|
804
|
+
registerRoutes: o.registerRoutes,
|
|
805
|
+
updateRouteAttrs: o.updateRouteAttrs,
|
|
806
|
+
getRouteAttrs: o.getRouteAttrs,
|
|
807
|
+
preloadRoute: o.preloadRoute,
|
|
808
808
|
// History (conditional — only if enabled)
|
|
809
|
-
...
|
|
810
|
-
canGoBack:
|
|
811
|
-
canGoForward:
|
|
812
|
-
historyBack:
|
|
813
|
-
historyForward:
|
|
814
|
-
historyGo:
|
|
809
|
+
...o.history ? {
|
|
810
|
+
canGoBack: o.history.canGoBack,
|
|
811
|
+
canGoForward: o.history.canGoForward,
|
|
812
|
+
historyBack: o.history.back,
|
|
813
|
+
historyForward: o.history.forward,
|
|
814
|
+
historyGo: o.history.go
|
|
815
815
|
} : {},
|
|
816
816
|
// Dialogs
|
|
817
817
|
activeDialog: i.activeDialog,
|
|
@@ -835,7 +835,7 @@ function et(e) {
|
|
|
835
835
|
getControlAttrs: t.getControlAttrs,
|
|
836
836
|
updateControlAttrs: t.updateControlAttrs,
|
|
837
837
|
// Serialization
|
|
838
|
-
serialize: () =>
|
|
838
|
+
serialize: () => Ve(u),
|
|
839
839
|
restore: (a) => xe(u, a),
|
|
840
840
|
// Audio (conditional — only if volumeRef provided in config)
|
|
841
841
|
...c ? {
|
|
@@ -846,156 +846,156 @@ function et(e) {
|
|
|
846
846
|
updateBackgroundMusic: c.updateBackgroundMusic
|
|
847
847
|
} : {}
|
|
848
848
|
}, s = H(e.defaultPath);
|
|
849
|
-
return X(
|
|
849
|
+
return X(o.activePage, (a, d) => {
|
|
850
850
|
if (!d) return;
|
|
851
851
|
const R = t.currentControl.value;
|
|
852
|
-
d === s && a !== s &&
|
|
852
|
+
d === s && a !== s && n.trackGuiLeave(R), a === s && d !== s && n.trackGuiEnter(R);
|
|
853
853
|
}), c && e.defaultBgm && e.bgmStartRef && X(e.bgmStartRef, (a) => {
|
|
854
854
|
a && !c.isStarted() && c.playSoundSync(e.defaultBgm, !0);
|
|
855
855
|
}, { flush: "sync" }), q(async () => {
|
|
856
|
-
await k(), t.toggleControl(e.defaultControlName, !0),
|
|
857
|
-
|
|
856
|
+
await k(), t.toggleControl(e.defaultControlName, !0), n.trackPageEnter(
|
|
857
|
+
o.activePath.value,
|
|
858
858
|
void 0,
|
|
859
|
-
|
|
859
|
+
o.activePath.value
|
|
860
860
|
), c && document.addEventListener("visibilitychange", c.handleVisibilityChange), ze(u);
|
|
861
861
|
}), he(() => {
|
|
862
|
-
|
|
863
|
-
}), N(Me, u),
|
|
862
|
+
n.cleanupAllSessions(), o.cleanup(), i.cleanup(), t.cleanup(), c && (document.removeEventListener("visibilitychange", c.handleVisibilityChange), c.cleanup());
|
|
863
|
+
}), N(Me, u), V(de, null) || N(de, u), u;
|
|
864
864
|
}
|
|
865
865
|
function J(e) {
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
866
|
+
const n = e != null && e.root ? de : Me, o = V(n);
|
|
867
|
+
if (!o)
|
|
868
868
|
throw new Error(
|
|
869
869
|
e != null && e.root ? "[vue-micro-router] useMicroRouter({ root: true }) failed — no root <MicroRouterView> found." : "[vue-micro-router] useMicroRouter() must be called inside <MicroRouterView>. Did you forget to wrap your app with <MicroRouterView>?"
|
|
870
870
|
);
|
|
871
|
-
return
|
|
871
|
+
return o;
|
|
872
872
|
}
|
|
873
|
-
function
|
|
874
|
-
const
|
|
875
|
-
!
|
|
873
|
+
function yt(e) {
|
|
874
|
+
const n = V(ae), o = V(ie);
|
|
875
|
+
!n && !e && console.warn(
|
|
876
876
|
"[vue-micro-router] useMicroState() called without provider and no defaults. Ensure component is inside <RoutePage>, <MicroDialog>, or <MicroControlWrapper>."
|
|
877
877
|
);
|
|
878
|
-
const i = (
|
|
878
|
+
const i = (n == null ? void 0 : n()) ?? {}, t = e ? { ...e } : {};
|
|
879
879
|
for (const s of Object.keys(i))
|
|
880
880
|
t[s] = i[s];
|
|
881
881
|
const c = pe(t);
|
|
882
|
-
|
|
882
|
+
o && X(
|
|
883
883
|
c,
|
|
884
|
-
(s) =>
|
|
884
|
+
(s) => o({ ...s }),
|
|
885
885
|
{ deep: !0, flush: "post" }
|
|
886
886
|
);
|
|
887
|
-
const u =
|
|
887
|
+
const u = Oe(c);
|
|
888
888
|
return new Proxy(u, {
|
|
889
889
|
get(s, f, a) {
|
|
890
|
-
return typeof f == "string" && !(f in s) && (s[f] =
|
|
890
|
+
return typeof f == "string" && !(f in s) && (s[f] = Ke(c, f)), Reflect.get(s, f, a);
|
|
891
891
|
}
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
const
|
|
896
|
-
if (!
|
|
894
|
+
function Pt(e) {
|
|
895
|
+
const n = V(Le);
|
|
896
|
+
if (!n) {
|
|
897
897
|
console.warn(
|
|
898
898
|
"[vue-micro-router] useRouteLifecycle() must be called inside a route component rendered by <MicroRouterView>."
|
|
899
899
|
);
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
|
-
const { activePage:
|
|
903
|
-
let i =
|
|
902
|
+
const { activePage: o } = J();
|
|
903
|
+
let i = o.value === n;
|
|
904
904
|
i && q(() => {
|
|
905
905
|
var t;
|
|
906
906
|
return (t = e.onRouteEnter) == null ? void 0 : t.call(e);
|
|
907
|
-
}), X(
|
|
907
|
+
}), X(o, (t) => {
|
|
908
908
|
var u, s;
|
|
909
|
-
const c = t ===
|
|
909
|
+
const c = t === n;
|
|
910
910
|
c && !i ? (u = e.onRouteEnter) == null || u.call(e) : !c && i && ((s = e.onRouteLeave) == null || s.call(e)), i = c;
|
|
911
911
|
});
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
const
|
|
915
|
-
if (!
|
|
913
|
+
function wt(e) {
|
|
914
|
+
const n = V(Te);
|
|
915
|
+
if (!n) {
|
|
916
916
|
console.warn(
|
|
917
917
|
"[vue-micro-router] useDialogLifecycle() must be called inside a dialog component rendered by <MicroDialog>."
|
|
918
918
|
);
|
|
919
919
|
return;
|
|
920
920
|
}
|
|
921
|
-
const { activeDialog:
|
|
922
|
-
let i =
|
|
921
|
+
const { activeDialog: o } = J();
|
|
922
|
+
let i = o.value === n;
|
|
923
923
|
i && q(() => {
|
|
924
924
|
var t;
|
|
925
925
|
return (t = e.onDialogEnter) == null ? void 0 : t.call(e);
|
|
926
|
-
}), X(
|
|
926
|
+
}), X(o, (t) => {
|
|
927
927
|
var u, s;
|
|
928
|
-
const c = t ===
|
|
928
|
+
const c = t === n;
|
|
929
929
|
c && !i ? (u = e.onDialogEnter) == null || u.call(e) : !c && i && ((s = e.onDialogLeave) == null || s.call(e)), i = c;
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
|
-
function
|
|
933
|
-
const
|
|
934
|
-
if (!
|
|
932
|
+
function Dt(e) {
|
|
933
|
+
const n = V(_e);
|
|
934
|
+
if (!n) {
|
|
935
935
|
console.warn(
|
|
936
936
|
"[vue-micro-router] useControlLifecycle() must be called inside a control component rendered by <MicroControlWrapper>."
|
|
937
937
|
);
|
|
938
938
|
return;
|
|
939
939
|
}
|
|
940
|
-
const { currentControl:
|
|
941
|
-
let i =
|
|
940
|
+
const { currentControl: o } = J();
|
|
941
|
+
let i = o.value === n;
|
|
942
942
|
i && q(() => {
|
|
943
943
|
var t;
|
|
944
944
|
return (t = e.onControlEnter) == null ? void 0 : t.call(e);
|
|
945
|
-
}), X(
|
|
945
|
+
}), X(o, (t) => {
|
|
946
946
|
var u, s;
|
|
947
|
-
const c = t ===
|
|
947
|
+
const c = t === n;
|
|
948
948
|
c && !i ? (u = e.onControlEnter) == null || u.call(e) : !c && i && ((s = e.onControlLeave) == null || s.call(e)), i = c;
|
|
949
949
|
});
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function nt(e, n) {
|
|
952
952
|
if (!e.enabled) return;
|
|
953
|
-
const
|
|
953
|
+
const o = e.edgeWidth ?? 20, i = e.threshold ?? 0.3, t = e.velocityThreshold ?? 0.5;
|
|
954
954
|
let c = 0, u = 0, s = 0, f = !1, a = null, d = null;
|
|
955
955
|
function R() {
|
|
956
|
-
const
|
|
957
|
-
return
|
|
956
|
+
const r = n.containerRef.value;
|
|
957
|
+
return r ? "$el" in r ? r.$el : r : null;
|
|
958
958
|
}
|
|
959
|
-
function
|
|
960
|
-
const
|
|
961
|
-
if (!
|
|
962
|
-
const
|
|
963
|
-
return
|
|
964
|
-
current:
|
|
965
|
-
previous:
|
|
959
|
+
function M() {
|
|
960
|
+
const r = R();
|
|
961
|
+
if (!r) return { current: null, previous: null };
|
|
962
|
+
const l = r.querySelectorAll(".route-page");
|
|
963
|
+
return l.length < 2 ? { current: l[l.length - 1] ?? null, previous: null } : {
|
|
964
|
+
current: l[l.length - 1],
|
|
965
|
+
previous: l[l.length - 2]
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
|
-
function
|
|
969
|
-
var
|
|
970
|
-
if (!
|
|
971
|
-
const { current:
|
|
972
|
-
if (!
|
|
973
|
-
f = !0, c =
|
|
968
|
+
function L(r) {
|
|
969
|
+
var A;
|
|
970
|
+
if (!n.canGoBack() || r.clientX > o) return;
|
|
971
|
+
const { current: l, previous: P } = M();
|
|
972
|
+
if (!l) return;
|
|
973
|
+
f = !0, c = r.clientX, u = r.clientY, s = Date.now(), a = l, d = P;
|
|
974
974
|
const h = R();
|
|
975
|
-
(
|
|
975
|
+
(A = h == null ? void 0 : h.setPointerCapture) == null || A.call(h, r.pointerId), a.style.willChange = "transform", d && (d.style.willChange = "transform", d.style.transition = "none"), a.style.transition = "none";
|
|
976
976
|
}
|
|
977
|
-
function _(
|
|
977
|
+
function _(r) {
|
|
978
978
|
if (!f || !a) return;
|
|
979
|
-
const
|
|
980
|
-
if (Math.abs(
|
|
979
|
+
const l = Math.max(0, r.clientX - c);
|
|
980
|
+
if (Math.abs(r.clientY - u) > l * 1.5) {
|
|
981
981
|
g();
|
|
982
982
|
return;
|
|
983
983
|
}
|
|
984
|
-
const h =
|
|
985
|
-
if (a.style.transform = `translateX(${
|
|
986
|
-
const
|
|
987
|
-
d.style.transform = `translateX(${
|
|
984
|
+
const h = l / window.innerWidth;
|
|
985
|
+
if (a.style.transform = `translateX(${l}px)`, d) {
|
|
986
|
+
const A = -20 + 20 * h;
|
|
987
|
+
d.style.transform = `translateX(${A}%)`;
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
|
-
function T(
|
|
990
|
+
function T(r) {
|
|
991
991
|
if (!f || !a) return;
|
|
992
992
|
if (!a.isConnected) {
|
|
993
993
|
p(), f = !1;
|
|
994
994
|
return;
|
|
995
995
|
}
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
p(),
|
|
996
|
+
const l = r.clientX - c, P = Date.now() - s, h = l / P;
|
|
997
|
+
l / window.innerWidth > i || h > t ? (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(100%)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(0)"), setTimeout(() => {
|
|
998
|
+
p(), n.goBack();
|
|
999
999
|
}, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(p, 200)), f = !1;
|
|
1000
1000
|
}
|
|
1001
1001
|
function g() {
|
|
@@ -1005,126 +1005,136 @@ function tt(e, o) {
|
|
|
1005
1005
|
a && (a.style.willChange = "", a.style.transition = "", a.style.transform = ""), d && (d.style.willChange = "", d.style.transition = "", d.style.transform = ""), a = null, d = null;
|
|
1006
1006
|
}
|
|
1007
1007
|
q(() => {
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1008
|
+
const r = R();
|
|
1009
|
+
r != null && r.addEventListener && (r.addEventListener("pointerdown", L, { passive: !0 }), r.addEventListener("pointermove", _, { passive: !0 }), r.addEventListener("pointerup", T, { passive: !0 }), r.addEventListener("pointercancel", g, { passive: !0 }));
|
|
1010
1010
|
}), he(() => {
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1011
|
+
const r = R();
|
|
1012
|
+
r != null && r.removeEventListener && (r.removeEventListener("pointerdown", L), r.removeEventListener("pointermove", _), r.removeEventListener("pointerup", T), r.removeEventListener("pointercancel", g));
|
|
1013
1013
|
});
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1015
|
+
function At(e) {
|
|
1016
1016
|
return { ...e };
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1019
|
-
var
|
|
1018
|
+
function ot(e, n) {
|
|
1019
|
+
var o, i, t;
|
|
1020
1020
|
for (const c of e)
|
|
1021
|
-
(
|
|
1021
|
+
(o = c.routes) != null && o.length && n.registerRoutes(c.routes), (i = c.dialogs) != null && i.length && n.registerDialogs(c.dialogs), (t = c.controls) != null && t.length && n.registerControls(c.controls);
|
|
1022
1022
|
}
|
|
1023
|
-
const
|
|
1023
|
+
const at = /* @__PURE__ */ oe({
|
|
1024
1024
|
__name: "MicroControlWrapper",
|
|
1025
1025
|
props: {
|
|
1026
1026
|
control: {}
|
|
1027
1027
|
},
|
|
1028
1028
|
setup(e) {
|
|
1029
|
-
const
|
|
1030
|
-
return N(_e,
|
|
1031
|
-
i(
|
|
1032
|
-
}), (t, c) => (
|
|
1029
|
+
const n = e, { getControlAttrs: o, updateControlAttrs: i } = J();
|
|
1030
|
+
return N(_e, n.control.name), N(ae, () => o(n.control.name)), N(ie, (t) => {
|
|
1031
|
+
i(n.control.name, t);
|
|
1032
|
+
}), (t, c) => (I(), z(ye(e.control.component), Pe({
|
|
1033
1033
|
key: e.control.componentKey || 0
|
|
1034
1034
|
}, e.control.attrs), null, 16));
|
|
1035
1035
|
}
|
|
1036
1036
|
});
|
|
1037
|
-
let Z = 0,
|
|
1038
|
-
function at() {
|
|
1039
|
-
Z === 0 && (Ge = document.body.style.overflow, document.body.style.overflow = "hidden"), Z++;
|
|
1040
|
-
}
|
|
1037
|
+
let Z = 0, Ie = "";
|
|
1041
1038
|
function it() {
|
|
1042
|
-
Z
|
|
1039
|
+
Z === 0 && (Ie = document.body.style.overflow, document.body.style.overflow = "hidden"), Z++;
|
|
1040
|
+
}
|
|
1041
|
+
function st() {
|
|
1042
|
+
Z = Math.max(0, Z - 1), Z === 0 && (document.body.style.overflow = Ie);
|
|
1043
|
+
}
|
|
1044
|
+
const rt = /* @__PURE__ */ new Set(["A", "BUTTON", "INPUT", "SELECT", "TEXTAREA"]);
|
|
1045
|
+
function lt(e) {
|
|
1046
|
+
return !(!rt.has(e.tagName) && !e.hasAttribute("tabindex") || e.tagName === "A" && !e.hasAttribute("href") || e.offsetParent === null || e.getAttribute("aria-hidden") === "true" || e.getAttribute("tabindex") === "-1" || e.hasAttribute("disabled") || e instanceof HTMLInputElement && e.type === "hidden");
|
|
1047
|
+
}
|
|
1048
|
+
function Ge(e) {
|
|
1049
|
+
return Array.from(
|
|
1050
|
+
e.querySelectorAll("*")
|
|
1051
|
+
).filter(lt);
|
|
1052
|
+
}
|
|
1053
|
+
function ct(e) {
|
|
1054
|
+
const n = Ge(e);
|
|
1055
|
+
return n.find((o) => o.hasAttribute("autofocus")) ?? n[0] ?? e;
|
|
1043
1056
|
}
|
|
1044
|
-
const
|
|
1057
|
+
const ut = /* @__PURE__ */ oe({
|
|
1045
1058
|
__name: "MicroDialog",
|
|
1046
1059
|
props: {
|
|
1047
1060
|
dialog: {},
|
|
1048
1061
|
stackIndex: {}
|
|
1049
1062
|
},
|
|
1050
1063
|
emits: ["close"],
|
|
1051
|
-
setup(e, { emit:
|
|
1052
|
-
const
|
|
1064
|
+
setup(e, { emit: n }) {
|
|
1065
|
+
const o = e, i = n, { getDialogAttrs: t, updateDialogAttrs: c } = J();
|
|
1053
1066
|
let u = !1;
|
|
1054
|
-
const s = ee(null), f = ee(null), a =
|
|
1055
|
-
function
|
|
1056
|
-
return s.value ?
|
|
1057
|
-
s.value.querySelectorAll(st)
|
|
1058
|
-
).filter((r) => r.offsetParent !== null) : [];
|
|
1067
|
+
const s = ee(null), f = ee(null), a = C(() => o.dialog.transition ?? "scale"), d = C(() => o.dialog.transitionDuration != null ? o.dialog.transitionDuration : a.value === "slide" ? 500 : 300), R = C(() => o.dialog.position ?? "standard"), M = C(() => o.dialog.seamless ?? !1);
|
|
1068
|
+
function L() {
|
|
1069
|
+
return s.value ? Ge(s.value) : [];
|
|
1059
1070
|
}
|
|
1060
|
-
function _(
|
|
1071
|
+
function _(l) {
|
|
1061
1072
|
var v, D;
|
|
1062
|
-
if (
|
|
1063
|
-
if (
|
|
1064
|
-
|
|
1073
|
+
if (l.key === "Escape") {
|
|
1074
|
+
if (o.dialog.persistent) return;
|
|
1075
|
+
l.preventDefault(), l.stopPropagation(), i("close", o.dialog.path);
|
|
1065
1076
|
return;
|
|
1066
1077
|
}
|
|
1067
|
-
if (
|
|
1068
|
-
const P =
|
|
1078
|
+
if (l.key !== "Tab") return;
|
|
1079
|
+
const P = L();
|
|
1069
1080
|
if (P.length === 0) {
|
|
1070
|
-
|
|
1081
|
+
l.preventDefault(), (v = s.value) == null || v.focus();
|
|
1071
1082
|
return;
|
|
1072
1083
|
}
|
|
1073
|
-
const h = P[0],
|
|
1074
|
-
|
|
1084
|
+
const h = P[0], A = P[P.length - 1], m = document.activeElement, y = !!((D = s.value) != null && D.contains(m));
|
|
1085
|
+
l.shiftKey ? (!y || m === h) && (l.preventDefault(), A.focus()) : (!y || m === A) && (l.preventDefault(), h.focus());
|
|
1075
1086
|
}
|
|
1076
|
-
function T(
|
|
1077
|
-
|
|
1087
|
+
function T(l) {
|
|
1088
|
+
o.dialog.persistent || l.target === l.currentTarget && i("close", o.dialog.path);
|
|
1078
1089
|
}
|
|
1079
|
-
function g(
|
|
1080
|
-
if (!
|
|
1081
|
-
|
|
1090
|
+
function g(l) {
|
|
1091
|
+
if (!o.dialog.focusInput || !s.value) {
|
|
1092
|
+
l();
|
|
1082
1093
|
return;
|
|
1083
1094
|
}
|
|
1084
1095
|
const P = document.createElement("input");
|
|
1085
1096
|
P.style.cssText = "position:fixed;opacity:0;height:0;width:0;top:-100px;", s.value.appendChild(P), P.focus(), setTimeout(() => {
|
|
1086
|
-
P.remove(),
|
|
1097
|
+
P.remove(), l();
|
|
1087
1098
|
}, 50);
|
|
1088
1099
|
}
|
|
1089
1100
|
function p() {
|
|
1090
|
-
u || (u = !0, f.value = document.activeElement,
|
|
1101
|
+
u || (u = !0, f.value = document.activeElement, it(), k(() => {
|
|
1091
1102
|
s.value && g(() => {
|
|
1092
|
-
|
|
1093
|
-
(M()[0] ?? s.value).focus();
|
|
1103
|
+
s.value && ct(s.value).focus();
|
|
1094
1104
|
});
|
|
1095
1105
|
}));
|
|
1096
1106
|
}
|
|
1097
|
-
function
|
|
1107
|
+
function r() {
|
|
1098
1108
|
var m;
|
|
1099
1109
|
if (!u) return;
|
|
1100
|
-
u = !1,
|
|
1101
|
-
const
|
|
1110
|
+
u = !1, st();
|
|
1111
|
+
const l = f.value;
|
|
1102
1112
|
f.value = null;
|
|
1103
|
-
const P = document.activeElement, h = !!((m = s.value) != null && m.contains(P)),
|
|
1104
|
-
|
|
1113
|
+
const P = document.activeElement, h = !!((m = s.value) != null && m.contains(P)), A = !P || P === document.body;
|
|
1114
|
+
l && typeof l.focus == "function" && document.contains(l) && (h || A) && l.focus();
|
|
1105
1115
|
}
|
|
1106
|
-
return N(Te,
|
|
1107
|
-
c(
|
|
1116
|
+
return N(Te, o.dialog.path), N(ae, () => t(o.dialog.path)), N(ie, (l) => {
|
|
1117
|
+
c(o.dialog.path, l);
|
|
1108
1118
|
}), X(
|
|
1109
|
-
() =>
|
|
1110
|
-
(
|
|
1111
|
-
|
|
1119
|
+
() => o.dialog.activated,
|
|
1120
|
+
(l) => {
|
|
1121
|
+
l && p();
|
|
1112
1122
|
}
|
|
1113
1123
|
), X(
|
|
1114
|
-
() =>
|
|
1115
|
-
(
|
|
1116
|
-
!
|
|
1124
|
+
() => o.dialog.closing,
|
|
1125
|
+
(l) => {
|
|
1126
|
+
!l && !o.dialog.activated && u && r();
|
|
1117
1127
|
}
|
|
1118
1128
|
), q(() => {
|
|
1119
|
-
|
|
1129
|
+
o.dialog.activated && p();
|
|
1120
1130
|
}), he(() => {
|
|
1121
|
-
u &&
|
|
1122
|
-
}), (
|
|
1131
|
+
u && r();
|
|
1132
|
+
}), (l, P) => (I(), z(We, { to: "body" }, [
|
|
1123
1133
|
j("div", {
|
|
1124
1134
|
class: Q(["micro-dialog-portal", [
|
|
1125
1135
|
`micro-dialog--${R.value}`,
|
|
1126
1136
|
e.dialog.fullscreen && "micro-dialog--fullscreen",
|
|
1127
|
-
|
|
1137
|
+
M.value && "micro-dialog--seamless"
|
|
1128
1138
|
]]),
|
|
1129
1139
|
style: be({
|
|
1130
1140
|
zIndex: 100 + e.stackIndex,
|
|
@@ -1132,7 +1142,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1132
1142
|
}),
|
|
1133
1143
|
onClick: le(T, ["self"])
|
|
1134
1144
|
}, [
|
|
1135
|
-
|
|
1145
|
+
M.value ? $e("", !0) : (I(), x("div", {
|
|
1136
1146
|
key: 0,
|
|
1137
1147
|
class: Q(["micro-dialog-backdrop", e.dialog.closing && "micro-dialog-backdrop--closing"])
|
|
1138
1148
|
}, null, 2)),
|
|
@@ -1154,8 +1164,8 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1154
1164
|
onClick: P[0] || (P[0] = le(() => {
|
|
1155
1165
|
}, ["stop"]))
|
|
1156
1166
|
}, [
|
|
1157
|
-
we(
|
|
1158
|
-
(
|
|
1167
|
+
we(l.$slots, "default"),
|
|
1168
|
+
(I(), z(ye(e.dialog.component), Pe({
|
|
1159
1169
|
key: e.dialog.componentKey
|
|
1160
1170
|
}, e.dialog.attrs), null, 16))
|
|
1161
1171
|
])
|
|
@@ -1163,28 +1173,28 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1163
1173
|
], 6)
|
|
1164
1174
|
]));
|
|
1165
1175
|
}
|
|
1166
|
-
}),
|
|
1176
|
+
}), ft = { class: "route-page" }, gt = { class: "route-page__body" }, dt = /* @__PURE__ */ oe({
|
|
1167
1177
|
__name: "RoutePage",
|
|
1168
1178
|
props: {
|
|
1169
1179
|
routePath: {}
|
|
1170
1180
|
},
|
|
1171
1181
|
setup(e) {
|
|
1172
|
-
const
|
|
1173
|
-
if (
|
|
1174
|
-
const
|
|
1175
|
-
N(Le,
|
|
1182
|
+
const n = e;
|
|
1183
|
+
if (n.routePath) {
|
|
1184
|
+
const o = n.routePath;
|
|
1185
|
+
N(Le, o);
|
|
1176
1186
|
const { updateRouteAttrs: i, getRouteAttrs: t } = J();
|
|
1177
|
-
N(ae, () => t(
|
|
1178
|
-
i(
|
|
1187
|
+
N(ae, () => t(o)), N(ie, (c) => {
|
|
1188
|
+
i(o, c);
|
|
1179
1189
|
});
|
|
1180
1190
|
}
|
|
1181
|
-
return (
|
|
1182
|
-
j("div",
|
|
1183
|
-
we(
|
|
1191
|
+
return (o, i) => (I(), x("div", ft, [
|
|
1192
|
+
j("div", gt, [
|
|
1193
|
+
we(o.$slots, "default")
|
|
1184
1194
|
])
|
|
1185
1195
|
]));
|
|
1186
1196
|
}
|
|
1187
|
-
}),
|
|
1197
|
+
}), vt = { class: "micro-router-content-layer" }, Ct = /* @__PURE__ */ oe({
|
|
1188
1198
|
__name: "MicroRouterView",
|
|
1189
1199
|
props: {
|
|
1190
1200
|
config: {},
|
|
@@ -1192,9 +1202,9 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1192
1202
|
nested: { type: Boolean }
|
|
1193
1203
|
},
|
|
1194
1204
|
setup(e) {
|
|
1195
|
-
var p,
|
|
1196
|
-
const
|
|
1197
|
-
(p =
|
|
1205
|
+
var p, r;
|
|
1206
|
+
const n = e, o = tt(n.config);
|
|
1207
|
+
(p = n.plugins) != null && p.length && ot(n.plugins, o);
|
|
1198
1208
|
const {
|
|
1199
1209
|
resolveRoutes: i,
|
|
1200
1210
|
resolveDialogs: t,
|
|
@@ -1203,62 +1213,62 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1203
1213
|
toPath: s,
|
|
1204
1214
|
isNavigating: f,
|
|
1205
1215
|
closeDialog: a
|
|
1206
|
-
} =
|
|
1207
|
-
const
|
|
1208
|
-
return
|
|
1209
|
-
}),
|
|
1210
|
-
const
|
|
1211
|
-
return (
|
|
1212
|
-
}), _ =
|
|
1213
|
-
const
|
|
1214
|
-
return
|
|
1215
|
-
}), g =
|
|
1216
|
-
() => R.value &&
|
|
1216
|
+
} = o, d = ee(null), R = C(() => {
|
|
1217
|
+
const l = u.value.split("/").filter(Boolean), P = new Set(s.value.split("/").filter(Boolean));
|
|
1218
|
+
return l.some((h) => P.has(h));
|
|
1219
|
+
}), M = C(() => c.value.length > 0), L = C(() => {
|
|
1220
|
+
const l = i.value.at(-1);
|
|
1221
|
+
return (l == null ? void 0 : l.transition) ?? "slide";
|
|
1222
|
+
}), _ = C(() => L.value === "none" ? "" : L.value === "fade" ? "page-fade" : "page-slide"), T = C(() => {
|
|
1223
|
+
const l = i.value.at(-1);
|
|
1224
|
+
return l != null && l.transitionDuration ? l.transitionDuration : L.value === "fade" ? 300 : 500;
|
|
1225
|
+
}), g = C(
|
|
1226
|
+
() => R.value && L.value !== "none"
|
|
1217
1227
|
);
|
|
1218
|
-
return (
|
|
1228
|
+
return (r = n.config.gesture) != null && r.enabled && nt(n.config.gesture, {
|
|
1219
1229
|
containerRef: d,
|
|
1220
|
-
goBack: () =>
|
|
1230
|
+
goBack: () => o.push(-1),
|
|
1221
1231
|
canGoBack: () => i.value.length > 1
|
|
1222
|
-
}), (
|
|
1223
|
-
Re(
|
|
1232
|
+
}), (l, P) => (I(), x(te, null, [
|
|
1233
|
+
Re(Ee, {
|
|
1224
1234
|
ref_key: "pageContainerRef",
|
|
1225
1235
|
ref: d,
|
|
1226
1236
|
name: _.value,
|
|
1227
1237
|
css: g.value
|
|
1228
1238
|
}, {
|
|
1229
1239
|
default: ce(() => [
|
|
1230
|
-
(
|
|
1240
|
+
(I(!0), x(te, null, ue(Y(i), (h, A) => (I(), z(dt, {
|
|
1231
1241
|
key: h.key || h.path,
|
|
1232
1242
|
"route-path": h.path,
|
|
1233
1243
|
class: Q({
|
|
1234
|
-
deactivate: Y(i).length > 1 &&
|
|
1244
|
+
deactivate: Y(i).length > 1 && A !== Y(i).length - 1,
|
|
1235
1245
|
"micro-router--navigating": Y(f)
|
|
1236
1246
|
}),
|
|
1237
1247
|
style: be({
|
|
1238
1248
|
transition: g.value ? `transform ${T.value}ms cubic-bezier(0.65, 0, 0.35, 1), opacity ${T.value}ms ease` : "none",
|
|
1239
|
-
zIndex: 10 +
|
|
1249
|
+
zIndex: 10 + A,
|
|
1240
1250
|
"--mr-page-height": e.nested ? "100%" : "100dvh"
|
|
1241
1251
|
})
|
|
1242
1252
|
}, {
|
|
1243
1253
|
default: ce(() => [
|
|
1244
|
-
(
|
|
1254
|
+
(I(), z(ye(h.component), Pe({
|
|
1245
1255
|
key: h.componentKey
|
|
1246
|
-
}, { ref_for: !0 }, Y(
|
|
1256
|
+
}, { ref_for: !0 }, Y(o).getRouteAttrs(h.path)), null, 16))
|
|
1247
1257
|
]),
|
|
1248
1258
|
_: 2
|
|
1249
1259
|
}, 1032, ["route-path", "class", "style"]))), 128))
|
|
1250
1260
|
]),
|
|
1251
1261
|
_: 1
|
|
1252
1262
|
}, 8, ["name", "css"]),
|
|
1253
|
-
j("div",
|
|
1254
|
-
we(
|
|
1263
|
+
j("div", vt, [
|
|
1264
|
+
we(l.$slots, "default")
|
|
1255
1265
|
]),
|
|
1256
1266
|
j("div", {
|
|
1257
|
-
class: Q(["micro-router-gui-layer", { "gui-visible":
|
|
1267
|
+
class: Q(["micro-router-gui-layer", { "gui-visible": M.value }])
|
|
1258
1268
|
}, [
|
|
1259
|
-
Re(
|
|
1269
|
+
Re(Ee, { name: "control-fade" }, {
|
|
1260
1270
|
default: ce(() => [
|
|
1261
|
-
(
|
|
1271
|
+
(I(!0), x(te, null, ue(Y(c), (h) => (I(), z(at, {
|
|
1262
1272
|
key: h.name + "-" + (h.componentKey || 0),
|
|
1263
1273
|
control: h
|
|
1264
1274
|
}, null, 8, ["control"]))), 128))
|
|
@@ -1266,10 +1276,10 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1266
1276
|
_: 1
|
|
1267
1277
|
})
|
|
1268
1278
|
], 2),
|
|
1269
|
-
(
|
|
1279
|
+
(I(!0), x(te, null, ue(Y(t), (h, A) => (I(), z(ut, {
|
|
1270
1280
|
key: "dialog-" + h.path,
|
|
1271
1281
|
dialog: h,
|
|
1272
|
-
"stack-index":
|
|
1282
|
+
"stack-index": A,
|
|
1273
1283
|
onClose: Y(a)
|
|
1274
1284
|
}, null, 8, ["dialog", "stack-index", "onClose"]))), 128))
|
|
1275
1285
|
], 64));
|
|
@@ -1283,29 +1293,29 @@ export {
|
|
|
1283
1293
|
Me as MICRO_ROUTER_KEY,
|
|
1284
1294
|
de as MICRO_ROUTER_ROOT_KEY,
|
|
1285
1295
|
Le as MICRO_ROUTE_PATH_KEY,
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1296
|
+
at as MicroControlWrapper,
|
|
1297
|
+
ut as MicroDialogComponent,
|
|
1298
|
+
Ct as MicroRouterView,
|
|
1299
|
+
dt as RoutePage,
|
|
1300
|
+
Ue as STEP_DELAY,
|
|
1291
1301
|
K as buildPathFromSegments,
|
|
1292
|
-
|
|
1293
|
-
|
|
1302
|
+
ht as createRouterKey,
|
|
1303
|
+
At as defineFeaturePlugin,
|
|
1294
1304
|
H as getLastSegment,
|
|
1295
1305
|
De as isAsyncLoader,
|
|
1296
1306
|
W as normalizePath,
|
|
1297
1307
|
B as parsePathSegments,
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1308
|
+
ot as registerFeaturePlugins,
|
|
1309
|
+
Ae as safeMarkRaw,
|
|
1310
|
+
Dt as useControlLifecycle,
|
|
1311
|
+
Xe as useControlManager,
|
|
1312
|
+
wt as useDialogLifecycle,
|
|
1313
|
+
je as useDialogManager,
|
|
1314
|
+
nt as useGestureNavigation,
|
|
1315
|
+
tt as useGlobalMicroRouter,
|
|
1306
1316
|
J as useMicroRouter,
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1317
|
+
yt as useMicroState,
|
|
1318
|
+
ke as useNavigation,
|
|
1319
|
+
et as usePageTracker,
|
|
1320
|
+
Pt as useRouteLifecycle
|
|
1311
1321
|
};
|