fumadocs-ui 14.5.4 → 14.5.6
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/dist/components/dialog/search.js +2 -2
- package/dist/components/layout/root-toggle.d.ts +4 -4
- package/dist/components/layout/root-toggle.d.ts.map +1 -1
- package/dist/components/layout/root-toggle.js +6 -7
- package/dist/components/layout/toc.d.ts +6 -0
- package/dist/components/layout/toc.d.ts.map +1 -1
- package/dist/components/layout/toc.js +16 -2
- package/dist/layouts/docs/navbar.js +1 -1
- package/dist/layouts/docs/sidebar.d.ts.map +1 -1
- package/dist/layouts/docs/sidebar.js +7 -4
- package/dist/layouts/docs.client.d.ts +1 -0
- package/dist/layouts/docs.client.d.ts.map +1 -1
- package/dist/layouts/docs.client.js +7 -1
- package/dist/layouts/docs.d.ts.map +1 -1
- package/dist/layouts/docs.js +3 -3
- package/dist/layouts/notebook.client.d.ts +3 -1
- package/dist/layouts/notebook.client.d.ts.map +1 -1
- package/dist/layouts/notebook.client.js +23 -4
- package/dist/layouts/notebook.d.ts.map +1 -1
- package/dist/layouts/notebook.js +3 -6
- package/dist/page.client.d.ts +0 -1
- package/dist/page.client.d.ts.map +1 -1
- package/dist/page.client.js +1 -10
- package/dist/page.d.ts +3 -1
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +6 -7
- package/dist/style.css +35 -49
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -1
- package/dist/utils/get-sidebar-tabs.js +23 -9
- package/package.json +6 -6
- package/dist/components/layout/toc-popover.d.ts +0 -8
- package/dist/components/layout/toc-popover.d.ts.map +0 -1
- package/dist/components/layout/toc-popover.js +0 -20
|
@@ -17,7 +17,7 @@ export function SearchDialog({ open, onOpenChange, footer, links = [], ...props
|
|
|
17
17
|
content: name,
|
|
18
18
|
url: link,
|
|
19
19
|
})), [links]);
|
|
20
|
-
return (_jsxs(Dialog, { open: open, onOpenChange: onOpenChange, children: [_jsx(DialogOverlay, { className: "fixed inset-0 z-50 bg-
|
|
20
|
+
return (_jsxs(Dialog, { open: open, onOpenChange: onOpenChange, children: [_jsx(DialogOverlay, { className: "fixed inset-0 z-50 bg-black/30 backdrop-blur-sm data-[state=closed]:animate-fd-fade-out data-[state=open]:animate-fd-fade-in" }), _jsxs(DialogContent, { "aria-describedby": undefined, className: "fixed left-1/2 top-[10vh] z-50 w-[98vw] max-w-screen-sm origin-left -translate-x-1/2 rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-lg data-[state=closed]:animate-fd-dialog-out data-[state=open]:animate-fd-dialog-in", children: [_jsx(DialogTitle, { className: "hidden", children: text.search }), _jsx(SearchInput, { search: props.search, onSearchChange: props.onSearchChange, isLoading: props.isLoading }), _jsx(SearchList, { items: props.results === 'empty' ? defaultItems : props.results, hideResults: props.results === 'empty' && defaultItems.length === 0 }), footer ? (_jsx("div", { className: "mt-auto flex flex-col border-t p-3", children: footer })) : null] })] }));
|
|
21
21
|
}
|
|
22
22
|
const icons = {
|
|
23
23
|
text: _jsx(Text, { className: "size-4 text-fd-muted-foreground" }),
|
|
@@ -92,5 +92,5 @@ function CommandItem({ active, onActiveChange, value, ...props }) {
|
|
|
92
92
|
block: 'nearest',
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
}, [active, value]), type: "button", "aria-selected": active === value, onPointerMove: () => onActiveChange(value), ...props, className: cn('flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm
|
|
95
|
+
}, [active, value]), type: "button", "aria-selected": active === value, onPointerMove: () => onActiveChange(value), ...props, className: cn('flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm', active === value && 'bg-fd-accent text-fd-accent-foreground', props.className), children: props.children }));
|
|
96
96
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import type { PageTree } from 'fumadocs-core/server';
|
|
3
2
|
export interface Option {
|
|
4
3
|
/**
|
|
5
4
|
* Redirect URL of the folder, usually the index page
|
|
@@ -9,12 +8,13 @@ export interface Option {
|
|
|
9
8
|
title: ReactNode;
|
|
10
9
|
description?: ReactNode;
|
|
11
10
|
/**
|
|
12
|
-
* Detect from
|
|
11
|
+
* Detect from a list of urls
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
urls?: string[];
|
|
15
14
|
props?: HTMLAttributes<HTMLElement>;
|
|
16
15
|
}
|
|
17
|
-
export declare function RootToggle({ options, ...props }: {
|
|
16
|
+
export declare function RootToggle({ options, placeholder, ...props }: {
|
|
17
|
+
placeholder?: ReactNode;
|
|
18
18
|
options: Option[];
|
|
19
19
|
} & HTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
//# sourceMappingURL=root-toggle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ/E,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,iBAAiB,CAAC,2CAuDpC"}
|
|
@@ -8,22 +8,21 @@ import { cn } from '../../utils/cn';
|
|
|
8
8
|
import { isActive } from '../../utils/is-active';
|
|
9
9
|
import { useSidebar } from '../../contexts/sidebar';
|
|
10
10
|
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
|
11
|
-
|
|
12
|
-
export function RootToggle({ options, ...props }) {
|
|
11
|
+
export function RootToggle({ options, placeholder, ...props }) {
|
|
13
12
|
const [open, setOpen] = useState(false);
|
|
14
13
|
const { closeOnRedirect } = useSidebar();
|
|
15
14
|
const pathname = usePathname();
|
|
16
|
-
const path = useTreePath();
|
|
17
15
|
const selected = useMemo(() => {
|
|
18
|
-
return options.findLast((item) => item.
|
|
19
|
-
?
|
|
16
|
+
return options.findLast((item) => item.urls
|
|
17
|
+
? item.urls.includes(pathname)
|
|
20
18
|
: isActive(item.url, pathname, true));
|
|
21
|
-
}, [
|
|
19
|
+
}, [options, pathname]);
|
|
22
20
|
const onClick = () => {
|
|
23
21
|
closeOnRedirect.current = false;
|
|
24
22
|
setOpen(false);
|
|
25
23
|
};
|
|
26
|
-
|
|
24
|
+
const item = selected ? _jsx(Item, { ...selected }) : placeholder;
|
|
25
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [item ? (_jsxs(PopoverTrigger, { ...props, className: cn('flex flex-row items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-fd-accent/50 hover:text-fd-accent-foreground', props.className), children: [item, _jsx(ChevronDown, { className: "me-1.5 size-4 text-fd-muted-foreground" })] })) : null, _jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] overflow-hidden p-0", children: options.map((item) => (_jsx(Link, { href: item.url, onClick: onClick, ...item.props, className: cn('flex w-full flex-row items-center gap-2 px-2 py-1.5', selected === item
|
|
27
26
|
? 'bg-fd-accent text-fd-accent-foreground'
|
|
28
27
|
: 'hover:bg-fd-accent/50', item.props?.className), children: _jsx(Item, { ...item }) }, item.url))) })] }));
|
|
29
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TOCItemType } from 'fumadocs-core/server';
|
|
2
2
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
3
|
+
import type { PopoverContentProps, PopoverTriggerProps } from '@radix-ui/react-popover';
|
|
3
4
|
export interface TOCProps {
|
|
4
5
|
/**
|
|
5
6
|
* Custom content in TOC container, before the main TOC
|
|
@@ -17,4 +18,9 @@ export declare function TOCItems({ items, isMenu, }: {
|
|
|
17
18
|
items: TOCItemType[];
|
|
18
19
|
isMenu?: boolean;
|
|
19
20
|
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const TocPopover: import("react").FC<import("@radix-ui/react-popover").PopoverProps>;
|
|
22
|
+
export declare function TocPopoverTrigger({ items, ...props }: PopoverTriggerProps & {
|
|
23
|
+
items: TOCItemType[];
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function TocPopoverContent(props: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
20
26
|
//# sourceMappingURL=toc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAU7E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAoBxD;AAED,wBAAgB,aAAa,4CAQ5B;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,MAAc,GACf,EAAE;IACD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,2CA6BA;AAkBD,eAAO,MAAM,UAAU,oEAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,2CAyBhD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,2CAiB3D"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as Primitive from 'fumadocs-core/toc';
|
|
4
|
-
import { useRef } from 'react';
|
|
4
|
+
import { useMemo, useRef } from 'react';
|
|
5
5
|
import { cn } from '../../utils/cn';
|
|
6
6
|
import { useI18n } from '../../contexts/i18n';
|
|
7
7
|
import { TocThumb } from '../../components/layout/toc-thumb';
|
|
8
8
|
import { ScrollArea, ScrollViewport } from '../ui/scroll-area';
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover';
|
|
10
|
+
import { ChevronRight, Text } from 'lucide-react';
|
|
9
11
|
export function Toc(props) {
|
|
10
12
|
return (_jsx("div", { ...props, "data-toc": "", className: cn('sticky top-fd-layout-top h-[var(--fd-toc-height)] flex-1 pb-2 pt-12', props.className), style: {
|
|
11
13
|
...props.style,
|
|
@@ -26,3 +28,15 @@ export function TOCItems({ items, isMenu = false, }) {
|
|
|
26
28
|
function TOCItem({ item }) {
|
|
27
29
|
return (_jsx(Primitive.TOCItem, { href: item.url, className: cn('prose py-1.5 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary', item.depth <= 2 && 'ps-3.5', item.depth === 3 && 'ps-6', item.depth >= 4 && 'ps-8'), children: item.title }));
|
|
28
30
|
}
|
|
31
|
+
export const TocPopover = Popover;
|
|
32
|
+
export function TocPopoverTrigger({ items, ...props }) {
|
|
33
|
+
const { text } = useI18n();
|
|
34
|
+
const active = Primitive.useActiveAnchor();
|
|
35
|
+
const current = useMemo(() => {
|
|
36
|
+
return items.find((item) => active === item.url.slice(1))?.title;
|
|
37
|
+
}, [items, active]);
|
|
38
|
+
return (_jsxs(PopoverTrigger, { ...props, className: cn('inline-flex items-center gap-2 text-nowrap px-4 py-2 text-start', props.className), children: [_jsx(Text, { className: "size-4 shrink-0" }), text.toc, current ? (_jsxs(_Fragment, { children: [_jsx(ChevronRight, { className: "-mx-1.5 size-4 shrink-0 text-fd-muted-foreground" }), _jsx("span", { className: "truncate text-fd-muted-foreground", children: current })] })) : null] }));
|
|
39
|
+
}
|
|
40
|
+
export function TocPopoverContent(props) {
|
|
41
|
+
return (_jsx(PopoverContent, { hideWhenDetached: true, alignOffset: 16, align: "start", side: "bottom", "data-toc-popover": "", ...props, className: cn('flex max-h-[var(--radix-popover-content-available-height)] w-[260px] flex-col gap-4 p-3', props.className), children: props.children }));
|
|
42
|
+
}
|
|
@@ -9,7 +9,7 @@ import { Menu, X } from 'lucide-react';
|
|
|
9
9
|
export function Navbar(props) {
|
|
10
10
|
const { open } = useSidebar();
|
|
11
11
|
const { isTransparent } = useNav();
|
|
12
|
-
return (_jsx("header", { ...props, className: cn('sticky top-[var(--fd-banner-height)] z-30 flex flex-row items-center border-b border-fd-foreground/10 px-4 transition-colors', (!isTransparent || open) && 'bg-fd-background/80
|
|
12
|
+
return (_jsx("header", { ...props, className: cn('sticky top-[var(--fd-banner-height)] z-30 flex flex-row items-center border-b border-fd-foreground/10 px-4 backdrop-blur-lg transition-colors', (!isTransparent || open) && 'bg-fd-background/80', props.className), children: props.children }));
|
|
13
13
|
}
|
|
14
14
|
export function NavbarSidebarTrigger(props) {
|
|
15
15
|
const { open } = useSidebar();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAInE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC/D;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA6BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,2CAqDrD;AAED,wBAAgB,OAAO,CAAC,EACtB,gBAAoB,EACpB,QAAe,EACf,KAAK,EACL,GAAG,KAAK,EACT,EAAE,YAAY,GAAG;IAAE,KAAK,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAAE,2CAuC3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,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
return (_jsx(Sidebar, { ...props, onPointerEnter: onEnter, onPointerLeave: onLeave, "data-collapsed": collapsed, className: cn('transition-
|
|
54
|
-
'md:-me-[var(--fd-sidebar-width)] md:
|
|
53
|
+
return (_jsx(Sidebar, { ...props, onPointerEnter: collapsed ? onEnter : undefined, onPointerLeave: collapsed ? onLeave : undefined, "data-collapsed": collapsed, className: cn('md:transition-all', collapsed &&
|
|
54
|
+
'md:-me-[var(--fd-sidebar-width)] md:translate-x-[calc(var(--fd-sidebar-offset)*-1)] rtl:md:translate-x-[var(--fd-sidebar-offset)]', collapsed && hover && 'z-50 md:translate-x-0', collapsed && !hover && 'md:opacity-0', props.className), style: {
|
|
55
55
|
'--fd-sidebar-offset': 'calc(var(--fd-sidebar-width) - 20px)',
|
|
56
56
|
} }));
|
|
57
57
|
}
|
|
@@ -62,7 +62,7 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, inner, ...props
|
|
|
62
62
|
prefetch,
|
|
63
63
|
};
|
|
64
64
|
}, [defaultOpenLevel, prefetch]);
|
|
65
|
-
return (_jsx(Context.Provider, { value: context, children: _jsx(Base.SidebarList, { id: "nd-sidebar", blockScrollingWidth: 768, ...props, className: cn('fixed top-fd-layout-top z-30 bg-fd-card text-sm md:sticky md:h-[var(--fd-sidebar-height)]
|
|
65
|
+
return (_jsx(Context.Provider, { value: context, children: _jsx(Base.SidebarList, { id: "nd-sidebar", blockScrollingWidth: 768, ...props, className: cn('fixed top-fd-layout-top z-30 bg-fd-card text-sm md:sticky md:h-[var(--fd-sidebar-height)]', 'max-md:inset-x-0 max-md:bottom-0 max-md:bg-fd-background/80 max-md:text-[15px] max-md:backdrop-blur-lg max-md:data-[open=false]:invisible', props.className), style: {
|
|
66
66
|
...props.style,
|
|
67
67
|
'--fd-sidebar-height': 'calc(100dvh - var(--fd-banner-height) - var(--fd-nav-height))',
|
|
68
68
|
}, children: _jsx("div", { ...inner, className: cn('flex size-full max-w-full flex-col pt-2 md:ms-auto md:w-[var(--fd-sidebar-width)] md:border-e md:pt-4', inner?.className), children: props.children }) }) }));
|
|
@@ -105,10 +105,13 @@ export function SidebarFolderLink(props) {
|
|
|
105
105
|
const pathname = usePathname();
|
|
106
106
|
const active = props.href !== undefined && isActive(props.href, pathname, false);
|
|
107
107
|
return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), 'w-full pe-3.5 md:pe-1.5', props.className), onClick: (e) => {
|
|
108
|
-
setOpen((prev) => !active || !prev);
|
|
109
108
|
if (e.target.hasAttribute('data-icon')) {
|
|
109
|
+
setOpen((prev) => !prev);
|
|
110
110
|
e.preventDefault();
|
|
111
111
|
}
|
|
112
|
+
else {
|
|
113
|
+
setOpen((prev) => !active || !prev);
|
|
114
|
+
}
|
|
112
115
|
}, prefetch: prefetch, children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
|
|
113
116
|
}
|
|
114
117
|
export function SidebarFolderContent(props) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
2
2
|
import { type LinkItemType } from '../layouts/links';
|
|
3
|
+
export declare function LayoutBody(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
interface LinksMenuProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
5
|
items: LinkItemType[];
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.client.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AASf,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.client.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AASf,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAUlE,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAe5D;AAMD,UAAU,cAAe,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACtE,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAkB5D;AAED,UAAU,aAAc,SAAQ,cAAc,CAAC,WAAW,CAAC;IACzD,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAgDzD"}
|
|
@@ -10,6 +10,12 @@ import { BaseLinkItem } from '../layouts/links';
|
|
|
10
10
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../components/ui/collapsible';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
import { buttonVariants } from '../components/ui/button';
|
|
13
|
+
import { useSidebar } from '../contexts/sidebar';
|
|
14
|
+
export function LayoutBody(props) {
|
|
15
|
+
const { collapsed } = useSidebar();
|
|
16
|
+
return (_jsx("main", { ...props, className: cn(!collapsed &&
|
|
17
|
+
'[&_#nd-page]:max-w-[calc(min(100vw,var(--fd-layout-width))-var(--fd-sidebar-width)-var(--fd-toc-width))]', props.className), children: props.children }));
|
|
18
|
+
}
|
|
13
19
|
const itemVariants = cva('flex flex-row items-center gap-2 rounded-md px-3 py-2.5 text-fd-muted-foreground transition-colors duration-100 [overflow-wrap:anywhere] hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none md:px-2 md:py-1.5 [&_svg]:size-4');
|
|
14
20
|
export function LinksMenu({ items, ...props }) {
|
|
15
21
|
const [open, setOpen] = useState(false);
|
|
@@ -23,7 +29,7 @@ export function MenuItem({ item, ...props }) {
|
|
|
23
29
|
if (item.type === 'custom')
|
|
24
30
|
return (_jsx("div", { ...props, className: cn('grid', props.className), children: item.children }));
|
|
25
31
|
if (item.type === 'menu') {
|
|
26
|
-
return (_jsxs(Collapsible, { className: "flex flex-col", children: [_jsxs(CollapsibleTrigger, { ...props, className: cn(itemVariants(), 'group
|
|
32
|
+
return (_jsxs(Collapsible, { className: "flex flex-col", children: [_jsxs(CollapsibleTrigger, { ...props, className: cn(itemVariants(), 'group', props.className), children: [item.icon, item.text, _jsx(ChevronDown, { className: "ms-auto transition-transform group-data-[state=closed]:-rotate-90" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col py-2 ps-2", children: item.items.map((child, i) => (_jsx(MenuItem, { item: child }, i))) }) })] }));
|
|
27
33
|
}
|
|
28
34
|
return (_jsxs(BaseLinkItem, { item: item, ...props, className: cn(item.type === 'button'
|
|
29
35
|
? buttonVariants({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAgB5D,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AAe1D,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAElC,cAAc,CAAC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AO,EAAE,cAAqB,EAC9B,WAAkB,EAClB,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,iBAAiB,EAC7B,GAAG,OAAO,EACN,EACN,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CAsF7B;AA0FD,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
package/dist/layouts/docs.js
CHANGED
|
@@ -11,7 +11,7 @@ import { getSidebarTabs } from '../utils/get-sidebar-tabs';
|
|
|
11
11
|
import { RootToggle } from '../components/layout/root-toggle';
|
|
12
12
|
import { getLinks } from './shared';
|
|
13
13
|
import { LanguageToggle, LanguageToggleText, } from '../components/layout/language-toggle';
|
|
14
|
-
import { LinksMenu } from '../layouts/docs.client';
|
|
14
|
+
import { LayoutBody, LinksMenu } from '../layouts/docs.client';
|
|
15
15
|
import { TreeContextProvider } from '../contexts/tree';
|
|
16
16
|
import { NavProvider, Title } from '../components/layout/nav';
|
|
17
17
|
import { ThemeToggle } from '../components/layout/theme-toggle';
|
|
@@ -25,9 +25,9 @@ export function DocsLayout({ nav: { enabled: navEnabled = true, component: navRe
|
|
|
25
25
|
if (props.tree === undefined)
|
|
26
26
|
notFound();
|
|
27
27
|
const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
|
|
28
|
-
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { id: "nd-subnav", className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs(
|
|
28
|
+
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { id: "nd-subnav", className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs(LayoutBody, { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row md:[--fd-sidebar-width:260px] xl:[--fd-toc-width:260px] [&_#nd-toc]:max-xl:hidden [&_#nd-tocnav]:xl:hidden max-xl:[&_article]:mx-0', !navReplace && navEnabled
|
|
29
29
|
? '[--fd-nav-height:3.5rem] md:[--fd-nav-height:0px]'
|
|
30
|
-
: null, props.containerProps?.className), children: [collapsible ? (_jsx(SidebarCollapseTrigger, { className: "fixed bottom-3 start-2 z-40 transition-opacity data-[collapsed=false]:pointer-events-none data-[collapsed=false]:opacity-0 max-md:hidden" })) : null, replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-2 pt-4 empty:hidden md:hidden", children: links
|
|
30
|
+
: null, props.containerProps?.className), children: [collapsible ? (_jsx(SidebarCollapseTrigger, { className: "fixed bottom-3 start-2 z-40 transition-opacity data-[collapsed=false]:pointer-events-none data-[collapsed=false]:opacity-0 max-md:hidden" })) : null, replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, className: "md:flex-1 md:data-[collapsed=true]:flex-initial", children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-2 pt-4 empty:hidden md:hidden", children: links
|
|
31
31
|
.filter((v) => v.type !== 'icon')
|
|
32
32
|
.map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "px-2 py-4 md:px-3", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsxs(SidebarFooter, { children: [_jsx(SidebarFooterItems, { sidebarCollapsible: collapsible, i18n: i18n, disableThemeSwitch: props.disableThemeSwitch ?? false, iconItems: links.filter((v) => v.type === 'icon') }), sidebarFooter] })] }), {
|
|
33
33
|
...sidebar,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
1
|
+
import type { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
2
|
export declare function LayoutBody(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function SubNavbar(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function NavbarSidebarTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
5
|
//# sourceMappingURL=notebook.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.client.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"notebook.client.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAOlE,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAkB5D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CA2B3D;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAkB/C"}
|
|
@@ -2,12 +2,31 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from '../utils/cn';
|
|
4
4
|
import { useSidebar } from '../contexts/sidebar';
|
|
5
|
+
import { useNav } from '../components/layout/nav';
|
|
6
|
+
import { SidebarTrigger } from 'fumadocs-core/sidebar';
|
|
7
|
+
import { buttonVariants } from '../components/ui/button';
|
|
8
|
+
import { Menu, X } from 'lucide-react';
|
|
5
9
|
export function LayoutBody(props) {
|
|
6
|
-
const { collapsed } = useSidebar();
|
|
7
10
|
return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex w-full flex-1 flex-row', props.className), style: {
|
|
8
11
|
...props.style,
|
|
9
|
-
'--fd-
|
|
10
|
-
|
|
11
|
-
: 'calc(min(100vw, var(--fd-layout-width)) - var(--fd-sidebar-width))',
|
|
12
|
+
'--fd-layout-offset': 'max(calc(50vw - var(--fd-layout-width) / 2), 0px)',
|
|
13
|
+
paddingInlineEnd: 'var(--fd-layout-offset)',
|
|
12
14
|
}, children: props.children }));
|
|
13
15
|
}
|
|
16
|
+
export function SubNavbar(props) {
|
|
17
|
+
const { open, collapsed } = useSidebar();
|
|
18
|
+
const { isTransparent } = useNav();
|
|
19
|
+
return (_jsx("header", { id: "nd-subnav", ...props, className: cn('fixed inset-x-0 top-[var(--fd-banner-height)] z-10 h-14 backdrop-blur-lg transition-colors', (!isTransparent || open) && 'bg-fd-background/80', props.className), style: {
|
|
20
|
+
paddingInlineStart: collapsed
|
|
21
|
+
? 'calc(var(--fd-layout-offset))'
|
|
22
|
+
: 'calc(var(--fd-layout-offset) + var(--fd-sidebar-width))',
|
|
23
|
+
paddingInlineEnd: 'var(--fd-layout-offset)',
|
|
24
|
+
}, children: _jsx("div", { className: "mx-auto flex size-full flex-row items-center border-b border-fd-foreground/10 px-4 md:gap-1.5 lg:px-8", children: props.children }) }));
|
|
25
|
+
}
|
|
26
|
+
export function NavbarSidebarTrigger(props) {
|
|
27
|
+
const { open } = useSidebar();
|
|
28
|
+
return (_jsx(SidebarTrigger, { ...props, className: cn(buttonVariants({
|
|
29
|
+
color: 'ghost',
|
|
30
|
+
size: 'icon',
|
|
31
|
+
}), props.className), children: open ? _jsx(X, {}) : _jsx(Menu, {}) }));
|
|
32
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AA+B1B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;IAEjE,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EAAE,eAAe,EAAE,GAAG,GAAG,EAAO,EACrC,OAAO,EAAE,EACP,WAAW,EAAE,kBAAyB,EACtC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,iBAAiB,EAC7B,GAAG,OAAO,EACN,EACN,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CA2D7B"}
|
package/dist/layouts/notebook.js
CHANGED
|
@@ -6,7 +6,6 @@ import { notFound } from 'next/navigation';
|
|
|
6
6
|
import { RootToggle } from '../components/layout/root-toggle';
|
|
7
7
|
import { TreeContextProvider } from '../contexts/tree';
|
|
8
8
|
import { NavProvider, Title } from '../components/layout/nav';
|
|
9
|
-
import { Navbar, NavbarSidebarTrigger } from '../layouts/docs/navbar';
|
|
10
9
|
import { SearchOnly } from '../contexts/search';
|
|
11
10
|
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle';
|
|
12
11
|
import { cn } from '../utils/cn';
|
|
@@ -18,19 +17,17 @@ import { LanguageToggle } from '../components/layout/language-toggle';
|
|
|
18
17
|
import { ThemeToggle } from '../components/layout/theme-toggle';
|
|
19
18
|
import { Popover, PopoverContent, PopoverTrigger, } from '../components/ui/popover';
|
|
20
19
|
import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
21
|
-
import { LayoutBody } from './notebook.client';
|
|
20
|
+
import { LayoutBody, SubNavbar, NavbarSidebarTrigger } from './notebook.client';
|
|
22
21
|
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { collapsible: sidebarCollapsible = true, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, ...props }) {
|
|
23
22
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
24
23
|
const Aside = sidebarCollapsible ? CollapsibleSidebar : Sidebar;
|
|
25
24
|
if (props.tree === undefined)
|
|
26
25
|
notFound();
|
|
27
26
|
const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
|
|
28
|
-
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs(LayoutBody, { ...props.containerProps, className: cn('[--fd-nav-height:3.5rem] md:[--fd-sidebar-width:260px] lg:[--fd-toc-width:260px] [&_#nd-toc]:max-lg:hidden [&_#nd-tocnav]:lg:hidden', props.containerProps?.className), children: [_jsxs(Aside, { ...sidebar, className: cn('md:[--fd-nav-height:0px]', sidebar.className), children: [_jsxs(SidebarHeader, { children: [_jsxs(SidebarHeaderItems, { nav: nav, links: links, children: [nav.children, sidebarCollapsible ? (_jsx(SidebarCollapseTrigger, { className: "ms-auto text-fd-muted-foreground" })) : null] }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "md:-mx-2" })) : null] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-4 pt-4 empty:hidden md:px-3 lg:hidden", children: links.map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "p-4 md:px-3", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsx(SidebarFooter, { children: sidebarFooter })] }),
|
|
29
|
-
marginInlineStart: 'calc(var(--fd-sidebar-width) * -1)',
|
|
30
|
-
} })] }) }) }));
|
|
27
|
+
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs(LayoutBody, { ...props.containerProps, className: cn('[--fd-nav-height:3.5rem] md:[--fd-sidebar-width:260px] lg:[--fd-toc-width:260px] [&_#nd-page]:mt-[var(--fd-nav-height)] [&_#nd-toc]:max-lg:hidden [&_#nd-tocnav]:lg:hidden', props.containerProps?.className), children: [_jsxs(Aside, { ...sidebar, className: cn('md:ps-[var(--fd-layout-offset)] md:[--fd-nav-height:0px]', sidebar.className), children: [_jsxs(SidebarHeader, { children: [_jsxs(SidebarHeaderItems, { nav: nav, links: links, children: [nav.children, sidebarCollapsible ? (_jsx(SidebarCollapseTrigger, { className: "ms-auto text-fd-muted-foreground" })) : null] }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "md:-mx-2" })) : null] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-4 pt-4 empty:hidden md:px-3 lg:hidden", children: links.map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "p-4 md:px-3", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsx(SidebarFooter, { children: sidebarFooter })] }), _jsx(DocsNavbar, { nav: nav, links: links, i18n: i18n, sidebarCollapsible: sidebarCollapsible }), props.children] }) }) }));
|
|
31
28
|
}
|
|
32
29
|
function DocsNavbar({ sidebarCollapsible, links, nav = {}, i18n, }) {
|
|
33
|
-
return (_jsxs(
|
|
30
|
+
return (_jsxs(SubNavbar, { children: [sidebarCollapsible ? (_jsx(SidebarCollapseTrigger, { className: "-ms-1.5 text-fd-muted-foreground data-[collapsed=false]:hidden max-md:hidden" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] rounded-lg max-md:hidden" }) }), _jsx(Title, { url: nav.url, title: nav.title, className: "md:hidden" }), _jsxs("div", { className: "flex flex-1 flex-row items-center gap-6 px-2", children: [links
|
|
34
31
|
.filter((item) => item.type !== 'icon')
|
|
35
32
|
.map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground max-lg:hidden" }, i))), nav.children] }), _jsx(SearchOnly, { children: _jsx(SearchToggle, { className: "md:hidden" }) }), _jsx(NavbarSidebarTrigger, { className: "-me-1.5 md:hidden" }), _jsx("div", { className: "flex flex-row items-center empty:hidden max-lg:hidden", children: links
|
|
36
33
|
.filter((item) => item.type === 'icon')
|
package/dist/page.client.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from 'react';
|
|
2
2
|
import { type BreadcrumbOptions } from 'fumadocs-core/breadcrumb';
|
|
3
|
-
export declare function PageContainer(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export declare function PageHeader(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export declare function LastUpdate(props: {
|
|
6
5
|
date: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAWf,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,
|
|
1
|
+
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAWf,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAwB/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAc/C;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAiCD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,2CA8C5C;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,kDAiClD"}
|
package/dist/page.client.js
CHANGED
|
@@ -11,19 +11,10 @@ import { useSidebar } from './contexts/sidebar';
|
|
|
11
11
|
import { usePathname } from 'next/navigation';
|
|
12
12
|
import { useNav } from './components/layout/nav';
|
|
13
13
|
import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
|
|
14
|
-
export function PageContainer(props) {
|
|
15
|
-
const { collapsed } = useSidebar();
|
|
16
|
-
return (_jsx("div", { ...props, className: cn('flex w-full min-w-0 max-w-[var(--fd-page-width)] flex-col md:transition-[max-width]', props.className), style: {
|
|
17
|
-
...props.style,
|
|
18
|
-
'--fd-page-width': collapsed
|
|
19
|
-
? '100vw'
|
|
20
|
-
: 'calc(min(100vw, var(--fd-layout-width)) - var(--fd-sidebar-width) - var(--fd-toc-width))',
|
|
21
|
-
}, children: props.children }));
|
|
22
|
-
}
|
|
23
14
|
export function PageHeader(props) {
|
|
24
15
|
const { open } = useSidebar();
|
|
25
16
|
const { isTransparent } = useNav();
|
|
26
|
-
return (_jsx("header", { ...props, className: cn('sticky top-fd-layout-top z-10 flex flex-row items-center border-b border-fd-foreground/10 text-sm transition-colors', !isTransparent && 'bg-fd-background/80
|
|
17
|
+
return (_jsx("header", { ...props, className: cn('sticky top-fd-layout-top z-10 flex flex-row items-center border-b border-fd-foreground/10 text-sm backdrop-blur-md transition-colors', !isTransparent && 'bg-fd-background/80', open && 'opacity-0', props.className), style: {
|
|
27
18
|
...props.style,
|
|
28
19
|
'--fd-toc-top-with-offset': 'calc(4px + var(--fd-banner-height) + var(--fd-nav-height))',
|
|
29
20
|
}, children: props.children }));
|
package/dist/page.d.ts
CHANGED
|
@@ -62,9 +62,11 @@ export interface DocsPageProps {
|
|
|
62
62
|
footer?: Partial<FooterOptions>;
|
|
63
63
|
editOnGithub?: EditOnGitHubOptions;
|
|
64
64
|
lastUpdate?: Date | string | number;
|
|
65
|
+
container?: HTMLAttributes<HTMLDivElement>;
|
|
66
|
+
article?: HTMLAttributes<HTMLElement>;
|
|
65
67
|
children: ReactNode;
|
|
66
68
|
}
|
|
67
|
-
export declare function DocsPage({ toc,
|
|
69
|
+
export declare function DocsPage({ toc, full, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps): ReactNode;
|
|
68
70
|
/**
|
|
69
71
|
* Add typography styles
|
|
70
72
|
*/
|
package/dist/page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAEL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,KAAK,mBAAmB,EAAk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@@ import { AnchorProvider } from 'fumadocs-core/toc';
|
|
|
4
4
|
import { Card, Cards } from './components/card';
|
|
5
5
|
import { replaceOrDefault } from './layouts/shared';
|
|
6
6
|
import { cn } from './utils/cn';
|
|
7
|
-
import { Footer, LastUpdate,
|
|
8
|
-
import { Toc, TOCItems } from './components/layout/toc';
|
|
9
|
-
import { TocPopoverTrigger, TocPopover, TocPopoverContent, } from './components/layout/toc-popover';
|
|
7
|
+
import { Footer, LastUpdate, PageHeader, Breadcrumb, } from './page.client';
|
|
8
|
+
import { Toc, TOCItems, TocPopoverTrigger, TocPopover, TocPopoverContent, } from './components/layout/toc';
|
|
10
9
|
import { buttonVariants } from './components/ui/button';
|
|
11
10
|
import { Edit, Text } from 'lucide-react';
|
|
12
11
|
import { I18nLabel } from './contexts/i18n';
|
|
13
12
|
import ClerkTOCItems from './components/layout/toc-clerk';
|
|
14
|
-
export function DocsPage({ toc = [],
|
|
13
|
+
export function DocsPage({ toc = [], full = false, tableOfContentPopover: { enabled: tocPopoverEnabled = true, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: {
|
|
15
14
|
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
16
15
|
enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
|
|
17
16
|
tocEnabled ?? (tocEnabled = !full &&
|
|
@@ -19,12 +18,12 @@ enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
|
|
|
19
18
|
tocOptions.footer !== undefined ||
|
|
20
19
|
tocOptions.header !== undefined));
|
|
21
20
|
const fullWidth = full && !tocEnabled;
|
|
22
|
-
return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs(
|
|
21
|
+
return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs("div", { id: "nd-page", ...props.container, className: cn('flex w-full min-w-0 flex-col md:transition-[max-width]', props.container?.className), style: {
|
|
23
22
|
'--fd-toc-width': fullWidth ? '0px' : undefined,
|
|
24
23
|
}, children: [replaceOrDefault({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsx(PageHeader, { id: "nd-tocnav", children: _jsxs(TocPopover, { children: [_jsx(TocPopoverTrigger, { className: "size-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc, isMenu: true })) : (_jsx(TOCItems, { items: toc, isMenu: true })), tocPopoverOptions.footer] })] }) }), {
|
|
25
24
|
items: toc,
|
|
26
25
|
...tocPopoverOptions,
|
|
27
|
-
}), _jsxs("article", { className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-
|
|
26
|
+
}), _jsxs("article", { ...props.article, className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-8 md:pt-12 lg:px-8', fullWidth ? 'max-w-[1120px]' : 'max-w-[860px]', props.article?.className), children: [replaceOrDefault(props.breadcrumb, _jsx(Breadcrumb, { includePage: props.breadcrumb?.full, ...props.breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(props.footer, _jsx(Footer, { items: props.footer?.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { id: "nd-toc", children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
|
|
28
27
|
items: toc,
|
|
29
28
|
...tocOptions,
|
|
30
29
|
}, _jsx("div", { role: "none", className: "flex-1" }))] }));
|
|
@@ -33,7 +32,7 @@ function EditOnGitHub({ owner, repo, sha, path, ...props }) {
|
|
|
33
32
|
const href = `https://github.com/${owner}/${repo}/blob/${sha}/${path.startsWith('/') ? path.slice(1) : path}`;
|
|
34
33
|
return (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
|
|
35
34
|
color: 'secondary',
|
|
36
|
-
className: 'gap-1.5
|
|
35
|
+
className: 'gap-1.5 text-fd-muted-foreground',
|
|
37
36
|
}), props.className), children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] }));
|
|
38
37
|
}
|
|
39
38
|
/**
|
package/dist/style.css
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
--tw-contain-paint: ;
|
|
106
106
|
--tw-contain-style: ;
|
|
107
107
|
}/*
|
|
108
|
-
! tailwindcss v3.4.
|
|
108
|
+
! tailwindcss v3.4.16 | MIT License | https://tailwindcss.com
|
|
109
109
|
*//*
|
|
110
110
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
111
111
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
@@ -1302,9 +1302,6 @@ body {
|
|
|
1302
1302
|
.min-w-\[220px\] {
|
|
1303
1303
|
min-width: 220px;
|
|
1304
1304
|
}
|
|
1305
|
-
.min-w-\[var\(--fd-sidebar-width\)\] {
|
|
1306
|
-
min-width: var(--fd-sidebar-width);
|
|
1307
|
-
}
|
|
1308
1305
|
.max-w-\[1120px\] {
|
|
1309
1306
|
max-width: 1120px;
|
|
1310
1307
|
}
|
|
@@ -1320,12 +1317,6 @@ body {
|
|
|
1320
1317
|
.max-w-\[98vw\] {
|
|
1321
1318
|
max-width: 98vw;
|
|
1322
1319
|
}
|
|
1323
|
-
.max-w-\[var\(--fd-content-width\)\] {
|
|
1324
|
-
max-width: var(--fd-content-width);
|
|
1325
|
-
}
|
|
1326
|
-
.max-w-\[var\(--fd-page-width\)\] {
|
|
1327
|
-
max-width: var(--fd-page-width);
|
|
1328
|
-
}
|
|
1329
1320
|
.max-w-fd-container {
|
|
1330
1321
|
max-width: 1400px;
|
|
1331
1322
|
}
|
|
@@ -1521,6 +1512,9 @@ body {
|
|
|
1521
1512
|
.bg-\[var\(--shiki-light-bg\)\] {
|
|
1522
1513
|
background-color: var(--shiki-light-bg);
|
|
1523
1514
|
}
|
|
1515
|
+
.bg-black\/30 {
|
|
1516
|
+
background-color: rgb(0 0 0 / 0.3);
|
|
1517
|
+
}
|
|
1524
1518
|
.bg-fd-accent {
|
|
1525
1519
|
--tw-bg-opacity: 1;
|
|
1526
1520
|
background-color: hsl(var(--accent) / var(--tw-bg-opacity, 1));
|
|
@@ -1529,9 +1523,6 @@ body {
|
|
|
1529
1523
|
--tw-bg-opacity: 1;
|
|
1530
1524
|
background-color: hsl(var(--background) / var(--tw-bg-opacity, 1));
|
|
1531
1525
|
}
|
|
1532
|
-
.bg-fd-background\/50 {
|
|
1533
|
-
background-color: hsl(var(--background) / 0.5);
|
|
1534
|
-
}
|
|
1535
1526
|
.bg-fd-background\/80 {
|
|
1536
1527
|
background-color: hsl(var(--background) / 0.8);
|
|
1537
1528
|
}
|
|
@@ -1691,9 +1682,6 @@ body {
|
|
|
1691
1682
|
.pt-0 {
|
|
1692
1683
|
padding-top: 0px;
|
|
1693
1684
|
}
|
|
1694
|
-
.pt-10 {
|
|
1695
|
-
padding-top: 2.5rem;
|
|
1696
|
-
}
|
|
1697
1685
|
.pt-12 {
|
|
1698
1686
|
padding-top: 3rem;
|
|
1699
1687
|
}
|
|
@@ -1703,6 +1691,9 @@ body {
|
|
|
1703
1691
|
.pt-4 {
|
|
1704
1692
|
padding-top: 1rem;
|
|
1705
1693
|
}
|
|
1694
|
+
.pt-8 {
|
|
1695
|
+
padding-top: 2rem;
|
|
1696
|
+
}
|
|
1706
1697
|
.pt-\[var\(--fd-nav-height\)\] {
|
|
1707
1698
|
padding-top: var(--fd-nav-height);
|
|
1708
1699
|
}
|
|
@@ -1836,11 +1827,6 @@ body {
|
|
|
1836
1827
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
1837
1828
|
transition-duration: 150ms;
|
|
1838
1829
|
}
|
|
1839
|
-
.transition-\[flex\2c margin\2c opacity\2c transform\] {
|
|
1840
|
-
transition-property: flex,margin,opacity,transform;
|
|
1841
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
1842
|
-
transition-duration: 150ms;
|
|
1843
|
-
}
|
|
1844
1830
|
.transition-\[width\2c height\] {
|
|
1845
1831
|
transition-property: width,height;
|
|
1846
1832
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -2014,24 +2000,6 @@ body {
|
|
|
2014
2000
|
opacity: 1;
|
|
2015
2001
|
}
|
|
2016
2002
|
|
|
2017
|
-
.aria-disabled\:pointer-events-none[aria-disabled="true"] {
|
|
2018
|
-
pointer-events: none;
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
.aria-disabled\:opacity-50[aria-disabled="true"] {
|
|
2022
|
-
opacity: 0.5;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
.aria-selected\:bg-fd-accent[aria-selected="true"] {
|
|
2026
|
-
--tw-bg-opacity: 1;
|
|
2027
|
-
background-color: hsl(var(--accent) / var(--tw-bg-opacity, 1));
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
.aria-selected\:text-fd-accent-foreground[aria-selected="true"] {
|
|
2031
|
-
--tw-text-opacity: 1;
|
|
2032
|
-
color: hsl(var(--accent-foreground) / var(--tw-text-opacity, 1));
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
2003
|
.data-\[collapsed\=false\]\:pointer-events-none[data-collapsed="false"] {
|
|
2036
2004
|
pointer-events: none;
|
|
2037
2005
|
}
|
|
@@ -2336,7 +2304,7 @@ body {
|
|
|
2336
2304
|
opacity: 0;
|
|
2337
2305
|
}
|
|
2338
2306
|
|
|
2339
|
-
.group
|
|
2307
|
+
.group[data-state="closed"] .group-data-\[state\=closed\]\:-rotate-90 {
|
|
2340
2308
|
--tw-rotate: -90deg;
|
|
2341
2309
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2342
2310
|
}
|
|
@@ -2492,10 +2460,6 @@ body {
|
|
|
2492
2460
|
flex: 1 1 0%;
|
|
2493
2461
|
}
|
|
2494
2462
|
|
|
2495
|
-
.md\:flex-initial {
|
|
2496
|
-
flex: 0 1 auto;
|
|
2497
|
-
}
|
|
2498
|
-
|
|
2499
2463
|
.md\:translate-x-0 {
|
|
2500
2464
|
--tw-translate-x: 0px;
|
|
2501
2465
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -2528,11 +2492,6 @@ body {
|
|
|
2528
2492
|
padding-right: 0.75rem;
|
|
2529
2493
|
}
|
|
2530
2494
|
|
|
2531
|
-
.md\:px-7 {
|
|
2532
|
-
padding-left: 1.75rem;
|
|
2533
|
-
padding-right: 1.75rem;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
2495
|
.md\:py-1\.5 {
|
|
2537
2496
|
padding-top: 0.375rem;
|
|
2538
2497
|
padding-bottom: 0.375rem;
|
|
@@ -2546,6 +2505,10 @@ body {
|
|
|
2546
2505
|
padding-inline-start: 0.5rem;
|
|
2547
2506
|
}
|
|
2548
2507
|
|
|
2508
|
+
.md\:ps-\[var\(--fd-layout-offset\)\] {
|
|
2509
|
+
padding-inline-start: var(--fd-layout-offset);
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2549
2512
|
.md\:pt-12 {
|
|
2550
2513
|
padding-top: 3rem;
|
|
2551
2514
|
}
|
|
@@ -2564,6 +2527,12 @@ body {
|
|
|
2564
2527
|
transition-duration: 150ms;
|
|
2565
2528
|
}
|
|
2566
2529
|
|
|
2530
|
+
.md\:transition-all {
|
|
2531
|
+
transition-property: all;
|
|
2532
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
2533
|
+
transition-duration: 150ms;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2567
2536
|
.md\:\[--fd-nav-height\:0px\] {
|
|
2568
2537
|
--fd-nav-height: 0px;
|
|
2569
2538
|
}
|
|
@@ -2571,6 +2540,10 @@ body {
|
|
|
2571
2540
|
.md\:\[--fd-sidebar-width\:260px\] {
|
|
2572
2541
|
--fd-sidebar-width: 260px;
|
|
2573
2542
|
}
|
|
2543
|
+
|
|
2544
|
+
.md\:data-\[collapsed\=true\]\:flex-initial[data-collapsed="true"] {
|
|
2545
|
+
flex: 0 1 auto;
|
|
2546
|
+
}
|
|
2574
2547
|
}
|
|
2575
2548
|
|
|
2576
2549
|
@media (min-width: 1024px) {
|
|
@@ -2607,6 +2580,11 @@ body {
|
|
|
2607
2580
|
border-width: 1px;
|
|
2608
2581
|
}
|
|
2609
2582
|
|
|
2583
|
+
.lg\:px-8 {
|
|
2584
|
+
padding-left: 2rem;
|
|
2585
|
+
padding-right: 2rem;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2610
2588
|
.lg\:\[--fd-toc-width\:260px\] {
|
|
2611
2589
|
--fd-toc-width: 260px;
|
|
2612
2590
|
}
|
|
@@ -2654,6 +2632,14 @@ body {
|
|
|
2654
2632
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2655
2633
|
}
|
|
2656
2634
|
|
|
2635
|
+
.\[\&_\#nd-page\]\:mt-\[var\(--fd-nav-height\)\] #nd-page {
|
|
2636
|
+
margin-top: var(--fd-nav-height);
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
.\[\&_\#nd-page\]\:max-w-\[calc\(min\(100vw\2c var\(--fd-layout-width\)\)-var\(--fd-sidebar-width\)-var\(--fd-toc-width\)\)\] #nd-page {
|
|
2640
|
+
max-width: calc(min(100vw,var(--fd-layout-width)) - var(--fd-sidebar-width) - var(--fd-toc-width));
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2657
2643
|
@media not all and (min-width: 1280px) {
|
|
2658
2644
|
|
|
2659
2645
|
.\[\&_\#nd-toc\]\:max-xl\:hidden #nd-toc {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtE;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,EACvB,EAAE,SAAS,EAAE,GAAE,UAAe,GAC7B,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtE;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,EACvB,EAAE,SAAS,EAAE,GAAE,UAAe,GAC7B,MAAM,EAAE,CA8BV"}
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
export function getSidebarTabs(pageTree, { transform } = {}) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (node.
|
|
2
|
+
function findOptions(node) {
|
|
3
|
+
const results = [];
|
|
4
|
+
if (node.root) {
|
|
5
5
|
const index = node.index ?? node.children.at(0);
|
|
6
6
|
if (index?.type === 'page') {
|
|
7
7
|
const option = {
|
|
8
8
|
url: index.url,
|
|
9
9
|
title: node.name,
|
|
10
10
|
icon: node.icon,
|
|
11
|
-
folder: node,
|
|
12
11
|
description: node.description,
|
|
12
|
+
urls: getFolderUrls(node),
|
|
13
13
|
};
|
|
14
14
|
const mapped = transform ? transform(option, node) : option;
|
|
15
15
|
if (mapped)
|
|
16
|
-
|
|
16
|
+
results.push(mapped);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
for (const child of node.children) {
|
|
20
|
+
if (child.type === 'folder')
|
|
21
|
+
results.push(...findOptions(child));
|
|
22
|
+
}
|
|
23
|
+
return results;
|
|
24
|
+
}
|
|
25
|
+
return findOptions(pageTree);
|
|
26
|
+
}
|
|
27
|
+
function getFolderUrls(folder) {
|
|
28
|
+
const results = [];
|
|
29
|
+
if (folder.index)
|
|
30
|
+
results.push(folder.index.url);
|
|
31
|
+
for (const child of folder.children) {
|
|
32
|
+
if (child.type === 'page')
|
|
33
|
+
results.push(child.url);
|
|
34
|
+
if (child.type === 'folder')
|
|
35
|
+
results.push(...getFolderUrls(child));
|
|
21
36
|
}
|
|
22
|
-
|
|
23
|
-
return options;
|
|
37
|
+
return results;
|
|
24
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "14.5.
|
|
3
|
+
"version": "14.5.6",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"@radix-ui/react-scroll-area": "^1.2.1",
|
|
62
62
|
"@radix-ui/react-slot": "^1.1.0",
|
|
63
63
|
"@radix-ui/react-tabs": "^1.1.1",
|
|
64
|
-
"class-variance-authority": "^0.7.
|
|
64
|
+
"class-variance-authority": "^0.7.1",
|
|
65
65
|
"lodash.merge": "^4.6.2",
|
|
66
|
-
"lucide-react": "^0.
|
|
66
|
+
"lucide-react": "^0.465.0",
|
|
67
67
|
"next-themes": "^0.4.3",
|
|
68
68
|
"postcss-selector-parser": "^7.0.0",
|
|
69
69
|
"react-medium-image-zoom": "^5.2.11",
|
|
70
|
-
"tailwind-merge": "^2.5.
|
|
71
|
-
"fumadocs-core": "14.5.
|
|
70
|
+
"tailwind-merge": "^2.5.5",
|
|
71
|
+
"fumadocs-core": "14.5.6"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@next/eslint-plugin-next": "^15.0.3",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"next": "15.0.3",
|
|
80
80
|
"postcss": "^8.4.49",
|
|
81
81
|
"postcss-cli": "^11.0.0",
|
|
82
|
-
"tailwindcss": "^3.4.
|
|
82
|
+
"tailwindcss": "^3.4.16",
|
|
83
83
|
"tsc-alias": "^1.8.10",
|
|
84
84
|
"@fumadocs/cli": "0.0.4",
|
|
85
85
|
"eslint-config-custom": "0.0.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TOCItemType } from 'fumadocs-core/server';
|
|
2
|
-
import type { PopoverContentProps, PopoverTriggerProps } from '@radix-ui/react-popover';
|
|
3
|
-
export declare const TocPopover: import("react").FC<import("@radix-ui/react-popover").PopoverProps>;
|
|
4
|
-
export declare function TocPopoverTrigger({ items, ...props }: PopoverTriggerProps & {
|
|
5
|
-
items: TOCItemType[];
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare function TocPopoverContent(props: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
//# sourceMappingURL=toc-popover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toc-popover.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc-popover.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASxD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,UAAU,oEAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,2CAyBhD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,2CAiB3D"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { cn } from '../../utils/cn';
|
|
5
|
-
import { useI18n } from '../../contexts/i18n';
|
|
6
|
-
import * as Primitive from 'fumadocs-core/toc';
|
|
7
|
-
import { ChevronRight, Text } from 'lucide-react';
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover';
|
|
9
|
-
export const TocPopover = Popover;
|
|
10
|
-
export function TocPopoverTrigger({ items, ...props }) {
|
|
11
|
-
const { text } = useI18n();
|
|
12
|
-
const active = Primitive.useActiveAnchor();
|
|
13
|
-
const current = useMemo(() => {
|
|
14
|
-
return items.find((item) => active === item.url.slice(1))?.title;
|
|
15
|
-
}, [items, active]);
|
|
16
|
-
return (_jsxs(PopoverTrigger, { ...props, className: cn('inline-flex items-center gap-2 text-nowrap px-4 py-2 text-start', props.className), children: [_jsx(Text, { className: "size-4 shrink-0" }), text.toc, current ? (_jsxs(_Fragment, { children: [_jsx(ChevronRight, { className: "-mx-1.5 size-4 shrink-0 text-fd-muted-foreground" }), _jsx("span", { className: "truncate text-fd-muted-foreground", children: current })] })) : null] }));
|
|
17
|
-
}
|
|
18
|
-
export function TocPopoverContent(props) {
|
|
19
|
-
return (_jsx(PopoverContent, { hideWhenDetached: true, alignOffset: 16, align: "start", side: "bottom", "data-toc-popover": "", ...props, className: cn('flex max-h-[var(--radix-popover-content-available-height)] w-[260px] flex-col gap-4 p-3', props.className), children: props.children }));
|
|
20
|
-
}
|