vue-micro-router 1.0.53 → 1.0.56
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 +356 -346
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowReactive as U, computed as
|
|
1
|
+
import { shallowReactive as U, computed as A, defineAsyncComponent as me, reactive as pe, nextTick as k, ref as ee, inject as x, watch as X, 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 te, createVNode as Re, TransitionGroup as Se, withCtx as ce, renderList as ue, unref as Y } from "vue";
|
|
2
2
|
import { i as De, s as Ce, g as H, w as ne, p as B, b as K, n as W, u as $e } from "./use-audio-manager.mjs";
|
|
3
3
|
const Me = Symbol("micro-router");
|
|
4
4
|
function vt() {
|
|
@@ -24,62 +24,62 @@ function fe(e) {
|
|
|
24
24
|
function Ue(e, o) {
|
|
25
25
|
const n = e.defaultControlName, i = e.onboardingControlName, t = 300, c = Ae();
|
|
26
26
|
let u = !1;
|
|
27
|
-
const
|
|
27
|
+
const s = U(/* @__PURE__ */ new Map()), f = U(
|
|
28
28
|
/* @__PURE__ */ new Map()
|
|
29
|
-
), a =
|
|
29
|
+
), a = A(() => {
|
|
30
30
|
const l = [];
|
|
31
|
-
for (const
|
|
32
|
-
|
|
31
|
+
for (const r of s.values())
|
|
32
|
+
r.activated && l.push(r);
|
|
33
33
|
return l;
|
|
34
|
-
}), d = a,
|
|
34
|
+
}), d = a, R = A(
|
|
35
35
|
() => a.value.some((l) => l.name !== n)
|
|
36
|
-
), L =
|
|
37
|
-
const l = a.value.find((
|
|
36
|
+
), L = A(() => {
|
|
37
|
+
const l = a.value.find((r) => r.name !== n);
|
|
38
38
|
return (l == null ? void 0 : l.name) ?? n;
|
|
39
39
|
});
|
|
40
|
-
function M(l,
|
|
41
|
-
var
|
|
42
|
-
if (!(
|
|
43
|
-
|
|
40
|
+
function M(l, r, P) {
|
|
41
|
+
var h, C, m;
|
|
42
|
+
if (!(r && u)) {
|
|
43
|
+
r && (u = !0);
|
|
44
44
|
try {
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const v =
|
|
48
|
-
if (
|
|
49
|
-
(
|
|
45
|
+
const y = s.get(l);
|
|
46
|
+
if (!y) return;
|
|
47
|
+
const v = s.get(n), D = l === n || l === i;
|
|
48
|
+
if (r)
|
|
49
|
+
(h = o == null ? void 0 : o.trackGuiEnter) == null || h.call(o, l), D ? s.forEach((w) => {
|
|
50
50
|
var b;
|
|
51
|
-
|
|
52
|
-
...
|
|
51
|
+
w.name !== n && w.activated && ((b = o == null ? void 0 : o.trackGuiLeave) == null || b.call(o, w.name), s.set(w.name, {
|
|
52
|
+
...w,
|
|
53
53
|
activated: !1,
|
|
54
54
|
attrs: void 0
|
|
55
55
|
}));
|
|
56
|
-
}) : v != null && v.activated && ((
|
|
57
|
-
...
|
|
56
|
+
}) : v != null && v.activated && ((C = o == null ? void 0 : o.trackGuiLeave) == null || C.call(o, n), s.set(n, { ...v, activated: !1 })), P && f.set(l, { ...P }), s.set(l, {
|
|
57
|
+
...y,
|
|
58
58
|
activated: !0,
|
|
59
|
-
componentKey: (
|
|
60
|
-
attrs:
|
|
59
|
+
componentKey: (y.componentKey || 0) + 1,
|
|
60
|
+
attrs: P ? { ...P } : void 0
|
|
61
61
|
});
|
|
62
62
|
else {
|
|
63
|
-
(
|
|
64
|
-
const
|
|
65
|
-
if (!D &&
|
|
66
|
-
if (
|
|
67
|
-
|
|
63
|
+
(m = o == null ? void 0 : o.trackGuiLeave) == null || m.call(o, l), f.delete(l), s.set(l, { ...y, activated: !1, attrs: void 0 });
|
|
64
|
+
const w = s.get(n);
|
|
65
|
+
if (!D && w && !w.activated) {
|
|
66
|
+
if (w.name === i) return;
|
|
67
|
+
s.set(n, { ...w, activated: !0 });
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
} finally {
|
|
71
|
-
|
|
71
|
+
r && c.schedule(() => {
|
|
72
72
|
u = !1;
|
|
73
73
|
}, t);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
function _(l) {
|
|
78
|
-
|
|
79
|
-
let { component:
|
|
80
|
-
De(
|
|
78
|
+
s.has(l.name) && console.warn(`[vue-micro-router] Control "${l.name}" already registered. Overwriting.`);
|
|
79
|
+
let { component: r } = l;
|
|
80
|
+
De(r) && (r = me(r)), s.set(l.name, {
|
|
81
81
|
...l,
|
|
82
|
-
component: Ce(
|
|
82
|
+
component: Ce(r)
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
function T(l) {
|
|
@@ -88,19 +88,19 @@ function Ue(e, o) {
|
|
|
88
88
|
function g(l) {
|
|
89
89
|
return f.get(l);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
f.set(l, { ...
|
|
91
|
+
function p(l, r) {
|
|
92
|
+
const P = f.get(l);
|
|
93
|
+
f.set(l, { ...P, ...r });
|
|
94
94
|
}
|
|
95
95
|
return {
|
|
96
96
|
resolveControls: d,
|
|
97
|
-
activeControl:
|
|
97
|
+
activeControl: R,
|
|
98
98
|
currentControl: L,
|
|
99
99
|
toggleControl: M,
|
|
100
100
|
registerControl: _,
|
|
101
101
|
registerControls: T,
|
|
102
102
|
getControlAttrs: g,
|
|
103
|
-
updateControlAttrs:
|
|
103
|
+
updateControlAttrs: p,
|
|
104
104
|
cleanup: c.cleanup
|
|
105
105
|
};
|
|
106
106
|
}
|
|
@@ -202,22 +202,22 @@ async function ze(e) {
|
|
|
202
202
|
}
|
|
203
203
|
function Fe(e) {
|
|
204
204
|
const o = e.activePath.value.split("/").filter(Boolean), n = {};
|
|
205
|
-
for (const
|
|
206
|
-
const f = e.getRouteAttrs(
|
|
207
|
-
f && (n[
|
|
205
|
+
for (const s of o) {
|
|
206
|
+
const f = e.getRouteAttrs(s);
|
|
207
|
+
f && (n[s] = { ...f });
|
|
208
208
|
}
|
|
209
209
|
const i = [], t = {};
|
|
210
|
-
for (const
|
|
211
|
-
if (
|
|
212
|
-
i.push(
|
|
213
|
-
const f = e.getDialogAttrs(
|
|
214
|
-
f && (t[
|
|
210
|
+
for (const s of e.resolveDialogs.value) {
|
|
211
|
+
if (s.closing) continue;
|
|
212
|
+
i.push(s.path);
|
|
213
|
+
const f = e.getDialogAttrs(s.path);
|
|
214
|
+
f && (t[s.path] = { ...f });
|
|
215
215
|
}
|
|
216
216
|
const c = [], u = {};
|
|
217
|
-
for (const
|
|
218
|
-
c.push(
|
|
219
|
-
const f = e.getControlAttrs(
|
|
220
|
-
f && (u[
|
|
217
|
+
for (const s of e.resolveControls.value) {
|
|
218
|
+
c.push(s.name);
|
|
219
|
+
const f = e.getControlAttrs(s.name);
|
|
220
|
+
f && (u[s.name] = { ...f });
|
|
221
221
|
}
|
|
222
222
|
return {
|
|
223
223
|
version: 1,
|
|
@@ -257,28 +257,28 @@ function Ve(e) {
|
|
|
257
257
|
dialogs: U(/* @__PURE__ */ new Map()),
|
|
258
258
|
/** Attrs stored separately for useMicroState access inside dialog components */
|
|
259
259
|
dialogAttrs: U(/* @__PURE__ */ new Map())
|
|
260
|
-
}), c =
|
|
261
|
-
const g = [],
|
|
260
|
+
}), c = A(() => {
|
|
261
|
+
const g = [], p = /* @__PURE__ */ new Set();
|
|
262
262
|
for (const l of t.dialogStack) {
|
|
263
|
-
const
|
|
264
|
-
|
|
263
|
+
const r = t.dialogs.get(l);
|
|
264
|
+
r && (r.activated || r.closing) && (g.push(r), p.add(l));
|
|
265
265
|
}
|
|
266
266
|
for (const l of t.dialogs.values())
|
|
267
|
-
l.closing && !
|
|
267
|
+
l.closing && !p.has(l.path) && g.push(l);
|
|
268
268
|
return g;
|
|
269
269
|
}), u = n.schedule;
|
|
270
|
-
function
|
|
271
|
-
return { path: g, attrs:
|
|
270
|
+
function s(g, p) {
|
|
271
|
+
return { path: g, attrs: p };
|
|
272
272
|
}
|
|
273
|
-
function f({ path: g, open:
|
|
274
|
-
const
|
|
275
|
-
return
|
|
276
|
-
if (
|
|
273
|
+
function f({ path: g, open: p, attrs: l }) {
|
|
274
|
+
const r = t.dialogs.get(g);
|
|
275
|
+
return r && k(() => {
|
|
276
|
+
if (p)
|
|
277
277
|
t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g, l && t.dialogAttrs.set(g, { ...l }), t.dialogs.set(g, {
|
|
278
|
-
...
|
|
278
|
+
...r,
|
|
279
279
|
activated: !0,
|
|
280
280
|
closing: !1,
|
|
281
|
-
componentKey: (
|
|
281
|
+
componentKey: (r.componentKey || 0) + 1,
|
|
282
282
|
attrs: {
|
|
283
283
|
path: g,
|
|
284
284
|
...l,
|
|
@@ -289,68 +289,68 @@ function Ve(e) {
|
|
|
289
289
|
});
|
|
290
290
|
else {
|
|
291
291
|
t.fromDialog = t.activeDialog;
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
const
|
|
292
|
+
const P = t.dialogStack.indexOf(g);
|
|
293
|
+
P > -1 && t.dialogStack.splice(P, 1), t.activeDialog = t.dialogStack.at(-1) ?? "", t.toDialog = t.activeDialog;
|
|
294
|
+
const h = r.transitionDuration ?? (r.transition === "slide" ? 500 : 300);
|
|
295
295
|
t.dialogs.set(g, {
|
|
296
|
-
...
|
|
296
|
+
...r,
|
|
297
297
|
activated: !1,
|
|
298
298
|
closing: !0,
|
|
299
299
|
attrs: void 0
|
|
300
300
|
}), u(() => {
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
},
|
|
301
|
+
const C = t.dialogs.get(g);
|
|
302
|
+
C && !C.activated && t.dialogs.set(g, { ...C, closing: !1 });
|
|
303
|
+
}, h + 200);
|
|
304
304
|
}
|
|
305
|
-
}),
|
|
305
|
+
}), s(g, l);
|
|
306
306
|
}
|
|
307
|
-
function a(g,
|
|
307
|
+
function a(g, p) {
|
|
308
308
|
var l;
|
|
309
|
-
if (i) return
|
|
309
|
+
if (i) return s(g, p);
|
|
310
310
|
i = !0;
|
|
311
311
|
try {
|
|
312
|
-
const
|
|
313
|
-
(l = e == null ? void 0 : e.trackDialogEnter) == null || l.call(e, g,
|
|
314
|
-
const
|
|
312
|
+
const r = t.activeDialog || "";
|
|
313
|
+
(l = e == null ? void 0 : e.trackDialogEnter) == null || l.call(e, g, r, g);
|
|
314
|
+
const P = f({ path: g, open: !0, attrs: p });
|
|
315
315
|
return u(() => {
|
|
316
316
|
i = !1;
|
|
317
|
-
}, 300),
|
|
318
|
-
} catch (
|
|
319
|
-
throw i = !1,
|
|
317
|
+
}, 300), P;
|
|
318
|
+
} catch (r) {
|
|
319
|
+
throw i = !1, r;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function d(g) {
|
|
323
|
-
var
|
|
324
|
-
(
|
|
323
|
+
var p;
|
|
324
|
+
(p = e == null ? void 0 : e.trackDialogLeave) == null || p.call(e, g, g, ""), t.dialogAttrs.delete(g), f({ path: g, open: !1 });
|
|
325
325
|
}
|
|
326
|
-
function
|
|
327
|
-
const g = [],
|
|
328
|
-
t.dialogs.forEach((l,
|
|
329
|
-
var
|
|
326
|
+
function R() {
|
|
327
|
+
const g = [], p = [];
|
|
328
|
+
t.dialogs.forEach((l, r) => {
|
|
329
|
+
var P, h;
|
|
330
330
|
if (l.activated) {
|
|
331
|
-
(
|
|
332
|
-
const
|
|
333
|
-
typeof
|
|
331
|
+
(P = e == null ? void 0 : e.trackDialogLeave) == null || P.call(e, r, r, "");
|
|
332
|
+
const C = (h = l.attrs) == null ? void 0 : h.onClose;
|
|
333
|
+
typeof C == "function" && p.push(C), t.dialogs.set(r, {
|
|
334
334
|
...l,
|
|
335
335
|
activated: !1,
|
|
336
336
|
closing: !0,
|
|
337
337
|
attrs: void 0
|
|
338
|
-
}), g.push(
|
|
338
|
+
}), g.push(r);
|
|
339
339
|
}
|
|
340
|
-
}),
|
|
340
|
+
}), p.forEach((l) => l()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], u(() => {
|
|
341
341
|
g.forEach((l) => {
|
|
342
|
-
const
|
|
343
|
-
|
|
342
|
+
const r = t.dialogs.get(l);
|
|
343
|
+
r && !r.activated && t.dialogs.set(l, { ...r, closing: !1 });
|
|
344
344
|
});
|
|
345
345
|
}, 500);
|
|
346
346
|
}
|
|
347
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: p } = g;
|
|
350
|
+
De(p) && (p = me(p)), t.dialogs.set(g.path, {
|
|
351
351
|
persistent: !0,
|
|
352
352
|
...g,
|
|
353
|
-
component: Ce(
|
|
353
|
+
component: Ce(p)
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
function M(g) {
|
|
@@ -359,18 +359,18 @@ function Ve(e) {
|
|
|
359
359
|
function _(g) {
|
|
360
360
|
return t.dialogAttrs.get(g);
|
|
361
361
|
}
|
|
362
|
-
function T(g,
|
|
362
|
+
function T(g, p) {
|
|
363
363
|
const l = t.dialogAttrs.get(g);
|
|
364
|
-
t.dialogAttrs.set(g, { ...l, ...
|
|
364
|
+
t.dialogAttrs.set(g, { ...l, ...p });
|
|
365
365
|
}
|
|
366
366
|
return {
|
|
367
|
-
activeDialog:
|
|
368
|
-
fromDialog:
|
|
369
|
-
toDialog:
|
|
367
|
+
activeDialog: A(() => t.activeDialog),
|
|
368
|
+
fromDialog: A(() => t.fromDialog),
|
|
369
|
+
toDialog: A(() => t.toDialog),
|
|
370
370
|
resolveDialogs: c,
|
|
371
371
|
openDialog: a,
|
|
372
372
|
closeDialog: d,
|
|
373
|
-
closeAllDialogs:
|
|
373
|
+
closeAllDialogs: R,
|
|
374
374
|
registerDialog: L,
|
|
375
375
|
registerDialogs: M,
|
|
376
376
|
getDialogAttrs: _,
|
|
@@ -384,8 +384,8 @@ async function ve(e, o, n, i) {
|
|
|
384
384
|
try {
|
|
385
385
|
const c = await Promise.race([
|
|
386
386
|
Promise.resolve(e(o, n)),
|
|
387
|
-
new Promise((u,
|
|
388
|
-
t = setTimeout(() =>
|
|
387
|
+
new Promise((u, s) => {
|
|
388
|
+
t = setTimeout(() => s(new Error("Navigation guard timed out")), i);
|
|
389
389
|
})
|
|
390
390
|
]);
|
|
391
391
|
return clearTimeout(t), c !== !1;
|
|
@@ -399,9 +399,9 @@ async function je(e, o, n, i = Be) {
|
|
|
399
399
|
return !0;
|
|
400
400
|
}
|
|
401
401
|
async function Ee(e, o, n, i) {
|
|
402
|
-
var
|
|
402
|
+
var s;
|
|
403
403
|
const t = n.guardTimeout ?? Be;
|
|
404
|
-
if ((
|
|
404
|
+
if ((s = n.beforeEach) != null && s.length && !await je(n.beforeEach, e, o, t))
|
|
405
405
|
return !1;
|
|
406
406
|
const c = H(e);
|
|
407
407
|
if (c) {
|
|
@@ -429,58 +429,58 @@ function qe(e, o) {
|
|
|
429
429
|
const n = e.maxEntries ?? 50, i = [];
|
|
430
430
|
let t = -1, c = !1;
|
|
431
431
|
const u = ee(0);
|
|
432
|
-
function
|
|
433
|
-
!e.enabled || c || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props:
|
|
432
|
+
function s(g, p) {
|
|
433
|
+
!e.enabled || c || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: p ? { ...p } : void 0 }), t = i.length - 1, i.length > n && (i.shift(), t--), u.value++);
|
|
434
434
|
}
|
|
435
|
-
const f =
|
|
436
|
-
async function
|
|
435
|
+
const f = A(() => (u.value, [...i])), a = A(() => (u.value, t > 0)), d = A(() => (u.value, t < i.length - 1));
|
|
436
|
+
async function R(g) {
|
|
437
437
|
if (g < 0 || g >= i.length) return;
|
|
438
|
-
const
|
|
439
|
-
if (
|
|
438
|
+
const p = i[g];
|
|
439
|
+
if (p) {
|
|
440
440
|
t = g, c = !0, u.value++;
|
|
441
441
|
try {
|
|
442
|
-
await o(
|
|
442
|
+
await o(p.path);
|
|
443
443
|
} finally {
|
|
444
444
|
c = !1;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
async function L() {
|
|
449
|
-
a.value && await
|
|
449
|
+
a.value && await R(t - 1);
|
|
450
450
|
}
|
|
451
451
|
async function M() {
|
|
452
|
-
d.value && await
|
|
452
|
+
d.value && await R(t + 1);
|
|
453
453
|
}
|
|
454
454
|
async function _(g) {
|
|
455
|
-
const
|
|
456
|
-
await
|
|
455
|
+
const p = t + g;
|
|
456
|
+
await R(p);
|
|
457
457
|
}
|
|
458
458
|
function T() {
|
|
459
459
|
i.length = 0, t = -1, u.value++;
|
|
460
460
|
}
|
|
461
|
-
return { entries: f, canGoBack: a, canGoForward: d, back: L, forward: M, go: _, clear: T, record:
|
|
461
|
+
return { entries: f, canGoBack: a, canGoForward: d, back: L, forward: M, go: _, clear: T, record: s };
|
|
462
462
|
}
|
|
463
463
|
function Je() {
|
|
464
464
|
const e = U(/* @__PURE__ */ new Map()), o = /* @__PURE__ */ new Map();
|
|
465
465
|
function n(u) {
|
|
466
466
|
e.has(u.path) && console.warn(`[vue-micro-router] Route "${u.path}" already registered. Overwriting.`);
|
|
467
|
-
let { component:
|
|
468
|
-
De(
|
|
467
|
+
let { component: s } = u;
|
|
468
|
+
De(s) && (o.set(u.path, s), s = me(s)), e.set(u.path, {
|
|
469
469
|
...u,
|
|
470
|
-
component: Ce(
|
|
470
|
+
component: Ce(s)
|
|
471
471
|
}), u.preload === "eager" && o.has(u.path) && ne(o.get(u.path));
|
|
472
472
|
}
|
|
473
473
|
function i(u) {
|
|
474
474
|
u.forEach(n);
|
|
475
475
|
}
|
|
476
476
|
async function t(u) {
|
|
477
|
-
const
|
|
478
|
-
|
|
477
|
+
const s = o.get(u);
|
|
478
|
+
s && await ne(s);
|
|
479
479
|
}
|
|
480
480
|
function c(u) {
|
|
481
|
-
for (const [
|
|
482
|
-
if (f.preload === "adjacent" && !u.includes(
|
|
483
|
-
const a = o.get(
|
|
481
|
+
for (const [s, f] of e.entries())
|
|
482
|
+
if (f.preload === "adjacent" && !u.includes(s)) {
|
|
483
|
+
const a = o.get(s);
|
|
484
484
|
a && ne(a);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
@@ -501,32 +501,32 @@ function Qe(e) {
|
|
|
501
501
|
return;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
const
|
|
504
|
+
const s = B(e.getActivePath()), f = B(u);
|
|
505
505
|
if (t.startsWith("/"))
|
|
506
506
|
for (let a = 0; a < f.length; a++) {
|
|
507
507
|
const d = K(
|
|
508
508
|
f.slice(0, a + 1)
|
|
509
509
|
);
|
|
510
510
|
if (e.getActivePath() === d) continue;
|
|
511
|
-
const
|
|
512
|
-
await e.pushCore(d,
|
|
511
|
+
const R = a === f.length - 1;
|
|
512
|
+
await e.pushCore(d, R ? c : void 0), R || await fe(o);
|
|
513
513
|
}
|
|
514
514
|
else {
|
|
515
515
|
const a = f.filter(
|
|
516
|
-
(d) => !
|
|
516
|
+
(d) => !s.includes(d)
|
|
517
517
|
);
|
|
518
518
|
if (a.length === 0) {
|
|
519
519
|
await e.pushCore(t, c), e.scheduleUnlock();
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
522
|
for (let d = 0; d < a.length; d++) {
|
|
523
|
-
const
|
|
524
|
-
await e.pushCore(a[d],
|
|
523
|
+
const R = d === a.length - 1;
|
|
524
|
+
await e.pushCore(a[d], R ? c : void 0), R || await fe(o);
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
e.scheduleUnlock();
|
|
528
|
-
} catch (
|
|
529
|
-
throw e.unlock(),
|
|
528
|
+
} catch (s) {
|
|
529
|
+
throw e.unlock(), s;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
}
|
|
@@ -537,24 +537,24 @@ function Qe(e) {
|
|
|
537
537
|
e.lock();
|
|
538
538
|
try {
|
|
539
539
|
if (e.runGuards) {
|
|
540
|
-
const
|
|
540
|
+
const s = c.slice(0, c.length - u), f = K(s), a = W(e.getActivePath());
|
|
541
541
|
if (!await e.runGuards(f, a)) {
|
|
542
542
|
e.unlock();
|
|
543
543
|
return;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
for (let
|
|
547
|
-
await e.pushCore(-1),
|
|
546
|
+
for (let s = 0; s < u; s++)
|
|
547
|
+
await e.pushCore(-1), s < u - 1 && await fe(o);
|
|
548
548
|
e.scheduleUnlock();
|
|
549
|
-
} catch (
|
|
550
|
-
throw e.unlock(),
|
|
549
|
+
} catch (s) {
|
|
550
|
+
throw e.unlock(), s;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
return { stepWisePush: n, stepWiseBack: i };
|
|
555
555
|
}
|
|
556
556
|
function Ze(e, o) {
|
|
557
|
-
const n = e.defaultPath, i = e.stepDelay ?? Ye, t = e.guards ?? {}, c = e.history ?? {}, u = Ae(),
|
|
557
|
+
const n = e.defaultPath, i = e.stepDelay ?? Ye, t = e.guards ?? {}, c = e.history ?? {}, u = Ae(), s = Je(), f = ee(!1), a = pe({
|
|
558
558
|
activePath: n,
|
|
559
559
|
fromPath: n,
|
|
560
560
|
toPath: n,
|
|
@@ -564,138 +564,138 @@ function Ze(e, o) {
|
|
|
564
564
|
routeKeys: U(/* @__PURE__ */ new Map()),
|
|
565
565
|
/** Component key per segment — incremented to force Vue full remount (resets local state) */
|
|
566
566
|
componentKeys: U(/* @__PURE__ */ new Map())
|
|
567
|
-
}), d = /* @__PURE__ */ new Map(),
|
|
568
|
-
const
|
|
569
|
-
for (const v of
|
|
570
|
-
const D =
|
|
567
|
+
}), d = /* @__PURE__ */ new Map(), R = A(() => {
|
|
568
|
+
const m = B(a.activePath), y = [];
|
|
569
|
+
for (const v of m) {
|
|
570
|
+
const D = s.routes.get(v);
|
|
571
571
|
if (!D) continue;
|
|
572
|
-
const
|
|
573
|
-
if (
|
|
574
|
-
|
|
572
|
+
const w = a.routeKeys.get(v) || 0, b = a.componentKeys.get(v) || 0, E = `${D.path}-${w}`, S = d.get(v);
|
|
573
|
+
if (S && S.key === E && S.componentKey === b)
|
|
574
|
+
y.push(S);
|
|
575
575
|
else {
|
|
576
576
|
const O = { ...D, key: E, componentKey: b };
|
|
577
|
-
d.set(v, O),
|
|
577
|
+
d.set(v, O), y.push(O);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
for (const v of d.keys())
|
|
581
|
-
|
|
582
|
-
return
|
|
581
|
+
m.includes(v) || d.delete(v);
|
|
582
|
+
return y;
|
|
583
583
|
});
|
|
584
|
-
function L(
|
|
584
|
+
function L(m, y) {
|
|
585
585
|
var O, I;
|
|
586
|
-
const v = B(a.activePath), D = Math.min(
|
|
586
|
+
const v = B(a.activePath), D = Math.min(m, v.length - 1);
|
|
587
587
|
if (D <= 0) return;
|
|
588
|
-
const
|
|
588
|
+
const w = v.slice(0, -D), b = K(w);
|
|
589
589
|
for (let $ = v.length - D; $ < v.length; $++)
|
|
590
590
|
a.routeAttrs.delete(v[$]);
|
|
591
|
-
const E =
|
|
592
|
-
if (E &&
|
|
591
|
+
const E = w.at(-1);
|
|
592
|
+
if (E && y) {
|
|
593
593
|
const $ = a.routeAttrs.get(E);
|
|
594
|
-
a.routeAttrs.set(E, { ...$, ...
|
|
594
|
+
a.routeAttrs.set(E, { ...$, ...y }), a.componentKeys.set(
|
|
595
595
|
E,
|
|
596
596
|
(a.componentKeys.get(E) || 0) + 1
|
|
597
597
|
);
|
|
598
598
|
}
|
|
599
|
-
const
|
|
600
|
-
(O = o == null ? void 0 : o.trackPageLeave) == null || O.call(o,
|
|
599
|
+
const S = a.activePath;
|
|
600
|
+
(O = o == null ? void 0 : o.trackPageLeave) == null || O.call(o, S, S, b), a.fromPath = S, a.toPath = b, a.activePath = b, (I = o == null ? void 0 : o.trackPageEnter) == null || I.call(o, b, S, b);
|
|
601
601
|
}
|
|
602
|
-
async function M(
|
|
602
|
+
async function M(m, y) {
|
|
603
603
|
var b, E;
|
|
604
|
-
const v = W(
|
|
604
|
+
const v = W(m), D = B(v);
|
|
605
605
|
await Promise.all(
|
|
606
|
-
D.map((
|
|
606
|
+
D.map((S) => s.asyncLoaders.get(S)).filter((S) => !!S).map((S) => ne(S))
|
|
607
607
|
);
|
|
608
|
-
const
|
|
609
|
-
|
|
608
|
+
const w = a.activePath;
|
|
609
|
+
w !== v && ((b = o == null ? void 0 : o.trackPageLeave) == null || b.call(o, w, w, v)), a.fromPath = w, a.toPath = v, a.activePath = v, y && _(v, y), (E = o == null ? void 0 : o.trackPageEnter) == null || E.call(o, v, w, v);
|
|
610
610
|
}
|
|
611
|
-
function _(
|
|
612
|
-
const v = B(
|
|
611
|
+
function _(m, y) {
|
|
612
|
+
const v = B(m).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, ...y });
|
|
616
616
|
}
|
|
617
|
-
function T(
|
|
618
|
-
const v = a.routeAttrs.get(
|
|
619
|
-
a.routeAttrs.set(
|
|
617
|
+
function T(m, y) {
|
|
618
|
+
const v = a.routeAttrs.get(m);
|
|
619
|
+
a.routeAttrs.set(m, { ...v, ...y });
|
|
620
620
|
}
|
|
621
|
-
function g(
|
|
622
|
-
return a.routeAttrs.get(
|
|
621
|
+
function g(m) {
|
|
622
|
+
return a.routeAttrs.get(m);
|
|
623
623
|
}
|
|
624
|
-
async function m
|
|
625
|
-
if (!
|
|
626
|
-
if (typeof
|
|
627
|
-
L(Math.abs(
|
|
624
|
+
async function p(m, y) {
|
|
625
|
+
if (!m && m !== 0) return;
|
|
626
|
+
if (typeof m == "number" && m < 0) {
|
|
627
|
+
L(Math.abs(m), y);
|
|
628
628
|
return;
|
|
629
629
|
}
|
|
630
|
-
const v =
|
|
630
|
+
const v = m.toString();
|
|
631
631
|
if (v.startsWith("/")) {
|
|
632
|
-
const E = B(v),
|
|
633
|
-
if (E.length <
|
|
634
|
-
if (
|
|
635
|
-
L(1,
|
|
632
|
+
const E = B(v), S = B(a.activePath);
|
|
633
|
+
if (E.length < S.length && E.every(($, se) => S[se] === $)) {
|
|
634
|
+
if (S.length - E.length === 1)
|
|
635
|
+
L(1, y);
|
|
636
636
|
else {
|
|
637
|
-
const se =
|
|
638
|
-
for (let re = E.length + 1; re <
|
|
639
|
-
a.routeAttrs.delete(
|
|
640
|
-
a.activePath = Ie, await k(), L(1,
|
|
637
|
+
const se = S.slice(0, E.length + 1), Ie = K(se);
|
|
638
|
+
for (let re = E.length + 1; re < S.length; re++)
|
|
639
|
+
a.routeAttrs.delete(S[re]);
|
|
640
|
+
a.activePath = Ie, await k(), L(1, y);
|
|
641
641
|
}
|
|
642
642
|
return;
|
|
643
643
|
}
|
|
644
644
|
const I = E.at(-1);
|
|
645
|
-
I &&
|
|
645
|
+
I && S.at(-1) === I && a.routeKeys.set(
|
|
646
646
|
I,
|
|
647
647
|
(a.routeKeys.get(I) || 0) + 1
|
|
648
|
-
), await M(v,
|
|
648
|
+
), await M(v, y);
|
|
649
649
|
return;
|
|
650
650
|
}
|
|
651
|
-
const D = B(a.activePath),
|
|
652
|
-
if (
|
|
653
|
-
const E = D.length - (
|
|
651
|
+
const D = B(a.activePath), w = D.indexOf(v);
|
|
652
|
+
if (w !== -1) {
|
|
653
|
+
const E = D.length - (w + 1);
|
|
654
654
|
if (E === 1)
|
|
655
|
-
L(1,
|
|
655
|
+
L(1, y);
|
|
656
656
|
else if (E > 1) {
|
|
657
|
-
const
|
|
658
|
-
for (let I =
|
|
657
|
+
const S = D.slice(0, w + 2), O = K(S);
|
|
658
|
+
for (let I = w + 2; I < D.length; I++)
|
|
659
659
|
a.routeAttrs.delete(D[I]);
|
|
660
|
-
a.activePath = O, await k(), L(1,
|
|
660
|
+
a.activePath = O, await k(), L(1, y);
|
|
661
661
|
} else
|
|
662
662
|
a.routeKeys.set(v, (a.routeKeys.get(v) || 0) + 1), await M(
|
|
663
|
-
K(D.slice(0,
|
|
664
|
-
|
|
663
|
+
K(D.slice(0, w + 1)),
|
|
664
|
+
y
|
|
665
665
|
);
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
668
668
|
const b = K([...D, v]);
|
|
669
|
-
await M(b,
|
|
669
|
+
await M(b, y);
|
|
670
670
|
}
|
|
671
|
-
function l(
|
|
672
|
-
if (typeof
|
|
673
|
-
const
|
|
674
|
-
return b <= 0 ? a.activePath : K(
|
|
671
|
+
function l(m) {
|
|
672
|
+
if (typeof m == "number" && m < 0) {
|
|
673
|
+
const w = B(a.activePath), b = Math.min(Math.abs(m), w.length - 1);
|
|
674
|
+
return b <= 0 ? a.activePath : K(w.slice(0, -b));
|
|
675
675
|
}
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
const v = B(a.activePath), D = v.indexOf(
|
|
679
|
-
return D !== -1 ? K(v.slice(0, D + 1)) : K([...v,
|
|
676
|
+
const y = m.toString();
|
|
677
|
+
if (y.startsWith("/")) return W(y);
|
|
678
|
+
const v = B(a.activePath), D = v.indexOf(y);
|
|
679
|
+
return D !== -1 ? K(v.slice(0, D + 1)) : K([...v, y]);
|
|
680
680
|
}
|
|
681
|
-
const
|
|
682
|
-
async function
|
|
681
|
+
const r = { getRoute: (m) => s.routes.get(m) };
|
|
682
|
+
async function P(m, y) {
|
|
683
683
|
var v;
|
|
684
684
|
if (!f.value) {
|
|
685
685
|
f.value = !0;
|
|
686
686
|
try {
|
|
687
|
-
const D = (((v = t.beforeEach) == null ? void 0 : v.length) ?? 0) > 0,
|
|
688
|
-
if ((D ||
|
|
689
|
-
const
|
|
690
|
-
if (!await Ee(
|
|
687
|
+
const D = (((v = t.beforeEach) == null ? void 0 : v.length) ?? 0) > 0, w = s.routes.size > 0;
|
|
688
|
+
if ((D || w) && m) {
|
|
689
|
+
const S = l(m), O = W(a.activePath);
|
|
690
|
+
if (!await Ee(S, O, t, r)) {
|
|
691
691
|
f.value = !1;
|
|
692
692
|
return;
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
695
|
const b = W(a.activePath);
|
|
696
|
-
await m
|
|
696
|
+
await p(m, y);
|
|
697
697
|
const E = W(a.activePath);
|
|
698
|
-
|
|
698
|
+
h == null || h.record(E, y), He(E, b, t.afterEach), s.preloadAdjacent(B(a.activePath)), u.schedule(() => {
|
|
699
699
|
f.value = !1;
|
|
700
700
|
}, i);
|
|
701
701
|
} catch (D) {
|
|
@@ -703,19 +703,19 @@ function Ze(e, o) {
|
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
const
|
|
707
|
-
const
|
|
708
|
-
if (v.length <
|
|
709
|
-
const
|
|
710
|
-
await
|
|
706
|
+
const h = c.enabled ? qe(c, async (m) => {
|
|
707
|
+
const y = B(a.activePath), v = B(m);
|
|
708
|
+
if (v.length < y.length && v.every((w, b) => y[b] === w)) {
|
|
709
|
+
const w = y.length - v.length;
|
|
710
|
+
await P(-w);
|
|
711
711
|
} else
|
|
712
|
-
await
|
|
712
|
+
await P(m);
|
|
713
713
|
}) : void 0;
|
|
714
|
-
|
|
715
|
-
const
|
|
714
|
+
h && h.record(W(n));
|
|
715
|
+
const C = Qe({
|
|
716
716
|
getActivePath: () => a.activePath,
|
|
717
|
-
pushCore:
|
|
718
|
-
runGuards: (
|
|
717
|
+
pushCore: p,
|
|
718
|
+
runGuards: (m, y) => Ee(m, y, t, r),
|
|
719
719
|
scheduleUnlock: () => u.schedule(() => {
|
|
720
720
|
f.value = !1;
|
|
721
721
|
}, i),
|
|
@@ -729,24 +729,24 @@ function Ze(e, o) {
|
|
|
729
729
|
stepDelay: i
|
|
730
730
|
});
|
|
731
731
|
return {
|
|
732
|
-
activePath:
|
|
733
|
-
fromPath:
|
|
734
|
-
toPath:
|
|
735
|
-
activePage:
|
|
736
|
-
fromPage:
|
|
737
|
-
toPage:
|
|
738
|
-
isNavigating:
|
|
739
|
-
resolveRoutes:
|
|
740
|
-
push:
|
|
741
|
-
stepWisePush:
|
|
742
|
-
stepWiseBack:
|
|
743
|
-
registerRoute:
|
|
744
|
-
registerRoutes:
|
|
732
|
+
activePath: A(() => a.activePath),
|
|
733
|
+
fromPath: A(() => a.fromPath),
|
|
734
|
+
toPath: A(() => a.toPath),
|
|
735
|
+
activePage: A(() => H(a.activePath)),
|
|
736
|
+
fromPage: A(() => H(a.fromPath)),
|
|
737
|
+
toPage: A(() => H(a.toPath)),
|
|
738
|
+
isNavigating: A(() => f.value),
|
|
739
|
+
resolveRoutes: R,
|
|
740
|
+
push: P,
|
|
741
|
+
stepWisePush: C.stepWisePush,
|
|
742
|
+
stepWiseBack: C.stepWiseBack,
|
|
743
|
+
registerRoute: s.registerRoute,
|
|
744
|
+
registerRoutes: s.registerRoutes,
|
|
745
745
|
updateRouteAttrs: T,
|
|
746
746
|
getRouteAttrs: g,
|
|
747
|
-
preloadRoute:
|
|
748
|
-
routes:
|
|
749
|
-
history:
|
|
747
|
+
preloadRoute: s.preloadRoute,
|
|
748
|
+
routes: s.routes,
|
|
749
|
+
history: h,
|
|
750
750
|
cleanup: u.cleanup
|
|
751
751
|
};
|
|
752
752
|
}
|
|
@@ -845,11 +845,11 @@ function et(e) {
|
|
|
845
845
|
resumeSound: c.resumeSound,
|
|
846
846
|
updateBackgroundMusic: c.updateBackgroundMusic
|
|
847
847
|
} : {}
|
|
848
|
-
},
|
|
848
|
+
}, s = H(e.defaultPath);
|
|
849
849
|
return X(n.activePage, (a, d) => {
|
|
850
850
|
if (!d) return;
|
|
851
|
-
const
|
|
852
|
-
d ===
|
|
851
|
+
const R = t.currentControl.value;
|
|
852
|
+
d === s && a !== s && o.trackGuiLeave(R), a === s && d !== s && o.trackGuiEnter(R);
|
|
853
853
|
}), c && e.defaultBgm && e.bgmStartRef && X(e.bgmStartRef, (a) => {
|
|
854
854
|
a && !c.isStarted() && c.playSoundSync(e.defaultBgm, !0);
|
|
855
855
|
}, { flush: "sync" }), q(async () => {
|
|
@@ -876,18 +876,18 @@ function mt(e) {
|
|
|
876
876
|
"[vue-micro-router] useMicroState() called without provider and no defaults. Ensure component is inside <RoutePage>, <MicroDialog>, or <MicroControlWrapper>."
|
|
877
877
|
);
|
|
878
878
|
const i = (o == null ? void 0 : o()) ?? {}, t = e ? { ...e } : {};
|
|
879
|
-
for (const
|
|
880
|
-
t[
|
|
879
|
+
for (const s of Object.keys(i))
|
|
880
|
+
t[s] = i[s];
|
|
881
881
|
const c = pe(t);
|
|
882
882
|
n && X(
|
|
883
883
|
c,
|
|
884
|
-
(
|
|
884
|
+
(s) => n({ ...s }),
|
|
885
885
|
{ deep: !0, flush: "post" }
|
|
886
886
|
);
|
|
887
887
|
const u = Ne(c);
|
|
888
888
|
return new Proxy(u, {
|
|
889
|
-
get(
|
|
890
|
-
return typeof f == "string" && !(f in
|
|
889
|
+
get(s, f, a) {
|
|
890
|
+
return typeof f == "string" && !(f in s) && (s[f] = Oe(c, f)), Reflect.get(s, f, a);
|
|
891
891
|
}
|
|
892
892
|
});
|
|
893
893
|
}
|
|
@@ -905,9 +905,9 @@ function pt(e) {
|
|
|
905
905
|
var t;
|
|
906
906
|
return (t = e.onRouteEnter) == null ? void 0 : t.call(e);
|
|
907
907
|
}), X(n, (t) => {
|
|
908
|
-
var u,
|
|
908
|
+
var u, s;
|
|
909
909
|
const c = t === o;
|
|
910
|
-
c && !i ? (u = e.onRouteEnter) == null || u.call(e) : !c && i && ((
|
|
910
|
+
c && !i ? (u = e.onRouteEnter) == null || u.call(e) : !c && i && ((s = e.onRouteLeave) == null || s.call(e)), i = c;
|
|
911
911
|
});
|
|
912
912
|
}
|
|
913
913
|
function ht(e) {
|
|
@@ -924,9 +924,9 @@ function ht(e) {
|
|
|
924
924
|
var t;
|
|
925
925
|
return (t = e.onDialogEnter) == null ? void 0 : t.call(e);
|
|
926
926
|
}), X(n, (t) => {
|
|
927
|
-
var u,
|
|
927
|
+
var u, s;
|
|
928
928
|
const c = t === o;
|
|
929
|
-
c && !i ? (u = e.onDialogEnter) == null || u.call(e) : !c && i && ((
|
|
929
|
+
c && !i ? (u = e.onDialogEnter) == null || u.call(e) : !c && i && ((s = e.onDialogLeave) == null || s.call(e)), i = c;
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
932
|
function yt(e) {
|
|
@@ -943,72 +943,72 @@ function yt(e) {
|
|
|
943
943
|
var t;
|
|
944
944
|
return (t = e.onControlEnter) == null ? void 0 : t.call(e);
|
|
945
945
|
}), X(n, (t) => {
|
|
946
|
-
var u,
|
|
946
|
+
var u, s;
|
|
947
947
|
const c = t === o;
|
|
948
|
-
c && !i ? (u = e.onControlEnter) == null || u.call(e) : !c && i && ((
|
|
948
|
+
c && !i ? (u = e.onControlEnter) == null || u.call(e) : !c && i && ((s = e.onControlLeave) == null || s.call(e)), i = c;
|
|
949
949
|
});
|
|
950
950
|
}
|
|
951
951
|
function tt(e, o) {
|
|
952
952
|
if (!e.enabled) return;
|
|
953
953
|
const n = e.edgeWidth ?? 20, i = e.threshold ?? 0.3, t = e.velocityThreshold ?? 0.5;
|
|
954
|
-
let c = 0, u = 0,
|
|
955
|
-
function
|
|
954
|
+
let c = 0, u = 0, s = 0, f = !1, a = null, d = null;
|
|
955
|
+
function R() {
|
|
956
956
|
const l = o.containerRef.value;
|
|
957
957
|
return l ? "$el" in l ? l.$el : l : null;
|
|
958
958
|
}
|
|
959
959
|
function L() {
|
|
960
|
-
const l =
|
|
960
|
+
const l = R();
|
|
961
961
|
if (!l) return { current: null, previous: null };
|
|
962
|
-
const
|
|
963
|
-
return
|
|
964
|
-
current:
|
|
965
|
-
previous:
|
|
962
|
+
const r = l.querySelectorAll(".route-page");
|
|
963
|
+
return r.length < 2 ? { current: r[r.length - 1] ?? null, previous: null } : {
|
|
964
|
+
current: r[r.length - 1],
|
|
965
|
+
previous: r[r.length - 2]
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
968
|
function M(l) {
|
|
969
|
-
var
|
|
969
|
+
var C;
|
|
970
970
|
if (!o.canGoBack() || l.clientX > n) return;
|
|
971
|
-
const { current:
|
|
972
|
-
if (!
|
|
973
|
-
f = !0, c = l.clientX, u = l.clientY,
|
|
974
|
-
const
|
|
975
|
-
(
|
|
971
|
+
const { current: r, previous: P } = L();
|
|
972
|
+
if (!r) return;
|
|
973
|
+
f = !0, c = l.clientX, u = l.clientY, s = Date.now(), a = r, d = P;
|
|
974
|
+
const h = R();
|
|
975
|
+
(C = h == null ? void 0 : h.setPointerCapture) == null || C.call(h, l.pointerId), a.style.willChange = "transform", d && (d.style.willChange = "transform", d.style.transition = "none"), a.style.transition = "none";
|
|
976
976
|
}
|
|
977
977
|
function _(l) {
|
|
978
978
|
if (!f || !a) return;
|
|
979
|
-
const
|
|
980
|
-
if (Math.abs(l.clientY - u) >
|
|
979
|
+
const r = Math.max(0, l.clientX - c);
|
|
980
|
+
if (Math.abs(l.clientY - u) > r * 1.5) {
|
|
981
981
|
g();
|
|
982
982
|
return;
|
|
983
983
|
}
|
|
984
|
-
const
|
|
985
|
-
if (a.style.transform = `translateX(${
|
|
986
|
-
const
|
|
987
|
-
d.style.transform = `translateX(${
|
|
984
|
+
const h = r / window.innerWidth;
|
|
985
|
+
if (a.style.transform = `translateX(${r}px)`, d) {
|
|
986
|
+
const C = -20 + 20 * h;
|
|
987
|
+
d.style.transform = `translateX(${C}%)`;
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
function T(l) {
|
|
991
991
|
if (!f || !a) return;
|
|
992
992
|
if (!a.isConnected) {
|
|
993
|
-
|
|
993
|
+
p(), f = !1;
|
|
994
994
|
return;
|
|
995
995
|
}
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(
|
|
996
|
+
const r = l.clientX - c, P = Date.now() - s, h = r / P;
|
|
997
|
+
r / window.innerWidth > i || h > t ? (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(100%)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(0)"), setTimeout(() => {
|
|
998
|
+
p(), o.goBack();
|
|
999
|
+
}, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", d && (d.style.transition = "transform 0.2s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(p, 200)), f = !1;
|
|
1000
1000
|
}
|
|
1001
1001
|
function g() {
|
|
1002
|
-
f && (a && (a.style.transition = "transform 0.15s ease-out", a.style.transform = "translateX(0)"), d && (d.style.transition = "transform 0.15s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(
|
|
1002
|
+
f && (a && (a.style.transition = "transform 0.15s ease-out", a.style.transform = "translateX(0)"), d && (d.style.transition = "transform 0.15s ease-out", d.style.transform = "translateX(-20%)"), setTimeout(p, 150), f = !1);
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function p() {
|
|
1005
1005
|
a && (a.style.willChange = "", a.style.transition = "", a.style.transform = ""), d && (d.style.willChange = "", d.style.transition = "", d.style.transform = ""), a = null, d = null;
|
|
1006
1006
|
}
|
|
1007
1007
|
q(() => {
|
|
1008
|
-
const l =
|
|
1008
|
+
const l = R();
|
|
1009
1009
|
l != null && l.addEventListener && (l.addEventListener("pointerdown", M, { passive: !0 }), l.addEventListener("pointermove", _, { passive: !0 }), l.addEventListener("pointerup", T, { passive: !0 }), l.addEventListener("pointercancel", g, { passive: !0 }));
|
|
1010
1010
|
}), he(() => {
|
|
1011
|
-
const l =
|
|
1011
|
+
const l = R();
|
|
1012
1012
|
l != null && l.removeEventListener && (l.removeEventListener("pointerdown", M), l.removeEventListener("pointermove", _), l.removeEventListener("pointerup", T), l.removeEventListener("pointercancel", g));
|
|
1013
1013
|
});
|
|
1014
1014
|
}
|
|
@@ -1051,68 +1051,78 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1051
1051
|
setup(e, { emit: o }) {
|
|
1052
1052
|
const n = e, i = o, { getDialogAttrs: t, updateDialogAttrs: c } = J();
|
|
1053
1053
|
let u = !1;
|
|
1054
|
-
const
|
|
1054
|
+
const s = ee(null), f = ee(null), a = A(() => n.dialog.transition ?? "scale"), d = A(() => n.dialog.transitionDuration != null ? n.dialog.transitionDuration : a.value === "slide" ? 500 : 300), R = A(() => n.dialog.position ?? "standard"), L = A(() => n.dialog.seamless ?? !1);
|
|
1055
1055
|
function M() {
|
|
1056
|
-
return
|
|
1057
|
-
|
|
1058
|
-
).filter((
|
|
1056
|
+
return s.value ? Array.from(
|
|
1057
|
+
s.value.querySelectorAll(st)
|
|
1058
|
+
).filter((r) => r.offsetParent !== null) : [];
|
|
1059
1059
|
}
|
|
1060
|
-
function _(
|
|
1060
|
+
function _(r) {
|
|
1061
1061
|
var v, D;
|
|
1062
|
-
if (
|
|
1062
|
+
if (r.key === "Escape") {
|
|
1063
1063
|
if (n.dialog.persistent) return;
|
|
1064
|
-
|
|
1064
|
+
r.preventDefault(), r.stopPropagation(), i("close", n.dialog.path);
|
|
1065
1065
|
return;
|
|
1066
1066
|
}
|
|
1067
|
-
if (
|
|
1068
|
-
const
|
|
1069
|
-
if (
|
|
1070
|
-
|
|
1067
|
+
if (r.key !== "Tab") return;
|
|
1068
|
+
const P = M();
|
|
1069
|
+
if (P.length === 0) {
|
|
1070
|
+
r.preventDefault(), (v = s.value) == null || v.focus();
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1073
|
+
const h = P[0], C = P[P.length - 1], m = document.activeElement, y = !!((D = s.value) != null && D.contains(m));
|
|
1074
|
+
r.shiftKey ? (!y || m === h) && (r.preventDefault(), C.focus()) : (!y || m === C) && (r.preventDefault(), h.focus());
|
|
1075
1075
|
}
|
|
1076
|
-
function T(
|
|
1077
|
-
n.dialog.persistent ||
|
|
1076
|
+
function T(r) {
|
|
1077
|
+
n.dialog.persistent || r.target === r.currentTarget && i("close", n.dialog.path);
|
|
1078
1078
|
}
|
|
1079
|
-
function g() {
|
|
1080
|
-
if (!n.dialog.focusInput || !
|
|
1081
|
-
|
|
1082
|
-
|
|
1079
|
+
function g(r) {
|
|
1080
|
+
if (!n.dialog.focusInput || !s.value) {
|
|
1081
|
+
r();
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
const P = document.createElement("input");
|
|
1085
|
+
P.style.cssText = "position:fixed;opacity:0;height:0;width:0;top:-100px;", s.value.appendChild(P), P.focus(), setTimeout(() => {
|
|
1086
|
+
P.remove(), r();
|
|
1087
|
+
}, 50);
|
|
1083
1088
|
}
|
|
1084
|
-
function
|
|
1089
|
+
function p() {
|
|
1085
1090
|
u || (u = !0, f.value = document.activeElement, at(), k(() => {
|
|
1086
|
-
|
|
1087
|
-
|
|
1091
|
+
s.value && g(() => {
|
|
1092
|
+
if (!s.value) return;
|
|
1093
|
+
(M()[0] ?? s.value).focus();
|
|
1094
|
+
});
|
|
1088
1095
|
}));
|
|
1089
1096
|
}
|
|
1090
1097
|
function l() {
|
|
1098
|
+
var m;
|
|
1091
1099
|
if (!u) return;
|
|
1092
1100
|
u = !1, it();
|
|
1093
|
-
const
|
|
1094
|
-
f.value = null
|
|
1101
|
+
const r = f.value;
|
|
1102
|
+
f.value = null;
|
|
1103
|
+
const P = document.activeElement, h = !!((m = s.value) != null && m.contains(P)), C = !P || P === document.body;
|
|
1104
|
+
r && typeof r.focus == "function" && document.contains(r) && (h || C) && r.focus();
|
|
1095
1105
|
}
|
|
1096
|
-
return N(Te, n.dialog.path), N(ae, () => t(n.dialog.path)), N(ie, (
|
|
1097
|
-
c(n.dialog.path,
|
|
1106
|
+
return N(Te, n.dialog.path), N(ae, () => t(n.dialog.path)), N(ie, (r) => {
|
|
1107
|
+
c(n.dialog.path, r);
|
|
1098
1108
|
}), X(
|
|
1099
1109
|
() => n.dialog.activated,
|
|
1100
|
-
(
|
|
1101
|
-
|
|
1110
|
+
(r) => {
|
|
1111
|
+
r && p();
|
|
1102
1112
|
}
|
|
1103
1113
|
), X(
|
|
1104
1114
|
() => n.dialog.closing,
|
|
1105
|
-
(
|
|
1106
|
-
!
|
|
1115
|
+
(r) => {
|
|
1116
|
+
!r && !n.dialog.activated && u && l();
|
|
1107
1117
|
}
|
|
1108
1118
|
), q(() => {
|
|
1109
|
-
n.dialog.activated &&
|
|
1119
|
+
n.dialog.activated && p();
|
|
1110
1120
|
}), he(() => {
|
|
1111
1121
|
u && l();
|
|
1112
|
-
}), (
|
|
1122
|
+
}), (r, P) => (G(), F(Ke, { to: "body" }, [
|
|
1113
1123
|
j("div", {
|
|
1114
1124
|
class: Q(["micro-dialog-portal", [
|
|
1115
|
-
`micro-dialog--${
|
|
1125
|
+
`micro-dialog--${R.value}`,
|
|
1116
1126
|
e.dialog.fullscreen && "micro-dialog--fullscreen",
|
|
1117
1127
|
L.value && "micro-dialog--seamless"
|
|
1118
1128
|
]]),
|
|
@@ -1128,7 +1138,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1128
1138
|
}, null, 2)),
|
|
1129
1139
|
j("div", {
|
|
1130
1140
|
ref_key: "wrapperRef",
|
|
1131
|
-
ref:
|
|
1141
|
+
ref: s,
|
|
1132
1142
|
role: "dialog",
|
|
1133
1143
|
"aria-modal": "true",
|
|
1134
1144
|
tabindex: "-1",
|
|
@@ -1141,10 +1151,10 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1141
1151
|
}, [
|
|
1142
1152
|
j("div", {
|
|
1143
1153
|
class: "micro-dialog__content",
|
|
1144
|
-
onClick:
|
|
1154
|
+
onClick: P[0] || (P[0] = le(() => {
|
|
1145
1155
|
}, ["stop"]))
|
|
1146
1156
|
}, [
|
|
1147
|
-
we(
|
|
1157
|
+
we(r.$slots, "default"),
|
|
1148
1158
|
(G(), F(ye(e.dialog.component), Pe({
|
|
1149
1159
|
key: e.dialog.componentKey
|
|
1150
1160
|
}, e.dialog.attrs), null, 16))
|
|
@@ -1182,34 +1192,34 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1182
1192
|
nested: { type: Boolean }
|
|
1183
1193
|
},
|
|
1184
1194
|
setup(e) {
|
|
1185
|
-
var
|
|
1195
|
+
var p, l;
|
|
1186
1196
|
const o = e, n = et(o.config);
|
|
1187
|
-
(
|
|
1197
|
+
(p = o.plugins) != null && p.length && nt(o.plugins, n);
|
|
1188
1198
|
const {
|
|
1189
1199
|
resolveRoutes: i,
|
|
1190
1200
|
resolveDialogs: t,
|
|
1191
1201
|
resolveControls: c,
|
|
1192
1202
|
fromPath: u,
|
|
1193
|
-
toPath:
|
|
1203
|
+
toPath: s,
|
|
1194
1204
|
isNavigating: f,
|
|
1195
1205
|
closeDialog: a
|
|
1196
|
-
} = n, d = ee(null),
|
|
1197
|
-
const
|
|
1198
|
-
return
|
|
1199
|
-
}), L =
|
|
1200
|
-
const
|
|
1201
|
-
return (
|
|
1202
|
-
}), _ =
|
|
1203
|
-
const
|
|
1204
|
-
return
|
|
1205
|
-
}), g =
|
|
1206
|
-
() =>
|
|
1206
|
+
} = n, d = ee(null), R = A(() => {
|
|
1207
|
+
const r = u.value.split("/").filter(Boolean), P = new Set(s.value.split("/").filter(Boolean));
|
|
1208
|
+
return r.some((h) => P.has(h));
|
|
1209
|
+
}), L = A(() => c.value.length > 0), M = A(() => {
|
|
1210
|
+
const r = i.value.at(-1);
|
|
1211
|
+
return (r == null ? void 0 : r.transition) ?? "slide";
|
|
1212
|
+
}), _ = A(() => M.value === "none" ? "" : M.value === "fade" ? "page-fade" : "page-slide"), T = A(() => {
|
|
1213
|
+
const r = i.value.at(-1);
|
|
1214
|
+
return r != null && r.transitionDuration ? r.transitionDuration : M.value === "fade" ? 300 : 500;
|
|
1215
|
+
}), g = A(
|
|
1216
|
+
() => R.value && M.value !== "none"
|
|
1207
1217
|
);
|
|
1208
1218
|
return (l = o.config.gesture) != null && l.enabled && tt(o.config.gesture, {
|
|
1209
1219
|
containerRef: d,
|
|
1210
1220
|
goBack: () => n.push(-1),
|
|
1211
1221
|
canGoBack: () => i.value.length > 1
|
|
1212
|
-
}), (
|
|
1222
|
+
}), (r, P) => (G(), V(te, null, [
|
|
1213
1223
|
Re(Se, {
|
|
1214
1224
|
ref_key: "pageContainerRef",
|
|
1215
1225
|
ref: d,
|
|
@@ -1217,23 +1227,23 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1217
1227
|
css: g.value
|
|
1218
1228
|
}, {
|
|
1219
1229
|
default: ce(() => [
|
|
1220
|
-
(G(!0), V(te, null, ue(Y(i), (
|
|
1221
|
-
key:
|
|
1222
|
-
"route-path":
|
|
1230
|
+
(G(!0), V(te, null, ue(Y(i), (h, C) => (G(), F(ut, {
|
|
1231
|
+
key: h.key || h.path,
|
|
1232
|
+
"route-path": h.path,
|
|
1223
1233
|
class: Q({
|
|
1224
|
-
deactivate: Y(i).length > 1 &&
|
|
1234
|
+
deactivate: Y(i).length > 1 && C !== Y(i).length - 1,
|
|
1225
1235
|
"micro-router--navigating": Y(f)
|
|
1226
1236
|
}),
|
|
1227
1237
|
style: be({
|
|
1228
1238
|
transition: g.value ? `transform ${T.value}ms cubic-bezier(0.65, 0, 0.35, 1), opacity ${T.value}ms ease` : "none",
|
|
1229
|
-
zIndex: 10 +
|
|
1239
|
+
zIndex: 10 + C,
|
|
1230
1240
|
"--mr-page-height": e.nested ? "100%" : "100dvh"
|
|
1231
1241
|
})
|
|
1232
1242
|
}, {
|
|
1233
1243
|
default: ce(() => [
|
|
1234
|
-
(G(), F(ye(
|
|
1235
|
-
key:
|
|
1236
|
-
}, { ref_for: !0 }, Y(n).getRouteAttrs(
|
|
1244
|
+
(G(), F(ye(h.component), Pe({
|
|
1245
|
+
key: h.componentKey
|
|
1246
|
+
}, { ref_for: !0 }, Y(n).getRouteAttrs(h.path)), null, 16))
|
|
1237
1247
|
]),
|
|
1238
1248
|
_: 2
|
|
1239
1249
|
}, 1032, ["route-path", "class", "style"]))), 128))
|
|
@@ -1241,25 +1251,25 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1241
1251
|
_: 1
|
|
1242
1252
|
}, 8, ["name", "css"]),
|
|
1243
1253
|
j("div", ft, [
|
|
1244
|
-
we(
|
|
1254
|
+
we(r.$slots, "default")
|
|
1245
1255
|
]),
|
|
1246
1256
|
j("div", {
|
|
1247
1257
|
class: Q(["micro-router-gui-layer", { "gui-visible": L.value }])
|
|
1248
1258
|
}, [
|
|
1249
1259
|
Re(Se, { name: "control-fade" }, {
|
|
1250
1260
|
default: ce(() => [
|
|
1251
|
-
(G(!0), V(te, null, ue(Y(c), (
|
|
1252
|
-
key:
|
|
1253
|
-
control:
|
|
1261
|
+
(G(!0), V(te, null, ue(Y(c), (h) => (G(), F(ot, {
|
|
1262
|
+
key: h.name + "-" + (h.componentKey || 0),
|
|
1263
|
+
control: h
|
|
1254
1264
|
}, null, 8, ["control"]))), 128))
|
|
1255
1265
|
]),
|
|
1256
1266
|
_: 1
|
|
1257
1267
|
})
|
|
1258
1268
|
], 2),
|
|
1259
|
-
(G(!0), V(te, null, ue(Y(t), (
|
|
1260
|
-
key: "dialog-" +
|
|
1261
|
-
dialog:
|
|
1262
|
-
"stack-index":
|
|
1269
|
+
(G(!0), V(te, null, ue(Y(t), (h, C) => (G(), F(rt, {
|
|
1270
|
+
key: "dialog-" + h.path,
|
|
1271
|
+
dialog: h,
|
|
1272
|
+
"stack-index": C,
|
|
1263
1273
|
onClose: Y(a)
|
|
1264
1274
|
}, null, 8, ["dialog", "stack-index", "onClose"]))), 128))
|
|
1265
1275
|
], 64));
|