fumadocs-ui 11.3.2 → 12.0.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/dist/{chunk-TDTHXDET.js → chunk-34Z7WODD.js} +2 -1
- package/dist/{chunk-IN5NHEZV.js → chunk-3F57TIUQ.js} +20 -5
- package/dist/{chunk-PXDQVGII.js → chunk-7EMVRXMS.js} +10 -1
- package/dist/{chunk-PW7TBOIJ.js → chunk-CRYPD6UZ.js} +2 -1
- package/dist/{chunk-UKE65HV3.js → chunk-IOHAG6BY.js} +1 -1
- package/dist/chunk-JQW5DMD2.js +226 -0
- package/dist/{chunk-WNKY4RA5.js → chunk-UBVEKNRF.js} +1 -1
- package/dist/components/api.js +1 -1
- package/dist/components/dialog/search-algolia.js +3 -2
- package/dist/components/dialog/search-default.js +3 -2
- package/dist/components/dialog/search.js +3 -2
- package/dist/components/heading.js +1 -1
- package/dist/components/layout/language-toggle.d.ts +6 -0
- package/dist/components/layout/language-toggle.js +58 -0
- package/dist/components/layout/root-toggle.d.ts +16 -0
- package/dist/components/layout/root-toggle.js +60 -0
- package/dist/components/type-table.js +1 -1
- package/dist/docs.client.d.ts +13 -0
- package/dist/docs.client.js +396 -0
- package/dist/{i18n-K879Pt9h.d.ts → i18n-CE8z-AAs.d.ts} +1 -0
- package/dist/i18n.d.ts +3 -6
- package/dist/i18n.js +4 -102
- package/dist/{layout-WuS8Ab4e.d.ts → layout.client-Duq0TTke.d.ts} +23 -15
- package/dist/layout.client.d.ts +2 -8
- package/dist/layout.client.js +37 -565
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +40 -26
- package/dist/mdx.js +2 -2
- package/dist/page.client.js +4 -4
- package/dist/page.js +17 -8
- package/dist/provider.d.ts +11 -12
- package/dist/provider.js +9 -10
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.cjs +17 -22
- package/dist/tailwind-plugin.js +17 -22
- package/dist/twoslash/popup.js +1 -1
- package/dist/twoslash.css +1 -1
- package/package.json +4 -5
package/dist/layout.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
LanguageToggle,
|
|
3
|
+
} from "./components/layout/language-toggle"
|
|
4
|
+
import {
|
|
3
5
|
TreeContextProvider,
|
|
4
6
|
DynamicSidebar,
|
|
7
|
+
SubNav,
|
|
5
8
|
Sidebar,
|
|
6
|
-
|
|
9
|
+
ThemeToggle,
|
|
10
|
+
} from "./docs.client"
|
|
11
|
+
import { Nav } from "./layout.client"
|
|
7
12
|
import {
|
|
8
13
|
replaceOrDefault
|
|
9
14
|
} from "./chunk-AN2Y6MA2.js";
|
|
@@ -13,63 +18,72 @@ import {
|
|
|
13
18
|
import "./chunk-MLKGABMK.js";
|
|
14
19
|
|
|
15
20
|
// src/layout.tsx
|
|
21
|
+
import Link from "next/link";
|
|
16
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
23
|
function Layout({
|
|
18
24
|
nav = {},
|
|
19
25
|
links = [],
|
|
26
|
+
githubUrl,
|
|
20
27
|
children
|
|
21
28
|
}) {
|
|
22
|
-
const finalLinks = getLinks(links,
|
|
29
|
+
const finalLinks = getLinks(links, githubUrl);
|
|
23
30
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
31
|
replaceOrDefault(
|
|
25
32
|
nav,
|
|
26
|
-
/* @__PURE__ */ jsx(Nav, { items: finalLinks,
|
|
33
|
+
/* @__PURE__ */ jsx(Nav, { items: finalLinks, ...nav, children: nav.children })
|
|
27
34
|
),
|
|
28
35
|
children
|
|
29
36
|
] });
|
|
30
37
|
}
|
|
31
38
|
function DocsLayout({
|
|
32
|
-
nav
|
|
39
|
+
nav,
|
|
40
|
+
githubUrl,
|
|
33
41
|
sidebar = {},
|
|
34
42
|
links = [],
|
|
35
43
|
containerProps,
|
|
36
44
|
tree,
|
|
45
|
+
i18n = false,
|
|
37
46
|
children
|
|
38
47
|
}) {
|
|
39
48
|
const sidebarEnabled = sidebar.enabled ?? true;
|
|
40
49
|
const sidebarCollapsible = sidebarEnabled && (sidebar.collapsible ?? true);
|
|
41
|
-
const finalLinks = getLinks(links,
|
|
50
|
+
const finalLinks = getLinks(links, githubUrl);
|
|
51
|
+
const Aside = sidebarCollapsible ? DynamicSidebar : Sidebar;
|
|
42
52
|
return /* @__PURE__ */ jsxs(TreeContextProvider, { tree, children: [
|
|
43
|
-
replaceOrDefault(
|
|
44
|
-
nav,
|
|
45
|
-
/* @__PURE__ */ jsx(Nav, { items: finalLinks, enableSidebar: sidebarEnabled, ...nav, children: nav.children })
|
|
46
|
-
),
|
|
53
|
+
replaceOrDefault(nav, /* @__PURE__ */ jsx(SubNav, { ...nav })),
|
|
47
54
|
/* @__PURE__ */ jsxs(
|
|
48
55
|
"div",
|
|
49
56
|
{
|
|
50
57
|
...containerProps,
|
|
51
|
-
className: twMerge(
|
|
52
|
-
"mx-auto flex w-full max-w-container flex-row gap-2 xl:gap-6",
|
|
53
|
-
containerProps?.className
|
|
54
|
-
),
|
|
58
|
+
className: twMerge("flex flex-1 flex-row", containerProps?.className),
|
|
55
59
|
children: [
|
|
56
60
|
replaceOrDefault(
|
|
57
61
|
sidebar,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
items: finalLinks,
|
|
62
|
-
defaultOpenLevel: sidebar.defaultOpenLevel,
|
|
63
|
-
banner: sidebar.banner,
|
|
64
|
-
footer: sidebar.footer
|
|
65
|
-
}
|
|
66
|
-
) : /* @__PURE__ */ jsx(
|
|
67
|
-
Sidebar,
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
Aside,
|
|
68
64
|
{
|
|
69
65
|
items: finalLinks,
|
|
70
66
|
defaultOpenLevel: sidebar.defaultOpenLevel,
|
|
71
|
-
banner:
|
|
72
|
-
|
|
67
|
+
banner: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Link,
|
|
70
|
+
{
|
|
71
|
+
href: nav?.url ?? "/",
|
|
72
|
+
className: "inline-flex items-center gap-2.5 border-b pb-4 font-semibold max-md:hidden",
|
|
73
|
+
children: nav?.title
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
sidebar.banner
|
|
77
|
+
] }),
|
|
78
|
+
bannerProps: {
|
|
79
|
+
className: twMerge(!sidebar.banner && "max-md:hidden")
|
|
80
|
+
},
|
|
81
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(ThemeToggle, { className: "me-auto" }),
|
|
83
|
+
sidebar.footer,
|
|
84
|
+
i18n ? /* @__PURE__ */ jsx(LanguageToggle, {}) : null
|
|
85
|
+
] }),
|
|
86
|
+
components: sidebar.components
|
|
73
87
|
}
|
|
74
88
|
)
|
|
75
89
|
),
|
package/dist/mdx.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Pre } from "./mdx.client
|
|
1
|
+
import { Pre } from "./mdx.client"
|
|
2
2
|
import {
|
|
3
3
|
defaultImageSizes
|
|
4
4
|
} from "./chunk-AN2Y6MA2.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-N3HFQZRE.js";
|
|
9
9
|
import {
|
|
10
10
|
Heading
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IOHAG6BY.js";
|
|
12
12
|
import "./chunk-TK3TM3MR.js";
|
|
13
13
|
import "./chunk-MLKGABMK.js";
|
|
14
14
|
|
package/dist/page.client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useTreeContext
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-34Z7WODD.js";
|
|
5
5
|
import {
|
|
6
6
|
ScrollArea,
|
|
7
7
|
ScrollViewport
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import "./chunk-AN2Y6MA2.js";
|
|
10
10
|
import {
|
|
11
11
|
useI18n
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CRYPD6UZ.js";
|
|
13
13
|
import {
|
|
14
14
|
twMerge
|
|
15
15
|
} from "./chunk-TK3TM3MR.js";
|
|
@@ -21,7 +21,7 @@ import { ChevronLeft, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
|
21
21
|
import Link2 from "next/link";
|
|
22
22
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
23
23
|
|
|
24
|
-
// src/components/toc.tsx
|
|
24
|
+
// src/components/layout/toc.tsx
|
|
25
25
|
import { TextIcon } from "lucide-react";
|
|
26
26
|
import * as Primitive from "fumadocs-core/toc";
|
|
27
27
|
import { useCallback, useEffect, useRef } from "react";
|
|
@@ -143,7 +143,7 @@ function Footer({ items }) {
|
|
|
143
143
|
};
|
|
144
144
|
}, [pathname, tree.navigation]);
|
|
145
145
|
const footerItem = "flex flex-col gap-2 rounded-lg p-4 text-sm transition-colors hover:bg-accent hover:text-accent-foreground";
|
|
146
|
-
return /* @__PURE__ */ jsxs3("div", { className: "mt-
|
|
146
|
+
return /* @__PURE__ */ jsxs3("div", { className: "mt-auto flex flex-row flex-wrap gap-1 border-t py-4", children: [
|
|
147
147
|
previous ? /* @__PURE__ */ jsxs3(Link2, { href: previous.url, className: footerItem, children: [
|
|
148
148
|
/* @__PURE__ */ jsxs3("div", { className: "inline-flex items-center gap-0.5 text-muted-foreground", children: [
|
|
149
149
|
/* @__PURE__ */ jsx3(ChevronLeft, { className: "-ms-1 size-4 shrink-0 rtl:rotate-180" }),
|
package/dist/page.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Breadcrumb,
|
|
4
4
|
Footer,
|
|
5
5
|
LastUpdate,
|
|
6
|
-
} from "./page.client
|
|
6
|
+
} from "./page.client"
|
|
7
7
|
import {
|
|
8
8
|
replaceOrDefault
|
|
9
9
|
} from "./chunk-AN2Y6MA2.js";
|
|
@@ -22,12 +22,21 @@ function DocsPage({
|
|
|
22
22
|
...props
|
|
23
23
|
}) {
|
|
24
24
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
-
/* @__PURE__ */ jsxs(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/* @__PURE__ */ jsxs(
|
|
26
|
+
"article",
|
|
27
|
+
{
|
|
28
|
+
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-16",
|
|
30
|
+
tableOfContent.enabled === false && "max-w-[1200px]"
|
|
31
|
+
),
|
|
32
|
+
children: [
|
|
33
|
+
replaceOrDefault(breadcrumb, /* @__PURE__ */ jsx(Breadcrumb, {})),
|
|
34
|
+
props.children,
|
|
35
|
+
props.lastUpdate ? /* @__PURE__ */ jsx(LastUpdate, { date: new Date(props.lastUpdate) }) : null,
|
|
36
|
+
replaceOrDefault(footer, /* @__PURE__ */ jsx(Footer, { items: footer.items }))
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
),
|
|
31
40
|
replaceOrDefault(
|
|
32
41
|
tableOfContent,
|
|
33
42
|
/* @__PURE__ */ jsx(
|
|
@@ -42,7 +51,7 @@ function DocsPage({
|
|
|
42
51
|
] });
|
|
43
52
|
}
|
|
44
53
|
function Toc(props) {
|
|
45
|
-
return /* @__PURE__ */ jsxs("div", { className: "sticky top-
|
|
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: [
|
|
46
55
|
props.header,
|
|
47
56
|
props.items.length > 0 && /* @__PURE__ */ jsx(TOCItems, { items: props.items }),
|
|
48
57
|
props.footer ? /* @__PURE__ */ jsx("div", { className: "pt-4 first:pt-0", children: props.footer }) : null
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { MutableRefObject, ReactNode } from 'react';
|
|
2
3
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
|
3
4
|
import { DefaultSearchDialogProps } from './components/dialog/search-default.js';
|
|
4
5
|
import { SearchLink, SharedProps } from './components/dialog/search.js';
|
|
5
|
-
export { u as useI18n } from './i18n-
|
|
6
|
+
export { u as useI18n } from './i18n-CE8z-AAs.js';
|
|
6
7
|
export { u as useTreeContext } from './tree-CrKzI9Nz.js';
|
|
7
8
|
import 'fumadocs-core/search/shared';
|
|
8
9
|
import 'fumadocs-core/server';
|
|
@@ -50,13 +51,18 @@ interface SearchContextType {
|
|
|
50
51
|
}
|
|
51
52
|
declare function useSearchContext(): SearchContextType;
|
|
52
53
|
|
|
53
|
-
interface
|
|
54
|
+
interface SidebarContext {
|
|
54
55
|
open: boolean;
|
|
55
56
|
setOpen: (v: boolean) => void;
|
|
56
57
|
collapsed: boolean;
|
|
57
58
|
setCollapsed: (v: boolean) => void;
|
|
59
|
+
/**
|
|
60
|
+
* When set to true, close the sidebar on redirection
|
|
61
|
+
*/
|
|
62
|
+
closeOnRedirect: MutableRefObject<boolean>;
|
|
58
63
|
}
|
|
59
|
-
declare
|
|
64
|
+
declare const SidebarContext: React$1.Context<SidebarContext | undefined>;
|
|
65
|
+
declare function useSidebar(): SidebarContext;
|
|
60
66
|
|
|
61
67
|
interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'> {
|
|
62
68
|
options?: Partial<DefaultSearchDialogProps> | SearchProviderProps['options'];
|
|
@@ -76,13 +82,6 @@ interface RootProviderProps {
|
|
|
76
82
|
* @remarks `SearchProviderProps`
|
|
77
83
|
*/
|
|
78
84
|
search?: Partial<SearchOptions>;
|
|
79
|
-
/**
|
|
80
|
-
* Wrap the body in `ThemeProvider` (next-themes)
|
|
81
|
-
*
|
|
82
|
-
* @defaultValue true
|
|
83
|
-
* @deprecated Use `theme.enable` instead
|
|
84
|
-
*/
|
|
85
|
-
enableThemeProvider?: boolean;
|
|
86
85
|
/**
|
|
87
86
|
* Customise options of `next-themes`
|
|
88
87
|
*/
|
|
@@ -96,6 +95,6 @@ interface RootProviderProps {
|
|
|
96
95
|
};
|
|
97
96
|
children: ReactNode;
|
|
98
97
|
}
|
|
99
|
-
declare function RootProvider({ children, dir,
|
|
98
|
+
declare function RootProvider({ children, dir, theme: { enabled, ...theme }, search, }: RootProviderProps): React.ReactElement;
|
|
100
99
|
|
|
101
100
|
export { RootProvider, type RootProviderProps, useSearchContext, useSidebar };
|
package/dist/provider.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
SidebarProvider,
|
|
4
|
-
useSidebar
|
|
5
|
-
} from "./chunk-IN5NHEZV.js";
|
|
6
2
|
import {
|
|
7
3
|
useTreeContext
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-34Z7WODD.js";
|
|
9
5
|
import "./chunk-AN2Y6MA2.js";
|
|
6
|
+
import {
|
|
7
|
+
SidebarProvider,
|
|
8
|
+
useSidebar
|
|
9
|
+
} from "./chunk-3F57TIUQ.js";
|
|
10
10
|
import {
|
|
11
11
|
SearchProvider,
|
|
12
12
|
useSearchContext
|
|
13
13
|
} from "./chunk-FSPYEOFC.js";
|
|
14
14
|
import {
|
|
15
15
|
useI18n
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CRYPD6UZ.js";
|
|
17
17
|
import "./chunk-MLKGABMK.js";
|
|
18
18
|
|
|
19
19
|
// src/provider.tsx
|
|
@@ -28,14 +28,13 @@ var DefaultSearchDialog = dynamic(
|
|
|
28
28
|
function RootProvider({
|
|
29
29
|
children,
|
|
30
30
|
dir,
|
|
31
|
-
enableThemeProvider = true,
|
|
32
31
|
theme: { enabled = true, ...theme } = {},
|
|
33
32
|
search
|
|
34
33
|
}) {
|
|
35
|
-
let body =
|
|
34
|
+
let body = children;
|
|
36
35
|
if (search?.enabled !== false)
|
|
37
36
|
body = /* @__PURE__ */ jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children: body });
|
|
38
|
-
if (enabled
|
|
37
|
+
if (enabled)
|
|
39
38
|
body = /* @__PURE__ */ jsx(
|
|
40
39
|
ThemeProvider,
|
|
41
40
|
{
|
|
@@ -47,7 +46,7 @@ function RootProvider({
|
|
|
47
46
|
children: body
|
|
48
47
|
}
|
|
49
48
|
);
|
|
50
|
-
return body;
|
|
49
|
+
return /* @__PURE__ */ jsx(DirectionProvider, { dir: dir ?? "ltr", children: /* @__PURE__ */ jsx(SidebarProvider, { children: body }) });
|
|
51
50
|
}
|
|
52
51
|
export {
|
|
53
52
|
RootProvider,
|