fumadocs-ui 15.7.0 → 15.7.2
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/layout/sidebar.d.ts.map +1 -1
- package/dist/components/layout/sidebar.js +13 -12
- package/dist/layouts/docs/client.js +2 -3
- package/dist/layouts/docs/index.d.ts +22 -8
- package/dist/layouts/docs/index.d.ts.map +1 -1
- package/dist/layouts/docs/index.js +23 -6
- package/dist/layouts/docs/page.js +1 -1
- package/dist/layouts/home/index.d.ts +1 -1
- package/dist/layouts/home/index.d.ts.map +1 -1
- package/dist/layouts/home/index.js +1 -1
- package/dist/layouts/home/menu.d.ts +1 -1
- package/dist/layouts/home/menu.d.ts.map +1 -1
- package/dist/layouts/home/menu.js +1 -1
- package/dist/layouts/home/navbar.d.ts +1 -1
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/home/navbar.js +1 -1
- package/dist/layouts/notebook/client.js +3 -4
- package/dist/layouts/notebook/index.d.ts +21 -4
- package/dist/layouts/notebook/index.d.ts.map +1 -1
- package/dist/layouts/notebook/index.js +22 -5
- package/dist/layouts/shared/client.d.ts +6 -0
- package/dist/layouts/shared/client.d.ts.map +1 -0
- package/dist/layouts/{links.js → shared/client.js} +4 -6
- package/dist/layouts/shared/index.d.ts +129 -0
- package/dist/layouts/shared/index.d.ts.map +1 -0
- package/dist/layouts/{shared.js → shared/index.js} +1 -0
- package/dist/style.css +54 -16
- package/package.json +8 -8
- package/dist/layouts/docs/shared.d.ts +0 -27
- package/dist/layouts/docs/shared.d.ts.map +0 -1
- package/dist/layouts/docs/shared.js +0 -21
- package/dist/layouts/links.d.ts +0 -79
- package/dist/layouts/links.d.ts.map +0 -1
- package/dist/layouts/shared.d.ts +0 -57
- package/dist/layouts/shared.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":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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"}
|
|
@@ -59,7 +59,7 @@ export function SidebarContent(props) {
|
|
|
59
59
|
'--fd-sidebar-top': `calc(var(--fd-banner-height) + var(--fd-nav-height) + var(--fd-sidebar-margin))`,
|
|
60
60
|
width: collapsed
|
|
61
61
|
? 'var(--fd-sidebar-width)'
|
|
62
|
-
: 'calc(var(--fd-sidebar-width) + var(--fd-layout-offset))',
|
|
62
|
+
: 'calc(var(--spacing) + var(--fd-sidebar-width) + var(--fd-layout-offset))',
|
|
63
63
|
}, onPointerEnter: (e) => {
|
|
64
64
|
if (!collapsed ||
|
|
65
65
|
e.pointerType === 'touch' ||
|
|
@@ -123,8 +123,8 @@ export function SidebarFolderLink(props) {
|
|
|
123
123
|
const pathname = usePathname();
|
|
124
124
|
const active = props.href !== undefined && isActive(props.href, pathname, false);
|
|
125
125
|
return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), 'w-full', props.className), onClick: (e) => {
|
|
126
|
-
if (e.target instanceof
|
|
127
|
-
e.target.
|
|
126
|
+
if (e.target instanceof Element &&
|
|
127
|
+
e.target.matches('[data-icon], [data-icon] *')) {
|
|
128
128
|
setOpen(!open);
|
|
129
129
|
e.preventDefault();
|
|
130
130
|
}
|
|
@@ -134,16 +134,17 @@ export function SidebarFolderLink(props) {
|
|
|
134
134
|
}, prefetch: prefetch, children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
|
|
135
135
|
}
|
|
136
136
|
export function SidebarFolderContent(props) {
|
|
137
|
-
const ctx = useInternalContext();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
"**:data-[active=true]:before:content-[''] **:data-[active=true]:before:bg-fd-primary **:data-[active=true]:before:absolute **:data-[active=true]:before:w-px **:data-[active=true]:before:inset-y-2.5 **:data-[active=true]:before:start-2.5",
|
|
141
|
-
|
|
137
|
+
const { level, ...ctx } = useInternalContext();
|
|
138
|
+
return (_jsx(CollapsibleContent, { ...props, className: cn('relative', level === 1 && [
|
|
139
|
+
"before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5",
|
|
140
|
+
"**:data-[active=true]:before:content-[''] **:data-[active=true]:before:bg-fd-primary **:data-[active=true]:before:absolute **:data-[active=true]:before:w-px **:data-[active=true]:before:inset-y-2.5 **:data-[active=true]:before:start-2.5",
|
|
141
|
+
], props.className), style: {
|
|
142
|
+
'--sidebar-item-offset': `calc(var(--spacing) * ${(level + 1) * 3})`,
|
|
142
143
|
...props.style,
|
|
143
|
-
}, children:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
}, children: _jsx(Context.Provider, { value: useMemo(() => ({
|
|
145
|
+
...ctx,
|
|
146
|
+
level: level + 1,
|
|
147
|
+
}), [ctx, level]), children: props.children }) }));
|
|
147
148
|
}
|
|
148
149
|
export function SidebarTrigger({ children, ...props }) {
|
|
149
150
|
const { setOpen } = useSidebar();
|
|
@@ -13,12 +13,11 @@ export function Navbar(props) {
|
|
|
13
13
|
}
|
|
14
14
|
export function LayoutBody(props) {
|
|
15
15
|
const { collapsed } = useSidebar();
|
|
16
|
-
return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex flex-1 flex-col pt-(--fd-nav-height) transition-[padding]', props.className), style: {
|
|
16
|
+
return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex flex-1 flex-col pt-(--fd-nav-height) transition-[padding]', !collapsed && 'mx-(--fd-layout-offset)', props.className), style: {
|
|
17
17
|
...props.style,
|
|
18
18
|
paddingInlineStart: collapsed
|
|
19
19
|
? 'min(calc(100vw - var(--fd-page-width)), var(--fd-sidebar-width))'
|
|
20
|
-
: '
|
|
21
|
-
paddingInlineEnd: collapsed ? '0px' : 'var(--fd-layout-offset)',
|
|
20
|
+
: 'var(--fd-sidebar-width)',
|
|
22
21
|
}, children: props.children }));
|
|
23
22
|
}
|
|
24
23
|
export function CollapsibleControl() {
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
import type { PageTree } from 'fumadocs-core/server';
|
|
2
2
|
import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
|
|
3
|
-
import { SidebarTrigger } from '../../components/layout/sidebar.js';
|
|
4
|
-
import { type
|
|
5
|
-
import { type BaseLayoutProps } from '../../layouts/shared.js';
|
|
3
|
+
import { type SidebarComponents, type SidebarProps, SidebarTrigger } from '../../components/layout/sidebar.js';
|
|
4
|
+
import { type Option } from '../../components/layout/root-toggle.js';
|
|
5
|
+
import { type BaseLayoutProps, type LinkItemType } from '../../layouts/shared/index.js';
|
|
6
6
|
import { CollapsibleControl, Navbar } from '../../layouts/docs/client.js';
|
|
7
|
-
import { type
|
|
7
|
+
import { type GetSidebarTabsOptions } from '../../utils/get-sidebar-tabs.js';
|
|
8
8
|
export interface DocsLayoutProps extends BaseLayoutProps {
|
|
9
9
|
tree: PageTree.Root;
|
|
10
|
-
sidebar?: SidebarOptions
|
|
11
|
-
enabled?: boolean;
|
|
12
|
-
component?: ReactNode;
|
|
13
|
-
};
|
|
10
|
+
sidebar?: SidebarOptions;
|
|
14
11
|
/**
|
|
15
12
|
* Props for the `div` container
|
|
16
13
|
*/
|
|
17
14
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
18
15
|
}
|
|
16
|
+
interface SidebarOptions extends ComponentProps<'aside'>, Pick<SidebarProps, 'defaultOpenLevel' | 'prefetch'> {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
component?: ReactNode;
|
|
19
|
+
components?: Partial<SidebarComponents>;
|
|
20
|
+
/**
|
|
21
|
+
* Root Toggle options
|
|
22
|
+
*/
|
|
23
|
+
tabs?: Option[] | GetSidebarTabsOptions | false;
|
|
24
|
+
banner?: ReactNode;
|
|
25
|
+
footer?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Support collapsing the sidebar on desktop mode
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue true
|
|
30
|
+
*/
|
|
31
|
+
collapsible?: boolean;
|
|
32
|
+
}
|
|
19
33
|
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;
|
|
20
34
|
export { CollapsibleControl, Navbar, SidebarTrigger, type LinkItemType };
|
|
21
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/index.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;AAIf,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/index.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;AAIf,OAAO,EAGL,KAAK,iBAAiB,EAWtB,KAAK,YAAY,EACjB,cAAc,EAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,EAIpB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,kBAAkB,E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
5
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
6
|
-
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFooter, SidebarHeader, SidebarPageTree, SidebarTrigger, SidebarViewport, } from '../../components/layout/sidebar.js';
|
|
7
|
-
import { BaseLinkItem, } from '../../layouts/links.js';
|
|
6
|
+
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarFooter, SidebarHeader, SidebarItem, SidebarPageTree, SidebarTrigger, SidebarViewport, } from '../../components/layout/sidebar.js';
|
|
8
7
|
import { RootToggle } from '../../components/layout/root-toggle.js';
|
|
9
|
-
import { getLinks } from '../../layouts/shared.js';
|
|
8
|
+
import { BaseLinkItem, getLinks, } from '../../layouts/shared/index.js';
|
|
10
9
|
import { LanguageToggle, LanguageToggleText, } from '../../components/layout/language-toggle.js';
|
|
11
10
|
import { CollapsibleControl, LayoutBody, Navbar } from '../../layouts/docs/client.js';
|
|
12
11
|
import { TreeContextProvider } from '../../contexts/tree.js';
|
|
13
12
|
import { ThemeToggle } from '../../components/layout/theme-toggle.js';
|
|
14
|
-
import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../../layouts/docs/shared.js';
|
|
15
13
|
import { NavProvider } from '../../contexts/layout.js';
|
|
16
14
|
import Link from 'fumadocs-core/link';
|
|
17
15
|
import { LargeSearchToggle, SearchToggle, } from '../../components/layout/search-toggle.js';
|
|
18
16
|
import { HideIfEmpty } from 'fumadocs-core/hide-if-empty';
|
|
17
|
+
import { getSidebarTabs, } from '../../utils/get-sidebar-tabs.js';
|
|
19
18
|
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { tabs: sidebarTabs, enabled: sidebarEnabled = true, ...sidebarProps } = {}, searchToggle = {}, disableThemeSwitch = false, themeSwitch = { enabled: !disableThemeSwitch }, i18n = false, children, ...props }) {
|
|
20
|
-
const tabs = useMemo(() =>
|
|
19
|
+
const tabs = useMemo(() => {
|
|
20
|
+
if (Array.isArray(sidebarTabs)) {
|
|
21
|
+
return sidebarTabs;
|
|
22
|
+
}
|
|
23
|
+
if (typeof sidebarTabs === 'object') {
|
|
24
|
+
return getSidebarTabs(props.tree, sidebarTabs);
|
|
25
|
+
}
|
|
26
|
+
if (sidebarTabs !== false) {
|
|
27
|
+
return getSidebarTabs(props.tree);
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
}, [sidebarTabs, props.tree]);
|
|
21
31
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
22
32
|
const sidebarVariables = cn('md:[--fd-sidebar-width:268px] lg:[--fd-sidebar-width:286px]');
|
|
23
33
|
function sidebar() {
|
|
@@ -53,8 +63,15 @@ export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { t
|
|
|
53
63
|
color: 'ghost',
|
|
54
64
|
size: 'icon-sm',
|
|
55
65
|
className: 'p-2',
|
|
56
|
-
})), children: _jsx(SidebarIcon, {}) }))] }))), _jsxs(LayoutBody, { ...props.containerProps, className: cn('xl:[--fd-toc-width:286px]', sidebarEnabled && sidebarVariables, !nav.component &&
|
|
66
|
+
})), children: _jsx(SidebarIcon, {}) }))] }))), _jsxs(LayoutBody, { ...props.containerProps, className: cn('md:[&_#nd-page_article]:pt-12 xl:[--fd-toc-width:286px] xl:[&_#nd-page_article]:px-8', sidebarEnabled && sidebarVariables, !nav.component &&
|
|
57
67
|
nav.enabled !== false &&
|
|
58
68
|
'[--fd-nav-height:56px] md:[--fd-nav-height:0px]', props.containerProps?.className), children: [sidebarEnabled && sidebar(), children] })] }) }));
|
|
59
69
|
}
|
|
70
|
+
function SidebarLinkItem({ item, ...props }) {
|
|
71
|
+
if (item.type === 'menu')
|
|
72
|
+
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))) })] }));
|
|
73
|
+
if (item.type === 'custom')
|
|
74
|
+
return _jsx("div", { ...props, children: item.children });
|
|
75
|
+
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
|
|
76
|
+
}
|
|
60
77
|
export { CollapsibleControl, Navbar, SidebarTrigger };
|
|
@@ -21,7 +21,7 @@ export function PageTOCPopoverItems({ variant = 'normal', ...props }) {
|
|
|
21
21
|
return (_jsx(TOCScrollArea, { ...props, children: variant === 'clerk' ? _jsx(ClerkTOCItems, {}) : _jsx(TOCItems, {}) }));
|
|
22
22
|
}
|
|
23
23
|
export function PageArticle(props) {
|
|
24
|
-
return (_jsx("article", { ...props, className: cn('flex min-w-0 w-full flex-col gap-4 px-4
|
|
24
|
+
return (_jsx("article", { ...props, className: cn('flex min-w-0 w-full flex-col gap-4 pt-8 px-4 md:px-6 md:mx-auto', props.className), children: props.children }));
|
|
25
25
|
}
|
|
26
26
|
export function PageRoot({ toc, children, ...props }) {
|
|
27
27
|
return (_jsx(TOCProvider, { ...toc, children: _jsx("div", { id: "nd-page", ...props, className: cn('flex flex-1 w-full mx-auto max-w-(--fd-page-width) pt-(--fd-tocnav-height)', props.className), children: children }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from 'react';
|
|
2
|
-
import { type BaseLayoutProps, type NavOptions } from '../../layouts/shared.js';
|
|
2
|
+
import { type BaseLayoutProps, type NavOptions } from '../../layouts/shared/index.js';
|
|
3
3
|
export interface HomeLayoutProps extends BaseLayoutProps {
|
|
4
4
|
nav?: Partial<NavOptions & {
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AA6B1B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,GAAG,CAAC,EAAE,OAAO,CACX,UAAU,GAAG;QACX;;WAEG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,CACF,CAAC;CACH;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,2CAmCrD;AAED,wBAAgB,MAAM,CAAC,EACrB,GAAQ,EACR,IAAY,EACZ,KAAK,EACL,SAAS,EACT,WAAgB,EAChB,YAAiB,GAClB,EAAE,eAAe,2CAiGjB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useMemo } from 'react';
|
|
3
3
|
import { cn } from '../../utils/cn.js';
|
|
4
|
-
import { getLinks, } from '../../layouts/shared.js';
|
|
4
|
+
import { getLinks, } from '../../layouts/shared/index.js';
|
|
5
5
|
import { NavProvider } from '../../contexts/layout.js';
|
|
6
6
|
import { Navbar, NavbarLink, NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger, } from '../../layouts/home/navbar.js';
|
|
7
7
|
import { LargeSearchToggle, SearchToggle, } from '../../components/layout/search-toggle.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LinkItemType } from '../../layouts/
|
|
1
|
+
import { type LinkItemType } from '../../layouts/shared/index.js';
|
|
2
2
|
import { NavigationMenuContent, NavigationMenuTrigger } from '../../components/ui/navigation-menu.js';
|
|
3
3
|
import type { ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
export declare function MenuLinkItem({ item, ...props }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EACL,qBAAqB,EAGrB,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAqBtD,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CA6CA;AAED,eAAO,MAAM,IAAI,yNAAqB,CAAC;AAEvC,wBAAgB,WAAW,CAAC,EAC1B,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,GAAG;IAC1D;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CASA;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,2CAU9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { BaseLinkItem } from '../../layouts/
|
|
3
|
+
import { BaseLinkItem } from '../../layouts/shared/index.js';
|
|
4
4
|
import { cn } from '../../utils/cn.js';
|
|
5
5
|
import { NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, } from '../../components/ui/navigation-menu.js';
|
|
6
6
|
import Link from 'fumadocs-core/link';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps } from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { type LinkProps } from 'fumadocs-core/link';
|
|
4
|
-
import { BaseLinkItem } from '../../layouts/
|
|
4
|
+
import { BaseLinkItem } from '../../layouts/shared/index.js';
|
|
5
5
|
import type { NavigationMenuContentProps, NavigationMenuTriggerProps } from '@radix-ui/react-navigation-menu';
|
|
6
6
|
export declare function Navbar(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare const NavbarMenu: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-navigation-menu").NavigationMenuItemProps & import("react").RefAttributes<HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAWhD,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAOzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CA8BlD;AAED,eAAO,MAAM,UAAU,yNAAqB,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CAYlE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CASlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,2CAc9C;AAED,QAAA,MAAM,YAAY;;8EAiBhB,CAAC;AAEH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,2CAczE"}
|
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
6
|
import { cn } from '../../utils/cn.js';
|
|
7
|
-
import { BaseLinkItem } from '../../layouts/
|
|
7
|
+
import { BaseLinkItem } from '../../layouts/shared/index.js';
|
|
8
8
|
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, } from '../../components/ui/navigation-menu.js';
|
|
9
9
|
import { useNav } from '../../contexts/layout.js';
|
|
10
10
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
@@ -18,12 +18,11 @@ export function Navbar({ mode, ...props }) {
|
|
|
18
18
|
}
|
|
19
19
|
export function LayoutBody(props) {
|
|
20
20
|
const { collapsed } = useSidebar();
|
|
21
|
-
return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex flex-1 flex-col transition-[padding] pt-(--fd-nav-height) fd-notebook-layout', props.className), style: {
|
|
21
|
+
return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex flex-1 flex-col transition-[padding] pt-(--fd-nav-height) fd-notebook-layout', !collapsed && 'mx-(--fd-layout-offset)', props.className), style: {
|
|
22
22
|
...props.style,
|
|
23
23
|
paddingInlineStart: collapsed
|
|
24
24
|
? 'min(calc(100vw - var(--fd-page-width)), var(--fd-sidebar-width))'
|
|
25
|
-
: '
|
|
26
|
-
paddingInlineEnd: collapsed ? '0px' : 'var(--fd-layout-offset)',
|
|
25
|
+
: 'var(--fd-sidebar-width)',
|
|
27
26
|
}, children: props.children }));
|
|
28
27
|
}
|
|
29
28
|
export function NavbarSidebarTrigger({ className, ...props }) {
|
|
@@ -48,5 +47,5 @@ export function LayoutTabs({ options, ...props }) {
|
|
|
48
47
|
return (_jsx("div", { ...props, className: cn('flex flex-row items-center gap-4 overflow-auto', props.className), children: options.map((option) => (_jsx(LayoutTab, { selected: selected === option, option: option }, option.url))) }));
|
|
49
48
|
}
|
|
50
49
|
function LayoutTab({ option, selected = false, }) {
|
|
51
|
-
return (_jsx(Link, { className: cn('inline-flex border-b border-transparent transition-colors items-center py-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap', selected && 'border-fd-primary text-fd-primary'), href: option.url, children: option.title }));
|
|
50
|
+
return (_jsx(Link, { className: cn('inline-flex border-b border-transparent transition-colors items-center py-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap', option.unlisted && !selected && 'hidden', selected && 'border-fd-primary text-fd-primary'), href: option.url, children: option.title }));
|
|
52
51
|
}
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { type ComponentProps, type HTMLAttributes } from 'react';
|
|
2
|
-
import { type BaseLayoutProps } from '../../layouts/shared.js';
|
|
3
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type BaseLayoutProps } from '../../layouts/shared/index.js';
|
|
3
|
+
import { type SidebarComponents, type SidebarProps } from '../../components/layout/sidebar.js';
|
|
4
4
|
import type { PageTree } from 'fumadocs-core/server';
|
|
5
5
|
import { Navbar, NavbarSidebarTrigger } from '../../layouts/notebook/client.js';
|
|
6
|
+
import { type Option } from '../../components/layout/root-toggle.js';
|
|
7
|
+
import { type GetSidebarTabsOptions } from '../../utils/get-sidebar-tabs.js';
|
|
6
8
|
export interface DocsLayoutProps extends BaseLayoutProps {
|
|
7
9
|
tree: PageTree.Root;
|
|
8
10
|
tabMode?: 'sidebar' | 'navbar';
|
|
9
11
|
nav?: BaseLayoutProps['nav'] & {
|
|
10
12
|
mode?: 'top' | 'auto';
|
|
11
13
|
};
|
|
12
|
-
sidebar?: SidebarOptions
|
|
14
|
+
sidebar?: SidebarOptions;
|
|
13
15
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
14
16
|
}
|
|
17
|
+
interface SidebarOptions extends ComponentProps<'aside'>, Pick<SidebarProps, 'defaultOpenLevel' | 'prefetch'> {
|
|
18
|
+
components?: Partial<SidebarComponents>;
|
|
19
|
+
/**
|
|
20
|
+
* Root Toggle options
|
|
21
|
+
*/
|
|
22
|
+
tabs?: Option[] | GetSidebarTabsOptions | false;
|
|
23
|
+
banner?: ReactNode;
|
|
24
|
+
footer?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Support collapsing the sidebar on desktop mode
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue true
|
|
29
|
+
*/
|
|
30
|
+
collapsible?: boolean;
|
|
31
|
+
}
|
|
15
32
|
export declare function DocsLayout(props: DocsLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
16
33
|
export { Navbar, NavbarSidebarTrigger };
|
|
17
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EAC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AE,CAAC"}
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useMemo, } from 'react';
|
|
3
|
-
import { getLinks } from '../../layouts/shared.js';
|
|
4
|
-
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFooter, SidebarHeader, SidebarPageTree, SidebarTrigger, SidebarViewport, } from '../../components/layout/sidebar.js';
|
|
3
|
+
import { BaseLinkItem, getLinks, } from '../../layouts/shared/index.js';
|
|
4
|
+
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarFooter, SidebarHeader, SidebarItem, SidebarPageTree, SidebarTrigger, 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';
|
|
8
8
|
import { ChevronDown, Languages, Sidebar as SidebarIcon, X, } from '../../icons.js';
|
|
9
|
-
import { BaseLinkItem } from '../../layouts/links.js';
|
|
10
9
|
import { LanguageToggle } from '../../components/layout/language-toggle.js';
|
|
11
10
|
import { ThemeToggle } from '../../components/layout/theme-toggle.js';
|
|
12
11
|
import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover.js';
|
|
13
|
-
import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../../layouts/docs/shared.js';
|
|
14
12
|
import { LayoutBody, LayoutTabs, Navbar, NavbarSidebarTrigger, } from '../../layouts/notebook/client.js';
|
|
15
13
|
import { NavProvider } from '../../contexts/layout.js';
|
|
16
14
|
import { RootToggle } from '../../components/layout/root-toggle.js';
|
|
17
15
|
import Link from 'fumadocs-core/link';
|
|
18
16
|
import { LargeSearchToggle, SearchToggle, } from '../../components/layout/search-toggle.js';
|
|
19
17
|
import { HideIfEmpty } from 'fumadocs-core/hide-if-empty';
|
|
18
|
+
import { getSidebarTabs, } from '../../utils/get-sidebar-tabs.js';
|
|
20
19
|
export function DocsLayout(props) {
|
|
21
20
|
const { tabMode = 'sidebar', nav: { transparentMode, ...nav } = {}, sidebar: { tabs: tabOptions, ...sidebarProps } = {}, i18n = false, disableThemeSwitch = false, themeSwitch = { enabled: !disableThemeSwitch }, } = props;
|
|
22
21
|
const navMode = nav.mode ?? 'auto';
|
|
23
22
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
24
|
-
const tabs = useMemo(() =>
|
|
23
|
+
const tabs = useMemo(() => {
|
|
24
|
+
if (Array.isArray(tabOptions)) {
|
|
25
|
+
return tabOptions;
|
|
26
|
+
}
|
|
27
|
+
if (typeof tabOptions === 'object') {
|
|
28
|
+
return getSidebarTabs(props.tree, tabOptions);
|
|
29
|
+
}
|
|
30
|
+
if (tabOptions !== false) {
|
|
31
|
+
return getSidebarTabs(props.tree);
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
}, [tabOptions, props.tree]);
|
|
25
35
|
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
36
|
function sidebar() {
|
|
27
37
|
const { banner, footer, components, collapsible = true, prefetch, defaultOpenLevel, ...rest } = sidebarProps;
|
|
@@ -90,4 +100,11 @@ function NavbarLinkItem({ item, ...props }) {
|
|
|
90
100
|
return item.children;
|
|
91
101
|
return (_jsx(BaseLinkItem, { item: item, ...props, children: item.text }));
|
|
92
102
|
}
|
|
103
|
+
function SidebarLinkItem({ item, ...props }) {
|
|
104
|
+
if (item.type === 'menu')
|
|
105
|
+
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))) })] }));
|
|
106
|
+
if (item.type === 'custom')
|
|
107
|
+
return _jsx("div", { ...props, children: item.children });
|
|
108
|
+
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
|
|
109
|
+
}
|
|
93
110
|
export { Navbar, NavbarSidebarTrigger };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { BaseLinkType } from '../../layouts/shared/index.js';
|
|
3
|
+
export declare function BaseLinkItem({ ref, item, ...props }: Omit<ComponentProps<'a'>, 'href'> & {
|
|
4
|
+
item: BaseLinkType;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2CAkB5D"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import Link from 'fumadocs-core/link';
|
|
4
3
|
import { usePathname } from 'fumadocs-core/framework';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
export
|
|
4
|
+
import { isActive } from '../../utils/is-active.js';
|
|
5
|
+
import Link from 'fumadocs-core/link';
|
|
6
|
+
export function BaseLinkItem({ ref, item, ...props }) {
|
|
8
7
|
const pathname = usePathname();
|
|
9
8
|
const activeType = item.active ?? 'url';
|
|
10
9
|
const active = activeType !== 'none' &&
|
|
11
10
|
isActive(item.url, pathname, activeType === 'nested-url');
|
|
12
11
|
return (_jsx(Link, { ref: ref, href: item.url, external: item.external, ...props, "data-active": active, children: props.children }));
|
|
13
|
-
}
|
|
14
|
-
BaseLinkItem.displayName = 'BaseLinkItem';
|
|
12
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { NavProviderProps } from '../../contexts/layout.js';
|
|
3
|
+
import type { I18nConfig } from 'fumadocs-core/i18n';
|
|
4
|
+
export interface NavOptions extends NavProviderProps {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
component: ReactNode;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Redirect url of title
|
|
10
|
+
* @defaultValue '/'
|
|
11
|
+
*/
|
|
12
|
+
url?: string;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface BaseLayoutProps {
|
|
16
|
+
themeSwitch?: {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
component?: ReactNode;
|
|
19
|
+
mode?: 'light-dark' | 'light-dark-system';
|
|
20
|
+
};
|
|
21
|
+
searchToggle?: Partial<{
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
components: Partial<{
|
|
24
|
+
sm: ReactNode;
|
|
25
|
+
lg: ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Remove theme switcher component
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Use `themeSwitch.enabled` instead.
|
|
32
|
+
*/
|
|
33
|
+
disableThemeSwitch?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* I18n options
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false
|
|
38
|
+
*/
|
|
39
|
+
i18n?: boolean | I18nConfig;
|
|
40
|
+
/**
|
|
41
|
+
* GitHub url
|
|
42
|
+
*/
|
|
43
|
+
githubUrl?: string;
|
|
44
|
+
links?: LinkItemType[];
|
|
45
|
+
/**
|
|
46
|
+
* Replace or disable navbar
|
|
47
|
+
*/
|
|
48
|
+
nav?: Partial<NavOptions>;
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
interface BaseItem {
|
|
52
|
+
/**
|
|
53
|
+
* Restrict where the item is displayed
|
|
54
|
+
*
|
|
55
|
+
* @defaultValue 'all'
|
|
56
|
+
*/
|
|
57
|
+
on?: 'menu' | 'nav' | 'all';
|
|
58
|
+
}
|
|
59
|
+
export interface BaseLinkType extends BaseItem {
|
|
60
|
+
url: string;
|
|
61
|
+
/**
|
|
62
|
+
* When the item is marked as active
|
|
63
|
+
*
|
|
64
|
+
* @defaultValue 'url'
|
|
65
|
+
*/
|
|
66
|
+
active?: 'url' | 'nested-url' | 'none';
|
|
67
|
+
external?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface MainItemType extends BaseLinkType {
|
|
70
|
+
type?: 'main';
|
|
71
|
+
icon?: ReactNode;
|
|
72
|
+
text: ReactNode;
|
|
73
|
+
description?: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
export interface IconItemType extends BaseLinkType {
|
|
76
|
+
type: 'icon';
|
|
77
|
+
/**
|
|
78
|
+
* `aria-label` of icon button
|
|
79
|
+
*/
|
|
80
|
+
label?: string;
|
|
81
|
+
icon: ReactNode;
|
|
82
|
+
text: ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* @defaultValue true
|
|
85
|
+
*/
|
|
86
|
+
secondary?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface ButtonItemType extends BaseLinkType {
|
|
89
|
+
type: 'button';
|
|
90
|
+
icon?: ReactNode;
|
|
91
|
+
text: ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* @defaultValue false
|
|
94
|
+
*/
|
|
95
|
+
secondary?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface MenuItemType extends BaseItem {
|
|
98
|
+
type: 'menu';
|
|
99
|
+
icon?: ReactNode;
|
|
100
|
+
text: ReactNode;
|
|
101
|
+
url?: string;
|
|
102
|
+
items: ((MainItemType & {
|
|
103
|
+
/**
|
|
104
|
+
* Options when displayed on navigation menu
|
|
105
|
+
*/
|
|
106
|
+
menu?: HTMLAttributes<HTMLElement> & {
|
|
107
|
+
banner?: ReactNode;
|
|
108
|
+
};
|
|
109
|
+
}) | CustomItemType)[];
|
|
110
|
+
/**
|
|
111
|
+
* @defaultValue false
|
|
112
|
+
*/
|
|
113
|
+
secondary?: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface CustomItemType extends BaseItem {
|
|
116
|
+
type: 'custom';
|
|
117
|
+
/**
|
|
118
|
+
* @defaultValue false
|
|
119
|
+
*/
|
|
120
|
+
secondary?: boolean;
|
|
121
|
+
children: ReactNode;
|
|
122
|
+
}
|
|
123
|
+
export type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType;
|
|
124
|
+
/**
|
|
125
|
+
* Get Links Items with shortcuts
|
|
126
|
+
*/
|
|
127
|
+
export declare function getLinks(links?: LinkItemType[], githubUrl?: string): LinkItemType[];
|
|
128
|
+
export { BaseLinkItem } from './client.js';
|
|
129
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,OAAO,EAAE,OAAO,CAAC;IAC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AS,CAAC,EAAE,MAAM,GACjB,YAAY,EAAE,CAqBhB;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/style.css
CHANGED
|
@@ -313,15 +313,9 @@
|
|
|
313
313
|
.inset-y-0 {
|
|
314
314
|
inset-block: calc(var(--spacing) * 0);
|
|
315
315
|
}
|
|
316
|
-
.inset-y-1 {
|
|
317
|
-
inset-block: calc(var(--spacing) * 1);
|
|
318
|
-
}
|
|
319
316
|
.start-0 {
|
|
320
317
|
inset-inline-start: calc(var(--spacing) * 0);
|
|
321
318
|
}
|
|
322
|
-
.start-2\.5 {
|
|
323
|
-
inset-inline-start: calc(var(--spacing) * 2.5);
|
|
324
|
-
}
|
|
325
319
|
.start-4\.5 {
|
|
326
320
|
inset-inline-start: calc(var(--spacing) * 4.5);
|
|
327
321
|
}
|
|
@@ -434,6 +428,9 @@
|
|
|
434
428
|
.-mx-1 {
|
|
435
429
|
margin-inline: calc(var(--spacing) * -1);
|
|
436
430
|
}
|
|
431
|
+
.mx-\(--fd-layout-offset\) {
|
|
432
|
+
margin-inline: var(--fd-layout-offset);
|
|
433
|
+
}
|
|
437
434
|
.mx-0\.5 {
|
|
438
435
|
margin-inline: calc(var(--spacing) * 0.5);
|
|
439
436
|
}
|
|
@@ -1835,6 +1832,43 @@
|
|
|
1835
1832
|
color: var(--color-fd-muted-foreground);
|
|
1836
1833
|
}
|
|
1837
1834
|
}
|
|
1835
|
+
.before\:absolute {
|
|
1836
|
+
&::before {
|
|
1837
|
+
content: var(--tw-content);
|
|
1838
|
+
position: absolute;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
.before\:inset-y-1 {
|
|
1842
|
+
&::before {
|
|
1843
|
+
content: var(--tw-content);
|
|
1844
|
+
inset-block: calc(var(--spacing) * 1);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
.before\:start-2\.5 {
|
|
1848
|
+
&::before {
|
|
1849
|
+
content: var(--tw-content);
|
|
1850
|
+
inset-inline-start: calc(var(--spacing) * 2.5);
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
.before\:w-px {
|
|
1854
|
+
&::before {
|
|
1855
|
+
content: var(--tw-content);
|
|
1856
|
+
width: 1px;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
.before\:bg-fd-border {
|
|
1860
|
+
&::before {
|
|
1861
|
+
content: var(--tw-content);
|
|
1862
|
+
background-color: var(--color-fd-border);
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
.before\:content-\[\'\'\] {
|
|
1866
|
+
&::before {
|
|
1867
|
+
content: var(--tw-content);
|
|
1868
|
+
--tw-content: '';
|
|
1869
|
+
content: var(--tw-content);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1838
1872
|
.first\:ms-1 {
|
|
1839
1873
|
&:first-child {
|
|
1840
1874
|
margin-inline-start: calc(var(--spacing) * 1);
|
|
@@ -2441,16 +2475,6 @@
|
|
|
2441
2475
|
--fd-toc-width: 286px;
|
|
2442
2476
|
}
|
|
2443
2477
|
}
|
|
2444
|
-
.\32 xl\:px-12 {
|
|
2445
|
-
@media (width >= 96rem) {
|
|
2446
|
-
padding-inline: calc(var(--spacing) * 12);
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
.\32 xl\:pt-12 {
|
|
2450
|
-
@media (width >= 96rem) {
|
|
2451
|
-
padding-top: calc(var(--spacing) * 12);
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
2478
|
.\@max-lg\:col-span-full {
|
|
2455
2479
|
@container (width < 32rem) {
|
|
2456
2480
|
grid-column: 1 / -1;
|
|
@@ -2478,6 +2502,20 @@
|
|
|
2478
2502
|
background-color: var(--shiki-dark-bg);
|
|
2479
2503
|
}
|
|
2480
2504
|
}
|
|
2505
|
+
.md\:\[\&_\#nd-page_article\]\:pt-12 {
|
|
2506
|
+
@media (width >= 48rem) {
|
|
2507
|
+
& #nd-page article {
|
|
2508
|
+
padding-top: calc(var(--spacing) * 12);
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
.xl\:\[\&_\#nd-page_article\]\:px-8 {
|
|
2513
|
+
@media (width >= 80rem) {
|
|
2514
|
+
& #nd-page article {
|
|
2515
|
+
padding-inline: calc(var(--spacing) * 8);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2481
2519
|
.\[\&_svg\]\:size-3\.5 {
|
|
2482
2520
|
& svg {
|
|
2483
2521
|
width: calc(var(--spacing) * 3.5);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "15.7.
|
|
3
|
+
"version": "15.7.2",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"types": "./dist/layouts/notebook/client.d.ts"
|
|
54
54
|
},
|
|
55
55
|
"./layouts/links": {
|
|
56
|
-
"import": "./dist/layouts/
|
|
57
|
-
"types": "./dist/layouts/
|
|
56
|
+
"import": "./dist/layouts/shared/index.js",
|
|
57
|
+
"types": "./dist/layouts/shared/index.d.ts"
|
|
58
58
|
},
|
|
59
59
|
"./layouts/shared": {
|
|
60
|
-
"import": "./dist/layouts/shared.js",
|
|
61
|
-
"types": "./dist/layouts/shared.d.ts"
|
|
60
|
+
"import": "./dist/layouts/shared/index.js",
|
|
61
|
+
"types": "./dist/layouts/shared/index.d.ts"
|
|
62
62
|
},
|
|
63
63
|
"./page": {
|
|
64
64
|
"node": "./dist/page.server.js",
|
|
@@ -121,20 +121,20 @@
|
|
|
121
121
|
"react-medium-image-zoom": "^5.3.0",
|
|
122
122
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
123
123
|
"tailwind-merge": "^3.3.1",
|
|
124
|
-
"fumadocs-core": "15.7.
|
|
124
|
+
"fumadocs-core": "15.7.2"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"@next/eslint-plugin-next": "^15.5.0",
|
|
128
128
|
"@tailwindcss/cli": "^4.1.12",
|
|
129
129
|
"@types/lodash.merge": "^4.6.9",
|
|
130
|
-
"@types/react": "^19.1.
|
|
130
|
+
"@types/react": "^19.1.11",
|
|
131
131
|
"@types/react-dom": "^19.1.7",
|
|
132
132
|
"next": "15.5.0",
|
|
133
133
|
"tailwindcss": "^4.1.12",
|
|
134
134
|
"tsc-alias": "^1.8.16",
|
|
135
135
|
"@fumadocs/cli": "1.0.0",
|
|
136
136
|
"eslint-config-custom": "0.0.0",
|
|
137
|
-
"fumadocs-core": "15.7.
|
|
137
|
+
"fumadocs-core": "15.7.2",
|
|
138
138
|
"tsconfig": "0.0.0"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { LinkItemType } from '../../layouts/links.js';
|
|
2
|
-
import { type SidebarComponents, type SidebarProps } from '../../components/layout/sidebar.js';
|
|
3
|
-
import type { PageTree } from 'fumadocs-core/server';
|
|
4
|
-
import type { ReactNode } from 'react';
|
|
5
|
-
import type { Option } from '../../components/layout/root-toggle.js';
|
|
6
|
-
import { type GetSidebarTabsOptions } from '../../utils/get-sidebar-tabs.js';
|
|
7
|
-
export interface SidebarOptions extends Pick<SidebarProps, 'defaultOpenLevel' | 'prefetch'> {
|
|
8
|
-
components?: Partial<SidebarComponents>;
|
|
9
|
-
/**
|
|
10
|
-
* Root Toggle options
|
|
11
|
-
*/
|
|
12
|
-
tabs?: Option[] | GetSidebarTabsOptions | false;
|
|
13
|
-
banner?: ReactNode;
|
|
14
|
-
footer?: ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* Support collapsing the sidebar on desktop mode
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue true
|
|
19
|
-
*/
|
|
20
|
-
collapsible?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare function SidebarLinkItem({ item, ...props }: {
|
|
23
|
-
item: LinkItemType;
|
|
24
|
-
className?: string;
|
|
25
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export declare function getSidebarTabsFromOptions(options: SidebarOptions['tabs'], tree: PageTree.Root): Option[] | undefined;
|
|
27
|
-
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,21 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, } from '../../components/layout/sidebar.js';
|
|
3
|
-
import { getSidebarTabs, } from '../../utils/get-sidebar-tabs.js';
|
|
4
|
-
export function SidebarLinkItem({ item, ...props }) {
|
|
5
|
-
if (item.type === 'menu')
|
|
6
|
-
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))) })] }));
|
|
7
|
-
if (item.type === 'custom')
|
|
8
|
-
return _jsx("div", { ...props, children: item.children });
|
|
9
|
-
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
|
|
10
|
-
}
|
|
11
|
-
export function getSidebarTabsFromOptions(options, tree) {
|
|
12
|
-
if (Array.isArray(options)) {
|
|
13
|
-
return options;
|
|
14
|
-
}
|
|
15
|
-
else if (typeof options === 'object') {
|
|
16
|
-
return getSidebarTabs(tree, options);
|
|
17
|
-
}
|
|
18
|
-
else if (options !== false) {
|
|
19
|
-
return getSidebarTabs(tree);
|
|
20
|
-
}
|
|
21
|
-
}
|
package/dist/layouts/links.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
interface BaseItem {
|
|
3
|
-
/**
|
|
4
|
-
* Restrict where the item is displayed
|
|
5
|
-
*
|
|
6
|
-
* @defaultValue 'all'
|
|
7
|
-
*/
|
|
8
|
-
on?: 'menu' | 'nav' | 'all';
|
|
9
|
-
}
|
|
10
|
-
export interface BaseLinkType extends BaseItem {
|
|
11
|
-
url: string;
|
|
12
|
-
/**
|
|
13
|
-
* When the item is marked as active
|
|
14
|
-
*
|
|
15
|
-
* @defaultValue 'url'
|
|
16
|
-
*/
|
|
17
|
-
active?: 'url' | 'nested-url' | 'none';
|
|
18
|
-
external?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface MainItemType extends BaseLinkType {
|
|
21
|
-
type?: 'main';
|
|
22
|
-
icon?: ReactNode;
|
|
23
|
-
text: ReactNode;
|
|
24
|
-
description?: ReactNode;
|
|
25
|
-
}
|
|
26
|
-
export interface IconItemType extends BaseLinkType {
|
|
27
|
-
type: 'icon';
|
|
28
|
-
/**
|
|
29
|
-
* `aria-label` of icon button
|
|
30
|
-
*/
|
|
31
|
-
label?: string;
|
|
32
|
-
icon: ReactNode;
|
|
33
|
-
text: ReactNode;
|
|
34
|
-
/**
|
|
35
|
-
* @defaultValue true
|
|
36
|
-
*/
|
|
37
|
-
secondary?: boolean;
|
|
38
|
-
}
|
|
39
|
-
interface ButtonItem extends BaseLinkType {
|
|
40
|
-
type: 'button';
|
|
41
|
-
icon?: ReactNode;
|
|
42
|
-
text: ReactNode;
|
|
43
|
-
/**
|
|
44
|
-
* @defaultValue false
|
|
45
|
-
*/
|
|
46
|
-
secondary?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface MenuItemType extends BaseItem {
|
|
49
|
-
type: 'menu';
|
|
50
|
-
icon?: ReactNode;
|
|
51
|
-
text: ReactNode;
|
|
52
|
-
url?: string;
|
|
53
|
-
items: ((MainItemType & {
|
|
54
|
-
/**
|
|
55
|
-
* Options when displayed on navigation menu
|
|
56
|
-
*/
|
|
57
|
-
menu?: HTMLAttributes<HTMLElement> & {
|
|
58
|
-
banner?: ReactNode;
|
|
59
|
-
};
|
|
60
|
-
}) | CustomItem)[];
|
|
61
|
-
/**
|
|
62
|
-
* @defaultValue false
|
|
63
|
-
*/
|
|
64
|
-
secondary?: boolean;
|
|
65
|
-
}
|
|
66
|
-
interface CustomItem extends BaseItem {
|
|
67
|
-
type: 'custom';
|
|
68
|
-
/**
|
|
69
|
-
* @defaultValue false
|
|
70
|
-
*/
|
|
71
|
-
secondary?: boolean;
|
|
72
|
-
children: ReactNode;
|
|
73
|
-
}
|
|
74
|
-
export type LinkItemType = MainItemType | IconItemType | ButtonItem | MenuItemType | CustomItem;
|
|
75
|
-
export declare const BaseLinkItem: import("react").ForwardRefExoticComponent<Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
|
|
76
|
-
item: BaseLinkType;
|
|
77
|
-
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
78
|
-
export {};
|
|
79
|
-
//# sourceMappingURL=links.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,UAAW,SAAQ,YAAY;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CACH,CAAC,YAAY,GAAG;QACd;;WAEG;QACH,IAAI,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;YACnC,MAAM,CAAC,EAAE,SAAS,CAAC;SACpB,CAAC;KACH,CAAC,GACF,UAAU,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"}
|
package/dist/layouts/shared.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { LinkItemType } from '../layouts/links.js';
|
|
3
|
-
import type { NavProviderProps } from '../contexts/layout.js';
|
|
4
|
-
import type { I18nConfig } from 'fumadocs-core/i18n';
|
|
5
|
-
export interface NavOptions extends NavProviderProps {
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
component: ReactNode;
|
|
8
|
-
title?: ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* Redirect url of title
|
|
11
|
-
* @defaultValue '/'
|
|
12
|
-
*/
|
|
13
|
-
url?: string;
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export interface BaseLayoutProps {
|
|
17
|
-
themeSwitch?: {
|
|
18
|
-
enabled?: boolean;
|
|
19
|
-
component?: ReactNode;
|
|
20
|
-
mode?: 'light-dark' | 'light-dark-system';
|
|
21
|
-
};
|
|
22
|
-
searchToggle?: Partial<{
|
|
23
|
-
enabled: boolean;
|
|
24
|
-
components: Partial<{
|
|
25
|
-
sm: ReactNode;
|
|
26
|
-
lg: ReactNode;
|
|
27
|
-
}>;
|
|
28
|
-
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Remove theme switcher component
|
|
31
|
-
*
|
|
32
|
-
* @deprecated Use `themeSwitch.enabled` instead.
|
|
33
|
-
*/
|
|
34
|
-
disableThemeSwitch?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* I18n options
|
|
37
|
-
*
|
|
38
|
-
* @defaultValue false
|
|
39
|
-
*/
|
|
40
|
-
i18n?: boolean | I18nConfig;
|
|
41
|
-
/**
|
|
42
|
-
* GitHub url
|
|
43
|
-
*/
|
|
44
|
-
githubUrl?: string;
|
|
45
|
-
links?: LinkItemType[];
|
|
46
|
-
/**
|
|
47
|
-
* Replace or disable navbar
|
|
48
|
-
*/
|
|
49
|
-
nav?: Partial<NavOptions>;
|
|
50
|
-
children?: ReactNode;
|
|
51
|
-
}
|
|
52
|
-
export { type LinkItemType };
|
|
53
|
-
/**
|
|
54
|
-
* Get Links Items with shortcuts
|
|
55
|
-
*/
|
|
56
|
-
export declare function getLinks(links?: LinkItemType[], githubUrl?: string): LinkItemType[];
|
|
57
|
-
//# sourceMappingURL=shared.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