@mxmweb/zui-layouts 1.3.2 → 1.3.3
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/index.js +120 -108
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as g, Fragment as Ie } from "react/jsx-runtime";
|
|
2
2
|
import * as R from "react";
|
|
3
3
|
import x, { forwardRef as me, createElement as xe } from "react";
|
|
4
4
|
import l from "styled-components";
|
|
@@ -50,7 +50,7 @@ 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 Ve = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), $e = (...t) => t.filter((c,
|
|
53
|
+
const Ve = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), $e = (...t) => t.filter((c, k, b) => !!c && c.trim() !== "" && b.indexOf(c) === k).join(" ").trim();
|
|
54
54
|
/**
|
|
55
55
|
* @license lucide-react v0.456.0 - ISC
|
|
56
56
|
*
|
|
@@ -78,7 +78,7 @@ const He = me(
|
|
|
78
78
|
({
|
|
79
79
|
color: t = "currentColor",
|
|
80
80
|
size: c = 24,
|
|
81
|
-
strokeWidth:
|
|
81
|
+
strokeWidth: k = 2,
|
|
82
82
|
absoluteStrokeWidth: b,
|
|
83
83
|
className: i = "",
|
|
84
84
|
children: $,
|
|
@@ -92,7 +92,7 @@ const He = me(
|
|
|
92
92
|
width: c,
|
|
93
93
|
height: c,
|
|
94
94
|
stroke: t,
|
|
95
|
-
strokeWidth: b ? Number(
|
|
95
|
+
strokeWidth: b ? Number(k) * 24 / Number(c) : k,
|
|
96
96
|
className: $e("lucide", i),
|
|
97
97
|
...z
|
|
98
98
|
},
|
|
@@ -109,7 +109,7 @@ const He = me(
|
|
|
109
109
|
* See the LICENSE file in the root directory of this source tree.
|
|
110
110
|
*/
|
|
111
111
|
const Be = (t, c) => {
|
|
112
|
-
const
|
|
112
|
+
const k = me(
|
|
113
113
|
({ className: b, ...i }, $) => xe(He, {
|
|
114
114
|
ref: $,
|
|
115
115
|
iconNode: c,
|
|
@@ -117,7 +117,7 @@ const Be = (t, c) => {
|
|
|
117
117
|
...i
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
|
-
return
|
|
120
|
+
return k.displayName = `${t}`, k;
|
|
121
121
|
};
|
|
122
122
|
/**
|
|
123
123
|
* @license lucide-react v0.456.0 - ISC
|
|
@@ -204,7 +204,7 @@ const se = Be("ChevronRight", [
|
|
|
204
204
|
text-overflow: ellipsis;
|
|
205
205
|
flex: 1;
|
|
206
206
|
min-width: 0;
|
|
207
|
-
`,
|
|
207
|
+
`, ve = l.div`
|
|
208
208
|
display: flex;
|
|
209
209
|
align-items: center;
|
|
210
210
|
gap: 4px;
|
|
@@ -252,7 +252,7 @@ l.div`
|
|
|
252
252
|
const $t = ({
|
|
253
253
|
children: t,
|
|
254
254
|
goBack: c,
|
|
255
|
-
title:
|
|
255
|
+
title: k,
|
|
256
256
|
description: b,
|
|
257
257
|
breadcrumbs: i,
|
|
258
258
|
dockItems: $,
|
|
@@ -272,19 +272,19 @@ const $t = ({
|
|
|
272
272
|
d != null && d.onGoBack ? d.onGoBack() : c && c();
|
|
273
273
|
}, j = () => {
|
|
274
274
|
d != null && d.onTitleClick && d.onTitleClick();
|
|
275
|
-
}, A = (
|
|
276
|
-
d != null && d.onBreadcrumbClick ? d.onBreadcrumbClick(
|
|
277
|
-
}, I = (
|
|
278
|
-
d != null && d.onDockItemClick && d.onDockItemClick(
|
|
275
|
+
}, A = (w, G) => {
|
|
276
|
+
d != null && d.onBreadcrumbClick ? d.onBreadcrumbClick(w, G) : w.onClick && w.onClick();
|
|
277
|
+
}, I = (w, G) => {
|
|
278
|
+
d != null && d.onDockItemClick && d.onDockItemClick(w, G);
|
|
279
279
|
}, F = () => {
|
|
280
280
|
if (!i || i.length === 0) return null;
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
281
|
+
const w = x.useRef(null), [G, X] = x.useState({ start: 0, end: i.length, showEllipsis: !1 }), Z = x.useCallback(() => {
|
|
282
|
+
if (!w.current || i.length <= 3) {
|
|
283
283
|
X({ start: 0, end: i.length, showEllipsis: !1 });
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
|
-
const
|
|
287
|
-
let K = Math.floor((
|
|
286
|
+
const y = w.current.offsetWidth * 0.5;
|
|
287
|
+
let K = Math.floor((y - 30) / (120 + 20));
|
|
288
288
|
if (K < 2 && (K = 2), K >= i.length) {
|
|
289
289
|
X({ start: 0, end: i.length, showEllipsis: !1 });
|
|
290
290
|
return;
|
|
@@ -298,48 +298,48 @@ const $t = ({
|
|
|
298
298
|
}, [i.length]);
|
|
299
299
|
if (x.useEffect(() => {
|
|
300
300
|
Z();
|
|
301
|
-
const
|
|
301
|
+
const f = new ResizeObserver(() => {
|
|
302
302
|
Z();
|
|
303
303
|
});
|
|
304
|
-
return
|
|
305
|
-
|
|
304
|
+
return w.current && f.observe(w.current), () => {
|
|
305
|
+
f.disconnect();
|
|
306
306
|
};
|
|
307
307
|
}, [Z]), i.length <= 3)
|
|
308
|
-
return /* @__PURE__ */ e(
|
|
308
|
+
return /* @__PURE__ */ e(ve, { children: i.map((f, y) => /* @__PURE__ */ g(x.Fragment, { children: [
|
|
309
309
|
/* @__PURE__ */ e(
|
|
310
310
|
ce,
|
|
311
311
|
{
|
|
312
|
-
$isLast:
|
|
313
|
-
$isClickable: !!(
|
|
314
|
-
onClick: () => A(
|
|
312
|
+
$isLast: y === i.length - 1,
|
|
313
|
+
$isClickable: !!(y < i.length - 1 || f.onClick),
|
|
314
|
+
onClick: () => A(f, y),
|
|
315
315
|
style: {
|
|
316
|
-
color:
|
|
316
|
+
color: y === i.length - 1 ? r.colors.text : r.colors.textSecondary || r.colors.disabledText
|
|
317
317
|
},
|
|
318
|
-
title:
|
|
319
|
-
children:
|
|
318
|
+
title: f.label,
|
|
319
|
+
children: f.label
|
|
320
320
|
}
|
|
321
321
|
),
|
|
322
|
-
|
|
323
|
-
] },
|
|
322
|
+
y < i.length - 1 && /* @__PURE__ */ e(de, { children: /* @__PURE__ */ e(se, { size: 14 }) })
|
|
323
|
+
] }, f.id)) });
|
|
324
324
|
const { start: N, end: D, showEllipsis: ee } = G;
|
|
325
|
-
return /* @__PURE__ */
|
|
326
|
-
i.slice(N, D).map((
|
|
325
|
+
return /* @__PURE__ */ g(ve, { children: [
|
|
326
|
+
i.slice(N, D).map((f, y) => /* @__PURE__ */ g(x.Fragment, { children: [
|
|
327
327
|
/* @__PURE__ */ e(
|
|
328
328
|
ce,
|
|
329
329
|
{
|
|
330
|
-
$isLast:
|
|
331
|
-
$isClickable: !!(
|
|
332
|
-
onClick: () => A(
|
|
330
|
+
$isLast: y === D - N - 1 && !ee,
|
|
331
|
+
$isClickable: !!(y < D - N - 1 || f.onClick),
|
|
332
|
+
onClick: () => A(f, N + y),
|
|
333
333
|
style: {
|
|
334
|
-
color:
|
|
334
|
+
color: y === D - N - 1 && !ee ? r.colors.text : r.colors.textSecondary || r.colors.disabledText
|
|
335
335
|
},
|
|
336
|
-
title:
|
|
337
|
-
children:
|
|
336
|
+
title: f.label,
|
|
337
|
+
children: f.label
|
|
338
338
|
}
|
|
339
339
|
),
|
|
340
|
-
|
|
341
|
-
] },
|
|
342
|
-
ee && /* @__PURE__ */
|
|
340
|
+
y < D - N - 1 && /* @__PURE__ */ e(de, { children: /* @__PURE__ */ e(se, { size: 14 }) })
|
|
341
|
+
] }, f.id)),
|
|
342
|
+
ee && /* @__PURE__ */ g(Ie, { children: [
|
|
343
343
|
/* @__PURE__ */ e(de, { children: /* @__PURE__ */ e(se, { size: 14 }) }),
|
|
344
344
|
/* @__PURE__ */ e(
|
|
345
345
|
ce,
|
|
@@ -351,7 +351,7 @@ const $t = ({
|
|
|
351
351
|
cursor: "default",
|
|
352
352
|
maxWidth: "auto"
|
|
353
353
|
},
|
|
354
|
-
title: `${i.slice(D, -1).map((
|
|
354
|
+
title: `${i.slice(D, -1).map((f) => f.label).join(" > ")}`,
|
|
355
355
|
children: "..."
|
|
356
356
|
}
|
|
357
357
|
),
|
|
@@ -380,19 +380,19 @@ const $t = ({
|
|
|
380
380
|
color: r.colors.text,
|
|
381
381
|
fontFamily: ((o = (H = r.fonts) == null ? void 0 : H.body) == null ? void 0 : o.family) || "PingFang SC, Microsoft YaHei, Arial, sans-serif"
|
|
382
382
|
},
|
|
383
|
-
children: /* @__PURE__ */
|
|
383
|
+
children: /* @__PURE__ */ g("div", { style: { height: "100%", display: "flex", width: "100%", gap: 12 }, children: [
|
|
384
384
|
$ && $.length > 0 && /* @__PURE__ */ e("div", { style: { flex: `0 0 ${ne ? 72 : 28}px`, transition: "flex-basis .2s ease" }, children: /* @__PURE__ */ e(
|
|
385
385
|
Te,
|
|
386
386
|
{
|
|
387
387
|
items: $,
|
|
388
388
|
open: ne,
|
|
389
389
|
onOpenChange: he,
|
|
390
|
-
onItemClick: (
|
|
390
|
+
onItemClick: (w) => I({ id: String(w.key), label: w.name }, 0),
|
|
391
391
|
defaultOpen: !0
|
|
392
392
|
}
|
|
393
393
|
) }),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
(
|
|
394
|
+
/* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", flex: 1, minWidth: 0 }, children: [
|
|
395
|
+
(k || b || c || i) && /* @__PURE__ */ g(Ke, { ref: q, children: [
|
|
396
396
|
c && /* @__PURE__ */ e(
|
|
397
397
|
Ye,
|
|
398
398
|
{
|
|
@@ -403,7 +403,7 @@ const $t = ({
|
|
|
403
403
|
}
|
|
404
404
|
),
|
|
405
405
|
F(),
|
|
406
|
-
|
|
406
|
+
k && /* @__PURE__ */ e(
|
|
407
407
|
Ee,
|
|
408
408
|
{
|
|
409
409
|
onClick: j,
|
|
@@ -412,8 +412,8 @@ const $t = ({
|
|
|
412
412
|
fontSize: ((ie = (_ = r.fonts) == null ? void 0 : _.heading) == null ? void 0 : ie.size) || "16px",
|
|
413
413
|
fontWeight: ((pe = (U = r.fonts) == null ? void 0 : U.heading) == null ? void 0 : pe.weight) || "600"
|
|
414
414
|
},
|
|
415
|
-
title:
|
|
416
|
-
children:
|
|
415
|
+
title: k,
|
|
416
|
+
children: k
|
|
417
417
|
}
|
|
418
418
|
),
|
|
419
419
|
b && /* @__PURE__ */ e(
|
|
@@ -507,7 +507,7 @@ const $t = ({
|
|
|
507
507
|
`, Bt = ({
|
|
508
508
|
children: t,
|
|
509
509
|
backgroundImage: c,
|
|
510
|
-
backgroundColor:
|
|
510
|
+
backgroundColor: k,
|
|
511
511
|
header: b,
|
|
512
512
|
dockItems: i,
|
|
513
513
|
dockActiveMode: $ = "single",
|
|
@@ -529,11 +529,11 @@ const $t = ({
|
|
|
529
529
|
}, T = (I, F) => {
|
|
530
530
|
u != null && u.onDockActiveChangeMultiple && u.onDockActiveChangeMultiple(I, F);
|
|
531
531
|
};
|
|
532
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ g(
|
|
533
533
|
Ze,
|
|
534
534
|
{
|
|
535
535
|
backgroundImage: c,
|
|
536
|
-
backgroundColor:
|
|
536
|
+
backgroundColor: k,
|
|
537
537
|
children: [
|
|
538
538
|
b && /* @__PURE__ */ e(Je, { children: b }),
|
|
539
539
|
/* @__PURE__ */ e(
|
|
@@ -599,7 +599,7 @@ const $t = ({
|
|
|
599
599
|
display: flex;
|
|
600
600
|
align-items: center;
|
|
601
601
|
gap: 8px;
|
|
602
|
-
`,
|
|
602
|
+
`, ye = l.button`
|
|
603
603
|
display: inline-flex;
|
|
604
604
|
align-items: center;
|
|
605
605
|
justify-content: center;
|
|
@@ -690,16 +690,21 @@ const $t = ({
|
|
|
690
690
|
/* 右侧目录独立滚动 */
|
|
691
691
|
position: relative;
|
|
692
692
|
height: 100%;
|
|
693
|
-
|
|
693
|
+
width: 100%;
|
|
694
|
+
max-width: var(--toc-width);
|
|
695
|
+
overflow-x: hidden; /* 禁止横向滚动 */
|
|
696
|
+
overflow-y: auto; /* 只允许垂直滚动 */
|
|
694
697
|
padding-left: 8px;
|
|
695
698
|
border-left: 1px solid rgba(0,0,0,0.06);
|
|
696
699
|
background: transparent;
|
|
697
700
|
z-index: 1;
|
|
698
|
-
`,
|
|
701
|
+
`, ft = l.div`
|
|
699
702
|
transition: opacity .2s ease, transform .2s ease;
|
|
700
703
|
opacity: ${(t) => t.$collapsed ? 0 : 1};
|
|
701
704
|
transform: translateX(${(t) => t.$collapsed ? "6px" : "0px"});
|
|
702
705
|
pointer-events: ${(t) => t.$collapsed ? "none" : "auto"};
|
|
706
|
+
width: 100%;
|
|
707
|
+
max-width: 100%;
|
|
703
708
|
/* 不设置高度限制,让内容自然流动,由父容器 TocFloat 控制滚动 */
|
|
704
709
|
`;
|
|
705
710
|
l.button`
|
|
@@ -718,15 +723,12 @@ l.button`
|
|
|
718
723
|
transition: background .15s ease;
|
|
719
724
|
&:hover { background: rgba(0,0,0,0.12); }
|
|
720
725
|
`;
|
|
721
|
-
const
|
|
726
|
+
const ge = l.div`
|
|
722
727
|
font-size: 12px;
|
|
723
728
|
opacity: .7;
|
|
724
729
|
padding: 8px 8px;
|
|
725
730
|
`, Q = l.button`
|
|
726
731
|
width: 100%;
|
|
727
|
-
display: flex;
|
|
728
|
-
align-items: center;
|
|
729
|
-
gap: 8px;
|
|
730
732
|
padding: 8px 10px;
|
|
731
733
|
background: transparent;
|
|
732
734
|
border: none;
|
|
@@ -736,14 +738,24 @@ const fe = l.div`
|
|
|
736
738
|
color: inherit;
|
|
737
739
|
transition: background .15s ease, color .15s ease;
|
|
738
740
|
font-size: 13px;
|
|
739
|
-
|
|
741
|
+
line-height: 1.5;
|
|
742
|
+
word-wrap: break-word;
|
|
743
|
+
word-break: break-word;
|
|
744
|
+
overflow-wrap: break-word;
|
|
745
|
+
/* 限制为最多两行,超出显示省略号 */
|
|
746
|
+
display: -webkit-box;
|
|
747
|
+
-webkit-line-clamp: 2;
|
|
748
|
+
-webkit-box-orient: vertical;
|
|
749
|
+
overflow: hidden;
|
|
750
|
+
text-overflow: ellipsis;
|
|
751
|
+
min-width: 0; /* 允许内容收缩 */
|
|
740
752
|
|
|
741
753
|
&:hover {
|
|
742
754
|
background: rgba(0,0,0,0.04);
|
|
743
755
|
}
|
|
744
756
|
|
|
745
757
|
${(t) => t.$active ? "background: rgba(0,0,0,0.08); font-weight: 600;" : ""}
|
|
746
|
-
`,
|
|
758
|
+
`, gt = l.div`
|
|
747
759
|
display: flex;
|
|
748
760
|
align-items: center;
|
|
749
761
|
gap: 8px;
|
|
@@ -772,7 +784,7 @@ const fe = l.div`
|
|
|
772
784
|
shadow: "0 1px 2px rgba(0,0,0,0.06)"
|
|
773
785
|
}
|
|
774
786
|
}
|
|
775
|
-
},
|
|
787
|
+
}, wt = {
|
|
776
788
|
theme: {
|
|
777
789
|
...M,
|
|
778
790
|
colors: {
|
|
@@ -788,10 +800,10 @@ const fe = l.div`
|
|
|
788
800
|
},
|
|
789
801
|
mode: "dark"
|
|
790
802
|
}, Dt = (t) => {
|
|
791
|
-
var K, ae, te,
|
|
803
|
+
var K, ae, te, we;
|
|
792
804
|
const {
|
|
793
805
|
children: c,
|
|
794
|
-
headerLogo:
|
|
806
|
+
headerLogo: k,
|
|
795
807
|
contentKey: b,
|
|
796
808
|
modules: i,
|
|
797
809
|
activeModuleKey: $,
|
|
@@ -809,25 +821,25 @@ const fe = l.div`
|
|
|
809
821
|
onTocItemClick: A,
|
|
810
822
|
collapsibleSidebar: I = !0,
|
|
811
823
|
styles: F
|
|
812
|
-
} = t, ne = be(), he = t.activeThemeKey === "dark" ?
|
|
824
|
+
} = t, ne = be(), he = t.activeThemeKey === "dark" ? wt : bt, H = E(
|
|
813
825
|
E(
|
|
814
826
|
E({ theme: M, mode: "light" }, ne),
|
|
815
827
|
he
|
|
816
828
|
),
|
|
817
829
|
F
|
|
818
|
-
), o = (H == null ? void 0 : H.theme) || M, [_, ie] = x.useState(!1), [U, pe] = x.useState(!1), [re, V] = x.useState(!1),
|
|
830
|
+
), o = (H == null ? void 0 : H.theme) || M, [_, ie] = x.useState(!1), [U, pe] = x.useState(!1), [re, V] = x.useState(!1), w = typeof j == "string", [G, X] = x.useState(j), Z = x.useRef(null), [N, D] = x.useState(void 0), [ee, f] = x.useState(c), [y, ue] = x.useState(1);
|
|
819
831
|
x.useEffect(() => {
|
|
820
832
|
if (b === void 0) {
|
|
821
|
-
|
|
833
|
+
f(c);
|
|
822
834
|
return;
|
|
823
835
|
}
|
|
824
836
|
ue(0);
|
|
825
837
|
const n = setTimeout(() => {
|
|
826
|
-
|
|
838
|
+
f(c), requestAnimationFrame(() => ue(1));
|
|
827
839
|
}, 120);
|
|
828
840
|
return () => clearTimeout(n);
|
|
829
841
|
}, [b, c]), x.useMemo(() => {
|
|
830
|
-
var n, h, s, m, B, a,
|
|
842
|
+
var n, h, s, m, B, a, v, p, Y, C, W, J, oe;
|
|
831
843
|
return {
|
|
832
844
|
primaryColor: (n = o == null ? void 0 : o.colors) == null ? void 0 : n.primary,
|
|
833
845
|
secondaryColor: (h = o == null ? void 0 : o.colors) == null ? void 0 : h.secondary,
|
|
@@ -835,7 +847,7 @@ const fe = l.div`
|
|
|
835
847
|
textColor: (m = o == null ? void 0 : o.colors) == null ? void 0 : m.text,
|
|
836
848
|
borderColor: (B = o == null ? void 0 : o.colors) == null ? void 0 : B.border,
|
|
837
849
|
disabledBackground: (a = o == null ? void 0 : o.colors) == null ? void 0 : a.disabledBackground,
|
|
838
|
-
borderRadius: (
|
|
850
|
+
borderRadius: (v = o == null ? void 0 : o.space) == null ? void 0 : v.radius,
|
|
839
851
|
padding: (p = o == null ? void 0 : o.space) == null ? void 0 : p.padding,
|
|
840
852
|
margin: (Y = o == null ? void 0 : o.space) == null ? void 0 : Y.margin,
|
|
841
853
|
baseFontSize: (W = (C = o == null ? void 0 : o.fonts) == null ? void 0 : C.body) != null && W.size ? parseInt((oe = (J = o == null ? void 0 : o.fonts) == null ? void 0 : J.body) == null ? void 0 : oe.size, 10) : void 0
|
|
@@ -854,14 +866,14 @@ const fe = l.div`
|
|
|
854
866
|
n < h ? (n++, s = setTimeout(B, 200)) : D([]);
|
|
855
867
|
return;
|
|
856
868
|
}
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
869
|
+
const v = Array.from(a.querySelectorAll("h1, h2, h3"));
|
|
870
|
+
if (v.length === 0) {
|
|
859
871
|
n < h ? (n++, s = setTimeout(B, 200)) : D([]);
|
|
860
872
|
return;
|
|
861
873
|
}
|
|
862
|
-
const p = /* @__PURE__ */ new Map(), Y =
|
|
863
|
-
var
|
|
864
|
-
const W = C.id || ((
|
|
874
|
+
const p = /* @__PURE__ */ new Map(), Y = v.map((C) => {
|
|
875
|
+
var ke;
|
|
876
|
+
const W = C.id || ((ke = C.textContent) == null ? void 0 : ke.trim().replace(/\s+/g, "-").toLowerCase()) || "", J = p.get(W) || 0;
|
|
865
877
|
p.set(W, J + 1);
|
|
866
878
|
const oe = J > 0 ? `${W}-${J}` : W;
|
|
867
879
|
C.id || (C.id = oe);
|
|
@@ -877,21 +889,21 @@ const fe = l.div`
|
|
|
877
889
|
};
|
|
878
890
|
}
|
|
879
891
|
}, [c, t.tocItems, b]), x.useEffect(() => {
|
|
880
|
-
if (
|
|
892
|
+
if (w) return;
|
|
881
893
|
const h = ((t.tocItems ?? N) || []).map((a) => a.id).filter(Boolean);
|
|
882
894
|
if (h.length === 0) return;
|
|
883
895
|
X(void 0);
|
|
884
896
|
const s = { root: null, rootMargin: "0px 0px -70% 0px", threshold: 0 }, m = (a) => {
|
|
885
897
|
var p, Y;
|
|
886
|
-
const
|
|
887
|
-
(Y = (p =
|
|
898
|
+
const v = a.filter((C) => C.isIntersecting).sort((C, W) => C.boundingClientRect.top - W.boundingClientRect.top);
|
|
899
|
+
(Y = (p = v[0]) == null ? void 0 : p.target) != null && Y.id && X(v[0].target.id);
|
|
888
900
|
}, B = new IntersectionObserver(m, s);
|
|
889
901
|
return h.forEach((a) => {
|
|
890
|
-
const
|
|
891
|
-
|
|
902
|
+
const v = document.getElementById(a);
|
|
903
|
+
v && B.observe(v);
|
|
892
904
|
}), () => B.disconnect();
|
|
893
|
-
}, [N,
|
|
894
|
-
const
|
|
905
|
+
}, [N, w, t.tocItems, b]);
|
|
906
|
+
const fe = (n, h) => {
|
|
895
907
|
if (!n || n.length === 0) return;
|
|
896
908
|
const s = Math.max(0, n.findIndex((B) => B.key === h)), m = n[(s + 1) % n.length];
|
|
897
909
|
return m == null ? void 0 : m.key;
|
|
@@ -899,7 +911,7 @@ const fe = l.div`
|
|
|
899
911
|
const h = document.getElementById(n);
|
|
900
912
|
h && h.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
|
|
901
913
|
};
|
|
902
|
-
return /* @__PURE__ */ e(Se, { theme: o, mode: H.mode, children: /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ e(Se, { theme: o, mode: H.mode, children: /* @__PURE__ */ g(
|
|
903
915
|
et,
|
|
904
916
|
{
|
|
905
917
|
style: {
|
|
@@ -908,7 +920,7 @@ const fe = l.div`
|
|
|
908
920
|
fontFamily: ((ae = (K = o.fonts) == null ? void 0 : K.body) == null ? void 0 : ae.family) || "PingFang SC, Microsoft YaHei, Arial, sans-serif"
|
|
909
921
|
},
|
|
910
922
|
children: [
|
|
911
|
-
/* @__PURE__ */
|
|
923
|
+
/* @__PURE__ */ g(
|
|
912
924
|
tt,
|
|
913
925
|
{
|
|
914
926
|
style: {
|
|
@@ -916,9 +928,9 @@ const fe = l.div`
|
|
|
916
928
|
color: o.colors.text
|
|
917
929
|
},
|
|
918
930
|
children: [
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
|
|
921
|
-
i && i.length > 0 && /* @__PURE__ */ e(
|
|
931
|
+
/* @__PURE__ */ g(ot, { children: [
|
|
932
|
+
k,
|
|
933
|
+
i && i.length > 0 && /* @__PURE__ */ e(gt, { children: i.map((n) => /* @__PURE__ */ e(
|
|
922
934
|
Q,
|
|
923
935
|
{
|
|
924
936
|
$active: n.key === $,
|
|
@@ -929,19 +941,19 @@ const fe = l.div`
|
|
|
929
941
|
n.key
|
|
930
942
|
)) })
|
|
931
943
|
] }),
|
|
932
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ g(nt, { children: [
|
|
933
945
|
/* @__PURE__ */ e("div", { className: "hide-on-desktop", style: { display: "none" } }),
|
|
934
946
|
z && z.length > 0 && /* @__PURE__ */ e(
|
|
935
|
-
|
|
947
|
+
ye,
|
|
936
948
|
{
|
|
937
949
|
onClick: () => {
|
|
938
|
-
const n =
|
|
950
|
+
const n = fe(z, P);
|
|
939
951
|
n && (u == null || u(n));
|
|
940
952
|
},
|
|
941
953
|
title: ((te = z.find((n) => n.key === P)) == null ? void 0 : te.label) || "Language",
|
|
942
954
|
"aria-label": "language",
|
|
943
955
|
style: { color: o.colors.text },
|
|
944
|
-
children: /* @__PURE__ */
|
|
956
|
+
children: /* @__PURE__ */ g("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
945
957
|
/* @__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" }),
|
|
946
958
|
/* @__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" })
|
|
947
959
|
] })
|
|
@@ -949,13 +961,13 @@ const fe = l.div`
|
|
|
949
961
|
),
|
|
950
962
|
/* @__PURE__ */ e(xt, {}),
|
|
951
963
|
d && d.length > 0 && /* @__PURE__ */ e(
|
|
952
|
-
|
|
964
|
+
ye,
|
|
953
965
|
{
|
|
954
966
|
onClick: () => {
|
|
955
|
-
const n =
|
|
967
|
+
const n = fe(d, L);
|
|
956
968
|
n && (S == null || S(n));
|
|
957
969
|
},
|
|
958
|
-
title: ((
|
|
970
|
+
title: ((we = d.find((n) => n.key === L)) == null ? void 0 : we.label) || "Theme",
|
|
959
971
|
"aria-label": "theme",
|
|
960
972
|
style: { color: o.colors.text },
|
|
961
973
|
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" }) })
|
|
@@ -968,16 +980,16 @@ const fe = l.div`
|
|
|
968
980
|
),
|
|
969
981
|
(() => {
|
|
970
982
|
const h = (Array.isArray(r) ? r.length : 0) > 1, s = h ? _ ? "10px" : "var(--sidebar-width)" : "0px", m = U ? "10px" : "var(--toc-width)", B = h ? `${s} 1fr ${m}` : `1fr ${m}`;
|
|
971
|
-
return /* @__PURE__ */
|
|
972
|
-
h && /* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ g(it, { style: { gridTemplateColumns: B }, children: [
|
|
984
|
+
h && /* @__PURE__ */ g(rt, { children: [
|
|
973
985
|
/* @__PURE__ */ e(lt, { $collapsed: _, children: /* @__PURE__ */ e(st, { children: r && r.length > 0 && /* @__PURE__ */ e("div", { children: Object.entries(
|
|
974
|
-
r.reduce((a,
|
|
975
|
-
const p =
|
|
976
|
-
return a[p] = a[p] || [], a[p].push(
|
|
986
|
+
r.reduce((a, v) => {
|
|
987
|
+
const p = v.group || "\u6587\u6863";
|
|
988
|
+
return a[p] = a[p] || [], a[p].push(v), a;
|
|
977
989
|
}, {})
|
|
978
|
-
).map(([a,
|
|
979
|
-
/* @__PURE__ */ e(
|
|
980
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children:
|
|
990
|
+
).map(([a, v]) => /* @__PURE__ */ g("div", { children: [
|
|
991
|
+
/* @__PURE__ */ e(ge, { children: a }),
|
|
992
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children: v.map((p) => /* @__PURE__ */ e(
|
|
981
993
|
Q,
|
|
982
994
|
{
|
|
983
995
|
$active: p.id === q,
|
|
@@ -996,15 +1008,15 @@ const fe = l.div`
|
|
|
996
1008
|
dt,
|
|
997
1009
|
{
|
|
998
1010
|
ref: Z,
|
|
999
|
-
children: /* @__PURE__ */ e(ht, { $opacity:
|
|
1011
|
+
children: /* @__PURE__ */ e(ht, { $opacity: y, children: ee })
|
|
1000
1012
|
}
|
|
1001
1013
|
) }),
|
|
1002
|
-
/* @__PURE__ */ e(pt, { children: /* @__PURE__ */ e(ut, { children: /* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */ e(
|
|
1014
|
+
/* @__PURE__ */ e(pt, { children: /* @__PURE__ */ e(ut, { children: /* @__PURE__ */ g(ft, { $collapsed: U, children: [
|
|
1015
|
+
/* @__PURE__ */ e(ge, { children: "\u672C\u9875\u76EE\u5F55" }),
|
|
1004
1016
|
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children: ((t.tocItems ?? N) || []).map((a) => /* @__PURE__ */ e(
|
|
1005
1017
|
Q,
|
|
1006
1018
|
{
|
|
1007
|
-
$active: (
|
|
1019
|
+
$active: (w ? j : G) === a.id,
|
|
1008
1020
|
onClick: () => {
|
|
1009
1021
|
le(a.id), A == null || A(a);
|
|
1010
1022
|
},
|
|
@@ -1030,7 +1042,7 @@ const fe = l.div`
|
|
|
1030
1042
|
display: "flex"
|
|
1031
1043
|
},
|
|
1032
1044
|
onClick: () => V(!1),
|
|
1033
|
-
children: /* @__PURE__ */
|
|
1045
|
+
children: /* @__PURE__ */ g(
|
|
1034
1046
|
"div",
|
|
1035
1047
|
{
|
|
1036
1048
|
style: {
|
|
@@ -1044,7 +1056,7 @@ const fe = l.div`
|
|
|
1044
1056
|
},
|
|
1045
1057
|
onClick: (n) => n.stopPropagation(),
|
|
1046
1058
|
children: [
|
|
1047
|
-
/* @__PURE__ */
|
|
1059
|
+
/* @__PURE__ */ g("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 8 }, children: [
|
|
1048
1060
|
/* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children: "\u76EE\u5F55" }),
|
|
1049
1061
|
/* @__PURE__ */ e(Q, { onClick: () => V(!1), children: "\u5173\u95ED" })
|
|
1050
1062
|
] }),
|
|
@@ -1053,8 +1065,8 @@ const fe = l.div`
|
|
|
1053
1065
|
const s = h.group || "\u6587\u6863";
|
|
1054
1066
|
return n[s] = n[s] || [], n[s].push(h), n;
|
|
1055
1067
|
}, {})
|
|
1056
|
-
).map(([n, h]) => /* @__PURE__ */
|
|
1057
|
-
/* @__PURE__ */ e(
|
|
1068
|
+
).map(([n, h]) => /* @__PURE__ */ g("div", { children: [
|
|
1069
|
+
/* @__PURE__ */ e(ge, { children: n }),
|
|
1058
1070
|
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "0 8px 8px 8px" }, children: h.map((s) => /* @__PURE__ */ e(
|
|
1059
1071
|
Q,
|
|
1060
1072
|
{
|