fumadocs-ui 11.3.1 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/{chunk-24NYFO7H.js → chunk-2KMKNVSN.js} +2 -4
  2. package/dist/{chunk-C4PI62MH.js → chunk-34Z7WODD.js} +6 -8
  3. package/dist/{chunk-GDRBCN6Q.js → chunk-3F57TIUQ.js} +21 -7
  4. package/dist/{chunk-PXDQVGII.js → chunk-7EMVRXMS.js} +10 -1
  5. package/dist/{chunk-7F2LGCS6.js → chunk-AN2Y6MA2.js} +2 -4
  6. package/dist/{chunk-PW7TBOIJ.js → chunk-CRYPD6UZ.js} +2 -1
  7. package/dist/{chunk-UKE65HV3.js → chunk-IOHAG6BY.js} +1 -1
  8. package/dist/chunk-JQW5DMD2.js +226 -0
  9. package/dist/{chunk-WNKY4RA5.js → chunk-UBVEKNRF.js} +1 -1
  10. package/dist/{chunk-E2VA3Y4S.js → chunk-XXVXIK4M.js} +2 -3
  11. package/dist/components/accordion.js +2 -2
  12. package/dist/components/api.js +5 -8
  13. package/dist/components/callout.js +1 -1
  14. package/dist/components/card.js +1 -1
  15. package/dist/components/codeblock.js +3 -3
  16. package/dist/components/dialog/search-algolia.js +4 -3
  17. package/dist/components/dialog/search-default.js +4 -3
  18. package/dist/components/dialog/search.js +4 -3
  19. package/dist/components/files.js +1 -1
  20. package/dist/components/heading.js +2 -2
  21. package/dist/components/image-zoom.js +4 -6
  22. package/dist/components/inline-toc.js +1 -1
  23. package/dist/components/layout/language-toggle.d.ts +6 -0
  24. package/dist/components/layout/language-toggle.js +58 -0
  25. package/dist/components/layout/root-toggle.d.ts +16 -0
  26. package/dist/components/layout/root-toggle.js +60 -0
  27. package/dist/components/roll-button.js +2 -3
  28. package/dist/components/steps.js +1 -1
  29. package/dist/components/tabs.js +6 -11
  30. package/dist/components/type-table.js +2 -2
  31. package/dist/docs.client.d.ts +13 -0
  32. package/dist/docs.client.js +396 -0
  33. package/dist/{i18n-p5QWhj_3.d.ts → i18n-CE8z-AAs.d.ts} +1 -0
  34. package/dist/i18n.d.ts +3 -6
  35. package/dist/i18n.js +5 -104
  36. package/dist/{layout-vxXAvjoq.d.ts → layout.client-Duq0TTke.d.ts} +23 -15
  37. package/dist/layout.client.d.ts +2 -8
  38. package/dist/layout.client.js +39 -571
  39. package/dist/layout.d.ts +1 -1
  40. package/dist/layout.js +42 -28
  41. package/dist/mdx.client.js +3 -3
  42. package/dist/mdx.js +4 -4
  43. package/dist/page.client.js +7 -8
  44. package/dist/page.js +19 -10
  45. package/dist/provider.d.ts +12 -13
  46. package/dist/provider.js +10 -11
  47. package/dist/style.css +1 -1
  48. package/dist/tailwind-plugin.cjs +34 -43
  49. package/dist/tailwind-plugin.js +35 -44
  50. package/dist/twoslash/popup.js +8 -14
  51. package/dist/twoslash.css +1 -1
  52. package/package.json +4 -5
  53. /package/dist/{chunk-6C3VEZWH.js → chunk-MLKGABMK.js} +0 -0
  54. /package/dist/{tree-cqNEopxM.d.ts → tree-CrKzI9Nz.d.ts} +0 -0
package/dist/i18n.js CHANGED
@@ -2,111 +2,13 @@
2
2
  import {
3
3
  I18nContext,
4
4
  useI18n
5
- } from "./chunk-PW7TBOIJ.js";
6
- import {
7
- twMerge
8
- } from "./chunk-TK3TM3MR.js";
9
- import "./chunk-6C3VEZWH.js";
5
+ } from "./chunk-CRYPD6UZ.js";
6
+ import "./chunk-MLKGABMK.js";
10
7
 
11
8
  // src/i18n.tsx
12
9
  import { useCallback } from "react";
13
10
  import { useRouter, usePathname } from "next/navigation";
14
-
15
- // src/components/ui/select.tsx
16
- import * as SelectPrimitive from "@radix-ui/react-select";
17
- import { Check, ChevronDown } from "lucide-react";
18
- import * as React from "react";
19
- import { jsx, jsxs } from "react/jsx-runtime";
20
- var Select = SelectPrimitive.Root;
21
- var SelectValue = SelectPrimitive.Value;
22
- var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
23
- SelectPrimitive.Trigger,
24
- {
25
- ref,
26
- className: twMerge(
27
- "flex h-10 w-full items-center justify-between rounded-lg border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground",
28
- className
29
- ),
30
- ...props,
31
- children: [
32
- children,
33
- /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 opacity-50" }) })
34
- ]
35
- }
36
- ));
37
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
38
- var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
39
- SelectPrimitive.Content,
40
- {
41
- ref,
42
- className: twMerge(
43
- "relative z-50 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-popover-out data-[state=open]:animate-popover-in",
44
- className
45
- ),
46
- position,
47
- ...props,
48
- children: /* @__PURE__ */ jsx(
49
- SelectPrimitive.Viewport,
50
- {
51
- className: twMerge(
52
- "p-1",
53
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
54
- ),
55
- children
56
- }
57
- )
58
- }
59
- ) }));
60
- SelectContent.displayName = SelectPrimitive.Content.displayName;
61
- var SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
62
- SelectPrimitive.Label,
63
- {
64
- ref,
65
- className: twMerge("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
66
- ...props
67
- }
68
- ));
69
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
70
- var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
71
- SelectPrimitive.Item,
72
- {
73
- ref,
74
- className: twMerge(
75
- "relative flex w-full select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
76
- className
77
- ),
78
- ...props,
79
- children: [
80
- /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4" }) }) }),
81
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
82
- ]
83
- }
84
- ));
85
- SelectItem.displayName = SelectPrimitive.Item.displayName;
86
- var SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
87
- SelectPrimitive.Separator,
88
- {
89
- ref,
90
- className: twMerge("-mx-1 my-1 h-px bg-muted", className),
91
- ...props
92
- }
93
- ));
94
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
95
-
96
- // src/i18n.tsx
97
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
98
- function LanguageSelect({
99
- ...props
100
- }) {
101
- const context = useI18n();
102
- if (!context.translations)
103
- throw new Error("Missing prop `translations`");
104
- const languages = Object.entries(context.translations);
105
- return /* @__PURE__ */ jsxs2(Select, { value: context.locale, onValueChange: context.onChange, ...props, children: [
106
- /* @__PURE__ */ jsx2(SelectTrigger, { children: /* @__PURE__ */ jsx2(SelectValue, { placeholder: context.text.chooseLanguage }) }),
107
- /* @__PURE__ */ jsx2(SelectContent, { children: languages.map(([lang, { name }]) => /* @__PURE__ */ jsx2(SelectItem, { value: lang, children: name }, lang)) })
108
- ] });
109
- }
11
+ import { jsx } from "react/jsx-runtime";
110
12
  function I18nProvider({
111
13
  translations = {},
112
14
  locale: forceLocale,
@@ -125,7 +27,7 @@ function I18nProvider({
125
27
  },
126
28
  [segments, router]
127
29
  );
128
- return /* @__PURE__ */ jsx2(
30
+ return /* @__PURE__ */ jsx(
129
31
  I18nContext.Provider,
130
32
  {
131
33
  value: {
@@ -142,6 +44,5 @@ function I18nProvider({
142
44
  );
143
45
  }
144
46
  export {
145
- I18nProvider,
146
- LanguageSelect
47
+ I18nProvider
147
48
  };
@@ -1,5 +1,5 @@
1
- import { PageTree } from 'fumadocs-core/server';
2
1
  import { ReactNode, HTMLAttributes } from 'react';
2
+ import { PageTree } from 'fumadocs-core/server';
3
3
 
4
4
  interface NavProps {
5
5
  title?: ReactNode;
@@ -8,8 +8,6 @@ interface NavProps {
8
8
  * @defaultValue '/'
9
9
  */
10
10
  url?: string;
11
- items: LinkItemType[];
12
- enableSidebar: boolean;
13
11
  /**
14
12
  * Show/hide search toggle
15
13
  *
@@ -23,7 +21,9 @@ interface NavProps {
23
21
  transparentMode?: 'always' | 'top' | 'none';
24
22
  children?: ReactNode;
25
23
  }
26
- declare function Nav({ title, url, items, transparentMode, enableSidebar, enableSearch, children, }: NavProps): React.ReactElement;
24
+ declare function Nav({ title, url, items, transparentMode, enableSearch, children, }: NavProps & {
25
+ items: LinkItemType[];
26
+ }): React.ReactElement;
27
27
 
28
28
  interface SidebarProps {
29
29
  items: LinkItemType[];
@@ -36,7 +36,9 @@ interface SidebarProps {
36
36
  defaultOpenLevel?: number;
37
37
  components?: Partial<Components>;
38
38
  banner?: React.ReactNode;
39
+ bannerProps?: HTMLAttributes<HTMLDivElement>;
39
40
  footer?: React.ReactNode;
41
+ footerProps?: HTMLAttributes<HTMLDivElement>;
40
42
  }
41
43
  interface Components {
42
44
  Item: React.FC<{
@@ -50,8 +52,8 @@ interface Components {
50
52
  item: PageTree.Separator;
51
53
  }>;
52
54
  }
53
- declare function Sidebar({ footer, components, defaultOpenLevel, banner, items, ...props }: SidebarProps & {
54
- className?: string;
55
+ declare function Sidebar({ footer, components, defaultOpenLevel, banner, items, aside, bannerProps, footerProps, }: SidebarProps & {
56
+ aside?: HTMLAttributes<HTMLElement> & Record<string, unknown>;
55
57
  }): React.ReactElement;
56
58
 
57
59
  type ActiveType = 'none' | 'url' | 'nested-url';
@@ -85,13 +87,9 @@ type LinkItemType = {
85
87
  text: string;
86
88
  external?: boolean;
87
89
  };
88
- interface NavOptions extends Omit<NavProps, 'enableSidebar' | 'collapsibleSidebar' | 'items'> {
90
+ interface NavOptions extends Omit<NavProps, 'items'> {
89
91
  enabled: boolean;
90
92
  component: ReactNode;
91
- /**
92
- * GitHub url displayed on the navbar
93
- */
94
- githubUrl: string;
95
93
  }
96
94
  interface SidebarOptions extends Omit<SidebarProps, 'items'> {
97
95
  enabled: boolean;
@@ -99,19 +97,29 @@ interface SidebarOptions extends Omit<SidebarProps, 'items'> {
99
97
  collapsible: boolean;
100
98
  }
101
99
  interface BaseLayoutProps {
100
+ /**
101
+ * GitHub url
102
+ */
103
+ githubUrl?: string;
102
104
  links?: LinkItemType[];
103
105
  /**
104
106
  * Replace or disable navbar
105
107
  */
106
108
  nav?: Partial<NavOptions>;
107
- children: ReactNode;
109
+ children?: ReactNode;
108
110
  }
109
111
  interface DocsLayoutProps extends BaseLayoutProps {
110
112
  tree: PageTree.Root;
111
113
  sidebar?: Partial<SidebarOptions>;
112
114
  containerProps?: HTMLAttributes<HTMLDivElement>;
115
+ /**
116
+ * Enable Language Switch
117
+ *
118
+ * @defaultValue false
119
+ */
120
+ i18n?: boolean;
113
121
  }
114
- declare function Layout({ nav, links, children, }: BaseLayoutProps): React.ReactElement;
115
- declare function DocsLayout({ nav, sidebar, links, containerProps, tree, children, }: DocsLayoutProps): React.ReactElement;
122
+ declare function Layout({ nav, links, githubUrl, children, }: BaseLayoutProps): React.ReactElement;
123
+ declare function DocsLayout({ nav, githubUrl, sidebar, links, containerProps, tree, i18n, children, }: DocsLayoutProps): React.ReactElement;
116
124
 
117
- export { type BaseLayoutProps as B, type DocsLayoutProps as D, type LinkItemType as L, Nav as N, type SidebarProps as S, Sidebar as a, Layout as b, DocsLayout as c };
125
+ export { type BaseLayoutProps as B, type DocsLayoutProps as D, type LinkItemType as L, type NavProps as N, type SidebarProps as S, Sidebar as a, Layout as b, DocsLayout as c, Nav as d };
@@ -1,9 +1,3 @@
1
- export { T as TreeContextProvider } from './tree-cqNEopxM.js';
2
- import { S as SidebarProps } from './layout-vxXAvjoq.js';
3
- export { N as Nav, a as Sidebar } from './layout-vxXAvjoq.js';
4
- import 'fumadocs-core/server';
1
+ export { d as Nav } from './layout.client-Duq0TTke.js';
5
2
  import 'react';
6
-
7
- declare function DynamicSidebar(props: SidebarProps): React.ReactElement;
8
-
9
- export { DynamicSidebar };
3
+ import 'fumadocs-core/server';