@nikala-ui/folio 0.14.0 → 0.15.1
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 +16 -0
- package/dist/cli/commands/init.js +105 -51
- package/dist/client/app.jsx +6 -3
- package/dist/client/components/docs-layout-shell.d.ts +1 -0
- package/dist/client/components/docs-layout-shell.jsx +1 -1
- package/dist/client/components/docs-page-content.jsx +9 -5
- package/dist/client/navigation/page-navigation.js +10 -27
- package/dist/client/public/algolia-logo.svg +15 -0
- package/dist/client/public/favicon.ico +0 -0
- package/dist/client/public/logo.svg +11 -0
- package/dist/client/routing/use-docs-router.d.ts +1 -0
- package/dist/client/routing/use-docs-router.js +12 -3
- package/dist/client/style.css +139 -55
- package/dist/components/ui/api-table.jsx +6 -4
- package/dist/components/ui/code-block.jsx +6 -4
- package/dist/components/ui/command.jsx +9 -5
- package/dist/components/ui/list.jsx +3 -1
- package/dist/components/ui/logo.d.ts +4 -1
- package/dist/components/ui/logo.jsx +8 -22
- package/dist/components/ui/package-manager-tabs.jsx +4 -2
- package/dist/components/ui/pager.jsx +4 -2
- package/dist/components/ui/section-heading.jsx +1 -1
- package/dist/components/ui/sidebar.jsx +6 -3
- package/dist/components/ui/spinner.jsx +3 -1
- package/dist/components/ui/theme-toggle.jsx +14 -12
- package/dist/config.d.ts +1 -0
- package/dist/config.js +84 -29
- package/dist/core/content-scanner.d.ts +2 -1
- package/dist/core/content-scanner.js +2 -9
- package/dist/core/plugin/index.d.ts +2 -0
- package/dist/core/plugin/index.js +1 -0
- package/dist/core/plugin/lifecycle-error.d.ts +19 -0
- package/dist/core/plugin/lifecycle-error.js +28 -0
- package/dist/core/plugin/lifecycle-snapshot.d.ts +1 -0
- package/dist/core/plugin/lifecycle-snapshot.js +156 -0
- package/dist/core/plugin/lifecycle.d.ts +34 -0
- package/dist/core/plugin/lifecycle.js +170 -0
- package/dist/core/route-tree.d.ts +3 -2
- package/dist/core/route-tree.js +40 -10
- package/dist/index.d.ts +7 -4
- package/dist/index.js +4 -3
- package/dist/plugin.d.ts +60 -0
- package/dist/plugin.js +51 -0
- package/dist/plugins/i18n/components/site-language-switcher.d.ts +10 -0
- package/dist/plugins/i18n/components/site-language-switcher.jsx +39 -0
- package/dist/plugins/i18n/constants.d.ts +1 -0
- package/dist/plugins/i18n/constants.js +1 -0
- package/dist/plugins/i18n/index.d.ts +11 -0
- package/dist/plugins/i18n/index.js +89 -0
- package/dist/plugins/i18n/navigation.d.ts +5 -0
- package/dist/plugins/i18n/navigation.js +33 -0
- package/dist/plugins/i18n/runtime.d.ts +19 -0
- package/dist/plugins/i18n/runtime.jsx +65 -0
- package/dist/plugins/i18n/site-locale.d.ts +12 -0
- package/dist/plugins/i18n/site-locale.js +119 -0
- package/dist/search/provider.d.ts +9 -0
- package/dist/search/provider.js +4 -2
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +69 -33
- package/dist/server/module-serialization.d.ts +6 -0
- package/dist/server/module-serialization.js +26 -0
- package/dist/server/plugin/components.d.ts +7 -0
- package/dist/server/plugin/components.js +82 -0
- package/dist/server/plugin/constants.d.ts +17 -0
- package/dist/server/plugin/constants.js +21 -0
- package/dist/server/{plugin.d.ts → plugin/index.d.ts} +3 -1
- package/dist/server/plugin/index.js +166 -0
- package/dist/server/plugin/lifecycle.d.ts +32 -0
- package/dist/server/plugin/lifecycle.js +110 -0
- package/dist/server/plugin/styles.d.ts +3 -0
- package/dist/server/plugin/styles.js +22 -0
- package/dist/server/plugin/virtual-modules.d.ts +11 -0
- package/dist/server/plugin/virtual-modules.js +121 -0
- package/dist/server/seo.d.ts +4 -0
- package/dist/server/seo.js +87 -0
- package/dist/templates/env.d.ts +26 -0
- package/dist/templates/locales/en.json +77 -0
- package/dist/themes/default/components/docs-landing-body.d.ts +17 -0
- package/dist/themes/default/components/docs-landing-body.jsx +17 -0
- package/dist/themes/default/components/docs-page-body.d.ts +21 -0
- package/dist/themes/default/components/docs-page-body.jsx +36 -0
- package/dist/themes/default/components/page-actions.d.ts +15 -0
- package/dist/themes/default/components/page-actions.jsx +60 -0
- package/dist/themes/default/components/page-header.d.ts +7 -0
- package/dist/themes/default/components/page-header.jsx +3 -0
- package/dist/themes/default/components/sidebar-footer.d.ts +6 -0
- package/dist/themes/default/components/sidebar-footer.jsx +12 -0
- package/dist/themes/default/components/sidebar-header.d.ts +8 -0
- package/dist/themes/default/components/sidebar-header.jsx +17 -0
- package/dist/themes/default/components/sidebar-mobile-nav.d.ts +7 -0
- package/dist/themes/default/components/sidebar-mobile-nav.jsx +17 -0
- package/dist/themes/default/components/sidebar-promo.d.ts +8 -0
- package/dist/themes/default/components/sidebar-promo.jsx +20 -0
- package/dist/themes/default/content/breadcrumbs.jsx +5 -2
- package/dist/themes/default/content/table-of-contents.jsx +3 -1
- package/dist/themes/default/hooks/use-page-copy.d.ts +6 -0
- package/dist/themes/default/hooks/use-page-copy.js +26 -0
- package/dist/themes/default/layout.jsx +30 -127
- package/dist/themes/default/lib/layout-visibility.d.ts +8 -0
- package/dist/themes/default/lib/layout-visibility.js +24 -0
- package/dist/themes/default/navbar.jsx +14 -7
- package/dist/themes/default/navigation/mobile-table-of-contents.jsx +5 -3
- package/dist/themes/default/navigation/sidebar-tree.d.ts +2 -0
- package/dist/themes/default/navigation/sidebar-tree.jsx +11 -2
- package/dist/themes/default/overlays/search-dialog.jsx +14 -3
- package/dist/themes/default/sidebar.jsx +21 -49
- package/dist/themes/types.d.ts +5 -0
- package/dist/types.d.ts +36 -0
- package/dist/utils/format-title.d.ts +1 -0
- package/dist/utils/format-title.js +11 -0
- package/dist/vendor/docs-src/client/page-actions.ts +69 -0
- package/dist/vendor/docs-src/components/ui/api-table.tsx +6 -4
- package/dist/vendor/docs-src/components/ui/code-block.tsx +6 -4
- package/dist/vendor/docs-src/components/ui/command.tsx +9 -5
- package/dist/vendor/docs-src/components/ui/list.tsx +4 -2
- package/dist/vendor/docs-src/components/ui/logo.tsx +19 -48
- package/dist/vendor/docs-src/components/ui/package-manager-tabs.tsx +4 -2
- package/dist/vendor/docs-src/components/ui/pager.tsx +4 -2
- package/dist/vendor/docs-src/components/ui/section-heading.tsx +5 -1
- package/dist/vendor/docs-src/components/ui/sidebar.tsx +7 -4
- package/dist/vendor/docs-src/components/ui/spinner.tsx +3 -1
- package/dist/vendor/docs-src/components/ui/theme-toggle.tsx +15 -13
- package/dist/vendor/docs-src/navigation/index.ts +2 -0
- package/dist/vendor/docs-src/navigation/repository-links.ts +43 -0
- package/dist/vendor/docs-src/navigation/sidebar-state.ts +22 -0
- package/dist/vendor/docs-src/navigation/sidebar-tree.ts +15 -0
- package/dist/vendor/docs-src/plugins/i18n/components/site-language-switcher.tsx +56 -0
- package/dist/vendor/docs-src/plugins/i18n/constants.ts +1 -0
- package/dist/vendor/docs-src/plugins/i18n/index.ts +110 -0
- package/dist/vendor/docs-src/plugins/i18n/navigation.ts +49 -0
- package/dist/vendor/docs-src/plugins/i18n/runtime.tsx +91 -0
- package/dist/vendor/docs-src/plugins/i18n/site-locale.ts +140 -0
- package/dist/vendor/docs-src/search/provider.ts +83 -0
- package/dist/vendor/docs-src/themes/default/components/docs-landing-body.tsx +30 -0
- package/dist/vendor/docs-src/themes/default/components/docs-page-body.tsx +53 -0
- package/dist/vendor/docs-src/themes/default/components/page-actions.tsx +105 -0
- package/dist/vendor/docs-src/themes/default/components/page-header.tsx +31 -0
- package/dist/vendor/docs-src/themes/default/components/sidebar-footer.tsx +21 -0
- package/dist/vendor/docs-src/themes/default/components/sidebar-header.tsx +30 -0
- package/dist/vendor/docs-src/themes/default/components/sidebar-mobile-nav.tsx +33 -0
- package/dist/vendor/docs-src/themes/default/components/sidebar-promo.tsx +37 -0
- package/dist/vendor/docs-src/themes/default/content/breadcrumbs.tsx +43 -0
- package/dist/vendor/docs-src/themes/default/content/pager.tsx +19 -0
- package/dist/vendor/docs-src/themes/default/content/table-of-contents.tsx +32 -0
- package/dist/vendor/docs-src/themes/default/hooks/use-page-copy.ts +29 -0
- package/dist/vendor/docs-src/themes/default/icons.ts +16 -0
- package/dist/vendor/docs-src/themes/default/index.ts +46 -0
- package/dist/vendor/docs-src/themes/default/layout.tsx +176 -0
- package/dist/vendor/docs-src/themes/default/lib/layout-visibility.ts +39 -0
- package/dist/vendor/docs-src/themes/default/navbar.tsx +130 -0
- package/dist/vendor/docs-src/themes/default/navigation/mobile-table-of-contents.tsx +61 -0
- package/dist/vendor/docs-src/themes/default/navigation/sidebar-tree.tsx +202 -0
- package/dist/vendor/docs-src/themes/default/overlays/search-dialog.tsx +106 -0
- package/dist/vendor/docs-src/themes/default/sidebar.tsx +86 -0
- package/dist/vendor/docs-src/themes/index.ts +4 -0
- package/dist/vendor/docs-src/themes/types.ts +87 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +11 -4
- package/dist/server/plugin.js +0 -521
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
// packages/docs/src/themes/default/layout.tsx
|
|
2
|
-
import { createSignal,
|
|
2
|
+
import { createSignal, Show, splitProps } from "solid-js";
|
|
3
3
|
import { SidebarProvider } from "@/components/ui/sidebar";
|
|
4
4
|
import { SidebarInset } from "@/components/ui/sidebar";
|
|
5
|
-
import { Container } from "@/components/ui/container";
|
|
6
|
-
import { SectionHeading } from "@/components/ui/section-heading";
|
|
7
5
|
import { DocsNavbar } from "./navbar.jsx";
|
|
8
6
|
import { DocsSidebar } from "./sidebar.jsx";
|
|
9
|
-
import { DocsBreadcrumbs } from "./content/breadcrumbs.jsx";
|
|
10
|
-
import { DocsPager } from "./content/pager.jsx";
|
|
11
|
-
import { DocsTableOfContents } from "./content/table-of-contents.jsx";
|
|
12
|
-
import { DocsMobileTableOfContents } from "./navigation/mobile-table-of-contents.jsx";
|
|
13
7
|
import { DocsSearchDialog } from "./overlays/search-dialog.jsx";
|
|
14
8
|
import { cn } from "@/lib/cn";
|
|
15
|
-
import { buttonVariants } from "@/components/ui/button";
|
|
16
|
-
import { Button } from "@/components/ui/button";
|
|
17
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu";
|
|
18
|
-
import { createClipboard } from "@/hooks/create-clipboard";
|
|
19
|
-
import { Copy, FileText, ChevronDown, ExternalLink } from "lucide-solid";
|
|
20
|
-
import { pageToMarkdown, pageToText, resolvePageActionUrl, sourceToMarkdown } from "../../client/page-actions.js";
|
|
21
9
|
import { getRepositorySourceUrl } from "../../navigation/repository-links.js";
|
|
22
10
|
import { resolveSearchProvider } from "../../search/provider.js";
|
|
11
|
+
import { DocsPageBody } from "./components/docs-page-body.jsx";
|
|
12
|
+
import { DocsLandingBody } from "./components/docs-landing-body.jsx";
|
|
13
|
+
import { PageHeader } from "./components/page-header.jsx";
|
|
14
|
+
import { createPageCopy } from "./hooks/use-page-copy.js";
|
|
15
|
+
import { isLandingPage, shouldShowLandingSidebar, shouldShowNavbar, shouldShowSidebarFooter, shouldShowSidebarHeader, shouldShowToc, shouldUseSidebarLayout, } from "./lib/layout-visibility.js";
|
|
23
16
|
export const DocsLayout = (props) => {
|
|
24
17
|
const [local, rest] = splitProps(props, [
|
|
25
18
|
"config",
|
|
26
19
|
"tree",
|
|
27
20
|
"pages",
|
|
28
21
|
"currentPage",
|
|
22
|
+
"onNavigate",
|
|
29
23
|
"breadcrumbs",
|
|
30
24
|
"toc",
|
|
31
25
|
"prev",
|
|
@@ -35,20 +29,18 @@ export const DocsLayout = (props) => {
|
|
|
35
29
|
"class",
|
|
36
30
|
]);
|
|
37
31
|
const [searchOpen, setSearchOpen] = createSignal(false);
|
|
38
|
-
const
|
|
32
|
+
const pageCopy = createPageCopy(() => local.sourceContent);
|
|
39
33
|
const searchEnabled = () => local.config.search?.enabled !== false;
|
|
40
34
|
const searchProvider = () => resolveSearchProvider(local.config.search);
|
|
41
35
|
const currentUrl = () => local.currentPage?.url;
|
|
42
|
-
const landingPage = () => local.currentPage
|
|
43
|
-
const showLandingSidebar = () => local.config
|
|
44
|
-
const showNavbar = () => local.config
|
|
45
|
-
const showToc = () =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
const sidebarHeader = () => local.config.navigation?.sidebar?.header !== false;
|
|
51
|
-
const sidebarFooter = () => local.config.navigation?.sidebar?.footer !== false;
|
|
36
|
+
const landingPage = () => isLandingPage(local.currentPage, local.config);
|
|
37
|
+
const showLandingSidebar = () => shouldShowLandingSidebar(local.config);
|
|
38
|
+
const showNavbar = () => shouldShowNavbar(local.config);
|
|
39
|
+
const showToc = () => shouldShowToc(local.toc, local.currentPage, local.config, landingPage());
|
|
40
|
+
const sidebarLayout = () => shouldUseSidebarLayout(local.config);
|
|
41
|
+
const sidebarHeader = () => shouldShowSidebarHeader(local.config);
|
|
42
|
+
const sidebarFooter = () => shouldShowSidebarFooter(local.config);
|
|
43
|
+
const sidebarPromo = () => local.config.navigation?.sidebar?.promo;
|
|
52
44
|
const sourceUrl = () => {
|
|
53
45
|
const page = local.currentPage;
|
|
54
46
|
const repository = local.config.repository;
|
|
@@ -56,129 +48,40 @@ export const DocsLayout = (props) => {
|
|
|
56
48
|
return undefined;
|
|
57
49
|
return getRepositorySourceUrl(repository, page.sourcePath, local.config.contentDir || "docs");
|
|
58
50
|
};
|
|
59
|
-
const
|
|
60
|
-
? document.querySelector("main article [data-docs-page-content]")
|
|
61
|
-
: null;
|
|
62
|
-
const markdown = () => local.sourceContent
|
|
63
|
-
? sourceToMarkdown(local.sourceContent)
|
|
64
|
-
: pageElement() ? pageToMarkdown(pageElement()) : "";
|
|
65
|
-
const copyPage = async () => {
|
|
66
|
-
const page = pageElement();
|
|
67
|
-
if (page)
|
|
68
|
-
await pageClipboard.copy(pageToText(page));
|
|
69
|
-
};
|
|
70
|
-
const copyMarkdown = async () => {
|
|
71
|
-
const content = markdown();
|
|
72
|
-
if (content)
|
|
73
|
-
await pageClipboard.copy(content);
|
|
74
|
-
};
|
|
51
|
+
const markdown = pageCopy.markdown;
|
|
75
52
|
const aiProviders = () => local.config.pageActions?.ai || [];
|
|
76
53
|
const copyPageEnabled = () => local.config.pageActions?.copyPage !== false;
|
|
77
54
|
const copyMarkdownEnabled = () => local.config.pageActions?.copyMarkdown !== false;
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
url: typeof window !== "undefined" ? window.location.href : "",
|
|
81
|
-
content: markdown(),
|
|
82
|
-
title: local.currentPage?.title,
|
|
83
|
-
prompt: provider.prompt,
|
|
84
|
-
});
|
|
85
|
-
const sidebar = (className) => (<DocsSidebar tree={local.tree} nav={local.config.navigation?.navbar || local.config.nav} currentUrl={currentUrl()} title={local.config.title} logo={local.config.logo} headerSubtitle={local.config.navigation?.sidebar?.headerSubtitle} footerText={local.config.navigation?.sidebar?.footerText} showHeader={sidebarHeader()} showFooter={sidebarFooter()} class={className}/>);
|
|
55
|
+
const pageActions = () => local.currentPage?.pageActions || [];
|
|
56
|
+
const sidebar = (className) => (<DocsSidebar tree={local.tree} pages={local.pages} nav={local.config.navigation?.navbar || local.config.nav} currentUrl={currentUrl()} title={local.config.title} logo={local.config.logo} headerSubtitle={local.config.navigation?.sidebar?.headerSubtitle} footerText={local.config.navigation?.sidebar?.footerText} showHeader={sidebarHeader()} showFooter={sidebarFooter()} class={className}/>);
|
|
86
57
|
const content = () => (<SidebarInset class={cn("min-w-0", local.class)} {...rest}>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<Show when={local.currentPage?.title}>
|
|
93
|
-
<SectionHeading variant="page" title={local.currentPage.title} description={local.currentPage?.description} class="mb-8" actions={<div class="flex items-center gap-2">
|
|
94
|
-
<Show when={sourceUrl()}>
|
|
95
|
-
{(url) => (<a href={url()} target="_blank" rel="noreferrer" class={cn(buttonVariants({ variant: "secondary", size: "sm" }), "shrink-0")}>
|
|
96
|
-
View source
|
|
97
|
-
</a>)}
|
|
98
|
-
</Show>
|
|
99
|
-
<Show when={hasPageActions()}>
|
|
100
|
-
<DropdownMenu placement="bottom-end">
|
|
101
|
-
<DropdownMenuTrigger as={Button} variant="secondary" size="sm" class="shrink-0 gap-1" aria-label="Copy documentation page">
|
|
102
|
-
<Copy class="size-3.5"/>
|
|
103
|
-
<span class="hidden sm:inline">Copy page</span>
|
|
104
|
-
<ChevronDown class="size-3.5"/>
|
|
105
|
-
</DropdownMenuTrigger>
|
|
106
|
-
<DropdownMenuContent>
|
|
107
|
-
<Show when={copyPageEnabled()}>
|
|
108
|
-
<DropdownMenuItem onClick={copyPage}>
|
|
109
|
-
<FileText class="mr-2 size-4"/>
|
|
110
|
-
Copy page
|
|
111
|
-
</DropdownMenuItem>
|
|
112
|
-
</Show>
|
|
113
|
-
<Show when={copyMarkdownEnabled()}>
|
|
114
|
-
<DropdownMenuItem onClick={copyMarkdown}>
|
|
115
|
-
<Copy class="mr-2 size-4"/>
|
|
116
|
-
Copy as Markdown
|
|
117
|
-
</DropdownMenuItem>
|
|
118
|
-
</Show>
|
|
119
|
-
<Show when={aiProviders().length > 0}>
|
|
120
|
-
<For each={aiProviders()}>
|
|
121
|
-
{(provider) => (<DropdownMenuItem as="a" href={pageActionUrl(provider)} target="_blank" rel="noreferrer">
|
|
122
|
-
<ExternalLink class="mr-2 size-4"/>
|
|
123
|
-
Open in {provider.name}
|
|
124
|
-
</DropdownMenuItem>)}
|
|
125
|
-
</For>
|
|
126
|
-
</Show>
|
|
127
|
-
</DropdownMenuContent>
|
|
128
|
-
</DropdownMenu>
|
|
129
|
-
</Show>
|
|
130
|
-
</div>}/>
|
|
131
|
-
</Show>
|
|
132
|
-
<Show when={showToc()}>
|
|
133
|
-
<DocsMobileTableOfContents items={local.toc} class="mb-6"/>
|
|
134
|
-
</Show>
|
|
135
|
-
<Container as="div" size="full" class="prose prose-zinc dark:prose-invert max-w-none px-0 sm:px-0 lg:px-0" data-docs-page-content>
|
|
136
|
-
{local.children}
|
|
137
|
-
</Container>
|
|
138
|
-
<Show when={local.prev || local.next}>
|
|
139
|
-
<DocsPager prev={local.prev} next={local.next}/>
|
|
140
|
-
</Show>
|
|
141
|
-
</Container>
|
|
142
|
-
<Show when={showToc() && local.currentPage?.url} keyed>
|
|
143
|
-
<Container as="aside" size="sm" class="hidden xl:block w-64 shrink-0 self-start px-0 sticky top-14 z-10 h-fit max-h-[calc(100vh-3.5rem)] overflow-hidden bg-background">
|
|
144
|
-
<DocsTableOfContents items={local.toc} class="max-h-[calc(100vh-3.5rem)]"/>
|
|
145
|
-
</Container>
|
|
146
|
-
</Show>
|
|
147
|
-
</Container>
|
|
58
|
+
<DocsPageBody breadcrumbs={local.breadcrumbs} currentPage={local.currentPage} toc={local.toc} prev={local.prev} next={local.next} showToc={showToc()} sidebarPromo={sidebarPromo()} pageActions={<Show when={local.currentPage?.title}>
|
|
59
|
+
<PageHeader title={local.currentPage.title} description={local.currentPage?.description} sourceUrl={sourceUrl()} pageActions={pageActions()} aiProviders={aiProviders()} copyPageEnabled={copyPageEnabled()} copyMarkdownEnabled={copyMarkdownEnabled()} pageUrl={local.currentPage?.url} pageTitle={local.currentPage?.title} markdown={markdown} onCopyPage={pageCopy.copyPage} onCopyMarkdown={pageCopy.copyMarkdown}/>
|
|
60
|
+
</Show>}>
|
|
61
|
+
{local.children}
|
|
62
|
+
</DocsPageBody>
|
|
148
63
|
<DocsSearchDialog open={searchOpen()} onOpenChange={setSearchOpen} pages={local.pages} provider={searchEnabled() ? searchProvider().implementation : undefined}/>
|
|
149
64
|
</SidebarInset>);
|
|
150
65
|
const landingContent = () => (<SidebarInset class={cn("min-w-0", local.class)} {...rest}>
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<Show when={local.breadcrumbs && local.breadcrumbs.length > 0}>
|
|
155
|
-
<DocsBreadcrumbs items={local.breadcrumbs} class="mb-6"/>
|
|
156
|
-
</Show>
|
|
157
|
-
</Show>
|
|
158
|
-
<Container as="div" size="full" class="prose prose-zinc dark:prose-invert max-w-none px-0" data-docs-page-content>
|
|
159
|
-
{local.children}
|
|
160
|
-
</Container>
|
|
161
|
-
<Show when={local.config.home?.showPager === true && (local.prev || local.next)}>
|
|
162
|
-
<DocsPager prev={local.prev} next={local.next}/>
|
|
163
|
-
</Show>
|
|
164
|
-
</Container>
|
|
165
|
-
</Container>
|
|
66
|
+
<DocsLandingBody breadcrumbs={local.breadcrumbs} showBreadcrumbs={local.config.home?.showBreadcrumbs === true} showPager={local.config.home?.showPager === true} prev={local.prev} next={local.next}>
|
|
67
|
+
{local.children}
|
|
68
|
+
</DocsLandingBody>
|
|
166
69
|
<DocsSearchDialog open={searchOpen()} onOpenChange={setSearchOpen} pages={local.pages} provider={searchEnabled() ? searchProvider().implementation : undefined}/>
|
|
167
70
|
</SidebarInset>);
|
|
168
71
|
return (<SidebarProvider defaultOpen={true} class="min-h-screen w-full items-stretch">
|
|
169
72
|
<Show when={landingPage()} fallback={<Show when={sidebarLayout()} fallback={<div class="flex min-h-screen min-w-0 flex-1 flex-col">
|
|
170
|
-
<DocsNavbar config={local.config} showBrand={true} showSidebarTrigger={false} onOpenSearch={() => setSearchOpen(true)}/>
|
|
73
|
+
<DocsNavbar config={local.config} currentPage={local.currentPage} pages={local.pages} onNavigate={local.onNavigate} showBrand={true} showSidebarTrigger={false} onOpenSearch={() => setSearchOpen(true)}/>
|
|
171
74
|
<div class="flex min-h-0 min-w-0 max-w-full flex-1 items-start">{content()}</div>
|
|
172
75
|
</div>}>
|
|
173
76
|
{sidebar()}
|
|
174
77
|
<div class="flex min-h-screen min-w-0 flex-1 flex-col">
|
|
175
|
-
<DocsNavbar config={local.config} showBrand={false} onOpenSearch={() => setSearchOpen(true)}/>
|
|
78
|
+
<DocsNavbar config={local.config} currentPage={local.currentPage} pages={local.pages} onNavigate={local.onNavigate} showBrand={false} onOpenSearch={() => setSearchOpen(true)}/>
|
|
176
79
|
{content()}
|
|
177
80
|
</div>
|
|
178
81
|
</Show>}>
|
|
179
82
|
<div class="flex min-h-screen min-w-0 flex-1 flex-col">
|
|
180
83
|
<Show when={showNavbar()}>
|
|
181
|
-
<DocsNavbar config={local.config} showBrand={true} showSidebarTrigger={showLandingSidebar()} mobileSidebarTrigger={landingPage()} onOpenSearch={() => setSearchOpen(true)}/>
|
|
84
|
+
<DocsNavbar config={local.config} currentPage={local.currentPage} pages={local.pages} onNavigate={local.onNavigate} showBrand={true} showSidebarTrigger={showLandingSidebar()} mobileSidebarTrigger={landingPage()} onOpenSearch={() => setSearchOpen(true)}/>
|
|
182
85
|
</Show>
|
|
183
86
|
<Show when={showLandingSidebar()} fallback={<>
|
|
184
87
|
<Show when={landingPage()}>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DocsConfig, PageData, TocItem } from "../../../types.js";
|
|
2
|
+
export declare function isLandingPage(page: PageData | undefined, config: DocsConfig): boolean;
|
|
3
|
+
export declare function shouldShowLandingSidebar(config: DocsConfig): boolean;
|
|
4
|
+
export declare function shouldShowNavbar(config: DocsConfig): boolean;
|
|
5
|
+
export declare function shouldShowToc(toc: TocItem[] | undefined, page: PageData | undefined, config: DocsConfig, landingPage: boolean): boolean;
|
|
6
|
+
export declare function shouldUseSidebarLayout(config: DocsConfig): boolean;
|
|
7
|
+
export declare function shouldShowSidebarHeader(config: DocsConfig): boolean;
|
|
8
|
+
export declare function shouldShowSidebarFooter(config: DocsConfig): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function isLandingPage(page, config) {
|
|
2
|
+
return page?.url === "/" && config.home?.layout === "landing";
|
|
3
|
+
}
|
|
4
|
+
export function shouldShowLandingSidebar(config) {
|
|
5
|
+
return config.home?.showSidebar === true;
|
|
6
|
+
}
|
|
7
|
+
export function shouldShowNavbar(config) {
|
|
8
|
+
return config.home?.showNavbar !== false;
|
|
9
|
+
}
|
|
10
|
+
export function shouldShowToc(toc, page, config, landingPage) {
|
|
11
|
+
return Boolean(toc &&
|
|
12
|
+
toc.length > 0 &&
|
|
13
|
+
page?.frontmatter?.toc !== false &&
|
|
14
|
+
(!landingPage || config.home?.showToc === true));
|
|
15
|
+
}
|
|
16
|
+
export function shouldUseSidebarLayout(config) {
|
|
17
|
+
return config.navigation?.layout !== "top";
|
|
18
|
+
}
|
|
19
|
+
export function shouldShowSidebarHeader(config) {
|
|
20
|
+
return config.navigation?.sidebar?.header !== false;
|
|
21
|
+
}
|
|
22
|
+
export function shouldShowSidebarFooter(config) {
|
|
23
|
+
return config.navigation?.sidebar?.footer !== false;
|
|
24
|
+
}
|
|
@@ -10,14 +10,17 @@ import { buttonVariants } from "@/components/ui/button";
|
|
|
10
10
|
import { Kbd } from "@/components/ui/kbd";
|
|
11
11
|
import { SidebarTrigger } from "@/components/ui/sidebar";
|
|
12
12
|
import { ThemeToggle } from "@/components/ui/theme-toggle";
|
|
13
|
+
import { DocsSiteLanguageSwitcher } from "../../plugins/i18n/components/site-language-switcher.jsx";
|
|
14
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
13
15
|
import { Logo } from "@/components/ui/logo";
|
|
14
16
|
import { Search } from "lucide-solid";
|
|
15
17
|
export const DocsNavbar = (props) => {
|
|
16
|
-
const [local, rest] = splitProps(props, ["config", "onOpenSearch", "showBrand", "showSidebarTrigger", "mobileSidebarTrigger", "class"]);
|
|
18
|
+
const [local, rest] = splitProps(props, ["config", "currentPage", "pages", "onNavigate", "onOpenSearch", "showBrand", "showSidebarTrigger", "mobileSidebarTrigger", "class"]);
|
|
17
19
|
const title = () => local.config.title || "Folio";
|
|
18
20
|
const logoText = () => local.config.logo?.text || title();
|
|
19
21
|
const logoHref = () => local.config.logo?.href || "/";
|
|
20
22
|
const repoUrl = () => local.config.repository?.url;
|
|
23
|
+
const siteLocale = useSiteLocale();
|
|
21
24
|
return (<Navbar variant="default" maxWidth="full" isSticky={true} class={local.class} {...rest}>
|
|
22
25
|
<NavbarContainer class="h-14 md:h-14 px-4 sm:px-6">
|
|
23
26
|
<NavbarContent justify="start" class="gap-3">
|
|
@@ -26,7 +29,7 @@ export const DocsNavbar = (props) => {
|
|
|
26
29
|
</Show>
|
|
27
30
|
<Show when={local.showBrand !== false}>
|
|
28
31
|
<NavbarBrand href={logoHref()} class="text-base font-bold tracking-tight">
|
|
29
|
-
<Show when={local.config.logo?.image} fallback={<Logo class="
|
|
32
|
+
<Show when={local.config.logo?.image} fallback={<Logo class="h-6 w-auto"/>}>
|
|
30
33
|
{(img) => <img src={img()} alt={logoText()} class="size-6 object-contain"/>}
|
|
31
34
|
</Show>
|
|
32
35
|
<span>{logoText()}</span>
|
|
@@ -50,13 +53,13 @@ export const DocsNavbar = (props) => {
|
|
|
50
53
|
<Show when={local.config.search?.enabled !== false && local.onOpenSearch}>
|
|
51
54
|
<NavbarItem>
|
|
52
55
|
<Button variant="outline" size="sm" onClick={() => local.onOpenSearch?.()} class="hidden sm:inline-flex text-muted-foreground w-48 sm:w-64 justify-between h-8 text-xs font-normal">
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
<span class="inline-flex items-center gap-2">
|
|
57
|
+
<Search class="size-3.5"/>
|
|
58
|
+
<span>{siteLocale.t("navigation.search")}</span>
|
|
56
59
|
</span>
|
|
57
60
|
<Kbd size="sm">⌘K</Kbd>
|
|
58
61
|
</Button>
|
|
59
|
-
<Button variant="ghost" size="sm" onClick={() => local.onOpenSearch?.()} class="sm:hidden p-2" aria-label="
|
|
62
|
+
<Button variant="ghost" size="sm" onClick={() => local.onOpenSearch?.()} class="sm:hidden p-2" aria-label={siteLocale.t("navigation.searchLabel")}>
|
|
60
63
|
<Search class="size-4"/>
|
|
61
64
|
</Button>
|
|
62
65
|
</NavbarItem>
|
|
@@ -66,11 +69,15 @@ export const DocsNavbar = (props) => {
|
|
|
66
69
|
<Show when={repoUrl()}>
|
|
67
70
|
{(url) => (<NavbarItem>
|
|
68
71
|
<a href={url()} target="_blank" rel="noreferrer" class={buttonVariants({ variant: "ghost", size: "sm" }) + " hidden sm:inline-flex h-8 px-2 text-xs"}>
|
|
69
|
-
|
|
72
|
+
{siteLocale.t("navigation.github")}
|
|
70
73
|
</a>
|
|
71
74
|
</NavbarItem>)}
|
|
72
75
|
</Show>
|
|
73
76
|
|
|
77
|
+
<NavbarItem>
|
|
78
|
+
<DocsSiteLanguageSwitcher currentPage={local.currentPage} pages={local.pages} onNavigate={local.onNavigate}/>
|
|
79
|
+
</NavbarItem>
|
|
80
|
+
|
|
74
81
|
{/* Theme Toggle */}
|
|
75
82
|
<NavbarItem>
|
|
76
83
|
<ThemeToggle />
|
|
@@ -5,12 +5,14 @@ import { CollapsibleTrigger } from "@/components/ui/collapsible";
|
|
|
5
5
|
import { cn } from "@/lib/cn";
|
|
6
6
|
import { ChevronDown } from "lucide-solid";
|
|
7
7
|
import { DocsTableOfContents } from "../content/table-of-contents.jsx";
|
|
8
|
+
import { useSiteLocale } from "../../../plugins/i18n/runtime.jsx";
|
|
8
9
|
export const DocsMobileTableOfContents = (props) => {
|
|
9
10
|
const [local, rest] = splitProps(props, ["items", "title", "class", "onActiveChange"]);
|
|
10
11
|
const [open, setOpen] = createSignal(false);
|
|
11
12
|
const [activeId, setActiveId] = createSignal(local.items[0]?.id || "");
|
|
12
13
|
const [rootElement, setRootElement] = createSignal();
|
|
13
|
-
const
|
|
14
|
+
const siteLocale = useSiteLocale();
|
|
15
|
+
const title = () => local.title ?? siteLocale.t("tableOfContents.title");
|
|
14
16
|
const activeTitle = () => local.items.find((item) => item.id === activeId())?.text || title();
|
|
15
17
|
const handleActiveChange = (id) => {
|
|
16
18
|
setActiveId(id);
|
|
@@ -25,12 +27,12 @@ export const DocsMobileTableOfContents = (props) => {
|
|
|
25
27
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
26
28
|
onCleanup(() => document.removeEventListener("pointerdown", handlePointerDown));
|
|
27
29
|
});
|
|
28
|
-
return (<Collapsible open={open()} onOpenChange={setOpen} ref={setRootElement} class={cn("
|
|
30
|
+
return (<Collapsible open={open()} onOpenChange={setOpen} ref={setRootElement} class={cn("z-20 xl:hidden sticky top-16 rounded-md border border-border bg-background/95 shadow-sm backdrop-blur supports-backdrop-filter:bg-background/80", local.class)}>
|
|
29
31
|
<CollapsibleTrigger type="button" aria-label={title()} class="flex min-h-10 items-center justify-between rounded-md px-3 py-2 text-sm font-medium text-foreground">
|
|
30
32
|
<span class="truncate text-left">{activeTitle()}</span>
|
|
31
33
|
<ChevronDown class={cn("size-4 text-muted-foreground transition-transform", open() && "rotate-180")}/>
|
|
32
34
|
</CollapsibleTrigger>
|
|
33
|
-
<CollapsibleContent onClick={() => setOpen(false)} class="absolute inset-x-0 top-full z-30 max-h-[min(60vh,24rem)] rounded-b-md border border-t-0 border-border bg-card px-3 py-2 shadow-lg
|
|
35
|
+
<CollapsibleContent onClick={() => setOpen(false)} class="absolute inset-x-0 top-full z-30 max-h-[min(60vh,24rem)] rounded-b-md border border-t-0 border-border bg-card px-3 py-2 shadow-lg overflow-y-auto!">
|
|
34
36
|
<DocsTableOfContents items={local.items} title={title()} onActiveChange={handleActiveChange} class="max-h-56 overflow-y-auto" {...rest}/>
|
|
35
37
|
</CollapsibleContent>
|
|
36
38
|
</Collapsible>);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type Component } from "solid-js";
|
|
2
2
|
import type { SidebarItem } from "../../../types.js";
|
|
3
|
+
import type { PageData } from "../../../types.js";
|
|
3
4
|
export interface SidebarTreeProps {
|
|
4
5
|
tree: SidebarItem[];
|
|
6
|
+
pages?: readonly PageData[];
|
|
5
7
|
currentUrl?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare const SidebarTree: Component<SidebarTreeProps>;
|
|
@@ -16,10 +16,19 @@ import { useSidebar } from "@/components/ui/sidebar";
|
|
|
16
16
|
import { Button } from "@/components/ui/button";
|
|
17
17
|
import { cn } from "@/lib/cn";
|
|
18
18
|
import { ChevronRight, Folder } from "lucide-solid";
|
|
19
|
+
import { localizeSidebarTree } from "../../../plugins/i18n/navigation.js";
|
|
20
|
+
import { useSiteLocale } from "../../../plugins/i18n/runtime.jsx";
|
|
19
21
|
import { resolveDefaultIcon } from "../icons.js";
|
|
20
22
|
import { containsActiveSidebarItem, containsNewSidebarItem, isSidebarItemActive, isSidebarItemNew, } from "../../../navigation/sidebar-state.js";
|
|
21
23
|
export const SidebarTree = (props) => {
|
|
22
24
|
const sidebar = useSidebar();
|
|
25
|
+
const siteLocale = useSiteLocale();
|
|
26
|
+
const activeLocale = () => {
|
|
27
|
+
const currentPage = props.pages?.find((page) => page.url === props.currentUrl);
|
|
28
|
+
const pageLocale = currentPage?.frontmatter.locale;
|
|
29
|
+
return typeof pageLocale === "string" ? pageLocale : siteLocale.locale();
|
|
30
|
+
};
|
|
31
|
+
const localizedTree = () => localizeSidebarTree(props.tree, props.pages || [], activeLocale());
|
|
23
32
|
const renderCategoryIcon = (name) => (<Show when={renderIcon(name, "size-4 shrink-0")} fallback={<Folder class="size-4 shrink-0"/>}>
|
|
24
33
|
{renderIcon(name, "size-4 shrink-0")}
|
|
25
34
|
</Show>);
|
|
@@ -117,7 +126,7 @@ export const SidebarTree = (props) => {
|
|
|
117
126
|
</SidebarGroupContent>
|
|
118
127
|
</SidebarGroup>);
|
|
119
128
|
return (<>
|
|
120
|
-
<For each={
|
|
121
|
-
<For each={
|
|
129
|
+
<For each={localizedTree().filter((item) => !item.items)}>{(item) => renderRootPage(item)}</For>
|
|
130
|
+
<For each={localizedTree().filter((item) => Boolean(item.items))}>{(group) => renderCategory(group)}</For>
|
|
122
131
|
</>);
|
|
123
132
|
};
|
|
@@ -8,7 +8,10 @@ import { CommandGroup } from "@/components/ui/command";
|
|
|
8
8
|
import { CommandItem } from "@/components/ui/command";
|
|
9
9
|
import { FileText } from "lucide-solid";
|
|
10
10
|
import { resolveSearchProvider, searchPages } from "../../../search/provider.js";
|
|
11
|
+
import { useSiteLocale } from "../../../plugins/i18n/runtime.jsx";
|
|
11
12
|
export const DocsSearchDialog = (props) => {
|
|
13
|
+
const siteLocale = useSiteLocale();
|
|
14
|
+
const showAlgoliaAttribution = () => typeof props.provider !== "string" && props.provider?.name === "algolia";
|
|
12
15
|
const handleOpenChange = (open) => {
|
|
13
16
|
props.onOpenChange(open);
|
|
14
17
|
};
|
|
@@ -47,19 +50,27 @@ export const DocsSearchDialog = (props) => {
|
|
|
47
50
|
});
|
|
48
51
|
});
|
|
49
52
|
return (<>
|
|
50
|
-
<CommandInput id="docs-search-input" placeholder="
|
|
53
|
+
<CommandInput id="docs-search-input" placeholder={siteLocale.t("search.placeholder")}/>
|
|
51
54
|
<CommandList>
|
|
52
55
|
<Show when={!searching() && query().length > 0 && filteredPages().length === 0}>
|
|
53
|
-
<CommandEmpty>
|
|
56
|
+
<CommandEmpty>{siteLocale.t("search.empty")}</CommandEmpty>
|
|
54
57
|
</Show>
|
|
55
58
|
<Show when={!searching() && filteredPages().length > 0}>
|
|
56
|
-
<CommandGroup heading="
|
|
59
|
+
<CommandGroup heading={siteLocale.t("search.pages")}>
|
|
57
60
|
<For each={filteredPages()}>
|
|
58
61
|
{(page) => (<CommandItem title={page.title} subtitle={page.url} description={page.description} icon={FileText} shouldFilter={false} onSelect={() => handleSelect(page.url)}/>)}
|
|
59
62
|
</For>
|
|
60
63
|
</CommandGroup>
|
|
61
64
|
</Show>
|
|
62
65
|
</CommandList>
|
|
66
|
+
<Show when={showAlgoliaAttribution()}>
|
|
67
|
+
<div class="flex items-center justify-end border-t border-border px-3 py-2">
|
|
68
|
+
<a href="https://www.algolia.com" target="_blank" rel="noreferrer" class="inline-flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground" aria-label={`${siteLocale.t("search.by")} Algolia`}>
|
|
69
|
+
<span>{siteLocale.t("search.by")}</span>
|
|
70
|
+
<img src="/algolia-logo.svg" alt="Algolia" class="h-4 w-auto object-contain"/>
|
|
71
|
+
</a>
|
|
72
|
+
</div>
|
|
73
|
+
</Show>
|
|
63
74
|
</>);
|
|
64
75
|
}}
|
|
65
76
|
</CommandDialog>);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// packages/docs/src/themes/default/sidebar.tsx
|
|
2
|
-
import { createSignal,
|
|
2
|
+
import { createSignal, onCleanup, onMount, Show, splitProps } from "solid-js";
|
|
3
3
|
import { Sidebar } from "@/components/ui/sidebar";
|
|
4
|
-
import { SidebarHeader } from "@/components/ui/sidebar";
|
|
5
4
|
import { SidebarContent } from "@/components/ui/sidebar";
|
|
6
|
-
import { SidebarFooter } from "@/components/ui/sidebar";
|
|
7
|
-
import { SidebarMenuButton } from "@/components/ui/sidebar";
|
|
8
|
-
import { sidebarMenuButtonVariants } from "@/components/ui/sidebar";
|
|
9
5
|
import { useSidebar } from "@/components/ui/sidebar";
|
|
10
|
-
import { Logo } from "@/components/ui/logo";
|
|
11
6
|
import { createFocusTrap } from "@/hooks/create-focus-trap";
|
|
12
7
|
import { createLockScroll } from "@/hooks/create-lock-scroll";
|
|
13
8
|
import { cn } from "@/lib/cn";
|
|
9
|
+
import { SidebarFooter } from "./components/sidebar-footer.jsx";
|
|
10
|
+
import { SidebarHeader } from "./components/sidebar-header.jsx";
|
|
11
|
+
import { SidebarMobileNav } from "./components/sidebar-mobile-nav.jsx";
|
|
14
12
|
import { SidebarTree } from "./navigation/sidebar-tree.jsx";
|
|
13
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
15
14
|
export const DocsSidebar = (props) => {
|
|
16
|
-
const [local, rest] = splitProps(props, ["tree", "nav", "currentUrl", "title", "logo", "headerSubtitle", "footerText", "showHeader", "showFooter", "class"]);
|
|
15
|
+
const [local, rest] = splitProps(props, ["tree", "pages", "nav", "currentUrl", "title", "logo", "headerSubtitle", "footerText", "showHeader", "showFooter", "class"]);
|
|
17
16
|
const brandText = () => local.logo?.text || local.title || "Folio";
|
|
17
|
+
const siteLocale = useSiteLocale();
|
|
18
18
|
const sidebar = useSidebar();
|
|
19
19
|
const [sidebarElement, setSidebarElement] = createSignal();
|
|
20
20
|
createFocusTrap(sidebarElement, {
|
|
@@ -37,53 +37,25 @@ export const DocsSidebar = (props) => {
|
|
|
37
37
|
});
|
|
38
38
|
return (<>
|
|
39
39
|
<Show when={sidebar.isMobile() && sidebar.openMobile()}>
|
|
40
|
-
<button type="button" aria-label="
|
|
40
|
+
<button type="button" aria-label={siteLocale.t("navigation.closeSidebar")} class="fixed inset-0 z-40 cursor-default bg-black/50 md:hidden" onClick={() => sidebar.setOpenMobile(false)}/>
|
|
41
41
|
</Show>
|
|
42
42
|
<Show when={!sidebar.isMobile() || sidebar.openMobile()}>
|
|
43
|
-
<div class={cn("w-0 md:shrink-0", sidebar.open() ? "md:w-
|
|
43
|
+
<div class={cn("w-0 md:shrink-0", sidebar.open() ? "md:w-(--sidebar-width)" : "md:w-(--sidebar-width-icon)")}>
|
|
44
44
|
<Sidebar ref={setSidebarElement} collapsible={sidebar.isMobile() ? "none" : "icon"} class={cn("top-0 self-start z-30 h-screen shrink-0 rounded-none border-y-0 border-l-0 border-r border-border bg-card shadow-sm md:fixed md:inset-y-0 md:left-0", "overflow-hidden max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:z-50 max-md:w-[min(17rem,calc(100vw-1rem))] max-md:shadow-xl", local.class)} {...rest}>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<div class="flex items-center gap-2.5 overflow-hidden">
|
|
49
|
-
<Show when={local.logo?.image} fallback={<Logo class="size-7"/>}>
|
|
50
|
-
{(image) => <img src={image()} alt={brandText()} class="size-7 shrink-0 rounded-md object-contain"/>}
|
|
51
|
-
</Show>
|
|
52
|
-
<div class="flex min-w-0 flex-col gap-0.5 leading-none group-data-[collapsible=icon]:hidden">
|
|
53
|
-
<span class="truncate text-xs font-bold">{brandText()}</span>
|
|
54
|
-
<span class="truncate text-[10px] text-muted-foreground">{local.headerSubtitle}</span>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
</a>
|
|
58
|
-
</SidebarHeader>
|
|
59
|
-
</Show>
|
|
45
|
+
<Show when={local.showHeader !== false}>
|
|
46
|
+
<SidebarHeader logo={local.logo} brandText={brandText()} subtitle={local.headerSubtitle}/>
|
|
47
|
+
</Show>
|
|
60
48
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</a>)}
|
|
68
|
-
</For>
|
|
69
|
-
</nav>
|
|
70
|
-
</Show>
|
|
71
|
-
<SidebarTree tree={local.tree} currentUrl={local.currentUrl}/>
|
|
72
|
-
</SidebarContent>
|
|
49
|
+
<SidebarContent class="h-full overflow-y-auto scrollbar-none [&::-webkit-scrollbar]:hidden">
|
|
50
|
+
<Show when={local.nav?.length}>
|
|
51
|
+
<SidebarMobileNav items={local.nav} onNavigate={() => sidebar.setOpenMobile(false)}/>
|
|
52
|
+
</Show>
|
|
53
|
+
<SidebarTree tree={local.tree} pages={local.pages} currentUrl={local.currentUrl}/>
|
|
54
|
+
</SidebarContent>
|
|
73
55
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<div class="flex size-7 shrink-0 items-center justify-center rounded-md bg-primary/15 text-xs font-bold text-primary">
|
|
78
|
-
N
|
|
79
|
-
</div>
|
|
80
|
-
<div class="flex min-w-0 flex-col gap-0.5 leading-none group-data-[collapsible=icon]:hidden">
|
|
81
|
-
<span class="truncate text-xs font-semibold">{brandText()}</span>
|
|
82
|
-
<span class="truncate text-[10px] text-muted-foreground">{local.footerText}</span>
|
|
83
|
-
</div>
|
|
84
|
-
</SidebarMenuButton>
|
|
85
|
-
</SidebarFooter>
|
|
86
|
-
</Show>
|
|
56
|
+
<Show when={local.showFooter !== false}>
|
|
57
|
+
<SidebarFooter brandText={brandText()} footerText={local.footerText}/>
|
|
58
|
+
</Show>
|
|
87
59
|
</Sidebar>
|
|
88
60
|
</div>
|
|
89
61
|
</Show>
|
package/dist/themes/types.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export type BreadcrumbItemData = {
|
|
|
7
7
|
};
|
|
8
8
|
export interface DocsNavbarProps {
|
|
9
9
|
config: DocsConfig;
|
|
10
|
+
currentPage?: PageData;
|
|
11
|
+
pages?: readonly PageData[];
|
|
12
|
+
onNavigate?: (url: string) => void;
|
|
10
13
|
onOpenSearch?: () => void;
|
|
11
14
|
showBrand?: boolean;
|
|
12
15
|
showSidebarTrigger?: boolean;
|
|
@@ -15,6 +18,7 @@ export interface DocsNavbarProps {
|
|
|
15
18
|
}
|
|
16
19
|
export interface DocsSidebarProps {
|
|
17
20
|
tree: SidebarItem[];
|
|
21
|
+
pages?: readonly PageData[];
|
|
18
22
|
nav?: NavItem[];
|
|
19
23
|
currentUrl?: string;
|
|
20
24
|
title?: string;
|
|
@@ -59,6 +63,7 @@ export interface DocsLayoutProps {
|
|
|
59
63
|
tree: SidebarItem[];
|
|
60
64
|
pages?: PageData[];
|
|
61
65
|
currentPage?: PageData;
|
|
66
|
+
onNavigate?: (url: string) => void;
|
|
62
67
|
breadcrumbs?: BreadcrumbItemData[];
|
|
63
68
|
toc?: TocItem[];
|
|
64
69
|
prev?: {
|