boltdocs 1.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/dist/CodeBlock-37XMKCYY.mjs +7 -0
- package/dist/PackageManagerTabs-4NWXLXQO.mjs +314 -0
- package/dist/Playground-OE2OE6B6.mjs +7 -0
- package/dist/SearchDialog-FTOQZ763.mjs +187 -0
- package/dist/SearchDialog-ZAZXYIFX.css +2147 -0
- package/dist/Video-I6QY4X7J.mjs +7 -0
- package/dist/chunk-2YRDWM6O.mjs +56 -0
- package/dist/chunk-PN4GCTYG.mjs +67 -0
- package/dist/chunk-X2TDGMTR.mjs +64 -0
- package/dist/chunk-X6BYQHVC.mjs +12 -0
- package/dist/chunk-Z7JHYNAS.mjs +57 -0
- package/dist/chunk-ZFCOLEXN.mjs +1644 -0
- package/dist/client/index.css +2147 -0
- package/dist/client/index.d.mts +298 -0
- package/dist/client/index.d.ts +298 -0
- package/dist/client/index.js +2793 -0
- package/dist/client/index.mjs +63 -0
- package/dist/client/ssr.css +2147 -0
- package/dist/client/ssr.d.mts +25 -0
- package/dist/client/ssr.d.ts +25 -0
- package/dist/client/ssr.js +2727 -0
- package/dist/client/ssr.mjs +32 -0
- package/dist/config-D2XmHJYe.d.mts +122 -0
- package/dist/config-D2XmHJYe.d.ts +122 -0
- package/dist/index-CRQKWAeo.d.mts +82 -0
- package/dist/index-CRQKWAeo.d.ts +82 -0
- package/dist/node/cli/index.d.mts +1 -0
- package/dist/node/cli/index.d.ts +1 -0
- package/dist/node/cli/index.js +199 -0
- package/dist/node/cli/index.mjs +154 -0
- package/dist/node/index.d.mts +79 -0
- package/dist/node/index.d.ts +79 -0
- package/dist/node/index.js +797 -0
- package/dist/node/index.mjs +719 -0
- package/package.json +79 -0
- package/src/client/app/index.tsx +422 -0
- package/src/client/app/preload.tsx +56 -0
- package/src/client/index.ts +40 -0
- package/src/client/ssr.tsx +50 -0
- package/src/client/theme/components/CodeBlock/CodeBlock.tsx +76 -0
- package/src/client/theme/components/CodeBlock/index.ts +1 -0
- package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +154 -0
- package/src/client/theme/components/PackageManagerTabs/index.ts +1 -0
- package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +64 -0
- package/src/client/theme/components/Playground/Playground.tsx +86 -0
- package/src/client/theme/components/Playground/index.ts +1 -0
- package/src/client/theme/components/Playground/playground.css +168 -0
- package/src/client/theme/components/Video/Video.tsx +84 -0
- package/src/client/theme/components/Video/index.ts +1 -0
- package/src/client/theme/components/Video/video.css +41 -0
- package/src/client/theme/components/mdx/Admonition.tsx +80 -0
- package/src/client/theme/components/mdx/Badge.tsx +31 -0
- package/src/client/theme/components/mdx/Button.tsx +50 -0
- package/src/client/theme/components/mdx/Card.tsx +80 -0
- package/src/client/theme/components/mdx/List.tsx +57 -0
- package/src/client/theme/components/mdx/Tabs.tsx +94 -0
- package/src/client/theme/components/mdx/index.ts +18 -0
- package/src/client/theme/components/mdx/mdx-components.css +405 -0
- package/src/client/theme/icons/bun.tsx +62 -0
- package/src/client/theme/icons/deno.tsx +20 -0
- package/src/client/theme/icons/discord.tsx +12 -0
- package/src/client/theme/icons/github.tsx +15 -0
- package/src/client/theme/icons/npm.tsx +13 -0
- package/src/client/theme/icons/pnpm.tsx +72 -0
- package/src/client/theme/icons/twitter.tsx +12 -0
- package/src/client/theme/styles/home.css +60 -0
- package/src/client/theme/styles/markdown.css +343 -0
- package/src/client/theme/styles/variables.css +162 -0
- package/src/client/theme/styles.css +38 -0
- package/src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx +10 -0
- package/src/client/theme/ui/BackgroundGradient/index.ts +1 -0
- package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +68 -0
- package/src/client/theme/ui/Breadcrumbs/index.ts +1 -0
- package/src/client/theme/ui/Footer/footer.css +32 -0
- package/src/client/theme/ui/Head/Head.tsx +69 -0
- package/src/client/theme/ui/Head/index.ts +1 -0
- package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +125 -0
- package/src/client/theme/ui/LanguageSwitcher/index.ts +1 -0
- package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +98 -0
- package/src/client/theme/ui/Layout/Layout.tsx +213 -0
- package/src/client/theme/ui/Layout/base.css +76 -0
- package/src/client/theme/ui/Layout/index.ts +2 -0
- package/src/client/theme/ui/Layout/pagination.css +72 -0
- package/src/client/theme/ui/Layout/responsive.css +40 -0
- package/src/client/theme/ui/Link/Link.tsx +202 -0
- package/src/client/theme/ui/Link/index.ts +2 -0
- package/src/client/theme/ui/Loading/Loading.tsx +10 -0
- package/src/client/theme/ui/Loading/index.ts +1 -0
- package/src/client/theme/ui/Loading/loading.css +30 -0
- package/src/client/theme/ui/Navbar/GithubStars.tsx +27 -0
- package/src/client/theme/ui/Navbar/Navbar.tsx +145 -0
- package/src/client/theme/ui/Navbar/index.ts +2 -0
- package/src/client/theme/ui/Navbar/navbar.css +233 -0
- package/src/client/theme/ui/NotFound/NotFound.tsx +20 -0
- package/src/client/theme/ui/NotFound/index.ts +1 -0
- package/src/client/theme/ui/NotFound/not-found.css +64 -0
- package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +192 -0
- package/src/client/theme/ui/OnThisPage/index.ts +1 -0
- package/src/client/theme/ui/OnThisPage/toc.css +132 -0
- package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +18 -0
- package/src/client/theme/ui/PoweredBy/index.ts +1 -0
- package/src/client/theme/ui/PoweredBy/powered-by.css +76 -0
- package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +199 -0
- package/src/client/theme/ui/SearchDialog/index.ts +1 -0
- package/src/client/theme/ui/SearchDialog/search.css +152 -0
- package/src/client/theme/ui/Sidebar/Sidebar.tsx +200 -0
- package/src/client/theme/ui/Sidebar/index.ts +1 -0
- package/src/client/theme/ui/Sidebar/sidebar.css +269 -0
- package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +69 -0
- package/src/client/theme/ui/ThemeToggle/index.ts +1 -0
- package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +136 -0
- package/src/client/theme/ui/VersionSwitcher/index.ts +1 -0
- package/src/client/utils.ts +26 -0
- package/src/node/cache.ts +94 -0
- package/src/node/cli/commands/config.ts +15 -0
- package/src/node/cli/commands/generate-css.ts +24 -0
- package/src/node/cli/constants.ts +70 -0
- package/src/node/cli/index.ts +22 -0
- package/src/node/config.ts +185 -0
- package/src/node/index.ts +21 -0
- package/src/node/mdx.ts +41 -0
- package/src/node/plugin/entry.ts +58 -0
- package/src/node/plugin/html.ts +55 -0
- package/src/node/plugin/index.ts +190 -0
- package/src/node/plugin/types.ts +11 -0
- package/src/node/routes/cache.ts +24 -0
- package/src/node/routes/index.ts +152 -0
- package/src/node/routes/parser.ts +127 -0
- package/src/node/routes/sorter.ts +42 -0
- package/src/node/routes/types.ts +49 -0
- package/src/node/ssg/index.ts +110 -0
- package/src/node/ssg/meta.ts +34 -0
- package/src/node/ssg/options.ts +13 -0
- package/src/node/ssg/sitemap.ts +54 -0
- package/src/node/utils.ts +134 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +22 -0
|
@@ -0,0 +1,2727 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// src/client/app/preload.tsx
|
|
34
|
+
function usePreload() {
|
|
35
|
+
return (0, import_react.useContext)(PreloadContext);
|
|
36
|
+
}
|
|
37
|
+
function PreloadProvider({
|
|
38
|
+
routes,
|
|
39
|
+
modules,
|
|
40
|
+
children
|
|
41
|
+
}) {
|
|
42
|
+
const preload = (0, import_react.useCallback)(
|
|
43
|
+
(path) => {
|
|
44
|
+
const cleanPath = path.split("#")[0].split("?")[0];
|
|
45
|
+
const route = routes.find(
|
|
46
|
+
(r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
|
|
47
|
+
);
|
|
48
|
+
if (route && route.filePath) {
|
|
49
|
+
const loaderKey = Object.keys(modules).find(
|
|
50
|
+
(k) => k.endsWith("/" + route.filePath)
|
|
51
|
+
);
|
|
52
|
+
if (loaderKey) {
|
|
53
|
+
modules[loaderKey]().catch((err) => {
|
|
54
|
+
console.error(`[boltdocs] Failed to preload route ${path}:`, err);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
[routes, modules]
|
|
60
|
+
);
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreloadContext.Provider, { value: { preload }, children });
|
|
62
|
+
}
|
|
63
|
+
var import_react, import_jsx_runtime, PreloadContext;
|
|
64
|
+
var init_preload = __esm({
|
|
65
|
+
"src/client/app/preload.tsx"() {
|
|
66
|
+
"use strict";
|
|
67
|
+
import_react = require("react");
|
|
68
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
69
|
+
PreloadContext = (0, import_react.createContext)({
|
|
70
|
+
preload: () => {
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// src/client/theme/ui/Link/Link.tsx
|
|
77
|
+
function useLocalizedTo(to) {
|
|
78
|
+
const location = (0, import_react_router_dom.useLocation)();
|
|
79
|
+
const config = useConfig();
|
|
80
|
+
if (!config || typeof to !== "string") return to;
|
|
81
|
+
if (!config.i18n && !config.versions) return to;
|
|
82
|
+
const basePath = "/docs";
|
|
83
|
+
if (!to.startsWith(basePath)) return to;
|
|
84
|
+
const curSub = location.pathname.substring(basePath.length);
|
|
85
|
+
const curParts = curSub.split("/").filter(Boolean);
|
|
86
|
+
let currentVersion = config.versions?.defaultVersion;
|
|
87
|
+
let currentLocale = config.i18n?.defaultLocale;
|
|
88
|
+
let cIdx = 0;
|
|
89
|
+
if (config.versions && curParts.length > cIdx && config.versions.versions[curParts[cIdx]]) {
|
|
90
|
+
currentVersion = curParts[cIdx];
|
|
91
|
+
cIdx++;
|
|
92
|
+
}
|
|
93
|
+
if (config.i18n && curParts.length > cIdx && config.i18n.locales[curParts[cIdx]]) {
|
|
94
|
+
currentLocale = curParts[cIdx];
|
|
95
|
+
}
|
|
96
|
+
const toSub = to.substring(basePath.length);
|
|
97
|
+
const toParts = toSub.split("/").filter(Boolean);
|
|
98
|
+
let tIdx = 0;
|
|
99
|
+
let hasVersion = false;
|
|
100
|
+
let hasLocale = false;
|
|
101
|
+
if (config.versions && toParts.length > tIdx && config.versions.versions[toParts[tIdx]]) {
|
|
102
|
+
hasVersion = true;
|
|
103
|
+
tIdx++;
|
|
104
|
+
}
|
|
105
|
+
if (config.i18n && toParts.length > tIdx && config.i18n.locales[toParts[tIdx]]) {
|
|
106
|
+
hasLocale = true;
|
|
107
|
+
tIdx++;
|
|
108
|
+
}
|
|
109
|
+
const routeParts = toParts.slice(tIdx);
|
|
110
|
+
const finalParts = [];
|
|
111
|
+
if (config.versions) {
|
|
112
|
+
if (hasVersion) {
|
|
113
|
+
finalParts.push(toParts[0]);
|
|
114
|
+
} else if (currentVersion) {
|
|
115
|
+
finalParts.push(currentVersion);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (config.i18n) {
|
|
119
|
+
if (hasLocale) {
|
|
120
|
+
finalParts.push(toParts[hasVersion ? 1 : 0]);
|
|
121
|
+
} else if (currentLocale) {
|
|
122
|
+
finalParts.push(currentLocale);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
finalParts.push(...routeParts);
|
|
126
|
+
let finalPath = `${basePath}/${finalParts.join("/")}`;
|
|
127
|
+
if (finalPath.endsWith("/")) {
|
|
128
|
+
finalPath = finalPath.slice(0, -1);
|
|
129
|
+
}
|
|
130
|
+
return finalPath === basePath ? basePath : finalPath;
|
|
131
|
+
}
|
|
132
|
+
var import_react2, import_react_router_dom, import_jsx_runtime2, Link, NavLink;
|
|
133
|
+
var init_Link = __esm({
|
|
134
|
+
"src/client/theme/ui/Link/Link.tsx"() {
|
|
135
|
+
"use strict";
|
|
136
|
+
import_react2 = __toESM(require("react"));
|
|
137
|
+
import_react_router_dom = require("react-router-dom");
|
|
138
|
+
init_preload();
|
|
139
|
+
init_app();
|
|
140
|
+
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
141
|
+
Link = import_react2.default.forwardRef(
|
|
142
|
+
(props, ref) => {
|
|
143
|
+
const {
|
|
144
|
+
boltdocsPrefetch = "hover",
|
|
145
|
+
onMouseEnter,
|
|
146
|
+
onFocus,
|
|
147
|
+
to,
|
|
148
|
+
...rest
|
|
149
|
+
} = props;
|
|
150
|
+
const localizedTo = useLocalizedTo(to);
|
|
151
|
+
const { preload } = usePreload();
|
|
152
|
+
const handleMouseEnter = (e) => {
|
|
153
|
+
onMouseEnter?.(e);
|
|
154
|
+
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
155
|
+
preload(localizedTo);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const handleFocus = (e) => {
|
|
159
|
+
onFocus?.(e);
|
|
160
|
+
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
161
|
+
preload(localizedTo);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
165
|
+
import_react_router_dom.Link,
|
|
166
|
+
{
|
|
167
|
+
ref,
|
|
168
|
+
to: localizedTo,
|
|
169
|
+
onMouseEnter: handleMouseEnter,
|
|
170
|
+
onFocus: handleFocus,
|
|
171
|
+
...rest
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
Link.displayName = "Link";
|
|
177
|
+
NavLink = import_react2.default.forwardRef(
|
|
178
|
+
(props, ref) => {
|
|
179
|
+
const {
|
|
180
|
+
boltdocsPrefetch = "hover",
|
|
181
|
+
onMouseEnter,
|
|
182
|
+
onFocus,
|
|
183
|
+
to,
|
|
184
|
+
...rest
|
|
185
|
+
} = props;
|
|
186
|
+
const localizedTo = useLocalizedTo(to);
|
|
187
|
+
const { preload } = usePreload();
|
|
188
|
+
const handleMouseEnter = (e) => {
|
|
189
|
+
onMouseEnter?.(e);
|
|
190
|
+
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
191
|
+
preload(localizedTo);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const handleFocus = (e) => {
|
|
195
|
+
onFocus?.(e);
|
|
196
|
+
if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
|
|
197
|
+
preload(localizedTo);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
201
|
+
import_react_router_dom.NavLink,
|
|
202
|
+
{
|
|
203
|
+
ref,
|
|
204
|
+
to: localizedTo,
|
|
205
|
+
onMouseEnter: handleMouseEnter,
|
|
206
|
+
onFocus: handleFocus,
|
|
207
|
+
...rest
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
NavLink.displayName = "NavLink";
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// src/client/theme/ui/Link/index.ts
|
|
217
|
+
var init_Link2 = __esm({
|
|
218
|
+
"src/client/theme/ui/Link/index.ts"() {
|
|
219
|
+
"use strict";
|
|
220
|
+
init_Link();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx
|
|
225
|
+
function getBaseFilePath(filePath, version, locale) {
|
|
226
|
+
let path = filePath;
|
|
227
|
+
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
228
|
+
path = path === version ? "index.md" : path.slice(version.length + 1);
|
|
229
|
+
}
|
|
230
|
+
if (locale && (path === locale || path.startsWith(locale + "/"))) {
|
|
231
|
+
path = path === locale ? "index.md" : path.slice(locale.length + 1);
|
|
232
|
+
}
|
|
233
|
+
return path;
|
|
234
|
+
}
|
|
235
|
+
function LanguageSwitcher({
|
|
236
|
+
i18n,
|
|
237
|
+
currentLocale,
|
|
238
|
+
allRoutes
|
|
239
|
+
}) {
|
|
240
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
241
|
+
const dropdownRef = (0, import_react3.useRef)(null);
|
|
242
|
+
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
243
|
+
const location = (0, import_react_router_dom2.useLocation)();
|
|
244
|
+
(0, import_react3.useEffect)(() => {
|
|
245
|
+
function handleClickOutside(event) {
|
|
246
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
247
|
+
setIsOpen(false);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
251
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
252
|
+
}, []);
|
|
253
|
+
const handleSelect = (locale) => {
|
|
254
|
+
setIsOpen(false);
|
|
255
|
+
if (locale === currentLocale) return;
|
|
256
|
+
const currentRoute = allRoutes.find((r) => r.path === location.pathname);
|
|
257
|
+
let targetPath = "/";
|
|
258
|
+
if (currentRoute) {
|
|
259
|
+
const baseFile = getBaseFilePath(
|
|
260
|
+
currentRoute.filePath,
|
|
261
|
+
currentRoute.version,
|
|
262
|
+
currentRoute.locale
|
|
263
|
+
);
|
|
264
|
+
const targetRoute = allRoutes.find(
|
|
265
|
+
(r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version
|
|
266
|
+
);
|
|
267
|
+
if (targetRoute) {
|
|
268
|
+
targetPath = targetRoute.path;
|
|
269
|
+
} else {
|
|
270
|
+
const defaultIndexRoute = allRoutes.find(
|
|
271
|
+
(r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version
|
|
272
|
+
);
|
|
273
|
+
targetPath = defaultIndexRoute ? defaultIndexRoute.path : locale === i18n.defaultLocale ? currentRoute.version ? `/${currentRoute.version}` : "/" : currentRoute.version ? `/${currentRoute.version}/${locale}` : `/${locale}`;
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
targetPath = locale === i18n.defaultLocale ? "/" : `/${locale}`;
|
|
277
|
+
}
|
|
278
|
+
navigate(targetPath);
|
|
279
|
+
};
|
|
280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "boltdocs-language-switcher", ref: dropdownRef, children: [
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
282
|
+
"button",
|
|
283
|
+
{
|
|
284
|
+
className: "language-btn",
|
|
285
|
+
onClick: () => setIsOpen(!isOpen),
|
|
286
|
+
"aria-label": "Switch language",
|
|
287
|
+
"aria-expanded": isOpen,
|
|
288
|
+
"aria-haspopup": "listbox",
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Globe, { size: 18 }),
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "language-label", children: i18n.locales[currentLocale] || currentLocale }),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ChevronDown, { size: 14 })
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "language-dropdown", children: Object.entries(i18n.locales).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
297
|
+
"button",
|
|
298
|
+
{
|
|
299
|
+
className: `language-option ${key === currentLocale ? "active" : ""}`,
|
|
300
|
+
onClick: () => handleSelect(key),
|
|
301
|
+
children: label
|
|
302
|
+
},
|
|
303
|
+
key
|
|
304
|
+
)) })
|
|
305
|
+
] });
|
|
306
|
+
}
|
|
307
|
+
var import_react3, import_lucide_react, import_react_router_dom2, import_jsx_runtime3;
|
|
308
|
+
var init_LanguageSwitcher = __esm({
|
|
309
|
+
"src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx"() {
|
|
310
|
+
"use strict";
|
|
311
|
+
import_react3 = require("react");
|
|
312
|
+
import_lucide_react = require("lucide-react");
|
|
313
|
+
import_react_router_dom2 = require("react-router-dom");
|
|
314
|
+
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// src/client/theme/ui/LanguageSwitcher/index.ts
|
|
319
|
+
var init_LanguageSwitcher2 = __esm({
|
|
320
|
+
"src/client/theme/ui/LanguageSwitcher/index.ts"() {
|
|
321
|
+
"use strict";
|
|
322
|
+
init_LanguageSwitcher();
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx
|
|
327
|
+
function getBaseFilePath2(filePath, version, locale) {
|
|
328
|
+
let path = filePath;
|
|
329
|
+
if (version && (path === version || path.startsWith(version + "/"))) {
|
|
330
|
+
path = path === version ? "index.md" : path.slice(version.length + 1);
|
|
331
|
+
}
|
|
332
|
+
if (locale && (path === locale || path.startsWith(locale + "/"))) {
|
|
333
|
+
path = path === locale ? "index.md" : path.slice(locale.length + 1);
|
|
334
|
+
}
|
|
335
|
+
return path;
|
|
336
|
+
}
|
|
337
|
+
function VersionSwitcher({
|
|
338
|
+
versions,
|
|
339
|
+
currentVersion,
|
|
340
|
+
currentLocale,
|
|
341
|
+
allRoutes
|
|
342
|
+
}) {
|
|
343
|
+
const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
|
|
344
|
+
const dropdownRef = (0, import_react4.useRef)(null);
|
|
345
|
+
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
346
|
+
const location = (0, import_react_router_dom3.useLocation)();
|
|
347
|
+
(0, import_react4.useEffect)(() => {
|
|
348
|
+
function handleClickOutside(event) {
|
|
349
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
350
|
+
setIsOpen(false);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
354
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
355
|
+
}, []);
|
|
356
|
+
const handleSelect = (version) => {
|
|
357
|
+
setIsOpen(false);
|
|
358
|
+
if (version === currentVersion) return;
|
|
359
|
+
const currentRoute = allRoutes.find((r) => r.path === location.pathname);
|
|
360
|
+
let targetPath = `/docs/${version}`;
|
|
361
|
+
if (currentRoute) {
|
|
362
|
+
const baseFile = getBaseFilePath2(
|
|
363
|
+
currentRoute.filePath,
|
|
364
|
+
currentRoute.version,
|
|
365
|
+
currentRoute.locale
|
|
366
|
+
);
|
|
367
|
+
const targetRoute = allRoutes.find(
|
|
368
|
+
(r) => getBaseFilePath2(r.filePath, r.version, r.locale) === baseFile && (r.version || versions.defaultVersion) === version && (currentLocale ? r.locale === currentLocale : !r.locale)
|
|
369
|
+
);
|
|
370
|
+
if (targetRoute) {
|
|
371
|
+
targetPath = targetRoute.path;
|
|
372
|
+
} else {
|
|
373
|
+
const versionIndexRoute = allRoutes.find(
|
|
374
|
+
(r) => getBaseFilePath2(r.filePath, r.version, r.locale) === "index.md" && (r.version || versions.defaultVersion) === version && (currentLocale ? r.locale === currentLocale : !r.locale)
|
|
375
|
+
);
|
|
376
|
+
targetPath = versionIndexRoute ? versionIndexRoute.path : `/docs/${version}${currentLocale ? `/${currentLocale}` : ""}`;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
navigate(targetPath);
|
|
380
|
+
};
|
|
381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
382
|
+
"div",
|
|
383
|
+
{
|
|
384
|
+
className: "boltdocs-version-switcher",
|
|
385
|
+
ref: dropdownRef,
|
|
386
|
+
style: { position: "relative", display: "flex", alignItems: "center" },
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
389
|
+
"button",
|
|
390
|
+
{
|
|
391
|
+
className: "navbar-version",
|
|
392
|
+
onClick: () => setIsOpen(!isOpen),
|
|
393
|
+
"aria-label": "Switch version",
|
|
394
|
+
"aria-expanded": isOpen,
|
|
395
|
+
"aria-haspopup": "listbox",
|
|
396
|
+
style: {
|
|
397
|
+
fontFamily: "inherit",
|
|
398
|
+
padding: "0.25rem 0.5rem",
|
|
399
|
+
marginLeft: "0.5rem"
|
|
400
|
+
},
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: versions.versions[currentVersion] || currentVersion }),
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.ChevronDown, { size: 14 })
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
408
|
+
"div",
|
|
409
|
+
{
|
|
410
|
+
className: "language-dropdown",
|
|
411
|
+
style: {
|
|
412
|
+
left: "0.5rem",
|
|
413
|
+
right: "auto",
|
|
414
|
+
minWidth: "150px",
|
|
415
|
+
top: "calc(100% + 8px)"
|
|
416
|
+
},
|
|
417
|
+
children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
418
|
+
"button",
|
|
419
|
+
{
|
|
420
|
+
className: `language-option ${key === currentVersion ? "active" : ""}`,
|
|
421
|
+
onClick: () => handleSelect(key),
|
|
422
|
+
children: label
|
|
423
|
+
},
|
|
424
|
+
key
|
|
425
|
+
))
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
]
|
|
429
|
+
}
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
var import_react4, import_lucide_react2, import_react_router_dom3, import_jsx_runtime4;
|
|
433
|
+
var init_VersionSwitcher = __esm({
|
|
434
|
+
"src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx"() {
|
|
435
|
+
"use strict";
|
|
436
|
+
import_react4 = require("react");
|
|
437
|
+
import_lucide_react2 = require("lucide-react");
|
|
438
|
+
import_react_router_dom3 = require("react-router-dom");
|
|
439
|
+
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// src/client/theme/ui/VersionSwitcher/index.ts
|
|
444
|
+
var init_VersionSwitcher2 = __esm({
|
|
445
|
+
"src/client/theme/ui/VersionSwitcher/index.ts"() {
|
|
446
|
+
"use strict";
|
|
447
|
+
init_VersionSwitcher();
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// src/client/theme/ui/ThemeToggle/ThemeToggle.tsx
|
|
452
|
+
function ThemeToggle() {
|
|
453
|
+
const [theme, setTheme] = (0, import_react5.useState)("dark");
|
|
454
|
+
const [mounted, setMounted] = (0, import_react5.useState)(false);
|
|
455
|
+
(0, import_react5.useEffect)(() => {
|
|
456
|
+
setMounted(true);
|
|
457
|
+
const stored = localStorage.getItem("boltdocs-theme");
|
|
458
|
+
if (stored === "light" || stored === "dark") {
|
|
459
|
+
setTheme(stored);
|
|
460
|
+
} else {
|
|
461
|
+
const prefersDark = window.matchMedia(
|
|
462
|
+
"(prefers-color-scheme: dark)"
|
|
463
|
+
).matches;
|
|
464
|
+
setTheme(prefersDark ? "dark" : "light");
|
|
465
|
+
}
|
|
466
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
467
|
+
const handleChange = (e) => {
|
|
468
|
+
if (!localStorage.getItem("boltdocs-theme")) {
|
|
469
|
+
setTheme(e.matches ? "dark" : "light");
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
473
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
474
|
+
}, []);
|
|
475
|
+
(0, import_react5.useEffect)(() => {
|
|
476
|
+
if (!mounted) return;
|
|
477
|
+
const root = document.documentElement;
|
|
478
|
+
if (theme === "light") {
|
|
479
|
+
root.classList.add("theme-light");
|
|
480
|
+
root.dataset.theme = "light";
|
|
481
|
+
} else {
|
|
482
|
+
root.classList.remove("theme-light");
|
|
483
|
+
root.dataset.theme = "dark";
|
|
484
|
+
}
|
|
485
|
+
}, [theme, mounted]);
|
|
486
|
+
const toggleTheme = () => {
|
|
487
|
+
const newTheme = theme === "dark" ? "light" : "dark";
|
|
488
|
+
setTheme(newTheme);
|
|
489
|
+
localStorage.setItem("boltdocs-theme", newTheme);
|
|
490
|
+
};
|
|
491
|
+
if (!mounted) {
|
|
492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "navbar-icon-btn", "aria-label": "Toggle theme", disabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { width: 20, height: 20, display: "inline-block" } }) });
|
|
493
|
+
}
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
495
|
+
"button",
|
|
496
|
+
{
|
|
497
|
+
className: "navbar-icon-btn",
|
|
498
|
+
onClick: toggleTheme,
|
|
499
|
+
"aria-label": "Toggle theme",
|
|
500
|
+
title: `Switch to ${theme === "dark" ? "light" : "dark"} theme`,
|
|
501
|
+
children: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Sun, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Moon, { size: 20 })
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
var import_react5, import_lucide_react3, import_jsx_runtime5;
|
|
506
|
+
var init_ThemeToggle = __esm({
|
|
507
|
+
"src/client/theme/ui/ThemeToggle/ThemeToggle.tsx"() {
|
|
508
|
+
"use strict";
|
|
509
|
+
import_react5 = require("react");
|
|
510
|
+
import_lucide_react3 = require("lucide-react");
|
|
511
|
+
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
// src/client/theme/ui/ThemeToggle/index.ts
|
|
516
|
+
var init_ThemeToggle2 = __esm({
|
|
517
|
+
"src/client/theme/ui/ThemeToggle/index.ts"() {
|
|
518
|
+
"use strict";
|
|
519
|
+
init_ThemeToggle();
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
// src/client/theme/icons/discord.tsx
|
|
524
|
+
var import_jsx_runtime6, Discord;
|
|
525
|
+
var init_discord = __esm({
|
|
526
|
+
"src/client/theme/icons/discord.tsx"() {
|
|
527
|
+
"use strict";
|
|
528
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
529
|
+
Discord = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { ...props, viewBox: "0 0 256 199", preserveAspectRatio: "xMidYMid", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
530
|
+
"path",
|
|
531
|
+
{
|
|
532
|
+
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",
|
|
533
|
+
fill: "currentColor"
|
|
534
|
+
}
|
|
535
|
+
) });
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// src/client/theme/icons/twitter.tsx
|
|
540
|
+
var import_jsx_runtime7, XformerlyTwitter;
|
|
541
|
+
var init_twitter = __esm({
|
|
542
|
+
"src/client/theme/icons/twitter.tsx"() {
|
|
543
|
+
"use strict";
|
|
544
|
+
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
545
|
+
XformerlyTwitter = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { ...props, fill: "none", viewBox: "0 0 1200 1227", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
546
|
+
"path",
|
|
547
|
+
{
|
|
548
|
+
fill: "currentColor",
|
|
549
|
+
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"
|
|
550
|
+
}
|
|
551
|
+
) });
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// src/client/theme/icons/github.tsx
|
|
556
|
+
var import_jsx_runtime8, GitHub;
|
|
557
|
+
var init_github = __esm({
|
|
558
|
+
"src/client/theme/icons/github.tsx"() {
|
|
559
|
+
"use strict";
|
|
560
|
+
import_jsx_runtime8 = require("react/jsx-runtime");
|
|
561
|
+
GitHub = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { ...props, viewBox: "0 0 1024 1024", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
562
|
+
"path",
|
|
563
|
+
{
|
|
564
|
+
fillRule: "evenodd",
|
|
565
|
+
clipRule: "evenodd",
|
|
566
|
+
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",
|
|
567
|
+
transform: "scale(64)",
|
|
568
|
+
fill: "currentColor"
|
|
569
|
+
}
|
|
570
|
+
) });
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// src/client/utils.ts
|
|
575
|
+
async function getStarsRepo(repo) {
|
|
576
|
+
const response = await fetch(`https://api.github.com/repos/${repo}`);
|
|
577
|
+
const data = await response.json();
|
|
578
|
+
if (data.stargazers_count !== void 0) {
|
|
579
|
+
return formatStars(data.stargazers_count);
|
|
580
|
+
} else {
|
|
581
|
+
return "0";
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
var formatStars;
|
|
585
|
+
var init_utils = __esm({
|
|
586
|
+
"src/client/utils.ts"() {
|
|
587
|
+
"use strict";
|
|
588
|
+
formatStars = (count) => {
|
|
589
|
+
return Intl.NumberFormat("en", {
|
|
590
|
+
notation: "compact",
|
|
591
|
+
compactDisplay: "short"
|
|
592
|
+
}).format(count);
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// src/client/theme/ui/Navbar/GithubStars.tsx
|
|
598
|
+
function GithubStars({ repo }) {
|
|
599
|
+
const [stars, setStars] = (0, import_react6.useState)(null);
|
|
600
|
+
(0, import_react6.useEffect)(() => {
|
|
601
|
+
if (repo) {
|
|
602
|
+
getStarsRepo(repo).then((stars2) => setStars(stars2)).catch(() => setStars("0"));
|
|
603
|
+
}
|
|
604
|
+
}, [repo]);
|
|
605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
606
|
+
"a",
|
|
607
|
+
{
|
|
608
|
+
href: `https://github.com/${repo}`,
|
|
609
|
+
target: "_blank",
|
|
610
|
+
rel: "noopener noreferrer",
|
|
611
|
+
className: "navbar-github-stars",
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GitHub, {}),
|
|
614
|
+
stars && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: stars })
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
var import_react6, import_jsx_runtime9;
|
|
620
|
+
var init_GithubStars = __esm({
|
|
621
|
+
"src/client/theme/ui/Navbar/GithubStars.tsx"() {
|
|
622
|
+
"use strict";
|
|
623
|
+
import_react6 = require("react");
|
|
624
|
+
init_github();
|
|
625
|
+
init_utils();
|
|
626
|
+
import_jsx_runtime9 = require("react/jsx-runtime");
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
// src/client/theme/ui/SearchDialog/SearchDialog.tsx
|
|
631
|
+
function SearchDialog({ routes }) {
|
|
632
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
633
|
+
const [query, setQuery] = (0, import_react7.useState)("");
|
|
634
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
635
|
+
(0, import_react7.useEffect)(() => {
|
|
636
|
+
const handleKeyDown = (e) => {
|
|
637
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
|
|
638
|
+
e.preventDefault();
|
|
639
|
+
setIsOpen((prev) => !prev);
|
|
640
|
+
}
|
|
641
|
+
if (e.key === "Escape" && isOpen) {
|
|
642
|
+
setIsOpen(false);
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
646
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
647
|
+
}, [isOpen]);
|
|
648
|
+
(0, import_react7.useEffect)(() => {
|
|
649
|
+
if (isOpen) {
|
|
650
|
+
setTimeout(() => inputRef.current?.focus(), 50);
|
|
651
|
+
} else {
|
|
652
|
+
setQuery("");
|
|
653
|
+
}
|
|
654
|
+
}, [isOpen]);
|
|
655
|
+
const searchResults = import_react7.default.useMemo(() => {
|
|
656
|
+
if (!query) {
|
|
657
|
+
return routes.slice(0, 10).map((r) => ({
|
|
658
|
+
title: r.title,
|
|
659
|
+
path: r.path,
|
|
660
|
+
groupTitle: r.groupTitle
|
|
661
|
+
}));
|
|
662
|
+
}
|
|
663
|
+
const results = [];
|
|
664
|
+
const lowerQuery = query.toLowerCase();
|
|
665
|
+
for (const route of routes) {
|
|
666
|
+
if (route.title && route.title.toLowerCase().includes(lowerQuery)) {
|
|
667
|
+
results.push({
|
|
668
|
+
title: route.title,
|
|
669
|
+
path: route.path,
|
|
670
|
+
groupTitle: route.groupTitle
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
if (route.headings) {
|
|
674
|
+
for (const heading of route.headings) {
|
|
675
|
+
if (heading.text.toLowerCase().includes(lowerQuery)) {
|
|
676
|
+
results.push({
|
|
677
|
+
title: heading.text,
|
|
678
|
+
path: `${route.path}#${heading.id}`,
|
|
679
|
+
groupTitle: route.title,
|
|
680
|
+
isHeading: true
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const uniqueResults = [];
|
|
687
|
+
const seenPaths = /* @__PURE__ */ new Set();
|
|
688
|
+
for (const res of results) {
|
|
689
|
+
if (!seenPaths.has(res.path)) {
|
|
690
|
+
seenPaths.add(res.path);
|
|
691
|
+
uniqueResults.push(res);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return uniqueResults.slice(0, 10);
|
|
695
|
+
}, [routes, query]);
|
|
696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
698
|
+
"div",
|
|
699
|
+
{
|
|
700
|
+
className: "navbar-search",
|
|
701
|
+
role: "button",
|
|
702
|
+
tabIndex: 0,
|
|
703
|
+
onClick: () => setIsOpen(true),
|
|
704
|
+
onKeyDown: (e) => {
|
|
705
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
706
|
+
e.preventDefault();
|
|
707
|
+
setIsOpen(true);
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
"aria-label": "Open search dialog",
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Search, { className: "boltdocs-search-icon", size: 18 }),
|
|
713
|
+
"Search docs...",
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("kbd", { children: "\u2318K" })
|
|
715
|
+
]
|
|
716
|
+
}
|
|
717
|
+
),
|
|
718
|
+
isOpen && (0, import_react_dom.createPortal)(
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
720
|
+
"div",
|
|
721
|
+
{
|
|
722
|
+
className: "boltdocs-search-overlay",
|
|
723
|
+
onPointerDown: () => setIsOpen(false),
|
|
724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
725
|
+
"div",
|
|
726
|
+
{
|
|
727
|
+
className: "boltdocs-search-modal",
|
|
728
|
+
role: "dialog",
|
|
729
|
+
"aria-modal": "true",
|
|
730
|
+
"aria-label": "Search",
|
|
731
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "boltdocs-search-header", children: [
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Search, { size: 18 }),
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
736
|
+
"input",
|
|
737
|
+
{
|
|
738
|
+
ref: inputRef,
|
|
739
|
+
type: "text",
|
|
740
|
+
"aria-label": "Search documentation input",
|
|
741
|
+
placeholder: "Search documentation...",
|
|
742
|
+
value: query,
|
|
743
|
+
onChange: (e) => setQuery(e.target.value)
|
|
744
|
+
}
|
|
745
|
+
),
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
747
|
+
"button",
|
|
748
|
+
{
|
|
749
|
+
className: "boltdocs-search-close",
|
|
750
|
+
onClick: () => setIsOpen(false),
|
|
751
|
+
"aria-label": "Close search",
|
|
752
|
+
children: "ESC"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] }),
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "boltdocs-search-results", children: searchResults.length > 0 ? searchResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
757
|
+
Link,
|
|
758
|
+
{
|
|
759
|
+
to: result.path === "" ? "/" : result.path,
|
|
760
|
+
className: `boltdocs-search-result-item ${result.isHeading ? "is-heading" : ""}`,
|
|
761
|
+
onClick: (e) => {
|
|
762
|
+
const isSamePath = result.path.split("#")[0] === window.location.pathname;
|
|
763
|
+
if (isSamePath && result.isHeading) {
|
|
764
|
+
e.preventDefault();
|
|
765
|
+
const id = result.path.split("#")[1];
|
|
766
|
+
const el = document.getElementById(id);
|
|
767
|
+
if (el) {
|
|
768
|
+
const offset = 80;
|
|
769
|
+
const bodyRect = document.body.getBoundingClientRect().top;
|
|
770
|
+
const elementRect = el.getBoundingClientRect().top;
|
|
771
|
+
const elementPosition = elementRect - bodyRect;
|
|
772
|
+
const offsetPosition = elementPosition - offset;
|
|
773
|
+
window.scrollTo({
|
|
774
|
+
top: offsetPosition,
|
|
775
|
+
behavior: "smooth"
|
|
776
|
+
});
|
|
777
|
+
window.history.pushState(null, "", `#${id}`);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
setIsOpen(false);
|
|
781
|
+
},
|
|
782
|
+
children: [
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "boltdocs-search-result-title", children: [
|
|
784
|
+
result.isHeading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "heading-indicator", children: "#" }) : null,
|
|
785
|
+
result.title
|
|
786
|
+
] }),
|
|
787
|
+
result.groupTitle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "boltdocs-search-result-group", children: result.groupTitle })
|
|
788
|
+
]
|
|
789
|
+
},
|
|
790
|
+
result.path
|
|
791
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "boltdocs-search-empty", children: [
|
|
792
|
+
'No results found for "',
|
|
793
|
+
query,
|
|
794
|
+
'"'
|
|
795
|
+
] }) })
|
|
796
|
+
]
|
|
797
|
+
}
|
|
798
|
+
)
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
document.body
|
|
802
|
+
)
|
|
803
|
+
] });
|
|
804
|
+
}
|
|
805
|
+
var import_react7, import_react_dom, import_lucide_react4, import_jsx_runtime10;
|
|
806
|
+
var init_SearchDialog = __esm({
|
|
807
|
+
"src/client/theme/ui/SearchDialog/SearchDialog.tsx"() {
|
|
808
|
+
"use strict";
|
|
809
|
+
import_react7 = __toESM(require("react"));
|
|
810
|
+
import_react_dom = require("react-dom");
|
|
811
|
+
init_Link2();
|
|
812
|
+
import_lucide_react4 = require("lucide-react");
|
|
813
|
+
import_jsx_runtime10 = require("react/jsx-runtime");
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
// src/client/theme/ui/SearchDialog/index.ts
|
|
818
|
+
var SearchDialog_exports = {};
|
|
819
|
+
__export(SearchDialog_exports, {
|
|
820
|
+
SearchDialog: () => SearchDialog
|
|
821
|
+
});
|
|
822
|
+
var init_SearchDialog2 = __esm({
|
|
823
|
+
"src/client/theme/ui/SearchDialog/index.ts"() {
|
|
824
|
+
"use strict";
|
|
825
|
+
init_SearchDialog();
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
// src/client/theme/ui/Navbar/Navbar.tsx
|
|
830
|
+
function Navbar({
|
|
831
|
+
config,
|
|
832
|
+
routes,
|
|
833
|
+
allRoutes,
|
|
834
|
+
currentLocale,
|
|
835
|
+
currentVersion
|
|
836
|
+
}) {
|
|
837
|
+
const title = config.themeConfig?.title || "Boltdocs";
|
|
838
|
+
const navItems = config.themeConfig?.navbar || [];
|
|
839
|
+
const socialLinks = config.themeConfig?.socialLinks || [];
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("header", { className: "boltdocs-navbar", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "navbar-container", children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "navbar-left", children: [
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "navbar-logo", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Link, { to: "/", children: [
|
|
843
|
+
config.themeConfig?.logo ? config.themeConfig.logo.trim().startsWith("<svg") ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
844
|
+
"span",
|
|
845
|
+
{
|
|
846
|
+
className: "navbar-logo-svg",
|
|
847
|
+
dangerouslySetInnerHTML: {
|
|
848
|
+
__html: config.themeConfig.logo
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
852
|
+
"img",
|
|
853
|
+
{
|
|
854
|
+
src: config.themeConfig.logo,
|
|
855
|
+
alt: title,
|
|
856
|
+
className: "navbar-logo-img"
|
|
857
|
+
}
|
|
858
|
+
) : null,
|
|
859
|
+
title
|
|
860
|
+
] }) }),
|
|
861
|
+
config.versions && currentVersion && allRoutes ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
862
|
+
VersionSwitcher,
|
|
863
|
+
{
|
|
864
|
+
versions: config.versions,
|
|
865
|
+
currentVersion,
|
|
866
|
+
currentLocale,
|
|
867
|
+
allRoutes
|
|
868
|
+
}
|
|
869
|
+
) : config.themeConfig?.version ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "navbar-version", children: [
|
|
870
|
+
config.themeConfig.version,
|
|
871
|
+
" ",
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.ChevronDown, { size: 14 })
|
|
873
|
+
] }) : null,
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("nav", { className: "navbar-links", "aria-label": "Top Navigation", children: navItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Link, { to: item.link, children: item.text }, i)) })
|
|
875
|
+
] }),
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "navbar-right", children: [
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
878
|
+
import_react8.default.Suspense,
|
|
879
|
+
{
|
|
880
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "navbar-search-placeholder" }),
|
|
881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SearchDialog2, { routes: routes || [] })
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
config.i18n && currentLocale && allRoutes && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
885
|
+
LanguageSwitcher,
|
|
886
|
+
{
|
|
887
|
+
i18n: config.i18n,
|
|
888
|
+
currentLocale,
|
|
889
|
+
allRoutes
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeToggle, {}),
|
|
893
|
+
config.themeConfig?.githubRepo && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GithubStars, { repo: config.themeConfig.githubRepo }),
|
|
894
|
+
socialLinks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "navbar-divider" }),
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "navbar-icons", children: socialLinks.map((link, i) => {
|
|
896
|
+
const IconComp = ICON_MAP[link.icon.toLowerCase()];
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
898
|
+
"a",
|
|
899
|
+
{
|
|
900
|
+
href: link.link,
|
|
901
|
+
target: "_blank",
|
|
902
|
+
rel: "noopener noreferrer",
|
|
903
|
+
className: "navbar-icon-btn",
|
|
904
|
+
"aria-label": link.icon,
|
|
905
|
+
children: IconComp ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconComp, {}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: link.icon })
|
|
906
|
+
},
|
|
907
|
+
i
|
|
908
|
+
);
|
|
909
|
+
}) })
|
|
910
|
+
] })
|
|
911
|
+
] }) });
|
|
912
|
+
}
|
|
913
|
+
var import_react8, import_lucide_react5, import_jsx_runtime11, SearchDialog2, ICON_MAP;
|
|
914
|
+
var init_Navbar = __esm({
|
|
915
|
+
"src/client/theme/ui/Navbar/Navbar.tsx"() {
|
|
916
|
+
"use strict";
|
|
917
|
+
import_react8 = __toESM(require("react"));
|
|
918
|
+
init_Link2();
|
|
919
|
+
import_lucide_react5 = require("lucide-react");
|
|
920
|
+
init_LanguageSwitcher2();
|
|
921
|
+
init_VersionSwitcher2();
|
|
922
|
+
init_ThemeToggle2();
|
|
923
|
+
init_discord();
|
|
924
|
+
init_twitter();
|
|
925
|
+
init_GithubStars();
|
|
926
|
+
import_jsx_runtime11 = require("react/jsx-runtime");
|
|
927
|
+
SearchDialog2 = import_react8.default.lazy(
|
|
928
|
+
() => Promise.resolve().then(() => (init_SearchDialog2(), SearchDialog_exports)).then((m) => ({ default: m.SearchDialog }))
|
|
929
|
+
);
|
|
930
|
+
ICON_MAP = {
|
|
931
|
+
discord: Discord,
|
|
932
|
+
x: XformerlyTwitter
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
// src/client/theme/ui/Navbar/index.ts
|
|
938
|
+
var init_Navbar2 = __esm({
|
|
939
|
+
"src/client/theme/ui/Navbar/index.ts"() {
|
|
940
|
+
"use strict";
|
|
941
|
+
init_Navbar();
|
|
942
|
+
init_GithubStars();
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
|
|
946
|
+
// src/client/theme/ui/PoweredBy/PoweredBy.tsx
|
|
947
|
+
function PoweredBy() {
|
|
948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "powered-by-container", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
949
|
+
"a",
|
|
950
|
+
{
|
|
951
|
+
href: "https://github.com/jesusalcaladev/boltdocs",
|
|
952
|
+
target: "_blank",
|
|
953
|
+
rel: "noopener noreferrer",
|
|
954
|
+
className: "powered-by-link",
|
|
955
|
+
children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Zap, { className: "powered-by-icon", size: 12, fill: "currentColor" }),
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "Powered by" }),
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "powered-by-brand", children: "LiteDocs" })
|
|
959
|
+
]
|
|
960
|
+
}
|
|
961
|
+
) });
|
|
962
|
+
}
|
|
963
|
+
var import_lucide_react6, import_jsx_runtime12;
|
|
964
|
+
var init_PoweredBy = __esm({
|
|
965
|
+
"src/client/theme/ui/PoweredBy/PoweredBy.tsx"() {
|
|
966
|
+
"use strict";
|
|
967
|
+
import_lucide_react6 = require("lucide-react");
|
|
968
|
+
import_jsx_runtime12 = require("react/jsx-runtime");
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
// src/client/theme/ui/PoweredBy/index.ts
|
|
973
|
+
var init_PoweredBy2 = __esm({
|
|
974
|
+
"src/client/theme/ui/PoweredBy/index.ts"() {
|
|
975
|
+
"use strict";
|
|
976
|
+
init_PoweredBy();
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
// src/client/theme/ui/Sidebar/Sidebar.tsx
|
|
981
|
+
function renderBadge(badgeRaw) {
|
|
982
|
+
if (!badgeRaw) return null;
|
|
983
|
+
let text = "";
|
|
984
|
+
let expires = "";
|
|
985
|
+
if (typeof badgeRaw === "string") {
|
|
986
|
+
text = badgeRaw;
|
|
987
|
+
} else {
|
|
988
|
+
text = badgeRaw.text;
|
|
989
|
+
expires = badgeRaw.expires || "";
|
|
990
|
+
}
|
|
991
|
+
if (expires) {
|
|
992
|
+
const expireDate = new Date(expires);
|
|
993
|
+
const now = /* @__PURE__ */ new Date();
|
|
994
|
+
expireDate.setHours(0, 0, 0, 0);
|
|
995
|
+
now.setHours(0, 0, 0, 0);
|
|
996
|
+
if (now > expireDate) {
|
|
997
|
+
return null;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
if (!text) return null;
|
|
1001
|
+
if (!text) return null;
|
|
1002
|
+
let typeClass = "badge-default";
|
|
1003
|
+
const lowerText = text.toLowerCase();
|
|
1004
|
+
if (lowerText === "new") {
|
|
1005
|
+
typeClass = "badge-new";
|
|
1006
|
+
} else if (lowerText === "experimental") {
|
|
1007
|
+
typeClass = "badge-experimental";
|
|
1008
|
+
} else if (lowerText === "updated") {
|
|
1009
|
+
typeClass = "badge-updated";
|
|
1010
|
+
}
|
|
1011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `sidebar-badge ${typeClass}`, children: text });
|
|
1012
|
+
}
|
|
1013
|
+
function Sidebar({
|
|
1014
|
+
routes,
|
|
1015
|
+
config,
|
|
1016
|
+
onCollapse
|
|
1017
|
+
}) {
|
|
1018
|
+
const location = (0, import_react_router_dom4.useLocation)();
|
|
1019
|
+
const ungrouped = [];
|
|
1020
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
1021
|
+
for (const route of routes) {
|
|
1022
|
+
if (!route.group) {
|
|
1023
|
+
ungrouped.push(route);
|
|
1024
|
+
} else {
|
|
1025
|
+
if (!groupMap.has(route.group)) {
|
|
1026
|
+
groupMap.set(route.group, {
|
|
1027
|
+
slug: route.group,
|
|
1028
|
+
title: route.groupTitle || route.group,
|
|
1029
|
+
routes: []
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
groupMap.get(route.group).routes.push(route);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
const groups = Array.from(groupMap.values());
|
|
1036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("aside", { className: "boltdocs-sidebar", children: [
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("nav", { "aria-label": "Main Navigation", children: [
|
|
1038
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "sidebar-list", children: ungrouped.map((route) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1039
|
+
Link,
|
|
1040
|
+
{
|
|
1041
|
+
to: route.path === "" ? "/" : route.path,
|
|
1042
|
+
className: `sidebar-link ${location.pathname === route.path ? "active" : ""}`,
|
|
1043
|
+
"aria-current": location.pathname === route.path ? "page" : void 0,
|
|
1044
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "sidebar-link-content", children: [
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: route.title }),
|
|
1046
|
+
renderBadge(route.badge)
|
|
1047
|
+
] })
|
|
1048
|
+
}
|
|
1049
|
+
) }, route.path)) }),
|
|
1050
|
+
groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1051
|
+
SidebarGroupSection,
|
|
1052
|
+
{
|
|
1053
|
+
group,
|
|
1054
|
+
currentPath: location.pathname
|
|
1055
|
+
},
|
|
1056
|
+
group.slug
|
|
1057
|
+
))
|
|
1058
|
+
] }),
|
|
1059
|
+
onCollapse && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "sidebar-footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1060
|
+
"button",
|
|
1061
|
+
{
|
|
1062
|
+
className: "sidebar-collapse-btn",
|
|
1063
|
+
onClick: onCollapse,
|
|
1064
|
+
"aria-label": "Collapse Sidebar",
|
|
1065
|
+
title: "Collapse Sidebar",
|
|
1066
|
+
children: [
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronLeft, { size: 16 }),
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Collapse Sidebar" })
|
|
1069
|
+
]
|
|
1070
|
+
}
|
|
1071
|
+
) }),
|
|
1072
|
+
config.themeConfig?.poweredBy !== false && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PoweredBy, {})
|
|
1073
|
+
] });
|
|
1074
|
+
}
|
|
1075
|
+
function SidebarGroupSection({
|
|
1076
|
+
group,
|
|
1077
|
+
currentPath
|
|
1078
|
+
}) {
|
|
1079
|
+
const isActive = group.routes.some((r) => currentPath === r.path);
|
|
1080
|
+
const [open, setOpen] = (0, import_react9.useState)(true);
|
|
1081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "sidebar-group", children: [
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1083
|
+
"button",
|
|
1084
|
+
{
|
|
1085
|
+
className: `sidebar-group-header ${isActive ? "active" : ""}`,
|
|
1086
|
+
onClick: () => setOpen(!open),
|
|
1087
|
+
"aria-expanded": open,
|
|
1088
|
+
"aria-controls": `sidebar-group-${group.slug}`,
|
|
1089
|
+
children: [
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sidebar-group-title", children: group.title }),
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `sidebar-group-chevron ${open ? "open" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronRight, { size: 16 }) })
|
|
1092
|
+
]
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "sidebar-group-list", id: `sidebar-group-${group.slug}`, children: group.routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1096
|
+
Link,
|
|
1097
|
+
{
|
|
1098
|
+
to: route.path === "" ? "/" : route.path,
|
|
1099
|
+
className: `sidebar-link sidebar-link-nested ${currentPath === route.path ? "active" : ""}`,
|
|
1100
|
+
"aria-current": currentPath === route.path ? "page" : void 0,
|
|
1101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "sidebar-link-content", children: [
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: route.title }),
|
|
1103
|
+
renderBadge(route.badge)
|
|
1104
|
+
] })
|
|
1105
|
+
}
|
|
1106
|
+
) }, route.path)) })
|
|
1107
|
+
] });
|
|
1108
|
+
}
|
|
1109
|
+
var import_react9, import_react_router_dom4, import_lucide_react7, import_jsx_runtime13;
|
|
1110
|
+
var init_Sidebar = __esm({
|
|
1111
|
+
"src/client/theme/ui/Sidebar/Sidebar.tsx"() {
|
|
1112
|
+
"use strict";
|
|
1113
|
+
import_react9 = require("react");
|
|
1114
|
+
import_react_router_dom4 = require("react-router-dom");
|
|
1115
|
+
init_Link2();
|
|
1116
|
+
init_PoweredBy2();
|
|
1117
|
+
import_lucide_react7 = require("lucide-react");
|
|
1118
|
+
import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
// src/client/theme/ui/Sidebar/index.ts
|
|
1123
|
+
var init_Sidebar2 = __esm({
|
|
1124
|
+
"src/client/theme/ui/Sidebar/index.ts"() {
|
|
1125
|
+
"use strict";
|
|
1126
|
+
init_Sidebar();
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
// src/client/theme/ui/OnThisPage/OnThisPage.tsx
|
|
1131
|
+
function OnThisPage({
|
|
1132
|
+
headings = [],
|
|
1133
|
+
editLink,
|
|
1134
|
+
communityHelp,
|
|
1135
|
+
filePath
|
|
1136
|
+
}) {
|
|
1137
|
+
const [activeId, setActiveId] = (0, import_react10.useState)("");
|
|
1138
|
+
const [indicatorStyle, setIndicatorStyle] = (0, import_react10.useState)({});
|
|
1139
|
+
const observerRef = (0, import_react10.useRef)(null);
|
|
1140
|
+
const location = (0, import_react_router_dom5.useLocation)();
|
|
1141
|
+
const listRef = (0, import_react10.useRef)(null);
|
|
1142
|
+
(0, import_react10.useEffect)(() => {
|
|
1143
|
+
if (headings.length > 0) {
|
|
1144
|
+
const hash = window.location.hash.substring(1);
|
|
1145
|
+
if (hash && headings.some((h) => h.id === hash)) {
|
|
1146
|
+
setActiveId(hash);
|
|
1147
|
+
} else {
|
|
1148
|
+
setActiveId(headings[0].id);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
}, [location.pathname, headings]);
|
|
1152
|
+
(0, import_react10.useEffect)(() => {
|
|
1153
|
+
if (!activeId || !listRef.current) return;
|
|
1154
|
+
const activeElement = listRef.current.querySelector(
|
|
1155
|
+
`a[href="#${activeId}"]`
|
|
1156
|
+
);
|
|
1157
|
+
if (activeElement) {
|
|
1158
|
+
const { offsetTop, offsetHeight } = activeElement;
|
|
1159
|
+
setIndicatorStyle({
|
|
1160
|
+
transform: `translateY(${offsetTop}px)`,
|
|
1161
|
+
height: `${offsetHeight}px`,
|
|
1162
|
+
opacity: 1
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
}, [activeId, headings]);
|
|
1166
|
+
(0, import_react10.useEffect)(() => {
|
|
1167
|
+
if (headings.length === 0) return;
|
|
1168
|
+
if (observerRef.current) {
|
|
1169
|
+
observerRef.current.disconnect();
|
|
1170
|
+
}
|
|
1171
|
+
const callback = (entries) => {
|
|
1172
|
+
const visibleEntries = entries.filter((entry) => entry.isIntersecting);
|
|
1173
|
+
if (visibleEntries.length > 0) {
|
|
1174
|
+
const closest = visibleEntries.reduce((prev, curr) => {
|
|
1175
|
+
return Math.abs(curr.boundingClientRect.top - 100) < Math.abs(prev.boundingClientRect.top - 100) ? curr : prev;
|
|
1176
|
+
});
|
|
1177
|
+
setActiveId(closest.target.id);
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
observerRef.current = new IntersectionObserver(callback, {
|
|
1181
|
+
rootMargin: "-100px 0px -70% 0px",
|
|
1182
|
+
threshold: [0, 1]
|
|
1183
|
+
});
|
|
1184
|
+
const observeHeadings = () => {
|
|
1185
|
+
headings.forEach(({ id }) => {
|
|
1186
|
+
const el = document.getElementById(id);
|
|
1187
|
+
if (el) {
|
|
1188
|
+
observerRef.current.observe(el);
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
observeHeadings();
|
|
1193
|
+
const timeoutId = setTimeout(observeHeadings, 1e3);
|
|
1194
|
+
return () => {
|
|
1195
|
+
observerRef.current?.disconnect();
|
|
1196
|
+
clearTimeout(timeoutId);
|
|
1197
|
+
};
|
|
1198
|
+
}, [headings, location.pathname]);
|
|
1199
|
+
const handleClick = (0, import_react10.useCallback)(
|
|
1200
|
+
(e, id) => {
|
|
1201
|
+
e.preventDefault();
|
|
1202
|
+
const el = document.getElementById(id);
|
|
1203
|
+
if (el) {
|
|
1204
|
+
const offset = 80;
|
|
1205
|
+
const bodyRect = document.body.getBoundingClientRect().top;
|
|
1206
|
+
const elementRect = el.getBoundingClientRect().top;
|
|
1207
|
+
const elementPosition = elementRect - bodyRect;
|
|
1208
|
+
const offsetPosition = elementPosition - offset;
|
|
1209
|
+
window.scrollTo({
|
|
1210
|
+
top: offsetPosition,
|
|
1211
|
+
behavior: "smooth"
|
|
1212
|
+
});
|
|
1213
|
+
setActiveId(id);
|
|
1214
|
+
window.history.pushState(null, "", `#${id}`);
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
[]
|
|
1218
|
+
);
|
|
1219
|
+
if (headings.length === 0) return null;
|
|
1220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("nav", { className: "boltdocs-on-this-page", "aria-label": "Table of contents", children: [
|
|
1221
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "on-this-page-title", children: "On this page" }),
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "on-this-page-container", children: [
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "toc-indicator", style: indicatorStyle }),
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "on-this-page-list", ref: listRef, children: headings.map((h) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: h.level === 3 ? "toc-indent" : "", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1225
|
+
"a",
|
|
1226
|
+
{
|
|
1227
|
+
href: `#${h.id}`,
|
|
1228
|
+
className: `toc-link ${activeId === h.id ? "active" : ""}`,
|
|
1229
|
+
"aria-current": activeId === h.id ? "true" : void 0,
|
|
1230
|
+
onClick: (e) => handleClick(e, h.id),
|
|
1231
|
+
children: h.text
|
|
1232
|
+
}
|
|
1233
|
+
) }, h.id)) })
|
|
1234
|
+
] }),
|
|
1235
|
+
(editLink || communityHelp) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "toc-help", children: [
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "toc-help-title", children: "Need help?" }),
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("ul", { className: "toc-help-links", children: [
|
|
1238
|
+
editLink && filePath && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1239
|
+
"a",
|
|
1240
|
+
{
|
|
1241
|
+
href: editLink.replace(":path", filePath),
|
|
1242
|
+
target: "_blank",
|
|
1243
|
+
rel: "noopener noreferrer",
|
|
1244
|
+
className: "toc-help-link",
|
|
1245
|
+
children: [
|
|
1246
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Pencil, { size: 16 }),
|
|
1247
|
+
"Edit this page"
|
|
1248
|
+
]
|
|
1249
|
+
}
|
|
1250
|
+
) }),
|
|
1251
|
+
communityHelp && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1252
|
+
"a",
|
|
1253
|
+
{
|
|
1254
|
+
href: communityHelp,
|
|
1255
|
+
target: "_blank",
|
|
1256
|
+
rel: "noopener noreferrer",
|
|
1257
|
+
className: "toc-help-link",
|
|
1258
|
+
children: [
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.CircleHelp, { size: 16 }),
|
|
1260
|
+
"Community help"
|
|
1261
|
+
]
|
|
1262
|
+
}
|
|
1263
|
+
) })
|
|
1264
|
+
] })
|
|
1265
|
+
] })
|
|
1266
|
+
] });
|
|
1267
|
+
}
|
|
1268
|
+
var import_react10, import_react_router_dom5, import_lucide_react8, import_jsx_runtime14;
|
|
1269
|
+
var init_OnThisPage = __esm({
|
|
1270
|
+
"src/client/theme/ui/OnThisPage/OnThisPage.tsx"() {
|
|
1271
|
+
"use strict";
|
|
1272
|
+
import_react10 = require("react");
|
|
1273
|
+
import_react_router_dom5 = require("react-router-dom");
|
|
1274
|
+
import_lucide_react8 = require("lucide-react");
|
|
1275
|
+
import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
// src/client/theme/ui/OnThisPage/index.ts
|
|
1280
|
+
var init_OnThisPage2 = __esm({
|
|
1281
|
+
"src/client/theme/ui/OnThisPage/index.ts"() {
|
|
1282
|
+
"use strict";
|
|
1283
|
+
init_OnThisPage();
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
|
|
1287
|
+
// src/client/theme/ui/Head/Head.tsx
|
|
1288
|
+
function Head({ siteTitle, siteDescription, routes }) {
|
|
1289
|
+
const location = (0, import_react_router_dom6.useLocation)();
|
|
1290
|
+
(0, import_react11.useEffect)(() => {
|
|
1291
|
+
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
1292
|
+
const pageTitle = currentRoute?.title;
|
|
1293
|
+
const pageDescription = currentRoute?.description || siteDescription || "";
|
|
1294
|
+
document.title = pageTitle ? `${pageTitle} | ${siteTitle}` : siteTitle;
|
|
1295
|
+
let metaDesc = document.querySelector(
|
|
1296
|
+
'meta[name="description"]'
|
|
1297
|
+
);
|
|
1298
|
+
if (!metaDesc) {
|
|
1299
|
+
metaDesc = document.createElement("meta");
|
|
1300
|
+
metaDesc.name = "description";
|
|
1301
|
+
document.head.appendChild(metaDesc);
|
|
1302
|
+
}
|
|
1303
|
+
metaDesc.content = pageDescription;
|
|
1304
|
+
setMetaTag("property", "og:title", document.title);
|
|
1305
|
+
setMetaTag("property", "og:description", pageDescription);
|
|
1306
|
+
setMetaTag("property", "og:type", "article");
|
|
1307
|
+
setMetaTag("property", "og:url", window.location.href);
|
|
1308
|
+
setMetaTag("name", "twitter:card", "summary");
|
|
1309
|
+
setMetaTag("name", "twitter:title", document.title);
|
|
1310
|
+
setMetaTag("name", "twitter:description", pageDescription);
|
|
1311
|
+
let canonical = document.querySelector(
|
|
1312
|
+
'link[rel="canonical"]'
|
|
1313
|
+
);
|
|
1314
|
+
if (!canonical) {
|
|
1315
|
+
canonical = document.createElement("link");
|
|
1316
|
+
canonical.rel = "canonical";
|
|
1317
|
+
document.head.appendChild(canonical);
|
|
1318
|
+
}
|
|
1319
|
+
canonical.href = window.location.origin + location.pathname;
|
|
1320
|
+
}, [location.pathname, siteTitle, siteDescription, routes]);
|
|
1321
|
+
return null;
|
|
1322
|
+
}
|
|
1323
|
+
function setMetaTag(attr, key, content) {
|
|
1324
|
+
let tag = document.querySelector(
|
|
1325
|
+
`meta[${attr}="${key}"]`
|
|
1326
|
+
);
|
|
1327
|
+
if (!tag) {
|
|
1328
|
+
tag = document.createElement("meta");
|
|
1329
|
+
tag.setAttribute(attr, key);
|
|
1330
|
+
document.head.appendChild(tag);
|
|
1331
|
+
}
|
|
1332
|
+
tag.content = content;
|
|
1333
|
+
}
|
|
1334
|
+
var import_react11, import_react_router_dom6;
|
|
1335
|
+
var init_Head = __esm({
|
|
1336
|
+
"src/client/theme/ui/Head/Head.tsx"() {
|
|
1337
|
+
"use strict";
|
|
1338
|
+
import_react11 = require("react");
|
|
1339
|
+
import_react_router_dom6 = require("react-router-dom");
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
// src/client/theme/ui/Head/index.ts
|
|
1344
|
+
var init_Head2 = __esm({
|
|
1345
|
+
"src/client/theme/ui/Head/index.ts"() {
|
|
1346
|
+
"use strict";
|
|
1347
|
+
init_Head();
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
// src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx
|
|
1352
|
+
function Breadcrumbs({ routes, config }) {
|
|
1353
|
+
const location = (0, import_react_router_dom7.useLocation)();
|
|
1354
|
+
if (config.themeConfig?.breadcrumbs === false) return null;
|
|
1355
|
+
if (location.pathname === "/") return null;
|
|
1356
|
+
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
1357
|
+
const groupRoute = currentRoute?.group ? routes.find((r) => r.group === currentRoute.group) : null;
|
|
1358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: "boltdocs-breadcrumbs", "aria-label": "Breadcrumb", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ol", { className: "boltdocs-breadcrumbs-list", children: [
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "boltdocs-breadcrumbs-item", children: [
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { to: "/", className: "boltdocs-breadcrumbs-link", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react9.Home, { size: 14 }) }),
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "boltdocs-breadcrumbs-separator", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react9.ChevronRight, { size: 14 }) })
|
|
1362
|
+
] }),
|
|
1363
|
+
currentRoute?.groupTitle && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "boltdocs-breadcrumbs-item", children: [
|
|
1364
|
+
groupRoute ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { to: groupRoute.path, className: "boltdocs-breadcrumbs-link", children: currentRoute.groupTitle }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "boltdocs-breadcrumbs-text", children: currentRoute.groupTitle }),
|
|
1365
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "boltdocs-breadcrumbs-separator", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react9.ChevronRight, { size: 14 }) })
|
|
1366
|
+
] }),
|
|
1367
|
+
currentRoute?.title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: "boltdocs-breadcrumbs-item", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1368
|
+
"span",
|
|
1369
|
+
{
|
|
1370
|
+
className: "boltdocs-breadcrumbs-text boltdocs-breadcrumbs-active",
|
|
1371
|
+
"aria-current": "page",
|
|
1372
|
+
children: currentRoute.title
|
|
1373
|
+
}
|
|
1374
|
+
) })
|
|
1375
|
+
] }) });
|
|
1376
|
+
}
|
|
1377
|
+
var import_react_router_dom7, import_lucide_react9, import_jsx_runtime15;
|
|
1378
|
+
var init_Breadcrumbs = __esm({
|
|
1379
|
+
"src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx"() {
|
|
1380
|
+
"use strict";
|
|
1381
|
+
import_react_router_dom7 = require("react-router-dom");
|
|
1382
|
+
init_Link2();
|
|
1383
|
+
import_lucide_react9 = require("lucide-react");
|
|
1384
|
+
import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
|
|
1388
|
+
// src/client/theme/ui/Breadcrumbs/index.ts
|
|
1389
|
+
var init_Breadcrumbs2 = __esm({
|
|
1390
|
+
"src/client/theme/ui/Breadcrumbs/index.ts"() {
|
|
1391
|
+
"use strict";
|
|
1392
|
+
init_Breadcrumbs();
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
|
|
1396
|
+
// src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx
|
|
1397
|
+
function BackgroundGradient() {
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "boltdocs-background-glow", children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "glow-shape glow-1" }),
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "glow-shape glow-2" })
|
|
1401
|
+
] });
|
|
1402
|
+
}
|
|
1403
|
+
var import_jsx_runtime16;
|
|
1404
|
+
var init_BackgroundGradient = __esm({
|
|
1405
|
+
"src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx"() {
|
|
1406
|
+
"use strict";
|
|
1407
|
+
import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
// src/client/theme/ui/BackgroundGradient/index.ts
|
|
1412
|
+
var init_BackgroundGradient2 = __esm({
|
|
1413
|
+
"src/client/theme/ui/BackgroundGradient/index.ts"() {
|
|
1414
|
+
"use strict";
|
|
1415
|
+
init_BackgroundGradient();
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
// src/client/theme/styles.css
|
|
1420
|
+
var init_styles = __esm({
|
|
1421
|
+
"src/client/theme/styles.css"() {
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
// src/client/theme/ui/Layout/Layout.tsx
|
|
1426
|
+
function ThemeLayout({
|
|
1427
|
+
config,
|
|
1428
|
+
routes,
|
|
1429
|
+
children,
|
|
1430
|
+
navbar,
|
|
1431
|
+
sidebar,
|
|
1432
|
+
toc,
|
|
1433
|
+
background,
|
|
1434
|
+
head,
|
|
1435
|
+
breadcrumbs,
|
|
1436
|
+
className = "",
|
|
1437
|
+
style
|
|
1438
|
+
}) {
|
|
1439
|
+
const [isSidebarOpen, setIsSidebarOpen] = (0, import_react12.useState)(true);
|
|
1440
|
+
const siteTitle = config.themeConfig?.title || "Boltdocs";
|
|
1441
|
+
const siteDescription = config.themeConfig?.description || "";
|
|
1442
|
+
const location = (0, import_react_router_dom8.useLocation)();
|
|
1443
|
+
const currentIndex = routes.findIndex((r) => r.path === location.pathname);
|
|
1444
|
+
const currentRoute = routes[currentIndex];
|
|
1445
|
+
const currentLocale = config.i18n ? currentRoute?.locale || config.i18n.defaultLocale : void 0;
|
|
1446
|
+
const currentVersion = config.versions ? currentRoute?.version || config.versions.defaultVersion : void 0;
|
|
1447
|
+
const filteredRoutes = routes.filter((r) => {
|
|
1448
|
+
const localeMatch = config.i18n ? (r.locale || config.i18n.defaultLocale) === currentLocale : true;
|
|
1449
|
+
const versionMatch = config.versions ? (r.version || config.versions.defaultVersion) === currentVersion : true;
|
|
1450
|
+
return localeMatch && versionMatch;
|
|
1451
|
+
});
|
|
1452
|
+
const localIndex = filteredRoutes.findIndex(
|
|
1453
|
+
(r) => r.path === location.pathname
|
|
1454
|
+
);
|
|
1455
|
+
const prevPage = localIndex > 0 ? filteredRoutes[localIndex - 1] : null;
|
|
1456
|
+
const nextPage = localIndex >= 0 && localIndex < filteredRoutes.length - 1 ? filteredRoutes[localIndex + 1] : null;
|
|
1457
|
+
const { preload } = usePreload();
|
|
1458
|
+
import_react12.default.useEffect(() => {
|
|
1459
|
+
if (prevPage?.path) preload(prevPage.path);
|
|
1460
|
+
if (nextPage?.path) preload(nextPage.path);
|
|
1461
|
+
}, [prevPage, nextPage, preload]);
|
|
1462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `boltdocs-layout ${className}`, style, children: [
|
|
1463
|
+
background !== void 0 ? background : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BackgroundGradient, {}),
|
|
1464
|
+
head !== void 0 ? head : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1465
|
+
Head,
|
|
1466
|
+
{
|
|
1467
|
+
siteTitle,
|
|
1468
|
+
siteDescription,
|
|
1469
|
+
routes
|
|
1470
|
+
}
|
|
1471
|
+
),
|
|
1472
|
+
navbar !== void 0 ? navbar : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1473
|
+
Navbar,
|
|
1474
|
+
{
|
|
1475
|
+
config,
|
|
1476
|
+
routes: filteredRoutes,
|
|
1477
|
+
allRoutes: routes,
|
|
1478
|
+
currentLocale,
|
|
1479
|
+
currentVersion
|
|
1480
|
+
}
|
|
1481
|
+
),
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1483
|
+
"div",
|
|
1484
|
+
{
|
|
1485
|
+
className: `boltdocs-main-container ${!isSidebarOpen ? "sidebar-collapsed" : ""}`,
|
|
1486
|
+
children: [
|
|
1487
|
+
sidebar !== void 0 ? sidebar : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1488
|
+
Sidebar,
|
|
1489
|
+
{
|
|
1490
|
+
routes: filteredRoutes,
|
|
1491
|
+
config,
|
|
1492
|
+
onCollapse: () => setIsSidebarOpen(false)
|
|
1493
|
+
}
|
|
1494
|
+
),
|
|
1495
|
+
sidebar === void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1496
|
+
"button",
|
|
1497
|
+
{
|
|
1498
|
+
className: "sidebar-toggle-floating",
|
|
1499
|
+
onClick: () => setIsSidebarOpen(true),
|
|
1500
|
+
"aria-label": "Expand Sidebar",
|
|
1501
|
+
title: "Expand Sidebar",
|
|
1502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react10.Menu, { size: 20 })
|
|
1503
|
+
}
|
|
1504
|
+
),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("main", { className: "boltdocs-content", children: [
|
|
1506
|
+
breadcrumbs !== void 0 ? breadcrumbs : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Breadcrumbs, { routes: filteredRoutes, config }),
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "boltdocs-page", children }),
|
|
1508
|
+
(prevPage || nextPage) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("nav", { className: "page-nav", "aria-label": "Pagination", children: [
|
|
1509
|
+
prevPage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1510
|
+
Link,
|
|
1511
|
+
{
|
|
1512
|
+
to: prevPage.path || "/",
|
|
1513
|
+
className: "page-nav-link page-nav-link--prev",
|
|
1514
|
+
children: [
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "page-nav-info", children: [
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "page-nav-label", children: "Previous" }),
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "page-nav-title", children: prevPage.title })
|
|
1518
|
+
] }),
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react10.ChevronLeft, { className: "page-nav-arrow", size: 16 })
|
|
1520
|
+
]
|
|
1521
|
+
}
|
|
1522
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", {}),
|
|
1523
|
+
nextPage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1524
|
+
Link,
|
|
1525
|
+
{
|
|
1526
|
+
to: nextPage.path || "/",
|
|
1527
|
+
className: "page-nav-link page-nav-link--next",
|
|
1528
|
+
children: [
|
|
1529
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "page-nav-info", children: [
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "page-nav-label", children: "Next" }),
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "page-nav-title", children: nextPage.title })
|
|
1532
|
+
] }),
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react10.ChevronRight, { className: "page-nav-arrow", size: 16 })
|
|
1534
|
+
]
|
|
1535
|
+
}
|
|
1536
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", {})
|
|
1537
|
+
] })
|
|
1538
|
+
] }),
|
|
1539
|
+
toc !== void 0 ? toc : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1540
|
+
OnThisPage,
|
|
1541
|
+
{
|
|
1542
|
+
headings: routes[currentIndex]?.headings,
|
|
1543
|
+
editLink: config.themeConfig?.editLink,
|
|
1544
|
+
communityHelp: config.themeConfig?.communityHelp,
|
|
1545
|
+
filePath: routes[currentIndex]?.filePath
|
|
1546
|
+
}
|
|
1547
|
+
)
|
|
1548
|
+
]
|
|
1549
|
+
}
|
|
1550
|
+
)
|
|
1551
|
+
] });
|
|
1552
|
+
}
|
|
1553
|
+
var import_react12, import_react_router_dom8, import_lucide_react10, import_jsx_runtime17;
|
|
1554
|
+
var init_Layout = __esm({
|
|
1555
|
+
"src/client/theme/ui/Layout/Layout.tsx"() {
|
|
1556
|
+
"use strict";
|
|
1557
|
+
import_react12 = __toESM(require("react"));
|
|
1558
|
+
import_react_router_dom8 = require("react-router-dom");
|
|
1559
|
+
init_Link2();
|
|
1560
|
+
import_lucide_react10 = require("lucide-react");
|
|
1561
|
+
init_preload();
|
|
1562
|
+
init_Navbar2();
|
|
1563
|
+
init_Sidebar2();
|
|
1564
|
+
init_OnThisPage2();
|
|
1565
|
+
init_Head2();
|
|
1566
|
+
init_Breadcrumbs2();
|
|
1567
|
+
init_BackgroundGradient2();
|
|
1568
|
+
init_Navbar2();
|
|
1569
|
+
init_Sidebar2();
|
|
1570
|
+
init_OnThisPage2();
|
|
1571
|
+
init_Head2();
|
|
1572
|
+
init_Breadcrumbs2();
|
|
1573
|
+
init_BackgroundGradient2();
|
|
1574
|
+
init_styles();
|
|
1575
|
+
import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
// src/client/theme/ui/Layout/index.ts
|
|
1580
|
+
var init_Layout2 = __esm({
|
|
1581
|
+
"src/client/theme/ui/Layout/index.ts"() {
|
|
1582
|
+
"use strict";
|
|
1583
|
+
init_Layout();
|
|
1584
|
+
}
|
|
1585
|
+
});
|
|
1586
|
+
|
|
1587
|
+
// src/client/theme/ui/NotFound/NotFound.tsx
|
|
1588
|
+
function NotFound() {
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "boltdocs-not-found", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "not-found-content", children: [
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "not-found-code", children: "404" }),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { className: "not-found-title", children: "Page Not Found" }),
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "not-found-text", children: "The page you're looking for doesn't exist or has been moved." }),
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Link, { to: "/", className: "not-found-link", children: [
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react11.ArrowLeft, { size: 16 }),
|
|
1595
|
+
" Go to Home"
|
|
1596
|
+
] })
|
|
1597
|
+
] }) });
|
|
1598
|
+
}
|
|
1599
|
+
var import_lucide_react11, import_jsx_runtime18;
|
|
1600
|
+
var init_NotFound = __esm({
|
|
1601
|
+
"src/client/theme/ui/NotFound/NotFound.tsx"() {
|
|
1602
|
+
"use strict";
|
|
1603
|
+
init_Link2();
|
|
1604
|
+
import_lucide_react11 = require("lucide-react");
|
|
1605
|
+
import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
|
|
1609
|
+
// src/client/theme/ui/NotFound/index.ts
|
|
1610
|
+
var init_NotFound2 = __esm({
|
|
1611
|
+
"src/client/theme/ui/NotFound/index.ts"() {
|
|
1612
|
+
"use strict";
|
|
1613
|
+
init_NotFound();
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
|
|
1617
|
+
// src/client/theme/ui/Loading/Loading.tsx
|
|
1618
|
+
function Loading() {
|
|
1619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "boltdocs-loading", children: [
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "loading-spinner" }),
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "loading-text", children: "Loading..." })
|
|
1622
|
+
] });
|
|
1623
|
+
}
|
|
1624
|
+
var import_jsx_runtime19;
|
|
1625
|
+
var init_Loading = __esm({
|
|
1626
|
+
"src/client/theme/ui/Loading/Loading.tsx"() {
|
|
1627
|
+
"use strict";
|
|
1628
|
+
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
|
|
1632
|
+
// src/client/theme/ui/Loading/index.ts
|
|
1633
|
+
var init_Loading2 = __esm({
|
|
1634
|
+
"src/client/theme/ui/Loading/index.ts"() {
|
|
1635
|
+
"use strict";
|
|
1636
|
+
init_Loading();
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
// src/client/theme/components/mdx/Button.tsx
|
|
1641
|
+
function Button({
|
|
1642
|
+
variant = "primary",
|
|
1643
|
+
size = "md",
|
|
1644
|
+
href,
|
|
1645
|
+
children,
|
|
1646
|
+
className = "",
|
|
1647
|
+
...rest
|
|
1648
|
+
}) {
|
|
1649
|
+
const cls = `ld-btn ld-btn--${variant} ld-btn--${size} ${className}`.trim();
|
|
1650
|
+
if (href) {
|
|
1651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1652
|
+
"a",
|
|
1653
|
+
{
|
|
1654
|
+
href,
|
|
1655
|
+
style: { textDecoration: "none" },
|
|
1656
|
+
className: cls,
|
|
1657
|
+
...rest,
|
|
1658
|
+
children
|
|
1659
|
+
}
|
|
1660
|
+
);
|
|
1661
|
+
}
|
|
1662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: cls, ...rest, children });
|
|
1663
|
+
}
|
|
1664
|
+
var import_jsx_runtime20;
|
|
1665
|
+
var init_Button = __esm({
|
|
1666
|
+
"src/client/theme/components/mdx/Button.tsx"() {
|
|
1667
|
+
"use strict";
|
|
1668
|
+
import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
|
|
1672
|
+
// src/client/theme/components/mdx/Badge.tsx
|
|
1673
|
+
function Badge({
|
|
1674
|
+
variant = "default",
|
|
1675
|
+
children,
|
|
1676
|
+
className = "",
|
|
1677
|
+
...rest
|
|
1678
|
+
}) {
|
|
1679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1680
|
+
"span",
|
|
1681
|
+
{
|
|
1682
|
+
className: `ld-badge ld-badge--${variant} ${className}`.trim(),
|
|
1683
|
+
...rest,
|
|
1684
|
+
children
|
|
1685
|
+
}
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
var import_jsx_runtime21;
|
|
1689
|
+
var init_Badge = __esm({
|
|
1690
|
+
"src/client/theme/components/mdx/Badge.tsx"() {
|
|
1691
|
+
"use strict";
|
|
1692
|
+
import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
// src/client/theme/components/mdx/Card.tsx
|
|
1697
|
+
function Cards({
|
|
1698
|
+
cols = 3,
|
|
1699
|
+
children,
|
|
1700
|
+
className = "",
|
|
1701
|
+
...rest
|
|
1702
|
+
}) {
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `ld-cards ld-cards--${cols} ${className}`.trim(), ...rest, children });
|
|
1704
|
+
}
|
|
1705
|
+
function Card({
|
|
1706
|
+
title,
|
|
1707
|
+
icon,
|
|
1708
|
+
href,
|
|
1709
|
+
children,
|
|
1710
|
+
className = "",
|
|
1711
|
+
...rest
|
|
1712
|
+
}) {
|
|
1713
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1714
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ld-card__icon", children: icon }),
|
|
1715
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "ld-card__title", children: title }),
|
|
1716
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ld-card__body", children })
|
|
1717
|
+
] });
|
|
1718
|
+
if (href) {
|
|
1719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1720
|
+
"a",
|
|
1721
|
+
{
|
|
1722
|
+
href,
|
|
1723
|
+
className: `ld-card ld-card--link ${className}`.trim(),
|
|
1724
|
+
...rest,
|
|
1725
|
+
children: inner
|
|
1726
|
+
}
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `ld-card ${className}`.trim(), ...rest, children: inner });
|
|
1730
|
+
}
|
|
1731
|
+
var import_jsx_runtime22;
|
|
1732
|
+
var init_Card = __esm({
|
|
1733
|
+
"src/client/theme/components/mdx/Card.tsx"() {
|
|
1734
|
+
"use strict";
|
|
1735
|
+
import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
|
|
1739
|
+
// src/client/theme/components/mdx/Tabs.tsx
|
|
1740
|
+
function Tab({ children }) {
|
|
1741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "ld-tab-panel", children });
|
|
1742
|
+
}
|
|
1743
|
+
function Tabs({ defaultIndex = 0, children }) {
|
|
1744
|
+
const [active, setActive] = (0, import_react13.useState)(defaultIndex);
|
|
1745
|
+
const tabRefs = (0, import_react13.useRef)([]);
|
|
1746
|
+
const tabs = import_react13.Children.toArray(children).filter(
|
|
1747
|
+
(child) => (0, import_react13.isValidElement)(child) && child.props?.label
|
|
1748
|
+
);
|
|
1749
|
+
const handleKeyDown = (e) => {
|
|
1750
|
+
let newIndex = active;
|
|
1751
|
+
if (e.key === "ArrowRight") {
|
|
1752
|
+
newIndex = (active + 1) % tabs.length;
|
|
1753
|
+
} else if (e.key === "ArrowLeft") {
|
|
1754
|
+
newIndex = (active - 1 + tabs.length) % tabs.length;
|
|
1755
|
+
}
|
|
1756
|
+
if (newIndex !== active) {
|
|
1757
|
+
setActive(newIndex);
|
|
1758
|
+
tabRefs.current[newIndex]?.focus();
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "ld-tabs", children: [
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "ld-tabs__bar", role: "tablist", onKeyDown: handleKeyDown, children: tabs.map((child, i) => {
|
|
1763
|
+
const label = child.props.label;
|
|
1764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1765
|
+
"button",
|
|
1766
|
+
{
|
|
1767
|
+
role: "tab",
|
|
1768
|
+
"aria-selected": i === active,
|
|
1769
|
+
"aria-controls": `tabpanel-${i}`,
|
|
1770
|
+
id: `tab-${i}`,
|
|
1771
|
+
tabIndex: i === active ? 0 : -1,
|
|
1772
|
+
ref: (el) => {
|
|
1773
|
+
tabRefs.current[i] = el;
|
|
1774
|
+
},
|
|
1775
|
+
className: `ld-tabs__trigger ${i === active ? "ld-tabs__trigger--active" : ""}`,
|
|
1776
|
+
onClick: () => setActive(i),
|
|
1777
|
+
children: label
|
|
1778
|
+
},
|
|
1779
|
+
i
|
|
1780
|
+
);
|
|
1781
|
+
}) }),
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
className: "ld-tabs__content",
|
|
1786
|
+
role: "tabpanel",
|
|
1787
|
+
id: `tabpanel-${active}`,
|
|
1788
|
+
"aria-labelledby": `tab-${active}`,
|
|
1789
|
+
children: tabs[active]
|
|
1790
|
+
}
|
|
1791
|
+
)
|
|
1792
|
+
] });
|
|
1793
|
+
}
|
|
1794
|
+
var import_react13, import_jsx_runtime23;
|
|
1795
|
+
var init_Tabs = __esm({
|
|
1796
|
+
"src/client/theme/components/mdx/Tabs.tsx"() {
|
|
1797
|
+
"use strict";
|
|
1798
|
+
import_react13 = require("react");
|
|
1799
|
+
import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
// src/client/theme/components/mdx/Admonition.tsx
|
|
1804
|
+
function Admonition({
|
|
1805
|
+
type = "note",
|
|
1806
|
+
title,
|
|
1807
|
+
children,
|
|
1808
|
+
className = "",
|
|
1809
|
+
...rest
|
|
1810
|
+
}) {
|
|
1811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1812
|
+
"div",
|
|
1813
|
+
{
|
|
1814
|
+
className: `ld-admonition ld-admonition--${type} ${className}`.trim(),
|
|
1815
|
+
role: type === "warning" || type === "danger" ? "alert" : "note",
|
|
1816
|
+
...rest,
|
|
1817
|
+
children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ld-admonition__header", children: [
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ld-admonition__icon", children: ICON_MAP2[type] }),
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ld-admonition__title", children: title || LABEL_MAP[type] })
|
|
1821
|
+
] }),
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "ld-admonition__body", children })
|
|
1823
|
+
]
|
|
1824
|
+
}
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
var import_lucide_react12, import_jsx_runtime24, ICON_MAP2, LABEL_MAP, Note, Tip, Warning, Danger, InfoBox;
|
|
1828
|
+
var init_Admonition = __esm({
|
|
1829
|
+
"src/client/theme/components/mdx/Admonition.tsx"() {
|
|
1830
|
+
"use strict";
|
|
1831
|
+
import_lucide_react12 = require("lucide-react");
|
|
1832
|
+
import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1833
|
+
ICON_MAP2 = {
|
|
1834
|
+
note: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Bookmark, { size: 18 }),
|
|
1835
|
+
tip: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Lightbulb, { size: 18 }),
|
|
1836
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Info, { size: 18 }),
|
|
1837
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.AlertTriangle, { size: 18 }),
|
|
1838
|
+
danger: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.ShieldAlert, { size: 18 })
|
|
1839
|
+
};
|
|
1840
|
+
LABEL_MAP = {
|
|
1841
|
+
note: "Note",
|
|
1842
|
+
tip: "Tip",
|
|
1843
|
+
info: "Info",
|
|
1844
|
+
warning: "Warning",
|
|
1845
|
+
danger: "Danger"
|
|
1846
|
+
};
|
|
1847
|
+
Note = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Admonition, { type: "note", ...props });
|
|
1848
|
+
Tip = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Admonition, { type: "tip", ...props });
|
|
1849
|
+
Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Admonition, { type: "warning", ...props });
|
|
1850
|
+
Danger = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Admonition, { type: "danger", ...props });
|
|
1851
|
+
InfoBox = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Admonition, { type: "info", ...props });
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
// src/client/theme/components/mdx/List.tsx
|
|
1856
|
+
function List({
|
|
1857
|
+
variant = "default",
|
|
1858
|
+
children,
|
|
1859
|
+
className = "",
|
|
1860
|
+
...rest
|
|
1861
|
+
}) {
|
|
1862
|
+
if (variant === "default") {
|
|
1863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: `ld-list ${className}`.trim(), ...rest, children });
|
|
1864
|
+
}
|
|
1865
|
+
const icon = ICON_MAP3[variant];
|
|
1866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: `ld-list ld-list--${variant} ${className}`.trim(), ...rest, children: import_react14.Children.map(children, (child) => {
|
|
1867
|
+
if (!import_react14.default.isValidElement(child)) return child;
|
|
1868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("li", { className: "ld-list__item", children: [
|
|
1869
|
+
icon,
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ld-list__text", children: child.props.children })
|
|
1871
|
+
] });
|
|
1872
|
+
}) });
|
|
1873
|
+
}
|
|
1874
|
+
var import_react14, import_lucide_react13, import_jsx_runtime25, ICON_MAP3;
|
|
1875
|
+
var init_List = __esm({
|
|
1876
|
+
"src/client/theme/components/mdx/List.tsx"() {
|
|
1877
|
+
"use strict";
|
|
1878
|
+
import_react14 = __toESM(require("react"));
|
|
1879
|
+
import_lucide_react13 = require("lucide-react");
|
|
1880
|
+
import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1881
|
+
ICON_MAP3 = {
|
|
1882
|
+
checked: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.Check, { size: 14, className: "ld-list__icon" }),
|
|
1883
|
+
arrow: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.ChevronRight, { size: 14, className: "ld-list__icon" })
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
});
|
|
1887
|
+
|
|
1888
|
+
// src/client/theme/components/mdx/index.ts
|
|
1889
|
+
var init_mdx = __esm({
|
|
1890
|
+
"src/client/theme/components/mdx/index.ts"() {
|
|
1891
|
+
"use strict";
|
|
1892
|
+
init_Button();
|
|
1893
|
+
init_Badge();
|
|
1894
|
+
init_Card();
|
|
1895
|
+
init_Tabs();
|
|
1896
|
+
init_Admonition();
|
|
1897
|
+
init_List();
|
|
1898
|
+
}
|
|
1899
|
+
});
|
|
1900
|
+
|
|
1901
|
+
// src/client/theme/components/CodeBlock/CodeBlock.tsx
|
|
1902
|
+
function CodeBlock({ children, ...props }) {
|
|
1903
|
+
const [copied, setCopied] = (0, import_react15.useState)(false);
|
|
1904
|
+
const preRef = (0, import_react15.useRef)(null);
|
|
1905
|
+
let language = "";
|
|
1906
|
+
if (import_react15.default.isValidElement(children)) {
|
|
1907
|
+
const childProps = children.props;
|
|
1908
|
+
language = childProps?.["data-language"] || "";
|
|
1909
|
+
if (!language && childProps?.className) {
|
|
1910
|
+
const match = childProps.className.match(/language-(\w+)/);
|
|
1911
|
+
if (match) language = match[1];
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
const handleCopy = (0, import_react15.useCallback)(async () => {
|
|
1915
|
+
const code = preRef.current?.textContent || "";
|
|
1916
|
+
try {
|
|
1917
|
+
await navigator.clipboard.writeText(code);
|
|
1918
|
+
setCopied(true);
|
|
1919
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
1920
|
+
} catch {
|
|
1921
|
+
const textarea = document.createElement("textarea");
|
|
1922
|
+
textarea.value = code;
|
|
1923
|
+
textarea.style.position = "fixed";
|
|
1924
|
+
textarea.style.opacity = "0";
|
|
1925
|
+
document.body.appendChild(textarea);
|
|
1926
|
+
textarea.select();
|
|
1927
|
+
document.execCommand("copy");
|
|
1928
|
+
document.body.removeChild(textarea);
|
|
1929
|
+
setCopied(true);
|
|
1930
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
1931
|
+
}
|
|
1932
|
+
}, []);
|
|
1933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "code-block-wrapper", children: [
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "code-block-header", children: [
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "code-block-lang", children: language || "code" }),
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1937
|
+
"button",
|
|
1938
|
+
{
|
|
1939
|
+
className: `code-block-copy ${copied ? "copied" : ""}`,
|
|
1940
|
+
onClick: handleCopy,
|
|
1941
|
+
type: "button",
|
|
1942
|
+
"aria-label": "Copy code",
|
|
1943
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.Check, { size: 20 }) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.Copy, { size: 20 }) })
|
|
1944
|
+
}
|
|
1945
|
+
)
|
|
1946
|
+
] }),
|
|
1947
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("pre", { ref: preRef, ...props, children })
|
|
1948
|
+
] });
|
|
1949
|
+
}
|
|
1950
|
+
var import_react15, import_lucide_react14, import_jsx_runtime26;
|
|
1951
|
+
var init_CodeBlock = __esm({
|
|
1952
|
+
"src/client/theme/components/CodeBlock/CodeBlock.tsx"() {
|
|
1953
|
+
"use strict";
|
|
1954
|
+
import_react15 = __toESM(require("react"));
|
|
1955
|
+
import_lucide_react14 = require("lucide-react");
|
|
1956
|
+
import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
|
|
1960
|
+
// src/client/theme/components/CodeBlock/index.ts
|
|
1961
|
+
var CodeBlock_exports = {};
|
|
1962
|
+
__export(CodeBlock_exports, {
|
|
1963
|
+
CodeBlock: () => CodeBlock
|
|
1964
|
+
});
|
|
1965
|
+
var init_CodeBlock2 = __esm({
|
|
1966
|
+
"src/client/theme/components/CodeBlock/index.ts"() {
|
|
1967
|
+
"use strict";
|
|
1968
|
+
init_CodeBlock();
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
|
|
1972
|
+
// src/client/theme/components/Video/Video.tsx
|
|
1973
|
+
function Video({
|
|
1974
|
+
src,
|
|
1975
|
+
poster,
|
|
1976
|
+
alt,
|
|
1977
|
+
children,
|
|
1978
|
+
controls,
|
|
1979
|
+
preload = "metadata",
|
|
1980
|
+
...rest
|
|
1981
|
+
}) {
|
|
1982
|
+
const containerRef = (0, import_react16.useRef)(null);
|
|
1983
|
+
const [isVisible, setIsVisible] = (0, import_react16.useState)(false);
|
|
1984
|
+
(0, import_react16.useEffect)(() => {
|
|
1985
|
+
const el = containerRef.current;
|
|
1986
|
+
if (!el) return;
|
|
1987
|
+
const observer = new IntersectionObserver(
|
|
1988
|
+
([entry]) => {
|
|
1989
|
+
if (entry.isIntersecting) {
|
|
1990
|
+
setIsVisible(true);
|
|
1991
|
+
observer.disconnect();
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
{ rootMargin: "200px" }
|
|
1995
|
+
);
|
|
1996
|
+
observer.observe(el);
|
|
1997
|
+
return () => observer.disconnect();
|
|
1998
|
+
}, []);
|
|
1999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: containerRef, className: "boltdocs-video-wrapper", children: isVisible ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2000
|
+
"video",
|
|
2001
|
+
{
|
|
2002
|
+
className: "boltdocs-video",
|
|
2003
|
+
src,
|
|
2004
|
+
poster,
|
|
2005
|
+
controls: true,
|
|
2006
|
+
preload,
|
|
2007
|
+
playsInline: true,
|
|
2008
|
+
...rest,
|
|
2009
|
+
children: [
|
|
2010
|
+
children,
|
|
2011
|
+
"Your browser does not support the video tag."
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2015
|
+
"div",
|
|
2016
|
+
{
|
|
2017
|
+
className: "boltdocs-video-placeholder",
|
|
2018
|
+
role: "img",
|
|
2019
|
+
"aria-label": alt || "Video"
|
|
2020
|
+
}
|
|
2021
|
+
) });
|
|
2022
|
+
}
|
|
2023
|
+
var import_react16, import_jsx_runtime27;
|
|
2024
|
+
var init_Video = __esm({
|
|
2025
|
+
"src/client/theme/components/Video/Video.tsx"() {
|
|
2026
|
+
"use strict";
|
|
2027
|
+
import_react16 = require("react");
|
|
2028
|
+
import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2029
|
+
}
|
|
2030
|
+
});
|
|
2031
|
+
|
|
2032
|
+
// src/client/theme/components/Video/index.ts
|
|
2033
|
+
var Video_exports = {};
|
|
2034
|
+
__export(Video_exports, {
|
|
2035
|
+
Video: () => Video
|
|
2036
|
+
});
|
|
2037
|
+
var init_Video2 = __esm({
|
|
2038
|
+
"src/client/theme/components/Video/index.ts"() {
|
|
2039
|
+
"use strict";
|
|
2040
|
+
init_Video();
|
|
2041
|
+
}
|
|
2042
|
+
});
|
|
2043
|
+
|
|
2044
|
+
// src/client/theme/icons/npm.tsx
|
|
2045
|
+
var import_jsx_runtime28, NPM;
|
|
2046
|
+
var init_npm = __esm({
|
|
2047
|
+
"src/client/theme/icons/npm.tsx"() {
|
|
2048
|
+
"use strict";
|
|
2049
|
+
import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2050
|
+
NPM = (props) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { ...props, viewBox: "0 0 2500 2500", children: [
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { fill: "#c00", d: "M0 0h2500v2500H0z" }),
|
|
2052
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2053
|
+
"path",
|
|
2054
|
+
{
|
|
2055
|
+
fill: "#fff",
|
|
2056
|
+
d: "M1241.5 268.5h-973v1962.9h972.9V763.5h495v1467.9h495V268.5z"
|
|
2057
|
+
}
|
|
2058
|
+
)
|
|
2059
|
+
] });
|
|
2060
|
+
}
|
|
2061
|
+
});
|
|
2062
|
+
|
|
2063
|
+
// src/client/theme/icons/pnpm.tsx
|
|
2064
|
+
var import_jsx_runtime29, Pnpm;
|
|
2065
|
+
var init_pnpm = __esm({
|
|
2066
|
+
"src/client/theme/icons/pnpm.tsx"() {
|
|
2067
|
+
"use strict";
|
|
2068
|
+
import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2069
|
+
Pnpm = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2070
|
+
"svg",
|
|
2071
|
+
{
|
|
2072
|
+
...props,
|
|
2073
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
2074
|
+
viewBox: "76.58987244897958 44 164.00775510204068 164",
|
|
2075
|
+
children: [
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("defs", { children: [
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2078
|
+
"path",
|
|
2079
|
+
{
|
|
2080
|
+
d: "M237.6 95L187.6 95L187.6 45L237.6 45L237.6 95Z",
|
|
2081
|
+
id: "pnpm_dark__b45vdTD8hs"
|
|
2082
|
+
}
|
|
2083
|
+
),
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2085
|
+
"path",
|
|
2086
|
+
{
|
|
2087
|
+
d: "M182.59 95L132.59 95L132.59 45L182.59 45L182.59 95Z",
|
|
2088
|
+
id: "pnpm_dark__a40WtxIl8d"
|
|
2089
|
+
}
|
|
2090
|
+
),
|
|
2091
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2092
|
+
"path",
|
|
2093
|
+
{
|
|
2094
|
+
d: "M127.59 95L77.59 95L77.59 45L127.59 45L127.59 95Z",
|
|
2095
|
+
id: "pnpm_dark__h2CN9AEEpe"
|
|
2096
|
+
}
|
|
2097
|
+
),
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2099
|
+
"path",
|
|
2100
|
+
{
|
|
2101
|
+
d: "M237.6 150L187.6 150L187.6 100L237.6 100L237.6 150Z",
|
|
2102
|
+
id: "pnpm_dark__dqv5133G8"
|
|
2103
|
+
}
|
|
2104
|
+
),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2106
|
+
"path",
|
|
2107
|
+
{
|
|
2108
|
+
d: "M182.59 150L132.59 150L132.59 100L182.59 100L182.59 150Z",
|
|
2109
|
+
id: "pnpm_dark__b1Lv79ypvm"
|
|
2110
|
+
}
|
|
2111
|
+
),
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2113
|
+
"path",
|
|
2114
|
+
{
|
|
2115
|
+
d: "M182.59 205L132.59 205L132.59 155L182.59 155L182.59 205Z",
|
|
2116
|
+
id: "pnpm_dark__hy1IZWwLX"
|
|
2117
|
+
}
|
|
2118
|
+
),
|
|
2119
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2120
|
+
"path",
|
|
2121
|
+
{
|
|
2122
|
+
d: "M237.6 205L187.6 205L187.6 155L237.6 155L237.6 205Z",
|
|
2123
|
+
id: "pnpm_dark__akQfjxQes"
|
|
2124
|
+
}
|
|
2125
|
+
),
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2127
|
+
"path",
|
|
2128
|
+
{
|
|
2129
|
+
d: "M127.59 205L77.59 205L77.59 155L127.59 155L127.59 205Z",
|
|
2130
|
+
id: "pnpm_dark__bdSrwE5pk"
|
|
2131
|
+
}
|
|
2132
|
+
)
|
|
2133
|
+
] }),
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("g", { children: [
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__b45vdTD8hs", fill: "#f9ad00" }) }),
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__a40WtxIl8d", fill: "#f9ad00" }) }),
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__h2CN9AEEpe", fill: "#f9ad00" }) }),
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__dqv5133G8", fill: "#f9ad00" }) }),
|
|
2139
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__b1Lv79ypvm", fill: "currentColor" }) }),
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__hy1IZWwLX", fill: "currentColor" }) }),
|
|
2141
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__akQfjxQes", fill: "currentColor" }) }),
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("use", { xlinkHref: "#pnpm_dark__bdSrwE5pk", fill: "currentColor" }) })
|
|
2143
|
+
] })
|
|
2144
|
+
]
|
|
2145
|
+
}
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
|
|
2150
|
+
// src/client/theme/icons/bun.tsx
|
|
2151
|
+
var import_jsx_runtime30, Bun;
|
|
2152
|
+
var init_bun = __esm({
|
|
2153
|
+
"src/client/theme/icons/bun.tsx"() {
|
|
2154
|
+
"use strict";
|
|
2155
|
+
import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2156
|
+
Bun = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("svg", { ...props, viewBox: "0 0 80 70", children: [
|
|
2157
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M71.09 20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46 26.46 0 0 1 75.5 35.7c0 16.57-16.82 30.05-37.5 30.05-11.58 0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55 65.3 30.14 69.75 42 69.75c20.68 0 37.5-13.48 37.5-30 0-7.06-3.04-13.75-8.41-19.01Z" }),
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2159
|
+
"path",
|
|
2160
|
+
{
|
|
2161
|
+
d: "M73 35.7c0 15.21-15.67 27.54-35 27.54S3 50.91 3 35.7C3 26.27 9 17.94 18.22 13S33.18 3 38 3s8.94 4.13 19.78 10C67 17.94 73 26.27 73 35.7Z",
|
|
2162
|
+
style: { fill: "#fbf0df" }
|
|
2163
|
+
}
|
|
2164
|
+
),
|
|
2165
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2166
|
+
"path",
|
|
2167
|
+
{
|
|
2168
|
+
d: "M73 35.7a21.67 21.67 0 0 0-.8-5.78c-2.73 33.3-43.35 34.9-59.32 24.94A40 40 0 0 0 38 63.24c19.3 0 35-12.35 35-27.54Z",
|
|
2169
|
+
style: { fill: "#f6dece" }
|
|
2170
|
+
}
|
|
2171
|
+
),
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2173
|
+
"path",
|
|
2174
|
+
{
|
|
2175
|
+
d: "M24.53 11.17C29 8.49 34.94 3.46 40.78 3.45A9.29 9.29 0 0 0 38 3c-2.42 0-5 1.25-8.25 3.13-1.13.66-2.3 1.39-3.54 2.15-2.33 1.44-5 3.07-8 4.7C8.69 18.13 3 26.62 3 35.7v1.19c6.06-21.41 17.07-23.04 21.53-25.72Z",
|
|
2176
|
+
style: { fill: "#fffefc" }
|
|
2177
|
+
}
|
|
2178
|
+
),
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2180
|
+
"path",
|
|
2181
|
+
{
|
|
2182
|
+
d: "M35.12 5.53A16.41 16.41 0 0 1 29.49 18c-.28.25-.06.73.3.59 3.37-1.31 7.92-5.23 6-13.14-.08-.45-.67-.33-.67.08Zm2.27 0A16.24 16.24 0 0 1 39 19c-.12.35.31.65.55.36 2.19-2.8 4.1-8.36-1.62-14.36-.29-.26-.74.14-.54.49Zm2.76-.17A16.42 16.42 0 0 1 47 17.12a.33.33 0 0 0 .65.11c.92-3.49.4-9.44-7.17-12.53-.4-.16-.66.38-.33.62Zm-18.46 10.4a16.94 16.94 0 0 0 10.47-9c.18-.36.75-.22.66.18-1.73 8-7.52 9.67-11.12 9.45-.38.01-.37-.52-.01-.63Z",
|
|
2183
|
+
style: { fill: "#ccbea7", fillRule: "evenodd" }
|
|
2184
|
+
}
|
|
2185
|
+
),
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M38 65.75C17.32 65.75.5 52.27.5 35.7c0-10 6.18-19.33 16.53-24.92 3-1.6 5.57-3.21 7.86-4.62 1.26-.78 2.45-1.51 3.6-2.19C32 1.89 35 .5 38 .5s5.62 1.2 8.9 3.14c1 .57 2 1.19 3.07 1.87 2.49 1.54 5.3 3.28 9 5.27C69.32 16.37 75.5 25.69 75.5 35.7c0 16.57-16.82 30.05-37.5 30.05ZM38 3c-2.42 0-5 1.25-8.25 3.13-1.13.66-2.3 1.39-3.54 2.15-2.33 1.44-5 3.07-8 4.7C8.69 18.13 3 26.62 3 35.7c0 15.19 15.7 27.55 35 27.55S73 50.89 73 35.7c0-9.08-5.69-17.57-15.22-22.7-3.78-2-6.73-3.88-9.12-5.36-1.09-.67-2.09-1.29-3-1.84C42.63 4 40.42 3 38 3Z" }),
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2189
|
+
"path",
|
|
2190
|
+
{
|
|
2191
|
+
d: "M45.05 43a8.93 8.93 0 0 1-2.92 4.71 6.81 6.81 0 0 1-4 1.88A6.84 6.84 0 0 1 34 47.71 8.93 8.93 0 0 1 31.12 43a.72.72 0 0 1 .8-.81h12.34a.72.72 0 0 1 .79.81Z",
|
|
2192
|
+
style: { fill: "#b71422" }
|
|
2193
|
+
}
|
|
2194
|
+
),
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2196
|
+
"path",
|
|
2197
|
+
{
|
|
2198
|
+
d: "M34 47.79a6.91 6.91 0 0 0 4.12 1.9 6.91 6.91 0 0 0 4.11-1.9 10.63 10.63 0 0 0 1-1.07 6.83 6.83 0 0 0-4.9-2.31 6.15 6.15 0 0 0-5 2.78c.23.21.43.41.67.6Z",
|
|
2199
|
+
style: { fill: "#ff6164" }
|
|
2200
|
+
}
|
|
2201
|
+
),
|
|
2202
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M34.16 47a5.36 5.36 0 0 1 4.19-2.08 6 6 0 0 1 4 1.69c.23-.25.45-.51.66-.77a7 7 0 0 0-4.71-1.93 6.36 6.36 0 0 0-4.89 2.36 9.53 9.53 0 0 0 .75.73Z" }),
|
|
2203
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M38.09 50.19a7.42 7.42 0 0 1-4.45-2 9.52 9.52 0 0 1-3.11-5.05 1.2 1.2 0 0 1 .26-1 1.41 1.41 0 0 1 1.13-.51h12.34a1.44 1.44 0 0 1 1.13.51 1.19 1.19 0 0 1 .25 1 9.52 9.52 0 0 1-3.11 5.05 7.42 7.42 0 0 1-4.44 2Zm-6.17-7.4c-.16 0-.2.07-.21.09a8.29 8.29 0 0 0 2.73 4.37A6.23 6.23 0 0 0 38.09 49a6.28 6.28 0 0 0 3.65-1.73 8.3 8.3 0 0 0 2.72-4.37.21.21 0 0 0-.2-.09Z" })
|
|
2204
|
+
] }),
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
|
|
2206
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2207
|
+
"ellipse",
|
|
2208
|
+
{
|
|
2209
|
+
cx: "53.22",
|
|
2210
|
+
cy: "40.18",
|
|
2211
|
+
rx: "5.85",
|
|
2212
|
+
ry: "3.44",
|
|
2213
|
+
style: { fill: "#febbd0" }
|
|
2214
|
+
}
|
|
2215
|
+
),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2217
|
+
"ellipse",
|
|
2218
|
+
{
|
|
2219
|
+
cx: "22.95",
|
|
2220
|
+
cy: "40.18",
|
|
2221
|
+
rx: "5.85",
|
|
2222
|
+
ry: "3.44",
|
|
2223
|
+
style: { fill: "#febbd0" }
|
|
2224
|
+
}
|
|
2225
|
+
),
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2227
|
+
"path",
|
|
2228
|
+
{
|
|
2229
|
+
d: "M25.7 38.8a5.51 5.51 0 1 0-5.5-5.51 5.51 5.51 0 0 0 5.5 5.51Zm24.77 0A5.51 5.51 0 1 0 45 33.29a5.5 5.5 0 0 0 5.47 5.51Z",
|
|
2230
|
+
style: { fillRule: "evenodd" }
|
|
2231
|
+
}
|
|
2232
|
+
),
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2234
|
+
"path",
|
|
2235
|
+
{
|
|
2236
|
+
d: "M24 33.64a2.07 2.07 0 1 0-2.06-2.07A2.07 2.07 0 0 0 24 33.64Zm24.77 0a2.07 2.07 0 1 0-2.06-2.07 2.07 2.07 0 0 0 2.04 2.07Z",
|
|
2237
|
+
style: { fill: "#fff", fillRule: "evenodd" }
|
|
2238
|
+
}
|
|
2239
|
+
)
|
|
2240
|
+
] })
|
|
2241
|
+
] });
|
|
2242
|
+
}
|
|
2243
|
+
});
|
|
2244
|
+
|
|
2245
|
+
// src/client/theme/icons/deno.tsx
|
|
2246
|
+
var import_jsx_runtime31, Deno;
|
|
2247
|
+
var init_deno = __esm({
|
|
2248
|
+
"src/client/theme/icons/deno.tsx"() {
|
|
2249
|
+
"use strict";
|
|
2250
|
+
import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2251
|
+
Deno = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2252
|
+
"svg",
|
|
2253
|
+
{
|
|
2254
|
+
...props,
|
|
2255
|
+
xmlSpace: "preserve",
|
|
2256
|
+
fillRule: "evenodd",
|
|
2257
|
+
strokeLinejoin: "round",
|
|
2258
|
+
strokeMiterlimit: "2",
|
|
2259
|
+
clipRule: "evenodd",
|
|
2260
|
+
viewBox: "0 0 441 441",
|
|
2261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2262
|
+
"path",
|
|
2263
|
+
{
|
|
2264
|
+
fill: "currentColor",
|
|
2265
|
+
d: "M229.858-2.62c121.29 5.675 215.154 108.755 209.479 230.045S330.582 442.578 209.292 436.903-5.863 328.149-.188 206.859 108.568-8.296 229.858-2.62Zm51.365 264.922c-13.886-.687-27.594-3.012-38.616-4.857-8.381-1.404-16.33-3.616-22.855-5.858a2.576 2.576 0 0 0-2.932.878c-.678.905-.777 2.22-.02 3.061 3.08 3.418 12.848 10.54 20.439 13.812-6.491 5.357-10.933 17.608-12.684 23.95-2.35 8.51-2.687 20.801-2.12 25.312 2.282 18.146 8.95 34.41 25.467 48.64 11.562 9.96 28.295 16.77 45.399 17.08 23.603.426 51.882-9.705 74.085-32.493 29.028-31.807 48.051-73.17 51.593-119.393 8.434-110.06-74.073-206.264-184.134-214.698C124.785 9.302 28.582 91.81 20.147 201.87c-4.368 56.998 15.655 110.28 51.267 149.576a3.185 3.185 0 0 0 5.422-2.974c-26.39-103.487 30.95-215.162 94.926-250.494 23.751-13.118 46.884-18.1 67.664-9.69 31.814 12.874 50 34.21 89.375 52.163 39.375 17.951 43.625 47.862 32.64 78.098-10.986 30.236-46.358 45.425-80.218 43.753Zm-68.863-160.08c-12.906 1.006-21.384 16.978-22.497 27.253-1.117 10.275 3.978 27.236 20.794 26.91 19.694-.383 25.681-17.238 23.525-33.55-1.618-12.25-11.033-21.456-21.822-20.613Z"
|
|
2266
|
+
}
|
|
2267
|
+
)
|
|
2268
|
+
}
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2272
|
+
|
|
2273
|
+
// src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx
|
|
2274
|
+
function getCommandForManager(manager, command, pkg) {
|
|
2275
|
+
const isInstall = command === "install" || command === "add" || command === "i";
|
|
2276
|
+
const isCreate = command === "create" || command === "init";
|
|
2277
|
+
const isRun = command === "run" || command === "exec";
|
|
2278
|
+
if (isInstall) {
|
|
2279
|
+
const pkgArgs2 = pkg ? ` ${pkg}` : "";
|
|
2280
|
+
if (manager === "npm") return `npm install${pkgArgs2}`;
|
|
2281
|
+
if (manager === "pnpm") return pkg ? `pnpm add${pkgArgs2}` : `pnpm install`;
|
|
2282
|
+
if (manager === "bun") return pkg ? `bun add${pkgArgs2}` : `bun install`;
|
|
2283
|
+
if (manager === "deno")
|
|
2284
|
+
return pkg ? `deno install npm:${pkg}` : `deno install`;
|
|
2285
|
+
}
|
|
2286
|
+
if (isCreate) {
|
|
2287
|
+
const pkgArgs2 = pkg ? ` ${pkg}` : "";
|
|
2288
|
+
if (manager === "npm") return `npm create${pkgArgs2}`;
|
|
2289
|
+
if (manager === "pnpm") return `pnpm create${pkgArgs2}`;
|
|
2290
|
+
if (manager === "bun") return `bun create${pkgArgs2}`;
|
|
2291
|
+
if (manager === "deno") return `deno run -A npm:create-${pkg}`;
|
|
2292
|
+
}
|
|
2293
|
+
if (isRun) {
|
|
2294
|
+
const pkgArgs2 = pkg ? ` ${pkg}` : "";
|
|
2295
|
+
if (manager === "npm") return `npm run${pkgArgs2}`;
|
|
2296
|
+
if (manager === "pnpm") return `pnpm run${pkgArgs2}`;
|
|
2297
|
+
if (manager === "bun") return `bun run${pkgArgs2}`;
|
|
2298
|
+
if (manager === "deno") return `deno task ${pkg}`;
|
|
2299
|
+
}
|
|
2300
|
+
const pkgArgs = pkg ? ` ${pkg}` : "";
|
|
2301
|
+
return `${manager} ${command}${pkgArgs}`;
|
|
2302
|
+
}
|
|
2303
|
+
function PackageManagerTabs({
|
|
2304
|
+
command,
|
|
2305
|
+
pkg = "",
|
|
2306
|
+
className = ""
|
|
2307
|
+
}) {
|
|
2308
|
+
const [activeTab, setActiveTab] = (0, import_react17.useState)("npm");
|
|
2309
|
+
const [copied, setCopied] = (0, import_react17.useState)(false);
|
|
2310
|
+
const activeCommand = getCommandForManager(activeTab, command, pkg);
|
|
2311
|
+
const handleCopy = (0, import_react17.useCallback)(async () => {
|
|
2312
|
+
try {
|
|
2313
|
+
await navigator.clipboard.writeText(activeCommand);
|
|
2314
|
+
setCopied(true);
|
|
2315
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2316
|
+
} catch {
|
|
2317
|
+
const textarea = document.createElement("textarea");
|
|
2318
|
+
textarea.value = activeCommand;
|
|
2319
|
+
textarea.style.position = "fixed";
|
|
2320
|
+
textarea.style.opacity = "0";
|
|
2321
|
+
document.body.appendChild(textarea);
|
|
2322
|
+
textarea.select();
|
|
2323
|
+
document.execCommand("copy");
|
|
2324
|
+
document.body.removeChild(textarea);
|
|
2325
|
+
setCopied(true);
|
|
2326
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2327
|
+
}
|
|
2328
|
+
}, [activeCommand]);
|
|
2329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `pkg-tabs-wrapper ${className}`, children: [
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "pkg-tabs-header", children: MANAGERS.map((mgr) => {
|
|
2331
|
+
const Icon = mgr.icon;
|
|
2332
|
+
const isActive = activeTab === mgr.id;
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2334
|
+
"button",
|
|
2335
|
+
{
|
|
2336
|
+
className: `pkg-tab-btn ${isActive ? "active" : ""}`,
|
|
2337
|
+
onClick: () => setActiveTab(mgr.id),
|
|
2338
|
+
"aria-selected": isActive,
|
|
2339
|
+
role: "tab",
|
|
2340
|
+
children: [
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { className: "pkg-tab-icon", width: "16", height: "16" }),
|
|
2342
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: mgr.label })
|
|
2343
|
+
]
|
|
2344
|
+
},
|
|
2345
|
+
mgr.id
|
|
2346
|
+
);
|
|
2347
|
+
}) }),
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "code-block-wrapper pkg-tabs-content", children: [
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "code-block-header", children: [
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "code-block-lang", children: "bash" }),
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2352
|
+
"button",
|
|
2353
|
+
{
|
|
2354
|
+
className: `code-block-copy ${copied ? "copied" : ""}`,
|
|
2355
|
+
onClick: handleCopy,
|
|
2356
|
+
type: "button",
|
|
2357
|
+
"aria-label": "Copy code",
|
|
2358
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react15.Check, { size: 12 }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react15.Copy, { size: 12 }) })
|
|
2359
|
+
}
|
|
2360
|
+
)
|
|
2361
|
+
] }),
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "line", children: activeCommand }) }) })
|
|
2363
|
+
] })
|
|
2364
|
+
] });
|
|
2365
|
+
}
|
|
2366
|
+
var import_react17, import_lucide_react15, import_jsx_runtime32, MANAGERS;
|
|
2367
|
+
var init_PackageManagerTabs = __esm({
|
|
2368
|
+
"src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx"() {
|
|
2369
|
+
"use strict";
|
|
2370
|
+
import_react17 = require("react");
|
|
2371
|
+
import_lucide_react15 = require("lucide-react");
|
|
2372
|
+
init_npm();
|
|
2373
|
+
init_pnpm();
|
|
2374
|
+
init_bun();
|
|
2375
|
+
init_deno();
|
|
2376
|
+
import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2377
|
+
MANAGERS = [
|
|
2378
|
+
{ id: "npm", label: "npm", icon: NPM },
|
|
2379
|
+
{ id: "pnpm", label: "pnpm", icon: Pnpm },
|
|
2380
|
+
{ id: "bun", label: "bun", icon: Bun },
|
|
2381
|
+
{ id: "deno", label: "deno", icon: Deno }
|
|
2382
|
+
];
|
|
2383
|
+
}
|
|
2384
|
+
});
|
|
2385
|
+
|
|
2386
|
+
// src/client/theme/components/PackageManagerTabs/index.ts
|
|
2387
|
+
var PackageManagerTabs_exports = {};
|
|
2388
|
+
__export(PackageManagerTabs_exports, {
|
|
2389
|
+
PackageManagerTabs: () => PackageManagerTabs
|
|
2390
|
+
});
|
|
2391
|
+
var init_PackageManagerTabs2 = __esm({
|
|
2392
|
+
"src/client/theme/components/PackageManagerTabs/index.ts"() {
|
|
2393
|
+
"use strict";
|
|
2394
|
+
init_PackageManagerTabs();
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
|
|
2398
|
+
// src/client/theme/components/Playground/Playground.tsx
|
|
2399
|
+
function Playground({
|
|
2400
|
+
code,
|
|
2401
|
+
children,
|
|
2402
|
+
scope = {},
|
|
2403
|
+
readonly = false
|
|
2404
|
+
}) {
|
|
2405
|
+
let initialCode = code || "";
|
|
2406
|
+
if (!initialCode && typeof children === "string") {
|
|
2407
|
+
initialCode = children;
|
|
2408
|
+
}
|
|
2409
|
+
const [copied, setCopied] = (0, import_react18.useState)(false);
|
|
2410
|
+
const [activeCode, setActiveCode] = (0, import_react18.useState)(initialCode.trim());
|
|
2411
|
+
const handleCopy = () => {
|
|
2412
|
+
navigator.clipboard.writeText(activeCode);
|
|
2413
|
+
setCopied(true);
|
|
2414
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2415
|
+
};
|
|
2416
|
+
const extendedScope = { React: import_react18.default, ...scope };
|
|
2417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "boltdocs-playground", "data-readonly": readonly, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2418
|
+
import_react_live.LiveProvider,
|
|
2419
|
+
{
|
|
2420
|
+
code: activeCode,
|
|
2421
|
+
scope: extendedScope,
|
|
2422
|
+
theme: void 0,
|
|
2423
|
+
noInline: false,
|
|
2424
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-split-container", children: [
|
|
2425
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel playground-editor-panel", children: [
|
|
2426
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel-header", children: [
|
|
2427
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel-title", children: [
|
|
2428
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react16.Terminal, { size: 14 }),
|
|
2429
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: readonly ? "Code Example" : "Live Editor" })
|
|
2430
|
+
] }),
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2432
|
+
"button",
|
|
2433
|
+
{
|
|
2434
|
+
className: "playground-copy-btn",
|
|
2435
|
+
onClick: handleCopy,
|
|
2436
|
+
title: "Copy code",
|
|
2437
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react16.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react16.Copy, { size: 14 })
|
|
2438
|
+
}
|
|
2439
|
+
)
|
|
2440
|
+
] }),
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "playground-panel-content playground-editor", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_live.LiveEditor, { disabled: readonly, onChange: setActiveCode }) })
|
|
2442
|
+
] }),
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel playground-preview-panel", children: [
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "playground-panel-header", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel-title", children: [
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react16.Play, { size: 14 }),
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Preview" })
|
|
2447
|
+
] }) }),
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel-content playground-preview", children: [
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_live.LivePreview, {}),
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_live.LiveError, { className: "playground-error" })
|
|
2451
|
+
] })
|
|
2452
|
+
] })
|
|
2453
|
+
] })
|
|
2454
|
+
}
|
|
2455
|
+
) });
|
|
2456
|
+
}
|
|
2457
|
+
var import_react18, import_react_live, import_lucide_react16, import_jsx_runtime33;
|
|
2458
|
+
var init_Playground = __esm({
|
|
2459
|
+
"src/client/theme/components/Playground/Playground.tsx"() {
|
|
2460
|
+
"use strict";
|
|
2461
|
+
import_react18 = __toESM(require("react"));
|
|
2462
|
+
import_react_live = require("react-live");
|
|
2463
|
+
import_lucide_react16 = require("lucide-react");
|
|
2464
|
+
import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2465
|
+
}
|
|
2466
|
+
});
|
|
2467
|
+
|
|
2468
|
+
// src/client/theme/components/Playground/index.ts
|
|
2469
|
+
var Playground_exports = {};
|
|
2470
|
+
__export(Playground_exports, {
|
|
2471
|
+
Playground: () => Playground
|
|
2472
|
+
});
|
|
2473
|
+
var init_Playground2 = __esm({
|
|
2474
|
+
"src/client/theme/components/Playground/index.ts"() {
|
|
2475
|
+
"use strict";
|
|
2476
|
+
init_Playground();
|
|
2477
|
+
}
|
|
2478
|
+
});
|
|
2479
|
+
|
|
2480
|
+
// src/client/app/index.tsx
|
|
2481
|
+
function useConfig() {
|
|
2482
|
+
return (0, import_react21.useContext)(ConfigContext);
|
|
2483
|
+
}
|
|
2484
|
+
function AppShell({
|
|
2485
|
+
initialRoutes,
|
|
2486
|
+
initialConfig,
|
|
2487
|
+
modules,
|
|
2488
|
+
hot,
|
|
2489
|
+
homePage: HomePage,
|
|
2490
|
+
components: customComponents = {}
|
|
2491
|
+
}) {
|
|
2492
|
+
const [routesInfo, setRoutesInfo] = (0, import_react19.useState)(initialRoutes);
|
|
2493
|
+
const [config] = (0, import_react19.useState)(initialConfig);
|
|
2494
|
+
const [resolvedRoutes, setResolvedRoutes] = (0, import_react19.useState)([]);
|
|
2495
|
+
(0, import_react19.useEffect)(() => {
|
|
2496
|
+
if (hot) {
|
|
2497
|
+
hot.on("boltdocs:routes-update", (newRoutes) => {
|
|
2498
|
+
setRoutesInfo(newRoutes);
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
}, [hot]);
|
|
2502
|
+
(0, import_react19.useEffect)(() => {
|
|
2503
|
+
const mapped = routesInfo.filter(
|
|
2504
|
+
(route) => !(HomePage && (route.path === "/" || route.path === ""))
|
|
2505
|
+
).map((route) => {
|
|
2506
|
+
const loaderKey = Object.keys(modules).find(
|
|
2507
|
+
(k) => k.endsWith("/" + route.filePath)
|
|
2508
|
+
);
|
|
2509
|
+
const loader = loaderKey ? modules[loaderKey] : null;
|
|
2510
|
+
return {
|
|
2511
|
+
...route,
|
|
2512
|
+
Component: import_react19.default.lazy(() => {
|
|
2513
|
+
if (!loader)
|
|
2514
|
+
return Promise.resolve({ default: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(NotFound, {}) });
|
|
2515
|
+
return loader();
|
|
2516
|
+
})
|
|
2517
|
+
};
|
|
2518
|
+
});
|
|
2519
|
+
setResolvedRoutes(mapped);
|
|
2520
|
+
}, [routesInfo, modules]);
|
|
2521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(PreloadProvider, { routes: routesInfo, modules, children: [
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ScrollHandler, {}),
|
|
2523
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_router_dom9.Routes, { children: [
|
|
2524
|
+
HomePage && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2525
|
+
import_react_router_dom9.Route,
|
|
2526
|
+
{
|
|
2527
|
+
path: "/",
|
|
2528
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2529
|
+
ThemeLayout,
|
|
2530
|
+
{
|
|
2531
|
+
config,
|
|
2532
|
+
routes: routesInfo,
|
|
2533
|
+
sidebar: null,
|
|
2534
|
+
toc: null,
|
|
2535
|
+
breadcrumbs: null,
|
|
2536
|
+
...config.themeConfig?.layoutProps,
|
|
2537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HomePage, {})
|
|
2538
|
+
}
|
|
2539
|
+
)
|
|
2540
|
+
}
|
|
2541
|
+
),
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom9.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DocsLayout, { config, routes: routesInfo }), children: resolvedRoutes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2543
|
+
import_react_router_dom9.Route,
|
|
2544
|
+
{
|
|
2545
|
+
path: route.path === "" ? "/" : route.path,
|
|
2546
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react19.default.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Loading, {}), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2547
|
+
MdxPage,
|
|
2548
|
+
{
|
|
2549
|
+
Component: route.Component,
|
|
2550
|
+
customComponents
|
|
2551
|
+
}
|
|
2552
|
+
) })
|
|
2553
|
+
},
|
|
2554
|
+
route.path
|
|
2555
|
+
)) }),
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2557
|
+
import_react_router_dom9.Route,
|
|
2558
|
+
{
|
|
2559
|
+
path: "*",
|
|
2560
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2561
|
+
ThemeLayout,
|
|
2562
|
+
{
|
|
2563
|
+
config,
|
|
2564
|
+
routes: routesInfo,
|
|
2565
|
+
...config.themeConfig?.layoutProps,
|
|
2566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(NotFound, {})
|
|
2567
|
+
}
|
|
2568
|
+
)
|
|
2569
|
+
}
|
|
2570
|
+
)
|
|
2571
|
+
] })
|
|
2572
|
+
] }) });
|
|
2573
|
+
}
|
|
2574
|
+
function ScrollHandler() {
|
|
2575
|
+
const { pathname, hash } = (0, import_react_router_dom9.useLocation)();
|
|
2576
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
2577
|
+
if (hash) {
|
|
2578
|
+
const id = hash.replace("#", "");
|
|
2579
|
+
const element = document.getElementById(id);
|
|
2580
|
+
if (element) {
|
|
2581
|
+
const offset = 80;
|
|
2582
|
+
const bodyRect = document.body.getBoundingClientRect().top;
|
|
2583
|
+
const elementRect = element.getBoundingClientRect().top;
|
|
2584
|
+
const elementPosition = elementRect - bodyRect;
|
|
2585
|
+
const offsetPosition = elementPosition - offset;
|
|
2586
|
+
window.scrollTo({
|
|
2587
|
+
top: offsetPosition,
|
|
2588
|
+
behavior: "smooth"
|
|
2589
|
+
});
|
|
2590
|
+
return;
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
window.scrollTo(0, 0);
|
|
2594
|
+
}, [pathname, hash]);
|
|
2595
|
+
return null;
|
|
2596
|
+
}
|
|
2597
|
+
function DocsLayout({
|
|
2598
|
+
config,
|
|
2599
|
+
routes
|
|
2600
|
+
}) {
|
|
2601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2602
|
+
ThemeLayout,
|
|
2603
|
+
{
|
|
2604
|
+
config,
|
|
2605
|
+
routes,
|
|
2606
|
+
...config.themeConfig?.layoutProps,
|
|
2607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom9.Outlet, {})
|
|
2608
|
+
}
|
|
2609
|
+
);
|
|
2610
|
+
}
|
|
2611
|
+
function MdxPage({
|
|
2612
|
+
Component,
|
|
2613
|
+
customComponents = {}
|
|
2614
|
+
}) {
|
|
2615
|
+
const allComponents = { ...mdxComponents, ...customComponents };
|
|
2616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react20.MDXProvider, { components: allComponents, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Component, {}) });
|
|
2617
|
+
}
|
|
2618
|
+
var import_react19, import_client, import_react_router_dom9, import_react20, import_react21, import_lucide_react17, import_jsx_runtime34, ConfigContext, CodeBlock2, Video2, PackageManagerTabs2, Playground2, Heading, mdxComponents;
|
|
2619
|
+
var init_app = __esm({
|
|
2620
|
+
"src/client/app/index.tsx"() {
|
|
2621
|
+
"use strict";
|
|
2622
|
+
import_react19 = __toESM(require("react"));
|
|
2623
|
+
import_client = __toESM(require("react-dom/client"));
|
|
2624
|
+
import_react_router_dom9 = require("react-router-dom");
|
|
2625
|
+
init_Layout2();
|
|
2626
|
+
init_NotFound2();
|
|
2627
|
+
init_Loading2();
|
|
2628
|
+
import_react20 = require("@mdx-js/react");
|
|
2629
|
+
import_react21 = require("react");
|
|
2630
|
+
import_lucide_react17 = require("lucide-react");
|
|
2631
|
+
init_mdx();
|
|
2632
|
+
init_preload();
|
|
2633
|
+
import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2634
|
+
ConfigContext = (0, import_react21.createContext)(null);
|
|
2635
|
+
CodeBlock2 = (0, import_react21.lazy)(
|
|
2636
|
+
() => Promise.resolve().then(() => (init_CodeBlock2(), CodeBlock_exports)).then((m) => ({
|
|
2637
|
+
default: m.CodeBlock
|
|
2638
|
+
}))
|
|
2639
|
+
);
|
|
2640
|
+
Video2 = (0, import_react21.lazy)(
|
|
2641
|
+
() => Promise.resolve().then(() => (init_Video2(), Video_exports)).then((m) => ({ default: m.Video }))
|
|
2642
|
+
);
|
|
2643
|
+
PackageManagerTabs2 = (0, import_react21.lazy)(
|
|
2644
|
+
() => Promise.resolve().then(() => (init_PackageManagerTabs2(), PackageManagerTabs_exports)).then((m) => ({
|
|
2645
|
+
default: m.PackageManagerTabs
|
|
2646
|
+
}))
|
|
2647
|
+
);
|
|
2648
|
+
Playground2 = (0, import_react21.lazy)(
|
|
2649
|
+
() => Promise.resolve().then(() => (init_Playground2(), Playground_exports)).then((m) => ({
|
|
2650
|
+
default: m.Playground
|
|
2651
|
+
}))
|
|
2652
|
+
);
|
|
2653
|
+
Heading = ({
|
|
2654
|
+
level,
|
|
2655
|
+
id,
|
|
2656
|
+
children
|
|
2657
|
+
}) => {
|
|
2658
|
+
const Tag = `h${level}`;
|
|
2659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Tag, { id, className: "boltdocs-heading", children: [
|
|
2660
|
+
children,
|
|
2661
|
+
id && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("a", { href: `#${id}`, className: "header-anchor", "aria-label": "Anchor", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.Link, { size: 16 }) })
|
|
2662
|
+
] });
|
|
2663
|
+
};
|
|
2664
|
+
mdxComponents = {
|
|
2665
|
+
h1: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Heading, { level: 1, ...props }),
|
|
2666
|
+
h2: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Heading, { level: 2, ...props }),
|
|
2667
|
+
h3: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Heading, { level: 3, ...props }),
|
|
2668
|
+
h4: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Heading, { level: 4, ...props }),
|
|
2669
|
+
h5: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Heading, { level: 5, ...props }),
|
|
2670
|
+
h6: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Heading, { level: 6, ...props }),
|
|
2671
|
+
pre: (props) => {
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react21.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "code-block-skeleton" }), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CodeBlock2, { ...props, children: props.children }) });
|
|
2673
|
+
},
|
|
2674
|
+
video: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react21.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "video-skeleton" }), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Video2, { ...props }) }),
|
|
2675
|
+
PackageManagerTabs: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react21.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "pkg-tabs-skeleton" }), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PackageManagerTabs2, { ...props }) }),
|
|
2676
|
+
Playground: (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react21.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "playground-skeleton" }), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Playground2, { ...props }) }),
|
|
2677
|
+
Button,
|
|
2678
|
+
Badge,
|
|
2679
|
+
Card,
|
|
2680
|
+
Cards,
|
|
2681
|
+
Tabs,
|
|
2682
|
+
Tab,
|
|
2683
|
+
Admonition,
|
|
2684
|
+
Note,
|
|
2685
|
+
Tip,
|
|
2686
|
+
Warning,
|
|
2687
|
+
Danger,
|
|
2688
|
+
InfoBox,
|
|
2689
|
+
List
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
});
|
|
2693
|
+
|
|
2694
|
+
// src/client/ssr.tsx
|
|
2695
|
+
var ssr_exports = {};
|
|
2696
|
+
__export(ssr_exports, {
|
|
2697
|
+
render: () => render
|
|
2698
|
+
});
|
|
2699
|
+
module.exports = __toCommonJS(ssr_exports);
|
|
2700
|
+
var import_react22 = __toESM(require("react"));
|
|
2701
|
+
var import_server = __toESM(require("react-dom/server"));
|
|
2702
|
+
var import_server2 = require("react-router-dom/server");
|
|
2703
|
+
init_app();
|
|
2704
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2705
|
+
async function render(options) {
|
|
2706
|
+
const { path, routes, config, modules, homePage } = options;
|
|
2707
|
+
const resolvedModules = {};
|
|
2708
|
+
for (const [key, mod] of Object.entries(modules)) {
|
|
2709
|
+
resolvedModules[key] = () => Promise.resolve(mod);
|
|
2710
|
+
}
|
|
2711
|
+
const html = import_server.default.renderToString(
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react22.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_server2.StaticRouter, { location: path, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2713
|
+
AppShell,
|
|
2714
|
+
{
|
|
2715
|
+
initialRoutes: routes,
|
|
2716
|
+
initialConfig: config,
|
|
2717
|
+
modules: resolvedModules,
|
|
2718
|
+
homePage
|
|
2719
|
+
}
|
|
2720
|
+
) }) })
|
|
2721
|
+
);
|
|
2722
|
+
return html;
|
|
2723
|
+
}
|
|
2724
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2725
|
+
0 && (module.exports = {
|
|
2726
|
+
render
|
|
2727
|
+
});
|