fumadocs-ui 15.2.8 → 16.0.3

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 (202) hide show
  1. package/README.md +1 -1
  2. package/css/black.css +4 -2
  3. package/css/catppuccin.css +2 -0
  4. package/css/default.css +33 -0
  5. package/css/dusk.css +2 -0
  6. package/css/neutral.css +11 -8
  7. package/css/ocean.css +5 -3
  8. package/css/preset.css +237 -16
  9. package/css/purple.css +12 -10
  10. package/css/shadcn.css +31 -0
  11. package/css/shiki.css +78 -51
  12. package/css/solar.css +48 -0
  13. package/css/vitepress.css +3 -4
  14. package/dist/components/accordion.d.ts +6 -3
  15. package/dist/components/accordion.d.ts.map +1 -1
  16. package/dist/components/accordion.js +19 -11
  17. package/dist/components/banner.d.ts +8 -2
  18. package/dist/components/banner.d.ts.map +1 -1
  19. package/dist/components/banner.js +25 -30
  20. package/dist/components/callout.d.ts +2 -2
  21. package/dist/components/callout.d.ts.map +1 -1
  22. package/dist/components/callout.js +15 -18
  23. package/dist/components/card.d.ts.map +1 -1
  24. package/dist/components/card.js +2 -2
  25. package/dist/components/codeblock.d.ts +19 -23
  26. package/dist/components/codeblock.d.ts.map +1 -1
  27. package/dist/components/codeblock.js +55 -24
  28. package/dist/components/dialog/search-algolia.d.ts +5 -4
  29. package/dist/components/dialog/search-algolia.d.ts.map +1 -1
  30. package/dist/components/dialog/search-algolia.js +21 -7
  31. package/dist/components/dialog/search-default.d.ts +4 -2
  32. package/dist/components/dialog/search-default.d.ts.map +1 -1
  33. package/dist/components/dialog/search-default.js +22 -6
  34. package/dist/components/dialog/search-orama.d.ts +5 -3
  35. package/dist/components/dialog/search-orama.d.ts.map +1 -1
  36. package/dist/components/dialog/search-orama.js +21 -6
  37. package/dist/components/dialog/search.d.ts +61 -27
  38. package/dist/components/dialog/search.d.ts.map +1 -1
  39. package/dist/components/dialog/search.js +155 -67
  40. package/dist/components/dynamic-codeblock.d.ts +16 -2
  41. package/dist/components/dynamic-codeblock.d.ts.map +1 -1
  42. package/dist/components/dynamic-codeblock.js +22 -10
  43. package/dist/components/files.d.ts.map +1 -1
  44. package/dist/components/files.js +1 -1
  45. package/dist/components/github-info.js +1 -1
  46. package/dist/components/heading.js +1 -1
  47. package/dist/components/image-zoom.css +4 -0
  48. package/dist/components/inline-toc.d.ts +2 -2
  49. package/dist/components/inline-toc.d.ts.map +1 -1
  50. package/dist/components/inline-toc.js +1 -1
  51. package/dist/components/layout/language-toggle.js +1 -1
  52. package/dist/components/layout/root-toggle.d.ts +5 -15
  53. package/dist/components/layout/root-toggle.d.ts.map +1 -1
  54. package/dist/components/layout/root-toggle.js +10 -12
  55. package/dist/components/layout/search-toggle.d.ts +6 -4
  56. package/dist/components/layout/search-toggle.d.ts.map +1 -1
  57. package/dist/components/layout/search-toggle.js +5 -5
  58. package/dist/components/layout/sidebar.d.ts +21 -13
  59. package/dist/components/layout/sidebar.d.ts.map +1 -1
  60. package/dist/components/layout/sidebar.js +67 -65
  61. package/dist/components/layout/theme-toggle.js +1 -1
  62. package/dist/components/layout/toc-clerk.d.ts +2 -4
  63. package/dist/components/layout/toc-clerk.d.ts.map +1 -1
  64. package/dist/components/layout/toc-clerk.js +9 -5
  65. package/dist/components/layout/toc-thumb.js +1 -1
  66. package/dist/components/layout/toc.d.ts +6 -22
  67. package/dist/components/layout/toc.d.ts.map +1 -1
  68. package/dist/components/layout/toc.js +14 -18
  69. package/dist/components/tabs.d.ts +18 -18
  70. package/dist/components/tabs.d.ts.map +1 -1
  71. package/dist/components/tabs.js +44 -105
  72. package/dist/components/tabs.unstyled.d.ts +24 -0
  73. package/dist/components/tabs.unstyled.d.ts.map +1 -0
  74. package/dist/components/tabs.unstyled.js +89 -0
  75. package/dist/components/type-table.d.ts +19 -10
  76. package/dist/components/type-table.d.ts.map +1 -1
  77. package/dist/components/type-table.js +19 -10
  78. package/dist/components/ui/button.d.ts +2 -1
  79. package/dist/components/ui/button.d.ts.map +1 -1
  80. package/dist/components/ui/button.js +12 -8
  81. package/dist/components/ui/navigation-menu.js +2 -2
  82. package/dist/components/ui/popover.js +1 -1
  83. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  84. package/dist/components/ui/scroll-area.js +1 -1
  85. package/dist/contexts/search.d.ts +10 -2
  86. package/dist/contexts/search.d.ts.map +1 -1
  87. package/dist/contexts/search.js +7 -1
  88. package/dist/contexts/sidebar.d.ts.map +1 -1
  89. package/dist/contexts/sidebar.js +2 -3
  90. package/dist/contexts/tree.d.ts +2 -1
  91. package/dist/contexts/tree.d.ts.map +1 -1
  92. package/dist/contexts/tree.js +9 -2
  93. package/dist/i18n.d.ts +13 -11
  94. package/dist/i18n.d.ts.map +1 -1
  95. package/dist/i18n.js +14 -37
  96. package/dist/icons.d.ts +49 -0
  97. package/dist/icons.d.ts.map +1 -0
  98. package/dist/icons.js +282 -0
  99. package/dist/layouts/docs/client.d.ts +9 -0
  100. package/dist/layouts/docs/client.d.ts.map +1 -0
  101. package/dist/layouts/docs/client.js +46 -0
  102. package/dist/layouts/docs/index.d.ts +36 -0
  103. package/dist/layouts/docs/index.d.ts.map +1 -0
  104. package/dist/layouts/docs/index.js +77 -0
  105. package/dist/layouts/docs/page-client.d.ts +25 -0
  106. package/dist/layouts/docs/page-client.d.ts.map +1 -0
  107. package/dist/layouts/docs/page-client.js +157 -0
  108. package/dist/layouts/docs/page.d.ts +17 -0
  109. package/dist/layouts/docs/page.d.ts.map +1 -0
  110. package/dist/layouts/docs/page.js +26 -0
  111. package/dist/layouts/{home.d.ts → home/index.d.ts} +2 -3
  112. package/dist/layouts/home/index.d.ts.map +1 -0
  113. package/dist/layouts/home/index.js +56 -0
  114. package/dist/layouts/home/menu.d.ts +1 -1
  115. package/dist/layouts/home/menu.d.ts.map +1 -1
  116. package/dist/layouts/home/menu.js +3 -6
  117. package/dist/layouts/home/navbar.d.ts +4 -4
  118. package/dist/layouts/home/navbar.d.ts.map +1 -1
  119. package/dist/layouts/home/navbar.js +3 -4
  120. package/dist/layouts/notebook/client.d.ts +11 -0
  121. package/dist/layouts/notebook/client.d.ts.map +1 -0
  122. package/dist/layouts/notebook/client.js +45 -0
  123. package/dist/layouts/notebook/index.d.ts +34 -0
  124. package/dist/layouts/notebook/index.d.ts.map +1 -0
  125. package/dist/layouts/notebook/index.js +112 -0
  126. package/dist/layouts/shared/client.d.ts +6 -0
  127. package/dist/layouts/shared/client.d.ts.map +1 -0
  128. package/dist/layouts/{links.js → shared/client.js} +4 -6
  129. package/dist/layouts/shared/index.d.ts +122 -0
  130. package/dist/layouts/shared/index.d.ts.map +1 -0
  131. package/dist/layouts/{shared.js → shared/index.js} +1 -15
  132. package/dist/mdx.d.ts +7 -2
  133. package/dist/mdx.d.ts.map +1 -1
  134. package/dist/mdx.js +5 -1
  135. package/dist/mdx.server.d.ts.map +1 -1
  136. package/dist/mdx.server.js +10 -3
  137. package/dist/page.d.ts +33 -35
  138. package/dist/page.d.ts.map +1 -1
  139. package/dist/page.js +28 -32
  140. package/dist/provider/base.d.ts +1 -1
  141. package/dist/provider/base.d.ts.map +1 -1
  142. package/dist/provider/base.js +9 -9
  143. package/dist/provider/index.d.ts +5 -3
  144. package/dist/provider/index.d.ts.map +1 -1
  145. package/dist/provider/index.js +6 -6
  146. package/dist/provider/next.d.ts +4 -0
  147. package/dist/provider/next.d.ts.map +1 -0
  148. package/dist/provider/next.js +7 -0
  149. package/dist/provider/react-router.d.ts +4 -0
  150. package/dist/provider/react-router.d.ts.map +1 -0
  151. package/dist/provider/react-router.js +7 -0
  152. package/dist/provider/tanstack.d.ts +4 -0
  153. package/dist/provider/tanstack.d.ts.map +1 -0
  154. package/dist/provider/tanstack.js +7 -0
  155. package/dist/provider/waku.d.ts +4 -0
  156. package/dist/provider/waku.d.ts.map +1 -0
  157. package/dist/provider/waku.js +7 -0
  158. package/dist/style.css +944 -470
  159. package/dist/utils/get-sidebar-tabs.d.ts +18 -4
  160. package/dist/utils/get-sidebar-tabs.d.ts.map +1 -1
  161. package/dist/utils/get-sidebar-tabs.js +11 -8
  162. package/dist/utils/is-active.d.ts +2 -0
  163. package/dist/utils/is-active.d.ts.map +1 -1
  164. package/dist/utils/is-active.js +12 -4
  165. package/dist/utils/merge-refs.d.ts +3 -0
  166. package/dist/utils/merge-refs.d.ts.map +1 -0
  167. package/dist/utils/merge-refs.js +12 -0
  168. package/dist/utils/use-copy-button.d.ts +1 -1
  169. package/dist/utils/use-copy-button.d.ts.map +1 -1
  170. package/dist/utils/use-copy-button.js +9 -7
  171. package/package.json +76 -32
  172. package/css/animations.css +0 -199
  173. package/dist/components/ui/tabs.d.ts +0 -8
  174. package/dist/components/ui/tabs.d.ts.map +0 -1
  175. package/dist/components/ui/tabs.js +0 -16
  176. package/dist/layouts/docs/shared.d.ts +0 -25
  177. package/dist/layouts/docs/shared.d.ts.map +0 -1
  178. package/dist/layouts/docs/shared.js +0 -24
  179. package/dist/layouts/docs-client.d.ts +0 -5
  180. package/dist/layouts/docs-client.d.ts.map +0 -1
  181. package/dist/layouts/docs-client.js +0 -33
  182. package/dist/layouts/docs.d.ts +0 -30
  183. package/dist/layouts/docs.d.ts.map +0 -1
  184. package/dist/layouts/docs.js +0 -50
  185. package/dist/layouts/home.d.ts.map +0 -1
  186. package/dist/layouts/home.js +0 -44
  187. package/dist/layouts/links.d.ts +0 -79
  188. package/dist/layouts/links.d.ts.map +0 -1
  189. package/dist/layouts/notebook-client.d.ts +0 -12
  190. package/dist/layouts/notebook-client.d.ts.map +0 -1
  191. package/dist/layouts/notebook-client.js +0 -47
  192. package/dist/layouts/notebook.d.ts +0 -17
  193. package/dist/layouts/notebook.d.ts.map +0 -1
  194. package/dist/layouts/notebook.js +0 -68
  195. package/dist/layouts/shared.d.ts +0 -65
  196. package/dist/layouts/shared.d.ts.map +0 -1
  197. package/dist/page-client.d.ts +0 -28
  198. package/dist/page-client.d.ts.map +0 -1
  199. package/dist/page-client.js +0 -150
  200. package/dist/page.server.d.ts +0 -13
  201. package/dist/page.server.d.ts.map +0 -1
  202. package/dist/page.server.js +0 -36
@@ -0,0 +1,112 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment, useMemo, } from 'react';
3
+ import { BaseLinkItem, getLinks, } from '../../layouts/shared/index.js';
4
+ import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarContentMobile, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarFooter, SidebarHeader, SidebarItem, SidebarPageTree, SidebarTrigger, SidebarViewport, } from '../../components/layout/sidebar.js';
5
+ import { TreeContextProvider } from '../../contexts/tree.js';
6
+ import { cn } from '../../utils/cn.js';
7
+ import { buttonVariants } from '../../components/ui/button.js';
8
+ import { ChevronDown, Languages, Sidebar as SidebarIcon, X, } from '../../icons.js';
9
+ import { LanguageToggle } from '../../components/layout/language-toggle.js';
10
+ import { ThemeToggle } from '../../components/layout/theme-toggle.js';
11
+ import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover.js';
12
+ import { LayoutBody, LayoutTabs, Navbar, NavbarSidebarTrigger, } from '../../layouts/notebook/client.js';
13
+ import { NavProvider } from '../../contexts/layout.js';
14
+ import { RootToggle } from '../../components/layout/root-toggle.js';
15
+ import Link from 'fumadocs-core/link';
16
+ import { LargeSearchToggle, SearchToggle, } from '../../components/layout/search-toggle.js';
17
+ import { getSidebarTabs, } from '../../utils/get-sidebar-tabs.js';
18
+ export function DocsLayout(props) {
19
+ const { tabMode = 'sidebar', nav: { transparentMode, ...nav } = {}, sidebar: { tabs: tabOptions, ...sidebarProps } = {}, i18n = false, themeSwitch = {}, } = props;
20
+ const navMode = nav.mode ?? 'auto';
21
+ const links = getLinks(props.links ?? [], props.githubUrl);
22
+ const tabs = useMemo(() => {
23
+ if (Array.isArray(tabOptions)) {
24
+ return tabOptions;
25
+ }
26
+ if (typeof tabOptions === 'object') {
27
+ return getSidebarTabs(props.tree, tabOptions);
28
+ }
29
+ if (tabOptions !== false) {
30
+ return getSidebarTabs(props.tree);
31
+ }
32
+ return [];
33
+ }, [tabOptions, props.tree]);
34
+ function sidebar() {
35
+ const { banner, footer, components, collapsible = true, prefetch, defaultOpenLevel, ...rest } = sidebarProps;
36
+ const Header = typeof banner === 'function'
37
+ ? banner
38
+ : (props) => (_jsxs(SidebarHeader, { ...props, children: [props.children, banner] }));
39
+ const Footer = typeof footer === 'function'
40
+ ? footer
41
+ : (props) => (_jsxs(SidebarFooter, { ...props, children: [props.children, footer] }));
42
+ const iconLinks = links.filter((item) => item.type === 'icon');
43
+ const rootToggle = (_jsxs(_Fragment, { children: [tabMode === 'sidebar' && tabs.length > 0 && (_jsx(RootToggle, { className: "mb-2", options: tabs })), tabMode === 'navbar' && tabs.length > 0 && (_jsx(RootToggle, { options: tabs, className: "lg:hidden" }))] }));
44
+ const viewport = (_jsxs(SidebarViewport, { children: [links
45
+ .filter((item) => item.type !== 'icon')
46
+ .map((item, i, arr) => (_jsx(SidebarLinkItem, { item: item, className: cn('lg:hidden', i === arr.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components: components })] }));
47
+ const content = (_jsxs(SidebarContent, { ...rest, className: cn(navMode === 'top'
48
+ ? 'border-e-0 bg-transparent'
49
+ : '[--fd-nav-height:0px]', rest.className), children: [_jsxs(Header, { className: "empty:hidden", children: [navMode === 'auto' && (_jsxs("div", { className: "flex justify-between", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 font-medium", children: nav.title }), collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
50
+ color: 'ghost',
51
+ size: 'icon-sm',
52
+ className: 'mt-px mb-auto text-fd-muted-foreground',
53
+ })), children: _jsx(SidebarIcon, {}) }))] })), nav.children, rootToggle] }), viewport, _jsx(Footer, { className: cn('hidden flex-row text-fd-muted-foreground items-center', iconLinks.length > 0 && 'max-lg:flex'), children: iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({
54
+ size: 'icon-sm',
55
+ color: 'ghost',
56
+ className: 'lg:hidden',
57
+ })), "aria-label": item.label, children: item.icon }, i))) })] }));
58
+ const mobile = (_jsxs(SidebarContentMobile, { ...rest, children: [_jsxs(Header, { children: [_jsx(SidebarTrigger, { className: cn(buttonVariants({
59
+ size: 'icon-sm',
60
+ color: 'ghost',
61
+ className: 'ms-auto text-fd-muted-foreground',
62
+ })), children: _jsx(X, {}) }), rootToggle] }), viewport, _jsxs(Footer, { className: cn('hidden flex-row items-center justify-end', (i18n || themeSwitch.enabled !== false) && 'flex', iconLinks.length > 0 && 'max-lg:flex'), children: [iconLinks.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({
63
+ size: 'icon-sm',
64
+ color: 'ghost',
65
+ }), 'text-fd-muted-foreground lg:hidden', i === iconLinks.length - 1 && 'me-auto'), "aria-label": item.label, children: item.icon }, i))), i18n && (_jsx(LanguageToggle, { children: _jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) })), themeSwitch.enabled !== false &&
66
+ (themeSwitch.component ?? (_jsx(ThemeToggle, { mode: themeSwitch.mode ?? 'light-dark-system' })))] })] }));
67
+ return (_jsx(Sidebar, { defaultOpenLevel: defaultOpenLevel, prefetch: prefetch, Content: content, Mobile: mobile }));
68
+ }
69
+ return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs(LayoutBody, { ...props.containerProps, className: cn('md:[--fd-sidebar-width:286px]', props.containerProps?.className), children: [sidebar(), _jsx(DocsNavbar, { ...props, links: links, tabs: tabMode == 'navbar' ? tabs : [] }), props.children] }) }) }));
70
+ }
71
+ function DocsNavbar({ links, tabs, sidebar: { collapsible: sidebarCollapsible = true } = {}, searchToggle = {}, themeSwitch = {}, nav = {}, i18n, }) {
72
+ const navMode = nav.mode ?? 'auto';
73
+ return (_jsxs(Navbar, { mode: navMode, className: cn('on-root:[--fd-nav-height:56px] md:on-root:[--fd-nav-height:64px]', tabs.length > 0 && 'lg:on-root:[--fd-nav-height:104px]'), children: [_jsxs("div", { className: cn('flex border-b px-4 gap-2 flex-1 md:px-6', navMode === 'top' && 'ps-7'), children: [_jsxs("div", { className: cn('items-center', navMode === 'top' && 'flex flex-1', navMode === 'auto' && [
74
+ 'hidden max-md:flex',
75
+ sidebarCollapsible && 'has-data-[collapsed=true]:md:flex',
76
+ ]), children: [sidebarCollapsible && navMode === 'auto' && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
77
+ color: 'ghost',
78
+ size: 'icon-sm',
79
+ }), 'text-fd-muted-foreground data-[collapsed=false]:hidden max-md:hidden'), children: _jsx(SidebarIcon, {}) })), _jsx(Link, { href: nav.url ?? '/', className: cn('inline-flex items-center gap-2.5 font-semibold', navMode === 'auto' && 'md:hidden'), children: nav.title })] }), searchToggle.enabled !== false &&
80
+ (searchToggle.components?.lg ? (_jsx("div", { className: cn('w-full my-auto max-md:hidden', navMode === 'top' ? 'rounded-xl max-w-sm' : 'max-w-[240px]'), children: searchToggle.components.lg })) : (_jsx(LargeSearchToggle, { hideIfDisabled: true, className: cn('w-full my-auto max-md:hidden', navMode === 'top'
81
+ ? 'rounded-xl max-w-sm ps-2.5'
82
+ : 'max-w-[240px]') }))), _jsxs("div", { className: "flex flex-1 items-center justify-end md:gap-2", children: [_jsx("div", { className: "flex items-center gap-6 empty:hidden max-lg:hidden", children: links
83
+ .filter((item) => item.type !== 'icon')
84
+ .map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary" }, i))) }), nav.children, links
85
+ .filter((item) => item.type === 'icon')
86
+ .map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon-sm', color: 'ghost' }), 'text-fd-muted-foreground max-lg:hidden'), "aria-label": item.label, children: item.icon }, i))), _jsxs("div", { className: "flex items-center md:hidden", children: [searchToggle.enabled !== false &&
87
+ (searchToggle.components?.sm ?? (_jsx(SearchToggle, { hideIfDisabled: true, className: "p-2" }))), _jsx(NavbarSidebarTrigger, { className: "p-2 -me-1.5" })] }), _jsxs("div", { className: "flex items-center gap-2 max-md:hidden", children: [i18n && (_jsx(LanguageToggle, { children: _jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) })), themeSwitch.enabled !== false &&
88
+ (themeSwitch.component ?? (_jsx(ThemeToggle, { mode: themeSwitch.mode ?? 'light-dark-system' }))), sidebarCollapsible && navMode === 'top' && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
89
+ color: 'secondary',
90
+ size: 'icon-sm',
91
+ }), 'text-fd-muted-foreground rounded-full -me-1.5'), children: _jsx(SidebarIcon, {}) }))] })] })] }), tabs.length > 0 && (_jsx(LayoutTabs, { className: cn('border-b px-6 h-10 max-lg:hidden', navMode === 'top' && 'ps-7'), options: tabs }))] }));
92
+ }
93
+ function NavbarLinkItem({ item, ...props }) {
94
+ if (item.type === 'menu') {
95
+ return (_jsxs(Popover, { children: [_jsxs(PopoverTrigger, { ...props, className: cn('inline-flex items-center gap-1.5 has-data-[active=true]:text-fd-primary', props.className), children: [item.url ? (_jsx(BaseLinkItem, { item: item, children: item.text })) : (item.text), _jsx(ChevronDown, { className: "size-3" })] }), _jsx(PopoverContent, { className: "flex flex-col", children: item.items.map((child, i) => {
96
+ if (child.type === 'custom')
97
+ return _jsx(Fragment, { children: child.children }, i);
98
+ return (_jsxs(BaseLinkItem, { item: child, className: "inline-flex items-center gap-2 rounded-md p-2 text-start hover:bg-fd-accent hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4", children: [child.icon, child.text] }, i));
99
+ }) })] }));
100
+ }
101
+ if (item.type === 'custom')
102
+ return item.children;
103
+ return (_jsx(BaseLinkItem, { item: item, ...props, children: item.text }));
104
+ }
105
+ function SidebarLinkItem({ item, ...props }) {
106
+ if (item.type === 'menu')
107
+ return (_jsxs(SidebarFolder, { ...props, children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, external: item.external, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(SidebarLinkItem, { item: child }, i))) })] }));
108
+ if (item.type === 'custom')
109
+ return _jsx("div", { ...props, children: item.children });
110
+ return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
111
+ }
112
+ export { Navbar, NavbarSidebarTrigger };
@@ -0,0 +1,6 @@
1
+ import type { ComponentProps } from 'react';
2
+ import type { BaseLinkType } from '../../layouts/shared/index.js';
3
+ export declare function BaseLinkItem({ ref, item, ...props }: Omit<ComponentProps<'a'>, 'href'> & {
4
+ item: BaseLinkType;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2CAkB5D"}
@@ -1,14 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import Link from 'fumadocs-core/link';
4
3
  import { usePathname } from 'fumadocs-core/framework';
5
- import { forwardRef, } from 'react';
6
- import { isActive } from '../utils/is-active.js';
7
- export const BaseLinkItem = forwardRef(({ item, ...props }, ref) => {
4
+ import { isActive } from '../../utils/is-active.js';
5
+ import Link from 'fumadocs-core/link';
6
+ export function BaseLinkItem({ ref, item, ...props }) {
8
7
  const pathname = usePathname();
9
8
  const activeType = item.active ?? 'url';
10
9
  const active = activeType !== 'none' &&
11
10
  isActive(item.url, pathname, activeType === 'nested-url');
12
11
  return (_jsx(Link, { ref: ref, href: item.url, external: item.external, ...props, "data-active": active, children: props.children }));
13
- });
14
- BaseLinkItem.displayName = 'BaseLinkItem';
12
+ }
@@ -0,0 +1,122 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { NavProviderProps } from '../../contexts/layout.js';
3
+ import type { I18nConfig } from 'fumadocs-core/i18n';
4
+ export interface NavOptions extends NavProviderProps {
5
+ enabled: boolean;
6
+ component: ReactNode;
7
+ title?: ReactNode;
8
+ /**
9
+ * Redirect url of title
10
+ * @defaultValue '/'
11
+ */
12
+ url?: string;
13
+ children?: ReactNode;
14
+ }
15
+ export interface BaseLayoutProps {
16
+ themeSwitch?: {
17
+ enabled?: boolean;
18
+ component?: ReactNode;
19
+ mode?: 'light-dark' | 'light-dark-system';
20
+ };
21
+ searchToggle?: Partial<{
22
+ enabled: boolean;
23
+ components: Partial<{
24
+ sm: ReactNode;
25
+ lg: ReactNode;
26
+ }>;
27
+ }>;
28
+ /**
29
+ * I18n options
30
+ *
31
+ * @defaultValue false
32
+ */
33
+ i18n?: boolean | I18nConfig;
34
+ /**
35
+ * GitHub url
36
+ */
37
+ githubUrl?: string;
38
+ links?: LinkItemType[];
39
+ /**
40
+ * Replace or disable navbar
41
+ */
42
+ nav?: Partial<NavOptions>;
43
+ children?: ReactNode;
44
+ }
45
+ interface BaseItem {
46
+ /**
47
+ * Restrict where the item is displayed
48
+ *
49
+ * @defaultValue 'all'
50
+ */
51
+ on?: 'menu' | 'nav' | 'all';
52
+ }
53
+ export interface BaseLinkType extends BaseItem {
54
+ url: string;
55
+ /**
56
+ * When the item is marked as active
57
+ *
58
+ * @defaultValue 'url'
59
+ */
60
+ active?: 'url' | 'nested-url' | 'none';
61
+ external?: boolean;
62
+ }
63
+ export interface MainItemType extends BaseLinkType {
64
+ type?: 'main';
65
+ icon?: ReactNode;
66
+ text: ReactNode;
67
+ description?: ReactNode;
68
+ }
69
+ export interface IconItemType extends BaseLinkType {
70
+ type: 'icon';
71
+ /**
72
+ * `aria-label` of icon button
73
+ */
74
+ label?: string;
75
+ icon: ReactNode;
76
+ text: ReactNode;
77
+ /**
78
+ * @defaultValue true
79
+ */
80
+ secondary?: boolean;
81
+ }
82
+ export interface ButtonItemType extends BaseLinkType {
83
+ type: 'button';
84
+ icon?: ReactNode;
85
+ text: ReactNode;
86
+ /**
87
+ * @defaultValue false
88
+ */
89
+ secondary?: boolean;
90
+ }
91
+ export interface MenuItemType extends Partial<BaseLinkType> {
92
+ type: 'menu';
93
+ icon?: ReactNode;
94
+ text: ReactNode;
95
+ items: ((MainItemType & {
96
+ /**
97
+ * Options when displayed on navigation menu
98
+ */
99
+ menu?: HTMLAttributes<HTMLElement> & {
100
+ banner?: ReactNode;
101
+ };
102
+ }) | CustomItemType)[];
103
+ /**
104
+ * @defaultValue false
105
+ */
106
+ secondary?: boolean;
107
+ }
108
+ export interface CustomItemType extends BaseItem {
109
+ type: 'custom';
110
+ /**
111
+ * @defaultValue false
112
+ */
113
+ secondary?: boolean;
114
+ children: ReactNode;
115
+ }
116
+ export type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType;
117
+ /**
118
+ * Get Links Items with shortcuts
119
+ */
120
+ export declare function getLinks(links?: LinkItemType[], githubUrl?: string): LinkItemType[];
121
+ export { BaseLinkItem } from './client.js';
122
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,W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,MAAM,GACjB,YAAY,EAAE,CAqBhB;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Slot } from '@radix-ui/react-slot';
3
2
  /**
4
3
  * Get Links Items with shortcuts
5
4
  */
@@ -19,17 +18,4 @@ export function getLinks(links = [], githubUrl) {
19
18
  ];
20
19
  return result;
21
20
  }
22
- export function slot(obj, def, customComponentProps, disabled) {
23
- if (obj?.enabled === false)
24
- return disabled;
25
- if (obj?.component !== undefined)
26
- return _jsx(Slot, { ...customComponentProps, children: obj.component });
27
- return def;
28
- }
29
- export function slots(variant, obj, def) {
30
- if (obj?.enabled === false)
31
- return;
32
- if (obj?.components?.[variant] !== undefined)
33
- return _jsx(Slot, { children: obj.components[variant] });
34
- return def;
35
- }
21
+ export { BaseLinkItem } from './client.js';
package/dist/mdx.d.ts CHANGED
@@ -1,10 +1,15 @@
1
1
  import type { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from 'react';
2
2
  import { Card, Cards } from './components/card.js';
3
+ import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from './components/codeblock.js';
3
4
  declare function Image(props: ImgHTMLAttributes<HTMLImageElement> & {
4
5
  sizes?: string;
5
6
  }): import("react/jsx-runtime").JSX.Element;
6
7
  declare function Table(props: TableHTMLAttributes<HTMLTableElement>): import("react/jsx-runtime").JSX.Element;
7
8
  declare const defaultMdxComponents: {
9
+ CodeBlockTab: typeof CodeBlockTab;
10
+ CodeBlockTabs: typeof CodeBlockTabs;
11
+ CodeBlockTabsList: typeof CodeBlockTabsList;
12
+ CodeBlockTabsTrigger: typeof CodeBlockTabsTrigger;
8
13
  pre: (props: HTMLAttributes<HTMLPreElement>) => import("react/jsx-runtime").JSX.Element;
9
14
  Card: typeof Card;
10
15
  Cards: typeof Cards;
@@ -17,9 +22,9 @@ declare const defaultMdxComponents: {
17
22
  h5: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
18
23
  h6: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
19
24
  table: typeof Table;
20
- Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "icon" | "type" | "title"> & {
25
+ Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
21
26
  title?: import("react").ReactNode;
22
- type?: "info" | "warn" | "error";
27
+ type?: "info" | "warn" | "error" | "success" | "warning";
23
28
  icon?: import("react").ReactNode;
24
29
  } & import("react").RefAttributes<HTMLDivElement>>;
25
30
  };
package/dist/mdx.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAMhD,iBAAS,KAAK,CACZ,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAUF;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;iBACX,cAAc,CAAC,cAAc,CAAC;;;OAOhC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;;CAK/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,cAAc,EAAE,kBAK5D,CAAC;AAEJ,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAEL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,wBAAwB,CAAC;AAEhC,iBAAS,KAAK,CACZ,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAUF;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;;;;;iBAKX,cAAc,CAAC,cAAc,CAAC;;;OAOhC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;;CAK/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,cAAc,EAAE,kBAK5D,CAAC;AAEJ,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
package/dist/mdx.js CHANGED
@@ -5,7 +5,7 @@ import { Card, Cards } from './components/card.js';
5
5
  import { Callout } from './components/callout.js';
6
6
  import { Heading } from './components/heading.js';
7
7
  import { cn } from './utils/cn.js';
8
- import { CodeBlock, Pre } from './components/codeblock.js';
8
+ import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre, } from './components/codeblock.js';
9
9
  function Image(props) {
10
10
  return (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, src: props.src, className: cn('rounded-lg', props.className) }));
11
11
  }
@@ -13,6 +13,10 @@ function Table(props) {
13
13
  return (_jsx("div", { className: "relative overflow-auto prose-no-margin my-6", children: _jsx("table", { ...props }) }));
14
14
  }
15
15
  const defaultMdxComponents = {
16
+ CodeBlockTab,
17
+ CodeBlockTabs,
18
+ CodeBlockTabsList,
19
+ CodeBlockTabsTrigger,
16
20
  pre: (props) => (_jsx(CodeBlock, { ...props, children: _jsx(Pre, { children: props.children }) })),
17
21
  Card,
18
22
  Cards,
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,EAClC,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAA0B,GAC7D,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAUzB;AAED,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;AAGzC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,EAClC,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAA0B,GAC7D,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAkBzB;AAED,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import defaultMdxComponents from './mdx.js';
3
+ import * as path from 'node:path';
3
4
  /**
4
5
  * Extend the default Link component to resolve relative file paths in `href`.
5
6
  *
@@ -11,9 +12,15 @@ export function createRelativeLink(source, page, OverrideLink = defaultMdxCompon
11
12
  return async function RelativeLink({ href, ...props }) {
12
13
  // resolve relative href
13
14
  if (href && href.startsWith('.')) {
14
- const target = source.getPageByHref(href, { dir: page.file.dirname });
15
- if (target)
16
- href = target.page.url;
15
+ const target = source.getPageByHref(href, {
16
+ dir: path.dirname(page.path),
17
+ language: page.locale,
18
+ });
19
+ if (target) {
20
+ href = target.hash
21
+ ? `${target.page.url}#${target.hash}`
22
+ : target.page.url;
23
+ }
17
24
  }
18
25
  return _jsx(OverrideLink, { href: href, ...props });
19
26
  };
package/dist/page.d.ts CHANGED
@@ -1,18 +1,7 @@
1
- import type { TableOfContents } from 'fumadocs-core/server';
2
- import { type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
3
- import { type AnchorProviderProps } from 'fumadocs-core/toc';
4
- import { type FooterProps, type BreadcrumbProps } from './page-client.js';
5
- import { type TOCProps } from './components/layout/toc.js';
6
- type TableOfContentOptions = Omit<TOCProps, 'items' | 'children'> & Pick<AnchorProviderProps, 'single'> & {
7
- enabled: boolean;
8
- component: ReactNode;
9
- /**
10
- * @defaultValue 'normal'
11
- */
12
- style?: 'normal' | 'clerk';
13
- };
14
- type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
15
- interface EditOnGitHubOptions extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'children'> {
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type BreadcrumbProps, type FooterProps } from './layouts/docs/page.js';
3
+ import type { AnchorProviderProps, TOCItemType } from 'fumadocs-core/toc';
4
+ interface EditOnGitHubOptions extends Omit<ComponentProps<'a'>, 'href' | 'children'> {
16
5
  owner: string;
17
6
  repo: string;
18
7
  /**
@@ -29,28 +18,21 @@ interface EditOnGitHubOptions extends Omit<AnchorHTMLAttributes<HTMLAnchorElemen
29
18
  interface BreadcrumbOptions extends BreadcrumbProps {
30
19
  enabled: boolean;
31
20
  component: ReactNode;
32
- /**
33
- * Show the full path to the current page
34
- *
35
- * @defaultValue false
36
- * @deprecated use `includePage` instead
37
- */
38
- full?: boolean;
39
21
  }
40
22
  interface FooterOptions extends FooterProps {
41
23
  enabled: boolean;
42
24
  component: ReactNode;
43
25
  }
44
26
  export interface DocsPageProps {
45
- toc?: TableOfContents;
27
+ toc?: TOCItemType[];
28
+ tableOfContent?: Partial<TableOfContentOptions>;
29
+ tableOfContentPopover?: Partial<TableOfContentPopoverOptions>;
46
30
  /**
47
31
  * Extend the page to fill all available space
48
32
  *
49
33
  * @defaultValue false
50
34
  */
51
35
  full?: boolean;
52
- tableOfContent?: Partial<TableOfContentOptions>;
53
- tableOfContentPopover?: Partial<TableOfContentPopoverOptions>;
54
36
  /**
55
37
  * Replace or disable breadcrumb
56
38
  */
@@ -61,22 +43,38 @@ export interface DocsPageProps {
61
43
  footer?: Partial<FooterOptions>;
62
44
  editOnGithub?: EditOnGitHubOptions;
63
45
  lastUpdate?: Date | string | number;
64
- container?: HTMLAttributes<HTMLDivElement>;
65
- article?: HTMLAttributes<HTMLElement>;
66
- children: ReactNode;
46
+ container?: ComponentProps<'div'>;
47
+ article?: ComponentProps<'article'>;
48
+ children?: ReactNode;
67
49
  }
68
- export declare function DocsPage({ toc, full, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps): import("react/jsx-runtime").JSX.Element;
50
+ type TableOfContentOptions = Pick<AnchorProviderProps, 'single'> & {
51
+ /**
52
+ * Custom content in TOC container, before the main TOC
53
+ */
54
+ header?: ReactNode;
55
+ /**
56
+ * Custom content in TOC container, after the main TOC
57
+ */
58
+ footer?: ReactNode;
59
+ enabled: boolean;
60
+ component: ReactNode;
61
+ /**
62
+ * @defaultValue 'normal'
63
+ */
64
+ style?: 'normal' | 'clerk';
65
+ };
66
+ type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
67
+ export declare function DocsPage({ editOnGithub, breadcrumb: { enabled: breadcrumbEnabled, component: breadcrumb, ...breadcrumbProps }, footer, lastUpdate, container, full, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, toc, article, children, }: DocsPageProps): import("react/jsx-runtime").JSX.Element;
68
+ export declare function EditOnGitHub(props: ComponentProps<'a'>): import("react/jsx-runtime").JSX.Element;
69
69
  /**
70
70
  * Add typography styles
71
71
  */
72
- export declare const DocsBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
73
- export declare const DocsDescription: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
74
- export declare const DocsTitle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & import("react").RefAttributes<HTMLHeadingElement>>;
72
+ export declare const DocsBody: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
73
+ export declare const DocsDescription: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
74
+ export declare const DocsTitle: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
75
75
  /**
76
76
  * For separate MDX page
77
77
  */
78
- export declare function withArticle({ children }: {
79
- children: ReactNode;
80
- }): ReactNode;
78
+ export declare function withArticle(props: ComponentProps<'main'>): ReactNode;
81
79
  export {};
82
80
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAEL,KAAK,WAAW,EAIhB,KAAK,eAAe,EAKrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,KAAK,QAAQ,EAEd,MAAM,yBAAyB,CAAC;AAMjC,KAAK,qBAAqB,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,GAC/D,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC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AAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,UAAU,EACrB,GAAG,iBAAiB,EAChB,EACN,cAAc,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,UAAU,EACT,EACN,GAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE,aAAa,2CA8Df;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAuBtD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,2MAMpB,CAAC;AAIF,eAAO,MAAM,eAAe,6NAgB1B,CAAC;AAIH,eAAO,MAAM,SAAS,uNAYrB,CAAC;AAIF;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS,CAMpE"}
package/dist/page.js CHANGED
@@ -1,45 +1,41 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, } from 'react';
3
- import { AnchorProvider } from 'fumadocs-core/toc';
4
- import { slot } from './layouts/shared.js';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
5
3
  import { cn } from './utils/cn.js';
6
- import { Footer, LastUpdate, TocPopover, Breadcrumb, PageBody, PageArticle, TocPopoverTrigger, TocPopoverContent, } from './page-client.js';
7
- import { Toc, TOCItems, TOCScrollArea, } from './components/layout/toc.js';
8
4
  import { buttonVariants } from './components/ui/button.js';
9
- import { Edit, Text } from 'lucide-react';
5
+ import { Edit } from './icons.js';
10
6
  import { I18nLabel } from './contexts/i18n.js';
11
- import ClerkTOCItems from './components/layout/toc-clerk.js';
12
- export function DocsPage({ toc = [], full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
13
- const isTocRequired = toc.length > 0 ||
14
- tocOptions.footer !== undefined ||
15
- tocOptions.header !== undefined;
7
+ import { PageArticle, PageBreadcrumb, PageFooter, PageLastUpdate, PageRoot, PageTOC, PageTOCItems, PageTOCPopover, PageTOCPopoverContent, PageTOCPopoverItems, PageTOCPopoverTrigger, PageTOCTitle, } from './layouts/docs/page.js';
8
+ export function DocsPage({ editOnGithub, breadcrumb: { enabled: breadcrumbEnabled = true, component: breadcrumb, ...breadcrumbProps } = {}, footer = {}, lastUpdate, container, full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, toc = [], article, children, }) {
16
9
  // disable TOC on full mode, you can still enable it with `enabled` option.
17
- tocEnabled ?? (tocEnabled = !full && isTocRequired);
10
+ tocEnabled ?? (tocEnabled = !full &&
11
+ (toc.length > 0 ||
12
+ tocOptions.footer !== undefined ||
13
+ tocOptions.header !== undefined));
18
14
  tocPopoverEnabled ?? (tocPopoverEnabled = toc.length > 0 ||
19
15
  tocPopoverOptions.header !== undefined ||
20
16
  tocPopoverOptions.footer !== undefined);
21
- return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs(PageBody, { ...props.container, className: cn(props.container?.className), style: {
22
- '--fd-tocnav-height': !tocPopoverEnabled ? '0px' : undefined,
23
- ...props.container?.style,
24
- }, children: [slot({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsxs(TocPopover, { className: "h-10", children: [_jsx(TocPopoverTrigger, { className: "w-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, _jsx(TOCScrollArea, { isMenu: true, children: tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })) }), tocPopoverOptions.footer] })] }), {
25
- items: toc,
26
- ...tocPopoverOptions,
27
- }), _jsxs(PageArticle, { ...props.article, className: cn(full || !tocEnabled ? 'max-w-[1120px]' : 'max-w-[860px]', props.article?.className), children: [slot(props.breadcrumb, _jsx(Breadcrumb, { ...props.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] }), slot(props.footer, _jsx(Footer, { items: props.footer?.items }))] })] }), slot({ enabled: tocEnabled, component: tocReplace }, _jsxs(Toc, { children: [tocOptions.header, _jsxs("h3", { className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), _jsx(TOCScrollArea, { children: tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })) }), tocOptions.footer] }), {
28
- items: toc,
29
- ...tocOptions,
30
- })] }));
17
+ return (_jsxs(PageRoot, { toc: tocEnabled || tocPopoverEnabled
18
+ ? {
19
+ toc,
20
+ single: tocOptions.single,
21
+ }
22
+ : false, ...container, children: [tocPopoverEnabled &&
23
+ (tocPopover ?? (_jsxs(PageTOCPopover, { children: [_jsx(PageTOCPopoverTrigger, {}), _jsxs(PageTOCPopoverContent, { children: [tocPopoverOptions.header, _jsx(PageTOCPopoverItems, { variant: tocPopoverOptions.style }), tocPopoverOptions.footer] })] }))), _jsxs(PageArticle, { ...article, children: [breadcrumbEnabled &&
24
+ (breadcrumb ?? _jsx(PageBreadcrumb, { ...breadcrumbProps })), children, _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [editOnGithub && (_jsx(EditOnGitHub, { href: `https://github.com/${editOnGithub.owner}/${editOnGithub.repo}/blob/${editOnGithub.sha}/${editOnGithub.path.startsWith('/') ? editOnGithub.path.slice(1) : editOnGithub.path}` })), lastUpdate && _jsx(PageLastUpdate, { date: new Date(lastUpdate) })] }), footer.enabled !== false &&
25
+ (footer.component ?? _jsx(PageFooter, { items: footer.items }))] }), tocEnabled &&
26
+ (tocReplace ?? (_jsxs(PageTOC, { children: [tocOptions.header, _jsx(PageTOCTitle, {}), _jsx(PageTOCItems, { variant: tocOptions.style }), tocOptions.footer] })))] }));
31
27
  }
32
- function EditOnGitHub({ owner, repo, sha, path, ...props }) {
33
- const href = `https://github.com/${owner}/${repo}/blob/${sha}/${path.startsWith('/') ? path.slice(1) : path}`;
34
- return (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
28
+ export function EditOnGitHub(props) {
29
+ return (_jsx("a", { target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
35
30
  color: 'secondary',
36
- className: 'gap-1.5 text-fd-muted-foreground',
37
- }), props.className), children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] }));
31
+ size: 'sm',
32
+ className: 'gap-1.5 not-prose',
33
+ }), props.className), children: props.children ?? (_jsxs(_Fragment, { children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] })) }));
38
34
  }
39
35
  /**
40
36
  * Add typography styles
41
37
  */
42
- export const DocsBody = forwardRef((props, ref) => (_jsx("div", { ref: ref, ...props, className: cn('prose', props.className), children: props.children })));
38
+ export const DocsBody = forwardRef((props, ref) => (_jsx("div", { ref: ref, ...props, className: cn('prose flex-1', props.className), children: props.children })));
43
39
  DocsBody.displayName = 'DocsBody';
44
40
  export const DocsDescription = forwardRef((props, ref) => {
45
41
  // don't render if no description provided
@@ -49,12 +45,12 @@ export const DocsDescription = forwardRef((props, ref) => {
49
45
  });
50
46
  DocsDescription.displayName = 'DocsDescription';
51
47
  export const DocsTitle = forwardRef((props, ref) => {
52
- return (_jsx("h1", { ref: ref, ...props, className: cn('text-3xl font-semibold', props.className), children: props.children }));
48
+ return (_jsx("h1", { ref: ref, ...props, className: cn('text-[1.75em] font-semibold', props.className), children: props.children }));
53
49
  });
54
50
  DocsTitle.displayName = 'DocsTitle';
55
51
  /**
56
52
  * For separate MDX page
57
53
  */
58
- export function withArticle({ children }) {
59
- return (_jsx("main", { className: "container py-12", children: _jsx("article", { className: "prose", children: children }) }));
54
+ export function withArticle(props) {
55
+ return (_jsx("main", { ...props, className: cn('container py-12', props.className), children: _jsx("article", { className: "prose", children: props.children }) }));
60
56
  }
@@ -4,7 +4,7 @@ import type { DefaultSearchDialogProps } from '../components/dialog/search-defau
4
4
  import { type SearchProviderProps } from '../contexts/search.js';
5
5
  import { type LocaleItem, type Translations } from '../contexts/i18n.js';
6
6
  interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'> {
7
- options?: Partial<DefaultSearchDialogProps> | SearchProviderProps['options'];
7
+ options?: Partial<DefaultSearchDialogProps>;
8
8
  /**
9
9
  * Enable search functionality
10
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/provider/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAGzB,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,EAA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