vue-micro-router 1.0.45 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +208 -204
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -349,7 +349,7 @@ export declare interface MicroDialog {
|
|
|
349
349
|
transitionDuration?: number;
|
|
350
350
|
/** Animation type: 'fade' (pure opacity), 'scale' (pop), 'slide' (page-style) */
|
|
351
351
|
transition?: TransitionType;
|
|
352
|
-
/** If true
|
|
352
|
+
/** If true, dialog has no backdrop overlay (see-through to app behind). Default: false */
|
|
353
353
|
seamless?: boolean;
|
|
354
354
|
/** Prime mobile keyboard on open — set true for dialogs with autofocus inputs */
|
|
355
355
|
focusInput?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowReactive as Y, computed as C, defineAsyncComponent as me, reactive as pe, nextTick as Z, ref as ne, inject as x, watch as U, onMounted as H, onBeforeUnmount as he, provide as N, toRefs as Oe, toRef as Ke, defineComponent as oe, openBlock as G, createBlock as F, resolveDynamicComponent as ye, mergeProps as Pe, Teleport as We, createElementBlock as V, withModifiers as le, normalizeStyle as Me, normalizeClass as J, createCommentVNode as Re, createElementVNode as k, renderSlot as we, Fragment as ee, createVNode as
|
|
1
|
+
import { shallowReactive as Y, computed as C, defineAsyncComponent as me, reactive as pe, nextTick as Z, ref as ne, inject as x, watch as U, onMounted as H, onBeforeUnmount as he, provide as N, toRefs as Oe, toRef as Ke, defineComponent as oe, openBlock as G, createBlock as F, resolveDynamicComponent as ye, mergeProps as Pe, Teleport as We, createElementBlock as V, withModifiers as le, normalizeStyle as Me, normalizeClass as J, createCommentVNode as Re, createElementVNode as k, renderSlot as we, Fragment as ee, createVNode as Se, TransitionGroup as Ee, withCtx as ce, renderList as ue, unref as X } from "vue";
|
|
2
2
|
import { i as De, s as Ce, g as j, w as te, p as B, b as K, n as W, u as $e } from "./use-audio-manager.mjs";
|
|
3
3
|
const Le = Symbol("micro-router");
|
|
4
4
|
function vt() {
|
|
@@ -7,9 +7,9 @@ function vt() {
|
|
|
7
7
|
const de = Symbol("micro-router-root"), Te = Symbol("micro-route-path"), _e = Symbol("micro-dialog-path"), Be = Symbol("micro-control-name"), ae = Symbol("micro-attrs-read"), ie = Symbol("micro-attrs-write"), Ye = 550;
|
|
8
8
|
function Ae() {
|
|
9
9
|
const e = /* @__PURE__ */ new Set();
|
|
10
|
-
function o(
|
|
10
|
+
function o(s, t) {
|
|
11
11
|
const l = setTimeout(() => {
|
|
12
|
-
e.delete(l),
|
|
12
|
+
e.delete(l), s();
|
|
13
13
|
}, t);
|
|
14
14
|
return e.add(l), l;
|
|
15
15
|
}
|
|
@@ -22,48 +22,48 @@ function fe(e) {
|
|
|
22
22
|
return new Promise((o) => setTimeout(o, e));
|
|
23
23
|
}
|
|
24
24
|
function Ue(e, o) {
|
|
25
|
-
const n = e.defaultControlName,
|
|
25
|
+
const n = e.defaultControlName, s = e.onboardingControlName, t = 300, l = Ae();
|
|
26
26
|
let c = !1;
|
|
27
27
|
const r = Y(/* @__PURE__ */ new Map()), f = Y(
|
|
28
28
|
/* @__PURE__ */ new Map()
|
|
29
29
|
), a = C(() => {
|
|
30
|
-
const
|
|
30
|
+
const i = [];
|
|
31
31
|
for (const d of r.values())
|
|
32
|
-
d.activated &&
|
|
33
|
-
return
|
|
32
|
+
d.activated && i.push(d);
|
|
33
|
+
return i;
|
|
34
34
|
}), v = a, A = C(
|
|
35
|
-
() => a.value.some((
|
|
35
|
+
() => a.value.some((i) => i.name !== n)
|
|
36
36
|
), b = C(() => {
|
|
37
|
-
const
|
|
38
|
-
return (
|
|
37
|
+
const i = a.value.find((d) => d.name !== n);
|
|
38
|
+
return (i == null ? void 0 : i.name) ?? n;
|
|
39
39
|
});
|
|
40
|
-
function T(
|
|
40
|
+
function T(i, d, u) {
|
|
41
41
|
var w, M, y;
|
|
42
42
|
if (!(d && c)) {
|
|
43
43
|
d && (c = !0);
|
|
44
44
|
try {
|
|
45
|
-
const h = r.get(
|
|
45
|
+
const h = r.get(i);
|
|
46
46
|
if (!h) return;
|
|
47
|
-
const m = r.get(n), D =
|
|
47
|
+
const m = r.get(n), D = i === n || i === s;
|
|
48
48
|
if (d)
|
|
49
|
-
(w = o == null ? void 0 : o.trackGuiEnter) == null || w.call(o,
|
|
50
|
-
var
|
|
51
|
-
P.name !== n && P.activated && ((
|
|
49
|
+
(w = o == null ? void 0 : o.trackGuiEnter) == null || w.call(o, i), D ? r.forEach((P) => {
|
|
50
|
+
var E;
|
|
51
|
+
P.name !== n && P.activated && ((E = o == null ? void 0 : o.trackGuiLeave) == null || E.call(o, P.name), r.set(P.name, {
|
|
52
52
|
...P,
|
|
53
53
|
activated: !1,
|
|
54
54
|
attrs: void 0
|
|
55
55
|
}));
|
|
56
|
-
}) : m != null && m.activated && ((M = o == null ? void 0 : o.trackGuiLeave) == null || M.call(o, n), r.set(n, { ...m, activated: !1 })), u && f.set(
|
|
56
|
+
}) : m != null && m.activated && ((M = o == null ? void 0 : o.trackGuiLeave) == null || M.call(o, n), r.set(n, { ...m, activated: !1 })), u && f.set(i, { ...u }), r.set(i, {
|
|
57
57
|
...h,
|
|
58
58
|
activated: !0,
|
|
59
59
|
componentKey: (h.componentKey || 0) + 1,
|
|
60
60
|
attrs: u ? { ...u } : void 0
|
|
61
61
|
});
|
|
62
62
|
else {
|
|
63
|
-
(y = o == null ? void 0 : o.trackGuiLeave) == null || y.call(o,
|
|
63
|
+
(y = o == null ? void 0 : o.trackGuiLeave) == null || y.call(o, i), f.delete(i), r.set(i, { ...h, activated: !1, attrs: void 0 });
|
|
64
64
|
const P = r.get(n);
|
|
65
65
|
if (!D && P && !P.activated) {
|
|
66
|
-
if (P.name ===
|
|
66
|
+
if (P.name === s) return;
|
|
67
67
|
r.set(n, { ...P, activated: !0 });
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -74,23 +74,23 @@ function Ue(e, o) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function L(
|
|
78
|
-
r.has(
|
|
79
|
-
let { component: d } =
|
|
80
|
-
De(d) && (d = me(d)), r.set(
|
|
81
|
-
...
|
|
77
|
+
function L(i) {
|
|
78
|
+
r.has(i.name) && console.warn(`[vue-micro-router] Control "${i.name}" already registered. Overwriting.`);
|
|
79
|
+
let { component: d } = i;
|
|
80
|
+
De(d) && (d = me(d)), r.set(i.name, {
|
|
81
|
+
...i,
|
|
82
82
|
component: Ce(d)
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
function _(
|
|
86
|
-
|
|
85
|
+
function _(i) {
|
|
86
|
+
i.forEach(L);
|
|
87
87
|
}
|
|
88
|
-
function g(
|
|
89
|
-
return f.get(
|
|
88
|
+
function g(i) {
|
|
89
|
+
return f.get(i);
|
|
90
90
|
}
|
|
91
|
-
function p(
|
|
92
|
-
const u = f.get(
|
|
93
|
-
f.set(
|
|
91
|
+
function p(i, d) {
|
|
92
|
+
const u = f.get(i);
|
|
93
|
+
f.set(i, { ...u, ...d });
|
|
94
94
|
}
|
|
95
95
|
return {
|
|
96
96
|
resolveControls: v,
|
|
@@ -132,8 +132,8 @@ async function ze(e) {
|
|
|
132
132
|
id: Xe,
|
|
133
133
|
label: "Micro Router",
|
|
134
134
|
color: 4372611
|
|
135
|
-
}), n.on.getInspectorTree((
|
|
136
|
-
|
|
135
|
+
}), n.on.getInspectorTree((s) => {
|
|
136
|
+
s.inspectorId === ge && (s.rootNodes = [
|
|
137
137
|
{
|
|
138
138
|
id: "routes",
|
|
139
139
|
label: `Routes (${e.resolveRoutes.value.length} active)`,
|
|
@@ -159,10 +159,10 @@ async function ze(e) {
|
|
|
159
159
|
}))
|
|
160
160
|
}
|
|
161
161
|
]);
|
|
162
|
-
}), n.on.getInspectorState((
|
|
163
|
-
if (
|
|
164
|
-
if (
|
|
165
|
-
|
|
162
|
+
}), n.on.getInspectorState((s) => {
|
|
163
|
+
if (s.inspectorId === ge) {
|
|
164
|
+
if (s.nodeId === "routes")
|
|
165
|
+
s.state = {
|
|
166
166
|
Navigation: [
|
|
167
167
|
{ key: "activePath", value: e.activePath.value },
|
|
168
168
|
{ key: "fromPath", value: e.fromPath.value },
|
|
@@ -170,25 +170,25 @@ async function ze(e) {
|
|
|
170
170
|
{ key: "activePage", value: e.activePage.value }
|
|
171
171
|
]
|
|
172
172
|
};
|
|
173
|
-
else if (
|
|
174
|
-
const t =
|
|
175
|
-
|
|
173
|
+
else if (s.nodeId.startsWith("route-")) {
|
|
174
|
+
const t = s.nodeId.replace("route-", "");
|
|
175
|
+
s.state = {
|
|
176
176
|
Route: [
|
|
177
177
|
{ key: "path", value: t },
|
|
178
178
|
{ key: "attrs", value: e.getRouteAttrs(t) ?? {} }
|
|
179
179
|
]
|
|
180
180
|
};
|
|
181
|
-
} else if (
|
|
182
|
-
const t =
|
|
183
|
-
|
|
181
|
+
} else if (s.nodeId.startsWith("dialog-")) {
|
|
182
|
+
const t = s.nodeId.replace("dialog-", "");
|
|
183
|
+
s.state = {
|
|
184
184
|
Dialog: [
|
|
185
185
|
{ key: "path", value: t },
|
|
186
186
|
{ key: "attrs", value: e.getDialogAttrs(t) ?? {} }
|
|
187
187
|
]
|
|
188
188
|
};
|
|
189
|
-
} else if (
|
|
190
|
-
const t =
|
|
191
|
-
|
|
189
|
+
} else if (s.nodeId.startsWith("control-")) {
|
|
190
|
+
const t = s.nodeId.replace("control-", "");
|
|
191
|
+
s.state = {
|
|
192
192
|
Control: [
|
|
193
193
|
{ key: "name", value: t },
|
|
194
194
|
{ key: "attrs", value: e.getControlAttrs(t) ?? {} }
|
|
@@ -206,10 +206,10 @@ function Fe(e) {
|
|
|
206
206
|
const f = e.getRouteAttrs(r);
|
|
207
207
|
f && (n[r] = { ...f });
|
|
208
208
|
}
|
|
209
|
-
const
|
|
209
|
+
const s = [], t = {};
|
|
210
210
|
for (const r of e.resolveDialogs.value) {
|
|
211
211
|
if (r.closing) continue;
|
|
212
|
-
|
|
212
|
+
s.push(r.path);
|
|
213
213
|
const f = e.getDialogAttrs(r.path);
|
|
214
214
|
f && (t[r.path] = { ...f });
|
|
215
215
|
}
|
|
@@ -222,7 +222,7 @@ function Fe(e) {
|
|
|
222
222
|
return {
|
|
223
223
|
version: 1,
|
|
224
224
|
navigation: { activePath: e.activePath.value, routeAttrs: n },
|
|
225
|
-
dialogs: { stack:
|
|
225
|
+
dialogs: { stack: s, attrs: t },
|
|
226
226
|
controls: { active: l, attrs: c }
|
|
227
227
|
};
|
|
228
228
|
}
|
|
@@ -231,9 +231,9 @@ async function Ve(e, o) {
|
|
|
231
231
|
console.warn("[vue-micro-router] Unknown serialized state version:", o.version);
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
const { activePath: n, routeAttrs:
|
|
234
|
+
const { activePath: n, routeAttrs: s } = o.navigation;
|
|
235
235
|
await e.push(n);
|
|
236
|
-
for (const [t, l] of Object.entries(
|
|
236
|
+
for (const [t, l] of Object.entries(s))
|
|
237
237
|
e.updateRouteAttrs(t, l);
|
|
238
238
|
for (const t of o.dialogs.stack) {
|
|
239
239
|
const l = o.dialogs.attrs[t];
|
|
@@ -246,7 +246,7 @@ async function Ve(e, o) {
|
|
|
246
246
|
}
|
|
247
247
|
function xe(e) {
|
|
248
248
|
const n = Ae();
|
|
249
|
-
let
|
|
249
|
+
let s = !1;
|
|
250
250
|
const t = pe({
|
|
251
251
|
activeDialog: "",
|
|
252
252
|
fromDialog: "",
|
|
@@ -258,27 +258,31 @@ function xe(e) {
|
|
|
258
258
|
/** Attrs stored separately for useMicroState access inside dialog components */
|
|
259
259
|
dialogAttrs: Y(/* @__PURE__ */ new Map())
|
|
260
260
|
}), l = C(() => {
|
|
261
|
-
const g = [];
|
|
262
|
-
for (const
|
|
263
|
-
|
|
261
|
+
const g = [], p = /* @__PURE__ */ new Set();
|
|
262
|
+
for (const i of t.dialogStack) {
|
|
263
|
+
const d = t.dialogs.get(i);
|
|
264
|
+
d && (d.activated || d.closing) && (g.push(d), p.add(i));
|
|
265
|
+
}
|
|
266
|
+
for (const i of t.dialogs.values())
|
|
267
|
+
i.closing && !p.has(i.path) && g.push(i);
|
|
264
268
|
return g;
|
|
265
269
|
}), c = n.schedule;
|
|
266
270
|
function r(g, p) {
|
|
267
271
|
return { path: g, attrs: p };
|
|
268
272
|
}
|
|
269
|
-
function f({ path: g, open: p, attrs:
|
|
273
|
+
function f({ path: g, open: p, attrs: i }) {
|
|
270
274
|
const d = t.dialogs.get(g);
|
|
271
275
|
return d && Z(() => {
|
|
272
276
|
if (p)
|
|
273
|
-
t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g,
|
|
277
|
+
t.fromDialog = t.activeDialog, t.toDialog = g, t.dialogStack.includes(g) || t.dialogStack.push(g), t.activeDialog = g, i && t.dialogAttrs.set(g, { ...i }), t.dialogs.set(g, {
|
|
274
278
|
...d,
|
|
275
279
|
activated: !0,
|
|
276
280
|
componentKey: (d.componentKey || 0) + 1,
|
|
277
281
|
attrs: {
|
|
278
282
|
path: g,
|
|
279
|
-
...
|
|
283
|
+
...i,
|
|
280
284
|
onClose: () => {
|
|
281
|
-
v(g),
|
|
285
|
+
v(g), i != null && i.onClose && typeof i.onClose == "function" && i.onClose();
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
});
|
|
@@ -297,21 +301,21 @@ function xe(e) {
|
|
|
297
301
|
M && !M.activated && t.dialogs.set(g, { ...M, closing: !1 });
|
|
298
302
|
}, w + 200);
|
|
299
303
|
}
|
|
300
|
-
}), r(g,
|
|
304
|
+
}), r(g, i);
|
|
301
305
|
}
|
|
302
306
|
function a(g, p) {
|
|
303
|
-
var
|
|
304
|
-
if (
|
|
305
|
-
|
|
307
|
+
var i;
|
|
308
|
+
if (s) return r(g, p);
|
|
309
|
+
s = !0;
|
|
306
310
|
try {
|
|
307
311
|
const d = t.activeDialog || "";
|
|
308
|
-
(
|
|
312
|
+
(i = e == null ? void 0 : e.trackDialogEnter) == null || i.call(e, g, d, g);
|
|
309
313
|
const u = f({ path: g, open: !0, attrs: p });
|
|
310
314
|
return c(() => {
|
|
311
|
-
|
|
315
|
+
s = !1;
|
|
312
316
|
}, 300), u;
|
|
313
317
|
} catch (d) {
|
|
314
|
-
throw
|
|
318
|
+
throw s = !1, d;
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
321
|
function v(g) {
|
|
@@ -320,22 +324,22 @@ function xe(e) {
|
|
|
320
324
|
}
|
|
321
325
|
function A() {
|
|
322
326
|
const g = [], p = [];
|
|
323
|
-
t.dialogs.forEach((
|
|
327
|
+
t.dialogs.forEach((i, d) => {
|
|
324
328
|
var u, w;
|
|
325
|
-
if (
|
|
329
|
+
if (i.activated) {
|
|
326
330
|
(u = e == null ? void 0 : e.trackDialogLeave) == null || u.call(e, d, d, "");
|
|
327
|
-
const M = (w =
|
|
331
|
+
const M = (w = i.attrs) == null ? void 0 : w.onClose;
|
|
328
332
|
typeof M == "function" && p.push(M), t.dialogs.set(d, {
|
|
329
|
-
...
|
|
333
|
+
...i,
|
|
330
334
|
activated: !1,
|
|
331
335
|
closing: !0,
|
|
332
336
|
attrs: void 0
|
|
333
337
|
}), g.push(d);
|
|
334
338
|
}
|
|
335
|
-
}), p.forEach((
|
|
336
|
-
g.forEach((
|
|
337
|
-
const d = t.dialogs.get(
|
|
338
|
-
d && !d.activated && t.dialogs.set(
|
|
339
|
+
}), p.forEach((i) => i()), t.dialogAttrs.clear(), t.fromDialog = t.activeDialog, t.toDialog = "", t.activeDialog = "", t.dialogStack = [], c(() => {
|
|
340
|
+
g.forEach((i) => {
|
|
341
|
+
const d = t.dialogs.get(i);
|
|
342
|
+
d && !d.activated && t.dialogs.set(i, { ...d, closing: !1 });
|
|
339
343
|
});
|
|
340
344
|
}, 500);
|
|
341
345
|
}
|
|
@@ -355,8 +359,8 @@ function xe(e) {
|
|
|
355
359
|
return t.dialogAttrs.get(g);
|
|
356
360
|
}
|
|
357
361
|
function _(g, p) {
|
|
358
|
-
const
|
|
359
|
-
t.dialogAttrs.set(g, { ...
|
|
362
|
+
const i = t.dialogAttrs.get(g);
|
|
363
|
+
t.dialogAttrs.set(g, { ...i, ...p });
|
|
360
364
|
}
|
|
361
365
|
return {
|
|
362
366
|
activeDialog: C(() => t.activeDialog),
|
|
@@ -374,13 +378,13 @@ function xe(e) {
|
|
|
374
378
|
};
|
|
375
379
|
}
|
|
376
380
|
const Ge = 5e3;
|
|
377
|
-
async function ve(e, o, n,
|
|
381
|
+
async function ve(e, o, n, s) {
|
|
378
382
|
let t;
|
|
379
383
|
try {
|
|
380
384
|
const l = await Promise.race([
|
|
381
385
|
Promise.resolve(e(o, n)),
|
|
382
386
|
new Promise((c, r) => {
|
|
383
|
-
t = setTimeout(() => r(new Error("Navigation guard timed out")),
|
|
387
|
+
t = setTimeout(() => r(new Error("Navigation guard timed out")), s);
|
|
384
388
|
})
|
|
385
389
|
]);
|
|
386
390
|
return clearTimeout(t), l !== !1;
|
|
@@ -388,25 +392,25 @@ async function ve(e, o, n, i) {
|
|
|
388
392
|
return clearTimeout(t), !1;
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
|
-
async function je(e, o, n,
|
|
395
|
+
async function je(e, o, n, s = Ge) {
|
|
392
396
|
for (const t of e)
|
|
393
|
-
if (!await ve(t, o, n,
|
|
397
|
+
if (!await ve(t, o, n, s)) return !1;
|
|
394
398
|
return !0;
|
|
395
399
|
}
|
|
396
|
-
async function be(e, o, n,
|
|
400
|
+
async function be(e, o, n, s) {
|
|
397
401
|
var r;
|
|
398
402
|
const t = n.guardTimeout ?? Ge;
|
|
399
403
|
if ((r = n.beforeEach) != null && r.length && !await je(n.beforeEach, e, o, t))
|
|
400
404
|
return !1;
|
|
401
405
|
const l = j(e);
|
|
402
406
|
if (l) {
|
|
403
|
-
const f =
|
|
407
|
+
const f = s.getRoute(l);
|
|
404
408
|
if (f != null && f.beforeEnter && !await ve(f.beforeEnter, e, o, t))
|
|
405
409
|
return !1;
|
|
406
410
|
}
|
|
407
411
|
const c = j(o);
|
|
408
412
|
if (c) {
|
|
409
|
-
const f =
|
|
413
|
+
const f = s.getRoute(c);
|
|
410
414
|
if (f != null && f.beforeLeave && !await ve(f.beforeLeave, e, o, t))
|
|
411
415
|
return !1;
|
|
412
416
|
}
|
|
@@ -414,23 +418,23 @@ async function be(e, o, n, i) {
|
|
|
414
418
|
}
|
|
415
419
|
function He(e, o, n) {
|
|
416
420
|
if (n != null && n.length)
|
|
417
|
-
for (const
|
|
421
|
+
for (const s of n)
|
|
418
422
|
try {
|
|
419
|
-
|
|
423
|
+
s(e, o);
|
|
420
424
|
} catch {
|
|
421
425
|
}
|
|
422
426
|
}
|
|
423
427
|
function qe(e, o) {
|
|
424
|
-
const n = e.maxEntries ?? 50,
|
|
428
|
+
const n = e.maxEntries ?? 50, s = [];
|
|
425
429
|
let t = -1, l = !1;
|
|
426
430
|
const c = ne(0);
|
|
427
431
|
function r(g, p) {
|
|
428
|
-
!e.enabled || l || (t <
|
|
432
|
+
!e.enabled || l || (t < s.length - 1 && s.splice(t + 1), s.push({ path: g, timestamp: Date.now(), props: p ? { ...p } : void 0 }), t = s.length - 1, s.length > n && (s.shift(), t--), c.value++);
|
|
429
433
|
}
|
|
430
|
-
const f = C(() => (c.value, [...
|
|
434
|
+
const f = C(() => (c.value, [...s])), a = C(() => (c.value, t > 0)), v = C(() => (c.value, t < s.length - 1));
|
|
431
435
|
async function A(g) {
|
|
432
|
-
if (g < 0 || g >=
|
|
433
|
-
const p =
|
|
436
|
+
if (g < 0 || g >= s.length) return;
|
|
437
|
+
const p = s[g];
|
|
434
438
|
if (p) {
|
|
435
439
|
t = g, l = !0, c.value++;
|
|
436
440
|
try {
|
|
@@ -451,7 +455,7 @@ function qe(e, o) {
|
|
|
451
455
|
await A(p);
|
|
452
456
|
}
|
|
453
457
|
function _() {
|
|
454
|
-
|
|
458
|
+
s.length = 0, t = -1, c.value++;
|
|
455
459
|
}
|
|
456
460
|
return { entries: f, canGoBack: a, canGoForward: v, back: b, forward: T, go: L, clear: _, record: r };
|
|
457
461
|
}
|
|
@@ -465,7 +469,7 @@ function Je() {
|
|
|
465
469
|
component: Ce(r)
|
|
466
470
|
}), c.preload === "eager" && o.has(c.path) && te(o.get(c.path));
|
|
467
471
|
}
|
|
468
|
-
function
|
|
472
|
+
function s(c) {
|
|
469
473
|
c.forEach(n);
|
|
470
474
|
}
|
|
471
475
|
async function t(c) {
|
|
@@ -479,7 +483,7 @@ function Je() {
|
|
|
479
483
|
a && te(a);
|
|
480
484
|
}
|
|
481
485
|
}
|
|
482
|
-
return { routes: e, asyncLoaders: o, registerRoute: n, registerRoutes:
|
|
486
|
+
return { routes: e, asyncLoaders: o, registerRoute: n, registerRoutes: s, preloadRoute: t, preloadAdjacent: l };
|
|
483
487
|
}
|
|
484
488
|
function Qe(e) {
|
|
485
489
|
const o = e.stepWiseDelay ?? Math.max(e.stepDelay * 1.2, e.stepDelay + 100);
|
|
@@ -525,7 +529,7 @@ function Qe(e) {
|
|
|
525
529
|
}
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
|
-
async function
|
|
532
|
+
async function s(t) {
|
|
529
533
|
if (t < 1 || e.isLocked()) return;
|
|
530
534
|
const l = B(e.getActivePath()), c = Math.min(t, l.length - 1);
|
|
531
535
|
if (!(c < 1)) {
|
|
@@ -546,10 +550,10 @@ function Qe(e) {
|
|
|
546
550
|
}
|
|
547
551
|
}
|
|
548
552
|
}
|
|
549
|
-
return { stepWisePush: n, stepWiseBack:
|
|
553
|
+
return { stepWisePush: n, stepWiseBack: s };
|
|
550
554
|
}
|
|
551
555
|
function Ze(e, o) {
|
|
552
|
-
const n = e.defaultPath,
|
|
556
|
+
const n = e.defaultPath, s = e.stepDelay ?? Ye, t = e.guards ?? {}, l = e.history ?? {}, c = Ae(), r = Je();
|
|
553
557
|
let f = !1;
|
|
554
558
|
const a = pe({
|
|
555
559
|
activePath: n,
|
|
@@ -566,11 +570,11 @@ function Ze(e, o) {
|
|
|
566
570
|
for (const m of y) {
|
|
567
571
|
const D = r.routes.get(m);
|
|
568
572
|
if (!D) continue;
|
|
569
|
-
const P = a.routeKeys.get(m) || 0,
|
|
570
|
-
if (R && R.key ===
|
|
573
|
+
const P = a.routeKeys.get(m) || 0, E = a.componentKeys.get(m) || 0, S = `${D.path}-${P}`, R = v.get(m);
|
|
574
|
+
if (R && R.key === S && R.componentKey === E)
|
|
571
575
|
h.push(R);
|
|
572
576
|
else {
|
|
573
|
-
const O = { ...D, key:
|
|
577
|
+
const O = { ...D, key: S, componentKey: E };
|
|
574
578
|
v.set(m, O), h.push(O);
|
|
575
579
|
}
|
|
576
580
|
}
|
|
@@ -582,28 +586,28 @@ function Ze(e, o) {
|
|
|
582
586
|
var O, I;
|
|
583
587
|
const m = B(a.activePath), D = Math.min(y, m.length - 1);
|
|
584
588
|
if (D <= 0) return;
|
|
585
|
-
const P = m.slice(0, -D),
|
|
589
|
+
const P = m.slice(0, -D), E = K(P);
|
|
586
590
|
for (let $ = m.length - D; $ < m.length; $++)
|
|
587
591
|
a.routeAttrs.delete(m[$]);
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
const $ = a.routeAttrs.get(
|
|
591
|
-
a.routeAttrs.set(
|
|
592
|
-
|
|
593
|
-
(a.componentKeys.get(
|
|
592
|
+
const S = P.at(-1);
|
|
593
|
+
if (S && h) {
|
|
594
|
+
const $ = a.routeAttrs.get(S);
|
|
595
|
+
a.routeAttrs.set(S, { ...$, ...h }), a.componentKeys.set(
|
|
596
|
+
S,
|
|
597
|
+
(a.componentKeys.get(S) || 0) + 1
|
|
594
598
|
);
|
|
595
599
|
}
|
|
596
600
|
const R = a.activePath;
|
|
597
|
-
(O = o == null ? void 0 : o.trackPageLeave) == null || O.call(o, R, R,
|
|
601
|
+
(O = o == null ? void 0 : o.trackPageLeave) == null || O.call(o, R, R, E), a.fromPath = R, a.toPath = E, a.activePath = E, (I = o == null ? void 0 : o.trackPageEnter) == null || I.call(o, E, R, E);
|
|
598
602
|
}
|
|
599
603
|
async function T(y, h) {
|
|
600
|
-
var
|
|
604
|
+
var E, S;
|
|
601
605
|
const m = W(y), D = B(m);
|
|
602
606
|
await Promise.all(
|
|
603
607
|
D.map((R) => r.asyncLoaders.get(R)).filter((R) => !!R).map((R) => te(R))
|
|
604
608
|
);
|
|
605
609
|
const P = a.activePath;
|
|
606
|
-
P !== m && ((
|
|
610
|
+
P !== m && ((E = o == null ? void 0 : o.trackPageLeave) == null || E.call(o, P, P, m)), a.fromPath = P, a.toPath = m, a.activePath = m, h && L(m, h), (S = o == null ? void 0 : o.trackPageEnter) == null || S.call(o, m, P, m);
|
|
607
611
|
}
|
|
608
612
|
function L(y, h) {
|
|
609
613
|
const m = B(y).at(-1);
|
|
@@ -626,19 +630,19 @@ function Ze(e, o) {
|
|
|
626
630
|
}
|
|
627
631
|
const m = y.toString();
|
|
628
632
|
if (m.startsWith("/")) {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
631
|
-
if (R.length -
|
|
633
|
+
const S = B(m), R = B(a.activePath);
|
|
634
|
+
if (S.length < R.length && S.every(($, se) => R[se] === $)) {
|
|
635
|
+
if (R.length - S.length === 1)
|
|
632
636
|
b(1, h);
|
|
633
637
|
else {
|
|
634
|
-
const se = R.slice(0,
|
|
635
|
-
for (let re =
|
|
638
|
+
const se = R.slice(0, S.length + 1), Ne = K(se);
|
|
639
|
+
for (let re = S.length + 1; re < R.length; re++)
|
|
636
640
|
a.routeAttrs.delete(R[re]);
|
|
637
641
|
a.activePath = Ne, await Z(), b(1, h);
|
|
638
642
|
}
|
|
639
643
|
return;
|
|
640
644
|
}
|
|
641
|
-
const I =
|
|
645
|
+
const I = S.at(-1);
|
|
642
646
|
I && R.at(-1) === I && a.routeKeys.set(
|
|
643
647
|
I,
|
|
644
648
|
(a.routeKeys.get(I) || 0) + 1
|
|
@@ -647,10 +651,10 @@ function Ze(e, o) {
|
|
|
647
651
|
}
|
|
648
652
|
const D = B(a.activePath), P = D.indexOf(m);
|
|
649
653
|
if (P !== -1) {
|
|
650
|
-
const
|
|
651
|
-
if (
|
|
654
|
+
const S = D.length - (P + 1);
|
|
655
|
+
if (S === 1)
|
|
652
656
|
b(1, h);
|
|
653
|
-
else if (
|
|
657
|
+
else if (S > 1) {
|
|
654
658
|
const R = D.slice(0, P + 2), O = K(R);
|
|
655
659
|
for (let I = P + 2; I < D.length; I++)
|
|
656
660
|
a.routeAttrs.delete(D[I]);
|
|
@@ -662,13 +666,13 @@ function Ze(e, o) {
|
|
|
662
666
|
);
|
|
663
667
|
return;
|
|
664
668
|
}
|
|
665
|
-
const
|
|
666
|
-
await T(
|
|
669
|
+
const E = K([...D, m]);
|
|
670
|
+
await T(E, h);
|
|
667
671
|
}
|
|
668
|
-
function
|
|
672
|
+
function i(y) {
|
|
669
673
|
if (typeof y == "number" && y < 0) {
|
|
670
|
-
const P = B(a.activePath),
|
|
671
|
-
return
|
|
674
|
+
const P = B(a.activePath), E = Math.min(Math.abs(y), P.length - 1);
|
|
675
|
+
return E <= 0 ? a.activePath : K(P.slice(0, -E));
|
|
672
676
|
}
|
|
673
677
|
const h = y.toString();
|
|
674
678
|
if (h.startsWith("/")) return W(h);
|
|
@@ -683,18 +687,18 @@ function Ze(e, o) {
|
|
|
683
687
|
try {
|
|
684
688
|
const D = (((m = t.beforeEach) == null ? void 0 : m.length) ?? 0) > 0, P = r.routes.size > 0;
|
|
685
689
|
if ((D || P) && y) {
|
|
686
|
-
const R =
|
|
690
|
+
const R = i(y), O = W(a.activePath);
|
|
687
691
|
if (!await be(R, O, t, d)) {
|
|
688
692
|
f = !1;
|
|
689
693
|
return;
|
|
690
694
|
}
|
|
691
695
|
}
|
|
692
|
-
const S = W(a.activePath);
|
|
693
|
-
await p(y, h);
|
|
694
696
|
const E = W(a.activePath);
|
|
695
|
-
|
|
697
|
+
await p(y, h);
|
|
698
|
+
const S = W(a.activePath);
|
|
699
|
+
w == null || w.record(S, h), He(S, E, t.afterEach), r.preloadAdjacent(B(a.activePath)), c.schedule(() => {
|
|
696
700
|
f = !1;
|
|
697
|
-
},
|
|
701
|
+
}, s);
|
|
698
702
|
} catch (D) {
|
|
699
703
|
throw f = !1, D;
|
|
700
704
|
}
|
|
@@ -702,7 +706,7 @@ function Ze(e, o) {
|
|
|
702
706
|
}
|
|
703
707
|
const w = l.enabled ? qe(l, async (y) => {
|
|
704
708
|
const h = B(a.activePath), m = B(y);
|
|
705
|
-
if (m.length < h.length && m.every((P,
|
|
709
|
+
if (m.length < h.length && m.every((P, E) => h[E] === P)) {
|
|
706
710
|
const P = h.length - m.length;
|
|
707
711
|
await u(-P);
|
|
708
712
|
} else
|
|
@@ -715,7 +719,7 @@ function Ze(e, o) {
|
|
|
715
719
|
runGuards: (y, h) => be(y, h, t, d),
|
|
716
720
|
scheduleUnlock: () => c.schedule(() => {
|
|
717
721
|
f = !1;
|
|
718
|
-
},
|
|
722
|
+
}, s),
|
|
719
723
|
lock: () => {
|
|
720
724
|
f = !0;
|
|
721
725
|
},
|
|
@@ -723,7 +727,7 @@ function Ze(e, o) {
|
|
|
723
727
|
f = !1;
|
|
724
728
|
},
|
|
725
729
|
isLocked: () => f,
|
|
726
|
-
stepDelay:
|
|
730
|
+
stepDelay: s
|
|
727
731
|
});
|
|
728
732
|
return {
|
|
729
733
|
activePath: C(() => a.activePath),
|
|
@@ -768,7 +772,7 @@ function et(e) {
|
|
|
768
772
|
history: e.history
|
|
769
773
|
},
|
|
770
774
|
o
|
|
771
|
-
),
|
|
775
|
+
), s = xe(o), t = Ue(
|
|
772
776
|
{
|
|
773
777
|
defaultControlName: e.defaultControlName,
|
|
774
778
|
onboardingControlName: e.onboardingControlName
|
|
@@ -809,17 +813,17 @@ function et(e) {
|
|
|
809
813
|
historyGo: n.history.go
|
|
810
814
|
} : {},
|
|
811
815
|
// Dialogs
|
|
812
|
-
activeDialog:
|
|
813
|
-
fromDialog:
|
|
814
|
-
toDialog:
|
|
815
|
-
resolveDialogs:
|
|
816
|
-
openDialog:
|
|
817
|
-
closeDialog:
|
|
818
|
-
closeAllDialogs:
|
|
819
|
-
registerDialog:
|
|
820
|
-
registerDialogs:
|
|
821
|
-
getDialogAttrs:
|
|
822
|
-
updateDialogAttrs:
|
|
816
|
+
activeDialog: s.activeDialog,
|
|
817
|
+
fromDialog: s.fromDialog,
|
|
818
|
+
toDialog: s.toDialog,
|
|
819
|
+
resolveDialogs: s.resolveDialogs,
|
|
820
|
+
openDialog: s.openDialog,
|
|
821
|
+
closeDialog: s.closeDialog,
|
|
822
|
+
closeAllDialogs: s.closeAllDialogs,
|
|
823
|
+
registerDialog: s.registerDialog,
|
|
824
|
+
registerDialogs: s.registerDialogs,
|
|
825
|
+
getDialogAttrs: s.getDialogAttrs,
|
|
826
|
+
updateDialogAttrs: s.updateDialogAttrs,
|
|
823
827
|
// Controls
|
|
824
828
|
resolveControls: t.resolveControls,
|
|
825
829
|
activeControl: t.activeControl,
|
|
@@ -854,7 +858,7 @@ function et(e) {
|
|
|
854
858
|
n.activePath.value
|
|
855
859
|
), l && document.addEventListener("visibilitychange", l.handleVisibilityChange), ze(c);
|
|
856
860
|
}), he(() => {
|
|
857
|
-
o.cleanupAllSessions(), n.cleanup(),
|
|
861
|
+
o.cleanupAllSessions(), n.cleanup(), s.cleanup(), t.cleanup(), l && (document.removeEventListener("visibilitychange", l.handleVisibilityChange), l.cleanup());
|
|
858
862
|
}), N(Le, c), x(de, null) || N(de, c), c;
|
|
859
863
|
}
|
|
860
864
|
function q(e) {
|
|
@@ -870,9 +874,9 @@ function mt(e) {
|
|
|
870
874
|
!o && !e && console.warn(
|
|
871
875
|
"[vue-micro-router] useMicroState() called without provider and no defaults. Ensure component is inside <RoutePage>, <MicroDialog>, or <MicroControlWrapper>."
|
|
872
876
|
);
|
|
873
|
-
const
|
|
874
|
-
for (const r of Object.keys(
|
|
875
|
-
t[r] =
|
|
877
|
+
const s = (o == null ? void 0 : o()) ?? {}, t = e ? { ...e } : {};
|
|
878
|
+
for (const r of Object.keys(s))
|
|
879
|
+
t[r] = s[r];
|
|
876
880
|
const l = pe(t);
|
|
877
881
|
n && U(
|
|
878
882
|
l,
|
|
@@ -895,14 +899,14 @@ function pt(e) {
|
|
|
895
899
|
return;
|
|
896
900
|
}
|
|
897
901
|
const { activePage: n } = q();
|
|
898
|
-
let
|
|
899
|
-
|
|
902
|
+
let s = n.value === o;
|
|
903
|
+
s && H(() => {
|
|
900
904
|
var t;
|
|
901
905
|
return (t = e.onRouteEnter) == null ? void 0 : t.call(e);
|
|
902
906
|
}), U(n, (t) => {
|
|
903
907
|
var c, r;
|
|
904
908
|
const l = t === o;
|
|
905
|
-
l && !
|
|
909
|
+
l && !s ? (c = e.onRouteEnter) == null || c.call(e) : !l && s && ((r = e.onRouteLeave) == null || r.call(e)), s = l;
|
|
906
910
|
});
|
|
907
911
|
}
|
|
908
912
|
function ht(e) {
|
|
@@ -914,14 +918,14 @@ function ht(e) {
|
|
|
914
918
|
return;
|
|
915
919
|
}
|
|
916
920
|
const { activeDialog: n } = q();
|
|
917
|
-
let
|
|
918
|
-
|
|
921
|
+
let s = n.value === o;
|
|
922
|
+
s && H(() => {
|
|
919
923
|
var t;
|
|
920
924
|
return (t = e.onDialogEnter) == null ? void 0 : t.call(e);
|
|
921
925
|
}), U(n, (t) => {
|
|
922
926
|
var c, r;
|
|
923
927
|
const l = t === o;
|
|
924
|
-
l && !
|
|
928
|
+
l && !s ? (c = e.onDialogEnter) == null || c.call(e) : !l && s && ((r = e.onDialogLeave) == null || r.call(e)), s = l;
|
|
925
929
|
});
|
|
926
930
|
}
|
|
927
931
|
function yt(e) {
|
|
@@ -933,46 +937,46 @@ function yt(e) {
|
|
|
933
937
|
return;
|
|
934
938
|
}
|
|
935
939
|
const { currentControl: n } = q();
|
|
936
|
-
let
|
|
937
|
-
|
|
940
|
+
let s = n.value === o;
|
|
941
|
+
s && H(() => {
|
|
938
942
|
var t;
|
|
939
943
|
return (t = e.onControlEnter) == null ? void 0 : t.call(e);
|
|
940
944
|
}), U(n, (t) => {
|
|
941
945
|
var c, r;
|
|
942
946
|
const l = t === o;
|
|
943
|
-
l && !
|
|
947
|
+
l && !s ? (c = e.onControlEnter) == null || c.call(e) : !l && s && ((r = e.onControlLeave) == null || r.call(e)), s = l;
|
|
944
948
|
});
|
|
945
949
|
}
|
|
946
950
|
function tt(e, o) {
|
|
947
951
|
if (!e.enabled) return;
|
|
948
|
-
const n = e.edgeWidth ?? 20,
|
|
952
|
+
const n = e.edgeWidth ?? 20, s = e.threshold ?? 0.3, t = e.velocityThreshold ?? 0.5;
|
|
949
953
|
let l = 0, c = 0, r = 0, f = !1, a = null, v = null;
|
|
950
954
|
function A() {
|
|
951
|
-
const
|
|
952
|
-
return
|
|
955
|
+
const i = o.containerRef.value;
|
|
956
|
+
return i ? "$el" in i ? i.$el : i : null;
|
|
953
957
|
}
|
|
954
958
|
function b() {
|
|
955
|
-
const
|
|
956
|
-
if (!
|
|
957
|
-
const d =
|
|
959
|
+
const i = A();
|
|
960
|
+
if (!i) return { current: null, previous: null };
|
|
961
|
+
const d = i.querySelectorAll(".route-page");
|
|
958
962
|
return d.length < 2 ? { current: d[d.length - 1] ?? null, previous: null } : {
|
|
959
963
|
current: d[d.length - 1],
|
|
960
964
|
previous: d[d.length - 2]
|
|
961
965
|
};
|
|
962
966
|
}
|
|
963
|
-
function T(
|
|
967
|
+
function T(i) {
|
|
964
968
|
var M;
|
|
965
|
-
if (!o.canGoBack() ||
|
|
969
|
+
if (!o.canGoBack() || i.clientX > n) return;
|
|
966
970
|
const { current: d, previous: u } = b();
|
|
967
971
|
if (!d) return;
|
|
968
|
-
f = !0, l =
|
|
972
|
+
f = !0, l = i.clientX, c = i.clientY, r = Date.now(), a = d, v = u;
|
|
969
973
|
const w = A();
|
|
970
|
-
(M = w == null ? void 0 : w.setPointerCapture) == null || M.call(w,
|
|
974
|
+
(M = w == null ? void 0 : w.setPointerCapture) == null || M.call(w, i.pointerId), a.style.willChange = "transform", v && (v.style.willChange = "transform", v.style.transition = "none"), a.style.transition = "none";
|
|
971
975
|
}
|
|
972
|
-
function L(
|
|
976
|
+
function L(i) {
|
|
973
977
|
if (!f || !a) return;
|
|
974
|
-
const d = Math.max(0,
|
|
975
|
-
if (Math.abs(
|
|
978
|
+
const d = Math.max(0, i.clientX - l);
|
|
979
|
+
if (Math.abs(i.clientY - c) > d * 1.5) {
|
|
976
980
|
g();
|
|
977
981
|
return;
|
|
978
982
|
}
|
|
@@ -982,14 +986,14 @@ function tt(e, o) {
|
|
|
982
986
|
v.style.transform = `translateX(${M}%)`;
|
|
983
987
|
}
|
|
984
988
|
}
|
|
985
|
-
function _(
|
|
989
|
+
function _(i) {
|
|
986
990
|
if (!f || !a) return;
|
|
987
991
|
if (!a.isConnected) {
|
|
988
992
|
p(), f = !1;
|
|
989
993
|
return;
|
|
990
994
|
}
|
|
991
|
-
const d =
|
|
992
|
-
d / window.innerWidth >
|
|
995
|
+
const d = i.clientX - l, u = Date.now() - r, w = d / u;
|
|
996
|
+
d / window.innerWidth > s || w > 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(() => {
|
|
993
997
|
p(), o.goBack();
|
|
994
998
|
}, 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(p, 200)), f = !1;
|
|
995
999
|
}
|
|
@@ -1000,20 +1004,20 @@ function tt(e, o) {
|
|
|
1000
1004
|
a && (a.style.willChange = "", a.style.transition = "", a.style.transform = ""), v && (v.style.willChange = "", v.style.transition = "", v.style.transform = ""), a = null, v = null;
|
|
1001
1005
|
}
|
|
1002
1006
|
H(() => {
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1007
|
+
const i = A();
|
|
1008
|
+
i != null && i.addEventListener && (i.addEventListener("pointerdown", T, { passive: !0 }), i.addEventListener("pointermove", L, { passive: !0 }), i.addEventListener("pointerup", _, { passive: !0 }), i.addEventListener("pointercancel", g, { passive: !0 }));
|
|
1005
1009
|
}), he(() => {
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1010
|
+
const i = A();
|
|
1011
|
+
i != null && i.removeEventListener && (i.removeEventListener("pointerdown", T), i.removeEventListener("pointermove", L), i.removeEventListener("pointerup", _), i.removeEventListener("pointercancel", g));
|
|
1008
1012
|
});
|
|
1009
1013
|
}
|
|
1010
1014
|
function Pt(e) {
|
|
1011
1015
|
return { ...e };
|
|
1012
1016
|
}
|
|
1013
1017
|
function nt(e, o) {
|
|
1014
|
-
var n,
|
|
1018
|
+
var n, s, t;
|
|
1015
1019
|
for (const l of e)
|
|
1016
|
-
(n = l.routes) != null && n.length && o.registerRoutes(l.routes), (
|
|
1020
|
+
(n = l.routes) != null && n.length && o.registerRoutes(l.routes), (s = l.dialogs) != null && s.length && o.registerDialogs(l.dialogs), (t = l.controls) != null && t.length && o.registerControls(l.controls);
|
|
1017
1021
|
}
|
|
1018
1022
|
const ot = /* @__PURE__ */ oe({
|
|
1019
1023
|
__name: "MicroControlWrapper",
|
|
@@ -1021,9 +1025,9 @@ const ot = /* @__PURE__ */ oe({
|
|
|
1021
1025
|
control: {}
|
|
1022
1026
|
},
|
|
1023
1027
|
setup(e) {
|
|
1024
|
-
const o = e, { getControlAttrs: n, updateControlAttrs:
|
|
1028
|
+
const o = e, { getControlAttrs: n, updateControlAttrs: s } = q();
|
|
1025
1029
|
return N(Be, o.control.name), N(ae, () => n(o.control.name)), N(ie, (t) => {
|
|
1026
|
-
|
|
1030
|
+
s(o.control.name, t);
|
|
1027
1031
|
}), (t, l) => (G(), F(ye(e.control.component), Pe({
|
|
1028
1032
|
key: e.control.componentKey || 0
|
|
1029
1033
|
}, e.control.attrs), null, 16));
|
|
@@ -1044,9 +1048,9 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1044
1048
|
},
|
|
1045
1049
|
emits: ["close"],
|
|
1046
1050
|
setup(e, { emit: o }) {
|
|
1047
|
-
const n = e,
|
|
1051
|
+
const n = e, s = o, { getDialogAttrs: t, updateDialogAttrs: l } = q();
|
|
1048
1052
|
let c = !1;
|
|
1049
|
-
const r = ne(null), f = ne(null), a = C(() => n.dialog.transition ?? "scale"), v = C(() => n.dialog.transitionDuration != null ? n.dialog.transitionDuration : a.value === "slide" ? 500 : 300), A = C(() => n.dialog.position ?? "standard"), b = C(() => n.dialog.seamless ?? !
|
|
1053
|
+
const r = ne(null), f = ne(null), a = C(() => n.dialog.transition ?? "scale"), v = C(() => n.dialog.transitionDuration != null ? n.dialog.transitionDuration : a.value === "slide" ? 500 : 300), A = C(() => n.dialog.position ?? "standard"), b = C(() => n.dialog.seamless ?? !1), T = C(
|
|
1050
1054
|
() => n.dialog.activated || !!n.dialog.closing
|
|
1051
1055
|
);
|
|
1052
1056
|
function L() {
|
|
@@ -1058,7 +1062,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1058
1062
|
var D, P;
|
|
1059
1063
|
if (u.key === "Escape") {
|
|
1060
1064
|
if (n.dialog.persistent) return;
|
|
1061
|
-
u.preventDefault(), u.stopPropagation(),
|
|
1065
|
+
u.preventDefault(), u.stopPropagation(), s("close", n.dialog.path);
|
|
1062
1066
|
return;
|
|
1063
1067
|
}
|
|
1064
1068
|
if (u.key !== "Tab") return;
|
|
@@ -1071,14 +1075,14 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1071
1075
|
u.shiftKey ? (!m || h === M) && (u.preventDefault(), y.focus()) : (!m || h === y) && (u.preventDefault(), M.focus());
|
|
1072
1076
|
}
|
|
1073
1077
|
function g(u) {
|
|
1074
|
-
n.dialog.persistent || u.target === u.currentTarget &&
|
|
1078
|
+
n.dialog.persistent || u.target === u.currentTarget && s("close", n.dialog.path);
|
|
1075
1079
|
}
|
|
1076
1080
|
function p() {
|
|
1077
1081
|
if (!n.dialog.focusInput || !r.value) return;
|
|
1078
1082
|
const u = document.createElement("input");
|
|
1079
1083
|
u.style.cssText = "position:fixed;opacity:0;height:0;width:0;top:-100px;", r.value.appendChild(u), u.focus(), setTimeout(() => u.remove(), 50);
|
|
1080
1084
|
}
|
|
1081
|
-
function
|
|
1085
|
+
function i() {
|
|
1082
1086
|
c || (c = !0, f.value = document.activeElement, at(), Z(() => {
|
|
1083
1087
|
if (!r.value) return;
|
|
1084
1088
|
(L()[0] ?? r.value).focus(), p();
|
|
@@ -1095,7 +1099,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1095
1099
|
}), U(
|
|
1096
1100
|
() => n.dialog.activated,
|
|
1097
1101
|
(u) => {
|
|
1098
|
-
u &&
|
|
1102
|
+
u && i();
|
|
1099
1103
|
}
|
|
1100
1104
|
), U(
|
|
1101
1105
|
() => n.dialog.closing,
|
|
@@ -1103,7 +1107,7 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1103
1107
|
!u && !n.dialog.activated && c && d();
|
|
1104
1108
|
}
|
|
1105
1109
|
), H(() => {
|
|
1106
|
-
n.dialog.activated &&
|
|
1110
|
+
n.dialog.activated && i();
|
|
1107
1111
|
}), he(() => {
|
|
1108
1112
|
c && d();
|
|
1109
1113
|
}), (u, w) => (G(), F(We, { to: "body" }, [
|
|
@@ -1161,12 +1165,12 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1161
1165
|
if (o.routePath) {
|
|
1162
1166
|
const n = o.routePath;
|
|
1163
1167
|
N(Te, n);
|
|
1164
|
-
const { updateRouteAttrs:
|
|
1168
|
+
const { updateRouteAttrs: s, getRouteAttrs: t } = q();
|
|
1165
1169
|
N(ae, () => t(n)), N(ie, (l) => {
|
|
1166
|
-
|
|
1170
|
+
s(n, l);
|
|
1167
1171
|
});
|
|
1168
1172
|
}
|
|
1169
|
-
return (n,
|
|
1173
|
+
return (n, s) => (G(), V("div", lt, [
|
|
1170
1174
|
k("div", ct, [
|
|
1171
1175
|
we(n.$slots, "default")
|
|
1172
1176
|
])
|
|
@@ -1184,39 +1188,39 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1184
1188
|
const o = e, n = et(o.config);
|
|
1185
1189
|
(g = o.plugins) != null && g.length && nt(o.plugins, n);
|
|
1186
1190
|
const {
|
|
1187
|
-
resolveRoutes:
|
|
1191
|
+
resolveRoutes: s,
|
|
1188
1192
|
resolveDialogs: t,
|
|
1189
1193
|
resolveControls: l,
|
|
1190
1194
|
fromPath: c,
|
|
1191
1195
|
toPath: r,
|
|
1192
1196
|
closeDialog: f
|
|
1193
1197
|
} = n, a = ne(null), v = C(() => {
|
|
1194
|
-
const
|
|
1195
|
-
return
|
|
1198
|
+
const i = c.value.split("/").filter(Boolean), d = new Set(r.value.split("/").filter(Boolean));
|
|
1199
|
+
return i.some((u) => d.has(u));
|
|
1196
1200
|
}), A = C(() => l.value.length > 0), b = C(() => {
|
|
1197
|
-
const
|
|
1198
|
-
return (
|
|
1201
|
+
const i = s.value.at(-1);
|
|
1202
|
+
return (i == null ? void 0 : i.transition) ?? "slide";
|
|
1199
1203
|
}), T = C(() => b.value === "none" ? "" : b.value === "fade" ? "page-fade" : "page-slide"), L = C(() => {
|
|
1200
|
-
const
|
|
1201
|
-
return
|
|
1204
|
+
const i = s.value.at(-1);
|
|
1205
|
+
return i != null && i.transitionDuration ? i.transitionDuration : b.value === "fade" ? 300 : 500;
|
|
1202
1206
|
}), _ = C(() => v.value && b.value !== "none");
|
|
1203
1207
|
return (p = o.config.gesture) != null && p.enabled && tt(o.config.gesture, {
|
|
1204
1208
|
containerRef: a,
|
|
1205
1209
|
goBack: () => n.push(-1),
|
|
1206
|
-
canGoBack: () =>
|
|
1207
|
-
}), (
|
|
1208
|
-
Ee
|
|
1210
|
+
canGoBack: () => s.value.length > 1
|
|
1211
|
+
}), (i, d) => (G(), V(ee, null, [
|
|
1212
|
+
Se(Ee, {
|
|
1209
1213
|
ref_key: "pageContainerRef",
|
|
1210
1214
|
ref: a,
|
|
1211
1215
|
name: T.value,
|
|
1212
1216
|
css: _.value
|
|
1213
1217
|
}, {
|
|
1214
1218
|
default: ce(() => [
|
|
1215
|
-
(G(!0), V(ee, null, ue(X(
|
|
1219
|
+
(G(!0), V(ee, null, ue(X(s), (u, w) => (G(), F(ut, {
|
|
1216
1220
|
key: u.key || u.path,
|
|
1217
1221
|
"route-path": u.path,
|
|
1218
1222
|
class: J({
|
|
1219
|
-
deactive: X(
|
|
1223
|
+
deactive: X(s).length > 1 && w !== X(s).length - 1
|
|
1220
1224
|
}),
|
|
1221
1225
|
style: Me({
|
|
1222
1226
|
transition: _.value ? `transform ${L.value}ms cubic-bezier(0.65, 0, 0.35, 1), opacity ${L.value}ms ease` : "none",
|
|
@@ -1235,12 +1239,12 @@ const st = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
1235
1239
|
_: 1
|
|
1236
1240
|
}, 8, ["name", "css"]),
|
|
1237
1241
|
k("div", ft, [
|
|
1238
|
-
we(
|
|
1242
|
+
we(i.$slots, "default")
|
|
1239
1243
|
]),
|
|
1240
1244
|
k("div", {
|
|
1241
1245
|
class: J(["micro-router-gui-layer", { "gui-visible": A.value }])
|
|
1242
1246
|
}, [
|
|
1243
|
-
Ee
|
|
1247
|
+
Se(Ee, { name: "control-fade" }, {
|
|
1244
1248
|
default: ce(() => [
|
|
1245
1249
|
(G(!0), V(ee, null, ue(X(l), (u) => (G(), F(ot, {
|
|
1246
1250
|
key: u.name + "-" + (u.componentKey || 0),
|
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.route-page{position:absolute!important;top:0;right:0;bottom:0;left:0;width:100%;height:var(--mr-page-height, 100%);transform:translate(0)}.route-page__body{position:relative;width:100%;height:100%}.route-page:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s cubic-bezier(.65,0,.35,1);pointer-events:none;z-index:1}.route-page.deactive{transform:translate(-20%)}.route-page.deactive:before{opacity:1}.page-slide-enter-active,.page-slide-leave-active{transition:transform .5s cubic-bezier(.65,0,.35,1)}.page-slide-enter-from,.page-slide-leave-to{transform:translate(100%)}.page-fade-enter-active,.page-fade-leave-active{transition:opacity .3s ease}.page-fade-enter-from,.page-fade-leave-to{opacity:0}.micro-router-content-layer{position:fixed;top:0;right:0;bottom:0;left:0;z-index:20;pointer-events:none}.micro-router-gui-layer{position:fixed;width:0;top:0;left:0;right:0;overflow:visible;z-index:1000;opacity:0;transition:opacity .5s ease;pointer-events:none}.micro-router-gui-layer.gui-visible{opacity:1;pointer-events:auto}.control-fade-move,.control-fade-enter-active,.control-fade-leave-active{transition:opacity .5s ease}.control-fade-enter-from,.control-fade-leave-to{opacity:0}.control-fade-leave-active{position:absolute}.micro-dialog-portal{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;pointer-events:auto}.micro-dialog--standard{align-items:center;justify-content:center}.micro-dialog--top{align-items:flex-start;justify-content:center}.micro-dialog--bottom{align-items:flex-end;justify-content:center}.micro-dialog--left{align-items:center;justify-content:flex-start}.micro-dialog--right{align-items:center;justify-content:flex-end}.micro-dialog-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;background:#00000080;pointer-events:none;animation:_dialog-fade-in .3s ease-out forwards}.micro-dialog-backdrop--closing{animation:_dialog-fade-out .2s ease-in forwards}.micro-dialog{position:relative;outline:none;pointer-events:none;
|
|
1
|
+
.route-page{position:absolute!important;top:0;right:0;bottom:0;left:0;width:100%;height:var(--mr-page-height, 100%);transform:translate(0)}.route-page__body{position:relative;width:100%;height:100%}.route-page:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s cubic-bezier(.65,0,.35,1);pointer-events:none;z-index:1}.route-page.deactive{transform:translate(-20%)}.route-page.deactive:before{opacity:1}.page-slide-enter-active,.page-slide-leave-active{transition:transform .5s cubic-bezier(.65,0,.35,1)}.page-slide-enter-from,.page-slide-leave-to{transform:translate(100%)}.page-fade-enter-active,.page-fade-leave-active{transition:opacity .3s ease}.page-fade-enter-from,.page-fade-leave-to{opacity:0}.micro-router-content-layer{position:fixed;top:0;right:0;bottom:0;left:0;z-index:20;pointer-events:none}.micro-router-gui-layer{position:fixed;width:0;top:0;left:0;right:0;overflow:visible;z-index:1000;opacity:0;transition:opacity .5s ease;pointer-events:none}.micro-router-gui-layer.gui-visible{opacity:1;pointer-events:auto}.control-fade-move,.control-fade-enter-active,.control-fade-leave-active{transition:opacity .5s ease}.control-fade-enter-from,.control-fade-leave-to{opacity:0}.control-fade-leave-active{position:absolute}.micro-dialog-portal{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;pointer-events:auto}.micro-dialog--standard{align-items:center;justify-content:center}.micro-dialog--top{align-items:flex-start;justify-content:center}.micro-dialog--bottom{align-items:flex-end;justify-content:center}.micro-dialog--left{align-items:center;justify-content:flex-start}.micro-dialog--right{align-items:center;justify-content:flex-end}.micro-dialog-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;background:#00000080;pointer-events:none;animation:_dialog-fade-in .3s ease-out forwards}.micro-dialog-backdrop--closing{animation:_dialog-fade-out .2s ease-in forwards}.micro-dialog{position:relative;outline:none;pointer-events:none;width:100%;max-width:100%;max-height:100dvh;will-change:opacity,transform}.micro-dialog__content{position:relative;pointer-events:auto}.micro-dialog--fullscreen .micro-dialog{width:100vw;height:100dvh}.micro-dialog--fullscreen .micro-dialog__content{width:100%;height:100dvh;overflow:hidden}.micro-dialog--closing{pointer-events:none}@keyframes _dialog-fade-in{0%{opacity:0}to{opacity:1}}@keyframes _dialog-fade-out{0%{opacity:1}to{opacity:0}}@keyframes _dialog-scale-pop-in{0%{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}@keyframes _dialog-scale-pop-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.85)}}@keyframes _dialog-slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes _dialog-slide-out{0%{transform:translate(0)}to{transform:translate(100%)}}.dialog-transition-fade:not(.micro-dialog--closing){animation:_dialog-fade-in .25s ease-out forwards}.dialog-transition-fade.micro-dialog--closing{animation:_dialog-fade-out .2s ease-in forwards}.dialog-transition-scale:not(.micro-dialog--closing){animation:_dialog-scale-pop-in .3s cubic-bezier(.22,1,.36,1) forwards}.dialog-transition-scale.micro-dialog--closing{animation:_dialog-scale-pop-out .3s cubic-bezier(.22,1,.36,1) forwards}.dialog-transition-slide:not(.micro-dialog--closing){animation:_dialog-slide-in var(--dialog-duration, .5s) cubic-bezier(.65,0,.35,1) forwards}.dialog-transition-slide.micro-dialog--closing{animation:_dialog-slide-out var(--dialog-duration, .5s) cubic-bezier(.65,0,.35,1) forwards}
|