boltdocs 1.0.1 → 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/{CodeBlock-37XMKCYY.mjs → CodeBlock-V3Z5EKGR.mjs} +0 -1
- package/dist/{PackageManagerTabs-4NWXLXQO.mjs → PackageManagerTabs-XEKI3L7P.mjs} +0 -2
- package/dist/{SearchDialog-FTOQZ763.mjs → SearchDialog-5EDRACEG.mjs} +1 -2
- package/dist/{SearchDialog-ZAZXYIFX.css → SearchDialog-X57WPTNN.css} +57 -129
- package/dist/{Video-I6QY4X7J.mjs → Video-KNTY5BNO.mjs} +0 -1
- package/dist/cache-EHR7SXRU.mjs +12 -0
- package/dist/chunk-GSYECEZY.mjs +381 -0
- package/dist/{chunk-ZFCOLEXN.mjs → chunk-NS7WHDYA.mjs} +234 -426
- package/dist/client/index.css +57 -129
- package/dist/client/index.d.mts +39 -8
- package/dist/client/index.d.ts +39 -8
- package/dist/client/index.js +557 -564
- package/dist/client/index.mjs +305 -18
- package/dist/client/ssr.css +57 -129
- package/dist/client/ssr.d.mts +1 -1
- package/dist/client/ssr.d.ts +1 -1
- package/dist/client/ssr.js +257 -558
- package/dist/client/ssr.mjs +1 -2
- 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 +144 -147
- package/dist/{index-CRQKWAeo.d.mts → types-CvrzTbEX.d.mts} +1 -28
- package/dist/{index-CRQKWAeo.d.ts → types-CvrzTbEX.d.ts} +1 -28
- package/package.json +2 -2
- package/src/client/app/index.tsx +32 -110
- package/src/client/app/preload.tsx +1 -1
- package/src/client/index.ts +1 -1
- package/src/client/ssr.tsx +2 -1
- package/src/client/theme/components/Playground/Playground.tsx +40 -2
- package/src/client/theme/components/mdx/mdx-components.css +39 -20
- package/src/client/theme/styles/markdown.css +4 -4
- package/src/client/theme/styles.css +0 -1
- package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +1 -1
- package/src/client/theme/ui/Layout/Layout.tsx +3 -14
- 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/Navbar/Navbar.tsx +1 -1
- 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/SearchDialog/SearchDialog.tsx +1 -1
- package/src/client/theme/ui/Sidebar/Sidebar.tsx +44 -40
- package/src/client/theme/ui/Sidebar/sidebar.css +25 -58
- package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +1 -1
- package/src/client/types.ts +50 -0
- 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-OE2OE6B6.mjs +0 -7
- package/dist/chunk-PN4GCTYG.mjs +0 -67
- package/dist/chunk-X2TDGMTR.mjs +0 -64
- package/dist/chunk-X6BYQHVC.mjs +0 -12
- package/dist/node/cli/index.d.mts +0 -1
- package/dist/node/cli/index.d.ts +0 -1
- package/dist/node/cli/index.js +0 -199
- package/dist/node/cli/index.mjs +0 -154
- 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,286 +693,47 @@ 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);
|
|
898
700
|
}
|
|
899
701
|
var CodeBlock = lazy(
|
|
900
|
-
() => import("./CodeBlock-
|
|
702
|
+
() => import("./CodeBlock-V3Z5EKGR.mjs").then((m) => ({
|
|
901
703
|
default: m.CodeBlock
|
|
902
704
|
}))
|
|
903
705
|
);
|
|
904
706
|
var Video = lazy(
|
|
905
|
-
() => import("./Video-
|
|
707
|
+
() => import("./Video-KNTY5BNO.mjs").then((m) => ({ default: m.Video }))
|
|
906
708
|
);
|
|
907
709
|
var PackageManagerTabs = lazy(
|
|
908
|
-
() => import("./PackageManagerTabs-
|
|
710
|
+
() => import("./PackageManagerTabs-XEKI3L7P.mjs").then((m) => ({
|
|
909
711
|
default: m.PackageManagerTabs
|
|
910
712
|
}))
|
|
911
713
|
);
|
|
912
|
-
var Playground = lazy(
|
|
913
|
-
() => import("./Playground-OE2OE6B6.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,
|
|
@@ -1105,15 +899,12 @@ function createBoltdocsApp(options) {
|
|
|
1105
899
|
components: options.components
|
|
1106
900
|
}
|
|
1107
901
|
) }) });
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
} else {
|
|
1111
|
-
ReactDOM.createRoot(container).render(app);
|
|
1112
|
-
}
|
|
902
|
+
container.innerHTML = "";
|
|
903
|
+
ReactDOM.createRoot(container).render(app);
|
|
1113
904
|
}
|
|
1114
905
|
|
|
1115
906
|
// src/client/theme/ui/Link/Link.tsx
|
|
1116
|
-
import { jsx as
|
|
907
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1117
908
|
function useLocalizedTo(to) {
|
|
1118
909
|
const location = useLocation7();
|
|
1119
910
|
const config = useConfig();
|
|
@@ -1169,17 +960,19 @@ function useLocalizedTo(to) {
|
|
|
1169
960
|
}
|
|
1170
961
|
return finalPath === basePath ? basePath : finalPath;
|
|
1171
962
|
}
|
|
1172
|
-
var Link =
|
|
963
|
+
var Link = React6.forwardRef(
|
|
1173
964
|
(props, ref) => {
|
|
1174
965
|
const {
|
|
1175
966
|
boltdocsPrefetch = "hover",
|
|
1176
967
|
onMouseEnter,
|
|
1177
968
|
onFocus,
|
|
969
|
+
onClick,
|
|
1178
970
|
to,
|
|
1179
971
|
...rest
|
|
1180
972
|
} = props;
|
|
1181
973
|
const localizedTo = useLocalizedTo(to);
|
|
1182
974
|
const { preload } = usePreload();
|
|
975
|
+
const navigate = useNavigate();
|
|
1183
976
|
const handleMouseEnter = (e) => {
|
|
1184
977
|
onMouseEnter?.(e);
|
|
1185
978
|
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
@@ -1192,30 +985,45 @@ var Link = React8.forwardRef(
|
|
|
1192
985
|
preload(localizedTo);
|
|
1193
986
|
}
|
|
1194
987
|
};
|
|
1195
|
-
|
|
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(
|
|
1196
1001
|
RouterLink,
|
|
1197
1002
|
{
|
|
1198
1003
|
ref,
|
|
1199
1004
|
to: localizedTo,
|
|
1200
1005
|
onMouseEnter: handleMouseEnter,
|
|
1201
1006
|
onFocus: handleFocus,
|
|
1007
|
+
onClick: handleClick,
|
|
1202
1008
|
...rest
|
|
1203
1009
|
}
|
|
1204
1010
|
);
|
|
1205
1011
|
}
|
|
1206
1012
|
);
|
|
1207
1013
|
Link.displayName = "Link";
|
|
1208
|
-
var NavLink =
|
|
1014
|
+
var NavLink = React6.forwardRef(
|
|
1209
1015
|
(props, ref) => {
|
|
1210
1016
|
const {
|
|
1211
1017
|
boltdocsPrefetch = "hover",
|
|
1212
1018
|
onMouseEnter,
|
|
1213
1019
|
onFocus,
|
|
1020
|
+
onClick,
|
|
1214
1021
|
to,
|
|
1215
1022
|
...rest
|
|
1216
1023
|
} = props;
|
|
1217
1024
|
const localizedTo = useLocalizedTo(to);
|
|
1218
1025
|
const { preload } = usePreload();
|
|
1026
|
+
const navigate = useNavigate();
|
|
1219
1027
|
const handleMouseEnter = (e) => {
|
|
1220
1028
|
onMouseEnter?.(e);
|
|
1221
1029
|
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
@@ -1228,13 +1036,26 @@ var NavLink = React8.forwardRef(
|
|
|
1228
1036
|
preload(localizedTo);
|
|
1229
1037
|
}
|
|
1230
1038
|
};
|
|
1231
|
-
|
|
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(
|
|
1232
1052
|
RouterNavLink,
|
|
1233
1053
|
{
|
|
1234
1054
|
ref,
|
|
1235
1055
|
to: localizedTo,
|
|
1236
1056
|
onMouseEnter: handleMouseEnter,
|
|
1237
1057
|
onFocus: handleFocus,
|
|
1058
|
+
onClick: handleClick,
|
|
1238
1059
|
...rest
|
|
1239
1060
|
}
|
|
1240
1061
|
);
|
|
@@ -1246,10 +1067,10 @@ NavLink.displayName = "NavLink";
|
|
|
1246
1067
|
import { ChevronDown as ChevronDown3 } from "lucide-react";
|
|
1247
1068
|
|
|
1248
1069
|
// src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx
|
|
1249
|
-
import { useState as
|
|
1070
|
+
import { useState as useState6, useRef as useRef2, useEffect as useEffect5 } from "react";
|
|
1250
1071
|
import { Globe, ChevronDown } from "lucide-react";
|
|
1251
|
-
import { useNavigate, useLocation as useLocation8 } from "react-router-dom";
|
|
1252
|
-
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";
|
|
1253
1074
|
function getBaseFilePath(filePath, version, locale) {
|
|
1254
1075
|
let path = filePath;
|
|
1255
1076
|
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
@@ -1265,9 +1086,9 @@ function LanguageSwitcher({
|
|
|
1265
1086
|
currentLocale,
|
|
1266
1087
|
allRoutes
|
|
1267
1088
|
}) {
|
|
1268
|
-
const [isOpen, setIsOpen] =
|
|
1269
|
-
const dropdownRef =
|
|
1270
|
-
const navigate =
|
|
1089
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1090
|
+
const dropdownRef = useRef2(null);
|
|
1091
|
+
const navigate = useNavigate2();
|
|
1271
1092
|
const location = useLocation8();
|
|
1272
1093
|
useEffect5(() => {
|
|
1273
1094
|
function handleClickOutside(event) {
|
|
@@ -1305,8 +1126,8 @@ function LanguageSwitcher({
|
|
|
1305
1126
|
}
|
|
1306
1127
|
navigate(targetPath);
|
|
1307
1128
|
};
|
|
1308
|
-
return /* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1129
|
+
return /* @__PURE__ */ jsxs11("div", { className: "boltdocs-language-switcher", ref: dropdownRef, children: [
|
|
1130
|
+
/* @__PURE__ */ jsxs11(
|
|
1310
1131
|
"button",
|
|
1311
1132
|
{
|
|
1312
1133
|
className: "language-btn",
|
|
@@ -1315,13 +1136,13 @@ function LanguageSwitcher({
|
|
|
1315
1136
|
"aria-expanded": isOpen,
|
|
1316
1137
|
"aria-haspopup": "listbox",
|
|
1317
1138
|
children: [
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__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 })
|
|
1321
1142
|
]
|
|
1322
1143
|
}
|
|
1323
1144
|
),
|
|
1324
|
-
isOpen && /* @__PURE__ */
|
|
1145
|
+
isOpen && /* @__PURE__ */ jsx14("div", { className: "language-dropdown", children: Object.entries(i18n.locales).map(([key, label]) => /* @__PURE__ */ jsx14(
|
|
1325
1146
|
"button",
|
|
1326
1147
|
{
|
|
1327
1148
|
className: `language-option ${key === currentLocale ? "active" : ""}`,
|
|
@@ -1334,10 +1155,10 @@ function LanguageSwitcher({
|
|
|
1334
1155
|
}
|
|
1335
1156
|
|
|
1336
1157
|
// src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx
|
|
1337
|
-
import { useState as
|
|
1158
|
+
import { useState as useState7, useRef as useRef3, useEffect as useEffect6 } from "react";
|
|
1338
1159
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
1339
|
-
import { useNavigate as
|
|
1340
|
-
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";
|
|
1341
1162
|
function getBaseFilePath2(filePath, version, locale) {
|
|
1342
1163
|
let path = filePath;
|
|
1343
1164
|
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
@@ -1354,9 +1175,9 @@ function VersionSwitcher({
|
|
|
1354
1175
|
currentLocale,
|
|
1355
1176
|
allRoutes
|
|
1356
1177
|
}) {
|
|
1357
|
-
const [isOpen, setIsOpen] =
|
|
1358
|
-
const dropdownRef =
|
|
1359
|
-
const navigate =
|
|
1178
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
1179
|
+
const dropdownRef = useRef3(null);
|
|
1180
|
+
const navigate = useNavigate3();
|
|
1360
1181
|
const location = useLocation9();
|
|
1361
1182
|
useEffect6(() => {
|
|
1362
1183
|
function handleClickOutside(event) {
|
|
@@ -1392,14 +1213,14 @@ function VersionSwitcher({
|
|
|
1392
1213
|
}
|
|
1393
1214
|
navigate(targetPath);
|
|
1394
1215
|
};
|
|
1395
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */ jsxs12(
|
|
1396
1217
|
"div",
|
|
1397
1218
|
{
|
|
1398
1219
|
className: "boltdocs-version-switcher",
|
|
1399
1220
|
ref: dropdownRef,
|
|
1400
1221
|
style: { position: "relative", display: "flex", alignItems: "center" },
|
|
1401
1222
|
children: [
|
|
1402
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsxs12(
|
|
1403
1224
|
"button",
|
|
1404
1225
|
{
|
|
1405
1226
|
className: "navbar-version",
|
|
@@ -1413,12 +1234,12 @@ function VersionSwitcher({
|
|
|
1413
1234
|
marginLeft: "0.5rem"
|
|
1414
1235
|
},
|
|
1415
1236
|
children: [
|
|
1416
|
-
/* @__PURE__ */
|
|
1417
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ jsx15("span", { children: versions.versions[currentVersion] || currentVersion }),
|
|
1238
|
+
/* @__PURE__ */ jsx15(ChevronDown2, { size: 14 })
|
|
1418
1239
|
]
|
|
1419
1240
|
}
|
|
1420
1241
|
),
|
|
1421
|
-
isOpen && /* @__PURE__ */
|
|
1242
|
+
isOpen && /* @__PURE__ */ jsx15(
|
|
1422
1243
|
"div",
|
|
1423
1244
|
{
|
|
1424
1245
|
className: "language-dropdown",
|
|
@@ -1428,7 +1249,7 @@ function VersionSwitcher({
|
|
|
1428
1249
|
minWidth: "150px",
|
|
1429
1250
|
top: "calc(100% + 8px)"
|
|
1430
1251
|
},
|
|
1431
|
-
children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */
|
|
1252
|
+
children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */ jsx15(
|
|
1432
1253
|
"button",
|
|
1433
1254
|
{
|
|
1434
1255
|
className: `language-option ${key === currentVersion ? "active" : ""}`,
|
|
@@ -1445,12 +1266,12 @@ function VersionSwitcher({
|
|
|
1445
1266
|
}
|
|
1446
1267
|
|
|
1447
1268
|
// src/client/theme/ui/ThemeToggle/ThemeToggle.tsx
|
|
1448
|
-
import { useEffect as useEffect7, useState as
|
|
1269
|
+
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
1449
1270
|
import { Sun, Moon } from "lucide-react";
|
|
1450
|
-
import { jsx as
|
|
1271
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1451
1272
|
function ThemeToggle() {
|
|
1452
|
-
const [theme, setTheme] =
|
|
1453
|
-
const [mounted, setMounted] =
|
|
1273
|
+
const [theme, setTheme] = useState8("dark");
|
|
1274
|
+
const [mounted, setMounted] = useState8(false);
|
|
1454
1275
|
useEffect7(() => {
|
|
1455
1276
|
setMounted(true);
|
|
1456
1277
|
const stored = localStorage.getItem("boltdocs-theme");
|
|
@@ -1488,23 +1309,23 @@ function ThemeToggle() {
|
|
|
1488
1309
|
localStorage.setItem("boltdocs-theme", newTheme);
|
|
1489
1310
|
};
|
|
1490
1311
|
if (!mounted) {
|
|
1491
|
-
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" } }) });
|
|
1492
1313
|
}
|
|
1493
|
-
return /* @__PURE__ */
|
|
1314
|
+
return /* @__PURE__ */ jsx16(
|
|
1494
1315
|
"button",
|
|
1495
1316
|
{
|
|
1496
1317
|
className: "navbar-icon-btn",
|
|
1497
1318
|
onClick: toggleTheme,
|
|
1498
1319
|
"aria-label": "Toggle theme",
|
|
1499
1320
|
title: `Switch to ${theme === "dark" ? "light" : "dark"} theme`,
|
|
1500
|
-
children: theme === "dark" ? /* @__PURE__ */
|
|
1321
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx16(Sun, { size: 20 }) : /* @__PURE__ */ jsx16(Moon, { size: 20 })
|
|
1501
1322
|
}
|
|
1502
1323
|
);
|
|
1503
1324
|
}
|
|
1504
1325
|
|
|
1505
1326
|
// src/client/theme/icons/discord.tsx
|
|
1506
|
-
import { jsx as
|
|
1507
|
-
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(
|
|
1508
1329
|
"path",
|
|
1509
1330
|
{
|
|
1510
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",
|
|
@@ -1513,8 +1334,8 @@ var Discord = (props) => /* @__PURE__ */ jsx23("svg", { ...props, viewBox: "0 0
|
|
|
1513
1334
|
) });
|
|
1514
1335
|
|
|
1515
1336
|
// src/client/theme/icons/twitter.tsx
|
|
1516
|
-
import { jsx as
|
|
1517
|
-
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(
|
|
1518
1339
|
"path",
|
|
1519
1340
|
{
|
|
1520
1341
|
fill: "currentColor",
|
|
@@ -1523,11 +1344,11 @@ var XformerlyTwitter = (props) => /* @__PURE__ */ jsx24("svg", { ...props, fill:
|
|
|
1523
1344
|
) });
|
|
1524
1345
|
|
|
1525
1346
|
// src/client/theme/ui/Navbar/Navbar.tsx
|
|
1526
|
-
import { jsx as
|
|
1527
|
-
var SearchDialog =
|
|
1528
|
-
() => 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 }))
|
|
1529
1350
|
);
|
|
1530
|
-
var
|
|
1351
|
+
var ICON_MAP = {
|
|
1531
1352
|
discord: Discord,
|
|
1532
1353
|
x: XformerlyTwitter
|
|
1533
1354
|
};
|
|
@@ -1541,10 +1362,10 @@ function Navbar({
|
|
|
1541
1362
|
const title = config.themeConfig?.title || "Boltdocs";
|
|
1542
1363
|
const navItems = config.themeConfig?.navbar || [];
|
|
1543
1364
|
const socialLinks = config.themeConfig?.socialLinks || [];
|
|
1544
|
-
return /* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
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(
|
|
1548
1369
|
"span",
|
|
1549
1370
|
{
|
|
1550
1371
|
className: "navbar-logo-svg",
|
|
@@ -1552,7 +1373,7 @@ function Navbar({
|
|
|
1552
1373
|
__html: config.themeConfig.logo
|
|
1553
1374
|
}
|
|
1554
1375
|
}
|
|
1555
|
-
) : /* @__PURE__ */
|
|
1376
|
+
) : /* @__PURE__ */ jsx19(
|
|
1556
1377
|
"img",
|
|
1557
1378
|
{
|
|
1558
1379
|
src: config.themeConfig.logo,
|
|
@@ -1562,7 +1383,7 @@ function Navbar({
|
|
|
1562
1383
|
) : null,
|
|
1563
1384
|
title
|
|
1564
1385
|
] }) }),
|
|
1565
|
-
config.versions && currentVersion && allRoutes ? /* @__PURE__ */
|
|
1386
|
+
config.versions && currentVersion && allRoutes ? /* @__PURE__ */ jsx19(
|
|
1566
1387
|
VersionSwitcher,
|
|
1567
1388
|
{
|
|
1568
1389
|
versions: config.versions,
|
|
@@ -1570,22 +1391,22 @@ function Navbar({
|
|
|
1570
1391
|
currentLocale,
|
|
1571
1392
|
allRoutes
|
|
1572
1393
|
}
|
|
1573
|
-
) : config.themeConfig?.version ? /* @__PURE__ */
|
|
1394
|
+
) : config.themeConfig?.version ? /* @__PURE__ */ jsxs13("div", { className: "navbar-version", children: [
|
|
1574
1395
|
config.themeConfig.version,
|
|
1575
1396
|
" ",
|
|
1576
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ jsx19(ChevronDown3, { size: 14 })
|
|
1577
1398
|
] }) : null,
|
|
1578
|
-
/* @__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)) })
|
|
1579
1400
|
] }),
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
/* @__PURE__ */
|
|
1582
|
-
|
|
1401
|
+
/* @__PURE__ */ jsxs13("div", { className: "navbar-right", children: [
|
|
1402
|
+
/* @__PURE__ */ jsx19(
|
|
1403
|
+
React9.Suspense,
|
|
1583
1404
|
{
|
|
1584
|
-
fallback: /* @__PURE__ */
|
|
1585
|
-
children: /* @__PURE__ */
|
|
1405
|
+
fallback: /* @__PURE__ */ jsx19("div", { className: "navbar-search-placeholder" }),
|
|
1406
|
+
children: /* @__PURE__ */ jsx19(SearchDialog, { routes: routes || [] })
|
|
1586
1407
|
}
|
|
1587
1408
|
),
|
|
1588
|
-
config.i18n && currentLocale && allRoutes && /* @__PURE__ */
|
|
1409
|
+
config.i18n && currentLocale && allRoutes && /* @__PURE__ */ jsx19(
|
|
1589
1410
|
LanguageSwitcher,
|
|
1590
1411
|
{
|
|
1591
1412
|
i18n: config.i18n,
|
|
@@ -1593,12 +1414,12 @@ function Navbar({
|
|
|
1593
1414
|
allRoutes
|
|
1594
1415
|
}
|
|
1595
1416
|
),
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
config.themeConfig?.githubRepo && /* @__PURE__ */
|
|
1598
|
-
socialLinks.length > 0 && /* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
const IconComp =
|
|
1601
|
-
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(
|
|
1602
1423
|
"a",
|
|
1603
1424
|
{
|
|
1604
1425
|
href: link.link,
|
|
@@ -1606,7 +1427,7 @@ function Navbar({
|
|
|
1606
1427
|
rel: "noopener noreferrer",
|
|
1607
1428
|
className: "navbar-icon-btn",
|
|
1608
1429
|
"aria-label": link.icon,
|
|
1609
|
-
children: IconComp ? /* @__PURE__ */
|
|
1430
|
+
children: IconComp ? /* @__PURE__ */ jsx19(IconComp, {}) : /* @__PURE__ */ jsx19("span", { children: link.icon })
|
|
1610
1431
|
},
|
|
1611
1432
|
i
|
|
1612
1433
|
);
|
|
@@ -1626,19 +1447,6 @@ export {
|
|
|
1626
1447
|
ThemeLayout,
|
|
1627
1448
|
NotFound,
|
|
1628
1449
|
Loading,
|
|
1629
|
-
Button,
|
|
1630
|
-
Badge,
|
|
1631
|
-
Cards,
|
|
1632
|
-
Card,
|
|
1633
|
-
Tab,
|
|
1634
|
-
Tabs,
|
|
1635
|
-
Admonition,
|
|
1636
|
-
Note,
|
|
1637
|
-
Tip,
|
|
1638
|
-
Warning,
|
|
1639
|
-
Danger,
|
|
1640
|
-
InfoBox,
|
|
1641
|
-
List,
|
|
1642
1450
|
AppShell,
|
|
1643
1451
|
createBoltdocsApp
|
|
1644
1452
|
};
|