fumadocs-ui 16.0.15 → 16.2.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/css/black.css +1 -1
- package/css/catppuccin.css +1 -1
- package/css/colors/index.css +51 -0
- package/css/dusk.css +1 -1
- package/css/layouts/docs.css +1 -0
- package/css/layouts/home.css +1 -0
- package/css/layouts/notebook.css +1 -0
- package/css/neutral.css +1 -40
- package/css/ocean.css +1 -1
- package/css/preset.css +21 -28
- package/css/purple.css +1 -1
- package/css/shadcn.css +0 -2
- package/css/shiki.css +1 -3
- package/css/solar.css +49 -18
- package/css/vitepress.css +1 -1
- package/dist/components/image-zoom.d.ts +3 -3
- package/dist/components/image-zoom.d.ts.map +1 -1
- package/dist/components/image-zoom.js +1 -1
- package/dist/components/sidebar/base.d.ts +62 -0
- package/dist/components/sidebar/base.d.ts.map +1 -0
- package/dist/components/sidebar/base.js +174 -0
- package/dist/components/sidebar/link-item.d.ts +11 -0
- package/dist/components/sidebar/link-item.d.ts.map +1 -0
- package/dist/components/sidebar/link-item.js +13 -0
- package/dist/components/sidebar/page-tree.d.ts +19 -0
- package/dist/components/sidebar/page-tree.d.ts.map +1 -0
- package/dist/components/sidebar/page-tree.js +34 -0
- package/dist/components/{layout/root-toggle.d.ts → sidebar/tabs.d.ts} +4 -4
- package/dist/components/sidebar/tabs.d.ts.map +1 -0
- package/dist/components/{layout/root-toggle.js → sidebar/tabs.js} +3 -3
- package/dist/components/tabs.unstyled.d.ts +0 -3
- package/dist/components/tabs.unstyled.d.ts.map +1 -1
- package/dist/components/tabs.unstyled.js +23 -32
- package/dist/components/toc/clerk.d.ts +3 -0
- package/dist/components/toc/clerk.d.ts.map +1 -0
- package/dist/components/{layout/toc-clerk.js → toc/clerk.js} +5 -6
- package/dist/components/toc/default.d.ts +3 -0
- package/dist/components/toc/default.d.ts.map +1 -0
- package/dist/components/{layout/toc.js → toc/default.js} +5 -16
- package/dist/components/{layout/toc.d.ts → toc/index.d.ts} +7 -3
- package/dist/components/toc/index.d.ts.map +1 -0
- package/dist/components/{layout/toc-thumb.js → toc/index.js} +17 -3
- package/dist/contexts/search.js +1 -1
- package/dist/contexts/tree.d.ts +1 -1
- package/dist/contexts/tree.d.ts.map +1 -1
- package/dist/contexts/tree.js +3 -3
- package/dist/layouts/docs/client.d.ts +12 -5
- package/dist/layouts/docs/client.d.ts.map +1 -1
- package/dist/layouts/docs/client.js +31 -22
- package/dist/layouts/docs/index.d.ts +9 -9
- package/dist/layouts/docs/index.d.ts.map +1 -1
- package/dist/layouts/docs/index.js +37 -48
- package/dist/layouts/docs/{page-client.d.ts → page/client.d.ts} +3 -4
- package/dist/layouts/docs/page/client.d.ts.map +1 -0
- package/dist/layouts/docs/{page-client.js → page/client.js} +39 -76
- package/dist/layouts/docs/page/index.d.ts +58 -0
- package/dist/layouts/docs/page/index.d.ts.map +1 -0
- package/dist/layouts/docs/page/index.js +51 -0
- package/dist/layouts/docs/sidebar.d.ts +17 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +82 -0
- package/dist/layouts/home/client.d.ts +2 -20
- package/dist/layouts/home/client.d.ts.map +1 -1
- package/dist/layouts/home/client.js +54 -17
- package/dist/layouts/home/index.d.ts +2 -3
- package/dist/layouts/home/index.d.ts.map +1 -1
- package/dist/layouts/home/index.js +3 -35
- package/dist/layouts/notebook/client.d.ts +20 -8
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js +59 -33
- package/dist/layouts/notebook/index.d.ts +9 -9
- package/dist/layouts/notebook/index.d.ts.map +1 -1
- package/dist/layouts/notebook/index.js +47 -70
- package/dist/layouts/notebook/page/client.d.ts +24 -0
- package/dist/layouts/notebook/page/client.d.ts.map +1 -0
- package/dist/layouts/notebook/page/client.js +119 -0
- package/dist/layouts/notebook/page/index.d.ts +58 -0
- package/dist/layouts/notebook/page/index.d.ts.map +1 -0
- package/dist/layouts/notebook/page/index.js +51 -0
- package/dist/layouts/notebook/sidebar.d.ts +17 -0
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -0
- package/dist/layouts/notebook/sidebar.js +87 -0
- package/dist/layouts/shared/index.d.ts +12 -78
- package/dist/layouts/shared/index.d.ts.map +1 -1
- package/dist/layouts/shared/index.js +11 -15
- package/dist/layouts/shared/language-toggle.d.ts +5 -0
- package/dist/layouts/shared/language-toggle.d.ts.map +1 -0
- package/dist/layouts/shared/link-item.d.ts +78 -0
- package/dist/layouts/shared/link-item.d.ts.map +1 -0
- package/dist/layouts/shared/{client.js → link-item.js} +1 -1
- package/dist/layouts/shared/search-toggle.d.ts.map +1 -0
- package/dist/{components/layout → layouts/shared}/theme-toggle.d.ts +2 -2
- package/dist/layouts/shared/theme-toggle.d.ts.map +1 -0
- package/dist/{components/layout → layouts/shared}/theme-toggle.js +3 -3
- package/dist/page.d.ts +6 -59
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +16 -50
- package/dist/provider/base.d.ts.map +1 -1
- package/dist/provider/base.js +2 -3
- package/dist/style.css +187 -160
- package/dist/utils/use-footer-items.d.ts +6 -0
- package/dist/utils/use-footer-items.d.ts.map +1 -0
- package/dist/utils/use-footer-items.js +27 -0
- package/dist/utils/use-is-scroll-top.d.ts +4 -0
- package/dist/utils/use-is-scroll-top.d.ts.map +1 -0
- package/dist/utils/use-is-scroll-top.js +17 -0
- package/package.json +9 -22
- package/css/default.css +0 -34
- package/dist/components/layout/language-toggle.d.ts +0 -5
- package/dist/components/layout/language-toggle.d.ts.map +0 -1
- package/dist/components/layout/root-toggle.d.ts.map +0 -1
- package/dist/components/layout/search-toggle.d.ts.map +0 -1
- package/dist/components/layout/sidebar.d.ts +0 -66
- package/dist/components/layout/sidebar.d.ts.map +0 -1
- package/dist/components/layout/sidebar.js +0 -200
- package/dist/components/layout/theme-toggle.d.ts.map +0 -1
- package/dist/components/layout/toc-clerk.d.ts +0 -3
- package/dist/components/layout/toc-clerk.d.ts.map +0 -1
- package/dist/components/layout/toc-thumb.d.ts +0 -7
- package/dist/components/layout/toc-thumb.d.ts.map +0 -1
- package/dist/components/layout/toc.d.ts.map +0 -1
- package/dist/contexts/layout.d.ts +0 -28
- package/dist/contexts/layout.d.ts.map +0 -1
- package/dist/contexts/layout.js +0 -38
- package/dist/contexts/sidebar.d.ts +0 -18
- package/dist/contexts/sidebar.d.ts.map +0 -1
- package/dist/contexts/sidebar.js +0 -31
- package/dist/layouts/docs/page-client.d.ts.map +0 -1
- package/dist/layouts/docs/page.d.ts +0 -17
- package/dist/layouts/docs/page.d.ts.map +0 -1
- package/dist/layouts/docs/page.js +0 -26
- package/dist/layouts/shared/client.d.ts +0 -6
- package/dist/layouts/shared/client.d.ts.map +0 -1
- package/dist/provider/index.d.ts +0 -11
- package/dist/provider/index.d.ts.map +0 -1
- package/dist/provider/index.js +0 -12
- /package/dist/{components/layout → layouts/shared}/language-toggle.js +0 -0
- /package/dist/{components/layout → layouts/shared}/search-toggle.d.ts +0 -0
- /package/dist/{components/layout → layouts/shared}/search-toggle.js +0 -0
|
@@ -3,18 +3,18 @@ import { useMemo, } from 'react';
|
|
|
3
3
|
import { Languages, Sidebar as SidebarIcon } from '../../icons.js';
|
|
4
4
|
import { cn } from '../../utils/cn.js';
|
|
5
5
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
6
|
-
import { Sidebar, SidebarCollapseTrigger, SidebarContent,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { LanguageToggle, LanguageToggleText, } from '../../
|
|
10
|
-
import { CollapsibleControl,
|
|
6
|
+
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarDrawer, SidebarLinkItem, SidebarPageTree, SidebarTrigger, SidebarViewport, } from './sidebar.js';
|
|
7
|
+
import { resolveLinkItems } from '../../layouts/shared/index.js';
|
|
8
|
+
import { LinkItem } from '../../layouts/shared/link-item.js';
|
|
9
|
+
import { LanguageToggle, LanguageToggleText, } from '../../layouts/shared/language-toggle.js';
|
|
10
|
+
import { CollapsibleControl, LayoutTabs, LayoutHeader, LayoutBody, LayoutContextProvider, } from './client.js';
|
|
11
11
|
import { TreeContextProvider } from '../../contexts/tree.js';
|
|
12
|
-
import { ThemeToggle } from '
|
|
13
|
-
import { NavProvider } from '../../contexts/layout.js';
|
|
12
|
+
import { ThemeToggle } from '../shared/theme-toggle.js';
|
|
14
13
|
import Link from 'fumadocs-core/link';
|
|
15
|
-
import { LargeSearchToggle, SearchToggle, } from '../../
|
|
14
|
+
import { LargeSearchToggle, SearchToggle, } from '../../layouts/shared/search-toggle.js';
|
|
16
15
|
import { getSidebarTabs, } from '../../utils/get-sidebar-tabs.js';
|
|
17
|
-
|
|
16
|
+
import { SidebarTabTrigger, } from '../../components/sidebar/tabs.js';
|
|
17
|
+
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { tabs: sidebarTabs, enabled: sidebarEnabled = true, defaultOpenLevel, prefetch, ...sidebarProps } = {}, searchToggle = {}, themeSwitch = {}, tabMode = 'auto', i18n = false, children, tree, ...props }) {
|
|
18
18
|
const tabs = useMemo(() => {
|
|
19
19
|
if (Array.isArray(sidebarTabs)) {
|
|
20
20
|
return sidebarTabs;
|
|
@@ -27,51 +27,40 @@ export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { t
|
|
|
27
27
|
}
|
|
28
28
|
return [];
|
|
29
29
|
}, [tree, sidebarTabs]);
|
|
30
|
-
const links =
|
|
31
|
-
const sidebarVariables = cn('md:[--fd-sidebar-width:268px] lg:[--fd-sidebar-width:286px]');
|
|
30
|
+
const links = resolveLinkItems(props);
|
|
32
31
|
function sidebar() {
|
|
33
|
-
const { footer, banner, collapsible = true, component, components,
|
|
32
|
+
const { footer, banner, collapsible = true, component, components, ...rest } = sidebarProps;
|
|
34
33
|
if (component)
|
|
35
34
|
return component;
|
|
36
35
|
const iconLinks = links.filter((item) => item.type === 'icon');
|
|
37
36
|
const viewport = (_jsxs(SidebarViewport, { children: [links
|
|
38
37
|
.filter((v) => v.type !== 'icon')
|
|
39
|
-
.map((item, i, list) => (_jsx(SidebarLinkItem, { item: item, className: cn(i === list.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
.map((item, i, list) => (_jsx(SidebarLinkItem, { item: item, className: cn(i === list.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { ...components })] }));
|
|
39
|
+
return (_jsxs(_Fragment, { children: [collapsible && _jsx(CollapsibleControl, {}), _jsxs(SidebarContent, { ...rest, children: [_jsxs("div", { className: "flex flex-col gap-3 p-4 pb-2", children: [_jsxs("div", { className: "flex", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex text-[0.9375rem] items-center gap-2.5 font-medium me-auto", children: nav.title }), nav.children, collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
|
|
40
|
+
color: 'ghost',
|
|
41
|
+
size: 'icon-sm',
|
|
42
|
+
className: 'mb-auto text-fd-muted-foreground',
|
|
43
|
+
})), children: _jsx(SidebarIcon, {}) }))] }), searchToggle.enabled !== false &&
|
|
44
|
+
(searchToggle.components?.lg ?? (_jsx(LargeSearchToggle, { hideIfDisabled: true }))), tabs.length > 0 && tabMode === 'auto' && (_jsx(SidebarTabTrigger, { options: tabs })), banner] }), viewport, (i18n ||
|
|
45
|
+
iconLinks.length > 0 ||
|
|
46
|
+
themeSwitch?.enabled !== false ||
|
|
47
|
+
footer) && (_jsxs("div", { className: "flex flex-col border-t p-4 pt-2 empty:hidden", children: [_jsxs("div", { className: "flex text-fd-muted-foreground items-center empty:hidden", children: [i18n && (_jsx(LanguageToggle, { children: _jsx(Languages, { className: "size-4.5" }) })), iconLinks.map((item, i) => (_jsx(LinkItem, { item: item, className: cn(buttonVariants({ size: 'icon-sm', color: 'ghost' })), "aria-label": item.label, children: item.icon }, i))), themeSwitch.enabled !== false &&
|
|
48
|
+
(themeSwitch.component ?? (_jsx(ThemeToggle, { className: "ms-auto p-0", mode: themeSwitch.mode })))] }), footer] }))] }), _jsxs(SidebarDrawer, { children: [_jsxs("div", { className: "flex flex-col gap-3 p-4 pb-2", children: [_jsxs("div", { className: "flex text-fd-muted-foreground items-center gap-1.5", children: [_jsx("div", { className: "flex flex-1", children: iconLinks.map((item, i) => (_jsx(LinkItem, { item: item, className: cn(buttonVariants({
|
|
49
|
+
size: 'icon-sm',
|
|
50
|
+
color: 'ghost',
|
|
51
|
+
className: 'p-2',
|
|
52
|
+
})), "aria-label": item.label, children: item.icon }, i))) }), i18n && (_jsxs(LanguageToggle, { children: [_jsx(Languages, { className: "size-4.5" }), _jsx(LanguageToggleText, {})] })), themeSwitch.enabled !== false &&
|
|
53
|
+
(themeSwitch.component ?? (_jsx(ThemeToggle, { className: "p-0", mode: themeSwitch.mode }))), _jsx(SidebarTrigger, { className: cn(buttonVariants({
|
|
54
|
+
color: 'ghost',
|
|
55
|
+
size: 'icon-sm',
|
|
56
|
+
className: 'p-2',
|
|
57
|
+
})), children: _jsx(SidebarIcon, {}) })] }), tabs.length > 0 && _jsx(SidebarTabTrigger, { options: tabs }), banner] }), viewport, _jsx("div", { className: "flex flex-col border-t p-4 pt-2 empty:hidden", children: footer })] })] }));
|
|
58
|
+
}
|
|
59
|
+
return (_jsx(TreeContextProvider, { tree: tree, children: _jsx(LayoutContextProvider, { navTransparentMode: transparentMode, children: _jsx(Sidebar, { defaultOpenLevel: defaultOpenLevel, prefetch: prefetch, children: _jsxs(LayoutBody, { ...props.containerProps, children: [nav.enabled !== false &&
|
|
60
|
+
(nav.component ?? (_jsxs(LayoutHeader, { id: "nd-subnav", className: "[grid-area:header] sticky top-(--fd-docs-row-1) z-30 flex items-center ps-4 pe-2.5 border-b transition-colors backdrop-blur-sm h-(--fd-header-height) md:hidden max-md:layout:[--fd-header-height:--spacing(14)] data-[transparent=false]:bg-fd-background/80", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 font-semibold", children: nav.title }), _jsx("div", { className: "flex-1", children: nav.children }), searchToggle.enabled !== false &&
|
|
61
|
+
(searchToggle.components?.sm ?? (_jsx(SearchToggle, { className: "p-2", hideIfDisabled: true }))), sidebarEnabled && (_jsx(SidebarTrigger, { className: cn(buttonVariants({
|
|
42
62
|
color: 'ghost',
|
|
63
|
+
size: 'icon-sm',
|
|
43
64
|
className: 'p-2',
|
|
44
|
-
})),
|
|
45
|
-
(themeSwitch.component ?? (_jsx(ThemeToggle, { className: "p-0", mode: themeSwitch.mode }))), _jsx(SidebarTrigger, { className: cn(buttonVariants({
|
|
46
|
-
color: 'ghost',
|
|
47
|
-
size: 'icon-sm',
|
|
48
|
-
className: 'p-2',
|
|
49
|
-
})), children: _jsx(SidebarIcon, {}) })] }), tabs.length > 0 && _jsx(RootToggle, { options: tabs }), banner] }), viewport, _jsx(SidebarFooter, { className: "empty:hidden", children: footer })] }));
|
|
50
|
-
const content = (_jsxs(SidebarContent, { ...rest, children: [_jsxs(SidebarHeader, { children: [_jsxs("div", { className: "flex", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex text-[0.9375rem] items-center gap-2.5 font-medium me-auto", children: nav.title }), nav.children, collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
|
|
51
|
-
color: 'ghost',
|
|
52
|
-
size: 'icon-sm',
|
|
53
|
-
className: 'mb-auto text-fd-muted-foreground',
|
|
54
|
-
})), children: _jsx(SidebarIcon, {}) }))] }), searchToggle.enabled !== false &&
|
|
55
|
-
(searchToggle.components?.lg ?? (_jsx(LargeSearchToggle, { hideIfDisabled: true }))), tabs.length > 0 && tabMode === 'auto' && (_jsx(RootToggle, { options: tabs })), banner] }), viewport, (i18n ||
|
|
56
|
-
iconLinks.length > 0 ||
|
|
57
|
-
themeSwitch?.enabled !== false ||
|
|
58
|
-
footer) && (_jsxs(SidebarFooter, { children: [_jsxs("div", { className: "flex text-fd-muted-foreground items-center empty:hidden", children: [i18n && (_jsx(LanguageToggle, { children: _jsx(Languages, { className: "size-4.5" }) })), iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon-sm', color: 'ghost' })), "aria-label": item.label, children: item.icon }, i))), themeSwitch.enabled !== false &&
|
|
59
|
-
(themeSwitch.component ?? (_jsx(ThemeToggle, { className: "ms-auto p-0", mode: themeSwitch.mode })))] }), footer] }))] }));
|
|
60
|
-
return (_jsx(Sidebar, { defaultOpenLevel: defaultOpenLevel, prefetch: prefetch, Mobile: mobile, Content: _jsxs(_Fragment, { children: [collapsible && _jsx(CollapsibleControl, {}), content] }) }));
|
|
61
|
-
}
|
|
62
|
-
return (_jsx(TreeContextProvider, { tree: tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [nav.enabled !== false &&
|
|
63
|
-
(nav.component ?? (_jsxs(Navbar, { className: "h-(--fd-nav-height) on-root:[--fd-nav-height:56px] md:on-root:[--fd-nav-height:0px] md:hidden", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 font-semibold", children: nav.title }), _jsx("div", { className: "flex-1", children: nav.children }), searchToggle.enabled !== false &&
|
|
64
|
-
(searchToggle.components?.sm ?? (_jsx(SearchToggle, { className: "p-2", hideIfDisabled: true }))), sidebarEnabled && (_jsx(SidebarTrigger, { className: cn(buttonVariants({
|
|
65
|
-
color: 'ghost',
|
|
66
|
-
size: 'icon-sm',
|
|
67
|
-
className: 'p-2',
|
|
68
|
-
})), children: _jsx(SidebarIcon, {}) }))] }))), _jsxs(LayoutBody, { ...props.containerProps, className: cn('md:[&_#nd-page_article]:pt-12 xl:[&_#nd-page_article]:px-8', sidebarEnabled && sidebarVariables, props.containerProps?.className), children: [sidebarEnabled && sidebar(), tabMode === 'top' && tabs.length > 0 && (_jsx(LayoutTabs, { options: tabs, className: "sticky top-[calc(var(--fd-nav-height)+var(--fd-tocnav-height))] z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden" })), children] })] }) }));
|
|
69
|
-
}
|
|
70
|
-
function SidebarLinkItem({ item, ...props }) {
|
|
71
|
-
if (item.type === 'menu')
|
|
72
|
-
return (_jsxs(SidebarFolder, { ...props, children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, external: item.external, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(SidebarLinkItem, { item: child }, i))) })] }));
|
|
73
|
-
if (item.type === 'custom')
|
|
74
|
-
return _jsx("div", { ...props, children: item.children });
|
|
75
|
-
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
|
|
65
|
+
})), children: _jsx(SidebarIcon, {}) }))] }))), sidebarEnabled && sidebar(), tabMode === 'top' && tabs.length > 0 && (_jsx(LayoutTabs, { options: tabs, className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden" })), children] }) }) }) }));
|
|
76
66
|
}
|
|
77
|
-
export { CollapsibleControl, Navbar, SidebarTrigger };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ComponentProps } from 'react';
|
|
2
2
|
import type * as PageTree from 'fumadocs-core/page-tree';
|
|
3
3
|
import { type BreadcrumbOptions } from 'fumadocs-core/breadcrumb';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function PageTOCPopover({ className, children, ...rest }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function PageTOCPopoverTrigger({ className, ...props }: ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
export declare function PageTOCPopoverContent(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare function PageTOCPopover(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function PageLastUpdate({ date: value, ...props }: Omit<ComponentProps<'p'>, 'children'> & {
|
|
8
8
|
date: Date;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,6 +20,5 @@ export interface FooterProps extends ComponentProps<'div'> {
|
|
|
20
20
|
export declare function PageFooter({ items, ...props }: FooterProps): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export type BreadcrumbProps = BreadcrumbOptions & ComponentProps<'div'>;
|
|
22
22
|
export declare function PageBreadcrumb({ includeRoot, includeSeparator, includePage, ...props }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
-
export declare function PageTOC(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
24
23
|
export {};
|
|
25
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/layouts/docs/page/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EASpB,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAiBlC,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,KAAK,CAAC,2CAqDvB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAqD1B;AA4DD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAUjE;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAiBxD;AAED,KAAK,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC,CAAC;AAChE,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,KAAK,CAAC;IACxD;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,IAAI,CAAC;KACb,CAAC;CACH;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CA+B1D;AA8BD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExE,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,GAAG,KAAK,EACT,EAAE,eAAe,kDA6CjB"}
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useEffect, useEffectEvent, createContext, useMemo, useRef, useState, use, } from 'react';
|
|
4
|
-
import { ChevronDown, ChevronLeft, ChevronRight } from '
|
|
4
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from '../../../icons.js';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
|
-
import { cn } from '
|
|
7
|
-
import { useI18n } from '
|
|
8
|
-
import { useTreeContext, useTreePath } from '
|
|
6
|
+
import { cn } from '../../../utils/cn.js';
|
|
7
|
+
import { useI18n } from '../../../contexts/i18n.js';
|
|
8
|
+
import { useTreeContext, useTreePath } from '../../../contexts/tree.js';
|
|
9
9
|
import { usePathname } from 'fumadocs-core/framework';
|
|
10
10
|
import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { useSidebar } from '../../contexts/sidebar.js';
|
|
15
|
-
import { useTOCItems } from '../../components/layout/toc.js';
|
|
11
|
+
import { isActive } from '../../../utils/is-active.js';
|
|
12
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../../../components/ui/collapsible.js';
|
|
13
|
+
import { useTOCItems } from '../../../components/toc/index.js';
|
|
16
14
|
import { useActiveAnchor } from 'fumadocs-core/toc';
|
|
15
|
+
import { LayoutContext } from '../client.js';
|
|
16
|
+
import { useFooterItems } from '../../../utils/use-footer-items.js';
|
|
17
17
|
const TocPopoverContext = createContext(null);
|
|
18
|
-
export function
|
|
18
|
+
export function PageTOCPopover({ className, children, ...rest }) {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const { isNavTransparent } = use(LayoutContext);
|
|
22
|
+
const onClick = useEffectEvent((e) => {
|
|
23
|
+
if (!open)
|
|
24
|
+
return;
|
|
25
|
+
if (ref.current && !ref.current.contains(e.target))
|
|
26
|
+
setOpen(false);
|
|
27
|
+
});
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
window.addEventListener('click', onClick);
|
|
30
|
+
return () => {
|
|
31
|
+
window.removeEventListener('click', onClick);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
return (_jsx(TocPopoverContext, { value: useMemo(() => ({
|
|
35
|
+
open,
|
|
36
|
+
setOpen,
|
|
37
|
+
}), [setOpen, open]), children: _jsx(Collapsible, { open: open, onOpenChange: setOpen, "data-toc-popover": "", className: cn('sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]', className), ...rest, children: _jsx("header", { ref: ref, className: cn('border-b backdrop-blur-sm transition-colors', (!isNavTransparent || open) && 'bg-fd-background/80', open && 'shadow-lg'), children: children }) }) }));
|
|
38
|
+
}
|
|
39
|
+
export function PageTOCPopoverTrigger({ className, ...props }) {
|
|
19
40
|
const { text } = useI18n();
|
|
20
41
|
const { open } = use(TocPopoverContext);
|
|
21
42
|
const items = useTOCItems();
|
|
@@ -23,7 +44,7 @@ export function PageTOCPopoverTrigger(props) {
|
|
|
23
44
|
const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
|
|
24
45
|
const path = useTreePath().at(-1);
|
|
25
46
|
const showItem = selected !== -1 && !open;
|
|
26
|
-
return (_jsxs(CollapsibleTrigger, {
|
|
47
|
+
return (_jsxs(CollapsibleTrigger, { className: cn('flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6', className), "data-toc-popover-trigger": "", ...props, children: [_jsx(ProgressCircle, { value: (selected + 1) / Math.max(1, items.length), max: 1, className: cn('shrink-0', open && 'text-fd-primary') }), _jsxs("span", { className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1", children: [_jsx("span", { className: cn('truncate transition-all', open && 'text-fd-foreground', showItem && 'opacity-0 -translate-y-full pointer-events-none'), children: path?.name ?? text.toc }), _jsx("span", { className: cn('truncate transition-all', !showItem && 'opacity-0 translate-y-full pointer-events-none'), children: items[selected]?.title })] }), _jsx(ChevronDown, { className: cn('shrink-0 transition-transform mx-0.5', open && 'rotate-180') })] }));
|
|
27
48
|
}
|
|
28
49
|
function clamp(input, min, max) {
|
|
29
50
|
if (input < min)
|
|
@@ -47,36 +68,7 @@ function ProgressCircle({ value, strokeWidth = 2, size = 24, min = 0, max = 100,
|
|
|
47
68
|
return (_jsxs("svg", { role: "progressbar", viewBox: `0 0 ${size} ${size}`, "aria-valuenow": normalizedValue, "aria-valuemin": min, "aria-valuemax": max, ...restSvgProps, children: [_jsx("circle", { ...circleProps, className: "stroke-current/25" }), _jsx("circle", { ...circleProps, stroke: "currentColor", strokeDasharray: circumference, strokeDashoffset: circumference - progress, strokeLinecap: "round", transform: `rotate(-90 ${size / 2} ${size / 2})`, className: "transition-all" })] }));
|
|
48
69
|
}
|
|
49
70
|
export function PageTOCPopoverContent(props) {
|
|
50
|
-
return (_jsx(CollapsibleContent, { "data-toc-popover": "", ...props, className: cn('flex flex-col px-4 max-h-[50vh] md:px-6', props.className), children: props.children }));
|
|
51
|
-
}
|
|
52
|
-
export function PageTOCPopover(props) {
|
|
53
|
-
const ref = useRef(null);
|
|
54
|
-
const [open, setOpen] = useState(false);
|
|
55
|
-
const { collapsed } = useSidebar();
|
|
56
|
-
const { isTransparent } = useNav();
|
|
57
|
-
const onClick = useEffectEvent((e) => {
|
|
58
|
-
if (!open)
|
|
59
|
-
return;
|
|
60
|
-
if (ref.current && !ref.current.contains(e.target))
|
|
61
|
-
setOpen(false);
|
|
62
|
-
});
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
window.addEventListener('click', onClick);
|
|
65
|
-
return () => {
|
|
66
|
-
window.removeEventListener('click', onClick);
|
|
67
|
-
};
|
|
68
|
-
}, []);
|
|
69
|
-
return (_jsx(TocPopoverContext, { value: useMemo(() => ({
|
|
70
|
-
open,
|
|
71
|
-
setOpen,
|
|
72
|
-
}), [setOpen, open]), children: _jsx(Collapsible, { open: open, onOpenChange: setOpen, asChild: true, children: _jsx("header", { ref: ref, id: "nd-tocnav", ...props, className: cn('fixed pr-(--removed-body-scroll-bar-size,0) z-10 border-b backdrop-blur-sm transition-colors xl:hidden max-xl:on-root:[--fd-tocnav-height:40px]', (!isTransparent || open) && 'bg-fd-background/80', open && 'shadow-lg', props.className), style: {
|
|
73
|
-
...props.style,
|
|
74
|
-
top: 'calc(var(--fd-banner-height) + var(--fd-nav-height))',
|
|
75
|
-
insetInlineStart: collapsed
|
|
76
|
-
? '0px'
|
|
77
|
-
: 'calc(var(--fd-sidebar-width) + var(--fd-layout-offset))',
|
|
78
|
-
insetInlineEnd: 0,
|
|
79
|
-
}, children: props.children }) }) }));
|
|
71
|
+
return (_jsx(CollapsibleContent, { "data-toc-popover-content": "", ...props, className: cn('flex flex-col px-4 max-h-[50vh] md:px-6', props.className), children: props.children }));
|
|
80
72
|
}
|
|
81
73
|
export function PageLastUpdate({ date: value, ...props }) {
|
|
82
74
|
const { text } = useI18n();
|
|
@@ -87,41 +79,21 @@ export function PageLastUpdate({ date: value, ...props }) {
|
|
|
87
79
|
}, [value]);
|
|
88
80
|
return (_jsxs("p", { ...props, className: cn('text-sm text-fd-muted-foreground', props.className), children: [text.lastUpdate, " ", date] }));
|
|
89
81
|
}
|
|
90
|
-
function scanNavigationList(tree) {
|
|
91
|
-
const list = [];
|
|
92
|
-
tree.forEach((node) => {
|
|
93
|
-
if (node.type === 'folder') {
|
|
94
|
-
if (node.index) {
|
|
95
|
-
list.push(node.index);
|
|
96
|
-
}
|
|
97
|
-
list.push(...scanNavigationList(node.children));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (node.type === 'page' && !node.external) {
|
|
101
|
-
list.push(node);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return list;
|
|
105
|
-
}
|
|
106
|
-
const listCache = new Map();
|
|
107
82
|
export function PageFooter({ items, ...props }) {
|
|
108
|
-
const
|
|
83
|
+
const footerList = useFooterItems();
|
|
109
84
|
const pathname = usePathname();
|
|
110
85
|
const { previous, next } = useMemo(() => {
|
|
111
86
|
if (items)
|
|
112
87
|
return items;
|
|
113
|
-
const
|
|
114
|
-
const list = cached ?? scanNavigationList(root.children);
|
|
115
|
-
listCache.set(root.$id, list);
|
|
116
|
-
const idx = list.findIndex((item) => isActive(item.url, pathname, false));
|
|
88
|
+
const idx = footerList.findIndex((item) => isActive(item.url, pathname, false));
|
|
117
89
|
if (idx === -1)
|
|
118
90
|
return {};
|
|
119
91
|
return {
|
|
120
|
-
previous:
|
|
121
|
-
next:
|
|
92
|
+
previous: footerList[idx - 1],
|
|
93
|
+
next: footerList[idx + 1],
|
|
122
94
|
};
|
|
123
|
-
}, [items, pathname
|
|
124
|
-
return (_jsxs("div", { ...props, className: cn('@container grid gap-4
|
|
95
|
+
}, [footerList, items, pathname]);
|
|
96
|
+
return (_jsxs("div", { ...props, className: cn('@container grid gap-4', previous && next ? 'grid-cols-2' : 'grid-cols-1', props.className), children: [previous ? _jsx(FooterItem, { item: previous, index: 0 }) : null, next ? _jsx(FooterItem, { item: next, index: 1 }) : null] }));
|
|
125
97
|
}
|
|
126
98
|
function FooterItem({ item, index }) {
|
|
127
99
|
const { text } = useI18n();
|
|
@@ -145,12 +117,3 @@ export function PageBreadcrumb({ includeRoot, includeSeparator, includePage, ...
|
|
|
145
117
|
return (_jsxs(Fragment, { children: [i !== 0 && _jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? (_jsx(Link, { href: item.url, className: cn(className, 'transition-opacity hover:opacity-80'), children: item.name })) : (_jsx("span", { className: className, children: item.name }))] }, i));
|
|
146
118
|
}) }));
|
|
147
119
|
}
|
|
148
|
-
export function PageTOC(props) {
|
|
149
|
-
const { collapsed } = useSidebar();
|
|
150
|
-
const offset = collapsed ? '0px' : 'var(--fd-layout-offset)';
|
|
151
|
-
return (_jsx("div", { id: "nd-toc", ...props, className: cn('fixed bottom-0 pt-12 pb-2 pr-(--removed-body-scroll-bar-size,0) xl:on-root:[--fd-toc-width:286px] max-xl:hidden', props.className), style: {
|
|
152
|
-
...props.style,
|
|
153
|
-
top: 'calc(var(--fd-banner-height) + var(--fd-nav-height))',
|
|
154
|
-
insetInlineEnd: `max(${offset}, calc(50vw - var(--fd-sidebar-width)/2 - var(--fd-page-width)/2))`,
|
|
155
|
-
}, children: _jsx("div", { className: "flex h-full w-(--fd-toc-width) max-w-full flex-col pe-4", children: props.children }) }));
|
|
156
|
-
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { type BreadcrumbProps, type FooterProps } from './client.js';
|
|
3
|
+
import type { AnchorProviderProps, TOCItemType } from 'fumadocs-core/toc';
|
|
4
|
+
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
component: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface FooterOptions extends FooterProps {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
component: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface DocsPageProps {
|
|
13
|
+
toc?: TOCItemType[];
|
|
14
|
+
tableOfContent?: Partial<TableOfContentOptions>;
|
|
15
|
+
tableOfContentPopover?: Partial<TableOfContentPopoverOptions>;
|
|
16
|
+
/**
|
|
17
|
+
* Extend the page to fill all available space
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue false
|
|
20
|
+
*/
|
|
21
|
+
full?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Replace or disable breadcrumb
|
|
24
|
+
*/
|
|
25
|
+
breadcrumb?: Partial<BreadcrumbOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Footer navigation, you can disable it by passing `false`
|
|
28
|
+
*/
|
|
29
|
+
footer?: Partial<FooterOptions>;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
type TableOfContentOptions = Pick<AnchorProviderProps, 'single'> & {
|
|
33
|
+
/**
|
|
34
|
+
* Custom content in TOC container, before the main TOC
|
|
35
|
+
*/
|
|
36
|
+
header?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Custom content in TOC container, after the main TOC
|
|
39
|
+
*/
|
|
40
|
+
footer?: ReactNode;
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
component: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* @defaultValue 'normal'
|
|
45
|
+
*/
|
|
46
|
+
style?: 'normal' | 'clerk';
|
|
47
|
+
};
|
|
48
|
+
type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
|
|
49
|
+
export declare function DocsPage({ breadcrumb: { enabled: breadcrumbEnabled, component: breadcrumb, ...breadcrumbProps }, footer, full, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, toc, children, }: DocsPageProps): ReactNode;
|
|
50
|
+
export declare function EditOnGitHub(props: ComponentProps<'a'>): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Add typography styles
|
|
53
|
+
*/
|
|
54
|
+
export declare function DocsBody({ children, className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export declare function DocsDescription({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element | null;
|
|
56
|
+
export declare function DocsTitle({ children, className, ...props }: ComponentProps<'h1'>): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export { PageLastUpdate, PageBreadcrumb } from './client.js';
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layouts/docs/page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAMjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAK1E,UAAU,iBAAkB,SAAQ,eAAe;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,aAAc,SAAQ,WAAW;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChD,qBAAqB,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAE9D;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG;IACjE;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,4BAA4B,GAAG,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAE1E,wBAAgB,QAAQ,CAAC,EACvB,UAAU,EAAE,EACV,OAAO,EAAE,iBAAwB,EACjC,SAAS,EAAE,UAAU,EACrB,GAAG,eAAe,EACd,EACN,MAAW,EACX,IAAY,EACZ,qBAAqB,EAAE,EACrB,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,UAAU,EACrB,GAAG,iBAAiB,EAChB,EACN,cAAc,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,UAAU,EACT,EACN,GAAQ,EACR,QAAQ,GACT,EAAE,aAAa,aAkFf;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAuBtD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,2CAMvB;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,kDAYrB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,IAAI,CAAC,2CAMtB;AAED,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import { buttonVariants } from '../../../components/ui/button.js';
|
|
4
|
+
import { Edit, Text } from '../../../icons.js';
|
|
5
|
+
import { I18nLabel } from '../../../contexts/i18n.js';
|
|
6
|
+
import { PageBreadcrumb, PageFooter, PageTOCPopover, PageTOCPopoverContent, PageTOCPopoverTrigger, } from './client.js';
|
|
7
|
+
import * as TocDefault from '../../../components/toc/default.js';
|
|
8
|
+
import * as TocClerk from '../../../components/toc/clerk.js';
|
|
9
|
+
import { TOCProvider, TOCScrollArea } from '../../../components/toc/index.js';
|
|
10
|
+
export function DocsPage({ breadcrumb: { enabled: breadcrumbEnabled = true, component: breadcrumb, ...breadcrumbProps } = {}, footer = {}, full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, toc = [], children, }) {
|
|
11
|
+
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
12
|
+
tocEnabled ?? (tocEnabled = !full &&
|
|
13
|
+
(toc.length > 0 ||
|
|
14
|
+
tocOptions.footer !== undefined ||
|
|
15
|
+
tocOptions.header !== undefined));
|
|
16
|
+
tocPopoverEnabled ?? (tocPopoverEnabled = toc.length > 0 ||
|
|
17
|
+
tocPopoverOptions.header !== undefined ||
|
|
18
|
+
tocPopoverOptions.footer !== undefined);
|
|
19
|
+
let wrapper = (children) => children;
|
|
20
|
+
if (tocEnabled || tocPopoverEnabled) {
|
|
21
|
+
wrapper = (children) => (_jsx(TOCProvider, { single: tocOptions.single, toc: toc, children: children }));
|
|
22
|
+
}
|
|
23
|
+
return wrapper(_jsxs(_Fragment, { children: [tocPopoverEnabled &&
|
|
24
|
+
(tocPopover ?? (_jsxs(PageTOCPopover, { children: [_jsx(PageTOCPopoverTrigger, {}), _jsxs(PageTOCPopoverContent, { children: [tocPopoverOptions.header, _jsx(TOCScrollArea, { children: tocPopoverOptions.style === 'clerk' ? (_jsx(TocClerk.TOCItems, {})) : (_jsx(TocDefault.TOCItems, {})) }), tocPopoverOptions.footer] })] }))), _jsxs("article", { id: "nd-page", "data-full": full, className: cn('flex flex-col w-full max-w-[900px] mx-auto [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14', full ? 'max-w-[1200px]' : 'xl:layout:[--fd-toc-width:268px]'), children: [breadcrumbEnabled &&
|
|
25
|
+
(breadcrumb ?? _jsx(PageBreadcrumb, { ...breadcrumbProps })), children, footer.enabled !== false &&
|
|
26
|
+
(footer.component ?? _jsx(PageFooter, { items: footer.items }))] }), tocEnabled &&
|
|
27
|
+
(tocReplace ?? (_jsxs("div", { id: "nd-toc", className: "sticky top-(--fd-docs-row-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] flex flex-col [grid-area:toc] w-(--fd-toc-width) pt-12 pe-4 pb-2 max-xl:hidden", children: [tocOptions.header, _jsxs("h3", { id: "toc-title", className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), _jsx(TOCScrollArea, { children: tocOptions.style === 'clerk' ? (_jsx(TocClerk.TOCItems, {})) : (_jsx(TocDefault.TOCItems, {})) }), tocOptions.footer] })))] }));
|
|
28
|
+
}
|
|
29
|
+
export function EditOnGitHub(props) {
|
|
30
|
+
return (_jsx("a", { target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
|
|
31
|
+
color: 'secondary',
|
|
32
|
+
size: 'sm',
|
|
33
|
+
className: 'gap-1.5 not-prose',
|
|
34
|
+
}), props.className), children: props.children ?? (_jsxs(_Fragment, { children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] })) }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Add typography styles
|
|
38
|
+
*/
|
|
39
|
+
export function DocsBody({ children, className, ...props }) {
|
|
40
|
+
return (_jsx("div", { ...props, className: cn('prose flex-1', className), children: children }));
|
|
41
|
+
}
|
|
42
|
+
export function DocsDescription({ children, className, ...props }) {
|
|
43
|
+
// Don't render if no description provided
|
|
44
|
+
if (children === undefined)
|
|
45
|
+
return null;
|
|
46
|
+
return (_jsx("p", { ...props, className: cn('mb-8 text-lg text-fd-muted-foreground', className), children: children }));
|
|
47
|
+
}
|
|
48
|
+
export function DocsTitle({ children, className, ...props }) {
|
|
49
|
+
return (_jsx("h1", { ...props, className: cn('text-[1.75em] font-semibold', className), children: children }));
|
|
50
|
+
}
|
|
51
|
+
export { PageLastUpdate, PageBreadcrumb } from './client.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Base from '../../components/sidebar/base.js';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export declare const Sidebar: typeof Base.SidebarProvider, SidebarFolder: typeof Base.SidebarFolder, SidebarCollapseTrigger: typeof Base.SidebarCollapseTrigger, SidebarViewport: typeof Base.SidebarViewport, SidebarTrigger: typeof Base.SidebarTrigger;
|
|
4
|
+
export declare function SidebarContent({ className, children, ...props }: ComponentProps<'aside'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function SidebarDrawer({ children, className, ...props }: ComponentProps<typeof Base.SidebarDrawerContent>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function SidebarSeparator({ className, style, children, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SidebarItem({ className, style, children, ...props }: ComponentProps<typeof Base.SidebarItem>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function SidebarFolderTrigger({ className, style, ...props }: ComponentProps<typeof Base.SidebarFolderTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SidebarFolderLink({ className, style, ...props }: ComponentProps<typeof Base.SidebarFolderLink>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function SidebarFolderContent({ className, children, ...props }: ComponentProps<typeof Base.SidebarFolderContent>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const SidebarPageTree: (components: Partial<import("../../components/sidebar/page-tree.js").SidebarPageTreeComponents>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const SidebarLinkItem: ({ item, ...props }: import("react").HTMLAttributes<HTMLElement> & {
|
|
13
|
+
item: Exclude<import("../shared/index.js").LinkItemType, {
|
|
14
|
+
type: "icon";
|
|
15
|
+
}>;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAoB5C,eAAO,MACY,OAAO,+BACxB,aAAa,6BACb,sBAAsB,sCACtB,eAAe,+BACf,cAAc,4BACR,CAAC;AAET,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,CAAC,2CAoBzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,2CAelD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAerB;AAED,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,2CAezC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,2CAelD;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,iBAAiB,CAAC,2CAe/C;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,2CAkBlD;AAED,eAAO,MAAM,eAAe,sIAO1B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;6CAM1B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Base from '../../components/sidebar/base.js';
|
|
4
|
+
import { cn } from '../../utils/cn.js';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { createPageTreeRenderer } from '../../components/sidebar/page-tree.js';
|
|
7
|
+
import { createLinkItemRenderer } from '../../components/sidebar/link-item.js';
|
|
8
|
+
const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
link: 'data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
function getItemOffset(depth) {
|
|
16
|
+
return `calc(${2 + 3 * depth} * var(--spacing))`;
|
|
17
|
+
}
|
|
18
|
+
export const { SidebarProvider: Sidebar, SidebarFolder, SidebarCollapseTrigger, SidebarViewport, SidebarTrigger, } = Base;
|
|
19
|
+
export function SidebarContent({ className, children, ...props }) {
|
|
20
|
+
return (_jsx(Base.SidebarContent, { aside: ({ collapsed, hovered }) => ({
|
|
21
|
+
className: cn('sticky top-(--fd-docs-row-1) [grid-area:sidebar] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] flex flex-col items-end z-20 bg-fd-card text-sm border-e *:w-(--fd-sidebar-width) md:layout:[--fd-sidebar-width:268px] max-md:hidden', collapsed && [
|
|
22
|
+
'fixed start-0 inset-y-2 h-auto rounded-xl border transition-[opacity,translate] duration-200',
|
|
23
|
+
hovered
|
|
24
|
+
? 'z-50 shadow-lg translate-x-2 rtl:-translate-x-2'
|
|
25
|
+
: 'opacity-0 -translate-x-[calc(100%-16px)] rtl:translate-x-[calc(100%-16px)]',
|
|
26
|
+
], className),
|
|
27
|
+
...props,
|
|
28
|
+
}), children: children }));
|
|
29
|
+
}
|
|
30
|
+
export function SidebarDrawer({ children, className, ...props }) {
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsx(Base.SidebarDrawerOverlay, { className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), _jsx(Base.SidebarDrawerContent, { className: cn('fixed text-[0.9375rem] flex flex-col shadow-lg border-s end-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out', className), ...props, children: children })] }));
|
|
32
|
+
}
|
|
33
|
+
export function SidebarSeparator({ className, style, children, ...props }) {
|
|
34
|
+
const depth = Base.useFolderDepth();
|
|
35
|
+
return (_jsx(Base.SidebarSeparator, { className: cn('[&_svg]:size-4 [&_svg]:shrink-0', className), style: {
|
|
36
|
+
paddingInlineStart: getItemOffset(depth),
|
|
37
|
+
...style,
|
|
38
|
+
}, ...props, children: children }));
|
|
39
|
+
}
|
|
40
|
+
export function SidebarItem({ className, style, children, ...props }) {
|
|
41
|
+
const depth = Base.useFolderDepth();
|
|
42
|
+
return (_jsx(Base.SidebarItem, { className: cn(itemVariants({ variant: 'link' }), className), style: {
|
|
43
|
+
paddingInlineStart: getItemOffset(depth),
|
|
44
|
+
...style,
|
|
45
|
+
}, ...props, children: children }));
|
|
46
|
+
}
|
|
47
|
+
export function SidebarFolderTrigger({ className, style, ...props }) {
|
|
48
|
+
const depth = Base.useFolderDepth();
|
|
49
|
+
return (_jsx(Base.SidebarFolderTrigger, { className: cn(itemVariants(), 'w-full', className), style: {
|
|
50
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
51
|
+
...style,
|
|
52
|
+
}, ...props, children: props.children }));
|
|
53
|
+
}
|
|
54
|
+
export function SidebarFolderLink({ className, style, ...props }) {
|
|
55
|
+
const depth = Base.useFolderDepth();
|
|
56
|
+
return (_jsx(Base.SidebarFolderLink, { className: cn(itemVariants({ variant: 'link' }), 'w-full', className), style: {
|
|
57
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
58
|
+
...style,
|
|
59
|
+
}, ...props, children: props.children }));
|
|
60
|
+
}
|
|
61
|
+
export function SidebarFolderContent({ className, children, ...props }) {
|
|
62
|
+
const depth = Base.useFolderDepth();
|
|
63
|
+
return (_jsx(Base.SidebarFolderContent, { className: cn('relative', depth === 1 && [
|
|
64
|
+
"before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5",
|
|
65
|
+
"**:data-[active=true]:before:content-[''] **:data-[active=true]:before:bg-fd-primary **:data-[active=true]:before:absolute **:data-[active=true]:before:w-px **:data-[active=true]:before:inset-y-2.5 **:data-[active=true]:before:start-2.5",
|
|
66
|
+
], className), ...props, children: children }));
|
|
67
|
+
}
|
|
68
|
+
export const SidebarPageTree = createPageTreeRenderer({
|
|
69
|
+
SidebarFolder,
|
|
70
|
+
SidebarFolderContent,
|
|
71
|
+
SidebarFolderLink,
|
|
72
|
+
SidebarFolderTrigger,
|
|
73
|
+
SidebarItem,
|
|
74
|
+
SidebarSeparator,
|
|
75
|
+
});
|
|
76
|
+
export const SidebarLinkItem = createLinkItemRenderer({
|
|
77
|
+
SidebarFolder,
|
|
78
|
+
SidebarFolderContent,
|
|
79
|
+
SidebarFolderLink,
|
|
80
|
+
SidebarFolderTrigger,
|
|
81
|
+
SidebarItem,
|
|
82
|
+
});
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type LinkItemType } from '../../layouts/shared/index.js';
|
|
3
|
-
import { NavigationMenuContent, NavigationMenuItem, NavigationMenuTrigger } from '../../components/ui/navigation-menu.js';
|
|
1
|
+
import type { HomeLayoutProps } from './index.js';
|
|
4
2
|
export declare const navItemVariants: (props?: ({
|
|
5
3
|
variant?: "button" | "main" | "icon" | null | undefined;
|
|
6
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
export declare function
|
|
8
|
-
export { NavigationMenuItem };
|
|
9
|
-
export declare function NavigationMenuLinkItem({ item, ...props }: {
|
|
10
|
-
item: LinkItemType;
|
|
11
|
-
className?: string;
|
|
12
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare function MobileNavigationMenuLinkItem({ item, ...props }: {
|
|
14
|
-
item: LinkItemType;
|
|
15
|
-
className?: string;
|
|
16
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function MobileNavigationMenuTrigger({ enableHover, ...props }: ComponentProps<typeof NavigationMenuTrigger> & {
|
|
18
|
-
/**
|
|
19
|
-
* Enable hover to trigger
|
|
20
|
-
*/
|
|
21
|
-
enableHover?: boolean;
|
|
22
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare function MobileNavigationMenuContent(props: ComponentProps<typeof NavigationMenuContent>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function Header({ nav, i18n, links, githubUrl, themeSwitch, searchToggle, }: HomeLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
24
6
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/client.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAazC,eAAO,MAAM,eAAe;;8EAiB1B,CAAC;AAEH,wBAAgB,MAAM,CAAC,EACrB,GAAQ,EACR,IAAY,EACZ,KAAK,EACL,SAAS,EACT,WAAgB,EAChB,YAAiB,GAClB,EAAE,eAAe,2CA0HjB"}
|