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,56 @@
|
|
|
1
|
+
// src/client/theme/components/CodeBlock/CodeBlock.tsx
|
|
2
|
+
import React, { useState, useRef, useCallback } from "react";
|
|
3
|
+
import { Copy, Check } from "lucide-react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function CodeBlock({ children, ...props }) {
|
|
6
|
+
const [copied, setCopied] = useState(false);
|
|
7
|
+
const preRef = useRef(null);
|
|
8
|
+
let language = "";
|
|
9
|
+
if (React.isValidElement(children)) {
|
|
10
|
+
const childProps = children.props;
|
|
11
|
+
language = childProps?.["data-language"] || "";
|
|
12
|
+
if (!language && childProps?.className) {
|
|
13
|
+
const match = childProps.className.match(/language-(\w+)/);
|
|
14
|
+
if (match) language = match[1];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const handleCopy = useCallback(async () => {
|
|
18
|
+
const code = preRef.current?.textContent || "";
|
|
19
|
+
try {
|
|
20
|
+
await navigator.clipboard.writeText(code);
|
|
21
|
+
setCopied(true);
|
|
22
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
23
|
+
} catch {
|
|
24
|
+
const textarea = document.createElement("textarea");
|
|
25
|
+
textarea.value = code;
|
|
26
|
+
textarea.style.position = "fixed";
|
|
27
|
+
textarea.style.opacity = "0";
|
|
28
|
+
document.body.appendChild(textarea);
|
|
29
|
+
textarea.select();
|
|
30
|
+
document.execCommand("copy");
|
|
31
|
+
document.body.removeChild(textarea);
|
|
32
|
+
setCopied(true);
|
|
33
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { className: "code-block-wrapper", children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("div", { className: "code-block-header", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "code-block-lang", children: language || "code" }),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
className: `code-block-copy ${copied ? "copied" : ""}`,
|
|
43
|
+
onClick: handleCopy,
|
|
44
|
+
type: "button",
|
|
45
|
+
"aria-label": "Copy code",
|
|
46
|
+
children: copied ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Check, { size: 20 }) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Copy, { size: 20 }) })
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsx("pre", { ref: preRef, ...props, children })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
CodeBlock
|
|
56
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// src/client/theme/components/Playground/Playground.tsx
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
|
|
4
|
+
import { Copy, Check, Terminal, Play } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
function Playground({
|
|
7
|
+
code,
|
|
8
|
+
children,
|
|
9
|
+
scope = {},
|
|
10
|
+
readonly = false
|
|
11
|
+
}) {
|
|
12
|
+
let initialCode = code || "";
|
|
13
|
+
if (!initialCode && typeof children === "string") {
|
|
14
|
+
initialCode = children;
|
|
15
|
+
}
|
|
16
|
+
const [copied, setCopied] = useState(false);
|
|
17
|
+
const [activeCode, setActiveCode] = useState(initialCode.trim());
|
|
18
|
+
const handleCopy = () => {
|
|
19
|
+
navigator.clipboard.writeText(activeCode);
|
|
20
|
+
setCopied(true);
|
|
21
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
22
|
+
};
|
|
23
|
+
const extendedScope = { React, ...scope };
|
|
24
|
+
return /* @__PURE__ */ jsx("div", { className: "boltdocs-playground", "data-readonly": readonly, children: /* @__PURE__ */ jsx(
|
|
25
|
+
LiveProvider,
|
|
26
|
+
{
|
|
27
|
+
code: activeCode,
|
|
28
|
+
scope: extendedScope,
|
|
29
|
+
theme: void 0,
|
|
30
|
+
noInline: false,
|
|
31
|
+
children: /* @__PURE__ */ jsxs("div", { className: "playground-split-container", children: [
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { className: "playground-panel playground-editor-panel", children: [
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { className: "playground-panel-header", children: [
|
|
34
|
+
/* @__PURE__ */ jsxs("div", { className: "playground-panel-title", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Terminal, { size: 14 }),
|
|
36
|
+
/* @__PURE__ */ jsx("span", { children: readonly ? "Code Example" : "Live Editor" })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
className: "playground-copy-btn",
|
|
42
|
+
onClick: handleCopy,
|
|
43
|
+
title: "Copy code",
|
|
44
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { size: 14 }) : /* @__PURE__ */ jsx(Copy, { size: 14 })
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx("div", { className: "playground-panel-content playground-editor", children: /* @__PURE__ */ jsx(LiveEditor, { disabled: readonly, onChange: setActiveCode }) })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsxs("div", { className: "playground-panel playground-preview-panel", children: [
|
|
51
|
+
/* @__PURE__ */ jsx("div", { className: "playground-panel-header", children: /* @__PURE__ */ jsxs("div", { className: "playground-panel-title", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Play, { size: 14 }),
|
|
53
|
+
/* @__PURE__ */ jsx("span", { children: "Preview" })
|
|
54
|
+
] }) }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "playground-panel-content playground-preview", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(LivePreview, {}),
|
|
57
|
+
/* @__PURE__ */ jsx(LiveError, { className: "playground-error" })
|
|
58
|
+
] })
|
|
59
|
+
] })
|
|
60
|
+
] })
|
|
61
|
+
}
|
|
62
|
+
) });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
Playground
|
|
67
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./chunk-X6BYQHVC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/node/config.ts
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { pathToFileURL } from "url";
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
async function resolveConfig(docsDir) {
|
|
10
|
+
const projectRoot = process.cwd();
|
|
11
|
+
const defaults = {
|
|
12
|
+
docsDir: path.resolve(docsDir),
|
|
13
|
+
themeConfig: {
|
|
14
|
+
title: "Boltdocs",
|
|
15
|
+
description: "A Vite documentation framework",
|
|
16
|
+
navbar: [
|
|
17
|
+
{ text: "Home", link: "/" },
|
|
18
|
+
{ text: "Documentation", link: "/docs" }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
for (const filename of CONFIG_FILES) {
|
|
23
|
+
const configPath = path.resolve(projectRoot, filename);
|
|
24
|
+
if (fs.existsSync(configPath)) {
|
|
25
|
+
try {
|
|
26
|
+
const fileUrl = pathToFileURL(configPath).href + "?t=" + Date.now();
|
|
27
|
+
const mod = await import(fileUrl);
|
|
28
|
+
const userConfig = mod.default || mod;
|
|
29
|
+
const userThemeConfig = userConfig.themeConfig || userConfig;
|
|
30
|
+
return {
|
|
31
|
+
docsDir: path.resolve(docsDir),
|
|
32
|
+
themeConfig: {
|
|
33
|
+
...defaults.themeConfig,
|
|
34
|
+
...userThemeConfig
|
|
35
|
+
},
|
|
36
|
+
i18n: userConfig.i18n,
|
|
37
|
+
versions: userConfig.versions,
|
|
38
|
+
siteUrl: userConfig.siteUrl,
|
|
39
|
+
plugins: userConfig.plugins || []
|
|
40
|
+
};
|
|
41
|
+
} catch (e) {
|
|
42
|
+
console.warn(`[boltdocs] Failed to load config from ${filename}:`, e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return defaults;
|
|
47
|
+
}
|
|
48
|
+
var CONFIG_FILES;
|
|
49
|
+
var init_config = __esm({
|
|
50
|
+
"src/node/config.ts"() {
|
|
51
|
+
"use strict";
|
|
52
|
+
CONFIG_FILES = [
|
|
53
|
+
"boltdocs.config.js",
|
|
54
|
+
"boltdocs.config.mjs",
|
|
55
|
+
"boltdocs.config.ts"
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
CONFIG_FILES,
|
|
62
|
+
resolveConfig,
|
|
63
|
+
init_config
|
|
64
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
5
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
6
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
__esm,
|
|
11
|
+
__commonJS
|
|
12
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/client/theme/components/Video/Video.tsx
|
|
2
|
+
import { useRef, useState, useEffect } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
function Video({
|
|
5
|
+
src,
|
|
6
|
+
poster,
|
|
7
|
+
alt,
|
|
8
|
+
children,
|
|
9
|
+
controls,
|
|
10
|
+
preload = "metadata",
|
|
11
|
+
...rest
|
|
12
|
+
}) {
|
|
13
|
+
const containerRef = useRef(null);
|
|
14
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const el = containerRef.current;
|
|
17
|
+
if (!el) return;
|
|
18
|
+
const observer = new IntersectionObserver(
|
|
19
|
+
([entry]) => {
|
|
20
|
+
if (entry.isIntersecting) {
|
|
21
|
+
setIsVisible(true);
|
|
22
|
+
observer.disconnect();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{ rootMargin: "200px" }
|
|
26
|
+
);
|
|
27
|
+
observer.observe(el);
|
|
28
|
+
return () => observer.disconnect();
|
|
29
|
+
}, []);
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, className: "boltdocs-video-wrapper", children: isVisible ? /* @__PURE__ */ jsxs(
|
|
31
|
+
"video",
|
|
32
|
+
{
|
|
33
|
+
className: "boltdocs-video",
|
|
34
|
+
src,
|
|
35
|
+
poster,
|
|
36
|
+
controls: true,
|
|
37
|
+
preload,
|
|
38
|
+
playsInline: true,
|
|
39
|
+
...rest,
|
|
40
|
+
children: [
|
|
41
|
+
children,
|
|
42
|
+
"Your browser does not support the video tag."
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) : /* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "boltdocs-video-placeholder",
|
|
49
|
+
role: "img",
|
|
50
|
+
"aria-label": alt || "Video"
|
|
51
|
+
}
|
|
52
|
+
) });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
Video
|
|
57
|
+
};
|