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