fumadocs-ui 15.6.6 → 15.6.8
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/neutral.css +1 -1
- package/css/shiki.css +13 -7
- package/dist/components/dialog/search.js +1 -1
- package/dist/components/layout/sidebar.d.ts +10 -6
- package/dist/components/layout/sidebar.d.ts.map +1 -1
- package/dist/components/layout/sidebar.js +18 -21
- package/dist/layouts/docs/shared.d.ts +7 -1
- package/dist/layouts/docs/shared.d.ts.map +1 -1
- package/dist/layouts/docs-client.d.ts +1 -1
- package/dist/layouts/docs-client.d.ts.map +1 -1
- package/dist/layouts/docs-client.js +3 -7
- package/dist/layouts/docs.d.ts +5 -5
- package/dist/layouts/docs.d.ts.map +1 -1
- package/dist/layouts/docs.js +39 -19
- package/dist/layouts/notebook.d.ts +2 -2
- package/dist/layouts/notebook.d.ts.map +1 -1
- package/dist/layouts/notebook.js +31 -21
- package/dist/style.css +35 -48
- package/package.json +8 -8
package/css/neutral.css
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
--color-fd-foreground: hsl(0, 0%, 92%);
|
|
23
23
|
--color-fd-muted: hsl(0, 0%, 12.9%);
|
|
24
24
|
--color-fd-muted-foreground: hsla(0, 0%, 70%, 0.8);
|
|
25
|
-
--color-fd-popover: hsl(0, 0%,
|
|
25
|
+
--color-fd-popover: hsl(0, 0%, 11.6%);
|
|
26
26
|
--color-fd-popover-foreground: hsl(0, 0%, 86.9%);
|
|
27
27
|
--color-fd-card: hsl(0, 0%, 9.8%);
|
|
28
28
|
--color-fd-card-foreground: hsl(0, 0%, 98%);
|
package/css/shiki.css
CHANGED
|
@@ -23,19 +23,22 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&[data-line-numbers] code .twoslash-meta-line {
|
|
26
|
-
|
|
26
|
+
padding-left: calc(var(--padding-left) + 7 * var(--spacing));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&[data-line-numbers] code .line {
|
|
30
|
-
width: calc(100% - 7 * var(--spacing));
|
|
31
30
|
counter-increment: line;
|
|
32
|
-
padding-left: calc(var(--padding-left)
|
|
33
|
-
@apply ml-7;
|
|
31
|
+
padding-left: calc(var(--padding-left) + 7 * var(--spacing));
|
|
34
32
|
|
|
35
33
|
&::after {
|
|
36
34
|
position: absolute;
|
|
37
35
|
content: counter(line);
|
|
38
|
-
|
|
36
|
+
color: color-mix(
|
|
37
|
+
in oklab,
|
|
38
|
+
var(--fd-counter-color, var(--color-fd-muted-foreground)) 60%,
|
|
39
|
+
transparent
|
|
40
|
+
);
|
|
41
|
+
@apply top-0 left-4;
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -46,6 +49,7 @@
|
|
|
46
49
|
|
|
47
50
|
code .diff.remove {
|
|
48
51
|
opacity: 0.7;
|
|
52
|
+
--fd-counter-color: var(--color-fd-diff-remove-symbol);
|
|
49
53
|
@apply bg-fd-diff-remove;
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -55,6 +59,7 @@
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
code .diff.add {
|
|
62
|
+
--fd-counter-color: var(--color-fd-diff-add-symbol);
|
|
58
63
|
@apply bg-fd-diff-add;
|
|
59
64
|
}
|
|
60
65
|
|
|
@@ -63,11 +68,12 @@
|
|
|
63
68
|
@apply text-fd-diff-add-symbol;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
.highlighted {
|
|
71
|
+
code .highlighted {
|
|
72
|
+
--fd-counter-color: var(--color-fd-primary);
|
|
67
73
|
@apply bg-fd-primary/10;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
|
-
.highlighted-word {
|
|
76
|
+
code .highlighted-word {
|
|
71
77
|
padding: 1px;
|
|
72
78
|
@apply border -my-px border-fd-primary/30 bg-fd-primary/10 rounded-md font-medium;
|
|
73
79
|
}
|
|
@@ -50,7 +50,7 @@ export function SearchDialogOverlay(props) {
|
|
|
50
50
|
}
|
|
51
51
|
export function SearchDialogContent({ children, ...props }) {
|
|
52
52
|
const { text } = useI18n();
|
|
53
|
-
return (_jsxs(DialogContent, { "aria-describedby": undefined, ...props, className: cn('fixed left-1/2 top-4 md:top-[calc(50%-250px)] z-50 w-[calc(100%-
|
|
53
|
+
return (_jsxs(DialogContent, { "aria-describedby": undefined, ...props, className: cn('fixed left-1/2 top-4 md:top-[calc(50%-250px)] z-50 w-[calc(100%-1rem)] max-w-screen-sm -translate-x-1/2 rounded-2xl border bg-fd-popover/80 backdrop-blur-xl text-fd-popover-foreground shadow-2xl shadow-black/50 overflow-hidden data-[state=closed]:animate-fd-dialog-out data-[state=open]:animate-fd-dialog-in', '*:border-b *:has-[+:last-child[data-empty=true]]:border-b-0 *:data-[empty=true]:border-b-0 *:last:border-b-0', props.className), children: [_jsx(DialogTitle, { className: "hidden", children: text.search }), children] }));
|
|
54
54
|
}
|
|
55
55
|
export function SearchDialogList({ items = null, Empty = () => (_jsx("div", { className: "py-12 text-center text-sm text-fd-muted-foreground", children: _jsx(I18nLabel, { label: "searchNoResult" }) })), Item = (props) => _jsx(SearchDialogListItem, { ...props }), ...props }) {
|
|
56
56
|
const ref = useRef(null);
|
|
@@ -3,7 +3,7 @@ import { type LinkProps } from 'fumadocs-core/link';
|
|
|
3
3
|
import { type ScrollAreaProps } from '@radix-ui/react-scroll-area';
|
|
4
4
|
import type { CollapsibleContentProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
|
|
5
5
|
import type { PageTree } from 'fumadocs-core/server';
|
|
6
|
-
export interface SidebarProps
|
|
6
|
+
export interface SidebarProps {
|
|
7
7
|
/**
|
|
8
8
|
* Open folders by default if their level is lower or equal to a specific level
|
|
9
9
|
* (Starting from 1)
|
|
@@ -18,13 +18,17 @@ export interface SidebarProps extends ComponentProps<'aside'> {
|
|
|
18
18
|
*/
|
|
19
19
|
prefetch?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
* Children to render
|
|
22
|
+
*/
|
|
23
|
+
Content: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Alternative children for mobile
|
|
24
26
|
*/
|
|
25
|
-
|
|
27
|
+
Mobile?: ReactNode;
|
|
26
28
|
}
|
|
27
|
-
export declare function Sidebar({ defaultOpenLevel, prefetch,
|
|
29
|
+
export declare function Sidebar({ defaultOpenLevel, prefetch, Mobile, Content, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function SidebarContent(props: ComponentProps<'aside'>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function SidebarContentMobile({ className, children, ...props }: ComponentProps<'aside'>): import("react/jsx-runtime").JSX.Element;
|
|
28
32
|
export declare function SidebarHeader(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
29
33
|
export declare function SidebarFooter(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
30
34
|
export declare function SidebarViewport(props: ScrollAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,EAAE,EAEP,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,EAAE,EAEP,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKrD,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AA2BD,wBAAgB,OAAO,CAAC,EACtB,gBAAoB,EACpB,QAAe,EACf,MAAM,EACN,OAAO,GACR,EAAE,YAAY,2CAed;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,2CAoE5D;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,CAAC,2CA+BzB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CASzD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CASzD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,2CAiBrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAY1D;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,SAAS,GAAG;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,2CAiBA;AAED,wBAAgB,aAAa,CAAC,EAC5B,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CAgBA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAezB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,2CAiCjD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAoClE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrE;AAgBD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,CAAC,CAAC;IAClC,MAAM,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAC1E,SAAS,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzC,2CAuDA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronDown, ExternalLink
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronDown, ExternalLink } from '../../icons.js';
|
|
4
4
|
import { usePathname } from 'fumadocs-core/framework';
|
|
5
5
|
import { createContext, Fragment, useContext, useMemo, useRef, useState, } from 'react';
|
|
6
6
|
import Link from 'fumadocs-core/link';
|
|
@@ -14,7 +14,6 @@ import { cva } from 'class-variance-authority';
|
|
|
14
14
|
import { useTreeContext, useTreePath } from '../../contexts/tree.js';
|
|
15
15
|
import { useMediaQuery } from 'fumadocs-core/utils/use-media-query';
|
|
16
16
|
import { Presence } from '@radix-ui/react-presence';
|
|
17
|
-
import { buttonVariants } from '../../components/ui/button.js';
|
|
18
17
|
const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-xl p-2 ps-(--sidebar-item-offset) text-start text-fd-muted-foreground [overflow-wrap:anywhere] [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
19
18
|
variants: {
|
|
20
19
|
active: {
|
|
@@ -25,8 +24,8 @@ const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-xl p
|
|
|
25
24
|
});
|
|
26
25
|
const Context = createContext(null);
|
|
27
26
|
const FolderContext = createContext(null);
|
|
28
|
-
export function Sidebar({ defaultOpenLevel = 0, prefetch = true,
|
|
29
|
-
const
|
|
27
|
+
export function Sidebar({ defaultOpenLevel = 0, prefetch = true, Mobile, Content, }) {
|
|
28
|
+
const isMobile = useMediaQuery('(width < 768px)') ?? false;
|
|
30
29
|
const context = useMemo(() => {
|
|
31
30
|
return {
|
|
32
31
|
defaultOpenLevel,
|
|
@@ -34,26 +33,20 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
|
|
|
34
33
|
level: 1,
|
|
35
34
|
};
|
|
36
35
|
}, [defaultOpenLevel, prefetch]);
|
|
36
|
+
return (_jsx(Context.Provider, { value: context, children: isMobile && Mobile != null ? Mobile : Content }));
|
|
37
|
+
}
|
|
38
|
+
export function SidebarContent(props) {
|
|
39
|
+
const { collapsed } = useSidebar();
|
|
37
40
|
const [hover, setHover] = useState(false);
|
|
38
41
|
const timerRef = useRef(0);
|
|
39
42
|
const closeTimeRef = useRef(0);
|
|
40
|
-
// md
|
|
41
|
-
const isMobile = useMediaQuery('(width < 768px)') ?? false;
|
|
42
43
|
useOnChange(collapsed, () => {
|
|
43
44
|
setHover(false);
|
|
44
45
|
closeTimeRef.current = Date.now() + 150;
|
|
45
46
|
});
|
|
46
|
-
if (isMobile) {
|
|
47
|
-
const state = open ? 'open' : 'closed';
|
|
48
|
-
return (_jsxs(Context.Provider, { value: context, children: [_jsx(Presence, { present: open, children: _jsx("div", { "data-state": state, className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", onClick: () => setOpen(false) }) }), _jsx(Presence, { present: open, children: ({ present }) => (_jsxs("aside", { id: "nd-sidebar-mobile", ...props, "data-state": state, className: cn('fixed text-[15px] 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', !present && 'invisible', props.className), children: [_jsx("button", { onClick: () => setOpen(false), className: cn(buttonVariants({
|
|
49
|
-
color: 'ghost',
|
|
50
|
-
size: 'icon-sm',
|
|
51
|
-
className: 'mt-3 mb-1 ms-auto me-4 text-fd-muted-foreground',
|
|
52
|
-
})), children: _jsx(X, {}) }), props.children] })) })] }));
|
|
53
|
-
}
|
|
54
47
|
return (_jsx("aside", { id: "nd-sidebar", ...props, "data-collapsed": collapsed, className: cn('fixed start-0 flex flex-col items-end top-(--fd-sidebar-top) bottom-(--fd-sidebar-margin) z-20 bg-fd-card text-sm border-e max-md:hidden *:w-(--fd-sidebar-width)', collapsed && [
|
|
55
48
|
'rounded-xl border translate-x-(--fd-sidebar-offset) rtl:-translate-x-(--fd-sidebar-offset)',
|
|
56
|
-
hover ? 'z-50 shadow-lg' : 'opacity-0
|
|
49
|
+
hover ? 'z-50 shadow-lg' : 'opacity-0',
|
|
57
50
|
], props.className), style: {
|
|
58
51
|
transition: ['top', 'opacity', 'translate', 'width']
|
|
59
52
|
.map((v) => `${v} ease 250ms`)
|
|
@@ -68,15 +61,14 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
|
|
|
68
61
|
? 'var(--fd-sidebar-width)'
|
|
69
62
|
: 'calc(var(--fd-sidebar-width) + var(--fd-layout-offset))',
|
|
70
63
|
}, onPointerEnter: (e) => {
|
|
71
|
-
if (!
|
|
72
|
-
!collapsed ||
|
|
64
|
+
if (!collapsed ||
|
|
73
65
|
e.pointerType === 'touch' ||
|
|
74
66
|
closeTimeRef.current > Date.now())
|
|
75
67
|
return;
|
|
76
68
|
window.clearTimeout(timerRef.current);
|
|
77
69
|
setHover(true);
|
|
78
70
|
}, onPointerLeave: (e) => {
|
|
79
|
-
if (!
|
|
71
|
+
if (!collapsed || e.pointerType === 'touch')
|
|
80
72
|
return;
|
|
81
73
|
window.clearTimeout(timerRef.current);
|
|
82
74
|
timerRef.current = window.setTimeout(() => {
|
|
@@ -85,10 +77,15 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
|
|
|
85
77
|
}, Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100
|
|
86
78
|
? 0
|
|
87
79
|
: 500);
|
|
88
|
-
}, children:
|
|
80
|
+
}, children: props.children }));
|
|
81
|
+
}
|
|
82
|
+
export function SidebarContentMobile({ className, children, ...props }) {
|
|
83
|
+
const { open, setOpen } = useSidebar();
|
|
84
|
+
const state = open ? 'open' : 'closed';
|
|
85
|
+
return (_jsxs(_Fragment, { children: [_jsx(Presence, { present: open, children: _jsx("div", { "data-state": state, className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", onClick: () => setOpen(false) }) }), _jsx(Presence, { present: open, children: ({ present }) => (_jsx("aside", { id: "nd-sidebar-mobile", ...props, "data-state": state, className: cn('fixed text-[15px] 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', !present && 'invisible', className), children: children })) })] }));
|
|
89
86
|
}
|
|
90
87
|
export function SidebarHeader(props) {
|
|
91
|
-
return (_jsx("div", { ...props, className: cn('flex flex-col gap-3
|
|
88
|
+
return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 p-4 pb-2', props.className), children: props.children }));
|
|
92
89
|
}
|
|
93
90
|
export function SidebarFooter(props) {
|
|
94
91
|
return (_jsx("div", { ...props, className: cn('flex flex-col border-t px-4 py-3', props.className), children: props.children }));
|
|
@@ -4,7 +4,7 @@ import type { PageTree } from 'fumadocs-core/server';
|
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
import type { Option } from '../../components/layout/root-toggle.js';
|
|
6
6
|
import { type GetSidebarTabsOptions } from '../../utils/get-sidebar-tabs.js';
|
|
7
|
-
export interface SidebarOptions extends SidebarProps {
|
|
7
|
+
export interface SidebarOptions extends Pick<SidebarProps, 'defaultOpenLevel' | 'prefetch'> {
|
|
8
8
|
components?: Partial<SidebarComponents>;
|
|
9
9
|
/**
|
|
10
10
|
* Root Toggle options
|
|
@@ -12,6 +12,12 @@ export interface SidebarOptions extends SidebarProps {
|
|
|
12
12
|
tabs?: Option[] | GetSidebarTabsOptions | false;
|
|
13
13
|
banner?: ReactNode;
|
|
14
14
|
footer?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Support collapsing the sidebar on desktop mode
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue true
|
|
19
|
+
*/
|
|
20
|
+
collapsible?: boolean;
|
|
15
21
|
}
|
|
16
22
|
export declare function SidebarLinkItem({ item, ...props }: {
|
|
17
23
|
item: LinkItemType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,KAAK,iBAAiB,EAMtB,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,KAAK,iBAAiB,EAMtB,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,UAAU,CAAC;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,qBAAqB,GAAG,KAAK,CAAC;IAEhD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAmCA;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,wBASpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps } from 'react';
|
|
2
2
|
export declare function Navbar(props: ComponentProps<'header'>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare function LayoutBody(props: ComponentProps<'main'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function SidebarTrigger({ children, ...props }: ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function CollapsibleControl(): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=docs-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ5C,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAqBvD;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"docs-client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ5C,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAqBvD;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAY1B;AAED,wBAAgB,kBAAkB,4CA2BjC"}
|
|
@@ -9,7 +9,7 @@ import { SidebarCollapseTrigger } from '../components/layout/sidebar.js';
|
|
|
9
9
|
import { SearchToggle } from '../components/layout/search-toggle.js';
|
|
10
10
|
export function Navbar(props) {
|
|
11
11
|
const { isTransparent } = useNav();
|
|
12
|
-
return (_jsx("header", { id: "nd-subnav", ...props, className: cn('fixed top-(--fd-banner-height) inset-x-0 z-30 flex items-center
|
|
12
|
+
return (_jsx("header", { id: "nd-subnav", ...props, className: cn('fixed top-(--fd-banner-height) inset-x-0 z-30 flex items-center ps-4 pe-2.5 border-b transition-colors backdrop-blur-sm', !isTransparent && 'bg-fd-background/80', props.className), children: props.children }));
|
|
13
13
|
}
|
|
14
14
|
export function LayoutBody(props) {
|
|
15
15
|
const { collapsed } = useSidebar();
|
|
@@ -20,13 +20,9 @@ export function LayoutBody(props) {
|
|
|
20
20
|
: 'var(--fd-sidebar-width)',
|
|
21
21
|
}, children: props.children }));
|
|
22
22
|
}
|
|
23
|
-
export function
|
|
23
|
+
export function SidebarTrigger({ children, ...props }) {
|
|
24
24
|
const { setOpen } = useSidebar();
|
|
25
|
-
return (_jsx("button", { ...props, "aria-label": "Open Sidebar",
|
|
26
|
-
color: 'ghost',
|
|
27
|
-
size: 'icon-sm',
|
|
28
|
-
className,
|
|
29
|
-
})), onClick: () => setOpen((prev) => !prev), children: _jsx(SidebarIcon, {}) }));
|
|
25
|
+
return (_jsx("button", { ...props, "aria-label": "Open Sidebar", onClick: () => setOpen((prev) => !prev), children: children }));
|
|
30
26
|
}
|
|
31
27
|
export function CollapsibleControl() {
|
|
32
28
|
const { collapsed } = useSidebar();
|
package/dist/layouts/docs.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { PageTree } from 'fumadocs-core/server';
|
|
2
|
-
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
|
|
3
3
|
import { type LinkItemType } from '../layouts/links.js';
|
|
4
4
|
import { type BaseLayoutProps } from './shared.js';
|
|
5
|
-
import { CollapsibleControl, Navbar,
|
|
5
|
+
import { CollapsibleControl, Navbar, SidebarTrigger } from '../layouts/docs-client.js';
|
|
6
6
|
import { type SidebarOptions } from '../layouts/docs/shared.js';
|
|
7
7
|
export interface DocsLayoutProps extends BaseLayoutProps {
|
|
8
8
|
tree: PageTree.Root;
|
|
9
|
-
sidebar?:
|
|
9
|
+
sidebar?: SidebarOptions & ComponentProps<'aside'> & {
|
|
10
10
|
enabled?: boolean;
|
|
11
11
|
component?: ReactNode;
|
|
12
12
|
};
|
|
@@ -15,6 +15,6 @@ export interface DocsLayoutProps extends BaseLayoutProps {
|
|
|
15
15
|
*/
|
|
16
16
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
17
17
|
}
|
|
18
|
-
export declare function DocsLayout({ nav: { transparentMode, ...nav }, sidebar: { tabs: sidebarTabs,
|
|
19
|
-
export { CollapsibleControl, Navbar,
|
|
18
|
+
export declare function DocsLayout({ nav: { transparentMode, ...nav }, sidebar: { tabs: sidebarTabs, enabled: sidebarEnabled, ...sidebarProps }, searchToggle, disableThemeSwitch, themeSwitch, i18n, children, ...props }: DocsLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export { CollapsibleControl, Navbar, SidebarTrigger, type LinkItemType };
|
|
20
20
|
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -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,
|
|
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,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAcf,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AAK1D,OAAO,EACL,kBAAkB,EAElB,MAAM,EACN,cAAc,EACf,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAS/B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,cAAc,GACtB,cAAc,CAAC,OAAO,CAAC,GAAG;QACxB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,CAAC;IAEJ;;OAEG;IACH,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,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,cAAqB,EAC9B,GAAG,YAAY,EACX,EACN,YAAiB,EACjB,kBAA0B,EAC1B,WAA8C,EAC9C,IAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CA4NjB;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
package/dist/layouts/docs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
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, SidebarFooter, SidebarHeader, SidebarPageTree, SidebarViewport, } from '../components/layout/sidebar.js';
|
|
7
|
-
import { BaseLinkItem } from '../layouts/links.js';
|
|
6
|
+
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFooter, SidebarHeader, SidebarPageTree, SidebarViewport, } from '../components/layout/sidebar.js';
|
|
7
|
+
import { BaseLinkItem, } from '../layouts/links.js';
|
|
8
8
|
import { RootToggle } from '../components/layout/root-toggle.js';
|
|
9
9
|
import { getLinks } from './shared.js';
|
|
10
10
|
import { LanguageToggle, LanguageToggleText, } from '../components/layout/language-toggle.js';
|
|
11
|
-
import { CollapsibleControl, LayoutBody, Navbar,
|
|
11
|
+
import { CollapsibleControl, LayoutBody, Navbar, SidebarTrigger, } from '../layouts/docs-client.js';
|
|
12
12
|
import { TreeContextProvider } from '../contexts/tree.js';
|
|
13
13
|
import { ThemeToggle } from '../components/layout/theme-toggle.js';
|
|
14
14
|
import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../layouts/docs/shared.js';
|
|
@@ -16,26 +16,46 @@ import { NavProvider } from '../contexts/layout.js';
|
|
|
16
16
|
import Link from 'fumadocs-core/link';
|
|
17
17
|
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle.js';
|
|
18
18
|
import { HideIfEmpty } from 'fumadocs-core/hide-if-empty';
|
|
19
|
-
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { tabs: sidebarTabs,
|
|
19
|
+
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { tabs: sidebarTabs, enabled: sidebarEnabled = true, ...sidebarProps } = {}, searchToggle = {}, disableThemeSwitch = false, themeSwitch = { enabled: !disableThemeSwitch }, i18n = false, children, ...props }) {
|
|
20
20
|
const tabs = useMemo(() => getSidebarTabsFromOptions(sidebarTabs, props.tree) ?? [], [sidebarTabs, props.tree]);
|
|
21
21
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
22
22
|
const variables = cn(sidebarEnabled &&
|
|
23
23
|
'md:[--fd-sidebar-width:268px] lg:[--fd-sidebar-width:286px]', 'xl:[--fd-toc-width:286px]', !nav.component && nav.enabled !== false
|
|
24
24
|
? '[--fd-nav-height:56px] md:[--fd-nav-height:0px]'
|
|
25
25
|
: undefined);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
function sidebar() {
|
|
27
|
+
const { footer, banner, collapsible = true, component, components, defaultOpenLevel, prefetch, ...rest } = sidebarProps;
|
|
28
|
+
if (component)
|
|
29
|
+
return component;
|
|
30
|
+
const iconLinks = links.filter((item) => item.type === 'icon');
|
|
31
|
+
const viewport = (_jsxs(SidebarViewport, { children: [links
|
|
32
|
+
.filter((v) => v.type !== 'icon')
|
|
33
|
+
.map((item, i, list) => (_jsx(SidebarLinkItem, { item: item, className: cn(i === list.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components: components })] }));
|
|
34
|
+
const mobile = (_jsxs(SidebarContentMobile, { ...rest, children: [_jsxs(HideIfEmpty, { as: SidebarHeader, children: [_jsxs("div", { className: "flex text-fd-muted-foreground items-center justify-end empty:hidden", children: [iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({
|
|
35
|
+
size: 'icon-sm',
|
|
36
|
+
color: 'ghost',
|
|
37
|
+
className: 'p-2',
|
|
38
|
+
}), i === iconLinks.length - 1 && 'me-auto'), "aria-label": item.label, children: item.icon }, i))), i18n ? (_jsxs(LanguageToggle, { children: [_jsx(Languages, { className: "size-4.5" }), _jsx(LanguageToggleText, {})] })) : null, themeSwitch.enabled !== false &&
|
|
39
|
+
(themeSwitch.component ?? (_jsx(ThemeToggle, { className: "p-0 ms-1.5", mode: themeSwitch.mode }))), _jsx(SidebarTrigger, { className: cn(buttonVariants({
|
|
40
|
+
color: 'ghost',
|
|
41
|
+
size: 'icon-sm',
|
|
42
|
+
className: 'p-2 ms-1.5',
|
|
43
|
+
})), children: _jsx(SidebarIcon, {}) })] }), tabs.length > 0 && _jsx(RootToggle, { options: tabs }), banner] }), viewport, _jsx(SidebarFooter, { className: "empty:hidden", children: footer })] }));
|
|
44
|
+
const content = (_jsxs(SidebarContent, { ...rest, children: [_jsxs(SidebarHeader, { children: [_jsxs("div", { className: "flex", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex text-[15px] items-center gap-2.5 font-medium me-auto", children: nav.title }), nav.children, collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
|
|
45
|
+
color: 'ghost',
|
|
46
|
+
size: 'icon-sm',
|
|
47
|
+
className: 'mb-auto text-fd-muted-foreground',
|
|
48
|
+
})), children: _jsx(SidebarIcon, {}) }))] }), searchToggle.enabled !== false &&
|
|
49
|
+
(searchToggle.components?.lg ?? (_jsx(LargeSearchToggle, { hideIfDisabled: true }))), tabs.length > 0 && _jsx(RootToggle, { options: tabs }), banner] }), viewport, _jsxs(HideIfEmpty, { as: SidebarFooter, children: [_jsxs("div", { className: "flex text-fd-muted-foreground items-center justify-end empty:hidden", children: [iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon-sm', color: 'ghost' }), i === iconLinks.length - 1 && 'me-auto'), "aria-label": item.label, children: item.icon }, i))), i18n ? (_jsx(LanguageToggle, { children: _jsx(Languages, { className: "size-4.5" }) })) : null, themeSwitch.enabled !== false &&
|
|
50
|
+
(themeSwitch.component ?? (_jsx(ThemeToggle, { className: "p-0 ms-1.5", mode: themeSwitch.mode })))] }), footer] })] }));
|
|
51
|
+
return (_jsx(Sidebar, { defaultOpenLevel: defaultOpenLevel, prefetch: prefetch, Mobile: mobile, Content: _jsxs(_Fragment, { children: [collapsible && _jsx(CollapsibleControl, {}), content] }) }));
|
|
52
|
+
}
|
|
37
53
|
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [nav.enabled !== false &&
|
|
38
|
-
(nav.component ?? (_jsxs(Navbar, { className: "h-14 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
|
|
39
|
-
(searchToggle.components?.sm ?? (_jsx(SearchToggle, { className: "p-2", hideIfDisabled: true }))), sidebarEnabled && (_jsx(
|
|
54
|
+
(nav.component ?? (_jsxs(Navbar, { className: "h-14 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 &&
|
|
55
|
+
(searchToggle.components?.sm ?? (_jsx(SearchToggle, { className: "p-2", hideIfDisabled: true }))), sidebarEnabled && (_jsx(SidebarTrigger, { className: cn(buttonVariants({
|
|
56
|
+
color: 'ghost',
|
|
57
|
+
size: 'icon-sm',
|
|
58
|
+
className: 'p-2',
|
|
59
|
+
})), children: _jsx(SidebarIcon, {}) }))] }))), _jsxs(LayoutBody, { ...props.containerProps, className: cn(variables, props.containerProps?.className), children: [sidebarEnabled && sidebar(), children] })] }) }));
|
|
40
60
|
}
|
|
41
|
-
export { CollapsibleControl, Navbar,
|
|
61
|
+
export { CollapsibleControl, Navbar, SidebarTrigger };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HTMLAttributes } from 'react';
|
|
1
|
+
import { type ComponentProps, type HTMLAttributes } from 'react';
|
|
2
2
|
import { type BaseLayoutProps } from '../layouts/shared.js';
|
|
3
3
|
import { type SidebarOptions } from '../layouts/docs/shared.js';
|
|
4
4
|
import type { PageTree } from 'fumadocs-core/server';
|
|
@@ -9,7 +9,7 @@ export interface DocsLayoutProps extends BaseLayoutProps {
|
|
|
9
9
|
nav?: BaseLayoutProps['nav'] & {
|
|
10
10
|
mode?: 'top' | 'auto';
|
|
11
11
|
};
|
|
12
|
-
sidebar?:
|
|
12
|
+
sidebar?: SidebarOptions & ComponentProps<'aside'>;
|
|
13
13
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
14
14
|
}
|
|
15
15
|
export declare function DocsLayout(props: DocsLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,kBAAkB,CAAC;AAuBlE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAGL,MAAM,EACN,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAU3B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE/B,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG;QAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;KACvB,CAAC;IAEF,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAEnD,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAqMhD;AAiMD,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/layouts/notebook.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, useMemo } from 'react';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useMemo, } from 'react';
|
|
3
3
|
import { getLinks } from '../layouts/shared.js';
|
|
4
|
-
import { Sidebar, SidebarCollapseTrigger, SidebarFooter, SidebarHeader, SidebarPageTree, SidebarViewport, } from '../components/layout/sidebar.js';
|
|
4
|
+
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFooter, SidebarHeader, SidebarPageTree, SidebarViewport, } from '../components/layout/sidebar.js';
|
|
5
5
|
import { TreeContextProvider } from '../contexts/tree.js';
|
|
6
6
|
import { cn } from '../utils/cn.js';
|
|
7
7
|
import { buttonVariants } from '../components/ui/button.js';
|
|
@@ -18,28 +18,38 @@ import Link from 'fumadocs-core/link';
|
|
|
18
18
|
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle.js';
|
|
19
19
|
import { HideIfEmpty } from 'fumadocs-core/hide-if-empty';
|
|
20
20
|
export function DocsLayout(props) {
|
|
21
|
-
const { tabMode = 'sidebar', nav: { transparentMode, ...nav } = {}, sidebar: { tabs: tabOptions,
|
|
21
|
+
const { tabMode = 'sidebar', nav: { transparentMode, ...nav } = {}, sidebar: { tabs: tabOptions, ...sidebarProps } = {}, i18n = false, disableThemeSwitch = false, themeSwitch = { enabled: !disableThemeSwitch }, } = props;
|
|
22
22
|
const navMode = nav.mode ?? 'auto';
|
|
23
23
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
24
24
|
const tabs = useMemo(() => getSidebarTabsFromOptions(tabOptions, props.tree) ?? [], [tabOptions, props.tree]);
|
|
25
25
|
const variables = cn('[--fd-nav-height:56px] md:[--fd-sidebar-width:286px] md:[--fd-nav-height:64px] xl:[--fd-toc-width:286px]', tabs.length > 0 && tabMode === 'navbar' && 'lg:[--fd-nav-height:104px]');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
function sidebar() {
|
|
27
|
+
const { banner, footer, components, collapsible = true, prefetch, defaultOpenLevel, ...rest } = sidebarProps;
|
|
28
|
+
const iconLinks = links.filter((item) => item.type === 'icon');
|
|
29
|
+
const rootToggle = (_jsxs(_Fragment, { children: [tabMode === 'sidebar' && tabs.length > 0 && (_jsx(RootToggle, { className: "mb-2", options: tabs })), tabMode === 'navbar' && tabs.length > 0 && (_jsx(RootToggle, { options: tabs, className: "lg:hidden" }))] }));
|
|
30
|
+
const sidebarNav = (_jsxs("div", { className: "flex justify-between", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 font-medium", children: nav.title }), collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
|
|
31
|
+
color: 'ghost',
|
|
32
|
+
size: 'icon-sm',
|
|
33
|
+
className: 'mt-px mb-auto text-fd-muted-foreground',
|
|
34
|
+
})), children: _jsx(SidebarIcon, {}) }))] }));
|
|
35
|
+
const viewport = (_jsxs(SidebarViewport, { children: [links
|
|
36
|
+
.filter((item) => item.type !== 'icon')
|
|
37
|
+
.map((item, i, arr) => (_jsx(SidebarLinkItem, { item: item, className: cn('lg:hidden', i === arr.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components: components })] }));
|
|
38
|
+
const content = (_jsxs(SidebarContent, { ...rest, className: cn(navMode === 'top'
|
|
39
|
+
? 'border-e-0 bg-transparent'
|
|
40
|
+
: '[--fd-nav-height:0px]', rest.className), children: [_jsxs(HideIfEmpty, { as: SidebarHeader, children: [navMode === 'auto' && sidebarNav, nav.children, banner, rootToggle] }), viewport, _jsxs(HideIfEmpty, { as: SidebarFooter, className: "flex flex-row text-fd-muted-foreground items-center", children: [iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({
|
|
41
|
+
size: 'icon-sm',
|
|
42
|
+
color: 'ghost',
|
|
43
|
+
className: 'lg:hidden',
|
|
44
|
+
})), "aria-label": item.label, children: item.icon }, i))), footer] })] }));
|
|
45
|
+
const mobile = (_jsxs(SidebarContentMobile, { ...rest, children: [_jsxs(HideIfEmpty, { as: SidebarHeader, children: [banner, rootToggle] }), viewport, _jsxs(HideIfEmpty, { as: SidebarFooter, className: "flex flex-row items-center justify-end", children: [iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({
|
|
46
|
+
size: 'icon-sm',
|
|
47
|
+
color: 'ghost',
|
|
48
|
+
}), 'text-fd-muted-foreground lg:hidden', i === iconLinks.length - 1 && 'me-auto'), "aria-label": item.label, children: item.icon }, i))), i18n ? (_jsx(LanguageToggle, { children: _jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) })) : null, themeSwitch.enabled !== false &&
|
|
49
|
+
(themeSwitch.component ?? (_jsx(ThemeToggle, { mode: themeSwitch.mode ?? 'light-dark-system' }))), footer] })] }));
|
|
50
|
+
return (_jsx(Sidebar, { defaultOpenLevel: defaultOpenLevel, prefetch: prefetch, Content: content, Mobile: mobile }));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs(LayoutBody, { ...props.containerProps, className: cn(variables, props.containerProps?.className), children: [sidebar(), _jsx(DocsNavbar, { ...props, links: links, tabs: tabMode == 'navbar' ? tabs : [] }), props.children] }) }) }));
|
|
43
53
|
}
|
|
44
54
|
function DocsNavbar({ links, tabs, searchToggle = {}, themeSwitch = {}, ...props }) {
|
|
45
55
|
const navMode = props.nav?.mode ?? 'auto';
|
package/dist/style.css
CHANGED
|
@@ -455,6 +455,9 @@
|
|
|
455
455
|
.-ms-1\.5 {
|
|
456
456
|
margin-inline-start: calc(var(--spacing) * -1.5);
|
|
457
457
|
}
|
|
458
|
+
.ms-1\.5 {
|
|
459
|
+
margin-inline-start: calc(var(--spacing) * 1.5);
|
|
460
|
+
}
|
|
458
461
|
.ms-2 {
|
|
459
462
|
margin-inline-start: calc(var(--spacing) * 2);
|
|
460
463
|
}
|
|
@@ -470,15 +473,9 @@
|
|
|
470
473
|
.-me-1\.5 {
|
|
471
474
|
margin-inline-end: calc(var(--spacing) * -1.5);
|
|
472
475
|
}
|
|
473
|
-
.me-1\.5 {
|
|
474
|
-
margin-inline-end: calc(var(--spacing) * 1.5);
|
|
475
|
-
}
|
|
476
476
|
.me-2 {
|
|
477
477
|
margin-inline-end: calc(var(--spacing) * 2);
|
|
478
478
|
}
|
|
479
|
-
.me-4 {
|
|
480
|
-
margin-inline-end: calc(var(--spacing) * 4);
|
|
481
|
-
}
|
|
482
479
|
.me-auto {
|
|
483
480
|
margin-inline-end: auto;
|
|
484
481
|
}
|
|
@@ -857,9 +854,6 @@
|
|
|
857
854
|
.mt-\(--fd-top\) {
|
|
858
855
|
margin-top: var(--fd-top);
|
|
859
856
|
}
|
|
860
|
-
.mt-3 {
|
|
861
|
-
margin-top: calc(var(--spacing) * 3);
|
|
862
|
-
}
|
|
863
857
|
.mt-6 {
|
|
864
858
|
margin-top: calc(var(--spacing) * 6);
|
|
865
859
|
}
|
|
@@ -1048,8 +1042,8 @@
|
|
|
1048
1042
|
.w-\[286px\] {
|
|
1049
1043
|
width: 286px;
|
|
1050
1044
|
}
|
|
1051
|
-
.w-\[calc\(100\%-
|
|
1052
|
-
width: calc(100% -
|
|
1045
|
+
.w-\[calc\(100\%-1rem\)\] {
|
|
1046
|
+
width: calc(100% - 1rem);
|
|
1053
1047
|
}
|
|
1054
1048
|
.w-fit {
|
|
1055
1049
|
width: fit-content;
|
|
@@ -1352,6 +1346,12 @@
|
|
|
1352
1346
|
background-color: color-mix(in oklab, var(--color-fd-popover) 60%, transparent);
|
|
1353
1347
|
}
|
|
1354
1348
|
}
|
|
1349
|
+
.bg-fd-popover\/80 {
|
|
1350
|
+
background-color: color-mix(in srgb, hsl(0, 0%, 98%) 80%, transparent);
|
|
1351
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1352
|
+
background-color: color-mix(in oklab, var(--color-fd-popover) 80%, transparent);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
1355
|
.bg-fd-primary {
|
|
1356
1356
|
background-color: var(--color-fd-primary);
|
|
1357
1357
|
}
|
|
@@ -1475,6 +1475,9 @@
|
|
|
1475
1475
|
.ps-3 {
|
|
1476
1476
|
padding-inline-start: calc(var(--spacing) * 3);
|
|
1477
1477
|
}
|
|
1478
|
+
.ps-4 {
|
|
1479
|
+
padding-inline-start: calc(var(--spacing) * 4);
|
|
1480
|
+
}
|
|
1478
1481
|
.ps-6 {
|
|
1479
1482
|
padding-inline-start: calc(var(--spacing) * 6);
|
|
1480
1483
|
}
|
|
@@ -1484,6 +1487,9 @@
|
|
|
1484
1487
|
.ps-\[calc\(var\(--fd-layout-offset\)\+var\(--fd-sidebar-width\)\)\] {
|
|
1485
1488
|
padding-inline-start: calc(var(--fd-layout-offset) + var(--fd-sidebar-width));
|
|
1486
1489
|
}
|
|
1490
|
+
.pe-2\.5 {
|
|
1491
|
+
padding-inline-end: calc(var(--spacing) * 2.5);
|
|
1492
|
+
}
|
|
1487
1493
|
.pe-4 {
|
|
1488
1494
|
padding-inline-end: calc(var(--spacing) * 4);
|
|
1489
1495
|
}
|
|
@@ -1644,10 +1650,10 @@
|
|
|
1644
1650
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
1645
1651
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
1646
1652
|
}
|
|
1647
|
-
.shadow-black\/
|
|
1648
|
-
--tw-shadow-color: color-mix(in srgb, #000
|
|
1653
|
+
.shadow-black\/50 {
|
|
1654
|
+
--tw-shadow-color: color-mix(in srgb, #000 50%, transparent);
|
|
1649
1655
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1650
|
-
--tw-shadow-color: color-mix(in oklab, color-mix(in oklab, var(--color-black)
|
|
1656
|
+
--tw-shadow-color: color-mix(in oklab, color-mix(in oklab, var(--color-black) 50%, transparent) var(--tw-shadow-alpha), transparent);
|
|
1651
1657
|
}
|
|
1652
1658
|
}
|
|
1653
1659
|
.outline {
|
|
@@ -1741,6 +1747,9 @@
|
|
|
1741
1747
|
-webkit-user-select: none;
|
|
1742
1748
|
user-select: none;
|
|
1743
1749
|
}
|
|
1750
|
+
.\[--fd-nav-height\:0px\] {
|
|
1751
|
+
--fd-nav-height: 0px;
|
|
1752
|
+
}
|
|
1744
1753
|
.\[--fd-nav-height\:56px\] {
|
|
1745
1754
|
--fd-nav-height: 56px;
|
|
1746
1755
|
}
|
|
@@ -2042,11 +2051,6 @@
|
|
|
2042
2051
|
display: none;
|
|
2043
2052
|
}
|
|
2044
2053
|
}
|
|
2045
|
-
.data-\[empty\=true\]\:hidden {
|
|
2046
|
-
&[data-empty="true"] {
|
|
2047
|
-
display: none;
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
2054
|
.\*\:data-\[empty\=true\]\:border-b-0 {
|
|
2051
2055
|
:is(& > *) {
|
|
2052
2056
|
&[data-empty="true"] {
|
|
@@ -2344,21 +2348,11 @@
|
|
|
2344
2348
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
2345
2349
|
}
|
|
2346
2350
|
}
|
|
2347
|
-
.md\:bg-transparent {
|
|
2348
|
-
@media (width >= 48rem) {
|
|
2349
|
-
background-color: transparent;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
2351
|
.md\:px-6 {
|
|
2353
2352
|
@media (width >= 48rem) {
|
|
2354
2353
|
padding-inline: calc(var(--spacing) * 6);
|
|
2355
2354
|
}
|
|
2356
2355
|
}
|
|
2357
|
-
.md\:pt-4 {
|
|
2358
|
-
@media (width >= 48rem) {
|
|
2359
|
-
padding-top: calc(var(--spacing) * 4);
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
2356
|
.md\:\[--fd-nav-height\:0px\] {
|
|
2363
2357
|
@media (width >= 48rem) {
|
|
2364
2358
|
--fd-nav-height: 0px;
|
|
@@ -2496,14 +2490,6 @@
|
|
|
2496
2490
|
flex-shrink: 0;
|
|
2497
2491
|
}
|
|
2498
2492
|
}
|
|
2499
|
-
.md\:\[\&_svg\]\:size-4\.5 {
|
|
2500
|
-
@media (width >= 48rem) {
|
|
2501
|
-
& svg {
|
|
2502
|
-
width: calc(var(--spacing) * 4.5);
|
|
2503
|
-
height: calc(var(--spacing) * 4.5);
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
2493
|
.\[\&\>figure\:only-child\]\:-m-4 {
|
|
2508
2494
|
&>figure:only-child {
|
|
2509
2495
|
margin: calc(var(--spacing) * -4);
|
|
@@ -2521,7 +2507,7 @@
|
|
|
2521
2507
|
--color-fd-foreground: hsl(0, 0%, 92%);
|
|
2522
2508
|
--color-fd-muted: hsl(0, 0%, 12.9%);
|
|
2523
2509
|
--color-fd-muted-foreground: hsla(0, 0%, 70%, 0.8);
|
|
2524
|
-
--color-fd-popover: hsl(0, 0%,
|
|
2510
|
+
--color-fd-popover: hsl(0, 0%, 11.6%);
|
|
2525
2511
|
--color-fd-popover-foreground: hsl(0, 0%, 86.9%);
|
|
2526
2512
|
--color-fd-card: hsl(0, 0%, 9.8%);
|
|
2527
2513
|
--color-fd-card-foreground: hsl(0, 0%, 98%);
|
|
@@ -2559,22 +2545,20 @@
|
|
|
2559
2545
|
filter: blur(0);
|
|
2560
2546
|
}
|
|
2561
2547
|
&[data-line-numbers] code .twoslash-meta-line {
|
|
2562
|
-
|
|
2548
|
+
padding-left: calc(var(--padding-left) + 7 * var(--spacing));
|
|
2563
2549
|
}
|
|
2564
2550
|
&[data-line-numbers] code .line {
|
|
2565
|
-
width: calc(100% - 7 * var(--spacing));
|
|
2566
2551
|
counter-increment: line;
|
|
2567
|
-
padding-left: calc(var(--padding-left)
|
|
2568
|
-
margin-left: calc(var(--spacing) * 7);
|
|
2552
|
+
padding-left: calc(var(--padding-left) + 7 * var(--spacing));
|
|
2569
2553
|
&::after {
|
|
2570
2554
|
position: absolute;
|
|
2571
2555
|
content: counter(line);
|
|
2572
|
-
|
|
2573
|
-
left: calc(var(--spacing) * -5);
|
|
2574
|
-
color: color-mix(in srgb, hsl(0, 0%, 45.1%) 60%, transparent);
|
|
2556
|
+
color: var(--fd-counter-color, hsl(0, 0%, 45.1%));
|
|
2575
2557
|
@supports (color: color-mix(in lab, red, red)) {
|
|
2576
|
-
color: color-mix(in oklab, var(--color-fd-muted-foreground) 60%, transparent);
|
|
2558
|
+
color: color-mix( in oklab, var(--fd-counter-color, var(--color-fd-muted-foreground)) 60%, transparent );
|
|
2577
2559
|
}
|
|
2560
|
+
top: calc(var(--spacing) * 0);
|
|
2561
|
+
left: calc(var(--spacing) * 4);
|
|
2578
2562
|
}
|
|
2579
2563
|
}
|
|
2580
2564
|
code .diff::before {
|
|
@@ -2583,6 +2567,7 @@
|
|
|
2583
2567
|
}
|
|
2584
2568
|
code .diff.remove {
|
|
2585
2569
|
opacity: 0.7;
|
|
2570
|
+
--fd-counter-color: var(--color-fd-diff-remove-symbol);
|
|
2586
2571
|
background-color: var(--color-fd-diff-remove);
|
|
2587
2572
|
}
|
|
2588
2573
|
code .diff.remove::before {
|
|
@@ -2590,19 +2575,21 @@
|
|
|
2590
2575
|
color: var(--color-fd-diff-remove-symbol);
|
|
2591
2576
|
}
|
|
2592
2577
|
code .diff.add {
|
|
2578
|
+
--fd-counter-color: var(--color-fd-diff-add-symbol);
|
|
2593
2579
|
background-color: var(--color-fd-diff-add);
|
|
2594
2580
|
}
|
|
2595
2581
|
code .diff.add::before {
|
|
2596
2582
|
content: '+';
|
|
2597
2583
|
color: var(--color-fd-diff-add-symbol);
|
|
2598
2584
|
}
|
|
2599
|
-
.highlighted {
|
|
2585
|
+
code .highlighted {
|
|
2586
|
+
--fd-counter-color: var(--color-fd-primary);
|
|
2600
2587
|
background-color: color-mix(in srgb, hsl(0, 0%, 9%) 10%, transparent);
|
|
2601
2588
|
@supports (color: color-mix(in lab, red, red)) {
|
|
2602
2589
|
background-color: color-mix(in oklab, var(--color-fd-primary) 10%, transparent);
|
|
2603
2590
|
}
|
|
2604
2591
|
}
|
|
2605
|
-
.highlighted-word {
|
|
2592
|
+
code .highlighted-word {
|
|
2606
2593
|
padding: 1px;
|
|
2607
2594
|
margin-block: -1px;
|
|
2608
2595
|
border-radius: var(--radius-md);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "15.6.
|
|
3
|
+
"version": "15.6.8",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -89,20 +89,20 @@
|
|
|
89
89
|
"react-medium-image-zoom": "^5.3.0",
|
|
90
90
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
91
91
|
"tailwind-merge": "^3.3.1",
|
|
92
|
-
"fumadocs-core": "15.6.
|
|
92
|
+
"fumadocs-core": "15.6.8"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@next/eslint-plugin-next": "^15.4.
|
|
95
|
+
"@next/eslint-plugin-next": "^15.4.5",
|
|
96
96
|
"@tailwindcss/cli": "^4.1.11",
|
|
97
97
|
"@types/lodash.merge": "^4.6.9",
|
|
98
|
-
"@types/react": "^19.1.
|
|
99
|
-
"@types/react-dom": "^19.1.
|
|
100
|
-
"next": "15.4.
|
|
98
|
+
"@types/react": "^19.1.9",
|
|
99
|
+
"@types/react-dom": "^19.1.7",
|
|
100
|
+
"next": "15.4.5",
|
|
101
101
|
"tailwindcss": "^4.1.11",
|
|
102
102
|
"tsc-alias": "^1.8.16",
|
|
103
|
-
"@fumadocs/cli": "0.2.1",
|
|
104
103
|
"eslint-config-custom": "0.0.0",
|
|
105
|
-
"fumadocs
|
|
104
|
+
"@fumadocs/cli": "0.2.1",
|
|
105
|
+
"fumadocs-core": "15.6.8",
|
|
106
106
|
"tsconfig": "0.0.0"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|