fumadocs-ui 8.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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/chunk-24NYFO7H.js +31 -0
  4. package/dist/chunk-2ZR5Z6B2.js +105 -0
  5. package/dist/chunk-36MVEJ25.js +39 -0
  6. package/dist/chunk-5EZE3X7G.js +31 -0
  7. package/dist/chunk-5KW7ATCP.js +23 -0
  8. package/dist/chunk-6C3VEZWH.js +9 -0
  9. package/dist/chunk-CBOHU2VN.js +28 -0
  10. package/dist/chunk-EDUYFB4P.js +43 -0
  11. package/dist/chunk-F62NYOL5.js +44 -0
  12. package/dist/chunk-GZQICERS.js +31 -0
  13. package/dist/chunk-IXYX64FW.js +243 -0
  14. package/dist/chunk-KCGRUOMD.js +13 -0
  15. package/dist/chunk-OG3QOLYP.js +43 -0
  16. package/dist/chunk-PLXR6QNH.js +21 -0
  17. package/dist/chunk-UIZNMCLD.js +49 -0
  18. package/dist/chunk-YAHHY62W.js +20 -0
  19. package/dist/components/accordion.d.mts +11 -0
  20. package/dist/components/accordion.js +128 -0
  21. package/dist/components/api.d.mts +20 -0
  22. package/dist/components/api.js +136 -0
  23. package/dist/components/callout.d.mts +13 -0
  24. package/dist/components/callout.js +39 -0
  25. package/dist/components/card.d.mts +12 -0
  26. package/dist/components/card.js +10 -0
  27. package/dist/components/codeblock.d.mts +12 -0
  28. package/dist/components/codeblock.js +14 -0
  29. package/dist/components/dialog/search-algolia.d.mts +15 -0
  30. package/dist/components/dialog/search-algolia.js +39 -0
  31. package/dist/components/dialog/search-default.d.mts +15 -0
  32. package/dist/components/dialog/search-default.js +39 -0
  33. package/dist/components/dialog/search.d.mts +25 -0
  34. package/dist/components/dialog/search.js +13 -0
  35. package/dist/components/files.d.mts +20 -0
  36. package/dist/components/files.js +56 -0
  37. package/dist/components/heading.d.mts +9 -0
  38. package/dist/components/heading.js +8 -0
  39. package/dist/components/image-zoom.d.mts +12 -0
  40. package/dist/components/image-zoom.js +39 -0
  41. package/dist/components/inline-toc.d.mts +11 -0
  42. package/dist/components/inline-toc.js +53 -0
  43. package/dist/components/roll-button.d.mts +14 -0
  44. package/dist/components/roll-button.js +54 -0
  45. package/dist/components/steps.d.mts +10 -0
  46. package/dist/components/steps.js +14 -0
  47. package/dist/components/tabs.d.mts +37 -0
  48. package/dist/components/tabs.js +141 -0
  49. package/dist/components/type-table.d.mts +23 -0
  50. package/dist/components/type-table.js +52 -0
  51. package/dist/i18n-dw7ODAws.d.mts +22 -0
  52. package/dist/i18n.d.mts +21 -0
  53. package/dist/i18n.js +146 -0
  54. package/dist/layout-YB7EFpgW.d.mts +79 -0
  55. package/dist/layout.client.d.mts +4 -0
  56. package/dist/layout.client.js +458 -0
  57. package/dist/layout.d.mts +3 -0
  58. package/dist/layout.js +97 -0
  59. package/dist/mdx.client.d.mts +7 -0
  60. package/dist/mdx.client.js +23 -0
  61. package/dist/mdx.d.mts +36 -0
  62. package/dist/mdx.js +51 -0
  63. package/dist/page.client.d.mts +29 -0
  64. package/dist/page.client.js +168 -0
  65. package/dist/page.d.mts +49 -0
  66. package/dist/page.js +56 -0
  67. package/dist/provider.d.mts +50 -0
  68. package/dist/provider.js +51 -0
  69. package/dist/style.css +1 -0
  70. package/dist/tailwind-plugin.d.ts +36 -0
  71. package/dist/tailwind-plugin.js +481 -0
  72. package/dist/tree-Zwtp9xPv.d.mts +15 -0
  73. package/package.json +97 -0
package/dist/layout.js ADDED
@@ -0,0 +1,97 @@
1
+ import {
2
+ Nav,
3
+ TreeContextProvider,
4
+ Sidebar,
5
+ } from "./layout.client.js"
6
+ import {
7
+ replaceOrDefault
8
+ } from "./chunk-EDUYFB4P.js";
9
+ import {
10
+ cn
11
+ } from "./chunk-KCGRUOMD.js";
12
+ import "./chunk-6C3VEZWH.js";
13
+
14
+ // src/layout.tsx
15
+ import { GithubIcon } from "lucide-react";
16
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
+ function Layout({
18
+ nav = {},
19
+ links = [],
20
+ children
21
+ }) {
22
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ getNav(false, false, links, nav),
24
+ children
25
+ ] });
26
+ }
27
+ function DocsLayout({
28
+ nav = {},
29
+ sidebar = {},
30
+ links = [],
31
+ containerProps,
32
+ tree,
33
+ children
34
+ }) {
35
+ const sidebarEnabled = sidebar.enabled ?? true;
36
+ const sidebarCollaspible = sidebarEnabled && (sidebar.collapsible ?? true);
37
+ return /* @__PURE__ */ jsxs(TreeContextProvider, { tree, children: [
38
+ getNav(sidebarEnabled, sidebarCollaspible, links, nav),
39
+ /* @__PURE__ */ jsxs(
40
+ "div",
41
+ {
42
+ ...containerProps,
43
+ className: cn(
44
+ "container flex flex-row gap-6 xl:gap-12",
45
+ containerProps?.className
46
+ ),
47
+ children: [
48
+ replaceOrDefault(
49
+ sidebar,
50
+ /* @__PURE__ */ jsx(
51
+ Sidebar,
52
+ {
53
+ items: links,
54
+ defaultOpenLevel: sidebar.defaultOpenLevel,
55
+ banner: sidebar.banner,
56
+ footer: sidebar.footer
57
+ }
58
+ )
59
+ ),
60
+ children
61
+ ]
62
+ }
63
+ )
64
+ ] });
65
+ }
66
+ function getNav(enableSidebar, collapsibleSidebar, items, { githubUrl, links, ...props }) {
67
+ let iconLinks = links ?? [];
68
+ if (githubUrl)
69
+ iconLinks = [
70
+ ...iconLinks,
71
+ {
72
+ href: githubUrl,
73
+ label: "Github",
74
+ icon: /* @__PURE__ */ jsx(GithubIcon, {}),
75
+ external: true
76
+ }
77
+ ];
78
+ return replaceOrDefault(
79
+ props,
80
+ /* @__PURE__ */ jsx(
81
+ Nav,
82
+ {
83
+ title: "My App",
84
+ ...props,
85
+ items,
86
+ links: iconLinks,
87
+ enableSidebar,
88
+ collapsibleSidebar,
89
+ children: props.children
90
+ }
91
+ )
92
+ );
93
+ }
94
+ export {
95
+ DocsLayout,
96
+ Layout
97
+ };
@@ -0,0 +1,7 @@
1
+ import { HTMLAttributes } from 'react';
2
+
3
+ declare function Pre({ title, allowCopy, ...props }: HTMLAttributes<HTMLPreElement> & {
4
+ allowCopy?: boolean;
5
+ }): JSX.Element;
6
+
7
+ export { Pre };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import {
3
+ CodeBlock,
4
+ Pre
5
+ } from "./chunk-2ZR5Z6B2.js";
6
+ import "./chunk-OG3QOLYP.js";
7
+ import "./chunk-24NYFO7H.js";
8
+ import "./chunk-5KW7ATCP.js";
9
+ import "./chunk-KCGRUOMD.js";
10
+ import "./chunk-6C3VEZWH.js";
11
+
12
+ // src/mdx.client.tsx
13
+ import { jsx } from "react/jsx-runtime";
14
+ function Pre2({
15
+ title,
16
+ allowCopy,
17
+ ...props
18
+ }) {
19
+ return /* @__PURE__ */ jsx(CodeBlock, { title, allowCopy, children: /* @__PURE__ */ jsx(Pre, { ...props }) });
20
+ }
21
+ export {
22
+ Pre2 as Pre
23
+ };
package/dist/mdx.d.mts ADDED
@@ -0,0 +1,36 @@
1
+ import { Pre } from './mdx.client.mjs';
2
+ import { FC, AnchorHTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from 'react';
3
+ import { Card, Cards } from './components/card.mjs';
4
+ import 'fumadocs-core/link';
5
+
6
+ declare function Image(props: ImgHTMLAttributes<HTMLImageElement>): JSX.Element;
7
+ declare function Table(props: TableHTMLAttributes<HTMLTableElement>): JSX.Element;
8
+ declare const defaultMdxComponents: {
9
+ pre: typeof Pre;
10
+ Card: typeof Card;
11
+ Cards: typeof Cards;
12
+ a: FC<AnchorHTMLAttributes<HTMLAnchorElement>>;
13
+ img: typeof Image;
14
+ h1: (props: React.HTMLAttributes<HTMLHeadingElement>) => JSX.Element;
15
+ h2: (props: React.HTMLAttributes<HTMLHeadingElement>) => JSX.Element;
16
+ h3: (props: React.HTMLAttributes<HTMLHeadingElement>) => JSX.Element;
17
+ h4: (props: React.HTMLAttributes<HTMLHeadingElement>) => JSX.Element;
18
+ h5: (props: React.HTMLAttributes<HTMLHeadingElement>) => JSX.Element;
19
+ h6: (props: React.HTMLAttributes<HTMLHeadingElement>) => JSX.Element;
20
+ table: typeof Table;
21
+ };
22
+ /**
23
+ * **Server Component Only**
24
+ *
25
+ * Sometimes, if you directly pass a client component to MDX Components, it will throw an error
26
+ *
27
+ * To solve this, you can re-create the component in a server component like: `(props) => <Component {...props} />`
28
+ *
29
+ * This function does that for you
30
+ *
31
+ * @param c - MDX Components
32
+ * @returns MDX Components with re-created client components
33
+ */
34
+ declare function createComponents<Components extends Record<string, FC<unknown>>>(c: Components): Components;
35
+
36
+ export { createComponents, defaultMdxComponents as default };
package/dist/mdx.js ADDED
@@ -0,0 +1,51 @@
1
+ import { Pre } from "./mdx.client.js"
2
+ import {
3
+ defaultImageSizes
4
+ } from "./chunk-EDUYFB4P.js";
5
+ import {
6
+ Card,
7
+ Cards
8
+ } from "./chunk-F62NYOL5.js";
9
+ import {
10
+ Heading
11
+ } from "./chunk-CBOHU2VN.js";
12
+ import "./chunk-KCGRUOMD.js";
13
+ import "./chunk-6C3VEZWH.js";
14
+
15
+ // src/mdx.tsx
16
+ import Link from "fumadocs-core/link";
17
+ import NextImage from "next/image";
18
+ import { jsx } from "react/jsx-runtime";
19
+ function Image(props) {
20
+ return /* @__PURE__ */ jsx(NextImage, { sizes: defaultImageSizes, ...props });
21
+ }
22
+ function Table(props) {
23
+ return /* @__PURE__ */ jsx("div", { className: "relative overflow-auto", children: /* @__PURE__ */ jsx("table", { ...props }) });
24
+ }
25
+ var defaultMdxComponents = {
26
+ pre: Pre,
27
+ Card,
28
+ Cards,
29
+ a: Link,
30
+ img: Image,
31
+ h1: (props) => /* @__PURE__ */ jsx(Heading, { as: "h1", ...props }),
32
+ h2: (props) => /* @__PURE__ */ jsx(Heading, { as: "h2", ...props }),
33
+ h3: (props) => /* @__PURE__ */ jsx(Heading, { as: "h3", ...props }),
34
+ h4: (props) => /* @__PURE__ */ jsx(Heading, { as: "h4", ...props }),
35
+ h5: (props) => /* @__PURE__ */ jsx(Heading, { as: "h5", ...props }),
36
+ h6: (props) => /* @__PURE__ */ jsx(Heading, { as: "h6", ...props }),
37
+ table: Table
38
+ };
39
+ function createComponents(c) {
40
+ const mapped = Object.entries(c).map(([k, V]) => {
41
+ return [
42
+ k,
43
+ Object.keys(V).length === 0 ? (props) => /* @__PURE__ */ jsx(V, { ...props }) : V
44
+ ];
45
+ });
46
+ return Object.fromEntries(mapped);
47
+ }
48
+ export {
49
+ createComponents,
50
+ defaultMdxComponents as default
51
+ };
@@ -0,0 +1,29 @@
1
+ import { TOCItemType } from 'fumadocs-core/server';
2
+
3
+ declare function TOCItems({ items }: {
4
+ items: TOCItemType[];
5
+ }): JSX.Element;
6
+
7
+ declare function Breadcrumb(): JSX.Element;
8
+
9
+ declare function LastUpdate(props: {
10
+ date: Date;
11
+ }): JSX.Element;
12
+ interface FooterProps {
13
+ /**
14
+ * Items including information for the next and previous page
15
+ */
16
+ items?: {
17
+ previous?: {
18
+ name: string;
19
+ url: string;
20
+ };
21
+ next?: {
22
+ name: string;
23
+ url: string;
24
+ };
25
+ };
26
+ }
27
+ declare function Footer({ items }: FooterProps): JSX.Element;
28
+
29
+ export { Breadcrumb, Footer, type FooterProps, LastUpdate, TOCItems };
@@ -0,0 +1,168 @@
1
+ "use client";
2
+ import {
3
+ useTreeContext
4
+ } from "./chunk-UIZNMCLD.js";
5
+ import "./chunk-EDUYFB4P.js";
6
+ import {
7
+ useI18n
8
+ } from "./chunk-YAHHY62W.js";
9
+ import {
10
+ cn
11
+ } from "./chunk-KCGRUOMD.js";
12
+ import "./chunk-6C3VEZWH.js";
13
+
14
+ // src/page.client.tsx
15
+ import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
16
+ import { cva } from "class-variance-authority";
17
+ import { ChevronLeftIcon, ChevronRightIcon as ChevronRightIcon2 } from "lucide-react";
18
+ import Link2 from "next/link";
19
+ import { usePathname as usePathname2 } from "next/navigation";
20
+
21
+ // src/components/toc.tsx
22
+ import { TextIcon } from "lucide-react";
23
+ import * as Primitive from "fumadocs-core/toc";
24
+ import { useEffect, useRef, useState } from "react";
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ function TOCItems({ items }) {
27
+ const { text } = useI18n();
28
+ const [pos, setPos] = useState();
29
+ return /* @__PURE__ */ jsxs(
30
+ Primitive.TOCProvider,
31
+ {
32
+ toc: items,
33
+ className: "relative overflow-hidden pt-4 text-sm first:pt-0",
34
+ children: [
35
+ /* @__PURE__ */ jsxs("h3", { className: "mb-4 inline-flex items-center gap-2", children: [
36
+ /* @__PURE__ */ jsx(TextIcon, { className: "size-4" }),
37
+ text.toc
38
+ ] }),
39
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 border-l-2 text-muted-foreground", children: [
40
+ /* @__PURE__ */ jsx(
41
+ "div",
42
+ {
43
+ role: "none",
44
+ className: cn(
45
+ "absolute left-0 border-l-2 transition-all",
46
+ pos && "border-primary"
47
+ ),
48
+ style: {
49
+ top: pos?.[0],
50
+ height: pos?.[1]
51
+ }
52
+ }
53
+ ),
54
+ items.map((item) => /* @__PURE__ */ jsx(TOCItem2, { item, setMarker: setPos }, item.url))
55
+ ] })
56
+ ]
57
+ }
58
+ );
59
+ }
60
+ function TOCItem2({
61
+ item,
62
+ setMarker
63
+ }) {
64
+ const active = Primitive.useActiveAnchor(item.url);
65
+ const ref = useRef(null);
66
+ useEffect(() => {
67
+ if (active && ref.current) {
68
+ setMarker([ref.current.offsetTop, ref.current.clientHeight]);
69
+ }
70
+ }, [active, setMarker]);
71
+ return /* @__PURE__ */ jsx(
72
+ Primitive.TOCItem,
73
+ {
74
+ ref,
75
+ href: item.url,
76
+ className: cn(
77
+ "overflow-hidden text-ellipsis py-1 transition-colors data-[active=true]:font-medium data-[active=true]:text-primary",
78
+ item.depth <= 2 && "pl-4",
79
+ item.depth === 3 && "pl-7",
80
+ item.depth >= 4 && "pl-10"
81
+ ),
82
+ children: item.title
83
+ }
84
+ );
85
+ }
86
+
87
+ // src/components/breadcrumb.tsx
88
+ import { ChevronRightIcon } from "lucide-react";
89
+ import { useBreadcrumb } from "fumadocs-core/breadcrumb";
90
+ import Link from "next/link";
91
+ import { usePathname } from "next/navigation";
92
+ import { Fragment } from "react";
93
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
94
+ function Breadcrumb() {
95
+ const { root } = useTreeContext();
96
+ const pathname = usePathname();
97
+ const items = useBreadcrumb(pathname, root);
98
+ return /* @__PURE__ */ jsx2(
99
+ "div",
100
+ {
101
+ className: cn(
102
+ "flex flex-row items-center gap-1 text-sm text-muted-foreground",
103
+ items.length === 1 && "hidden"
104
+ ),
105
+ children: items.map((item, i) => {
106
+ const isLast = items.length === i + 1;
107
+ const style = cn(
108
+ "overflow-hidden whitespace-nowrap",
109
+ isLast ? "text-foreground" : "text-ellipsis"
110
+ );
111
+ return (
112
+ // eslint-disable-next-line react/no-array-index-key -- Won't re-render
113
+ /* @__PURE__ */ jsxs2(Fragment, { children: [
114
+ i !== 0 && /* @__PURE__ */ jsx2(ChevronRightIcon, { className: "size-4 shrink-0" }),
115
+ item.url ? /* @__PURE__ */ jsx2(Link, { href: item.url, className: style, children: item.name }) : /* @__PURE__ */ jsx2("p", { className: style, children: item.name })
116
+ ] }, i)
117
+ );
118
+ })
119
+ }
120
+ );
121
+ }
122
+
123
+ // src/page.client.tsx
124
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
125
+ function LastUpdate(props) {
126
+ const { text } = useI18n();
127
+ const [date, setDate] = useState2("");
128
+ useEffect2(() => {
129
+ setDate(props.date.toLocaleDateString());
130
+ }, [props.date]);
131
+ return /* @__PURE__ */ jsxs3("p", { className: "mt-8 text-xs text-muted-foreground", children: [
132
+ text.lastUpdate,
133
+ " ",
134
+ date
135
+ ] });
136
+ }
137
+ var footerItem = cva(
138
+ "flex flex-row items-center gap-2 text-muted-foreground transition-colors hover:text-foreground"
139
+ );
140
+ function Footer({ items }) {
141
+ const tree = useTreeContext();
142
+ const pathname = usePathname2();
143
+ const { previous, next } = useMemo(() => {
144
+ if (items)
145
+ return items;
146
+ const currentIndex = tree.list.findIndex((item) => item.url === pathname);
147
+ return {
148
+ previous: tree.list[currentIndex - 1],
149
+ next: tree.list[currentIndex + 1]
150
+ };
151
+ }, [items, pathname, tree.list]);
152
+ return /* @__PURE__ */ jsxs3("div", { className: "mt-4 flex flex-row flex-wrap gap-4 border-t py-12", children: [
153
+ previous ? /* @__PURE__ */ jsxs3(Link2, { href: previous.url, className: footerItem(), children: [
154
+ /* @__PURE__ */ jsx3(ChevronLeftIcon, { className: "size-5 shrink-0" }),
155
+ /* @__PURE__ */ jsx3("p", { className: "font-medium text-foreground", children: previous.name })
156
+ ] }) : null,
157
+ next ? /* @__PURE__ */ jsxs3(Link2, { href: next.url, className: footerItem({ className: "ml-auto" }), children: [
158
+ /* @__PURE__ */ jsx3("p", { className: "text-end font-medium text-foreground", children: next.name }),
159
+ /* @__PURE__ */ jsx3(ChevronRightIcon2, { className: "size-5 shrink-0" })
160
+ ] }) : null
161
+ ] });
162
+ }
163
+ export {
164
+ Breadcrumb,
165
+ Footer,
166
+ LastUpdate,
167
+ TOCItems
168
+ };
@@ -0,0 +1,49 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, HTMLAttributes } from 'react';
3
+ import { TableOfContents, TOCItemType } from 'fumadocs-core/server';
4
+ import { FooterProps } from './page.client.mjs';
5
+
6
+ type TableOfContentOptions = Omit<TOCProps, 'items'> & {
7
+ enabled: boolean;
8
+ component: ReactNode;
9
+ };
10
+ interface BreadcrumbOptions {
11
+ enabled: boolean;
12
+ component: ReactNode;
13
+ }
14
+ interface FooterOptions extends FooterProps {
15
+ enabled: boolean;
16
+ component: ReactNode;
17
+ }
18
+ interface DocsPageProps {
19
+ toc?: TableOfContents;
20
+ tableOfContent?: Partial<TableOfContentOptions>;
21
+ /**
22
+ * Replace or disable breadcrumb
23
+ */
24
+ breadcrumb?: Partial<BreadcrumbOptions>;
25
+ /**
26
+ * Footer navigation, you can disable it by passing `false`
27
+ */
28
+ footer?: Partial<FooterOptions>;
29
+ lastUpdate?: Date | string | number;
30
+ children: ReactNode;
31
+ }
32
+ declare function DocsPage({ tableOfContent, breadcrumb, footer, ...props }: DocsPageProps): JSX.Element;
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
+ }
44
+ /**
45
+ * Add typography styles
46
+ */
47
+ declare const DocsBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
48
+
49
+ export { DocsBody, DocsPage, type DocsPageProps };
package/dist/page.js ADDED
@@ -0,0 +1,56 @@
1
+ import {
2
+ TOCItems,
3
+ Breadcrumb,
4
+ Footer,
5
+ LastUpdate,
6
+ } from "./page.client.js"
7
+ import {
8
+ replaceOrDefault
9
+ } from "./chunk-EDUYFB4P.js";
10
+ import {
11
+ cn
12
+ } from "./chunk-KCGRUOMD.js";
13
+ import "./chunk-6C3VEZWH.js";
14
+
15
+ // src/page.tsx
16
+ import { forwardRef } from "react";
17
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
18
+ function DocsPage({
19
+ tableOfContent = {},
20
+ breadcrumb = {},
21
+ footer = {},
22
+ ...props
23
+ }) {
24
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ /* @__PURE__ */ jsxs("article", { className: "flex w-0 flex-1 flex-col gap-6 py-10", children: [
26
+ replaceOrDefault(breadcrumb, /* @__PURE__ */ jsx(Breadcrumb, {})),
27
+ props.children,
28
+ props.lastUpdate ? /* @__PURE__ */ jsx(LastUpdate, { date: new Date(props.lastUpdate) }) : null,
29
+ replaceOrDefault(footer, /* @__PURE__ */ jsx(Footer, { items: footer.items }))
30
+ ] }),
31
+ replaceOrDefault(
32
+ tableOfContent,
33
+ /* @__PURE__ */ jsx(
34
+ Toc,
35
+ {
36
+ items: props.toc ?? [],
37
+ header: tableOfContent.header,
38
+ footer: tableOfContent.footer
39
+ }
40
+ )
41
+ )
42
+ ] });
43
+ }
44
+ function Toc(props) {
45
+ return /* @__PURE__ */ jsxs("div", { className: "sticky top-16 flex h-body w-[220px] flex-col gap-4 divide-y py-10 max-lg:hidden xl:w-[260px]", children: [
46
+ props.header,
47
+ props.items.length > 0 && /* @__PURE__ */ jsx(TOCItems, { items: props.items }),
48
+ props.footer ? /* @__PURE__ */ jsx("div", { className: "pt-4 first:pt-0", children: props.footer }) : null
49
+ ] });
50
+ }
51
+ var DocsBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("prose", className), ...props }));
52
+ DocsBody.displayName = "DocsBody";
53
+ export {
54
+ DocsBody,
55
+ DocsPage
56
+ };
@@ -0,0 +1,50 @@
1
+ import * as react from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
+ import { SharedProps } from './components/dialog/search.mjs';
4
+ export { u as useI18n } from './i18n-dw7ODAws.mjs';
5
+ export { u as useTreeContext } from './tree-Zwtp9xPv.mjs';
6
+ import 'fumadocs-core/search/shared';
7
+ import 'fumadocs-core/server';
8
+
9
+ interface SearchProviderProps {
10
+ /**
11
+ * Preload search dialog before opening it
12
+ *
13
+ * @defaultValue `true`
14
+ */
15
+ preload?: boolean;
16
+ /**
17
+ * Custom links to be displayed if search is empty
18
+ */
19
+ links?: SearchContextType['links'];
20
+ /**
21
+ * Replace default search dialog, allowing you to use other solutions such as Algolia Search
22
+ *
23
+ * It receives the `open` and `onOpenChange` prop, shall be lazy loaded with `next/dynamic`
24
+ */
25
+ SearchDialog: ComponentType<SharedProps>;
26
+ children: ReactNode;
27
+ }
28
+ interface SearchContextType {
29
+ links: [name: string, link: string][];
30
+ setOpenSearch: (value: boolean) => void;
31
+ }
32
+ declare function useSearchContext(): SearchContextType;
33
+
34
+ type SidebarCollapseContext = [open: boolean, setOpen: (v: boolean) => void];
35
+ declare const SidebarCollapseContext: react.Context<SidebarCollapseContext | undefined>;
36
+ declare function useSidebarCollapse(): SidebarCollapseContext;
37
+
38
+ interface RootProviderProps {
39
+ search?: Partial<Omit<SearchProviderProps, 'children'>>;
40
+ /**
41
+ * Wrap the body in `ThemeProvider` (next-themes)
42
+ *
43
+ * @defaultValue true
44
+ */
45
+ enableThemeProvider?: boolean;
46
+ children: ReactNode;
47
+ }
48
+ declare function RootProvider({ children, enableThemeProvider, search, }: RootProviderProps): JSX.Element;
49
+
50
+ export { RootProvider, type RootProviderProps, useSearchContext, useSidebarCollapse };
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import {
3
+ SidebarCollapseProvider,
4
+ useSidebarCollapse
5
+ } from "./chunk-PLXR6QNH.js";
6
+ import {
7
+ useTreeContext
8
+ } from "./chunk-UIZNMCLD.js";
9
+ import "./chunk-EDUYFB4P.js";
10
+ import {
11
+ SearchProvider,
12
+ useSearchContext
13
+ } from "./chunk-36MVEJ25.js";
14
+ import {
15
+ useI18n
16
+ } from "./chunk-YAHHY62W.js";
17
+ import "./chunk-6C3VEZWH.js";
18
+
19
+ // src/provider.tsx
20
+ import { SidebarProvider } from "fumadocs-core/sidebar";
21
+ import { ThemeProvider } from "next-themes";
22
+ import dynamic from "next/dynamic";
23
+ import { jsx } from "react/jsx-runtime";
24
+ var DefaultSearchDialog = dynamic(
25
+ () => import("./components/dialog/search-default.js"),
26
+ { ssr: false }
27
+ );
28
+ function RootProvider({
29
+ children,
30
+ enableThemeProvider = true,
31
+ search
32
+ }) {
33
+ const body = /* @__PURE__ */ jsx(SidebarProvider, { children: /* @__PURE__ */ jsx(SidebarCollapseProvider, { children: /* @__PURE__ */ jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children }) }) });
34
+ return enableThemeProvider ? /* @__PURE__ */ jsx(
35
+ ThemeProvider,
36
+ {
37
+ attribute: "class",
38
+ defaultTheme: "system",
39
+ enableSystem: true,
40
+ disableTransitionOnChange: true,
41
+ children: body
42
+ }
43
+ ) : body;
44
+ }
45
+ export {
46
+ RootProvider,
47
+ useI18n,
48
+ useSearchContext,
49
+ useSidebarCollapse,
50
+ useTreeContext
51
+ };