@fumadocs/base-ui 16.7.1 → 16.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/css/generated/docs.css +4 -1
- package/css/generated/flux.css +3 -3
- package/css/generated/home.css +2 -3
- package/css/generated/notebook.css +3 -1
- package/dist/components/toc/index.js +10 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/layouts/docs/client.d.ts +3 -3
- package/dist/layouts/docs/client.js +19 -22
- package/dist/layouts/docs/index.d.ts +1 -1
- package/dist/layouts/docs/page/index.d.ts +91 -3
- package/dist/layouts/docs/page/index.js +67 -7
- package/dist/layouts/docs/page/slots/breadcrumb.js +1 -0
- package/dist/layouts/docs/page/slots/container.js +2 -1
- package/dist/layouts/docs/page/slots/footer.js +1 -0
- package/dist/layouts/docs/slots/container.js +1 -0
- package/dist/layouts/docs/slots/header.js +1 -0
- package/dist/layouts/flux/index.d.ts +4 -4
- package/dist/layouts/flux/index.js +8 -11
- package/dist/layouts/flux/page/index.d.ts +79 -3
- package/dist/layouts/flux/page/index.js +61 -7
- package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
- package/dist/layouts/flux/page/slots/container.js +2 -1
- package/dist/layouts/flux/page/slots/footer.js +1 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
- package/dist/layouts/flux/page/slots/toc.js +3 -2
- package/dist/layouts/flux/slots/container.js +1 -0
- package/dist/layouts/home/index.d.ts +3 -3
- package/dist/layouts/home/index.js +6 -8
- package/dist/layouts/home/slots/container.js +1 -0
- package/dist/layouts/home/slots/header.d.ts +1 -1
- package/dist/layouts/home/slots/header.js +4 -4
- package/dist/layouts/notebook/client.d.ts +3 -3
- package/dist/layouts/notebook/client.js +14 -17
- package/dist/layouts/notebook/index.d.ts +1 -1
- package/dist/layouts/notebook/page/index.d.ts +91 -3
- package/dist/layouts/notebook/page/index.js +67 -7
- package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
- package/dist/layouts/notebook/page/slots/container.js +2 -1
- package/dist/layouts/notebook/page/slots/footer.js +1 -0
- package/dist/layouts/notebook/slots/container.js +1 -0
- package/dist/layouts/shared/client.d.ts +6 -6
- package/dist/layouts/shared/client.js +4 -4
- package/dist/layouts/shared/index.d.ts +3 -3
- package/dist/layouts/shared/page-actions.d.ts +2 -2
- package/dist/layouts/shared/page-actions.js +3 -3
- package/dist/page.d.ts +1 -2
- package/dist/page.js +1 -2
- package/package.json +4 -4
- package/dist/layouts/docs/page/client.d.ts +0 -98
- package/dist/layouts/docs/page/client.js +0 -110
- package/dist/layouts/flux/page/client.d.ts +0 -82
- package/dist/layouts/flux/page/client.js +0 -94
- package/dist/layouts/notebook/page/client.d.ts +0 -98
- package/dist/layouts/notebook/page/client.js +0 -110
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../../../../utils/cn.js";
|
|
2
|
-
import { useDocsPage } from "../
|
|
3
|
+
import { useDocsPage } from "../index.js";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/layouts/notebook/page/slots/container.tsx
|
|
5
6
|
function Container(props) {
|
|
@@ -16,16 +16,16 @@ declare function LinkItem({
|
|
|
16
16
|
}>;
|
|
17
17
|
}): react_jsx_runtime0.JSX.Element;
|
|
18
18
|
interface BaseSlots {
|
|
19
|
-
navTitle
|
|
20
|
-
|
|
19
|
+
navTitle: FC<ComponentProps<'a'>>;
|
|
20
|
+
themeSwitch: FC<ThemeSwitchProps> | false;
|
|
21
|
+
searchTrigger: {
|
|
21
22
|
sm: FC<SearchTriggerProps>;
|
|
22
23
|
full: FC<FullSearchTriggerProps>;
|
|
23
|
-
};
|
|
24
|
-
languageSelect
|
|
24
|
+
} | false;
|
|
25
|
+
languageSelect: {
|
|
25
26
|
root: FC<LanguageSelectProps>;
|
|
26
27
|
text: FC<LanguageSelectTextProps>;
|
|
27
|
-
};
|
|
28
|
-
themeSwitch?: FC<ThemeSwitchProps>;
|
|
28
|
+
} | false;
|
|
29
29
|
}
|
|
30
30
|
interface BaseSlotsProps<P extends BaseLayoutProps = BaseLayoutProps> extends Pick<P, 'nav'> {
|
|
31
31
|
themeSwitch: Omit<NonNullable<P['themeSwitch']>, 'enabled'>;
|
|
@@ -62,15 +62,15 @@ function baseSlots({ useProps }) {
|
|
|
62
62
|
return {
|
|
63
63
|
baseSlots: {
|
|
64
64
|
navTitle: slots.navTitle ?? InlineNavTitle,
|
|
65
|
-
themeSwitch: themeSwitchEnabled
|
|
65
|
+
themeSwitch: themeSwitchEnabled && (slots.themeSwitch ?? InlineThemeSwitch),
|
|
66
66
|
languageSelect: i18n ? slots.languageSelect ?? {
|
|
67
67
|
root: LanguageSelect,
|
|
68
68
|
text: LanguageSelectText
|
|
69
|
-
} :
|
|
70
|
-
searchTrigger: searchToggleEnabled
|
|
69
|
+
} : false,
|
|
70
|
+
searchTrigger: searchToggleEnabled && (slots.searchTrigger ?? {
|
|
71
71
|
sm: InlineSearchTrigger,
|
|
72
72
|
full: InlineSearchTriggerFull
|
|
73
|
-
}
|
|
73
|
+
})
|
|
74
74
|
},
|
|
75
75
|
baseProps: {
|
|
76
76
|
nav,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FullSearchTriggerProps, SearchTriggerProps } from "./slots/search-trigger.js";
|
|
2
2
|
import { ThemeSwitchProps } from "./slots/theme-switch.js";
|
|
3
3
|
import { BaseSlots, BaseSlotsProps, LinkItem, baseSlots } from "./client.js";
|
|
4
|
-
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
5
5
|
import * as PageTree from "fumadocs-core/page-tree";
|
|
6
6
|
import { I18nConfig } from "fumadocs-core/i18n";
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ import { I18nConfig } from "fumadocs-core/i18n";
|
|
|
9
9
|
interface NavOptions {
|
|
10
10
|
enabled?: boolean;
|
|
11
11
|
children?: ReactNode;
|
|
12
|
-
title?: ReactNode |
|
|
12
|
+
title?: ReactNode | FC<ComponentProps<'a'>>;
|
|
13
13
|
/**
|
|
14
14
|
* Redirect url of title
|
|
15
15
|
* @defaultValue '/'
|
|
@@ -36,7 +36,7 @@ interface BaseLayoutProps {
|
|
|
36
36
|
* navigation config
|
|
37
37
|
*/
|
|
38
38
|
nav?: NavOptions;
|
|
39
|
-
slots?: BaseSlots
|
|
39
|
+
slots?: Partial<BaseSlots>;
|
|
40
40
|
children?: ReactNode;
|
|
41
41
|
themeSwitch?: ThemeSwitchOptions;
|
|
42
42
|
searchToggle?: SearchToggleOptions;
|
|
@@ -26,11 +26,11 @@ declare function ViewOptionsPopover({
|
|
|
26
26
|
/**
|
|
27
27
|
* A URL to the raw Markdown/MDX content of page
|
|
28
28
|
*/
|
|
29
|
-
markdownUrl
|
|
29
|
+
markdownUrl?: string;
|
|
30
30
|
/**
|
|
31
31
|
* Source file URL on GitHub
|
|
32
32
|
*/
|
|
33
|
-
githubUrl
|
|
33
|
+
githubUrl?: string;
|
|
34
34
|
}): react_jsx_runtime0.JSX.Element;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { MarkdownCopyButton, ViewOptionsPopover };
|
|
@@ -46,7 +46,7 @@ function ViewOptionsPopover({ markdownUrl, githubUrl, ...props }) {
|
|
|
46
46
|
const items = useMemo(() => {
|
|
47
47
|
const q = `Read ${typeof window === "undefined" ? pathname : new URL(pathname, window.location.origin)}, I want to ask questions about it.`;
|
|
48
48
|
return [
|
|
49
|
-
{
|
|
49
|
+
githubUrl && {
|
|
50
50
|
title: "Open in GitHub",
|
|
51
51
|
href: githubUrl,
|
|
52
52
|
icon: /* @__PURE__ */ jsxs("svg", {
|
|
@@ -56,7 +56,7 @@ function ViewOptionsPopover({ markdownUrl, githubUrl, ...props }) {
|
|
|
56
56
|
children: [/* @__PURE__ */ jsx("title", { children: "GitHub" }), /* @__PURE__ */ 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" })]
|
|
57
57
|
})
|
|
58
58
|
},
|
|
59
|
-
{
|
|
59
|
+
markdownUrl && {
|
|
60
60
|
title: "View as Markdown",
|
|
61
61
|
href: markdownUrl,
|
|
62
62
|
icon: /* @__PURE__ */ jsx(TextIcon, {})
|
|
@@ -158,7 +158,7 @@ function ViewOptionsPopover({ markdownUrl, githubUrl, ...props }) {
|
|
|
158
158
|
}),
|
|
159
159
|
href: `https://cursor.com/link/prompt?${new URLSearchParams({ text: q })}`
|
|
160
160
|
}
|
|
161
|
-
];
|
|
161
|
+
].filter((v) => !!v);
|
|
162
162
|
}, [
|
|
163
163
|
githubUrl,
|
|
164
164
|
markdownUrl,
|
package/dist/page.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Breadcrumb } from "./layouts/docs/page/slots/breadcrumb.js";
|
|
2
|
-
import { DocsPageProps as DocsPageProps$1, PageLastUpdate } from "./layouts/docs/page/
|
|
3
|
-
import { DocsBody, DocsDescription, DocsTitle, EditOnGitHub } from "./layouts/docs/page/index.js";
|
|
2
|
+
import { DocsBody, DocsDescription, DocsPageProps as DocsPageProps$1, DocsTitle, EditOnGitHub, PageLastUpdate } from "./layouts/docs/page/index.js";
|
|
4
3
|
import { ComponentProps } from "react";
|
|
5
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
5
|
|
package/dist/page.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { cn } from "./utils/cn.js";
|
|
3
3
|
import { useIsDocsLayout } from "./layouts/docs/client.js";
|
|
4
4
|
import { Breadcrumb } from "./layouts/docs/page/slots/breadcrumb.js";
|
|
5
|
-
import { PageLastUpdate } from "./layouts/docs/page/
|
|
6
|
-
import { DocsBody, DocsDescription, DocsTitle, EditOnGitHub, page_exports } from "./layouts/docs/page/index.js";
|
|
5
|
+
import { DocsBody, DocsDescription, DocsTitle, EditOnGitHub, PageLastUpdate, page_exports } from "./layouts/docs/page/index.js";
|
|
7
6
|
import { page_exports as page_exports$1 } from "./layouts/notebook/page/index.js";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
//#region src/page.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fumadocs/base-ui",
|
|
3
|
-
"version": "16.7.
|
|
3
|
+
"version": "16.7.2",
|
|
4
4
|
"description": "The Base UI version of Fumadocs UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -140,9 +140,9 @@
|
|
|
140
140
|
"tailwindcss": "^4.2.2",
|
|
141
141
|
"tsdown": "0.21.4",
|
|
142
142
|
"unified": "^11.0.5",
|
|
143
|
-
"@fumadocs/cli": "1.3.1",
|
|
144
143
|
"eslint-config-custom": "0.0.0",
|
|
145
|
-
"fumadocs
|
|
144
|
+
"@fumadocs/cli": "1.3.1",
|
|
145
|
+
"fumadocs-core": "16.7.2",
|
|
146
146
|
"tsconfig": "0.0.0"
|
|
147
147
|
},
|
|
148
148
|
"peerDependencies": {
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"react": "^19.2.0",
|
|
154
154
|
"react-dom": "^19.2.0",
|
|
155
155
|
"shiki": "*",
|
|
156
|
-
"fumadocs-core": "16.7.
|
|
156
|
+
"fumadocs-core": "16.7.2"
|
|
157
157
|
},
|
|
158
158
|
"peerDependenciesMeta": {
|
|
159
159
|
"shiki": {
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
2
|
-
import { FooterProps } from "./slots/footer.js";
|
|
3
|
-
import { BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
4
|
-
import { ComponentProps, FC, ReactNode } from "react";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
-
import { TOCItemType } from "fumadocs-core/toc";
|
|
7
|
-
|
|
8
|
-
//#region src/layouts/docs/page/client.d.ts
|
|
9
|
-
interface DocsPageProps extends ComponentProps<'article'> {
|
|
10
|
-
toc?: TOCItemType[];
|
|
11
|
-
/**
|
|
12
|
-
* Extend the page to fill all available space
|
|
13
|
-
*
|
|
14
|
-
* @defaultValue false
|
|
15
|
-
*/
|
|
16
|
-
full?: boolean;
|
|
17
|
-
slots?: DocsPageSlots;
|
|
18
|
-
footer?: FooterOptions;
|
|
19
|
-
breadcrumb?: BreadcrumbOptions;
|
|
20
|
-
tableOfContent?: TableOfContentOptions;
|
|
21
|
-
tableOfContentPopover?: TableOfContentPopoverOptions;
|
|
22
|
-
}
|
|
23
|
-
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
24
|
-
enabled?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated use `slots.breadcrumb` instead.
|
|
27
|
-
*/
|
|
28
|
-
component?: ReactNode;
|
|
29
|
-
}
|
|
30
|
-
interface FooterOptions extends FooterProps {
|
|
31
|
-
enabled?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated use `slots.footer` instead.
|
|
34
|
-
*/
|
|
35
|
-
component?: ReactNode;
|
|
36
|
-
}
|
|
37
|
-
interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
|
|
38
|
-
enabled?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated use `slots.toc` instead.
|
|
41
|
-
*/
|
|
42
|
-
component?: ReactNode;
|
|
43
|
-
}
|
|
44
|
-
interface TableOfContentPopoverOptions extends TOCPopoverProps {
|
|
45
|
-
enabled?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated use `slots.tocPopover` instead.
|
|
48
|
-
*/
|
|
49
|
-
component?: ReactNode;
|
|
50
|
-
}
|
|
51
|
-
interface DocsPageSlots {
|
|
52
|
-
toc?: {
|
|
53
|
-
provider: FC<TOCProviderProps>;
|
|
54
|
-
main?: FC<TOCProps>;
|
|
55
|
-
popover?: FC<TOCPopoverProps>;
|
|
56
|
-
};
|
|
57
|
-
container?: FC<ComponentProps<'article'>>;
|
|
58
|
-
footer?: FC<FooterProps>;
|
|
59
|
-
breadcrumb?: FC<BreadcrumbProps>;
|
|
60
|
-
}
|
|
61
|
-
interface PageSlotsProps extends Pick<DocsPageProps, 'full' | 'breadcrumb' | 'footer'> {
|
|
62
|
-
tableOfContent: TOCProps & {
|
|
63
|
-
component?: ReactNode;
|
|
64
|
-
};
|
|
65
|
-
tableOfContentPopover: TOCPopoverProps & {
|
|
66
|
-
component?: ReactNode;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
declare function useDocsPage(): {
|
|
70
|
-
props: PageSlotsProps;
|
|
71
|
-
slots: DocsPageSlots;
|
|
72
|
-
};
|
|
73
|
-
declare function DocsPage({
|
|
74
|
-
tableOfContent: {
|
|
75
|
-
enabled: tocEnabled,
|
|
76
|
-
single,
|
|
77
|
-
...tocProps
|
|
78
|
-
},
|
|
79
|
-
tableOfContentPopover: {
|
|
80
|
-
enabled: tocPopoverEnabled,
|
|
81
|
-
...tocPopoverProps
|
|
82
|
-
},
|
|
83
|
-
footer,
|
|
84
|
-
breadcrumb,
|
|
85
|
-
full,
|
|
86
|
-
toc,
|
|
87
|
-
slots: defaultSlots,
|
|
88
|
-
children,
|
|
89
|
-
...containerProps
|
|
90
|
-
}: DocsPageProps): react_jsx_runtime0.JSX.Element;
|
|
91
|
-
declare function PageLastUpdate({
|
|
92
|
-
date: value,
|
|
93
|
-
...props
|
|
94
|
-
}: Omit<ComponentProps<'p'>, 'children'> & {
|
|
95
|
-
date: Date;
|
|
96
|
-
}): react_jsx_runtime0.JSX.Element;
|
|
97
|
-
//#endregion
|
|
98
|
-
export { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useI18n } from "../../../contexts/i18n.js";
|
|
3
|
-
import { cn } from "../../../utils/cn.js";
|
|
4
|
-
import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
5
|
-
import { Footer } from "./slots/footer.js";
|
|
6
|
-
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
7
|
-
import { Container } from "./slots/container.js";
|
|
8
|
-
import { createContext, use, useEffect, useState } from "react";
|
|
9
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
//#region src/layouts/docs/page/client.tsx
|
|
11
|
-
const PageContext = createContext(null);
|
|
12
|
-
function useDocsPage() {
|
|
13
|
-
const context = use(PageContext);
|
|
14
|
-
if (!context) throw new Error("Please use page components under <DocsPage /> (`fumadocs-ui/layouts/docs/page`).");
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
17
|
-
function DocsPage({ tableOfContent: { enabled: tocEnabled, single, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, footer = {}, breadcrumb = {}, full = false, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
|
|
18
|
-
tocEnabled ??= Boolean(!full && (toc.length > 0 || tocProps.footer || tocProps.header));
|
|
19
|
-
tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
|
|
20
|
-
const slots = {
|
|
21
|
-
breadcrumb: breadcrumb.enabled !== false ? defaultSlots.breadcrumb ?? InlineBreadcrumb : void 0,
|
|
22
|
-
footer: footer.enabled !== false ? defaultSlots.footer ?? InlineFooter : void 0,
|
|
23
|
-
toc: defaultSlots.toc ?? {
|
|
24
|
-
provider: TOCProvider,
|
|
25
|
-
main: tocEnabled ? InlineTOC : void 0,
|
|
26
|
-
popover: tocPopoverEnabled ? InlineTOCPopover : void 0
|
|
27
|
-
},
|
|
28
|
-
container: defaultSlots.container ?? Container
|
|
29
|
-
};
|
|
30
|
-
let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31
|
-
slots.toc?.popover && /* @__PURE__ */ jsx(slots.toc.popover, {}),
|
|
32
|
-
slots.container && /* @__PURE__ */ jsxs(slots.container, {
|
|
33
|
-
...containerProps,
|
|
34
|
-
children: [
|
|
35
|
-
slots.breadcrumb && /* @__PURE__ */ jsx(slots.breadcrumb, {}),
|
|
36
|
-
children,
|
|
37
|
-
slots.footer && /* @__PURE__ */ jsx(slots.footer, {})
|
|
38
|
-
]
|
|
39
|
-
}),
|
|
40
|
-
slots.toc?.main && /* @__PURE__ */ jsx(slots.toc.main, {})
|
|
41
|
-
] });
|
|
42
|
-
if (slots.toc) content = /* @__PURE__ */ jsx(slots.toc.provider, {
|
|
43
|
-
single,
|
|
44
|
-
toc: tocEnabled || tocPopoverEnabled ? toc : [],
|
|
45
|
-
children: content
|
|
46
|
-
});
|
|
47
|
-
return /* @__PURE__ */ jsx(PageContext, {
|
|
48
|
-
value: {
|
|
49
|
-
props: {
|
|
50
|
-
full,
|
|
51
|
-
tableOfContent: tocProps,
|
|
52
|
-
tableOfContentPopover: tocPopoverProps,
|
|
53
|
-
footer,
|
|
54
|
-
breadcrumb
|
|
55
|
-
},
|
|
56
|
-
slots
|
|
57
|
-
},
|
|
58
|
-
children: content
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function InlineBreadcrumb(props) {
|
|
62
|
-
const { component, enabled: _, ...rest } = useDocsPage().props.breadcrumb ?? {};
|
|
63
|
-
if (component) return component;
|
|
64
|
-
return /* @__PURE__ */ jsx(Breadcrumb, {
|
|
65
|
-
...props,
|
|
66
|
-
...rest
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function InlineFooter(props) {
|
|
70
|
-
const { component, enabled: _, ...rest } = useDocsPage().props.footer ?? {};
|
|
71
|
-
if (component) return component;
|
|
72
|
-
return /* @__PURE__ */ jsx(Footer, {
|
|
73
|
-
...props,
|
|
74
|
-
...rest
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function InlineTOCPopover(props) {
|
|
78
|
-
const { tableOfContentPopover } = useDocsPage().props;
|
|
79
|
-
if (tableOfContentPopover.component) return tableOfContentPopover.component;
|
|
80
|
-
return /* @__PURE__ */ jsx(TOCPopover, {
|
|
81
|
-
...props,
|
|
82
|
-
...tableOfContentPopover
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function InlineTOC(props) {
|
|
86
|
-
const { tableOfContent } = useDocsPage().props;
|
|
87
|
-
if (tableOfContent.component) return tableOfContent.component;
|
|
88
|
-
return /* @__PURE__ */ jsx(TOC, {
|
|
89
|
-
...props,
|
|
90
|
-
...tableOfContent
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function PageLastUpdate({ date: value, ...props }) {
|
|
94
|
-
const { text } = useI18n();
|
|
95
|
-
const [date, setDate] = useState("");
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
setDate(value.toLocaleDateString());
|
|
98
|
-
}, [value]);
|
|
99
|
-
return /* @__PURE__ */ jsxs("p", {
|
|
100
|
-
...props,
|
|
101
|
-
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
102
|
-
children: [
|
|
103
|
-
text.lastUpdate,
|
|
104
|
-
" ",
|
|
105
|
-
date
|
|
106
|
-
]
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
export { DocsPage, PageLastUpdate, useDocsPage };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { TOCProviderProps } from "../../../components/toc/index.js";
|
|
2
|
-
import { TOCProps } from "./slots/toc.js";
|
|
3
|
-
import { FooterProps } from "./slots/footer.js";
|
|
4
|
-
import { BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
5
|
-
import { ComponentProps, FC, ReactNode } from "react";
|
|
6
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
-
import { TOCItemType } from "fumadocs-core/toc";
|
|
8
|
-
|
|
9
|
-
//#region src/layouts/flux/page/client.d.ts
|
|
10
|
-
interface DocsPageSlots {
|
|
11
|
-
toc?: FC<TOCProps>;
|
|
12
|
-
container?: FC<ComponentProps<'article'>>;
|
|
13
|
-
tocProvider?: FC<TOCProviderProps>;
|
|
14
|
-
footer?: FC<FooterProps>;
|
|
15
|
-
breadcrumb?: FC<BreadcrumbProps>;
|
|
16
|
-
}
|
|
17
|
-
interface DocsPageProps extends ComponentProps<'article'> {
|
|
18
|
-
toc?: TOCItemType[];
|
|
19
|
-
/**
|
|
20
|
-
* Extend the page to fill all available space
|
|
21
|
-
*
|
|
22
|
-
* @defaultValue false
|
|
23
|
-
*/
|
|
24
|
-
full?: boolean;
|
|
25
|
-
children?: ReactNode;
|
|
26
|
-
slots?: DocsPageSlots;
|
|
27
|
-
footer?: FooterOptions;
|
|
28
|
-
breadcrumb?: BreadcrumbOptions;
|
|
29
|
-
tableOfContent?: TableOfContentOptions;
|
|
30
|
-
}
|
|
31
|
-
interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
|
|
32
|
-
enabled?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated use `slots.toc` instead.
|
|
35
|
-
*/
|
|
36
|
-
component?: ReactNode;
|
|
37
|
-
}
|
|
38
|
-
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
39
|
-
enabled?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated use `slots.breadcrumb` instead.
|
|
42
|
-
*/
|
|
43
|
-
component?: ReactNode;
|
|
44
|
-
}
|
|
45
|
-
interface FooterOptions extends FooterProps {
|
|
46
|
-
enabled?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated use `slots.footer` instead.
|
|
49
|
-
*/
|
|
50
|
-
component?: ReactNode;
|
|
51
|
-
}
|
|
52
|
-
interface PageSlotsProps extends Pick<DocsPageProps, 'full' | 'footer' | 'breadcrumb'> {
|
|
53
|
-
tableOfContent: TOCProps & {
|
|
54
|
-
component?: ReactNode;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
declare function useDocsPage(): {
|
|
58
|
-
props: PageSlotsProps;
|
|
59
|
-
slots: DocsPageSlots;
|
|
60
|
-
};
|
|
61
|
-
declare function DocsPage({
|
|
62
|
-
tableOfContent: {
|
|
63
|
-
enabled: tocEnabled,
|
|
64
|
-
single,
|
|
65
|
-
...tocProps
|
|
66
|
-
},
|
|
67
|
-
footer,
|
|
68
|
-
breadcrumb,
|
|
69
|
-
full,
|
|
70
|
-
toc,
|
|
71
|
-
slots: defaultSlots,
|
|
72
|
-
children,
|
|
73
|
-
...containerProps
|
|
74
|
-
}: DocsPageProps): react_jsx_runtime0.JSX.Element;
|
|
75
|
-
declare function PageLastUpdate({
|
|
76
|
-
date: value,
|
|
77
|
-
...props
|
|
78
|
-
}: Omit<ComponentProps<'p'>, 'children'> & {
|
|
79
|
-
date: Date;
|
|
80
|
-
}): react_jsx_runtime0.JSX.Element;
|
|
81
|
-
//#endregion
|
|
82
|
-
export { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useI18n } from "../../../contexts/i18n.js";
|
|
3
|
-
import { cn } from "../../../utils/cn.js";
|
|
4
|
-
import { TOCProvider } from "../../../components/toc/index.js";
|
|
5
|
-
import { TOC } from "./slots/toc.js";
|
|
6
|
-
import { Footer } from "./slots/footer.js";
|
|
7
|
-
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
8
|
-
import { Container } from "./slots/container.js";
|
|
9
|
-
import { createContext, use, useEffect, useState } from "react";
|
|
10
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
//#region src/layouts/flux/page/client.tsx
|
|
12
|
-
const PageContext = createContext(null);
|
|
13
|
-
function useDocsPage() {
|
|
14
|
-
const context = use(PageContext);
|
|
15
|
-
if (!context) throw new Error("Please use page components under <DocsPage /> (`fumadocs-ui/layouts/flux/page`).");
|
|
16
|
-
return context;
|
|
17
|
-
}
|
|
18
|
-
function DocsPage({ tableOfContent: { enabled: tocEnabled, single = false, ...tocProps } = {}, footer = {}, breadcrumb = {}, full = false, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
|
|
19
|
-
tocEnabled ??= Boolean(toc.length > 0 || tocProps.header || tocProps.footer);
|
|
20
|
-
const slots = {
|
|
21
|
-
breadcrumb: breadcrumb.enabled !== false ? defaultSlots.breadcrumb ?? InlineBreadcrumb : void 0,
|
|
22
|
-
footer: footer.enabled !== false ? defaultSlots.footer ?? InlineFooter : void 0,
|
|
23
|
-
toc: tocEnabled ? defaultSlots.toc ?? InlineTOC : void 0,
|
|
24
|
-
tocProvider: defaultSlots.tocProvider ?? TOCProvider,
|
|
25
|
-
container: defaultSlots.container ?? Container
|
|
26
|
-
};
|
|
27
|
-
let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [slots.toc && /* @__PURE__ */ jsx(slots.toc, {}), slots.container && /* @__PURE__ */ jsxs(slots.container, {
|
|
28
|
-
...containerProps,
|
|
29
|
-
children: [
|
|
30
|
-
slots.breadcrumb && /* @__PURE__ */ jsx(slots.breadcrumb, {}),
|
|
31
|
-
children,
|
|
32
|
-
slots.footer && /* @__PURE__ */ jsx(slots.footer, {})
|
|
33
|
-
]
|
|
34
|
-
})] });
|
|
35
|
-
if (slots.tocProvider) content = /* @__PURE__ */ jsx(slots.tocProvider, {
|
|
36
|
-
single,
|
|
37
|
-
toc: tocEnabled ? toc : [],
|
|
38
|
-
children: content
|
|
39
|
-
});
|
|
40
|
-
return /* @__PURE__ */ jsx(PageContext, {
|
|
41
|
-
value: {
|
|
42
|
-
props: {
|
|
43
|
-
full,
|
|
44
|
-
tableOfContent: tocProps,
|
|
45
|
-
footer,
|
|
46
|
-
breadcrumb
|
|
47
|
-
},
|
|
48
|
-
slots
|
|
49
|
-
},
|
|
50
|
-
children: content
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function InlineBreadcrumb(props) {
|
|
54
|
-
const { component, enabled: _, ...rest } = useDocsPage().props.breadcrumb ?? {};
|
|
55
|
-
if (component) return component;
|
|
56
|
-
return /* @__PURE__ */ jsx(Breadcrumb, {
|
|
57
|
-
...props,
|
|
58
|
-
...rest
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function InlineFooter(props) {
|
|
62
|
-
const { component, enabled: _, ...rest } = useDocsPage().props.footer ?? {};
|
|
63
|
-
if (component) return component;
|
|
64
|
-
return /* @__PURE__ */ jsx(Footer, {
|
|
65
|
-
...props,
|
|
66
|
-
...rest
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function InlineTOC(props) {
|
|
70
|
-
const { tableOfContent } = useDocsPage().props;
|
|
71
|
-
if (tableOfContent.component) return tableOfContent.component;
|
|
72
|
-
return /* @__PURE__ */ jsx(TOC, {
|
|
73
|
-
...props,
|
|
74
|
-
...tableOfContent
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function PageLastUpdate({ date: value, ...props }) {
|
|
78
|
-
const { text } = useI18n();
|
|
79
|
-
const [date, setDate] = useState("");
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
setDate(value.toLocaleDateString());
|
|
82
|
-
}, [value]);
|
|
83
|
-
return /* @__PURE__ */ jsxs("p", {
|
|
84
|
-
...props,
|
|
85
|
-
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
86
|
-
children: [
|
|
87
|
-
text.lastUpdate,
|
|
88
|
-
" ",
|
|
89
|
-
date
|
|
90
|
-
]
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
export { DocsPage, PageLastUpdate, useDocsPage };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
2
|
-
import { FooterProps } from "./slots/footer.js";
|
|
3
|
-
import { BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
4
|
-
import { ComponentProps, FC, ReactNode } from "react";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
-
import { TOCItemType } from "fumadocs-core/toc";
|
|
7
|
-
|
|
8
|
-
//#region src/layouts/notebook/page/client.d.ts
|
|
9
|
-
interface DocsPageSlots {
|
|
10
|
-
toc?: {
|
|
11
|
-
provider: FC<TOCProviderProps>;
|
|
12
|
-
main?: FC<TOCProps>;
|
|
13
|
-
popover?: FC<TOCPopoverProps>;
|
|
14
|
-
};
|
|
15
|
-
container?: FC<ComponentProps<'article'>>;
|
|
16
|
-
footer?: FC<FooterProps>;
|
|
17
|
-
breadcrumb?: FC<BreadcrumbProps>;
|
|
18
|
-
}
|
|
19
|
-
interface DocsPageProps extends ComponentProps<'article'> {
|
|
20
|
-
toc?: TOCItemType[];
|
|
21
|
-
/**
|
|
22
|
-
* Extend the page to fill all available space
|
|
23
|
-
*
|
|
24
|
-
* @defaultValue false
|
|
25
|
-
*/
|
|
26
|
-
full?: boolean;
|
|
27
|
-
slots?: DocsPageSlots;
|
|
28
|
-
footer?: FooterOptions;
|
|
29
|
-
breadcrumb?: BreadcrumbOptions;
|
|
30
|
-
tableOfContent?: TableOfContentOptions;
|
|
31
|
-
tableOfContentPopover?: TableOfContentPopoverOptions;
|
|
32
|
-
}
|
|
33
|
-
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
34
|
-
enabled?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated use `slots.breadcrumb` instead.
|
|
37
|
-
*/
|
|
38
|
-
component?: ReactNode;
|
|
39
|
-
}
|
|
40
|
-
interface FooterOptions extends FooterProps {
|
|
41
|
-
enabled?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated use `slots.footer` instead.
|
|
44
|
-
*/
|
|
45
|
-
component?: ReactNode;
|
|
46
|
-
}
|
|
47
|
-
interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
|
|
48
|
-
enabled?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated use `slots.toc` instead.
|
|
51
|
-
*/
|
|
52
|
-
component?: ReactNode;
|
|
53
|
-
}
|
|
54
|
-
interface TableOfContentPopoverOptions extends TOCPopoverProps {
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated use `slots.tocPopover` instead.
|
|
58
|
-
*/
|
|
59
|
-
component?: ReactNode;
|
|
60
|
-
}
|
|
61
|
-
interface PageSlotsProps extends Pick<DocsPageProps, 'full' | 'breadcrumb' | 'footer'> {
|
|
62
|
-
tableOfContent: TOCProps & {
|
|
63
|
-
component?: ReactNode;
|
|
64
|
-
};
|
|
65
|
-
tableOfContentPopover: TOCPopoverProps & {
|
|
66
|
-
component?: ReactNode;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
declare function useDocsPage(): {
|
|
70
|
-
props: PageSlotsProps;
|
|
71
|
-
slots: DocsPageSlots;
|
|
72
|
-
};
|
|
73
|
-
declare function DocsPage({
|
|
74
|
-
tableOfContent: {
|
|
75
|
-
enabled: tocEnabled,
|
|
76
|
-
single,
|
|
77
|
-
...tocProps
|
|
78
|
-
},
|
|
79
|
-
tableOfContentPopover: {
|
|
80
|
-
enabled: tocPopoverEnabled,
|
|
81
|
-
...tocPopoverProps
|
|
82
|
-
},
|
|
83
|
-
footer,
|
|
84
|
-
breadcrumb,
|
|
85
|
-
full,
|
|
86
|
-
toc,
|
|
87
|
-
slots: defaultSlots,
|
|
88
|
-
children,
|
|
89
|
-
...containerProps
|
|
90
|
-
}: DocsPageProps): react_jsx_runtime0.JSX.Element;
|
|
91
|
-
declare function PageLastUpdate({
|
|
92
|
-
date: value,
|
|
93
|
-
...props
|
|
94
|
-
}: Omit<ComponentProps<'p'>, 'children'> & {
|
|
95
|
-
date: Date;
|
|
96
|
-
}): react_jsx_runtime0.JSX.Element;
|
|
97
|
-
//#endregion
|
|
98
|
-
export { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage };
|