@fumadocs/base-ui 16.18.1 → 16.18.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 (86) hide show
  1. package/css/generated/docs.css +1 -1
  2. package/css/generated/flux.css +1 -1
  3. package/css/generated/glass.css +1 -1
  4. package/css/generated/notebook.css +1 -1
  5. package/css/generated/shared.css +1 -1
  6. package/css/generated/spacious.css +1 -1
  7. package/dist/_virtual/_rolldown/runtime.js +4 -4
  8. package/dist/components/accordion.js +1 -1
  9. package/dist/components/codeblock.js +2 -2
  10. package/dist/components/codeblock.rsc.js +1 -1
  11. package/dist/components/dialog/search-algolia.d.ts +1 -1
  12. package/dist/components/dialog/search-algolia.js +1 -1
  13. package/dist/components/dialog/search-default.d.ts +1 -1
  14. package/dist/components/dialog/search-orama.d.ts +1 -1
  15. package/dist/components/dialog/search-orama.js +1 -1
  16. package/dist/components/dynamic-codeblock.core.js +1 -1
  17. package/dist/components/image-zoom.js +3 -3
  18. package/dist/components/inline-toc.js +1 -1
  19. package/dist/components/sidebar/base.js +1 -1
  20. package/dist/components/sidebar/tabs/dropdown.js +2 -2
  21. package/dist/i18n.js +1 -1
  22. package/dist/layouts/docs/client.js +5 -4
  23. package/dist/layouts/docs/index.d.ts +1 -1
  24. package/dist/layouts/docs/page/index.js +1 -1
  25. package/dist/layouts/docs/page/slots/breadcrumb.js +1 -1
  26. package/dist/layouts/docs/page/slots/container.js +1 -1
  27. package/dist/layouts/docs/page/slots/toc.d.ts +6 -6
  28. package/dist/layouts/docs/page/slots/toc.js +2 -2
  29. package/dist/layouts/docs/slots/header.js +1 -1
  30. package/dist/layouts/docs/slots/sidebar.js +5 -5
  31. package/dist/layouts/flux/index.js +4 -4
  32. package/dist/layouts/flux/page/index.d.ts +1 -1
  33. package/dist/layouts/flux/page/index.js +2 -2
  34. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -1
  35. package/dist/layouts/flux/page/slots/toc.d.ts +5 -5
  36. package/dist/layouts/flux/page/slots/toc.js +3 -3
  37. package/dist/layouts/flux/slots/sidebar.js +2 -2
  38. package/dist/layouts/flux/slots/tab-dropdown.js +1 -1
  39. package/dist/layouts/glass/index.js +2 -2
  40. package/dist/layouts/glass/layout-tabs.js +2 -2
  41. package/dist/layouts/glass/page/index.d.ts +1 -1
  42. package/dist/layouts/glass/page/index.js +1 -1
  43. package/dist/layouts/glass/page/slots/breadcrumb.js +1 -1
  44. package/dist/layouts/glass/page/slots/toc.js +1 -1
  45. package/dist/layouts/glass/slots/header.js +1 -1
  46. package/dist/layouts/glass/slots/sidebar.js +4 -4
  47. package/dist/layouts/home/not-found.js +1 -1
  48. package/dist/layouts/home/slots/header.js +3 -3
  49. package/dist/layouts/notebook/client.d.ts +1 -1
  50. package/dist/layouts/notebook/client.js +5 -4
  51. package/dist/layouts/notebook/index.d.ts +1 -1
  52. package/dist/layouts/notebook/page/index.d.ts +1 -1
  53. package/dist/layouts/notebook/page/index.js +2 -2
  54. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -1
  55. package/dist/layouts/notebook/page/slots/container.js +1 -1
  56. package/dist/layouts/notebook/page/slots/toc.d.ts +6 -6
  57. package/dist/layouts/notebook/page/slots/toc.js +2 -2
  58. package/dist/layouts/notebook/slots/header.js +5 -5
  59. package/dist/layouts/notebook/slots/sidebar.js +4 -4
  60. package/dist/layouts/shared/client.d.ts +2 -2
  61. package/dist/layouts/shared/client.js +21 -4
  62. package/dist/layouts/shared/index.d.ts +8 -2
  63. package/dist/layouts/shared/index.js +3 -1
  64. package/dist/layouts/shared/page-actions.js +1 -1
  65. package/dist/layouts/shared/slots/language-select.js +2 -2
  66. package/dist/layouts/shared/slots/search-trigger.js +1 -1
  67. package/dist/layouts/spacious/index.js +3 -3
  68. package/dist/layouts/spacious/page/index.d.ts +1 -1
  69. package/dist/layouts/spacious/page/index.js +4 -4
  70. package/dist/layouts/spacious/page/slots/breadcrumb.js +1 -1
  71. package/dist/layouts/spacious/page/slots/toc.d.ts +5 -5
  72. package/dist/layouts/spacious/page/slots/toc.js +2 -2
  73. package/dist/layouts/spacious/slots/actions.js +1 -1
  74. package/dist/layouts/spacious/slots/header.js +2 -2
  75. package/dist/layouts/spacious/slots/sidebar.js +19 -11
  76. package/dist/mdx.d.ts +2 -2
  77. package/dist/mdx.js +1 -1
  78. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/index.d.ts +1 -1
  79. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +1 -1
  80. package/dist/page.js +3 -3
  81. package/dist/provider/base.d.ts +1 -1
  82. package/dist/provider/base.js +1 -1
  83. package/dist/style.css +40 -28
  84. package/package.json +15 -15
  85. /package/dist/.translations/{keys.js → keys.json.js} +0 -0
  86. /package/dist/components/{image-zoom2.css → image-zoom.css} +0 -0
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../../../utils/cn.js";
3
- import { useTabsGroups, useTreePath } from "../../../contexts/tree.js";
4
3
  import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
5
4
  import { isLayoutTabActive } from "../../shared/index.js";
5
+ import { useTabsGroups, useTreePath } from "../../../contexts/tree.js";
6
6
  import Link from "fumadocs-core/link";
7
7
  import { usePathname } from "fumadocs-core/framework";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { TreeContextProvider } from "../../contexts/tree.js";
3
- import { AIChatPanel, SkipToContent, baseSlots } from "../shared/client.js";
4
2
  import { getLayoutTabs, useLinkItems } from "../shared/index.js";
3
+ import { AIChatPanel, SkipToContent, baseSlots } from "../shared/client.js";
4
+ import { TreeContextProvider } from "../../contexts/tree.js";
5
5
  import { Sidebar, SidebarDrawer, SidebarProvider, drawerHandle, useSidebar } from "./slots/sidebar.js";
6
6
  import { Header } from "./slots/header.js";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
- import { cn } from "../../utils/cn.js";
2
- import { useTabsGroups, useTreePath } from "../../contexts/tree.js";
3
1
  import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
2
+ import { useTabsGroups, useTreePath } from "../../contexts/tree.js";
4
3
  import { isLayoutTabActive } from "../shared/index.js";
4
+ import { cn } from "../../utils/cn.js";
5
5
  import Link from "fumadocs-core/link";
6
6
  import { usePathname } from "fumadocs-core/framework";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
- import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
1
  import { TOCProps } from "./slots/toc.js";
2
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
3
3
  import { ComponentProps } from "react";
4
4
  import { TOCItemType } from "fumadocs-core/toc";
5
5
  export interface DocsPageProps extends ComponentProps<'article'> {
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { cn } from "../../../utils/cn.js";
3
3
  import { buttonVariants } from "../../../components/ui/button.js";
4
- import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
5
4
  import { Footer } from "./slots/footer.js";
6
5
  import { Breadcrumb } from "./slots/breadcrumb.js";
7
6
  import { TOC, TOCProvider } from "./slots/toc.js";
7
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { Edit } from "lucide-react";
10
10
  import { createContext, use, useEffect, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
2
  import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
3
+ import { cn } from "../../../../utils/cn.js";
4
4
  import Link from "fumadocs-core/link";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { ChevronRight } from "lucide-react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
2
  import { TOCProvider as TOCProvider$1, TOCScrollArea, useTOCItems } from "../../../../components/toc/index.js";
3
+ import { cn } from "../../../../utils/cn.js";
4
4
  import { useGlassLayout } from "../../index.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Text } from "lucide-react";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../../../utils/cn.js";
3
3
  import { buttonVariants } from "../../../components/ui/button.js";
4
- import { LayoutTabsDropdown } from "../layout-tabs.js";
5
4
  import { useGlassLayout } from "../index.js";
5
+ import { LayoutTabsDropdown } from "../layout-tabs.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { ChevronsUpDown, LanguagesIcon, MessageCircleIcon, SidebarIcon } from "lucide-react";
8
8
  import { useTranslations } from "@fuma-translate/react";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
2
+ import { isLinkItemActive } from "../../shared/index.js";
4
3
  import { useTreeContext, useTreePath } from "../../../contexts/tree.js";
5
4
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
5
+ import { cn } from "../../../utils/cn.js";
6
6
  import { useHotKey } from "../../../utils/hotkey.js";
7
- import { isLinkItemActive } from "../../shared/index.js";
8
- import { LayoutTabsDropdown } from "../layout-tabs.js";
7
+ import { buttonVariants } from "../../../components/ui/button.js";
9
8
  import { useGlassLayout } from "../index.js";
9
+ import { LayoutTabsDropdown } from "../layout-tabs.js";
10
10
  import Link from "fumadocs-core/link";
11
11
  import { usePathname } from "fumadocs-core/framework";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cn } from "../../utils/cn.js";
3
2
  import { buttonVariants } from "../../components/ui/button.js";
3
+ import { cn } from "../../utils/cn.js";
4
4
  import Link from "fumadocs-core/link";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { HomeIcon } from "lucide-react";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
- import { mergeRefs } from "../../../utils/merge-refs.js";
5
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
6
3
  import { LinkItem } from "../../shared/client.js";
4
+ import { buttonVariants } from "../../../components/ui/button.js";
7
5
  import { useIsScrollTop } from "../../../utils/use-is-scroll-top.js";
8
6
  import { useHomeLayout } from "../index.js";
7
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
8
+ import { mergeRefs } from "../../../utils/merge-refs.js";
9
9
  import Link from "fumadocs-core/link";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { ChevronDown, Languages } from "lucide-react";
@@ -1,7 +1,7 @@
1
1
  import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
2
+ import { DocsLayoutProps } from "./index.js";
2
3
  import { LayoutTab, LinkItemType } from "../shared/index.js";
3
4
  import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
4
- import { DocsLayoutProps } from "./index.js";
5
5
  import { ComponentProps, FC } from "react";
6
6
  export interface DocsSlots extends BaseSlots {
7
7
  container: FC<ComponentProps<'div'>>;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { TreeContextProvider } from "../../contexts/tree.js";
3
- import { AIChatPanel, SkipToContent, baseSlots } from "../shared/client.js";
4
- import { useLinkItems } from "../shared/index.js";
5
2
  import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
3
+ import { useLinkItems } from "../shared/index.js";
4
+ import { AIChatPanel, AIChatTrigger, SkipToContent, baseSlots } from "../shared/client.js";
5
+ import { TreeContextProvider } from "../../contexts/tree.js";
6
6
  import { Container } from "./slots/container.js";
7
7
  import { Sidebar, SidebarCollapseTrigger, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
8
8
  import { Header } from "./slots/header.js";
@@ -66,7 +66,8 @@ function LayoutBody(props) {
66
66
  open: aiChat.open,
67
67
  className: "[grid-area:toc] justify-self-end xl:sticky xl:max-w-full xl:top-(--fd-docs-row-3) xl:h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] xl:border-s",
68
68
  children: aiChat.panel
69
- })
69
+ }),
70
+ aiChat?.trigger && /* @__PURE__ */ jsx(AIChatTrigger, { ...aiChat })
70
71
  ]
71
72
  })
72
73
  })
@@ -1,5 +1,5 @@
1
- import { AIChatOptions, BaseLayoutProps, GetLayoutTabsOptions, LayoutTab, NavOptions } from "../shared/index.js";
2
1
  import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
2
+ import { AIChatOptions, BaseLayoutProps, GetLayoutTabsOptions, LayoutTab, NavOptions } from "../shared/index.js";
3
3
  import { DocsSlots, useNotebookLayout } from "./client.js";
4
4
  import { HTMLAttributes } from "react";
5
5
  import * as PageTree from "fumadocs-core/page-tree";
@@ -1,7 +1,7 @@
1
- import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
1
  import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
3
2
  import { Footer, FooterProps } from "./slots/footer.js";
4
3
  import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
4
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
5
5
  import { ComponentProps, FC, ReactNode } from "react";
6
6
  import { TOCItemType } from "fumadocs-core/toc";
7
7
  export interface DocsPageProps extends ComponentProps<'article'> {
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
3
3
  import { cn } from "../../../utils/cn.js";
4
- import { buttonVariants } from "../../../components/ui/button.js";
5
- import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
6
4
  import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
7
5
  import { Footer } from "./slots/footer.js";
8
6
  import { Breadcrumb } from "./slots/breadcrumb.js";
9
7
  import { Container } from "./slots/container.js";
8
+ import { buttonVariants } from "../../../components/ui/button.js";
9
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { Edit } from "lucide-react";
12
12
  import { createContext, use, useEffect, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
2
  import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
3
+ import { cn } from "../../../../utils/cn.js";
4
4
  import Link from "fumadocs-core/link";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { ChevronRight } from "lucide-react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
2
  import { useDocsPage } from "../index.js";
3
+ import { cn } from "../../../../utils/cn.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  // src/layouts/notebook/page/slots/container.tsx
6
6
  function Container(props) {
@@ -1,6 +1,6 @@
1
1
  import { TOCItemsProps } from "../../../../components/toc/default.js";
2
- import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/block.js";
3
- import { TOCItemsProps as TOCItemsProps$2 } from "../../../../components/toc/clerk.js";
2
+ import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/clerk.js";
3
+ import { TOCItemsProps as TOCItemsProps$2 } from "../../../../components/toc/block.js";
4
4
  import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
5
5
  import { ComponentProps, ReactNode } from "react";
6
6
  export type TOCProviderProps = TOCProviderProps$1;
@@ -20,10 +20,10 @@ export type TOCProps = {
20
20
  list?: TOCItemsProps;
21
21
  } | {
22
22
  style: 'clerk';
23
- list?: TOCItemsProps$2;
23
+ list?: TOCItemsProps$1;
24
24
  } | {
25
25
  style: 'block';
26
- list?: TOCItemsProps$1;
26
+ list?: TOCItemsProps$2;
27
27
  });
28
28
  export declare function TOC({ container, header, footer, style, list }: TOCProps): import("react").JSX.Element;
29
29
  export type TOCPopoverProps = {
@@ -43,9 +43,9 @@ export type TOCPopoverProps = {
43
43
  list?: TOCItemsProps;
44
44
  } | {
45
45
  style: 'clerk';
46
- list?: TOCItemsProps$2;
46
+ list?: TOCItemsProps$1;
47
47
  } | {
48
48
  style: 'block';
49
- list?: TOCItemsProps$1;
49
+ list?: TOCItemsProps$2;
50
50
  });
51
51
  export declare function TOCPopover({ container, trigger, content, header, footer, style, list }: TOCPopoverProps): import("react").JSX.Element;
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
- import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
4
2
  import { default_exports } from "../../../../components/toc/default.js";
5
3
  import { clerk_exports } from "../../../../components/toc/clerk.js";
6
4
  import { block_exports } from "../../../../components/toc/block.js";
5
+ import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
6
+ import { cn } from "../../../../utils/cn.js";
7
7
  import { useTreePath } from "../../../../contexts/tree.js";
8
8
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
9
9
  import { useNotebookLayout } from "../../client.js";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
2
  import { buttonVariants } from "../../../components/ui/button.js";
4
- import { useTabsGroups, useTreePath } from "../../../contexts/tree.js";
5
- import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
6
- import { LinkItem } from "../../shared/client.js";
3
+ import { cn } from "../../../utils/cn.js";
7
4
  import { isLayoutTabActive } from "../../shared/index.js";
8
- import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
9
5
  import { useNotebookLayout } from "../client.js";
6
+ import { LinkItem } from "../../shared/client.js";
7
+ import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
8
+ import { useTabsGroups, useTreePath } from "../../../contexts/tree.js";
9
+ import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
10
10
  import Link from "fumadocs-core/link";
11
11
  import { usePathname } from "fumadocs-core/framework";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,13 +1,13 @@
1
1
  "use client";
2
+ import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
2
3
  import { cn } from "../../../utils/cn.js";
4
+ import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
5
+ import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
3
6
  import { buttonVariants } from "../../../components/ui/button.js";
4
7
  import { mergeRefs } from "../../../utils/merge-refs.js";
5
8
  import { LinkItem } from "../../shared/client.js";
6
- import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
7
- import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
8
- import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
9
- import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
10
9
  import { useNotebookLayout } from "../client.js";
10
+ import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { Languages, SidebarIcon, X } from "lucide-react";
13
13
  import { cva } from "class-variance-authority";
@@ -1,8 +1,8 @@
1
+ import { BaseLayoutProps, LinkItemType } from "./index.js";
1
2
  import { LanguageSelectProps, LanguageSelectTextProps } from "./slots/language-select.js";
2
3
  import { FullSearchTriggerProps, SearchTriggerProps } from "./slots/search-trigger.js";
3
4
  import { ThemeSwitchProps } from "./slots/theme-switch.js";
4
- import { BaseLayoutProps, LinkItemType } from "./index.js";
5
- import { ComponentProps, FC, ReactNode } from "react";
5
+ import { ComponentProps, FC } from "react";
6
6
  export declare function LinkItem({ ref, item, ...props }: Omit<ComponentProps<'a'>, 'href'> & {
7
7
  item: Extract<LinkItemType, {
8
8
  url: string;
@@ -1,13 +1,15 @@
1
1
  "use client";
2
- import { cn } from "../../utils/cn.js";
3
2
  import { useI18n } from "../../contexts/i18n.js";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { buttonVariants } from "../../components/ui/button.js";
5
+ import { isLinkItemActive } from "./index.js";
4
6
  import { LanguageSelect, LanguageSelectText } from "./slots/language-select.js";
5
7
  import { FullSearchTrigger, SearchTrigger } from "./slots/search-trigger.js";
6
8
  import { ThemeSwitch } from "./slots/theme-switch.js";
7
- import { isLinkItemActive } from "./index.js";
8
9
  import Link from "fumadocs-core/link";
9
10
  import { usePathname } from "fumadocs-core/framework";
10
- import { jsx } from "react/jsx-runtime";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { MessageCircleIcon } from "lucide-react";
11
13
  import { useState } from "react";
12
14
  import { useTranslations } from "@fuma-translate/react";
13
15
  // src/layouts/shared/client.tsx
@@ -37,6 +39,21 @@ function AIChatPanel({ open, className, children }) {
37
39
  })
38
40
  });
39
41
  }
42
+ /** a floating button toggling the chat, for layouts without one of their own */
43
+ function AIChatTrigger({ open, onOpenChange }) {
44
+ const t = useTranslations({ note: "AI chat button" });
45
+ return /* @__PURE__ */ jsxs("button", {
46
+ type: "button",
47
+ "aria-expanded": open,
48
+ className: cn(buttonVariants({ variant: "secondary" }), "fixed inset-e-[calc(--spacing(4)+var(--removed-body-scroll-bar-size,0px))] bottom-4 z-20 gap-2 rounded-2xl text-fd-muted-foreground shadow-lg transition-[translate,opacity] motion-reduce:transition-none", open && "translate-y-10 opacity-0"),
49
+ inert: open,
50
+ onClick: () => onOpenChange(!open),
51
+ children: [/* @__PURE__ */ jsx(MessageCircleIcon, {
52
+ "aria-hidden": true,
53
+ className: "size-4.5"
54
+ }), t("Ask AI")]
55
+ });
56
+ }
40
57
  function baseSlots({ useProps }) {
41
58
  function InlineThemeSwitch(props) {
42
59
  const { themeSwitch } = useProps();
@@ -106,4 +123,4 @@ function SkipToContent() {
106
123
  children: t("Skip to Content")
107
124
  });
108
125
  }
109
- export { AIChatPanel, LinkItem, SkipToContent, baseSlots };
126
+ export { AIChatPanel, AIChatTrigger, LinkItem, SkipToContent, baseSlots };
@@ -1,6 +1,6 @@
1
- import { FullSearchTriggerProps, SearchTriggerProps } from "./slots/search-trigger.js";
2
- import { ThemeSwitchProps } from "./slots/theme-switch.js";
3
1
  import { BaseSlots, BaseSlotsProps, LinkItem, baseSlots } from "./client.js";
2
+ import { ThemeSwitchProps } from "./slots/theme-switch.js";
3
+ import { FullSearchTriggerProps, SearchTriggerProps } from "./slots/search-trigger.js";
4
4
  import { ComponentProps, FC, ReactNode } from "react";
5
5
  import * as PageTree from "fumadocs-core/page-tree";
6
6
  import { I18nConfig } from "fumadocs-core/i18n";
@@ -65,6 +65,12 @@ export interface AIChatOptions {
65
65
  * The chat panel, placed beside the page on wide viewports, and floating over it on smaller ones.
66
66
  */
67
67
  panel?: ReactNode;
68
+ /**
69
+ * Render a floating Ask AI button, for layouts without one of their own (Docs and Notebook)
70
+ *
71
+ * @defaultValue false
72
+ */
73
+ trigger?: boolean;
68
74
  }
69
75
  export interface LayoutTab {
70
76
  /**
@@ -2,6 +2,7 @@ import { isActive, normalize } from "../../utils/urls.js";
2
2
  import { LinkItem, baseSlots } from "./client.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { useMemo } from "react";
5
+ import * as PageTree from "fumadocs-core/page-tree";
5
6
  // src/layouts/shared/index.tsx
6
7
  const defaultTransform = (option, node) => {
7
8
  if (!node.icon) return option;
@@ -17,7 +18,8 @@ function getLayoutTabs(tree, { transform = defaultTransform } = {}) {
17
18
  const results = [];
18
19
  function next(node, unlisted) {
19
20
  if ("root" in node && node.root) {
20
- const url = node.index?.url ?? node.children.find((node) => node.type === "page")?.url;
21
+ const page = node.index ?? node.children.find((node) => node.type === "page") ?? PageTree.findPath(node.children, (node) => node.type === "page")?.at(-1);
22
+ const url = page?.type === "page" ? page.url : void 0;
21
23
  if (url) {
22
24
  const option = {
23
25
  title: node.name,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import { buttonVariants } from "../../components/ui/button.js";
4
3
  import { useCopyButton } from "../../utils/use-copy-button.js";
5
4
  import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
5
+ import { buttonVariants } from "../../components/ui/button.js";
6
6
  import { usePathname } from "fumadocs-core/framework";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Check, ChevronDown, Copy, ExternalLinkIcon, TextIcon } from "lucide-react";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
2
  import { useI18n } from "../../../contexts/i18n.js";
5
3
  import { Popover, PopoverClose, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
4
+ import { cn } from "../../../utils/cn.js";
5
+ import { buttonVariants } from "../../../components/ui/button.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useTranslations } from "@fuma-translate/react";
8
8
  // src/layouts/shared/slots/language-select.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
+ import { useSearchContext } from "../../../contexts/search.js";
2
3
  import { cn } from "../../../utils/cn.js";
3
4
  import { buttonVariants } from "../../../components/ui/button.js";
4
- import { useSearchContext } from "../../../contexts/search.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Search } from "lucide-react";
7
7
  import { useTranslations } from "@fuma-translate/react";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { cn } from "../../utils/cn.js";
3
- import { TreeContextProvider } from "../../contexts/tree.js";
4
- import { AIChatPanel, SkipToContent, baseSlots } from "../shared/client.js";
5
2
  import { getLayoutTabs, useLinkItems } from "../shared/index.js";
3
+ import { TreeContextProvider } from "../../contexts/tree.js";
6
4
  import { Sidebar, SidebarDrawer, SidebarProvider } from "./slots/sidebar.js";
7
5
  import { Header } from "./slots/header.js";
6
+ import { AIChatPanel, SkipToContent, baseSlots } from "../shared/client.js";
7
+ import { cn } from "../../utils/cn.js";
8
8
  import { HeaderActions } from "./slots/actions.js";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { createContext, use, useMemo } from "react";
@@ -1,7 +1,7 @@
1
- import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
1
  import { TOCDropdownProps, TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
3
2
  import { Footer, FooterProps } from "./slots/footer.js";
4
3
  import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
4
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
5
5
  import { ComponentProps, FC } from "react";
6
6
  import { TOCItemType } from "fumadocs-core/toc";
7
7
  interface DocsPageSlots {
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
2
  import { SidebarCollapseTrigger, useSidebar } from "../../../components/sidebar/base.js";
5
- import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
6
- import { useSpaciousLayout } from "../index.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { cn } from "../../../utils/cn.js";
7
5
  import { TOC, TOCDropdown, TOCPopover, TOCProvider } from "./slots/toc.js";
8
6
  import { Footer } from "./slots/footer.js";
9
7
  import { Breadcrumb, useBreadcrumbItems } from "./slots/breadcrumb.js";
8
+ import { useSpaciousLayout } from "../index.js";
9
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
10
10
  import { usePathname } from "fumadocs-core/framework";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { EditIcon, SidebarIcon } from "lucide-react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
2
  import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
3
+ import { cn } from "../../../../utils/cn.js";
4
4
  import Link from "fumadocs-core/link";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Fragment as Fragment$1, useMemo } from "react";
@@ -1,19 +1,19 @@
1
- import { TOCItemsProps } from "../../../../components/toc/default.js";
2
- import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/block.js";
3
- import { TOCItemsProps as TOCItemsProps$2 } from "../../../../components/toc/clerk.js";
4
1
  import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
2
+ import { TOCItemsProps } from "../../../../components/toc/default.js";
3
+ import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/clerk.js";
4
+ import { TOCItemsProps as TOCItemsProps$2 } from "../../../../components/toc/block.js";
5
5
  import { ComponentProps, ReactNode } from "react";
6
6
  export type TOCProviderProps = TOCProviderProps$1;
7
7
  export declare function TOCProvider(props: TOCProviderProps): import("react").JSX.Element;
8
8
  type TOCStyle = {
9
9
  style?: 'block';
10
- list?: TOCItemsProps$1;
10
+ list?: TOCItemsProps$2;
11
11
  } | {
12
12
  style: 'normal';
13
13
  list?: TOCItemsProps;
14
14
  } | {
15
15
  style: 'clerk';
16
- list?: TOCItemsProps$2;
16
+ list?: TOCItemsProps$1;
17
17
  };
18
18
  type TOCContent = {
19
19
  /**
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { cn } from "../../../../utils/cn.js";
2
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
3
3
  import { TOCProvider as TOCProvider$1, TOCScrollArea, useTOCItems } from "../../../../components/toc/index.js";
4
4
  import { default_exports } from "../../../../components/toc/default.js";
5
5
  import { clerk_exports } from "../../../../components/toc/clerk.js";
6
6
  import { block_exports } from "../../../../components/toc/block.js";
7
+ import { cn } from "../../../../utils/cn.js";
7
8
  import { useTreePath } from "../../../../contexts/tree.js";
8
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
9
9
  import { useSpaciousLayout } from "../../index.js";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { ChevronDownIcon, TextIcon } from "lucide-react";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
2
  import { buttonVariants } from "../../../components/ui/button.js";
4
3
  import { useI18n } from "../../../contexts/i18n.js";
5
4
  import { LinkItem } from "../../shared/client.js";
5
+ import { cn } from "../../../utils/cn.js";
6
6
  import { useSpaciousLayout } from "../index.js";
7
7
  import Link from "fumadocs-core/link";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
2
  import { SidebarTrigger } from "../../../components/sidebar/base.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { cn } from "../../../utils/cn.js";
5
5
  import { useSpaciousLayout } from "../index.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { SidebarIcon } from "lucide-react";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
- import { useTabsGroups, useTreePath } from "../../../contexts/tree.js";
5
- import { LinkItem } from "../../shared/client.js";
6
- import { isLayoutTabActive } from "../../shared/index.js";
7
2
  import { SidebarCollapseTrigger, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger, useFolderDepth, useSidebar } from "../../../components/sidebar/base.js";
8
3
  import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
9
4
  import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
5
+ import { LinkItem } from "../../shared/client.js";
6
+ import { buttonVariants } from "../../../components/ui/button.js";
7
+ import { useTabsGroups, useTreePath } from "../../../contexts/tree.js";
8
+ import { isLayoutTabActive } from "../../shared/index.js";
9
+ import { cn } from "../../../utils/cn.js";
10
10
  import { useSpaciousLayout } from "../index.js";
11
11
  import Link from "fumadocs-core/link";
12
12
  import { usePathname } from "fumadocs-core/framework";
@@ -54,7 +54,7 @@ function Sidebar({ className, ...props }) {
54
54
  }),
55
55
  /* @__PURE__ */ jsxs("div", {
56
56
  className: "flex flex-col gap-2 px-3 empty:hidden",
57
- children: [/* @__PURE__ */ jsx(TabsMenu, {}), slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
57
+ children: [/* @__PURE__ */ jsx(TabsMenus, {}), slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
58
58
  hideIfDisabled: true,
59
59
  className: "h-10 gap-3 rounded-xl ps-[calc(--spacing(2.5)-1px)] pe-2 [&_svg]:shrink-0"
60
60
  })]
@@ -101,7 +101,7 @@ function SidebarDrawer() {
101
101
  }),
102
102
  /* @__PURE__ */ jsxs("div", {
103
103
  className: "flex flex-col gap-2 px-3 empty:hidden",
104
- children: [/* @__PURE__ */ jsx(TabsMenu, {}), aiChat && /* @__PURE__ */ jsxs("button", {
104
+ children: [/* @__PURE__ */ jsx(TabsMenus, {}), aiChat && /* @__PURE__ */ jsxs("button", {
105
105
  type: "button",
106
106
  className: cn(itemVariants(), "hover:bg-fd-accent/60"),
107
107
  onClick: () => {
@@ -115,16 +115,24 @@ function SidebarDrawer() {
115
115
  ]
116
116
  })] });
117
117
  }
118
- function TabsMenu() {
118
+ /** the sections, then the root folders of a type within them (`root: 'version'`), as one control */
119
+ function TabsMenus() {
119
120
  const { props: { tabs } } = useSpaciousLayout();
121
+ const groups = useTabsGroups(tabs);
122
+ const start = Math.max(0, groups.findLastIndex((group) => typeof group.active?.root !== "string"));
123
+ if (start >= groups.length) return;
124
+ return /* @__PURE__ */ jsx("div", {
125
+ className: "flex flex-col rounded-xl border bg-fd-secondary/50 divide-y overflow-clip",
126
+ children: groups.map((group, i) => i >= start && /* @__PURE__ */ jsx(TabsMenu, { options: group.options }, i))
127
+ });
128
+ }
129
+ function TabsMenu({ options }) {
120
130
  const t = useTranslations();
121
131
  const pathname = usePathname();
122
132
  const path = useTreePath();
123
- const options = useTabsGroups(tabs).findLast((group) => typeof group.active?.root !== "string")?.options ?? [];
124
133
  const selected = options.findLast((tab) => isLayoutTabActive(tab, path, pathname));
125
- if (options.length === 0) return;
126
134
  return /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsxs(Menu.Trigger, {
127
- className: "flex w-full h-10 items-center gap-3 rounded-xl border bg-fd-secondary/50 ps-[calc(--spacing(2.5)-1px)] pe-2.5 text-start font-medium outline-none transition-colors hover:bg-fd-accent focus-visible:ring-2 focus-visible:ring-fd-ring data-popup-open:bg-fd-accent [&_svg]:size-4 [&_svg]:shrink-0",
135
+ className: "flex w-full h-10 items-center gap-3 ps-[calc(--spacing(2.5)-1px)] pe-2.5 text-start font-medium outline-none transition-colors hover:bg-fd-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring data-popup-open:bg-fd-accent [&_svg]:size-4 [&_svg]:shrink-0",
128
136
  children: [
129
137
  selected && /* @__PURE__ */ jsx(TabIcon, { tab: selected }),
130
138
  /* @__PURE__ */ jsx("span", {