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