import { BaseSlots, BaseSlotsProps, LinkItem, baseSlots } from "./client.js"; import { ThemeSwitchProps } from "./slots/theme-switch.js"; import { FullSearchTriggerProps, SearchTriggerProps } from "./slots/search-trigger.js"; import { ComponentProps, FC, ReactNode } from "react"; import * as PageTree from "fumadocs-core/page-tree"; import { I18nConfig } from "fumadocs-core/i18n"; export interface NavOptions { enabled?: boolean; children?: ReactNode; title?: ReactNode | FC>; /** * Redirect url of title * @defaultValue '/' */ url?: string; /** * Use transparent background * * @defaultValue none */ transparentMode?: 'always' | 'top' | 'none'; /** * @deprecated use `slots.header` instead. */ component?: ReactNode; } export interface BaseLayoutProps { /** * GitHub url */ githubUrl?: string; links?: LinkItemType[]; /** * navigation config */ nav?: NavOptions; slots?: Partial; children?: ReactNode; themeSwitch?: ThemeSwitchOptions; searchToggle?: SearchToggleOptions; /** * @deprecated this is now optional for i18n setups, you can still customize language switch from `slots`. */ i18n?: boolean | I18nConfig; } interface SearchToggleOptions { enabled?: boolean; sm?: SearchTriggerProps; full?: FullSearchTriggerProps; /** @deprecated use `slots.searchTrigger` instead */ components?: { sm?: ReactNode; lg?: ReactNode; }; } interface ThemeSwitchOptions extends ThemeSwitchProps { enabled?: boolean; /** @deprecated use `slots.themeSwitch` instead */ component?: ReactNode; } export interface AIChatOptions { open: boolean; onOpenChange: (open: boolean) => void; /** * The chat panel, placed beside the page on wide viewports, and floating over it on smaller ones. */ panel?: ReactNode; /** * Render a floating Ask AI button, for layouts without one of their own (Docs and Notebook) * * @defaultValue false */ trigger?: boolean; } export interface LayoutTab { /** * Redirect URL of the folder, usually the index page */ url: string; icon?: ReactNode; title: ReactNode; description?: ReactNode; unlisted?: boolean; props?: ComponentProps<'a'>; /** * bind to a page tree node. */ $folder?: PageTree.Folder; /** * Detect from a list of urls (when not binded to page tree). */ urls?: Set; } export interface GetLayoutTabsOptions { transform?: (option: LayoutTab, node: PageTree.Folder) => LayoutTab | null; } export declare function getLayoutTabs(tree: PageTree.Root, { transform }?: GetLayoutTabsOptions): LayoutTab[]; export declare function isLayoutTabActive(tab: LayoutTab, pathname: string): boolean; interface Filterable { /** * Restrict where the item is displayed * * @defaultValue 'all' */ on?: 'menu' | 'nav' | 'all'; } interface WithHref { url: string; /** * When the item is marked as active * * @defaultValue 'url' */ active?: 'url' | 'nested-url' | 'none'; external?: boolean; } export interface MainItemType extends WithHref, Filterable { type?: 'main'; icon?: ReactNode; text: ReactNode; description?: ReactNode; } export interface IconItemType extends WithHref, Filterable { type: 'icon'; /** * `aria-label` of icon button */ label?: string; icon: ReactNode; text: ReactNode; /** * @defaultValue true */ secondary?: boolean; } export interface ButtonItemType extends WithHref, Filterable { type: 'button'; icon?: ReactNode; text: ReactNode; /** * @defaultValue false */ secondary?: boolean; } export interface MenuItemType extends Partial, Filterable { type: 'menu'; icon?: ReactNode; text: ReactNode; items: ((MainItemType & { /** * Options when displayed on navigation menu */ menu?: ComponentProps<'a'> & { banner?: ReactNode; }; }) | CustomItemType)[]; /** * @defaultValue false */ secondary?: boolean; } export interface CustomItemType extends Filterable { type: 'custom'; /** * @defaultValue false */ secondary?: boolean; children: ReactNode; } export type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType; /** * Get link items with shortcuts */ export declare function resolveLinkItems({ links, githubUrl }: Pick): LinkItemType[]; export declare function useLinkItems({ githubUrl, links }: Pick): { navItems: LinkItemType[]; menuItems: LinkItemType[]; all: LinkItemType[]; }; export declare function isLinkItemActive(link: LinkItemType, pathname: string): boolean; export { type BaseSlots, type BaseSlotsProps, LinkItem, baseSlots };