boltdocs 1.0.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SearchDialog-R36WKAQ7.mjs → SearchDialog-5EDRACEG.mjs} +1 -1
- package/dist/{SearchDialog-PYF3QMYG.css → SearchDialog-X57WPTNN.css} +54 -126
- package/dist/cache-EHR7SXRU.mjs +12 -0
- package/dist/chunk-GSYECEZY.mjs +381 -0
- package/dist/{chunk-TWSRXUFF.mjs → chunk-NS7WHDYA.mjs} +229 -418
- package/dist/client/index.css +54 -126
- package/dist/client/index.d.mts +5 -4
- package/dist/client/index.d.ts +5 -4
- package/dist/client/index.js +555 -580
- package/dist/client/index.mjs +304 -16
- package/dist/client/ssr.css +54 -126
- package/dist/client/ssr.js +257 -580
- package/dist/client/ssr.mjs +1 -1
- package/dist/{config-D2XmHJYe.d.mts → config-BD5ZHz15.d.mts} +7 -0
- package/dist/{config-D2XmHJYe.d.ts → config-BD5ZHz15.d.ts} +7 -0
- package/dist/node/index.d.mts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +457 -118
- package/dist/node/index.mjs +93 -136
- package/package.json +2 -2
- package/src/client/app/index.tsx +25 -54
- package/src/client/theme/components/mdx/mdx-components.css +39 -20
- package/src/client/theme/styles/markdown.css +1 -1
- package/src/client/theme/styles.css +0 -1
- package/src/client/theme/ui/Layout/Layout.tsx +2 -13
- package/src/client/theme/ui/Layout/responsive.css +0 -4
- package/src/client/theme/ui/Link/Link.tsx +52 -0
- package/src/client/theme/ui/NotFound/NotFound.tsx +0 -1
- package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +45 -2
- package/src/client/theme/ui/Sidebar/Sidebar.tsx +44 -40
- package/src/client/theme/ui/Sidebar/sidebar.css +25 -58
- package/src/node/cache.ts +360 -46
- package/src/node/config.ts +7 -0
- package/src/node/mdx.ts +83 -4
- package/src/node/plugin/index.ts +3 -0
- package/src/node/routes/cache.ts +5 -1
- package/src/node/routes/index.ts +17 -2
- package/src/node/ssg/index.ts +4 -0
- package/dist/Playground-B2FA34BC.mjs +0 -6
- package/dist/chunk-WPT4MWTQ.mjs +0 -89
- package/src/client/theme/styles/home.css +0 -60
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// src/client/theme/ui/Navbar/Navbar.tsx
|
|
2
|
-
import
|
|
2
|
+
import React9 from "react";
|
|
3
3
|
|
|
4
4
|
// src/client/theme/ui/Link/Link.tsx
|
|
5
|
-
import
|
|
5
|
+
import React6 from "react";
|
|
6
6
|
import {
|
|
7
7
|
Link as RouterLink,
|
|
8
8
|
NavLink as RouterNavLink,
|
|
9
|
-
useLocation as useLocation7
|
|
9
|
+
useLocation as useLocation7,
|
|
10
|
+
useNavigate
|
|
10
11
|
} from "react-router-dom";
|
|
11
12
|
|
|
12
13
|
// src/client/app/preload.tsx
|
|
@@ -47,7 +48,7 @@ function PreloadProvider({
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
// src/client/app/index.tsx
|
|
50
|
-
import
|
|
51
|
+
import React5, { useEffect as useEffect4, useState as useState5 } from "react";
|
|
51
52
|
import ReactDOM from "react-dom/client";
|
|
52
53
|
import {
|
|
53
54
|
BrowserRouter,
|
|
@@ -60,7 +61,7 @@ import {
|
|
|
60
61
|
// src/client/theme/ui/Layout/Layout.tsx
|
|
61
62
|
import React4, { useState as useState4 } from "react";
|
|
62
63
|
import { useLocation as useLocation5 } from "react-router-dom";
|
|
63
|
-
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3
|
|
64
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
64
65
|
|
|
65
66
|
// src/client/theme/ui/Navbar/GithubStars.tsx
|
|
66
67
|
import { useEffect, useState } from "react";
|
|
@@ -144,8 +145,8 @@ function PoweredBy() {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
// src/client/theme/ui/Sidebar/Sidebar.tsx
|
|
147
|
-
import { ChevronRight,
|
|
148
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
148
|
+
import { ChevronRight, PanelLeft } from "lucide-react";
|
|
149
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
149
150
|
function renderBadge(badgeRaw) {
|
|
150
151
|
if (!badgeRaw) return null;
|
|
151
152
|
let text = "";
|
|
@@ -181,7 +182,8 @@ function renderBadge(badgeRaw) {
|
|
|
181
182
|
function Sidebar({
|
|
182
183
|
routes,
|
|
183
184
|
config,
|
|
184
|
-
|
|
185
|
+
isCollapsed,
|
|
186
|
+
onToggle
|
|
185
187
|
}) {
|
|
186
188
|
const location = useLocation();
|
|
187
189
|
const ungrouped = [];
|
|
@@ -202,42 +204,41 @@ function Sidebar({
|
|
|
202
204
|
}
|
|
203
205
|
const groups = Array.from(groupMap.values());
|
|
204
206
|
return /* @__PURE__ */ jsxs3("aside", { className: "boltdocs-sidebar", children: [
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */ jsx5("ul", { className: "sidebar-list", children: ungrouped.map((route) => /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
207
|
-
Link,
|
|
208
|
-
{
|
|
209
|
-
to: route.path === "" ? "/" : route.path,
|
|
210
|
-
className: `sidebar-link ${location.pathname === route.path ? "active" : ""}`,
|
|
211
|
-
"aria-current": location.pathname === route.path ? "page" : void 0,
|
|
212
|
-
children: /* @__PURE__ */ jsxs3("div", { className: "sidebar-link-content", children: [
|
|
213
|
-
/* @__PURE__ */ jsx5("span", { children: route.title }),
|
|
214
|
-
renderBadge(route.badge)
|
|
215
|
-
] })
|
|
216
|
-
}
|
|
217
|
-
) }, route.path)) }),
|
|
218
|
-
groups.map((group) => /* @__PURE__ */ jsx5(
|
|
219
|
-
SidebarGroupSection,
|
|
220
|
-
{
|
|
221
|
-
group,
|
|
222
|
-
currentPath: location.pathname
|
|
223
|
-
},
|
|
224
|
-
group.slug
|
|
225
|
-
))
|
|
226
|
-
] }),
|
|
227
|
-
onCollapse && /* @__PURE__ */ jsx5("div", { className: "sidebar-footer", children: /* @__PURE__ */ jsxs3(
|
|
207
|
+
onToggle && /* @__PURE__ */ jsx5("div", { className: "sidebar-collapse", children: /* @__PURE__ */ jsx5(
|
|
228
208
|
"button",
|
|
229
209
|
{
|
|
230
210
|
className: "sidebar-collapse-btn",
|
|
231
|
-
onClick:
|
|
232
|
-
"aria-label": "Collapse Sidebar",
|
|
233
|
-
title: "Collapse Sidebar",
|
|
234
|
-
children:
|
|
235
|
-
/* @__PURE__ */ jsx5(ChevronLeft, { size: 16 }),
|
|
236
|
-
/* @__PURE__ */ jsx5("span", { children: "Collapse Sidebar" })
|
|
237
|
-
]
|
|
211
|
+
onClick: onToggle,
|
|
212
|
+
"aria-label": isCollapsed ? "Expand Sidebar" : "Collapse Sidebar",
|
|
213
|
+
title: isCollapsed ? "Expand Sidebar" : "Collapse Sidebar",
|
|
214
|
+
children: /* @__PURE__ */ jsx5(PanelLeft, { size: 18 })
|
|
238
215
|
}
|
|
239
216
|
) }),
|
|
240
|
-
|
|
217
|
+
!isCollapsed && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
218
|
+
/* @__PURE__ */ jsxs3("nav", { "aria-label": "Main Navigation", children: [
|
|
219
|
+
/* @__PURE__ */ jsx5("ul", { className: "sidebar-list", children: ungrouped.map((route) => /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
220
|
+
Link,
|
|
221
|
+
{
|
|
222
|
+
to: route.path === "" ? "/" : route.path,
|
|
223
|
+
className: `sidebar-link ${location.pathname === route.path ? "active" : ""}`,
|
|
224
|
+
"aria-current": location.pathname === route.path ? "page" : void 0,
|
|
225
|
+
children: /* @__PURE__ */ jsxs3("div", { className: "sidebar-link-content", children: [
|
|
226
|
+
/* @__PURE__ */ jsx5("span", { children: route.title }),
|
|
227
|
+
renderBadge(route.badge)
|
|
228
|
+
] })
|
|
229
|
+
}
|
|
230
|
+
) }, route.path)) }),
|
|
231
|
+
groups.map((group) => /* @__PURE__ */ jsx5(
|
|
232
|
+
SidebarGroupSection,
|
|
233
|
+
{
|
|
234
|
+
group,
|
|
235
|
+
currentPath: location.pathname
|
|
236
|
+
},
|
|
237
|
+
group.slug
|
|
238
|
+
))
|
|
239
|
+
] }),
|
|
240
|
+
config.themeConfig?.poweredBy !== false && /* @__PURE__ */ jsx5(PoweredBy, {})
|
|
241
|
+
] })
|
|
241
242
|
] });
|
|
242
243
|
}
|
|
243
244
|
function SidebarGroupSection({
|
|
@@ -343,11 +344,41 @@ function OnThisPage({
|
|
|
343
344
|
};
|
|
344
345
|
observeHeadings();
|
|
345
346
|
const timeoutId = setTimeout(observeHeadings, 1e3);
|
|
347
|
+
const handleScroll = () => {
|
|
348
|
+
const scrollPosition = window.innerHeight + window.pageYOffset;
|
|
349
|
+
const bodyHeight = document.documentElement.scrollHeight;
|
|
350
|
+
if (scrollPosition >= bodyHeight - 50) {
|
|
351
|
+
setActiveId(headings[headings.length - 1].id);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
346
355
|
return () => {
|
|
347
356
|
observerRef.current?.disconnect();
|
|
348
357
|
clearTimeout(timeoutId);
|
|
358
|
+
window.removeEventListener("scroll", handleScroll);
|
|
349
359
|
};
|
|
350
360
|
}, [headings, location.pathname]);
|
|
361
|
+
useEffect2(() => {
|
|
362
|
+
if (!activeId || !listRef.current) return;
|
|
363
|
+
const activeLink = listRef.current.querySelector(
|
|
364
|
+
`a[href="#${activeId}"]`
|
|
365
|
+
);
|
|
366
|
+
if (activeLink) {
|
|
367
|
+
const container = listRef.current.closest(
|
|
368
|
+
".boltdocs-on-this-page"
|
|
369
|
+
);
|
|
370
|
+
if (!container) return;
|
|
371
|
+
const linkRect = activeLink.getBoundingClientRect();
|
|
372
|
+
const containerRect = container.getBoundingClientRect();
|
|
373
|
+
const isVisible = linkRect.top >= containerRect.top && linkRect.bottom <= containerRect.bottom;
|
|
374
|
+
if (!isVisible) {
|
|
375
|
+
activeLink.scrollIntoView({
|
|
376
|
+
behavior: "smooth",
|
|
377
|
+
block: "nearest"
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}, [activeId]);
|
|
351
382
|
const handleClick = useCallback2(
|
|
352
383
|
(e, id) => {
|
|
353
384
|
e.preventDefault();
|
|
@@ -575,17 +606,8 @@ function ThemeLayout({
|
|
|
575
606
|
{
|
|
576
607
|
routes: filteredRoutes,
|
|
577
608
|
config,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
),
|
|
581
|
-
sidebar === void 0 && /* @__PURE__ */ jsx9(
|
|
582
|
-
"button",
|
|
583
|
-
{
|
|
584
|
-
className: "sidebar-toggle-floating",
|
|
585
|
-
onClick: () => setIsSidebarOpen(true),
|
|
586
|
-
"aria-label": "Expand Sidebar",
|
|
587
|
-
title: "Expand Sidebar",
|
|
588
|
-
children: /* @__PURE__ */ jsx9(Menu, { size: 20 })
|
|
609
|
+
isCollapsed: !isSidebarOpen,
|
|
610
|
+
onToggle: () => setIsSidebarOpen(!isSidebarOpen)
|
|
589
611
|
}
|
|
590
612
|
),
|
|
591
613
|
/* @__PURE__ */ jsxs7("main", { className: "boltdocs-content", children: [
|
|
@@ -671,227 +693,7 @@ import {
|
|
|
671
693
|
useLayoutEffect
|
|
672
694
|
} from "react";
|
|
673
695
|
import { Link as LucideLink } from "lucide-react";
|
|
674
|
-
|
|
675
|
-
// src/client/theme/components/mdx/Button.tsx
|
|
676
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
677
|
-
function Button({
|
|
678
|
-
variant = "primary",
|
|
679
|
-
size = "md",
|
|
680
|
-
href,
|
|
681
|
-
children,
|
|
682
|
-
className = "",
|
|
683
|
-
...rest
|
|
684
|
-
}) {
|
|
685
|
-
const cls = `ld-btn ld-btn--${variant} ld-btn--${size} ${className}`.trim();
|
|
686
|
-
if (href) {
|
|
687
|
-
return /* @__PURE__ */ jsx12(
|
|
688
|
-
"a",
|
|
689
|
-
{
|
|
690
|
-
href,
|
|
691
|
-
style: { textDecoration: "none" },
|
|
692
|
-
className: cls,
|
|
693
|
-
...rest,
|
|
694
|
-
children
|
|
695
|
-
}
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
return /* @__PURE__ */ jsx12("button", { className: cls, ...rest, children });
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// src/client/theme/components/mdx/Badge.tsx
|
|
702
|
-
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
703
|
-
function Badge({
|
|
704
|
-
variant = "default",
|
|
705
|
-
children,
|
|
706
|
-
className = "",
|
|
707
|
-
...rest
|
|
708
|
-
}) {
|
|
709
|
-
return /* @__PURE__ */ jsx13(
|
|
710
|
-
"span",
|
|
711
|
-
{
|
|
712
|
-
className: `ld-badge ld-badge--${variant} ${className}`.trim(),
|
|
713
|
-
...rest,
|
|
714
|
-
children
|
|
715
|
-
}
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
// src/client/theme/components/mdx/Card.tsx
|
|
720
|
-
import { Fragment, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
721
|
-
function Cards({
|
|
722
|
-
cols = 3,
|
|
723
|
-
children,
|
|
724
|
-
className = "",
|
|
725
|
-
...rest
|
|
726
|
-
}) {
|
|
727
|
-
return /* @__PURE__ */ jsx14("div", { className: `ld-cards ld-cards--${cols} ${className}`.trim(), ...rest, children });
|
|
728
|
-
}
|
|
729
|
-
function Card({
|
|
730
|
-
title,
|
|
731
|
-
icon,
|
|
732
|
-
href,
|
|
733
|
-
children,
|
|
734
|
-
className = "",
|
|
735
|
-
...rest
|
|
736
|
-
}) {
|
|
737
|
-
const inner = /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
738
|
-
icon && /* @__PURE__ */ jsx14("span", { className: "ld-card__icon", children: icon }),
|
|
739
|
-
title && /* @__PURE__ */ jsx14("h3", { className: "ld-card__title", children: title }),
|
|
740
|
-
children && /* @__PURE__ */ jsx14("div", { className: "ld-card__body", children })
|
|
741
|
-
] });
|
|
742
|
-
if (href) {
|
|
743
|
-
return /* @__PURE__ */ jsx14(
|
|
744
|
-
"a",
|
|
745
|
-
{
|
|
746
|
-
href,
|
|
747
|
-
className: `ld-card ld-card--link ${className}`.trim(),
|
|
748
|
-
...rest,
|
|
749
|
-
children: inner
|
|
750
|
-
}
|
|
751
|
-
);
|
|
752
|
-
}
|
|
753
|
-
return /* @__PURE__ */ jsx14("div", { className: `ld-card ${className}`.trim(), ...rest, children: inner });
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// src/client/theme/components/mdx/Tabs.tsx
|
|
757
|
-
import { useState as useState5, Children, isValidElement, useRef as useRef2 } from "react";
|
|
758
|
-
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
759
|
-
function Tab({ children }) {
|
|
760
|
-
return /* @__PURE__ */ jsx15("div", { className: "ld-tab-panel", children });
|
|
761
|
-
}
|
|
762
|
-
function Tabs({ defaultIndex = 0, children }) {
|
|
763
|
-
const [active, setActive] = useState5(defaultIndex);
|
|
764
|
-
const tabRefs = useRef2([]);
|
|
765
|
-
const tabs = Children.toArray(children).filter(
|
|
766
|
-
(child) => isValidElement(child) && child.props?.label
|
|
767
|
-
);
|
|
768
|
-
const handleKeyDown = (e) => {
|
|
769
|
-
let newIndex = active;
|
|
770
|
-
if (e.key === "ArrowRight") {
|
|
771
|
-
newIndex = (active + 1) % tabs.length;
|
|
772
|
-
} else if (e.key === "ArrowLeft") {
|
|
773
|
-
newIndex = (active - 1 + tabs.length) % tabs.length;
|
|
774
|
-
}
|
|
775
|
-
if (newIndex !== active) {
|
|
776
|
-
setActive(newIndex);
|
|
777
|
-
tabRefs.current[newIndex]?.focus();
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
return /* @__PURE__ */ jsxs11("div", { className: "ld-tabs", children: [
|
|
781
|
-
/* @__PURE__ */ jsx15("div", { className: "ld-tabs__bar", role: "tablist", onKeyDown: handleKeyDown, children: tabs.map((child, i) => {
|
|
782
|
-
const label = child.props.label;
|
|
783
|
-
return /* @__PURE__ */ jsx15(
|
|
784
|
-
"button",
|
|
785
|
-
{
|
|
786
|
-
role: "tab",
|
|
787
|
-
"aria-selected": i === active,
|
|
788
|
-
"aria-controls": `tabpanel-${i}`,
|
|
789
|
-
id: `tab-${i}`,
|
|
790
|
-
tabIndex: i === active ? 0 : -1,
|
|
791
|
-
ref: (el) => {
|
|
792
|
-
tabRefs.current[i] = el;
|
|
793
|
-
},
|
|
794
|
-
className: `ld-tabs__trigger ${i === active ? "ld-tabs__trigger--active" : ""}`,
|
|
795
|
-
onClick: () => setActive(i),
|
|
796
|
-
children: label
|
|
797
|
-
},
|
|
798
|
-
i
|
|
799
|
-
);
|
|
800
|
-
}) }),
|
|
801
|
-
/* @__PURE__ */ jsx15(
|
|
802
|
-
"div",
|
|
803
|
-
{
|
|
804
|
-
className: "ld-tabs__content",
|
|
805
|
-
role: "tabpanel",
|
|
806
|
-
id: `tabpanel-${active}`,
|
|
807
|
-
"aria-labelledby": `tab-${active}`,
|
|
808
|
-
children: tabs[active]
|
|
809
|
-
}
|
|
810
|
-
)
|
|
811
|
-
] });
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
// src/client/theme/components/mdx/Admonition.tsx
|
|
815
|
-
import {
|
|
816
|
-
Info,
|
|
817
|
-
Lightbulb,
|
|
818
|
-
AlertTriangle,
|
|
819
|
-
ShieldAlert,
|
|
820
|
-
Bookmark
|
|
821
|
-
} from "lucide-react";
|
|
822
|
-
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
823
|
-
var ICON_MAP = {
|
|
824
|
-
note: /* @__PURE__ */ jsx16(Bookmark, { size: 18 }),
|
|
825
|
-
tip: /* @__PURE__ */ jsx16(Lightbulb, { size: 18 }),
|
|
826
|
-
info: /* @__PURE__ */ jsx16(Info, { size: 18 }),
|
|
827
|
-
warning: /* @__PURE__ */ jsx16(AlertTriangle, { size: 18 }),
|
|
828
|
-
danger: /* @__PURE__ */ jsx16(ShieldAlert, { size: 18 })
|
|
829
|
-
};
|
|
830
|
-
var LABEL_MAP = {
|
|
831
|
-
note: "Note",
|
|
832
|
-
tip: "Tip",
|
|
833
|
-
info: "Info",
|
|
834
|
-
warning: "Warning",
|
|
835
|
-
danger: "Danger"
|
|
836
|
-
};
|
|
837
|
-
function Admonition({
|
|
838
|
-
type = "note",
|
|
839
|
-
title,
|
|
840
|
-
children,
|
|
841
|
-
className = "",
|
|
842
|
-
...rest
|
|
843
|
-
}) {
|
|
844
|
-
return /* @__PURE__ */ jsxs12(
|
|
845
|
-
"div",
|
|
846
|
-
{
|
|
847
|
-
className: `ld-admonition ld-admonition--${type} ${className}`.trim(),
|
|
848
|
-
role: type === "warning" || type === "danger" ? "alert" : "note",
|
|
849
|
-
...rest,
|
|
850
|
-
children: [
|
|
851
|
-
/* @__PURE__ */ jsxs12("div", { className: "ld-admonition__header", children: [
|
|
852
|
-
/* @__PURE__ */ jsx16("span", { className: "ld-admonition__icon", children: ICON_MAP[type] }),
|
|
853
|
-
/* @__PURE__ */ jsx16("span", { className: "ld-admonition__title", children: title || LABEL_MAP[type] })
|
|
854
|
-
] }),
|
|
855
|
-
/* @__PURE__ */ jsx16("div", { className: "ld-admonition__body", children })
|
|
856
|
-
]
|
|
857
|
-
}
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
var Note = (props) => /* @__PURE__ */ jsx16(Admonition, { type: "note", ...props });
|
|
861
|
-
var Tip = (props) => /* @__PURE__ */ jsx16(Admonition, { type: "tip", ...props });
|
|
862
|
-
var Warning = (props) => /* @__PURE__ */ jsx16(Admonition, { type: "warning", ...props });
|
|
863
|
-
var Danger = (props) => /* @__PURE__ */ jsx16(Admonition, { type: "danger", ...props });
|
|
864
|
-
var InfoBox = (props) => /* @__PURE__ */ jsx16(Admonition, { type: "info", ...props });
|
|
865
|
-
|
|
866
|
-
// src/client/theme/components/mdx/List.tsx
|
|
867
|
-
import React6, { Children as Children2 } from "react";
|
|
868
|
-
import { Check, ChevronRight as ChevronRight4 } from "lucide-react";
|
|
869
|
-
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
870
|
-
var ICON_MAP2 = {
|
|
871
|
-
checked: /* @__PURE__ */ jsx17(Check, { size: 14, className: "ld-list__icon" }),
|
|
872
|
-
arrow: /* @__PURE__ */ jsx17(ChevronRight4, { size: 14, className: "ld-list__icon" })
|
|
873
|
-
};
|
|
874
|
-
function List({
|
|
875
|
-
variant = "default",
|
|
876
|
-
children,
|
|
877
|
-
className = "",
|
|
878
|
-
...rest
|
|
879
|
-
}) {
|
|
880
|
-
if (variant === "default") {
|
|
881
|
-
return /* @__PURE__ */ jsx17("ul", { className: `ld-list ${className}`.trim(), ...rest, children });
|
|
882
|
-
}
|
|
883
|
-
const icon = ICON_MAP2[variant];
|
|
884
|
-
return /* @__PURE__ */ jsx17("ul", { className: `ld-list ld-list--${variant} ${className}`.trim(), ...rest, children: Children2.map(children, (child) => {
|
|
885
|
-
if (!React6.isValidElement(child)) return child;
|
|
886
|
-
return /* @__PURE__ */ jsxs13("li", { className: "ld-list__item", children: [
|
|
887
|
-
icon,
|
|
888
|
-
/* @__PURE__ */ jsx17("span", { className: "ld-list__text", children: child.props.children })
|
|
889
|
-
] });
|
|
890
|
-
}) });
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
// src/client/app/index.tsx
|
|
894
|
-
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
696
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
895
697
|
var ConfigContext = createContext2(null);
|
|
896
698
|
function useConfig() {
|
|
897
699
|
return useContext2(ConfigContext);
|
|
@@ -909,48 +711,29 @@ var PackageManagerTabs = lazy(
|
|
|
909
711
|
default: m.PackageManagerTabs
|
|
910
712
|
}))
|
|
911
713
|
);
|
|
912
|
-
var Playground = lazy(
|
|
913
|
-
() => import("./Playground-B2FA34BC.mjs").then((m) => ({
|
|
914
|
-
default: m.Playground
|
|
915
|
-
}))
|
|
916
|
-
);
|
|
917
714
|
var Heading = ({
|
|
918
715
|
level,
|
|
919
716
|
id,
|
|
920
717
|
children
|
|
921
718
|
}) => {
|
|
922
719
|
const Tag = `h${level}`;
|
|
923
|
-
return /* @__PURE__ */
|
|
720
|
+
return /* @__PURE__ */ jsxs10(Tag, { id, className: "boltdocs-heading", children: [
|
|
924
721
|
children,
|
|
925
|
-
id && /* @__PURE__ */
|
|
722
|
+
id && /* @__PURE__ */ jsx12("a", { href: `#${id}`, className: "header-anchor", "aria-label": "Anchor", children: /* @__PURE__ */ jsx12(LucideLink, { size: 16 }) })
|
|
926
723
|
] });
|
|
927
724
|
};
|
|
928
725
|
var mdxComponents = {
|
|
929
|
-
h1: (props) => /* @__PURE__ */
|
|
930
|
-
h2: (props) => /* @__PURE__ */
|
|
931
|
-
h3: (props) => /* @__PURE__ */
|
|
932
|
-
h4: (props) => /* @__PURE__ */
|
|
933
|
-
h5: (props) => /* @__PURE__ */
|
|
934
|
-
h6: (props) => /* @__PURE__ */
|
|
726
|
+
h1: (props) => /* @__PURE__ */ jsx12(Heading, { level: 1, ...props }),
|
|
727
|
+
h2: (props) => /* @__PURE__ */ jsx12(Heading, { level: 2, ...props }),
|
|
728
|
+
h3: (props) => /* @__PURE__ */ jsx12(Heading, { level: 3, ...props }),
|
|
729
|
+
h4: (props) => /* @__PURE__ */ jsx12(Heading, { level: 4, ...props }),
|
|
730
|
+
h5: (props) => /* @__PURE__ */ jsx12(Heading, { level: 5, ...props }),
|
|
731
|
+
h6: (props) => /* @__PURE__ */ jsx12(Heading, { level: 6, ...props }),
|
|
935
732
|
pre: (props) => {
|
|
936
|
-
return /* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ jsx12(Suspense, { fallback: /* @__PURE__ */ jsx12("div", { className: "code-block-skeleton" }), children: /* @__PURE__ */ jsx12(CodeBlock, { ...props, children: props.children }) });
|
|
937
734
|
},
|
|
938
|
-
video: (props) => /* @__PURE__ */
|
|
939
|
-
PackageManagerTabs: (props) => /* @__PURE__ */
|
|
940
|
-
Playground: (props) => /* @__PURE__ */ jsx18(Suspense, { fallback: /* @__PURE__ */ jsx18("div", { className: "playground-skeleton" }), children: /* @__PURE__ */ jsx18(Playground, { ...props }) }),
|
|
941
|
-
Button,
|
|
942
|
-
Badge,
|
|
943
|
-
Card,
|
|
944
|
-
Cards,
|
|
945
|
-
Tabs,
|
|
946
|
-
Tab,
|
|
947
|
-
Admonition,
|
|
948
|
-
Note,
|
|
949
|
-
Tip,
|
|
950
|
-
Warning,
|
|
951
|
-
Danger,
|
|
952
|
-
InfoBox,
|
|
953
|
-
List
|
|
735
|
+
video: (props) => /* @__PURE__ */ jsx12(Suspense, { fallback: /* @__PURE__ */ jsx12("div", { className: "video-skeleton" }), children: /* @__PURE__ */ jsx12(Video, { ...props }) }),
|
|
736
|
+
PackageManagerTabs: (props) => /* @__PURE__ */ jsx12(Suspense, { fallback: /* @__PURE__ */ jsx12("div", { className: "pkg-tabs-skeleton" }), children: /* @__PURE__ */ jsx12(PackageManagerTabs, { ...props }) })
|
|
954
737
|
};
|
|
955
738
|
function AppShell({
|
|
956
739
|
initialRoutes,
|
|
@@ -960,18 +743,10 @@ function AppShell({
|
|
|
960
743
|
homePage: HomePage,
|
|
961
744
|
components: customComponents = {}
|
|
962
745
|
}) {
|
|
963
|
-
const [routesInfo, setRoutesInfo] =
|
|
964
|
-
const [config] =
|
|
965
|
-
const
|
|
966
|
-
|
|
967
|
-
if (hot) {
|
|
968
|
-
hot.on("boltdocs:routes-update", (newRoutes) => {
|
|
969
|
-
setRoutesInfo(newRoutes);
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
}, [hot]);
|
|
973
|
-
useEffect4(() => {
|
|
974
|
-
const mapped = routesInfo.filter(
|
|
746
|
+
const [routesInfo, setRoutesInfo] = useState5(initialRoutes);
|
|
747
|
+
const [config] = useState5(initialConfig);
|
|
748
|
+
const resolveRoutes = (infos) => {
|
|
749
|
+
return infos.filter(
|
|
975
750
|
(route) => !(HomePage && (route.path === "/" || route.path === ""))
|
|
976
751
|
).map((route) => {
|
|
977
752
|
const loaderKey = Object.keys(modules).find(
|
|
@@ -980,23 +755,35 @@ function AppShell({
|
|
|
980
755
|
const loader = loaderKey ? modules[loaderKey] : null;
|
|
981
756
|
return {
|
|
982
757
|
...route,
|
|
983
|
-
Component:
|
|
758
|
+
Component: React5.lazy(() => {
|
|
984
759
|
if (!loader)
|
|
985
|
-
return Promise.resolve({ default: () => /* @__PURE__ */
|
|
760
|
+
return Promise.resolve({ default: () => /* @__PURE__ */ jsx12(NotFound, {}) });
|
|
986
761
|
return loader();
|
|
987
762
|
})
|
|
988
763
|
};
|
|
989
764
|
});
|
|
990
|
-
|
|
765
|
+
};
|
|
766
|
+
const [resolvedRoutes, setResolvedRoutes] = useState5(
|
|
767
|
+
() => resolveRoutes(initialRoutes)
|
|
768
|
+
);
|
|
769
|
+
useEffect4(() => {
|
|
770
|
+
if (hot) {
|
|
771
|
+
hot.on("boltdocs:routes-update", (newRoutes) => {
|
|
772
|
+
setRoutesInfo(newRoutes);
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}, [hot]);
|
|
776
|
+
useEffect4(() => {
|
|
777
|
+
setResolvedRoutes(resolveRoutes(routesInfo));
|
|
991
778
|
}, [routesInfo, modules]);
|
|
992
|
-
return /* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
HomePage && /* @__PURE__ */
|
|
779
|
+
return /* @__PURE__ */ jsx12(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsxs10(PreloadProvider, { routes: routesInfo, modules, children: [
|
|
780
|
+
/* @__PURE__ */ jsx12(ScrollHandler, {}),
|
|
781
|
+
/* @__PURE__ */ jsxs10(Routes, { children: [
|
|
782
|
+
HomePage && /* @__PURE__ */ jsx12(
|
|
996
783
|
Route,
|
|
997
784
|
{
|
|
998
785
|
path: "/",
|
|
999
|
-
element: /* @__PURE__ */
|
|
786
|
+
element: /* @__PURE__ */ jsx12(
|
|
1000
787
|
ThemeLayout,
|
|
1001
788
|
{
|
|
1002
789
|
config,
|
|
@@ -1005,36 +792,43 @@ function AppShell({
|
|
|
1005
792
|
toc: null,
|
|
1006
793
|
breadcrumbs: null,
|
|
1007
794
|
...config.themeConfig?.layoutProps,
|
|
1008
|
-
children: /* @__PURE__ */
|
|
795
|
+
children: /* @__PURE__ */ jsx12(HomePage, {})
|
|
1009
796
|
}
|
|
1010
797
|
)
|
|
1011
798
|
}
|
|
1012
799
|
),
|
|
1013
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx12(
|
|
1014
801
|
Route,
|
|
1015
802
|
{
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
803
|
+
element: /* @__PURE__ */ jsx12(DocsLayout, { config, routes: routesInfo }),
|
|
804
|
+
children: resolvedRoutes.map((route) => /* @__PURE__ */ jsx12(
|
|
805
|
+
Route,
|
|
1019
806
|
{
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
807
|
+
path: route.path === "" ? "/" : route.path,
|
|
808
|
+
element: /* @__PURE__ */ jsx12(React5.Suspense, { fallback: /* @__PURE__ */ jsx12(Loading, {}), children: /* @__PURE__ */ jsx12(
|
|
809
|
+
MdxPage,
|
|
810
|
+
{
|
|
811
|
+
Component: route.Component,
|
|
812
|
+
customComponents
|
|
813
|
+
}
|
|
814
|
+
) })
|
|
815
|
+
},
|
|
816
|
+
route.path
|
|
817
|
+
))
|
|
1024
818
|
},
|
|
1025
|
-
|
|
1026
|
-
)
|
|
1027
|
-
/* @__PURE__ */
|
|
819
|
+
"docs-layout"
|
|
820
|
+
),
|
|
821
|
+
/* @__PURE__ */ jsx12(
|
|
1028
822
|
Route,
|
|
1029
823
|
{
|
|
1030
824
|
path: "*",
|
|
1031
|
-
element: /* @__PURE__ */
|
|
825
|
+
element: /* @__PURE__ */ jsx12(
|
|
1032
826
|
ThemeLayout,
|
|
1033
827
|
{
|
|
1034
828
|
config,
|
|
1035
829
|
routes: routesInfo,
|
|
1036
830
|
...config.themeConfig?.layoutProps,
|
|
1037
|
-
children: /* @__PURE__ */
|
|
831
|
+
children: /* @__PURE__ */ jsx12(NotFound, {})
|
|
1038
832
|
}
|
|
1039
833
|
)
|
|
1040
834
|
}
|
|
@@ -1069,13 +863,13 @@ function DocsLayout({
|
|
|
1069
863
|
config,
|
|
1070
864
|
routes
|
|
1071
865
|
}) {
|
|
1072
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ jsx12(
|
|
1073
867
|
ThemeLayout,
|
|
1074
868
|
{
|
|
1075
869
|
config,
|
|
1076
870
|
routes,
|
|
1077
871
|
...config.themeConfig?.layoutProps,
|
|
1078
|
-
children: /* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ jsx12(Outlet, {})
|
|
1079
873
|
}
|
|
1080
874
|
);
|
|
1081
875
|
}
|
|
@@ -1084,7 +878,7 @@ function MdxPage({
|
|
|
1084
878
|
customComponents = {}
|
|
1085
879
|
}) {
|
|
1086
880
|
const allComponents = { ...mdxComponents, ...customComponents };
|
|
1087
|
-
return /* @__PURE__ */
|
|
881
|
+
return /* @__PURE__ */ jsx12(MDXProvider, { components: allComponents, children: /* @__PURE__ */ jsx12(Component, {}) });
|
|
1088
882
|
}
|
|
1089
883
|
function createBoltdocsApp(options) {
|
|
1090
884
|
const { target, routes, config, modules, hot, homePage } = options;
|
|
@@ -1094,7 +888,7 @@ function createBoltdocsApp(options) {
|
|
|
1094
888
|
`[boltdocs] Mount target "${target}" not found in document.`
|
|
1095
889
|
);
|
|
1096
890
|
}
|
|
1097
|
-
const app = /* @__PURE__ */
|
|
891
|
+
const app = /* @__PURE__ */ jsx12(React5.StrictMode, { children: /* @__PURE__ */ jsx12(BrowserRouter, { children: /* @__PURE__ */ jsx12(
|
|
1098
892
|
AppShell,
|
|
1099
893
|
{
|
|
1100
894
|
initialRoutes: routes,
|
|
@@ -1110,7 +904,7 @@ function createBoltdocsApp(options) {
|
|
|
1110
904
|
}
|
|
1111
905
|
|
|
1112
906
|
// src/client/theme/ui/Link/Link.tsx
|
|
1113
|
-
import { jsx as
|
|
907
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1114
908
|
function useLocalizedTo(to) {
|
|
1115
909
|
const location = useLocation7();
|
|
1116
910
|
const config = useConfig();
|
|
@@ -1166,17 +960,19 @@ function useLocalizedTo(to) {
|
|
|
1166
960
|
}
|
|
1167
961
|
return finalPath === basePath ? basePath : finalPath;
|
|
1168
962
|
}
|
|
1169
|
-
var Link =
|
|
963
|
+
var Link = React6.forwardRef(
|
|
1170
964
|
(props, ref) => {
|
|
1171
965
|
const {
|
|
1172
966
|
boltdocsPrefetch = "hover",
|
|
1173
967
|
onMouseEnter,
|
|
1174
968
|
onFocus,
|
|
969
|
+
onClick,
|
|
1175
970
|
to,
|
|
1176
971
|
...rest
|
|
1177
972
|
} = props;
|
|
1178
973
|
const localizedTo = useLocalizedTo(to);
|
|
1179
974
|
const { preload } = usePreload();
|
|
975
|
+
const navigate = useNavigate();
|
|
1180
976
|
const handleMouseEnter = (e) => {
|
|
1181
977
|
onMouseEnter?.(e);
|
|
1182
978
|
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
@@ -1189,30 +985,45 @@ var Link = React8.forwardRef(
|
|
|
1189
985
|
preload(localizedTo);
|
|
1190
986
|
}
|
|
1191
987
|
};
|
|
1192
|
-
|
|
988
|
+
const handleClick = (e) => {
|
|
989
|
+
onClick?.(e);
|
|
990
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
|
|
994
|
+
e.preventDefault();
|
|
995
|
+
React6.startTransition(() => {
|
|
996
|
+
navigate(localizedTo);
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
return /* @__PURE__ */ jsx13(
|
|
1193
1001
|
RouterLink,
|
|
1194
1002
|
{
|
|
1195
1003
|
ref,
|
|
1196
1004
|
to: localizedTo,
|
|
1197
1005
|
onMouseEnter: handleMouseEnter,
|
|
1198
1006
|
onFocus: handleFocus,
|
|
1007
|
+
onClick: handleClick,
|
|
1199
1008
|
...rest
|
|
1200
1009
|
}
|
|
1201
1010
|
);
|
|
1202
1011
|
}
|
|
1203
1012
|
);
|
|
1204
1013
|
Link.displayName = "Link";
|
|
1205
|
-
var NavLink =
|
|
1014
|
+
var NavLink = React6.forwardRef(
|
|
1206
1015
|
(props, ref) => {
|
|
1207
1016
|
const {
|
|
1208
1017
|
boltdocsPrefetch = "hover",
|
|
1209
1018
|
onMouseEnter,
|
|
1210
1019
|
onFocus,
|
|
1020
|
+
onClick,
|
|
1211
1021
|
to,
|
|
1212
1022
|
...rest
|
|
1213
1023
|
} = props;
|
|
1214
1024
|
const localizedTo = useLocalizedTo(to);
|
|
1215
1025
|
const { preload } = usePreload();
|
|
1026
|
+
const navigate = useNavigate();
|
|
1216
1027
|
const handleMouseEnter = (e) => {
|
|
1217
1028
|
onMouseEnter?.(e);
|
|
1218
1029
|
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
@@ -1225,13 +1036,26 @@ var NavLink = React8.forwardRef(
|
|
|
1225
1036
|
preload(localizedTo);
|
|
1226
1037
|
}
|
|
1227
1038
|
};
|
|
1228
|
-
|
|
1039
|
+
const handleClick = (e) => {
|
|
1040
|
+
onClick?.(e);
|
|
1041
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
|
|
1045
|
+
e.preventDefault();
|
|
1046
|
+
React6.startTransition(() => {
|
|
1047
|
+
navigate(localizedTo);
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
return /* @__PURE__ */ jsx13(
|
|
1229
1052
|
RouterNavLink,
|
|
1230
1053
|
{
|
|
1231
1054
|
ref,
|
|
1232
1055
|
to: localizedTo,
|
|
1233
1056
|
onMouseEnter: handleMouseEnter,
|
|
1234
1057
|
onFocus: handleFocus,
|
|
1058
|
+
onClick: handleClick,
|
|
1235
1059
|
...rest
|
|
1236
1060
|
}
|
|
1237
1061
|
);
|
|
@@ -1243,10 +1067,10 @@ NavLink.displayName = "NavLink";
|
|
|
1243
1067
|
import { ChevronDown as ChevronDown3 } from "lucide-react";
|
|
1244
1068
|
|
|
1245
1069
|
// src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx
|
|
1246
|
-
import { useState as
|
|
1070
|
+
import { useState as useState6, useRef as useRef2, useEffect as useEffect5 } from "react";
|
|
1247
1071
|
import { Globe, ChevronDown } from "lucide-react";
|
|
1248
|
-
import { useNavigate, useLocation as useLocation8 } from "react-router-dom";
|
|
1249
|
-
import { jsx as
|
|
1072
|
+
import { useNavigate as useNavigate2, useLocation as useLocation8 } from "react-router-dom";
|
|
1073
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1250
1074
|
function getBaseFilePath(filePath, version, locale) {
|
|
1251
1075
|
let path = filePath;
|
|
1252
1076
|
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
@@ -1262,9 +1086,9 @@ function LanguageSwitcher({
|
|
|
1262
1086
|
currentLocale,
|
|
1263
1087
|
allRoutes
|
|
1264
1088
|
}) {
|
|
1265
|
-
const [isOpen, setIsOpen] =
|
|
1266
|
-
const dropdownRef =
|
|
1267
|
-
const navigate =
|
|
1089
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1090
|
+
const dropdownRef = useRef2(null);
|
|
1091
|
+
const navigate = useNavigate2();
|
|
1268
1092
|
const location = useLocation8();
|
|
1269
1093
|
useEffect5(() => {
|
|
1270
1094
|
function handleClickOutside(event) {
|
|
@@ -1302,8 +1126,8 @@ function LanguageSwitcher({
|
|
|
1302
1126
|
}
|
|
1303
1127
|
navigate(targetPath);
|
|
1304
1128
|
};
|
|
1305
|
-
return /* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1129
|
+
return /* @__PURE__ */ jsxs11("div", { className: "boltdocs-language-switcher", ref: dropdownRef, children: [
|
|
1130
|
+
/* @__PURE__ */ jsxs11(
|
|
1307
1131
|
"button",
|
|
1308
1132
|
{
|
|
1309
1133
|
className: "language-btn",
|
|
@@ -1312,13 +1136,13 @@ function LanguageSwitcher({
|
|
|
1312
1136
|
"aria-expanded": isOpen,
|
|
1313
1137
|
"aria-haspopup": "listbox",
|
|
1314
1138
|
children: [
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1317
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ jsx14(Globe, { size: 18 }),
|
|
1140
|
+
/* @__PURE__ */ jsx14("span", { className: "language-label", children: i18n.locales[currentLocale] || currentLocale }),
|
|
1141
|
+
/* @__PURE__ */ jsx14(ChevronDown, { size: 14 })
|
|
1318
1142
|
]
|
|
1319
1143
|
}
|
|
1320
1144
|
),
|
|
1321
|
-
isOpen && /* @__PURE__ */
|
|
1145
|
+
isOpen && /* @__PURE__ */ jsx14("div", { className: "language-dropdown", children: Object.entries(i18n.locales).map(([key, label]) => /* @__PURE__ */ jsx14(
|
|
1322
1146
|
"button",
|
|
1323
1147
|
{
|
|
1324
1148
|
className: `language-option ${key === currentLocale ? "active" : ""}`,
|
|
@@ -1331,10 +1155,10 @@ function LanguageSwitcher({
|
|
|
1331
1155
|
}
|
|
1332
1156
|
|
|
1333
1157
|
// src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx
|
|
1334
|
-
import { useState as
|
|
1158
|
+
import { useState as useState7, useRef as useRef3, useEffect as useEffect6 } from "react";
|
|
1335
1159
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
1336
|
-
import { useNavigate as
|
|
1337
|
-
import { jsx as
|
|
1160
|
+
import { useNavigate as useNavigate3, useLocation as useLocation9 } from "react-router-dom";
|
|
1161
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1338
1162
|
function getBaseFilePath2(filePath, version, locale) {
|
|
1339
1163
|
let path = filePath;
|
|
1340
1164
|
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
@@ -1351,9 +1175,9 @@ function VersionSwitcher({
|
|
|
1351
1175
|
currentLocale,
|
|
1352
1176
|
allRoutes
|
|
1353
1177
|
}) {
|
|
1354
|
-
const [isOpen, setIsOpen] =
|
|
1355
|
-
const dropdownRef =
|
|
1356
|
-
const navigate =
|
|
1178
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
1179
|
+
const dropdownRef = useRef3(null);
|
|
1180
|
+
const navigate = useNavigate3();
|
|
1357
1181
|
const location = useLocation9();
|
|
1358
1182
|
useEffect6(() => {
|
|
1359
1183
|
function handleClickOutside(event) {
|
|
@@ -1389,14 +1213,14 @@ function VersionSwitcher({
|
|
|
1389
1213
|
}
|
|
1390
1214
|
navigate(targetPath);
|
|
1391
1215
|
};
|
|
1392
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */ jsxs12(
|
|
1393
1217
|
"div",
|
|
1394
1218
|
{
|
|
1395
1219
|
className: "boltdocs-version-switcher",
|
|
1396
1220
|
ref: dropdownRef,
|
|
1397
1221
|
style: { position: "relative", display: "flex", alignItems: "center" },
|
|
1398
1222
|
children: [
|
|
1399
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsxs12(
|
|
1400
1224
|
"button",
|
|
1401
1225
|
{
|
|
1402
1226
|
className: "navbar-version",
|
|
@@ -1410,12 +1234,12 @@ function VersionSwitcher({
|
|
|
1410
1234
|
marginLeft: "0.5rem"
|
|
1411
1235
|
},
|
|
1412
1236
|
children: [
|
|
1413
|
-
/* @__PURE__ */
|
|
1414
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ jsx15("span", { children: versions.versions[currentVersion] || currentVersion }),
|
|
1238
|
+
/* @__PURE__ */ jsx15(ChevronDown2, { size: 14 })
|
|
1415
1239
|
]
|
|
1416
1240
|
}
|
|
1417
1241
|
),
|
|
1418
|
-
isOpen && /* @__PURE__ */
|
|
1242
|
+
isOpen && /* @__PURE__ */ jsx15(
|
|
1419
1243
|
"div",
|
|
1420
1244
|
{
|
|
1421
1245
|
className: "language-dropdown",
|
|
@@ -1425,7 +1249,7 @@ function VersionSwitcher({
|
|
|
1425
1249
|
minWidth: "150px",
|
|
1426
1250
|
top: "calc(100% + 8px)"
|
|
1427
1251
|
},
|
|
1428
|
-
children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */
|
|
1252
|
+
children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */ jsx15(
|
|
1429
1253
|
"button",
|
|
1430
1254
|
{
|
|
1431
1255
|
className: `language-option ${key === currentVersion ? "active" : ""}`,
|
|
@@ -1442,12 +1266,12 @@ function VersionSwitcher({
|
|
|
1442
1266
|
}
|
|
1443
1267
|
|
|
1444
1268
|
// src/client/theme/ui/ThemeToggle/ThemeToggle.tsx
|
|
1445
|
-
import { useEffect as useEffect7, useState as
|
|
1269
|
+
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
1446
1270
|
import { Sun, Moon } from "lucide-react";
|
|
1447
|
-
import { jsx as
|
|
1271
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1448
1272
|
function ThemeToggle() {
|
|
1449
|
-
const [theme, setTheme] =
|
|
1450
|
-
const [mounted, setMounted] =
|
|
1273
|
+
const [theme, setTheme] = useState8("dark");
|
|
1274
|
+
const [mounted, setMounted] = useState8(false);
|
|
1451
1275
|
useEffect7(() => {
|
|
1452
1276
|
setMounted(true);
|
|
1453
1277
|
const stored = localStorage.getItem("boltdocs-theme");
|
|
@@ -1485,23 +1309,23 @@ function ThemeToggle() {
|
|
|
1485
1309
|
localStorage.setItem("boltdocs-theme", newTheme);
|
|
1486
1310
|
};
|
|
1487
1311
|
if (!mounted) {
|
|
1488
|
-
return /* @__PURE__ */
|
|
1312
|
+
return /* @__PURE__ */ jsx16("button", { className: "navbar-icon-btn", "aria-label": "Toggle theme", disabled: true, children: /* @__PURE__ */ jsx16("span", { style: { width: 20, height: 20, display: "inline-block" } }) });
|
|
1489
1313
|
}
|
|
1490
|
-
return /* @__PURE__ */
|
|
1314
|
+
return /* @__PURE__ */ jsx16(
|
|
1491
1315
|
"button",
|
|
1492
1316
|
{
|
|
1493
1317
|
className: "navbar-icon-btn",
|
|
1494
1318
|
onClick: toggleTheme,
|
|
1495
1319
|
"aria-label": "Toggle theme",
|
|
1496
1320
|
title: `Switch to ${theme === "dark" ? "light" : "dark"} theme`,
|
|
1497
|
-
children: theme === "dark" ? /* @__PURE__ */
|
|
1321
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx16(Sun, { size: 20 }) : /* @__PURE__ */ jsx16(Moon, { size: 20 })
|
|
1498
1322
|
}
|
|
1499
1323
|
);
|
|
1500
1324
|
}
|
|
1501
1325
|
|
|
1502
1326
|
// src/client/theme/icons/discord.tsx
|
|
1503
|
-
import { jsx as
|
|
1504
|
-
var Discord = (props) => /* @__PURE__ */
|
|
1327
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1328
|
+
var Discord = (props) => /* @__PURE__ */ jsx17("svg", { ...props, viewBox: "0 0 256 199", preserveAspectRatio: "xMidYMid", children: /* @__PURE__ */ jsx17(
|
|
1505
1329
|
"path",
|
|
1506
1330
|
{
|
|
1507
1331
|
d: "M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z",
|
|
@@ -1510,8 +1334,8 @@ var Discord = (props) => /* @__PURE__ */ jsx23("svg", { ...props, viewBox: "0 0
|
|
|
1510
1334
|
) });
|
|
1511
1335
|
|
|
1512
1336
|
// src/client/theme/icons/twitter.tsx
|
|
1513
|
-
import { jsx as
|
|
1514
|
-
var XformerlyTwitter = (props) => /* @__PURE__ */
|
|
1337
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1338
|
+
var XformerlyTwitter = (props) => /* @__PURE__ */ jsx18("svg", { ...props, fill: "none", viewBox: "0 0 1200 1227", children: /* @__PURE__ */ jsx18(
|
|
1515
1339
|
"path",
|
|
1516
1340
|
{
|
|
1517
1341
|
fill: "currentColor",
|
|
@@ -1520,11 +1344,11 @@ var XformerlyTwitter = (props) => /* @__PURE__ */ jsx24("svg", { ...props, fill:
|
|
|
1520
1344
|
) });
|
|
1521
1345
|
|
|
1522
1346
|
// src/client/theme/ui/Navbar/Navbar.tsx
|
|
1523
|
-
import { jsx as
|
|
1524
|
-
var SearchDialog =
|
|
1525
|
-
() => import("./SearchDialog-
|
|
1347
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1348
|
+
var SearchDialog = React9.lazy(
|
|
1349
|
+
() => import("./SearchDialog-5EDRACEG.mjs").then((m) => ({ default: m.SearchDialog }))
|
|
1526
1350
|
);
|
|
1527
|
-
var
|
|
1351
|
+
var ICON_MAP = {
|
|
1528
1352
|
discord: Discord,
|
|
1529
1353
|
x: XformerlyTwitter
|
|
1530
1354
|
};
|
|
@@ -1538,10 +1362,10 @@ function Navbar({
|
|
|
1538
1362
|
const title = config.themeConfig?.title || "Boltdocs";
|
|
1539
1363
|
const navItems = config.themeConfig?.navbar || [];
|
|
1540
1364
|
const socialLinks = config.themeConfig?.socialLinks || [];
|
|
1541
|
-
return /* @__PURE__ */
|
|
1542
|
-
/* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
config.themeConfig?.logo ? config.themeConfig.logo.trim().startsWith("<svg") ? /* @__PURE__ */
|
|
1365
|
+
return /* @__PURE__ */ jsx19("header", { className: "boltdocs-navbar", children: /* @__PURE__ */ jsxs13("div", { className: "navbar-container", children: [
|
|
1366
|
+
/* @__PURE__ */ jsxs13("div", { className: "navbar-left", children: [
|
|
1367
|
+
/* @__PURE__ */ jsx19("div", { className: "navbar-logo", children: /* @__PURE__ */ jsxs13(Link, { to: "/", children: [
|
|
1368
|
+
config.themeConfig?.logo ? config.themeConfig.logo.trim().startsWith("<svg") ? /* @__PURE__ */ jsx19(
|
|
1545
1369
|
"span",
|
|
1546
1370
|
{
|
|
1547
1371
|
className: "navbar-logo-svg",
|
|
@@ -1549,7 +1373,7 @@ function Navbar({
|
|
|
1549
1373
|
__html: config.themeConfig.logo
|
|
1550
1374
|
}
|
|
1551
1375
|
}
|
|
1552
|
-
) : /* @__PURE__ */
|
|
1376
|
+
) : /* @__PURE__ */ jsx19(
|
|
1553
1377
|
"img",
|
|
1554
1378
|
{
|
|
1555
1379
|
src: config.themeConfig.logo,
|
|
@@ -1559,7 +1383,7 @@ function Navbar({
|
|
|
1559
1383
|
) : null,
|
|
1560
1384
|
title
|
|
1561
1385
|
] }) }),
|
|
1562
|
-
config.versions && currentVersion && allRoutes ? /* @__PURE__ */
|
|
1386
|
+
config.versions && currentVersion && allRoutes ? /* @__PURE__ */ jsx19(
|
|
1563
1387
|
VersionSwitcher,
|
|
1564
1388
|
{
|
|
1565
1389
|
versions: config.versions,
|
|
@@ -1567,22 +1391,22 @@ function Navbar({
|
|
|
1567
1391
|
currentLocale,
|
|
1568
1392
|
allRoutes
|
|
1569
1393
|
}
|
|
1570
|
-
) : config.themeConfig?.version ? /* @__PURE__ */
|
|
1394
|
+
) : config.themeConfig?.version ? /* @__PURE__ */ jsxs13("div", { className: "navbar-version", children: [
|
|
1571
1395
|
config.themeConfig.version,
|
|
1572
1396
|
" ",
|
|
1573
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ jsx19(ChevronDown3, { size: 14 })
|
|
1574
1398
|
] }) : null,
|
|
1575
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ jsx19("nav", { className: "navbar-links", "aria-label": "Top Navigation", children: navItems.map((item, i) => /* @__PURE__ */ jsx19(Link, { to: item.link, children: item.text }, i)) })
|
|
1576
1400
|
] }),
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
|
|
1401
|
+
/* @__PURE__ */ jsxs13("div", { className: "navbar-right", children: [
|
|
1402
|
+
/* @__PURE__ */ jsx19(
|
|
1403
|
+
React9.Suspense,
|
|
1580
1404
|
{
|
|
1581
|
-
fallback: /* @__PURE__ */
|
|
1582
|
-
children: /* @__PURE__ */
|
|
1405
|
+
fallback: /* @__PURE__ */ jsx19("div", { className: "navbar-search-placeholder" }),
|
|
1406
|
+
children: /* @__PURE__ */ jsx19(SearchDialog, { routes: routes || [] })
|
|
1583
1407
|
}
|
|
1584
1408
|
),
|
|
1585
|
-
config.i18n && currentLocale && allRoutes && /* @__PURE__ */
|
|
1409
|
+
config.i18n && currentLocale && allRoutes && /* @__PURE__ */ jsx19(
|
|
1586
1410
|
LanguageSwitcher,
|
|
1587
1411
|
{
|
|
1588
1412
|
i18n: config.i18n,
|
|
@@ -1590,12 +1414,12 @@ function Navbar({
|
|
|
1590
1414
|
allRoutes
|
|
1591
1415
|
}
|
|
1592
1416
|
),
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
config.themeConfig?.githubRepo && /* @__PURE__ */
|
|
1595
|
-
socialLinks.length > 0 && /* @__PURE__ */
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
const IconComp =
|
|
1598
|
-
return /* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ jsx19(ThemeToggle, {}),
|
|
1418
|
+
config.themeConfig?.githubRepo && /* @__PURE__ */ jsx19(GithubStars, { repo: config.themeConfig.githubRepo }),
|
|
1419
|
+
socialLinks.length > 0 && /* @__PURE__ */ jsx19("div", { className: "navbar-divider" }),
|
|
1420
|
+
/* @__PURE__ */ jsx19("div", { className: "navbar-icons", children: socialLinks.map((link, i) => {
|
|
1421
|
+
const IconComp = ICON_MAP[link.icon.toLowerCase()];
|
|
1422
|
+
return /* @__PURE__ */ jsx19(
|
|
1599
1423
|
"a",
|
|
1600
1424
|
{
|
|
1601
1425
|
href: link.link,
|
|
@@ -1603,7 +1427,7 @@ function Navbar({
|
|
|
1603
1427
|
rel: "noopener noreferrer",
|
|
1604
1428
|
className: "navbar-icon-btn",
|
|
1605
1429
|
"aria-label": link.icon,
|
|
1606
|
-
children: IconComp ? /* @__PURE__ */
|
|
1430
|
+
children: IconComp ? /* @__PURE__ */ jsx19(IconComp, {}) : /* @__PURE__ */ jsx19("span", { children: link.icon })
|
|
1607
1431
|
},
|
|
1608
1432
|
i
|
|
1609
1433
|
);
|
|
@@ -1623,19 +1447,6 @@ export {
|
|
|
1623
1447
|
ThemeLayout,
|
|
1624
1448
|
NotFound,
|
|
1625
1449
|
Loading,
|
|
1626
|
-
Button,
|
|
1627
|
-
Badge,
|
|
1628
|
-
Cards,
|
|
1629
|
-
Card,
|
|
1630
|
-
Tab,
|
|
1631
|
-
Tabs,
|
|
1632
|
-
Admonition,
|
|
1633
|
-
Note,
|
|
1634
|
-
Tip,
|
|
1635
|
-
Warning,
|
|
1636
|
-
Danger,
|
|
1637
|
-
InfoBox,
|
|
1638
|
-
List,
|
|
1639
1450
|
AppShell,
|
|
1640
1451
|
createBoltdocsApp
|
|
1641
1452
|
};
|