boltdocs 1.10.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/dist/cache-7G6D532T.mjs +1 -0
- package/dist/chunk-A4HQPEPU.mjs +1 -0
- package/dist/chunk-BA5NH5HU.mjs +1 -0
- package/dist/chunk-BQCD3DWG.mjs +1 -0
- package/dist/chunk-H63UMKYF.mjs +1 -0
- package/dist/chunk-IWHRQHS7.mjs +1 -0
- package/dist/chunk-JZXLCA2E.mjs +1 -0
- package/dist/chunk-MFU7Q6WF.mjs +1 -0
- package/dist/chunk-QYPNX5UN.mjs +1 -0
- package/dist/chunk-XEAPSFMB.mjs +1 -0
- package/dist/client/components/mdx/index.d.mts +209 -0
- package/dist/client/components/mdx/index.d.ts +209 -0
- package/dist/client/components/mdx/index.js +1 -0
- package/dist/client/components/mdx/index.mjs +1 -0
- package/dist/client/hooks/index.d.mts +133 -0
- package/dist/client/hooks/index.d.ts +133 -0
- package/dist/client/hooks/index.js +1 -0
- package/dist/client/hooks/index.mjs +1 -0
- package/dist/client/index.d.mts +138 -298
- package/dist/client/index.d.ts +138 -298
- package/dist/client/index.js +1 -3630
- package/dist/client/index.mjs +1 -697
- package/dist/client/ssr.d.mts +7 -3
- package/dist/client/ssr.d.ts +7 -3
- package/dist/client/ssr.js +1 -2928
- package/dist/client/ssr.mjs +1 -33
- package/dist/{config-BsFQ-ErD.d.ts → config-CX4l-ZNp.d.mts} +42 -35
- package/dist/{config-BsFQ-ErD.d.mts → config-CX4l-ZNp.d.ts} +42 -35
- package/dist/node/index.d.mts +2 -4
- package/dist/node/index.d.ts +2 -4
- package/dist/node/index.js +31 -1161
- package/dist/node/index.mjs +31 -736
- package/dist/search-dialog-EB3N4TYM.mjs +1 -0
- package/dist/types-BuZWFT7r.d.ts +159 -0
- package/dist/types-CvT-SGbK.d.mts +159 -0
- package/dist/use-routes-5bAtAAYX.d.mts +30 -0
- package/dist/use-routes-BefRXY3v.d.ts +30 -0
- package/package.json +34 -12
- package/src/client/app/config-context.tsx +18 -0
- package/src/client/app/docs-layout.tsx +14 -0
- package/src/client/app/index.tsx +137 -262
- package/src/client/app/mdx-component.tsx +52 -0
- package/src/client/app/mdx-components-context.tsx +23 -0
- package/src/client/app/mdx-page.tsx +20 -0
- package/src/client/app/preload.tsx +38 -30
- package/src/client/app/router.tsx +30 -0
- package/src/client/app/scroll-handler.tsx +40 -0
- package/src/client/app/theme-context.tsx +75 -0
- package/src/client/components/default-layout.tsx +80 -0
- package/src/client/components/docs-layout.tsx +105 -0
- package/src/client/components/icons-dev.tsx +74 -0
- package/src/client/components/mdx/admonition.tsx +107 -0
- package/src/client/components/mdx/badge.tsx +41 -0
- package/src/client/components/mdx/button.tsx +35 -0
- package/src/client/components/mdx/card.tsx +124 -0
- package/src/client/components/mdx/code-block.tsx +119 -0
- package/src/client/components/mdx/component-preview.tsx +47 -0
- package/src/client/components/mdx/component-props.tsx +83 -0
- package/src/client/components/mdx/field.tsx +66 -0
- package/src/client/components/mdx/file-tree.tsx +287 -0
- package/src/client/components/mdx/hooks/use-code-block.ts +56 -0
- package/src/client/components/mdx/hooks/use-component-preview.ts +16 -0
- package/src/client/components/mdx/hooks/useTable.ts +74 -0
- package/src/client/components/mdx/hooks/useTabs.ts +68 -0
- package/src/client/components/mdx/image.tsx +23 -0
- package/src/client/components/mdx/index.ts +53 -0
- package/src/client/components/mdx/link.tsx +38 -0
- package/src/client/components/mdx/list.tsx +192 -0
- package/src/client/components/mdx/table.tsx +156 -0
- package/src/client/components/mdx/tabs.tsx +135 -0
- package/src/client/components/mdx/video.tsx +68 -0
- package/src/client/components/primitives/breadcrumbs.tsx +79 -0
- package/src/client/components/primitives/button-group.tsx +54 -0
- package/src/client/components/primitives/button.tsx +145 -0
- package/src/client/components/primitives/helpers/observer.ts +120 -0
- package/src/client/components/primitives/index.ts +17 -0
- package/src/client/components/primitives/link.tsx +122 -0
- package/src/client/components/primitives/menu.tsx +159 -0
- package/src/client/components/primitives/navbar.tsx +359 -0
- package/src/client/components/primitives/navigation-menu.tsx +116 -0
- package/src/client/components/primitives/on-this-page.tsx +461 -0
- package/src/client/components/primitives/page-nav.tsx +87 -0
- package/src/client/components/primitives/popover.tsx +47 -0
- package/src/client/components/primitives/search-dialog.tsx +183 -0
- package/src/client/components/primitives/sidebar.tsx +154 -0
- package/src/client/components/primitives/tabs.tsx +90 -0
- package/src/client/components/primitives/tooltip.tsx +83 -0
- package/src/client/components/primitives/types.ts +11 -0
- package/src/client/components/ui-base/breadcrumbs.tsx +42 -0
- package/src/client/components/ui-base/copy-markdown.tsx +112 -0
- package/src/client/components/ui-base/error-boundary.tsx +52 -0
- package/src/client/components/ui-base/github-stars.tsx +27 -0
- package/src/client/components/ui-base/head.tsx +69 -0
- package/src/client/components/ui-base/loading.tsx +87 -0
- package/src/client/components/ui-base/navbar.tsx +138 -0
- package/src/client/components/ui-base/not-found.tsx +24 -0
- package/src/client/components/ui-base/on-this-page.tsx +152 -0
- package/src/client/components/ui-base/page-nav.tsx +39 -0
- package/src/client/components/ui-base/powered-by.tsx +19 -0
- package/src/client/components/ui-base/progress-bar.tsx +67 -0
- package/src/client/components/ui-base/search-dialog.tsx +82 -0
- package/src/client/components/ui-base/sidebar.tsx +104 -0
- package/src/client/components/ui-base/tabs.tsx +65 -0
- package/src/client/components/ui-base/theme-toggle.tsx +32 -0
- package/src/client/hooks/index.ts +12 -0
- package/src/client/hooks/use-breadcrumbs.ts +22 -0
- package/src/client/hooks/use-i18n.ts +84 -0
- package/src/client/hooks/use-localized-to.ts +95 -0
- package/src/client/hooks/use-location.ts +5 -0
- package/src/client/hooks/use-navbar.ts +60 -0
- package/src/client/hooks/use-onthispage.ts +23 -0
- package/src/client/hooks/use-page-nav.ts +22 -0
- package/src/client/hooks/use-routes.ts +72 -0
- package/src/client/hooks/use-search.ts +71 -0
- package/src/client/hooks/use-sidebar.ts +49 -0
- package/src/client/hooks/use-tabs.ts +43 -0
- package/src/client/hooks/use-version.ts +78 -0
- package/src/client/index.ts +55 -17
- package/src/client/integrations/codesandbox.ts +179 -0
- package/src/client/ssr.tsx +27 -16
- package/src/client/theme/neutral.css +360 -0
- package/src/client/types.ts +131 -27
- package/src/client/utils/cn.ts +6 -0
- package/src/client/utils/copy-clipboard.ts +22 -0
- package/src/client/utils/get-base-file-path.ts +21 -0
- package/src/client/utils/github.ts +121 -0
- package/src/client/utils/use-on-change.ts +15 -0
- package/src/client/virtual.d.ts +24 -0
- package/src/node/cache.ts +156 -156
- package/src/node/config.ts +159 -103
- package/src/node/index.ts +13 -13
- package/src/node/mdx.ts +213 -61
- package/src/node/plugin/entry.ts +29 -18
- package/src/node/plugin/html.ts +11 -11
- package/src/node/plugin/index.ts +161 -84
- package/src/node/plugin/types.ts +2 -4
- package/src/node/routes/cache.ts +6 -6
- package/src/node/routes/index.ts +206 -113
- package/src/node/routes/parser.ts +102 -82
- package/src/node/routes/sorter.ts +15 -15
- package/src/node/routes/types.ts +24 -24
- package/src/node/ssg/index.ts +73 -47
- package/src/node/ssg/meta.ts +4 -4
- package/src/node/ssg/options.ts +5 -5
- package/src/node/ssg/sitemap.ts +14 -14
- package/src/node/utils.ts +54 -31
- package/tsconfig.json +25 -20
- package/tsup.config.ts +23 -14
- package/dist/PackageManagerTabs-NVT7G625.mjs +0 -99
- package/dist/SearchDialog-AGVF6JBO.mjs +0 -194
- package/dist/SearchDialog-YPDOM7Q6.css +0 -2847
- package/dist/Video-KNTY5BNO.mjs +0 -6
- package/dist/cache-KNL5B4EE.mjs +0 -12
- package/dist/chunk-7SFUJWTB.mjs +0 -211
- package/dist/chunk-FFBNU6IJ.mjs +0 -386
- package/dist/chunk-FMTOYQLO.mjs +0 -37
- package/dist/chunk-TKLQWU7H.mjs +0 -1920
- package/dist/chunk-Z7JHYNAS.mjs +0 -57
- package/dist/client/index.css +0 -2847
- package/dist/client/ssr.css +0 -2847
- package/dist/types-Dj-bfnC3.d.mts +0 -74
- package/dist/types-Dj-bfnC3.d.ts +0 -74
- package/src/client/theme/components/CodeBlock/CodeBlock.tsx +0 -61
- package/src/client/theme/components/CodeBlock/index.ts +0 -1
- package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +0 -131
- package/src/client/theme/components/PackageManagerTabs/index.ts +0 -1
- package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +0 -64
- package/src/client/theme/components/Playground/Playground.tsx +0 -180
- package/src/client/theme/components/Playground/index.ts +0 -1
- package/src/client/theme/components/Playground/playground.css +0 -238
- package/src/client/theme/components/Video/Video.tsx +0 -84
- package/src/client/theme/components/Video/index.ts +0 -1
- package/src/client/theme/components/Video/video.css +0 -41
- package/src/client/theme/components/mdx/Admonition.tsx +0 -80
- package/src/client/theme/components/mdx/Badge.tsx +0 -31
- package/src/client/theme/components/mdx/Button.tsx +0 -50
- package/src/client/theme/components/mdx/Card.tsx +0 -80
- package/src/client/theme/components/mdx/Field.tsx +0 -60
- package/src/client/theme/components/mdx/FileTree.tsx +0 -229
- package/src/client/theme/components/mdx/List.tsx +0 -57
- package/src/client/theme/components/mdx/Table.tsx +0 -151
- package/src/client/theme/components/mdx/Tabs.tsx +0 -123
- package/src/client/theme/components/mdx/index.ts +0 -27
- package/src/client/theme/components/mdx/mdx-components.css +0 -764
- package/src/client/theme/icons/bun.tsx +0 -62
- package/src/client/theme/icons/deno.tsx +0 -20
- package/src/client/theme/icons/discord.tsx +0 -12
- package/src/client/theme/icons/github.tsx +0 -15
- package/src/client/theme/icons/npm.tsx +0 -13
- package/src/client/theme/icons/pnpm.tsx +0 -72
- package/src/client/theme/icons/twitter.tsx +0 -12
- package/src/client/theme/styles/markdown.css +0 -394
- package/src/client/theme/styles/variables.css +0 -175
- package/src/client/theme/styles.css +0 -39
- package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +0 -68
- package/src/client/theme/ui/Breadcrumbs/index.ts +0 -1
- package/src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx +0 -82
- package/src/client/theme/ui/CopyMarkdown/copy-markdown.css +0 -112
- package/src/client/theme/ui/CopyMarkdown/index.ts +0 -1
- package/src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx +0 -50
- package/src/client/theme/ui/ErrorBoundary/error-boundary.css +0 -55
- package/src/client/theme/ui/ErrorBoundary/index.ts +0 -1
- package/src/client/theme/ui/Footer/footer.css +0 -32
- package/src/client/theme/ui/Head/Head.tsx +0 -69
- package/src/client/theme/ui/Head/index.ts +0 -1
- package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +0 -125
- package/src/client/theme/ui/LanguageSwitcher/index.ts +0 -1
- package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +0 -98
- package/src/client/theme/ui/Layout/Layout.tsx +0 -203
- package/src/client/theme/ui/Layout/base.css +0 -106
- package/src/client/theme/ui/Layout/index.ts +0 -2
- package/src/client/theme/ui/Layout/pagination.css +0 -72
- package/src/client/theme/ui/Layout/responsive.css +0 -47
- package/src/client/theme/ui/Link/Link.tsx +0 -392
- package/src/client/theme/ui/Link/LinkPreview.tsx +0 -59
- package/src/client/theme/ui/Link/index.ts +0 -2
- package/src/client/theme/ui/Link/link-preview.css +0 -48
- package/src/client/theme/ui/Loading/Loading.tsx +0 -10
- package/src/client/theme/ui/Loading/index.ts +0 -1
- package/src/client/theme/ui/Loading/loading.css +0 -30
- package/src/client/theme/ui/Navbar/GithubStars.tsx +0 -27
- package/src/client/theme/ui/Navbar/Navbar.tsx +0 -193
- package/src/client/theme/ui/Navbar/Tabs.tsx +0 -99
- package/src/client/theme/ui/Navbar/index.ts +0 -2
- package/src/client/theme/ui/Navbar/navbar.css +0 -347
- package/src/client/theme/ui/NotFound/NotFound.tsx +0 -19
- package/src/client/theme/ui/NotFound/index.ts +0 -1
- package/src/client/theme/ui/NotFound/not-found.css +0 -64
- package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +0 -244
- package/src/client/theme/ui/OnThisPage/index.ts +0 -1
- package/src/client/theme/ui/OnThisPage/toc.css +0 -152
- package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +0 -18
- package/src/client/theme/ui/PoweredBy/index.ts +0 -1
- package/src/client/theme/ui/PoweredBy/powered-by.css +0 -76
- package/src/client/theme/ui/ProgressBar/ProgressBar.css +0 -17
- package/src/client/theme/ui/ProgressBar/ProgressBar.tsx +0 -51
- package/src/client/theme/ui/ProgressBar/index.ts +0 -1
- package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +0 -209
- package/src/client/theme/ui/SearchDialog/index.ts +0 -1
- package/src/client/theme/ui/SearchDialog/search.css +0 -152
- package/src/client/theme/ui/Sidebar/Sidebar.tsx +0 -244
- package/src/client/theme/ui/Sidebar/index.ts +0 -1
- package/src/client/theme/ui/Sidebar/sidebar.css +0 -230
- package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +0 -69
- package/src/client/theme/ui/ThemeToggle/index.ts +0 -1
- package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +0 -136
- package/src/client/theme/ui/VersionSwitcher/index.ts +0 -1
- package/src/client/utils.ts +0 -49
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f}from"./chunk-H63UMKYF.mjs";import{h as g,i as h,j as u,k as m,l as S,m as d,n as p,o as y,p as D}from"./chunk-BQCD3DWG.mjs";import"./chunk-XEAPSFMB.mjs";import"./chunk-JZXLCA2E.mjs";import{useEffect as K,useCallback as M}from"react";import{useNavigate as R}from"react-router-dom";import{Fragment as T,jsx as o,jsxs as n}from"react/jsx-runtime";function N({routes:v}){let{isOpen:I,setIsOpen:a,query:w,setQuery:k,list:E}=f(v),r=R();K(()=>{let e=t=>{(/Mac/.test(navigator.userAgent)?t.metaKey:t.ctrlKey)&&(t.key==="k"||t.key==="j")&&(t.preventDefault(),a(i=>!i))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let l=M(e=>{let t=String(e);if(a(!1),t.includes("#")){let[s,c]=t.split("#");r(s),setTimeout(()=>{let i=document.getElementById(c);i&&i.scrollIntoView({behavior:"smooth"})},100)}else r(t)},[r,a]);return n(T,{children:[o(g.SearchTrigger,{onPress:()=>a(!0)}),o(h,{isOpen:I,onOpenChange:a,children:n(u,{onSelectionChange:l,children:[o(m,{value:w,onChange:e=>k(e.target.value)}),o(S,{items:E,children:e=>n(d,{onPress:()=>l(e.id),textValue:e.title,children:[o(p,{isHeading:e.isHeading}),n("div",{className:"flex flex-col justify-center gap-0.5",children:[o(y,{children:e.title}),o(D,{children:e.groupTitle})]})]},e.id)})]})})]})}export{N as SearchDialog};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { B as BoltdocsConfig } from './config-CX4l-ZNp.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Metadata provided by the server for a specific route.
|
|
6
|
+
* Maps closely to the `RouteMeta` type in the Node environment.
|
|
7
|
+
*/
|
|
8
|
+
interface ComponentRoute {
|
|
9
|
+
/** The final URL path */
|
|
10
|
+
path: string;
|
|
11
|
+
/** The absolute filesystem path of the source file */
|
|
12
|
+
componentPath: string;
|
|
13
|
+
/** The page title */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Explicit order in the sidebar */
|
|
16
|
+
sidebarPosition?: number;
|
|
17
|
+
/** The relative path from the docs directory */
|
|
18
|
+
filePath: string;
|
|
19
|
+
/** The group directory name */
|
|
20
|
+
group?: string;
|
|
21
|
+
/** The display title of the group */
|
|
22
|
+
groupTitle?: string;
|
|
23
|
+
/** Explicit order of the group in the sidebar */
|
|
24
|
+
groupPosition?: number;
|
|
25
|
+
/** Extracted markdown headings for search indexing */
|
|
26
|
+
headings?: {
|
|
27
|
+
level: number;
|
|
28
|
+
text: string;
|
|
29
|
+
id: string;
|
|
30
|
+
}[];
|
|
31
|
+
/** The page summary or description */
|
|
32
|
+
description?: string;
|
|
33
|
+
/** The locale this route belongs to, if i18n is configured */
|
|
34
|
+
locale?: string;
|
|
35
|
+
/** The version this route belongs to, if versioning is configured */
|
|
36
|
+
version?: string;
|
|
37
|
+
/** Optional icon to display (Lucide icon name or raw SVG) */
|
|
38
|
+
icon?: string;
|
|
39
|
+
/** The tab this route belongs to, if tabs are configured */
|
|
40
|
+
tab?: string;
|
|
41
|
+
/** Optional badge to display next to the sidebar item */
|
|
42
|
+
badge?: string | {
|
|
43
|
+
text: 'updated' | 'new' | 'deprecated';
|
|
44
|
+
expires?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Optional icon for the route's group */
|
|
47
|
+
groupIcon?: string;
|
|
48
|
+
/** The extracted plain-text content of the page for search indexing */
|
|
49
|
+
_content?: string;
|
|
50
|
+
/** The raw markdown content of the page */
|
|
51
|
+
_rawContent?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Site configuration provided by the server.
|
|
55
|
+
*/
|
|
56
|
+
type SiteConfig = BoltdocsConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Configuration options for initializing the Boltdocs client app.
|
|
59
|
+
*/
|
|
60
|
+
interface CreateBoltdocsAppOptions {
|
|
61
|
+
/** CSS selector for the DOM element where the app should mount (e.g. '#root') */
|
|
62
|
+
target: string;
|
|
63
|
+
/** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
|
|
64
|
+
routes: ComponentRoute[];
|
|
65
|
+
/** The name of the documentation directory (e.g. 'docs') */
|
|
66
|
+
docsDirName: string;
|
|
67
|
+
/** Site configuration (`virtual:boltdocs-config`) */
|
|
68
|
+
config: SiteConfig;
|
|
69
|
+
/** Dynamic import mapping from `import.meta.glob` for the documentation pages */
|
|
70
|
+
modules: Record<string, () => Promise<{
|
|
71
|
+
default: React__default.ComponentType<any>;
|
|
72
|
+
}>>;
|
|
73
|
+
/** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
|
|
74
|
+
hot?: {
|
|
75
|
+
accept: (cb?: (mod: any) => void) => void;
|
|
76
|
+
dispose: (cb: (data: any) => void) => void;
|
|
77
|
+
on: (event: string, cb: (data: any) => void) => void;
|
|
78
|
+
data: any;
|
|
79
|
+
};
|
|
80
|
+
/** Optional custom React component to render when visiting the root path ('/') */
|
|
81
|
+
homePage?: React__default.ComponentType;
|
|
82
|
+
/** Custom external pages mapped by their route path */
|
|
83
|
+
externalPages?: Record<string, React__default.ComponentType>;
|
|
84
|
+
/** Optional custom MDX components provided by plugins */
|
|
85
|
+
components?: Record<string, React__default.ComponentType>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Types for CodeSandbox integration.
|
|
89
|
+
*/
|
|
90
|
+
interface SandboxFile {
|
|
91
|
+
content: string | object;
|
|
92
|
+
isBinary?: boolean;
|
|
93
|
+
}
|
|
94
|
+
type SandboxFiles = Record<string, SandboxFile>;
|
|
95
|
+
interface SandboxOptions {
|
|
96
|
+
files?: SandboxFiles;
|
|
97
|
+
dependencies?: Record<string, string>;
|
|
98
|
+
devDependencies?: Record<string, string>;
|
|
99
|
+
title?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
template?: string;
|
|
102
|
+
/** The file path to open by default in the editor (e.g. `"src/App.tsx"`). */
|
|
103
|
+
entry?: string;
|
|
104
|
+
/** Options for the embedded iframe view, used by `embedSandbox()`. */
|
|
105
|
+
embed?: SandboxEmbedOptions;
|
|
106
|
+
/** Custom scripts for the package.json (e.g. `{ "start": "vite" }`). */
|
|
107
|
+
scripts?: Record<string, string>;
|
|
108
|
+
/** Optional default theme configuration for the sandbox project. */
|
|
109
|
+
themeConfig?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
interface SandboxEmbedOptions {
|
|
112
|
+
/** Which panel to display: `"editor"`, `"preview"`, or `"split"`. */
|
|
113
|
+
view?: 'editor' | 'preview' | 'split';
|
|
114
|
+
/** Color theme: `"dark"` or `"light"`. */
|
|
115
|
+
theme?: 'dark' | 'light';
|
|
116
|
+
/** Whether to hide the navigation bar in the embed. */
|
|
117
|
+
hideNavigation?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Tab configuration for the documentation site.
|
|
121
|
+
*/
|
|
122
|
+
interface BoltdocsTab {
|
|
123
|
+
id: string;
|
|
124
|
+
text: string;
|
|
125
|
+
icon?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Props for the OnThisPage (TOC) component.
|
|
129
|
+
*/
|
|
130
|
+
interface OnThisPageProps {
|
|
131
|
+
headings?: {
|
|
132
|
+
level: number;
|
|
133
|
+
text: string;
|
|
134
|
+
id: string;
|
|
135
|
+
}[];
|
|
136
|
+
editLink?: string;
|
|
137
|
+
communityHelp?: string;
|
|
138
|
+
filePath?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Props for user-defined layout components (layout.tsx).
|
|
142
|
+
*/
|
|
143
|
+
interface LayoutProps {
|
|
144
|
+
children: React__default.ReactNode;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Unified type for navbar links.
|
|
148
|
+
*/
|
|
149
|
+
interface NavbarLink {
|
|
150
|
+
label: string;
|
|
151
|
+
href: string;
|
|
152
|
+
active: boolean;
|
|
153
|
+
/** Optional icon or string for external link indication */
|
|
154
|
+
to?: string;
|
|
155
|
+
/** Nested items for NavigationMenu */
|
|
156
|
+
items?: NavbarLink[];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type { BoltdocsTab as B, ComponentRoute as C, LayoutProps as L, NavbarLink as N, OnThisPageProps as O, SandboxOptions as S, CreateBoltdocsAppOptions as a, SandboxEmbedOptions as b, SandboxFile as c, SandboxFiles as d };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { B as BoltdocsConfig } from './config-CX4l-ZNp.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Metadata provided by the server for a specific route.
|
|
6
|
+
* Maps closely to the `RouteMeta` type in the Node environment.
|
|
7
|
+
*/
|
|
8
|
+
interface ComponentRoute {
|
|
9
|
+
/** The final URL path */
|
|
10
|
+
path: string;
|
|
11
|
+
/** The absolute filesystem path of the source file */
|
|
12
|
+
componentPath: string;
|
|
13
|
+
/** The page title */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Explicit order in the sidebar */
|
|
16
|
+
sidebarPosition?: number;
|
|
17
|
+
/** The relative path from the docs directory */
|
|
18
|
+
filePath: string;
|
|
19
|
+
/** The group directory name */
|
|
20
|
+
group?: string;
|
|
21
|
+
/** The display title of the group */
|
|
22
|
+
groupTitle?: string;
|
|
23
|
+
/** Explicit order of the group in the sidebar */
|
|
24
|
+
groupPosition?: number;
|
|
25
|
+
/** Extracted markdown headings for search indexing */
|
|
26
|
+
headings?: {
|
|
27
|
+
level: number;
|
|
28
|
+
text: string;
|
|
29
|
+
id: string;
|
|
30
|
+
}[];
|
|
31
|
+
/** The page summary or description */
|
|
32
|
+
description?: string;
|
|
33
|
+
/** The locale this route belongs to, if i18n is configured */
|
|
34
|
+
locale?: string;
|
|
35
|
+
/** The version this route belongs to, if versioning is configured */
|
|
36
|
+
version?: string;
|
|
37
|
+
/** Optional icon to display (Lucide icon name or raw SVG) */
|
|
38
|
+
icon?: string;
|
|
39
|
+
/** The tab this route belongs to, if tabs are configured */
|
|
40
|
+
tab?: string;
|
|
41
|
+
/** Optional badge to display next to the sidebar item */
|
|
42
|
+
badge?: string | {
|
|
43
|
+
text: 'updated' | 'new' | 'deprecated';
|
|
44
|
+
expires?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Optional icon for the route's group */
|
|
47
|
+
groupIcon?: string;
|
|
48
|
+
/** The extracted plain-text content of the page for search indexing */
|
|
49
|
+
_content?: string;
|
|
50
|
+
/** The raw markdown content of the page */
|
|
51
|
+
_rawContent?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Site configuration provided by the server.
|
|
55
|
+
*/
|
|
56
|
+
type SiteConfig = BoltdocsConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Configuration options for initializing the Boltdocs client app.
|
|
59
|
+
*/
|
|
60
|
+
interface CreateBoltdocsAppOptions {
|
|
61
|
+
/** CSS selector for the DOM element where the app should mount (e.g. '#root') */
|
|
62
|
+
target: string;
|
|
63
|
+
/** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
|
|
64
|
+
routes: ComponentRoute[];
|
|
65
|
+
/** The name of the documentation directory (e.g. 'docs') */
|
|
66
|
+
docsDirName: string;
|
|
67
|
+
/** Site configuration (`virtual:boltdocs-config`) */
|
|
68
|
+
config: SiteConfig;
|
|
69
|
+
/** Dynamic import mapping from `import.meta.glob` for the documentation pages */
|
|
70
|
+
modules: Record<string, () => Promise<{
|
|
71
|
+
default: React__default.ComponentType<any>;
|
|
72
|
+
}>>;
|
|
73
|
+
/** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
|
|
74
|
+
hot?: {
|
|
75
|
+
accept: (cb?: (mod: any) => void) => void;
|
|
76
|
+
dispose: (cb: (data: any) => void) => void;
|
|
77
|
+
on: (event: string, cb: (data: any) => void) => void;
|
|
78
|
+
data: any;
|
|
79
|
+
};
|
|
80
|
+
/** Optional custom React component to render when visiting the root path ('/') */
|
|
81
|
+
homePage?: React__default.ComponentType;
|
|
82
|
+
/** Custom external pages mapped by their route path */
|
|
83
|
+
externalPages?: Record<string, React__default.ComponentType>;
|
|
84
|
+
/** Optional custom MDX components provided by plugins */
|
|
85
|
+
components?: Record<string, React__default.ComponentType>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Types for CodeSandbox integration.
|
|
89
|
+
*/
|
|
90
|
+
interface SandboxFile {
|
|
91
|
+
content: string | object;
|
|
92
|
+
isBinary?: boolean;
|
|
93
|
+
}
|
|
94
|
+
type SandboxFiles = Record<string, SandboxFile>;
|
|
95
|
+
interface SandboxOptions {
|
|
96
|
+
files?: SandboxFiles;
|
|
97
|
+
dependencies?: Record<string, string>;
|
|
98
|
+
devDependencies?: Record<string, string>;
|
|
99
|
+
title?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
template?: string;
|
|
102
|
+
/** The file path to open by default in the editor (e.g. `"src/App.tsx"`). */
|
|
103
|
+
entry?: string;
|
|
104
|
+
/** Options for the embedded iframe view, used by `embedSandbox()`. */
|
|
105
|
+
embed?: SandboxEmbedOptions;
|
|
106
|
+
/** Custom scripts for the package.json (e.g. `{ "start": "vite" }`). */
|
|
107
|
+
scripts?: Record<string, string>;
|
|
108
|
+
/** Optional default theme configuration for the sandbox project. */
|
|
109
|
+
themeConfig?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
interface SandboxEmbedOptions {
|
|
112
|
+
/** Which panel to display: `"editor"`, `"preview"`, or `"split"`. */
|
|
113
|
+
view?: 'editor' | 'preview' | 'split';
|
|
114
|
+
/** Color theme: `"dark"` or `"light"`. */
|
|
115
|
+
theme?: 'dark' | 'light';
|
|
116
|
+
/** Whether to hide the navigation bar in the embed. */
|
|
117
|
+
hideNavigation?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Tab configuration for the documentation site.
|
|
121
|
+
*/
|
|
122
|
+
interface BoltdocsTab {
|
|
123
|
+
id: string;
|
|
124
|
+
text: string;
|
|
125
|
+
icon?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Props for the OnThisPage (TOC) component.
|
|
129
|
+
*/
|
|
130
|
+
interface OnThisPageProps {
|
|
131
|
+
headings?: {
|
|
132
|
+
level: number;
|
|
133
|
+
text: string;
|
|
134
|
+
id: string;
|
|
135
|
+
}[];
|
|
136
|
+
editLink?: string;
|
|
137
|
+
communityHelp?: string;
|
|
138
|
+
filePath?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Props for user-defined layout components (layout.tsx).
|
|
142
|
+
*/
|
|
143
|
+
interface LayoutProps {
|
|
144
|
+
children: React__default.ReactNode;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Unified type for navbar links.
|
|
148
|
+
*/
|
|
149
|
+
interface NavbarLink {
|
|
150
|
+
label: string;
|
|
151
|
+
href: string;
|
|
152
|
+
active: boolean;
|
|
153
|
+
/** Optional icon or string for external link indication */
|
|
154
|
+
to?: string;
|
|
155
|
+
/** Nested items for NavigationMenu */
|
|
156
|
+
items?: NavbarLink[];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type { BoltdocsTab as B, ComponentRoute as C, LayoutProps as L, NavbarLink as N, OnThisPageProps as O, SandboxOptions as S, CreateBoltdocsAppOptions as a, SandboxEmbedOptions as b, SandboxFile as c, SandboxFiles as d };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { B as BoltdocsConfig } from './config-CX4l-ZNp.mjs';
|
|
2
|
+
import { C as ComponentRoute } from './types-CvT-SGbK.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook to access the framework's routing state.
|
|
6
|
+
* Returns both the complete set of routes and a filtered list based on the current
|
|
7
|
+
* version and locale.
|
|
8
|
+
*/
|
|
9
|
+
declare function useRoutes(): {
|
|
10
|
+
routes: ComponentRoute[];
|
|
11
|
+
allRoutes: ComponentRoute[];
|
|
12
|
+
currentRoute: ComponentRoute | undefined;
|
|
13
|
+
currentLocale: string | undefined;
|
|
14
|
+
currentLocaleLabel: string | undefined;
|
|
15
|
+
availableLocales: {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
isCurrent: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
currentVersion: string | undefined;
|
|
21
|
+
currentVersionLabel: string | undefined;
|
|
22
|
+
availableVersions: {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string;
|
|
25
|
+
isCurrent: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
config: BoltdocsConfig;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { useRoutes as u };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { B as BoltdocsConfig } from './config-CX4l-ZNp.js';
|
|
2
|
+
import { C as ComponentRoute } from './types-BuZWFT7r.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook to access the framework's routing state.
|
|
6
|
+
* Returns both the complete set of routes and a filtered list based on the current
|
|
7
|
+
* version and locale.
|
|
8
|
+
*/
|
|
9
|
+
declare function useRoutes(): {
|
|
10
|
+
routes: ComponentRoute[];
|
|
11
|
+
allRoutes: ComponentRoute[];
|
|
12
|
+
currentRoute: ComponentRoute | undefined;
|
|
13
|
+
currentLocale: string | undefined;
|
|
14
|
+
currentLocaleLabel: string | undefined;
|
|
15
|
+
availableLocales: {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
isCurrent: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
currentVersion: string | undefined;
|
|
21
|
+
currentVersionLabel: string | undefined;
|
|
22
|
+
availableVersions: {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string;
|
|
25
|
+
isCurrent: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
config: BoltdocsConfig;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { useRoutes as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boltdocs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A lightweight documentation generator for React projects.",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
6
|
"module": "dist/node/index.mjs",
|
|
@@ -19,11 +19,22 @@
|
|
|
19
19
|
"import": "./dist/client/index.mjs",
|
|
20
20
|
"require": "./dist/client/index.js"
|
|
21
21
|
},
|
|
22
|
-
"./
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
"./client/hooks": {
|
|
23
|
+
"types": "./dist/client/hooks/index.d.ts",
|
|
24
|
+
"import": "./dist/client/hooks/index.mjs",
|
|
25
|
+
"require": "./dist/client/hooks/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./client/primitives": {
|
|
28
|
+
"types": "./dist/client/components/primitives/index.d.ts",
|
|
29
|
+
"import": "./dist/client/components/primitives/index.mjs",
|
|
30
|
+
"require": "./dist/client/components/primitives/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./client/types": {
|
|
33
|
+
"types": "./dist/client/types.d.ts",
|
|
34
|
+
"import": "./dist/client/types.mjs",
|
|
35
|
+
"require": "./dist/client/types.js"
|
|
36
|
+
},
|
|
37
|
+
"./theme/neutral.css": "./src/client/theme/neutral.css"
|
|
27
38
|
},
|
|
28
39
|
"keywords": [
|
|
29
40
|
"docs",
|
|
@@ -42,28 +53,32 @@
|
|
|
42
53
|
"dependencies": {
|
|
43
54
|
"@mdx-js/react": "^3.1.1",
|
|
44
55
|
"@mdx-js/rollup": "^3.1.1",
|
|
56
|
+
"class-variance-authority": "^0.7.1",
|
|
57
|
+
"clsx": "^2.1.1",
|
|
58
|
+
"codesandbox": "^2.2.3",
|
|
45
59
|
"fast-glob": "^3.3.3",
|
|
46
60
|
"github-slugger": "^2.0.0",
|
|
47
61
|
"gray-matter": "^4.0.3",
|
|
62
|
+
"isomorphic-dompurify": "^3.7.1",
|
|
48
63
|
"lucide-react": "^0.575.0",
|
|
49
|
-
"react-
|
|
64
|
+
"react-aria-components": "^1.16.0",
|
|
50
65
|
"react-router-dom": "^6.30.3",
|
|
51
|
-
"rehype-pretty-code": "^0.14.1",
|
|
52
66
|
"rehype-slug": "^6.0.0",
|
|
53
67
|
"remark-frontmatter": "^5.0.0",
|
|
54
68
|
"remark-gfm": "^4.0.1",
|
|
69
|
+
"scroll-into-view-if-needed": "^3.1.0",
|
|
55
70
|
"sharp": "^0.34.5",
|
|
56
71
|
"shiki": "^3.23.0",
|
|
57
72
|
"svgo": "^4.0.1",
|
|
73
|
+
"tailwind-merge": "^3.5.0",
|
|
58
74
|
"unist-util-visit": "^5.1.0",
|
|
59
75
|
"vite": "^7.3.1",
|
|
60
76
|
"vite-plugin-image-optimizer": "^2.0.3"
|
|
61
77
|
},
|
|
62
78
|
"peerDependencies": {
|
|
63
|
-
"react": "^
|
|
64
|
-
"react-dom": "^
|
|
79
|
+
"react": "^19.1.0",
|
|
80
|
+
"react-dom": "^19.1.0"
|
|
65
81
|
},
|
|
66
|
-
"packageManager": "pnpm@10.30.2",
|
|
67
82
|
"devDependencies": {
|
|
68
83
|
"@types/node": "^25.3.2",
|
|
69
84
|
"@types/react": "^19.2.14",
|
|
@@ -71,5 +86,12 @@
|
|
|
71
86
|
"@types/react-router-dom": "^5.3.3",
|
|
72
87
|
"tsup": "^8.5.1",
|
|
73
88
|
"typescript": "^5.9.3"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"build": "tsup",
|
|
92
|
+
"dev": "tsup --watch",
|
|
93
|
+
"format": "pnpm exec biome format --write",
|
|
94
|
+
"lint": "pnpm exec biome lint --write",
|
|
95
|
+
"check": "pnpm exec biome check --write"
|
|
74
96
|
}
|
|
75
|
-
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, use } from 'react'
|
|
2
|
+
import type { BoltdocsConfig } from '@node/config'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Context for the global documentation configuration.
|
|
6
|
+
*/
|
|
7
|
+
export const ConfigContext = createContext<BoltdocsConfig | null>(null)
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Hook to access the Boltdocs configuration.
|
|
11
|
+
*/
|
|
12
|
+
export function useConfig() {
|
|
13
|
+
const context = use(ConfigContext)
|
|
14
|
+
if (!context) {
|
|
15
|
+
throw new Error('useConfig must be used within a ConfigProvider')
|
|
16
|
+
}
|
|
17
|
+
return context
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Outlet } from 'react-router-dom'
|
|
2
|
+
import UserLayout from 'virtual:boltdocs-layout'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Wraps the docs Outlet with the user's (or default) layout component.
|
|
6
|
+
* The Layout receives the routed page as `children`.
|
|
7
|
+
*/
|
|
8
|
+
export function DocsLayout() {
|
|
9
|
+
return (
|
|
10
|
+
<UserLayout>
|
|
11
|
+
<Outlet />
|
|
12
|
+
</UserLayout>
|
|
13
|
+
)
|
|
14
|
+
}
|