import type { OutlineEntry } from '../types.js'; import type { StoryJump } from '../composed/carry.js'; import type { CarriedPlace } from '../pipeline/carriedOutline.js'; import type { VDTDocument } from '../vdt.js'; /** What a build needs of a chapter laid out, besides its document: what * the next chapter continues from, and what the book's outline reads. */ export interface ChapterRecord { /** Dropped when the record is kept only for the page fields (a round of * the contents that turned out not to be the last). */ doc?: VDTDocument; pageCount: number; /** The numbering the next page would carry. */ next?: { startAt: number; format: VDTDocument['pages'][number]['pageNumberFormat']; }; /** The chapter's outline entries with their pages. */ outline: OutlineEntry[]; /** The label and book index of the first page holding a block. */ firstContent?: { pageLabel: string; pageIndex: number; }; /** The stories of the chapter that jump into a page of a later one * (#943), kept apart from `doc` so they stand when the document is * dropped. */ jumps?: StoryJump[]; /** Where the marks, anchors and headings written in the stories this * chapter received landed (#988), for the sending chapters' entries. */ carried?: CarriedPlace[]; } /** What the last build did with the chapters. */ export interface BundleLayoutStats { /** Chapters laid out, every round of the contents counted. */ layouts: number; /** For each chapter of the result, whether its document was laid out by * that build (false: the one an earlier build laid out stands). */ laidOut: boolean[]; } /** * The chapters of a book laid out so far, handed to `buildBundle` build * after build (`layoutCache`) so that it lays out again only the chapters * whose inputs changed. Results are those of a build without it. The * cache does not see the fonts: a host whose faces change drops it along * with the measurement cache. */ export interface BundleLayoutCache { readonly stats: BundleLayoutStats; } export declare function createBundleLayoutCache(): BundleLayoutCache; /** The text of `value` as JSON, or undefined when it cannot be written * (a cycle): a key that cannot be written matches nothing. */ export declare function jsonKey(value: unknown): string | undefined; /** One build's use of a cache, round after round of the contents. */ export interface LayoutBuild { /** `compute()`, or what it gave for the same `key` in a build with the * same settings: for the work a build does on a chapter's text alone, * which a book of many chapters would otherwise parse again on every * build. Undefined `key`: computed. */ derive(key: string | undefined, compute: () => T): T; /** The book-wide inputs worked out from every chapter (the book's * references and citations), once known: when they are not the ones * of the build that filled the cache, none of its chapters stands. */ bookInputs(key: string | undefined): void; /** The record of the chapter keyed `key` (undefined: never reused), * laying it out with `layOut` when none stands. */ chapter(key: string | undefined, layOut: () => ChapterRecord): ChapterRecord; /** Start another round: records this build made that the round before * did not use are kept without their documents. */ nextRound(): void; /** The documents of the last round, laying out again any whose record * had lost its document; the cache keeps the records this build used. */ finish(): VDTDocument[]; } /** Begin a build of a book whose configuration, resources and metadata * give `settingsKey` (undefined: nothing is reused). The cache is changed * only when the build finishes. */ export declare function beginLayoutBuild(cache: BundleLayoutCache, settingsKey: string | undefined): LayoutBuild; //# sourceMappingURL=layoutCache.d.ts.map