/** * Page-scoped relayout of composed pages (#857, DESIGN §6): the layout of * a composed page is kept by what it reads — the resolved template, the * page's Markdown and blocks, the styles and fonts, the locale (in the * configuration), the page's side and geometry, and what the pass knows * of those blocks (heading numbers, part and section, the pictures they * show) — so a build that meets the same page again (the next pass, the * next keystroke elsewhere in the chapter, the same chapter paginated in * the background) reuses it instead of setting it again. An edit inside a * page, or a change of a property it reads, sets that page alone. * * The kept layout is position-free: on reuse its source offsets, content * indices, container ids and page index are moved to where the page now * stands. A page whose layout reads what this key does not hold (a * footnote, a cross-reference, a citation, a contents or index listing, a * comic strip), that leaves notes for the pass (a drop cap's warning, a * joining script's tracking) or whose content goes on on pages it adds * (#859) is always laid out afresh. */ import type { ContentBlock, InlineSpan } from '../parse/types.js'; import type { VDTPage } from '../vdt.js'; import { type ComposedPageInput, type ComposedPageLayout } from '../pipeline/composedLayout.js'; /** What the memo reads of the pass that lays the page out. */ export interface ComposedMemoContext { /** The chapter's Markdown body, and the offset of the body in the file. */ markdown: string; bodyOffset: number; /** A key of the pass's resolved configuration (styles, typography, * locale, page): see {@link configKeyOf}. Read once a page is met. */ configKey(): string; /** What else the pass knows of content blocks `from`…`to` that their * layout reads, or undefined when the page must be laid out afresh. */ contextKey(from: number, to: number): string | undefined; /** Whether laying out blocks `from`…`to` left notes for the pass. */ sideEffectsIn(from: number, to: number): boolean; } /** Drop every kept page (tests; a host that wants a cold build). */ export declare function clearComposedPageMemo(): void; /** Turn the memo off (every composed page laid out afresh) or on again. */ export declare function setComposedPageMemo(on: boolean): void; /** Pages reused, laid out and kept, and laid out without keeping. */ export declare function composedPageMemoStats(): { hits: number; misses: number; skipped: number; size: number; }; /** A 64-bit digest of `parts` (two 32-bit FNV-style lanes, mixed) and * their total length: the memo's keys stay short whatever a page holds. */ export declare function digest(parts: readonly string[]): string; /** A key of a resolved configuration (or any plain object the layout * does not change, a resolved template), computed once per object. */ export declare function configKeyOf(resolved: object): string; /** Spans the memo cannot key: what prints something set elsewhere. */ export declare function spansReadOutside(spans: readonly InlineSpan[] | undefined): boolean; /** Whether content block `b` lays out from what it holds and the key's * context alone. */ export declare function blockMemoisable(b: ContentBlock): boolean; /** * {@link layoutComposedPage}, kept by what it reads: the same page met * again is taken from the memo and moved to where it now stands. */ export declare function layoutComposedPageMemo(input: ComposedPageInput, ctx: ComposedMemoContext): ComposedPageLayout; /** * What a composed page paints, as a key (#857): its frames' layout key * with what is laid round them (running heads, decoration, page number, * paper, the floats and notes no frame holds). Two pages with the same * key paint the same pixels with the same paint options, so a host can * keep a page's bitmap across a relayout. Undefined for a page without a * layout key (not a composed page, or one laid out afresh every time). */ export declare function composedPagePaintKey(page: VDTPage): string | undefined; //# sourceMappingURL=pageMemo.d.ts.map