/** * Unit and identity helpers for DocxIR construction. * * The DOCX authoring surface mixes units — points for spacing, twips for * indents, pixels for image sizes, inches for a visual canvas — and the IR * mixes none: every value is converted here, once, into the unit its property * name states. */ /** Points → twips. Spacing, padding and row heights are authored in points. */ export declare function pointsToTwips(points: number): number; /** Points → half-points, the OOXML unit for a font size. */ export declare function pointsToHalfPoints(points: number): number; /** Points → eighths of a point, the OOXML unit for a border width. */ export declare function pointsToEighthPoints(points: number): number; /** Inches → twips. */ export declare function inchesToTwips(inches: number): number; /** * Inches → EMU, directly. * * Not `twipsToEmu(inchesToTwips(x))`: that rounds twice, and a drawing canvas * authored in inches deserves the exact figure — 914400 is a whole number of * EMU per inch, so nothing is lost going straight there. */ export declare function inchesToEmu(inches: number): number; /** EMU → inches, the inverse of {@link inchesToEmu}. */ export declare function emuToInches(emu: number): number; /** Points → EMU, the OOXML unit for a drawing outline width. */ export declare function pointsToEmu(points: number): number; /** Twips → EMU. */ export declare function twipsToEmu(twips: number): number; /** Pixels at 96 DPI → EMU, which is how image extents are expressed. */ export declare function pixelsToEmu(pixels: number): number; /** EMU → pixels at 96 DPI, the inverse of {@link pixelsToEmu}. */ export declare function emuToPixels(emu: number): number; /** Pixels at 96 DPI → twips. */ export declare function pixelsToTwips(pixels: number): number; /** Twips → pixels at 96 DPI. */ export declare function twipsToPixels(twips: number): number; /** * Resolve a length that may be a percentage of a containing box. * * `"50%"` resolves against `containerTwips`; a number is already twips. * Anything unparseable resolves to 0 rather than throwing, matching what the * pre-IR pipeline did. */ export declare function resolveLengthTwips(value: number | string, containerTwips: number): number; /** * Build an IR colour from an already-resolved hex string. * * Theme tokens are resolved upstream; this only strips the `#` prefix, so an * unresolved token cannot reach the IR by accident. Case is left alone — OOXML * reads hex case-insensitively, so normalising it would rewrite the bytes of * every document that stated a colour in lower case and change nothing else. */ export declare function irColor(hex: string): { hex: string; }; /** Lowercase hex SHA-256, the identity used for resources. */ export declare function sha256Hex(bytes: Uint8Array): string; /** * Deterministic block id from its position in the document tree. * * Ids are derived, never allocated from a shared counter, so two concurrent * generations of the same document produce the same ids. */ export declare function blockId(sectionIndex: number, indexPath: readonly number[]): string; /** Deterministic id for a block inside a header or footer part. */ export declare function headerFooterBlockId(partId: string, indexPath: readonly number[]): string; //# sourceMappingURL=units.d.ts.map