react-modal-navigation 1.1.9 → 1.1.11
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/CHANGELOG.md +11 -0
- package/README.md +46 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +63 -6
- package/dist/index.js +1096 -807
- package/dist/style.css +19 -0
- package/docs/ARCHITECTURE-1.1.11.md +5 -0
- package/docs/FINAL-OPTIMIZATION-1.1.11.md +10 -0
- package/docs/RUNTIME-1.1.11.md +5 -0
- package/docs/STABILITY-1.1.11.md +9 -0
- package/docs/SUBSCRIPTIONS-1.1.11.md +7 -0
- package/docs/UPGRADE-1.1.11.md +18 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,140 +1,155 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
|
|
5
|
-
function kn(e) {
|
|
1
|
+
import { jsx as i, jsxs as Ce } from "react/jsx-runtime";
|
|
2
|
+
import fe, { createContext as se, useState as xe, useEffect as H, useRef as k, useMemo as F, useSyncExternalStore as Ee, useContext as V, memo as Ue, useCallback as K, useReducer as Qn, useLayoutEffect as Ie, Suspense as Ln, useInsertionEffect as Zn } from "react";
|
|
3
|
+
import { createPortal as Xn } from "react-dom";
|
|
4
|
+
function Oe(e) {
|
|
6
5
|
let n = e;
|
|
7
|
-
const
|
|
6
|
+
const t = /* @__PURE__ */ new Set();
|
|
7
|
+
let r = !1;
|
|
8
8
|
return {
|
|
9
9
|
getSnapshot: () => n,
|
|
10
|
-
subscribe: (
|
|
11
|
-
publish(
|
|
12
|
-
if (n
|
|
13
|
-
n =
|
|
14
|
-
for (const
|
|
10
|
+
subscribe: (o) => (r || t.add(o), () => t.delete(o)),
|
|
11
|
+
publish(o) {
|
|
12
|
+
if (!(r || Object.is(n, o))) {
|
|
13
|
+
n = o;
|
|
14
|
+
for (const g of [...t]) g();
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
function Te(e) {
|
|
21
|
-
let n = e;
|
|
22
|
-
const r = /* @__PURE__ */ new Set();
|
|
23
|
-
return {
|
|
24
|
-
getSnapshot: () => n,
|
|
25
|
-
subscribe: (t) => (r.add(t), () => r.delete(t)),
|
|
26
|
-
publish(t) {
|
|
27
|
-
if (!Object.is(n, t)) {
|
|
28
|
-
n = t;
|
|
29
|
-
for (const c of [...r]) c();
|
|
30
|
-
}
|
|
17
|
+
destroy() {
|
|
18
|
+
r = !0, t.clear();
|
|
31
19
|
},
|
|
32
|
-
listenerCount: () =>
|
|
20
|
+
listenerCount: () => t.size
|
|
33
21
|
};
|
|
34
22
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
const tn = se(null), An = se(null), Nn = se(null), Ve = se(null), De = se(null), bn = se(null), vn = se(null), rn = se(null), on = se(null), an = se(null), zn = se(null), Bn = se(null), sn = se(null), wn = se(null), xn = se(null), kn = se(null);
|
|
24
|
+
let Jn = 0;
|
|
25
|
+
const yn = (e, n) => ({ key: `modal-route-${++Jn}`, name: e, params: n ?? {} }), Fn = (e, n) => [yn(e, n)];
|
|
26
|
+
function Xe(e, n) {
|
|
38
27
|
switch (n.type) {
|
|
28
|
+
case "COMMIT":
|
|
29
|
+
return n.stack;
|
|
39
30
|
case "RESET":
|
|
40
|
-
return
|
|
31
|
+
return Fn(n.name, n.params);
|
|
41
32
|
case "NAVIGATE": {
|
|
42
|
-
const
|
|
43
|
-
return
|
|
33
|
+
const t = e.findIndex((r) => r.name === n.name);
|
|
34
|
+
return t < 0 ? [...e, yn(n.name, n.params)] : e.slice(0, t + 1).map((r, o) => o === t ? { ...r, params: n.params ?? {} } : r);
|
|
44
35
|
}
|
|
45
36
|
case "SET_OPTIONS":
|
|
46
|
-
return e.map((
|
|
37
|
+
return e.map((t, r) => r === e.length - 1 ? { ...t, options: { ...t.options ?? {}, ...n.options ?? {} } } : t);
|
|
47
38
|
case "SET_PARAMS":
|
|
48
|
-
return e.map((
|
|
39
|
+
return e.map((t, r) => r === e.length - 1 ? { ...t, params: { ...t.params ?? {}, ...n.params ?? {} } } : t);
|
|
49
40
|
case "BACK":
|
|
50
41
|
return e.length > 1 ? e.slice(0, -1) : e;
|
|
51
42
|
case "REPLACE":
|
|
52
|
-
return e.length ? [...e.slice(0, -1),
|
|
43
|
+
return e.length ? [...e.slice(0, -1), yn(n.name, n.params)] : e;
|
|
53
44
|
default:
|
|
54
45
|
return e;
|
|
55
46
|
}
|
|
56
47
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
return e.filter((p,
|
|
48
|
+
function et(e, n, t = 1 / 0) {
|
|
49
|
+
const r = t === 1 / 0 ? 1 / 0 : Math.max(0, Math.floor(Number(t) || 0)), o = e.slice(0, -1).filter((p) => n[p.name]?.keepAlive !== !1), g = new Set((r === 0 ? [] : o.slice(-r)).map((p) => p.key));
|
|
50
|
+
return e.filter((p, h) => h === e.length - 1 || g.has(p.key));
|
|
51
|
+
}
|
|
52
|
+
function nt(e, n) {
|
|
53
|
+
const t = e.responsive;
|
|
54
|
+
if (!t) return e;
|
|
55
|
+
const { sm: r, md: o, lg: g, xl: p } = t;
|
|
56
|
+
return { ...e, ...n < 768 ? r : n < 1024 ? o : n < 1280 ? g : p, ...e.runtimeLayout };
|
|
60
57
|
}
|
|
61
|
-
|
|
58
|
+
function tt(e, n, t, r) {
|
|
59
|
+
const o = Math.max(0, Math.min(t ?? 1 / 0, r));
|
|
60
|
+
return Math.min(o, Math.max(Math.min(n ?? 240, o), e));
|
|
61
|
+
}
|
|
62
|
+
const rt = Object.freeze({ sm: 400, md: 560, lg: 720, xl: 960, full: "100%" }), Te = (e) => typeof e == "number" ? `${e}px` : e, Rn = () => {
|
|
62
63
|
if (typeof document > "u") return "light";
|
|
63
64
|
const e = document.documentElement, n = document.body;
|
|
64
65
|
return e.classList.contains("dark") || n.classList.contains("dark") || e.dataset.theme === "dark" || n.dataset.theme === "dark" ? "dark" : e.classList.contains("light") || n.classList.contains("light") || e.dataset.theme === "light" || n.dataset.theme === "light" ? "light" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
65
66
|
};
|
|
66
|
-
let
|
|
67
|
-
const
|
|
68
|
-
let
|
|
69
|
-
function
|
|
70
|
-
if (
|
|
71
|
-
const n = document.documentElement,
|
|
72
|
-
|
|
73
|
-
n.style.overflow =
|
|
67
|
+
let Ge = 0;
|
|
68
|
+
const Ne = [];
|
|
69
|
+
let gn = null;
|
|
70
|
+
function ot() {
|
|
71
|
+
if (Ge++, Ge === 1) {
|
|
72
|
+
const n = document.documentElement, t = document.body, r = { html: n.style.overflow, body: t.style.overflow, padding: t.style.paddingRight, width: t.style.getPropertyValue("--modal-scrollbar-width") }, o = Math.max(0, window.innerWidth - n.clientWidth), g = parseFloat(getComputedStyle(t).paddingRight) || 0;
|
|
73
|
+
o && (t.style.paddingRight = `${g + o}px`), t.style.setProperty("--modal-scrollbar-width", `${o}px`), n.style.overflow = "hidden", t.style.overflow = "hidden", gn = () => {
|
|
74
|
+
n.style.overflow = r.html, t.style.overflow = r.body, t.style.paddingRight = r.padding, r.width ? t.style.setProperty("--modal-scrollbar-width", r.width) : t.style.removeProperty("--modal-scrollbar-width");
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
let e = !1;
|
|
77
78
|
return () => {
|
|
78
|
-
e || (e = !0,
|
|
79
|
+
e || (e = !0, Ge = Math.max(0, Ge - 1), Ge || (gn?.(), gn = null));
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const g =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
const at = 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])', st = (e) => !e.closest('[inert], [hidden], [aria-hidden="true"]') && e.getClientRects().length > 0 && getComputedStyle(e).visibility !== "hidden" && getComputedStyle(e).display !== "none";
|
|
83
|
+
function it({ dialogRef: e, options: n, requestClose: t, children: r, exiting: o = !1 }) {
|
|
84
|
+
const [g, p] = xe(() => typeof window > "u" ? 1024 : window.innerWidth), h = !!n.responsive;
|
|
85
|
+
H(() => {
|
|
86
|
+
if (!h) return;
|
|
87
|
+
const C = () => p(window.innerWidth < 768 ? 0 : window.innerWidth < 1024 ? 768 : window.innerWidth < 1280 ? 1024 : 1280);
|
|
88
|
+
return window.addEventListener("resize", C), C(), () => window.removeEventListener("resize", C);
|
|
89
|
+
}, [h]), n = nt(n, g);
|
|
90
|
+
const [l, d] = xe(null);
|
|
91
|
+
H(() => d(null), [n.width, n.placement]);
|
|
92
|
+
const u = k(null), x = k(0);
|
|
93
|
+
H(() => () => {
|
|
94
|
+
x.current && cancelAnimationFrame(x.current);
|
|
95
|
+
}, []);
|
|
96
|
+
const w = k(null), b = k(null), s = k(t);
|
|
97
|
+
s.current = t;
|
|
98
|
+
const m = k(n.closeOnEsc);
|
|
99
|
+
m.current = n.closeOnEsc;
|
|
100
|
+
const [M, I] = xe(Rn), j = n.theme === "light" || n.theme === "dark" ? n.theme : M;
|
|
101
|
+
H(() => {
|
|
89
102
|
if (n.theme === "light" || n.theme === "dark") return;
|
|
90
|
-
const
|
|
91
|
-
for (const
|
|
92
|
-
const
|
|
93
|
-
return
|
|
94
|
-
|
|
103
|
+
const C = () => I(Rn()), R = new MutationObserver(C);
|
|
104
|
+
for (const ge of [document.documentElement, document.body]) R.observe(ge, { attributes: !0, attributeFilter: ["class", "data-theme"] });
|
|
105
|
+
const de = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
106
|
+
return de?.addEventListener?.("change", C), C(), () => {
|
|
107
|
+
R.disconnect(), de?.removeEventListener?.("change", C);
|
|
95
108
|
};
|
|
96
|
-
}, [n.theme]),
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
if (
|
|
104
|
-
|
|
109
|
+
}, [n.theme]), H(() => {
|
|
110
|
+
b.current = document.activeElement;
|
|
111
|
+
const C = ot(), R = w.current;
|
|
112
|
+
Ne.push(R), e.current?.focus({ preventScroll: !0 });
|
|
113
|
+
const de = (te) => {
|
|
114
|
+
const A = e.current;
|
|
115
|
+
if (!A || Ne.at(-1) !== R) return;
|
|
116
|
+
if (te.key === "Escape" && m.current !== !1) {
|
|
117
|
+
te.preventDefault(), s.current("escape");
|
|
105
118
|
return;
|
|
106
119
|
}
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
|
|
120
|
+
if (te.key !== "Tab") return;
|
|
121
|
+
const y = [...A.querySelectorAll(at)].filter(st);
|
|
122
|
+
if (!y.length) {
|
|
123
|
+
te.preventDefault(), A.focus();
|
|
111
124
|
return;
|
|
112
125
|
}
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
|
|
126
|
+
const U = y[0], ve = y.at(-1);
|
|
127
|
+
A.contains(document.activeElement) ? te.shiftKey && (document.activeElement === U || document.activeElement === A) ? (te.preventDefault(), ve.focus()) : !te.shiftKey && (document.activeElement === ve || document.activeElement === A) && (te.preventDefault(), U.focus()) : (te.preventDefault(), (te.shiftKey ? ve : U).focus());
|
|
128
|
+
}, ge = (te) => {
|
|
129
|
+
Ne.at(-1) === R && e.current && !e.current.contains(te.target) && e.current.focus({ preventScroll: !0 });
|
|
117
130
|
};
|
|
118
|
-
return document.addEventListener("keydown",
|
|
119
|
-
document.removeEventListener("keydown",
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
|
|
131
|
+
return document.addEventListener("keydown", de), document.addEventListener("focusin", ge), () => {
|
|
132
|
+
document.removeEventListener("keydown", de), document.removeEventListener("focusin", ge);
|
|
133
|
+
const te = Ne.at(-1) === R, A = Ne.indexOf(R);
|
|
134
|
+
if (A !== -1 && Ne.splice(A, 1), C(), te) {
|
|
135
|
+
const y = b.current;
|
|
136
|
+
y?.isConnected && !y.closest("[inert], [hidden]") ? y.focus?.({ preventScroll: !0 }) : Ne.at(-1)?.querySelector("[role=dialog]")?.focus?.({ preventScroll: !0 });
|
|
124
137
|
}
|
|
125
138
|
};
|
|
126
139
|
}, [e]);
|
|
127
|
-
const
|
|
128
|
-
|
|
140
|
+
const q = n.backgroundColor ?? n.backgroudColor, O = typeof q == "string" ? q : q?.[j], P = typeof O == "string" && /^(#|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|color|color-mix|light-dark|var)\(|transparent$|currentColor$|[a-z]+$)/i.test(O.trim()) ? O.trim() : null, L = typeof O == "string" && !P ? O.trim() : "", Y = !!(P || L), T = ["center", "left", "right", "top", "bottom"].includes(n.placement) ? n.placement : "right", $ = Te(l ?? n.width ?? rt[n.size] ?? 460), Q = Te(n.height), X = Te(n.maxHeight), ne = Te(n.maxWidth), oe = Number(n.viewportGap ?? 5), be = Number.isFinite(oe) ? Math.max(0, oe) : 5, z = n.top == null ? null : Te(n.top), _ = T !== "bottom" && z !== null ? z : null, le = typeof n.borderRadius == "number" ? `${n.borderRadius}px` : n.borderRadius ?? "12px", W = n.resizable && !n.fullscreen && ["left", "right"].includes(T), ue = (C) => tt(C, n.minWidth, typeof n.maxWidth == "number" ? n.maxWidth : void 0, w.current?.clientWidth - be * 2 || window.innerWidth), ie = (C) => {
|
|
141
|
+
!u.current || u.current.id !== C.pointerId || (cancelAnimationFrame(x.current), d(u.current.width), e.current?.style.removeProperty("--pmn-drag-width"), u.current = null);
|
|
142
|
+
};
|
|
143
|
+
return Xn(/* @__PURE__ */ i(
|
|
129
144
|
"div",
|
|
130
145
|
{
|
|
131
|
-
ref:
|
|
132
|
-
className: `pmn-overlay ${
|
|
133
|
-
style: { padding:
|
|
134
|
-
onMouseDown: (
|
|
135
|
-
|
|
146
|
+
ref: w,
|
|
147
|
+
className: `pmn-overlay ${o ? "pmn-exiting" : "pmn-entering"} ${n.animation === !1 ? "pmn-no-animation" : ""} pmn-place-${T} ${n.fullscreen ? "pmn-fullscreen" : ""} ${n.mobileFullscreen ? "pmn-mobile-fullscreen" : ""}`,
|
|
148
|
+
style: { padding: be, ...n.bottom != null ? { paddingBottom: Te(n.bottom) } : {}, ...n.left != null ? { paddingLeft: Te(n.left) } : {}, ...n.right != null ? { paddingRight: Te(n.right) } : {}, ..._ !== null ? { paddingTop: _, "--pmn-top-offset": _ } : {}, "--pmn-animation-duration": `${Math.min(1e3, Math.max(0, Number(n.animationDuration ?? 220) || 0))}ms` },
|
|
149
|
+
onMouseDown: (C) => {
|
|
150
|
+
C.target === C.currentTarget && n.closeOnOverlay === !0 && s.current("overlay");
|
|
136
151
|
},
|
|
137
|
-
children: /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ Ce(
|
|
138
153
|
"section",
|
|
139
154
|
{
|
|
140
155
|
ref: e,
|
|
@@ -142,896 +157,1170 @@ function En({ dialogRef: e, options: n, requestClose: r, children: t, exiting: c
|
|
|
142
157
|
role: "dialog",
|
|
143
158
|
"aria-modal": "true",
|
|
144
159
|
"aria-label": n.ariaLabel ?? "Dialog",
|
|
145
|
-
"data-modal-theme":
|
|
146
|
-
className: `pmn-dialog ${
|
|
147
|
-
style: { "--pmn-width":
|
|
148
|
-
children:
|
|
160
|
+
"data-modal-theme": j,
|
|
161
|
+
className: `pmn-dialog ${j === "dark" ? "dark" : ""} ${Y ? "pmn-has-custom-background" : ""} ${n.className ?? ""}`,
|
|
162
|
+
style: { "--pmn-width": $, "--pmn-gap": `${be}px`, ..._ !== null ? { "--pmn-top-offset": _ } : {}, ...Q !== void 0 ? { "--pmn-height": Q } : {}, ...X !== void 0 ? { "--pmn-max-height": X } : {}, ...ne !== void 0 ? { "--pmn-max-width": ne } : {}, borderRadius: le },
|
|
163
|
+
children: [
|
|
164
|
+
Y && /* @__PURE__ */ i("div", { "aria-hidden": "true", className: `pmn-custom-background-layer ${L}`, style: P ? { backgroundColor: P } : void 0 }),
|
|
165
|
+
r,
|
|
166
|
+
W && /* @__PURE__ */ i(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
role: "separator",
|
|
170
|
+
"aria-label": "调整弹窗宽度",
|
|
171
|
+
"aria-orientation": "vertical",
|
|
172
|
+
tabIndex: 0,
|
|
173
|
+
className: `pmn-resize-handle pmn-resize-${T}`,
|
|
174
|
+
onKeyDown: (C) => {
|
|
175
|
+
["ArrowLeft", "ArrowRight"].includes(C.key) && (C.preventDefault(), d(ue(e.current.getBoundingClientRect().width + (C.key === "ArrowRight" ? 16 : -16) * (T === "left" ? 1 : -1))));
|
|
176
|
+
},
|
|
177
|
+
onPointerDown: (C) => {
|
|
178
|
+
if (C.button !== 0) return;
|
|
179
|
+
C.preventDefault(), C.currentTarget.setPointerCapture(C.pointerId);
|
|
180
|
+
const R = e.current.getBoundingClientRect().width;
|
|
181
|
+
u.current = { id: C.pointerId, x: C.clientX, start: R, width: R };
|
|
182
|
+
},
|
|
183
|
+
onPointerMove: (C) => {
|
|
184
|
+
const R = u.current;
|
|
185
|
+
!R || R.id !== C.pointerId || (R.width = ue(R.start + (C.clientX - R.x) * (T === "left" ? 1 : -1)), cancelAnimationFrame(x.current), x.current = requestAnimationFrame(() => e.current?.style.setProperty("--pmn-drag-width", `${R.width}px`)));
|
|
186
|
+
},
|
|
187
|
+
onPointerUp: ie,
|
|
188
|
+
onPointerCancel: ie,
|
|
189
|
+
onLostPointerCapture: ie
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
]
|
|
149
193
|
}
|
|
150
194
|
)
|
|
151
195
|
}
|
|
152
196
|
), document.body);
|
|
153
197
|
}
|
|
154
|
-
|
|
155
|
-
|
|
198
|
+
const ct = (e) => e;
|
|
199
|
+
function ke(e, n = ct, t = Object.is) {
|
|
200
|
+
const r = k({ store: null, initialized: !1, selection: void 0 }), o = F(() => {
|
|
201
|
+
let p = !1, h, l;
|
|
202
|
+
return () => {
|
|
203
|
+
const d = e.getSnapshot();
|
|
204
|
+
if (p && Object.is(h, d)) return l;
|
|
205
|
+
const u = n(d);
|
|
206
|
+
if (p)
|
|
207
|
+
t(l, u) || (l = u);
|
|
208
|
+
else {
|
|
209
|
+
const x = r.current;
|
|
210
|
+
l = x.initialized && x.store === e && t(x.selection, u) ? x.selection : u;
|
|
211
|
+
}
|
|
212
|
+
return h = d, p = !0, l;
|
|
213
|
+
};
|
|
214
|
+
}, [e, n, t]), g = Ee(e.subscribe, o, o);
|
|
215
|
+
return H(() => {
|
|
216
|
+
r.current = { store: e, initialized: !0, selection: g };
|
|
217
|
+
}, [e, g]), g;
|
|
218
|
+
}
|
|
219
|
+
function ze(e, n) {
|
|
220
|
+
if (Object.is(e, n)) return !0;
|
|
221
|
+
if (!e || !n || typeof e != "object" || typeof n != "object") return !1;
|
|
222
|
+
const t = Object.keys(e);
|
|
223
|
+
return t.length === Object.keys(n).length && t.every((r) => Object.hasOwn(n, r) && Object.is(e[r], n[r]));
|
|
224
|
+
}
|
|
225
|
+
const Ke = (e) => (n) => Object.fromEntries(e.map((t) => [t, n[t]])), lt = Ke(["pageAnimationDuration", "pageAnimationDistance", "pageAnimation", "animation", "lockCloseWhileLoading", "maxCachedScreens", "bodyClassName", "lazyFallback", "onBlur", "onNavigate", "onRouteChange", "onFocus"]), ut = Ke(["bodyClassName", "lazyFallback"]), dt = Ke(["showHeader", "showTitle", "renderHeader", "renderHeaderRight", "showHeaderBorder", "headerClassName", "showBackButton", "showCloseButton"]), jn = Ke(["showFooter", "renderFooter", "done", "cancel", "cancle", "showFooterBorder", "footerClassName", "actions", "loadingText", "cancelText", "doneText", "doneDisabled"]), mt = Ke(["fullscreenable", "fullscreen"]), Sn = ["responsive", "width", "height", "maxWidth", "maxHeight", "minWidth", "size", "placement", "viewportGap", "top", "bottom", "left", "right", "borderRadius", "resizable", "fullscreen", "mobileFullscreen", "animation", "animationDuration", "closeOnEsc", "closeOnOverlay", "theme", "backgroundColor", "backgroudColor", "ariaLabel", "className"], pt = Ke(Sn);
|
|
226
|
+
function ft(e, n) {
|
|
227
|
+
const t = { ...e, ...n, ...e.runtimeLayout };
|
|
228
|
+
return { ...pt(t), runtimeLayout: Object.fromEntries(Sn.filter((r) => Object.hasOwn(e.runtimeLayout ?? {}, r)).map((r) => [r, e.runtimeLayout[r]])) };
|
|
156
229
|
}
|
|
157
|
-
function
|
|
230
|
+
function gt(e, n) {
|
|
231
|
+
return ze(e.runtimeLayout, n.runtimeLayout) && Sn.every((t) => Object.is(e[t], n[t]));
|
|
232
|
+
}
|
|
233
|
+
const qn = {}, ht = () => qn, yt = () => () => {
|
|
234
|
+
}, bt = fe.memo(function({ action: n, context: t }) {
|
|
235
|
+
const r = k(!1), [o, g] = xe(!1), p = k(!1);
|
|
236
|
+
return H(() => (p.current = !0, () => {
|
|
237
|
+
p.current = !1;
|
|
238
|
+
}), []), /* @__PURE__ */ i("button", { type: "button", className: "pmn-icon-button", "aria-label": n.tooltip ?? n.key, title: n.tooltip, disabled: o || n.disabled || n.loading, onClick: async () => {
|
|
239
|
+
if (!(r.current || !p.current || n.disabled || n.loading)) {
|
|
240
|
+
r.current = !0, g(!0);
|
|
241
|
+
try {
|
|
242
|
+
await n.onClick?.(t);
|
|
243
|
+
} catch (h) {
|
|
244
|
+
console.error("[react-modal-navigation] header action", h);
|
|
245
|
+
} finally {
|
|
246
|
+
r.current = !1, p.current && g(!1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}, children: o ? "…" : n.icon ?? n.label });
|
|
250
|
+
});
|
|
251
|
+
function Pn({ back: e }) {
|
|
252
|
+
return /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "2", children: e ? /* @__PURE__ */ i("path", { d: "m15 18-6-6 6-6" }) : /* @__PURE__ */ i("path", { d: "M18 6 6 18M6 6l12 12" }) });
|
|
253
|
+
}
|
|
254
|
+
function vt({ options: e, screen: n, route: t, navigation: r, requestClose: o, translate: g, canGoBack: p }) {
|
|
255
|
+
const h = V(tn), l = () => h?.getSnapshot()[t.key] ?? qn, d = Ee(h?.subscribe ?? yt, l, ht);
|
|
256
|
+
n = { ...n, ...d };
|
|
257
|
+
const u = g ?? ((M) => M), x = n.showTitle ?? e.showTitle ?? !0, w = typeof n.title == "function" ? n.title({ t: u, route: t, navigation: r }) : n.title ?? t.name, b = F(() => ({ route: t, navigation: r, close: o, canGoBack: p, title: w, t: u }), [t, r, o, p, w, u]);
|
|
158
258
|
if (e.showHeader === !1) return null;
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
(n.showBackButton ?? e.showBackButton) !== !1 && p && /* @__PURE__ */
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
259
|
+
const s = n.renderHeader ?? e.renderHeader;
|
|
260
|
+
if (s) return s(b);
|
|
261
|
+
const m = n.renderHeaderRight ?? e.renderHeaderRight;
|
|
262
|
+
return /* @__PURE__ */ Ce("header", { className: `pmn-header ${n.showHeaderBorder ?? e.showHeaderBorder ? "pmn-border-bottom" : ""} ${e.headerClassName ?? ""}`, children: [
|
|
263
|
+
(n.showBackButton ?? e.showBackButton) !== !1 && p && /* @__PURE__ */ i("button", { type: "button", className: "pmn-icon-button", "aria-label": u("modal.back"), onClick: () => r.goBack(), children: /* @__PURE__ */ i(Pn, { back: !0 }) }),
|
|
264
|
+
x ? /* @__PURE__ */ i("h2", { children: w }) : /* @__PURE__ */ i("div", { className: "pmn-header-spacer" }),
|
|
265
|
+
m?.(b),
|
|
266
|
+
d.actions?.filter((M) => !M.hidden).map((M) => /* @__PURE__ */ i(bt, { action: M, context: b }, `${t.key}:${M.key}`)),
|
|
267
|
+
/* @__PURE__ */ i(wt, { hidden: n.showFullscreenButton === !1 }),
|
|
268
|
+
(n.showCloseButton ?? e.showCloseButton) !== !1 && /* @__PURE__ */ i("button", { type: "button", className: "pmn-icon-button", "aria-label": u("modal.close"), onClick: () => o("header"), children: /* @__PURE__ */ i(Pn, {}) })
|
|
167
269
|
] });
|
|
168
270
|
}
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
271
|
+
const wt = fe.memo(function({ hidden: n }) {
|
|
272
|
+
const t = V(wn), r = V(kn), o = ke(r.stores.layout, mt, ze);
|
|
273
|
+
return n || !o.fullscreenable ? null : /* @__PURE__ */ i("button", { type: "button", className: "pmn-icon-button", "aria-label": o.fullscreen ? "还原" : "全屏", onClick: t?.toggleFullscreen, children: /* @__PURE__ */ i("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ i("path", { d: o.fullscreen ? "M3 9h6V3 M21 9h-6V3 M3 15h6v6 M21 15h-6v6" : "M3 9V3h6 M15 3h6v6 M3 15v6h6 M15 21h6v-6" }) }) });
|
|
274
|
+
}), $n = Ue(function({ store: n, screenOptions: t, ...r }) {
|
|
275
|
+
const o = K((p) => ft(p, t), [t]), g = ke(n, o, gt);
|
|
276
|
+
return /* @__PURE__ */ i(it, { ...r, options: g });
|
|
277
|
+
}), In = Ue(function({ store: n, ...t }) {
|
|
278
|
+
const r = ke(n, dt, ze);
|
|
279
|
+
return /* @__PURE__ */ i(vt, { ...t, options: r });
|
|
280
|
+
}), xt = fe.memo(function({ action: n, context: t, loadingApi: r, onError: o, loadingText: g }) {
|
|
281
|
+
const p = k(!1), [h, l] = xe(!1), d = k(!1);
|
|
282
|
+
H(() => (d.current = !0, () => {
|
|
172
283
|
d.current = !1;
|
|
173
284
|
}), []);
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const F = Array.isArray(a.actions) ? a.actions : null;
|
|
179
|
-
if (!F && typeof D != "function" && typeof x != "function") return null;
|
|
180
|
-
const M = async (b, P, W) => {
|
|
181
|
-
if (k.current.has(b) || typeof P != "function") return;
|
|
182
|
-
k.current.add(b), C(b);
|
|
183
|
-
const U = u?.begin(t.key, W ?? a.loadingText ?? m("modal.processing"));
|
|
285
|
+
const u = h || n.loading === !0, x = n.loadingText ?? g ?? t.t("modal.processing"), w = async () => {
|
|
286
|
+
if (!d.current || p.current || n.disabled || n.loading || typeof n.onClick != "function") return;
|
|
287
|
+
p.current = !0, l(!0);
|
|
288
|
+
const b = r?.begin(t.route.key, x);
|
|
184
289
|
try {
|
|
185
|
-
await
|
|
186
|
-
} catch (
|
|
187
|
-
|
|
290
|
+
await n.onClick(t);
|
|
291
|
+
} catch (s) {
|
|
292
|
+
o?.(s, { phase: "footer", action: n.key, route: t.route });
|
|
188
293
|
} finally {
|
|
189
|
-
|
|
294
|
+
b != null && r?.end(t.route.key, b), p.current = !1, d.current && l(!1);
|
|
190
295
|
}
|
|
191
296
|
};
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"button",
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
297
|
+
return /* @__PURE__ */ i(
|
|
298
|
+
"button",
|
|
299
|
+
{
|
|
300
|
+
type: "button",
|
|
301
|
+
disabled: n.disabled === !0 || u,
|
|
302
|
+
className: `pmn-button ${n.variant === "primary" || n.variant === "danger" ? "pmn-button-primary" : "pmn-button-secondary"} ${n.variant === "danger" ? "pmn-button-danger" : ""}`,
|
|
303
|
+
onClick: w,
|
|
304
|
+
children: u ? x : n.label
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
});
|
|
308
|
+
function Dn({ screen: e, options: n, override: t, route: r, navigation: o, requestClose: g, translate: p, onError: h, loadingApi: l }) {
|
|
309
|
+
const [d, u] = xe(null), x = k(/* @__PURE__ */ new Set()), w = k(!0);
|
|
310
|
+
H(() => (w.current = !0, () => {
|
|
311
|
+
w.current = !1;
|
|
312
|
+
}), []);
|
|
313
|
+
const b = p ?? (($) => $), s = { ...n, ...e, ...t }, { showFooter: m, renderFooter: M, done: I, cancel: j, cancle: q } = s, O = j ?? q, P = F(() => ({ route: r, navigation: o, close: g, t: b }), [r, o, g, b]);
|
|
314
|
+
if (m === !1) return null;
|
|
315
|
+
const L = `pmn-footer ${s.showFooterBorder ? "pmn-border-top" : ""} ${s.footerClassName ?? ""}`;
|
|
316
|
+
if (typeof M == "function") return /* @__PURE__ */ i("footer", { className: L, children: M({ ...P, pending: x.current.size > 0 }) });
|
|
317
|
+
const Y = Array.isArray(s.actions) ? s.actions : null;
|
|
318
|
+
if (!Y && typeof I != "function" && typeof O != "function") return null;
|
|
319
|
+
const T = async ($, Q, X) => {
|
|
320
|
+
if (!w.current || x.current.size > 0 || x.current.has($) || typeof Q != "function") return;
|
|
321
|
+
x.current.add($), u($);
|
|
322
|
+
const ne = l?.begin(r.key, s.loadingText ?? b("modal.processing"));
|
|
323
|
+
try {
|
|
324
|
+
await Q(P);
|
|
325
|
+
} catch (oe) {
|
|
326
|
+
h?.(oe, { phase: "footer", action: $, route: r });
|
|
327
|
+
} finally {
|
|
328
|
+
ne != null && l?.end(r.key, ne), x.current.delete($), w.current && u((oe) => oe === $ ? null : oe);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
return Y ? /* @__PURE__ */ i("footer", { className: L, children: Y.filter(($) => !$.hidden).map(
|
|
332
|
+
($) => /* @__PURE__ */ i(xt, { action: $, context: P, loadingApi: l, onError: h, loadingText: s.loadingText }, `${r.key}:${$.key}`)
|
|
333
|
+
) }) : /* @__PURE__ */ Ce("footer", { className: L, children: [
|
|
334
|
+
typeof O == "function" && /* @__PURE__ */ i("button", { type: "button", disabled: d !== null, onClick: () => T("cancel", O), className: "pmn-button pmn-button-secondary", children: s.cancelText ?? b("modal.cancel") }),
|
|
335
|
+
typeof I == "function" && /* @__PURE__ */ i("button", { type: "button", disabled: d !== null || s.doneDisabled === !0, onClick: () => T("done", I), className: "pmn-button pmn-button-primary", children: d === "done" ? s.loadingText ?? b("modal.processing") : s.doneText ?? b("modal.done") })
|
|
208
336
|
] });
|
|
209
337
|
}
|
|
210
|
-
function
|
|
338
|
+
function Kn({ loading: e, translate: n }) {
|
|
211
339
|
if (!e.visible) return null;
|
|
212
|
-
const
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
|
|
340
|
+
const r = (n ?? ((g) => g))("modal.loading"), o = e.text ?? (r === "modal.loading" ? "加载中..." : r);
|
|
341
|
+
return /* @__PURE__ */ i("div", { className: "pmn-loading-overlay", role: "status", "aria-live": "polite", "aria-busy": "true", children: /* @__PURE__ */ Ce("div", { className: "pmn-loading-content", children: [
|
|
342
|
+
/* @__PURE__ */ i("span", { className: "pmn-spinner", "aria-hidden": "true" }),
|
|
343
|
+
o && /* @__PURE__ */ i("span", { className: "pmn-loading-text", children: o })
|
|
216
344
|
] }) });
|
|
217
345
|
}
|
|
218
|
-
class
|
|
346
|
+
class Cn extends fe.Component {
|
|
219
347
|
state = { error: null };
|
|
220
348
|
static getDerivedStateFromError(n) {
|
|
221
349
|
return { error: n };
|
|
222
350
|
}
|
|
223
|
-
componentDidCatch(n,
|
|
224
|
-
this.props.onError?.(n, { phase: "render", route: this.props.route, componentStack:
|
|
351
|
+
componentDidCatch(n, t) {
|
|
352
|
+
this.props.onError?.(n, { phase: "render", route: this.props.route, componentStack: t.componentStack });
|
|
225
353
|
}
|
|
226
354
|
componentDidUpdate(n) {
|
|
227
355
|
n.route?.key !== this.props.route?.key && this.state.error && this.setState({ error: null });
|
|
228
356
|
}
|
|
229
357
|
render() {
|
|
230
|
-
return this.state.error ? /* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
358
|
+
return this.state.error ? /* @__PURE__ */ Ce("div", { role: "alert", className: "pmn-error-screen", children: [
|
|
359
|
+
/* @__PURE__ */ i("strong", { children: "页面加载失败" }),
|
|
360
|
+
/* @__PURE__ */ i("p", { children: this.state.error.message }),
|
|
361
|
+
/* @__PURE__ */ i("button", { type: "button", className: "pmn-button pmn-button-secondary", onClick: () => {
|
|
362
|
+
this.props.onRetry?.(), this.setState({ error: null });
|
|
363
|
+
}, children: "重试" })
|
|
234
364
|
] }) : this.props.children;
|
|
235
365
|
}
|
|
236
366
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
239
|
-
return e.length ? /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
|
|
243
|
-
] },
|
|
367
|
+
const kt = { success: "✓", error: "×", warning: "!", info: "i" };
|
|
368
|
+
function Hn({ items: e, dismiss: n }) {
|
|
369
|
+
return e.length ? /* @__PURE__ */ i("div", { className: "pmn-toast-region", "aria-label": "Notifications", children: e.map((t) => /* @__PURE__ */ Ce("div", { className: `pmn-toast pmn-toast-${t.type}`, role: t.type === "error" || t.type === "warning" ? "alert" : "status", children: [
|
|
370
|
+
/* @__PURE__ */ i("span", { className: "pmn-toast-symbol", "aria-hidden": "true", children: kt[t.type] }),
|
|
371
|
+
/* @__PURE__ */ i("span", { className: "pmn-toast-message", children: t.message }),
|
|
372
|
+
t.dismissible && /* @__PURE__ */ i("button", { type: "button", className: "pmn-toast-close", "aria-label": "Dismiss notification", onClick: () => n(t.id), children: "×" })
|
|
373
|
+
] }, t.id)) }) : null;
|
|
244
374
|
}
|
|
245
|
-
function
|
|
246
|
-
const r =
|
|
247
|
-
clearTimeout(
|
|
248
|
-
}, []),
|
|
249
|
-
if (typeof
|
|
250
|
-
const
|
|
375
|
+
function Wn(e, n, t) {
|
|
376
|
+
const r = k(0), o = k(/* @__PURE__ */ new Map()), g = K((l) => {
|
|
377
|
+
clearTimeout(o.current.get(l)), o.current.delete(l), n.current && e.current.publish(e.current.getSnapshot().filter((d) => d.id !== l));
|
|
378
|
+
}, []), p = K((l, d = {}) => {
|
|
379
|
+
if (typeof l != "string" || !l.trim()) throw new TypeError("[react-modal-navigation] toast message must be a non-empty string");
|
|
380
|
+
const u = typeof d == "string" ? { type: d } : d ?? {}, x = ["success", "error", "warning", "info"].includes(u.type) ? u.type : "info", w = ++r.current, b = Number.isFinite(u.duration) ? Math.max(0, u.duration) : 3e3;
|
|
251
381
|
if (!n.current) return null;
|
|
252
|
-
const
|
|
253
|
-
for (const
|
|
254
|
-
clearTimeout(
|
|
255
|
-
return e.current.publish([...
|
|
256
|
-
}, [
|
|
257
|
-
const
|
|
258
|
-
for (const
|
|
259
|
-
return
|
|
260
|
-
const
|
|
382
|
+
const s = e.current.getSnapshot(), m = s.slice(0, Math.max(0, s.length - 4));
|
|
383
|
+
for (const M of m)
|
|
384
|
+
clearTimeout(o.current.get(M.id)), o.current.delete(M.id);
|
|
385
|
+
return e.current.publish([...s.slice(-4), { id: w, message: l, type: x, dismissible: u.dismissible !== !1 }]), b > 0 && o.current.set(w, setTimeout(() => g(w), b)), w;
|
|
386
|
+
}, [g]), h = F(() => {
|
|
387
|
+
const l = (d, u) => p(d, u);
|
|
388
|
+
for (const d of ["success", "error", "warning", "info"]) l[d] = (u, x = {}) => p(u, { ...x, type: d });
|
|
389
|
+
return l.promise = async (d, u, x = {}) => {
|
|
390
|
+
const w = p(u.loading, { ...x, type: "info", duration: 0 });
|
|
261
391
|
try {
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
return
|
|
266
|
-
} catch (
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
throw
|
|
392
|
+
const b = await (typeof d == "function" ? d() : d);
|
|
393
|
+
w != null && g(w);
|
|
394
|
+
const s = typeof u.success == "function" ? u.success(b) : u.success;
|
|
395
|
+
return s && p(s, { ...x, type: "success" }), b;
|
|
396
|
+
} catch (b) {
|
|
397
|
+
w != null && g(w);
|
|
398
|
+
const s = typeof u.error == "function" ? u.error(b) : u.error;
|
|
399
|
+
throw s && p(s, { ...x, type: "error" }), b;
|
|
270
400
|
}
|
|
271
|
-
},
|
|
272
|
-
for (const
|
|
273
|
-
|
|
274
|
-
},
|
|
275
|
-
}, [
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
401
|
+
}, l.dismiss = g, l.clear = () => {
|
|
402
|
+
for (const d of o.current.values()) clearTimeout(d);
|
|
403
|
+
o.current.clear(), e.current.publish([]);
|
|
404
|
+
}, l;
|
|
405
|
+
}, [p, g]);
|
|
406
|
+
return H(() => {
|
|
407
|
+
const l = () => {
|
|
408
|
+
for (const u of o.current.values()) clearTimeout(u);
|
|
409
|
+
o.current.clear();
|
|
410
|
+
}, d = t?.addCleanup(l);
|
|
411
|
+
return () => {
|
|
412
|
+
d?.(), l();
|
|
413
|
+
};
|
|
414
|
+
}, [t]), { toast: h, dismissToast: g };
|
|
280
415
|
}
|
|
281
|
-
function
|
|
282
|
-
const
|
|
416
|
+
function Gn(e, n, t, r) {
|
|
417
|
+
const o = r.loadingTasks, g = r.loadingSequence, p = K(() => {
|
|
283
418
|
if (!n.current) return;
|
|
284
|
-
const
|
|
285
|
-
(
|
|
286
|
-
}, []),
|
|
287
|
-
if (!n.current ||
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
}, [
|
|
291
|
-
if (
|
|
292
|
-
|
|
419
|
+
const b = [...o.current.values()], s = { visible: b.length > 0, text: b.at(-1)?.text ?? null, count: b.length }, m = e.current.getSnapshot();
|
|
420
|
+
(m.visible !== s.visible || m.text !== s.text || m.count !== s.count) && e.current.publish(s);
|
|
421
|
+
}, []), h = K((b, s) => {
|
|
422
|
+
if (!n.current || b !== "global" && t.current !== b) return null;
|
|
423
|
+
const m = ++g.current;
|
|
424
|
+
return o.current.set(m, { owner: b, text: s }), p(), m;
|
|
425
|
+
}, [p]), l = K((b, s) => {
|
|
426
|
+
if (s != null)
|
|
427
|
+
o.current.get(s)?.owner === b && o.current.delete(s);
|
|
293
428
|
else
|
|
294
|
-
for (const [
|
|
295
|
-
|
|
296
|
-
}, [
|
|
297
|
-
|
|
298
|
-
}, [
|
|
299
|
-
|
|
300
|
-
}, [
|
|
301
|
-
return { loadingApi:
|
|
429
|
+
for (const [m, M] of o.current) M.owner === b && o.current.delete(m);
|
|
430
|
+
p();
|
|
431
|
+
}, [p]), d = K((b, s) => {
|
|
432
|
+
b ? (l("global"), h("global", s)) : l("global");
|
|
433
|
+
}, [h, l]), u = K((b, s, m) => {
|
|
434
|
+
s ? (l(b), h(b, m)) : l(b);
|
|
435
|
+
}, [h, l]);
|
|
436
|
+
return { loadingApi: F(() => ({ setLoading: d, setScreenLoading: u, begin: h, end: l }), [d, u, h, l]), refreshLoading: p, loadingTasks: o, setLoading: d };
|
|
302
437
|
}
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
return /* @__PURE__ */
|
|
306
|
-
}),
|
|
307
|
-
const
|
|
308
|
-
return /* @__PURE__ */
|
|
309
|
-
}),
|
|
310
|
-
const
|
|
311
|
-
return /* @__PURE__ */
|
|
312
|
-
}),
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
{ opacity: 1, transform: `translate3d(${
|
|
438
|
+
const St = fe.memo(function({ store: n, translate: t }) {
|
|
439
|
+
const r = Ee(n.subscribe, n.getSnapshot, n.getSnapshot);
|
|
440
|
+
return /* @__PURE__ */ i(Kn, { loading: r, translate: t });
|
|
441
|
+
}), Ct = fe.memo(function({ store: n, dismiss: t }) {
|
|
442
|
+
const r = Ee(n.subscribe, n.getSnapshot, n.getSnapshot);
|
|
443
|
+
return /* @__PURE__ */ i(Hn, { items: r, dismiss: t });
|
|
444
|
+
}), Et = fe.memo(function({ store: n, layoutStore: t, routeKey: r, ...o }) {
|
|
445
|
+
const g = () => n.getSnapshot()[r], p = Ee(n.subscribe, g, g), h = ke(t, jn, ze);
|
|
446
|
+
return /* @__PURE__ */ i(Dn, { ...o, options: h, override: p });
|
|
447
|
+
}), Mt = fe.memo(function({ route: n, screen: t, navigation: r, focused: o, resultEvent: g, setFooter: p, loadingApi: h, loadingStore: l, bodyClassName: d, notifyError: u, registerDirtyGuard: x, pageMotion: w, lazyFallback: b }) {
|
|
448
|
+
const s = t.component, m = k(null), M = k(!1);
|
|
449
|
+
Ie(() => {
|
|
450
|
+
const O = o && !M.current;
|
|
451
|
+
if (M.current = o, !O || !w?.enabled || !m.current?.animate) return;
|
|
452
|
+
const P = w.direction === "back" ? -100 : 100;
|
|
453
|
+
m.current.style.zIndex = "2";
|
|
454
|
+
const L = m.current.animate([
|
|
455
|
+
{ opacity: 1, transform: `translate3d(${P}%,0,0)` },
|
|
321
456
|
{ opacity: 1, transform: "translate3d(0,0,0)" }
|
|
322
|
-
], { duration:
|
|
457
|
+
], { duration: w.duration, easing: "cubic-bezier(.22,1,.36,1)" });
|
|
323
458
|
return () => {
|
|
324
|
-
|
|
459
|
+
L.cancel(), m.current && (m.current.style.zIndex = "");
|
|
325
460
|
};
|
|
326
|
-
}, [
|
|
327
|
-
const
|
|
328
|
-
setLoading: (
|
|
329
|
-
showLoading: (
|
|
330
|
-
hideLoading: (
|
|
331
|
-
}), [
|
|
332
|
-
return /* @__PURE__ */
|
|
461
|
+
}, [o, w?.enabled, w?.direction, w?.duration, w?.distance]);
|
|
462
|
+
const I = F(() => ({ isFocused: o, resultEvent: g, routeKey: n.key, setFooter: p }), [o, g, n.key, p]), j = F(() => ({
|
|
463
|
+
setLoading: (O, P) => h.setScreenLoading(n.key, O, P),
|
|
464
|
+
showLoading: (O) => h.begin(n.key, O),
|
|
465
|
+
hideLoading: (O) => h.end(n.key, O)
|
|
466
|
+
}), [h, n.key]), q = F(() => ({ routeKey: n.key, registerDirtyGuard: x }), [n.key, x]);
|
|
467
|
+
return /* @__PURE__ */ i(sn.Provider, { value: n, children: /* @__PURE__ */ i(bn.Provider, { value: q, children: /* @__PURE__ */ i(Ve.Provider, { value: I, children: /* @__PURE__ */ i(De.Provider, { value: j, children: /* @__PURE__ */ i(an.Provider, { value: l, children: /* @__PURE__ */ i("div", { ref: m, hidden: !o, inert: !o, "data-modal-route-key": n.key, tabIndex: -1, className: `pmn-body ${o && w?.enabled && typeof Element < "u" && !Element.prototype.animate ? `pmn-page-enter pmn-page-${w.direction}` : ""} ${d ?? ""}`, style: o && w?.enabled ? { "--pmn-page-duration": `${w.duration}ms`, "--pmn-page-distance": `${w.distance}px` } : void 0, children: /* @__PURE__ */ i(Cn, { route: n, onError: u, children: /* @__PURE__ */ i(Ln, { fallback: b ?? /* @__PURE__ */ i("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ i(s, { route: n, navigation: r }) }) }) }) }) }) }) }) });
|
|
333
468
|
});
|
|
334
|
-
function
|
|
335
|
-
const [
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (S === null) {
|
|
360
|
-
if (!(o in z)) return;
|
|
361
|
-
const I = { ...z };
|
|
362
|
-
delete I[o], q.current.publish(I);
|
|
469
|
+
function Rt({ runtime: e, config: n, initialScreen: t, params: r, translate: o, onRequestClose: g, onOpened: p, registerLoading: h, notifyError: l, error: d, clearError: u, registerDirtyGuard: x, canNavigate: w, exiting: b = !1 }) {
|
|
470
|
+
const s = ke(e.stores.layout, lt, ze), [m, M] = Qn(Xe, e.stores.navigation.getSnapshot().stack), { navigation: I, loading: j, footer: q, toast: O } = e.refs, P = e.alive, L = k(0), { toast: Y, dismissToast: T } = Wn(O, P, e);
|
|
471
|
+
H(() => () => {
|
|
472
|
+
L.current++;
|
|
473
|
+
}, []);
|
|
474
|
+
const [$, Q] = xe({}), X = k(/* @__PURE__ */ new Map()), ne = k(null), oe = k(null), be = k(null), z = k(null), _ = k(null), le = k(!1), W = k(!1), ue = e.pageRequests, ie = k(0), C = K((c, E, D) => {
|
|
475
|
+
for (const [G, me] of ue.current)
|
|
476
|
+
c.includes(me.key) && (ue.current.delete(G), me.resolve({ status: E, ...E === "returned" ? { value: D } : {} }));
|
|
477
|
+
}, []), R = k(m);
|
|
478
|
+
R.current = m;
|
|
479
|
+
const de = k(w);
|
|
480
|
+
de.current = w;
|
|
481
|
+
const ge = k(!1), te = k(0), A = m.at(-1), y = A.key, U = k({ key: y, depth: m.length }), ve = U.current, we = ve.key !== y, Be = m.length < ve.depth ? "back" : "forward";
|
|
482
|
+
we && (U.current = { key: y, depth: m.length });
|
|
483
|
+
const Ye = Math.min(1e3, Math.max(0, Number(s.pageAnimationDuration ?? 360) || 0)), cn = Math.min(300, Math.max(0, Number(s.pageAnimationDistance ?? 96) || 0)), Re = F(() => ({ distance: cn, enabled: s.pageAnimation !== !1 && s.animation !== !1 && Ye > 0 && we, direction: Be, duration: Ye }), [cn, s.pageAnimation, s.animation, Ye, we, Be]), ln = k(y);
|
|
484
|
+
ln.current = y;
|
|
485
|
+
const { loadingApi: Qe, refreshLoading: un, loadingTasks: Ze, setLoading: Fe } = Gn(j, P, ln, e), Se = n.screens, Me = j, je = k(h);
|
|
486
|
+
je.current = h, H(() => (je.current?.({ setLoading: Fe }), () => je.current?.(null)), [Fe]);
|
|
487
|
+
const En = K((c, E) => {
|
|
488
|
+
if (!P.current) return;
|
|
489
|
+
const D = q.current.getSnapshot();
|
|
490
|
+
if (E === null) {
|
|
491
|
+
if (!(c in D)) return;
|
|
492
|
+
const G = { ...D };
|
|
493
|
+
delete G[c], q.current.publish(G);
|
|
363
494
|
return;
|
|
364
495
|
}
|
|
365
|
-
|
|
366
|
-
}, []),
|
|
496
|
+
D[c] !== E && q.current.publish({ ...D, [c]: E });
|
|
497
|
+
}, []), dn = K(() => {
|
|
367
498
|
if (typeof document > "u") return;
|
|
368
|
-
const
|
|
369
|
-
if (!(
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
}, []),
|
|
373
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
374
|
-
}, [
|
|
499
|
+
const c = document.activeElement;
|
|
500
|
+
if (!(c instanceof HTMLElement) || !ne.current?.contains(c)) return;
|
|
501
|
+
const E = c.closest("[data-modal-route-key]");
|
|
502
|
+
E && X.current.set(E.dataset.modalRouteKey, c), ne.current.focus({ preventScroll: !0 });
|
|
503
|
+
}, []), mn = K((c) => {
|
|
504
|
+
if (!Object.prototype.hasOwnProperty.call(Se, c)) throw new Error(`[react-modal-navigation] Unknown modal screen: ${c}`);
|
|
505
|
+
}, [Se]), a = K((c, E) => {
|
|
375
506
|
try {
|
|
376
|
-
Promise.resolve(
|
|
377
|
-
} catch (
|
|
378
|
-
|
|
507
|
+
Promise.resolve(s[c]?.(E)).catch((D) => l(D, { phase: c }));
|
|
508
|
+
} catch (D) {
|
|
509
|
+
l(D, { phase: c });
|
|
379
510
|
}
|
|
380
|
-
}, [
|
|
381
|
-
if (!
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
const
|
|
385
|
-
|
|
511
|
+
}, [s, l]), f = K(async (c, E, D, G) => {
|
|
512
|
+
if (!P.current || W.current) return !1;
|
|
513
|
+
const me = L.current, Z = R.current, pe = Z.at(-1);
|
|
514
|
+
if (c !== "BACK" && mn(E), c === "BACK" && Z.length <= 1) return !1;
|
|
515
|
+
const Mn = c === "NAVIGATE" ? Z.findIndex((We) => We.name === E) : -1, pn = c === "RESET" ? Z : c === "BACK" || c === "REPLACE" ? [pe] : Mn >= 0 ? Z.slice(Mn + 1) : [];
|
|
516
|
+
W.current = !0;
|
|
386
517
|
try {
|
|
387
|
-
if (
|
|
518
|
+
if (pn.length && de.current && !await de.current(pn.map((fn) => fn.key), {
|
|
388
519
|
reason: "navigation",
|
|
389
|
-
action:
|
|
390
|
-
from:
|
|
391
|
-
to:
|
|
392
|
-
}) || !
|
|
393
|
-
if (
|
|
394
|
-
const
|
|
395
|
-
|
|
520
|
+
action: c,
|
|
521
|
+
from: pe,
|
|
522
|
+
to: c === "BACK" ? Z.at(-2)?.name : E
|
|
523
|
+
}) || !P.current || me !== L.current || R.current.at(-1)?.key !== pe.key) return !1;
|
|
524
|
+
if (c === "BACK" && G !== void 0) {
|
|
525
|
+
const $e = Z.at(-2);
|
|
526
|
+
Q((fn) => ({ ...fn, [$e.key]: { id: ++te.current, data: G } }));
|
|
396
527
|
}
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
return
|
|
402
|
-
} catch (
|
|
403
|
-
return
|
|
528
|
+
c === "RESET" && Q({}), C(pn.map(($e) => $e.key), c === "BACK" ? "returned" : "removed", G);
|
|
529
|
+
const We = [...oe.current?.querySelectorAll("[data-modal-route-key]") ?? []].find(($e) => $e.dataset.modalRouteKey === pe.key);
|
|
530
|
+
be.current = We?.cloneNode(!0) ?? null, dn();
|
|
531
|
+
const Yn = { type: c, name: E, params: D };
|
|
532
|
+
return R.current = Xe(R.current, Yn), M({ type: "COMMIT", stack: R.current }), !0;
|
|
533
|
+
} catch (We) {
|
|
534
|
+
return P.current && l(We, { phase: "navigationGuard", action: c }), !1;
|
|
404
535
|
} finally {
|
|
405
|
-
|
|
536
|
+
W.current = !1;
|
|
406
537
|
}
|
|
407
|
-
}, [
|
|
408
|
-
if (!
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
411
|
-
return !
|
|
412
|
-
const
|
|
413
|
-
|
|
538
|
+
}, [mn, dn, l, C]), S = K((c, E) => f("NAVIGATE", c, E), [f]), v = K(async (c, E) => {
|
|
539
|
+
if (!P.current) return { status: "cancelled" };
|
|
540
|
+
if (R.current, !await f("NAVIGATE", c, E) || !P.current) return { status: "cancelled" };
|
|
541
|
+
const G = R.current.at(-1);
|
|
542
|
+
return !G || G.name !== c ? { status: "cancelled" } : new Promise((me) => {
|
|
543
|
+
const Z = ++ie.current;
|
|
544
|
+
ue.current.set(Z, { key: G.key, resolve: me });
|
|
414
545
|
});
|
|
415
|
-
}, [
|
|
416
|
-
if (!
|
|
417
|
-
if (!
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
}, []),
|
|
421
|
-
if (!
|
|
422
|
-
if (!
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
}, []),
|
|
426
|
-
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
canGoBack: { enumerable: !0, get: () =>
|
|
432
|
-
stack: { enumerable: !0, get: () =>
|
|
433
|
-
currentRoute: { enumerable: !0, get: () =>
|
|
546
|
+
}, [f]), B = K((c, E) => f("REPLACE", c, E), [f]), N = K((c, E) => f("RESET", c, E), [f]), J = K((c) => {
|
|
547
|
+
if (!c || typeof c != "object" || Array.isArray(c)) throw new TypeError("[react-modal-navigation] setParams expects an object");
|
|
548
|
+
if (!P.current) return;
|
|
549
|
+
const E = { type: "SET_PARAMS", params: c };
|
|
550
|
+
R.current = Xe(R.current, E), M({ type: "COMMIT", stack: R.current });
|
|
551
|
+
}, []), ce = K((c) => {
|
|
552
|
+
if (!c || typeof c != "object" || Array.isArray(c)) throw new TypeError("[react-modal-navigation] setOptions expects an object");
|
|
553
|
+
if (!P.current) return;
|
|
554
|
+
const E = { type: "SET_OPTIONS", options: c };
|
|
555
|
+
R.current = Xe(R.current, E), M({ type: "COMMIT", stack: R.current });
|
|
556
|
+
}, []), ee = K((c) => f("BACK", null, void 0, c), [f]), he = K((c, E) => !P.current || Me.current.getSnapshot().visible && s.lockCloseWhileLoading !== !1 ? Promise.resolve(!1) : g(c, E, { route: A, stack: m }), [s.lockCloseWhileLoading, g, A, m]), qe = k(he);
|
|
557
|
+
qe.current = he;
|
|
558
|
+
const ae = K((c) => qe.current("api", c), []), Le = F(() => ({ navigate: S, navigateAsync: v, replace: B, reset: N, setParams: J, setOptions: ce, goBack: ee, close: ae, setLoading: Fe }), [S, v, B, N, J, ce, ee, ae, Fe]), He = F(() => ({ canGoBack: m.length > 1, stack: m, currentRoute: A }), [m]);
|
|
559
|
+
Ie(() => I.current.publish(He), [He]);
|
|
560
|
+
const ye = k(null);
|
|
561
|
+
ye.current || (ye.current = Object.defineProperties({}, {
|
|
562
|
+
canGoBack: { enumerable: !0, get: () => I.current.getSnapshot().canGoBack },
|
|
563
|
+
stack: { enumerable: !0, get: () => I.current.getSnapshot().stack },
|
|
564
|
+
currentRoute: { enumerable: !0, get: () => I.current.getSnapshot().currentRoute }
|
|
434
565
|
}));
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
|
|
566
|
+
const re = F(() => Object.assign(ye.current, Le), [Le]);
|
|
567
|
+
Ie(() => {
|
|
568
|
+
const c = be.current;
|
|
569
|
+
if (be.current = null, z.current?.cancel?.(), z.current = null, oe.current?.querySelectorAll("[data-pmn-outgoing]").forEach((pe) => pe.remove()), !we || !Re.enabled || !c || !oe.current || typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
|
|
570
|
+
const E = oe.current;
|
|
571
|
+
c.removeAttribute("hidden"), c.removeAttribute("tabindex"), c.setAttribute("aria-hidden", "true"), c.setAttribute("inert", ""), c.dataset.pmnOutgoing = "true", c.querySelectorAll("[id]").forEach((pe) => pe.removeAttribute("id")), c.querySelectorAll("[autofocus]").forEach((pe) => pe.removeAttribute("autofocus")), c.style.cssText += ";position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none;overflow:hidden;background:var(--pmn-body);", E.appendChild(c);
|
|
572
|
+
const D = Re.direction === "back" ? 1 : -1, G = [...E.querySelectorAll("[data-modal-route-key]")].find((pe) => pe.dataset.modalRouteKey === y);
|
|
573
|
+
G && (G.style.zIndex = "2");
|
|
574
|
+
const me = () => {
|
|
575
|
+
c.remove(), G && (G.style.zIndex = ""), z.current === Z && (z.current = null);
|
|
445
576
|
};
|
|
446
|
-
let
|
|
447
|
-
if (
|
|
448
|
-
|
|
577
|
+
let Z;
|
|
578
|
+
if (c.animate)
|
|
579
|
+
Z = c.animate([
|
|
449
580
|
{ opacity: 1, transform: "translate3d(0,0,0)" },
|
|
450
|
-
{ opacity: 1, transform: `translate3d(${
|
|
451
|
-
], { duration:
|
|
581
|
+
{ opacity: 1, transform: `translate3d(${D * 100}%,0,0)` }
|
|
582
|
+
], { duration: Re.duration, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }), Z.addEventListener("finish", me, { once: !0 }), Z.addEventListener("cancel", me, { once: !0 }), z.current = Z;
|
|
452
583
|
else {
|
|
453
|
-
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
clearTimeout(
|
|
457
|
-
} },
|
|
584
|
+
c.classList.add("pmn-page-exit", `pmn-page-exit-${Re.direction}`), c.style.setProperty("--pmn-page-duration", `${Re.duration}ms`), c.style.setProperty("--pmn-page-distance", "100%");
|
|
585
|
+
const pe = setTimeout(me, Re.duration + 40);
|
|
586
|
+
Z = { cancel: () => {
|
|
587
|
+
clearTimeout(pe), me();
|
|
588
|
+
} }, z.current = Z;
|
|
458
589
|
}
|
|
459
590
|
return () => {
|
|
460
|
-
|
|
591
|
+
Z?.cancel?.(), c.remove();
|
|
461
592
|
};
|
|
462
|
-
}, [
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
if (!
|
|
466
|
-
const
|
|
467
|
-
(
|
|
468
|
-
}, [
|
|
469
|
-
let
|
|
470
|
-
for (const [
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
if (!
|
|
477
|
-
const
|
|
478
|
-
return
|
|
593
|
+
}, [y]), Ie(() => {
|
|
594
|
+
le.current = !1;
|
|
595
|
+
const c = [...ne.current?.querySelectorAll("[data-modal-route-key]") ?? []].find((G) => G.dataset.modalRouteKey === y);
|
|
596
|
+
if (!c) return;
|
|
597
|
+
const E = X.current.get(y);
|
|
598
|
+
(E?.isConnected && c.contains(E) && !E.matches(":disabled") && !E.closest("[inert], [hidden]") ? E : c).focus({ preventScroll: !0 });
|
|
599
|
+
}, [y]), H(() => {
|
|
600
|
+
let c = !1;
|
|
601
|
+
for (const [D, G] of Ze.current)
|
|
602
|
+
G.owner !== "global" && G.owner !== y && (Ze.current.delete(D), c = !0);
|
|
603
|
+
c && un();
|
|
604
|
+
const E = new Set(m.map((D) => D.key));
|
|
605
|
+
Q((D) => {
|
|
606
|
+
const G = Object.keys(D).filter((Z) => !E.has(Z));
|
|
607
|
+
if (!G.length) return D;
|
|
608
|
+
const me = { ...D };
|
|
609
|
+
return G.forEach((Z) => delete me[Z]), me;
|
|
479
610
|
});
|
|
480
|
-
for (const
|
|
481
|
-
}, [
|
|
482
|
-
if (
|
|
483
|
-
if (
|
|
484
|
-
const
|
|
485
|
-
|
|
611
|
+
for (const D of X.current.keys()) E.has(D) || X.current.delete(D);
|
|
612
|
+
}, [y, m, un]), H(() => {
|
|
613
|
+
if (_.current?.key !== y) {
|
|
614
|
+
if (_.current) {
|
|
615
|
+
const c = { from: _.current, to: A, stack: m };
|
|
616
|
+
a("onBlur", { route: _.current, ...c }), a("onNavigate", c), a("onRouteChange", c);
|
|
486
617
|
}
|
|
487
|
-
|
|
618
|
+
a("onFocus", { route: A, stack: m }), _.current = A;
|
|
488
619
|
}
|
|
489
|
-
}, [
|
|
490
|
-
|
|
491
|
-
for (const
|
|
492
|
-
|
|
493
|
-
}, []),
|
|
494
|
-
|
|
620
|
+
}, [A, y, m, a]), H(() => () => {
|
|
621
|
+
Ze.current.clear(), X.current.clear();
|
|
622
|
+
for (const c of ue.current.values()) c.resolve({ status: "dismissed" });
|
|
623
|
+
ue.current.clear();
|
|
624
|
+
}, []), H(() => {
|
|
625
|
+
ge.current || (ge.current = !0, p?.({ route: A, stack: m }));
|
|
495
626
|
}, []);
|
|
496
|
-
const
|
|
497
|
-
return /* @__PURE__ */
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
|
|
627
|
+
const Pe = F(() => et(m, Se, s.maxCachedScreens), [m, Se, s.maxCachedScreens]), Ae = F(() => ({ ...Se[A.name], ...A.options ?? {} }), [Se, A.name, A.options]), Vn = e.refs.header;
|
|
628
|
+
return /* @__PURE__ */ i(tn.Provider, { value: Vn.current, children: /* @__PURE__ */ i(vn.Provider, { value: Y, children: /* @__PURE__ */ i(Bn.Provider, { value: O.current, children: /* @__PURE__ */ i(zn.Provider, { value: q.current, children: /* @__PURE__ */ i(Nn.Provider, { value: re, children: /* @__PURE__ */ i(rn.Provider, { value: Le, children: /* @__PURE__ */ i(on.Provider, { value: I.current, children: /* @__PURE__ */ i(De.Provider, { value: Qe, children: /* @__PURE__ */ Ce($n, { store: e.stores.layout, screenOptions: Ae.modalOptions, dialogRef: ne, requestClose: he, exiting: b, children: [
|
|
629
|
+
/* @__PURE__ */ i(In, { store: e.stores.layout, screen: Ae, route: A, navigation: re, requestClose: he, translate: o, canGoBack: m.length > 1 }),
|
|
630
|
+
/* @__PURE__ */ i("main", { ref: oe, className: "pmn-main", children: Pe.map((c) => /* @__PURE__ */ i(
|
|
631
|
+
Mt,
|
|
501
632
|
{
|
|
502
|
-
route:
|
|
503
|
-
screen:
|
|
504
|
-
navigation:
|
|
505
|
-
focused:
|
|
506
|
-
resultEvent:
|
|
507
|
-
bodyClassName:
|
|
508
|
-
setFooter:
|
|
509
|
-
loadingApi:
|
|
510
|
-
loadingStore:
|
|
511
|
-
notifyError:
|
|
512
|
-
registerDirtyGuard:
|
|
513
|
-
pageMotion:
|
|
514
|
-
lazyFallback:
|
|
633
|
+
route: c,
|
|
634
|
+
screen: Se[c.name],
|
|
635
|
+
navigation: re,
|
|
636
|
+
focused: c.key === y,
|
|
637
|
+
resultEvent: $[c.key] ?? null,
|
|
638
|
+
bodyClassName: s.bodyClassName,
|
|
639
|
+
setFooter: En,
|
|
640
|
+
loadingApi: Qe,
|
|
641
|
+
loadingStore: j.current,
|
|
642
|
+
notifyError: l,
|
|
643
|
+
registerDirtyGuard: x,
|
|
644
|
+
pageMotion: c.key === y ? Re : null,
|
|
645
|
+
lazyFallback: s.lazyFallback
|
|
515
646
|
},
|
|
516
|
-
|
|
647
|
+
c.key
|
|
517
648
|
)) }),
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
|
|
649
|
+
/* @__PURE__ */ i(
|
|
650
|
+
Et,
|
|
520
651
|
{
|
|
521
652
|
store: q.current,
|
|
522
|
-
routeKey:
|
|
523
|
-
screen:
|
|
524
|
-
|
|
525
|
-
route:
|
|
526
|
-
navigation:
|
|
527
|
-
requestClose:
|
|
528
|
-
translate:
|
|
529
|
-
onError:
|
|
530
|
-
loadingApi:
|
|
653
|
+
routeKey: y,
|
|
654
|
+
screen: Ae,
|
|
655
|
+
layoutStore: e.stores.layout,
|
|
656
|
+
route: A,
|
|
657
|
+
navigation: re,
|
|
658
|
+
requestClose: he,
|
|
659
|
+
translate: o,
|
|
660
|
+
onError: l,
|
|
661
|
+
loadingApi: Qe
|
|
531
662
|
},
|
|
532
|
-
|
|
663
|
+
y
|
|
533
664
|
),
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ i(St, { store: j.current, translate: o }),
|
|
666
|
+
/* @__PURE__ */ i(Ct, { store: O.current, dismiss: T }),
|
|
667
|
+
d && /* @__PURE__ */ Ce("div", { className: "pmn-error", role: "alert", children: [
|
|
668
|
+
/* @__PURE__ */ i("span", { children: d.message || String(d) }),
|
|
669
|
+
/* @__PURE__ */ i("button", { type: "button", onClick: u, "aria-label": "Dismiss error", children: "×" })
|
|
539
670
|
] })
|
|
540
|
-
] }) }) }) }) }) }) }) });
|
|
671
|
+
] }) }) }) }) }) }) }) }) });
|
|
541
672
|
}
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
return
|
|
551
|
-
});
|
|
552
|
-
function Jn({ config: e, initialScreen: n, params: r, options: t, translate: c, onRequestClose: g, onOpened: p, registerLoading: f, notifyError: u, error: v, clearError: C, registerDirtyGuard: k, exiting: d = !1 }) {
|
|
553
|
-
const m = n ?? e.initialRoute ?? Object.keys(e.screens)[0], [a, T] = me(() => ({ key: "single", name: m, params: r ?? {}, options: {} })), L = l(a);
|
|
554
|
-
L.current = a;
|
|
555
|
-
const D = e.screens[m], q = l(!0), H = l(null), x = l(null), O = l(null), j = l(null), F = l(null);
|
|
556
|
-
x.current || (x.current = kn({ canGoBack: !1, stack: [a], currentRoute: a })), O.current || (O.current = Te({})), j.current || (j.current = Te({ visible: !1, text: null, count: 0 })), F.current || (F.current = Te([]));
|
|
557
|
-
const M = l("single"), { loadingApi: b, setLoading: P } = An(j, q, M), { toast: W, dismissToast: U } = Nn(F, q), B = w((y, R) => {
|
|
558
|
-
const _ = O.current, le = _.getSnapshot();
|
|
559
|
-
if (R === null) {
|
|
560
|
-
if (le[y] !== void 0) {
|
|
561
|
-
const he = { ...le };
|
|
562
|
-
delete he[y], _.publish(he);
|
|
563
|
-
}
|
|
564
|
-
} else le[y] !== R && _.publish({ ...le, [y]: R });
|
|
565
|
-
}, []), K = w((y = "api", R) => g(y, R), [g]), N = w(() => Promise.resolve(!1), []), J = G(() => ({
|
|
566
|
-
navigate: N,
|
|
567
|
-
navigateAsync: async () => ({ status: "cancelled" }),
|
|
568
|
-
replace: N,
|
|
569
|
-
reset: N,
|
|
570
|
-
goBack: N,
|
|
571
|
-
popToTop: N,
|
|
572
|
-
popTo: N,
|
|
573
|
-
setParams: (y) => (T((R) => ({ ...R, params: { ...R.params, ...typeof y == "function" ? y(R.params) : y } })), !0),
|
|
574
|
-
setOptions: (y) => (T((R) => ({ ...R, options: { ...R.options, ...y } })), !0),
|
|
575
|
-
close: K,
|
|
576
|
-
setLoading: P,
|
|
577
|
-
canGoBack: !1,
|
|
578
|
-
stack: [a],
|
|
579
|
-
currentRoute: a
|
|
580
|
-
}), [K, a, P, N]), $ = l(J);
|
|
581
|
-
$.current = J;
|
|
582
|
-
const ce = G(() => ({
|
|
583
|
-
navigate: (...y) => $.current.navigate(...y),
|
|
584
|
-
navigateAsync: (...y) => $.current.navigateAsync(...y),
|
|
585
|
-
replace: (...y) => $.current.replace(...y),
|
|
586
|
-
reset: (...y) => $.current.reset(...y),
|
|
587
|
-
goBack: (...y) => $.current.goBack(...y),
|
|
588
|
-
popToTop: (...y) => $.current.popToTop(...y),
|
|
589
|
-
popTo: (...y) => $.current.popTo(...y),
|
|
590
|
-
setParams: (...y) => $.current.setParams(...y),
|
|
591
|
-
setOptions: (...y) => $.current.setOptions(...y),
|
|
592
|
-
close: (...y) => $.current.close(...y),
|
|
593
|
-
setLoading: (...y) => $.current.setLoading(...y)
|
|
594
|
-
}), []), ae = G(() => ({
|
|
595
|
-
setLoading: (y, R) => b.setScreenLoading("single", y, R),
|
|
596
|
-
showLoading: (y) => b.begin("single", y),
|
|
597
|
-
hideLoading: (y) => b.end("single", y)
|
|
598
|
-
}), [b]), ge = G(() => ({ isFocused: !0, resultEvent: null, routeKey: "single", setFooter: B }), [B]), V = G(() => ({ routeKey: "single", registerDirtyGuard: k }), [k]);
|
|
599
|
-
Q(() => {
|
|
600
|
-
x.current.publish({ canGoBack: !1, stack: [a], currentRoute: a });
|
|
601
|
-
}, [a]), Q(() => (q.current = !0, f?.({ setLoading: P }), p?.({ route: L.current, stack: [L.current] }), () => {
|
|
602
|
-
q.current = !1;
|
|
603
|
-
}), []);
|
|
604
|
-
const ie = { ...D, ...a.options }, ye = D.component;
|
|
605
|
-
return /* @__PURE__ */ s(rn.Provider, { value: W, children: /* @__PURE__ */ s(wn.Provider, { value: F.current, children: /* @__PURE__ */ s(xn.Provider, { value: O.current, children: /* @__PURE__ */ s(vn.Provider, { value: J, children: /* @__PURE__ */ s(_e.Provider, { value: ce, children: /* @__PURE__ */ s(We.Provider, { value: x.current, children: /* @__PURE__ */ s(Me.Provider, { value: b, children: /* @__PURE__ */ pe(En, { dialogRef: H, options: t, requestClose: K, exiting: d, children: [
|
|
606
|
-
/* @__PURE__ */ s(Rn, { options: t, screen: ie, route: a, navigation: J, requestClose: K, translate: c, canGoBack: !1 }),
|
|
607
|
-
/* @__PURE__ */ s("main", { className: "pmn-main", children: /* @__PURE__ */ s(on.Provider, { value: a, children: /* @__PURE__ */ s(tn.Provider, { value: V, children: /* @__PURE__ */ s($e.Provider, { value: ge, children: /* @__PURE__ */ s(Me.Provider, { value: ae, children: /* @__PURE__ */ s(Ue.Provider, { value: j.current, children: /* @__PURE__ */ s("div", { className: `pmn-body ${t.bodyClassName ?? ""}`, "data-modal-route-key": "single", tabIndex: -1, children: /* @__PURE__ */ s(Mn, { route: a, onError: u, children: /* @__PURE__ */ s(bn, { fallback: t.lazyFallback ?? /* @__PURE__ */ s("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ s(ye, { route: a, navigation: J }) }) }) }) }) }) }) }) }) }),
|
|
608
|
-
/* @__PURE__ */ s(Vn, { store: O.current, route: a, screen: ie, options: t, navigation: J, requestClose: K, translate: c, onError: u, loadingApi: b }),
|
|
609
|
-
/* @__PURE__ */ s(Zn, { store: j.current, translate: c }),
|
|
610
|
-
/* @__PURE__ */ s(Qn, { store: F.current, dismiss: U }),
|
|
611
|
-
v && /* @__PURE__ */ pe("div", { className: "pmn-error", role: "alert", children: [
|
|
612
|
-
/* @__PURE__ */ s("span", { children: v.message || String(v) }),
|
|
613
|
-
/* @__PURE__ */ s("button", { type: "button", onClick: C, children: "×" })
|
|
614
|
-
] })
|
|
615
|
-
] }) }) }) }) }) }) }) });
|
|
673
|
+
const ar = (e) => e, sr = (e) => ({ definitionLoader: e }), Je = /* @__PURE__ */ new WeakMap();
|
|
674
|
+
function nn(e) {
|
|
675
|
+
if (!Je.has(e)) {
|
|
676
|
+
const n = Promise.resolve().then(e).catch((t) => {
|
|
677
|
+
throw Je.delete(e), t;
|
|
678
|
+
});
|
|
679
|
+
Je.set(e, n);
|
|
680
|
+
}
|
|
681
|
+
return Je.get(e);
|
|
616
682
|
}
|
|
617
|
-
const Xn = ".pmn-overlay,.pmn-dialog,.pmn-dialog *{box-sizing:border-box}.pmn-overlay{position:fixed;inset:0;z-index:1000;display:flex;overscroll-behavior:none;background:#00000073}.pmn-place-right{justify-content:flex-end;align-items:stretch}.pmn-place-left{justify-content:flex-start;align-items:stretch}.pmn-place-center{justify-content:center;align-items:center}.pmn-place-top{justify-content:center;align-items:flex-start}.pmn-place-bottom{justify-content:center;align-items:flex-end}.pmn-dialog{--pmn-surface:#fff;--pmn-body:#fff;--pmn-text:#0f172a;--pmn-muted:#475569;--pmn-border:#e2e8f0;--pmn-hover:#f1f5f9;--pmn-overlay-card:rgba(255,255,255,.92);color-scheme:light;position:relative;display:flex;flex-direction:column;min-height:0;width:100%;max-width:min(calc(100vw - var(--pmn-gap)*2),var(--pmn-max-width, var(--pmn-width)));max-height:min(calc(100dvh - var(--pmn-gap)*2),var(--pmn-max-height, 100dvh));height:var(--pmn-height, 100%);overflow:hidden;outline:none;box-shadow:0 25px 50px -12px #00000040;background:var(--pmn-surface);color:var(--pmn-text)}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:calc(100dvh - var(--pmn-gap)*2);max-height:calc(100dvh - var(--pmn-gap)*2)}.pmn-place-center .pmn-dialog{height:var(--pmn-height, auto);min-height:150px}.pmn-place-top .pmn-dialog,.pmn-place-bottom .pmn-dialog{height:var(--pmn-height, auto);min-height:0}.pmn-dialog[data-modal-theme=dark]{--pmn-surface:#334155;--pmn-body:#334155;--pmn-text:#f1f5f9;--pmn-muted:#cbd5e1;--pmn-border:#475569;--pmn-hover:#1e293b;--pmn-overlay-card:rgba(51,65,85,.94);color-scheme:dark}.pmn-main{min-height:0;flex:1;overflow:hidden;display:flex;flex-direction:column;background:transparent}.pmn-body{height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px;flex:1}.pmn-body[hidden]{display:none!important}.pmn-header{display:flex;flex-shrink:0;height:64px;align-items:center;gap:12px;padding:0 20px;background:transparent}.pmn-header h2{font-size:18px;font-weight:600;min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0}.pmn-header-spacer{flex:1}.pmn-border-bottom{border-bottom:1px solid var(--pmn-border)}.pmn-icon-button{display:inline-flex;align-items:center;justify-content:center;padding:8px;border:0;background:transparent;color:inherit;border-radius:8px;cursor:pointer}.pmn-icon-button:hover{background:var(--pmn-hover)}.pmn-footer{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;gap:12px;padding:16px 20px;background:transparent}.pmn-border-top{border-top:1px solid var(--pmn-border)}.pmn-button{padding:8px 16px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer}.pmn-button:disabled{opacity:.5;cursor:not-allowed}.pmn-button-secondary{border:1px solid var(--pmn-border);background:transparent;color:var(--pmn-text)}.pmn-button-secondary:hover:not(:disabled){background:var(--pmn-hover)}.pmn-button-primary{border:1px solid #2563eb;background:#2563eb;color:#fff}.pmn-button-primary:hover:not(:disabled){background:#1d4ed8}.pmn-loading-overlay{position:absolute;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:#ffffffb8;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);cursor:progress}.pmn-dialog[data-modal-theme=dark] .pmn-loading-overlay{background:#0f172ab8}.pmn-loading-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;max-width:85%;text-align:center;color:var(--pmn-text);pointer-events:none}.pmn-loading-text{font-size:14px;font-weight:500;line-height:1.5;overflow-wrap:anywhere}.pmn-spinner{width:38px;height:38px;border:3px solid rgba(37,99,235,.2);border-top-color:#2563eb;border-radius:50%;animation:pmn-spin .8s linear infinite}@keyframes pmn-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:1.8s}}.pmn-error{position:absolute;z-index:60;bottom:8px;left:12px;right:12px;display:flex;justify-content:space-between;gap:12px;padding:12px;border:1px solid #fca5a5;border-radius:8px;background:#fef2f2;color:#991b1b;font-size:13px}.pmn-error button{border:0;background:transparent;font-size:20px;cursor:pointer;color:inherit}.pmn-dialog input:not([type=checkbox]):not([type=radio]),.pmn-dialog textarea,.pmn-dialog select{color:var(--pmn-text);border-color:var(--pmn-border)}.pmn-error-screen{padding:24px;color:var(--pmn-text)}.pmn-error-screen p{color:#dc2626;overflow-wrap:anywhere}@media(max-width:640px){.pmn-overlay.pmn-mobile-fullscreen{padding:0!important}.pmn-mobile-fullscreen .pmn-dialog{max-width:100%;width:100%;height:100dvh;max-height:100dvh;border-radius:0!important}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:2s}}@keyframes pmn-fade-in{0%{opacity:0}to{opacity:1}}@keyframes pmn-fade-out{0%{opacity:1}to{opacity:0}}@keyframes pmn-scale-in{0%{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}@keyframes pmn-scale-out{0%{opacity:1;transform:none}to{opacity:0;transform:translateY(10px) scale(.97)}}@keyframes pmn-right-in{0%{transform:translate(105%)}to{transform:none}}@keyframes pmn-right-out{0%{transform:none}to{transform:translate(105%)}}@keyframes pmn-left-in{0%{transform:translate(-105%)}to{transform:none}}@keyframes pmn-left-out{0%{transform:none}to{transform:translate(-105%)}}@keyframes pmn-top-in{0%{transform:translateY(-105%)}to{transform:none}}@keyframes pmn-top-out{0%{transform:none}to{transform:translateY(-105%)}}@keyframes pmn-bottom-in{0%{transform:translateY(105%)}to{transform:none}}@keyframes pmn-bottom-out{0%{transform:none}to{transform:translateY(105%)}}.pmn-entering{animation:pmn-fade-in var(--pmn-animation-duration) ease-out both}.pmn-exiting{animation:pmn-fade-out var(--pmn-animation-duration) ease-in both;pointer-events:none}.pmn-entering .pmn-dialog{animation:pmn-scale-in var(--pmn-animation-duration) cubic-bezier(.2,.8,.2,1) both}.pmn-exiting .pmn-dialog{animation:pmn-scale-out var(--pmn-animation-duration) ease-in both}.pmn-entering.pmn-place-right .pmn-dialog{animation-name:pmn-right-in}.pmn-exiting.pmn-place-right .pmn-dialog{animation-name:pmn-right-out}.pmn-entering.pmn-place-left .pmn-dialog{animation-name:pmn-left-in}.pmn-exiting.pmn-place-left .pmn-dialog{animation-name:pmn-left-out}.pmn-entering.pmn-place-top .pmn-dialog{animation-name:pmn-top-in}.pmn-exiting.pmn-place-top .pmn-dialog{animation-name:pmn-top-out}.pmn-entering.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-in}.pmn-exiting.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-out}.pmn-no-animation,.pmn-no-animation .pmn-dialog{animation:none!important}@media(prefers-reduced-motion:reduce){.pmn-entering,.pmn-exiting,.pmn-entering .pmn-dialog,.pmn-exiting .pmn-dialog{animation:none!important}}.pmn-toast-region{position:absolute;top:56px;left:12px;right:12px;z-index:80;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;max-height:calc(100% - 72px);overflow:hidden}.pmn-toast{pointer-events:auto;display:flex;align-items:flex-start;gap:10px;width:max-content;max-width:100%;min-width:min(260px,100%);padding:11px 13px;border:1px solid var(--pmn-border);border-radius:9px;background:var(--pmn-surface);color:var(--pmn-text);box-shadow:0 5px 18px #0000001a;font-size:13px;line-height:1.5;overflow-wrap:anywhere}.pmn-toast-symbol{flex:0 0 20px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;font-size:13px;font-weight:700;background:var(--pmn-hover);color:var(--pmn-muted)}.pmn-toast-success .pmn-toast-symbol{background:#dcfce7;color:#15803d}.pmn-toast-error .pmn-toast-symbol{background:#fee2e2;color:#b91c1c}.pmn-toast-warning .pmn-toast-symbol{background:#fef3c7;color:#b45309}.pmn-toast-info .pmn-toast-symbol{background:#dbeafe;color:#1d4ed8}.pmn-toast-message{flex:1;min-width:0;white-space:pre-wrap}.pmn-toast-close{border:0;background:transparent;color:var(--pmn-muted);cursor:pointer;font-size:19px;line-height:18px;padding:0 1px}.pmn-toast-close:hover{color:var(--pmn-text)}.pmn-button-danger{background:#dc2626!important;color:#fff!important;border-color:#dc2626!important}@keyframes pmn-page-forward-in{0%{opacity:.18;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:.18;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}.pmn-page-enter{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.2,.8,.2,1);animation-fill-mode:both;will-change:transform,opacity}.pmn-page-forward{animation-name:pmn-page-forward-in}.pmn-page-back{animation-name:pmn-page-back-in}@media(prefers-reduced-motion:reduce){.pmn-page-enter{animation:none!important;will-change:auto}}.pmn-main{position:relative;isolation:isolate}.pmn-page-exit{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.22,1,.36,1);animation-fill-mode:forwards}@keyframes pmn-page-forward-out{to{opacity:.45;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}}@keyframes pmn-page-back-out{to{opacity:.45;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}}.pmn-page-exit-forward{animation-name:pmn-page-forward-out}.pmn-page-exit-back{animation-name:pmn-page-back-out}@media(prefers-reduced-motion:reduce){.pmn-page-exit{animation:none!important}}.pmn-main>.pmn-body{position:relative;width:100%;flex:1 0 100%;background:var(--pmn-body)}.pmn-page-forward,.pmn-page-back{z-index:2}@keyframes pmn-page-forward-in{0%{opacity:1;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:1;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-forward-out{to{opacity:1;transform:translate3d(-100%,0,0)}}@keyframes pmn-page-back-out{to{opacity:1;transform:translate3d(100%,0,0)}}.pmn-lazy-loading{display:flex;min-height:80px;align-items:center;justify-content:center;color:var(--pmn-muted);font-size:14px}.pmn-place-top .pmn-dialog{max-height:min(calc(100dvh - var(--pmn-top-offset, var(--pmn-gap)) - var(--pmn-gap)),var(--pmn-max-height,100dvh))}", gn = "react-modal-navigation-styles", en = /* @__PURE__ */ new WeakMap();
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
683
|
+
async function _n(e, n) {
|
|
684
|
+
let t = typeof e == "string" ? n?.[e] : e;
|
|
685
|
+
if (t?.definitionLoader) {
|
|
686
|
+
const r = await nn(t.definitionLoader);
|
|
687
|
+
t = r.default ?? r;
|
|
688
|
+
}
|
|
689
|
+
if (!t || !(t.component || t.loader || t.screens)) throw new Error(`[react-modal-navigation] Unknown or invalid modal: ${typeof e == "string" ? e : "inline"}`);
|
|
690
|
+
return t;
|
|
691
|
+
}
|
|
692
|
+
async function Pt(e, n, t) {
|
|
693
|
+
const r = await _n(e, n), o = r.screens ? r.screens[t ?? r.initialRoute ?? Object.keys(r.screens)[0]] : r;
|
|
694
|
+
if (!o) throw new Error("[react-modal-navigation] Unknown preload screen");
|
|
695
|
+
return o.loader && await nn(o.loader), r;
|
|
696
|
+
}
|
|
697
|
+
function Tt(e) {
|
|
698
|
+
return function(t) {
|
|
699
|
+
const [r, o] = xe(() => fe.lazy(() => nn(e)));
|
|
700
|
+
return /* @__PURE__ */ i(Cn, { route: t.route, onRetry: () => o(() => fe.lazy(() => nn(e))), children: /* @__PURE__ */ i(r, { ...t }) });
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function Ot(e, n) {
|
|
704
|
+
const t = e.config.singlePage || Object.keys(e.config.screens).length === 1, r = t ? [{ key: "single", name: e.screen, params: e.params ?? {}, options: {} }] : Fn(e.screen, e.params), o = Oe({});
|
|
705
|
+
o.set = (s, m) => {
|
|
706
|
+
const M = o.getSnapshot();
|
|
707
|
+
if (m == null && !(s in M) || Object.is(M[s], m)) return;
|
|
708
|
+
const I = { ...M };
|
|
709
|
+
m == null ? delete I[s] : I[s] = m, o.publish(I);
|
|
710
|
+
};
|
|
711
|
+
const g = {
|
|
712
|
+
layout: Oe(n),
|
|
713
|
+
navigation: Oe({ canGoBack: !1, stack: r, currentRoute: r[0] }),
|
|
714
|
+
header: o,
|
|
715
|
+
footer: Oe({}),
|
|
716
|
+
loading: Oe({ visible: !1, text: null, count: 0 }),
|
|
717
|
+
toast: Oe([])
|
|
718
|
+
}, p = Object.fromEntries(Object.entries(g).map(([s, m]) => [s, { current: m }])), h = { current: !0 }, l = /* @__PURE__ */ new Set(), d = { current: /* @__PURE__ */ new Map() }, u = { current: /* @__PURE__ */ new Map() }, x = { current: 0 }, w = (s) => h.current ? (l.add(s), () => l.delete(s)) : (s(), () => {
|
|
719
|
+
}), b = () => {
|
|
720
|
+
if (h.current) {
|
|
721
|
+
h.current = !1;
|
|
722
|
+
for (const s of l)
|
|
723
|
+
try {
|
|
724
|
+
s();
|
|
725
|
+
} catch (m) {
|
|
726
|
+
console.error(m);
|
|
727
|
+
}
|
|
728
|
+
l.clear(), d.current.clear();
|
|
729
|
+
for (const s of u.current.values()) s.resolve({ status: "dismissed" });
|
|
730
|
+
u.current.clear(), Object.values(g).forEach((s) => s.destroy());
|
|
627
731
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
};
|
|
631
|
-
}, []);
|
|
732
|
+
};
|
|
733
|
+
return { id: e.id, single: t, stores: g, refs: p, alive: h, loadingTasks: d, loadingSequence: x, pageRequests: u, addCleanup: w, destroy: b };
|
|
632
734
|
}
|
|
633
|
-
function
|
|
735
|
+
function _e(e, n, t) {
|
|
634
736
|
if (typeof e == "string") {
|
|
635
737
|
if (!e.trim()) throw new TypeError("[react-modal-navigation] modal name must not be empty");
|
|
636
|
-
return { name: e, params: n ?? {}, options:
|
|
738
|
+
return { name: e, params: n ?? {}, options: t ?? {} };
|
|
637
739
|
}
|
|
638
740
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
639
741
|
throw new TypeError("[react-modal-navigation] open expects a modal name or a configuration object");
|
|
640
|
-
|
|
641
|
-
|
|
742
|
+
if (e.component || e.loader || e.screens || e.definitionLoader) {
|
|
743
|
+
const { params: l, options: d, screen: u, ...x } = e;
|
|
744
|
+
return { name: x, params: n ?? l ?? {}, options: { ...d, ...t }, screen: u };
|
|
745
|
+
}
|
|
746
|
+
const { name: r, screen: o, params: g = {}, options: p = {}, ...h } = e;
|
|
747
|
+
if (typeof r != "string" || !r.trim())
|
|
642
748
|
throw new TypeError("[react-modal-navigation] open config requires a non-empty string name");
|
|
643
749
|
if (p === null || typeof p != "object" || Array.isArray(p))
|
|
644
750
|
throw new TypeError("[react-modal-navigation] open config options must be an object");
|
|
645
|
-
if (
|
|
751
|
+
if (o !== void 0 && (typeof o != "string" || !o.trim()))
|
|
646
752
|
throw new TypeError("[react-modal-navigation] screen must be a non-empty string");
|
|
647
|
-
return { name:
|
|
753
|
+
return { name: r, ...o === void 0 ? {} : { screen: o }, params: g, options: { ...h, ...p } };
|
|
648
754
|
}
|
|
649
|
-
function
|
|
755
|
+
function Lt() {
|
|
650
756
|
const e = /* @__PURE__ */ new Map();
|
|
651
757
|
return {
|
|
652
758
|
wait(n) {
|
|
653
|
-
return new Promise((
|
|
654
|
-
const
|
|
655
|
-
e.delete(
|
|
759
|
+
return n <= 0 ? Promise.resolve() : new Promise((t) => {
|
|
760
|
+
const r = setTimeout(() => {
|
|
761
|
+
e.delete(r), t();
|
|
656
762
|
}, Math.max(0, n));
|
|
657
|
-
e.set(
|
|
763
|
+
e.set(r, t);
|
|
658
764
|
});
|
|
659
765
|
},
|
|
660
766
|
cancelAll() {
|
|
661
|
-
for (const [n,
|
|
662
|
-
clearTimeout(n),
|
|
767
|
+
for (const [n, t] of e)
|
|
768
|
+
clearTimeout(n), t();
|
|
663
769
|
e.clear();
|
|
664
770
|
},
|
|
665
771
|
pendingCount: () => e.size
|
|
666
772
|
};
|
|
667
773
|
}
|
|
668
|
-
const
|
|
669
|
-
function
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
774
|
+
const At = { placement: "right", showHeader: !0, showBackButton: !0, showCloseButton: !0, viewportGap: 5, borderRadius: 12, closeOnOverlay: !1, closeOnEsc: !0 };
|
|
775
|
+
function Nt(e, n) {
|
|
776
|
+
let t = e;
|
|
777
|
+
const r = /* @__PURE__ */ new Set(), { confirmDiscard: o, onError: g } = t, p = Oe({ isOpen: !1, activeName: null, isFullscreen: !1, queueSize: 0, error: null }), h = Oe({ active: null, options: null, exiting: !1, error: null, translate: t.translate });
|
|
778
|
+
let l = null;
|
|
779
|
+
const d = (a) => {
|
|
780
|
+
l = a, Me();
|
|
781
|
+
};
|
|
782
|
+
let u = null;
|
|
783
|
+
const x = (a) => {
|
|
784
|
+
u = a, Me();
|
|
785
|
+
};
|
|
786
|
+
let w = 0;
|
|
787
|
+
const b = (a) => {
|
|
788
|
+
w = a, Me();
|
|
789
|
+
}, s = { current: null }, m = { current: /* @__PURE__ */ new Map() }, M = { current: [] }, I = { current: null }, j = { current: null }, q = { current: 0 }, O = { current: null }, P = { current: !1 }, L = { current: 0 }, Y = { current: null }, T = { current: /* @__PURE__ */ new Map() };
|
|
790
|
+
let $ = !1;
|
|
791
|
+
const Q = (a) => {
|
|
792
|
+
$ = a, Me();
|
|
793
|
+
}, X = { current: o }, ne = ((a, f) => (T.current.set(a, f), () => {
|
|
794
|
+
T.current.get(a) === f && T.current.delete(a);
|
|
795
|
+
})), oe = (async (a) => {
|
|
796
|
+
for (const f of T.current.values()) {
|
|
797
|
+
if (!f.dirty) continue;
|
|
798
|
+
if ((f.onBeforeDiscard ? await f.onBeforeDiscard(a) : X.current ? await X.current(a) : typeof window < "u" && typeof window.confirm == "function" ? window.confirm(f.message || "有未保存的修改,确定放弃吗?") : !1) === !1) return !1;
|
|
679
799
|
}
|
|
680
800
|
return !0;
|
|
681
|
-
}
|
|
682
|
-
for (const
|
|
683
|
-
const
|
|
684
|
-
if (!
|
|
685
|
-
if ((
|
|
801
|
+
}), be = (async (a, f) => {
|
|
802
|
+
for (const S of a) {
|
|
803
|
+
const v = T.current.get(S);
|
|
804
|
+
if (!v?.dirty) continue;
|
|
805
|
+
if ((v.onBeforeDiscard ? await v.onBeforeDiscard(f) : X.current ? await X.current(f) : typeof window < "u" && typeof window.confirm == "function" ? window.confirm(v.message || "有未保存的修改,确定放弃吗?") : !1) === !1) return !1;
|
|
686
806
|
}
|
|
687
807
|
return !0;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
const ae = w((i, h) => {
|
|
693
|
-
N.current && k(i);
|
|
808
|
+
}), z = { current: !0 }, _ = { current: null };
|
|
809
|
+
_.current || (_.current = Lt());
|
|
810
|
+
const le = { current: g }, W = ((a, f) => {
|
|
811
|
+
z.current && x(a);
|
|
694
812
|
try {
|
|
695
|
-
|
|
696
|
-
} catch (
|
|
697
|
-
console.error("[react-modal-navigation] onError failed",
|
|
813
|
+
le.current ? le.current(a, f) : console.error("[react-modal-navigation]", a);
|
|
814
|
+
} catch (S) {
|
|
815
|
+
console.error("[react-modal-navigation] onError failed", S);
|
|
698
816
|
}
|
|
699
|
-
}
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
const
|
|
817
|
+
}), ue = ((a, f) => {
|
|
818
|
+
const S = m.current.get(a);
|
|
819
|
+
m.current.delete(a);
|
|
820
|
+
for (const v of S ?? []) v(f);
|
|
821
|
+
}), ie = ((a) => ({ ...At, ...t.defaultOptions, ...t.theme !== void 0 ? { theme: t.theme } : {}, ...t.backgroundColor !== void 0 ? { backgroundColor: t.backgroundColor } : {}, ...a.config.modalOptions, ...a.overrides, runtimeLayout: a.runtimeLayout })), C = (async (a = "api", f, S = {}) => {
|
|
822
|
+
const v = s.current;
|
|
823
|
+
if (!v || O.current || P.current) return !1;
|
|
824
|
+
const B = L.current;
|
|
825
|
+
O.current = v.id, P.current = !0;
|
|
826
|
+
const N = ie(v), J = { ...S, reason: a, result: f, name: v.name };
|
|
709
827
|
try {
|
|
710
|
-
if (!await
|
|
711
|
-
|
|
712
|
-
const
|
|
713
|
-
if (await
|
|
714
|
-
|
|
828
|
+
if (!await oe(J) || B !== L.current || s.current?.id !== v.id || await N.onBeforeClose?.(J) === !1 || s.current?.id !== v.id || !z.current) return !1;
|
|
829
|
+
Q(!0);
|
|
830
|
+
const ce = N.animation === !1 || typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, Number(N.animationDuration ?? 220) || 0);
|
|
831
|
+
if (await _.current.wait(Math.min(ce, 1e3)), !z.current || s.current?.id !== v.id) return !1;
|
|
832
|
+
v.runtime.destroy(), s.current = null, Y.current = null, $ = !1, d(null), T.current.clear(), ue(v.id, S.confirmed || f !== void 0 ? { status: "confirmed", value: f, reason: a } : { status: "dismissed", reason: a });
|
|
715
833
|
try {
|
|
716
|
-
await
|
|
717
|
-
} catch (
|
|
718
|
-
|
|
834
|
+
(S.confirmed || f !== void 0) && await N.onConfirmed?.(f), await N.onClose?.(J), await N.onClosed?.(J);
|
|
835
|
+
} catch (ee) {
|
|
836
|
+
B === L.current && W(ee, { phase: "onClose", name: v.name });
|
|
719
837
|
}
|
|
720
838
|
return !0;
|
|
721
|
-
} catch (
|
|
722
|
-
return
|
|
839
|
+
} catch (ce) {
|
|
840
|
+
return B === L.current && s.current?.id === v.id && W(ce, { phase: "onBeforeClose", name: v.name }), !1;
|
|
723
841
|
} finally {
|
|
724
|
-
|
|
842
|
+
O.current === v.id && (O.current = null), B === L.current && (P.current = !1), !s.current && z.current && queueMicrotask(() => j.current?.());
|
|
725
843
|
}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
const
|
|
730
|
-
if (!ee.screens?.[ne]) throw new Error(`[react-modal-navigation] Unknown initial screen '${ne}' in modal '${i}'`);
|
|
731
|
-
if (!N.current || O.current || x.current) return null;
|
|
732
|
-
O.current = !0;
|
|
733
|
-
const Be = j.current;
|
|
844
|
+
}), R = (async (a, f = {}, S = {}, v, B) => {
|
|
845
|
+
if (!z.current || P.current || O.current) return null;
|
|
846
|
+
P.current = !0;
|
|
847
|
+
const N = L.current;
|
|
734
848
|
try {
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
737
|
-
|
|
849
|
+
const J = await _n(a, t.registry);
|
|
850
|
+
if (!z.current || N !== L.current) return null;
|
|
851
|
+
const ce = (re) => re.loader && !re.component ? { ...re, component: n(re.loader) } : re, ee = J.screens ? { ...J, screens: Object.fromEntries(Object.entries(J.screens).map(([re, Pe]) => [re, ce(Pe)])) } : ce(J);
|
|
852
|
+
a = typeof a == "string" ? a : J.name ?? "inline";
|
|
853
|
+
const he = ee?.component && !ee.screens ? { ...ee, singlePage: !0, initialRoute: "__single__", screens: { __single__: { component: ee.component, title: ee.title, ...J.screenOptions ?? {} } } } : ee;
|
|
854
|
+
if (!he) throw new Error(`[react-modal-navigation] Unknown modal: ${a}`);
|
|
855
|
+
const qe = B ?? he.initialRoute ?? Object.keys(he.screens ?? {})[0];
|
|
856
|
+
if (!he.screens?.[qe]) throw new Error(`[react-modal-navigation] Unknown initial screen '${qe}' in modal '${a}'`);
|
|
857
|
+
const ae = s.current, Le = S.instanceKey ?? he.modalOptions?.instanceKey, He = S.duplicateStrategy ?? he.modalOptions?.duplicateStrategy;
|
|
858
|
+
if (ae && Le != null && ae.instanceKey === Le) {
|
|
859
|
+
if (He === "ignore") return null;
|
|
860
|
+
if (He === "reuse") {
|
|
861
|
+
if (v) {
|
|
862
|
+
const re = m.current.get(ae.id) ?? [];
|
|
863
|
+
re.push(v), m.current.set(ae.id, re);
|
|
864
|
+
}
|
|
865
|
+
return ae.id;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
if (ae) {
|
|
869
|
+
const re = ie(ae), Pe = { reason: "replace", name: ae.name, nextName: a };
|
|
738
870
|
try {
|
|
739
|
-
if (!await
|
|
740
|
-
} catch (
|
|
741
|
-
return ae(
|
|
871
|
+
if (!await oe(Pe) || N !== L.current || s.current?.id !== ae.id || await re.onBeforeClose?.(Pe) === !1) return null;
|
|
872
|
+
} catch (Ae) {
|
|
873
|
+
return N === L.current && s.current?.id === ae.id && W(Ae, { phase: "onBeforeClose", name: ae.name }), null;
|
|
742
874
|
}
|
|
743
|
-
if (!
|
|
744
|
-
|
|
875
|
+
if (!z.current || N !== L.current || s.current?.id !== ae.id) return null;
|
|
876
|
+
ae.runtime.destroy(), s.current = null, Y.current = null, d(null), T.current.clear(), ue(ae.id, { status: "replaced", reason: "replace" });
|
|
745
877
|
try {
|
|
746
|
-
await
|
|
747
|
-
} catch (
|
|
748
|
-
|
|
878
|
+
await re.onClose?.(Pe), await re.onClosed?.(Pe);
|
|
879
|
+
} catch (Ae) {
|
|
880
|
+
N === L.current && W(Ae, { phase: "onClose", name: ae.name });
|
|
749
881
|
}
|
|
750
|
-
if (!
|
|
882
|
+
if (!z.current || N !== L.current) return null;
|
|
751
883
|
}
|
|
752
|
-
const
|
|
753
|
-
return
|
|
884
|
+
const ye = { id: ++q.current, name: a, screen: qe, params: f, config: he, overrides: S, instanceKey: Le };
|
|
885
|
+
return ye.runtime = Ot(ye, ie(ye)), ye.runtime.bindings = je(ye.id), s.current = ye, Y.current = null, v && m.current.set(ye.id, [v]), u = null, d(ye), ye.id;
|
|
754
886
|
} finally {
|
|
755
|
-
|
|
887
|
+
N === L.current && (P.current = !1), !s.current && z.current && queueMicrotask(() => j.current?.());
|
|
756
888
|
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
if (!
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
763
|
-
|
|
889
|
+
});
|
|
890
|
+
I.current = R;
|
|
891
|
+
const de = (async () => {
|
|
892
|
+
if (!z.current || s.current || P.current || O.current) return;
|
|
893
|
+
const a = M.current.shift();
|
|
894
|
+
if (a) {
|
|
895
|
+
r.add(a), b(M.current.length);
|
|
764
896
|
try {
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
} catch (
|
|
768
|
-
|
|
897
|
+
const f = await I.current(a.args.name, a.args.params, a.args.options, a.resolveResult, a.args.screen);
|
|
898
|
+
f === null ? (a.resolveResult?.({ status: "dismissed", reason: "blocked" }), a.resolveId?.(null), queueMicrotask(() => j.current?.())) : a.resolveId?.(f);
|
|
899
|
+
} catch (f) {
|
|
900
|
+
a.reject?.(f), queueMicrotask(() => j.current?.());
|
|
901
|
+
} finally {
|
|
902
|
+
r.delete(a);
|
|
769
903
|
}
|
|
770
904
|
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}, [e]), he = w((i, h, A) => {
|
|
779
|
-
const E = Ge(i, h, A);
|
|
780
|
-
return e?.[E.name] ? new Promise((X, Z) => {
|
|
781
|
-
L.current.push({ args: E, resolveResult: X, reject: Z }), m(L.current.length), queueMicrotask(() => q.current?.());
|
|
782
|
-
}) : Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${E.name}`));
|
|
783
|
-
}, [e]), we = w((i) => {
|
|
784
|
-
if (!i || typeof i != "object" || Array.isArray(i)) throw new TypeError("[react-modal-navigation] update expects an options object");
|
|
785
|
-
const h = a.current;
|
|
786
|
-
if (!h || O.current) return !1;
|
|
787
|
-
const A = { ...h, overrides: { ...h.overrides, ...i } };
|
|
788
|
-
return a.current = A, v(A), $.current = V(A), !0;
|
|
789
|
-
}, [V]), Ie = w((i = "queue-cleared") => {
|
|
790
|
-
const h = L.current.splice(0);
|
|
791
|
-
m(0);
|
|
792
|
-
for (const A of h)
|
|
793
|
-
A.resolveId?.(null), A.resolveResult?.({ status: "dismissed", reason: i });
|
|
794
|
-
return h.length;
|
|
795
|
-
}, []), Pe = w((i, h, A) => {
|
|
796
|
-
const E = Ge(i, h, A);
|
|
797
|
-
return R(E.name, E.params, E.options, void 0, E.screen);
|
|
798
|
-
}, [R]), Ye = w((i, h, A) => {
|
|
799
|
-
const E = Ge(i, h, A);
|
|
800
|
-
return new Promise((X, Z) => {
|
|
801
|
-
R(E.name, E.params, E.options, X, E.screen).then((ee) => {
|
|
802
|
-
ee === null && X({ status: "dismissed", reason: "blocked" });
|
|
803
|
-
}, Z);
|
|
905
|
+
});
|
|
906
|
+
j.current = de;
|
|
907
|
+
const ge = ((a, f, S) => {
|
|
908
|
+
if (!z.current) return Promise.resolve(null);
|
|
909
|
+
const v = _e(a, f, S);
|
|
910
|
+
return typeof v.name == "string" && !t.registry?.[v.name] ? Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${v.name}`)) : new Promise((B, N) => {
|
|
911
|
+
M.current.push({ args: v, resolveId: B, reject: N }), b(M.current.length), queueMicrotask(() => j.current?.());
|
|
804
912
|
});
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
{
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
913
|
+
}), te = ((a, f, S) => {
|
|
914
|
+
if (!z.current) return Promise.resolve({ status: "dismissed", reason: "unmount" });
|
|
915
|
+
const v = _e(a, f, S);
|
|
916
|
+
return typeof v.name == "string" && !t.registry?.[v.name] ? Promise.reject(new Error(`[react-modal-navigation] Unknown modal: ${v.name}`)) : new Promise((B, N) => {
|
|
917
|
+
M.current.push({ args: v, resolveResult: B, reject: N }), b(M.current.length), queueMicrotask(() => j.current?.());
|
|
918
|
+
});
|
|
919
|
+
}), A = ((a) => {
|
|
920
|
+
if (!a || typeof a != "object" || Array.isArray(a)) throw new TypeError("[react-modal-navigation] update expects an options object");
|
|
921
|
+
const f = s.current;
|
|
922
|
+
return !f || P.current ? !1 : (Object.keys(a).every((S) => Object.is(ie(f)[S], a[S])) || (f.overrides = { ...f.overrides, ...a }, f.runtimeLayout = { ...f.runtimeLayout, ...a }, Me()), !0);
|
|
923
|
+
}), y = ((a, f) => Pt(a, t.registry, f)), U = ((a) => A({ fullscreen: !!a })), ve = (() => U(!(s.current && ie(s.current).fullscreen))), we = ((a = "queue-cleared") => {
|
|
924
|
+
const f = M.current.splice(0);
|
|
925
|
+
b(0);
|
|
926
|
+
for (const S of f)
|
|
927
|
+
S.resolveId?.(null), S.resolveResult?.({ status: "dismissed", reason: a });
|
|
928
|
+
return f.length;
|
|
929
|
+
}), Fe = { open: ((a, f, S) => {
|
|
930
|
+
const v = _e(a, f, S);
|
|
931
|
+
return R(v.name, v.params, v.options, void 0, v.screen);
|
|
932
|
+
}), openInstance: (async (a, f, S) => {
|
|
933
|
+
const v = _e(a, f, S);
|
|
934
|
+
let B;
|
|
935
|
+
const N = new Promise((ee) => {
|
|
936
|
+
B = ee;
|
|
937
|
+
}), J = await R(v.name, v.params, v.options, B, v.screen);
|
|
938
|
+
J === null && B({ status: "dismissed", reason: "blocked" });
|
|
939
|
+
const ce = () => J !== null && s.current?.id === J;
|
|
940
|
+
return { id: J, result: N, isActive: ce, setOptions: (ee) => ce() && A(ee), setFullscreen: (ee) => ce() && A({ fullscreen: !!ee }), close: (ee) => ce() ? C("api", ee) : Promise.resolve(!1), confirm: (ee) => ce() ? C("confirm", ee, { confirmed: !0 }) : Promise.resolve(!1) };
|
|
941
|
+
}), openAsync: ((a, f, S) => {
|
|
942
|
+
const v = _e(a, f, S);
|
|
943
|
+
return new Promise((B, N) => {
|
|
944
|
+
R(v.name, v.params, v.options, B, v.screen).then((J) => {
|
|
945
|
+
J === null && B({ status: "dismissed", reason: "blocked" });
|
|
946
|
+
}, N);
|
|
947
|
+
});
|
|
948
|
+
}), enqueue: ge, enqueueAsync: te, update: A, setOptions: A, preload: y, setFullscreen: U, toggleFullscreen: ve, clearQueue: we, close: ((a) => C("api", a)), dismiss: ((a = "api") => C(a)), confirm: ((a) => C("confirm", a, { confirmed: !0 })), setLoading: ((a, f) => Y.current?.setLoading(a, f)), clearError: () => x(null) }, Se = (a, f) => Object.keys(a).length === Object.keys(f).length && Object.keys(a).every((S) => Object.is(a[S], f[S]));
|
|
949
|
+
function Me() {
|
|
950
|
+
const a = l ? ie(l) : null, f = h.getSnapshot();
|
|
951
|
+
l && !Se(a, l.runtime.stores.layout.getSnapshot()) && l.runtime.stores.layout.publish(a);
|
|
952
|
+
const S = l ? f.active === l ? f.options : a : null, v = { isOpen: !!l, activeName: l?.name ?? null, isFullscreen: !!a?.fullscreen, queueSize: w, error: u }, B = { active: l, options: S, exiting: $, error: u, translate: t.translate };
|
|
953
|
+
Se(v, p.getSnapshot()) || p.publish(v), Se(B, f) || h.publish(B);
|
|
954
|
+
}
|
|
955
|
+
const je = (a) => ({
|
|
956
|
+
registerLoading: (f) => {
|
|
957
|
+
s.current?.id === a && (Y.current = f);
|
|
958
|
+
},
|
|
959
|
+
registerDirtyGuard: (f, S) => s.current?.id === a ? ne(f, S) : () => {
|
|
960
|
+
},
|
|
961
|
+
canNavigate: (f, S) => s.current?.id === a ? be(f, S) : Promise.resolve(!1),
|
|
962
|
+
onRequestClose: (...f) => s.current?.id === a ? C(...f) : Promise.resolve(!1),
|
|
963
|
+
onOpened: (f) => {
|
|
964
|
+
if (s.current?.id !== a) return;
|
|
965
|
+
const S = ie(s.current), v = (B, N) => {
|
|
966
|
+
s.current?.id === a && W(B, { phase: N });
|
|
967
|
+
};
|
|
968
|
+
for (const B of ["onOpen", "onOpened"])
|
|
969
|
+
try {
|
|
970
|
+
Promise.resolve(S[B]?.(f)).catch((N) => v(N, B));
|
|
971
|
+
} catch (N) {
|
|
972
|
+
v(N, B);
|
|
842
973
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
974
|
+
}
|
|
975
|
+
});
|
|
976
|
+
return { commands: Fe, statusStore: p, hostStore: h, bindInstance: je, configure: (a) => {
|
|
977
|
+
t = a, X.current = a.confirmDiscard, le.current = a.onError, Me();
|
|
978
|
+
}, mount: () => {
|
|
979
|
+
z.current = !0;
|
|
980
|
+
}, destroy: () => {
|
|
981
|
+
z.current = !1, L.current += 1, _.current.cancelAll(), s.current?.runtime.destroy(), s.current = null, Y.current = null, O.current = null, P.current = !1;
|
|
982
|
+
for (const a of m.current.keys()) ue(a, { status: "dismissed", reason: "unmount" });
|
|
983
|
+
m.current.clear(), T.current.clear(), l = null, $ = !1, u = null;
|
|
984
|
+
for (const a of r)
|
|
985
|
+
a.resolveId?.(null), a.resolveResult?.({ status: "dismissed", reason: "unmount" });
|
|
986
|
+
r.clear(), we("unmount"), Me();
|
|
987
|
+
}, reportError: W };
|
|
988
|
+
}
|
|
989
|
+
const zt = fe.memo(function({ Screen: n, route: t, navigation: r }) {
|
|
990
|
+
return /* @__PURE__ */ i(n, { route: t, navigation: r });
|
|
991
|
+
}), Bt = fe.memo(function({ store: n, layoutStore: t, route: r, ...o }) {
|
|
992
|
+
const g = () => n.getSnapshot()[r.key], p = Ee(n.subscribe, g, g), h = ke(t, jn, ze);
|
|
993
|
+
return /* @__PURE__ */ i(Dn, { ...o, options: h, route: r, override: p });
|
|
994
|
+
}), Ft = fe.memo(function({ store: n, translate: t }) {
|
|
995
|
+
const r = Ee(n.subscribe, n.getSnapshot, n.getSnapshot);
|
|
996
|
+
return /* @__PURE__ */ i(Kn, { loading: r, translate: t });
|
|
997
|
+
}), jt = fe.memo(function({ store: n, dismiss: t }) {
|
|
998
|
+
const r = Ee(n.subscribe, n.getSnapshot, n.getSnapshot);
|
|
999
|
+
return /* @__PURE__ */ i(Hn, { items: r, dismiss: t });
|
|
1000
|
+
});
|
|
1001
|
+
function qt({ runtime: e, config: n, initialScreen: t, params: r, translate: o, onRequestClose: g, onOpened: p, registerLoading: h, notifyError: l, error: d, clearError: u, registerDirtyGuard: x, exiting: w = !1 }) {
|
|
1002
|
+
const b = ke(e.stores.layout, ut, ze), s = t ?? n.initialRoute ?? Object.keys(n.screens)[0], [m, M] = xe(() => e.stores.navigation.getSnapshot().currentRoute), I = k(m);
|
|
1003
|
+
I.current = m;
|
|
1004
|
+
const j = n.screens[s], q = e.alive, O = k(null), { navigation: P, footer: L, loading: Y, toast: T } = e.refs, $ = k("single"), { loadingApi: Q, setLoading: X } = Gn(Y, q, $, e), { toast: ne, dismissToast: oe } = Wn(T, q, e), be = K((y, U) => {
|
|
1005
|
+
const ve = L.current, we = ve.getSnapshot();
|
|
1006
|
+
if (U === null) {
|
|
1007
|
+
if (we[y] !== void 0) {
|
|
1008
|
+
const Be = { ...we };
|
|
1009
|
+
delete Be[y], ve.publish(Be);
|
|
1010
|
+
}
|
|
1011
|
+
} else we[y] !== U && ve.publish({ ...we, [y]: U });
|
|
1012
|
+
}, []), z = K((y = "api", U) => !q.current || Y.current.getSnapshot().visible && e.stores.layout.getSnapshot().lockCloseWhileLoading !== !1 ? Promise.resolve(!1) : g(y, U), [g, e]), _ = K(() => Promise.resolve(!1), []), le = F(() => ({
|
|
1013
|
+
navigate: _,
|
|
1014
|
+
navigateAsync: async () => ({ status: "cancelled" }),
|
|
1015
|
+
replace: _,
|
|
1016
|
+
reset: _,
|
|
1017
|
+
goBack: _,
|
|
1018
|
+
popToTop: _,
|
|
1019
|
+
popTo: _,
|
|
1020
|
+
setParams: (y) => q.current ? (M((U) => ({ ...U, params: { ...U.params, ...typeof y == "function" ? y(U.params) : y } })), !0) : !1,
|
|
1021
|
+
setOptions: (y) => q.current ? (M((U) => ({ ...U, options: { ...U.options, ...y } })), !0) : !1,
|
|
1022
|
+
close: z,
|
|
1023
|
+
setLoading: X,
|
|
1024
|
+
canGoBack: !1,
|
|
1025
|
+
stack: [m],
|
|
1026
|
+
currentRoute: m
|
|
1027
|
+
}), [z, m, X, _]), W = k(le);
|
|
1028
|
+
W.current = le;
|
|
1029
|
+
const ue = F(() => ({
|
|
1030
|
+
navigate: (...y) => W.current.navigate(...y),
|
|
1031
|
+
navigateAsync: (...y) => W.current.navigateAsync(...y),
|
|
1032
|
+
replace: (...y) => W.current.replace(...y),
|
|
1033
|
+
reset: (...y) => W.current.reset(...y),
|
|
1034
|
+
goBack: (...y) => W.current.goBack(...y),
|
|
1035
|
+
popToTop: (...y) => W.current.popToTop(...y),
|
|
1036
|
+
popTo: (...y) => W.current.popTo(...y),
|
|
1037
|
+
setParams: (...y) => W.current.setParams(...y),
|
|
1038
|
+
setOptions: (...y) => W.current.setOptions(...y),
|
|
1039
|
+
close: (...y) => W.current.close(...y),
|
|
1040
|
+
setLoading: (...y) => W.current.setLoading(...y)
|
|
1041
|
+
}), []), ie = F(() => ({
|
|
1042
|
+
setLoading: (y, U) => Q.setScreenLoading("single", y, U),
|
|
1043
|
+
showLoading: (y) => Q.begin("single", y),
|
|
1044
|
+
hideLoading: (y) => Q.end("single", y)
|
|
1045
|
+
}), [Q]), C = F(() => ({ isFocused: !0, resultEvent: null, routeKey: "single", setFooter: be }), [be]), R = F(() => ({ routeKey: "single", registerDirtyGuard: x }), [x]);
|
|
1046
|
+
H(() => {
|
|
1047
|
+
P.current.publish({ canGoBack: !1, stack: [m], currentRoute: m });
|
|
1048
|
+
}, [m]);
|
|
1049
|
+
const de = k(!1);
|
|
1050
|
+
H(() => (h?.({ setLoading: X }), de.current || (de.current = !0, p?.({ route: I.current, stack: [I.current] })), () => {
|
|
1051
|
+
h?.(null);
|
|
1052
|
+
}), []);
|
|
1053
|
+
const ge = F(() => ({ ...j, ...m.options }), [j, m.options]), te = j.component, A = e.refs.header;
|
|
1054
|
+
return /* @__PURE__ */ i(tn.Provider, { value: A.current, children: /* @__PURE__ */ i(vn.Provider, { value: ne, children: /* @__PURE__ */ i(Bn.Provider, { value: T.current, children: /* @__PURE__ */ i(zn.Provider, { value: L.current, children: /* @__PURE__ */ i(Nn.Provider, { value: le, children: /* @__PURE__ */ i(rn.Provider, { value: ue, children: /* @__PURE__ */ i(on.Provider, { value: P.current, children: /* @__PURE__ */ i(De.Provider, { value: Q, children: /* @__PURE__ */ Ce($n, { store: e.stores.layout, screenOptions: ge.modalOptions, dialogRef: O, requestClose: z, exiting: w, children: [
|
|
1055
|
+
/* @__PURE__ */ i(In, { store: e.stores.layout, screen: ge, route: m, navigation: le, requestClose: z, translate: o, canGoBack: !1 }),
|
|
1056
|
+
/* @__PURE__ */ i("main", { className: "pmn-main", children: /* @__PURE__ */ i(sn.Provider, { value: m, children: /* @__PURE__ */ i(bn.Provider, { value: R, children: /* @__PURE__ */ i(Ve.Provider, { value: C, children: /* @__PURE__ */ i(De.Provider, { value: ie, children: /* @__PURE__ */ i(an.Provider, { value: Y.current, children: /* @__PURE__ */ i("div", { className: `pmn-body ${b.bodyClassName ?? ""}`, "data-modal-route-key": "single", tabIndex: -1, children: /* @__PURE__ */ i(Cn, { route: m, onError: l, children: /* @__PURE__ */ i(Ln, { fallback: b.lazyFallback ?? /* @__PURE__ */ i("div", { className: "pmn-lazy-loading", role: "status", "aria-live": "polite", children: "加载中..." }), children: /* @__PURE__ */ i(zt, { Screen: te, route: m, navigation: le }) }) }) }) }) }) }) }) }) }),
|
|
1057
|
+
/* @__PURE__ */ i(Bt, { store: L.current, route: m, screen: ge, layoutStore: e.stores.layout, navigation: le, requestClose: z, translate: o, onError: l, loadingApi: Q }),
|
|
1058
|
+
/* @__PURE__ */ i(Ft, { store: Y.current, translate: o }),
|
|
1059
|
+
/* @__PURE__ */ i(jt, { store: T.current, dismiss: oe }),
|
|
1060
|
+
d && /* @__PURE__ */ Ce("div", { className: "pmn-error", role: "alert", children: [
|
|
1061
|
+
/* @__PURE__ */ i("span", { children: d.message || String(d) }),
|
|
1062
|
+
/* @__PURE__ */ i("button", { type: "button", onClick: u, children: "×" })
|
|
1063
|
+
] })
|
|
1064
|
+
] }) }) }) }) }) }) }) }) });
|
|
1065
|
+
}
|
|
1066
|
+
const $t = Ue(Rt), It = Ue(qt), Dt = Ue(function({ manager: n }) {
|
|
1067
|
+
const { active: t, options: r, exiting: o, error: g, translate: p } = Ee(n.hostStore.subscribe, n.hostStore.getSnapshot, n.hostStore.getSnapshot), h = t?.id, l = t?.runtime.bindings, d = F(() => (x, w) => {
|
|
1068
|
+
t?.runtime.alive.current && n.hostStore.getSnapshot().active?.id === h && n.reportError(x, w);
|
|
1069
|
+
}, [n, t, h]);
|
|
1070
|
+
if (!t) return null;
|
|
1071
|
+
const u = t.config.singlePage || Object.keys(t.config.screens ?? {}).length === 1 ? It : $t;
|
|
1072
|
+
return /* @__PURE__ */ i(kn.Provider, { value: t.runtime, children: /* @__PURE__ */ i(u, { runtime: t.runtime, config: t.config, initialScreen: t.screen, params: t.params, options: r, translate: p, notifyError: d, error: g, clearError: n.commands.clearError, exiting: o, ...l }, h) });
|
|
1073
|
+
}), Kt = ".pmn-overlay,.pmn-dialog,.pmn-dialog *{box-sizing:border-box}.pmn-overlay{position:fixed;inset:0;z-index:1000;display:flex;overscroll-behavior:none;background:#00000073}.pmn-place-right{justify-content:flex-end;align-items:stretch}.pmn-place-left{justify-content:flex-start;align-items:stretch}.pmn-place-center{justify-content:center;align-items:center}.pmn-place-top{justify-content:center;align-items:flex-start}.pmn-place-bottom{justify-content:center;align-items:flex-end}.pmn-dialog{--pmn-surface:#fff;--pmn-body:#fff;--pmn-text:#0f172a;--pmn-muted:#475569;--pmn-border:#e2e8f0;--pmn-hover:#f1f5f9;--pmn-overlay-card:rgba(255,255,255,.92);color-scheme:light;position:relative;display:flex;flex-direction:column;min-height:0;width:100%;max-width:min(calc(100vw - var(--pmn-gap)*2),var(--pmn-max-width, var(--pmn-width)));max-height:min(calc(100dvh - var(--pmn-gap)*2),var(--pmn-max-height, 100dvh));height:var(--pmn-height, 100%);overflow:hidden;outline:none;box-shadow:0 25px 50px -12px #00000040;background:var(--pmn-surface);color:var(--pmn-text)}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:calc(100dvh - var(--pmn-gap)*2);max-height:calc(100dvh - var(--pmn-gap)*2)}.pmn-place-center .pmn-dialog{height:var(--pmn-height, auto);min-height:150px}.pmn-place-top .pmn-dialog,.pmn-place-bottom .pmn-dialog{height:var(--pmn-height, auto);min-height:0}.pmn-dialog[data-modal-theme=dark]{--pmn-surface:#334155;--pmn-body:#334155;--pmn-text:#f1f5f9;--pmn-muted:#cbd5e1;--pmn-border:#475569;--pmn-hover:#1e293b;--pmn-overlay-card:rgba(51,65,85,.94);color-scheme:dark}.pmn-main{min-height:0;flex:1;overflow:hidden;display:flex;flex-direction:column;background:transparent}.pmn-body{height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px;flex:1}.pmn-body[hidden]{display:none!important}.pmn-header{display:flex;flex-shrink:0;height:64px;align-items:center;gap:12px;padding:0 20px;background:transparent}.pmn-header h2{font-size:18px;font-weight:600;min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0}.pmn-header-spacer{flex:1}.pmn-border-bottom{border-bottom:1px solid var(--pmn-border)}.pmn-icon-button{display:inline-flex;align-items:center;justify-content:center;padding:8px;border:0;background:transparent;color:inherit;border-radius:8px;cursor:pointer}.pmn-icon-button:hover{background:var(--pmn-hover)}.pmn-footer{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;gap:12px;padding:16px 20px;background:transparent}.pmn-border-top{border-top:1px solid var(--pmn-border)}.pmn-button{padding:8px 16px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer}.pmn-button:disabled{opacity:.5;cursor:not-allowed}.pmn-button-secondary{border:1px solid var(--pmn-border);background:transparent;color:var(--pmn-text)}.pmn-button-secondary:hover:not(:disabled){background:var(--pmn-hover)}.pmn-button-primary{border:1px solid #2563eb;background:#2563eb;color:#fff}.pmn-button-primary:hover:not(:disabled){background:#1d4ed8}.pmn-loading-overlay{position:absolute;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:#ffffffb8;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);cursor:progress}.pmn-dialog[data-modal-theme=dark] .pmn-loading-overlay{background:#0f172ab8}.pmn-loading-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;max-width:85%;text-align:center;color:var(--pmn-text);pointer-events:none}.pmn-loading-text{font-size:14px;font-weight:500;line-height:1.5;overflow-wrap:anywhere}.pmn-spinner{width:38px;height:38px;border:3px solid rgba(37,99,235,.2);border-top-color:#2563eb;border-radius:50%;animation:pmn-spin .8s linear infinite}@keyframes pmn-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:1.8s}}.pmn-error{position:absolute;z-index:60;bottom:8px;left:12px;right:12px;display:flex;justify-content:space-between;gap:12px;padding:12px;border:1px solid #fca5a5;border-radius:8px;background:#fef2f2;color:#991b1b;font-size:13px}.pmn-error button{border:0;background:transparent;font-size:20px;cursor:pointer;color:inherit}.pmn-dialog input:not([type=checkbox]):not([type=radio]),.pmn-dialog textarea,.pmn-dialog select{color:var(--pmn-text);border-color:var(--pmn-border)}.pmn-error-screen{padding:24px;color:var(--pmn-text)}.pmn-error-screen p{color:#dc2626;overflow-wrap:anywhere}@media(max-width:640px){.pmn-overlay.pmn-mobile-fullscreen{padding:0!important}.pmn-mobile-fullscreen .pmn-dialog{max-width:100%;width:100%;height:100dvh;max-height:100dvh;border-radius:0!important}}@media(prefers-reduced-motion:reduce){.pmn-spinner{animation-duration:2s}}@keyframes pmn-fade-in{0%{opacity:0}to{opacity:1}}@keyframes pmn-fade-out{0%{opacity:1}to{opacity:0}}@keyframes pmn-scale-in{0%{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}@keyframes pmn-scale-out{0%{opacity:1;transform:none}to{opacity:0;transform:translateY(10px) scale(.97)}}@keyframes pmn-right-in{0%{transform:translate(105%)}to{transform:none}}@keyframes pmn-right-out{0%{transform:none}to{transform:translate(105%)}}@keyframes pmn-left-in{0%{transform:translate(-105%)}to{transform:none}}@keyframes pmn-left-out{0%{transform:none}to{transform:translate(-105%)}}@keyframes pmn-top-in{0%{transform:translateY(-105%)}to{transform:none}}@keyframes pmn-top-out{0%{transform:none}to{transform:translateY(-105%)}}@keyframes pmn-bottom-in{0%{transform:translateY(105%)}to{transform:none}}@keyframes pmn-bottom-out{0%{transform:none}to{transform:translateY(105%)}}.pmn-entering{animation:pmn-fade-in var(--pmn-animation-duration) ease-out both}.pmn-exiting{animation:pmn-fade-out var(--pmn-animation-duration) ease-in both;pointer-events:none}.pmn-entering .pmn-dialog{animation:pmn-scale-in var(--pmn-animation-duration) cubic-bezier(.2,.8,.2,1) both}.pmn-exiting .pmn-dialog{animation:pmn-scale-out var(--pmn-animation-duration) ease-in both}.pmn-entering.pmn-place-right .pmn-dialog{animation-name:pmn-right-in}.pmn-exiting.pmn-place-right .pmn-dialog{animation-name:pmn-right-out}.pmn-entering.pmn-place-left .pmn-dialog{animation-name:pmn-left-in}.pmn-exiting.pmn-place-left .pmn-dialog{animation-name:pmn-left-out}.pmn-entering.pmn-place-top .pmn-dialog{animation-name:pmn-top-in}.pmn-exiting.pmn-place-top .pmn-dialog{animation-name:pmn-top-out}.pmn-entering.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-in}.pmn-exiting.pmn-place-bottom .pmn-dialog{animation-name:pmn-bottom-out}.pmn-no-animation,.pmn-no-animation .pmn-dialog{animation:none!important}@media(prefers-reduced-motion:reduce){.pmn-entering,.pmn-exiting,.pmn-entering .pmn-dialog,.pmn-exiting .pmn-dialog{animation:none!important}}.pmn-toast-region{position:absolute;top:56px;left:12px;right:12px;z-index:80;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;max-height:calc(100% - 72px);overflow:hidden}.pmn-toast{pointer-events:auto;display:flex;align-items:flex-start;gap:10px;width:max-content;max-width:100%;min-width:min(260px,100%);padding:11px 13px;border:1px solid var(--pmn-border);border-radius:9px;background:var(--pmn-surface);color:var(--pmn-text);box-shadow:0 5px 18px #0000001a;font-size:13px;line-height:1.5;overflow-wrap:anywhere}.pmn-toast-symbol{flex:0 0 20px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;font-size:13px;font-weight:700;background:var(--pmn-hover);color:var(--pmn-muted)}.pmn-toast-success .pmn-toast-symbol{background:#dcfce7;color:#15803d}.pmn-toast-error .pmn-toast-symbol{background:#fee2e2;color:#b91c1c}.pmn-toast-warning .pmn-toast-symbol{background:#fef3c7;color:#b45309}.pmn-toast-info .pmn-toast-symbol{background:#dbeafe;color:#1d4ed8}.pmn-toast-message{flex:1;min-width:0;white-space:pre-wrap}.pmn-toast-close{border:0;background:transparent;color:var(--pmn-muted);cursor:pointer;font-size:19px;line-height:18px;padding:0 1px}.pmn-toast-close:hover{color:var(--pmn-text)}.pmn-button-danger{background:#dc2626!important;color:#fff!important;border-color:#dc2626!important}@keyframes pmn-page-forward-in{0%{opacity:.18;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:.18;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}to{opacity:1;transform:translateZ(0)}}.pmn-page-enter{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.2,.8,.2,1);animation-fill-mode:both;will-change:transform,opacity}.pmn-page-forward{animation-name:pmn-page-forward-in}.pmn-page-back{animation-name:pmn-page-back-in}@media(prefers-reduced-motion:reduce){.pmn-page-enter{animation:none!important;will-change:auto}}.pmn-main{position:relative;isolation:isolate}.pmn-page-exit{animation-duration:var(--pmn-page-duration,.36s);animation-timing-function:cubic-bezier(.22,1,.36,1);animation-fill-mode:forwards}@keyframes pmn-page-forward-out{to{opacity:.45;transform:translate3d(calc(-1 * var(--pmn-page-distance,96px)),0,0) scale(.985)}}@keyframes pmn-page-back-out{to{opacity:.45;transform:translate3d(var(--pmn-page-distance,96px),0,0) scale(.985)}}.pmn-page-exit-forward{animation-name:pmn-page-forward-out}.pmn-page-exit-back{animation-name:pmn-page-back-out}@media(prefers-reduced-motion:reduce){.pmn-page-exit{animation:none!important}}.pmn-main>.pmn-body{position:relative;width:100%;flex:1 0 100%;background:var(--pmn-body)}.pmn-page-forward,.pmn-page-back{z-index:2}@keyframes pmn-page-forward-in{0%{opacity:1;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-back-in{0%{opacity:1;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes pmn-page-forward-out{to{opacity:1;transform:translate3d(-100%,0,0)}}@keyframes pmn-page-back-out{to{opacity:1;transform:translate3d(100%,0,0)}}.pmn-lazy-loading{display:flex;min-height:80px;align-items:center;justify-content:center;color:var(--pmn-muted);font-size:14px}.pmn-place-top .pmn-dialog{max-height:min(calc(100dvh - var(--pmn-top-offset, var(--pmn-gap)) - var(--pmn-gap)),var(--pmn-max-height,100dvh))}.pmn-dialog.pmn-has-custom-background{isolation:isolate;--pmn-body:transparent}.pmn-custom-background-layer{position:absolute;inset:0;z-index:0;pointer-events:none}.pmn-dialog.pmn-has-custom-background>:not(.pmn-custom-background-layer){position:relative;z-index:1}.pmn-dialog.pmn-has-custom-background .pmn-main>.pmn-body{background:transparent}.pmn-overlay.pmn-fullscreen{padding:0!important;align-items:stretch;justify-content:stretch}.pmn-overlay.pmn-fullscreen .pmn-dialog{width:100%;max-width:100%;height:100%;max-height:100%;border-radius:0!important}.pmn-place-left .pmn-dialog,.pmn-place-right .pmn-dialog{height:100%;max-height:100%}.pmn-place-center .pmn-dialog{max-height:100%}.pmn-dialog{max-width:min(100%,var(--pmn-drag-width,var(--pmn-max-width,var(--pmn-width))));max-height:min(100%,var(--pmn-max-height,100dvh))}.pmn-dialog .pmn-resize-handle{position:absolute;z-index:5;top:0;bottom:0;width:10px;cursor:ew-resize;touch-action:none;-webkit-user-select:none;user-select:none}.pmn-resize-left{right:0}.pmn-resize-right{left:0}.pmn-resize-handle:hover,.pmn-resize-handle:focus-visible{background:var(--pmn-border)}@media(max-width:640px){.pmn-mobile-fullscreen .pmn-resize-handle{display:none}}.pmn-dialog{max-width:min(100%,var(--pmn-max-width,100%),var(--pmn-drag-width,var(--pmn-width)))}.pmn-overlay.pmn-fullscreen .pmn-dialog{max-width:100%}", Tn = "react-modal-navigation-styles", hn = /* @__PURE__ */ new WeakMap();
|
|
1074
|
+
function Ht() {
|
|
1075
|
+
Zn(() => {
|
|
1076
|
+
if (typeof document > "u") return;
|
|
1077
|
+
const e = document;
|
|
1078
|
+
let n = hn.get(e);
|
|
1079
|
+
if (!n) {
|
|
1080
|
+
let t = e.getElementById(Tn);
|
|
1081
|
+
const r = !t;
|
|
1082
|
+
t || (t = e.createElement("style"), t.id = Tn, t.setAttribute("data-react-modal-navigation", ""), t.textContent = Kt, e.head.appendChild(t)), n = { element: t, owned: r, count: 0 }, hn.set(e, n);
|
|
1083
|
+
}
|
|
1084
|
+
return n.count += 1, () => {
|
|
1085
|
+
n.count -= 1, n.count === 0 && (n.owned && n.element.remove(), hn.delete(e));
|
|
1086
|
+
};
|
|
1087
|
+
}, []);
|
|
1088
|
+
}
|
|
1089
|
+
const Wt = Object.freeze({}), Gt = (e) => ({ "modal.loading": "加载中...", "modal.processing": "处理中...", "modal.back": "返回", "modal.close": "关闭", "modal.cancel": "取消", "modal.done": "完成" })[e] ?? e;
|
|
1090
|
+
function ir({ children: e, registry: n, defaultOptions: t = Wt, backgroundColor: r, theme: o, translate: g = Gt, onError: p, confirmDiscard: h }) {
|
|
1091
|
+
Ht();
|
|
1092
|
+
const l = { registry: n, defaultOptions: t, backgroundColor: r, theme: o, translate: g, onError: p, confirmDiscard: h }, [d] = xe(() => Nt(l, Tt));
|
|
1093
|
+
return Ie(() => (d.mount(), d.destroy), [d]), Ie(() => {
|
|
1094
|
+
d.configure(l);
|
|
1095
|
+
}, [d, n, t, r, o, g, p, h]), /* @__PURE__ */ i(wn.Provider, { value: d.commands, children: /* @__PURE__ */ i(xn.Provider, { value: d.statusStore, children: /* @__PURE__ */ Ce(An.Provider, { value: d.commands, children: [
|
|
1096
|
+
e,
|
|
1097
|
+
/* @__PURE__ */ i(Dt, { manager: d })
|
|
1098
|
+
] }) }) });
|
|
847
1099
|
}
|
|
848
|
-
const
|
|
849
|
-
},
|
|
850
|
-
function
|
|
851
|
-
const e =
|
|
852
|
-
if (!
|
|
853
|
-
const
|
|
854
|
-
const
|
|
855
|
-
if (!
|
|
856
|
-
return
|
|
1100
|
+
const _t = Object.freeze({ canGoBack: !1, stack: [], currentRoute: null }), On = () => () => {
|
|
1101
|
+
}, en = () => _t;
|
|
1102
|
+
function cr({ subscribe: e = !0 } = {}) {
|
|
1103
|
+
const n = V(An), t = V(xn), r = Ee(e && t?.subscribe || On, e && t?.getSnapshot || en, e && t?.getSnapshot || en), o = F(() => n ? e ? { ...n, ...r } : n : null, [n, r, e]), g = V(rn), p = V(on), h = Ee(e && p?.subscribe || On, e && p?.getSnapshot || en, e && p?.getSnapshot || en);
|
|
1104
|
+
if (!o) throw new Error("[react-modal-navigation] useModal requires <ModalProvider>");
|
|
1105
|
+
const l = F(() => {
|
|
1106
|
+
const d = () => {
|
|
1107
|
+
if (!g) throw new Error("[react-modal-navigation] navigation requires an active modal screen; use modal.open() outside a modal");
|
|
1108
|
+
return g;
|
|
857
1109
|
};
|
|
858
1110
|
return {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
stack:
|
|
869
|
-
currentRoute: t.currentRoute
|
|
1111
|
+
navigateAsync: (...u) => d().navigateAsync(...u),
|
|
1112
|
+
navigate: (...u) => d().navigate(...u),
|
|
1113
|
+
replace: (...u) => d().replace(...u),
|
|
1114
|
+
reset: (...u) => d().reset(...u),
|
|
1115
|
+
setParams: (...u) => d().setParams(...u),
|
|
1116
|
+
setOptions: (...u) => d().setOptions(...u),
|
|
1117
|
+
goBack: (...u) => d().goBack(...u),
|
|
1118
|
+
close: (...u) => d().close(...u),
|
|
1119
|
+
setLoading: (...u) => d().setLoading(...u),
|
|
1120
|
+
...e ? { canGoBack: h.canGoBack, stack: h.stack, currentRoute: h.currentRoute } : {}
|
|
870
1121
|
};
|
|
871
|
-
}, [
|
|
872
|
-
return
|
|
1122
|
+
}, [g, h, e]);
|
|
1123
|
+
return F(() => ({ ...o, modal: o, navigation: l }), [o, l]);
|
|
873
1124
|
}
|
|
874
|
-
function
|
|
875
|
-
const e =
|
|
1125
|
+
function Ut() {
|
|
1126
|
+
const e = V(rn);
|
|
876
1127
|
if (!e) throw new Error("useModalNavigationCommands requires an active modal screen");
|
|
877
1128
|
return e;
|
|
878
1129
|
}
|
|
879
|
-
function
|
|
880
|
-
const
|
|
881
|
-
if (!
|
|
882
|
-
return
|
|
1130
|
+
function Vt(e, n) {
|
|
1131
|
+
const t = V(on);
|
|
1132
|
+
if (!t) throw new Error("useModalNavigationState requires an active modal screen");
|
|
1133
|
+
return ke(t, e, n);
|
|
883
1134
|
}
|
|
884
|
-
function
|
|
885
|
-
const e =
|
|
886
|
-
return
|
|
1135
|
+
function lr() {
|
|
1136
|
+
const e = Ut(), n = Vt();
|
|
1137
|
+
return F(() => ({ ...e, ...n }), [e, n]);
|
|
887
1138
|
}
|
|
888
|
-
function
|
|
889
|
-
const e =
|
|
1139
|
+
function Un() {
|
|
1140
|
+
const e = V(Ve);
|
|
890
1141
|
if (!e) throw new Error("useIsFocused must be called inside a modal screen");
|
|
891
1142
|
return e.isFocused;
|
|
892
1143
|
}
|
|
893
|
-
function
|
|
894
|
-
const n =
|
|
895
|
-
|
|
1144
|
+
function ur(e) {
|
|
1145
|
+
const n = Un();
|
|
1146
|
+
H(() => {
|
|
896
1147
|
if (n)
|
|
897
1148
|
return e();
|
|
898
1149
|
}, [n, e]);
|
|
899
1150
|
}
|
|
900
|
-
function
|
|
901
|
-
const n =
|
|
1151
|
+
function dr(e) {
|
|
1152
|
+
const n = V(Ve);
|
|
902
1153
|
if (!n) throw new Error("useNavigationResult requires an active modal screen");
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
}, [e]),
|
|
907
|
-
!n.isFocused || !n.resultEvent ||
|
|
1154
|
+
const t = k(e), r = k(null);
|
|
1155
|
+
H(() => {
|
|
1156
|
+
t.current = e;
|
|
1157
|
+
}, [e]), H(() => {
|
|
1158
|
+
!n.isFocused || !n.resultEvent || r.current !== n.resultEvent.id && (r.current = n.resultEvent.id, t.current(n.resultEvent.data));
|
|
908
1159
|
}, [n.isFocused, n.resultEvent]);
|
|
909
1160
|
}
|
|
910
|
-
function
|
|
911
|
-
const n =
|
|
1161
|
+
function mr(e = {}) {
|
|
1162
|
+
const n = V(Ve);
|
|
912
1163
|
if (!n) throw new Error("[react-modal-navigation] useModalFooter requires an active modal screen");
|
|
913
|
-
const { setFooter:
|
|
914
|
-
|
|
915
|
-
const g =
|
|
916
|
-
|
|
917
|
-
const
|
|
918
|
-
return [.../* @__PURE__ */ new Set([...Object.keys(
|
|
919
|
-
}) || (
|
|
920
|
-
source:
|
|
921
|
-
normalized:
|
|
922
|
-
...
|
|
923
|
-
onClick: (...
|
|
1164
|
+
const { setFooter: t, routeKey: r } = n, o = k(e);
|
|
1165
|
+
o.current = e;
|
|
1166
|
+
const g = F(() => (...T) => o.current.done?.(...T), []), p = F(() => (...T) => (o.current.cancel ?? o.current.cancle)?.(...T), []), h = F(() => (...T) => o.current.renderFooter?.(...T), []), l = typeof e.done == "function", d = typeof (e.cancel ?? e.cancle) == "function", u = typeof e.renderFooter == "function", { showFooter: x, showFooterBorder: w, doneDisabled: b, doneText: s, cancelText: m, loadingText: M, footerClassName: I } = e, j = k({ source: null, normalized: void 0 }), q = Array.isArray(e.actions) ? e.actions : null, O = j.current.source;
|
|
1167
|
+
q === O || q && O && q.length === O.length && q.every((T, $) => {
|
|
1168
|
+
const Q = O[$];
|
|
1169
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(T), ...Object.keys(Q)])].every((ne) => ne === "onClick" || Object.is(T[ne], Q[ne]));
|
|
1170
|
+
}) || (j.current = {
|
|
1171
|
+
source: q?.map((T) => ({ ...T })) ?? null,
|
|
1172
|
+
normalized: q?.map((T, $) => ({
|
|
1173
|
+
...T,
|
|
1174
|
+
onClick: (...Q) => (o.current.actions?.find((ne) => ne.key === T.key) ?? o.current.actions?.[$])?.onClick?.(...Q)
|
|
924
1175
|
}))
|
|
925
1176
|
});
|
|
926
|
-
const
|
|
927
|
-
showFooter:
|
|
928
|
-
showFooterBorder:
|
|
929
|
-
doneDisabled:
|
|
930
|
-
doneText:
|
|
931
|
-
cancelText:
|
|
932
|
-
loadingText:
|
|
933
|
-
footerClassName:
|
|
934
|
-
...
|
|
935
|
-
...
|
|
936
|
-
...
|
|
937
|
-
...
|
|
938
|
-
}), [
|
|
939
|
-
|
|
940
|
-
r
|
|
941
|
-
}, [
|
|
1177
|
+
const L = j.current.normalized, Y = F(() => ({
|
|
1178
|
+
showFooter: x,
|
|
1179
|
+
showFooterBorder: w,
|
|
1180
|
+
doneDisabled: b,
|
|
1181
|
+
doneText: s,
|
|
1182
|
+
cancelText: m,
|
|
1183
|
+
loadingText: M,
|
|
1184
|
+
footerClassName: I,
|
|
1185
|
+
...L !== void 0 ? { actions: L } : {},
|
|
1186
|
+
...l ? { done: g } : {},
|
|
1187
|
+
...d ? { cancel: p } : {},
|
|
1188
|
+
...u ? { renderFooter: h } : {}
|
|
1189
|
+
}), [x, w, b, s, m, M, I, L, l, d, u, g, p, h]);
|
|
1190
|
+
H(() => {
|
|
1191
|
+
t(r, Y);
|
|
1192
|
+
}, [r, t, Y]), H(() => () => t(r, null), [r, t]);
|
|
942
1193
|
}
|
|
943
|
-
|
|
944
|
-
|
|
1194
|
+
const Yt = (e) => e.visible;
|
|
1195
|
+
function Qt() {
|
|
1196
|
+
const e = V(De), n = V(an);
|
|
945
1197
|
if (!e || !n) throw new Error("[react-modal-navigation] useModalLoading requires an active modal screen");
|
|
946
|
-
const
|
|
947
|
-
return
|
|
1198
|
+
const t = ke(n, Yt);
|
|
1199
|
+
return F(() => ({ ...e, isLoading: t }), [e, t]);
|
|
948
1200
|
}
|
|
949
|
-
function
|
|
950
|
-
const e =
|
|
1201
|
+
function pr() {
|
|
1202
|
+
const e = V(De);
|
|
951
1203
|
if (!e) throw new Error("[react-modal-navigation] useModalLoadingCommands requires an active modal screen");
|
|
952
1204
|
return e;
|
|
953
1205
|
}
|
|
954
|
-
function
|
|
955
|
-
const
|
|
956
|
-
if (!
|
|
957
|
-
return
|
|
1206
|
+
function fr(e, n) {
|
|
1207
|
+
const t = V(an);
|
|
1208
|
+
if (!t) throw new Error("[react-modal-navigation] useModalLoadingState requires an active modal screen");
|
|
1209
|
+
return ke(t, e, n);
|
|
958
1210
|
}
|
|
959
|
-
function
|
|
960
|
-
const e =
|
|
961
|
-
return
|
|
962
|
-
|
|
963
|
-
}), []), { run:
|
|
964
|
-
if (
|
|
965
|
-
if (typeof
|
|
966
|
-
|
|
967
|
-
const
|
|
1211
|
+
function gr() {
|
|
1212
|
+
const e = Qt(), n = Un(), t = k(!0), r = k(!1), [o, g] = xe(!1), [p, h] = xe(null), l = k(e);
|
|
1213
|
+
return l.current = e, H(() => (t.current = !0, () => {
|
|
1214
|
+
t.current = !1;
|
|
1215
|
+
}), []), { run: K(async (u, x = {}) => {
|
|
1216
|
+
if (r.current) return { status: "busy" };
|
|
1217
|
+
if (typeof u != "function") throw new TypeError("[react-modal-navigation] run requires a function");
|
|
1218
|
+
r.current = !0, t.current && (g(!0), h(null));
|
|
1219
|
+
const w = l.current.showLoading(x.loadingText);
|
|
968
1220
|
try {
|
|
969
|
-
const
|
|
970
|
-
return
|
|
971
|
-
} catch (
|
|
972
|
-
if (
|
|
973
|
-
|
|
1221
|
+
const b = await u();
|
|
1222
|
+
return t.current && await x.onSuccess?.(b), { status: "success", value: b };
|
|
1223
|
+
} catch (b) {
|
|
1224
|
+
if (t.current) {
|
|
1225
|
+
h(b);
|
|
974
1226
|
try {
|
|
975
|
-
await
|
|
976
|
-
} catch (
|
|
977
|
-
console.error("[react-modal-navigation] onError failed",
|
|
1227
|
+
await x.onError?.(b);
|
|
1228
|
+
} catch (s) {
|
|
1229
|
+
console.error("[react-modal-navigation] onError failed", s);
|
|
978
1230
|
}
|
|
979
1231
|
}
|
|
980
|
-
if (
|
|
981
|
-
return { status: "error", error:
|
|
1232
|
+
if (x.throwOnError) throw b;
|
|
1233
|
+
return { status: "error", error: b };
|
|
982
1234
|
} finally {
|
|
983
|
-
|
|
1235
|
+
w != null && l.current.hideLoading(w), r.current = !1, t.current && g(!1);
|
|
984
1236
|
}
|
|
985
|
-
}, []), pending:
|
|
1237
|
+
}, []), pending: o, error: p, clearError: () => h(null), isFocused: n };
|
|
986
1238
|
}
|
|
987
|
-
function
|
|
988
|
-
const
|
|
989
|
-
if (!
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
const { routeKey:
|
|
993
|
-
|
|
1239
|
+
function hr(e, n = {}) {
|
|
1240
|
+
const t = V(bn);
|
|
1241
|
+
if (!t) throw new Error("[react-modal-navigation] useModalUnsavedChanges must be used inside a modal screen");
|
|
1242
|
+
const r = k({ dirty: e, ...n });
|
|
1243
|
+
r.current = { dirty: e, ...n };
|
|
1244
|
+
const { routeKey: o, registerDirtyGuard: g } = t;
|
|
1245
|
+
H(() => g(o, {
|
|
994
1246
|
get dirty() {
|
|
995
|
-
return !!
|
|
1247
|
+
return !!r.current.dirty;
|
|
996
1248
|
},
|
|
997
1249
|
get message() {
|
|
998
|
-
return
|
|
1250
|
+
return r.current.message;
|
|
999
1251
|
},
|
|
1000
1252
|
get onBeforeDiscard() {
|
|
1001
|
-
return
|
|
1253
|
+
return r.current.onBeforeDiscard;
|
|
1002
1254
|
}
|
|
1003
|
-
}), [
|
|
1255
|
+
}), [o, g]);
|
|
1004
1256
|
}
|
|
1005
|
-
const
|
|
1006
|
-
const e =
|
|
1257
|
+
const yr = () => {
|
|
1258
|
+
const e = V(vn);
|
|
1007
1259
|
if (!e) throw new Error("[react-modal-navigation] useToast requires an active modal");
|
|
1008
1260
|
return e;
|
|
1009
1261
|
};
|
|
1010
|
-
function
|
|
1011
|
-
const e =
|
|
1262
|
+
function Zt() {
|
|
1263
|
+
const e = V(sn);
|
|
1012
1264
|
if (!e) throw new Error("[react-modal-navigation] useModalRoute requires a modal screen");
|
|
1013
1265
|
return e;
|
|
1014
1266
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return
|
|
1267
|
+
function br() {
|
|
1268
|
+
return Zt().params;
|
|
1269
|
+
}
|
|
1270
|
+
function Xt() {
|
|
1271
|
+
const e = V(wn);
|
|
1272
|
+
if (!e) throw new Error("[react-modal-navigation] ModalProvider required");
|
|
1273
|
+
return e;
|
|
1274
|
+
}
|
|
1275
|
+
const Jt = (e) => e;
|
|
1276
|
+
function er(e = Jt, n = Object.is) {
|
|
1277
|
+
const t = V(xn);
|
|
1278
|
+
if (!t) throw new Error("[react-modal-navigation] ModalProvider required");
|
|
1279
|
+
return ke(t, e, n);
|
|
1280
|
+
}
|
|
1281
|
+
const nr = (e) => e.isFullscreen;
|
|
1282
|
+
function vr() {
|
|
1283
|
+
const { setFullscreen: e, toggleFullscreen: n } = Xt();
|
|
1284
|
+
return { isFullscreen: er(nr), setFullscreen: e, toggleFullscreen: n };
|
|
1285
|
+
}
|
|
1286
|
+
function wr(e = {}) {
|
|
1287
|
+
const n = V(tn), t = V(sn);
|
|
1288
|
+
if (!n || !t) throw new Error("[react-modal-navigation] useModalHeader requires a modal screen");
|
|
1289
|
+
const r = k(e);
|
|
1290
|
+
r.current = e, H(() => {
|
|
1291
|
+
n.set(t.key, r.current);
|
|
1292
|
+
}), H(() => () => n.set(t.key, null), [n, t.key]);
|
|
1293
|
+
}
|
|
1294
|
+
function xr(e, n) {
|
|
1295
|
+
const t = V(kn);
|
|
1296
|
+
if (!t) throw new Error("[react-modal-navigation] useModalLayout requires an active modal");
|
|
1297
|
+
return ke(t.stores.layout, e, n);
|
|
1017
1298
|
}
|
|
1018
1299
|
export {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1300
|
+
Rt as ModalNavigator,
|
|
1301
|
+
ir as ModalProvider,
|
|
1302
|
+
ar as defineModal,
|
|
1303
|
+
sr as lazyModal,
|
|
1304
|
+
ze as shallowEqual,
|
|
1305
|
+
ur as useFocusEffect,
|
|
1306
|
+
Un as useIsFocused,
|
|
1307
|
+
cr as useModal,
|
|
1308
|
+
Xt as useModalCommands,
|
|
1309
|
+
mr as useModalFooter,
|
|
1310
|
+
vr as useModalFullscreen,
|
|
1311
|
+
wr as useModalHeader,
|
|
1312
|
+
xr as useModalLayout,
|
|
1313
|
+
Qt as useModalLoading,
|
|
1314
|
+
pr as useModalLoadingCommands,
|
|
1315
|
+
fr as useModalLoadingState,
|
|
1316
|
+
lr as useModalNavigation,
|
|
1317
|
+
Ut as useModalNavigationCommands,
|
|
1318
|
+
Vt as useModalNavigationState,
|
|
1319
|
+
br as useModalParams,
|
|
1320
|
+
Zt as useModalRoute,
|
|
1321
|
+
er as useModalStatus,
|
|
1322
|
+
gr as useModalTask,
|
|
1323
|
+
hr as useModalUnsavedChanges,
|
|
1324
|
+
dr as useNavigationResult,
|
|
1325
|
+
yr as useToast
|
|
1037
1326
|
};
|