fumadocs-core
Version:
The React.js library for building a documentation website
56 lines (55 loc) • 1.49 kB
TypeScript
import { ComponentProps, ReactNode, RefObject } from "react";
import * as react_jsx_runtime6 from "react/jsx-runtime";
//#region src/toc.d.ts
interface TOCItemType {
title: ReactNode;
url: string;
depth: number;
}
type TableOfContents = TOCItemType[];
/**
* The estimated active heading ID
*/
declare function useActiveAnchor(): string | undefined;
/**
* The id of visible anchors
*/
declare function useActiveAnchors(): string[];
interface AnchorProviderProps {
toc: TableOfContents;
/**
* Only accept one active item at most
*
* @defaultValue false
*/
single?: boolean;
children?: ReactNode;
}
interface ScrollProviderProps {
/**
* Scroll into the view of container when active
*/
containerRef: RefObject<HTMLElement | null>;
children?: ReactNode;
}
declare function ScrollProvider({
containerRef,
children
}: ScrollProviderProps): react_jsx_runtime6.JSX.Element;
declare function AnchorProvider({
toc,
single,
children
}: AnchorProviderProps): react_jsx_runtime6.JSX.Element;
interface TOCItemProps extends Omit<ComponentProps<'a'>, 'href'> {
href: string;
onActiveChange?: (v: boolean) => void;
}
declare function TOCItem({
ref,
onActiveChange,
...props
}: TOCItemProps): react_jsx_runtime6.JSX.Element;
//#endregion
export { AnchorProvider, AnchorProviderProps, ScrollProvider, ScrollProviderProps, TOCItem, TOCItemProps, TOCItemType, TableOfContents, useActiveAnchor, useActiveAnchors };
//# sourceMappingURL=toc.d.ts.map