vue-micro-router 1.0.62 → 1.0.63
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/README.md +5 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +129 -129
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -445,6 +445,11 @@ const { stepWisePush, stepWiseBack } = useMicroRouter();
|
|
|
445
445
|
// Walk through: home → home/onboarding → home/onboarding/step1
|
|
446
446
|
await stepWisePush('/home/onboarding/step1');
|
|
447
447
|
|
|
448
|
+
// Relative multi-segment paths are type-checked: every segment must be a
|
|
449
|
+
// known route, joined by `/`, in any order and to any depth.
|
|
450
|
+
await stepWisePush('onboarding/step1'); // ✅ each segment validated
|
|
451
|
+
await stepWisePush('onboarding/oops'); // ❌ compile error — unknown segment
|
|
452
|
+
|
|
448
453
|
// Step back through each page with animation
|
|
449
454
|
await stepWiseBack(3);
|
|
450
455
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -635,6 +635,7 @@ declare interface PluginTypedStepWiseBack {
|
|
|
635
635
|
|
|
636
636
|
declare interface PluginTypedStepWisePush<Routes extends string, AttrsMap = {}> {
|
|
637
637
|
<K extends Routes>(targetPath: K, ...args: PropsArgs<K, AttrsMap>): Promise<void>;
|
|
638
|
+
<S extends string>(targetPath: S & RouteSegmentPath<S, Routes>, props?: Record<string, unknown>): Promise<void>;
|
|
638
639
|
(targetPath: `/${string}`, props?: Record<string, unknown>): Promise<void>;
|
|
639
640
|
}
|
|
640
641
|
|
|
@@ -756,6 +757,15 @@ export declare type RouteMap = Record<string, Record<string, unknown> | undefine
|
|
|
756
757
|
|
|
757
758
|
export declare const RoutePage: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
758
759
|
|
|
760
|
+
/**
|
|
761
|
+
* Validate a `/`-joined path where every segment must be a known route.
|
|
762
|
+
* Returns `S` when valid, else `never`. Given routes `'a' | 'b'`:
|
|
763
|
+
* 'a' ✓ 'a/b' ✓ 'b/a/b' ✓ 'a/x' ✗ (→ never) 'x' ✗ (→ never)
|
|
764
|
+
* Walks the string via `infer` (bounded by segment count) — no infinite union,
|
|
765
|
+
* so it stays cheap for arbitrary depth like `'a/b/c/d/f'`.
|
|
766
|
+
*/
|
|
767
|
+
declare type RouteSegmentPath<S extends string, Routes extends string> = S extends `${infer Head}/${infer Rest}` ? [Head] extends [Routes] ? [RouteSegmentPath<Rest, Routes>] extends [never] ? never : S : never : [S] extends [Routes] ? S : never;
|
|
768
|
+
|
|
759
769
|
/** Extract route names that don't require props */
|
|
760
770
|
export declare type RoutesWithoutProps<T extends RouteMap> = {
|
|
761
771
|
[K in keyof T]: T[K] extends undefined ? K : never;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { shallowReactive as X, computed as R, defineAsyncComponent as Pe, reactive as we, nextTick as te, ref as ne, inject as V, watch as F, onMounted as Q, onBeforeUnmount as De, provide as
|
|
2
|
-
import { i as Ee, s as Se, g as H, w as ae, p as I, b as
|
|
1
|
+
import { shallowReactive as X, computed as R, defineAsyncComponent as Pe, reactive as we, nextTick as te, ref as ne, inject as V, watch as F, onMounted as Q, onBeforeUnmount as De, provide as K, toRefs as Ue, toRef as Ye, defineComponent as ie, openBlock as N, createBlock as z, resolveDynamicComponent as Ae, mergeProps as Ce, Teleport as Xe, createElementVNode as q, withModifiers as ce, normalizeStyle as _e, normalizeClass as k, createElementBlock as j, createCommentVNode as Fe, renderSlot as Re, Fragment as oe, createVNode as Te, TransitionGroup as Me, withCtx as fe, renderList as ge, unref as Y } from "vue";
|
|
2
|
+
import { i as Ee, s as Se, g as H, w as ae, p as I, b as $, n as O, u as xe } from "./use-audio-manager.mjs";
|
|
3
3
|
const Ie = Symbol("micro-router");
|
|
4
4
|
function bt() {
|
|
5
5
|
return Symbol("micro-router-nested");
|
|
@@ -38,12 +38,12 @@ function Ve(e, o) {
|
|
|
38
38
|
return (s == null ? void 0 : s.name) ?? n;
|
|
39
39
|
});
|
|
40
40
|
function T(s, f, A) {
|
|
41
|
-
var d, w,
|
|
41
|
+
var d, w, p;
|
|
42
42
|
if (!(f && u)) {
|
|
43
43
|
f && (u = !0);
|
|
44
44
|
try {
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
45
|
+
const y = r.get(s);
|
|
46
|
+
if (!y) return;
|
|
47
47
|
const m = r.get(n), D = s === n || s === i;
|
|
48
48
|
if (f)
|
|
49
49
|
(d = o == null ? void 0 : o.trackGuiEnter) == null || d.call(o, s), D ? r.forEach((P) => {
|
|
@@ -54,13 +54,13 @@ function Ve(e, o) {
|
|
|
54
54
|
attrs: void 0
|
|
55
55
|
}));
|
|
56
56
|
}) : m != null && m.activated && ((w = o == null ? void 0 : o.trackGuiLeave) == null || w.call(o, n), r.set(n, { ...m, activated: !1 })), A && c.set(s, { ...A }), r.set(s, {
|
|
57
|
-
...
|
|
57
|
+
...y,
|
|
58
58
|
activated: !0,
|
|
59
|
-
componentKey: (
|
|
59
|
+
componentKey: (y.componentKey || 0) + 1,
|
|
60
60
|
attrs: A ? { ...A } : void 0
|
|
61
61
|
});
|
|
62
62
|
else {
|
|
63
|
-
(
|
|
63
|
+
(p = o == null ? void 0 : o.trackGuiLeave) == null || p.call(o, s), c.delete(s), r.set(s, { ...y, activated: !1, attrs: void 0 });
|
|
64
64
|
const P = r.get(n);
|
|
65
65
|
if (!D && P && !P.activated) {
|
|
66
66
|
if (P.name === i) return;
|
|
@@ -88,7 +88,7 @@ function Ve(e, o) {
|
|
|
88
88
|
function g(s) {
|
|
89
89
|
return c.get(s);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function h(s, f) {
|
|
92
92
|
const A = c.get(s);
|
|
93
93
|
c.set(s, { ...A, ...f });
|
|
94
94
|
}
|
|
@@ -100,7 +100,7 @@ function Ve(e, o) {
|
|
|
100
100
|
registerControl: L,
|
|
101
101
|
registerControls: _,
|
|
102
102
|
getControlAttrs: g,
|
|
103
|
-
updateControlAttrs:
|
|
103
|
+
updateControlAttrs: h,
|
|
104
104
|
cleanup: l.cleanup
|
|
105
105
|
};
|
|
106
106
|
}
|
|
@@ -313,22 +313,22 @@ function st(e) {
|
|
|
313
313
|
/** Attrs stored separately for useMicroState access inside dialog components */
|
|
314
314
|
dialogAttrs: X(/* @__PURE__ */ new Map())
|
|
315
315
|
}), l = R(() => {
|
|
316
|
-
const g = [],
|
|
316
|
+
const g = [], h = /* @__PURE__ */ new Set();
|
|
317
317
|
for (const s of t.dialogStack) {
|
|
318
318
|
const f = t.dialogs.get(s);
|
|
319
|
-
f && (f.activated || f.closing) && (g.push(f),
|
|
319
|
+
f && (f.activated || f.closing) && (g.push(f), h.add(s));
|
|
320
320
|
}
|
|
321
321
|
for (const s of t.dialogs.values())
|
|
322
|
-
s.closing && !
|
|
322
|
+
s.closing && !h.has(s.path) && g.push(s);
|
|
323
323
|
return g;
|
|
324
324
|
}), u = n.schedule;
|
|
325
|
-
function r(g,
|
|
326
|
-
return { path: g, attrs:
|
|
325
|
+
function r(g, h) {
|
|
326
|
+
return { path: g, attrs: h };
|
|
327
327
|
}
|
|
328
|
-
function c({ path: g, open:
|
|
328
|
+
function c({ path: g, open: h, attrs: s }) {
|
|
329
329
|
const f = t.dialogs.get(g);
|
|
330
330
|
return f && te(() => {
|
|
331
|
-
if (
|
|
331
|
+
if (h)
|
|
332
332
|
t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g, s && t.dialogAttrs.set(g, { ...s }), t.dialogs.set(g, {
|
|
333
333
|
...f,
|
|
334
334
|
activated: !0,
|
|
@@ -359,14 +359,14 @@ function st(e) {
|
|
|
359
359
|
}
|
|
360
360
|
}), r(g, s);
|
|
361
361
|
}
|
|
362
|
-
function a(g,
|
|
362
|
+
function a(g, h) {
|
|
363
363
|
var s, f;
|
|
364
|
-
if (i) return r(g,
|
|
364
|
+
if (i) return r(g, h);
|
|
365
365
|
(s = t.dialogs.get(g)) != null && s.focusInput && it(), i = !0;
|
|
366
366
|
try {
|
|
367
367
|
const A = t.activeDialog || "";
|
|
368
368
|
(f = e == null ? void 0 : e.trackDialogEnter) == null || f.call(e, g, A, g);
|
|
369
|
-
const d = c({ path: g, open: !0, attrs:
|
|
369
|
+
const d = c({ path: g, open: !0, attrs: h });
|
|
370
370
|
return u(() => {
|
|
371
371
|
i = !1;
|
|
372
372
|
}, 300), d;
|
|
@@ -375,24 +375,24 @@ function st(e) {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
function v(g) {
|
|
378
|
-
var
|
|
379
|
-
(
|
|
378
|
+
var h;
|
|
379
|
+
(h = e == null ? void 0 : e.trackDialogLeave) == null || h.call(e, g, g, ""), t.dialogAttrs.delete(g), c({ path: g, open: !1 });
|
|
380
380
|
}
|
|
381
381
|
function C() {
|
|
382
|
-
const g = [],
|
|
382
|
+
const g = [], h = [];
|
|
383
383
|
t.dialogs.forEach((s, f) => {
|
|
384
384
|
var A, d;
|
|
385
385
|
if (s.activated) {
|
|
386
386
|
(A = e == null ? void 0 : e.trackDialogLeave) == null || A.call(e, f, f, "");
|
|
387
387
|
const w = (d = s.attrs) == null ? void 0 : d.onClose;
|
|
388
|
-
typeof w == "function" &&
|
|
388
|
+
typeof w == "function" && h.push(w), t.dialogs.set(f, {
|
|
389
389
|
...s,
|
|
390
390
|
activated: !1,
|
|
391
391
|
closing: !0,
|
|
392
392
|
attrs: void 0
|
|
393
393
|
}), g.push(f);
|
|
394
394
|
}
|
|
395
|
-
}),
|
|
395
|
+
}), h.forEach((s) => s()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], u(() => {
|
|
396
396
|
g.forEach((s) => {
|
|
397
397
|
const f = t.dialogs.get(s);
|
|
398
398
|
f && !f.activated && t.dialogs.set(s, { ...f, closing: !1 });
|
|
@@ -401,11 +401,11 @@ function st(e) {
|
|
|
401
401
|
}
|
|
402
402
|
function M(g) {
|
|
403
403
|
t.dialogs.has(g.path) && console.warn(`[vue-micro-router] Dialog "${g.path}" already registered. Overwriting.`);
|
|
404
|
-
let { component:
|
|
405
|
-
Ee(
|
|
404
|
+
let { component: h } = g;
|
|
405
|
+
Ee(h) && (h = Pe(h)), t.dialogs.set(g.path, {
|
|
406
406
|
persistent: !0,
|
|
407
407
|
...g,
|
|
408
|
-
component: Se(
|
|
408
|
+
component: Se(h)
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
411
|
function T(g) {
|
|
@@ -414,9 +414,9 @@ function st(e) {
|
|
|
414
414
|
function L(g) {
|
|
415
415
|
return t.dialogAttrs.get(g);
|
|
416
416
|
}
|
|
417
|
-
function _(g,
|
|
417
|
+
function _(g, h) {
|
|
418
418
|
const s = t.dialogAttrs.get(g);
|
|
419
|
-
t.dialogAttrs.set(g, { ...s, ...
|
|
419
|
+
t.dialogAttrs.set(g, { ...s, ...h });
|
|
420
420
|
}
|
|
421
421
|
return {
|
|
422
422
|
activeDialog: R(() => t.activeDialog),
|
|
@@ -484,17 +484,17 @@ function ut(e, o) {
|
|
|
484
484
|
const n = e.maxEntries ?? 50, i = [];
|
|
485
485
|
let t = -1, l = !1;
|
|
486
486
|
const u = ne(0);
|
|
487
|
-
function r(g,
|
|
488
|
-
!e.enabled || l || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props:
|
|
487
|
+
function r(g, h) {
|
|
488
|
+
!e.enabled || l || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: h ? { ...h } : void 0 }), t = i.length - 1, i.length > n && (i.shift(), t--), u.value++);
|
|
489
489
|
}
|
|
490
490
|
const c = R(() => (u.value, [...i])), a = R(() => (u.value, t > 0)), v = R(() => (u.value, t < i.length - 1));
|
|
491
491
|
async function C(g) {
|
|
492
492
|
if (g < 0 || g >= i.length) return;
|
|
493
|
-
const
|
|
494
|
-
if (
|
|
493
|
+
const h = i[g];
|
|
494
|
+
if (h) {
|
|
495
495
|
t = g, l = !0, u.value++;
|
|
496
496
|
try {
|
|
497
|
-
await o(
|
|
497
|
+
await o(h.path);
|
|
498
498
|
} finally {
|
|
499
499
|
l = !1;
|
|
500
500
|
}
|
|
@@ -507,8 +507,8 @@ function ut(e, o) {
|
|
|
507
507
|
v.value && await C(t + 1);
|
|
508
508
|
}
|
|
509
509
|
async function L(g) {
|
|
510
|
-
const
|
|
511
|
-
await C(
|
|
510
|
+
const h = t + g;
|
|
511
|
+
await C(h);
|
|
512
512
|
}
|
|
513
513
|
function _() {
|
|
514
514
|
i.length = 0, t = -1, u.value++;
|
|
@@ -545,12 +545,12 @@ function ft(e) {
|
|
|
545
545
|
const o = e.stepWiseDelay ?? Math.max(e.stepDelay * 1.2, e.stepDelay + 100);
|
|
546
546
|
async function n(t, l) {
|
|
547
547
|
if (!t || e.isLocked()) return;
|
|
548
|
-
const u =
|
|
548
|
+
const u = O(t);
|
|
549
549
|
if (e.getActivePath() !== u) {
|
|
550
550
|
e.lock();
|
|
551
551
|
try {
|
|
552
552
|
if (e.runGuards) {
|
|
553
|
-
const a =
|
|
553
|
+
const a = O(e.getActivePath());
|
|
554
554
|
if (!await e.runGuards(u, a)) {
|
|
555
555
|
e.unlock();
|
|
556
556
|
return;
|
|
@@ -559,7 +559,7 @@ function ft(e) {
|
|
|
559
559
|
const r = I(e.getActivePath()), c = I(u);
|
|
560
560
|
if (t.startsWith("/"))
|
|
561
561
|
for (let a = 0; a < c.length; a++) {
|
|
562
|
-
const v =
|
|
562
|
+
const v = $(
|
|
563
563
|
c.slice(0, a + 1)
|
|
564
564
|
);
|
|
565
565
|
if (e.getActivePath() === v) continue;
|
|
@@ -592,7 +592,7 @@ function ft(e) {
|
|
|
592
592
|
e.lock();
|
|
593
593
|
try {
|
|
594
594
|
if (e.runGuards) {
|
|
595
|
-
const r = l.slice(0, l.length - u), c =
|
|
595
|
+
const r = l.slice(0, l.length - u), c = $(r), a = O(e.getActivePath());
|
|
596
596
|
if (!await e.runGuards(c, a)) {
|
|
597
597
|
e.unlock();
|
|
598
598
|
return;
|
|
@@ -620,79 +620,79 @@ function gt(e, o) {
|
|
|
620
620
|
/** Component key per segment — incremented to force Vue full remount (resets local state) */
|
|
621
621
|
componentKeys: X(/* @__PURE__ */ new Map())
|
|
622
622
|
}), v = /* @__PURE__ */ new Map(), C = R(() => {
|
|
623
|
-
const
|
|
624
|
-
for (const m of
|
|
623
|
+
const p = I(a.activePath), y = [];
|
|
624
|
+
for (const m of p) {
|
|
625
625
|
const D = r.routes.get(m);
|
|
626
626
|
if (!D) continue;
|
|
627
627
|
const P = a.routeKeys.get(m) || 0, S = a.componentKeys.get(m) || 0, b = `${D.path}-${P}`, E = v.get(m);
|
|
628
628
|
if (E && E.key === b && E.componentKey === S)
|
|
629
|
-
|
|
629
|
+
y.push(E);
|
|
630
630
|
else {
|
|
631
|
-
const
|
|
632
|
-
v.set(m,
|
|
631
|
+
const W = { ...D, key: b, componentKey: S };
|
|
632
|
+
v.set(m, W), y.push(W);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
for (const m of v.keys())
|
|
636
|
-
|
|
637
|
-
return
|
|
636
|
+
p.includes(m) || v.delete(m);
|
|
637
|
+
return y;
|
|
638
638
|
});
|
|
639
|
-
function M(
|
|
640
|
-
var
|
|
641
|
-
const m = I(a.activePath), D = Math.min(
|
|
639
|
+
function M(p, y) {
|
|
640
|
+
var W, G;
|
|
641
|
+
const m = I(a.activePath), D = Math.min(p, m.length - 1);
|
|
642
642
|
if (D <= 0) return;
|
|
643
|
-
const P = m.slice(0, -D), S =
|
|
643
|
+
const P = m.slice(0, -D), S = $(P);
|
|
644
644
|
for (let U = m.length - D; U < m.length; U++)
|
|
645
645
|
a.routeAttrs.delete(m[U]);
|
|
646
646
|
const b = P.at(-1);
|
|
647
|
-
if (b &&
|
|
647
|
+
if (b && y) {
|
|
648
648
|
const U = a.routeAttrs.get(b);
|
|
649
|
-
a.routeAttrs.set(b, { ...U, ...
|
|
649
|
+
a.routeAttrs.set(b, { ...U, ...y }), a.componentKeys.set(
|
|
650
650
|
b,
|
|
651
651
|
(a.componentKeys.get(b) || 0) + 1
|
|
652
652
|
);
|
|
653
653
|
}
|
|
654
654
|
const E = a.activePath;
|
|
655
|
-
(
|
|
655
|
+
(W = o == null ? void 0 : o.trackPageLeave) == null || W.call(o, E, E, S), a.fromPath = E, a.toPath = S, a.activePath = S, (G = o == null ? void 0 : o.trackPageEnter) == null || G.call(o, S, E, S);
|
|
656
656
|
}
|
|
657
|
-
async function T(
|
|
657
|
+
async function T(p, y) {
|
|
658
658
|
var S, b;
|
|
659
|
-
const m =
|
|
659
|
+
const m = O(p), D = I(m);
|
|
660
660
|
await Promise.all(
|
|
661
661
|
D.map((E) => r.asyncLoaders.get(E)).filter((E) => !!E).map((E) => ae(E))
|
|
662
662
|
);
|
|
663
663
|
const P = a.activePath;
|
|
664
|
-
P !== m && ((S = o == null ? void 0 : o.trackPageLeave) == null || S.call(o, P, P, m)), a.fromPath = P, a.toPath = m, a.activePath = m,
|
|
664
|
+
P !== m && ((S = o == null ? void 0 : o.trackPageLeave) == null || S.call(o, P, P, m)), a.fromPath = P, a.toPath = m, a.activePath = m, y && L(m, y), (b = o == null ? void 0 : o.trackPageEnter) == null || b.call(o, m, P, m);
|
|
665
665
|
}
|
|
666
|
-
function L(
|
|
667
|
-
const m = I(
|
|
666
|
+
function L(p, y) {
|
|
667
|
+
const m = I(p).at(-1);
|
|
668
668
|
if (!m) return;
|
|
669
669
|
const D = a.routeAttrs.get(m);
|
|
670
|
-
a.routeAttrs.set(m, { ...D, ...
|
|
670
|
+
a.routeAttrs.set(m, { ...D, ...y });
|
|
671
671
|
}
|
|
672
|
-
function _(
|
|
673
|
-
const m = a.routeAttrs.get(
|
|
674
|
-
a.routeAttrs.set(
|
|
672
|
+
function _(p, y) {
|
|
673
|
+
const m = a.routeAttrs.get(p);
|
|
674
|
+
a.routeAttrs.set(p, { ...m, ...y });
|
|
675
675
|
}
|
|
676
|
-
function g(
|
|
677
|
-
return a.routeAttrs.get(
|
|
676
|
+
function g(p) {
|
|
677
|
+
return a.routeAttrs.get(p);
|
|
678
678
|
}
|
|
679
|
-
async function p
|
|
680
|
-
if (!
|
|
681
|
-
if (typeof
|
|
682
|
-
M(Math.abs(
|
|
679
|
+
async function h(p, y) {
|
|
680
|
+
if (!p && p !== 0) return;
|
|
681
|
+
if (typeof p == "number" && p < 0) {
|
|
682
|
+
M(Math.abs(p), y);
|
|
683
683
|
return;
|
|
684
684
|
}
|
|
685
|
-
const m =
|
|
685
|
+
const m = p.toString();
|
|
686
686
|
if (m.startsWith("/")) {
|
|
687
687
|
const b = I(m), E = I(a.activePath);
|
|
688
688
|
if (b.length < E.length && b.every((U, le) => E[le] === U)) {
|
|
689
689
|
if (E.length - b.length === 1)
|
|
690
|
-
M(1,
|
|
690
|
+
M(1, y);
|
|
691
691
|
else {
|
|
692
|
-
const le = E.slice(0, b.length + 1), $e =
|
|
692
|
+
const le = E.slice(0, b.length + 1), $e = $(le);
|
|
693
693
|
for (let ue = b.length + 1; ue < E.length; ue++)
|
|
694
694
|
a.routeAttrs.delete(E[ue]);
|
|
695
|
-
a.activePath = $e, await te(), M(1,
|
|
695
|
+
a.activePath = $e, await te(), M(1, y);
|
|
696
696
|
}
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
@@ -700,57 +700,57 @@ function gt(e, o) {
|
|
|
700
700
|
G && E.at(-1) === G && a.routeKeys.set(
|
|
701
701
|
G,
|
|
702
702
|
(a.routeKeys.get(G) || 0) + 1
|
|
703
|
-
), await T(m,
|
|
703
|
+
), await T(m, y);
|
|
704
704
|
return;
|
|
705
705
|
}
|
|
706
706
|
const D = I(a.activePath), P = D.indexOf(m);
|
|
707
707
|
if (P !== -1) {
|
|
708
708
|
const b = D.length - (P + 1);
|
|
709
709
|
if (b === 1)
|
|
710
|
-
M(1,
|
|
710
|
+
M(1, y);
|
|
711
711
|
else if (b > 1) {
|
|
712
|
-
const E = D.slice(0, P + 2),
|
|
712
|
+
const E = D.slice(0, P + 2), W = $(E);
|
|
713
713
|
for (let G = P + 2; G < D.length; G++)
|
|
714
714
|
a.routeAttrs.delete(D[G]);
|
|
715
|
-
a.activePath =
|
|
715
|
+
a.activePath = W, await te(), M(1, y);
|
|
716
716
|
} else
|
|
717
717
|
a.routeKeys.set(m, (a.routeKeys.get(m) || 0) + 1), await T(
|
|
718
|
-
|
|
719
|
-
|
|
718
|
+
$(D.slice(0, P + 1)),
|
|
719
|
+
y
|
|
720
720
|
);
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
723
|
-
const S =
|
|
724
|
-
await T(S,
|
|
723
|
+
const S = $([...D, m]);
|
|
724
|
+
await T(S, y);
|
|
725
725
|
}
|
|
726
|
-
function s(
|
|
727
|
-
if (typeof
|
|
728
|
-
const P = I(a.activePath), S = Math.min(Math.abs(
|
|
729
|
-
return S <= 0 ? a.activePath :
|
|
726
|
+
function s(p) {
|
|
727
|
+
if (typeof p == "number" && p < 0) {
|
|
728
|
+
const P = I(a.activePath), S = Math.min(Math.abs(p), P.length - 1);
|
|
729
|
+
return S <= 0 ? a.activePath : $(P.slice(0, -S));
|
|
730
730
|
}
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
733
|
-
const m = I(a.activePath), D = m.indexOf(
|
|
734
|
-
return D !== -1 ?
|
|
731
|
+
const y = p.toString();
|
|
732
|
+
if (y.startsWith("/")) return O(y);
|
|
733
|
+
const m = I(a.activePath), D = m.indexOf(y);
|
|
734
|
+
return D !== -1 ? $(m.slice(0, D + 1)) : $([...m, y]);
|
|
735
735
|
}
|
|
736
|
-
const f = { getRoute: (
|
|
737
|
-
async function A(
|
|
736
|
+
const f = { getRoute: (p) => r.routes.get(p) };
|
|
737
|
+
async function A(p, y) {
|
|
738
738
|
var m;
|
|
739
|
-
if (!c.value) {
|
|
739
|
+
if (!c.value && !((p || p === 0) && O(s(p)) === O(a.activePath))) {
|
|
740
740
|
c.value = !0;
|
|
741
741
|
try {
|
|
742
742
|
const D = (((m = t.beforeEach) == null ? void 0 : m.length) ?? 0) > 0, P = r.routes.size > 0;
|
|
743
|
-
if ((D || P) &&
|
|
744
|
-
const E = s(
|
|
745
|
-
if (!await Le(E,
|
|
743
|
+
if ((D || P) && p) {
|
|
744
|
+
const E = s(p), W = O(a.activePath);
|
|
745
|
+
if (!await Le(E, W, t, f)) {
|
|
746
746
|
c.value = !1;
|
|
747
747
|
return;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
const S =
|
|
751
|
-
await p
|
|
752
|
-
const b =
|
|
753
|
-
d == null || d.record(b,
|
|
750
|
+
const S = O(a.activePath);
|
|
751
|
+
await h(p, y);
|
|
752
|
+
const b = O(a.activePath);
|
|
753
|
+
d == null || d.record(b, y), lt(b, S, t.afterEach), r.preloadAdjacent(I(a.activePath)), u.schedule(() => {
|
|
754
754
|
c.value = !1;
|
|
755
755
|
}, i);
|
|
756
756
|
} catch (D) {
|
|
@@ -758,19 +758,19 @@ function gt(e, o) {
|
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
|
-
const d = l.enabled ? ut(l, async (
|
|
762
|
-
const
|
|
763
|
-
if (m.length <
|
|
764
|
-
const P =
|
|
761
|
+
const d = l.enabled ? ut(l, async (p) => {
|
|
762
|
+
const y = I(a.activePath), m = I(p);
|
|
763
|
+
if (m.length < y.length && m.every((P, S) => y[S] === P)) {
|
|
764
|
+
const P = y.length - m.length;
|
|
765
765
|
await A(-P);
|
|
766
766
|
} else
|
|
767
|
-
await A(
|
|
767
|
+
await A(p);
|
|
768
768
|
}) : void 0;
|
|
769
|
-
d && d.record(
|
|
769
|
+
d && d.record(O(n));
|
|
770
770
|
const w = ft({
|
|
771
771
|
getActivePath: () => a.activePath,
|
|
772
|
-
pushCore:
|
|
773
|
-
runGuards: (
|
|
772
|
+
pushCore: h,
|
|
773
|
+
runGuards: (p, y) => Le(p, y, t, f),
|
|
774
774
|
scheduleUnlock: () => u.schedule(() => {
|
|
775
775
|
c.value = !1;
|
|
776
776
|
}, i),
|
|
@@ -915,7 +915,7 @@ function vt(e) {
|
|
|
915
915
|
), l && document.addEventListener("visibilitychange", l.handleVisibilityChange), qe(u);
|
|
916
916
|
}), De(() => {
|
|
917
917
|
o.cleanupAllSessions(), n.cleanup(), i.cleanup(), t.cleanup(), l && (document.removeEventListener("visibilitychange", l.handleVisibilityChange), l.cleanup());
|
|
918
|
-
}),
|
|
918
|
+
}), K(Ie, u), V(me, null) || K(me, u), u;
|
|
919
919
|
}
|
|
920
920
|
function Z(e) {
|
|
921
921
|
const o = e != null && e.root ? me : Ie, n = V(o);
|
|
@@ -1045,18 +1045,18 @@ function mt(e, o) {
|
|
|
1045
1045
|
function _(s) {
|
|
1046
1046
|
if (!c || !a) return;
|
|
1047
1047
|
if (!a.isConnected) {
|
|
1048
|
-
|
|
1048
|
+
h(), c = !1;
|
|
1049
1049
|
return;
|
|
1050
1050
|
}
|
|
1051
1051
|
const f = s.clientX - l, A = Date.now() - r, d = f / A;
|
|
1052
1052
|
f / window.innerWidth > i || d > t ? (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(100%)", v && (v.style.transition = "transform 0.2s ease-out", v.style.transform = "translateX(0)"), setTimeout(() => {
|
|
1053
|
-
|
|
1054
|
-
}, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", v && (v.style.transition = "transform 0.2s ease-out", v.style.transform = "translateX(-20%)"), setTimeout(
|
|
1053
|
+
h(), o.goBack();
|
|
1054
|
+
}, 200)) : (a.style.transition = "transform 0.2s ease-out", a.style.transform = "translateX(0)", v && (v.style.transition = "transform 0.2s ease-out", v.style.transform = "translateX(-20%)"), setTimeout(h, 200)), c = !1;
|
|
1055
1055
|
}
|
|
1056
1056
|
function g() {
|
|
1057
|
-
c && (a && (a.style.transition = "transform 0.15s ease-out", a.style.transform = "translateX(0)"), v && (v.style.transition = "transform 0.15s ease-out", v.style.transform = "translateX(-20%)"), setTimeout(
|
|
1057
|
+
c && (a && (a.style.transition = "transform 0.15s ease-out", a.style.transform = "translateX(0)"), v && (v.style.transition = "transform 0.15s ease-out", v.style.transform = "translateX(-20%)"), setTimeout(h, 150), c = !1);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function h() {
|
|
1060
1060
|
a && (a.style.willChange = "", a.style.transition = "", a.style.transform = ""), v && (v.style.willChange = "", v.style.transition = "", v.style.transform = ""), a = null, v = null;
|
|
1061
1061
|
}
|
|
1062
1062
|
Q(() => {
|
|
@@ -1082,7 +1082,7 @@ const ht = /* @__PURE__ */ ie({
|
|
|
1082
1082
|
},
|
|
1083
1083
|
setup(e) {
|
|
1084
1084
|
const o = e, { getControlAttrs: n, updateControlAttrs: i } = Z();
|
|
1085
|
-
return
|
|
1085
|
+
return K(Ge, o.control.name), K(se, () => n(o.control.name)), K(re, (t) => {
|
|
1086
1086
|
i(o.control.name, t);
|
|
1087
1087
|
}), (t, l) => (N(), z(Ae(e.control.component), Ce({
|
|
1088
1088
|
key: e.control.componentKey || 0
|
|
@@ -1123,10 +1123,10 @@ const wt = /* @__PURE__ */ ie({
|
|
|
1123
1123
|
d.preventDefault(), (P = a.value) == null || P.focus();
|
|
1124
1124
|
return;
|
|
1125
1125
|
}
|
|
1126
|
-
const
|
|
1127
|
-
d.shiftKey ? (!D || m ===
|
|
1126
|
+
const p = w[0], y = w[w.length - 1], m = document.activeElement, D = !!((S = a.value) != null && S.contains(m));
|
|
1127
|
+
d.shiftKey ? (!D || m === p) && (d.preventDefault(), y.focus()) : (!D || m === y) && (d.preventDefault(), p.focus());
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function h(d) {
|
|
1130
1130
|
n.dialog.persistent || d.target === d.currentTarget && i("close", n.dialog.path);
|
|
1131
1131
|
}
|
|
1132
1132
|
function s(d) {
|
|
@@ -1153,10 +1153,10 @@ const wt = /* @__PURE__ */ ie({
|
|
|
1153
1153
|
r++, c == null || c(), c = null, u = !1, Pt();
|
|
1154
1154
|
const d = v.value;
|
|
1155
1155
|
v.value = null;
|
|
1156
|
-
const w = document.activeElement,
|
|
1157
|
-
d && typeof d.focus == "function" && document.contains(d) && (
|
|
1156
|
+
const w = document.activeElement, p = !!((m = a.value) != null && m.contains(w)), y = !w || w === document.body;
|
|
1157
|
+
d && typeof d.focus == "function" && document.contains(d) && (p || y) && d.focus();
|
|
1158
1158
|
}
|
|
1159
|
-
return
|
|
1159
|
+
return K(Ne, n.dialog.path), K(se, () => t(n.dialog.path)), K(re, (d) => {
|
|
1160
1160
|
l(n.dialog.path, d);
|
|
1161
1161
|
}), F(
|
|
1162
1162
|
() => n.dialog.activated,
|
|
@@ -1183,7 +1183,7 @@ const wt = /* @__PURE__ */ ie({
|
|
|
1183
1183
|
zIndex: 100 + e.stackIndex,
|
|
1184
1184
|
"--dialog-duration": `${M.value}ms`
|
|
1185
1185
|
}),
|
|
1186
|
-
onClick: ce(
|
|
1186
|
+
onClick: ce(h, ["self"])
|
|
1187
1187
|
}, [
|
|
1188
1188
|
L.value ? Fe("", !0) : (N(), j("div", {
|
|
1189
1189
|
key: 0,
|
|
@@ -1199,7 +1199,7 @@ const wt = /* @__PURE__ */ ie({
|
|
|
1199
1199
|
`dialog-transition-${C.value}`,
|
|
1200
1200
|
e.dialog.closing && "micro-dialog--closing"
|
|
1201
1201
|
]]),
|
|
1202
|
-
onClick: ce(
|
|
1202
|
+
onClick: ce(h, ["self"]),
|
|
1203
1203
|
onKeydown: g
|
|
1204
1204
|
}, [
|
|
1205
1205
|
q("div", {
|
|
@@ -1225,9 +1225,9 @@ const wt = /* @__PURE__ */ ie({
|
|
|
1225
1225
|
const o = e;
|
|
1226
1226
|
if (o.routePath) {
|
|
1227
1227
|
const n = o.routePath;
|
|
1228
|
-
|
|
1228
|
+
K(Be, n);
|
|
1229
1229
|
const { updateRouteAttrs: i, getRouteAttrs: t } = Z();
|
|
1230
|
-
|
|
1230
|
+
K(se, () => t(n)), K(re, (l) => {
|
|
1231
1231
|
i(n, l);
|
|
1232
1232
|
});
|
|
1233
1233
|
}
|
|
@@ -1245,9 +1245,9 @@ const wt = /* @__PURE__ */ ie({
|
|
|
1245
1245
|
nested: { type: Boolean }
|
|
1246
1246
|
},
|
|
1247
1247
|
setup(e) {
|
|
1248
|
-
var
|
|
1248
|
+
var h, s;
|
|
1249
1249
|
const o = e, n = vt(o.config);
|
|
1250
|
-
(
|
|
1250
|
+
(h = o.plugins) != null && h.length && pt(o.plugins, n);
|
|
1251
1251
|
const {
|
|
1252
1252
|
resolveRoutes: i,
|
|
1253
1253
|
resolveDialogs: t,
|
|
@@ -1341,12 +1341,12 @@ export {
|
|
|
1341
1341
|
Bt as MicroRouterView,
|
|
1342
1342
|
Ct as RoutePage,
|
|
1343
1343
|
ze as STEP_DELAY,
|
|
1344
|
-
|
|
1344
|
+
$ as buildPathFromSegments,
|
|
1345
1345
|
bt as createRouterKey,
|
|
1346
1346
|
It as defineFeaturePlugin,
|
|
1347
1347
|
H as getLastSegment,
|
|
1348
1348
|
Ee as isAsyncLoader,
|
|
1349
|
-
|
|
1349
|
+
O as normalizePath,
|
|
1350
1350
|
I as parsePathSegments,
|
|
1351
1351
|
pt as registerFeaturePlugins,
|
|
1352
1352
|
Se as safeMarkRaw,
|