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