@fumadocs/base-ui 16.7.1 → 16.7.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 (75) hide show
  1. package/css/generated/docs.css +5 -9
  2. package/css/generated/flux.css +3 -6
  3. package/css/generated/home.css +28 -14
  4. package/css/generated/notebook.css +5 -5
  5. package/css/generated/shared.css +63 -10
  6. package/dist/components/sidebar/base.js +1 -2
  7. package/dist/components/tabs.d.ts +9 -4
  8. package/dist/components/tabs.js +12 -13
  9. package/dist/components/toc/clerk.js +65 -29
  10. package/dist/components/toc/default.js +5 -3
  11. package/dist/components/toc/index.d.ts +4 -2
  12. package/dist/components/toc/index.js +46 -19
  13. package/dist/components/ui/collapsible.js +1 -1
  14. package/dist/components/ui/navigation-menu.d.ts +24 -12
  15. package/dist/components/ui/navigation-menu.js +47 -32
  16. package/dist/components/ui/popover.d.ts +7 -1
  17. package/dist/components/ui/popover.js +13 -13
  18. package/dist/components/ui/scroll-area.d.ts +15 -4
  19. package/dist/components/ui/scroll-area.js +26 -27
  20. package/dist/layouts/docs/client.d.ts +3 -3
  21. package/dist/layouts/docs/client.js +19 -22
  22. package/dist/layouts/docs/index.d.ts +1 -1
  23. package/dist/layouts/docs/page/index.d.ts +91 -3
  24. package/dist/layouts/docs/page/index.js +67 -7
  25. package/dist/layouts/docs/page/slots/breadcrumb.js +1 -0
  26. package/dist/layouts/docs/page/slots/container.js +2 -1
  27. package/dist/layouts/docs/page/slots/footer.js +1 -0
  28. package/dist/layouts/docs/page/slots/toc.js +3 -3
  29. package/dist/layouts/docs/slots/container.js +1 -0
  30. package/dist/layouts/docs/slots/header.js +1 -0
  31. package/dist/layouts/docs/slots/sidebar.js +9 -19
  32. package/dist/layouts/flux/index.d.ts +4 -4
  33. package/dist/layouts/flux/index.js +8 -11
  34. package/dist/layouts/flux/page/index.d.ts +79 -3
  35. package/dist/layouts/flux/page/index.js +61 -7
  36. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
  37. package/dist/layouts/flux/page/slots/container.js +2 -1
  38. package/dist/layouts/flux/page/slots/footer.js +1 -0
  39. package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
  40. package/dist/layouts/flux/page/slots/toc.js +6 -5
  41. package/dist/layouts/flux/slots/container.js +1 -0
  42. package/dist/layouts/flux/slots/sidebar.js +8 -13
  43. package/dist/layouts/home/index.d.ts +3 -3
  44. package/dist/layouts/home/index.js +11 -8
  45. package/dist/layouts/home/navbar.d.ts +2 -4
  46. package/dist/layouts/home/navbar.js +6 -9
  47. package/dist/layouts/home/slots/container.js +1 -0
  48. package/dist/layouts/home/slots/header.d.ts +2 -3
  49. package/dist/layouts/home/slots/header.js +125 -115
  50. package/dist/layouts/notebook/client.d.ts +3 -3
  51. package/dist/layouts/notebook/client.js +14 -17
  52. package/dist/layouts/notebook/index.d.ts +1 -1
  53. package/dist/layouts/notebook/page/index.d.ts +91 -3
  54. package/dist/layouts/notebook/page/index.js +67 -7
  55. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
  56. package/dist/layouts/notebook/page/slots/container.js +2 -1
  57. package/dist/layouts/notebook/page/slots/footer.js +1 -0
  58. package/dist/layouts/notebook/page/slots/toc.js +3 -3
  59. package/dist/layouts/notebook/slots/container.js +1 -0
  60. package/dist/layouts/notebook/slots/sidebar.js +9 -19
  61. package/dist/layouts/shared/client.d.ts +6 -6
  62. package/dist/layouts/shared/client.js +4 -4
  63. package/dist/layouts/shared/index.d.ts +3 -3
  64. package/dist/layouts/shared/page-actions.d.ts +2 -2
  65. package/dist/layouts/shared/page-actions.js +3 -3
  66. package/dist/page.d.ts +1 -2
  67. package/dist/page.js +1 -2
  68. package/dist/style.css +302 -60
  69. package/package.json +3 -3
  70. package/dist/layouts/docs/page/client.d.ts +0 -98
  71. package/dist/layouts/docs/page/client.js +0 -110
  72. package/dist/layouts/flux/page/client.d.ts +0 -82
  73. package/dist/layouts/flux/page/client.js +0 -94
  74. package/dist/layouts/notebook/page/client.d.ts +0 -98
  75. package/dist/layouts/notebook/page/client.js +0 -110
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
3
  import { cn } from "../../utils/cn.js";
3
4
  import { mergeRefs } from "../../utils/merge-refs.js";
4
5
  import { createContext, use, useEffect, useEffectEvent, useRef } from "react";
@@ -6,6 +7,14 @@ import { jsx } from "react/jsx-runtime";
6
7
  import * as Primitive from "fumadocs-core/toc";
7
8
  import { useOnChange } from "fumadocs-core/utils/use-on-change";
8
9
  //#region src/components/toc/index.tsx
10
+ var toc_exports = /* @__PURE__ */ __exportAll({
11
+ TOCProvider: () => TOCProvider,
12
+ TOCScrollArea: () => TOCScrollArea,
13
+ TocThumb: () => TocThumb,
14
+ useActiveAnchor: () => useActiveAnchor,
15
+ useActiveAnchors: () => useActiveAnchors,
16
+ useTOCItems: () => useTOCItems
17
+ });
9
18
  const TOCContext = createContext([]);
10
19
  function useTOCItems() {
11
20
  return use(TOCContext);
@@ -33,17 +42,46 @@ function TOCScrollArea({ ref, className, ...props }) {
33
42
  })
34
43
  });
35
44
  }
36
- function TocThumb({ containerRef, ...props }) {
45
+ function TocThumb({ containerRef, align = "end", ...props }) {
37
46
  const thumbRef = useRef(null);
38
47
  const active = useActiveAnchors();
39
48
  function update(info) {
40
49
  const element = thumbRef.current;
41
- if (!element) return;
42
- element.style.setProperty("--fd-top", `${info[0]}px`);
43
- element.style.setProperty("--fd-height", `${info[1]}px`);
50
+ const container = containerRef.current;
51
+ if (!element || !container) return;
52
+ element.style.setProperty("--fd-top", `${info.top}px`);
53
+ element.style.setProperty("--fd-height", `${info.height}px`);
54
+ }
55
+ function calc(active) {
56
+ const container = containerRef.current;
57
+ if (!container || container.clientHeight === 0) return null;
58
+ if (active.length === 0) return {
59
+ height: 0,
60
+ top: 0
61
+ };
62
+ let upper = Number.MAX_VALUE;
63
+ let lower = 0;
64
+ for (const item of active) {
65
+ const element = container.querySelector(`a[href="#${item}"]`);
66
+ if (!element) continue;
67
+ if (align === "center") {
68
+ const y = element.offsetTop + element.clientHeight / 2;
69
+ upper = Math.min(upper, y);
70
+ lower = Math.max(lower, y);
71
+ } else {
72
+ const styles = getComputedStyle(element);
73
+ upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
74
+ lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
75
+ }
76
+ }
77
+ return {
78
+ top: upper,
79
+ height: lower - upper
80
+ };
44
81
  }
45
82
  const onPrint = useEffectEvent(() => {
46
- if (containerRef.current) update(calc(containerRef.current, active));
83
+ const result = calc(active);
84
+ if (result) update(result);
47
85
  });
48
86
  useEffect(() => {
49
87
  if (!containerRef.current) return;
@@ -55,7 +93,8 @@ function TocThumb({ containerRef, ...props }) {
55
93
  };
56
94
  }, [containerRef]);
57
95
  useOnChange(active, () => {
58
- if (containerRef.current) update(calc(containerRef.current, active));
96
+ const result = calc(active);
97
+ if (result) update(result);
59
98
  });
60
99
  return /* @__PURE__ */ jsx("div", {
61
100
  ref: thumbRef,
@@ -63,17 +102,5 @@ function TocThumb({ containerRef, ...props }) {
63
102
  ...props
64
103
  });
65
104
  }
66
- function calc(container, active) {
67
- if (active.length === 0 || container.clientHeight === 0) return [0, 0];
68
- let upper = Number.MAX_VALUE, lower = 0;
69
- for (const item of active) {
70
- const element = container.querySelector(`a[href="#${item}"]`);
71
- if (!element) continue;
72
- const styles = getComputedStyle(element);
73
- upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
74
- lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
75
- }
76
- return [upper, lower - upper];
77
- }
78
105
  //#endregion
79
- export { TOCProvider, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useTOCItems };
106
+ export { TOCProvider, TOCScrollArea, TocThumb, toc_exports, useActiveAnchor, useActiveAnchors, useTOCItems };
@@ -8,7 +8,7 @@ const CollapsibleTrigger = Collapsible$1.Trigger;
8
8
  function CollapsibleContent({ children, className, ...props }) {
9
9
  return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
10
10
  ...props,
11
- className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height] data-[starting-style]:h-0 data-[ending-style]:h-0", typeof className === "function" ? className(s) : className),
11
+ className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height,opacity] data-starting-style:opacity-0 data-starting-style:h-0 data-ending-style:h-0 data-ending-style:opacity-0", typeof className === "function" ? className(s) : className),
12
12
  children
13
13
  });
14
14
  }
@@ -1,18 +1,30 @@
1
1
  import * as React$1 from "react";
2
- import { NavigationMenu } from "@base-ui/react/navigation-menu";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
3
4
  import * as _base_ui_react0 from "@base-ui/react";
4
5
 
5
6
  //#region src/components/ui/navigation-menu.d.ts
6
- type NavigationMenuContentProps = NavigationMenu.Content.Props;
7
- type NavigationMenuTriggerProps = NavigationMenu.Trigger.Props;
8
- declare const NavigationMenuRoot: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.NavigationMenuRootProps, "ref"> & React$1.RefAttributes<HTMLElement>>;
7
+ type NavigationMenuContentProps = NavigationMenu$1.Content.Props;
8
+ type NavigationMenuTriggerProps = NavigationMenu$1.Trigger.Props;
9
+ declare const NavigationMenu: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.NavigationMenuRootProps, "ref"> & React$1.RefAttributes<HTMLElement>>;
9
10
  declare const NavigationMenuList: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.NavigationMenuListProps, "ref"> & React$1.RefAttributes<HTMLUListElement>>;
10
- declare const NavigationMenuItem: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuItemProps, "ref"> & React$1.RefAttributes<HTMLLIElement>, "ref"> & React$1.RefAttributes<HTMLLIElement>>;
11
- declare const NavigationMenuTrigger: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuTriggerProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
12
- declare const NavigationMenuContent: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuContentProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
13
- declare const NavigationMenuLink: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuLinkProps, "ref"> & React$1.RefAttributes<HTMLAnchorElement>, "ref"> & {
14
- asChild?: boolean;
15
- } & React$1.RefAttributes<HTMLAnchorElement>>;
16
- declare function NavigationMenuViewport(): null;
11
+ declare function NavigationMenuItem({
12
+ className,
13
+ children,
14
+ ...props
15
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Item>): react_jsx_runtime0.JSX.Element;
16
+ declare function NavigationMenuTrigger({
17
+ children,
18
+ ...props
19
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Trigger>): react_jsx_runtime0.JSX.Element;
20
+ declare function NavigationMenuContent({
21
+ className,
22
+ ...props
23
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Content>): react_jsx_runtime0.JSX.Element;
24
+ declare function NavigationMenuLink({
25
+ children,
26
+ ...props
27
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Link>): react_jsx_runtime0.JSX.Element;
28
+ declare function NavigationMenuViewport(props: NavigationMenu$1.Positioner.Props): react_jsx_runtime0.JSX.Element;
17
29
  //#endregion
18
- export { NavigationMenuRoot as NavigationMenu, NavigationMenuRoot, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport };
30
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport };
@@ -1,41 +1,56 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import * as React$1 from "react";
3
+ import "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { NavigationMenu } from "@base-ui/react/navigation-menu";
5
+ import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
6
6
  //#region src/components/ui/navigation-menu.tsx
7
- const NavigationMenuRoot = NavigationMenu.Root;
8
- const NavigationMenuList = NavigationMenu.List;
9
- const NavigationMenuItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(NavigationMenu.Item, {
10
- ref,
11
- className: (s) => cn("list-none", typeof className === "function" ? className(s) : className),
12
- ...props,
13
- children
14
- }));
15
- NavigationMenuItem.displayName = NavigationMenu.Item.displayName;
16
- const NavigationMenuTrigger = React$1.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx(NavigationMenu.Trigger, {
17
- ref,
18
- ...props,
19
- children
20
- }));
21
- NavigationMenuTrigger.displayName = NavigationMenu.Trigger.displayName;
22
- const NavigationMenuContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(NavigationMenu.Content, {
23
- ref,
24
- className: (s) => cn("size-full p-4", "transition-[opacity,transform,translate] duration-(--duration) ease-(--easing)", "data-starting-style:opacity-0 data-ending-style:opacity-0", "data-starting-style:data-[activation-direction=left]:-translate-x-1/2", "data-starting-style:data-[activation-direction=right]:translate-x-1/2", "data-ending-style:data-[activation-direction=left]:translate-x-1/2", "data-ending-style:data-[activation-direction=right]:-translate-x-1/2", typeof className === "function" ? className(s) : className),
25
- ...props
26
- }));
27
- NavigationMenuContent.displayName = NavigationMenu.Content.displayName;
28
- const NavigationMenuLink = React$1.forwardRef(({ asChild, children, ...props }, ref) => {
29
- if (asChild) return children;
30
- return /* @__PURE__ */ jsx(NavigationMenu.Link, {
31
- ref,
7
+ const NavigationMenu = NavigationMenu$1.Root;
8
+ const NavigationMenuList = NavigationMenu$1.List;
9
+ function NavigationMenuItem({ className, children, ...props }) {
10
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Item, {
11
+ className: (s) => cn("list-none", typeof className === "function" ? className(s) : className),
32
12
  ...props,
33
13
  children
34
14
  });
35
- });
36
- NavigationMenuLink.displayName = NavigationMenu.Link.displayName;
37
- function NavigationMenuViewport() {
38
- return null;
15
+ }
16
+ function NavigationMenuTrigger({ children, ...props }) {
17
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Trigger, {
18
+ ...props,
19
+ children
20
+ });
21
+ }
22
+ function NavigationMenuContent({ className, ...props }) {
23
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Content, {
24
+ className: (s) => cn("size-full p-3", "transition-[opacity,transform,translate] duration-(--duration) ease-(--easing)", "data-starting-style:opacity-0 data-ending-style:opacity-0", "data-starting-style:data-[activation-direction=left]:-translate-x-1/2", "data-starting-style:data-[activation-direction=right]:translate-x-1/2", "data-ending-style:data-[activation-direction=left]:translate-x-1/2", "data-ending-style:data-[activation-direction=right]:-translate-x-1/2", typeof className === "function" ? className(s) : className),
25
+ ...props
26
+ });
27
+ }
28
+ function NavigationMenuLink({ children, ...props }) {
29
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Link, {
30
+ ...props,
31
+ children
32
+ });
33
+ }
34
+ function NavigationMenuViewport(props) {
35
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Portal, { children: /* @__PURE__ */ jsx(NavigationMenu$1.Positioner, {
36
+ collisionPadding: {
37
+ top: 5,
38
+ bottom: 5,
39
+ left: 20,
40
+ right: 20
41
+ },
42
+ ...props,
43
+ className: (s) => cn("box-border h-(--positioner-height) w-(--anchor-width) max-w-(--available-width) duration-(--duration) ease-(--easing) before:absolute before:content-[''] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 data-[side=bottom]:before:h-2.5 data-[side=left]:before:top-0 data-[side=left]:before:right-[-10px] data-[side=left]:before:bottom-0 data-[side=left]:before:w-2.5 data-[side=right]:before:top-0 data-[side=right]:before:bottom-0 data-[side=right]:before:left-[-10px] data-[side=right]:before:w-2.5 data-[side=top]:before:right-0 data-[side=top]:before:bottom-[-10px] data-[side=top]:before:left-0 data-[side=top]:before:h-2.5", typeof props.className === "function" ? props.className(s) : props.className),
44
+ style: {
45
+ ["--duration"]: "0.35s",
46
+ ["--easing"]: "cubic-bezier(0.22, 1, 0.36, 1)",
47
+ ...props.style
48
+ },
49
+ children: /* @__PURE__ */ jsx(NavigationMenu$1.Popup, {
50
+ className: "data-[ending-style]:easing-[ease] relative border h-(--popup-height) origin-(--transform-origin) rounded-xl bg-fd-popover/80 text-fd-popover-foreground backdrop-blur-md shadow-lg transition-[opacity,transform,width,height,scale,translate] duration-(--duration) ease-(--easing) data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150 data-starting-style:scale-90 data-starting-style:opacity-0 w-(--popup-width)",
51
+ children: /* @__PURE__ */ jsx(NavigationMenu$1.Viewport, { className: "relative size-full overflow-hidden" })
52
+ })
53
+ }) });
39
54
  }
40
55
  //#endregion
41
- export { NavigationMenuRoot as NavigationMenu, NavigationMenuRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport };
56
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport };
@@ -1,11 +1,17 @@
1
1
  import * as React$1 from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
3
  import { Popover as Popover$1 } from "@base-ui/react/popover";
3
4
  import * as _base_ui_react0 from "@base-ui/react";
4
5
 
5
6
  //#region src/components/ui/popover.d.ts
6
7
  declare const Popover: typeof Popover$1.Root;
7
8
  declare const PopoverTrigger: Popover$1.Trigger;
8
- declare const PopoverContent: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.PopoverPopupProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & Pick<_base_ui_react0.PopoverPositionerProps, "sideOffset" | "align"> & React$1.RefAttributes<HTMLDivElement>>;
9
+ declare function PopoverContent({
10
+ className,
11
+ align,
12
+ sideOffset,
13
+ ...props
14
+ }: React$1.ComponentPropsWithRef<typeof Popover$1.Popup> & Pick<Popover$1.Positioner.Props, 'sideOffset' | 'align'>): react_jsx_runtime0.JSX.Element;
9
15
  declare const PopoverClose: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.PopoverCloseProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
10
16
  //#endregion
11
17
  export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -1,23 +1,23 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import * as React$1 from "react";
3
+ import "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { Popover as Popover$1 } from "@base-ui/react/popover";
6
6
  //#region src/components/ui/popover.tsx
7
7
  const Popover = Popover$1.Root;
8
8
  const PopoverTrigger = Popover$1.Trigger;
9
- const PopoverContent = React$1.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
10
- align,
11
- side: "bottom",
12
- sideOffset,
13
- className: "z-50",
14
- children: /* @__PURE__ */ jsx(Popover$1.Popup, {
15
- ref,
16
- className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
17
- ...props
18
- })
19
- }) }));
20
- PopoverContent.displayName = Popover$1.Popup.displayName;
9
+ function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
10
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
11
+ align,
12
+ side: "bottom",
13
+ sideOffset,
14
+ className: "z-50",
15
+ children: /* @__PURE__ */ jsx(Popover$1.Popup, {
16
+ className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
17
+ ...props
18
+ })
19
+ }) });
20
+ }
21
21
  const PopoverClose = Popover$1.Close;
22
22
  //#endregion
23
23
  export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -1,11 +1,22 @@
1
1
  import * as React$1 from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
3
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
3
- import * as _base_ui_react0 from "@base-ui/react";
4
4
 
5
5
  //#region src/components/ui/scroll-area.d.ts
6
- declare const ScrollArea: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ScrollAreaRootProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
7
- declare const ScrollViewport: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ScrollAreaViewportProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
8
- declare const ScrollBar: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ScrollAreaScrollbarProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
6
+ declare function ScrollArea({
7
+ children,
8
+ ...props
9
+ }: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Root>): react_jsx_runtime0.JSX.Element;
10
+ declare function ScrollViewport({
11
+ className,
12
+ children,
13
+ ...props
14
+ }: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Viewport>): react_jsx_runtime0.JSX.Element;
15
+ declare function ScrollBar({
16
+ className,
17
+ orientation,
18
+ ...props
19
+ }: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Scrollbar>): react_jsx_runtime0.JSX.Element;
9
20
  type ScrollAreaProps = ScrollArea$1.Root.Props;
10
21
  //#endregion
11
22
  export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollViewport };
@@ -1,33 +1,32 @@
1
1
  import { cn } from "../../utils/cn.js";
2
- import * as React$1 from "react";
2
+ import "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
5
5
  //#region src/components/ui/scroll-area.tsx
6
- const ScrollArea = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
7
- ref,
8
- className: (s) => cn("overflow-hidden", typeof className === "function" ? className(s) : className),
9
- ...props,
10
- children: [
11
- children,
12
- /* @__PURE__ */ jsx(ScrollArea$1.Corner, {}),
13
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
14
- ]
15
- }));
16
- ScrollArea.displayName = ScrollArea$1.Root.displayName;
17
- const ScrollViewport = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
18
- ref,
19
- className: (s) => cn("size-full rounded-[inherit]", typeof className === "function" ? className(s) : className),
20
- ...props,
21
- children
22
- }));
23
- ScrollViewport.displayName = ScrollArea$1.Viewport.displayName;
24
- const ScrollBar = React$1.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
25
- ref,
26
- orientation,
27
- className: (s) => cn("flex select-none transition-opacity", !s.hovering && "opacity-0", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", typeof className === "function" ? className(s) : className),
28
- ...props,
29
- children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "relative flex-1 rounded-full bg-fd-border" })
30
- }));
31
- ScrollBar.displayName = ScrollArea$1.Scrollbar.displayName;
6
+ function ScrollArea({ children, ...props }) {
7
+ return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
8
+ ...props,
9
+ children: [
10
+ children,
11
+ /* @__PURE__ */ jsx(ScrollArea$1.Corner, {}),
12
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
13
+ ]
14
+ });
15
+ }
16
+ function ScrollViewport({ className, children, ...props }) {
17
+ return /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
18
+ className: (s) => cn("size-full rounded-[inherit]", typeof className === "function" ? className(s) : className),
19
+ ...props,
20
+ children
21
+ });
22
+ }
23
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
24
+ return /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
25
+ orientation,
26
+ className: (s) => cn("flex select-none transition-opacity", !s.hovering && "opacity-0", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", typeof className === "function" ? className(s) : className),
27
+ ...props,
28
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "relative flex-1 rounded-full bg-fd-border" })
29
+ });
30
+ }
32
31
  //#endregion
33
32
  export { ScrollArea, ScrollBar, ScrollViewport };
@@ -5,8 +5,9 @@ import { DocsLayoutProps } from "./index.js";
5
5
  import { ComponentProps, FC } from "react";
6
6
  //#region src/layouts/docs/client.d.ts
7
7
  interface DocsSlots extends BaseSlots {
8
- container?: FC<ComponentProps<'div'>>;
9
- sidebar?: {
8
+ container: FC<ComponentProps<'div'>>;
9
+ header: FC<ComponentProps<'header'>>;
10
+ sidebar: {
10
11
  provider: FC<SidebarProviderProps>;
11
12
  root: FC<SidebarProps>;
12
13
  trigger: FC<ComponentProps<'button'>>;
@@ -16,7 +17,6 @@ interface DocsSlots extends BaseSlots {
16
17
  setOpen: (v: boolean) => void;
17
18
  };
18
19
  };
19
- header?: FC<ComponentProps<'header'>>;
20
20
  }
21
21
  interface SlotsProps extends BaseSlotsProps<DocsLayoutProps> {
22
22
  tabs: LayoutTab[];
@@ -9,7 +9,7 @@ import { Header } from "./slots/header.js";
9
9
  import { Container } from "./slots/container.js";
10
10
  import { createContext, use, useMemo } from "react";
11
11
  import { usePathname } from "fumadocs-core/framework";
12
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
13
  import Link from "fumadocs-core/link";
14
14
  //#region src/layouts/docs/client.tsx
15
15
  const { useProvider } = baseSlots({ useProps() {
@@ -25,14 +25,14 @@ function useDocsLayout() {
25
25
  return context;
26
26
  }
27
27
  function LayoutBody(props) {
28
- const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabs, tabMode = "auto", tree, containerProps, children } = props;
28
+ const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { enabled: sidebarEnabled = true, defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabs, tabMode = "auto", tree, containerProps, children } = props;
29
29
  const isTop = useIsScrollTop({ enabled: navTransparentMode === "top" }) ?? true;
30
30
  const isNavTransparent = navTransparentMode === "top" ? isTop : navTransparentMode === "always";
31
31
  const { baseSlots, baseProps } = useProvider(props);
32
32
  const linkItems = useLinkItems(props);
33
33
  const slots = {
34
34
  ...baseSlots,
35
- header: navEnabled ? defaultSlots?.header ?? Header : void 0,
35
+ header: defaultSlots?.header ?? Header,
36
36
  container: defaultSlots?.container ?? Container,
37
37
  sidebar: defaultSlots?.sidebar ?? {
38
38
  provider: SidebarProvider,
@@ -41,24 +41,6 @@ function LayoutBody(props) {
41
41
  useSidebar
42
42
  }
43
43
  };
44
- let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
45
- slots.header && /* @__PURE__ */ jsx(slots.header, {}),
46
- slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
47
- tabMode === "top" && tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabs, {
48
- tabs,
49
- className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"
50
- }),
51
- children
52
- ] });
53
- if (slots.container) content = /* @__PURE__ */ jsx(slots.container, {
54
- ...containerProps,
55
- children: content
56
- });
57
- if (slots.sidebar) content = /* @__PURE__ */ jsx(slots.sidebar.provider, {
58
- defaultOpenLevel,
59
- prefetch,
60
- children: content
61
- });
62
44
  return /* @__PURE__ */ jsx(TreeContextProvider, {
63
45
  tree,
64
46
  children: /* @__PURE__ */ jsx(LayoutContext, {
@@ -72,7 +54,22 @@ function LayoutBody(props) {
72
54
  slots,
73
55
  ...linkItems
74
56
  },
75
- children: content
57
+ children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
58
+ defaultOpenLevel,
59
+ prefetch,
60
+ children: /* @__PURE__ */ jsxs(slots.container, {
61
+ ...containerProps,
62
+ children: [
63
+ navEnabled && /* @__PURE__ */ jsx(slots.header, {}),
64
+ sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
65
+ tabMode === "top" && tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabs, {
66
+ tabs,
67
+ className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"
68
+ }),
69
+ children
70
+ ]
71
+ })
72
+ })
76
73
  })
77
74
  });
78
75
  }
@@ -12,7 +12,7 @@ interface DocsLayoutProps extends BaseLayoutProps {
12
12
  tabMode?: 'top' | 'auto';
13
13
  tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
14
14
  containerProps?: HTMLAttributes<HTMLDivElement>;
15
- slots?: DocsSlots;
15
+ slots?: Partial<DocsSlots>;
16
16
  }
17
17
  interface SidebarOptions extends SidebarProps, SidebarProviderProps {
18
18
  enabled?: boolean;
@@ -1,11 +1,93 @@
1
+ import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
1
2
  import { Footer, FooterProps } from "./slots/footer.js";
2
3
  import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
3
- import { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage } from "./client.js";
4
4
  import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
5
- import { ComponentProps } from "react";
5
+ import { ComponentProps, FC, ReactNode } from "react";
6
6
  import * as react_jsx_runtime0 from "react/jsx-runtime";
7
+ import { TOCItemType } from "fumadocs-core/toc";
7
8
 
8
9
  //#region src/layouts/docs/page/index.d.ts
10
+ interface DocsPageProps extends ComponentProps<'article'> {
11
+ toc?: TOCItemType[];
12
+ /**
13
+ * Extend the page to fill all available space
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ full?: boolean;
18
+ slots?: Partial<DocsPageSlots>;
19
+ footer?: FooterOptions;
20
+ breadcrumb?: BreadcrumbOptions;
21
+ tableOfContent?: TableOfContentOptions;
22
+ tableOfContentPopover?: TableOfContentPopoverOptions;
23
+ }
24
+ interface BreadcrumbOptions extends BreadcrumbProps {
25
+ enabled?: boolean;
26
+ /**
27
+ * @deprecated use `slots.breadcrumb` instead.
28
+ */
29
+ component?: ReactNode;
30
+ }
31
+ interface FooterOptions extends FooterProps {
32
+ enabled?: boolean;
33
+ /**
34
+ * @deprecated use `slots.footer` instead.
35
+ */
36
+ component?: ReactNode;
37
+ }
38
+ interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
39
+ enabled?: boolean;
40
+ /**
41
+ * @deprecated use `slots.toc` instead.
42
+ */
43
+ component?: ReactNode;
44
+ }
45
+ interface TableOfContentPopoverOptions extends TOCPopoverProps {
46
+ enabled?: boolean;
47
+ /**
48
+ * @deprecated use `slots.tocPopover` instead.
49
+ */
50
+ component?: ReactNode;
51
+ }
52
+ interface DocsPageSlots {
53
+ toc: {
54
+ provider: FC<TOCProviderProps>;
55
+ main: FC<TOCProps>;
56
+ popover: FC<TOCPopoverProps>;
57
+ };
58
+ container: FC<ComponentProps<'article'>>;
59
+ footer: FC<FooterProps>;
60
+ breadcrumb: FC<BreadcrumbProps>;
61
+ }
62
+ type PageSlotsProps = Pick<DocsPageProps, 'full'>;
63
+ declare function useDocsPage(): {
64
+ props: PageSlotsProps;
65
+ slots: DocsPageSlots;
66
+ };
67
+ declare function DocsPage({
68
+ tableOfContent: {
69
+ enabled: tocEnabled,
70
+ single,
71
+ ...tocProps
72
+ },
73
+ tableOfContentPopover: {
74
+ enabled: tocPopoverEnabled,
75
+ ...tocPopoverProps
76
+ },
77
+ breadcrumb: {
78
+ enabled: breadcrumbEnabled,
79
+ ...breadcrumb
80
+ },
81
+ footer: {
82
+ enabled: footerEnabled,
83
+ ...footer
84
+ },
85
+ full,
86
+ toc,
87
+ slots: defaultSlots,
88
+ children,
89
+ ...containerProps
90
+ }: DocsPageProps): react_jsx_runtime0.JSX.Element;
9
91
  declare function EditOnGitHub(props: ComponentProps<'a'>): react_jsx_runtime0.JSX.Element;
10
92
  /**
11
93
  * Add typography styles
@@ -25,5 +107,11 @@ declare function DocsTitle({
25
107
  className,
26
108
  ...props
27
109
  }: ComponentProps<'h1'>): react_jsx_runtime0.JSX.Element;
110
+ declare function PageLastUpdate({
111
+ date: value,
112
+ ...props
113
+ }: Omit<ComponentProps<'p'>, 'children'> & {
114
+ date: Date;
115
+ }): react_jsx_runtime0.JSX.Element;
28
116
  //#endregion
29
- export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, type DocsPageProps, type DocsPageSlots, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
117
+ export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };