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.
Files changed (2) hide show
  1. package/dist/index.mjs +356 -346
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { shallowReactive as U, computed as C, 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";
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 r = U(/* @__PURE__ */ new Map()), f = U(
27
+ const s = U(/* @__PURE__ */ new Map()), f = U(
28
28
  /* @__PURE__ */ new Map()
29
- ), a = C(() => {
29
+ ), a = A(() => {
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
- }), d = a, A = C(
34
+ }), d = a, R = A(
35
35
  () => a.value.some((l) => l.name !== n)
36
- ), L = C(() => {
37
- const l = a.value.find((s) => s.name !== n);
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, s, w) {
41
- var y, S, p;
42
- if (!(s && u)) {
43
- s && (u = !0);
40
+ function M(l, r, P) {
41
+ var h, C, m;
42
+ if (!(r && u)) {
43
+ r && (u = !0);
44
44
  try {
45
- const h = r.get(l);
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) => {
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
- 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, {
57
- ...h,
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: (h.componentKey || 0) + 1,
60
- attrs: w ? { ...w } : void 0
59
+ componentKey: (y.componentKey || 0) + 1,
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
+ (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
- 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,19 +88,19 @@ 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 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: A,
97
+ activeControl: R,
98
98
  currentControl: L,
99
99
  toggleControl: M,
100
100
  registerControl: _,
101
101
  registerControls: T,
102
102
  getControlAttrs: g,
103
- updateControlAttrs: m,
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 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,
@@ -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 = C(() => {
261
- const g = [], m = /* @__PURE__ */ new Set();
260
+ }), c = A(() => {
261
+ const g = [], p = /* @__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), p.add(l));
265
265
  }
266
266
  for (const l of t.dialogs.values())
267
- l.closing && !m.has(l.path) && g.push(l);
267
+ l.closing && !p.has(l.path) && g.push(l);
268
268
  return g;
269
269
  }), u = n.schedule;
270
- function r(g, m) {
271
- return { path: g, attrs: m };
270
+ function s(g, p) {
271
+ return { path: g, attrs: p };
272
272
  }
273
- function f({ path: g, open: m, attrs: l }) {
274
- const s = t.dialogs.get(g);
275
- return s && k(() => {
276
- if (m)
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
- ...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,68 +289,68 @@ 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 h = 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
300
300
  }), u(() => {
301
- const S = t.dialogs.get(g);
302
- S && !S.activated && t.dialogs.set(g, { ...S, closing: !1 });
303
- }, y + 200);
301
+ const C = t.dialogs.get(g);
302
+ C && !C.activated && t.dialogs.set(g, { ...C, closing: !1 });
303
+ }, h + 200);
304
304
  }
305
- }), r(g, l);
305
+ }), s(g, l);
306
306
  }
307
- function a(g, m) {
307
+ function a(g, p) {
308
308
  var l;
309
- if (i) return r(g, m);
309
+ if (i) return s(g, p);
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: p });
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) {
323
- var m;
324
- (m = e == null ? void 0 : e.trackDialogLeave) == null || m.call(e, g, g, ""), t.dialogAttrs.delete(g), f({ path: g, open: !1 });
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 A() {
327
- const g = [], m = [];
328
- t.dialogs.forEach((l, s) => {
329
- var w, y;
326
+ function R() {
327
+ const g = [], p = [];
328
+ t.dialogs.forEach((l, r) => {
329
+ var P, h;
330
330
  if (l.activated) {
331
- (w = e == null ? void 0 : e.trackDialogLeave) == null || w.call(e, s, s, "");
332
- const S = (y = l.attrs) == null ? void 0 : y.onClose;
333
- typeof S == "function" && m.push(S), t.dialogs.set(s, {
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(s);
338
+ }), g.push(r);
339
339
  }
340
- }), m.forEach((l) => l()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], u(() => {
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 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
  }
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: m } = g;
350
- De(m) && (m = me(m)), t.dialogs.set(g.path, {
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(m)
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, m) {
362
+ function T(g, p) {
363
363
  const l = t.dialogAttrs.get(g);
364
- t.dialogAttrs.set(g, { ...l, ...m });
364
+ t.dialogAttrs.set(g, { ...l, ...p });
365
365
  }
366
366
  return {
367
- activeDialog: C(() => t.activeDialog),
368
- fromDialog: C(() => t.fromDialog),
369
- toDialog: C(() => t.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: A,
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, 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,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 r(g, m) {
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++);
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 = C(() => (u.value, [...i])), a = C(() => (u.value, t > 0)), d = C(() => (u.value, t < i.length - 1));
436
- async function A(g) {
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 m = i[g];
439
- if (m) {
438
+ const p = i[g];
439
+ if (p) {
440
440
  t = g, c = !0, u.value++;
441
441
  try {
442
- await o(m.path);
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 A(t - 1);
449
+ a.value && await R(t - 1);
450
450
  }
451
451
  async function M() {
452
- d.value && await A(t + 1);
452
+ d.value && await R(t + 1);
453
453
  }
454
454
  async function _(g) {
455
- const m = t + g;
456
- await A(m);
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: 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,32 +501,32 @@ 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(
508
508
  f.slice(0, a + 1)
509
509
  );
510
510
  if (e.getActivePath() === d) continue;
511
- const A = a === f.length - 1;
512
- await e.pushCore(d, A ? c : void 0), A || await fe(o);
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) => !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();
520
520
  return;
521
521
  }
522
522
  for (let d = 0; d < a.length; d++) {
523
- const A = d === a.length - 1;
524
- await e.pushCore(a[d], A ? c : void 0), A || await fe(o);
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 (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,
@@ -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(), A = C(() => {
568
- const p = B(a.activePath), h = [];
569
- for (const v of p) {
570
- const D = r.routes.get(v);
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 P = a.routeKeys.get(v) || 0, b = a.componentKeys.get(v) || 0, E = `${D.path}-${P}`, R = d.get(v);
573
- if (R && R.key === E && R.componentKey === b)
574
- h.push(R);
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), h.push(O);
577
+ d.set(v, O), y.push(O);
578
578
  }
579
579
  }
580
580
  for (const v of d.keys())
581
- p.includes(v) || d.delete(v);
582
- return h;
581
+ m.includes(v) || d.delete(v);
582
+ return y;
583
583
  });
584
- function L(p, h) {
584
+ function L(m, y) {
585
585
  var O, I;
586
- const v = B(a.activePath), D = Math.min(p, v.length - 1);
586
+ const v = B(a.activePath), D = Math.min(m, 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);
592
- if (E && h) {
591
+ const E = w.at(-1);
592
+ if (E && y) {
593
593
  const $ = a.routeAttrs.get(E);
594
- a.routeAttrs.set(E, { ...$, ...h }), a.componentKeys.set(
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 R = a.activePath;
600
- (O = o == null ? void 0 : o.trackPageLeave) == null || O.call(o, R, R, b), a.fromPath = R, a.toPath = b, a.activePath = b, (I = o == null ? void 0 : o.trackPageEnter) == null || I.call(o, b, R, b);
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(p, h) {
602
+ async function M(m, y) {
603
603
  var b, E;
604
- const v = W(p), D = B(v);
604
+ const v = W(m), 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((S) => s.asyncLoaders.get(S)).filter((S) => !!S).map((S) => ne(S))
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, y && _(v, y), (E = o == null ? void 0 : o.trackPageEnter) == null || E.call(o, v, w, v);
610
610
  }
611
- function _(p, h) {
612
- const v = B(p).at(-1);
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, ...h });
615
+ a.routeAttrs.set(v, { ...D, ...y });
616
616
  }
617
- function T(p, h) {
618
- const v = a.routeAttrs.get(p);
619
- a.routeAttrs.set(p, { ...v, ...h });
617
+ function T(m, y) {
618
+ const v = a.routeAttrs.get(m);
619
+ a.routeAttrs.set(m, { ...v, ...y });
620
620
  }
621
- function g(p) {
622
- return a.routeAttrs.get(p);
621
+ function g(m) {
622
+ return a.routeAttrs.get(m);
623
623
  }
624
- async function m(p, h) {
625
- if (!p && p !== 0) return;
626
- if (typeof p == "number" && p < 0) {
627
- L(Math.abs(p), h);
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 = p.toString();
630
+ const v = m.toString();
631
631
  if (v.startsWith("/")) {
632
- const E = B(v), R = B(a.activePath);
633
- if (E.length < R.length && E.every(($, se) => R[se] === $)) {
634
- if (R.length - E.length === 1)
635
- L(1, h);
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 = R.slice(0, E.length + 1), Ie = K(se);
638
- for (let re = E.length + 1; re < R.length; re++)
639
- a.routeAttrs.delete(R[re]);
640
- a.activePath = Ie, await k(), L(1, h);
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 && R.at(-1) === I && a.routeKeys.set(
645
+ I && S.at(-1) === I && a.routeKeys.set(
646
646
  I,
647
647
  (a.routeKeys.get(I) || 0) + 1
648
- ), await M(v, h);
648
+ ), await M(v, y);
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
- L(1, h);
655
+ L(1, y);
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 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, h);
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, P + 1)),
664
- h
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, h);
669
+ await M(b, y);
670
670
  }
671
- function l(p) {
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));
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 h = p.toString();
677
- if (h.startsWith("/")) return W(h);
678
- const v = B(a.activePath), D = v.indexOf(h);
679
- return D !== -1 ? K(v.slice(0, D + 1)) : K([...v, h]);
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 s = { getRoute: (p) => r.routes.get(p) };
682
- async function w(p, h) {
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, P = r.routes.size > 0;
688
- if ((D || P) && p) {
689
- const R = l(p), O = W(a.activePath);
690
- if (!await Ee(R, O, t, s)) {
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(p, h);
696
+ await p(m, y);
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
+ 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 y = c.enabled ? qe(c, async (p) => {
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);
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 w(p);
712
+ await P(m);
713
713
  }) : void 0;
714
- y && y.record(W(n));
715
- const S = Qe({
714
+ h && h.record(W(n));
715
+ const C = Qe({
716
716
  getActivePath: () => a.activePath,
717
- pushCore: m,
718
- runGuards: (p, h) => Ee(p, h, t, s),
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: C(() => a.activePath),
733
- fromPath: C(() => a.fromPath),
734
- toPath: C(() => a.toPath),
735
- activePage: C(() => H(a.activePath)),
736
- fromPage: C(() => H(a.fromPath)),
737
- toPage: C(() => H(a.toPath)),
738
- isNavigating: C(() => f.value),
739
- resolveRoutes: A,
740
- push: w,
741
- stepWisePush: S.stepWisePush,
742
- stepWiseBack: S.stepWiseBack,
743
- registerRoute: r.registerRoute,
744
- registerRoutes: r.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: r.preloadRoute,
748
- routes: r.routes,
749
- history: y,
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
- }, r = H(e.defaultPath);
848
+ }, s = H(e.defaultPath);
849
849
  return X(n.activePage, (a, d) => {
850
850
  if (!d) return;
851
- const A = t.currentControl.value;
852
- d === r && a !== r && o.trackGuiLeave(A), a === r && d !== r && o.trackGuiEnter(A);
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 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,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, 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;
955
- function A() {
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 = A();
960
+ const l = R();
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
- var S;
969
+ var C;
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;
974
- const y = A();
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";
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 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) {
986
- const S = -20 + 20 * y;
987
- d.style.transform = `translateX(${S}%)`;
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
- m(), f = !1;
993
+ p(), 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(() => {
998
- m(), 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(m, 200)), f = !1;
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(m, 150), f = !1);
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 m() {
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 = A();
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 = A();
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 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 = 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 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 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(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
- function m() {
1089
+ function p() {
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() {
1098
+ var m;
1091
1099
  if (!u) return;
1092
1100
  u = !1, it();
1093
- const s = f.value;
1094
- f.value = null, s && typeof s.focus == "function" && document.contains(s) && s.focus();
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, (s) => {
1097
- c(n.dialog.path, s);
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
- (s) => {
1101
- s && m();
1110
+ (r) => {
1111
+ r && p();
1102
1112
  }
1103
1113
  ), X(
1104
1114
  () => n.dialog.closing,
1105
- (s) => {
1106
- !s && !n.dialog.activated && u && l();
1115
+ (r) => {
1116
+ !r && !n.dialog.activated && u && l();
1107
1117
  }
1108
1118
  ), q(() => {
1109
- n.dialog.activated && m();
1119
+ n.dialog.activated && p();
1110
1120
  }), he(() => {
1111
1121
  u && l();
1112
- }), (s, w) => (G(), F(Ke, { to: "body" }, [
1122
+ }), (r, P) => (G(), F(Ke, { to: "body" }, [
1113
1123
  j("div", {
1114
1124
  class: Q(["micro-dialog-portal", [
1115
- `micro-dialog--${A.value}`,
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: r,
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: w[0] || (w[0] = le(() => {
1154
+ onClick: P[0] || (P[0] = le(() => {
1145
1155
  }, ["stop"]))
1146
1156
  }, [
1147
- we(s.$slots, "default"),
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 m, l;
1195
+ var p, l;
1186
1196
  const o = e, n = et(o.config);
1187
- (m = o.plugins) != null && m.length && nt(o.plugins, n);
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: r,
1203
+ toPath: s,
1194
1204
  isNavigating: f,
1195
1205
  closeDialog: a
1196
- } = 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));
1199
- }), L = C(() => c.value.length > 0), M = C(() => {
1200
- const s = i.value.at(-1);
1201
- return (s == null ? void 0 : s.transition) ?? "slide";
1202
- }), _ = 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;
1205
- }), g = C(
1206
- () => A.value && M.value !== "none"
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
- }), (s, w) => (G(), V(te, null, [
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), (y, S) => (G(), F(ut, {
1221
- key: y.key || y.path,
1222
- "route-path": y.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 && S !== 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 + S,
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(y.component), Pe({
1235
- key: y.componentKey
1236
- }, { ref_for: !0 }, Y(n).getRouteAttrs(y.path)), null, 16))
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(s.$slots, "default")
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), (y) => (G(), F(ot, {
1252
- key: y.name + "-" + (y.componentKey || 0),
1253
- control: y
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), (y, S) => (G(), F(rt, {
1260
- key: "dialog-" + y.path,
1261
- dialog: y,
1262
- "stack-index": S,
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));
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.56",
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": {