import type { FlatBlock } from "@tooee/renderers"; import type { DocumentController, NavigationState } from "@tooee/shell"; import type { FoldState } from "../folds/use-folds.js"; import type { OutlineEntry } from "./markdown-outline.js"; /** Below this terminal width the outline is not shown. */ export declare const OUTLINE_MIN_TERMINAL_WIDTH = 60; /** * Lines of the document kept above a heading after a jump. The heading lands * near the top of the view, with a little of the text before it for context. */ export declare const OUTLINE_JUMP_MARGIN = 3; /** Columns for the outline at a terminal width, or 0 when the terminal is too narrow. */ export declare const outlineWidth: (terminalWidth: number) => number; /** State and actions of a document outline. */ export interface OutlineState { entries: readonly OutlineEntry[]; /** Entry of the heading that contains the document cursor, or -1. */ currentIndex: number; /** Entry the outline highlights as selected: the current heading unless the outline has focus. */ selectedIndex: number; /** Full-array rows whose own heading fold is closed. */ closedRows: ReadonlySet; /** True when the outline is open and the terminal is wide enough to show it. */ visible: boolean; /** True when the visible outline owns keyboard input. */ focused: boolean; /** Outline width in columns, or 0 when the terminal is too narrow. */ width: number; focus: () => void; focusContent: () => void; close: () => void; move: (delta: number) => void; select: (index: number) => void; /** Move the document cursor to an entry's heading and give focus back to the content. */ jump: (index: number) => void; } interface UseOutlineOptions { blocks: readonly FlatBlock[]; folds: FoldState; navigation: Pick; /** Scrolls a jumped-to heading near the top of the document view. */ revealRow: DocumentController["revealRow"]; initialOpen?: boolean; } /** * Outline state for a Markdown document, and the root `g o` command that * opens, focuses and closes it. A jump to a heading inside closed folds opens * those folds, then moves the cursor once the new rows are in place. Every * jump scrolls the heading to near the top of the view. */ export declare const useMarkdownOutline: ({ blocks, folds, navigation, revealRow, initialOpen, }: UseOutlineOptions) => OutlineState; export {}; //# sourceMappingURL=use-outline.d.ts.map