blodemd 0.0.5 → 0.0.7
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/README.md +2 -2
- package/dev-server/app/[[...slug]]/page.tsx +139 -0
- package/dev-server/app/blodemd-dev/invalidate/route.ts +12 -0
- package/dev-server/app/blodemd-dev/static/[...path]/route.ts +32 -0
- package/dev-server/app/blodemd-dev/version/route.ts +14 -0
- package/dev-server/app/blodemd-internal/proxy/route.ts +86 -0
- package/dev-server/app/error.tsx +24 -0
- package/dev-server/app/favicon.ico +0 -0
- package/dev-server/app/globals.css +4 -0
- package/dev-server/app/layout.tsx +38 -0
- package/dev-server/app/not-found.tsx +18 -0
- package/dev-server/app/search/route.ts +17 -0
- package/dev-server/components/dev-reload-script.tsx +86 -0
- package/dev-server/components/providers.tsx +15 -0
- package/dev-server/lib/dev-state.ts +8 -0
- package/dev-server/lib/local-content-source.ts +103 -0
- package/dev-server/lib/local-runtime.tsx +558 -0
- package/dev-server/next-env.d.ts +5 -0
- package/dev-server/next.config.js +46 -0
- package/dev-server/package.json +57 -0
- package/dev-server/postcss.config.mjs +7 -0
- package/dev-server/public/glide-variable.woff2 +0 -0
- package/dev-server/tsconfig.json +50 -0
- package/dist/cli.mjs +311 -86
- package/dist/cli.mjs.map +1 -1
- package/docs/app/globals.css +457 -0
- package/docs/components/api/api-playground.tsx +295 -0
- package/docs/components/api/api-reference.tsx +121 -0
- package/docs/components/content/collection-index.tsx +114 -0
- package/docs/components/docs/contextual-menu.tsx +406 -0
- package/docs/components/docs/copy-page-menu.tsx +255 -0
- package/docs/components/docs/doc-header.tsx +210 -0
- package/docs/components/docs/doc-shell.tsx +313 -0
- package/docs/components/docs/doc-sidebar.tsx +211 -0
- package/docs/components/docs/doc-toc.tsx +45 -0
- package/docs/components/docs/mobile-nav.tsx +205 -0
- package/docs/components/icons/doc-icon.tsx +96 -0
- package/docs/components/mdx/accordion.tsx +83 -0
- package/docs/components/mdx/badge.tsx +79 -0
- package/docs/components/mdx/callout.tsx +88 -0
- package/docs/components/mdx/card.tsx +110 -0
- package/docs/components/mdx/code-block.tsx +75 -0
- package/docs/components/mdx/code-group.tsx +94 -0
- package/docs/components/mdx/color.tsx +87 -0
- package/docs/components/mdx/columns.tsx +25 -0
- package/docs/components/mdx/expandable.tsx +45 -0
- package/docs/components/mdx/field-layout.tsx +77 -0
- package/docs/components/mdx/frame.tsx +23 -0
- package/docs/components/mdx/get-text-content.ts +18 -0
- package/docs/components/mdx/icon.tsx +12 -0
- package/docs/components/mdx/index.tsx +107 -0
- package/docs/components/mdx/installer.tsx +20 -0
- package/docs/components/mdx/panel.tsx +11 -0
- package/docs/components/mdx/param-field.tsx +56 -0
- package/docs/components/mdx/preview.tsx +36 -0
- package/docs/components/mdx/prompt.tsx +63 -0
- package/docs/components/mdx/request-example.tsx +27 -0
- package/docs/components/mdx/response-field.tsx +42 -0
- package/docs/components/mdx/steps.tsx +92 -0
- package/docs/components/mdx/tabs.tsx +88 -0
- package/docs/components/mdx/tile.tsx +43 -0
- package/docs/components/mdx/tooltip.tsx +71 -0
- package/docs/components/mdx/tree.tsx +120 -0
- package/docs/components/mdx/type-table.tsx +71 -0
- package/docs/components/mdx/update.tsx +44 -0
- package/docs/components/mdx/video.tsx +12 -0
- package/docs/components/mdx/view.tsx +66 -0
- package/docs/components/providers.tsx +15 -0
- package/docs/components/ui/breadcrumb.tsx +92 -0
- package/docs/components/ui/button.tsx +90 -0
- package/docs/components/ui/card.tsx +92 -0
- package/docs/components/ui/command.tsx +139 -0
- package/docs/components/ui/dialog.tsx +97 -0
- package/docs/components/ui/field.tsx +237 -0
- package/docs/components/ui/input.tsx +105 -0
- package/docs/components/ui/label.tsx +22 -0
- package/docs/components/ui/popover.tsx +72 -0
- package/docs/components/ui/search.tsx +384 -0
- package/docs/components/ui/separator.tsx +26 -0
- package/docs/components/ui/sheet.tsx +104 -0
- package/docs/components/ui/sidebar.tsx +433 -0
- package/docs/components/ui/theme-toggle.tsx +62 -0
- package/docs/components/ui/tooltip.tsx +53 -0
- package/docs/lib/contextual-options.ts +193 -0
- package/docs/lib/docs-collection.ts +22 -0
- package/docs/lib/mdx.ts +87 -0
- package/docs/lib/navigation.ts +288 -0
- package/docs/lib/openapi.ts +158 -0
- package/docs/lib/routes.ts +44 -0
- package/docs/lib/server-cache.ts +83 -0
- package/docs/lib/shiki.ts +40 -0
- package/docs/lib/theme.ts +29 -0
- package/docs/lib/toc.ts +2 -0
- package/docs/lib/utils.ts +5 -0
- package/package.json +43 -6
- package/packages/@repo/common/dist/index.d.ts +9 -0
- package/packages/@repo/common/dist/index.d.ts.map +1 -0
- package/packages/@repo/common/dist/index.js +42 -0
- package/packages/@repo/common/package.json +34 -0
- package/packages/@repo/common/src/index.ts +51 -0
- package/packages/@repo/contracts/dist/api-key.d.ts +30 -0
- package/packages/@repo/contracts/dist/api-key.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/api-key.js +20 -0
- package/packages/@repo/contracts/dist/dates.d.ts +4 -0
- package/packages/@repo/contracts/dist/dates.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/dates.js +2 -0
- package/packages/@repo/contracts/dist/deployment.d.ts +71 -0
- package/packages/@repo/contracts/dist/deployment.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/deployment.js +46 -0
- package/packages/@repo/contracts/dist/domain.d.ts +94 -0
- package/packages/@repo/contracts/dist/domain.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/domain.js +36 -0
- package/packages/@repo/contracts/dist/ids.d.ts +14 -0
- package/packages/@repo/contracts/dist/ids.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/ids.js +10 -0
- package/packages/@repo/contracts/dist/index.d.ts +10 -0
- package/packages/@repo/contracts/dist/index.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/index.js +11 -0
- package/packages/@repo/contracts/dist/pagination.d.ts +23 -0
- package/packages/@repo/contracts/dist/pagination.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/pagination.js +15 -0
- package/packages/@repo/contracts/dist/project.d.ts +25 -0
- package/packages/@repo/contracts/dist/project.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/project.js +23 -0
- package/packages/@repo/contracts/dist/tenant.d.ts +111 -0
- package/packages/@repo/contracts/dist/tenant.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/tenant.js +56 -0
- package/packages/@repo/contracts/dist/user.d.ts +9 -0
- package/packages/@repo/contracts/dist/user.d.ts.map +1 -0
- package/packages/@repo/contracts/dist/user.js +9 -0
- package/packages/@repo/contracts/package.json +37 -0
- package/packages/@repo/contracts/src/api-key.ts +27 -0
- package/packages/@repo/contracts/src/dates.ts +4 -0
- package/packages/@repo/contracts/src/deployment.ts +73 -0
- package/packages/@repo/contracts/src/domain.ts +51 -0
- package/packages/@repo/contracts/src/ids.ts +22 -0
- package/packages/@repo/contracts/src/index.ts +11 -0
- package/packages/@repo/contracts/src/pagination.ts +21 -0
- package/packages/@repo/contracts/src/project.ts +30 -0
- package/packages/@repo/contracts/src/tenant.ts +92 -0
- package/packages/@repo/contracts/src/user.ts +12 -0
- package/packages/@repo/models/dist/docs-config.d.ts +985 -0
- package/packages/@repo/models/dist/docs-config.d.ts.map +1 -0
- package/packages/@repo/models/dist/docs-config.js +548 -0
- package/packages/@repo/models/dist/index.d.ts +3 -0
- package/packages/@repo/models/dist/index.d.ts.map +1 -0
- package/packages/@repo/models/dist/index.js +3 -0
- package/packages/@repo/models/dist/tenant.d.ts +25 -0
- package/packages/@repo/models/dist/tenant.d.ts.map +1 -0
- package/packages/@repo/models/dist/tenant.js +1 -0
- package/packages/@repo/models/package.json +37 -0
- package/packages/@repo/models/src/docs-config.ts +648 -0
- package/packages/@repo/models/src/index.ts +3 -0
- package/packages/@repo/models/src/tenant.ts +29 -0
- package/packages/@repo/prebuild/dist/index.d.ts +2 -0
- package/packages/@repo/prebuild/dist/index.d.ts.map +1 -0
- package/packages/@repo/prebuild/dist/index.js +2 -0
- package/packages/@repo/prebuild/dist/openapi.d.ts +43 -0
- package/packages/@repo/prebuild/dist/openapi.d.ts.map +1 -0
- package/packages/@repo/prebuild/dist/openapi.js +58 -0
- package/packages/@repo/prebuild/package.json +39 -0
- package/packages/@repo/prebuild/src/index.ts +2 -0
- package/packages/@repo/prebuild/src/openapi.ts +116 -0
- package/packages/@repo/previewing/dist/blob-source.d.ts +16 -0
- package/packages/@repo/previewing/dist/blob-source.d.ts.map +1 -0
- package/packages/@repo/previewing/dist/blob-source.js +110 -0
- package/packages/@repo/previewing/dist/content-source.d.ts +12 -0
- package/packages/@repo/previewing/dist/content-source.d.ts.map +1 -0
- package/packages/@repo/previewing/dist/content-source.js +1 -0
- package/packages/@repo/previewing/dist/fs-source.d.ts +11 -0
- package/packages/@repo/previewing/dist/fs-source.d.ts.map +1 -0
- package/packages/@repo/previewing/dist/fs-source.js +72 -0
- package/packages/@repo/previewing/dist/index.d.ts +120 -0
- package/packages/@repo/previewing/dist/index.d.ts.map +1 -0
- package/packages/@repo/previewing/dist/index.js +984 -0
- package/packages/@repo/previewing/package.json +41 -0
- package/packages/@repo/previewing/src/blob-source.ts +167 -0
- package/packages/@repo/previewing/src/content-source.ts +12 -0
- package/packages/@repo/previewing/src/fs-source.ts +104 -0
- package/packages/@repo/previewing/src/index.ts +1490 -0
- package/packages/@repo/validation/dist/index.d.ts +12 -0
- package/packages/@repo/validation/dist/index.d.ts.map +1 -0
- package/packages/@repo/validation/dist/index.js +30 -0
- package/packages/@repo/validation/package.json +37 -0
- package/packages/@repo/validation/src/index.ts +59 -0
- package/packages/@repo/validation/src/mintlify-docs-schema.json +5016 -0
- package/scripts/prepare-package.mjs +39 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import type { SiteConfig } from "@repo/models";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
|
|
5
|
+
import { MobileNav } from "@/components/docs/mobile-nav";
|
|
6
|
+
import { Search } from "@/components/ui/search";
|
|
7
|
+
import { ThemeToggle } from "@/components/ui/theme-toggle";
|
|
8
|
+
import type { NavEntry, NavTab } from "@/lib/navigation";
|
|
9
|
+
import { isExternalHref, resolveHref, toDocHref } from "@/lib/routes";
|
|
10
|
+
import { cn } from "@/lib/utils";
|
|
11
|
+
|
|
12
|
+
const Dropdown = ({
|
|
13
|
+
label,
|
|
14
|
+
items,
|
|
15
|
+
basePath,
|
|
16
|
+
}: {
|
|
17
|
+
label: string;
|
|
18
|
+
items: { label: string; url: string }[];
|
|
19
|
+
basePath: string;
|
|
20
|
+
}) => {
|
|
21
|
+
if (!items.length) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return (
|
|
25
|
+
<details className="relative">
|
|
26
|
+
<summary className="cursor-pointer rounded-full border border-border bg-background px-3 py-1.5 text-sm">
|
|
27
|
+
{label}
|
|
28
|
+
</summary>
|
|
29
|
+
<div className="absolute right-0 top-11 z-20 grid min-w-36 overflow-hidden rounded-xl border border-border bg-popover shadow-popover">
|
|
30
|
+
{items.map((item) => {
|
|
31
|
+
const href = resolveHref(item.url, basePath);
|
|
32
|
+
const isExternal = isExternalHref(item.url);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Link
|
|
36
|
+
className="px-3 py-2 hover:bg-accent"
|
|
37
|
+
href={href}
|
|
38
|
+
key={item.label}
|
|
39
|
+
rel={isExternal ? "noopener noreferrer" : undefined}
|
|
40
|
+
target={isExternal ? "_blank" : undefined}
|
|
41
|
+
>
|
|
42
|
+
{item.label}
|
|
43
|
+
</Link>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</div>
|
|
47
|
+
</details>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const HeaderTabs = ({
|
|
52
|
+
tabs,
|
|
53
|
+
activeTabIndex = 0,
|
|
54
|
+
basePath,
|
|
55
|
+
}: {
|
|
56
|
+
tabs: NavTab[];
|
|
57
|
+
activeTabIndex?: number;
|
|
58
|
+
basePath: string;
|
|
59
|
+
}) => (
|
|
60
|
+
<nav
|
|
61
|
+
aria-label="Navigation tabs"
|
|
62
|
+
className="ml-4 hidden items-center gap-0.5 lg:flex"
|
|
63
|
+
>
|
|
64
|
+
{tabs.map((tab, index) => {
|
|
65
|
+
const isActive = index === activeTabIndex;
|
|
66
|
+
const href =
|
|
67
|
+
(tab.href ? resolveHref(tab.href, basePath) : undefined) ??
|
|
68
|
+
(tab.slugPrefix ? toDocHref(tab.slugPrefix, basePath) : undefined);
|
|
69
|
+
|
|
70
|
+
if (!href) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const isExternal = Boolean(tab.href && isExternalHref(tab.href));
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Link
|
|
78
|
+
className={cn(
|
|
79
|
+
"relative px-2.5 py-1.5 text-sm transition-colors",
|
|
80
|
+
isActive
|
|
81
|
+
? "font-medium text-primary"
|
|
82
|
+
: "text-muted-foreground hover:text-foreground"
|
|
83
|
+
)}
|
|
84
|
+
href={href}
|
|
85
|
+
key={tab.label}
|
|
86
|
+
rel={isExternal ? "noopener noreferrer" : undefined}
|
|
87
|
+
target={isExternal ? "_blank" : undefined}
|
|
88
|
+
>
|
|
89
|
+
{tab.label}
|
|
90
|
+
{isActive ? (
|
|
91
|
+
<span className="absolute inset-x-1 -bottom-3.5 h-0.5 rounded-full bg-primary" />
|
|
92
|
+
) : null}
|
|
93
|
+
</Link>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
96
|
+
</nav>
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// oxlint-disable-next-line eslint/complexity
|
|
100
|
+
export const DocHeader = ({
|
|
101
|
+
config,
|
|
102
|
+
basePath,
|
|
103
|
+
tabs,
|
|
104
|
+
activeTabIndex,
|
|
105
|
+
nav = [],
|
|
106
|
+
}: {
|
|
107
|
+
config: SiteConfig;
|
|
108
|
+
basePath: string;
|
|
109
|
+
tabs?: NavTab[] | null;
|
|
110
|
+
activeTabIndex?: number;
|
|
111
|
+
nav?: NavEntry[];
|
|
112
|
+
}) => {
|
|
113
|
+
const globalLinks = config.navigation?.global?.links ?? [];
|
|
114
|
+
const versions = config.navigation?.versions ?? [];
|
|
115
|
+
const languages = config.navigation?.languages ?? [];
|
|
116
|
+
const [primaryVersion] = versions;
|
|
117
|
+
const [primaryLanguage] = languages;
|
|
118
|
+
const searchDisabled = config.features?.search === false;
|
|
119
|
+
const themeToggleDisabled = config.features?.themeToggle === false;
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<header className="sticky top-0 z-50 w-full bg-background">
|
|
123
|
+
<div className="container-wrapper px-4 lg:px-8">
|
|
124
|
+
<div className="flex h-(--header-height) items-center gap-2">
|
|
125
|
+
<MobileNav
|
|
126
|
+
activeTabIndex={activeTabIndex}
|
|
127
|
+
basePath={basePath}
|
|
128
|
+
className="flex lg:hidden"
|
|
129
|
+
entries={nav}
|
|
130
|
+
globalLinks={globalLinks}
|
|
131
|
+
tabs={tabs}
|
|
132
|
+
/>
|
|
133
|
+
<Link
|
|
134
|
+
className="flex items-center gap-2.5"
|
|
135
|
+
href={toDocHref("index", basePath)}
|
|
136
|
+
>
|
|
137
|
+
{config.logo?.light ? (
|
|
138
|
+
<Image
|
|
139
|
+
alt={config.logo.alt ?? config.name}
|
|
140
|
+
className="dark:hidden"
|
|
141
|
+
data-logo="light"
|
|
142
|
+
height={32}
|
|
143
|
+
loading="eager"
|
|
144
|
+
src={config.logo.light}
|
|
145
|
+
unoptimized
|
|
146
|
+
width={140}
|
|
147
|
+
/>
|
|
148
|
+
) : null}
|
|
149
|
+
{config.logo?.dark ? (
|
|
150
|
+
<Image
|
|
151
|
+
alt={config.logo.alt ?? config.name}
|
|
152
|
+
className="hidden dark:inline-block"
|
|
153
|
+
data-logo="dark"
|
|
154
|
+
height={32}
|
|
155
|
+
loading="eager"
|
|
156
|
+
src={config.logo.dark}
|
|
157
|
+
unoptimized
|
|
158
|
+
width={140}
|
|
159
|
+
/>
|
|
160
|
+
) : null}
|
|
161
|
+
{config.logo?.light || config.logo?.dark ? null : (
|
|
162
|
+
<span className="text-xl font-bold">{config.name}</span>
|
|
163
|
+
)}
|
|
164
|
+
</Link>
|
|
165
|
+
{tabs?.length ? (
|
|
166
|
+
<HeaderTabs
|
|
167
|
+
activeTabIndex={activeTabIndex}
|
|
168
|
+
basePath={basePath}
|
|
169
|
+
tabs={tabs}
|
|
170
|
+
/>
|
|
171
|
+
) : null}
|
|
172
|
+
<nav
|
|
173
|
+
aria-label="External links"
|
|
174
|
+
className="ml-1 hidden items-center gap-0 text-sm text-muted-foreground lg:flex"
|
|
175
|
+
>
|
|
176
|
+
{globalLinks.map((link) => (
|
|
177
|
+
<a
|
|
178
|
+
className="rounded-lg px-2.5 py-1.5 transition-colors hover:bg-muted hover:text-foreground"
|
|
179
|
+
href={link.href}
|
|
180
|
+
key={link.label}
|
|
181
|
+
rel="noopener noreferrer"
|
|
182
|
+
target="_blank"
|
|
183
|
+
>
|
|
184
|
+
{link.label}
|
|
185
|
+
</a>
|
|
186
|
+
))}
|
|
187
|
+
</nav>
|
|
188
|
+
<div className="ml-auto flex items-center gap-2 md:flex-1 md:justify-end">
|
|
189
|
+
{searchDisabled ? null : <Search basePath={basePath} />}
|
|
190
|
+
{primaryVersion ? (
|
|
191
|
+
<Dropdown
|
|
192
|
+
basePath={basePath}
|
|
193
|
+
items={versions}
|
|
194
|
+
label={primaryVersion.label}
|
|
195
|
+
/>
|
|
196
|
+
) : null}
|
|
197
|
+
{primaryLanguage ? (
|
|
198
|
+
<Dropdown
|
|
199
|
+
basePath={basePath}
|
|
200
|
+
items={languages}
|
|
201
|
+
label={primaryLanguage.label}
|
|
202
|
+
/>
|
|
203
|
+
) : null}
|
|
204
|
+
{themeToggleDisabled ? null : <ThemeToggle />}
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</header>
|
|
209
|
+
);
|
|
210
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import type { PageMode, SiteConfig } from "@repo/models";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "blode-icons-react";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import Script from "next/script";
|
|
5
|
+
import { Fragment } from "react";
|
|
6
|
+
import type { ReactNode } from "react";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ContextualMenu,
|
|
10
|
+
ContextualTocItems,
|
|
11
|
+
} from "@/components/docs/contextual-menu";
|
|
12
|
+
import { CopyPageMenu } from "@/components/docs/copy-page-menu";
|
|
13
|
+
import { DocHeader } from "@/components/docs/doc-header";
|
|
14
|
+
import { DocSidebar } from "@/components/docs/doc-sidebar";
|
|
15
|
+
import { DocToc } from "@/components/docs/doc-toc";
|
|
16
|
+
import {
|
|
17
|
+
Breadcrumb,
|
|
18
|
+
BreadcrumbItem,
|
|
19
|
+
BreadcrumbLink,
|
|
20
|
+
BreadcrumbList,
|
|
21
|
+
BreadcrumbPage,
|
|
22
|
+
BreadcrumbSeparator,
|
|
23
|
+
} from "@/components/ui/breadcrumb";
|
|
24
|
+
import type { NavEntry, NavTab } from "@/lib/navigation";
|
|
25
|
+
import { toDocHref } from "@/lib/routes";
|
|
26
|
+
import { themeStylesFromConfig } from "@/lib/theme";
|
|
27
|
+
import type { TocItem } from "@/lib/toc";
|
|
28
|
+
import { cn } from "@/lib/utils";
|
|
29
|
+
|
|
30
|
+
const renderScripts = (
|
|
31
|
+
scripts?: string[],
|
|
32
|
+
strategy: "afterInteractive" | "lazyOnload" = "afterInteractive"
|
|
33
|
+
) =>
|
|
34
|
+
scripts?.map((script) => (
|
|
35
|
+
<Script key={script} src={script} strategy={strategy} />
|
|
36
|
+
)) ?? null;
|
|
37
|
+
|
|
38
|
+
const Breadcrumbs = ({
|
|
39
|
+
basePath,
|
|
40
|
+
breadcrumbs,
|
|
41
|
+
}: {
|
|
42
|
+
basePath: string;
|
|
43
|
+
breadcrumbs: { label: string; path: string }[];
|
|
44
|
+
}) => {
|
|
45
|
+
if (!breadcrumbs.length) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Breadcrumb>
|
|
51
|
+
<BreadcrumbList>
|
|
52
|
+
{breadcrumbs.map((crumb, index) => {
|
|
53
|
+
const key = `${crumb.path || "current"}-${crumb.label}`;
|
|
54
|
+
const isLast = index === breadcrumbs.length - 1;
|
|
55
|
+
return (
|
|
56
|
+
<Fragment key={key}>
|
|
57
|
+
<BreadcrumbItem>
|
|
58
|
+
{isLast ? (
|
|
59
|
+
<BreadcrumbPage>{crumb.label}</BreadcrumbPage>
|
|
60
|
+
) : (
|
|
61
|
+
<BreadcrumbLink asChild>
|
|
62
|
+
<Link href={toDocHref(crumb.path, basePath)}>
|
|
63
|
+
{crumb.label}
|
|
64
|
+
</Link>
|
|
65
|
+
</BreadcrumbLink>
|
|
66
|
+
)}
|
|
67
|
+
</BreadcrumbItem>
|
|
68
|
+
{!isLast && <BreadcrumbSeparator />}
|
|
69
|
+
</Fragment>
|
|
70
|
+
);
|
|
71
|
+
})}
|
|
72
|
+
</BreadcrumbList>
|
|
73
|
+
</Breadcrumb>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// oxlint-disable-next-line eslint/complexity
|
|
78
|
+
export const DocShell = ({
|
|
79
|
+
config,
|
|
80
|
+
nav,
|
|
81
|
+
prevPage,
|
|
82
|
+
nextPage,
|
|
83
|
+
toc,
|
|
84
|
+
content,
|
|
85
|
+
currentPath,
|
|
86
|
+
breadcrumbs,
|
|
87
|
+
pageTitle,
|
|
88
|
+
pageDescription,
|
|
89
|
+
anchors,
|
|
90
|
+
activeTabIndex,
|
|
91
|
+
basePath,
|
|
92
|
+
markdownHref,
|
|
93
|
+
rawContent,
|
|
94
|
+
tabs,
|
|
95
|
+
mode,
|
|
96
|
+
deprecated,
|
|
97
|
+
hideFooterPagination,
|
|
98
|
+
}: {
|
|
99
|
+
config: SiteConfig;
|
|
100
|
+
nav: NavEntry[];
|
|
101
|
+
prevPage?: { title: string; path: string };
|
|
102
|
+
nextPage?: { title: string; path: string; description?: string };
|
|
103
|
+
toc: TocItem[];
|
|
104
|
+
content: ReactNode;
|
|
105
|
+
currentPath: string;
|
|
106
|
+
breadcrumbs: { label: string; path: string }[];
|
|
107
|
+
pageTitle: string;
|
|
108
|
+
pageDescription?: string;
|
|
109
|
+
anchors?: { label: string; href: string }[];
|
|
110
|
+
activeTabIndex?: number;
|
|
111
|
+
basePath: string;
|
|
112
|
+
markdownHref?: string;
|
|
113
|
+
rawContent?: string;
|
|
114
|
+
tabs?: NavTab[] | null;
|
|
115
|
+
mode?: PageMode;
|
|
116
|
+
deprecated?: boolean;
|
|
117
|
+
hideFooterPagination?: boolean;
|
|
118
|
+
}) => {
|
|
119
|
+
const pageMode = mode ?? "default";
|
|
120
|
+
const isCustomMode = pageMode === "custom";
|
|
121
|
+
const showSidebar =
|
|
122
|
+
pageMode !== "custom" &&
|
|
123
|
+
pageMode !== "center" &&
|
|
124
|
+
Boolean((nav?.length ?? 0) || (anchors?.length ?? 0));
|
|
125
|
+
const { contextual } = config;
|
|
126
|
+
const contextualDisplay = contextual?.display ?? "header";
|
|
127
|
+
const hasToc =
|
|
128
|
+
pageMode !== "custom" &&
|
|
129
|
+
pageMode !== "wide" &&
|
|
130
|
+
pageMode !== "frame" &&
|
|
131
|
+
pageMode !== "center" &&
|
|
132
|
+
config.features?.rightToc !== false &&
|
|
133
|
+
config.features?.toc !== false &&
|
|
134
|
+
(toc.length > 0 || (contextual && contextualDisplay === "toc"));
|
|
135
|
+
|
|
136
|
+
const contextualTocItems =
|
|
137
|
+
contextual && contextualDisplay === "toc" && rawContent !== undefined ? (
|
|
138
|
+
<ContextualTocItems
|
|
139
|
+
content={rawContent}
|
|
140
|
+
options={contextual.options}
|
|
141
|
+
pagePath={currentPath}
|
|
142
|
+
title={pageTitle}
|
|
143
|
+
/>
|
|
144
|
+
) : null;
|
|
145
|
+
|
|
146
|
+
const headerContextualMenu =
|
|
147
|
+
contextual && contextualDisplay === "header" && rawContent !== undefined ? (
|
|
148
|
+
<ContextualMenu
|
|
149
|
+
content={rawContent}
|
|
150
|
+
options={contextual.options}
|
|
151
|
+
pagePath={currentPath}
|
|
152
|
+
title={pageTitle}
|
|
153
|
+
/>
|
|
154
|
+
) : null;
|
|
155
|
+
|
|
156
|
+
const innerContent = (
|
|
157
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
158
|
+
<div className="h-(--top-spacing) shrink-0" />
|
|
159
|
+
{isCustomMode ? (
|
|
160
|
+
<main id="main-content">{content}</main>
|
|
161
|
+
) : (
|
|
162
|
+
<main
|
|
163
|
+
className={cn(
|
|
164
|
+
"flex scroll-mt-24 items-stretch gap-1 px-4 lg:px-8",
|
|
165
|
+
!showSidebar && "mx-auto max-w-[960px]"
|
|
166
|
+
)}
|
|
167
|
+
id="main-content"
|
|
168
|
+
>
|
|
169
|
+
<div
|
|
170
|
+
className={cn(
|
|
171
|
+
"mx-auto flex w-full min-w-0 flex-1 flex-col gap-6 py-6 text-neutral-800 lg:py-8 dark:text-neutral-300",
|
|
172
|
+
pageMode === "wide" ? "max-w-[60rem]" : "max-w-[40rem]"
|
|
173
|
+
)}
|
|
174
|
+
>
|
|
175
|
+
<div className="flex flex-col gap-2">
|
|
176
|
+
<Breadcrumbs basePath={basePath} breadcrumbs={breadcrumbs} />
|
|
177
|
+
<div className="flex flex-col gap-2">
|
|
178
|
+
<div className="flex items-center justify-between md:items-start">
|
|
179
|
+
<h1 className="scroll-m-24 text-3xl font-semibold tracking-tight sm:text-3xl">
|
|
180
|
+
{pageTitle}
|
|
181
|
+
{deprecated ? (
|
|
182
|
+
<span className="ml-3 inline-flex translate-y-[-2px] items-center rounded-md bg-yellow-100 px-2 py-0.5 align-middle text-xs font-medium text-yellow-800 dark:bg-yellow-900/40 dark:text-yellow-300">
|
|
183
|
+
Deprecated
|
|
184
|
+
</span>
|
|
185
|
+
) : null}
|
|
186
|
+
</h1>
|
|
187
|
+
{headerContextualMenu ??
|
|
188
|
+
(rawContent === undefined &&
|
|
189
|
+
markdownHref === undefined ? null : (
|
|
190
|
+
<CopyPageMenu
|
|
191
|
+
content={rawContent}
|
|
192
|
+
contentUrl={markdownHref}
|
|
193
|
+
title={pageTitle}
|
|
194
|
+
/>
|
|
195
|
+
))}
|
|
196
|
+
</div>
|
|
197
|
+
{pageDescription ? (
|
|
198
|
+
<p className="text-[1.05rem] text-muted-foreground sm:text-balance sm:text-base md:max-w-[80%]">
|
|
199
|
+
{pageDescription}
|
|
200
|
+
</p>
|
|
201
|
+
) : null}
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
<div className="grid gap-4.5 leading-relaxed [&_blockquote]:border-l-3 [&_blockquote]:border-primary [&_blockquote]:pl-3.5 [&_blockquote]:text-muted-foreground [&_h2]:mt-10 [&_h2]:mb-3 [&_h2]:text-2xl [&_h2]:font-bold [&_h3]:mt-8 [&_h3]:mb-2 [&_h3]:text-[1.375rem] [&_h3]:font-semibold [&_h4]:mt-6 [&_h4]:mb-2 [&_h4]:text-base [&_h4]:font-semibold [&_ol]:list-decimal [&_ol]:pl-5 [&_table]:w-full [&_table]:border-collapse [&_table]:text-sm [&_td]:border-b [&_td]:border-border [&_td]:px-2.5 [&_td]:py-2 [&_td]:text-left [&_th]:border-b [&_th]:border-border [&_th]:px-2.5 [&_th]:py-2 [&_th]:text-left [&_ul]:list-disc [&_ul]:pl-5">
|
|
205
|
+
{content}
|
|
206
|
+
</div>
|
|
207
|
+
{!hideFooterPagination && (prevPage || nextPage) ? (
|
|
208
|
+
<nav
|
|
209
|
+
className="flex w-full rounded-2xl bg-muted/50 p-1 text-sm"
|
|
210
|
+
id="pagination"
|
|
211
|
+
>
|
|
212
|
+
{prevPage ? (
|
|
213
|
+
<Link
|
|
214
|
+
className="group flex items-center justify-between gap-1.5 pl-3 pr-6"
|
|
215
|
+
href={toDocHref(prevPage.path, basePath)}
|
|
216
|
+
>
|
|
217
|
+
<ChevronLeftIcon
|
|
218
|
+
aria-hidden="true"
|
|
219
|
+
className="size-3 text-muted-foreground/50 group-hover:text-muted-foreground"
|
|
220
|
+
/>
|
|
221
|
+
<span className="font-medium tracking-tight text-muted-foreground group-hover:text-foreground">
|
|
222
|
+
Previous
|
|
223
|
+
</span>
|
|
224
|
+
</Link>
|
|
225
|
+
) : null}
|
|
226
|
+
{nextPage ? (
|
|
227
|
+
<Link
|
|
228
|
+
className="group ml-auto flex w-full min-w-0 flex-1"
|
|
229
|
+
href={toDocHref(nextPage.path, basePath)}
|
|
230
|
+
>
|
|
231
|
+
<div className="flex flex-1 items-center justify-end rounded-xl bg-background hover:ring-1 hover:ring-border sm:h-16">
|
|
232
|
+
<div className="flex min-w-0 flex-col items-end justify-center px-5">
|
|
233
|
+
<span className="text-right font-semibold text-foreground/80">
|
|
234
|
+
{nextPage.title}
|
|
235
|
+
</span>
|
|
236
|
+
{nextPage.description ? (
|
|
237
|
+
<span className="hidden w-full truncate text-right text-muted-foreground lg:block lg:w-72">
|
|
238
|
+
{nextPage.description}
|
|
239
|
+
</span>
|
|
240
|
+
) : null}
|
|
241
|
+
</div>
|
|
242
|
+
<div className="h-8 w-px bg-border/50" />
|
|
243
|
+
<div className="flex items-center gap-1.5 pl-5 pr-3">
|
|
244
|
+
<span className="font-medium tracking-tight text-muted-foreground group-hover:text-foreground">
|
|
245
|
+
Next
|
|
246
|
+
</span>
|
|
247
|
+
<ChevronRightIcon
|
|
248
|
+
aria-hidden="true"
|
|
249
|
+
className="size-3 text-muted-foreground/50 group-hover:text-muted-foreground"
|
|
250
|
+
/>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
</Link>
|
|
254
|
+
) : null}
|
|
255
|
+
</nav>
|
|
256
|
+
) : null}
|
|
257
|
+
</div>
|
|
258
|
+
{hasToc ? (
|
|
259
|
+
<DocToc contextualItems={contextualTocItems} toc={toc} />
|
|
260
|
+
) : null}
|
|
261
|
+
</main>
|
|
262
|
+
)}
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<div
|
|
268
|
+
className="min-h-screen font-sans"
|
|
269
|
+
data-has-dark-logo={config.logo?.dark ? "true" : "false"}
|
|
270
|
+
style={themeStylesFromConfig(config)}
|
|
271
|
+
>
|
|
272
|
+
<a
|
|
273
|
+
className="sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[100] focus:rounded-md focus:bg-background focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:shadow-sm"
|
|
274
|
+
href="#main-content"
|
|
275
|
+
>
|
|
276
|
+
Skip to content
|
|
277
|
+
</a>
|
|
278
|
+
{renderScripts(config.scripts?.head)}
|
|
279
|
+
<DocHeader
|
|
280
|
+
activeTabIndex={activeTabIndex}
|
|
281
|
+
basePath={basePath}
|
|
282
|
+
config={config}
|
|
283
|
+
nav={nav}
|
|
284
|
+
tabs={tabs}
|
|
285
|
+
/>
|
|
286
|
+
<div className="container-wrapper flex flex-1 flex-col">
|
|
287
|
+
{showSidebar ? (
|
|
288
|
+
<div
|
|
289
|
+
className="min-h-min flex-1 items-start px-0 [--top-spacing:0] lg:grid lg:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] lg:[--top-spacing:calc(var(--spacing)*4)]"
|
|
290
|
+
style={
|
|
291
|
+
{
|
|
292
|
+
"--sidebar-width": "calc(var(--spacing) * 72)",
|
|
293
|
+
} as React.CSSProperties
|
|
294
|
+
}
|
|
295
|
+
>
|
|
296
|
+
<DocSidebar
|
|
297
|
+
anchors={anchors}
|
|
298
|
+
basePath={basePath}
|
|
299
|
+
currentPath={currentPath}
|
|
300
|
+
entries={nav}
|
|
301
|
+
/>
|
|
302
|
+
{innerContent}
|
|
303
|
+
</div>
|
|
304
|
+
) : (
|
|
305
|
+
<div className="min-h-min flex-1 items-start px-0 [--top-spacing:0] lg:[--top-spacing:calc(var(--spacing)*4)]">
|
|
306
|
+
{innerContent}
|
|
307
|
+
</div>
|
|
308
|
+
)}
|
|
309
|
+
</div>
|
|
310
|
+
{renderScripts(config.scripts?.body, "lazyOnload")}
|
|
311
|
+
</div>
|
|
312
|
+
);
|
|
313
|
+
};
|