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
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/* ═══════════════════════════════════════════════════════════
|
|
2
|
-
Boltdocs — Dark Theme
|
|
3
|
-
Font: Inter · Accent: #7f13ec
|
|
4
|
-
═══════════════════════════════════════════════════════════ */
|
|
5
|
-
|
|
6
|
-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
7
|
-
|
|
8
|
-
:root[data-theme="light"],
|
|
9
|
-
:root.theme-light {
|
|
10
|
-
--ld-bg-main: #ffffff;
|
|
11
|
-
--ld-bg-soft: #eeeeee;
|
|
12
|
-
--ld-bg-mute: #f3f4f6;
|
|
13
|
-
|
|
14
|
-
--ld-surface: #ffffff;
|
|
15
|
-
|
|
16
|
-
--ld-border-subtle: #e5e7eb;
|
|
17
|
-
--ld-border-strong: #d1d5db;
|
|
18
|
-
|
|
19
|
-
--ld-text-main: #111827;
|
|
20
|
-
--ld-text-muted: #4b5563;
|
|
21
|
-
--ld-text-dim: #6b7280;
|
|
22
|
-
|
|
23
|
-
--ld-color-primary: #7f13ec;
|
|
24
|
-
--ld-color-primary-hover: #6d0fd0;
|
|
25
|
-
--ld-color-primary-muted: rgba(127, 19, 236, 0.1);
|
|
26
|
-
--ld-color-primary-glow: rgba(127, 19, 236, 0.25);
|
|
27
|
-
--ld-color-primary-text: #ffffff;
|
|
28
|
-
|
|
29
|
-
/* ─ Buttons ─ */
|
|
30
|
-
--ld-btn-primary-bg: #7f13ec;
|
|
31
|
-
--ld-btn-primary-text: #ffffff;
|
|
32
|
-
--ld-btn-secondary-bg: #ffffff;
|
|
33
|
-
--ld-btn-secondary-text: #111827;
|
|
34
|
-
|
|
35
|
-
--ld-code-bg: #f3f4f6;
|
|
36
|
-
--ld-code-header: #e5e7eb;
|
|
37
|
-
--ld-code-text: #1f2937;
|
|
38
|
-
|
|
39
|
-
/* ─ Customization ─ */
|
|
40
|
-
--ld-navbar-bg: #ffffff;
|
|
41
|
-
--ld-navbar-blur: 12px;
|
|
42
|
-
--ld-sidebar-bg: transparent;
|
|
43
|
-
--ld-sidebar-blur: 0px;
|
|
44
|
-
|
|
45
|
-
/* ─ UI Components (overridable independently from layout) ─ */
|
|
46
|
-
--ld-ui-btn-primary-bg: var(--ld-btn-primary-bg);
|
|
47
|
-
--ld-ui-btn-primary-text: var(--ld-btn-primary-text);
|
|
48
|
-
--ld-ui-btn-secondary-bg: var(--ld-btn-secondary-bg);
|
|
49
|
-
--ld-ui-btn-secondary-text: var(--ld-btn-secondary-text);
|
|
50
|
-
|
|
51
|
-
--ld-ui-success-bg: rgba(34, 197, 94, 0.1);
|
|
52
|
-
--ld-ui-success-text: #16a34a;
|
|
53
|
-
--ld-ui-success-border: rgba(34, 197, 94, 0.25);
|
|
54
|
-
--ld-ui-warning-bg: rgba(245, 158, 11, 0.1);
|
|
55
|
-
--ld-ui-warning-text: #d97706;
|
|
56
|
-
--ld-ui-warning-border: rgba(245, 158, 11, 0.25);
|
|
57
|
-
--ld-ui-danger-bg: rgba(239, 68, 68, 0.1);
|
|
58
|
-
--ld-ui-danger-text: #dc2626;
|
|
59
|
-
--ld-ui-danger-border: rgba(239, 68, 68, 0.25);
|
|
60
|
-
--ld-ui-info-bg: rgba(59, 130, 246, 0.1);
|
|
61
|
-
--ld-ui-info-text: #2563eb;
|
|
62
|
-
--ld-ui-info-border: rgba(59, 130, 246, 0.25);
|
|
63
|
-
--ld-ui-note-bg: rgba(59, 130, 246, 0.06);
|
|
64
|
-
--ld-ui-note-text: #2563eb;
|
|
65
|
-
--ld-ui-note-border: rgba(59, 130, 246, 0.3);
|
|
66
|
-
--ld-ui-tip-bg: rgba(34, 197, 94, 0.06);
|
|
67
|
-
--ld-ui-tip-text: #16a34a;
|
|
68
|
-
--ld-ui-tip-border: rgba(34, 197, 94, 0.3);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:root {
|
|
72
|
-
/* ─ Base palette ─ */
|
|
73
|
-
--ld-bg-main: #000;
|
|
74
|
-
--ld-bg-soft: #12121272;
|
|
75
|
-
--ld-bg-mute: #090909;
|
|
76
|
-
--ld-surface: #1a1a1a;
|
|
77
|
-
--ld-border-subtle: rgba(255, 255, 255, 0.06);
|
|
78
|
-
--ld-border-strong: rgba(255, 255, 255, 0.12);
|
|
79
|
-
|
|
80
|
-
/* ─ Text ─ */
|
|
81
|
-
--ld-text-main: #e4e4ed;
|
|
82
|
-
--ld-text-muted: #9d9db5;
|
|
83
|
-
--ld-text-dim: #6b6b85;
|
|
84
|
-
|
|
85
|
-
/* ─ Accent ─ */
|
|
86
|
-
--ld-color-primary: #ffffff;
|
|
87
|
-
--ld-color-primary-hover: #f3f3f3;
|
|
88
|
-
--ld-color-primary-muted: rgba(255, 255, 255, 0.1);
|
|
89
|
-
--ld-color-primary-glow: rgba(255, 255, 255, 0.25);
|
|
90
|
-
--ld-color-primary-text: #0a0a0f;
|
|
91
|
-
--ld-color-accent: #ffffff; /* White accent for TOC */
|
|
92
|
-
|
|
93
|
-
/* ─ Buttons ─ */
|
|
94
|
-
--ld-btn-primary-bg: #ffffff;
|
|
95
|
-
--ld-btn-primary-text: #0a0a0f;
|
|
96
|
-
--ld-btn-secondary-bg: #1a1a2e;
|
|
97
|
-
--ld-btn-secondary-text: #e4e4ed;
|
|
98
|
-
|
|
99
|
-
/* ─ Code ─ */
|
|
100
|
-
--ld-code-bg: #050505;
|
|
101
|
-
--ld-code-header: #111119;
|
|
102
|
-
--ld-code-text: #d4d4d4;
|
|
103
|
-
|
|
104
|
-
/* ─ Customization ─ */
|
|
105
|
-
--ld-navbar-bg: #000;
|
|
106
|
-
--ld-navbar-blur: 12px;
|
|
107
|
-
--ld-sidebar-bg: transparent;
|
|
108
|
-
--ld-sidebar-blur: 0px;
|
|
109
|
-
|
|
110
|
-
/* ─ UI Components (dark) ─ */
|
|
111
|
-
--ld-ui-btn-primary-bg: var(--ld-btn-primary-bg);
|
|
112
|
-
--ld-ui-btn-primary-text: var(--ld-btn-primary-text);
|
|
113
|
-
--ld-ui-btn-secondary-bg: var(--ld-btn-secondary-bg);
|
|
114
|
-
--ld-ui-btn-secondary-text: var(--ld-btn-secondary-text);
|
|
115
|
-
|
|
116
|
-
--ld-ui-success-bg: rgba(34, 197, 94, 0.1);
|
|
117
|
-
--ld-ui-success-text: #22c55e;
|
|
118
|
-
--ld-ui-success-border: rgba(34, 197, 94, 0.25);
|
|
119
|
-
--ld-ui-warning-bg: rgba(245, 158, 11, 0.1);
|
|
120
|
-
--ld-ui-warning-text: #f59e0b;
|
|
121
|
-
--ld-ui-warning-border: rgba(245, 158, 11, 0.25);
|
|
122
|
-
--ld-ui-danger-bg: rgba(239, 68, 68, 0.1);
|
|
123
|
-
--ld-ui-danger-text: #ef4444;
|
|
124
|
-
--ld-ui-danger-border: rgba(239, 68, 68, 0.25);
|
|
125
|
-
--ld-ui-info-bg: rgba(59, 130, 246, 0.1);
|
|
126
|
-
--ld-ui-info-text: #3b82f6;
|
|
127
|
-
--ld-ui-info-border: rgba(59, 130, 246, 0.25);
|
|
128
|
-
--ld-ui-note-bg: rgba(59, 130, 246, 0.06);
|
|
129
|
-
--ld-ui-note-text: #3b82f6;
|
|
130
|
-
--ld-ui-note-border: rgba(59, 130, 246, 0.3);
|
|
131
|
-
--ld-ui-tip-bg: rgba(34, 197, 94, 0.06);
|
|
132
|
-
--ld-ui-tip-text: #22c55e;
|
|
133
|
-
--ld-ui-tip-border: rgba(34, 197, 94, 0.3);
|
|
134
|
-
|
|
135
|
-
/* ─ Typography ─ */
|
|
136
|
-
--ld-font-sans: "Inter", system-ui, -apple-system, sans-serif;
|
|
137
|
-
--ld-font-mono:
|
|
138
|
-
"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
139
|
-
monospace;
|
|
140
|
-
|
|
141
|
-
/* ─ Dimensions ─ */
|
|
142
|
-
--ld-navbar-height: 3.5rem;
|
|
143
|
-
--ld-header-height: var(--ld-navbar-height); /* Default sync */
|
|
144
|
-
--ld-sidebar-width: 14.5rem;
|
|
145
|
-
--ld-toc-width: 13rem;
|
|
146
|
-
--ld-content-max-width: 820px;
|
|
147
|
-
--ld-radius-sm: 4px;
|
|
148
|
-
--ld-radius-md: 8px;
|
|
149
|
-
--ld-radius-lg: 12px;
|
|
150
|
-
--ld-radius-full: 9999px;
|
|
151
|
-
|
|
152
|
-
/* ─ Custom Scrollbar ─ */
|
|
153
|
-
scrollbar-width: thin;
|
|
154
|
-
scrollbar-color: var(--ld-border-strong) transparent;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/* Chrome, Edge, and Safari */
|
|
158
|
-
*::-webkit-scrollbar {
|
|
159
|
-
width: 6px;
|
|
160
|
-
height: 6px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
*::-webkit-scrollbar-track {
|
|
164
|
-
background: transparent;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
*::-webkit-scrollbar-thumb {
|
|
168
|
-
background-color: var(--ld-border-strong);
|
|
169
|
-
border-radius: 20px;
|
|
170
|
-
border: transparent;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
*::-webkit-scrollbar-thumb:hover {
|
|
174
|
-
background-color: var(--ld-text-dim);
|
|
175
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* ═══════════════════════════════════════════════════════════
|
|
2
|
-
Boltdocs — Dark Theme
|
|
3
|
-
Main Entry Point
|
|
4
|
-
═══════════════════════════════════════════════════════════ */
|
|
5
|
-
|
|
6
|
-
@import "./styles/variables.css";
|
|
7
|
-
@import "./ui/Layout/base.css";
|
|
8
|
-
|
|
9
|
-
/* Core Layout Components */
|
|
10
|
-
@import "./ui/Navbar/navbar.css";
|
|
11
|
-
@import "./ui/Sidebar/sidebar.css";
|
|
12
|
-
@import "./ui/OnThisPage/toc.css";
|
|
13
|
-
@import "./ui/Footer/footer.css";
|
|
14
|
-
@import "./ui/LanguageSwitcher/language-switcher.css";
|
|
15
|
-
@import "./ui/PoweredBy/powered-by.css";
|
|
16
|
-
@import "./ui/CopyMarkdown/copy-markdown.css";
|
|
17
|
-
|
|
18
|
-
/* Markdown Content */
|
|
19
|
-
@import "./styles/markdown.css";
|
|
20
|
-
@import "./components/Video/video.css";
|
|
21
|
-
|
|
22
|
-
/* UI Components (MDX) */
|
|
23
|
-
@import "./components/mdx/mdx-components.css";
|
|
24
|
-
@import "./components/PackageManagerTabs/pkg-tabs.css";
|
|
25
|
-
|
|
26
|
-
/* Interactive Elements */
|
|
27
|
-
@import "./ui/SearchDialog/search.css";
|
|
28
|
-
@import "./ui/Layout/pagination.css";
|
|
29
|
-
|
|
30
|
-
/* Pages */
|
|
31
|
-
@import "./ui/NotFound/not-found.css";
|
|
32
|
-
@import "./ui/Loading/loading.css";
|
|
33
|
-
@import "./ui/ErrorBoundary/error-boundary.css";
|
|
34
|
-
|
|
35
|
-
/* Playground */
|
|
36
|
-
@import "./components/Playground/playground.css";
|
|
37
|
-
|
|
38
|
-
/* Media Queries */
|
|
39
|
-
@import "./ui/Layout/responsive.css";
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { useLocation } from "react-router-dom";
|
|
3
|
-
import { Link } from "../Link";
|
|
4
|
-
import { Home, ChevronRight } from "lucide-react";
|
|
5
|
-
import { ComponentRoute } from "../../../types";
|
|
6
|
-
import { BoltdocsConfig } from "../../../../node/config";
|
|
7
|
-
|
|
8
|
-
export interface BreadcrumbsProps {
|
|
9
|
-
routes: ComponentRoute[];
|
|
10
|
-
config: BoltdocsConfig;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function Breadcrumbs({ routes, config }: BreadcrumbsProps) {
|
|
14
|
-
const location = useLocation();
|
|
15
|
-
|
|
16
|
-
if (config.themeConfig?.breadcrumbs === false) return null;
|
|
17
|
-
if (location.pathname === "/") return null;
|
|
18
|
-
|
|
19
|
-
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
20
|
-
|
|
21
|
-
const groupRoute = currentRoute?.group
|
|
22
|
-
? routes.find((r) => r.group === currentRoute.group)
|
|
23
|
-
: null;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<nav className="boltdocs-breadcrumbs" aria-label="Breadcrumb">
|
|
27
|
-
<ol className="boltdocs-breadcrumbs-list">
|
|
28
|
-
<li className="boltdocs-breadcrumbs-item">
|
|
29
|
-
<Link to="/" className="boltdocs-breadcrumbs-link">
|
|
30
|
-
{/* Home Icon */}
|
|
31
|
-
<Home size={14} />
|
|
32
|
-
</Link>
|
|
33
|
-
<span className="boltdocs-breadcrumbs-separator">
|
|
34
|
-
<ChevronRight size={14} />
|
|
35
|
-
</span>
|
|
36
|
-
</li>
|
|
37
|
-
|
|
38
|
-
{currentRoute?.groupTitle && (
|
|
39
|
-
<li className="boltdocs-breadcrumbs-item">
|
|
40
|
-
{groupRoute ? (
|
|
41
|
-
<Link to={groupRoute.path} className="boltdocs-breadcrumbs-link">
|
|
42
|
-
{currentRoute.groupTitle}
|
|
43
|
-
</Link>
|
|
44
|
-
) : (
|
|
45
|
-
<span className="boltdocs-breadcrumbs-text">
|
|
46
|
-
{currentRoute.groupTitle}
|
|
47
|
-
</span>
|
|
48
|
-
)}
|
|
49
|
-
<span className="boltdocs-breadcrumbs-separator">
|
|
50
|
-
<ChevronRight size={14} />
|
|
51
|
-
</span>
|
|
52
|
-
</li>
|
|
53
|
-
)}
|
|
54
|
-
|
|
55
|
-
{currentRoute?.title && (
|
|
56
|
-
<li className="boltdocs-breadcrumbs-item">
|
|
57
|
-
<span
|
|
58
|
-
className="boltdocs-breadcrumbs-text boltdocs-breadcrumbs-active"
|
|
59
|
-
aria-current="page"
|
|
60
|
-
>
|
|
61
|
-
{currentRoute.title}
|
|
62
|
-
</span>
|
|
63
|
-
</li>
|
|
64
|
-
)}
|
|
65
|
-
</ol>
|
|
66
|
-
</nav>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Breadcrumbs } from "./Breadcrumbs";
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
-
import { Copy, ChevronDown, Check, ExternalLink } from "lucide-react";
|
|
3
|
-
import "./copy-markdown.css";
|
|
4
|
-
|
|
5
|
-
export interface CopyMarkdownProps {
|
|
6
|
-
content?: string;
|
|
7
|
-
config?: boolean | { text?: string; icon?: string };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function CopyMarkdown({ content, config }: CopyMarkdownProps) {
|
|
11
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
-
const [copied, setCopied] = useState(false);
|
|
13
|
-
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
14
|
-
|
|
15
|
-
const isEnabled = config !== false;
|
|
16
|
-
const buttonText = typeof config === "object" ? config.text || "Copy Markdown" : "Copy Markdown";
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
function handleClickOutside(event: MouseEvent) {
|
|
20
|
-
if (
|
|
21
|
-
dropdownRef.current &&
|
|
22
|
-
!dropdownRef.current.contains(event.target as Node)
|
|
23
|
-
) {
|
|
24
|
-
setIsOpen(false);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
28
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
if (!isEnabled || !content) return null;
|
|
32
|
-
|
|
33
|
-
const handleCopy = () => {
|
|
34
|
-
navigator.clipboard.writeText(content);
|
|
35
|
-
setCopied(true);
|
|
36
|
-
setIsOpen(false);
|
|
37
|
-
setTimeout(() => setCopied(false), 2000);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const handleOpenRaw = () => {
|
|
41
|
-
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
|
|
42
|
-
const url = URL.createObjectURL(blob);
|
|
43
|
-
window.open(url, "_blank");
|
|
44
|
-
setIsOpen(false);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div className="boltdocs-copy-markdown" ref={dropdownRef}>
|
|
49
|
-
<div className="copy-btn-group">
|
|
50
|
-
<button
|
|
51
|
-
className="copy-btn"
|
|
52
|
-
onClick={handleCopy}
|
|
53
|
-
aria-label="Copy Markdown"
|
|
54
|
-
>
|
|
55
|
-
{copied ? <Check size={16} /> : <Copy size={16} />}
|
|
56
|
-
<span className="copy-label">{copied ? "Copied!" : buttonText}</span>
|
|
57
|
-
</button>
|
|
58
|
-
<button
|
|
59
|
-
className={`copy-dropdown-toggle ${isOpen ? "is-active" : ""}`}
|
|
60
|
-
onClick={() => setIsOpen(!isOpen)}
|
|
61
|
-
aria-label="More options"
|
|
62
|
-
aria-expanded={isOpen}
|
|
63
|
-
>
|
|
64
|
-
<ChevronDown size={14} className="arrow-icon" />
|
|
65
|
-
</button>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
{isOpen && (
|
|
69
|
-
<div className="copy-dropdown">
|
|
70
|
-
<button className="copy-option" onClick={handleCopy}>
|
|
71
|
-
<Copy size={14} />
|
|
72
|
-
Copy Markdown
|
|
73
|
-
</button>
|
|
74
|
-
<button className="copy-option" onClick={handleOpenRaw}>
|
|
75
|
-
<ExternalLink size={14} />
|
|
76
|
-
View as Markdown
|
|
77
|
-
</button>
|
|
78
|
-
</div>
|
|
79
|
-
)}
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
.boltdocs-copy-markdown {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
z-index: 100;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.copy-btn-group {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: stretch;
|
|
10
|
-
background-color: var(--ld-bg-mute);
|
|
11
|
-
border: 1px solid var(--ld-border-subtle);
|
|
12
|
-
border-radius: var(--ld-radius-full);
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
transition: all 0.2s ease;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.copy-btn-group:hover {
|
|
18
|
-
border-color: var(--ld-color-primary-hover);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.copy-btn {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
gap: 8px;
|
|
25
|
-
padding: 8px 16px;
|
|
26
|
-
background: transparent;
|
|
27
|
-
border: none;
|
|
28
|
-
color: var(--ld-text-main);
|
|
29
|
-
font-size: 14px;
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
transition: background 0.2s ease;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.copy-btn:hover {
|
|
36
|
-
background-color: var(--ld-bg-soft);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.copy-label {
|
|
40
|
-
white-space: nowrap;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.copy-dropdown-toggle {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
padding: 0 10px;
|
|
48
|
-
background: rgba(255, 255, 255, 0.03);
|
|
49
|
-
border: none;
|
|
50
|
-
border-left: 1px solid var(--ld-border-subtle);
|
|
51
|
-
color: var(--ld-text-muted);
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.copy-dropdown-toggle:hover {
|
|
57
|
-
background: rgba(255, 255, 255, 0.1);
|
|
58
|
-
color: var(--ld-text-main);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.copy-dropdown-toggle .arrow-icon {
|
|
62
|
-
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.copy-dropdown-toggle.is-active .arrow-icon {
|
|
66
|
-
transform: rotate(180deg);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.copy-dropdown {
|
|
70
|
-
position: absolute;
|
|
71
|
-
top: calc(100% + 8px);
|
|
72
|
-
right: 0;
|
|
73
|
-
width: 200px;
|
|
74
|
-
background: var(--ld-bg-main);
|
|
75
|
-
border: 1px solid var(--ld-border-subtle);
|
|
76
|
-
border-radius: var(--ld-radius-lg);
|
|
77
|
-
padding: 4px;
|
|
78
|
-
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
|
|
79
|
-
overflow: hidden;
|
|
80
|
-
animation: boltdocs-fade-in 0.2s ease;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.copy-option {
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
gap: 10px;
|
|
87
|
-
width: 100%;
|
|
88
|
-
padding: 10px 12px;
|
|
89
|
-
background: transparent;
|
|
90
|
-
border: none;
|
|
91
|
-
border-radius: 8px;
|
|
92
|
-
color: var(--ld-text-main);
|
|
93
|
-
font-size: 14px;
|
|
94
|
-
text-align: left;
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
transition: background 0.2s ease;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.copy-option:hover {
|
|
100
|
-
background-color: var(--ld-bg-soft);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@keyframes boltdocs-fade-in {
|
|
104
|
-
from {
|
|
105
|
-
opacity: 0;
|
|
106
|
-
transform: translateY(-4px);
|
|
107
|
-
}
|
|
108
|
-
to {
|
|
109
|
-
opacity: 1;
|
|
110
|
-
transform: translateY(0);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./CopyMarkdown";
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
-
import "./error-boundary.css";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
fallback?: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface State {
|
|
10
|
-
hasError: boolean;
|
|
11
|
-
error?: Error;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class ErrorBoundary extends Component<Props, State> {
|
|
15
|
-
public state: State = {
|
|
16
|
-
hasError: false,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
public static getDerivedStateFromError(error: Error): State {
|
|
20
|
-
return { hasError: true, error };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
24
|
-
console.error("Uncaught error in Boltdocs Layout:", error, errorInfo);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public render() {
|
|
28
|
-
if (this.state.hasError) {
|
|
29
|
-
return (
|
|
30
|
-
this.props.fallback || (
|
|
31
|
-
<div className="boltdocs-error-boundary">
|
|
32
|
-
<div className="boltdocs-error-title">Something went wrong</div>
|
|
33
|
-
<p className="boltdocs-error-message">
|
|
34
|
-
{this.state.error?.message ||
|
|
35
|
-
"An unexpected error occurred while rendering this page."}
|
|
36
|
-
</p>
|
|
37
|
-
<button
|
|
38
|
-
className="boltdocs-error-retry"
|
|
39
|
-
onClick={() => this.setState({ hasError: false })}
|
|
40
|
-
>
|
|
41
|
-
Try again
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return this.props.children;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
.boltdocs-error-boundary {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
padding: 3rem 2rem;
|
|
7
|
-
margin: 2rem 0;
|
|
8
|
-
background-color: var(--ld-bg-soft);
|
|
9
|
-
border: 1px solid var(--ld-ui-danger-border);
|
|
10
|
-
border-radius: var(--ld-radius-lg);
|
|
11
|
-
text-align: center;
|
|
12
|
-
backdrop-filter: blur(8px);
|
|
13
|
-
-webkit-backdrop-filter: blur(8px);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.boltdocs-error-title {
|
|
17
|
-
font-size: 1.5rem;
|
|
18
|
-
font-weight: 700;
|
|
19
|
-
color: var(--ld-ui-danger-text);
|
|
20
|
-
margin-bottom: 0.75rem;
|
|
21
|
-
font-family: var(--ld-font-sans);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.boltdocs-error-message {
|
|
25
|
-
font-size: 1rem;
|
|
26
|
-
color: var(--ld-text-muted);
|
|
27
|
-
max-width: 100%;
|
|
28
|
-
margin-bottom: 1.5rem;
|
|
29
|
-
line-height: 1.6;
|
|
30
|
-
overflow-wrap: break-word;
|
|
31
|
-
word-break: break-word;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.boltdocs-error-retry {
|
|
35
|
-
padding: 0.6rem 1.25rem;
|
|
36
|
-
background-color: var(--ld-ui-btn-primary-bg);
|
|
37
|
-
color: var(--ld-ui-btn-primary-text);
|
|
38
|
-
border: none;
|
|
39
|
-
border-radius: var(--ld-radius-full);
|
|
40
|
-
font-size: 0.875rem;
|
|
41
|
-
font-weight: 600;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
transition: all 0.2s ease;
|
|
44
|
-
box-shadow: 0 4px 12px var(--ld-color-primary-glow);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.boltdocs-error-retry:hover {
|
|
48
|
-
background-color: var(--ld-color-primary-hover);
|
|
49
|
-
transform: translateY(-1px);
|
|
50
|
-
box-shadow: 0 6px 16px var(--ld-color-primary-glow);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.boltdocs-error-retry:active {
|
|
54
|
-
transform: translateY(0);
|
|
55
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ErrorBoundary";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* ═══════════════════════════════════════════════════════════
|
|
2
|
-
FOOTER
|
|
3
|
-
═══════════════════════════════════════════════════════════ */
|
|
4
|
-
.boltdocs-footer {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
padding: 1.5rem 2rem;
|
|
9
|
-
border-top: 1px solid var(--ld-border-subtle);
|
|
10
|
-
background-color: var(--ld-bg-soft);
|
|
11
|
-
font-size: 0.8rem;
|
|
12
|
-
color: var(--ld-text-dim);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.footer-copy {
|
|
16
|
-
margin: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.footer-links {
|
|
20
|
-
display: flex;
|
|
21
|
-
gap: 1.25rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.footer-links a {
|
|
25
|
-
color: var(--ld-text-dim);
|
|
26
|
-
text-decoration: none;
|
|
27
|
-
transition: color 0.2s;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.footer-links a:hover {
|
|
31
|
-
color: var(--ld-text-muted);
|
|
32
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { useLocation } from "react-router-dom";
|
|
3
|
-
|
|
4
|
-
interface HeadProps {
|
|
5
|
-
siteTitle: string;
|
|
6
|
-
siteDescription?: string;
|
|
7
|
-
routes: Array<{ path: string; title: string; description?: string }>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function Head({ siteTitle, siteDescription, routes }: HeadProps) {
|
|
11
|
-
const location = useLocation();
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
// Find the current route's metadata
|
|
15
|
-
const currentRoute = routes.find((r) => r.path === location.pathname);
|
|
16
|
-
const pageTitle = currentRoute?.title;
|
|
17
|
-
const pageDescription = currentRoute?.description || siteDescription || "";
|
|
18
|
-
|
|
19
|
-
// Update document title
|
|
20
|
-
document.title = pageTitle ? `${pageTitle} | ${siteTitle}` : siteTitle;
|
|
21
|
-
|
|
22
|
-
// Update or create meta description
|
|
23
|
-
let metaDesc = document.querySelector(
|
|
24
|
-
'meta[name="description"]',
|
|
25
|
-
) as HTMLMetaElement | null;
|
|
26
|
-
if (!metaDesc) {
|
|
27
|
-
metaDesc = document.createElement("meta");
|
|
28
|
-
metaDesc.name = "description";
|
|
29
|
-
document.head.appendChild(metaDesc);
|
|
30
|
-
}
|
|
31
|
-
metaDesc.content = pageDescription;
|
|
32
|
-
|
|
33
|
-
// Update OG tags
|
|
34
|
-
setMetaTag("property", "og:title", document.title);
|
|
35
|
-
setMetaTag("property", "og:description", pageDescription);
|
|
36
|
-
setMetaTag("property", "og:type", "article");
|
|
37
|
-
setMetaTag("property", "og:url", window.location.href);
|
|
38
|
-
|
|
39
|
-
// Twitter card
|
|
40
|
-
setMetaTag("name", "twitter:card", "summary");
|
|
41
|
-
setMetaTag("name", "twitter:title", document.title);
|
|
42
|
-
setMetaTag("name", "twitter:description", pageDescription);
|
|
43
|
-
|
|
44
|
-
// Canonical URL
|
|
45
|
-
let canonical = document.querySelector(
|
|
46
|
-
'link[rel="canonical"]',
|
|
47
|
-
) as HTMLLinkElement | null;
|
|
48
|
-
if (!canonical) {
|
|
49
|
-
canonical = document.createElement("link");
|
|
50
|
-
canonical.rel = "canonical";
|
|
51
|
-
document.head.appendChild(canonical);
|
|
52
|
-
}
|
|
53
|
-
canonical.href = window.location.origin + location.pathname;
|
|
54
|
-
}, [location.pathname, siteTitle, siteDescription, routes]);
|
|
55
|
-
|
|
56
|
-
return null; // This component only manages <head>, no visual output
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function setMetaTag(attr: "name" | "property", key: string, content: string) {
|
|
60
|
-
let tag = document.querySelector(
|
|
61
|
-
`meta[${attr}="${key}"]`,
|
|
62
|
-
) as HTMLMetaElement | null;
|
|
63
|
-
if (!tag) {
|
|
64
|
-
tag = document.createElement("meta");
|
|
65
|
-
tag.setAttribute(attr, key);
|
|
66
|
-
document.head.appendChild(tag);
|
|
67
|
-
}
|
|
68
|
-
tag.content = content;
|
|
69
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Head } from "./Head";
|