fumadocs-ui 15.2.3 → 15.2.4
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/dynamic-codeblock.d.ts +2 -2
- package/dist/components/dynamic-codeblock.d.ts.map +1 -1
- package/dist/components/layout/sidebar.d.ts +15 -2
- package/dist/components/layout/sidebar.d.ts.map +1 -1
- package/dist/layouts/docs/shared.d.ts +5 -21
- package/dist/layouts/docs/shared.d.ts.map +1 -1
- package/dist/layouts/docs/shared.js +1 -61
- package/dist/layouts/docs.d.ts +1 -1
- package/dist/layouts/docs.d.ts.map +1 -1
- package/dist/layouts/docs.js +1 -2
- package/dist/layouts/home.js +3 -4
- package/dist/layouts/links.d.ts +0 -1
- package/dist/layouts/links.d.ts.map +1 -1
- package/dist/layouts/notebook.d.ts.map +1 -1
- package/dist/layouts/notebook.js +1 -2
- package/dist/utils/get-sidebar-tabs.d.ts +7 -0
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
- package/dist/utils/get-sidebar-tabs.js +46 -0
- package/package.json +8 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HighlightOptionsCommon, HighlightOptionsThemes } from 'fumadocs-core/highlight';
|
|
2
2
|
export declare function DynamicCodeBlock({ lang, code, options, }: {
|
|
3
3
|
lang: string;
|
|
4
4
|
code: string;
|
|
5
|
-
options?: Omit<
|
|
5
|
+
options?: Omit<HighlightOptionsCommon, 'lang'> & HighlightOptionsThemes;
|
|
6
6
|
}): import("react").ReactNode;
|
|
7
7
|
//# sourceMappingURL=dynamic-codeblock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-codeblock.d.ts","sourceRoot":"","sources":["../../src/components/dynamic-codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dynamic-codeblock.d.ts","sourceRoot":"","sources":["../../src/components/dynamic-codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAcjC,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,GAAG,sBAAsB,CAAC;CACzE,6BAUA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
1
|
+
import { type ButtonHTMLAttributes, type FC, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
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
|
-
import type {
|
|
5
|
+
import type { PageTree } from 'fumadocs-core/server';
|
|
6
6
|
export interface SidebarProps extends HTMLAttributes<HTMLElement> {
|
|
7
7
|
/**
|
|
8
8
|
* Open folders by default if their level is lower or equal to a specific level
|
|
@@ -36,6 +36,19 @@ export declare function SidebarFolderTrigger(props: CollapsibleTriggerProps): im
|
|
|
36
36
|
export declare function SidebarFolderLink(props: LinkProps): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export declare function SidebarFolderContent(props: CollapsibleContentProps): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare function SidebarCollapseTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export interface SidebarComponents {
|
|
40
|
+
Item: FC<{
|
|
41
|
+
item: PageTree.Item;
|
|
42
|
+
}>;
|
|
43
|
+
Folder: FC<{
|
|
44
|
+
item: PageTree.Folder;
|
|
45
|
+
level: number;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}>;
|
|
48
|
+
Separator: FC<{
|
|
49
|
+
item: PageTree.Separator;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
39
52
|
/**
|
|
40
53
|
* Render sidebar items from page tree
|
|
41
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,EAAE,EAEP,KAAK,cAAc,EACnB,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;AAGrD,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;AA2BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,2CAuDrD;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,2CAwC3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CASlE;AA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,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type SidebarProps } from '../../components/layout/sidebar.js';
|
|
1
|
+
import type { LinkItemType } from '../../layouts/links.js';
|
|
2
|
+
import { type SidebarComponents, type SidebarProps } from '../../components/layout/sidebar.js';
|
|
3
3
|
import type { PageTree } from 'fumadocs-core/server';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
5
|
import type { Option } from '../../components/layout/root-toggle.js';
|
|
6
|
+
import { type GetSidebarTabsOptions } from '../../utils/get-sidebar-tabs.js';
|
|
6
7
|
export declare const layoutVariables: {
|
|
7
8
|
'--fd-layout-offset': string;
|
|
8
9
|
};
|
|
9
|
-
export interface TabOptions {
|
|
10
|
-
transform?: (option: Option, node: PageTree.Folder) => Option | null;
|
|
11
|
-
}
|
|
12
10
|
export interface SidebarOptions extends SidebarProps {
|
|
13
11
|
collapsible?: boolean;
|
|
14
12
|
components?: Partial<SidebarComponents>;
|
|
15
13
|
/**
|
|
16
14
|
* Root Toggle options
|
|
17
15
|
*/
|
|
18
|
-
tabs?: Option[] |
|
|
16
|
+
tabs?: Option[] | GetSidebarTabsOptions | false;
|
|
19
17
|
banner?: ReactNode;
|
|
20
18
|
footer?: ReactNode;
|
|
21
19
|
/**
|
|
@@ -25,23 +23,9 @@ export interface SidebarOptions extends SidebarProps {
|
|
|
25
23
|
*/
|
|
26
24
|
hideSearch?: boolean;
|
|
27
25
|
}
|
|
28
|
-
export interface SidebarComponents {
|
|
29
|
-
Item: FC<{
|
|
30
|
-
item: PageTree.Item;
|
|
31
|
-
}>;
|
|
32
|
-
Folder: FC<{
|
|
33
|
-
item: PageTree.Folder;
|
|
34
|
-
level: number;
|
|
35
|
-
children: ReactNode;
|
|
36
|
-
}>;
|
|
37
|
-
Separator: FC<{
|
|
38
|
-
item: PageTree.Separator;
|
|
39
|
-
}>;
|
|
40
|
-
}
|
|
41
26
|
export declare function SidebarLinkItem({ item, ...props }: {
|
|
42
27
|
item: LinkItemType;
|
|
43
28
|
className?: string;
|
|
44
29
|
}): import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
export declare function checkPageTree(passed: unknown): void;
|
|
46
30
|
export declare function getSidebarTabsFromOptions(options: SidebarOptions['tabs'], tree: PageTree.Root): Option[] | undefined;
|
|
47
31
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,eAAO,MAAM,eAAe;;CAE3B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,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,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;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,31 +1,16 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BaseLinkItem } from '../../layouts/links.js';
|
|
3
2
|
import { SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, } from '../../components/layout/sidebar.js';
|
|
4
|
-
import {
|
|
5
|
-
import { buttonVariants } from '../../components/ui/button.js';
|
|
3
|
+
import { getSidebarTabs, } from '../../utils/get-sidebar-tabs.js';
|
|
6
4
|
export const layoutVariables = {
|
|
7
5
|
'--fd-layout-offset': 'max(calc(50vw - var(--fd-layout-width) / 2), 0px)',
|
|
8
6
|
};
|
|
9
7
|
export function SidebarLinkItem({ item, ...props }) {
|
|
10
8
|
if (item.type === 'menu')
|
|
11
9
|
return (_jsxs(SidebarFolder, { ...props, children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(SidebarLinkItem, { item: child }, i))) })] }));
|
|
12
|
-
if (item.type === 'button') {
|
|
13
|
-
return (_jsxs(BaseLinkItem, { item: item, ...props, className: cn(buttonVariants({
|
|
14
|
-
color: 'secondary',
|
|
15
|
-
}), 'gap-1.5 [&_svg]:size-4', props.className), children: [item.icon, item.text] }));
|
|
16
|
-
}
|
|
17
10
|
if (item.type === 'custom')
|
|
18
11
|
return _jsx("div", { ...props, children: item.children });
|
|
19
12
|
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
|
|
20
13
|
}
|
|
21
|
-
export function checkPageTree(passed) {
|
|
22
|
-
if (passed &&
|
|
23
|
-
typeof passed === 'object' &&
|
|
24
|
-
'children' in passed &&
|
|
25
|
-
Array.isArray(passed.children))
|
|
26
|
-
return;
|
|
27
|
-
throw new Error('You passed an invalid page tree to `<DocsLayout />`. Check your usage in layout.tsx if you have enabled i18n.');
|
|
28
|
-
}
|
|
29
14
|
export function getSidebarTabsFromOptions(options, tree) {
|
|
30
15
|
if (Array.isArray(options)) {
|
|
31
16
|
return options;
|
|
@@ -37,48 +22,3 @@ export function getSidebarTabsFromOptions(options, tree) {
|
|
|
37
22
|
return getSidebarTabs(tree);
|
|
38
23
|
}
|
|
39
24
|
}
|
|
40
|
-
const defaultTransform = (option, node) => {
|
|
41
|
-
if (!node.icon)
|
|
42
|
-
return option;
|
|
43
|
-
return {
|
|
44
|
-
...option,
|
|
45
|
-
icon: (_jsx("div", { className: "rounded-md border bg-fd-secondary p-1 shadow-md [&_svg]:size-5", children: node.icon })),
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
|
|
49
|
-
function findOptions(node) {
|
|
50
|
-
const results = [];
|
|
51
|
-
if (node.root) {
|
|
52
|
-
const urls = getFolderUrls(node);
|
|
53
|
-
if (urls.size > 0) {
|
|
54
|
-
const option = {
|
|
55
|
-
url: urls.values().next().value ?? '',
|
|
56
|
-
title: node.name,
|
|
57
|
-
icon: node.icon,
|
|
58
|
-
description: node.description,
|
|
59
|
-
urls,
|
|
60
|
-
};
|
|
61
|
-
const mapped = transform ? transform(option, node) : option;
|
|
62
|
-
if (mapped)
|
|
63
|
-
results.push(mapped);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
for (const child of node.children) {
|
|
67
|
-
if (child.type === 'folder')
|
|
68
|
-
results.push(...findOptions(child));
|
|
69
|
-
}
|
|
70
|
-
return results;
|
|
71
|
-
}
|
|
72
|
-
return findOptions(pageTree);
|
|
73
|
-
}
|
|
74
|
-
function getFolderUrls(folder, output = new Set()) {
|
|
75
|
-
if (folder.index)
|
|
76
|
-
output.add(folder.index.url);
|
|
77
|
-
for (const child of folder.children) {
|
|
78
|
-
if (child.type === 'page' && !child.external)
|
|
79
|
-
output.add(child.url);
|
|
80
|
-
if (child.type === 'folder')
|
|
81
|
-
getFolderUrls(child, output);
|
|
82
|
-
}
|
|
83
|
-
return output;
|
|
84
|
-
}
|
package/dist/layouts/docs.d.ts
CHANGED
|
@@ -27,5 +27,5 @@ export declare function DocsLayoutSidebarFooter({ i18n, themeSwitch, links, }: {
|
|
|
27
27
|
themeSwitch?: DocsLayoutProps['themeSwitch'];
|
|
28
28
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
29
29
|
export { CollapsibleControl, Navbar, NavbarSidebarTrigger, type LinkItemType };
|
|
30
|
-
export { getSidebarTabsFromOptions
|
|
30
|
+
export { getSidebarTabsFromOptions } from './docs/shared.js';
|
|
31
31
|
//# 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,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAcrE,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AAK1D,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAO/B,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,EAAE,KAAK,S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KAAU,GACX,EAAE;IACD,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;CAC9C,kDAiCA;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/layouts/docs.js
CHANGED
|
@@ -13,11 +13,10 @@ import { CollapsibleControl, Navbar, NavbarSidebarTrigger, } from '../layouts/do
|
|
|
13
13
|
import { TreeContextProvider } from '../contexts/tree.js';
|
|
14
14
|
import { ThemeToggle } from '../components/layout/theme-toggle.js';
|
|
15
15
|
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle.js';
|
|
16
|
-
import {
|
|
16
|
+
import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared.js';
|
|
17
17
|
import { StylesProvider, NavProvider, } from '../contexts/layout.js';
|
|
18
18
|
import Link from 'fumadocs-core/link';
|
|
19
19
|
export function DocsLayout({ nav: { enabled: navEnabled = true, component: navReplace, transparentMode, ...nav } = {}, themeSwitch, sidebar = {}, i18n = false, children, ...props }) {
|
|
20
|
-
checkPageTree(props.tree);
|
|
21
20
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
22
21
|
const variables = cn('[--fd-tocnav-height:36px] md:[--fd-sidebar-width:268px] lg:[--fd-sidebar-width:286px] xl:[--fd-toc-width:286px] xl:[--fd-tocnav-height:0px]', !navReplace && navEnabled
|
|
23
22
|
? '[--fd-nav-height:calc(var(--spacing)*14)] md:[--fd-nav-height:0px]'
|
package/dist/layouts/home.js
CHANGED
|
@@ -29,14 +29,13 @@ function Header({ nav: { enableSearch = true, ...nav } = {}, i18n = false, final
|
|
|
29
29
|
}
|
|
30
30
|
function NavbarLinkItem({ item, ...props }) {
|
|
31
31
|
if (item.type === 'custom')
|
|
32
|
-
return item.children;
|
|
32
|
+
return _jsx("div", { ...props, children: item.children });
|
|
33
33
|
if (item.type === 'menu') {
|
|
34
34
|
const children = item.items.map((child, j) => {
|
|
35
35
|
if (child.type === 'custom')
|
|
36
36
|
return _jsx(Fragment, { children: child.children }, j);
|
|
37
|
-
const { banner,
|
|
38
|
-
return (
|
|
39
|
-
(child.icon ? (_jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null), _jsx("p", { className: "-mb-1 text-sm font-medium", children: child.text }), child.description ? (_jsx("p", { className: "text-[13px] text-fd-muted-foreground", children: child.description })) : null, footer] }, j));
|
|
37
|
+
const { banner = child.icon ? (_jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null, ...rest } = child.menu ?? {};
|
|
38
|
+
return (_jsx(NavbarMenuLink, { href: child.url, ...rest, children: rest.children ?? (_jsxs(_Fragment, { children: [banner, _jsx("p", { className: "-mb-1 text-sm font-medium", children: child.text }), child.description ? (_jsx("p", { className: "text-[13px] text-fd-muted-foreground", children: child.description })) : null] })) }, j));
|
|
40
39
|
});
|
|
41
40
|
return (_jsxs(NavbarMenu, { children: [_jsx(NavbarMenuTrigger, { ...props, children: item.url ? _jsx(Link, { href: item.url, children: item.text }) : item.text }), _jsx(NavbarMenuContent, { children: children })] }));
|
|
42
41
|
}
|
package/dist/layouts/links.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/layouts/links.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,UAAU,QAAQ;IAChB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CAC7B;AAED,MAA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U,CACb,EAAE,CAAC;IAEJ;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,UAAW,SAAQ,QAAQ;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,UAAU,CAAC;AAEf,eAAO,MAAM,YAAY;UAEyC,YAAY;qDAmB5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAC/D,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AA0B1B,OAAO,
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAC/D,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AA0B1B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAGL,MAAM,EACN,oBAAoB,EAErB,MAAM,mBAAmB,CAAC;AAS3B,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,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,OAAmB,EACnB,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,WAAW,EACX,GAAG,KAAK,EACT,EAAE,eAAe,2CAqIjB;AAiLD,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/layouts/notebook.js
CHANGED
|
@@ -11,13 +11,12 @@ import { BaseLinkItem } from '../layouts/links.js';
|
|
|
11
11
|
import { LanguageToggle } from '../components/layout/language-toggle.js';
|
|
12
12
|
import { ThemeToggle } from '../components/layout/theme-toggle.js';
|
|
13
13
|
import { Popover, PopoverContent, PopoverTrigger, } from '../components/ui/popover.js';
|
|
14
|
-
import {
|
|
14
|
+
import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared.js';
|
|
15
15
|
import { LayoutTab, LayoutTabs, Navbar, NavbarSidebarTrigger, SidebarLayoutTab, } from './notebook-client.js';
|
|
16
16
|
import { StylesProvider, NavProvider, } from '../contexts/layout.js';
|
|
17
17
|
import { RootToggle } from '../components/layout/root-toggle.js';
|
|
18
18
|
import Link from 'fumadocs-core/link';
|
|
19
19
|
export function DocsLayout({ tabMode = 'sidebar', nav: { transparentMode, ...nav } = {}, sidebar: { collapsible: sidebarCollapsible = true, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, themeSwitch, ...props }) {
|
|
20
|
-
checkPageTree(props.tree);
|
|
21
20
|
const navMode = nav.mode ?? 'auto';
|
|
22
21
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
23
22
|
const tabs = useMemo(() => getSidebarTabsFromOptions(tabOptions, props.tree) ?? [], [tabOptions, props.tree]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PageTree } from 'fumadocs-core/server';
|
|
2
|
+
import type { Option } from '../components/layout/root-toggle.js';
|
|
3
|
+
export interface GetSidebarTabsOptions {
|
|
4
|
+
transform?: (option: Option, node: PageTree.Folder) => Option | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function getSidebarTabs(pageTree: PageTree.Root, { transform }?: GetSidebarTabsOptions): Option[];
|
|
7
|
+
//# sourceMappingURL=get-sidebar-tabs.d.ts.map
|
|
@@ -0,0 +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,qBAAqB;IACpC,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,SAA4B,EAAE,GAAE,qBAA0B,GAC3D,MAAM,EAAE,CA6BV"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const defaultTransform = (option, node) => {
|
|
3
|
+
if (!node.icon)
|
|
4
|
+
return option;
|
|
5
|
+
return {
|
|
6
|
+
...option,
|
|
7
|
+
icon: (_jsx("div", { className: "rounded-md border bg-fd-secondary p-1 shadow-md [&_svg]:size-5", children: node.icon })),
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
|
|
11
|
+
function findOptions(node) {
|
|
12
|
+
const results = [];
|
|
13
|
+
if (node.root) {
|
|
14
|
+
const urls = getFolderUrls(node);
|
|
15
|
+
if (urls.size > 0) {
|
|
16
|
+
const option = {
|
|
17
|
+
url: urls.values().next().value ?? '',
|
|
18
|
+
title: node.name,
|
|
19
|
+
icon: node.icon,
|
|
20
|
+
description: node.description,
|
|
21
|
+
urls,
|
|
22
|
+
};
|
|
23
|
+
const mapped = transform ? transform(option, node) : option;
|
|
24
|
+
if (mapped)
|
|
25
|
+
results.push(mapped);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const child of node.children) {
|
|
29
|
+
if (child.type === 'folder')
|
|
30
|
+
results.push(...findOptions(child));
|
|
31
|
+
}
|
|
32
|
+
return results;
|
|
33
|
+
}
|
|
34
|
+
return findOptions(pageTree);
|
|
35
|
+
}
|
|
36
|
+
function getFolderUrls(folder, output = new Set()) {
|
|
37
|
+
if (folder.index)
|
|
38
|
+
output.add(folder.index.url);
|
|
39
|
+
for (const child of folder.children) {
|
|
40
|
+
if (child.type === 'page' && !child.external)
|
|
41
|
+
output.add(child.url);
|
|
42
|
+
if (child.type === 'folder')
|
|
43
|
+
getFolderUrls(child, output);
|
|
44
|
+
}
|
|
45
|
+
return output;
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.4",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
"./theme/*": {
|
|
57
57
|
"import": "./dist/theme/*.js",
|
|
58
58
|
"types": "./dist/theme/*.d.ts"
|
|
59
|
+
},
|
|
60
|
+
"./utils/*": {
|
|
61
|
+
"import": "./dist/utils/*.js",
|
|
62
|
+
"types": "./dist/utils/*.d.ts"
|
|
59
63
|
}
|
|
60
64
|
},
|
|
61
65
|
"files": [
|
|
@@ -79,7 +83,7 @@
|
|
|
79
83
|
"postcss-selector-parser": "^7.1.0",
|
|
80
84
|
"react-medium-image-zoom": "^5.2.14",
|
|
81
85
|
"tailwind-merge": "^3.1.0",
|
|
82
|
-
"fumadocs-core": "15.2.
|
|
86
|
+
"fumadocs-core": "15.2.4"
|
|
83
87
|
},
|
|
84
88
|
"devDependencies": {
|
|
85
89
|
"@next/eslint-plugin-next": "^15.2.4",
|
|
@@ -90,9 +94,9 @@
|
|
|
90
94
|
"next": "15.2.4",
|
|
91
95
|
"tailwindcss": "^4.1.1",
|
|
92
96
|
"tsc-alias": "^1.8.13",
|
|
93
|
-
"@fumadocs/cli": "0.1.
|
|
97
|
+
"@fumadocs/cli": "0.1.1",
|
|
94
98
|
"eslint-config-custom": "0.0.0",
|
|
95
|
-
"fumadocs-core": "15.2.
|
|
99
|
+
"fumadocs-core": "15.2.4",
|
|
96
100
|
"tsconfig": "0.0.0"
|
|
97
101
|
},
|
|
98
102
|
"peerDependencies": {
|