boltdocs 1.10.2 → 2.0.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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/dist/cache-7G6D532T.mjs +1 -0
- package/dist/chunk-A4HQPEPU.mjs +1 -0
- package/dist/chunk-BA5NH5HU.mjs +1 -0
- package/dist/chunk-BQCD3DWG.mjs +1 -0
- package/dist/chunk-H63UMKYF.mjs +1 -0
- package/dist/chunk-IWHRQHS7.mjs +1 -0
- package/dist/chunk-JZXLCA2E.mjs +1 -0
- package/dist/chunk-MFU7Q6WF.mjs +1 -0
- package/dist/chunk-QYPNX5UN.mjs +1 -0
- package/dist/chunk-XEAPSFMB.mjs +1 -0
- package/dist/client/components/mdx/index.d.mts +209 -0
- package/dist/client/components/mdx/index.d.ts +209 -0
- package/dist/client/components/mdx/index.js +1 -0
- package/dist/client/components/mdx/index.mjs +1 -0
- package/dist/client/hooks/index.d.mts +133 -0
- package/dist/client/hooks/index.d.ts +133 -0
- package/dist/client/hooks/index.js +1 -0
- package/dist/client/hooks/index.mjs +1 -0
- package/dist/client/index.d.mts +138 -298
- package/dist/client/index.d.ts +138 -298
- package/dist/client/index.js +1 -3630
- package/dist/client/index.mjs +1 -697
- package/dist/client/ssr.d.mts +7 -3
- package/dist/client/ssr.d.ts +7 -3
- package/dist/client/ssr.js +1 -2928
- package/dist/client/ssr.mjs +1 -33
- package/dist/{config-BsFQ-ErD.d.ts → config-CX4l-ZNp.d.mts} +42 -35
- package/dist/{config-BsFQ-ErD.d.mts → config-CX4l-ZNp.d.ts} +42 -35
- package/dist/node/index.d.mts +2 -4
- package/dist/node/index.d.ts +2 -4
- package/dist/node/index.js +31 -1161
- package/dist/node/index.mjs +31 -736
- package/dist/search-dialog-EB3N4TYM.mjs +1 -0
- package/dist/types-BuZWFT7r.d.ts +159 -0
- package/dist/types-CvT-SGbK.d.mts +159 -0
- package/dist/use-routes-5bAtAAYX.d.mts +30 -0
- package/dist/use-routes-BefRXY3v.d.ts +30 -0
- package/package.json +34 -12
- package/src/client/app/config-context.tsx +18 -0
- package/src/client/app/docs-layout.tsx +14 -0
- package/src/client/app/index.tsx +137 -262
- package/src/client/app/mdx-component.tsx +52 -0
- package/src/client/app/mdx-components-context.tsx +23 -0
- package/src/client/app/mdx-page.tsx +20 -0
- package/src/client/app/preload.tsx +38 -30
- package/src/client/app/router.tsx +30 -0
- package/src/client/app/scroll-handler.tsx +40 -0
- package/src/client/app/theme-context.tsx +75 -0
- package/src/client/components/default-layout.tsx +80 -0
- package/src/client/components/docs-layout.tsx +105 -0
- package/src/client/components/icons-dev.tsx +74 -0
- package/src/client/components/mdx/admonition.tsx +107 -0
- package/src/client/components/mdx/badge.tsx +41 -0
- package/src/client/components/mdx/button.tsx +35 -0
- package/src/client/components/mdx/card.tsx +124 -0
- package/src/client/components/mdx/code-block.tsx +119 -0
- package/src/client/components/mdx/component-preview.tsx +47 -0
- package/src/client/components/mdx/component-props.tsx +83 -0
- package/src/client/components/mdx/field.tsx +66 -0
- package/src/client/components/mdx/file-tree.tsx +287 -0
- package/src/client/components/mdx/hooks/use-code-block.ts +56 -0
- package/src/client/components/mdx/hooks/use-component-preview.ts +16 -0
- package/src/client/components/mdx/hooks/useTable.ts +74 -0
- package/src/client/components/mdx/hooks/useTabs.ts +68 -0
- package/src/client/components/mdx/image.tsx +23 -0
- package/src/client/components/mdx/index.ts +53 -0
- package/src/client/components/mdx/link.tsx +38 -0
- package/src/client/components/mdx/list.tsx +192 -0
- package/src/client/components/mdx/table.tsx +156 -0
- package/src/client/components/mdx/tabs.tsx +135 -0
- package/src/client/components/mdx/video.tsx +68 -0
- package/src/client/components/primitives/breadcrumbs.tsx +79 -0
- package/src/client/components/primitives/button-group.tsx +54 -0
- package/src/client/components/primitives/button.tsx +145 -0
- package/src/client/components/primitives/helpers/observer.ts +120 -0
- package/src/client/components/primitives/index.ts +17 -0
- package/src/client/components/primitives/link.tsx +122 -0
- package/src/client/components/primitives/menu.tsx +159 -0
- package/src/client/components/primitives/navbar.tsx +359 -0
- package/src/client/components/primitives/navigation-menu.tsx +116 -0
- package/src/client/components/primitives/on-this-page.tsx +461 -0
- package/src/client/components/primitives/page-nav.tsx +87 -0
- package/src/client/components/primitives/popover.tsx +47 -0
- package/src/client/components/primitives/search-dialog.tsx +183 -0
- package/src/client/components/primitives/sidebar.tsx +154 -0
- package/src/client/components/primitives/tabs.tsx +90 -0
- package/src/client/components/primitives/tooltip.tsx +83 -0
- package/src/client/components/primitives/types.ts +11 -0
- package/src/client/components/ui-base/breadcrumbs.tsx +42 -0
- package/src/client/components/ui-base/copy-markdown.tsx +112 -0
- package/src/client/components/ui-base/error-boundary.tsx +52 -0
- package/src/client/components/ui-base/github-stars.tsx +27 -0
- package/src/client/components/ui-base/head.tsx +69 -0
- package/src/client/components/ui-base/loading.tsx +87 -0
- package/src/client/components/ui-base/navbar.tsx +138 -0
- package/src/client/components/ui-base/not-found.tsx +24 -0
- package/src/client/components/ui-base/on-this-page.tsx +152 -0
- package/src/client/components/ui-base/page-nav.tsx +39 -0
- package/src/client/components/ui-base/powered-by.tsx +19 -0
- package/src/client/components/ui-base/progress-bar.tsx +67 -0
- package/src/client/components/ui-base/search-dialog.tsx +82 -0
- package/src/client/components/ui-base/sidebar.tsx +104 -0
- package/src/client/components/ui-base/tabs.tsx +65 -0
- package/src/client/components/ui-base/theme-toggle.tsx +32 -0
- package/src/client/hooks/index.ts +12 -0
- package/src/client/hooks/use-breadcrumbs.ts +22 -0
- package/src/client/hooks/use-i18n.ts +84 -0
- package/src/client/hooks/use-localized-to.ts +95 -0
- package/src/client/hooks/use-location.ts +5 -0
- package/src/client/hooks/use-navbar.ts +60 -0
- package/src/client/hooks/use-onthispage.ts +23 -0
- package/src/client/hooks/use-page-nav.ts +22 -0
- package/src/client/hooks/use-routes.ts +72 -0
- package/src/client/hooks/use-search.ts +71 -0
- package/src/client/hooks/use-sidebar.ts +49 -0
- package/src/client/hooks/use-tabs.ts +43 -0
- package/src/client/hooks/use-version.ts +78 -0
- package/src/client/index.ts +55 -17
- package/src/client/integrations/codesandbox.ts +179 -0
- package/src/client/ssr.tsx +27 -16
- package/src/client/theme/neutral.css +360 -0
- package/src/client/types.ts +131 -27
- package/src/client/utils/cn.ts +6 -0
- package/src/client/utils/copy-clipboard.ts +22 -0
- package/src/client/utils/get-base-file-path.ts +21 -0
- package/src/client/utils/github.ts +121 -0
- package/src/client/utils/use-on-change.ts +15 -0
- package/src/client/virtual.d.ts +24 -0
- package/src/node/cache.ts +156 -156
- package/src/node/config.ts +159 -103
- package/src/node/index.ts +13 -13
- package/src/node/mdx.ts +213 -61
- package/src/node/plugin/entry.ts +29 -18
- package/src/node/plugin/html.ts +11 -11
- package/src/node/plugin/index.ts +161 -84
- package/src/node/plugin/types.ts +2 -4
- package/src/node/routes/cache.ts +6 -6
- package/src/node/routes/index.ts +206 -113
- package/src/node/routes/parser.ts +102 -82
- package/src/node/routes/sorter.ts +15 -15
- package/src/node/routes/types.ts +24 -24
- package/src/node/ssg/index.ts +73 -47
- package/src/node/ssg/meta.ts +4 -4
- package/src/node/ssg/options.ts +5 -5
- package/src/node/ssg/sitemap.ts +14 -14
- package/src/node/utils.ts +54 -31
- package/tsconfig.json +25 -20
- package/tsup.config.ts +23 -14
- package/dist/PackageManagerTabs-NVT7G625.mjs +0 -99
- package/dist/SearchDialog-AGVF6JBO.mjs +0 -194
- package/dist/SearchDialog-YPDOM7Q6.css +0 -2847
- package/dist/Video-KNTY5BNO.mjs +0 -6
- package/dist/cache-KNL5B4EE.mjs +0 -12
- package/dist/chunk-7SFUJWTB.mjs +0 -211
- package/dist/chunk-FFBNU6IJ.mjs +0 -386
- package/dist/chunk-FMTOYQLO.mjs +0 -37
- package/dist/chunk-TKLQWU7H.mjs +0 -1920
- package/dist/chunk-Z7JHYNAS.mjs +0 -57
- package/dist/client/index.css +0 -2847
- package/dist/client/ssr.css +0 -2847
- package/dist/types-Dj-bfnC3.d.mts +0 -74
- package/dist/types-Dj-bfnC3.d.ts +0 -74
- package/src/client/theme/components/CodeBlock/CodeBlock.tsx +0 -61
- package/src/client/theme/components/CodeBlock/index.ts +0 -1
- package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +0 -131
- package/src/client/theme/components/PackageManagerTabs/index.ts +0 -1
- package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +0 -64
- package/src/client/theme/components/Playground/Playground.tsx +0 -180
- package/src/client/theme/components/Playground/index.ts +0 -1
- package/src/client/theme/components/Playground/playground.css +0 -238
- package/src/client/theme/components/Video/Video.tsx +0 -84
- package/src/client/theme/components/Video/index.ts +0 -1
- package/src/client/theme/components/Video/video.css +0 -41
- package/src/client/theme/components/mdx/Admonition.tsx +0 -80
- package/src/client/theme/components/mdx/Badge.tsx +0 -31
- package/src/client/theme/components/mdx/Button.tsx +0 -50
- package/src/client/theme/components/mdx/Card.tsx +0 -80
- package/src/client/theme/components/mdx/Field.tsx +0 -60
- package/src/client/theme/components/mdx/FileTree.tsx +0 -229
- package/src/client/theme/components/mdx/List.tsx +0 -57
- package/src/client/theme/components/mdx/Table.tsx +0 -151
- package/src/client/theme/components/mdx/Tabs.tsx +0 -123
- package/src/client/theme/components/mdx/index.ts +0 -27
- package/src/client/theme/components/mdx/mdx-components.css +0 -764
- package/src/client/theme/icons/bun.tsx +0 -62
- package/src/client/theme/icons/deno.tsx +0 -20
- package/src/client/theme/icons/discord.tsx +0 -12
- package/src/client/theme/icons/github.tsx +0 -15
- package/src/client/theme/icons/npm.tsx +0 -13
- package/src/client/theme/icons/pnpm.tsx +0 -72
- package/src/client/theme/icons/twitter.tsx +0 -12
- package/src/client/theme/styles/markdown.css +0 -394
- package/src/client/theme/styles/variables.css +0 -175
- package/src/client/theme/styles.css +0 -39
- package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +0 -68
- package/src/client/theme/ui/Breadcrumbs/index.ts +0 -1
- package/src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx +0 -82
- package/src/client/theme/ui/CopyMarkdown/copy-markdown.css +0 -112
- package/src/client/theme/ui/CopyMarkdown/index.ts +0 -1
- package/src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx +0 -50
- package/src/client/theme/ui/ErrorBoundary/error-boundary.css +0 -55
- package/src/client/theme/ui/ErrorBoundary/index.ts +0 -1
- package/src/client/theme/ui/Footer/footer.css +0 -32
- package/src/client/theme/ui/Head/Head.tsx +0 -69
- package/src/client/theme/ui/Head/index.ts +0 -1
- package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +0 -125
- package/src/client/theme/ui/LanguageSwitcher/index.ts +0 -1
- package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +0 -98
- package/src/client/theme/ui/Layout/Layout.tsx +0 -203
- package/src/client/theme/ui/Layout/base.css +0 -106
- package/src/client/theme/ui/Layout/index.ts +0 -2
- package/src/client/theme/ui/Layout/pagination.css +0 -72
- package/src/client/theme/ui/Layout/responsive.css +0 -47
- package/src/client/theme/ui/Link/Link.tsx +0 -392
- package/src/client/theme/ui/Link/LinkPreview.tsx +0 -59
- package/src/client/theme/ui/Link/index.ts +0 -2
- package/src/client/theme/ui/Link/link-preview.css +0 -48
- package/src/client/theme/ui/Loading/Loading.tsx +0 -10
- package/src/client/theme/ui/Loading/index.ts +0 -1
- package/src/client/theme/ui/Loading/loading.css +0 -30
- package/src/client/theme/ui/Navbar/GithubStars.tsx +0 -27
- package/src/client/theme/ui/Navbar/Navbar.tsx +0 -193
- package/src/client/theme/ui/Navbar/Tabs.tsx +0 -99
- package/src/client/theme/ui/Navbar/index.ts +0 -2
- package/src/client/theme/ui/Navbar/navbar.css +0 -347
- package/src/client/theme/ui/NotFound/NotFound.tsx +0 -19
- package/src/client/theme/ui/NotFound/index.ts +0 -1
- package/src/client/theme/ui/NotFound/not-found.css +0 -64
- package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +0 -244
- package/src/client/theme/ui/OnThisPage/index.ts +0 -1
- package/src/client/theme/ui/OnThisPage/toc.css +0 -152
- package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +0 -18
- package/src/client/theme/ui/PoweredBy/index.ts +0 -1
- package/src/client/theme/ui/PoweredBy/powered-by.css +0 -76
- package/src/client/theme/ui/ProgressBar/ProgressBar.css +0 -17
- package/src/client/theme/ui/ProgressBar/ProgressBar.tsx +0 -51
- package/src/client/theme/ui/ProgressBar/index.ts +0 -1
- package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +0 -209
- package/src/client/theme/ui/SearchDialog/index.ts +0 -1
- package/src/client/theme/ui/SearchDialog/search.css +0 -152
- package/src/client/theme/ui/Sidebar/Sidebar.tsx +0 -244
- package/src/client/theme/ui/Sidebar/index.ts +0 -1
- package/src/client/theme/ui/Sidebar/sidebar.css +0 -230
- package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +0 -69
- package/src/client/theme/ui/ThemeToggle/index.ts +0 -1
- package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +0 -136
- package/src/client/theme/ui/VersionSwitcher/index.ts +0 -1
- package/src/client/utils.ts +0 -49
package/dist/chunk-TKLQWU7H.mjs
DELETED
|
@@ -1,1920 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
copyToClipboard,
|
|
3
|
-
getStarsRepo
|
|
4
|
-
} from "./chunk-FMTOYQLO.mjs";
|
|
5
|
-
|
|
6
|
-
// src/client/theme/ui/Navbar/Navbar.tsx
|
|
7
|
-
import { Suspense as Suspense2, lazy as lazy2 } from "react";
|
|
8
|
-
import { Link as Link2, useLocation as useLocation11 } from "react-router-dom";
|
|
9
|
-
import { ChevronDown as ChevronDown4 } from "lucide-react";
|
|
10
|
-
|
|
11
|
-
// src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx
|
|
12
|
-
import { useState, useRef, useEffect } from "react";
|
|
13
|
-
import { Globe, ChevronDown } from "lucide-react";
|
|
14
|
-
import { useNavigate, useLocation } from "react-router-dom";
|
|
15
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
function getBaseFilePath(filePath, version, locale) {
|
|
17
|
-
let path = filePath;
|
|
18
|
-
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
19
|
-
path = path === version ? "index.md" : path.slice(version.length + 1);
|
|
20
|
-
}
|
|
21
|
-
if (locale && (path === locale || path.startsWith(locale + "/"))) {
|
|
22
|
-
path = path === locale ? "index.md" : path.slice(locale.length + 1);
|
|
23
|
-
}
|
|
24
|
-
return path;
|
|
25
|
-
}
|
|
26
|
-
function LanguageSwitcher({
|
|
27
|
-
i18n,
|
|
28
|
-
currentLocale,
|
|
29
|
-
allRoutes
|
|
30
|
-
}) {
|
|
31
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
32
|
-
const dropdownRef = useRef(null);
|
|
33
|
-
const navigate = useNavigate();
|
|
34
|
-
const location = useLocation();
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
function handleClickOutside(event) {
|
|
37
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
38
|
-
setIsOpen(false);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
42
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
43
|
-
}, []);
|
|
44
|
-
const handleSelect = (locale) => {
|
|
45
|
-
setIsOpen(false);
|
|
46
|
-
if (locale === currentLocale) return;
|
|
47
|
-
const currentRoute = allRoutes.find((r) => r.path === location.pathname);
|
|
48
|
-
let targetPath = "/";
|
|
49
|
-
if (currentRoute) {
|
|
50
|
-
const baseFile = getBaseFilePath(
|
|
51
|
-
currentRoute.filePath,
|
|
52
|
-
currentRoute.version,
|
|
53
|
-
currentRoute.locale
|
|
54
|
-
);
|
|
55
|
-
const targetRoute = allRoutes.find(
|
|
56
|
-
(r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version
|
|
57
|
-
);
|
|
58
|
-
if (targetRoute) {
|
|
59
|
-
targetPath = targetRoute.path;
|
|
60
|
-
} else {
|
|
61
|
-
const defaultIndexRoute = allRoutes.find(
|
|
62
|
-
(r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version
|
|
63
|
-
);
|
|
64
|
-
targetPath = defaultIndexRoute ? defaultIndexRoute.path : locale === i18n.defaultLocale ? currentRoute.version ? `/${currentRoute.version}` : "/" : currentRoute.version ? `/${currentRoute.version}/${locale}` : `/${locale}`;
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
targetPath = locale === i18n.defaultLocale ? "/" : `/${locale}`;
|
|
68
|
-
}
|
|
69
|
-
navigate(targetPath);
|
|
70
|
-
};
|
|
71
|
-
return /* @__PURE__ */ jsxs("div", { className: "boltdocs-language-switcher", ref: dropdownRef, children: [
|
|
72
|
-
/* @__PURE__ */ jsxs(
|
|
73
|
-
"button",
|
|
74
|
-
{
|
|
75
|
-
className: "language-btn",
|
|
76
|
-
onClick: () => setIsOpen(!isOpen),
|
|
77
|
-
"aria-label": "Switch language",
|
|
78
|
-
"aria-expanded": isOpen,
|
|
79
|
-
"aria-haspopup": "listbox",
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ jsx(Globe, { size: 18 }),
|
|
82
|
-
/* @__PURE__ */ jsx("span", { className: "language-label", children: i18n.locales[currentLocale] || currentLocale }),
|
|
83
|
-
/* @__PURE__ */ jsx(ChevronDown, { size: 14 })
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
isOpen && /* @__PURE__ */ jsx("div", { className: "language-dropdown", children: Object.entries(i18n.locales).map(([key, label]) => /* @__PURE__ */ jsx(
|
|
88
|
-
"button",
|
|
89
|
-
{
|
|
90
|
-
className: `language-option ${key === currentLocale ? "active" : ""}`,
|
|
91
|
-
onClick: () => handleSelect(key),
|
|
92
|
-
children: label
|
|
93
|
-
},
|
|
94
|
-
key
|
|
95
|
-
)) })
|
|
96
|
-
] });
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx
|
|
100
|
-
import { useState as useState2, useRef as useRef2, useEffect as useEffect2 } from "react";
|
|
101
|
-
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
102
|
-
import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
103
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
104
|
-
function getBaseFilePath2(filePath, version, locale) {
|
|
105
|
-
let path = filePath;
|
|
106
|
-
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
107
|
-
path = path === version ? "index.md" : path.slice(version.length + 1);
|
|
108
|
-
}
|
|
109
|
-
if (locale && (path === locale || path.startsWith(locale + "/"))) {
|
|
110
|
-
path = path === locale ? "index.md" : path.slice(locale.length + 1);
|
|
111
|
-
}
|
|
112
|
-
return path;
|
|
113
|
-
}
|
|
114
|
-
function VersionSwitcher({
|
|
115
|
-
versions,
|
|
116
|
-
currentVersion,
|
|
117
|
-
currentLocale,
|
|
118
|
-
allRoutes
|
|
119
|
-
}) {
|
|
120
|
-
const [isOpen, setIsOpen] = useState2(false);
|
|
121
|
-
const dropdownRef = useRef2(null);
|
|
122
|
-
const navigate = useNavigate2();
|
|
123
|
-
const location = useLocation2();
|
|
124
|
-
useEffect2(() => {
|
|
125
|
-
function handleClickOutside(event) {
|
|
126
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
127
|
-
setIsOpen(false);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
131
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
132
|
-
}, []);
|
|
133
|
-
const handleSelect = (version) => {
|
|
134
|
-
setIsOpen(false);
|
|
135
|
-
if (version === currentVersion) return;
|
|
136
|
-
const currentRoute = allRoutes.find((r) => r.path === location.pathname);
|
|
137
|
-
let targetPath = `/docs/${version}`;
|
|
138
|
-
if (currentRoute) {
|
|
139
|
-
const baseFile = getBaseFilePath2(
|
|
140
|
-
currentRoute.filePath,
|
|
141
|
-
currentRoute.version,
|
|
142
|
-
currentRoute.locale
|
|
143
|
-
);
|
|
144
|
-
const targetRoute = allRoutes.find(
|
|
145
|
-
(r) => getBaseFilePath2(r.filePath, r.version, r.locale) === baseFile && (r.version || versions.defaultVersion) === version && (currentLocale ? r.locale === currentLocale : !r.locale)
|
|
146
|
-
);
|
|
147
|
-
if (targetRoute) {
|
|
148
|
-
targetPath = targetRoute.path;
|
|
149
|
-
} else {
|
|
150
|
-
const versionIndexRoute = allRoutes.find(
|
|
151
|
-
(r) => getBaseFilePath2(r.filePath, r.version, r.locale) === "index.md" && (r.version || versions.defaultVersion) === version && (currentLocale ? r.locale === currentLocale : !r.locale)
|
|
152
|
-
);
|
|
153
|
-
targetPath = versionIndexRoute ? versionIndexRoute.path : `/docs/${version}${currentLocale ? `/${currentLocale}` : ""}`;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
navigate(targetPath);
|
|
157
|
-
};
|
|
158
|
-
return /* @__PURE__ */ jsxs2(
|
|
159
|
-
"div",
|
|
160
|
-
{
|
|
161
|
-
className: "boltdocs-version-switcher",
|
|
162
|
-
ref: dropdownRef,
|
|
163
|
-
style: { position: "relative", display: "flex", alignItems: "center" },
|
|
164
|
-
children: [
|
|
165
|
-
/* @__PURE__ */ jsxs2(
|
|
166
|
-
"button",
|
|
167
|
-
{
|
|
168
|
-
className: "navbar-version",
|
|
169
|
-
onClick: () => setIsOpen(!isOpen),
|
|
170
|
-
"aria-label": "Switch version",
|
|
171
|
-
"aria-expanded": isOpen,
|
|
172
|
-
"aria-haspopup": "listbox",
|
|
173
|
-
style: {
|
|
174
|
-
fontFamily: "inherit",
|
|
175
|
-
padding: "0.25rem 0.5rem",
|
|
176
|
-
marginLeft: "0.5rem"
|
|
177
|
-
},
|
|
178
|
-
children: [
|
|
179
|
-
/* @__PURE__ */ jsx2("span", { children: versions.versions[currentVersion] || currentVersion }),
|
|
180
|
-
/* @__PURE__ */ jsx2(ChevronDown2, { size: 14 })
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
),
|
|
184
|
-
isOpen && /* @__PURE__ */ jsx2(
|
|
185
|
-
"div",
|
|
186
|
-
{
|
|
187
|
-
className: "language-dropdown",
|
|
188
|
-
style: {
|
|
189
|
-
left: "0.5rem",
|
|
190
|
-
right: "auto",
|
|
191
|
-
minWidth: "150px",
|
|
192
|
-
top: "calc(100% + 8px)"
|
|
193
|
-
},
|
|
194
|
-
children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */ jsx2(
|
|
195
|
-
"button",
|
|
196
|
-
{
|
|
197
|
-
className: `language-option ${key === currentVersion ? "active" : ""}`,
|
|
198
|
-
onClick: () => handleSelect(key),
|
|
199
|
-
children: label
|
|
200
|
-
},
|
|
201
|
-
key
|
|
202
|
-
))
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/client/theme/ui/ThemeToggle/ThemeToggle.tsx
|
|
211
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
212
|
-
import { Sun, Moon } from "lucide-react";
|
|
213
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
214
|
-
function ThemeToggle() {
|
|
215
|
-
const [theme, setTheme] = useState3("dark");
|
|
216
|
-
const [mounted, setMounted] = useState3(false);
|
|
217
|
-
useEffect3(() => {
|
|
218
|
-
setMounted(true);
|
|
219
|
-
const stored = localStorage.getItem("boltdocs-theme");
|
|
220
|
-
if (stored === "light" || stored === "dark") {
|
|
221
|
-
setTheme(stored);
|
|
222
|
-
} else {
|
|
223
|
-
const prefersDark = window.matchMedia(
|
|
224
|
-
"(prefers-color-scheme: dark)"
|
|
225
|
-
).matches;
|
|
226
|
-
setTheme(prefersDark ? "dark" : "light");
|
|
227
|
-
}
|
|
228
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
229
|
-
const handleChange = (e) => {
|
|
230
|
-
if (!localStorage.getItem("boltdocs-theme")) {
|
|
231
|
-
setTheme(e.matches ? "dark" : "light");
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
mediaQuery.addEventListener("change", handleChange);
|
|
235
|
-
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
236
|
-
}, []);
|
|
237
|
-
useEffect3(() => {
|
|
238
|
-
if (!mounted) return;
|
|
239
|
-
const root = document.documentElement;
|
|
240
|
-
if (theme === "light") {
|
|
241
|
-
root.classList.add("theme-light");
|
|
242
|
-
root.dataset.theme = "light";
|
|
243
|
-
} else {
|
|
244
|
-
root.classList.remove("theme-light");
|
|
245
|
-
root.dataset.theme = "dark";
|
|
246
|
-
}
|
|
247
|
-
}, [theme, mounted]);
|
|
248
|
-
const toggleTheme = () => {
|
|
249
|
-
const newTheme = theme === "dark" ? "light" : "dark";
|
|
250
|
-
setTheme(newTheme);
|
|
251
|
-
localStorage.setItem("boltdocs-theme", newTheme);
|
|
252
|
-
};
|
|
253
|
-
if (!mounted) {
|
|
254
|
-
return /* @__PURE__ */ jsx3("button", { className: "navbar-icon-btn", "aria-label": "Toggle theme", disabled: true, children: /* @__PURE__ */ jsx3("span", { style: { width: 20, height: 20, display: "inline-block" } }) });
|
|
255
|
-
}
|
|
256
|
-
return /* @__PURE__ */ jsx3(
|
|
257
|
-
"button",
|
|
258
|
-
{
|
|
259
|
-
className: "navbar-icon-btn",
|
|
260
|
-
onClick: toggleTheme,
|
|
261
|
-
"aria-label": "Toggle theme",
|
|
262
|
-
title: `Switch to ${theme === "dark" ? "light" : "dark"} theme`,
|
|
263
|
-
children: theme === "dark" ? /* @__PURE__ */ jsx3(Sun, { size: 20 }) : /* @__PURE__ */ jsx3(Moon, { size: 20 })
|
|
264
|
-
}
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// src/client/theme/icons/discord.tsx
|
|
269
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
270
|
-
var Discord = (props) => /* @__PURE__ */ jsx4("svg", { ...props, viewBox: "0 0 256 199", preserveAspectRatio: "xMidYMid", children: /* @__PURE__ */ jsx4(
|
|
271
|
-
"path",
|
|
272
|
-
{
|
|
273
|
-
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",
|
|
274
|
-
fill: "currentColor"
|
|
275
|
-
}
|
|
276
|
-
) });
|
|
277
|
-
|
|
278
|
-
// src/client/theme/icons/twitter.tsx
|
|
279
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
280
|
-
var XformerlyTwitter = (props) => /* @__PURE__ */ jsx5("svg", { ...props, fill: "none", viewBox: "0 0 1200 1227", children: /* @__PURE__ */ jsx5(
|
|
281
|
-
"path",
|
|
282
|
-
{
|
|
283
|
-
fill: "currentColor",
|
|
284
|
-
d: "M714.163 519.284 1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284h.026ZM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854v-.026Z"
|
|
285
|
-
}
|
|
286
|
-
) });
|
|
287
|
-
|
|
288
|
-
// src/client/theme/ui/Navbar/GithubStars.tsx
|
|
289
|
-
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
290
|
-
|
|
291
|
-
// src/client/theme/icons/github.tsx
|
|
292
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
293
|
-
var GitHub = (props) => /* @__PURE__ */ jsx6("svg", { ...props, viewBox: "0 0 1024 1024", fill: "none", children: /* @__PURE__ */ jsx6(
|
|
294
|
-
"path",
|
|
295
|
-
{
|
|
296
|
-
fillRule: "evenodd",
|
|
297
|
-
clipRule: "evenodd",
|
|
298
|
-
d: "M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z",
|
|
299
|
-
transform: "scale(64)",
|
|
300
|
-
fill: "currentColor"
|
|
301
|
-
}
|
|
302
|
-
) });
|
|
303
|
-
|
|
304
|
-
// src/client/theme/ui/Navbar/GithubStars.tsx
|
|
305
|
-
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
306
|
-
function GithubStars({ repo }) {
|
|
307
|
-
const [stars, setStars] = useState4(null);
|
|
308
|
-
useEffect4(() => {
|
|
309
|
-
if (repo) {
|
|
310
|
-
getStarsRepo(repo).then((stars2) => setStars(stars2)).catch(() => setStars("0"));
|
|
311
|
-
}
|
|
312
|
-
}, [repo]);
|
|
313
|
-
return /* @__PURE__ */ jsxs3(
|
|
314
|
-
"a",
|
|
315
|
-
{
|
|
316
|
-
href: `https://github.com/${repo}`,
|
|
317
|
-
target: "_blank",
|
|
318
|
-
rel: "noopener noreferrer",
|
|
319
|
-
className: "navbar-github-stars",
|
|
320
|
-
children: [
|
|
321
|
-
/* @__PURE__ */ jsx7(GitHub, {}),
|
|
322
|
-
stars && /* @__PURE__ */ jsx7("span", { children: stars })
|
|
323
|
-
]
|
|
324
|
-
}
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// src/client/theme/ui/Navbar/Tabs.tsx
|
|
329
|
-
import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
|
|
330
|
-
import { useLocation as useLocation10 } from "react-router-dom";
|
|
331
|
-
|
|
332
|
-
// src/client/theme/ui/Link/Link.tsx
|
|
333
|
-
import React10 from "react";
|
|
334
|
-
import {
|
|
335
|
-
Link as RouterLink,
|
|
336
|
-
NavLink as RouterNavLink,
|
|
337
|
-
useLocation as useLocation9,
|
|
338
|
-
useNavigate as useNavigate3
|
|
339
|
-
} from "react-router-dom";
|
|
340
|
-
|
|
341
|
-
// src/client/app/preload.tsx
|
|
342
|
-
import { createContext, useContext, useCallback } from "react";
|
|
343
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
344
|
-
var PreloadContext = createContext({
|
|
345
|
-
preload: () => {
|
|
346
|
-
},
|
|
347
|
-
routes: []
|
|
348
|
-
});
|
|
349
|
-
function usePreload() {
|
|
350
|
-
return useContext(PreloadContext);
|
|
351
|
-
}
|
|
352
|
-
function PreloadProvider({
|
|
353
|
-
routes,
|
|
354
|
-
modules,
|
|
355
|
-
children
|
|
356
|
-
}) {
|
|
357
|
-
const preload = useCallback(
|
|
358
|
-
(path) => {
|
|
359
|
-
const cleanPath = path.split("#")[0].split("?")[0];
|
|
360
|
-
const route = routes.find(
|
|
361
|
-
(r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
|
|
362
|
-
);
|
|
363
|
-
if (route && route.filePath) {
|
|
364
|
-
const loaderKey = Object.keys(modules).find(
|
|
365
|
-
(k) => k.endsWith("/" + route.filePath)
|
|
366
|
-
);
|
|
367
|
-
if (loaderKey) {
|
|
368
|
-
modules[loaderKey]().catch((err) => {
|
|
369
|
-
console.error(`[boltdocs] Failed to preload route ${path}:`, err);
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
[routes, modules]
|
|
375
|
-
);
|
|
376
|
-
return /* @__PURE__ */ jsx8(PreloadContext.Provider, { value: { preload, routes }, children });
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// src/client/app/index.tsx
|
|
380
|
-
import React9, { useEffect as useEffect9, useState as useState10 } from "react";
|
|
381
|
-
import ReactDOM from "react-dom/client";
|
|
382
|
-
import {
|
|
383
|
-
BrowserRouter,
|
|
384
|
-
Routes,
|
|
385
|
-
Route,
|
|
386
|
-
Outlet,
|
|
387
|
-
useLocation as useLocation8
|
|
388
|
-
} from "react-router-dom";
|
|
389
|
-
|
|
390
|
-
// src/client/theme/ui/Layout/Layout.tsx
|
|
391
|
-
import React7 from "react";
|
|
392
|
-
import { useLocation as useLocation7 } from "react-router-dom";
|
|
393
|
-
import { ChevronLeft, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
394
|
-
|
|
395
|
-
// src/client/theme/ui/Sidebar/Sidebar.tsx
|
|
396
|
-
import { useState as useState5 } from "react";
|
|
397
|
-
import { useLocation as useLocation3 } from "react-router-dom";
|
|
398
|
-
|
|
399
|
-
// src/client/theme/ui/PoweredBy/PoweredBy.tsx
|
|
400
|
-
import { Zap } from "lucide-react";
|
|
401
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
402
|
-
function PoweredBy() {
|
|
403
|
-
return /* @__PURE__ */ jsx9("div", { className: "powered-by-container", children: /* @__PURE__ */ jsxs4(
|
|
404
|
-
"a",
|
|
405
|
-
{
|
|
406
|
-
href: "https://github.com/jesusalcaladev/boltdocs",
|
|
407
|
-
target: "_blank",
|
|
408
|
-
rel: "noopener noreferrer",
|
|
409
|
-
className: "powered-by-link",
|
|
410
|
-
children: [
|
|
411
|
-
/* @__PURE__ */ jsx9(Zap, { className: "powered-by-icon", size: 12, fill: "currentColor" }),
|
|
412
|
-
/* @__PURE__ */ jsx9("span", { children: "Powered by" }),
|
|
413
|
-
/* @__PURE__ */ jsx9("span", { className: "powered-by-brand", children: "LiteDocs" })
|
|
414
|
-
]
|
|
415
|
-
}
|
|
416
|
-
) });
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// src/client/theme/ui/Sidebar/Sidebar.tsx
|
|
420
|
-
import { ChevronRight } from "lucide-react";
|
|
421
|
-
import * as LucideIcons from "lucide-react";
|
|
422
|
-
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
423
|
-
function renderBadge(badgeRaw) {
|
|
424
|
-
if (!badgeRaw) return null;
|
|
425
|
-
let text = "";
|
|
426
|
-
let expires = "";
|
|
427
|
-
if (typeof badgeRaw === "string") {
|
|
428
|
-
text = badgeRaw;
|
|
429
|
-
} else {
|
|
430
|
-
text = badgeRaw.text;
|
|
431
|
-
expires = badgeRaw.expires || "";
|
|
432
|
-
}
|
|
433
|
-
if (expires) {
|
|
434
|
-
const expireDate = new Date(expires);
|
|
435
|
-
const now = /* @__PURE__ */ new Date();
|
|
436
|
-
expireDate.setHours(0, 0, 0, 0);
|
|
437
|
-
now.setHours(0, 0, 0, 0);
|
|
438
|
-
if (now > expireDate) {
|
|
439
|
-
return null;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (!text) return null;
|
|
443
|
-
let typeClass = "badge-default";
|
|
444
|
-
const lowerText = text.toLowerCase();
|
|
445
|
-
if (lowerText === "new") {
|
|
446
|
-
typeClass = "badge-new";
|
|
447
|
-
} else if (lowerText === "experimental") {
|
|
448
|
-
typeClass = "badge-experimental";
|
|
449
|
-
} else if (lowerText === "updated") {
|
|
450
|
-
typeClass = "badge-updated";
|
|
451
|
-
}
|
|
452
|
-
return /* @__PURE__ */ jsx10("span", { className: `sidebar-badge ${typeClass}`, children: text });
|
|
453
|
-
}
|
|
454
|
-
function renderIcon(iconName, size = 16) {
|
|
455
|
-
if (!iconName) return null;
|
|
456
|
-
const trimmed = iconName.trim();
|
|
457
|
-
if (trimmed.startsWith("<svg") || trimmed.includes("http")) {
|
|
458
|
-
if (trimmed.startsWith("<svg")) {
|
|
459
|
-
return /* @__PURE__ */ jsx10(
|
|
460
|
-
"span",
|
|
461
|
-
{
|
|
462
|
-
className: "sidebar-icon svg-icon",
|
|
463
|
-
dangerouslySetInnerHTML: { __html: trimmed }
|
|
464
|
-
}
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
return /* @__PURE__ */ jsx10(
|
|
468
|
-
"img",
|
|
469
|
-
{
|
|
470
|
-
src: trimmed,
|
|
471
|
-
className: "sidebar-icon",
|
|
472
|
-
style: { width: size, height: size },
|
|
473
|
-
alt: ""
|
|
474
|
-
}
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
const IconComponent = LucideIcons[iconName];
|
|
478
|
-
if (IconComponent) {
|
|
479
|
-
return /* @__PURE__ */ jsx10(IconComponent, { size, className: "sidebar-icon lucide-icon" });
|
|
480
|
-
}
|
|
481
|
-
return null;
|
|
482
|
-
}
|
|
483
|
-
function Sidebar({
|
|
484
|
-
routes,
|
|
485
|
-
config
|
|
486
|
-
}) {
|
|
487
|
-
const location = useLocation3();
|
|
488
|
-
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
489
|
-
const activeTabId = currentRoute?.tab?.toLowerCase();
|
|
490
|
-
const filteredRoutes = activeTabId ? routes.filter((r) => {
|
|
491
|
-
if (!r.tab) return true;
|
|
492
|
-
return r.tab.toLowerCase() === activeTabId;
|
|
493
|
-
}) : routes;
|
|
494
|
-
const ungrouped = [];
|
|
495
|
-
const groupMap = /* @__PURE__ */ new Map();
|
|
496
|
-
for (const route of filteredRoutes) {
|
|
497
|
-
if (!route.group) {
|
|
498
|
-
ungrouped.push(route);
|
|
499
|
-
} else {
|
|
500
|
-
if (!groupMap.has(route.group)) {
|
|
501
|
-
groupMap.set(route.group, {
|
|
502
|
-
slug: route.group,
|
|
503
|
-
title: route.groupTitle || route.group,
|
|
504
|
-
routes: [],
|
|
505
|
-
icon: route.groupIcon
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
groupMap.get(route.group).routes.push(route);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
const groups = Array.from(groupMap.values());
|
|
512
|
-
return /* @__PURE__ */ jsxs5("aside", { className: "boltdocs-sidebar", children: [
|
|
513
|
-
/* @__PURE__ */ jsxs5("nav", { "aria-label": "Main Navigation", children: [
|
|
514
|
-
/* @__PURE__ */ jsx10("ul", { className: "sidebar-list", children: ungrouped.map((route) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(
|
|
515
|
-
Link,
|
|
516
|
-
{
|
|
517
|
-
to: route.path === "" ? "/" : route.path,
|
|
518
|
-
className: `sidebar-link ${location.pathname === route.path ? "active" : ""}`,
|
|
519
|
-
"aria-current": location.pathname === route.path ? "page" : void 0,
|
|
520
|
-
children: /* @__PURE__ */ jsxs5("div", { className: "sidebar-link-content", children: [
|
|
521
|
-
/* @__PURE__ */ jsxs5("div", { className: "sidebar-link-title-container", children: [
|
|
522
|
-
renderIcon(route.icon),
|
|
523
|
-
/* @__PURE__ */ jsx10("span", { children: route.title })
|
|
524
|
-
] }),
|
|
525
|
-
renderBadge(route.badge)
|
|
526
|
-
] })
|
|
527
|
-
}
|
|
528
|
-
) }, route.path)) }),
|
|
529
|
-
groups.map((group) => /* @__PURE__ */ jsx10(
|
|
530
|
-
SidebarGroupSection,
|
|
531
|
-
{
|
|
532
|
-
group,
|
|
533
|
-
currentPath: location.pathname
|
|
534
|
-
},
|
|
535
|
-
group.slug
|
|
536
|
-
))
|
|
537
|
-
] }),
|
|
538
|
-
config.themeConfig?.poweredBy !== false && /* @__PURE__ */ jsx10(PoweredBy, {})
|
|
539
|
-
] });
|
|
540
|
-
}
|
|
541
|
-
function SidebarGroupSection({
|
|
542
|
-
group,
|
|
543
|
-
currentPath
|
|
544
|
-
}) {
|
|
545
|
-
const isActive = group.routes.some((r) => currentPath === r.path);
|
|
546
|
-
const [open, setOpen] = useState5(true);
|
|
547
|
-
return /* @__PURE__ */ jsxs5("div", { className: "sidebar-group", children: [
|
|
548
|
-
/* @__PURE__ */ jsxs5(
|
|
549
|
-
"button",
|
|
550
|
-
{
|
|
551
|
-
className: `sidebar-group-header ${isActive ? "active" : ""}`,
|
|
552
|
-
onClick: () => setOpen(!open),
|
|
553
|
-
"aria-expanded": open,
|
|
554
|
-
"aria-controls": `sidebar-group-${group.slug}`,
|
|
555
|
-
children: [
|
|
556
|
-
/* @__PURE__ */ jsx10("div", { className: "sidebar-group-header-content", children: /* @__PURE__ */ jsx10("span", { className: "sidebar-group-title", children: group.title }) }),
|
|
557
|
-
/* @__PURE__ */ jsx10("span", { className: `sidebar-group-chevron ${open ? "open" : ""}`, children: /* @__PURE__ */ jsx10(ChevronRight, { size: 16 }) })
|
|
558
|
-
]
|
|
559
|
-
}
|
|
560
|
-
),
|
|
561
|
-
open && /* @__PURE__ */ jsx10("ul", { className: "sidebar-group-list", id: `sidebar-group-${group.slug}`, children: group.routes.map((route) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(
|
|
562
|
-
Link,
|
|
563
|
-
{
|
|
564
|
-
to: route.path === "" ? "/" : route.path,
|
|
565
|
-
className: `sidebar-link sidebar-link-nested ${currentPath === route.path ? "active" : ""}`,
|
|
566
|
-
"aria-current": currentPath === route.path ? "page" : void 0,
|
|
567
|
-
children: /* @__PURE__ */ jsxs5("div", { className: "sidebar-link-content", children: [
|
|
568
|
-
/* @__PURE__ */ jsxs5("div", { className: "sidebar-link-title-container", children: [
|
|
569
|
-
renderIcon(route.icon),
|
|
570
|
-
/* @__PURE__ */ jsx10("span", { children: route.title })
|
|
571
|
-
] }),
|
|
572
|
-
renderBadge(route.badge)
|
|
573
|
-
] })
|
|
574
|
-
}
|
|
575
|
-
) }, route.path)) })
|
|
576
|
-
] });
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// src/client/theme/ui/OnThisPage/OnThisPage.tsx
|
|
580
|
-
import { useEffect as useEffect5, useState as useState6, useRef as useRef3, useCallback as useCallback2 } from "react";
|
|
581
|
-
import { useLocation as useLocation4 } from "react-router-dom";
|
|
582
|
-
import { Pencil, CircleHelp } from "lucide-react";
|
|
583
|
-
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
584
|
-
function OnThisPage({
|
|
585
|
-
headings = [],
|
|
586
|
-
editLink,
|
|
587
|
-
communityHelp,
|
|
588
|
-
filePath
|
|
589
|
-
}) {
|
|
590
|
-
const [activeId, setActiveId] = useState6(null);
|
|
591
|
-
const [indicatorStyle, setIndicatorStyle] = useState6({});
|
|
592
|
-
const observerRef = useRef3(null);
|
|
593
|
-
const location = useLocation4();
|
|
594
|
-
const listRef = useRef3(null);
|
|
595
|
-
const visibleIdsRef = useRef3(/* @__PURE__ */ new Set());
|
|
596
|
-
useEffect5(() => {
|
|
597
|
-
if (headings.length > 0) {
|
|
598
|
-
const hash = window.location.hash.substring(1);
|
|
599
|
-
if (hash && headings.some((h) => h.id === hash)) {
|
|
600
|
-
setActiveId(hash);
|
|
601
|
-
} else {
|
|
602
|
-
setActiveId(headings[0].id);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}, [location.pathname, headings]);
|
|
606
|
-
useEffect5(() => {
|
|
607
|
-
if (!activeId || !listRef.current) return;
|
|
608
|
-
const activeLink = listRef.current.querySelector(
|
|
609
|
-
`a[href="#${activeId}"]`
|
|
610
|
-
);
|
|
611
|
-
if (activeLink) {
|
|
612
|
-
const top = activeLink.offsetTop;
|
|
613
|
-
const height = activeLink.offsetHeight;
|
|
614
|
-
setIndicatorStyle({
|
|
615
|
-
transform: `translateY(${top}px)`,
|
|
616
|
-
height: `${height}px`,
|
|
617
|
-
opacity: 1
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
}, [activeId, headings]);
|
|
621
|
-
useEffect5(() => {
|
|
622
|
-
if (headings.length === 0) return;
|
|
623
|
-
visibleIdsRef.current.clear();
|
|
624
|
-
if (observerRef.current) {
|
|
625
|
-
observerRef.current.disconnect();
|
|
626
|
-
}
|
|
627
|
-
const callback = (entries) => {
|
|
628
|
-
entries.forEach((entry) => {
|
|
629
|
-
if (entry.isIntersecting) {
|
|
630
|
-
visibleIdsRef.current.add(entry.target.id);
|
|
631
|
-
} else {
|
|
632
|
-
visibleIdsRef.current.delete(entry.target.id);
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
const firstVisible = headings.find((h) => visibleIdsRef.current.has(h.id));
|
|
636
|
-
if (firstVisible) {
|
|
637
|
-
setActiveId(firstVisible.id);
|
|
638
|
-
} else {
|
|
639
|
-
const firstEl = document.getElementById(headings[0].id);
|
|
640
|
-
if (firstEl) {
|
|
641
|
-
const rect = firstEl.getBoundingClientRect();
|
|
642
|
-
if (rect.top > 200) {
|
|
643
|
-
setActiveId(headings[0].id);
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
const observerOptions = {
|
|
650
|
-
root: document.querySelector(".boltdocs-content"),
|
|
651
|
-
rootMargin: "-20% 0px -70% 0px",
|
|
652
|
-
threshold: [0, 1]
|
|
653
|
-
};
|
|
654
|
-
observerRef.current = new IntersectionObserver(callback, observerOptions);
|
|
655
|
-
const observeHeadings = () => {
|
|
656
|
-
headings.forEach(({ id }) => {
|
|
657
|
-
const el = document.getElementById(id);
|
|
658
|
-
if (el) {
|
|
659
|
-
observerRef.current.observe(el);
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
};
|
|
663
|
-
observeHeadings();
|
|
664
|
-
const timeoutId = setTimeout(observeHeadings, 1e3);
|
|
665
|
-
const handleScroll = () => {
|
|
666
|
-
const scrollPosition = window.innerHeight + window.pageYOffset;
|
|
667
|
-
const bodyHeight = document.documentElement.scrollHeight;
|
|
668
|
-
if (scrollPosition >= bodyHeight - 50) {
|
|
669
|
-
setActiveId(headings[headings.length - 1].id);
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
673
|
-
return () => {
|
|
674
|
-
observerRef.current?.disconnect();
|
|
675
|
-
clearTimeout(timeoutId);
|
|
676
|
-
window.removeEventListener("scroll", handleScroll);
|
|
677
|
-
};
|
|
678
|
-
}, [headings, location.pathname]);
|
|
679
|
-
useEffect5(() => {
|
|
680
|
-
if (!activeId || !listRef.current) return;
|
|
681
|
-
const activeLink = listRef.current.querySelector(
|
|
682
|
-
`a[href="#${activeId}"]`
|
|
683
|
-
);
|
|
684
|
-
if (activeLink) {
|
|
685
|
-
const container = listRef.current.parentElement;
|
|
686
|
-
if (!container) return;
|
|
687
|
-
const linkRect = activeLink.getBoundingClientRect();
|
|
688
|
-
const containerRect = container.getBoundingClientRect();
|
|
689
|
-
const isVisible = linkRect.top >= containerRect.top && linkRect.bottom <= containerRect.bottom;
|
|
690
|
-
if (!isVisible) {
|
|
691
|
-
activeLink.scrollIntoView({
|
|
692
|
-
behavior: "auto",
|
|
693
|
-
block: "nearest"
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}, [activeId]);
|
|
698
|
-
const handleClick = useCallback2(
|
|
699
|
-
(e, id) => {
|
|
700
|
-
e.preventDefault();
|
|
701
|
-
const el = document.getElementById(id);
|
|
702
|
-
if (el) {
|
|
703
|
-
el.scrollIntoView({
|
|
704
|
-
behavior: "smooth"
|
|
705
|
-
});
|
|
706
|
-
setActiveId(id);
|
|
707
|
-
window.history.pushState(null, "", `#${id}`);
|
|
708
|
-
}
|
|
709
|
-
},
|
|
710
|
-
[]
|
|
711
|
-
);
|
|
712
|
-
if (headings.length === 0) return null;
|
|
713
|
-
return /* @__PURE__ */ jsxs6("nav", { className: "boltdocs-on-this-page", "aria-label": "Table of contents", children: [
|
|
714
|
-
/* @__PURE__ */ jsx11("p", { className: "on-this-page-title", children: "On this page" }),
|
|
715
|
-
/* @__PURE__ */ jsx11("div", { className: "on-this-page-container", children: /* @__PURE__ */ jsxs6("div", { className: "on-this-page-list-container", children: [
|
|
716
|
-
/* @__PURE__ */ jsx11("div", { className: "toc-indicator", style: indicatorStyle }),
|
|
717
|
-
/* @__PURE__ */ jsx11("ul", { className: "on-this-page-list", ref: listRef, children: headings.map((h) => /* @__PURE__ */ jsx11("li", { className: h.level === 3 ? "toc-indent" : "", children: /* @__PURE__ */ jsx11(
|
|
718
|
-
"a",
|
|
719
|
-
{
|
|
720
|
-
href: `#${h.id}`,
|
|
721
|
-
className: `toc-link ${activeId === h.id ? "active" : ""}`,
|
|
722
|
-
"aria-current": activeId === h.id ? "true" : void 0,
|
|
723
|
-
onClick: (e) => handleClick(e, h.id),
|
|
724
|
-
children: h.text
|
|
725
|
-
}
|
|
726
|
-
) }, h.id)) })
|
|
727
|
-
] }) }),
|
|
728
|
-
(editLink || communityHelp) && /* @__PURE__ */ jsxs6("div", { className: "toc-help", children: [
|
|
729
|
-
/* @__PURE__ */ jsx11("p", { className: "toc-help-title", children: "Need help?" }),
|
|
730
|
-
/* @__PURE__ */ jsxs6("ul", { className: "toc-help-links", children: [
|
|
731
|
-
editLink && filePath && /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsxs6(
|
|
732
|
-
"a",
|
|
733
|
-
{
|
|
734
|
-
href: editLink.replace(":path", filePath),
|
|
735
|
-
target: "_blank",
|
|
736
|
-
rel: "noopener noreferrer",
|
|
737
|
-
className: "toc-help-link",
|
|
738
|
-
children: [
|
|
739
|
-
/* @__PURE__ */ jsx11(Pencil, { size: 16 }),
|
|
740
|
-
"Edit this page"
|
|
741
|
-
]
|
|
742
|
-
}
|
|
743
|
-
) }),
|
|
744
|
-
communityHelp && /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsxs6(
|
|
745
|
-
"a",
|
|
746
|
-
{
|
|
747
|
-
href: communityHelp,
|
|
748
|
-
target: "_blank",
|
|
749
|
-
rel: "noopener noreferrer",
|
|
750
|
-
className: "toc-help-link",
|
|
751
|
-
children: [
|
|
752
|
-
/* @__PURE__ */ jsx11(CircleHelp, { size: 16 }),
|
|
753
|
-
"Community help"
|
|
754
|
-
]
|
|
755
|
-
}
|
|
756
|
-
) })
|
|
757
|
-
] })
|
|
758
|
-
] })
|
|
759
|
-
] });
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
// src/client/theme/ui/Head/Head.tsx
|
|
763
|
-
import { useEffect as useEffect6 } from "react";
|
|
764
|
-
import { useLocation as useLocation5 } from "react-router-dom";
|
|
765
|
-
function Head({ siteTitle, siteDescription, routes }) {
|
|
766
|
-
const location = useLocation5();
|
|
767
|
-
useEffect6(() => {
|
|
768
|
-
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
769
|
-
const pageTitle = currentRoute?.title;
|
|
770
|
-
const pageDescription = currentRoute?.description || siteDescription || "";
|
|
771
|
-
document.title = pageTitle ? `${pageTitle} | ${siteTitle}` : siteTitle;
|
|
772
|
-
let metaDesc = document.querySelector(
|
|
773
|
-
'meta[name="description"]'
|
|
774
|
-
);
|
|
775
|
-
if (!metaDesc) {
|
|
776
|
-
metaDesc = document.createElement("meta");
|
|
777
|
-
metaDesc.name = "description";
|
|
778
|
-
document.head.appendChild(metaDesc);
|
|
779
|
-
}
|
|
780
|
-
metaDesc.content = pageDescription;
|
|
781
|
-
setMetaTag("property", "og:title", document.title);
|
|
782
|
-
setMetaTag("property", "og:description", pageDescription);
|
|
783
|
-
setMetaTag("property", "og:type", "article");
|
|
784
|
-
setMetaTag("property", "og:url", window.location.href);
|
|
785
|
-
setMetaTag("name", "twitter:card", "summary");
|
|
786
|
-
setMetaTag("name", "twitter:title", document.title);
|
|
787
|
-
setMetaTag("name", "twitter:description", pageDescription);
|
|
788
|
-
let canonical = document.querySelector(
|
|
789
|
-
'link[rel="canonical"]'
|
|
790
|
-
);
|
|
791
|
-
if (!canonical) {
|
|
792
|
-
canonical = document.createElement("link");
|
|
793
|
-
canonical.rel = "canonical";
|
|
794
|
-
document.head.appendChild(canonical);
|
|
795
|
-
}
|
|
796
|
-
canonical.href = window.location.origin + location.pathname;
|
|
797
|
-
}, [location.pathname, siteTitle, siteDescription, routes]);
|
|
798
|
-
return null;
|
|
799
|
-
}
|
|
800
|
-
function setMetaTag(attr, key, content) {
|
|
801
|
-
let tag = document.querySelector(
|
|
802
|
-
`meta[${attr}="${key}"]`
|
|
803
|
-
);
|
|
804
|
-
if (!tag) {
|
|
805
|
-
tag = document.createElement("meta");
|
|
806
|
-
tag.setAttribute(attr, key);
|
|
807
|
-
document.head.appendChild(tag);
|
|
808
|
-
}
|
|
809
|
-
tag.content = content;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
// src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx
|
|
813
|
-
import { useLocation as useLocation6 } from "react-router-dom";
|
|
814
|
-
import { Home, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
815
|
-
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
816
|
-
function Breadcrumbs({ routes, config }) {
|
|
817
|
-
const location = useLocation6();
|
|
818
|
-
if (config.themeConfig?.breadcrumbs === false) return null;
|
|
819
|
-
if (location.pathname === "/") return null;
|
|
820
|
-
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
821
|
-
const groupRoute = currentRoute?.group ? routes.find((r) => r.group === currentRoute.group) : null;
|
|
822
|
-
return /* @__PURE__ */ jsx12("nav", { className: "boltdocs-breadcrumbs", "aria-label": "Breadcrumb", children: /* @__PURE__ */ jsxs7("ol", { className: "boltdocs-breadcrumbs-list", children: [
|
|
823
|
-
/* @__PURE__ */ jsxs7("li", { className: "boltdocs-breadcrumbs-item", children: [
|
|
824
|
-
/* @__PURE__ */ jsx12(Link, { to: "/", className: "boltdocs-breadcrumbs-link", children: /* @__PURE__ */ jsx12(Home, { size: 14 }) }),
|
|
825
|
-
/* @__PURE__ */ jsx12("span", { className: "boltdocs-breadcrumbs-separator", children: /* @__PURE__ */ jsx12(ChevronRight2, { size: 14 }) })
|
|
826
|
-
] }),
|
|
827
|
-
currentRoute?.groupTitle && /* @__PURE__ */ jsxs7("li", { className: "boltdocs-breadcrumbs-item", children: [
|
|
828
|
-
groupRoute ? /* @__PURE__ */ jsx12(Link, { to: groupRoute.path, className: "boltdocs-breadcrumbs-link", children: currentRoute.groupTitle }) : /* @__PURE__ */ jsx12("span", { className: "boltdocs-breadcrumbs-text", children: currentRoute.groupTitle }),
|
|
829
|
-
/* @__PURE__ */ jsx12("span", { className: "boltdocs-breadcrumbs-separator", children: /* @__PURE__ */ jsx12(ChevronRight2, { size: 14 }) })
|
|
830
|
-
] }),
|
|
831
|
-
currentRoute?.title && /* @__PURE__ */ jsx12("li", { className: "boltdocs-breadcrumbs-item", children: /* @__PURE__ */ jsx12(
|
|
832
|
-
"span",
|
|
833
|
-
{
|
|
834
|
-
className: "boltdocs-breadcrumbs-text boltdocs-breadcrumbs-active",
|
|
835
|
-
"aria-current": "page",
|
|
836
|
-
children: currentRoute.title
|
|
837
|
-
}
|
|
838
|
-
) })
|
|
839
|
-
] }) });
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
// src/client/theme/ui/ProgressBar/ProgressBar.tsx
|
|
843
|
-
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
844
|
-
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
845
|
-
function ProgressBar() {
|
|
846
|
-
const [progress, setProgress] = useState7(0);
|
|
847
|
-
useEffect7(() => {
|
|
848
|
-
let container = null;
|
|
849
|
-
let timer;
|
|
850
|
-
const handleScroll = () => {
|
|
851
|
-
if (!container) return;
|
|
852
|
-
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
853
|
-
if (scrollHeight <= clientHeight) {
|
|
854
|
-
setProgress(0);
|
|
855
|
-
return;
|
|
856
|
-
}
|
|
857
|
-
const scrollPercent = scrollTop / (scrollHeight - clientHeight) * 100;
|
|
858
|
-
setProgress(Math.min(100, Math.max(0, scrollPercent)));
|
|
859
|
-
};
|
|
860
|
-
const attachListener = () => {
|
|
861
|
-
container = document.querySelector(".boltdocs-content");
|
|
862
|
-
if (container) {
|
|
863
|
-
container.addEventListener("scroll", handleScroll);
|
|
864
|
-
handleScroll();
|
|
865
|
-
if (timer) clearInterval(timer);
|
|
866
|
-
return true;
|
|
867
|
-
}
|
|
868
|
-
return false;
|
|
869
|
-
};
|
|
870
|
-
if (!attachListener()) {
|
|
871
|
-
timer = setInterval(attachListener, 100);
|
|
872
|
-
}
|
|
873
|
-
return () => {
|
|
874
|
-
if (container) container.removeEventListener("scroll", handleScroll);
|
|
875
|
-
if (timer) clearInterval(timer);
|
|
876
|
-
};
|
|
877
|
-
}, []);
|
|
878
|
-
return /* @__PURE__ */ jsx13("div", { className: "boltdocs-progress-container", children: /* @__PURE__ */ jsx13(
|
|
879
|
-
"div",
|
|
880
|
-
{
|
|
881
|
-
className: "boltdocs-progress-bar",
|
|
882
|
-
style: { width: `${progress}%` }
|
|
883
|
-
}
|
|
884
|
-
) });
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
// src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx
|
|
888
|
-
import { Component } from "react";
|
|
889
|
-
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
890
|
-
var ErrorBoundary = class extends Component {
|
|
891
|
-
state = {
|
|
892
|
-
hasError: false
|
|
893
|
-
};
|
|
894
|
-
static getDerivedStateFromError(error) {
|
|
895
|
-
return { hasError: true, error };
|
|
896
|
-
}
|
|
897
|
-
componentDidCatch(error, errorInfo) {
|
|
898
|
-
console.error("Uncaught error in Boltdocs Layout:", error, errorInfo);
|
|
899
|
-
}
|
|
900
|
-
render() {
|
|
901
|
-
if (this.state.hasError) {
|
|
902
|
-
return this.props.fallback || /* @__PURE__ */ jsxs8("div", { className: "boltdocs-error-boundary", children: [
|
|
903
|
-
/* @__PURE__ */ jsx14("div", { className: "boltdocs-error-title", children: "Something went wrong" }),
|
|
904
|
-
/* @__PURE__ */ jsx14("p", { className: "boltdocs-error-message", children: this.state.error?.message || "An unexpected error occurred while rendering this page." }),
|
|
905
|
-
/* @__PURE__ */ jsx14(
|
|
906
|
-
"button",
|
|
907
|
-
{
|
|
908
|
-
className: "boltdocs-error-retry",
|
|
909
|
-
onClick: () => this.setState({ hasError: false }),
|
|
910
|
-
children: "Try again"
|
|
911
|
-
}
|
|
912
|
-
)
|
|
913
|
-
] });
|
|
914
|
-
}
|
|
915
|
-
return this.props.children;
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
// src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx
|
|
920
|
-
import { useState as useState8, useRef as useRef4, useEffect as useEffect8 } from "react";
|
|
921
|
-
import { Copy, ChevronDown as ChevronDown3, Check, ExternalLink } from "lucide-react";
|
|
922
|
-
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
923
|
-
function CopyMarkdown({ content, config }) {
|
|
924
|
-
const [isOpen, setIsOpen] = useState8(false);
|
|
925
|
-
const [copied, setCopied] = useState8(false);
|
|
926
|
-
const dropdownRef = useRef4(null);
|
|
927
|
-
const isEnabled = config !== false;
|
|
928
|
-
const buttonText = typeof config === "object" ? config.text || "Copy Markdown" : "Copy Markdown";
|
|
929
|
-
useEffect8(() => {
|
|
930
|
-
function handleClickOutside(event) {
|
|
931
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
932
|
-
setIsOpen(false);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
936
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
937
|
-
}, []);
|
|
938
|
-
if (!isEnabled || !content) return null;
|
|
939
|
-
const handleCopy = () => {
|
|
940
|
-
navigator.clipboard.writeText(content);
|
|
941
|
-
setCopied(true);
|
|
942
|
-
setIsOpen(false);
|
|
943
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
944
|
-
};
|
|
945
|
-
const handleOpenRaw = () => {
|
|
946
|
-
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
|
|
947
|
-
const url = URL.createObjectURL(blob);
|
|
948
|
-
window.open(url, "_blank");
|
|
949
|
-
setIsOpen(false);
|
|
950
|
-
};
|
|
951
|
-
return /* @__PURE__ */ jsxs9("div", { className: "boltdocs-copy-markdown", ref: dropdownRef, children: [
|
|
952
|
-
/* @__PURE__ */ jsxs9("div", { className: "copy-btn-group", children: [
|
|
953
|
-
/* @__PURE__ */ jsxs9(
|
|
954
|
-
"button",
|
|
955
|
-
{
|
|
956
|
-
className: "copy-btn",
|
|
957
|
-
onClick: handleCopy,
|
|
958
|
-
"aria-label": "Copy Markdown",
|
|
959
|
-
children: [
|
|
960
|
-
copied ? /* @__PURE__ */ jsx15(Check, { size: 16 }) : /* @__PURE__ */ jsx15(Copy, { size: 16 }),
|
|
961
|
-
/* @__PURE__ */ jsx15("span", { className: "copy-label", children: copied ? "Copied!" : buttonText })
|
|
962
|
-
]
|
|
963
|
-
}
|
|
964
|
-
),
|
|
965
|
-
/* @__PURE__ */ jsx15(
|
|
966
|
-
"button",
|
|
967
|
-
{
|
|
968
|
-
className: `copy-dropdown-toggle ${isOpen ? "is-active" : ""}`,
|
|
969
|
-
onClick: () => setIsOpen(!isOpen),
|
|
970
|
-
"aria-label": "More options",
|
|
971
|
-
"aria-expanded": isOpen,
|
|
972
|
-
children: /* @__PURE__ */ jsx15(ChevronDown3, { size: 14, className: "arrow-icon" })
|
|
973
|
-
}
|
|
974
|
-
)
|
|
975
|
-
] }),
|
|
976
|
-
isOpen && /* @__PURE__ */ jsxs9("div", { className: "copy-dropdown", children: [
|
|
977
|
-
/* @__PURE__ */ jsxs9("button", { className: "copy-option", onClick: handleCopy, children: [
|
|
978
|
-
/* @__PURE__ */ jsx15(Copy, { size: 14 }),
|
|
979
|
-
"Copy Markdown"
|
|
980
|
-
] }),
|
|
981
|
-
/* @__PURE__ */ jsxs9("button", { className: "copy-option", onClick: handleOpenRaw, children: [
|
|
982
|
-
/* @__PURE__ */ jsx15(ExternalLink, { size: 14 }),
|
|
983
|
-
"View as Markdown"
|
|
984
|
-
] })
|
|
985
|
-
] })
|
|
986
|
-
] });
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
// src/client/theme/ui/Layout/Layout.tsx
|
|
990
|
-
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
991
|
-
function ThemeLayout({
|
|
992
|
-
config,
|
|
993
|
-
routes,
|
|
994
|
-
children,
|
|
995
|
-
navbar,
|
|
996
|
-
sidebar,
|
|
997
|
-
toc,
|
|
998
|
-
background,
|
|
999
|
-
head,
|
|
1000
|
-
breadcrumbs,
|
|
1001
|
-
className = "",
|
|
1002
|
-
style
|
|
1003
|
-
}) {
|
|
1004
|
-
const siteTitle = config.themeConfig?.title || "Boltdocs";
|
|
1005
|
-
const siteDescription = config.themeConfig?.description || "";
|
|
1006
|
-
const location = useLocation7();
|
|
1007
|
-
const currentIndex = routes.findIndex((r) => r.path === location.pathname);
|
|
1008
|
-
const currentRoute = routes[currentIndex];
|
|
1009
|
-
const currentLocale = config.i18n ? currentRoute?.locale || config.i18n.defaultLocale : void 0;
|
|
1010
|
-
const currentVersion = config.versions ? currentRoute?.version || config.versions.defaultVersion : void 0;
|
|
1011
|
-
const filteredRoutes = routes.filter((r) => {
|
|
1012
|
-
const localeMatch = config.i18n ? (r.locale || config.i18n.defaultLocale) === currentLocale : true;
|
|
1013
|
-
const versionMatch = config.versions ? (r.version || config.versions.defaultVersion) === currentVersion : true;
|
|
1014
|
-
return localeMatch && versionMatch;
|
|
1015
|
-
});
|
|
1016
|
-
const localIndex = filteredRoutes.findIndex(
|
|
1017
|
-
(r) => r.path === location.pathname
|
|
1018
|
-
);
|
|
1019
|
-
const prevPage = localIndex > 0 ? filteredRoutes[localIndex - 1] : null;
|
|
1020
|
-
const nextPage = localIndex >= 0 && localIndex < filteredRoutes.length - 1 ? filteredRoutes[localIndex + 1] : null;
|
|
1021
|
-
const { preload } = usePreload();
|
|
1022
|
-
React7.useEffect(() => {
|
|
1023
|
-
if (prevPage?.path) preload(prevPage.path);
|
|
1024
|
-
if (nextPage?.path) preload(nextPage.path);
|
|
1025
|
-
}, [prevPage, nextPage, preload]);
|
|
1026
|
-
return /* @__PURE__ */ jsxs10("div", { className: `boltdocs-layout ${className}`, style, children: [
|
|
1027
|
-
/* @__PURE__ */ jsx16(ProgressBar, {}),
|
|
1028
|
-
head !== void 0 ? head : /* @__PURE__ */ jsx16(
|
|
1029
|
-
Head,
|
|
1030
|
-
{
|
|
1031
|
-
siteTitle,
|
|
1032
|
-
siteDescription,
|
|
1033
|
-
routes
|
|
1034
|
-
}
|
|
1035
|
-
),
|
|
1036
|
-
navbar !== void 0 ? navbar : /* @__PURE__ */ jsx16(
|
|
1037
|
-
Navbar,
|
|
1038
|
-
{
|
|
1039
|
-
config,
|
|
1040
|
-
routes: filteredRoutes,
|
|
1041
|
-
allRoutes: routes,
|
|
1042
|
-
currentLocale,
|
|
1043
|
-
currentVersion
|
|
1044
|
-
}
|
|
1045
|
-
),
|
|
1046
|
-
/* @__PURE__ */ jsxs10("div", { className: "boltdocs-main-container", children: [
|
|
1047
|
-
sidebar !== void 0 ? sidebar : /* @__PURE__ */ jsx16(Sidebar, { routes: filteredRoutes, config }),
|
|
1048
|
-
/* @__PURE__ */ jsxs10("main", { className: "boltdocs-content", children: [
|
|
1049
|
-
breadcrumbs !== void 0 ? breadcrumbs : /* @__PURE__ */ jsx16(Breadcrumbs, { routes: filteredRoutes, config }),
|
|
1050
|
-
/* @__PURE__ */ jsxs10("div", { className: "boltdocs-page", children: [
|
|
1051
|
-
/* @__PURE__ */ jsx16("div", { className: "boltdocs-page-header", children: /* @__PURE__ */ jsx16(
|
|
1052
|
-
CopyMarkdown,
|
|
1053
|
-
{
|
|
1054
|
-
content: routes[currentIndex]?._rawContent,
|
|
1055
|
-
config: config.themeConfig?.copyMarkdown
|
|
1056
|
-
}
|
|
1057
|
-
) }),
|
|
1058
|
-
/* @__PURE__ */ jsx16(ErrorBoundary, { children })
|
|
1059
|
-
] }),
|
|
1060
|
-
(prevPage || nextPage) && /* @__PURE__ */ jsxs10("nav", { className: "page-nav", "aria-label": "Pagination", children: [
|
|
1061
|
-
prevPage ? /* @__PURE__ */ jsxs10(
|
|
1062
|
-
Link,
|
|
1063
|
-
{
|
|
1064
|
-
to: prevPage.path || "/",
|
|
1065
|
-
className: "page-nav-link page-nav-link--prev",
|
|
1066
|
-
children: [
|
|
1067
|
-
/* @__PURE__ */ jsxs10("div", { className: "page-nav-info", children: [
|
|
1068
|
-
/* @__PURE__ */ jsx16("span", { className: "page-nav-label", children: "Previous" }),
|
|
1069
|
-
/* @__PURE__ */ jsx16("span", { className: "page-nav-title", children: prevPage.title })
|
|
1070
|
-
] }),
|
|
1071
|
-
/* @__PURE__ */ jsx16(ChevronLeft, { className: "page-nav-arrow", size: 16 })
|
|
1072
|
-
]
|
|
1073
|
-
}
|
|
1074
|
-
) : /* @__PURE__ */ jsx16("span", {}),
|
|
1075
|
-
nextPage ? /* @__PURE__ */ jsxs10(
|
|
1076
|
-
Link,
|
|
1077
|
-
{
|
|
1078
|
-
to: nextPage.path || "/",
|
|
1079
|
-
className: "page-nav-link page-nav-link--next",
|
|
1080
|
-
children: [
|
|
1081
|
-
/* @__PURE__ */ jsxs10("div", { className: "page-nav-info", children: [
|
|
1082
|
-
/* @__PURE__ */ jsx16("span", { className: "page-nav-label", children: "Next" }),
|
|
1083
|
-
/* @__PURE__ */ jsx16("span", { className: "page-nav-title", children: nextPage.title })
|
|
1084
|
-
] }),
|
|
1085
|
-
/* @__PURE__ */ jsx16(ChevronRight3, { className: "page-nav-arrow", size: 16 })
|
|
1086
|
-
]
|
|
1087
|
-
}
|
|
1088
|
-
) : /* @__PURE__ */ jsx16("span", {})
|
|
1089
|
-
] })
|
|
1090
|
-
] }),
|
|
1091
|
-
toc !== void 0 ? toc : /* @__PURE__ */ jsx16(
|
|
1092
|
-
OnThisPage,
|
|
1093
|
-
{
|
|
1094
|
-
headings: routes[currentIndex]?.headings,
|
|
1095
|
-
editLink: config.themeConfig?.editLink,
|
|
1096
|
-
communityHelp: config.themeConfig?.communityHelp,
|
|
1097
|
-
filePath: routes[currentIndex]?.filePath
|
|
1098
|
-
}
|
|
1099
|
-
)
|
|
1100
|
-
] })
|
|
1101
|
-
] });
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
// src/client/theme/ui/NotFound/NotFound.tsx
|
|
1105
|
-
import { ArrowLeft } from "lucide-react";
|
|
1106
|
-
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1107
|
-
function NotFound() {
|
|
1108
|
-
return /* @__PURE__ */ jsx17("div", { className: "boltdocs-not-found", children: /* @__PURE__ */ jsxs11("div", { className: "not-found-content", children: [
|
|
1109
|
-
/* @__PURE__ */ jsx17("span", { className: "not-found-code", children: "404" }),
|
|
1110
|
-
/* @__PURE__ */ jsx17("h1", { className: "not-found-title", children: "Page Not Found" }),
|
|
1111
|
-
/* @__PURE__ */ jsx17("p", { className: "not-found-text", children: "The page you're looking for doesn't exist or has been moved." }),
|
|
1112
|
-
/* @__PURE__ */ jsxs11(Link, { to: "/", className: "not-found-link", children: [
|
|
1113
|
-
/* @__PURE__ */ jsx17(ArrowLeft, { size: 16 }),
|
|
1114
|
-
" Go to Home"
|
|
1115
|
-
] })
|
|
1116
|
-
] }) });
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
// src/client/theme/ui/Loading/Loading.tsx
|
|
1120
|
-
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1121
|
-
function Loading() {
|
|
1122
|
-
return /* @__PURE__ */ jsxs12("div", { className: "boltdocs-loading", children: [
|
|
1123
|
-
/* @__PURE__ */ jsx18("div", { className: "loading-spinner" }),
|
|
1124
|
-
/* @__PURE__ */ jsx18("p", { className: "loading-text", children: "Loading..." })
|
|
1125
|
-
] });
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
// src/client/app/index.tsx
|
|
1129
|
-
import { MDXProvider } from "@mdx-js/react";
|
|
1130
|
-
import {
|
|
1131
|
-
createContext as createContext2,
|
|
1132
|
-
useContext as useContext2,
|
|
1133
|
-
Suspense,
|
|
1134
|
-
lazy,
|
|
1135
|
-
useLayoutEffect
|
|
1136
|
-
} from "react";
|
|
1137
|
-
import { Link as LucideLink } from "lucide-react";
|
|
1138
|
-
|
|
1139
|
-
// src/client/theme/components/CodeBlock/CodeBlock.tsx
|
|
1140
|
-
import React8, { useState as useState9, useRef as useRef5, useCallback as useCallback3 } from "react";
|
|
1141
|
-
import { Copy as Copy2, Check as Check2 } from "lucide-react";
|
|
1142
|
-
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1143
|
-
function CodeBlock({ children, ...props }) {
|
|
1144
|
-
const [copied, setCopied] = useState9(false);
|
|
1145
|
-
const [isExpanded, setIsExpanded] = useState9(false);
|
|
1146
|
-
const [isExpandable, setIsExpandable] = useState9(false);
|
|
1147
|
-
const preRef = useRef5(null);
|
|
1148
|
-
const handleCopy = useCallback3(async () => {
|
|
1149
|
-
const code = preRef.current?.textContent || "";
|
|
1150
|
-
copyToClipboard(code);
|
|
1151
|
-
setCopied(true);
|
|
1152
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
1153
|
-
}, []);
|
|
1154
|
-
React8.useEffect(() => {
|
|
1155
|
-
if (preRef.current) {
|
|
1156
|
-
const codeLength = preRef.current.textContent?.length || 0;
|
|
1157
|
-
setIsExpandable(codeLength > 500);
|
|
1158
|
-
}
|
|
1159
|
-
}, [children]);
|
|
1160
|
-
const shouldTruncate = isExpandable && !isExpanded;
|
|
1161
|
-
return /* @__PURE__ */ jsxs13("div", { className: `code-block-wrapper ${shouldTruncate ? "is-truncated" : ""}`, children: [
|
|
1162
|
-
/* @__PURE__ */ jsx19(
|
|
1163
|
-
"button",
|
|
1164
|
-
{
|
|
1165
|
-
className: `code-block-copy ${copied ? "copied" : ""}`,
|
|
1166
|
-
onClick: handleCopy,
|
|
1167
|
-
"aria-label": "Copy code",
|
|
1168
|
-
children: copied ? /* @__PURE__ */ jsx19(Check2, { size: 16 }) : /* @__PURE__ */ jsx19(Copy2, { size: 16 })
|
|
1169
|
-
}
|
|
1170
|
-
),
|
|
1171
|
-
/* @__PURE__ */ jsx19("pre", { ref: preRef, ...props, children }),
|
|
1172
|
-
isExpandable && /* @__PURE__ */ jsx19("div", { className: "code-block-expand-wrapper", children: /* @__PURE__ */ jsx19(
|
|
1173
|
-
"button",
|
|
1174
|
-
{
|
|
1175
|
-
className: "code-block-expand-btn",
|
|
1176
|
-
onClick: () => setIsExpanded(!isExpanded),
|
|
1177
|
-
children: isExpanded ? "Show less" : "Expand code"
|
|
1178
|
-
}
|
|
1179
|
-
) })
|
|
1180
|
-
] });
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
// src/client/app/index.tsx
|
|
1184
|
-
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1185
|
-
var ConfigContext = createContext2(null);
|
|
1186
|
-
function useConfig() {
|
|
1187
|
-
return useContext2(ConfigContext);
|
|
1188
|
-
}
|
|
1189
|
-
var Video = lazy(
|
|
1190
|
-
() => import("./Video-KNTY5BNO.mjs").then((m) => ({ default: m.Video }))
|
|
1191
|
-
);
|
|
1192
|
-
var PackageManagerTabs = lazy(
|
|
1193
|
-
() => import("./PackageManagerTabs-NVT7G625.mjs").then((m) => ({
|
|
1194
|
-
default: m.PackageManagerTabs
|
|
1195
|
-
}))
|
|
1196
|
-
);
|
|
1197
|
-
var Heading = ({
|
|
1198
|
-
level,
|
|
1199
|
-
id,
|
|
1200
|
-
children
|
|
1201
|
-
}) => {
|
|
1202
|
-
const Tag = `h${level}`;
|
|
1203
|
-
return /* @__PURE__ */ jsxs14(Tag, { id, className: "boltdocs-heading", children: [
|
|
1204
|
-
children,
|
|
1205
|
-
id && /* @__PURE__ */ jsx20("a", { href: `#${id}`, className: "header-anchor", "aria-label": "Anchor", children: /* @__PURE__ */ jsx20(LucideLink, { size: 16 }) })
|
|
1206
|
-
] });
|
|
1207
|
-
};
|
|
1208
|
-
var mdxComponents = {
|
|
1209
|
-
h1: (props) => /* @__PURE__ */ jsx20(Heading, { level: 1, ...props }),
|
|
1210
|
-
h2: (props) => /* @__PURE__ */ jsx20(Heading, { level: 2, ...props }),
|
|
1211
|
-
h3: (props) => /* @__PURE__ */ jsx20(Heading, { level: 3, ...props }),
|
|
1212
|
-
h4: (props) => /* @__PURE__ */ jsx20(Heading, { level: 4, ...props }),
|
|
1213
|
-
h5: (props) => /* @__PURE__ */ jsx20(Heading, { level: 5, ...props }),
|
|
1214
|
-
h6: (props) => /* @__PURE__ */ jsx20(Heading, { level: 6, ...props }),
|
|
1215
|
-
pre: (props) => /* @__PURE__ */ jsx20(CodeBlock, { ...props, children: props.children }),
|
|
1216
|
-
video: (props) => /* @__PURE__ */ jsx20(Suspense, { fallback: /* @__PURE__ */ jsx20("div", { className: "video-skeleton" }), children: /* @__PURE__ */ jsx20(Video, { ...props }) }),
|
|
1217
|
-
PackageManagerTabs: (props) => /* @__PURE__ */ jsx20(Suspense, { fallback: /* @__PURE__ */ jsx20("div", { className: "pkg-tabs-skeleton" }), children: /* @__PURE__ */ jsx20(PackageManagerTabs, { ...props }) })
|
|
1218
|
-
};
|
|
1219
|
-
function AppShell({
|
|
1220
|
-
initialRoutes,
|
|
1221
|
-
initialConfig,
|
|
1222
|
-
docsDirName,
|
|
1223
|
-
modules,
|
|
1224
|
-
hot,
|
|
1225
|
-
homePage: HomePage,
|
|
1226
|
-
components: customComponents = {}
|
|
1227
|
-
}) {
|
|
1228
|
-
const [routesInfo, setRoutesInfo] = useState10(initialRoutes);
|
|
1229
|
-
const [config] = useState10(initialConfig);
|
|
1230
|
-
const resolveRoutes = (infos) => {
|
|
1231
|
-
return infos.filter(
|
|
1232
|
-
(route) => !(HomePage && (route.path === "/" || route.path === ""))
|
|
1233
|
-
).map((route) => {
|
|
1234
|
-
const loaderKey = Object.keys(modules).find(
|
|
1235
|
-
(k) => k === `/${docsDirName}/${route.filePath}`
|
|
1236
|
-
);
|
|
1237
|
-
const loader = loaderKey ? modules[loaderKey] : null;
|
|
1238
|
-
return {
|
|
1239
|
-
...route,
|
|
1240
|
-
Component: React9.lazy(() => {
|
|
1241
|
-
if (!loader)
|
|
1242
|
-
return Promise.resolve({ default: () => /* @__PURE__ */ jsx20(NotFound, {}) });
|
|
1243
|
-
return loader();
|
|
1244
|
-
})
|
|
1245
|
-
};
|
|
1246
|
-
});
|
|
1247
|
-
};
|
|
1248
|
-
const [resolvedRoutes, setResolvedRoutes] = useState10(
|
|
1249
|
-
() => resolveRoutes(initialRoutes)
|
|
1250
|
-
);
|
|
1251
|
-
useEffect9(() => {
|
|
1252
|
-
if (hot) {
|
|
1253
|
-
hot.on("boltdocs:routes-update", (newRoutes) => {
|
|
1254
|
-
setRoutesInfo(newRoutes);
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
}, [hot]);
|
|
1258
|
-
useEffect9(() => {
|
|
1259
|
-
setResolvedRoutes(resolveRoutes(routesInfo));
|
|
1260
|
-
}, [routesInfo, modules, docsDirName]);
|
|
1261
|
-
return /* @__PURE__ */ jsx20(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsxs14(PreloadProvider, { routes: routesInfo, modules, children: [
|
|
1262
|
-
/* @__PURE__ */ jsx20(ScrollHandler, {}),
|
|
1263
|
-
/* @__PURE__ */ jsxs14(Routes, { children: [
|
|
1264
|
-
HomePage && /* @__PURE__ */ jsx20(
|
|
1265
|
-
Route,
|
|
1266
|
-
{
|
|
1267
|
-
path: "/",
|
|
1268
|
-
element: /* @__PURE__ */ jsx20(
|
|
1269
|
-
ThemeLayout,
|
|
1270
|
-
{
|
|
1271
|
-
config,
|
|
1272
|
-
routes: routesInfo,
|
|
1273
|
-
sidebar: null,
|
|
1274
|
-
toc: null,
|
|
1275
|
-
breadcrumbs: null,
|
|
1276
|
-
...config.themeConfig?.layoutProps,
|
|
1277
|
-
children: /* @__PURE__ */ jsx20(HomePage, {})
|
|
1278
|
-
}
|
|
1279
|
-
)
|
|
1280
|
-
}
|
|
1281
|
-
),
|
|
1282
|
-
/* @__PURE__ */ jsx20(
|
|
1283
|
-
Route,
|
|
1284
|
-
{
|
|
1285
|
-
element: /* @__PURE__ */ jsx20(DocsLayout, { config, routes: routesInfo }),
|
|
1286
|
-
children: resolvedRoutes.map((route) => /* @__PURE__ */ jsx20(
|
|
1287
|
-
Route,
|
|
1288
|
-
{
|
|
1289
|
-
path: route.path === "" ? "/" : route.path,
|
|
1290
|
-
element: /* @__PURE__ */ jsx20(React9.Suspense, { fallback: /* @__PURE__ */ jsx20(Loading, {}), children: /* @__PURE__ */ jsx20(
|
|
1291
|
-
MdxPage,
|
|
1292
|
-
{
|
|
1293
|
-
Component: route.Component,
|
|
1294
|
-
customComponents
|
|
1295
|
-
}
|
|
1296
|
-
) })
|
|
1297
|
-
},
|
|
1298
|
-
route.path
|
|
1299
|
-
))
|
|
1300
|
-
},
|
|
1301
|
-
"docs-layout"
|
|
1302
|
-
),
|
|
1303
|
-
/* @__PURE__ */ jsx20(
|
|
1304
|
-
Route,
|
|
1305
|
-
{
|
|
1306
|
-
path: "*",
|
|
1307
|
-
element: /* @__PURE__ */ jsx20(
|
|
1308
|
-
ThemeLayout,
|
|
1309
|
-
{
|
|
1310
|
-
config,
|
|
1311
|
-
routes: routesInfo,
|
|
1312
|
-
...config.themeConfig?.layoutProps,
|
|
1313
|
-
children: /* @__PURE__ */ jsx20(NotFound, {})
|
|
1314
|
-
}
|
|
1315
|
-
)
|
|
1316
|
-
}
|
|
1317
|
-
)
|
|
1318
|
-
] })
|
|
1319
|
-
] }) });
|
|
1320
|
-
}
|
|
1321
|
-
function ScrollHandler() {
|
|
1322
|
-
const { pathname, hash } = useLocation8();
|
|
1323
|
-
useLayoutEffect(() => {
|
|
1324
|
-
const container = document.querySelector(".boltdocs-content");
|
|
1325
|
-
if (!container) return;
|
|
1326
|
-
if (hash) {
|
|
1327
|
-
const id = hash.replace("#", "");
|
|
1328
|
-
const element = document.getElementById(id);
|
|
1329
|
-
if (element) {
|
|
1330
|
-
const offset = 80;
|
|
1331
|
-
const containerRect = container.getBoundingClientRect().top;
|
|
1332
|
-
const elementRect = element.getBoundingClientRect().top;
|
|
1333
|
-
const elementPosition = elementRect - containerRect;
|
|
1334
|
-
const offsetPosition = elementPosition - offset + container.scrollTop;
|
|
1335
|
-
container.scrollTo({
|
|
1336
|
-
top: offsetPosition,
|
|
1337
|
-
behavior: "smooth"
|
|
1338
|
-
});
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
container.scrollTo(0, 0);
|
|
1343
|
-
}, [pathname, hash]);
|
|
1344
|
-
return null;
|
|
1345
|
-
}
|
|
1346
|
-
function DocsLayout({
|
|
1347
|
-
config,
|
|
1348
|
-
routes
|
|
1349
|
-
}) {
|
|
1350
|
-
return /* @__PURE__ */ jsx20(
|
|
1351
|
-
ThemeLayout,
|
|
1352
|
-
{
|
|
1353
|
-
config,
|
|
1354
|
-
routes,
|
|
1355
|
-
...config.themeConfig?.layoutProps,
|
|
1356
|
-
children: /* @__PURE__ */ jsx20(Outlet, {})
|
|
1357
|
-
}
|
|
1358
|
-
);
|
|
1359
|
-
}
|
|
1360
|
-
function MdxPage({
|
|
1361
|
-
Component: Component2,
|
|
1362
|
-
customComponents = {}
|
|
1363
|
-
}) {
|
|
1364
|
-
const allComponents = { ...mdxComponents, ...customComponents };
|
|
1365
|
-
return /* @__PURE__ */ jsx20(MDXProvider, { components: allComponents, children: /* @__PURE__ */ jsx20(Component2, {}) });
|
|
1366
|
-
}
|
|
1367
|
-
function createBoltdocsApp(options) {
|
|
1368
|
-
const { target, routes, docsDirName, config, modules, hot, homePage } = options;
|
|
1369
|
-
const container = document.querySelector(target);
|
|
1370
|
-
if (!container) {
|
|
1371
|
-
throw new Error(
|
|
1372
|
-
`[boltdocs] Mount target "${target}" not found in document.`
|
|
1373
|
-
);
|
|
1374
|
-
}
|
|
1375
|
-
const app = /* @__PURE__ */ jsx20(React9.StrictMode, { children: /* @__PURE__ */ jsx20(BrowserRouter, { children: /* @__PURE__ */ jsx20(
|
|
1376
|
-
AppShell,
|
|
1377
|
-
{
|
|
1378
|
-
initialRoutes: routes,
|
|
1379
|
-
initialConfig: config,
|
|
1380
|
-
docsDirName,
|
|
1381
|
-
modules,
|
|
1382
|
-
hot,
|
|
1383
|
-
homePage,
|
|
1384
|
-
components: options.components
|
|
1385
|
-
}
|
|
1386
|
-
) }) });
|
|
1387
|
-
container.innerHTML = "";
|
|
1388
|
-
ReactDOM.createRoot(container).render(app);
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
// src/client/theme/ui/Link/LinkPreview.tsx
|
|
1392
|
-
import { useEffect as useEffect10, useState as useState11, useRef as useRef6 } from "react";
|
|
1393
|
-
import { createPortal } from "react-dom";
|
|
1394
|
-
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1395
|
-
function LinkPreview({
|
|
1396
|
-
isVisible,
|
|
1397
|
-
title,
|
|
1398
|
-
summary,
|
|
1399
|
-
x,
|
|
1400
|
-
y
|
|
1401
|
-
}) {
|
|
1402
|
-
const ref = useRef6(null);
|
|
1403
|
-
const [position, setPosition] = useState11({ top: 0, left: 0 });
|
|
1404
|
-
useEffect10(() => {
|
|
1405
|
-
if (ref.current) {
|
|
1406
|
-
const rect = ref.current.getBoundingClientRect();
|
|
1407
|
-
const padding = 12;
|
|
1408
|
-
let top = y + padding;
|
|
1409
|
-
let left = x + padding;
|
|
1410
|
-
if (left + rect.width > window.innerWidth - 20) {
|
|
1411
|
-
left = x - rect.width - padding;
|
|
1412
|
-
}
|
|
1413
|
-
if (top + rect.height > window.innerHeight - 20) {
|
|
1414
|
-
top = y - rect.height - padding;
|
|
1415
|
-
}
|
|
1416
|
-
setPosition({ top, left });
|
|
1417
|
-
}
|
|
1418
|
-
}, [x, y, isVisible]);
|
|
1419
|
-
return createPortal(
|
|
1420
|
-
/* @__PURE__ */ jsx21(
|
|
1421
|
-
"div",
|
|
1422
|
-
{
|
|
1423
|
-
ref,
|
|
1424
|
-
className: `boltdocs-link-preview ${isVisible ? "is-visible" : ""}`,
|
|
1425
|
-
style: {
|
|
1426
|
-
top: position.top,
|
|
1427
|
-
left: position.left
|
|
1428
|
-
},
|
|
1429
|
-
children: /* @__PURE__ */ jsxs15("div", { className: "boltdocs-link-preview-content", children: [
|
|
1430
|
-
/* @__PURE__ */ jsx21("span", { className: "boltdocs-link-preview-title", children: title }),
|
|
1431
|
-
summary && /* @__PURE__ */ jsx21("p", { className: "boltdocs-link-preview-summary", children: summary })
|
|
1432
|
-
] })
|
|
1433
|
-
}
|
|
1434
|
-
),
|
|
1435
|
-
document.body
|
|
1436
|
-
);
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
// src/client/theme/ui/Link/Link.tsx
|
|
1440
|
-
import { Fragment, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1441
|
-
function useLocalizedTo(to) {
|
|
1442
|
-
const location = useLocation9();
|
|
1443
|
-
const config = useConfig();
|
|
1444
|
-
if (!config || typeof to !== "string") return to;
|
|
1445
|
-
if (!config.i18n && !config.versions) return to;
|
|
1446
|
-
const basePath = "/docs";
|
|
1447
|
-
if (!to.startsWith(basePath)) return to;
|
|
1448
|
-
const curSub = location.pathname.substring(basePath.length);
|
|
1449
|
-
const curParts = curSub.split("/").filter(Boolean);
|
|
1450
|
-
let currentVersion = config.versions?.defaultVersion;
|
|
1451
|
-
let currentLocale = config.i18n?.defaultLocale;
|
|
1452
|
-
let cIdx = 0;
|
|
1453
|
-
if (config.versions && curParts.length > cIdx && config.versions.versions[curParts[cIdx]]) {
|
|
1454
|
-
currentVersion = curParts[cIdx];
|
|
1455
|
-
cIdx++;
|
|
1456
|
-
}
|
|
1457
|
-
if (config.i18n && curParts.length > cIdx && config.i18n.locales[curParts[cIdx]]) {
|
|
1458
|
-
currentLocale = curParts[cIdx];
|
|
1459
|
-
}
|
|
1460
|
-
const toSub = to.substring(basePath.length);
|
|
1461
|
-
const toParts = toSub.split("/").filter(Boolean);
|
|
1462
|
-
let tIdx = 0;
|
|
1463
|
-
let hasVersion = false;
|
|
1464
|
-
let hasLocale = false;
|
|
1465
|
-
if (config.versions && toParts.length > tIdx && config.versions.versions[toParts[tIdx]]) {
|
|
1466
|
-
hasVersion = true;
|
|
1467
|
-
tIdx++;
|
|
1468
|
-
}
|
|
1469
|
-
if (config.i18n && toParts.length > tIdx && config.i18n.locales[toParts[tIdx]]) {
|
|
1470
|
-
hasLocale = true;
|
|
1471
|
-
tIdx++;
|
|
1472
|
-
}
|
|
1473
|
-
const routeParts = toParts.slice(tIdx);
|
|
1474
|
-
const finalParts = [];
|
|
1475
|
-
if (config.versions) {
|
|
1476
|
-
if (hasVersion) {
|
|
1477
|
-
finalParts.push(toParts[0]);
|
|
1478
|
-
} else if (currentVersion) {
|
|
1479
|
-
finalParts.push(currentVersion);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
if (config.i18n) {
|
|
1483
|
-
if (hasLocale) {
|
|
1484
|
-
finalParts.push(toParts[hasVersion ? 1 : 0]);
|
|
1485
|
-
} else if (currentLocale) {
|
|
1486
|
-
finalParts.push(currentLocale);
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
finalParts.push(...routeParts);
|
|
1490
|
-
let finalPath = `${basePath}/${finalParts.join("/")}`;
|
|
1491
|
-
if (finalPath.endsWith("/")) {
|
|
1492
|
-
finalPath = finalPath.slice(0, -1);
|
|
1493
|
-
}
|
|
1494
|
-
return finalPath === basePath ? basePath : finalPath;
|
|
1495
|
-
}
|
|
1496
|
-
var Link = React10.forwardRef(
|
|
1497
|
-
(props, ref) => {
|
|
1498
|
-
const {
|
|
1499
|
-
boltdocsPrefetch = "hover",
|
|
1500
|
-
boltdocsPreview = true,
|
|
1501
|
-
onMouseEnter,
|
|
1502
|
-
onMouseLeave,
|
|
1503
|
-
onFocus,
|
|
1504
|
-
onBlur,
|
|
1505
|
-
onClick,
|
|
1506
|
-
to,
|
|
1507
|
-
...rest
|
|
1508
|
-
} = props;
|
|
1509
|
-
const localizedTo = useLocalizedTo(to);
|
|
1510
|
-
const { preload, routes } = usePreload();
|
|
1511
|
-
const config = useConfig();
|
|
1512
|
-
const navigate = useNavigate3();
|
|
1513
|
-
const shouldShowPreview = boltdocsPreview && config?.themeConfig?.linkPreview !== false;
|
|
1514
|
-
const [preview, setPreview] = React10.useState({ visible: false, x: 0, y: 0, title: "" });
|
|
1515
|
-
const handleMouseEnter = (e) => {
|
|
1516
|
-
onMouseEnter?.(e);
|
|
1517
|
-
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
1518
|
-
preload(localizedTo);
|
|
1519
|
-
}
|
|
1520
|
-
if (shouldShowPreview && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
1521
|
-
const cleanPath = localizedTo.split("#")[0].split("?")[0];
|
|
1522
|
-
const route = routes.find(
|
|
1523
|
-
(r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
|
|
1524
|
-
);
|
|
1525
|
-
if (route) {
|
|
1526
|
-
setPreview({
|
|
1527
|
-
visible: true,
|
|
1528
|
-
x: e.clientX,
|
|
1529
|
-
y: e.clientY,
|
|
1530
|
-
title: route.title,
|
|
1531
|
-
summary: route.description
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
};
|
|
1536
|
-
const handleMouseMove = (e) => {
|
|
1537
|
-
if (preview.visible) {
|
|
1538
|
-
setPreview((prev) => ({ ...prev, x: e.clientX, y: e.clientY }));
|
|
1539
|
-
}
|
|
1540
|
-
};
|
|
1541
|
-
const handleMouseLeave = (e) => {
|
|
1542
|
-
onMouseLeave?.(e);
|
|
1543
|
-
setPreview((prev) => ({ ...prev, visible: false }));
|
|
1544
|
-
};
|
|
1545
|
-
const handleFocus = (e) => {
|
|
1546
|
-
onFocus?.(e);
|
|
1547
|
-
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
1548
|
-
preload(localizedTo);
|
|
1549
|
-
}
|
|
1550
|
-
};
|
|
1551
|
-
const handleBlur = (e) => {
|
|
1552
|
-
onBlur?.(e);
|
|
1553
|
-
setPreview((prev) => ({ ...prev, visible: false }));
|
|
1554
|
-
};
|
|
1555
|
-
const handleClick = (e) => {
|
|
1556
|
-
onClick?.(e);
|
|
1557
|
-
setPreview((prev) => ({ ...prev, visible: false }));
|
|
1558
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
1559
|
-
return;
|
|
1560
|
-
}
|
|
1561
|
-
if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
|
|
1562
|
-
e.preventDefault();
|
|
1563
|
-
React10.startTransition(() => {
|
|
1564
|
-
navigate(localizedTo);
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
return /* @__PURE__ */ jsxs16(Fragment, { children: [
|
|
1569
|
-
/* @__PURE__ */ jsx22(
|
|
1570
|
-
RouterLink,
|
|
1571
|
-
{
|
|
1572
|
-
ref,
|
|
1573
|
-
to: localizedTo,
|
|
1574
|
-
onMouseEnter: handleMouseEnter,
|
|
1575
|
-
onMouseMove: handleMouseMove,
|
|
1576
|
-
onMouseLeave: handleMouseLeave,
|
|
1577
|
-
onFocus: handleFocus,
|
|
1578
|
-
onBlur: handleBlur,
|
|
1579
|
-
onClick: handleClick,
|
|
1580
|
-
...rest
|
|
1581
|
-
}
|
|
1582
|
-
),
|
|
1583
|
-
preview.visible && shouldShowPreview && /* @__PURE__ */ jsx22(
|
|
1584
|
-
LinkPreview,
|
|
1585
|
-
{
|
|
1586
|
-
isVisible: preview.visible,
|
|
1587
|
-
title: preview.title,
|
|
1588
|
-
summary: preview.summary,
|
|
1589
|
-
x: preview.x,
|
|
1590
|
-
y: preview.y
|
|
1591
|
-
}
|
|
1592
|
-
)
|
|
1593
|
-
] });
|
|
1594
|
-
}
|
|
1595
|
-
);
|
|
1596
|
-
Link.displayName = "Link";
|
|
1597
|
-
var NavLink = React10.forwardRef(
|
|
1598
|
-
(props, ref) => {
|
|
1599
|
-
const {
|
|
1600
|
-
boltdocsPrefetch = "hover",
|
|
1601
|
-
boltdocsPreview = true,
|
|
1602
|
-
onMouseEnter,
|
|
1603
|
-
onMouseLeave,
|
|
1604
|
-
onFocus,
|
|
1605
|
-
onBlur,
|
|
1606
|
-
onClick,
|
|
1607
|
-
to,
|
|
1608
|
-
...rest
|
|
1609
|
-
} = props;
|
|
1610
|
-
const localizedTo = useLocalizedTo(to);
|
|
1611
|
-
const { preload, routes } = usePreload();
|
|
1612
|
-
const config = useConfig();
|
|
1613
|
-
const navigate = useNavigate3();
|
|
1614
|
-
const shouldShowPreview = boltdocsPreview && config?.themeConfig?.linkPreview !== false;
|
|
1615
|
-
const [preview, setPreview] = React10.useState({ visible: false, x: 0, y: 0, title: "" });
|
|
1616
|
-
const handleMouseEnter = (e) => {
|
|
1617
|
-
onMouseEnter?.(e);
|
|
1618
|
-
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
1619
|
-
preload(localizedTo);
|
|
1620
|
-
}
|
|
1621
|
-
if (shouldShowPreview && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
1622
|
-
const cleanPath = localizedTo.split("#")[0].split("?")[0];
|
|
1623
|
-
const route = routes.find(
|
|
1624
|
-
(r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
|
|
1625
|
-
);
|
|
1626
|
-
if (route) {
|
|
1627
|
-
setPreview({
|
|
1628
|
-
visible: true,
|
|
1629
|
-
x: e.clientX,
|
|
1630
|
-
y: e.clientY,
|
|
1631
|
-
title: route.title,
|
|
1632
|
-
summary: route.description
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
};
|
|
1637
|
-
const handleMouseMove = (e) => {
|
|
1638
|
-
if (preview.visible) {
|
|
1639
|
-
setPreview((prev) => ({ ...prev, x: e.clientX, y: e.clientY }));
|
|
1640
|
-
}
|
|
1641
|
-
};
|
|
1642
|
-
const handleMouseLeave = (e) => {
|
|
1643
|
-
onMouseLeave?.(e);
|
|
1644
|
-
setPreview((prev) => ({ ...prev, visible: false }));
|
|
1645
|
-
};
|
|
1646
|
-
const handleFocus = (e) => {
|
|
1647
|
-
onFocus?.(e);
|
|
1648
|
-
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
1649
|
-
preload(localizedTo);
|
|
1650
|
-
}
|
|
1651
|
-
};
|
|
1652
|
-
const handleBlur = (e) => {
|
|
1653
|
-
onBlur?.(e);
|
|
1654
|
-
setPreview((prev) => ({ ...prev, visible: false }));
|
|
1655
|
-
};
|
|
1656
|
-
const handleClick = (e) => {
|
|
1657
|
-
onClick?.(e);
|
|
1658
|
-
setPreview((prev) => ({ ...prev, visible: false }));
|
|
1659
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
|
-
if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
|
|
1663
|
-
e.preventDefault();
|
|
1664
|
-
React10.startTransition(() => {
|
|
1665
|
-
navigate(localizedTo);
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
};
|
|
1669
|
-
return /* @__PURE__ */ jsxs16(Fragment, { children: [
|
|
1670
|
-
/* @__PURE__ */ jsx22(
|
|
1671
|
-
RouterNavLink,
|
|
1672
|
-
{
|
|
1673
|
-
ref,
|
|
1674
|
-
to: localizedTo,
|
|
1675
|
-
onMouseEnter: handleMouseEnter,
|
|
1676
|
-
onMouseMove: handleMouseMove,
|
|
1677
|
-
onMouseLeave: handleMouseLeave,
|
|
1678
|
-
onFocus: handleFocus,
|
|
1679
|
-
onBlur: handleBlur,
|
|
1680
|
-
onClick: handleClick,
|
|
1681
|
-
...rest
|
|
1682
|
-
}
|
|
1683
|
-
),
|
|
1684
|
-
preview.visible && shouldShowPreview && /* @__PURE__ */ jsx22(
|
|
1685
|
-
LinkPreview,
|
|
1686
|
-
{
|
|
1687
|
-
isVisible: preview.visible,
|
|
1688
|
-
title: preview.title,
|
|
1689
|
-
summary: preview.summary,
|
|
1690
|
-
x: preview.x,
|
|
1691
|
-
y: preview.y
|
|
1692
|
-
}
|
|
1693
|
-
)
|
|
1694
|
-
] });
|
|
1695
|
-
}
|
|
1696
|
-
);
|
|
1697
|
-
NavLink.displayName = "NavLink";
|
|
1698
|
-
|
|
1699
|
-
// src/client/theme/ui/Navbar/Tabs.tsx
|
|
1700
|
-
import * as Icons from "lucide-react";
|
|
1701
|
-
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1702
|
-
function Tabs({ tabs, routes }) {
|
|
1703
|
-
const location = useLocation10();
|
|
1704
|
-
const containerRef = useRef7(null);
|
|
1705
|
-
const tabRefs = useRef7([]);
|
|
1706
|
-
const [indicatorStyle, setIndicatorStyle] = useState12({
|
|
1707
|
-
opacity: 0,
|
|
1708
|
-
transform: "translateX(0) scaleX(0)",
|
|
1709
|
-
width: 0
|
|
1710
|
-
});
|
|
1711
|
-
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
1712
|
-
const currentTabId = currentRoute?.tab?.toLowerCase();
|
|
1713
|
-
const activeIndex = tabs.findIndex(
|
|
1714
|
-
(tab) => currentTabId ? currentTabId === tab.id.toLowerCase() : false
|
|
1715
|
-
);
|
|
1716
|
-
const finalActiveIndex = activeIndex === -1 ? 0 : activeIndex;
|
|
1717
|
-
useEffect11(() => {
|
|
1718
|
-
const activeTab = tabRefs.current[finalActiveIndex];
|
|
1719
|
-
if (activeTab) {
|
|
1720
|
-
setIndicatorStyle({
|
|
1721
|
-
opacity: 1,
|
|
1722
|
-
width: activeTab.offsetWidth,
|
|
1723
|
-
transform: `translateX(${activeTab.offsetLeft}px)`
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
}, [finalActiveIndex, tabs, location.pathname]);
|
|
1727
|
-
if (!tabs || tabs.length === 0) return null;
|
|
1728
|
-
const renderTabIcon = (iconName) => {
|
|
1729
|
-
if (!iconName) return null;
|
|
1730
|
-
if (iconName.trim().startsWith("<svg")) {
|
|
1731
|
-
return /* @__PURE__ */ jsx23(
|
|
1732
|
-
"span",
|
|
1733
|
-
{
|
|
1734
|
-
className: "tab-icon svg-icon",
|
|
1735
|
-
dangerouslySetInnerHTML: { __html: iconName }
|
|
1736
|
-
}
|
|
1737
|
-
);
|
|
1738
|
-
}
|
|
1739
|
-
const LucideIcon = Icons[iconName];
|
|
1740
|
-
if (LucideIcon) {
|
|
1741
|
-
return /* @__PURE__ */ jsx23(LucideIcon, { size: 16, className: "tab-icon lucide-icon" });
|
|
1742
|
-
}
|
|
1743
|
-
return /* @__PURE__ */ jsx23("img", { src: iconName, alt: "", className: "tab-icon img-icon" });
|
|
1744
|
-
};
|
|
1745
|
-
return /* @__PURE__ */ jsx23("div", { className: "boltdocs-tabs-container", children: /* @__PURE__ */ jsxs17("div", { className: "boltdocs-tabs", ref: containerRef, children: [
|
|
1746
|
-
tabs.map((tab, index) => {
|
|
1747
|
-
const isActive = index === finalActiveIndex;
|
|
1748
|
-
const firstRoute = routes.find(
|
|
1749
|
-
(r) => r.tab && r.tab.toLowerCase() === tab.id.toLowerCase()
|
|
1750
|
-
);
|
|
1751
|
-
const linkTo = firstRoute ? firstRoute.path : "#";
|
|
1752
|
-
return /* @__PURE__ */ jsxs17(
|
|
1753
|
-
Link,
|
|
1754
|
-
{
|
|
1755
|
-
to: linkTo,
|
|
1756
|
-
ref: (el) => {
|
|
1757
|
-
tabRefs.current[index] = el;
|
|
1758
|
-
},
|
|
1759
|
-
className: `boltdocs-tab-item ${isActive ? "active" : ""}`,
|
|
1760
|
-
children: [
|
|
1761
|
-
renderTabIcon(tab.icon),
|
|
1762
|
-
/* @__PURE__ */ jsx23("span", { children: tab.text })
|
|
1763
|
-
]
|
|
1764
|
-
},
|
|
1765
|
-
tab.id
|
|
1766
|
-
);
|
|
1767
|
-
}),
|
|
1768
|
-
/* @__PURE__ */ jsx23("div", { className: "boltdocs-tab-indicator", style: indicatorStyle })
|
|
1769
|
-
] }) });
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
// src/client/theme/ui/Navbar/Navbar.tsx
|
|
1773
|
-
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1774
|
-
var SearchDialog = lazy2(
|
|
1775
|
-
() => import("./SearchDialog-AGVF6JBO.mjs").then((m) => ({ default: m.SearchDialog }))
|
|
1776
|
-
);
|
|
1777
|
-
var ICON_MAP = {
|
|
1778
|
-
discord: Discord,
|
|
1779
|
-
x: XformerlyTwitter
|
|
1780
|
-
};
|
|
1781
|
-
function Navbar({
|
|
1782
|
-
config,
|
|
1783
|
-
routes,
|
|
1784
|
-
allRoutes,
|
|
1785
|
-
currentLocale,
|
|
1786
|
-
currentVersion
|
|
1787
|
-
}) {
|
|
1788
|
-
const location = useLocation11();
|
|
1789
|
-
const isHomePage = location.pathname === "/";
|
|
1790
|
-
const title = config.themeConfig?.title || "Boltdocs";
|
|
1791
|
-
const navItems = config.themeConfig?.navbar || [];
|
|
1792
|
-
const socialLinks = config.themeConfig?.socialLinks || [];
|
|
1793
|
-
const hasTabs = !isHomePage && config.themeConfig?.tabs && config.themeConfig.tabs.length > 0;
|
|
1794
|
-
const leftItems = navItems.filter((item) => item.position !== "right");
|
|
1795
|
-
const rightItems = navItems.filter((item) => item.position === "right");
|
|
1796
|
-
const renderNavItem = (item, i) => {
|
|
1797
|
-
const text = item.label || item.text || "";
|
|
1798
|
-
const href = item.to || item.href || item.link || "";
|
|
1799
|
-
const isExternal = href.startsWith("http") || href.startsWith("//") || href.includes("://");
|
|
1800
|
-
return /* @__PURE__ */ jsxs18(Link2, { to: href, target: isExternal ? "_blank" : void 0, children: [
|
|
1801
|
-
text,
|
|
1802
|
-
isExternal && /* @__PURE__ */ jsx24("span", { className: "navbar-external-icon", children: /* @__PURE__ */ jsxs18(
|
|
1803
|
-
"svg",
|
|
1804
|
-
{
|
|
1805
|
-
viewBox: "0 0 24 24",
|
|
1806
|
-
width: "13",
|
|
1807
|
-
height: "13",
|
|
1808
|
-
stroke: "currentColor",
|
|
1809
|
-
strokeWidth: "2",
|
|
1810
|
-
fill: "none",
|
|
1811
|
-
strokeLinecap: "round",
|
|
1812
|
-
strokeLinejoin: "round",
|
|
1813
|
-
children: [
|
|
1814
|
-
/* @__PURE__ */ jsx24("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1815
|
-
/* @__PURE__ */ jsx24("polyline", { points: "15 3 21 3 21 9" }),
|
|
1816
|
-
/* @__PURE__ */ jsx24("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1817
|
-
]
|
|
1818
|
-
}
|
|
1819
|
-
) })
|
|
1820
|
-
] }, i);
|
|
1821
|
-
};
|
|
1822
|
-
return /* @__PURE__ */ jsxs18("header", { className: `boltdocs-navbar ${hasTabs ? "has-tabs" : ""}`, children: [
|
|
1823
|
-
/* @__PURE__ */ jsxs18(
|
|
1824
|
-
"div",
|
|
1825
|
-
{
|
|
1826
|
-
className: "navbar-container",
|
|
1827
|
-
style: { height: "var(--ld-navbar-height)" },
|
|
1828
|
-
children: [
|
|
1829
|
-
/* @__PURE__ */ jsxs18("div", { className: "navbar-left", children: [
|
|
1830
|
-
/* @__PURE__ */ jsx24("div", { className: "navbar-logo", children: /* @__PURE__ */ jsxs18(Link2, { to: "/", children: [
|
|
1831
|
-
config.themeConfig?.logo ? config.themeConfig.logo.trim().startsWith("<svg") ? /* @__PURE__ */ jsx24(
|
|
1832
|
-
"span",
|
|
1833
|
-
{
|
|
1834
|
-
className: "navbar-logo-svg",
|
|
1835
|
-
dangerouslySetInnerHTML: {
|
|
1836
|
-
__html: config.themeConfig.logo
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
) : /* @__PURE__ */ jsx24(
|
|
1840
|
-
"img",
|
|
1841
|
-
{
|
|
1842
|
-
src: config.themeConfig.logo,
|
|
1843
|
-
alt: title,
|
|
1844
|
-
className: "navbar-logo-img"
|
|
1845
|
-
}
|
|
1846
|
-
) : null,
|
|
1847
|
-
title
|
|
1848
|
-
] }) }),
|
|
1849
|
-
config.versions && currentVersion && allRoutes ? /* @__PURE__ */ jsx24(
|
|
1850
|
-
VersionSwitcher,
|
|
1851
|
-
{
|
|
1852
|
-
versions: config.versions,
|
|
1853
|
-
currentVersion,
|
|
1854
|
-
currentLocale,
|
|
1855
|
-
allRoutes
|
|
1856
|
-
}
|
|
1857
|
-
) : config.themeConfig?.version ? /* @__PURE__ */ jsxs18("div", { className: "navbar-version", children: [
|
|
1858
|
-
config.themeConfig.version,
|
|
1859
|
-
" ",
|
|
1860
|
-
/* @__PURE__ */ jsx24(ChevronDown4, { size: 14 })
|
|
1861
|
-
] }) : null,
|
|
1862
|
-
/* @__PURE__ */ jsx24("nav", { className: "navbar-links", "aria-label": "Top Navigation Left", children: leftItems.map(renderNavItem) })
|
|
1863
|
-
] }),
|
|
1864
|
-
/* @__PURE__ */ jsxs18("div", { className: "navbar-right", children: [
|
|
1865
|
-
/* @__PURE__ */ jsx24("nav", { className: "navbar-links", "aria-label": "Top Navigation Right", children: rightItems.map(renderNavItem) }),
|
|
1866
|
-
/* @__PURE__ */ jsx24(Suspense2, { fallback: /* @__PURE__ */ jsx24("div", { className: "navbar-search-placeholder" }), children: /* @__PURE__ */ jsx24(SearchDialog, { routes: routes || [] }) }),
|
|
1867
|
-
config.i18n && currentLocale && allRoutes && /* @__PURE__ */ jsx24(
|
|
1868
|
-
LanguageSwitcher,
|
|
1869
|
-
{
|
|
1870
|
-
i18n: config.i18n,
|
|
1871
|
-
currentLocale,
|
|
1872
|
-
allRoutes
|
|
1873
|
-
}
|
|
1874
|
-
),
|
|
1875
|
-
/* @__PURE__ */ jsx24(ThemeToggle, {}),
|
|
1876
|
-
config.themeConfig?.githubRepo && /* @__PURE__ */ jsx24(GithubStars, { repo: config.themeConfig.githubRepo }),
|
|
1877
|
-
socialLinks.length > 0 && /* @__PURE__ */ jsx24("div", { className: "navbar-divider" }),
|
|
1878
|
-
/* @__PURE__ */ jsx24("div", { className: "navbar-icons", children: socialLinks.map((link, i) => {
|
|
1879
|
-
const IconComp = ICON_MAP[link.icon.toLowerCase()];
|
|
1880
|
-
return /* @__PURE__ */ jsx24(
|
|
1881
|
-
"a",
|
|
1882
|
-
{
|
|
1883
|
-
href: link.link,
|
|
1884
|
-
target: "_blank",
|
|
1885
|
-
rel: "noopener noreferrer",
|
|
1886
|
-
className: "navbar-icon-btn",
|
|
1887
|
-
"aria-label": link.icon,
|
|
1888
|
-
children: IconComp ? /* @__PURE__ */ jsx24(IconComp, {}) : /* @__PURE__ */ jsx24("span", { children: link.icon })
|
|
1889
|
-
},
|
|
1890
|
-
i
|
|
1891
|
-
);
|
|
1892
|
-
}) })
|
|
1893
|
-
] })
|
|
1894
|
-
]
|
|
1895
|
-
}
|
|
1896
|
-
),
|
|
1897
|
-
hasTabs && config.themeConfig?.tabs && /* @__PURE__ */ jsx24(
|
|
1898
|
-
Tabs,
|
|
1899
|
-
{
|
|
1900
|
-
tabs: config.themeConfig.tabs,
|
|
1901
|
-
routes: allRoutes || routes || []
|
|
1902
|
-
}
|
|
1903
|
-
)
|
|
1904
|
-
] });
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
export {
|
|
1908
|
-
Link,
|
|
1909
|
-
Navbar,
|
|
1910
|
-
Sidebar,
|
|
1911
|
-
OnThisPage,
|
|
1912
|
-
Head,
|
|
1913
|
-
Breadcrumbs,
|
|
1914
|
-
ThemeLayout,
|
|
1915
|
-
NotFound,
|
|
1916
|
-
Loading,
|
|
1917
|
-
CodeBlock,
|
|
1918
|
-
AppShell,
|
|
1919
|
-
createBoltdocsApp
|
|
1920
|
-
};
|