fumadocs-ui 13.4.10 → 14.0.1
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-774JT2B6.js → chunk-5KVEK5A7.js} +11 -8
- package/dist/chunk-5QPVK7QM.js +542 -0
- package/dist/chunk-BN7HGCQ4.js +212 -0
- package/dist/chunk-CDPVENXR.js +8 -0
- package/dist/{chunk-KWZZNVSY.js → chunk-CPGKWLLV.js} +7 -3
- package/dist/chunk-DN6Z5VW6.js +61 -0
- package/dist/{chunk-HOIRMHZT.js → chunk-E3VO2QQT.js} +10 -2
- package/dist/chunk-GHOAONNQ.js +48 -0
- package/dist/{chunk-ERUVE5R6.js → chunk-IHIFNFRB.js} +4 -2
- package/dist/{chunk-CP67AHDD.js → chunk-IVBHRX3O.js} +1 -1
- package/dist/{chunk-NSEJBI4V.js → chunk-KZTWSBYY.js} +28 -16
- package/dist/chunk-MCX7E6ZW.js +57 -0
- package/dist/chunk-PZTQPB4U.js +125 -0
- package/dist/{chunk-EDNTYBXS.js → chunk-QKOA6KEZ.js} +2 -17
- package/dist/{chunk-YIOV4KEY.js → chunk-TYZZJ335.js} +26 -16
- package/dist/chunk-V6RONFCQ.js +69 -0
- package/dist/chunk-WRBUXI2A.js +82 -0
- package/dist/chunk-YL3MZH7N.js +66 -0
- package/dist/components/accordion.js +7 -3
- package/dist/components/api.d.ts +2 -5
- package/dist/components/api.js +2 -4
- package/dist/components/banner.js +5 -6
- package/dist/components/callout.js +2 -1
- package/dist/components/card.d.ts +6 -5
- package/dist/components/card.js +1 -1
- package/dist/components/codeblock.js +4 -3
- package/dist/components/dialog/search-algolia.d.ts +10 -4
- package/dist/components/dialog/search-algolia.js +25 -15
- package/dist/components/dialog/search-default.d.ts +10 -6
- package/dist/components/dialog/search-default.js +27 -5
- package/dist/components/dialog/search.d.ts +7 -7
- package/dist/components/dialog/search.js +4 -3
- package/dist/components/files.js +15 -11
- package/dist/components/heading.js +2 -1
- package/dist/components/image-zoom.js +8 -5
- package/dist/components/inline-toc.js +3 -1
- package/dist/components/layout/language-toggle.d.ts +4 -3
- package/dist/components/layout/language-toggle.js +8 -6
- package/dist/components/layout/root-toggle.d.ts +3 -3
- package/dist/components/layout/root-toggle.js +7 -73
- package/dist/components/tabs.js +30 -13
- package/dist/components/type-table.d.ts +7 -5
- package/dist/components/type-table.js +11 -11
- package/dist/dynamic-sidebar-QWGMOUMS.js +129 -0
- package/dist/{edit-on-github-YFVYCMB7.js → edit-on-github-PCTRDRD6.js} +10 -8
- package/dist/layouts/docs.client.d.ts +27 -0
- package/dist/layouts/docs.client.js +200 -0
- package/dist/layouts/docs.d.ts +30 -0
- package/dist/layouts/docs.js +207 -0
- package/dist/layouts/home.client.d.ts +11 -0
- package/dist/layouts/home.client.js +274 -0
- package/dist/layouts/home.d.ts +7 -0
- package/dist/layouts/home.js +61 -0
- package/dist/layouts/shared.d.ts +2 -0
- package/dist/layouts/shared.js +9 -0
- package/dist/mdx.client.js +4 -3
- package/dist/mdx.d.ts +1 -2
- package/dist/mdx.js +8 -10
- package/dist/og.d.ts +1 -7
- package/dist/og.js +5 -15
- package/dist/page.client.d.ts +2 -1
- package/dist/page.client.js +91 -63
- package/dist/page.d.ts +7 -6
- package/dist/page.js +78 -62
- package/dist/provider.d.ts +1 -2
- package/dist/provider.js +3 -4
- package/dist/shared-SScCiV7b.d.ts +152 -0
- package/dist/{sidebar-DwBSl7jC.d.ts → sidebar-CQ4HmzQl.d.ts} +8 -9
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.js +86 -39
- package/dist/{toc-clerk-CAID2WGC.js → toc-clerk-SKE4LBT7.js} +40 -50
- package/dist/{tree-CrKzI9Nz.d.ts → tree-06ley65N.d.ts} +9 -3
- package/package.json +32 -68
- package/dist/chunk-KCZRDPB4.js +0 -308
- package/dist/chunk-LSTPTAZ5.js +0 -58
- package/dist/chunk-P4HLRHHV.js +0 -36
- package/dist/chunk-UOD2T27N.js +0 -27
- package/dist/chunk-WLTWFYQA.js +0 -44
- package/dist/docs-layout.client.d.ts +0 -18
- package/dist/docs-layout.client.js +0 -406
- package/dist/home-layout.client.d.ts +0 -9
- package/dist/home-layout.client.js +0 -88
- package/dist/home-layout.d.ts +0 -7
- package/dist/home-layout.js +0 -30
- package/dist/layout.d.ts +0 -19
- package/dist/layout.js +0 -127
- package/dist/layout.shared-DEQFTB9M.d.ts +0 -117
- package/dist/twoslash/popup.d.ts +0 -11
- package/dist/twoslash/popup.js +0 -97
- package/dist/twoslash.css +0 -1
- /package/dist/{image-zoom.css → components/image-zoom.css} +0 -0
package/dist/page.client.js
CHANGED
|
@@ -1,71 +1,103 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
TocThumb
|
|
4
|
+
} from "./chunk-DN6Z5VW6.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
ScrollArea,
|
|
10
|
-
ScrollViewport
|
|
11
|
-
} from "./chunk-2FLZOPQN.js";
|
|
6
|
+
NavContext
|
|
7
|
+
} from "./chunk-MCX7E6ZW.js";
|
|
12
8
|
import {
|
|
13
9
|
Popover,
|
|
14
10
|
PopoverContent,
|
|
15
11
|
PopoverTrigger
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-UOD2T27N.js";
|
|
12
|
+
} from "./chunk-IVBHRX3O.js";
|
|
18
13
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
ScrollArea,
|
|
15
|
+
ScrollViewport
|
|
16
|
+
} from "./chunk-2FLZOPQN.js";
|
|
17
|
+
import {
|
|
18
|
+
ChevronLeft,
|
|
19
|
+
ChevronRight,
|
|
20
|
+
Text
|
|
21
|
+
} from "./chunk-5QPVK7QM.js";
|
|
21
22
|
import {
|
|
22
23
|
twMerge
|
|
23
24
|
} from "./chunk-TK3TM3MR.js";
|
|
25
|
+
import {
|
|
26
|
+
useTreeContext
|
|
27
|
+
} from "./chunk-YL3MZH7N.js";
|
|
28
|
+
import {
|
|
29
|
+
useSidebar
|
|
30
|
+
} from "./chunk-27HFSL7N.js";
|
|
31
|
+
import {
|
|
32
|
+
useI18n
|
|
33
|
+
} from "./chunk-EFMHXXHW.js";
|
|
24
34
|
import "./chunk-MLKGABMK.js";
|
|
25
35
|
|
|
26
36
|
// src/page.client.tsx
|
|
27
|
-
import { useEffect, useMemo as
|
|
28
|
-
import { ChevronLeft, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
37
|
+
import { useEffect, useMemo as useMemo3, useState } from "react";
|
|
29
38
|
import Link2 from "next/link";
|
|
30
|
-
import { usePathname as usePathname2 } from "next/navigation";
|
|
31
39
|
import { cva } from "class-variance-authority";
|
|
32
40
|
|
|
33
41
|
// src/components/layout/toc.tsx
|
|
34
|
-
import { ChevronRight, Text } from "lucide-react";
|
|
35
42
|
import * as Primitive from "fumadocs-core/toc";
|
|
36
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
useContext,
|
|
45
|
+
useMemo,
|
|
46
|
+
useRef
|
|
47
|
+
} from "react";
|
|
37
48
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
38
49
|
function Toc({ header, footer, children }) {
|
|
39
50
|
const { text } = useI18n();
|
|
40
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
41
52
|
"div",
|
|
42
53
|
{
|
|
43
54
|
"data-toc": "",
|
|
44
|
-
className: "sticky top-
|
|
45
|
-
|
|
55
|
+
className: "sticky top-fd-layout-top h-[var(--fd-toc-height)] flex-1 pb-2 pt-12 max-lg:hidden",
|
|
56
|
+
style: {
|
|
57
|
+
"--fd-toc-height": "calc(100dvh - var(--fd-banner-height) - var(--fd-nav-height))"
|
|
58
|
+
},
|
|
59
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] flex-col gap-3 pe-2", children: [
|
|
46
60
|
header,
|
|
47
|
-
/* @__PURE__ */ jsxs("h3", { className: "-
|
|
61
|
+
/* @__PURE__ */ jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [
|
|
48
62
|
/* @__PURE__ */ jsx(Text, { className: "size-4" }),
|
|
49
63
|
text.toc
|
|
50
64
|
] }),
|
|
51
65
|
children,
|
|
52
66
|
footer
|
|
53
|
-
]
|
|
67
|
+
] })
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function TocNav(props) {
|
|
72
|
+
const { open } = useSidebar();
|
|
73
|
+
const { isTransparent } = useContext(NavContext);
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
id: "nd-tocnav",
|
|
78
|
+
className: twMerge(
|
|
79
|
+
"sticky top-fd-layout-top z-10 border-b border-fd-foreground/10 text-sm transition-colors md:top-[var(--fd-toc-top-with-offset)] md:mx-3 md:rounded-full md:border",
|
|
80
|
+
!isTransparent && "bg-fd-background/80 backdrop-blur-md md:shadow-md",
|
|
81
|
+
open && "opacity-0",
|
|
82
|
+
props.className
|
|
83
|
+
),
|
|
84
|
+
style: {
|
|
85
|
+
"--fd-toc-top-with-offset": "calc(4px + var(--fd-banner-height) + var(--fd-nav-height))"
|
|
86
|
+
},
|
|
87
|
+
children: props.children
|
|
54
88
|
}
|
|
55
89
|
);
|
|
56
90
|
}
|
|
57
91
|
function TocPopover({
|
|
58
|
-
header,
|
|
59
|
-
footer,
|
|
60
92
|
items,
|
|
61
|
-
|
|
93
|
+
...props
|
|
62
94
|
}) {
|
|
63
95
|
const { text } = useI18n();
|
|
64
96
|
const active = Primitive.useActiveAnchor();
|
|
65
97
|
const current = useMemo(() => {
|
|
66
98
|
return items.find((item) => active === item.url.slice(1))?.title;
|
|
67
99
|
}, [items, active]);
|
|
68
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
100
|
+
return /* @__PURE__ */ jsx(TocNav, { ...props, children: /* @__PURE__ */ jsxs(Popover, { children: [
|
|
69
101
|
/* @__PURE__ */ jsxs(PopoverTrigger, { className: "inline-flex size-full items-center gap-2 text-nowrap px-4 py-2 text-left md:px-3", children: [
|
|
70
102
|
/* @__PURE__ */ jsx(Text, { className: "size-4 shrink-0" }),
|
|
71
103
|
text.toc,
|
|
@@ -84,13 +116,13 @@ function TocPopover({
|
|
|
84
116
|
className: "flex max-h-[var(--radix-popover-content-available-height)] w-[260px] flex-col gap-4 p-3",
|
|
85
117
|
"data-toc-popover": "",
|
|
86
118
|
children: [
|
|
87
|
-
header,
|
|
88
|
-
children,
|
|
89
|
-
footer
|
|
119
|
+
props.header,
|
|
120
|
+
props.children,
|
|
121
|
+
props.footer
|
|
90
122
|
]
|
|
91
123
|
}
|
|
92
124
|
)
|
|
93
|
-
] });
|
|
125
|
+
] }) });
|
|
94
126
|
}
|
|
95
127
|
function TOCItems({
|
|
96
128
|
items,
|
|
@@ -98,32 +130,29 @@ function TOCItems({
|
|
|
98
130
|
}) {
|
|
99
131
|
const { text } = useI18n();
|
|
100
132
|
const containerRef = useRef(null);
|
|
101
|
-
const
|
|
133
|
+
const viewRef = useRef(null);
|
|
102
134
|
if (items.length === 0)
|
|
103
135
|
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings });
|
|
104
|
-
return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", isMenu && "-ms-3"), children: /* @__PURE__ */ jsxs(ScrollViewport, { className: "relative min-h-0 text-sm", ref:
|
|
136
|
+
return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", isMenu && "-ms-3"), children: /* @__PURE__ */ jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: /* @__PURE__ */ jsxs(ScrollViewport, { className: "relative min-h-0 text-sm", ref: viewRef, children: [
|
|
105
137
|
/* @__PURE__ */ jsx(
|
|
106
|
-
|
|
138
|
+
TocThumb,
|
|
107
139
|
{
|
|
108
|
-
|
|
109
|
-
className: "absolute start-0 w-px bg-fd-primary transition-all"
|
|
110
|
-
style: {
|
|
111
|
-
top: pos[0],
|
|
112
|
-
height: pos[1]
|
|
113
|
-
}
|
|
140
|
+
containerRef,
|
|
141
|
+
className: "absolute start-0 mt-[var(--fd-top)] h-[var(--fd-height)] w-px bg-fd-primary transition-all"
|
|
114
142
|
}
|
|
115
143
|
),
|
|
116
|
-
/* @__PURE__ */ jsx(
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
117
145
|
"div",
|
|
118
146
|
{
|
|
147
|
+
ref: containerRef,
|
|
119
148
|
className: twMerge(
|
|
120
|
-
"flex flex-col
|
|
149
|
+
"flex flex-col",
|
|
121
150
|
!isMenu && "border-s border-fd-foreground/10"
|
|
122
151
|
),
|
|
123
152
|
children: items.map((item) => /* @__PURE__ */ jsx(TOCItem2, { item }, item.url))
|
|
124
153
|
}
|
|
125
|
-
)
|
|
126
|
-
] }) });
|
|
154
|
+
)
|
|
155
|
+
] }) }) });
|
|
127
156
|
}
|
|
128
157
|
function TOCItem2({ item }) {
|
|
129
158
|
return /* @__PURE__ */ jsx(
|
|
@@ -131,7 +160,7 @@ function TOCItem2({ item }) {
|
|
|
131
160
|
{
|
|
132
161
|
href: item.url,
|
|
133
162
|
className: twMerge(
|
|
134
|
-
"py-1.5 transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
163
|
+
"prose py-1.5 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
135
164
|
item.depth <= 2 && "ps-3.5",
|
|
136
165
|
item.depth === 3 && "ps-6",
|
|
137
166
|
item.depth >= 4 && "ps-8"
|
|
@@ -142,27 +171,26 @@ function TOCItem2({ item }) {
|
|
|
142
171
|
}
|
|
143
172
|
|
|
144
173
|
// src/components/layout/breadcrumb.tsx
|
|
145
|
-
import { ChevronRight as ChevronRight2 } from "lucide-react";
|
|
146
174
|
import {
|
|
147
|
-
|
|
175
|
+
getBreadcrumbItemsFromPath
|
|
148
176
|
} from "fumadocs-core/breadcrumb";
|
|
149
177
|
import Link from "next/link";
|
|
150
|
-
import {
|
|
151
|
-
import { Fragment as Fragment2 } from "react";
|
|
178
|
+
import { Fragment as Fragment2, useMemo as useMemo2 } from "react";
|
|
152
179
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
153
180
|
function Breadcrumb({
|
|
154
181
|
full = false,
|
|
155
182
|
...options
|
|
156
183
|
}) {
|
|
157
|
-
const { root } = useTreeContext();
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
184
|
+
const { path, root } = useTreeContext();
|
|
185
|
+
const items = useMemo2(() => {
|
|
186
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
187
|
+
includePage: full,
|
|
188
|
+
...options
|
|
189
|
+
});
|
|
190
|
+
}, [full, options, path, root]);
|
|
163
191
|
if (items.length === 0) return null;
|
|
164
192
|
return /* @__PURE__ */ jsx2("div", { className: "-mb-3 flex flex-row items-center gap-1 text-sm font-medium text-fd-muted-foreground", children: items.map((item, i) => /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
165
|
-
i !== 0 && /* @__PURE__ */ jsx2(
|
|
193
|
+
i !== 0 && /* @__PURE__ */ jsx2(ChevronRight, { className: "size-4 shrink-0 rtl:rotate-180" }),
|
|
166
194
|
item.url ? /* @__PURE__ */ jsx2(
|
|
167
195
|
Link,
|
|
168
196
|
{
|
|
@@ -182,7 +210,7 @@ function LastUpdate(props) {
|
|
|
182
210
|
useEffect(() => {
|
|
183
211
|
setDate(props.date.toLocaleDateString());
|
|
184
212
|
}, [props.date]);
|
|
185
|
-
return /* @__PURE__ */ jsxs3("p", { className: "text-
|
|
213
|
+
return /* @__PURE__ */ jsxs3("p", { className: "text-sm text-fd-muted-foreground", children: [
|
|
186
214
|
text.lastUpdate,
|
|
187
215
|
" ",
|
|
188
216
|
date
|
|
@@ -196,15 +224,15 @@ var itemLabel = cva(
|
|
|
196
224
|
);
|
|
197
225
|
function Footer({ items }) {
|
|
198
226
|
const tree = useTreeContext();
|
|
199
|
-
const pathname = usePathname2();
|
|
200
227
|
const { text } = useI18n();
|
|
201
|
-
const { previous
|
|
202
|
-
|
|
228
|
+
const { previous, next } = useMemo3(() => {
|
|
229
|
+
if (items) return items;
|
|
230
|
+
const neighbours = tree.getNeighbours();
|
|
203
231
|
return {
|
|
204
|
-
previous:
|
|
205
|
-
next:
|
|
232
|
+
previous: neighbours[0],
|
|
233
|
+
next: neighbours[1]
|
|
206
234
|
};
|
|
207
|
-
}, [
|
|
235
|
+
}, [items, tree]);
|
|
208
236
|
return /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-2 gap-4 pb-6", children: [
|
|
209
237
|
previous ? /* @__PURE__ */ jsxs3(Link2, { href: previous.url, className: twMerge(itemVariants()), children: [
|
|
210
238
|
/* @__PURE__ */ jsxs3("div", { className: twMerge(itemLabel()), children: [
|
|
@@ -220,7 +248,7 @@ function Footer({ items }) {
|
|
|
220
248
|
className: twMerge(itemVariants({ className: "col-start-2 text-end" })),
|
|
221
249
|
children: [
|
|
222
250
|
/* @__PURE__ */ jsxs3("div", { className: twMerge(itemLabel({ className: "flex-row-reverse" })), children: [
|
|
223
|
-
/* @__PURE__ */ jsx3(
|
|
251
|
+
/* @__PURE__ */ jsx3(ChevronRight, { className: "-me-1 size-4 shrink-0 rtl:rotate-180" }),
|
|
224
252
|
/* @__PURE__ */ jsx3("p", { children: text.nextPage })
|
|
225
253
|
] }),
|
|
226
254
|
/* @__PURE__ */ jsx3("p", { className: "font-medium", children: next.name })
|
package/dist/page.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { AnchorHTMLAttributes, ReactNode, HTMLAttributes } from 'react';
|
|
3
|
-
import { TableOfContents } from 'fumadocs-core/server';
|
|
4
|
-
import { Page } from 'fumadocs-core/source';
|
|
3
|
+
import { TableOfContents, PageTree } from 'fumadocs-core/server';
|
|
4
|
+
import { Page, LoaderOutput, LoaderConfig } from 'fumadocs-core/source';
|
|
5
5
|
import { AnchorProviderProps } from 'fumadocs-core/toc';
|
|
6
6
|
import { TOCProps, BreadcrumbProps, FooterProps } from './page.client.js';
|
|
7
7
|
import 'fumadocs-core/breadcrumb';
|
|
@@ -60,17 +60,18 @@ interface DocsPageProps {
|
|
|
60
60
|
lastUpdate?: Date | string | number;
|
|
61
61
|
children: ReactNode;
|
|
62
62
|
}
|
|
63
|
-
declare function DocsPage({ toc, breadcrumb, full, footer, ...props }: DocsPageProps): React.ReactElement;
|
|
63
|
+
declare function DocsPage({ toc, breadcrumb, full, footer, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps): React.ReactElement;
|
|
64
64
|
/**
|
|
65
65
|
* Add typography styles
|
|
66
66
|
*/
|
|
67
67
|
declare const DocsBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
68
68
|
declare const DocsDescription: react.ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & react.RefAttributes<HTMLParagraphElement>>;
|
|
69
69
|
declare const DocsTitle: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & react.RefAttributes<HTMLHeadingElement>>;
|
|
70
|
-
declare function DocsCategory({ page,
|
|
70
|
+
declare function DocsCategory({ page, from, tree: forcedTree, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
71
71
|
page: Page;
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
from: LoaderOutput<LoaderConfig>;
|
|
73
|
+
tree?: PageTree.Root;
|
|
74
|
+
}): React.ReactNode;
|
|
74
75
|
/**
|
|
75
76
|
* For separate MDX page
|
|
76
77
|
*/
|
package/dist/page.js
CHANGED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
} from "./page.client"
|
|
9
9
|
import {
|
|
10
10
|
replaceOrDefault
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-E3VO2QQT.js";
|
|
12
12
|
import {
|
|
13
13
|
Card,
|
|
14
14
|
Cards
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GHOAONNQ.js";
|
|
16
16
|
import {
|
|
17
17
|
twMerge
|
|
18
18
|
} from "./chunk-TK3TM3MR.js";
|
|
@@ -22,81 +22,78 @@ import "./chunk-MLKGABMK.js";
|
|
|
22
22
|
import { forwardRef } from "react";
|
|
23
23
|
import dynamic from "next/dynamic";
|
|
24
24
|
import { AnchorProvider } from "fumadocs-core/toc";
|
|
25
|
-
import {
|
|
26
|
-
var ClerkTOCItems = dynamic(() => import("./toc-clerk-
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
var ClerkTOCItems = dynamic(() => import("./toc-clerk-SKE4LBT7.js"));
|
|
27
27
|
var EditOnGitHub = dynamic(
|
|
28
|
-
() => import("./edit-on-github-
|
|
28
|
+
() => import("./edit-on-github-PCTRDRD6.js")
|
|
29
29
|
);
|
|
30
30
|
function DocsPage({
|
|
31
31
|
toc = [],
|
|
32
32
|
breadcrumb = {},
|
|
33
33
|
full = false,
|
|
34
34
|
footer = {},
|
|
35
|
+
tableOfContentPopover: {
|
|
36
|
+
enabled: tocPopoverEnabled = true,
|
|
37
|
+
component: tocPopoverReplace,
|
|
38
|
+
...tocPopoverOptions
|
|
39
|
+
} = {},
|
|
40
|
+
tableOfContent: {
|
|
41
|
+
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
42
|
+
enabled: tocEnabled = !full,
|
|
43
|
+
component: tocReplace,
|
|
44
|
+
...tocOptions
|
|
45
|
+
} = {},
|
|
35
46
|
...props
|
|
36
47
|
}) {
|
|
37
|
-
const tocPopoverOptions = {
|
|
38
|
-
...props.tableOfContentPopover
|
|
39
|
-
};
|
|
40
|
-
const tocOptions = {
|
|
41
|
-
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
42
|
-
enabled: props.tableOfContent?.enabled ?? !full,
|
|
43
|
-
...props.tableOfContent
|
|
44
|
-
};
|
|
45
|
-
if (props.editOnGithub) {
|
|
46
|
-
tocOptions.footer = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
|
-
tocOptions.footer,
|
|
48
|
-
/* @__PURE__ */ jsx(EditOnGitHub, { ...props.editOnGithub })
|
|
49
|
-
] });
|
|
50
|
-
tocPopoverOptions.footer = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
-
tocPopoverOptions.footer,
|
|
52
|
-
/* @__PURE__ */ jsx(EditOnGitHub, { ...props.editOnGithub })
|
|
53
|
-
] });
|
|
54
|
-
}
|
|
55
48
|
return /* @__PURE__ */ jsxs(AnchorProvider, { toc, single: tocOptions.single, children: [
|
|
56
49
|
/* @__PURE__ */ jsxs(
|
|
57
50
|
"div",
|
|
58
51
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
52
|
+
id: "nd-page",
|
|
53
|
+
className: "flex w-full min-w-0 max-w-[var(--fd-page-width)] flex-col md:transition-[max-width]",
|
|
54
|
+
style: {
|
|
55
|
+
"--fd-page-width": "calc(min(100vw, var(--fd-layout-width)) - var(--fd-sidebar-width) - var(--fd-toc-width))",
|
|
56
|
+
"--fd-toc-width": tocEnabled ? void 0 : "0px"
|
|
57
|
+
},
|
|
64
58
|
children: [
|
|
65
59
|
replaceOrDefault(
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */ jsx(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"sticky top-14 z-10 border-b bg-fd-background/60 text-sm backdrop-blur-md md:top-1 md:mx-3 md:rounded-full md:border md:shadow-md",
|
|
73
|
-
tocPopoverOptions.enabled !== true && "lg:hidden"
|
|
74
|
-
),
|
|
75
|
-
children: /* @__PURE__ */ jsx(
|
|
76
|
-
TocPopover,
|
|
77
|
-
{
|
|
78
|
-
items: toc,
|
|
79
|
-
header: tocPopoverOptions.header,
|
|
80
|
-
footer: tocPopoverOptions.footer,
|
|
81
|
-
children: tocPopoverOptions.style === "clerk" ? /* @__PURE__ */ jsx(ClerkTOCItems, { items: toc, isMenu: true }) : /* @__PURE__ */ jsx(TOCItems, { items: toc, isMenu: true })
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
)
|
|
60
|
+
{ enabled: tocPopoverEnabled, component: tocPopoverReplace },
|
|
61
|
+
/* @__PURE__ */ jsx(TocPopover, { items: toc, ...tocPopoverOptions, className: "lg:hidden", children: tocPopoverOptions.style === "clerk" ? /* @__PURE__ */ jsx(ClerkTOCItems, { items: toc, isMenu: true }) : /* @__PURE__ */ jsx(TOCItems, { items: toc, isMenu: true }) }),
|
|
62
|
+
{
|
|
63
|
+
items: toc,
|
|
64
|
+
...tocPopoverOptions
|
|
65
|
+
}
|
|
86
66
|
),
|
|
87
|
-
/* @__PURE__ */ jsxs(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
67
|
+
/* @__PURE__ */ jsxs(
|
|
68
|
+
"article",
|
|
69
|
+
{
|
|
70
|
+
className: twMerge(
|
|
71
|
+
"mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-10 md:px-6 md:pt-12",
|
|
72
|
+
tocEnabled ? "max-w-[860px]" : "max-w-[1120px]"
|
|
73
|
+
),
|
|
74
|
+
children: [
|
|
75
|
+
replaceOrDefault(breadcrumb, /* @__PURE__ */ jsx(Breadcrumb, { ...breadcrumb })),
|
|
76
|
+
props.children,
|
|
77
|
+
/* @__PURE__ */ jsx("div", { role: "none", className: "flex-1" }),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [
|
|
79
|
+
props.editOnGithub ? /* @__PURE__ */ jsx(EditOnGitHub, { ...props.editOnGithub }) : null,
|
|
80
|
+
props.lastUpdate ? /* @__PURE__ */ jsx(LastUpdate, { date: new Date(props.lastUpdate) }) : null
|
|
81
|
+
] }),
|
|
82
|
+
replaceOrDefault(footer, /* @__PURE__ */ jsx(Footer, { items: footer.items }))
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
)
|
|
94
86
|
]
|
|
95
87
|
}
|
|
96
88
|
),
|
|
97
89
|
replaceOrDefault(
|
|
98
|
-
|
|
99
|
-
/* @__PURE__ */ jsx(Toc, {
|
|
90
|
+
{ enabled: tocEnabled, component: tocReplace },
|
|
91
|
+
/* @__PURE__ */ jsx(Toc, { ...tocOptions, children: tocOptions.style === "clerk" ? /* @__PURE__ */ jsx(ClerkTOCItems, { items: toc }) : /* @__PURE__ */ jsx(TOCItems, { items: toc }) }),
|
|
92
|
+
{
|
|
93
|
+
items: toc,
|
|
94
|
+
...tocOptions
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ jsx("div", { role: "none", className: "flex-1" })
|
|
100
97
|
)
|
|
101
98
|
] });
|
|
102
99
|
}
|
|
@@ -127,15 +124,34 @@ var DocsTitle = forwardRef((props, ref) => {
|
|
|
127
124
|
);
|
|
128
125
|
});
|
|
129
126
|
DocsTitle.displayName = "DocsTitle";
|
|
127
|
+
function findParent(node, page) {
|
|
128
|
+
if ("index" in node && node.index?.$ref?.file === page.file.path) {
|
|
129
|
+
return node;
|
|
130
|
+
}
|
|
131
|
+
for (const child of node.children) {
|
|
132
|
+
if (child.type === "folder") {
|
|
133
|
+
const parent = findParent(child, page);
|
|
134
|
+
if (parent) return parent;
|
|
135
|
+
}
|
|
136
|
+
if (child.type === "page" && child.$ref?.file === page.file.path) {
|
|
137
|
+
return node;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
130
141
|
function DocsCategory({
|
|
131
142
|
page,
|
|
132
|
-
|
|
143
|
+
from,
|
|
144
|
+
tree: forcedTree,
|
|
133
145
|
...props
|
|
134
146
|
}) {
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
);
|
|
138
|
-
|
|
147
|
+
const tree = forcedTree ?? (from._i18n ? from.pageTree[page.locale ?? from._i18n.defaultLanguage] : from.pageTree);
|
|
148
|
+
const parent = findParent(tree, page);
|
|
149
|
+
if (!parent) return null;
|
|
150
|
+
const items = parent.children.flatMap((item) => {
|
|
151
|
+
if (item.type !== "page" || item.url === page.url) return [];
|
|
152
|
+
return from.getNodePage(item) ?? [];
|
|
153
|
+
});
|
|
154
|
+
return /* @__PURE__ */ jsx(Cards, { ...props, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
139
155
|
Card,
|
|
140
156
|
{
|
|
141
157
|
title: item.data.title,
|
package/dist/provider.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ 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
6
|
export { u as useI18n } from './i18n-Db2HAPOu.js';
|
|
7
|
-
export { u as useTreeContext } from './tree-
|
|
8
|
-
import 'fumadocs-core/search/shared';
|
|
7
|
+
export { u as useTreeContext } from './tree-06ley65N.js';
|
|
9
8
|
import 'fumadocs-core/server';
|
|
10
9
|
|
|
11
10
|
interface HotKey {
|
package/dist/provider.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useTreeContext
|
|
4
|
-
} from "./chunk-LSTPTAZ5.js";
|
|
5
|
-
import "./chunk-UOD2T27N.js";
|
|
6
2
|
import {
|
|
7
3
|
SearchProvider,
|
|
8
4
|
useSearchContext
|
|
9
5
|
} from "./chunk-ET4TW6M5.js";
|
|
6
|
+
import {
|
|
7
|
+
useTreeContext
|
|
8
|
+
} from "./chunk-YL3MZH7N.js";
|
|
10
9
|
import {
|
|
11
10
|
SidebarProvider,
|
|
12
11
|
useSidebar
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BaseItem {
|
|
5
|
+
/**
|
|
6
|
+
* Restrict where the item is displayed
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue 'all'
|
|
9
|
+
*/
|
|
10
|
+
on?: 'menu' | 'nav' | 'all';
|
|
11
|
+
}
|
|
12
|
+
interface MainItem extends BaseLinkItem {
|
|
13
|
+
type?: 'main';
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
text: ReactNode;
|
|
16
|
+
description?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
interface MenuItem extends BaseItem {
|
|
19
|
+
type: 'menu';
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
text: ReactNode;
|
|
22
|
+
url?: string;
|
|
23
|
+
items: ((MainItem & {
|
|
24
|
+
/**
|
|
25
|
+
* Options when displayed on navigation menu
|
|
26
|
+
*/
|
|
27
|
+
menu?: HTMLAttributes<HTMLElement> & {
|
|
28
|
+
banner?: ReactNode;
|
|
29
|
+
footer?: ReactNode;
|
|
30
|
+
};
|
|
31
|
+
}) | CustomItem)[];
|
|
32
|
+
/**
|
|
33
|
+
* @defaultValue false
|
|
34
|
+
*/
|
|
35
|
+
secondary?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface CustomItem extends BaseItem {
|
|
38
|
+
type: 'custom';
|
|
39
|
+
/**
|
|
40
|
+
* @defaultValue false
|
|
41
|
+
*/
|
|
42
|
+
secondary?: boolean;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
type LinkItemType = MainItem | IconItem | ButtonItem | MenuItem | CustomItem;
|
|
46
|
+
interface BaseLinkItem extends BaseItem {
|
|
47
|
+
url: string;
|
|
48
|
+
/**
|
|
49
|
+
* When the item is marked as active
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue 'url'
|
|
52
|
+
*/
|
|
53
|
+
active?: 'url' | 'nested-url' | 'none';
|
|
54
|
+
external?: boolean;
|
|
55
|
+
}
|
|
56
|
+
declare const BaseLinkItem: react.ForwardRefExoticComponent<{
|
|
57
|
+
item: BaseLinkItem;
|
|
58
|
+
} & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
|
|
59
|
+
interface ButtonItem extends BaseLinkItem {
|
|
60
|
+
type: 'button';
|
|
61
|
+
icon?: ReactNode;
|
|
62
|
+
text: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* @defaultValue false
|
|
65
|
+
*/
|
|
66
|
+
secondary?: boolean;
|
|
67
|
+
}
|
|
68
|
+
declare const ButtonItem: react.ForwardRefExoticComponent<{
|
|
69
|
+
item: ButtonItem;
|
|
70
|
+
} & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
|
|
71
|
+
interface IconItem extends BaseLinkItem {
|
|
72
|
+
type: 'icon';
|
|
73
|
+
/**
|
|
74
|
+
* `aria-label` of icon button
|
|
75
|
+
*/
|
|
76
|
+
label?: string;
|
|
77
|
+
icon: ReactNode;
|
|
78
|
+
text: ReactNode;
|
|
79
|
+
/**
|
|
80
|
+
* @defaultValue true
|
|
81
|
+
*/
|
|
82
|
+
secondary?: boolean;
|
|
83
|
+
}
|
|
84
|
+
declare const IconItem: react.ForwardRefExoticComponent<{
|
|
85
|
+
item: IconItem;
|
|
86
|
+
} & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
|
|
87
|
+
|
|
88
|
+
interface NavProviderProps {
|
|
89
|
+
/**
|
|
90
|
+
* Use transparent background
|
|
91
|
+
*
|
|
92
|
+
* @defaultValue none
|
|
93
|
+
*/
|
|
94
|
+
transparentMode?: 'always' | 'top' | 'none';
|
|
95
|
+
}
|
|
96
|
+
interface TitleProps {
|
|
97
|
+
title?: ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Redirect url of title
|
|
100
|
+
* @defaultValue '/'
|
|
101
|
+
*/
|
|
102
|
+
url?: string;
|
|
103
|
+
}
|
|
104
|
+
declare function NavProvider({ transparentMode, children, }: NavProviderProps & {
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
}): ReactNode;
|
|
107
|
+
|
|
108
|
+
interface NavOptions extends SharedNavProps {
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
component: ReactNode;
|
|
111
|
+
}
|
|
112
|
+
interface SharedNavProps extends TitleProps, NavProviderProps {
|
|
113
|
+
/**
|
|
114
|
+
* Show/hide search toggle
|
|
115
|
+
*
|
|
116
|
+
* Note: Enable/disable search from root provider instead
|
|
117
|
+
*/
|
|
118
|
+
enableSearch?: boolean;
|
|
119
|
+
children?: ReactNode;
|
|
120
|
+
}
|
|
121
|
+
interface BaseLayoutProps {
|
|
122
|
+
/**
|
|
123
|
+
* Remove theme switcher component
|
|
124
|
+
*/
|
|
125
|
+
disableThemeSwitch?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Enable Language Switch
|
|
128
|
+
*
|
|
129
|
+
* @defaultValue false
|
|
130
|
+
*/
|
|
131
|
+
i18n?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* GitHub url
|
|
134
|
+
*/
|
|
135
|
+
githubUrl?: string;
|
|
136
|
+
links?: LinkItemType[];
|
|
137
|
+
/**
|
|
138
|
+
* Replace or disable navbar
|
|
139
|
+
*/
|
|
140
|
+
nav?: Partial<NavOptions>;
|
|
141
|
+
children?: ReactNode;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get Links Items with shortcuts
|
|
145
|
+
*/
|
|
146
|
+
declare function getLinks(links?: LinkItemType[], githubUrl?: string): LinkItemType[];
|
|
147
|
+
declare function replaceOrDefault(obj: {
|
|
148
|
+
enabled?: boolean;
|
|
149
|
+
component?: ReactNode;
|
|
150
|
+
} | undefined, def: ReactNode, customComponentProps?: object, disabled?: ReactNode): ReactNode;
|
|
151
|
+
|
|
152
|
+
export { type BaseLayoutProps as B, IconItem as I, type LinkItemType as L, NavProvider as N, type SharedNavProps as S, getLinks as g, replaceOrDefault as r };
|