import { type ReactElement } from "react"; import type { TocEntry } from "../../docs/types.js"; /** * Props for {@link DocsToc}. */ export interface DocsTocProps { /** The page's heading minimap (`docs.tableOfContents(doc)`); the component renders nothing when empty. */ toc: TocEntry[]; /** Heading shown above the minimap. Defaults to `"On this page"`. */ title?: string; } /** * The docs page's right-hand "On this page" minimap: the `##`/`###` headings as jump links, with a * blue indicator that slides to the active section as the reader scrolls (a scroll-spy). Mirrors the * design's right rail - a sticky column, no collapse toggle. Renders nothing when the page has no * headings. * * A client component (the scroll-spy and the sliding indicator need browser APIs). It receives the * already-computed, serialisable `toc` from the server `DocsPage`. For its jump links to resolve, * `DocsPage` injects matching anchor ids into the body's headings. * * @param props - see {@link DocsTocProps}. * @returns the minimap `