fumadocs-ui 14.2.1 → 14.3.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/components/accordion.d.ts +4 -7
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +32 -104
- package/dist/components/api.d.ts +4 -13
- package/dist/components/api.d.ts.map +1 -0
- package/dist/components/api.js +3 -16
- package/dist/components/banner.d.ts +3 -5
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +53 -120
- package/dist/components/callout.d.ts +4 -7
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +13 -9
- package/dist/components/card.d.ts +5 -7
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +10 -10
- package/dist/components/codeblock.d.ts +6 -9
- package/dist/components/codeblock.d.ts.map +1 -0
- package/dist/components/codeblock.js +41 -15
- package/dist/components/dialog/search-algolia.d.ts +7 -11
- package/dist/components/dialog/search-algolia.d.ts.map +1 -0
- package/dist/components/dialog/search-algolia.js +19 -79
- package/dist/components/dialog/search-default.d.ts +6 -10
- package/dist/components/dialog/search-default.d.ts.map +1 -0
- package/dist/components/dialog/search-default.js +24 -73
- package/dist/components/dialog/search-orama.d.ts +7 -11
- package/dist/components/dialog/search-orama.d.ts.map +1 -0
- package/dist/components/dialog/search-orama.js +22 -79
- package/dist/components/dialog/search.d.ts +7 -9
- package/dist/components/dialog/search.d.ts.map +1 -0
- package/dist/components/dialog/search.js +98 -13
- package/dist/components/dialog/tag-list.d.ts +13 -0
- package/dist/components/dialog/tag-list.d.ts.map +1 -0
- package/dist/components/dialog/tag-list.js +20 -0
- package/dist/components/files.d.ts +7 -9
- package/dist/components/files.d.ts.map +1 -0
- package/dist/components/files.js +15 -63
- package/dist/components/heading.d.ts +4 -5
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +9 -9
- package/dist/components/image-zoom.d.ts +7 -8
- package/dist/components/image-zoom.d.ts.map +1 -0
- package/dist/components/image-zoom.js +16 -40
- package/dist/components/inline-toc.d.ts +4 -6
- package/dist/components/inline-toc.d.ts.map +1 -0
- package/dist/components/inline-toc.js +8 -46
- package/dist/components/layout/breadcrumb.d.ts +11 -0
- package/dist/components/layout/breadcrumb.d.ts.map +1 -0
- package/dist/components/layout/breadcrumb.js +20 -0
- package/dist/components/layout/language-toggle.d.ts +5 -7
- package/dist/components/layout/language-toggle.d.ts.map +1 -0
- package/dist/components/layout/language-toggle.js +24 -14
- package/dist/components/layout/nav.d.ts +28 -0
- package/dist/components/layout/nav.d.ts.map +1 -0
- package/dist/components/layout/nav.js +29 -0
- package/dist/components/layout/root-toggle.d.ts +5 -7
- package/dist/components/layout/root-toggle.d.ts.map +1 -0
- package/dist/components/layout/root-toggle.js +28 -13
- package/dist/components/layout/search-toggle.d.ts +4 -0
- package/dist/components/layout/search-toggle.d.ts.map +1 -0
- package/dist/components/layout/search-toggle.js +24 -0
- package/dist/components/layout/theme-toggle.d.ts +3 -0
- package/dist/components/layout/theme-toggle.d.ts.map +1 -0
- package/dist/components/layout/theme-toggle.js +21 -0
- package/dist/components/layout/toc-clerk.d.ts +6 -0
- package/dist/components/layout/toc-clerk.d.ts.map +1 -0
- package/dist/components/layout/toc-clerk.js +76 -0
- package/dist/components/layout/toc-popover.d.ts +8 -0
- package/dist/components/layout/toc-popover.d.ts.map +1 -0
- package/dist/components/layout/toc-popover.js +20 -0
- package/dist/components/layout/toc-thumb.d.ts +6 -0
- package/dist/components/layout/toc-thumb.d.ts.map +1 -0
- package/dist/components/layout/toc-thumb.js +53 -0
- package/dist/components/layout/toc.d.ts +19 -0
- package/dist/components/layout/toc.d.ts.map +1 -0
- package/dist/components/layout/toc.js +25 -0
- package/dist/components/registry.d.ts +3 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +70 -0
- package/dist/components/steps.d.ts +4 -6
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +5 -16
- package/dist/components/tabs.d.ts +7 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +61 -171
- package/dist/components/type-table.d.ts +5 -6
- package/dist/components/type-table.d.ts.map +1 -0
- package/dist/components/type-table.js +18 -59
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +14 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +12 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +15 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +16 -0
- package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
- package/dist/contexts/i18n.d.ts.map +1 -0
- package/dist/contexts/i18n.js +23 -0
- package/dist/contexts/search.d.ts +50 -0
- package/dist/contexts/search.d.ts.map +1 -0
- package/dist/contexts/search.js +50 -0
- package/dist/contexts/sidebar.d.ts +18 -0
- package/dist/contexts/sidebar.d.ts.map +1 -0
- package/dist/contexts/sidebar.js +31 -0
- package/dist/contexts/tree.d.ts +13 -0
- package/dist/contexts/tree.d.ts.map +1 -0
- package/dist/contexts/tree.js +25 -0
- package/dist/i18n.d.ts +5 -6
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +31 -49
- package/dist/layouts/docs/navbar.d.ts +4 -0
- package/dist/layouts/docs/navbar.d.ts.map +1 -0
- package/dist/layouts/docs/navbar.js +22 -0
- package/dist/layouts/docs/sidebar.d.ts +40 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +146 -0
- package/dist/layouts/docs.client.d.ts +14 -25
- package/dist/layouts/docs.client.d.ts.map +1 -0
- package/dist/layouts/docs.client.js +53 -195
- package/dist/layouts/docs.d.ts +34 -19
- package/dist/layouts/docs.d.ts.map +1 -0
- package/dist/layouts/docs.js +67 -202
- package/dist/layouts/home/menu.d.ts +6 -0
- package/dist/layouts/home/menu.d.ts.map +1 -0
- package/dist/layouts/home/menu.js +33 -0
- package/dist/layouts/home/navbar.d.ts +16 -0
- package/dist/layouts/home/navbar.d.ts.map +1 -0
- package/dist/layouts/home/navbar.js +48 -0
- package/dist/layouts/home.d.ts +5 -7
- package/dist/layouts/home.d.ts.map +1 -0
- package/dist/layouts/home.js +51 -59
- package/dist/layouts/links.d.ts +80 -0
- package/dist/layouts/links.d.ts.map +1 -0
- package/dist/layouts/links.js +14 -0
- package/dist/layouts/shared.d.ts +48 -2
- package/dist/layouts/shared.d.ts.map +1 -0
- package/dist/layouts/shared.js +27 -9
- package/dist/mdx.client.d.ts +3 -6
- package/dist/mdx.client.d.ts.map +1 -0
- package/dist/mdx.client.js +12 -19
- package/dist/mdx.d.ts +18 -20
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +47 -56
- package/dist/og.d.ts +6 -7
- package/dist/og.d.ts.map +1 -0
- package/dist/og.js +43 -102
- package/dist/page.client.d.ts +8 -41
- package/dist/page.client.d.ts.map +1 -0
- package/dist/page.client.js +71 -261
- package/dist/page.d.ts +28 -30
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +80 -168
- package/dist/provider.d.ts +12 -72
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +19 -55
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.d.ts +9 -20
- package/dist/tailwind-plugin.d.ts.map +1 -0
- package/dist/tailwind-plugin.js +191 -699
- package/dist/theme/animations.d.ts +170 -0
- package/dist/theme/animations.d.ts.map +1 -0
- package/dist/theme/animations.js +95 -0
- package/dist/theme/colors.d.ts +11 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +327 -0
- package/dist/theme/typography.d.ts +70 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +71 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +1 -0
- package/dist/utils/get-sidebar-tabs.d.ts +7 -0
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
- package/dist/utils/get-sidebar-tabs.js +20 -0
- package/dist/utils/is-active.d.ts +2 -0
- package/dist/utils/is-active.d.ts.map +1 -0
- package/dist/utils/is-active.js +3 -0
- package/dist/utils/use-copy-button.d.ts +3 -0
- package/dist/utils/use-copy-button.d.ts.map +1 -0
- package/dist/utils/use-copy-button.js +25 -0
- package/package.json +9 -9
- package/dist/chunk-27HFSL7N.js +0 -53
- package/dist/chunk-2FLZOPQN.js +0 -54
- package/dist/chunk-2KMKNVSN.js +0 -29
- package/dist/chunk-AFMXKA2S.js +0 -125
- package/dist/chunk-CDPVENXR.js +0 -8
- package/dist/chunk-CLF6ZVYS.js +0 -259
- package/dist/chunk-DGKCMOIC.js +0 -56
- package/dist/chunk-DN6Z5VW6.js +0 -61
- package/dist/chunk-E3VO2QQT.js +0 -29
- package/dist/chunk-EFMHXXHW.js +0 -24
- package/dist/chunk-F534DZID.js +0 -43
- package/dist/chunk-GHOAONNQ.js +0 -48
- package/dist/chunk-IL64LMKR.js +0 -82
- package/dist/chunk-ILBYBJ5C.js +0 -38
- package/dist/chunk-IVBHRX3O.js +0 -31
- package/dist/chunk-J6XGK6ZG.js +0 -212
- package/dist/chunk-KZTWSBYY.js +0 -68
- package/dist/chunk-MCX7E6ZW.js +0 -57
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-QKOA6KEZ.js +0 -22
- package/dist/chunk-TK3TM3MR.js +0 -6
- package/dist/chunk-TQJ6YPJ3.js +0 -31
- package/dist/chunk-UUGCW3UP.js +0 -84
- package/dist/chunk-VPJMNIJX.js +0 -542
- package/dist/chunk-W36BQGMB.js +0 -69
- package/dist/chunk-YL3MZH7N.js +0 -66
- package/dist/chunk-ZBOI25UW.js +0 -139
- package/dist/components/api.client.d.ts +0 -5
- package/dist/components/api.client.js +0 -8
- package/dist/dynamic-sidebar-SYEETGZL.js +0 -129
- package/dist/edit-on-github-FIYOWWPQ.js +0 -49
- package/dist/layouts/home.client.d.ts +0 -11
- package/dist/layouts/home.client.js +0 -274
- package/dist/shared-SScCiV7b.d.ts +0 -152
- package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
- package/dist/tag-list-BsEgfE3x.d.ts +0 -6
- package/dist/toc-clerk-SKE4LBT7.js +0 -158
- package/dist/tree-06ley65N.d.ts +0 -21
package/dist/page.js
CHANGED
|
@@ -1,177 +1,89 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
} from
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
() => import("./edit-on-github-FIYOWWPQ.js")
|
|
29
|
-
);
|
|
30
|
-
function DocsPage({
|
|
31
|
-
toc = [],
|
|
32
|
-
breadcrumb = {},
|
|
33
|
-
full = false,
|
|
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
|
-
} = {},
|
|
46
|
-
...props
|
|
47
|
-
}) {
|
|
48
|
-
return /* @__PURE__ */ jsxs(AnchorProvider, { toc, single: tocOptions.single, children: [
|
|
49
|
-
/* @__PURE__ */ jsxs(
|
|
50
|
-
"div",
|
|
51
|
-
{
|
|
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
|
-
},
|
|
58
|
-
children: [
|
|
59
|
-
replaceOrDefault(
|
|
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
|
-
}
|
|
66
|
-
),
|
|
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
|
-
)
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
replaceOrDefault(
|
|
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" })
|
|
97
|
-
)
|
|
98
|
-
] });
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, } from 'react';
|
|
3
|
+
import dynamic from 'next/dynamic';
|
|
4
|
+
import { AnchorProvider } from 'fumadocs-core/toc';
|
|
5
|
+
import { Card, Cards } from './components/card';
|
|
6
|
+
import { replaceOrDefault } from './layouts/shared';
|
|
7
|
+
import { cn } from './utils/cn';
|
|
8
|
+
import { Footer, LastUpdate, PageContainer, PageHeader, } from './page.client';
|
|
9
|
+
import { Breadcrumb, } from './components/layout/breadcrumb';
|
|
10
|
+
import { Toc, TOCItems } from './components/layout/toc';
|
|
11
|
+
import { TocPopoverTrigger, TocPopover, TocPopoverContent, } from './components/layout/toc-popover';
|
|
12
|
+
import { buttonVariants } from './components/ui/button';
|
|
13
|
+
import { Edit, Text } from 'lucide-react';
|
|
14
|
+
import { I18nLabel } from './contexts/i18n';
|
|
15
|
+
const ClerkTOCItems = dynamic(() => import('./components/layout/toc-clerk'));
|
|
16
|
+
export function DocsPage({ toc = [], breadcrumb = {}, full = false, footer = {}, tableOfContentPopover: { enabled: tocPopoverEnabled = true, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: {
|
|
17
|
+
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
18
|
+
enabled: tocEnabled = !full, component: tocReplace, ...tocOptions } = {}, ...props }) {
|
|
19
|
+
return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs(PageContainer, { style: {
|
|
20
|
+
'--fd-toc-width': tocEnabled ? undefined : '0px',
|
|
21
|
+
}, children: [replaceOrDefault({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsx(PageHeader, { className: "lg:hidden", children: _jsxs(TocPopover, { children: [_jsx(TocPopoverTrigger, { className: "size-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc, isMenu: true })) : (_jsx(TOCItems, { items: toc, isMenu: true })), tocPopoverOptions.footer] })] }) }), {
|
|
22
|
+
items: toc,
|
|
23
|
+
...tocPopoverOptions,
|
|
24
|
+
}), _jsxs("article", { className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-10 md:px-6 md:pt-12', tocEnabled ? 'max-w-[860px]' : 'max-w-[1120px]'), children: [replaceOrDefault(breadcrumb, _jsx(Breadcrumb, { ...breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(footer, _jsx(Footer, { items: footer.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
|
|
25
|
+
items: toc,
|
|
26
|
+
...tocOptions,
|
|
27
|
+
}, _jsx("div", { role: "none", className: "flex-1" }))] }));
|
|
99
28
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
29
|
+
function EditOnGitHub({ owner, repo, sha, path, ...props }) {
|
|
30
|
+
const href = `https://github.com/${owner}/${repo}/blob/${sha}/${path.startsWith('/') ? path.slice(1) : path}`;
|
|
31
|
+
return (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
|
|
32
|
+
color: 'secondary',
|
|
33
|
+
className: 'gap-1.5 py-1 text-fd-muted-foreground',
|
|
34
|
+
}), props.className), children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Add typography styles
|
|
38
|
+
*/
|
|
39
|
+
export const DocsBody = forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('prose', className), ...props })));
|
|
40
|
+
DocsBody.displayName = 'DocsBody';
|
|
41
|
+
export const DocsDescription = forwardRef((props, ref) => {
|
|
42
|
+
// don't render if no description provided
|
|
43
|
+
if (props.children === undefined)
|
|
44
|
+
return null;
|
|
45
|
+
return (_jsx("p", { ref: ref, ...props, className: cn('mb-8 text-lg text-fd-muted-foreground', props.className), children: props.children }));
|
|
113
46
|
});
|
|
114
|
-
DocsDescription.displayName =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"h1",
|
|
118
|
-
{
|
|
119
|
-
ref,
|
|
120
|
-
...props,
|
|
121
|
-
className: twMerge("text-3xl font-bold", props.className),
|
|
122
|
-
children: props.children
|
|
123
|
-
}
|
|
124
|
-
);
|
|
47
|
+
DocsDescription.displayName = 'DocsDescription';
|
|
48
|
+
export const DocsTitle = forwardRef((props, ref) => {
|
|
49
|
+
return (_jsx("h1", { ref: ref, ...props, className: cn('text-3xl font-bold', props.className), children: props.children }));
|
|
125
50
|
});
|
|
126
|
-
DocsTitle.displayName =
|
|
51
|
+
DocsTitle.displayName = 'DocsTitle';
|
|
127
52
|
function findParent(node, page) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
for (const child of node.children) {
|
|
132
|
-
if (child.type === "folder") {
|
|
133
|
-
const parent = findParent(child, page);
|
|
134
|
-
if (parent) return parent;
|
|
53
|
+
if ('index' in node && node.index?.$ref?.file === page.file.path) {
|
|
54
|
+
return node;
|
|
135
55
|
}
|
|
136
|
-
|
|
137
|
-
|
|
56
|
+
for (const child of node.children) {
|
|
57
|
+
if (child.type === 'folder') {
|
|
58
|
+
const parent = findParent(child, page);
|
|
59
|
+
if (parent)
|
|
60
|
+
return parent;
|
|
61
|
+
}
|
|
62
|
+
if (child.type === 'page' && child.$ref?.file === page.file.path) {
|
|
63
|
+
return node;
|
|
64
|
+
}
|
|
138
65
|
}
|
|
139
|
-
}
|
|
140
66
|
}
|
|
141
|
-
function DocsCategory({
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
title: item.data.title,
|
|
158
|
-
description: item.data.description ?? "No Description",
|
|
159
|
-
href: item.url
|
|
160
|
-
},
|
|
161
|
-
item.url
|
|
162
|
-
)) });
|
|
67
|
+
export function DocsCategory({ page, from, tree: forcedTree, ...props }) {
|
|
68
|
+
const tree = forcedTree ??
|
|
69
|
+
(from._i18n
|
|
70
|
+
? from.pageTree[page.locale ?? from._i18n.defaultLanguage]
|
|
71
|
+
: from.pageTree);
|
|
72
|
+
const parent = findParent(tree, page);
|
|
73
|
+
if (!parent)
|
|
74
|
+
return null;
|
|
75
|
+
const items = parent.children.flatMap((item) => {
|
|
76
|
+
if (item.type !== 'page' || item.url === page.url)
|
|
77
|
+
return [];
|
|
78
|
+
return from.getNodePage(item) ?? [];
|
|
79
|
+
});
|
|
80
|
+
return (_jsx(Cards, { ...props, children: items.map((item) => (_jsx(Card, { title: item.data.title, description: item.data.description ??
|
|
81
|
+
'No Description', href: item.url }, item.url))) }));
|
|
163
82
|
}
|
|
164
|
-
DocsBody.displayName =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
83
|
+
DocsBody.displayName = 'DocsBody';
|
|
84
|
+
/**
|
|
85
|
+
* For separate MDX page
|
|
86
|
+
*/
|
|
87
|
+
export function withArticle({ children }) {
|
|
88
|
+
return (_jsx("main", { className: "container py-12", children: _jsx("article", { className: "prose", children: children }) }));
|
|
169
89
|
}
|
|
170
|
-
export {
|
|
171
|
-
DocsBody,
|
|
172
|
-
DocsCategory,
|
|
173
|
-
DocsDescription,
|
|
174
|
-
DocsPage,
|
|
175
|
-
DocsTitle,
|
|
176
|
-
withArticle
|
|
177
|
-
};
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,70 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SearchLink, SharedProps } from './components/dialog/search.js';
|
|
6
|
-
export { u as useI18n } from './i18n-Db2HAPOu.js';
|
|
7
|
-
export { u as useTreeContext } from './tree-06ley65N.js';
|
|
8
|
-
import './tag-list-BsEgfE3x.js';
|
|
9
|
-
import 'react/jsx-runtime';
|
|
10
|
-
import 'fumadocs-core/server';
|
|
11
|
-
|
|
12
|
-
interface HotKey {
|
|
13
|
-
display: ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* Key code or a function determining whether the key is pressed.
|
|
16
|
-
*/
|
|
17
|
-
key: string | ((e: KeyboardEvent) => boolean);
|
|
18
|
-
}
|
|
19
|
-
interface SearchProviderProps {
|
|
20
|
-
/**
|
|
21
|
-
* Preload search dialog before opening it
|
|
22
|
-
*
|
|
23
|
-
* @defaultValue `true`
|
|
24
|
-
*/
|
|
25
|
-
preload?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Custom links to be displayed if search is empty
|
|
28
|
-
*/
|
|
29
|
-
links?: SearchLink[];
|
|
30
|
-
/**
|
|
31
|
-
* Hotkeys for triggering search dialog
|
|
32
|
-
*
|
|
33
|
-
* @defaultValue Meta/Ctrl + K
|
|
34
|
-
*/
|
|
35
|
-
hotKey?: HotKey[];
|
|
36
|
-
/**
|
|
37
|
-
* Replace default search dialog, allowing you to use other solutions such as Algolia Search
|
|
38
|
-
*
|
|
39
|
-
* It receives the `open` and `onOpenChange` prop, can be lazy loaded with `next/dynamic`
|
|
40
|
-
*/
|
|
41
|
-
SearchDialog: React.ComponentType<SharedProps>;
|
|
42
|
-
/**
|
|
43
|
-
* Additional props to the dialog
|
|
44
|
-
*/
|
|
45
|
-
options?: Partial<SharedProps>;
|
|
46
|
-
children?: ReactNode;
|
|
47
|
-
}
|
|
48
|
-
interface SearchContextType {
|
|
49
|
-
enabled: boolean;
|
|
50
|
-
hotKey: HotKey[];
|
|
51
|
-
setOpenSearch: (value: boolean) => void;
|
|
52
|
-
}
|
|
53
|
-
declare function useSearchContext(): SearchContextType;
|
|
54
|
-
|
|
55
|
-
interface SidebarContext {
|
|
56
|
-
open: boolean;
|
|
57
|
-
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
58
|
-
collapsed: boolean;
|
|
59
|
-
setCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
|
|
60
|
-
/**
|
|
61
|
-
* When set to false, don't close the sidebar when navigate to another page
|
|
62
|
-
*/
|
|
63
|
-
closeOnRedirect: MutableRefObject<boolean>;
|
|
64
|
-
}
|
|
65
|
-
declare const SidebarContext: react.Context<SidebarContext | undefined>;
|
|
66
|
-
declare function useSidebar(): SidebarContext;
|
|
67
|
-
|
|
1
|
+
import { ThemeProvider } from 'next-themes';
|
|
2
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
3
|
+
import type { DefaultSearchDialogProps } from './components/dialog/search-default';
|
|
4
|
+
import { type SearchProviderProps } from './contexts/search';
|
|
68
5
|
interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'> {
|
|
69
6
|
options?: Partial<DefaultSearchDialogProps> | SearchProviderProps['options'];
|
|
70
7
|
/**
|
|
@@ -74,7 +11,7 @@ interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'
|
|
|
74
11
|
*/
|
|
75
12
|
enabled?: boolean;
|
|
76
13
|
}
|
|
77
|
-
interface RootProviderProps {
|
|
14
|
+
export interface RootProviderProps {
|
|
78
15
|
/**
|
|
79
16
|
* `dir` option for Radix UI
|
|
80
17
|
*/
|
|
@@ -86,7 +23,7 @@ interface RootProviderProps {
|
|
|
86
23
|
/**
|
|
87
24
|
* Customise options of `next-themes`
|
|
88
25
|
*/
|
|
89
|
-
theme?: Partial<
|
|
26
|
+
theme?: Partial<ComponentPropsWithoutRef<typeof ThemeProvider>> & {
|
|
90
27
|
/**
|
|
91
28
|
* Enable `next-themes`
|
|
92
29
|
*
|
|
@@ -96,6 +33,9 @@ interface RootProviderProps {
|
|
|
96
33
|
};
|
|
97
34
|
children: ReactNode;
|
|
98
35
|
}
|
|
99
|
-
declare function RootProvider({ children, dir, theme: { enabled, ...theme }, search, }: RootProviderProps): React.ReactElement;
|
|
100
|
-
|
|
101
|
-
export {
|
|
36
|
+
export declare function RootProvider({ children, dir, theme: { enabled, ...theme }, search, }: RootProviderProps): React.ReactElement;
|
|
37
|
+
export { useI18n, I18nLabel } from './contexts/i18n';
|
|
38
|
+
export { SearchProvider, SearchOnly, useSearchContext, type SearchProviderProps, } from './contexts/search';
|
|
39
|
+
export { SidebarProvider, useSidebar } from './contexts/sidebar';
|
|
40
|
+
export { useTreePath, useTreeContext, TreeContextProvider, } from './contexts/tree';
|
|
41
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,UAAU,aACR,SAAQ,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,UAAU,CAAC;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7E;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,CAAC,GAAG;QAChE;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAEF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAOD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,GAAG,EACH,KAAK,EAAE,EAAE,OAAc,EAAE,GAAG,KAAK,EAAO,EACxC,MAAM,GACP,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CA4BxC;AAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,iBAAiB,CAAC"}
|
package/dist/provider.js
CHANGED
|
@@ -1,56 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
import "./chunk-MLKGABMK.js";
|
|
17
|
-
|
|
18
|
-
// src/provider.tsx
|
|
19
|
-
import { ThemeProvider } from "next-themes";
|
|
20
|
-
import dynamic from "next/dynamic";
|
|
21
|
-
import { DirectionProvider } from "@radix-ui/react-direction";
|
|
22
|
-
import { jsx } from "react/jsx-runtime";
|
|
23
|
-
var DefaultSearchDialog = dynamic(
|
|
24
|
-
() => import("./components/dialog/search-default.js"),
|
|
25
|
-
{ ssr: false }
|
|
26
|
-
);
|
|
27
|
-
function RootProvider({
|
|
28
|
-
children,
|
|
29
|
-
dir,
|
|
30
|
-
theme: { enabled = true, ...theme } = {},
|
|
31
|
-
search
|
|
32
|
-
}) {
|
|
33
|
-
let body = children;
|
|
34
|
-
if (search?.enabled !== false)
|
|
35
|
-
body = /* @__PURE__ */ jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children: body });
|
|
36
|
-
if (enabled)
|
|
37
|
-
body = /* @__PURE__ */ jsx(
|
|
38
|
-
ThemeProvider,
|
|
39
|
-
{
|
|
40
|
-
attribute: "class",
|
|
41
|
-
defaultTheme: "system",
|
|
42
|
-
enableSystem: true,
|
|
43
|
-
disableTransitionOnChange: true,
|
|
44
|
-
...theme,
|
|
45
|
-
children: body
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
return /* @__PURE__ */ jsx(DirectionProvider, { dir: dir ?? "ltr", children: /* @__PURE__ */ jsx(SidebarProvider, { children: body }) });
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ThemeProvider } from 'next-themes';
|
|
4
|
+
import dynamic from 'next/dynamic';
|
|
5
|
+
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
6
|
+
import { SidebarProvider } from './contexts/sidebar';
|
|
7
|
+
import { SearchProvider } from './contexts/search';
|
|
8
|
+
const DefaultSearchDialog = dynamic(() => import('./components/dialog/search-default'), { ssr: false });
|
|
9
|
+
export function RootProvider({ children, dir, theme: { enabled = true, ...theme } = {}, search, }) {
|
|
10
|
+
let body = children;
|
|
11
|
+
if (search?.enabled !== false)
|
|
12
|
+
body = (_jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children: body }));
|
|
13
|
+
if (enabled)
|
|
14
|
+
body = (_jsx(ThemeProvider, { attribute: "class", defaultTheme: "system", enableSystem: true, disableTransitionOnChange: true, ...theme, children: body }));
|
|
15
|
+
return (_jsx(DirectionProvider, { dir: dir ?? 'ltr', children: _jsx(SidebarProvider, { children: body }) }));
|
|
49
16
|
}
|
|
50
|
-
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
useSidebar,
|
|
55
|
-
useTreeContext
|
|
56
|
-
};
|
|
17
|
+
export { useI18n, I18nLabel } from './contexts/i18n';
|
|
18
|
+
export { SearchProvider, SearchOnly, useSearchContext, } from './contexts/search';
|
|
19
|
+
export { SidebarProvider, useSidebar } from './contexts/sidebar';
|
|
20
|
+
export { useTreePath, useTreeContext, TreeContextProvider, } from './contexts/tree';
|