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,360 @@
|
|
|
1
|
+
@theme {
|
|
2
|
+
--font-display: "Inter", "ui-sans-serif", "system-ui", sans-serif;
|
|
3
|
+
--font-sans: "Inter", "ui-sans-serif", "system-ui", sans-serif;
|
|
4
|
+
--font-mono:
|
|
5
|
+
"JetBrains Mono", "ui-monospace", "SFMono-Regular", Menlo, Monaco, Consolas,
|
|
6
|
+
"liberation mono", "courier new", monospace;
|
|
7
|
+
|
|
8
|
+
--breakpoint-3xl: 120rem;
|
|
9
|
+
|
|
10
|
+
--color-primary-50: oklch(0.985 0.012 265.8);
|
|
11
|
+
--color-primary-100: oklch(0.92 0.045 265.8);
|
|
12
|
+
--color-primary-200: oklch(0.84 0.085 265.8);
|
|
13
|
+
--color-primary-300: oklch(0.74 0.125 265.8);
|
|
14
|
+
--color-primary-400: oklch(0.64 0.165 265.8);
|
|
15
|
+
--color-primary-500: oklch(0.54 0.195 265.8);
|
|
16
|
+
--color-primary-600: oklch(0.45 0.165 265.8);
|
|
17
|
+
--color-primary-700: oklch(0.36 0.135 265.8);
|
|
18
|
+
--color-primary-800: oklch(0.27 0.095 265.8);
|
|
19
|
+
--color-primary-900: oklch(0.15 0.045 265.8);
|
|
20
|
+
|
|
21
|
+
/* Neutral Gray Palette */
|
|
22
|
+
--color-neutral-50: oklch(0.98 0 0);
|
|
23
|
+
--color-neutral-100: oklch(0.96 0 0);
|
|
24
|
+
--color-neutral-200: oklch(0.92 0 0);
|
|
25
|
+
--color-neutral-300: oklch(0.84 0 0);
|
|
26
|
+
--color-neutral-400: oklch(0.7 0 0);
|
|
27
|
+
--color-neutral-500: oklch(0.55 0 0);
|
|
28
|
+
--color-neutral-600: oklch(0.4 0 0);
|
|
29
|
+
--color-neutral-700: oklch(0.25 0 0);
|
|
30
|
+
--color-neutral-800: oklch(0.15 0 0);
|
|
31
|
+
--color-neutral-900: oklch(0.1 0 0);
|
|
32
|
+
--color-neutral-950: oklch(0.05 0 0);
|
|
33
|
+
|
|
34
|
+
/* Semantic Status Colors */
|
|
35
|
+
--color-danger-500: oklch(0.63 0.24 27);
|
|
36
|
+
--color-success-500: oklch(0.72 0.19 150);
|
|
37
|
+
--color-warning-500: oklch(0.78 0.17 75);
|
|
38
|
+
--color-info-500: oklch(0.62 0.19 260);
|
|
39
|
+
|
|
40
|
+
/* Shared Properties */
|
|
41
|
+
--radius-sm: 0.375rem;
|
|
42
|
+
--radius-md: 0.5rem;
|
|
43
|
+
--radius-lg: 0.75rem;
|
|
44
|
+
--radius-xl: 1rem;
|
|
45
|
+
--radius-2xl: 1.5rem;
|
|
46
|
+
--radius-full: 99999rem;
|
|
47
|
+
|
|
48
|
+
--ease-fluid: cubic-bezier(0.3, 0, 0, 1);
|
|
49
|
+
--ease-snappy: cubic-bezier(0.2, 0, 0, 1);
|
|
50
|
+
|
|
51
|
+
/* Semantic Colors - Default (Light) */
|
|
52
|
+
--color-bg-main: var(--color-neutral-50);
|
|
53
|
+
--color-bg-surface: var(--color-neutral-100);
|
|
54
|
+
--color-bg-muted: var(--color-neutral-200);
|
|
55
|
+
--color-text-main: var(--color-neutral-900);
|
|
56
|
+
--color-text-muted: var(--color-neutral-500);
|
|
57
|
+
--color-text-dim: var(--color-neutral-400);
|
|
58
|
+
--color-border-subtle: var(--color-neutral-200);
|
|
59
|
+
--color-border-strong: var(--color-neutral-300);
|
|
60
|
+
--color-code-bg: var(--color-neutral-100);
|
|
61
|
+
--color-code-text: var(--color-neutral-800);
|
|
62
|
+
|
|
63
|
+
/* Semantic Colors - Dark Override (handled via standard CSS overrides below the @theme block) */
|
|
64
|
+
|
|
65
|
+
/* Spacing and Dimensions */
|
|
66
|
+
--spacing-navbar: 3.5rem;
|
|
67
|
+
--spacing-sidebar: 16rem;
|
|
68
|
+
--spacing-toc: 14rem;
|
|
69
|
+
--spacing-content-max: 48rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:root[data-theme="dark"],
|
|
73
|
+
:root:not(.theme-light) {
|
|
74
|
+
--color-bg-main: var(--color-neutral-950);
|
|
75
|
+
--color-bg-surface: var(--color-neutral-900);
|
|
76
|
+
--color-bg-muted: var(--color-neutral-800);
|
|
77
|
+
--color-text-main: var(--color-neutral-50);
|
|
78
|
+
--color-text-muted: var(--color-neutral-400);
|
|
79
|
+
--color-text-dim: var(--color-neutral-500);
|
|
80
|
+
--color-border-subtle: var(--color-neutral-800);
|
|
81
|
+
--color-border-strong: var(--color-neutral-700);
|
|
82
|
+
--color-code-bg: var(--color-neutral-900);
|
|
83
|
+
--color-code-text: var(--color-neutral-200);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@layer base {
|
|
87
|
+
*,
|
|
88
|
+
*::before,
|
|
89
|
+
*::after {
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
html,
|
|
94
|
+
body {
|
|
95
|
+
margin: 0;
|
|
96
|
+
padding: 0;
|
|
97
|
+
height: 100%;
|
|
98
|
+
overflow-x: hidden;
|
|
99
|
+
overflow-y: hidden;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
body {
|
|
103
|
+
@apply bg-bg-main text-text-main antialiased;
|
|
104
|
+
font-family: var(--font-sans);
|
|
105
|
+
line-height: 1.7;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
a {
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Scroll-margin-top for anchor scrolling */
|
|
113
|
+
h1,
|
|
114
|
+
h2,
|
|
115
|
+
h3,
|
|
116
|
+
h4,
|
|
117
|
+
h5,
|
|
118
|
+
h6 {
|
|
119
|
+
scroll-margin-top: 6rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Scrollbar */
|
|
123
|
+
::-webkit-scrollbar {
|
|
124
|
+
width: 6px;
|
|
125
|
+
height: 6px;
|
|
126
|
+
}
|
|
127
|
+
::-webkit-scrollbar-track {
|
|
128
|
+
background: transparent;
|
|
129
|
+
}
|
|
130
|
+
::-webkit-scrollbar-thumb {
|
|
131
|
+
@apply bg-neutral-300 dark:bg-neutral-700 rounded-full;
|
|
132
|
+
}
|
|
133
|
+
::-webkit-scrollbar-thumb:hover {
|
|
134
|
+
@apply bg-neutral-400 dark:bg-neutral-600;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ═══ Content Area ═══ */
|
|
138
|
+
.boltdocs-content {
|
|
139
|
+
scrollbar-width: none;
|
|
140
|
+
scroll-behavior: smooth;
|
|
141
|
+
}
|
|
142
|
+
.boltdocs-content::-webkit-scrollbar {
|
|
143
|
+
display: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* ═══ Markdown Typography ═══ */
|
|
147
|
+
.boltdocs-page {
|
|
148
|
+
position: relative;
|
|
149
|
+
padding-top: 1rem;
|
|
150
|
+
padding-bottom: 8rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.boltdocs-page h1 {
|
|
154
|
+
font-size: 2.5rem;
|
|
155
|
+
margin: 0 0 1rem;
|
|
156
|
+
font-weight: 800;
|
|
157
|
+
letter-spacing: -0.04em;
|
|
158
|
+
color: var(--color-text-main);
|
|
159
|
+
line-height: 1.2;
|
|
160
|
+
}
|
|
161
|
+
.boltdocs-page h1 + p {
|
|
162
|
+
color: var(--color-text-muted);
|
|
163
|
+
font-size: 1.125rem;
|
|
164
|
+
margin-bottom: 2.5rem;
|
|
165
|
+
line-height: 1.6;
|
|
166
|
+
}
|
|
167
|
+
.boltdocs-page h2 {
|
|
168
|
+
font-size: 1.75rem;
|
|
169
|
+
margin-top: 3.5rem;
|
|
170
|
+
margin-bottom: 1.25rem;
|
|
171
|
+
font-weight: 700;
|
|
172
|
+
color: var(--color-text-main);
|
|
173
|
+
padding-bottom: 0.5rem;
|
|
174
|
+
border-bottom: 1px solid var(--color-border-subtle);
|
|
175
|
+
scroll-margin-top: 6rem;
|
|
176
|
+
letter-spacing: -0.02em;
|
|
177
|
+
}
|
|
178
|
+
.boltdocs-page h3 {
|
|
179
|
+
font-size: 1.25rem;
|
|
180
|
+
margin-top: 2.5rem;
|
|
181
|
+
margin-bottom: 1rem;
|
|
182
|
+
font-weight: 600;
|
|
183
|
+
color: var(--color-text-main);
|
|
184
|
+
scroll-margin-top: 6rem;
|
|
185
|
+
letter-spacing: -0.01em;
|
|
186
|
+
}
|
|
187
|
+
.boltdocs-page p {
|
|
188
|
+
margin-top: 0;
|
|
189
|
+
margin-bottom: 1.25rem;
|
|
190
|
+
color: var(--color-text-muted);
|
|
191
|
+
line-height: 1.8;
|
|
192
|
+
}
|
|
193
|
+
.boltdocs-page a {
|
|
194
|
+
color: var(--color-primary-500);
|
|
195
|
+
text-decoration: none;
|
|
196
|
+
transition: color 0.2s;
|
|
197
|
+
font-weight: 500;
|
|
198
|
+
}
|
|
199
|
+
.boltdocs-page a:hover {
|
|
200
|
+
color: var(--color-primary-400);
|
|
201
|
+
text-decoration: underline;
|
|
202
|
+
}
|
|
203
|
+
.boltdocs-page ul,
|
|
204
|
+
.boltdocs-page ol {
|
|
205
|
+
margin-top: 0;
|
|
206
|
+
margin-bottom: 1.5rem;
|
|
207
|
+
padding-left: 1.5rem;
|
|
208
|
+
color: var(--color-text-muted);
|
|
209
|
+
}
|
|
210
|
+
.boltdocs-page li {
|
|
211
|
+
margin-bottom: 0.5rem;
|
|
212
|
+
line-height: 1.8;
|
|
213
|
+
}
|
|
214
|
+
.boltdocs-page strong {
|
|
215
|
+
color: var(--color-text-main);
|
|
216
|
+
font-weight: 700;
|
|
217
|
+
}
|
|
218
|
+
.boltdocs-page blockquote {
|
|
219
|
+
margin: 2rem 0;
|
|
220
|
+
padding: 1rem 1.5rem;
|
|
221
|
+
border-left: 4px solid var(--color-primary-500);
|
|
222
|
+
background-color: var(--color-primary-500);
|
|
223
|
+
background-color: color-mix(
|
|
224
|
+
in oklch,
|
|
225
|
+
var(--color-primary-500),
|
|
226
|
+
transparent 93%
|
|
227
|
+
);
|
|
228
|
+
border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
|
|
229
|
+
color: var(--color-text-muted);
|
|
230
|
+
font-style: italic;
|
|
231
|
+
}
|
|
232
|
+
.boltdocs-page blockquote p {
|
|
233
|
+
margin: 0;
|
|
234
|
+
}
|
|
235
|
+
.boltdocs-page hr {
|
|
236
|
+
border: none;
|
|
237
|
+
border-top: 1px solid var(--color-border-subtle);
|
|
238
|
+
margin: 3rem 0;
|
|
239
|
+
}
|
|
240
|
+
.boltdocs-page img {
|
|
241
|
+
max-width: 100%;
|
|
242
|
+
height: auto;
|
|
243
|
+
border-radius: var(--radius-lg);
|
|
244
|
+
margin: 2rem 0;
|
|
245
|
+
display: block;
|
|
246
|
+
box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
|
|
247
|
+
}
|
|
248
|
+
.boltdocs-page table {
|
|
249
|
+
width: 100%;
|
|
250
|
+
border-collapse: collapse;
|
|
251
|
+
margin: 2rem 0;
|
|
252
|
+
font-size: 0.875rem;
|
|
253
|
+
}
|
|
254
|
+
.boltdocs-page th {
|
|
255
|
+
text-align: left;
|
|
256
|
+
padding: 0.75rem 1rem;
|
|
257
|
+
border-bottom: 2px solid var(--color-border-subtle);
|
|
258
|
+
color: var(--color-text-main);
|
|
259
|
+
font-weight: 700;
|
|
260
|
+
}
|
|
261
|
+
.boltdocs-page td {
|
|
262
|
+
padding: 0.75rem 1rem;
|
|
263
|
+
border-bottom: 1px solid var(--color-border-subtle);
|
|
264
|
+
color: var(--color-text-muted);
|
|
265
|
+
}
|
|
266
|
+
.boltdocs-page tr:hover td {
|
|
267
|
+
background-color: var(--color-bg-surface);
|
|
268
|
+
}
|
|
269
|
+
.boltdocs-page :not(pre) > code {
|
|
270
|
+
background-color: var(--color-bg-surface);
|
|
271
|
+
padding: 0.15rem 0.45rem;
|
|
272
|
+
border-radius: 5px;
|
|
273
|
+
font-family: var(--font-mono);
|
|
274
|
+
font-size: 0.85em;
|
|
275
|
+
color: var(--color-primary-400);
|
|
276
|
+
border: 1px solid var(--color-border-subtle);
|
|
277
|
+
}
|
|
278
|
+
.boltdocs-page pre {
|
|
279
|
+
margin: 1.5rem 0;
|
|
280
|
+
border-radius: var(--radius-md);
|
|
281
|
+
overflow-x: auto;
|
|
282
|
+
font-family: var(--font-mono);
|
|
283
|
+
font-size: 0.8125rem;
|
|
284
|
+
line-height: 1.7;
|
|
285
|
+
background-color: var(--color-code-bg);
|
|
286
|
+
color: var(--color-code-text);
|
|
287
|
+
border: 1px solid var(--color-border-subtle);
|
|
288
|
+
}
|
|
289
|
+
.boltdocs-page pre > code {
|
|
290
|
+
display: grid;
|
|
291
|
+
padding: 1rem;
|
|
292
|
+
background-color: transparent;
|
|
293
|
+
border: none;
|
|
294
|
+
color: inherit;
|
|
295
|
+
font-size: inherit;
|
|
296
|
+
}
|
|
297
|
+
.boltdocs-page pre > code .line {
|
|
298
|
+
padding: 0 1.25rem;
|
|
299
|
+
}
|
|
300
|
+
.boltdocs-page pre > code .line.highlighted {
|
|
301
|
+
background-color: oklch(0.6 0.22 280 / 10%);
|
|
302
|
+
border-left: 2px solid var(--color-primary-500);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media (max-width: 768px) {
|
|
306
|
+
.boltdocs-page h1 {
|
|
307
|
+
font-size: 1.75rem;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/* ═══ Header Anchors ═══ */
|
|
312
|
+
.header-anchor {
|
|
313
|
+
margin-left: 0.5rem;
|
|
314
|
+
color: var(--color-text-dim);
|
|
315
|
+
opacity: 0;
|
|
316
|
+
transition: opacity 0.2s;
|
|
317
|
+
text-decoration: none;
|
|
318
|
+
font-weight: 400;
|
|
319
|
+
}
|
|
320
|
+
.boltdocs-page h2:hover .header-anchor,
|
|
321
|
+
.boltdocs-page h3:hover .header-anchor {
|
|
322
|
+
opacity: 1;
|
|
323
|
+
}
|
|
324
|
+
.header-anchor:hover {
|
|
325
|
+
color: var(--color-primary-500);
|
|
326
|
+
}
|
|
327
|
+
.boltdocs-heading {
|
|
328
|
+
display: flex;
|
|
329
|
+
align-items: center;
|
|
330
|
+
}
|
|
331
|
+
.boltdocs-heading .header-anchor {
|
|
332
|
+
display: inline-flex;
|
|
333
|
+
align-items: center;
|
|
334
|
+
margin-left: 0.5rem;
|
|
335
|
+
color: var(--color-text-dim);
|
|
336
|
+
opacity: 0;
|
|
337
|
+
transition: opacity 0.2s;
|
|
338
|
+
text-decoration: none;
|
|
339
|
+
}
|
|
340
|
+
.boltdocs-heading:hover .header-anchor {
|
|
341
|
+
opacity: 1;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* ═══ Shiki Dual Theme ═══ */
|
|
345
|
+
.shiki-wrapper .shiki.shiki-themes {
|
|
346
|
+
background-color: transparent !important;
|
|
347
|
+
color: var(--shiki-light) !important;
|
|
348
|
+
}
|
|
349
|
+
.shiki-wrapper .shiki.shiki-themes span {
|
|
350
|
+
color: var(--shiki-light);
|
|
351
|
+
}
|
|
352
|
+
:root[data-theme="dark"] .shiki-wrapper .shiki.shiki-themes,
|
|
353
|
+
:root:not(.theme-light) .shiki-wrapper .shiki.shiki-themes {
|
|
354
|
+
color: var(--shiki-dark) !important;
|
|
355
|
+
}
|
|
356
|
+
:root[data-theme="dark"] .shiki-wrapper .shiki.shiki-themes span,
|
|
357
|
+
:root:not(.theme-light) .shiki-wrapper .shiki.shiki-themes span {
|
|
358
|
+
color: var(--shiki-dark) !important;
|
|
359
|
+
}
|
|
360
|
+
}
|
package/src/client/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { BoltdocsConfig } from '@node/config'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Metadata provided by the server for a specific route.
|
|
@@ -6,61 +7,164 @@ import React from "react";
|
|
|
6
7
|
*/
|
|
7
8
|
export interface ComponentRoute {
|
|
8
9
|
/** The final URL path */
|
|
9
|
-
path: string
|
|
10
|
+
path: string
|
|
10
11
|
/** The absolute filesystem path of the source file */
|
|
11
|
-
componentPath: string
|
|
12
|
+
componentPath: string
|
|
12
13
|
/** The page title */
|
|
13
|
-
title: string
|
|
14
|
+
title: string
|
|
14
15
|
/** Explicit order in the sidebar */
|
|
15
|
-
sidebarPosition?: number
|
|
16
|
+
sidebarPosition?: number
|
|
16
17
|
/** The relative path from the docs directory */
|
|
17
|
-
filePath: string
|
|
18
|
+
filePath: string
|
|
18
19
|
/** The group directory name */
|
|
19
|
-
group?: string
|
|
20
|
+
group?: string
|
|
20
21
|
/** The display title of the group */
|
|
21
|
-
groupTitle?: string
|
|
22
|
+
groupTitle?: string
|
|
22
23
|
/** Explicit order of the group in the sidebar */
|
|
23
|
-
groupPosition?: number
|
|
24
|
+
groupPosition?: number
|
|
24
25
|
/** Extracted markdown headings for search indexing */
|
|
25
|
-
headings?: { level: number; text: string; id: string }[]
|
|
26
|
+
headings?: { level: number; text: string; id: string }[]
|
|
26
27
|
/** The page summary or description */
|
|
27
|
-
description?: string
|
|
28
|
+
description?: string
|
|
28
29
|
/** The locale this route belongs to, if i18n is configured */
|
|
29
|
-
locale?: string
|
|
30
|
+
locale?: string
|
|
30
31
|
/** The version this route belongs to, if versioning is configured */
|
|
31
|
-
version?: string
|
|
32
|
+
version?: string
|
|
32
33
|
/** Optional icon to display (Lucide icon name or raw SVG) */
|
|
33
|
-
icon?: string
|
|
34
|
+
icon?: string
|
|
34
35
|
/** The tab this route belongs to, if tabs are configured */
|
|
35
|
-
tab?: string
|
|
36
|
+
tab?: string
|
|
36
37
|
/** Optional badge to display next to the sidebar item */
|
|
37
|
-
badge?: string | { text:
|
|
38
|
+
badge?: string | { text: 'updated' | 'new' | 'deprecated'; expires?: string }
|
|
38
39
|
/** Optional icon for the route's group */
|
|
39
|
-
groupIcon?: string
|
|
40
|
+
groupIcon?: string
|
|
40
41
|
/** The extracted plain-text content of the page for search indexing */
|
|
41
|
-
_content?: string
|
|
42
|
+
_content?: string
|
|
42
43
|
/** The raw markdown content of the page */
|
|
43
|
-
_rawContent?: string
|
|
44
|
+
_rawContent?: string
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Site configuration provided by the server.
|
|
49
|
+
*/
|
|
50
|
+
export type SiteConfig = BoltdocsConfig
|
|
51
|
+
|
|
46
52
|
/**
|
|
47
53
|
* Configuration options for initializing the Boltdocs client app.
|
|
48
54
|
*/
|
|
49
55
|
export interface CreateBoltdocsAppOptions {
|
|
50
56
|
/** CSS selector for the DOM element where the app should mount (e.g. '#root') */
|
|
51
|
-
target: string
|
|
57
|
+
target: string
|
|
52
58
|
/** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
|
|
53
|
-
routes: ComponentRoute[]
|
|
59
|
+
routes: ComponentRoute[]
|
|
54
60
|
/** The name of the documentation directory (e.g. 'docs') */
|
|
55
|
-
docsDirName: string
|
|
61
|
+
docsDirName: string
|
|
56
62
|
/** Site configuration (`virtual:boltdocs-config`) */
|
|
57
|
-
config:
|
|
63
|
+
config: SiteConfig
|
|
58
64
|
/** Dynamic import mapping from `import.meta.glob` for the documentation pages */
|
|
59
|
-
modules: Record<string, () => Promise<any
|
|
65
|
+
modules: Record<string, () => Promise<{ default: React.ComponentType<any> }>>
|
|
60
66
|
/** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
|
|
61
|
-
hot?:
|
|
67
|
+
hot?: {
|
|
68
|
+
accept: (cb?: (mod: any) => void) => void
|
|
69
|
+
dispose: (cb: (data: any) => void) => void
|
|
70
|
+
on: (event: string, cb: (data: any) => void) => void
|
|
71
|
+
data: any
|
|
72
|
+
}
|
|
62
73
|
/** Optional custom React component to render when visiting the root path ('/') */
|
|
63
|
-
homePage?: React.ComponentType
|
|
74
|
+
homePage?: React.ComponentType
|
|
75
|
+
/** Custom external pages mapped by their route path */
|
|
76
|
+
externalPages?: Record<string, React.ComponentType>
|
|
64
77
|
/** Optional custom MDX components provided by plugins */
|
|
65
|
-
components?: Record<string, React.ComponentType
|
|
78
|
+
components?: Record<string, React.ComponentType>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Types for CodeSandbox integration.
|
|
83
|
+
*/
|
|
84
|
+
export interface SandboxFile {
|
|
85
|
+
content: string | object
|
|
86
|
+
isBinary?: boolean
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type SandboxFiles = Record<string, SandboxFile>
|
|
90
|
+
|
|
91
|
+
export interface SandboxOptions {
|
|
92
|
+
files?: SandboxFiles
|
|
93
|
+
dependencies?: Record<string, string>
|
|
94
|
+
devDependencies?: Record<string, string>
|
|
95
|
+
title?: string
|
|
96
|
+
description?: string
|
|
97
|
+
template?: string
|
|
98
|
+
/** The file path to open by default in the editor (e.g. `"src/App.tsx"`). */
|
|
99
|
+
entry?: string
|
|
100
|
+
/** Options for the embedded iframe view, used by `embedSandbox()`. */
|
|
101
|
+
embed?: SandboxEmbedOptions
|
|
102
|
+
/** Custom scripts for the package.json (e.g. `{ "start": "vite" }`). */
|
|
103
|
+
scripts?: Record<string, string>
|
|
104
|
+
/** Optional default theme configuration for the sandbox project. */
|
|
105
|
+
themeConfig?: Record<string, unknown>
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface SandboxEmbedOptions {
|
|
109
|
+
/** Which panel to display: `"editor"`, `"preview"`, or `"split"`. */
|
|
110
|
+
view?: 'editor' | 'preview' | 'split'
|
|
111
|
+
/** Color theme: `"dark"` or `"light"`. */
|
|
112
|
+
theme?: 'dark' | 'light'
|
|
113
|
+
/** Whether to hide the navigation bar in the embed. */
|
|
114
|
+
hideNavigation?: boolean
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Tab configuration for the documentation site.
|
|
119
|
+
*/
|
|
120
|
+
export interface BoltdocsTab {
|
|
121
|
+
id: string
|
|
122
|
+
text: string
|
|
123
|
+
icon?: string
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Props for the Sidebar component.
|
|
128
|
+
*/
|
|
129
|
+
export interface SidebarProps {
|
|
130
|
+
routes: ComponentRoute[]
|
|
131
|
+
config: BoltdocsConfig
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Props for the OnThisPage (TOC) component.
|
|
136
|
+
*/
|
|
137
|
+
export interface OnThisPageProps {
|
|
138
|
+
headings?: { level: number; text: string; id: string }[]
|
|
139
|
+
editLink?: string
|
|
140
|
+
communityHelp?: string
|
|
141
|
+
filePath?: string
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Props for the Tabs component.
|
|
146
|
+
*/
|
|
147
|
+
export interface TabsProps {
|
|
148
|
+
tabs: BoltdocsTab[]
|
|
149
|
+
routes: ComponentRoute[]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Props for user-defined layout components (layout.tsx).
|
|
154
|
+
*/
|
|
155
|
+
export interface LayoutProps {
|
|
156
|
+
children: React.ReactNode
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Unified type for navbar links.
|
|
161
|
+
*/
|
|
162
|
+
export interface NavbarLink {
|
|
163
|
+
label: string
|
|
164
|
+
href: string
|
|
165
|
+
active: boolean
|
|
166
|
+
/** Optional icon or string for external link indication */
|
|
167
|
+
to?: string
|
|
168
|
+
/** Nested items for NavigationMenu */
|
|
169
|
+
items?: NavbarLink[]
|
|
66
170
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy text to clipboard.
|
|
3
|
+
* @param text - The text to copy.
|
|
4
|
+
* @returns True if the text was copied successfully.
|
|
5
|
+
*/
|
|
6
|
+
export const copyToClipboard = async (text: string) => {
|
|
7
|
+
try {
|
|
8
|
+
await navigator.clipboard.writeText(text)
|
|
9
|
+
return true
|
|
10
|
+
} catch {
|
|
11
|
+
// Fallback
|
|
12
|
+
const textarea = document.createElement('textarea')
|
|
13
|
+
textarea.value = text
|
|
14
|
+
textarea.style.position = 'fixed'
|
|
15
|
+
textarea.style.opacity = '0'
|
|
16
|
+
document.body.appendChild(textarea)
|
|
17
|
+
textarea.select()
|
|
18
|
+
document.execCommand('copy')
|
|
19
|
+
document.body.removeChild(textarea)
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the base file path by removing version and locale prefixes.
|
|
3
|
+
* @param filePath - The full file path.
|
|
4
|
+
* @param version - The version to remove from the path.
|
|
5
|
+
* @param locale - The locale to remove from the path.
|
|
6
|
+
* @returns The base file path.
|
|
7
|
+
*/
|
|
8
|
+
export function getBaseFilePath(
|
|
9
|
+
filePath: string,
|
|
10
|
+
version: string | undefined,
|
|
11
|
+
locale: string | undefined,
|
|
12
|
+
): string {
|
|
13
|
+
let path = filePath
|
|
14
|
+
if (version && (path === version || path.startsWith(version + '/'))) {
|
|
15
|
+
path = path === version ? 'index.md' : path.slice(version.length + 1)
|
|
16
|
+
}
|
|
17
|
+
if (locale && (path === locale || path.startsWith(locale + '/'))) {
|
|
18
|
+
path = path === locale ? 'index.md' : path.slice(locale.length + 1)
|
|
19
|
+
}
|
|
20
|
+
return path
|
|
21
|
+
}
|