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