@mxmweb/zui-layouts 1.1.2 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -11
- package/assets/style.css +1 -1
- package/index.js +721 -235
- package/lib_enter.d.ts +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import x, { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import { useTheme as
|
|
6
|
-
import { GoogleNavbar as
|
|
1
|
+
import { jsx as e, jsxs as f, Fragment as Be } from "react/jsx-runtime";
|
|
2
|
+
import * as A from "react";
|
|
3
|
+
import x, { forwardRef as ve, createElement as ge } from "react";
|
|
4
|
+
import l from "styled-components";
|
|
5
|
+
import { useTheme as fe, deepMergeTheme as K, defaultTheme as N, ThemeProvider as De } from "@mxmweb/zui-theme";
|
|
6
|
+
import { GoogleNavbar as Se, CustomDock as Ie } from "@mxmweb/zui-components";
|
|
7
7
|
/**
|
|
8
8
|
* React Router v6.30.1
|
|
9
9
|
*
|
|
@@ -14,33 +14,33 @@ import { GoogleNavbar as re, CustomDock as ae } from "@mxmweb/zui-components";
|
|
|
14
14
|
*
|
|
15
15
|
* @license MIT
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
18
|
-
process.env.NODE_ENV !== "production" && (
|
|
19
|
-
const
|
|
20
|
-
process.env.NODE_ENV !== "production" && (
|
|
21
|
-
const
|
|
22
|
-
process.env.NODE_ENV !== "production" && (
|
|
23
|
-
const
|
|
24
|
-
process.env.NODE_ENV !== "production" && (
|
|
25
|
-
const
|
|
26
|
-
process.env.NODE_ENV !== "production" && (
|
|
27
|
-
const
|
|
17
|
+
const Te = /* @__PURE__ */ A.createContext(null);
|
|
18
|
+
process.env.NODE_ENV !== "production" && (Te.displayName = "DataRouter");
|
|
19
|
+
const Ae = /* @__PURE__ */ A.createContext(null);
|
|
20
|
+
process.env.NODE_ENV !== "production" && (Ae.displayName = "DataRouterState");
|
|
21
|
+
const Ne = /* @__PURE__ */ A.createContext(null);
|
|
22
|
+
process.env.NODE_ENV !== "production" && (Ne.displayName = "Await");
|
|
23
|
+
const Re = /* @__PURE__ */ A.createContext(null);
|
|
24
|
+
process.env.NODE_ENV !== "production" && (Re.displayName = "Navigation");
|
|
25
|
+
const ze = /* @__PURE__ */ A.createContext(null);
|
|
26
|
+
process.env.NODE_ENV !== "production" && (ze.displayName = "Location");
|
|
27
|
+
const me = /* @__PURE__ */ A.createContext({
|
|
28
28
|
outlet: null,
|
|
29
29
|
matches: [],
|
|
30
30
|
isDataRoute: !1
|
|
31
31
|
});
|
|
32
|
-
process.env.NODE_ENV !== "production" && (
|
|
33
|
-
const
|
|
34
|
-
process.env.NODE_ENV !== "production" && (
|
|
35
|
-
const
|
|
36
|
-
function
|
|
37
|
-
let
|
|
38
|
-
return
|
|
32
|
+
process.env.NODE_ENV !== "production" && (me.displayName = "Route");
|
|
33
|
+
const Me = /* @__PURE__ */ A.createContext(null);
|
|
34
|
+
process.env.NODE_ENV !== "production" && (Me.displayName = "RouteError");
|
|
35
|
+
const Fe = /* @__PURE__ */ A.createContext(null);
|
|
36
|
+
function We(t) {
|
|
37
|
+
let s = A.useContext(me).outlet;
|
|
38
|
+
return s && /* @__PURE__ */ A.createElement(Fe.Provider, {
|
|
39
39
|
value: t
|
|
40
|
-
},
|
|
40
|
+
}, s);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
42
|
+
function Oe(t) {
|
|
43
|
+
return We(t.context);
|
|
44
44
|
}
|
|
45
45
|
new Promise(() => {
|
|
46
46
|
});
|
|
@@ -50,14 +50,14 @@ new Promise(() => {
|
|
|
50
50
|
* This source code is licensed under the ISC license.
|
|
51
51
|
* See the LICENSE file in the root directory of this source tree.
|
|
52
52
|
*/
|
|
53
|
-
const
|
|
53
|
+
const Le = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Ce = (...t) => t.filter((s, w, b) => !!s && s.trim() !== "" && b.indexOf(s) === w).join(" ").trim();
|
|
54
54
|
/**
|
|
55
55
|
* @license lucide-react v0.456.0 - ISC
|
|
56
56
|
*
|
|
57
57
|
* This source code is licensed under the ISC license.
|
|
58
58
|
* See the LICENSE file in the root directory of this source tree.
|
|
59
59
|
*/
|
|
60
|
-
var
|
|
60
|
+
var je = {
|
|
61
61
|
xmlns: "http://www.w3.org/2000/svg",
|
|
62
62
|
width: 24,
|
|
63
63
|
height: 24,
|
|
@@ -74,31 +74,31 @@ var Ce = {
|
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
76
|
*/
|
|
77
|
-
const
|
|
77
|
+
const Ve = ve(
|
|
78
78
|
({
|
|
79
79
|
color: t = "currentColor",
|
|
80
|
-
size:
|
|
81
|
-
strokeWidth:
|
|
82
|
-
absoluteStrokeWidth:
|
|
83
|
-
className:
|
|
84
|
-
children:
|
|
85
|
-
iconNode:
|
|
86
|
-
|
|
87
|
-
},
|
|
80
|
+
size: s = 24,
|
|
81
|
+
strokeWidth: w = 2,
|
|
82
|
+
absoluteStrokeWidth: b,
|
|
83
|
+
className: i = "",
|
|
84
|
+
children: C,
|
|
85
|
+
iconNode: M,
|
|
86
|
+
...R
|
|
87
|
+
}, j) => ge(
|
|
88
88
|
"svg",
|
|
89
89
|
{
|
|
90
|
-
ref:
|
|
91
|
-
...
|
|
92
|
-
width:
|
|
93
|
-
height:
|
|
90
|
+
ref: j,
|
|
91
|
+
...je,
|
|
92
|
+
width: s,
|
|
93
|
+
height: s,
|
|
94
94
|
stroke: t,
|
|
95
|
-
strokeWidth:
|
|
96
|
-
className:
|
|
97
|
-
|
|
95
|
+
strokeWidth: b ? Number(w) * 24 / Number(s) : w,
|
|
96
|
+
className: Ce("lucide", i),
|
|
97
|
+
...R
|
|
98
98
|
},
|
|
99
99
|
[
|
|
100
|
-
...
|
|
101
|
-
...Array.isArray(
|
|
100
|
+
...M.map(([u, c]) => ge(u, c)),
|
|
101
|
+
...Array.isArray(C) ? C : [C]
|
|
102
102
|
]
|
|
103
103
|
)
|
|
104
104
|
);
|
|
@@ -108,16 +108,16 @@ const we = U(
|
|
|
108
108
|
* This source code is licensed under the ISC license.
|
|
109
109
|
* See the LICENSE file in the root directory of this source tree.
|
|
110
110
|
*/
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
({ className:
|
|
114
|
-
ref:
|
|
115
|
-
iconNode:
|
|
116
|
-
className:
|
|
117
|
-
...
|
|
111
|
+
const $e = (t, s) => {
|
|
112
|
+
const w = ve(
|
|
113
|
+
({ className: b, ...i }, C) => ge(Ve, {
|
|
114
|
+
ref: C,
|
|
115
|
+
iconNode: s,
|
|
116
|
+
className: Ce(`lucide-${Le(t)}`, b),
|
|
117
|
+
...i
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
|
-
return
|
|
120
|
+
return w.displayName = `${t}`, w;
|
|
121
121
|
};
|
|
122
122
|
/**
|
|
123
123
|
* @license lucide-react v0.456.0 - ISC
|
|
@@ -125,7 +125,7 @@ const oe = (t, l) => {
|
|
|
125
125
|
* This source code is licensed under the ISC license.
|
|
126
126
|
* See the LICENSE file in the root directory of this source tree.
|
|
127
127
|
*/
|
|
128
|
-
const
|
|
128
|
+
const Pe = $e("ArrowLeft", [
|
|
129
129
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
130
130
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
131
131
|
]);
|
|
@@ -135,9 +135,9 @@ const ye = oe("ArrowLeft", [
|
|
|
135
135
|
* This source code is licensed under the ISC license.
|
|
136
136
|
* See the LICENSE file in the root directory of this source tree.
|
|
137
137
|
*/
|
|
138
|
-
const
|
|
138
|
+
const le = $e("ChevronRight", [
|
|
139
139
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
140
|
-
]),
|
|
140
|
+
]), He = l.div`
|
|
141
141
|
display: flex;
|
|
142
142
|
justify-content: flex-start;
|
|
143
143
|
align-items: flex-start;
|
|
@@ -147,7 +147,7 @@ const I = oe("ChevronRight", [
|
|
|
147
147
|
width: 100%;
|
|
148
148
|
max-width: 98%;
|
|
149
149
|
position: relative;
|
|
150
|
-
`,
|
|
150
|
+
`, _e = l.div`
|
|
151
151
|
display: flex;
|
|
152
152
|
height: 38px;
|
|
153
153
|
z-index: 10;
|
|
@@ -158,7 +158,7 @@ const I = oe("ChevronRight", [
|
|
|
158
158
|
justify-content: flex-start;
|
|
159
159
|
width: 100%;
|
|
160
160
|
min-width: 0; /* 确保 flex 子元素可以收缩 */
|
|
161
|
-
`,
|
|
161
|
+
`, Ge = l.button`
|
|
162
162
|
display: flex;
|
|
163
163
|
align-items: center;
|
|
164
164
|
justify-content: center;
|
|
@@ -184,7 +184,7 @@ const I = oe("ChevronRight", [
|
|
|
184
184
|
&:active svg {
|
|
185
185
|
transform: translateY(0);
|
|
186
186
|
}
|
|
187
|
-
`,
|
|
187
|
+
`, Ke = l.div`
|
|
188
188
|
line-height: 1.4;
|
|
189
189
|
cursor: pointer;
|
|
190
190
|
transition: color 0.2s ease;
|
|
@@ -197,14 +197,14 @@ const I = oe("ChevronRight", [
|
|
|
197
197
|
&:hover {
|
|
198
198
|
color: #007bff;
|
|
199
199
|
}
|
|
200
|
-
`,
|
|
200
|
+
`, Ye = l.div`
|
|
201
201
|
line-height: 1.4;
|
|
202
202
|
white-space: nowrap;
|
|
203
203
|
overflow: hidden;
|
|
204
204
|
text-overflow: ellipsis;
|
|
205
205
|
flex: 1;
|
|
206
206
|
min-width: 0;
|
|
207
|
-
`,
|
|
207
|
+
`, ye = l.div`
|
|
208
208
|
display: flex;
|
|
209
209
|
align-items: center;
|
|
210
210
|
gap: 4px;
|
|
@@ -212,7 +212,7 @@ const I = oe("ChevronRight", [
|
|
|
212
212
|
max-width: 50%;
|
|
213
213
|
min-width: 0;
|
|
214
214
|
overflow: hidden;
|
|
215
|
-
`,
|
|
215
|
+
`, ae = l.div`
|
|
216
216
|
display: flex;
|
|
217
217
|
align-items: center;
|
|
218
218
|
gap: 4px;
|
|
@@ -229,12 +229,12 @@ const I = oe("ChevronRight", [
|
|
|
229
229
|
&:hover {
|
|
230
230
|
color: ${(t) => t.$isLast ? "#007bff" : "inherit"};
|
|
231
231
|
}
|
|
232
|
-
`,
|
|
232
|
+
`, se = l.div`
|
|
233
233
|
display: flex;
|
|
234
234
|
align-items: center;
|
|
235
235
|
color: #6c757d;
|
|
236
236
|
margin: 0 2px;
|
|
237
|
-
`,
|
|
237
|
+
`, Ze = l.div`
|
|
238
238
|
display: flex;
|
|
239
239
|
flex-direction: column;
|
|
240
240
|
width: 100%;
|
|
@@ -242,210 +242,210 @@ const I = oe("ChevronRight", [
|
|
|
242
242
|
min-height: 650px;
|
|
243
243
|
overflow: auto;
|
|
244
244
|
`;
|
|
245
|
-
|
|
245
|
+
l.div`
|
|
246
246
|
position: fixed;
|
|
247
247
|
bottom: 20px;
|
|
248
248
|
left: 50%;
|
|
249
249
|
transform: translateX(-50%);
|
|
250
250
|
z-index: 1000;
|
|
251
251
|
`;
|
|
252
|
-
const
|
|
252
|
+
const mt = ({
|
|
253
253
|
children: t,
|
|
254
|
-
goBack:
|
|
255
|
-
title:
|
|
256
|
-
description:
|
|
257
|
-
breadcrumbs:
|
|
258
|
-
dockItems:
|
|
259
|
-
dockActiveMode:
|
|
260
|
-
defaultDockActiveId:
|
|
261
|
-
defaultDockActiveIds:
|
|
262
|
-
styles:
|
|
263
|
-
eventsEmit:
|
|
254
|
+
goBack: s,
|
|
255
|
+
title: w,
|
|
256
|
+
description: b,
|
|
257
|
+
breadcrumbs: i,
|
|
258
|
+
dockItems: C,
|
|
259
|
+
dockActiveMode: M = "single",
|
|
260
|
+
defaultDockActiveId: R,
|
|
261
|
+
defaultDockActiveIds: j,
|
|
262
|
+
styles: u,
|
|
263
|
+
eventsEmit: c
|
|
264
264
|
}) => {
|
|
265
|
-
var
|
|
266
|
-
const
|
|
265
|
+
var V, o, P, te, X, de, oe, O;
|
|
266
|
+
const F = fe(), D = K(
|
|
267
267
|
// 基础:默认主题 + useTheme的配置
|
|
268
|
-
|
|
268
|
+
K({ theme: N, mode: "light" }, F),
|
|
269
269
|
// 最高层:用户手动传入的styles
|
|
270
|
-
|
|
271
|
-
),
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
},
|
|
280
|
-
if (!
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
|
|
270
|
+
u
|
|
271
|
+
), r = (D == null ? void 0 : D.theme) || N, Y = x.useRef(null), S = () => {
|
|
272
|
+
c != null && c.onGoBack ? c.onGoBack() : s && s();
|
|
273
|
+
}, W = () => {
|
|
274
|
+
c != null && c.onTitleClick && c.onTitleClick();
|
|
275
|
+
}, I = (k, H) => {
|
|
276
|
+
c != null && c.onBreadcrumbClick ? c.onBreadcrumbClick(k, H) : k.onClick && k.onClick();
|
|
277
|
+
}, B = (k, H) => {
|
|
278
|
+
c != null && c.onDockItemClick && c.onDockItemClick(k, H);
|
|
279
|
+
}, z = () => {
|
|
280
|
+
if (!i || i.length === 0) return null;
|
|
281
|
+
const k = x.useRef(null), [H, Z] = x.useState({ start: 0, end: i.length, showEllipsis: !1 }), _ = x.useCallback(() => {
|
|
282
|
+
if (!k.current || i.length <= 3) {
|
|
283
|
+
Z({ start: 0, end: i.length, showEllipsis: !1 });
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
|
-
const
|
|
287
|
-
let
|
|
288
|
-
if (
|
|
289
|
-
|
|
286
|
+
const v = k.current.offsetWidth * 0.5;
|
|
287
|
+
let G = Math.floor((v - 30) / (120 + 20));
|
|
288
|
+
if (G < 2 && (G = 2), G >= i.length) {
|
|
289
|
+
Z({ start: 0, end: i.length, showEllipsis: !1 });
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
start:
|
|
295
|
-
end:
|
|
296
|
-
showEllipsis:
|
|
292
|
+
const ie = 0, Q = Math.min(G - 1, i.length);
|
|
293
|
+
Z({
|
|
294
|
+
start: ie,
|
|
295
|
+
end: Q,
|
|
296
|
+
showEllipsis: Q < i.length - 1
|
|
297
297
|
});
|
|
298
|
-
}, [
|
|
298
|
+
}, [i.length]);
|
|
299
299
|
if (x.useEffect(() => {
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
300
|
+
_();
|
|
301
|
+
const g = new ResizeObserver(() => {
|
|
302
|
+
_();
|
|
303
303
|
});
|
|
304
|
-
return
|
|
305
|
-
|
|
304
|
+
return k.current && g.observe(k.current), () => {
|
|
305
|
+
g.disconnect();
|
|
306
306
|
};
|
|
307
|
-
}, [
|
|
308
|
-
return /* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
|
|
307
|
+
}, [_]), i.length <= 3)
|
|
308
|
+
return /* @__PURE__ */ e(ye, { children: i.map((g, v) => /* @__PURE__ */ f(x.Fragment, { children: [
|
|
309
|
+
/* @__PURE__ */ e(
|
|
310
|
+
ae,
|
|
311
311
|
{
|
|
312
|
-
$isLast:
|
|
313
|
-
$isClickable: !!(
|
|
314
|
-
onClick: () =>
|
|
312
|
+
$isLast: v === i.length - 1,
|
|
313
|
+
$isClickable: !!(v < i.length - 1 || g.onClick),
|
|
314
|
+
onClick: () => I(g, v),
|
|
315
315
|
style: {
|
|
316
|
-
color:
|
|
316
|
+
color: v === i.length - 1 ? r.colors.text : r.colors.textSecondary || r.colors.disabledText
|
|
317
317
|
},
|
|
318
|
-
title:
|
|
319
|
-
children:
|
|
318
|
+
title: g.label,
|
|
319
|
+
children: g.label
|
|
320
320
|
}
|
|
321
321
|
),
|
|
322
|
-
|
|
323
|
-
] },
|
|
324
|
-
const { start:
|
|
325
|
-
return /* @__PURE__ */
|
|
326
|
-
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
|
|
322
|
+
v < i.length - 1 && /* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(le, { size: 14 }) })
|
|
323
|
+
] }, g.id)) });
|
|
324
|
+
const { start: T, end: L, showEllipsis: J } = H;
|
|
325
|
+
return /* @__PURE__ */ f(ye, { children: [
|
|
326
|
+
i.slice(T, L).map((g, v) => /* @__PURE__ */ f(x.Fragment, { children: [
|
|
327
|
+
/* @__PURE__ */ e(
|
|
328
|
+
ae,
|
|
329
329
|
{
|
|
330
|
-
$isLast:
|
|
331
|
-
$isClickable: !!(
|
|
332
|
-
onClick: () =>
|
|
330
|
+
$isLast: v === L - T - 1 && !J,
|
|
331
|
+
$isClickable: !!(v < L - T - 1 || g.onClick),
|
|
332
|
+
onClick: () => I(g, T + v),
|
|
333
333
|
style: {
|
|
334
|
-
color:
|
|
334
|
+
color: v === L - T - 1 && !J ? r.colors.text : r.colors.textSecondary || r.colors.disabledText
|
|
335
335
|
},
|
|
336
|
-
title:
|
|
337
|
-
children:
|
|
336
|
+
title: g.label,
|
|
337
|
+
children: g.label
|
|
338
338
|
}
|
|
339
339
|
),
|
|
340
|
-
|
|
341
|
-
] },
|
|
342
|
-
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
|
|
340
|
+
v < L - T - 1 && /* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(le, { size: 14 }) })
|
|
341
|
+
] }, g.id)),
|
|
342
|
+
J && /* @__PURE__ */ f(Be, { children: [
|
|
343
|
+
/* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(le, { size: 14 }) }),
|
|
344
|
+
/* @__PURE__ */ e(
|
|
345
|
+
ae,
|
|
346
346
|
{
|
|
347
347
|
$isLast: !1,
|
|
348
348
|
$isClickable: !1,
|
|
349
349
|
style: {
|
|
350
|
-
color:
|
|
350
|
+
color: r.colors.textSecondary || r.colors.disabledText,
|
|
351
351
|
cursor: "default",
|
|
352
352
|
maxWidth: "auto"
|
|
353
353
|
},
|
|
354
|
-
title: `${
|
|
354
|
+
title: `${i.slice(L, -1).map((g) => g.label).join(" > ")}`,
|
|
355
355
|
children: "..."
|
|
356
356
|
}
|
|
357
357
|
),
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
|
|
358
|
+
/* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(le, { size: 14 }) }),
|
|
359
|
+
/* @__PURE__ */ e(
|
|
360
|
+
ae,
|
|
361
361
|
{
|
|
362
362
|
$isLast: !0,
|
|
363
|
-
$isClickable: !!
|
|
364
|
-
onClick: () =>
|
|
363
|
+
$isClickable: !!i[i.length - 1].onClick,
|
|
364
|
+
onClick: () => I(i[i.length - 1], i.length - 1),
|
|
365
365
|
style: {
|
|
366
|
-
color:
|
|
366
|
+
color: r.colors.text
|
|
367
367
|
},
|
|
368
|
-
title:
|
|
369
|
-
children:
|
|
368
|
+
title: i[i.length - 1].label,
|
|
369
|
+
children: i[i.length - 1].label
|
|
370
370
|
}
|
|
371
371
|
)
|
|
372
372
|
] })
|
|
373
373
|
] });
|
|
374
|
-
}, [
|
|
375
|
-
return /* @__PURE__ */
|
|
376
|
-
|
|
374
|
+
}, [ee, ce] = x.useState(!0);
|
|
375
|
+
return /* @__PURE__ */ e(
|
|
376
|
+
He,
|
|
377
377
|
{
|
|
378
378
|
style: {
|
|
379
|
-
background:
|
|
380
|
-
color:
|
|
381
|
-
fontFamily: ((
|
|
379
|
+
background: r.colors.appBackground,
|
|
380
|
+
color: r.colors.text,
|
|
381
|
+
fontFamily: ((o = (V = r.fonts) == null ? void 0 : V.body) == null ? void 0 : o.family) || "PingFang SC, Microsoft YaHei, Arial, sans-serif"
|
|
382
382
|
},
|
|
383
|
-
children: /* @__PURE__ */
|
|
384
|
-
|
|
385
|
-
|
|
383
|
+
children: /* @__PURE__ */ f("div", { style: { height: "100%", display: "flex", width: "100%", gap: 12 }, children: [
|
|
384
|
+
C && C.length > 0 && /* @__PURE__ */ e("div", { style: { flex: `0 0 ${ee ? 72 : 28}px`, transition: "flex-basis .2s ease" }, children: /* @__PURE__ */ e(
|
|
385
|
+
Se,
|
|
386
386
|
{
|
|
387
|
-
items:
|
|
388
|
-
open:
|
|
389
|
-
onOpenChange:
|
|
390
|
-
onItemClick: (
|
|
387
|
+
items: C,
|
|
388
|
+
open: ee,
|
|
389
|
+
onOpenChange: ce,
|
|
390
|
+
onItemClick: (k) => B({ id: String(k.key), label: k.name }, 0),
|
|
391
391
|
defaultOpen: !0
|
|
392
392
|
}
|
|
393
393
|
) }),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
(
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
/* @__PURE__ */ f("div", { style: { display: "flex", flexDirection: "column", flex: 1, minWidth: 0 }, children: [
|
|
395
|
+
(w || b || s || i) && /* @__PURE__ */ f(_e, { ref: Y, children: [
|
|
396
|
+
s && /* @__PURE__ */ e(
|
|
397
|
+
Ge,
|
|
398
398
|
{
|
|
399
|
-
onClick:
|
|
400
|
-
style: { color:
|
|
399
|
+
onClick: S,
|
|
400
|
+
style: { color: r.colors.primary, borderRadius: r.space.radius || "6px" },
|
|
401
401
|
title: "\u8FD4\u56DE",
|
|
402
|
-
children: /* @__PURE__ */
|
|
402
|
+
children: /* @__PURE__ */ e(Pe, { size: 18 })
|
|
403
403
|
}
|
|
404
404
|
),
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
z(),
|
|
406
|
+
w && /* @__PURE__ */ e(
|
|
407
|
+
Ke,
|
|
408
408
|
{
|
|
409
|
-
onClick:
|
|
409
|
+
onClick: W,
|
|
410
410
|
style: {
|
|
411
|
-
color:
|
|
412
|
-
fontSize: ((
|
|
413
|
-
fontWeight: ((
|
|
411
|
+
color: r.colors.text,
|
|
412
|
+
fontSize: ((te = (P = r.fonts) == null ? void 0 : P.heading) == null ? void 0 : te.size) || "16px",
|
|
413
|
+
fontWeight: ((de = (X = r.fonts) == null ? void 0 : X.heading) == null ? void 0 : de.weight) || "600"
|
|
414
414
|
},
|
|
415
|
-
title:
|
|
416
|
-
children:
|
|
415
|
+
title: w,
|
|
416
|
+
children: w
|
|
417
417
|
}
|
|
418
418
|
),
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
b && /* @__PURE__ */ e(
|
|
420
|
+
Ye,
|
|
421
421
|
{
|
|
422
422
|
style: {
|
|
423
|
-
color:
|
|
423
|
+
color: r.colors.textSecondary || r.colors.disabledText,
|
|
424
424
|
opacity: 0.7,
|
|
425
|
-
fontSize: ((
|
|
425
|
+
fontSize: ((O = (oe = r.fonts) == null ? void 0 : oe.body) == null ? void 0 : O.size) || "12px"
|
|
426
426
|
},
|
|
427
|
-
title:
|
|
428
|
-
children:
|
|
427
|
+
title: b,
|
|
428
|
+
children: b
|
|
429
429
|
}
|
|
430
430
|
)
|
|
431
431
|
] }),
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
|
|
432
|
+
/* @__PURE__ */ e(
|
|
433
|
+
Ze,
|
|
434
434
|
{
|
|
435
435
|
style: {
|
|
436
|
-
background:
|
|
437
|
-
border: `1px solid ${
|
|
438
|
-
borderRadius:
|
|
439
|
-
boxShadow:
|
|
436
|
+
background: r.colors.dashboardBackground || "transparent",
|
|
437
|
+
border: `1px solid ${r.colors.border}` || void 0,
|
|
438
|
+
borderRadius: r.space.radius || void 0,
|
|
439
|
+
boxShadow: r.colors.shadow || void 0
|
|
440
440
|
},
|
|
441
|
-
children: t || /* @__PURE__ */
|
|
441
|
+
children: t || /* @__PURE__ */ e(Oe, {})
|
|
442
442
|
}
|
|
443
443
|
)
|
|
444
444
|
] })
|
|
445
445
|
] })
|
|
446
446
|
}
|
|
447
447
|
);
|
|
448
|
-
},
|
|
448
|
+
}, qe = l.div.withConfig({
|
|
449
449
|
shouldForwardProp: (t) => !["backgroundImage", "backgroundColor"].includes(t)
|
|
450
450
|
})`
|
|
451
451
|
position: fixed;
|
|
@@ -458,7 +458,7 @@ const Fe = ({
|
|
|
458
458
|
flex-direction: column;
|
|
459
459
|
overflow: hidden;
|
|
460
460
|
z-index: 1;
|
|
461
|
-
`,
|
|
461
|
+
`, Ee = l.div`
|
|
462
462
|
height: 48px;
|
|
463
463
|
width: 100%;
|
|
464
464
|
display: flex;
|
|
@@ -467,7 +467,7 @@ const Fe = ({
|
|
|
467
467
|
background: transparent;
|
|
468
468
|
z-index: 10;
|
|
469
469
|
flex-shrink: 0;
|
|
470
|
-
`,
|
|
470
|
+
`, Xe = l.div`
|
|
471
471
|
flex: 1;
|
|
472
472
|
width: 100%;
|
|
473
473
|
overflow-y: auto;
|
|
@@ -494,7 +494,7 @@ const Fe = ({
|
|
|
494
494
|
&::-webkit-scrollbar-thumb:hover {
|
|
495
495
|
background: rgba(255, 255, 255, 0.5);
|
|
496
496
|
}
|
|
497
|
-
`,
|
|
497
|
+
`, Je = l.div`
|
|
498
498
|
height: 80px;
|
|
499
499
|
width: 100%;
|
|
500
500
|
display: flex;
|
|
@@ -504,69 +504,555 @@ const Fe = ({
|
|
|
504
504
|
background: transparent;
|
|
505
505
|
z-index: 10;
|
|
506
506
|
flex-shrink: 0;
|
|
507
|
-
`,
|
|
507
|
+
`, Ct = ({
|
|
508
508
|
children: t,
|
|
509
|
-
backgroundImage:
|
|
510
|
-
backgroundColor:
|
|
511
|
-
header:
|
|
512
|
-
dockItems:
|
|
513
|
-
dockActiveMode:
|
|
514
|
-
defaultDockActiveId:
|
|
515
|
-
defaultDockActiveIds:
|
|
516
|
-
styles:
|
|
517
|
-
eventsEmit:
|
|
509
|
+
backgroundImage: s,
|
|
510
|
+
backgroundColor: w,
|
|
511
|
+
header: b,
|
|
512
|
+
dockItems: i,
|
|
513
|
+
dockActiveMode: C = "single",
|
|
514
|
+
defaultDockActiveId: M,
|
|
515
|
+
defaultDockActiveIds: R,
|
|
516
|
+
styles: j,
|
|
517
|
+
eventsEmit: u
|
|
518
518
|
}) => {
|
|
519
|
-
var
|
|
520
|
-
const
|
|
519
|
+
var W, I;
|
|
520
|
+
const c = fe(), F = K(
|
|
521
521
|
// 基础:默认主题 + useTheme的配置
|
|
522
|
-
|
|
522
|
+
K({ theme: N, mode: "light" }, c),
|
|
523
523
|
// 最高层:用户手动传入的styles
|
|
524
|
-
|
|
525
|
-
),
|
|
526
|
-
|
|
527
|
-
},
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
|
|
524
|
+
j
|
|
525
|
+
), D = (F == null ? void 0 : F.theme) || N, r = (B, z) => {
|
|
526
|
+
u != null && u.onDockItemClick ? u.onDockItemClick(B, z) : B.onClick && B.onClick();
|
|
527
|
+
}, Y = (B, z) => {
|
|
528
|
+
u != null && u.onDockActiveChange && u.onDockActiveChange(B, z);
|
|
529
|
+
}, S = (B, z) => {
|
|
530
|
+
u != null && u.onDockActiveChangeMultiple && u.onDockActiveChangeMultiple(B, z);
|
|
531
531
|
};
|
|
532
|
-
return /* @__PURE__ */
|
|
533
|
-
|
|
532
|
+
return /* @__PURE__ */ f(
|
|
533
|
+
qe,
|
|
534
534
|
{
|
|
535
|
-
backgroundImage:
|
|
536
|
-
backgroundColor:
|
|
535
|
+
backgroundImage: s,
|
|
536
|
+
backgroundColor: w,
|
|
537
537
|
children: [
|
|
538
|
-
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
|
|
538
|
+
b && /* @__PURE__ */ e(Ee, { children: b }),
|
|
539
|
+
/* @__PURE__ */ e(
|
|
540
|
+
Xe,
|
|
541
541
|
{
|
|
542
542
|
style: {
|
|
543
|
-
color:
|
|
544
|
-
fontFamily: ((
|
|
543
|
+
color: D.colors.text,
|
|
544
|
+
fontFamily: ((I = (W = D.fonts) == null ? void 0 : W.body) == null ? void 0 : I.family) || "PingFang SC, Microsoft YaHei, Arial, sans-serif"
|
|
545
545
|
},
|
|
546
546
|
children: t
|
|
547
547
|
}
|
|
548
548
|
),
|
|
549
|
-
|
|
550
|
-
|
|
549
|
+
i && i.length > 0 && /* @__PURE__ */ e(Je, { children: /* @__PURE__ */ e(
|
|
550
|
+
Ie,
|
|
551
551
|
{
|
|
552
|
-
items:
|
|
552
|
+
items: i,
|
|
553
553
|
itemWidth: 48,
|
|
554
554
|
itemHeight: 48,
|
|
555
555
|
magnification: 1.5,
|
|
556
556
|
itemGap: 8,
|
|
557
|
-
activeMode:
|
|
558
|
-
defaultActiveId:
|
|
559
|
-
defaultActiveIds:
|
|
560
|
-
onItemClick:
|
|
561
|
-
onActiveChange:
|
|
562
|
-
onActiveChangeMultiple:
|
|
557
|
+
activeMode: C,
|
|
558
|
+
defaultActiveId: M,
|
|
559
|
+
defaultActiveIds: R,
|
|
560
|
+
onItemClick: r,
|
|
561
|
+
onActiveChange: Y,
|
|
562
|
+
onActiveChangeMultiple: S
|
|
563
563
|
}
|
|
564
564
|
) })
|
|
565
565
|
]
|
|
566
566
|
}
|
|
567
567
|
);
|
|
568
|
+
}, Qe = l.div`
|
|
569
|
+
--header-height: 56px;
|
|
570
|
+
--page-gutter: 16px;
|
|
571
|
+
--sidebar-width: 264px;
|
|
572
|
+
--toc-width: 268px;
|
|
573
|
+
--content-max: 960px;
|
|
574
|
+
|
|
575
|
+
display: flex;
|
|
576
|
+
flex-direction: column;
|
|
577
|
+
width: 100%;
|
|
578
|
+
min-height: 100vh;
|
|
579
|
+
height: 100vh; /* 以视口高度为基准,便于内部独立滚动布局 */
|
|
580
|
+
position: relative;
|
|
581
|
+
`, Ue = l.div`
|
|
582
|
+
position: sticky;
|
|
583
|
+
top: 0;
|
|
584
|
+
z-index: 30;
|
|
585
|
+
width: 100%;
|
|
586
|
+
height: var(--header-height);
|
|
587
|
+
display: flex;
|
|
588
|
+
align-items: center;
|
|
589
|
+
justify-content: space-between;
|
|
590
|
+
padding: 0 16px;
|
|
591
|
+
border-bottom: 1px solid rgba(0,0,0,0.06);
|
|
592
|
+
backdrop-filter: blur(8px);
|
|
593
|
+
`, et = l.div`
|
|
594
|
+
display: flex;
|
|
595
|
+
align-items: center;
|
|
596
|
+
gap: 12px;
|
|
597
|
+
min-width: 0;
|
|
598
|
+
`, tt = l.div`
|
|
599
|
+
display: flex;
|
|
600
|
+
align-items: center;
|
|
601
|
+
gap: 8px;
|
|
602
|
+
`, we = l.button`
|
|
603
|
+
display: inline-flex;
|
|
604
|
+
align-items: center;
|
|
605
|
+
justify-content: center;
|
|
606
|
+
width: 32px;
|
|
607
|
+
height: 32px;
|
|
608
|
+
border-radius: 8px;
|
|
609
|
+
background: transparent;
|
|
610
|
+
border: 1px solid rgba(0,0,0,0.08);
|
|
611
|
+
cursor: pointer;
|
|
612
|
+
transition: background .15s ease, border-color .15s ease, transform .1s ease;
|
|
613
|
+
|
|
614
|
+
&:hover { background: rgba(0,0,0,0.04); }
|
|
615
|
+
&:active { transform: translateY(1px); }
|
|
616
|
+
`, ot = l.div`
|
|
617
|
+
display: grid;
|
|
618
|
+
grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
|
|
619
|
+
gap: 16px;
|
|
620
|
+
width: 100%;
|
|
621
|
+
padding: 12px 0;
|
|
622
|
+
box-sizing: border-box;
|
|
623
|
+
transition: grid-template-columns .25s ease;
|
|
624
|
+
height: calc(100vh - var(--header-height));
|
|
625
|
+
min-height: calc(100vh - var(--header-height));
|
|
626
|
+
overflow: hidden; /* 内部区域各自滚动 */
|
|
627
|
+
|
|
628
|
+
@media (max-width: 1280px) {
|
|
629
|
+
grid-template-columns: var(--sidebar-width) 1fr 0px;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
@media (max-width: 960px) {
|
|
633
|
+
grid-template-columns: 0px 1fr 0px;
|
|
634
|
+
gap: 12px;
|
|
635
|
+
padding: 12px 12px 20px 12px;
|
|
636
|
+
}
|
|
637
|
+
`, nt = l.aside`
|
|
638
|
+
position: relative;
|
|
639
|
+
`, it = l.div`
|
|
640
|
+
height: 100%;
|
|
641
|
+
overflow: hidden;
|
|
642
|
+
padding-right: 8px;
|
|
643
|
+
border-right: 1px solid rgba(0,0,0,0.06);
|
|
644
|
+
transition: opacity .2s ease, transform .2s ease;
|
|
645
|
+
opacity: ${(t) => t.$collapsed ? 0 : 1};
|
|
646
|
+
transform: translateX(${(t) => t.$collapsed ? "-6px" : "0px"});
|
|
647
|
+
pointer-events: ${(t) => t.$collapsed ? "none" : "auto"};
|
|
648
|
+
`, rt = l.button`
|
|
649
|
+
position: absolute;
|
|
650
|
+
top: 6px;
|
|
651
|
+
right: -10px;
|
|
652
|
+
width: 10px;
|
|
653
|
+
height: 72px;
|
|
654
|
+
border: none;
|
|
655
|
+
background: rgba(0,0,0,0.06);
|
|
656
|
+
border-radius: 0 8px 8px 0;
|
|
657
|
+
cursor: pointer;
|
|
658
|
+
display: flex;
|
|
659
|
+
align-items: center;
|
|
660
|
+
justify-content: center;
|
|
661
|
+
transition: background .15s ease;
|
|
662
|
+
&:hover { background: rgba(0,0,0,0.12); }
|
|
663
|
+
`, lt = l.div`
|
|
664
|
+
height: 100%;
|
|
665
|
+
overflow: auto;
|
|
666
|
+
padding-right: 8px;
|
|
667
|
+
`, at = l.main`
|
|
668
|
+
position: relative;
|
|
669
|
+
min-width: 0;
|
|
670
|
+
height: 100%;
|
|
671
|
+
overflow: auto; /* 文档渲染区独立滚动 */
|
|
672
|
+
`, st = l.div`
|
|
673
|
+
width: 100%;
|
|
674
|
+
max-width: var(--content-max);
|
|
675
|
+
margin: 0 auto;
|
|
676
|
+
background-clip: padding-box;
|
|
677
|
+
border-radius: 8px;
|
|
678
|
+
padding: 0px 12px;
|
|
679
|
+
`, ct = l.div`
|
|
680
|
+
height: 100%;
|
|
681
|
+
transition: opacity .5s ease;
|
|
682
|
+
opacity: ${(t) => t.$opacity};
|
|
683
|
+
`, dt = l.aside`
|
|
684
|
+
position: relative;
|
|
685
|
+
z-index: 1;
|
|
686
|
+
`, ht = l.div`
|
|
687
|
+
/* 跟随整页滚动,不再单独滚动 */
|
|
688
|
+
position: static;
|
|
689
|
+
overflow: visible;
|
|
690
|
+
padding-left: 8px;
|
|
691
|
+
border-left: 1px solid rgba(0,0,0,0.06);
|
|
692
|
+
background: transparent;
|
|
693
|
+
z-index: 1;
|
|
694
|
+
`, pt = l.div`
|
|
695
|
+
transition: opacity .2s ease, transform .2s ease;
|
|
696
|
+
opacity: ${(t) => t.$collapsed ? 0 : 1};
|
|
697
|
+
transform: translateX(${(t) => t.$collapsed ? "6px" : "0px"});
|
|
698
|
+
pointer-events: ${(t) => t.$collapsed ? "none" : "auto"};
|
|
699
|
+
`;
|
|
700
|
+
l.button`
|
|
701
|
+
position: absolute;
|
|
702
|
+
top: 6px;
|
|
703
|
+
left: -10px;
|
|
704
|
+
width: 10px;
|
|
705
|
+
height: 72px;
|
|
706
|
+
border: none;
|
|
707
|
+
background: rgba(0,0,0,0.06);
|
|
708
|
+
border-radius: 8px 0 0 8px;
|
|
709
|
+
cursor: pointer;
|
|
710
|
+
display: flex;
|
|
711
|
+
align-items: center;
|
|
712
|
+
justify-content: center;
|
|
713
|
+
transition: background .15s ease;
|
|
714
|
+
&:hover { background: rgba(0,0,0,0.12); }
|
|
715
|
+
`;
|
|
716
|
+
const ue = l.div`
|
|
717
|
+
font-size: 12px;
|
|
718
|
+
opacity: .7;
|
|
719
|
+
padding: 8px 8px;
|
|
720
|
+
`, E = l.button`
|
|
721
|
+
width: 100%;
|
|
722
|
+
display: flex;
|
|
723
|
+
align-items: center;
|
|
724
|
+
gap: 8px;
|
|
725
|
+
padding: 8px 10px;
|
|
726
|
+
background: transparent;
|
|
727
|
+
border: none;
|
|
728
|
+
text-align: left;
|
|
729
|
+
cursor: pointer;
|
|
730
|
+
border-radius: 6px;
|
|
731
|
+
color: inherit;
|
|
732
|
+
transition: background .15s ease, color .15s ease;
|
|
733
|
+
font-size: 13px;
|
|
734
|
+
white-space: nowrap;
|
|
735
|
+
|
|
736
|
+
&:hover {
|
|
737
|
+
background: rgba(0,0,0,0.04);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
${(t) => t.$active ? "background: rgba(0,0,0,0.08); font-weight: 600;" : ""}
|
|
741
|
+
`, ut = l.div`
|
|
742
|
+
display: flex;
|
|
743
|
+
align-items: center;
|
|
744
|
+
gap: 8px;
|
|
745
|
+
flex-wrap: nowrap;
|
|
746
|
+
white-space: nowrap;
|
|
747
|
+
overflow-x: auto;
|
|
748
|
+
overflow-y: hidden;
|
|
749
|
+
scrollbar-width: none;
|
|
750
|
+
&::-webkit-scrollbar { display: none; }
|
|
751
|
+
`, gt = l.div`
|
|
752
|
+
width: 1px;
|
|
753
|
+
height: 16px;
|
|
754
|
+
background: currentColor;
|
|
755
|
+
opacity: .2;
|
|
756
|
+
`, ft = {
|
|
757
|
+
theme: {
|
|
758
|
+
...N,
|
|
759
|
+
colors: {
|
|
760
|
+
...N.colors,
|
|
761
|
+
appBackground: "#ffffff",
|
|
762
|
+
panelBackground: "#ffffff",
|
|
763
|
+
dashboardBackground: "#ffffff",
|
|
764
|
+
text: "#24292f",
|
|
765
|
+
textSecondary: "#6b7280",
|
|
766
|
+
border: "#e5e7eb",
|
|
767
|
+
shadow: "0 1px 2px rgba(0,0,0,0.06)"
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}, xt = {
|
|
771
|
+
theme: {
|
|
772
|
+
...N,
|
|
773
|
+
colors: {
|
|
774
|
+
...N.colors,
|
|
775
|
+
appBackground: "#0f172a",
|
|
776
|
+
panelBackground: "#111827",
|
|
777
|
+
dashboardBackground: "#0b1220",
|
|
778
|
+
text: "#e5e7eb",
|
|
779
|
+
textSecondary: "#9ca3af",
|
|
780
|
+
border: "#1f2937",
|
|
781
|
+
shadow: "none"
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
mode: "dark"
|
|
785
|
+
}, $t = (t) => {
|
|
786
|
+
var G, ie, Q, xe;
|
|
787
|
+
const {
|
|
788
|
+
children: s,
|
|
789
|
+
headerLogo: w,
|
|
790
|
+
contentKey: b,
|
|
791
|
+
modules: i,
|
|
792
|
+
activeModuleKey: C,
|
|
793
|
+
onModuleChange: M,
|
|
794
|
+
languages: R,
|
|
795
|
+
activeLanguageKey: j,
|
|
796
|
+
onLanguageChange: u,
|
|
797
|
+
themes: c,
|
|
798
|
+
activeThemeKey: F,
|
|
799
|
+
onThemeChange: D,
|
|
800
|
+
sidebarItems: r,
|
|
801
|
+
activeSidebarId: Y,
|
|
802
|
+
onSidebarItemClick: S,
|
|
803
|
+
activeTocId: W,
|
|
804
|
+
onTocItemClick: I,
|
|
805
|
+
collapsibleSidebar: B = !0,
|
|
806
|
+
styles: z
|
|
807
|
+
} = t, ee = fe(), ce = t.activeThemeKey === "dark" ? xt : ft, V = K(
|
|
808
|
+
K(
|
|
809
|
+
K({ theme: N, mode: "light" }, ee),
|
|
810
|
+
ce
|
|
811
|
+
),
|
|
812
|
+
z
|
|
813
|
+
), o = (V == null ? void 0 : V.theme) || N, [P, te] = x.useState(!1), [X, de] = x.useState(!1), [oe, O] = x.useState(!1), k = typeof W == "string", [H, Z] = x.useState(W), _ = x.useRef(null), [T, L] = x.useState(void 0), [J, g] = x.useState(s), [v, he] = x.useState(1);
|
|
814
|
+
x.useEffect(() => {
|
|
815
|
+
if (b === void 0) {
|
|
816
|
+
g(s);
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
he(0);
|
|
820
|
+
const n = setTimeout(() => {
|
|
821
|
+
g(s), requestAnimationFrame(() => he(1));
|
|
822
|
+
}, 120);
|
|
823
|
+
return () => clearTimeout(n);
|
|
824
|
+
}, [b, s]), x.useMemo(() => {
|
|
825
|
+
var n, d, h, $, y, a, m, p, U, q, re, be, ke;
|
|
826
|
+
return {
|
|
827
|
+
primaryColor: (n = o == null ? void 0 : o.colors) == null ? void 0 : n.primary,
|
|
828
|
+
secondaryColor: (d = o == null ? void 0 : o.colors) == null ? void 0 : d.secondary,
|
|
829
|
+
backgroundColor: (h = o == null ? void 0 : o.colors) == null ? void 0 : h.appBackground,
|
|
830
|
+
textColor: ($ = o == null ? void 0 : o.colors) == null ? void 0 : $.text,
|
|
831
|
+
borderColor: (y = o == null ? void 0 : o.colors) == null ? void 0 : y.border,
|
|
832
|
+
disabledBackground: (a = o == null ? void 0 : o.colors) == null ? void 0 : a.disabledBackground,
|
|
833
|
+
borderRadius: (m = o == null ? void 0 : o.space) == null ? void 0 : m.radius,
|
|
834
|
+
padding: (p = o == null ? void 0 : o.space) == null ? void 0 : p.padding,
|
|
835
|
+
margin: (U = o == null ? void 0 : o.space) == null ? void 0 : U.margin,
|
|
836
|
+
baseFontSize: (re = (q = o == null ? void 0 : o.fonts) == null ? void 0 : q.body) != null && re.size ? parseInt((ke = (be = o == null ? void 0 : o.fonts) == null ? void 0 : be.body) == null ? void 0 : ke.size, 10) : void 0
|
|
837
|
+
};
|
|
838
|
+
}, [o]), x.useEffect(() => {
|
|
839
|
+
if (!t.tocItems && _.current) {
|
|
840
|
+
const n = setTimeout(() => {
|
|
841
|
+
const d = _.current;
|
|
842
|
+
if (!d) return;
|
|
843
|
+
const $ = Array.from(d.querySelectorAll("h1, h2, h3")).map((y) => {
|
|
844
|
+
var p;
|
|
845
|
+
const a = y.id || ((p = y.textContent) == null ? void 0 : p.trim().replace(/\s+/g, "-").toLowerCase()) || "";
|
|
846
|
+
y.id || (y.id = a);
|
|
847
|
+
const m = y.tagName === "H1" ? 1 : y.tagName === "H2" ? 2 : 3;
|
|
848
|
+
return { id: a, label: y.textContent || "", level: m };
|
|
849
|
+
});
|
|
850
|
+
L($);
|
|
851
|
+
}, 100);
|
|
852
|
+
return () => clearTimeout(n);
|
|
853
|
+
}
|
|
854
|
+
}, [s, t.tocItems, b]), x.useEffect(() => {
|
|
855
|
+
if (k) return;
|
|
856
|
+
const d = ((t.tocItems ?? T) || []).map((a) => a.id).filter(Boolean);
|
|
857
|
+
if (d.length === 0) return;
|
|
858
|
+
Z(void 0);
|
|
859
|
+
const h = { root: null, rootMargin: "0px 0px -70% 0px", threshold: 0 }, $ = (a) => {
|
|
860
|
+
var p, U;
|
|
861
|
+
const m = a.filter((q) => q.isIntersecting).sort((q, re) => q.boundingClientRect.top - re.boundingClientRect.top);
|
|
862
|
+
(U = (p = m[0]) == null ? void 0 : p.target) != null && U.id && Z(m[0].target.id);
|
|
863
|
+
}, y = new IntersectionObserver($, h);
|
|
864
|
+
return d.forEach((a) => {
|
|
865
|
+
const m = document.getElementById(a);
|
|
866
|
+
m && y.observe(m);
|
|
867
|
+
}), () => y.disconnect();
|
|
868
|
+
}, [T, k, t.tocItems, b]);
|
|
869
|
+
const pe = (n, d) => {
|
|
870
|
+
if (!n || n.length === 0) return;
|
|
871
|
+
const h = Math.max(0, n.findIndex((y) => y.key === d)), $ = n[(h + 1) % n.length];
|
|
872
|
+
return $ == null ? void 0 : $.key;
|
|
873
|
+
}, ne = (n) => {
|
|
874
|
+
const d = document.getElementById(n);
|
|
875
|
+
d && d.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
|
|
876
|
+
};
|
|
877
|
+
return /* @__PURE__ */ e(De, { theme: o, mode: V.mode, children: /* @__PURE__ */ f(
|
|
878
|
+
Qe,
|
|
879
|
+
{
|
|
880
|
+
style: {
|
|
881
|
+
background: o.colors.appBackground,
|
|
882
|
+
color: o.colors.text,
|
|
883
|
+
fontFamily: ((ie = (G = o.fonts) == null ? void 0 : G.body) == null ? void 0 : ie.family) || "PingFang SC, Microsoft YaHei, Arial, sans-serif"
|
|
884
|
+
},
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ f(
|
|
887
|
+
Ue,
|
|
888
|
+
{
|
|
889
|
+
style: {
|
|
890
|
+
background: o.colors.panelBackground || o.colors.dashboardBackground || "rgba(255,255,255,0.6)",
|
|
891
|
+
color: o.colors.text
|
|
892
|
+
},
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ f(et, { children: [
|
|
895
|
+
w,
|
|
896
|
+
i && i.length > 0 && /* @__PURE__ */ e(ut, { children: i.map((n) => /* @__PURE__ */ e(
|
|
897
|
+
E,
|
|
898
|
+
{
|
|
899
|
+
$active: n.key === C,
|
|
900
|
+
onClick: () => M == null ? void 0 : M(n.key),
|
|
901
|
+
title: n.label,
|
|
902
|
+
children: n.label
|
|
903
|
+
},
|
|
904
|
+
n.key
|
|
905
|
+
)) })
|
|
906
|
+
] }),
|
|
907
|
+
/* @__PURE__ */ f(tt, { children: [
|
|
908
|
+
/* @__PURE__ */ e("div", { className: "hide-on-desktop", style: { display: "none" } }),
|
|
909
|
+
R && R.length > 0 && /* @__PURE__ */ e(
|
|
910
|
+
we,
|
|
911
|
+
{
|
|
912
|
+
onClick: () => {
|
|
913
|
+
const n = pe(R, j);
|
|
914
|
+
n && (u == null || u(n));
|
|
915
|
+
},
|
|
916
|
+
title: ((Q = R.find((n) => n.key === j)) == null ? void 0 : Q.label) || "Language",
|
|
917
|
+
"aria-label": "language",
|
|
918
|
+
style: { color: o.colors.text },
|
|
919
|
+
children: /* @__PURE__ */ f("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
920
|
+
/* @__PURE__ */ e("path", { d: "M12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9-9 4.03-9 9 4.03 9 9 9Z", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
921
|
+
/* @__PURE__ */ e("path", { d: "M3 12h18M12 3c-2.5 2.5-3.75 5.167-3.75 9S9.5 19.5 12 21c2.5-1.5 3.75-4.167 3.75-8S14.5 5.5 12 3Z", stroke: "currentColor", strokeWidth: "1.6" })
|
|
922
|
+
] })
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ e(gt, {}),
|
|
926
|
+
c && c.length > 0 && /* @__PURE__ */ e(
|
|
927
|
+
we,
|
|
928
|
+
{
|
|
929
|
+
onClick: () => {
|
|
930
|
+
const n = pe(c, F);
|
|
931
|
+
n && (D == null || D(n));
|
|
932
|
+
},
|
|
933
|
+
title: ((xe = c.find((n) => n.key === F)) == null ? void 0 : xe.label) || "Theme",
|
|
934
|
+
"aria-label": "theme",
|
|
935
|
+
style: { color: o.colors.text },
|
|
936
|
+
children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z", stroke: "currentColor", strokeWidth: "1.6" }) })
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
/* @__PURE__ */ e("div", { className: "mobile-only", style: { display: "none" }, children: /* @__PURE__ */ e(E, { onClick: () => O(!0), title: "\u6253\u5F00\u76EE\u5F55", children: "\u76EE\u5F55" }) })
|
|
940
|
+
] })
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
),
|
|
944
|
+
(() => {
|
|
945
|
+
const d = (Array.isArray(r) ? r.length : 0) > 1, h = d ? P ? "10px" : "var(--sidebar-width)" : "0px", $ = X ? "10px" : "var(--toc-width)", y = d ? `${h} 1fr ${$}` : `1fr ${$}`;
|
|
946
|
+
return /* @__PURE__ */ f(ot, { style: { gridTemplateColumns: y }, children: [
|
|
947
|
+
d && /* @__PURE__ */ f(nt, { children: [
|
|
948
|
+
/* @__PURE__ */ e(it, { $collapsed: P, children: /* @__PURE__ */ e(lt, { children: r && r.length > 0 && /* @__PURE__ */ e("div", { children: Object.entries(
|
|
949
|
+
r.reduce((a, m) => {
|
|
950
|
+
const p = m.group || "\u6587\u6863";
|
|
951
|
+
return a[p] = a[p] || [], a[p].push(m), a;
|
|
952
|
+
}, {})
|
|
953
|
+
).map(([a, m]) => /* @__PURE__ */ f("div", { children: [
|
|
954
|
+
/* @__PURE__ */ e(ue, { children: a }),
|
|
955
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children: m.map((p) => /* @__PURE__ */ e(
|
|
956
|
+
E,
|
|
957
|
+
{
|
|
958
|
+
$active: p.id === Y,
|
|
959
|
+
onClick: () => {
|
|
960
|
+
p.href && (p.href.startsWith("#") ? ne(p.href.slice(1)) : window.location.href = p.href), S == null || S(p), O(!1);
|
|
961
|
+
},
|
|
962
|
+
title: p.label,
|
|
963
|
+
children: p.label
|
|
964
|
+
},
|
|
965
|
+
p.id
|
|
966
|
+
)) })
|
|
967
|
+
] }, a)) }) }) }),
|
|
968
|
+
B && d && /* @__PURE__ */ e(rt, { onClick: () => te((a) => !a), title: P ? "\u5C55\u5F00\u5DE6\u4FA7\u680F" : "\u6536\u8D77\u5DE6\u4FA7\u680F", "aria-label": "toggle-left", children: P ? /* @__PURE__ */ e("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { d: "M9 6l6 6-6 6", stroke: "currentColor", strokeWidth: "1.6" }) }) : /* @__PURE__ */ e("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { d: "M15 6l-6 6 6 6", stroke: "currentColor", strokeWidth: "1.6" }) }) })
|
|
969
|
+
] }),
|
|
970
|
+
/* @__PURE__ */ e(at, { children: /* @__PURE__ */ e(
|
|
971
|
+
st,
|
|
972
|
+
{
|
|
973
|
+
ref: _,
|
|
974
|
+
children: /* @__PURE__ */ e(ct, { $opacity: v, children: J })
|
|
975
|
+
}
|
|
976
|
+
) }),
|
|
977
|
+
/* @__PURE__ */ e(dt, { children: /* @__PURE__ */ e(ht, { children: /* @__PURE__ */ f(pt, { $collapsed: X, children: [
|
|
978
|
+
/* @__PURE__ */ e(ue, { children: "\u672C\u9875\u76EE\u5F55" }),
|
|
979
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children: ((t.tocItems ?? T) || []).map((a) => /* @__PURE__ */ e(
|
|
980
|
+
E,
|
|
981
|
+
{
|
|
982
|
+
$active: (k ? W : H) === a.id,
|
|
983
|
+
onClick: () => {
|
|
984
|
+
ne(a.id), I == null || I(a);
|
|
985
|
+
},
|
|
986
|
+
title: a.label,
|
|
987
|
+
style: { paddingLeft: Math.max(0, (a.level || 1) - 1) * 12 + 10 },
|
|
988
|
+
children: a.label
|
|
989
|
+
},
|
|
990
|
+
a.id
|
|
991
|
+
)) })
|
|
992
|
+
] }) }) })
|
|
993
|
+
] });
|
|
994
|
+
})(),
|
|
995
|
+
oe && /* @__PURE__ */ e(
|
|
996
|
+
"div",
|
|
997
|
+
{
|
|
998
|
+
role: "dialog",
|
|
999
|
+
"aria-modal": "true",
|
|
1000
|
+
style: {
|
|
1001
|
+
position: "fixed",
|
|
1002
|
+
inset: 0,
|
|
1003
|
+
zIndex: 40,
|
|
1004
|
+
background: "rgba(0,0,0,0.45)",
|
|
1005
|
+
display: "flex"
|
|
1006
|
+
},
|
|
1007
|
+
onClick: () => O(!1),
|
|
1008
|
+
children: /* @__PURE__ */ f(
|
|
1009
|
+
"div",
|
|
1010
|
+
{
|
|
1011
|
+
style: {
|
|
1012
|
+
width: "82%",
|
|
1013
|
+
maxWidth: 320,
|
|
1014
|
+
height: "100%",
|
|
1015
|
+
background: o.colors.panelBackground || o.colors.dashboardBackground || "#fff",
|
|
1016
|
+
color: o.colors.text,
|
|
1017
|
+
borderRight: `1px solid ${o.colors.border}`,
|
|
1018
|
+
padding: 12
|
|
1019
|
+
},
|
|
1020
|
+
onClick: (n) => n.stopPropagation(),
|
|
1021
|
+
children: [
|
|
1022
|
+
/* @__PURE__ */ f("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 8 }, children: [
|
|
1023
|
+
/* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children: "\u76EE\u5F55" }),
|
|
1024
|
+
/* @__PURE__ */ e(E, { onClick: () => O(!1), children: "\u5173\u95ED" })
|
|
1025
|
+
] }),
|
|
1026
|
+
r && r.length > 0 && /* @__PURE__ */ e("div", { style: { overflow: "auto", height: "calc(100% - 40px)" }, children: Object.entries(
|
|
1027
|
+
r.reduce((n, d) => {
|
|
1028
|
+
const h = d.group || "\u6587\u6863";
|
|
1029
|
+
return n[h] = n[h] || [], n[h].push(d), n;
|
|
1030
|
+
}, {})
|
|
1031
|
+
).map(([n, d]) => /* @__PURE__ */ f("div", { children: [
|
|
1032
|
+
/* @__PURE__ */ e(ue, { children: n }),
|
|
1033
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children: d.map((h) => /* @__PURE__ */ e(
|
|
1034
|
+
E,
|
|
1035
|
+
{
|
|
1036
|
+
$active: h.id === Y,
|
|
1037
|
+
onClick: () => {
|
|
1038
|
+
h.href && (h.href.startsWith("#") ? ne(h.href.slice(1)) : window.location.href = h.href), S == null || S(h), O(!1);
|
|
1039
|
+
},
|
|
1040
|
+
children: h.label
|
|
1041
|
+
},
|
|
1042
|
+
h.id
|
|
1043
|
+
)) })
|
|
1044
|
+
] }, n)) })
|
|
1045
|
+
]
|
|
1046
|
+
}
|
|
1047
|
+
)
|
|
1048
|
+
}
|
|
1049
|
+
)
|
|
1050
|
+
]
|
|
1051
|
+
}
|
|
1052
|
+
) });
|
|
568
1053
|
};
|
|
569
1054
|
export {
|
|
570
|
-
|
|
571
|
-
|
|
1055
|
+
mt as DashboardContainer,
|
|
1056
|
+
Ct as DockContainer,
|
|
1057
|
+
$t as DocmentContainer
|
|
572
1058
|
};
|