/** * Full Layout Engine — produces a complete LayoutDocument with positioned elements. * * Uses the pagination result from layoutDocument() for page assignments, * then computes precise positions (x, y, width, height) for every body * element on each page. * * This is the bridge between the page-number-only LayoutResult and the * fully positioned LayoutDocument that renderers (SVG, PDF, Canvas) can consume. * * Coverage: every variant of `BodyContent` from `../types` produces a * `PageContent` variant in the output. The `default:` branch of the * dispatch switch in `buildPage()` is a `never`-typed exhaustiveness * guard — adding a new body variant without a matching layout function * is a build error, never a silent drop. */ import type { DocxDocument } from "../types.js"; import type { LayoutOptions } from "./layout.js"; import type { LayoutDocument } from "./layout-model.js"; /** * Page geometry overrides for {@link FullLayoutOptions}. All fields are * in points. Any field not supplied falls back to the corresponding * value resolved from `doc.sectionProperties` (or the engine defaults). */ export interface PageGeometryOverride { readonly pageWidth?: number; readonly pageHeight?: number; readonly marginTop?: number; readonly marginBottom?: number; readonly marginLeft?: number; readonly marginRight?: number; /** * Distance of the header band from the top edge of the page, in * points. Overrides the section's `pgMar.header`. Header paragraphs * are laid out starting at this y-offset from the page top. */ readonly headerMargin?: number; /** * Distance of the footer band from the bottom edge of the page, in * points. Overrides the section's `pgMar.footer`. The footer band's * top is placed at `pageHeight - footerMargin`. */ readonly footerMargin?: number; } /** Options for the full layout engine. */ export interface FullLayoutOptions extends LayoutOptions { /** Font map for font-family resolution (name → actual font). */ readonly fonts?: ReadonlyMap; /** * Override the page geometry resolved from `doc.sectionProperties`. * Used by hosts that drive layout with their own page model (e.g. the * PDF bridge translating `DocxToPdfOptions.pageWidth` into a layout * geometry override). Any unspecified field falls back to the * section properties / engine defaults. */ readonly pageGeometry?: PageGeometryOverride; } /** * Perform full document layout, producing a LayoutDocument with precise positions. * * @param doc - The parsed DOCX document. * @param options - Layout and font options. * @returns A fully positioned LayoutDocument. */ export declare function layoutDocumentFull(doc: DocxDocument, options?: FullLayoutOptions): LayoutDocument;