fumadocs-ui 12.0.0 → 12.0.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/{chunk-7EMVRXMS.js → chunk-45374JLF.js} +1 -1
- package/dist/{chunk-IOHAG6BY.js → chunk-5CZEA2KX.js} +1 -1
- package/dist/{chunk-XXVXIK4M.js → chunk-E5OQ6FBQ.js} +1 -1
- package/dist/{chunk-CRYPD6UZ.js → chunk-HLGNIWUN.js} +1 -0
- package/dist/{chunk-JQW5DMD2.js → chunk-KOSWCGKQ.js} +96 -61
- package/dist/components/accordion.js +2 -2
- package/dist/components/api.js +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/codeblock.js +1 -1
- package/dist/components/dialog/search-algolia.js +2 -2
- package/dist/components/dialog/search-default.js +2 -2
- package/dist/components/dialog/search.js +2 -2
- package/dist/components/files.js +1 -1
- package/dist/components/heading.js +1 -1
- package/dist/components/layout/language-toggle.js +1 -1
- package/dist/components/layout/root-toggle.js +2 -2
- package/dist/components/roll-button.d.ts +1 -1
- package/dist/components/roll-button.js +22 -9
- package/dist/docs.client.d.ts +8 -2
- package/dist/docs.client.js +26 -16
- package/dist/{i18n-CE8z-AAs.d.ts → i18n-DSnJuWoW.d.ts} +1 -0
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.js +1 -1
- package/dist/layout.client.js +20 -45
- package/dist/layout.js +13 -8
- package/dist/mdx.client.js +1 -1
- package/dist/mdx.js +1 -1
- package/dist/page.client.d.ts +16 -3
- package/dist/page.client.js +87 -34
- package/dist/page.d.ts +5 -14
- package/dist/page.js +21 -13
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.cjs +4 -0
- package/dist/tailwind-plugin.js +4 -0
- package/package.json +2 -2
package/dist/layout.client.js
CHANGED
|
@@ -2,35 +2,29 @@
|
|
|
2
2
|
import {
|
|
3
3
|
LargeSearchToggle,
|
|
4
4
|
LinkItem,
|
|
5
|
+
LinksMenu,
|
|
5
6
|
SearchToggle,
|
|
6
7
|
ThemeToggle
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import
|
|
9
|
-
Popover,
|
|
10
|
-
PopoverContent,
|
|
11
|
-
PopoverTrigger
|
|
12
|
-
} from "./chunk-UBVEKNRF.js";
|
|
8
|
+
} from "./chunk-KOSWCGKQ.js";
|
|
9
|
+
import "./chunk-UBVEKNRF.js";
|
|
13
10
|
import "./chunk-AN2Y6MA2.js";
|
|
14
11
|
import {
|
|
15
12
|
useSearchContext
|
|
16
13
|
} from "./chunk-FSPYEOFC.js";
|
|
17
14
|
import {
|
|
18
15
|
useI18n
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HLGNIWUN.js";
|
|
20
17
|
import "./chunk-7XPZOMJ2.js";
|
|
21
|
-
import
|
|
22
|
-
buttonVariants
|
|
23
|
-
} from "./chunk-7GZKFBAP.js";
|
|
18
|
+
import "./chunk-7GZKFBAP.js";
|
|
24
19
|
import {
|
|
25
20
|
twMerge
|
|
26
21
|
} from "./chunk-TK3TM3MR.js";
|
|
27
22
|
import "./chunk-MLKGABMK.js";
|
|
28
23
|
|
|
29
24
|
// src/components/layout/nav.tsx
|
|
30
|
-
import { MoreVertical } from "lucide-react";
|
|
31
25
|
import Link from "fumadocs-core/link";
|
|
32
26
|
import { useEffect, useState } from "react";
|
|
33
|
-
import {
|
|
27
|
+
import { MoreVertical } from "lucide-react";
|
|
34
28
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
35
29
|
function Nav({
|
|
36
30
|
title = "My App",
|
|
@@ -42,6 +36,7 @@ function Nav({
|
|
|
42
36
|
}) {
|
|
43
37
|
const search = useSearchContext();
|
|
44
38
|
const [transparent, setTransparent] = useState(transparentMode !== "none");
|
|
39
|
+
const { text } = useI18n();
|
|
45
40
|
useEffect(() => {
|
|
46
41
|
if (transparentMode !== "top") return;
|
|
47
42
|
const listener = () => {
|
|
@@ -58,7 +53,7 @@ function Nav({
|
|
|
58
53
|
{
|
|
59
54
|
className: twMerge(
|
|
60
55
|
"sticky top-0 z-50 h-16 border-b transition-colors",
|
|
61
|
-
transparent ? "border-transparent" : "border-foreground/10 bg-background/
|
|
56
|
+
transparent ? "border-transparent" : "border-foreground/10 bg-background/80 backdrop-blur-md"
|
|
62
57
|
),
|
|
63
58
|
children: /* @__PURE__ */ jsxs("nav", { className: "mx-auto flex size-full max-w-container flex-row items-center gap-6 px-4", children: [
|
|
64
59
|
/* @__PURE__ */ jsx(
|
|
@@ -84,44 +79,24 @@ function Nav({
|
|
|
84
79
|
/* @__PURE__ */ jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-md:hidden" })
|
|
85
80
|
] }) : null,
|
|
86
81
|
/* @__PURE__ */ jsx(ThemeToggle, { className: "max-lg:hidden" }),
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
LinksMenu,
|
|
84
|
+
{
|
|
85
|
+
items,
|
|
86
|
+
className: "lg:hidden",
|
|
87
|
+
footer: /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between px-2 py-1", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground", children: text.chooseTheme }),
|
|
89
|
+
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
90
|
+
] }),
|
|
91
|
+
children: /* @__PURE__ */ jsx(MoreVertical, {})
|
|
92
|
+
}
|
|
93
|
+
),
|
|
88
94
|
items.filter((item) => item.type === "secondary").map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, className: "max-lg:hidden" }, i))
|
|
89
95
|
] })
|
|
90
96
|
] })
|
|
91
97
|
}
|
|
92
98
|
);
|
|
93
99
|
}
|
|
94
|
-
function LinksMenu({ items, ...props }) {
|
|
95
|
-
const [open, setOpen] = useState(false);
|
|
96
|
-
const { text } = useI18n();
|
|
97
|
-
const pathname = usePathname();
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
setOpen(false);
|
|
100
|
-
}, [pathname]);
|
|
101
|
-
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
102
|
-
/* @__PURE__ */ jsx(
|
|
103
|
-
PopoverTrigger,
|
|
104
|
-
{
|
|
105
|
-
...props,
|
|
106
|
-
className: twMerge(
|
|
107
|
-
buttonVariants({
|
|
108
|
-
size: "icon",
|
|
109
|
-
color: "ghost",
|
|
110
|
-
className: props.className
|
|
111
|
-
})
|
|
112
|
-
),
|
|
113
|
-
children: /* @__PURE__ */ jsx(MoreVertical, {})
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
/* @__PURE__ */ jsxs(PopoverContent, { className: "flex flex-col", children: [
|
|
117
|
-
items.map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, on: "menu" }, i)),
|
|
118
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between px-2 py-1", children: [
|
|
119
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground", children: text.chooseTheme }),
|
|
120
|
-
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
121
|
-
] })
|
|
122
|
-
] })
|
|
123
|
-
] });
|
|
124
|
-
}
|
|
125
100
|
export {
|
|
126
101
|
Nav
|
|
127
102
|
};
|
package/dist/layout.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
TreeContextProvider,
|
|
6
6
|
DynamicSidebar,
|
|
7
7
|
SubNav,
|
|
8
|
+
LinksMenu,
|
|
8
9
|
Sidebar,
|
|
9
10
|
ThemeToggle,
|
|
10
11
|
} from "./docs.client"
|
|
@@ -19,6 +20,7 @@ import "./chunk-MLKGABMK.js";
|
|
|
19
20
|
|
|
20
21
|
// src/layout.tsx
|
|
21
22
|
import Link from "next/link";
|
|
23
|
+
import { MoreHorizontal } from "lucide-react";
|
|
22
24
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
25
|
function Layout({
|
|
24
26
|
nav = {},
|
|
@@ -65,14 +67,17 @@ function DocsLayout({
|
|
|
65
67
|
items: finalLinks,
|
|
66
68
|
defaultOpenLevel: sidebar.defaultOpenLevel,
|
|
67
69
|
banner: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between border-b pb-2 max-md:hidden", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Link,
|
|
73
|
+
{
|
|
74
|
+
href: nav?.url ?? "/",
|
|
75
|
+
className: "inline-flex items-center gap-2.5 font-medium",
|
|
76
|
+
children: nav?.title
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsx(LinksMenu, { items: finalLinks, children: /* @__PURE__ */ jsx(MoreHorizontal, {}) })
|
|
80
|
+
] }),
|
|
76
81
|
sidebar.banner
|
|
77
82
|
] }),
|
|
78
83
|
bannerProps: {
|
package/dist/mdx.client.js
CHANGED
package/dist/mdx.js
CHANGED
package/dist/page.client.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { TOCItemType } from 'fumadocs-core/server';
|
|
2
|
+
import * as Primitive from 'fumadocs-core/toc-internal';
|
|
3
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
interface TOCProps {
|
|
4
6
|
items: TOCItemType[];
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Custom content in TOC container, before the main TOC
|
|
9
|
+
*/
|
|
10
|
+
header?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Custom content in TOC container, after the main TOC
|
|
13
|
+
*/
|
|
14
|
+
footer?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const TocProvider: typeof Primitive.AnchorProvider;
|
|
17
|
+
declare function Toc({ items, header, footer }: TOCProps): ReactElement;
|
|
18
|
+
declare function SubToc({ items, header, footer }: TOCProps): ReactElement;
|
|
6
19
|
|
|
7
20
|
declare function Breadcrumb(): React.ReactElement;
|
|
8
21
|
|
|
@@ -26,4 +39,4 @@ interface FooterProps {
|
|
|
26
39
|
}
|
|
27
40
|
declare function Footer({ items }: FooterProps): React.ReactElement;
|
|
28
41
|
|
|
29
|
-
export { Breadcrumb, Footer, type FooterProps, LastUpdate,
|
|
42
|
+
export { Breadcrumb, Footer, type FooterProps, LastUpdate, SubToc, type TOCProps, Toc, TocProvider };
|
package/dist/page.client.js
CHANGED
|
@@ -1,78 +1,129 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useTreeContext
|
|
4
|
-
} from "./chunk-34Z7WODD.js";
|
|
5
2
|
import {
|
|
6
3
|
ScrollArea,
|
|
7
4
|
ScrollViewport
|
|
8
5
|
} from "./chunk-VYTHQTZE.js";
|
|
6
|
+
import {
|
|
7
|
+
Popover,
|
|
8
|
+
PopoverContent,
|
|
9
|
+
PopoverTrigger
|
|
10
|
+
} from "./chunk-UBVEKNRF.js";
|
|
11
|
+
import {
|
|
12
|
+
useTreeContext
|
|
13
|
+
} from "./chunk-34Z7WODD.js";
|
|
9
14
|
import "./chunk-AN2Y6MA2.js";
|
|
10
15
|
import {
|
|
11
16
|
useI18n
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HLGNIWUN.js";
|
|
18
|
+
import {
|
|
19
|
+
buttonVariants
|
|
20
|
+
} from "./chunk-7GZKFBAP.js";
|
|
13
21
|
import {
|
|
14
22
|
twMerge
|
|
15
23
|
} from "./chunk-TK3TM3MR.js";
|
|
16
24
|
import "./chunk-MLKGABMK.js";
|
|
17
25
|
|
|
18
26
|
// src/page.client.tsx
|
|
19
|
-
import { useEffect
|
|
27
|
+
import { useEffect, useMemo, useState } from "react";
|
|
20
28
|
import { ChevronLeft, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
21
29
|
import Link2 from "next/link";
|
|
22
30
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
23
31
|
|
|
24
32
|
// src/components/layout/toc.tsx
|
|
25
33
|
import { TextIcon } from "lucide-react";
|
|
26
|
-
import * as Primitive from "fumadocs-core/toc";
|
|
27
|
-
import { useCallback,
|
|
34
|
+
import * as Primitive from "fumadocs-core/toc-internal";
|
|
35
|
+
import { useCallback, useRef } from "react";
|
|
28
36
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
+
var TocProvider = Primitive.AnchorProvider;
|
|
38
|
+
function Toc({ items, header, footer }) {
|
|
39
|
+
const { text } = useI18n();
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", { className: "sticky top-0 flex h-dvh w-[220px] flex-col gap-4 pe-2 pt-12 max-lg:hidden xl:w-[260px]", children: [
|
|
41
|
+
header,
|
|
42
|
+
/* @__PURE__ */ jsxs("h3", { className: "-mb-1 -ms-0.5 inline-flex items-center gap-1.5 text-sm text-muted-foreground", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(TextIcon, { className: "size-4" }),
|
|
44
|
+
text.toc
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx(TOCItems, { items }),
|
|
47
|
+
footer
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
function SubToc({ items, header, footer }) {
|
|
51
|
+
const { text } = useI18n();
|
|
52
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
PopoverTrigger,
|
|
55
|
+
{
|
|
56
|
+
className: twMerge(
|
|
57
|
+
buttonVariants({
|
|
58
|
+
className: "sticky ms-auto bottom-4 gap-2 shadow-lg shadow-background z-10 lg:hidden",
|
|
59
|
+
color: "secondary"
|
|
60
|
+
})
|
|
61
|
+
),
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsx(TextIcon, { className: "size-4" }),
|
|
64
|
+
text.toc
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "flex max-h-[300px] w-[260px] flex-col gap-4 p-3", children: [
|
|
69
|
+
header,
|
|
70
|
+
/* @__PURE__ */ jsx(TOCItems, { className: "-me-1", items }),
|
|
71
|
+
footer
|
|
72
|
+
] })
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
29
75
|
function TOCItems({
|
|
30
|
-
items
|
|
76
|
+
items,
|
|
77
|
+
className
|
|
31
78
|
}) {
|
|
32
79
|
const { text } = useI18n();
|
|
33
80
|
const containerRef = useRef(null);
|
|
34
81
|
const markerRef = useRef(null);
|
|
35
82
|
const setPos = useCallback(([top, height]) => {
|
|
36
83
|
const element = markerRef.current;
|
|
37
|
-
if (!element) return;
|
|
84
|
+
if (!element || containerRef.current?.clientHeight === 0) return;
|
|
38
85
|
element.style.setProperty("top", `${top.toString()}px`);
|
|
39
86
|
element.style.setProperty("height", `${height.toString()}px`);
|
|
40
87
|
element.style.setProperty("display", "block");
|
|
41
88
|
}, []);
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
89
|
+
if (items.length === 0)
|
|
90
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card p-3 text-xs text-muted-foreground", children: text.tocNoHeadings });
|
|
91
|
+
return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", className), children: /* @__PURE__ */ jsxs(
|
|
92
|
+
ScrollViewport,
|
|
93
|
+
{
|
|
94
|
+
className: "relative h-0 flex-1 text-sm",
|
|
95
|
+
ref: containerRef,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
role: "none",
|
|
101
|
+
ref: markerRef,
|
|
102
|
+
className: "absolute start-0 hidden w-0.5 bg-primary transition-all"
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(Primitive.ScrollProvider, { containerRef, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 border-s-2 text-muted-foreground", children: items.map((item) => /* @__PURE__ */ jsx(TOCItem2, { item, setMarker: setPos }, item.url)) }) })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
) });
|
|
57
109
|
}
|
|
58
110
|
function TOCItem2({
|
|
59
111
|
item,
|
|
60
112
|
setMarker
|
|
61
113
|
}) {
|
|
62
|
-
const active = Primitive.useActiveAnchor(item.url);
|
|
63
114
|
const ref = useRef(null);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (active && ref.current) {
|
|
66
|
-
setMarker([ref.current.offsetTop, ref.current.clientHeight]);
|
|
67
|
-
}
|
|
68
|
-
}, [active, setMarker]);
|
|
69
115
|
return /* @__PURE__ */ jsx(
|
|
70
116
|
Primitive.TOCItem,
|
|
71
117
|
{
|
|
72
118
|
ref,
|
|
73
119
|
href: item.url,
|
|
120
|
+
onActiveChange: (active) => {
|
|
121
|
+
const element = ref.current;
|
|
122
|
+
if (active && element)
|
|
123
|
+
setMarker([element.offsetTop, element.clientHeight]);
|
|
124
|
+
},
|
|
74
125
|
className: twMerge(
|
|
75
|
-
"
|
|
126
|
+
"py-1 transition-colors data-[active=true]:font-medium data-[active=true]:text-primary",
|
|
76
127
|
item.depth <= 2 && "ps-4",
|
|
77
128
|
item.depth === 3 && "ps-7",
|
|
78
129
|
item.depth >= 4 && "ps-10"
|
|
@@ -82,7 +133,7 @@ function TOCItem2({
|
|
|
82
133
|
);
|
|
83
134
|
}
|
|
84
135
|
|
|
85
|
-
// src/components/breadcrumb.tsx
|
|
136
|
+
// src/components/layout/breadcrumb.tsx
|
|
86
137
|
import { ChevronRight } from "lucide-react";
|
|
87
138
|
import { useBreadcrumb } from "fumadocs-core/breadcrumb";
|
|
88
139
|
import Link from "next/link";
|
|
@@ -120,7 +171,7 @@ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
|
120
171
|
function LastUpdate(props) {
|
|
121
172
|
const { text } = useI18n();
|
|
122
173
|
const [date, setDate] = useState("");
|
|
123
|
-
|
|
174
|
+
useEffect(() => {
|
|
124
175
|
setDate(props.date.toLocaleDateString());
|
|
125
176
|
}, [props.date]);
|
|
126
177
|
return /* @__PURE__ */ jsxs3("p", { className: "mt-8 text-xs text-muted-foreground", children: [
|
|
@@ -164,5 +215,7 @@ export {
|
|
|
164
215
|
Breadcrumb,
|
|
165
216
|
Footer,
|
|
166
217
|
LastUpdate,
|
|
167
|
-
|
|
218
|
+
SubToc,
|
|
219
|
+
Toc,
|
|
220
|
+
TocProvider
|
|
168
221
|
};
|
package/dist/page.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ReactNode, HTMLAttributes } from 'react';
|
|
3
|
-
import { TableOfContents
|
|
4
|
-
import { FooterProps } from './page.client.js';
|
|
3
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
4
|
+
import { TOCProps, FooterProps } from './page.client.js';
|
|
5
|
+
import 'fumadocs-core/toc-internal';
|
|
5
6
|
|
|
6
7
|
type TableOfContentOptions = Omit<TOCProps, 'items'> & {
|
|
7
8
|
enabled: boolean;
|
|
@@ -18,6 +19,7 @@ interface FooterOptions extends FooterProps {
|
|
|
18
19
|
interface DocsPageProps {
|
|
19
20
|
toc?: TableOfContents;
|
|
20
21
|
tableOfContent?: Partial<TableOfContentOptions>;
|
|
22
|
+
tableOfContentPopover?: Partial<TableOfContentOptions>;
|
|
21
23
|
/**
|
|
22
24
|
* Replace or disable breadcrumb
|
|
23
25
|
*/
|
|
@@ -29,18 +31,7 @@ interface DocsPageProps {
|
|
|
29
31
|
lastUpdate?: Date | string | number;
|
|
30
32
|
children: ReactNode;
|
|
31
33
|
}
|
|
32
|
-
declare function DocsPage({ tableOfContent, breadcrumb, footer, ...props }: DocsPageProps): React.ReactElement;
|
|
33
|
-
interface TOCProps {
|
|
34
|
-
items: TOCItemType[];
|
|
35
|
-
/**
|
|
36
|
-
* Custom content in TOC container, before the main TOC
|
|
37
|
-
*/
|
|
38
|
-
header: ReactNode;
|
|
39
|
-
/**
|
|
40
|
-
* Custom content in TOC container, after the main TOC
|
|
41
|
-
*/
|
|
42
|
-
footer: ReactNode;
|
|
43
|
-
}
|
|
34
|
+
declare function DocsPage({ toc, tableOfContent, breadcrumb, tableOfContentPopover, footer, ...props }: DocsPageProps): React.ReactElement;
|
|
44
35
|
/**
|
|
45
36
|
* Add typography styles
|
|
46
37
|
*/
|
package/dist/page.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
Toc,
|
|
3
|
+
SubToc,
|
|
3
4
|
Breadcrumb,
|
|
4
5
|
Footer,
|
|
6
|
+
TocProvider,
|
|
5
7
|
LastUpdate,
|
|
6
8
|
} from "./page.client"
|
|
7
9
|
import {
|
|
@@ -14,26 +16,39 @@ import "./chunk-MLKGABMK.js";
|
|
|
14
16
|
|
|
15
17
|
// src/page.tsx
|
|
16
18
|
import { forwardRef } from "react";
|
|
17
|
-
import {
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
20
|
function DocsPage({
|
|
21
|
+
toc = [],
|
|
19
22
|
tableOfContent = {},
|
|
20
23
|
breadcrumb = {},
|
|
24
|
+
tableOfContentPopover = {},
|
|
21
25
|
footer = {},
|
|
22
26
|
...props
|
|
23
27
|
}) {
|
|
24
|
-
return /* @__PURE__ */ jsxs(
|
|
28
|
+
return /* @__PURE__ */ jsxs(TocProvider, { toc, children: [
|
|
25
29
|
/* @__PURE__ */ jsxs(
|
|
26
30
|
"article",
|
|
27
31
|
{
|
|
28
32
|
className: twMerge(
|
|
29
|
-
"mx-auto flex w-0 max-w-[800px] flex-1 flex-col gap-6 px-4 py-10 md:px-6 md:pt-
|
|
33
|
+
"mx-auto flex w-0 max-w-[800px] flex-1 flex-col gap-6 px-4 py-10 md:px-6 md:pt-12",
|
|
30
34
|
tableOfContent.enabled === false && "max-w-[1200px]"
|
|
31
35
|
),
|
|
32
36
|
children: [
|
|
33
37
|
replaceOrDefault(breadcrumb, /* @__PURE__ */ jsx(Breadcrumb, {})),
|
|
34
38
|
props.children,
|
|
35
39
|
props.lastUpdate ? /* @__PURE__ */ jsx(LastUpdate, { date: new Date(props.lastUpdate) }) : null,
|
|
36
|
-
replaceOrDefault(footer, /* @__PURE__ */ jsx(Footer, { items: footer.items }))
|
|
40
|
+
replaceOrDefault(footer, /* @__PURE__ */ jsx(Footer, { items: footer.items })),
|
|
41
|
+
replaceOrDefault(
|
|
42
|
+
tableOfContentPopover,
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
SubToc,
|
|
45
|
+
{
|
|
46
|
+
items: toc,
|
|
47
|
+
header: tableOfContentPopover.header,
|
|
48
|
+
footer: tableOfContentPopover.footer
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
)
|
|
37
52
|
]
|
|
38
53
|
}
|
|
39
54
|
),
|
|
@@ -42,7 +57,7 @@ function DocsPage({
|
|
|
42
57
|
/* @__PURE__ */ jsx(
|
|
43
58
|
Toc,
|
|
44
59
|
{
|
|
45
|
-
items:
|
|
60
|
+
items: toc,
|
|
46
61
|
header: tableOfContent.header,
|
|
47
62
|
footer: tableOfContent.footer
|
|
48
63
|
}
|
|
@@ -50,13 +65,6 @@ function DocsPage({
|
|
|
50
65
|
)
|
|
51
66
|
] });
|
|
52
67
|
}
|
|
53
|
-
function Toc(props) {
|
|
54
|
-
return /* @__PURE__ */ jsxs("div", { className: "sticky top-0 flex h-dvh w-[220px] flex-col gap-4 divide-y py-10 max-lg:hidden xl:w-[260px]", children: [
|
|
55
|
-
props.header,
|
|
56
|
-
props.items.length > 0 && /* @__PURE__ */ jsx(TOCItems, { items: props.items }),
|
|
57
|
-
props.footer ? /* @__PURE__ */ jsx("div", { className: "pt-4 first:pt-0", children: props.footer }) : null
|
|
58
|
-
] });
|
|
59
|
-
}
|
|
60
68
|
var DocsBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: twMerge("prose", className), ...props }));
|
|
61
69
|
DocsBody.displayName = "DocsBody";
|
|
62
70
|
function withArticle({
|
package/dist/provider.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { MutableRefObject, ReactNode } from 'react';
|
|
|
3
3
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
|
4
4
|
import { DefaultSearchDialogProps } from './components/dialog/search-default.js';
|
|
5
5
|
import { SearchLink, SharedProps } from './components/dialog/search.js';
|
|
6
|
-
export { u as useI18n } from './i18n-
|
|
6
|
+
export { u as useI18n } from './i18n-DSnJuWoW.js';
|
|
7
7
|
export { u as useTreeContext } from './tree-CrKzI9Nz.js';
|
|
8
8
|
import 'fumadocs-core/search/shared';
|
|
9
9
|
import 'fumadocs-core/server';
|