/** * The `toc` component, resolved into the switches a Word field needs. * * A table of contents is a field: Word repopulates it on open from the outline * and the switches the field carries. Deciding what those switches say — which * outline levels, which extra styles, which region, which levels keep their * page numbers — is a reading of the authoring props with no renderer in it. * * The cached entries are the other half. Word refreshes the field, but headless * LibreOffice does not, so without them a PDF export shows only the title. What * is cached must be exactly what Word would collect, or a reader pressing F9 * sees the table change under them — the disagreement caching exists to avoid. */ import type { ThemeConfig } from '../styles'; import type { TocHeadingEntry } from './collectTocHeadings'; export interface TocFieldEntry { text: string; level: number; } export interface ResolvedTocField { /** `\o` — heading outline levels to include, inclusive. */ headingRange: { from: number; to: number; }; /** `\t` — extra paragraph styles, by Word display name, with their level. */ styleLevels: Array<{ styleName: string; level: number; }>; /** `\b` — restrict to a bookmarked region. */ bookmarkScope?: string; /** `\n` — level ranges whose entries omit a page number. */ omitPageNumbersForLevels: Array<{ from: number; to: number; }>; /** What separates an entry's text from its page number. */ entrySeparator: string; entries: TocFieldEntry[]; /** Things the field cannot express, to be reported by the caller. */ warnings: string[]; } /** * The Word display name a theme style key registers under: camelCase and * kebab/snake separators become spaces (`calloutTitle` → `callout Title`). * Mirrors the naming in `themeToDocxAdapter`. */ export declare function toStyleDisplayName(styleId: string): string; export interface TocFieldSource { depth?: unknown; pageNumbersDepth?: unknown; includePageNumbers?: boolean; numberingStyle?: string; numberSeparator?: boolean; scope?: 'auto' | 'document' | 'section'; styles?: Array<{ styleId: string; level: number; }>; title?: string; } /** Resolve a `toc` component's props into field switches and cached entries. */ export declare function resolveTocField(props: TocFieldSource, theme: ThemeConfig, context: { /** The bookmark of the section this TOC sits in, if any. */ sectionBookmarkId?: string; /** Every heading and mapped-style paragraph in the document, in order. */ collected?: readonly TocHeadingEntry[]; }): ResolvedTocField; //# sourceMappingURL=tocField.d.ts.map