fumadocs-ui 14.2.1 → 14.3.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 (229) hide show
  1. package/dist/components/accordion.d.ts +4 -7
  2. package/dist/components/accordion.d.ts.map +1 -0
  3. package/dist/components/accordion.js +32 -104
  4. package/dist/components/api.d.ts +4 -13
  5. package/dist/components/api.d.ts.map +1 -0
  6. package/dist/components/api.js +3 -16
  7. package/dist/components/banner.d.ts +3 -5
  8. package/dist/components/banner.d.ts.map +1 -0
  9. package/dist/components/banner.js +53 -120
  10. package/dist/components/callout.d.ts +4 -7
  11. package/dist/components/callout.d.ts.map +1 -0
  12. package/dist/components/callout.js +13 -9
  13. package/dist/components/card.d.ts +5 -7
  14. package/dist/components/card.d.ts.map +1 -0
  15. package/dist/components/card.js +10 -10
  16. package/dist/components/codeblock.d.ts +6 -9
  17. package/dist/components/codeblock.d.ts.map +1 -0
  18. package/dist/components/codeblock.js +41 -15
  19. package/dist/components/dialog/search-algolia.d.ts +7 -11
  20. package/dist/components/dialog/search-algolia.d.ts.map +1 -0
  21. package/dist/components/dialog/search-algolia.js +19 -79
  22. package/dist/components/dialog/search-default.d.ts +6 -10
  23. package/dist/components/dialog/search-default.d.ts.map +1 -0
  24. package/dist/components/dialog/search-default.js +24 -73
  25. package/dist/components/dialog/search-orama.d.ts +7 -11
  26. package/dist/components/dialog/search-orama.d.ts.map +1 -0
  27. package/dist/components/dialog/search-orama.js +22 -79
  28. package/dist/components/dialog/search.d.ts +7 -9
  29. package/dist/components/dialog/search.d.ts.map +1 -0
  30. package/dist/components/dialog/search.js +98 -13
  31. package/dist/components/dialog/tag-list.d.ts +13 -0
  32. package/dist/components/dialog/tag-list.d.ts.map +1 -0
  33. package/dist/components/dialog/tag-list.js +20 -0
  34. package/dist/components/files.d.ts +7 -9
  35. package/dist/components/files.d.ts.map +1 -0
  36. package/dist/components/files.js +15 -63
  37. package/dist/components/heading.d.ts +4 -5
  38. package/dist/components/heading.d.ts.map +1 -0
  39. package/dist/components/heading.js +9 -9
  40. package/dist/components/image-zoom.d.ts +7 -8
  41. package/dist/components/image-zoom.d.ts.map +1 -0
  42. package/dist/components/image-zoom.js +16 -40
  43. package/dist/components/inline-toc.d.ts +4 -6
  44. package/dist/components/inline-toc.d.ts.map +1 -0
  45. package/dist/components/inline-toc.js +8 -46
  46. package/dist/components/layout/breadcrumb.d.ts +11 -0
  47. package/dist/components/layout/breadcrumb.d.ts.map +1 -0
  48. package/dist/components/layout/breadcrumb.js +20 -0
  49. package/dist/components/layout/language-toggle.d.ts +5 -7
  50. package/dist/components/layout/language-toggle.d.ts.map +1 -0
  51. package/dist/components/layout/language-toggle.js +24 -14
  52. package/dist/components/layout/nav.d.ts +28 -0
  53. package/dist/components/layout/nav.d.ts.map +1 -0
  54. package/dist/components/layout/nav.js +29 -0
  55. package/dist/components/layout/root-toggle.d.ts +5 -7
  56. package/dist/components/layout/root-toggle.d.ts.map +1 -0
  57. package/dist/components/layout/root-toggle.js +28 -13
  58. package/dist/components/layout/search-toggle.d.ts +4 -0
  59. package/dist/components/layout/search-toggle.d.ts.map +1 -0
  60. package/dist/components/layout/search-toggle.js +24 -0
  61. package/dist/components/layout/theme-toggle.d.ts +3 -0
  62. package/dist/components/layout/theme-toggle.d.ts.map +1 -0
  63. package/dist/components/layout/theme-toggle.js +21 -0
  64. package/dist/components/layout/toc-clerk.d.ts +6 -0
  65. package/dist/components/layout/toc-clerk.d.ts.map +1 -0
  66. package/dist/components/layout/toc-clerk.js +76 -0
  67. package/dist/components/layout/toc-popover.d.ts +8 -0
  68. package/dist/components/layout/toc-popover.d.ts.map +1 -0
  69. package/dist/components/layout/toc-popover.js +20 -0
  70. package/dist/components/layout/toc-thumb.d.ts +6 -0
  71. package/dist/components/layout/toc-thumb.d.ts.map +1 -0
  72. package/dist/components/layout/toc-thumb.js +53 -0
  73. package/dist/components/layout/toc.d.ts +19 -0
  74. package/dist/components/layout/toc.d.ts.map +1 -0
  75. package/dist/components/layout/toc.js +25 -0
  76. package/dist/components/registry.d.ts +3 -0
  77. package/dist/components/registry.d.ts.map +1 -0
  78. package/dist/components/registry.js +70 -0
  79. package/dist/components/steps.d.ts +4 -6
  80. package/dist/components/steps.d.ts.map +1 -0
  81. package/dist/components/steps.js +5 -16
  82. package/dist/components/tabs.d.ts +7 -21
  83. package/dist/components/tabs.d.ts.map +1 -0
  84. package/dist/components/tabs.js +61 -171
  85. package/dist/components/type-table.d.ts +5 -6
  86. package/dist/components/type-table.d.ts.map +1 -0
  87. package/dist/components/type-table.js +18 -59
  88. package/dist/components/ui/button.d.ts +5 -0
  89. package/dist/components/ui/button.d.ts.map +1 -0
  90. package/dist/components/ui/button.js +14 -0
  91. package/dist/components/ui/collapsible.d.ts +6 -0
  92. package/dist/components/ui/collapsible.d.ts.map +1 -0
  93. package/dist/components/ui/collapsible.js +12 -0
  94. package/dist/components/ui/navigation-menu.d.ts +11 -0
  95. package/dist/components/ui/navigation-menu.d.ts.map +1 -0
  96. package/dist/components/ui/navigation-menu.js +15 -0
  97. package/dist/components/ui/popover.d.ts +8 -0
  98. package/dist/components/ui/popover.d.ts.map +1 -0
  99. package/dist/components/ui/popover.js +11 -0
  100. package/dist/components/ui/scroll-area.d.ts +7 -0
  101. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  102. package/dist/components/ui/scroll-area.js +11 -0
  103. package/dist/components/ui/tabs.d.ts +8 -0
  104. package/dist/components/ui/tabs.d.ts.map +1 -0
  105. package/dist/components/ui/tabs.js +16 -0
  106. package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
  107. package/dist/contexts/i18n.d.ts.map +1 -0
  108. package/dist/contexts/i18n.js +23 -0
  109. package/dist/contexts/search.d.ts +50 -0
  110. package/dist/contexts/search.d.ts.map +1 -0
  111. package/dist/contexts/search.js +50 -0
  112. package/dist/contexts/sidebar.d.ts +18 -0
  113. package/dist/contexts/sidebar.d.ts.map +1 -0
  114. package/dist/contexts/sidebar.js +31 -0
  115. package/dist/contexts/tree.d.ts +13 -0
  116. package/dist/contexts/tree.d.ts.map +1 -0
  117. package/dist/contexts/tree.js +25 -0
  118. package/dist/i18n.d.ts +5 -6
  119. package/dist/i18n.d.ts.map +1 -0
  120. package/dist/i18n.js +31 -49
  121. package/dist/layouts/docs/navbar.d.ts +4 -0
  122. package/dist/layouts/docs/navbar.d.ts.map +1 -0
  123. package/dist/layouts/docs/navbar.js +22 -0
  124. package/dist/layouts/docs/sidebar.d.ts +40 -0
  125. package/dist/layouts/docs/sidebar.d.ts.map +1 -0
  126. package/dist/layouts/docs/sidebar.js +146 -0
  127. package/dist/layouts/docs.client.d.ts +14 -25
  128. package/dist/layouts/docs.client.d.ts.map +1 -0
  129. package/dist/layouts/docs.client.js +53 -195
  130. package/dist/layouts/docs.d.ts +34 -19
  131. package/dist/layouts/docs.d.ts.map +1 -0
  132. package/dist/layouts/docs.js +67 -202
  133. package/dist/layouts/home/menu.d.ts +6 -0
  134. package/dist/layouts/home/menu.d.ts.map +1 -0
  135. package/dist/layouts/home/menu.js +33 -0
  136. package/dist/layouts/home/navbar.d.ts +16 -0
  137. package/dist/layouts/home/navbar.d.ts.map +1 -0
  138. package/dist/layouts/home/navbar.js +48 -0
  139. package/dist/layouts/home.d.ts +5 -7
  140. package/dist/layouts/home.d.ts.map +1 -0
  141. package/dist/layouts/home.js +51 -59
  142. package/dist/layouts/links.d.ts +80 -0
  143. package/dist/layouts/links.d.ts.map +1 -0
  144. package/dist/layouts/links.js +14 -0
  145. package/dist/layouts/shared.d.ts +48 -2
  146. package/dist/layouts/shared.d.ts.map +1 -0
  147. package/dist/layouts/shared.js +27 -9
  148. package/dist/mdx.client.d.ts +3 -6
  149. package/dist/mdx.client.d.ts.map +1 -0
  150. package/dist/mdx.client.js +12 -19
  151. package/dist/mdx.d.ts +18 -20
  152. package/dist/mdx.d.ts.map +1 -0
  153. package/dist/mdx.js +47 -56
  154. package/dist/og.d.ts +6 -7
  155. package/dist/og.d.ts.map +1 -0
  156. package/dist/og.js +43 -102
  157. package/dist/page.client.d.ts +8 -41
  158. package/dist/page.client.d.ts.map +1 -0
  159. package/dist/page.client.js +71 -261
  160. package/dist/page.d.ts +28 -30
  161. package/dist/page.d.ts.map +1 -0
  162. package/dist/page.js +80 -168
  163. package/dist/provider.d.ts +12 -72
  164. package/dist/provider.d.ts.map +1 -0
  165. package/dist/provider.js +19 -55
  166. package/dist/style.css +1 -1
  167. package/dist/tailwind-plugin.d.ts +9 -20
  168. package/dist/tailwind-plugin.d.ts.map +1 -0
  169. package/dist/tailwind-plugin.js +191 -699
  170. package/dist/theme/animations.d.ts +170 -0
  171. package/dist/theme/animations.d.ts.map +1 -0
  172. package/dist/theme/animations.js +95 -0
  173. package/dist/theme/colors.d.ts +11 -0
  174. package/dist/theme/colors.d.ts.map +1 -0
  175. package/dist/theme/colors.js +327 -0
  176. package/dist/theme/typography.d.ts +70 -0
  177. package/dist/theme/typography.d.ts.map +1 -0
  178. package/dist/theme/typography.js +71 -0
  179. package/dist/utils/cn.d.ts +2 -0
  180. package/dist/utils/cn.d.ts.map +1 -0
  181. package/dist/utils/cn.js +1 -0
  182. package/dist/utils/get-sidebar-tabs.d.ts +7 -0
  183. package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
  184. package/dist/utils/get-sidebar-tabs.js +20 -0
  185. package/dist/utils/is-active.d.ts +2 -0
  186. package/dist/utils/is-active.d.ts.map +1 -0
  187. package/dist/utils/is-active.js +3 -0
  188. package/dist/utils/use-copy-button.d.ts +3 -0
  189. package/dist/utils/use-copy-button.d.ts.map +1 -0
  190. package/dist/utils/use-copy-button.js +25 -0
  191. package/package.json +9 -9
  192. package/dist/chunk-27HFSL7N.js +0 -53
  193. package/dist/chunk-2FLZOPQN.js +0 -54
  194. package/dist/chunk-2KMKNVSN.js +0 -29
  195. package/dist/chunk-AFMXKA2S.js +0 -125
  196. package/dist/chunk-CDPVENXR.js +0 -8
  197. package/dist/chunk-CLF6ZVYS.js +0 -259
  198. package/dist/chunk-DGKCMOIC.js +0 -56
  199. package/dist/chunk-DN6Z5VW6.js +0 -61
  200. package/dist/chunk-E3VO2QQT.js +0 -29
  201. package/dist/chunk-EFMHXXHW.js +0 -24
  202. package/dist/chunk-F534DZID.js +0 -43
  203. package/dist/chunk-GHOAONNQ.js +0 -48
  204. package/dist/chunk-IL64LMKR.js +0 -82
  205. package/dist/chunk-ILBYBJ5C.js +0 -38
  206. package/dist/chunk-IVBHRX3O.js +0 -31
  207. package/dist/chunk-J6XGK6ZG.js +0 -212
  208. package/dist/chunk-KZTWSBYY.js +0 -68
  209. package/dist/chunk-MCX7E6ZW.js +0 -57
  210. package/dist/chunk-MLKGABMK.js +0 -9
  211. package/dist/chunk-QKOA6KEZ.js +0 -22
  212. package/dist/chunk-TK3TM3MR.js +0 -6
  213. package/dist/chunk-TQJ6YPJ3.js +0 -31
  214. package/dist/chunk-UUGCW3UP.js +0 -84
  215. package/dist/chunk-VPJMNIJX.js +0 -542
  216. package/dist/chunk-W36BQGMB.js +0 -69
  217. package/dist/chunk-YL3MZH7N.js +0 -66
  218. package/dist/chunk-ZBOI25UW.js +0 -139
  219. package/dist/components/api.client.d.ts +0 -5
  220. package/dist/components/api.client.js +0 -8
  221. package/dist/dynamic-sidebar-SYEETGZL.js +0 -129
  222. package/dist/edit-on-github-FIYOWWPQ.js +0 -49
  223. package/dist/layouts/home.client.d.ts +0 -11
  224. package/dist/layouts/home.client.js +0 -274
  225. package/dist/shared-SScCiV7b.d.ts +0 -152
  226. package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
  227. package/dist/tag-list-BsEgfE3x.d.ts +0 -6
  228. package/dist/toc-clerk-SKE4LBT7.js +0 -158
  229. package/dist/tree-06ley65N.d.ts +0 -21
package/dist/page.js CHANGED
@@ -1,177 +1,89 @@
1
- import {
2
- Toc,
3
- TocPopover,
4
- Breadcrumb,
5
- Footer,
6
- TOCItems,
7
- LastUpdate,
8
- } from "./page.client"
9
- import {
10
- replaceOrDefault
11
- } from "./chunk-E3VO2QQT.js";
12
- import {
13
- Card,
14
- Cards
15
- } from "./chunk-GHOAONNQ.js";
16
- import {
17
- twMerge
18
- } from "./chunk-TK3TM3MR.js";
19
- import "./chunk-MLKGABMK.js";
20
-
21
- // src/page.tsx
22
- import { forwardRef } from "react";
23
- import dynamic from "next/dynamic";
24
- import { AnchorProvider } from "fumadocs-core/toc";
25
- import { jsx, jsxs } from "react/jsx-runtime";
26
- var ClerkTOCItems = dynamic(() => import("./toc-clerk-SKE4LBT7.js"));
27
- var EditOnGitHub = dynamic(
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
- var DocsBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: twMerge("prose", className), ...props }));
101
- DocsBody.displayName = "DocsBody";
102
- var DocsDescription = forwardRef((props, ref) => {
103
- if (props.children === void 0) return null;
104
- return /* @__PURE__ */ jsx(
105
- "p",
106
- {
107
- ref,
108
- ...props,
109
- className: twMerge("mb-8 text-lg text-fd-muted-foreground", props.className),
110
- children: props.children
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 = "DocsDescription";
115
- var DocsTitle = forwardRef((props, ref) => {
116
- return /* @__PURE__ */ jsx(
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 = "DocsTitle";
51
+ DocsTitle.displayName = 'DocsTitle';
127
52
  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;
53
+ if ('index' in node && node.index?.$ref?.file === page.file.path) {
54
+ return node;
135
55
  }
136
- if (child.type === "page" && child.$ref?.file === page.file.path) {
137
- return node;
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
- page,
143
- from,
144
- tree: forcedTree,
145
- ...props
146
- }) {
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(
155
- Card,
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 = "DocsBody";
165
- function withArticle({
166
- children
167
- }) {
168
- return /* @__PURE__ */ jsx("main", { className: "container py-12", children: /* @__PURE__ */ jsx("article", { className: "prose", children }) });
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
- };
@@ -1,70 +1,7 @@
1
- import * as react from 'react';
2
- import { ReactNode, MutableRefObject } from 'react';
3
- import { ThemeProviderProps } from 'next-themes/dist/types';
4
- import { DefaultSearchDialogProps } from './components/dialog/search-default.js';
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<ThemeProviderProps> & {
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 { RootProvider, type RootProviderProps, useSearchContext, useSidebar };
36
+ export declare function RootProvider({ children, dir, theme: { enabled, ...theme }, search, }: RootProviderProps): React.ReactElement;
37
+ export { useI18n, I18nLabel } from './contexts/i18n';
38
+ export * from './contexts/search';
39
+ export * from './contexts/sidebar';
40
+ export * 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,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
package/dist/provider.js CHANGED
@@ -1,56 +1,20 @@
1
- "use client";
2
- import {
3
- SearchProvider,
4
- useSearchContext
5
- } from "./chunk-UUGCW3UP.js";
6
- import {
7
- useTreeContext
8
- } from "./chunk-YL3MZH7N.js";
9
- import {
10
- SidebarProvider,
11
- useSidebar
12
- } from "./chunk-27HFSL7N.js";
13
- import {
14
- useI18n
15
- } from "./chunk-EFMHXXHW.js";
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
- RootProvider,
52
- useI18n,
53
- useSearchContext,
54
- useSidebar,
55
- useTreeContext
56
- };
17
+ export { useI18n, I18nLabel } from './contexts/i18n';
18
+ export * from './contexts/search';
19
+ export * from './contexts/sidebar';
20
+ export * from './contexts/tree';