vue-micro-router 1.0.53 → 1.0.55

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.
Files changed (2) hide show
  1. package/dist/index.mjs +197 -190
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -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 r = U(/* @__PURE__ */ new Map()), f = U(
27
+ const s = U(/* @__PURE__ */ new Map()), f = U(
28
28
  /* @__PURE__ */ new Map()
29
29
  ), a = C(() => {
30
30
  const l = [];
31
- for (const s of r.values())
32
- s.activated && l.push(s);
31
+ for (const r of s.values())
32
+ r.activated && l.push(r);
33
33
  return l;
34
34
  }), d = a, A = C(
35
35
  () => a.value.some((l) => l.name !== n)
36
36
  ), L = C(() => {
37
- const l = a.value.find((s) => s.name !== n);
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, s, w) {
40
+ function M(l, r, P) {
41
41
  var y, S, p;
42
- if (!(s && u)) {
43
- s && (u = !0);
42
+ if (!(r && u)) {
43
+ r && (u = !0);
44
44
  try {
45
- const h = r.get(l);
45
+ const h = s.get(l);
46
46
  if (!h) return;
47
- const v = r.get(n), D = l === n || l === i;
48
- if (s)
49
- (y = o == null ? void 0 : o.trackGuiEnter) == null || y.call(o, l), D ? r.forEach((P) => {
47
+ const v = s.get(n), D = l === n || l === i;
48
+ if (r)
49
+ (y = o == null ? void 0 : o.trackGuiEnter) == null || y.call(o, l), D ? s.forEach((w) => {
50
50
  var b;
51
- P.name !== n && P.activated && ((b = o == null ? void 0 : o.trackGuiLeave) == null || b.call(o, P.name), r.set(P.name, {
52
- ...P,
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 && ((S = o == null ? void 0 : o.trackGuiLeave) == null || S.call(o, n), r.set(n, { ...v, activated: !1 })), w && f.set(l, { ...w }), r.set(l, {
56
+ }) : v != null && v.activated && ((S = o == null ? void 0 : o.trackGuiLeave) == null || S.call(o, n), s.set(n, { ...v, activated: !1 })), P && f.set(l, { ...P }), s.set(l, {
57
57
  ...h,
58
58
  activated: !0,
59
59
  componentKey: (h.componentKey || 0) + 1,
60
- attrs: w ? { ...w } : void 0
60
+ attrs: P ? { ...P } : void 0
61
61
  });
62
62
  else {
63
- (p = o == null ? void 0 : o.trackGuiLeave) == null || p.call(o, l), f.delete(l), r.set(l, { ...h, activated: !1, attrs: void 0 });
64
- const P = r.get(n);
65
- if (!D && P && !P.activated) {
66
- if (P.name === i) return;
67
- r.set(n, { ...P, activated: !0 });
63
+ (p = o == null ? void 0 : o.trackGuiLeave) == null || p.call(o, l), f.delete(l), s.set(l, { ...h, 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
- s && c.schedule(() => {
71
+ r && c.schedule(() => {
72
72
  u = !1;
73
73
  }, t);
74
74
  }
75
75
  }
76
76
  }
77
77
  function _(l) {
78
- r.has(l.name) && console.warn(`[vue-micro-router] Control "${l.name}" already registered. Overwriting.`);
79
- let { component: s } = l;
80
- De(s) && (s = me(s)), r.set(l.name, {
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(s)
82
+ component: Ce(r)
83
83
  });
84
84
  }
85
85
  function T(l) {
@@ -88,9 +88,9 @@ function Ue(e, o) {
88
88
  function g(l) {
89
89
  return f.get(l);
90
90
  }
91
- function m(l, s) {
92
- const w = f.get(l);
93
- f.set(l, { ...w, ...s });
91
+ function m(l, r) {
92
+ const P = f.get(l);
93
+ f.set(l, { ...P, ...r });
94
94
  }
95
95
  return {
96
96
  resolveControls: d,
@@ -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 r of o) {
206
- const f = e.getRouteAttrs(r);
207
- f && (n[r] = { ...f });
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 r of e.resolveDialogs.value) {
211
- if (r.closing) continue;
212
- i.push(r.path);
213
- const f = e.getDialogAttrs(r.path);
214
- f && (t[r.path] = { ...f });
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 r of e.resolveControls.value) {
218
- c.push(r.name);
219
- const f = e.getControlAttrs(r.name);
220
- f && (u[r.name] = { ...f });
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,
@@ -260,25 +260,25 @@ function Ve(e) {
260
260
  }), c = C(() => {
261
261
  const g = [], m = /* @__PURE__ */ new Set();
262
262
  for (const l of t.dialogStack) {
263
- const s = t.dialogs.get(l);
264
- s && (s.activated || s.closing) && (g.push(s), m.add(l));
263
+ const r = t.dialogs.get(l);
264
+ r && (r.activated || r.closing) && (g.push(r), m.add(l));
265
265
  }
266
266
  for (const l of t.dialogs.values())
267
267
  l.closing && !m.has(l.path) && g.push(l);
268
268
  return g;
269
269
  }), u = n.schedule;
270
- function r(g, m) {
270
+ function s(g, m) {
271
271
  return { path: g, attrs: m };
272
272
  }
273
273
  function f({ path: g, open: m, attrs: l }) {
274
- const s = t.dialogs.get(g);
275
- return s && k(() => {
274
+ const r = t.dialogs.get(g);
275
+ return r && k(() => {
276
276
  if (m)
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
- ...s,
278
+ ...r,
279
279
  activated: !0,
280
280
  closing: !1,
281
- componentKey: (s.componentKey || 0) + 1,
281
+ componentKey: (r.componentKey || 0) + 1,
282
282
  attrs: {
283
283
  path: g,
284
284
  ...l,
@@ -289,11 +289,11 @@ function Ve(e) {
289
289
  });
290
290
  else {
291
291
  t.fromDialog = t.activeDialog;
292
- const w = t.dialogStack.indexOf(g);
293
- w > -1 && t.dialogStack.splice(w, 1), t.activeDialog = t.dialogStack.at(-1) ?? "", t.toDialog = t.activeDialog;
294
- const y = s.transitionDuration ?? (s.transition === "slide" ? 500 : 300);
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 y = r.transitionDuration ?? (r.transition === "slide" ? 500 : 300);
295
295
  t.dialogs.set(g, {
296
- ...s,
296
+ ...r,
297
297
  activated: !1,
298
298
  closing: !0,
299
299
  attrs: void 0
@@ -302,21 +302,21 @@ function Ve(e) {
302
302
  S && !S.activated && t.dialogs.set(g, { ...S, closing: !1 });
303
303
  }, y + 200);
304
304
  }
305
- }), r(g, l);
305
+ }), s(g, l);
306
306
  }
307
307
  function a(g, m) {
308
308
  var l;
309
- if (i) return r(g, m);
309
+ if (i) return s(g, m);
310
310
  i = !0;
311
311
  try {
312
- const s = t.activeDialog || "";
313
- (l = e == null ? void 0 : e.trackDialogEnter) == null || l.call(e, g, s, g);
314
- const w = f({ path: g, open: !0, attrs: m });
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: m });
315
315
  return u(() => {
316
316
  i = !1;
317
- }, 300), w;
318
- } catch (s) {
319
- throw i = !1, s;
317
+ }, 300), P;
318
+ } catch (r) {
319
+ throw i = !1, r;
320
320
  }
321
321
  }
322
322
  function d(g) {
@@ -325,22 +325,22 @@ function Ve(e) {
325
325
  }
326
326
  function A() {
327
327
  const g = [], m = [];
328
- t.dialogs.forEach((l, s) => {
329
- var w, y;
328
+ t.dialogs.forEach((l, r) => {
329
+ var P, y;
330
330
  if (l.activated) {
331
- (w = e == null ? void 0 : e.trackDialogLeave) == null || w.call(e, s, s, "");
331
+ (P = e == null ? void 0 : e.trackDialogLeave) == null || P.call(e, r, r, "");
332
332
  const S = (y = l.attrs) == null ? void 0 : y.onClose;
333
- typeof S == "function" && m.push(S), t.dialogs.set(s, {
333
+ typeof S == "function" && m.push(S), t.dialogs.set(r, {
334
334
  ...l,
335
335
  activated: !1,
336
336
  closing: !0,
337
337
  attrs: void 0
338
- }), g.push(s);
338
+ }), g.push(r);
339
339
  }
340
340
  }), m.forEach((l) => l()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], u(() => {
341
341
  g.forEach((l) => {
342
- const s = t.dialogs.get(l);
343
- s && !s.activated && t.dialogs.set(l, { ...s, closing: !1 });
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
  }
@@ -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, r) => {
388
- t = setTimeout(() => r(new Error("Navigation guard timed out")), i);
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 r;
402
+ var s;
403
403
  const t = n.guardTimeout ?? Be;
404
- if ((r = n.beforeEach) != null && r.length && !await je(n.beforeEach, e, o, t))
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,7 +429,7 @@ 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 r(g, m) {
432
+ function s(g, m) {
433
433
  !e.enabled || c || (t < i.length - 1 && i.splice(t + 1), i.push({ path: g, timestamp: Date.now(), props: m ? { ...m } : void 0 }), t = i.length - 1, i.length > n && (i.shift(), t--), u.value++);
434
434
  }
435
435
  const f = C(() => (u.value, [...i])), a = C(() => (u.value, t > 0)), d = C(() => (u.value, t < i.length - 1));
@@ -458,29 +458,29 @@ function qe(e, o) {
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: r };
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: r } = u;
468
- De(r) && (o.set(u.path, r), r = me(r)), e.set(u.path, {
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(r)
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 r = o.get(u);
478
- r && await ne(r);
477
+ const s = o.get(u);
478
+ s && await ne(s);
479
479
  }
480
480
  function c(u) {
481
- for (const [r, f] of e.entries())
482
- if (f.preload === "adjacent" && !u.includes(r)) {
483
- const a = o.get(r);
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,7 +501,7 @@ function Qe(e) {
501
501
  return;
502
502
  }
503
503
  }
504
- const r = B(e.getActivePath()), f = B(u);
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(
@@ -513,7 +513,7 @@ function Qe(e) {
513
513
  }
514
514
  else {
515
515
  const a = f.filter(
516
- (d) => !r.includes(d)
516
+ (d) => !s.includes(d)
517
517
  );
518
518
  if (a.length === 0) {
519
519
  await e.pushCore(t, c), e.scheduleUnlock();
@@ -525,8 +525,8 @@ function Qe(e) {
525
525
  }
526
526
  }
527
527
  e.scheduleUnlock();
528
- } catch (r) {
529
- throw e.unlock(), r;
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 r = c.slice(0, c.length - u), f = K(r), a = W(e.getActivePath());
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 r = 0; r < u; r++)
547
- await e.pushCore(-1), r < u - 1 && await fe(o);
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 (r) {
550
- throw e.unlock(), r;
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(), r = Je(), f = ee(!1), a = pe({
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,
@@ -567,9 +567,9 @@ function Ze(e, o) {
567
567
  }), d = /* @__PURE__ */ new Map(), A = C(() => {
568
568
  const p = B(a.activePath), h = [];
569
569
  for (const v of p) {
570
- const D = r.routes.get(v);
570
+ const D = s.routes.get(v);
571
571
  if (!D) continue;
572
- const P = a.routeKeys.get(v) || 0, b = a.componentKeys.get(v) || 0, E = `${D.path}-${P}`, R = d.get(v);
572
+ const w = a.routeKeys.get(v) || 0, b = a.componentKeys.get(v) || 0, E = `${D.path}-${w}`, R = d.get(v);
573
573
  if (R && R.key === E && R.componentKey === b)
574
574
  h.push(R);
575
575
  else {
@@ -585,10 +585,10 @@ function Ze(e, o) {
585
585
  var O, I;
586
586
  const v = B(a.activePath), D = Math.min(p, v.length - 1);
587
587
  if (D <= 0) return;
588
- const P = v.slice(0, -D), b = K(P);
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 = P.at(-1);
591
+ const E = w.at(-1);
592
592
  if (E && h) {
593
593
  const $ = a.routeAttrs.get(E);
594
594
  a.routeAttrs.set(E, { ...$, ...h }), a.componentKeys.set(
@@ -603,10 +603,10 @@ function Ze(e, o) {
603
603
  var b, E;
604
604
  const v = W(p), D = B(v);
605
605
  await Promise.all(
606
- D.map((R) => r.asyncLoaders.get(R)).filter((R) => !!R).map((R) => ne(R))
606
+ D.map((R) => s.asyncLoaders.get(R)).filter((R) => !!R).map((R) => ne(R))
607
607
  );
608
- const P = a.activePath;
609
- P !== v && ((b = o == null ? void 0 : o.trackPageLeave) == null || b.call(o, P, P, v)), a.fromPath = P, a.toPath = v, a.activePath = v, h && _(v, h), (E = o == null ? void 0 : o.trackPageEnter) == null || E.call(o, v, P, v);
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, h && _(v, h), (E = o == null ? void 0 : o.trackPageEnter) == null || E.call(o, v, w, v);
610
610
  }
611
611
  function _(p, h) {
612
612
  const v = B(p).at(-1);
@@ -648,19 +648,19 @@ function Ze(e, o) {
648
648
  ), await M(v, h);
649
649
  return;
650
650
  }
651
- const D = B(a.activePath), P = D.indexOf(v);
652
- if (P !== -1) {
653
- const E = D.length - (P + 1);
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
655
  L(1, h);
656
656
  else if (E > 1) {
657
- const R = D.slice(0, P + 2), O = K(R);
658
- for (let I = P + 2; I < D.length; I++)
657
+ const R = D.slice(0, w + 2), O = K(R);
658
+ for (let I = w + 2; I < D.length; I++)
659
659
  a.routeAttrs.delete(D[I]);
660
660
  a.activePath = O, await k(), L(1, h);
661
661
  } else
662
662
  a.routeKeys.set(v, (a.routeKeys.get(v) || 0) + 1), await M(
663
- K(D.slice(0, P + 1)),
663
+ K(D.slice(0, w + 1)),
664
664
  h
665
665
  );
666
666
  return;
@@ -670,24 +670,24 @@ function Ze(e, o) {
670
670
  }
671
671
  function l(p) {
672
672
  if (typeof p == "number" && p < 0) {
673
- const P = B(a.activePath), b = Math.min(Math.abs(p), P.length - 1);
674
- return b <= 0 ? a.activePath : K(P.slice(0, -b));
673
+ const w = B(a.activePath), b = Math.min(Math.abs(p), w.length - 1);
674
+ return b <= 0 ? a.activePath : K(w.slice(0, -b));
675
675
  }
676
676
  const h = p.toString();
677
677
  if (h.startsWith("/")) return W(h);
678
678
  const v = B(a.activePath), D = v.indexOf(h);
679
679
  return D !== -1 ? K(v.slice(0, D + 1)) : K([...v, h]);
680
680
  }
681
- const s = { getRoute: (p) => r.routes.get(p) };
682
- async function w(p, h) {
681
+ const r = { getRoute: (p) => s.routes.get(p) };
682
+ async function P(p, h) {
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, P = r.routes.size > 0;
688
- if ((D || P) && p) {
687
+ const D = (((v = t.beforeEach) == null ? void 0 : v.length) ?? 0) > 0, w = s.routes.size > 0;
688
+ if ((D || w) && p) {
689
689
  const R = l(p), O = W(a.activePath);
690
- if (!await Ee(R, O, t, s)) {
690
+ if (!await Ee(R, O, t, r)) {
691
691
  f.value = !1;
692
692
  return;
693
693
  }
@@ -695,7 +695,7 @@ function Ze(e, o) {
695
695
  const b = W(a.activePath);
696
696
  await m(p, h);
697
697
  const E = W(a.activePath);
698
- y == null || y.record(E, h), He(E, b, t.afterEach), r.preloadAdjacent(B(a.activePath)), u.schedule(() => {
698
+ y == null || y.record(E, h), He(E, b, t.afterEach), s.preloadAdjacent(B(a.activePath)), u.schedule(() => {
699
699
  f.value = !1;
700
700
  }, i);
701
701
  } catch (D) {
@@ -705,17 +705,17 @@ function Ze(e, o) {
705
705
  }
706
706
  const y = c.enabled ? qe(c, async (p) => {
707
707
  const h = B(a.activePath), v = B(p);
708
- if (v.length < h.length && v.every((P, b) => h[b] === P)) {
709
- const P = h.length - v.length;
710
- await w(-P);
708
+ if (v.length < h.length && v.every((w, b) => h[b] === w)) {
709
+ const w = h.length - v.length;
710
+ await P(-w);
711
711
  } else
712
- await w(p);
712
+ await P(p);
713
713
  }) : void 0;
714
714
  y && y.record(W(n));
715
715
  const S = Qe({
716
716
  getActivePath: () => a.activePath,
717
717
  pushCore: m,
718
- runGuards: (p, h) => Ee(p, h, t, s),
718
+ runGuards: (p, h) => Ee(p, h, t, r),
719
719
  scheduleUnlock: () => u.schedule(() => {
720
720
  f.value = !1;
721
721
  }, i),
@@ -737,15 +737,15 @@ function Ze(e, o) {
737
737
  toPage: C(() => H(a.toPath)),
738
738
  isNavigating: C(() => f.value),
739
739
  resolveRoutes: A,
740
- push: w,
740
+ push: P,
741
741
  stepWisePush: S.stepWisePush,
742
742
  stepWiseBack: S.stepWiseBack,
743
- registerRoute: r.registerRoute,
744
- registerRoutes: r.registerRoutes,
743
+ registerRoute: s.registerRoute,
744
+ registerRoutes: s.registerRoutes,
745
745
  updateRouteAttrs: T,
746
746
  getRouteAttrs: g,
747
- preloadRoute: r.preloadRoute,
748
- routes: r.routes,
747
+ preloadRoute: s.preloadRoute,
748
+ routes: s.routes,
749
749
  history: y,
750
750
  cleanup: u.cleanup
751
751
  };
@@ -845,11 +845,11 @@ function et(e) {
845
845
  resumeSound: c.resumeSound,
846
846
  updateBackgroundMusic: c.updateBackgroundMusic
847
847
  } : {}
848
- }, r = H(e.defaultPath);
848
+ }, s = H(e.defaultPath);
849
849
  return X(n.activePage, (a, d) => {
850
850
  if (!d) return;
851
851
  const A = t.currentControl.value;
852
- d === r && a !== r && o.trackGuiLeave(A), a === r && d !== r && o.trackGuiEnter(A);
852
+ d === s && a !== s && o.trackGuiLeave(A), a === s && d !== s && o.trackGuiEnter(A);
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 r of Object.keys(i))
880
- t[r] = i[r];
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
- (r) => n({ ...r }),
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(r, f, a) {
890
- return typeof f == "string" && !(f in r) && (r[f] = Oe(c, f)), Reflect.get(r, f, a);
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, r;
908
+ var u, s;
909
909
  const c = t === o;
910
- c && !i ? (u = e.onRouteEnter) == null || u.call(e) : !c && i && ((r = e.onRouteLeave) == null || r.call(e)), i = c;
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, r;
927
+ var u, s;
928
928
  const c = t === o;
929
- c && !i ? (u = e.onDialogEnter) == null || u.call(e) : !c && i && ((r = e.onDialogLeave) == null || r.call(e)), i = c;
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,15 +943,15 @@ 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, r;
946
+ var u, s;
947
947
  const c = t === o;
948
- c && !i ? (u = e.onControlEnter) == null || u.call(e) : !c && i && ((r = e.onControlLeave) == null || r.call(e)), i = c;
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, r = 0, f = !1, a = null, d = null;
954
+ let c = 0, u = 0, s = 0, f = !1, a = null, d = null;
955
955
  function A() {
956
956
  const l = o.containerRef.value;
957
957
  return l ? "$el" in l ? l.$el : l : null;
@@ -959,30 +959,30 @@ function tt(e, o) {
959
959
  function L() {
960
960
  const l = A();
961
961
  if (!l) return { current: null, previous: null };
962
- const s = l.querySelectorAll(".route-page");
963
- return s.length < 2 ? { current: s[s.length - 1] ?? null, previous: null } : {
964
- current: s[s.length - 1],
965
- previous: s[s.length - 2]
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
969
  var S;
970
970
  if (!o.canGoBack() || l.clientX > n) return;
971
- const { current: s, previous: w } = L();
972
- if (!s) return;
973
- f = !0, c = l.clientX, u = l.clientY, r = Date.now(), a = s, d = w;
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
974
  const y = A();
975
975
  (S = y == null ? void 0 : y.setPointerCapture) == null || S.call(y, 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 s = Math.max(0, l.clientX - c);
980
- if (Math.abs(l.clientY - u) > s * 1.5) {
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 y = s / window.innerWidth;
985
- if (a.style.transform = `translateX(${s}px)`, d) {
984
+ const y = r / window.innerWidth;
985
+ if (a.style.transform = `translateX(${r}px)`, d) {
986
986
  const S = -20 + 20 * y;
987
987
  d.style.transform = `translateX(${S}%)`;
988
988
  }
@@ -993,8 +993,8 @@ function tt(e, o) {
993
993
  m(), f = !1;
994
994
  return;
995
995
  }
996
- const s = l.clientX - c, w = Date.now() - r, y = s / w;
997
- s / window.innerWidth > i || y > 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(() => {
996
+ const r = l.clientX - c, P = Date.now() - s, y = r / P;
997
+ r / window.innerWidth > i || y > 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
998
  m(), o.goBack();
999
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(m, 200)), f = !1;
1000
1000
  }
@@ -1051,65 +1051,72 @@ 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 r = ee(null), f = ee(null), a = C(() => n.dialog.transition ?? "scale"), d = C(() => n.dialog.transitionDuration != null ? n.dialog.transitionDuration : a.value === "slide" ? 500 : 300), A = C(() => n.dialog.position ?? "standard"), L = C(() => n.dialog.seamless ?? !1);
1054
+ const s = ee(null), f = ee(null), a = C(() => n.dialog.transition ?? "scale"), d = C(() => n.dialog.transitionDuration != null ? n.dialog.transitionDuration : a.value === "slide" ? 500 : 300), A = C(() => n.dialog.position ?? "standard"), L = C(() => n.dialog.seamless ?? !1);
1055
1055
  function M() {
1056
- return r.value ? Array.from(
1057
- r.value.querySelectorAll(st)
1058
- ).filter((s) => s.offsetParent !== null) : [];
1056
+ return s.value ? Array.from(
1057
+ s.value.querySelectorAll(st)
1058
+ ).filter((r) => r.offsetParent !== null) : [];
1059
1059
  }
1060
- function _(s) {
1060
+ function _(r) {
1061
1061
  var v, D;
1062
- if (s.key === "Escape") {
1062
+ if (r.key === "Escape") {
1063
1063
  if (n.dialog.persistent) return;
1064
- s.preventDefault(), s.stopPropagation(), i("close", n.dialog.path);
1064
+ r.preventDefault(), r.stopPropagation(), i("close", n.dialog.path);
1065
1065
  return;
1066
1066
  }
1067
- if (s.key !== "Tab") return;
1068
- const w = M();
1069
- if (w.length === 0) {
1070
- s.preventDefault(), (v = r.value) == null || v.focus();
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 y = w[0], S = w[w.length - 1], p = document.activeElement, h = !!((D = r.value) != null && D.contains(p));
1074
- s.shiftKey ? (!h || p === y) && (s.preventDefault(), S.focus()) : (!h || p === S) && (s.preventDefault(), y.focus());
1073
+ const y = P[0], S = P[P.length - 1], p = document.activeElement, h = !!((D = s.value) != null && D.contains(p));
1074
+ r.shiftKey ? (!h || p === y) && (r.preventDefault(), S.focus()) : (!h || p === S) && (r.preventDefault(), y.focus());
1075
1075
  }
1076
- function T(s) {
1077
- n.dialog.persistent || s.target === s.currentTarget && i("close", n.dialog.path);
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 || !r.value) return;
1081
- const s = document.createElement("input");
1082
- s.style.cssText = "position:fixed;opacity:0;height:0;width:0;top:-100px;", r.value.appendChild(s), s.focus(), setTimeout(() => s.remove(), 50);
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
1089
  function m() {
1085
1090
  u || (u = !0, f.value = document.activeElement, at(), k(() => {
1086
- if (!r.value) return;
1087
- (M()[0] ?? r.value).focus(), g();
1091
+ s.value && g(() => {
1092
+ if (!s.value) return;
1093
+ (M()[0] ?? s.value).focus();
1094
+ });
1088
1095
  }));
1089
1096
  }
1090
1097
  function l() {
1091
1098
  if (!u) return;
1092
1099
  u = !1, it();
1093
- const s = f.value;
1094
- f.value = null, s && typeof s.focus == "function" && document.contains(s) && s.focus();
1100
+ const r = f.value;
1101
+ f.value = null, r && typeof r.focus == "function" && document.contains(r) && r.focus();
1095
1102
  }
1096
- return N(Te, n.dialog.path), N(ae, () => t(n.dialog.path)), N(ie, (s) => {
1097
- c(n.dialog.path, s);
1103
+ return N(Te, n.dialog.path), N(ae, () => t(n.dialog.path)), N(ie, (r) => {
1104
+ c(n.dialog.path, r);
1098
1105
  }), X(
1099
1106
  () => n.dialog.activated,
1100
- (s) => {
1101
- s && m();
1107
+ (r) => {
1108
+ r && m();
1102
1109
  }
1103
1110
  ), X(
1104
1111
  () => n.dialog.closing,
1105
- (s) => {
1106
- !s && !n.dialog.activated && u && l();
1112
+ (r) => {
1113
+ !r && !n.dialog.activated && u && l();
1107
1114
  }
1108
1115
  ), q(() => {
1109
1116
  n.dialog.activated && m();
1110
1117
  }), he(() => {
1111
1118
  u && l();
1112
- }), (s, w) => (G(), F(Ke, { to: "body" }, [
1119
+ }), (r, P) => (G(), F(Ke, { to: "body" }, [
1113
1120
  j("div", {
1114
1121
  class: Q(["micro-dialog-portal", [
1115
1122
  `micro-dialog--${A.value}`,
@@ -1128,7 +1135,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
1128
1135
  }, null, 2)),
1129
1136
  j("div", {
1130
1137
  ref_key: "wrapperRef",
1131
- ref: r,
1138
+ ref: s,
1132
1139
  role: "dialog",
1133
1140
  "aria-modal": "true",
1134
1141
  tabindex: "-1",
@@ -1141,10 +1148,10 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
1141
1148
  }, [
1142
1149
  j("div", {
1143
1150
  class: "micro-dialog__content",
1144
- onClick: w[0] || (w[0] = le(() => {
1151
+ onClick: P[0] || (P[0] = le(() => {
1145
1152
  }, ["stop"]))
1146
1153
  }, [
1147
- we(s.$slots, "default"),
1154
+ we(r.$slots, "default"),
1148
1155
  (G(), F(ye(e.dialog.component), Pe({
1149
1156
  key: e.dialog.componentKey
1150
1157
  }, e.dialog.attrs), null, 16))
@@ -1190,18 +1197,18 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
1190
1197
  resolveDialogs: t,
1191
1198
  resolveControls: c,
1192
1199
  fromPath: u,
1193
- toPath: r,
1200
+ toPath: s,
1194
1201
  isNavigating: f,
1195
1202
  closeDialog: a
1196
1203
  } = n, d = ee(null), A = C(() => {
1197
- const s = u.value.split("/").filter(Boolean), w = new Set(r.value.split("/").filter(Boolean));
1198
- return s.some((y) => w.has(y));
1204
+ const r = u.value.split("/").filter(Boolean), P = new Set(s.value.split("/").filter(Boolean));
1205
+ return r.some((y) => P.has(y));
1199
1206
  }), L = C(() => c.value.length > 0), M = C(() => {
1200
- const s = i.value.at(-1);
1201
- return (s == null ? void 0 : s.transition) ?? "slide";
1207
+ const r = i.value.at(-1);
1208
+ return (r == null ? void 0 : r.transition) ?? "slide";
1202
1209
  }), _ = C(() => M.value === "none" ? "" : M.value === "fade" ? "page-fade" : "page-slide"), T = C(() => {
1203
- const s = i.value.at(-1);
1204
- return s != null && s.transitionDuration ? s.transitionDuration : M.value === "fade" ? 300 : 500;
1210
+ const r = i.value.at(-1);
1211
+ return r != null && r.transitionDuration ? r.transitionDuration : M.value === "fade" ? 300 : 500;
1205
1212
  }), g = C(
1206
1213
  () => A.value && M.value !== "none"
1207
1214
  );
@@ -1209,7 +1216,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
1209
1216
  containerRef: d,
1210
1217
  goBack: () => n.push(-1),
1211
1218
  canGoBack: () => i.value.length > 1
1212
- }), (s, w) => (G(), V(te, null, [
1219
+ }), (r, P) => (G(), V(te, null, [
1213
1220
  Re(Se, {
1214
1221
  ref_key: "pageContainerRef",
1215
1222
  ref: d,
@@ -1241,7 +1248,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
1241
1248
  _: 1
1242
1249
  }, 8, ["name", "css"]),
1243
1250
  j("div", ft, [
1244
- we(s.$slots, "default")
1251
+ we(r.$slots, "default")
1245
1252
  ]),
1246
1253
  j("div", {
1247
1254
  class: Q(["micro-router-gui-layer", { "gui-visible": L.value }])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-micro-router",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "type": "module",
5
5
  "description": "Mobile-app-style navigation for Vue 3 — animated page stacks, modal dialogs, HUD controls. No URL routing.",
6
6
  "author": {