fumadocs-ui 16.0.15 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/black.css +1 -1
- package/css/catppuccin.css +1 -1
- package/css/colors/index.css +51 -0
- package/css/dusk.css +1 -1
- package/css/layouts/docs.css +1 -0
- package/css/layouts/home.css +1 -0
- package/css/layouts/notebook.css +1 -0
- package/css/neutral.css +1 -40
- package/css/ocean.css +1 -1
- package/css/preset.css +21 -28
- package/css/purple.css +1 -1
- package/css/shadcn.css +0 -2
- package/css/shiki.css +1 -3
- package/css/solar.css +49 -18
- package/css/vitepress.css +1 -1
- package/dist/components/image-zoom.d.ts +3 -3
- package/dist/components/image-zoom.d.ts.map +1 -1
- package/dist/components/image-zoom.js +1 -1
- package/dist/components/sidebar/base.d.ts +62 -0
- package/dist/components/sidebar/base.d.ts.map +1 -0
- package/dist/components/sidebar/base.js +174 -0
- package/dist/components/sidebar/link-item.d.ts +11 -0
- package/dist/components/sidebar/link-item.d.ts.map +1 -0
- package/dist/components/sidebar/link-item.js +13 -0
- package/dist/components/sidebar/page-tree.d.ts +19 -0
- package/dist/components/sidebar/page-tree.d.ts.map +1 -0
- package/dist/components/sidebar/page-tree.js +34 -0
- package/dist/components/{layout/root-toggle.d.ts → sidebar/tabs.d.ts} +4 -4
- package/dist/components/sidebar/tabs.d.ts.map +1 -0
- package/dist/components/{layout/root-toggle.js → sidebar/tabs.js} +3 -3
- package/dist/components/tabs.unstyled.d.ts +0 -3
- package/dist/components/tabs.unstyled.d.ts.map +1 -1
- package/dist/components/tabs.unstyled.js +23 -32
- package/dist/components/toc/clerk.d.ts +3 -0
- package/dist/components/toc/clerk.d.ts.map +1 -0
- package/dist/components/{layout/toc-clerk.js → toc/clerk.js} +5 -6
- package/dist/components/toc/default.d.ts +3 -0
- package/dist/components/toc/default.d.ts.map +1 -0
- package/dist/components/{layout/toc.js → toc/default.js} +5 -16
- package/dist/components/{layout/toc.d.ts → toc/index.d.ts} +7 -3
- package/dist/components/toc/index.d.ts.map +1 -0
- package/dist/components/{layout/toc-thumb.js → toc/index.js} +17 -3
- package/dist/contexts/search.js +1 -1
- package/dist/contexts/tree.d.ts +1 -1
- package/dist/contexts/tree.d.ts.map +1 -1
- package/dist/contexts/tree.js +3 -3
- package/dist/layouts/docs/client.d.ts +12 -5
- package/dist/layouts/docs/client.d.ts.map +1 -1
- package/dist/layouts/docs/client.js +31 -22
- package/dist/layouts/docs/index.d.ts +9 -9
- package/dist/layouts/docs/index.d.ts.map +1 -1
- package/dist/layouts/docs/index.js +37 -48
- package/dist/layouts/docs/{page-client.d.ts → page/client.d.ts} +3 -4
- package/dist/layouts/docs/page/client.d.ts.map +1 -0
- package/dist/layouts/docs/{page-client.js → page/client.js} +39 -76
- package/dist/layouts/docs/page/index.d.ts +58 -0
- package/dist/layouts/docs/page/index.d.ts.map +1 -0
- package/dist/layouts/docs/page/index.js +51 -0
- package/dist/layouts/docs/sidebar.d.ts +17 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +82 -0
- package/dist/layouts/home/client.d.ts +2 -20
- package/dist/layouts/home/client.d.ts.map +1 -1
- package/dist/layouts/home/client.js +54 -17
- package/dist/layouts/home/index.d.ts +2 -3
- package/dist/layouts/home/index.d.ts.map +1 -1
- package/dist/layouts/home/index.js +3 -35
- package/dist/layouts/notebook/client.d.ts +20 -8
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js +59 -33
- package/dist/layouts/notebook/index.d.ts +9 -9
- package/dist/layouts/notebook/index.d.ts.map +1 -1
- package/dist/layouts/notebook/index.js +47 -70
- package/dist/layouts/notebook/page/client.d.ts +24 -0
- package/dist/layouts/notebook/page/client.d.ts.map +1 -0
- package/dist/layouts/notebook/page/client.js +119 -0
- package/dist/layouts/notebook/page/index.d.ts +58 -0
- package/dist/layouts/notebook/page/index.d.ts.map +1 -0
- package/dist/layouts/notebook/page/index.js +51 -0
- package/dist/layouts/notebook/sidebar.d.ts +17 -0
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -0
- package/dist/layouts/notebook/sidebar.js +87 -0
- package/dist/layouts/shared/index.d.ts +12 -78
- package/dist/layouts/shared/index.d.ts.map +1 -1
- package/dist/layouts/shared/index.js +11 -15
- package/dist/layouts/shared/language-toggle.d.ts +5 -0
- package/dist/layouts/shared/language-toggle.d.ts.map +1 -0
- package/dist/layouts/shared/link-item.d.ts +78 -0
- package/dist/layouts/shared/link-item.d.ts.map +1 -0
- package/dist/layouts/shared/{client.js → link-item.js} +1 -1
- package/dist/layouts/shared/search-toggle.d.ts.map +1 -0
- package/dist/{components/layout → layouts/shared}/theme-toggle.d.ts +2 -2
- package/dist/layouts/shared/theme-toggle.d.ts.map +1 -0
- package/dist/{components/layout → layouts/shared}/theme-toggle.js +3 -3
- package/dist/page.d.ts +6 -59
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +16 -50
- package/dist/provider/base.d.ts.map +1 -1
- package/dist/provider/base.js +2 -3
- package/dist/style.css +187 -160
- package/dist/utils/use-footer-items.d.ts +6 -0
- package/dist/utils/use-footer-items.d.ts.map +1 -0
- package/dist/utils/use-footer-items.js +27 -0
- package/dist/utils/use-is-scroll-top.d.ts +4 -0
- package/dist/utils/use-is-scroll-top.d.ts.map +1 -0
- package/dist/utils/use-is-scroll-top.js +17 -0
- package/package.json +9 -22
- package/css/default.css +0 -34
- package/dist/components/layout/language-toggle.d.ts +0 -5
- package/dist/components/layout/language-toggle.d.ts.map +0 -1
- package/dist/components/layout/root-toggle.d.ts.map +0 -1
- package/dist/components/layout/search-toggle.d.ts.map +0 -1
- package/dist/components/layout/sidebar.d.ts +0 -66
- package/dist/components/layout/sidebar.d.ts.map +0 -1
- package/dist/components/layout/sidebar.js +0 -200
- package/dist/components/layout/theme-toggle.d.ts.map +0 -1
- package/dist/components/layout/toc-clerk.d.ts +0 -3
- package/dist/components/layout/toc-clerk.d.ts.map +0 -1
- package/dist/components/layout/toc-thumb.d.ts +0 -7
- package/dist/components/layout/toc-thumb.d.ts.map +0 -1
- package/dist/components/layout/toc.d.ts.map +0 -1
- package/dist/contexts/layout.d.ts +0 -28
- package/dist/contexts/layout.d.ts.map +0 -1
- package/dist/contexts/layout.js +0 -38
- package/dist/contexts/sidebar.d.ts +0 -18
- package/dist/contexts/sidebar.d.ts.map +0 -1
- package/dist/contexts/sidebar.js +0 -31
- package/dist/layouts/docs/page-client.d.ts.map +0 -1
- package/dist/layouts/docs/page.d.ts +0 -17
- package/dist/layouts/docs/page.d.ts.map +0 -1
- package/dist/layouts/docs/page.js +0 -26
- package/dist/layouts/shared/client.d.ts +0 -6
- package/dist/layouts/shared/client.d.ts.map +0 -1
- package/dist/provider/index.d.ts +0 -11
- package/dist/provider/index.d.ts.map +0 -1
- package/dist/provider/index.js +0 -12
- /package/dist/{components/layout → layouts/shared}/language-toggle.js +0 -0
- /package/dist/{components/layout → layouts/shared}/search-toggle.d.ts +0 -0
- /package/dist/{components/layout → layouts/shared}/search-toggle.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/layouts/notebook/page/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EASpB,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAiBlC,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,KAAK,CAAC,2CAqDvB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAqD1B;AA4DD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAUjE;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAiBxD;AAED,KAAK,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC,CAAC;AAChE,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,KAAK,CAAC;IACxD;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,IAAI,CAAC;KACb,CAAC;CACH;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CA8B1D;AA8BD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExE,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,GAAG,KAAK,EACT,EAAE,eAAe,kDA6CjB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, useEffect, useEffectEvent, createContext, useMemo, useRef, useState, use, } from 'react';
|
|
4
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from '../../../icons.js';
|
|
5
|
+
import Link from 'fumadocs-core/link';
|
|
6
|
+
import { cn } from '../../../utils/cn.js';
|
|
7
|
+
import { useI18n } from '../../../contexts/i18n.js';
|
|
8
|
+
import { useTreeContext, useTreePath } from '../../../contexts/tree.js';
|
|
9
|
+
import { usePathname } from 'fumadocs-core/framework';
|
|
10
|
+
import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
|
|
11
|
+
import { isActive } from '../../../utils/is-active.js';
|
|
12
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../../../components/ui/collapsible.js';
|
|
13
|
+
import { useTOCItems } from '../../../components/toc/index.js';
|
|
14
|
+
import { useActiveAnchor } from 'fumadocs-core/toc';
|
|
15
|
+
import { LayoutContext } from '../client.js';
|
|
16
|
+
import { useFooterItems } from '../../../utils/use-footer-items.js';
|
|
17
|
+
const TocPopoverContext = createContext(null);
|
|
18
|
+
export function PageTOCPopover({ className, children, ...rest }) {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const { isNavTransparent } = use(LayoutContext);
|
|
22
|
+
const onClick = useEffectEvent((e) => {
|
|
23
|
+
if (!open)
|
|
24
|
+
return;
|
|
25
|
+
if (ref.current && !ref.current.contains(e.target))
|
|
26
|
+
setOpen(false);
|
|
27
|
+
});
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
window.addEventListener('click', onClick);
|
|
30
|
+
return () => {
|
|
31
|
+
window.removeEventListener('click', onClick);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
return (_jsx(TocPopoverContext, { value: useMemo(() => ({
|
|
35
|
+
open,
|
|
36
|
+
setOpen,
|
|
37
|
+
}), [setOpen, open]), children: _jsx(Collapsible, { open: open, onOpenChange: setOpen, "data-toc-popover": "", className: cn('sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]', className), ...rest, children: _jsx("header", { ref: ref, className: cn('border-b backdrop-blur-sm transition-colors', (!isNavTransparent || open) && 'bg-fd-background/80', open && 'shadow-lg'), children: children }) }) }));
|
|
38
|
+
}
|
|
39
|
+
export function PageTOCPopoverTrigger({ className, ...props }) {
|
|
40
|
+
const { text } = useI18n();
|
|
41
|
+
const { open } = use(TocPopoverContext);
|
|
42
|
+
const items = useTOCItems();
|
|
43
|
+
const active = useActiveAnchor();
|
|
44
|
+
const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
|
|
45
|
+
const path = useTreePath().at(-1);
|
|
46
|
+
const showItem = selected !== -1 && !open;
|
|
47
|
+
return (_jsxs(CollapsibleTrigger, { className: cn('flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6', className), "data-toc-popover-trigger": "", ...props, children: [_jsx(ProgressCircle, { value: (selected + 1) / Math.max(1, items.length), max: 1, className: cn('shrink-0', open && 'text-fd-primary') }), _jsxs("span", { className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1", children: [_jsx("span", { className: cn('truncate transition-all', open && 'text-fd-foreground', showItem && 'opacity-0 -translate-y-full pointer-events-none'), children: path?.name ?? text.toc }), _jsx("span", { className: cn('truncate transition-all', !showItem && 'opacity-0 translate-y-full pointer-events-none'), children: items[selected]?.title })] }), _jsx(ChevronDown, { className: cn('shrink-0 transition-transform mx-0.5', open && 'rotate-180') })] }));
|
|
48
|
+
}
|
|
49
|
+
function clamp(input, min, max) {
|
|
50
|
+
if (input < min)
|
|
51
|
+
return min;
|
|
52
|
+
if (input > max)
|
|
53
|
+
return max;
|
|
54
|
+
return input;
|
|
55
|
+
}
|
|
56
|
+
function ProgressCircle({ value, strokeWidth = 2, size = 24, min = 0, max = 100, ...restSvgProps }) {
|
|
57
|
+
const normalizedValue = clamp(value, min, max);
|
|
58
|
+
const radius = (size - strokeWidth) / 2;
|
|
59
|
+
const circumference = 2 * Math.PI * radius;
|
|
60
|
+
const progress = (normalizedValue / max) * circumference;
|
|
61
|
+
const circleProps = {
|
|
62
|
+
cx: size / 2,
|
|
63
|
+
cy: size / 2,
|
|
64
|
+
r: radius,
|
|
65
|
+
fill: 'none',
|
|
66
|
+
strokeWidth,
|
|
67
|
+
};
|
|
68
|
+
return (_jsxs("svg", { role: "progressbar", viewBox: `0 0 ${size} ${size}`, "aria-valuenow": normalizedValue, "aria-valuemin": min, "aria-valuemax": max, ...restSvgProps, children: [_jsx("circle", { ...circleProps, className: "stroke-current/25" }), _jsx("circle", { ...circleProps, stroke: "currentColor", strokeDasharray: circumference, strokeDashoffset: circumference - progress, strokeLinecap: "round", transform: `rotate(-90 ${size / 2} ${size / 2})`, className: "transition-all" })] }));
|
|
69
|
+
}
|
|
70
|
+
export function PageTOCPopoverContent(props) {
|
|
71
|
+
return (_jsx(CollapsibleContent, { "data-toc-popover-content": "", ...props, className: cn('flex flex-col px-4 max-h-[50vh] md:px-6', props.className), children: props.children }));
|
|
72
|
+
}
|
|
73
|
+
export function PageLastUpdate({ date: value, ...props }) {
|
|
74
|
+
const { text } = useI18n();
|
|
75
|
+
const [date, setDate] = useState('');
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
// to the timezone of client
|
|
78
|
+
setDate(value.toLocaleDateString());
|
|
79
|
+
}, [value]);
|
|
80
|
+
return (_jsxs("p", { ...props, className: cn('text-sm text-fd-muted-foreground', props.className), children: [text.lastUpdate, " ", date] }));
|
|
81
|
+
}
|
|
82
|
+
export function PageFooter({ items, ...props }) {
|
|
83
|
+
const footerList = useFooterItems();
|
|
84
|
+
const pathname = usePathname();
|
|
85
|
+
const { previous, next } = useMemo(() => {
|
|
86
|
+
if (items)
|
|
87
|
+
return items;
|
|
88
|
+
const idx = footerList.findIndex((item) => isActive(item.url, pathname, false));
|
|
89
|
+
if (idx === -1)
|
|
90
|
+
return {};
|
|
91
|
+
return {
|
|
92
|
+
previous: footerList[idx - 1],
|
|
93
|
+
next: footerList[idx + 1],
|
|
94
|
+
};
|
|
95
|
+
}, [footerList, items, pathname]);
|
|
96
|
+
return (_jsxs("div", { ...props, className: cn('@container grid gap-4', previous && next ? 'grid-cols-2' : 'grid-cols-1', props.className), children: [previous ? _jsx(FooterItem, { item: previous, index: 0 }) : null, next ? _jsx(FooterItem, { item: next, index: 1 }) : null] }));
|
|
97
|
+
}
|
|
98
|
+
function FooterItem({ item, index }) {
|
|
99
|
+
const { text } = useI18n();
|
|
100
|
+
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
101
|
+
return (_jsxs(Link, { href: item.url, className: cn('flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full', index === 1 && 'text-end'), children: [_jsxs("div", { className: cn('inline-flex items-center gap-1.5 font-medium', index === 1 && 'flex-row-reverse'), children: [_jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), _jsx("p", { children: item.name })] }), _jsx("p", { className: "text-fd-muted-foreground truncate", children: item.description ?? (index === 0 ? text.previousPage : text.nextPage) })] }));
|
|
102
|
+
}
|
|
103
|
+
export function PageBreadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
104
|
+
const path = useTreePath();
|
|
105
|
+
const { root } = useTreeContext();
|
|
106
|
+
const items = useMemo(() => {
|
|
107
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
108
|
+
includePage,
|
|
109
|
+
includeSeparator,
|
|
110
|
+
includeRoot,
|
|
111
|
+
});
|
|
112
|
+
}, [includePage, includeRoot, includeSeparator, path, root]);
|
|
113
|
+
if (items.length === 0)
|
|
114
|
+
return null;
|
|
115
|
+
return (_jsx("div", { ...props, className: cn('flex items-center gap-1.5 text-sm text-fd-muted-foreground', props.className), children: items.map((item, i) => {
|
|
116
|
+
const className = cn('truncate', i === items.length - 1 && 'text-fd-primary font-medium');
|
|
117
|
+
return (_jsxs(Fragment, { children: [i !== 0 && _jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? (_jsx(Link, { href: item.url, className: cn(className, 'transition-opacity hover:opacity-80'), children: item.name })) : (_jsx("span", { className: className, children: item.name }))] }, i));
|
|
118
|
+
}) }));
|
|
119
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { type BreadcrumbProps, type FooterProps } from './client.js';
|
|
3
|
+
import type { AnchorProviderProps, TOCItemType } from 'fumadocs-core/toc';
|
|
4
|
+
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
component: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface FooterOptions extends FooterProps {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
component: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface DocsPageProps {
|
|
13
|
+
toc?: TOCItemType[];
|
|
14
|
+
tableOfContent?: Partial<TableOfContentOptions>;
|
|
15
|
+
tableOfContentPopover?: Partial<TableOfContentPopoverOptions>;
|
|
16
|
+
/**
|
|
17
|
+
* Extend the page to fill all available space
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue false
|
|
20
|
+
*/
|
|
21
|
+
full?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Replace or disable breadcrumb
|
|
24
|
+
*/
|
|
25
|
+
breadcrumb?: Partial<BreadcrumbOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Footer navigation, you can disable it by passing `false`
|
|
28
|
+
*/
|
|
29
|
+
footer?: Partial<FooterOptions>;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
type TableOfContentOptions = Pick<AnchorProviderProps, 'single'> & {
|
|
33
|
+
/**
|
|
34
|
+
* Custom content in TOC container, before the main TOC
|
|
35
|
+
*/
|
|
36
|
+
header?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Custom content in TOC container, after the main TOC
|
|
39
|
+
*/
|
|
40
|
+
footer?: ReactNode;
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
component: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* @defaultValue 'normal'
|
|
45
|
+
*/
|
|
46
|
+
style?: 'normal' | 'clerk';
|
|
47
|
+
};
|
|
48
|
+
type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
|
|
49
|
+
export declare function DocsPage({ breadcrumb: { enabled: breadcrumbEnabled, component: breadcrumb, ...breadcrumbProps }, footer, full, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, toc, children, }: DocsPageProps): ReactNode;
|
|
50
|
+
export declare function EditOnGitHub(props: ComponentProps<'a'>): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Add typography styles
|
|
53
|
+
*/
|
|
54
|
+
export declare function DocsBody({ children, className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export declare function DocsDescription({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element | null;
|
|
56
|
+
export declare function DocsTitle({ children, className, ...props }: ComponentProps<'h1'>): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export { PageLastUpdate, PageBreadcrumb } from './client.js';
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layouts/notebook/page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAMjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAK1E,UAAU,iBAAkB,SAAQ,eAAe;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,aAAc,SAAQ,WAAW;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChD,qBAAqB,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAE9D;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG;IACjE;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,4BAA4B,GAAG,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAE1E,wBAAgB,QAAQ,CAAC,EACvB,UAAU,EAAE,EACV,OAAO,EAAE,iBAAwB,EACjC,SAAS,EAAE,UAAU,EACrB,GAAG,eAAe,EACd,EACN,MAAW,EACX,IAAY,EACZ,qBAAqB,EAAE,EACrB,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,UAAU,EACrB,GAAG,iBAAiB,EAChB,EACN,cAAc,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,UAAU,EACT,EACN,GAAQ,EACR,QAAQ,GACT,EAAE,aAAa,aAkFf;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAuBtD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,2CAMvB;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,kDAYrB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,IAAI,CAAC,2CAMtB;AAED,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import { buttonVariants } from '../../../components/ui/button.js';
|
|
4
|
+
import { Edit, Text } from '../../../icons.js';
|
|
5
|
+
import { I18nLabel } from '../../../contexts/i18n.js';
|
|
6
|
+
import { PageBreadcrumb, PageFooter, PageTOCPopover, PageTOCPopoverContent, PageTOCPopoverTrigger, } from './client.js';
|
|
7
|
+
import * as TocDefault from '../../../components/toc/default.js';
|
|
8
|
+
import * as TocClerk from '../../../components/toc/clerk.js';
|
|
9
|
+
import { TOCProvider, TOCScrollArea } from '../../../components/toc/index.js';
|
|
10
|
+
export function DocsPage({ breadcrumb: { enabled: breadcrumbEnabled = true, component: breadcrumb, ...breadcrumbProps } = {}, footer = {}, full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, toc = [], children, }) {
|
|
11
|
+
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
12
|
+
tocEnabled ?? (tocEnabled = !full &&
|
|
13
|
+
(toc.length > 0 ||
|
|
14
|
+
tocOptions.footer !== undefined ||
|
|
15
|
+
tocOptions.header !== undefined));
|
|
16
|
+
tocPopoverEnabled ?? (tocPopoverEnabled = toc.length > 0 ||
|
|
17
|
+
tocPopoverOptions.header !== undefined ||
|
|
18
|
+
tocPopoverOptions.footer !== undefined);
|
|
19
|
+
let wrapper = (children) => children;
|
|
20
|
+
if (tocEnabled || tocPopoverEnabled) {
|
|
21
|
+
wrapper = (children) => (_jsx(TOCProvider, { single: tocOptions.single, toc: toc, children: children }));
|
|
22
|
+
}
|
|
23
|
+
return wrapper(_jsxs(_Fragment, { children: [tocPopoverEnabled &&
|
|
24
|
+
(tocPopover ?? (_jsxs(PageTOCPopover, { children: [_jsx(PageTOCPopoverTrigger, {}), _jsxs(PageTOCPopoverContent, { children: [tocPopoverOptions.header, _jsx(TOCScrollArea, { children: tocPopoverOptions.style === 'clerk' ? (_jsx(TocClerk.TOCItems, {})) : (_jsx(TocDefault.TOCItems, {})) }), tocPopoverOptions.footer] })] }))), _jsxs("article", { id: "nd-page", "data-full": full, className: cn('flex flex-col [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14 *:max-w-[900px]', full && '*:max-w-[1285px]'), children: [breadcrumbEnabled &&
|
|
25
|
+
(breadcrumb ?? _jsx(PageBreadcrumb, { ...breadcrumbProps })), children, footer.enabled !== false &&
|
|
26
|
+
(footer.component ?? _jsx(PageFooter, { items: footer.items }))] }), tocEnabled &&
|
|
27
|
+
(tocReplace ?? (_jsxs("div", { id: "nd-toc", className: "sticky top-(--fd-docs-row-3) [grid-area:toc] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] flex flex-col w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", children: [tocOptions.header, _jsxs("h3", { id: "toc-title", className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), _jsx(TOCScrollArea, { children: tocOptions.style === 'clerk' ? (_jsx(TocClerk.TOCItems, {})) : (_jsx(TocDefault.TOCItems, {})) }), tocOptions.footer] })))] }));
|
|
28
|
+
}
|
|
29
|
+
export function EditOnGitHub(props) {
|
|
30
|
+
return (_jsx("a", { target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
|
|
31
|
+
color: 'secondary',
|
|
32
|
+
size: 'sm',
|
|
33
|
+
className: 'gap-1.5 not-prose',
|
|
34
|
+
}), props.className), children: props.children ?? (_jsxs(_Fragment, { children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] })) }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Add typography styles
|
|
38
|
+
*/
|
|
39
|
+
export function DocsBody({ children, className, ...props }) {
|
|
40
|
+
return (_jsx("div", { ...props, className: cn('prose flex-1', className), children: children }));
|
|
41
|
+
}
|
|
42
|
+
export function DocsDescription({ children, className, ...props }) {
|
|
43
|
+
// Don't render if no description provided
|
|
44
|
+
if (children === undefined)
|
|
45
|
+
return null;
|
|
46
|
+
return (_jsx("p", { ...props, className: cn('mb-8 text-lg text-fd-muted-foreground', className), children: children }));
|
|
47
|
+
}
|
|
48
|
+
export function DocsTitle({ children, className, ...props }) {
|
|
49
|
+
return (_jsx("h1", { ...props, className: cn('text-[1.75em] font-semibold', className), children: children }));
|
|
50
|
+
}
|
|
51
|
+
export { PageLastUpdate, PageBreadcrumb } from './client.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Base from '../../components/sidebar/base.js';
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
|
+
export declare const Sidebar: typeof Base.SidebarProvider, SidebarFolder: typeof Base.SidebarFolder, SidebarCollapseTrigger: typeof Base.SidebarCollapseTrigger, SidebarViewport: typeof Base.SidebarViewport, SidebarTrigger: typeof Base.SidebarTrigger;
|
|
4
|
+
export declare function SidebarContent({ className, children, ...props }: ComponentProps<'aside'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function SidebarDrawer({ children, className, ...props }: ComponentProps<typeof Base.SidebarDrawerContent>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function SidebarSeparator({ className, style, children, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SidebarItem({ className, style, children, ...props }: ComponentProps<typeof Base.SidebarItem>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function SidebarFolderTrigger({ className, style, ...props }: ComponentProps<typeof Base.SidebarFolderTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SidebarFolderLink({ className, style, ...props }: ComponentProps<typeof Base.SidebarFolderLink>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function SidebarFolderContent({ className, children, ...props }: ComponentProps<typeof Base.SidebarFolderContent>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const SidebarPageTree: (components: Partial<import("../../components/sidebar/page-tree.js").SidebarPageTreeComponents>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const SidebarLinkItem: ({ item, ...props }: import("react").HTMLAttributes<HTMLElement> & {
|
|
13
|
+
item: Exclude<import("../shared/index.js").LinkItemType, {
|
|
14
|
+
type: "icon";
|
|
15
|
+
}>;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,KAAK,cAAc,EAAO,MAAM,OAAO,CAAC;AAqBjD,eAAO,MACY,OAAO,+BACxB,aAAa,6BACb,sBAAsB,sCACtB,eAAe,+BACf,cAAc,4BACR,CAAC;AAET,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,CAAC,2CA0BzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,2CAelD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAerB;AAED,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,2CAezC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,2CAelD;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,iBAAiB,CAAC,2CAe/C;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,2CAkBlD;AACD,eAAO,MAAM,eAAe,sIAO1B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;6CAM1B,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Base from '../../components/sidebar/base.js';
|
|
4
|
+
import { cn } from '../../utils/cn.js';
|
|
5
|
+
import { use } from 'react';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { LayoutContext } from './client.js';
|
|
8
|
+
import { createPageTreeRenderer } from '../../components/sidebar/page-tree.js';
|
|
9
|
+
import { createLinkItemRenderer } from '../../components/sidebar/link-item.js';
|
|
10
|
+
const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
link: 'data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
function getItemOffset(depth) {
|
|
18
|
+
return `calc(${2 + 3 * depth} * var(--spacing))`;
|
|
19
|
+
}
|
|
20
|
+
export const { SidebarProvider: Sidebar, SidebarFolder, SidebarCollapseTrigger, SidebarViewport, SidebarTrigger, } = Base;
|
|
21
|
+
export function SidebarContent({ className, children, ...props }) {
|
|
22
|
+
const { navMode } = use(LayoutContext);
|
|
23
|
+
return (_jsx(Base.SidebarContent, { aside: ({ collapsed, hovered }) => ({
|
|
24
|
+
className: cn('sticky [grid-area:sidebar] flex flex-col items-end z-20 text-sm *:w-(--fd-sidebar-width) md:layout:[--fd-sidebar-width:268px] max-md:hidden', (navMode === 'auto' || collapsed) &&
|
|
25
|
+
'data-[collapsed=true]:bg-fd-card data-[collapsed=true]:border-e', navMode === 'auto'
|
|
26
|
+
? 'top-(--fd-docs-row-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))]'
|
|
27
|
+
: 'top-(--fd-docs-row-2) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-2))]', collapsed && [
|
|
28
|
+
'fixed start-0 inset-y-2 h-auto rounded-xl border transition-[opacity,translate] duration-200',
|
|
29
|
+
hovered
|
|
30
|
+
? 'z-50 shadow-lg translate-x-2 rtl:-translate-x-2'
|
|
31
|
+
: 'opacity-0 -translate-x-[calc(100%-16px)] rtl:translate-x-[calc(100%-16px)]',
|
|
32
|
+
], className),
|
|
33
|
+
}), ...props, children: children }));
|
|
34
|
+
}
|
|
35
|
+
export function SidebarDrawer({ children, className, ...props }) {
|
|
36
|
+
return (_jsxs(_Fragment, { children: [_jsx(Base.SidebarDrawerOverlay, { className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), _jsx(Base.SidebarDrawerContent, { className: cn('fixed text-[0.9375rem] flex flex-col shadow-lg border-s end-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out', className), ...props, children: children })] }));
|
|
37
|
+
}
|
|
38
|
+
export function SidebarSeparator({ className, style, children, ...props }) {
|
|
39
|
+
const depth = Base.useFolderDepth();
|
|
40
|
+
return (_jsx(Base.SidebarSeparator, { className: cn('[&_svg]:size-4 [&_svg]:shrink-0', className), style: {
|
|
41
|
+
paddingInlineStart: getItemOffset(depth),
|
|
42
|
+
...style,
|
|
43
|
+
}, ...props, children: children }));
|
|
44
|
+
}
|
|
45
|
+
export function SidebarItem({ className, style, children, ...props }) {
|
|
46
|
+
const depth = Base.useFolderDepth();
|
|
47
|
+
return (_jsx(Base.SidebarItem, { className: cn(itemVariants({ variant: 'link' }), className), style: {
|
|
48
|
+
paddingInlineStart: getItemOffset(depth),
|
|
49
|
+
...style,
|
|
50
|
+
}, ...props, children: children }));
|
|
51
|
+
}
|
|
52
|
+
export function SidebarFolderTrigger({ className, style, ...props }) {
|
|
53
|
+
const depth = Base.useFolderDepth();
|
|
54
|
+
return (_jsx(Base.SidebarFolderTrigger, { className: cn(itemVariants(), 'w-full', className), style: {
|
|
55
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
56
|
+
...style,
|
|
57
|
+
}, ...props, children: props.children }));
|
|
58
|
+
}
|
|
59
|
+
export function SidebarFolderLink({ className, style, ...props }) {
|
|
60
|
+
const depth = Base.useFolderDepth();
|
|
61
|
+
return (_jsx(Base.SidebarFolderLink, { className: cn(itemVariants({ variant: 'link' }), 'w-full', className), style: {
|
|
62
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
63
|
+
...style,
|
|
64
|
+
}, ...props, children: props.children }));
|
|
65
|
+
}
|
|
66
|
+
export function SidebarFolderContent({ className, children, ...props }) {
|
|
67
|
+
const depth = Base.useFolderDepth();
|
|
68
|
+
return (_jsx(Base.SidebarFolderContent, { className: cn('relative', depth === 1 && [
|
|
69
|
+
"before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5",
|
|
70
|
+
"**: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",
|
|
71
|
+
], className), ...props, children: children }));
|
|
72
|
+
}
|
|
73
|
+
export const SidebarPageTree = createPageTreeRenderer({
|
|
74
|
+
SidebarFolder,
|
|
75
|
+
SidebarFolderContent,
|
|
76
|
+
SidebarFolderLink,
|
|
77
|
+
SidebarFolderTrigger,
|
|
78
|
+
SidebarItem,
|
|
79
|
+
SidebarSeparator,
|
|
80
|
+
});
|
|
81
|
+
export const SidebarLinkItem = createLinkItemRenderer({
|
|
82
|
+
SidebarFolder,
|
|
83
|
+
SidebarFolderContent,
|
|
84
|
+
SidebarFolderLink,
|
|
85
|
+
SidebarFolderTrigger,
|
|
86
|
+
SidebarItem,
|
|
87
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { NavProviderProps } from '../../contexts/layout.js';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
3
2
|
import type { I18nConfig } from 'fumadocs-core/i18n';
|
|
4
|
-
|
|
3
|
+
import type { LinkItemType } from './link-item.js';
|
|
4
|
+
export interface NavOptions {
|
|
5
5
|
enabled: boolean;
|
|
6
6
|
component: ReactNode;
|
|
7
7
|
title?: ReactNode;
|
|
@@ -10,6 +10,12 @@ export interface NavOptions extends NavProviderProps {
|
|
|
10
10
|
* @defaultValue '/'
|
|
11
11
|
*/
|
|
12
12
|
url?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Use transparent background
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue none
|
|
17
|
+
*/
|
|
18
|
+
transparentMode?: 'always' | 'top' | 'none';
|
|
13
19
|
children?: ReactNode;
|
|
14
20
|
}
|
|
15
21
|
export interface BaseLayoutProps {
|
|
@@ -42,81 +48,9 @@ export interface BaseLayoutProps {
|
|
|
42
48
|
nav?: Partial<NavOptions>;
|
|
43
49
|
children?: ReactNode;
|
|
44
50
|
}
|
|
45
|
-
interface BaseItem {
|
|
46
|
-
/**
|
|
47
|
-
* Restrict where the item is displayed
|
|
48
|
-
*
|
|
49
|
-
* @defaultValue 'all'
|
|
50
|
-
*/
|
|
51
|
-
on?: 'menu' | 'nav' | 'all';
|
|
52
|
-
}
|
|
53
|
-
export interface BaseLinkType extends BaseItem {
|
|
54
|
-
url: string;
|
|
55
|
-
/**
|
|
56
|
-
* When the item is marked as active
|
|
57
|
-
*
|
|
58
|
-
* @defaultValue 'url'
|
|
59
|
-
*/
|
|
60
|
-
active?: 'url' | 'nested-url' | 'none';
|
|
61
|
-
external?: boolean;
|
|
62
|
-
}
|
|
63
|
-
export interface MainItemType extends BaseLinkType {
|
|
64
|
-
type?: 'main';
|
|
65
|
-
icon?: ReactNode;
|
|
66
|
-
text: ReactNode;
|
|
67
|
-
description?: ReactNode;
|
|
68
|
-
}
|
|
69
|
-
export interface IconItemType extends BaseLinkType {
|
|
70
|
-
type: 'icon';
|
|
71
|
-
/**
|
|
72
|
-
* `aria-label` of icon button
|
|
73
|
-
*/
|
|
74
|
-
label?: string;
|
|
75
|
-
icon: ReactNode;
|
|
76
|
-
text: ReactNode;
|
|
77
|
-
/**
|
|
78
|
-
* @defaultValue true
|
|
79
|
-
*/
|
|
80
|
-
secondary?: boolean;
|
|
81
|
-
}
|
|
82
|
-
export interface ButtonItemType extends BaseLinkType {
|
|
83
|
-
type: 'button';
|
|
84
|
-
icon?: ReactNode;
|
|
85
|
-
text: ReactNode;
|
|
86
|
-
/**
|
|
87
|
-
* @defaultValue false
|
|
88
|
-
*/
|
|
89
|
-
secondary?: boolean;
|
|
90
|
-
}
|
|
91
|
-
export interface MenuItemType extends Partial<BaseLinkType> {
|
|
92
|
-
type: 'menu';
|
|
93
|
-
icon?: ReactNode;
|
|
94
|
-
text: ReactNode;
|
|
95
|
-
items: ((MainItemType & {
|
|
96
|
-
/**
|
|
97
|
-
* Options when displayed on navigation menu
|
|
98
|
-
*/
|
|
99
|
-
menu?: HTMLAttributes<HTMLElement> & {
|
|
100
|
-
banner?: ReactNode;
|
|
101
|
-
};
|
|
102
|
-
}) | CustomItemType)[];
|
|
103
|
-
/**
|
|
104
|
-
* @defaultValue false
|
|
105
|
-
*/
|
|
106
|
-
secondary?: boolean;
|
|
107
|
-
}
|
|
108
|
-
export interface CustomItemType extends BaseItem {
|
|
109
|
-
type: 'custom';
|
|
110
|
-
/**
|
|
111
|
-
* @defaultValue false
|
|
112
|
-
*/
|
|
113
|
-
secondary?: boolean;
|
|
114
|
-
children: ReactNode;
|
|
115
|
-
}
|
|
116
|
-
export type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType;
|
|
117
51
|
/**
|
|
118
|
-
* Get
|
|
52
|
+
* Get link items with shortcuts
|
|
119
53
|
*/
|
|
120
|
-
export declare function
|
|
121
|
-
export
|
|
54
|
+
export declare function resolveLinkItems({ links, githubUrl, }: Pick<BaseLayoutProps, 'links' | 'githubUrl'>): LinkItemType[];
|
|
55
|
+
export type * from './link-item.js';
|
|
122
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAE5C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,GAAG,mBAAmB,CAAC;KAC3C,CAAC;IAEF,YAAY,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,OAAO,CAAC;YAClB,EAAE,EAAE,SAAS,CAAC;YACd,EAAE,EAAE,SAAS,CAAC;SACf,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAU,EACV,SAAS,GACV,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG,YAAY,EAAE,CAkB/D;AAED,mBAAmB,aAAa,CAAC"}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* Get
|
|
3
|
+
* Get link items with shortcuts
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
6
|
-
|
|
5
|
+
export function resolveLinkItems({ links = [], githubUrl, }) {
|
|
6
|
+
const result = [...links];
|
|
7
7
|
if (githubUrl)
|
|
8
|
-
result
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
external: true,
|
|
17
|
-
},
|
|
18
|
-
];
|
|
8
|
+
result.push({
|
|
9
|
+
type: 'icon',
|
|
10
|
+
url: githubUrl,
|
|
11
|
+
text: 'Github',
|
|
12
|
+
label: 'GitHub',
|
|
13
|
+
icon: (_jsx("svg", { role: "img", viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" }) })),
|
|
14
|
+
external: true,
|
|
15
|
+
});
|
|
19
16
|
return result;
|
|
20
17
|
}
|
|
21
|
-
export { BaseLinkItem } from './client.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
export type LanguageSelectProps = ComponentProps<'button'>;
|
|
3
|
+
export declare function LanguageToggle(props: LanguageSelectProps): React.ReactElement;
|
|
4
|
+
export declare function LanguageToggleText(props: ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=language-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-toggle.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/language-toggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU5C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAE3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CA2C7E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAO/D"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
interface Filterable {
|
|
3
|
+
/**
|
|
4
|
+
* Restrict where the item is displayed
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue 'all'
|
|
7
|
+
*/
|
|
8
|
+
on?: 'menu' | 'nav' | 'all';
|
|
9
|
+
}
|
|
10
|
+
interface WithHref {
|
|
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 WithHref, Filterable {
|
|
21
|
+
type?: 'main';
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
text: ReactNode;
|
|
24
|
+
description?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export interface IconItemType extends WithHref, Filterable {
|
|
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
|
+
export interface ButtonItemType extends WithHref, Filterable {
|
|
40
|
+
type: 'button';
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
text: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* @defaultValue false
|
|
45
|
+
*/
|
|
46
|
+
secondary?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface MenuItemType extends Partial<WithHref>, Filterable {
|
|
49
|
+
type: 'menu';
|
|
50
|
+
icon?: ReactNode;
|
|
51
|
+
text: ReactNode;
|
|
52
|
+
items: ((MainItemType & {
|
|
53
|
+
/**
|
|
54
|
+
* Options when displayed on navigation menu
|
|
55
|
+
*/
|
|
56
|
+
menu?: ComponentProps<'a'> & {
|
|
57
|
+
banner?: ReactNode;
|
|
58
|
+
};
|
|
59
|
+
}) | CustomItemType)[];
|
|
60
|
+
/**
|
|
61
|
+
* @defaultValue false
|
|
62
|
+
*/
|
|
63
|
+
secondary?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface CustomItemType extends Filterable {
|
|
66
|
+
type: 'custom';
|
|
67
|
+
/**
|
|
68
|
+
* @defaultValue false
|
|
69
|
+
*/
|
|
70
|
+
secondary?: boolean;
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
}
|
|
73
|
+
export type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType;
|
|
74
|
+
export declare function LinkItem({ ref, item, ...props }: Omit<ComponentProps<'a'>, 'href'> & {
|
|
75
|
+
item: WithHref;
|
|
76
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=link-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-item.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/link-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,UAAU,UAAU;IAClB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CAC7B;AAED,UAAU,QAAQ;IAChB,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,QAAQ,EAAE,UAAU;IACxD,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,QAAQ,EAAE,UAAU;IACxD,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,MAAM,WAAW,cAAe,SAAQ,QAAQ,EAAE,UAAU;IAC1D,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,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAEhB,KAAK,EAAE,CACH,CAAC,YAAY,GAAG;QACd;;WAEG;QACH,IAAI,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG;YAC3B,MAAM,CAAC,EAAE,SAAS,CAAC;SACpB,CAAC;KACH,CAAC,GACF,cAAc,CACjB,EAAE,CAAC;IAEJ;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,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,cAAc,GACd,YAAY,GACZ,cAAc,CAAC;AAEnB,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,2CAkBxD"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { usePathname } from 'fumadocs-core/framework';
|
|
4
4
|
import { isActive } from '../../utils/is-active.js';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
|
-
export function
|
|
6
|
+
export function LinkItem({ ref, item, ...props }) {
|
|
7
7
|
const pathname = usePathname();
|
|
8
8
|
const activeType = item.active ?? 'url';
|
|
9
9
|
const active = activeType !== 'none' &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-toggle.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/search-toggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,wBAAwB,CAAC;AAE1E,UAAU,iBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAC7C,WAAW;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAC3B,cAAc,EACd,IAAgB,EAChB,KAAe,EACf,GAAG,KAAK,EACT,EAAE,iBAAiB,kDAuBnB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,cAAc,EACd,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,kDA6BA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function ThemeToggle({ className, mode, ...props }:
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
export declare function ThemeToggle({ className, mode, ...props }: ComponentProps<'div'> & {
|
|
3
3
|
mode?: 'light-dark' | 'light-dark-system';
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
//# sourceMappingURL=theme-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/theme-toggle.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAC;AAqB5D,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,IAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,IAAI,CAAC,EAAE,YAAY,GAAG,mBAAmB,CAAC;CAC3C,2CAsDA"}
|