## API Report File for "@eigenpal/docx-editor-core"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { EditorState } from 'prosemirror-state';
import { EditorView } from 'prosemirror-view';
import { Node as Node_2 } from 'prosemirror-model';

// @public
export function applyCellSelectionHighlight(pagesContainer: HTMLElement, state: EditorState, options?: {
    scope?: 'body' | 'header' | 'footer';
}): void;

// @public
export function applyFootnotePresentation(blocks: FlowBlock[], displayNumber: number): FlowBlock[];

// @public
export function buildFontString(style: FontStyle): string;

// @public
export function buildFootnoteContentMap(footnotes: Footnote[], footnoteRefs: Array<{
    footnoteId: number;
}>, contentWidth: number, options: ConvertFootnoteOptions): Map<number, FootnoteContent>;

// @public
export function buildFootnoteRenderItems(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, FootnoteContent>, doc: Document_2 | null): Map<number, FootnoteRenderItem[]>;

// @public
export function calculateFootnoteReservedHeights(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, {
    height: number;
}>): Map<number, number>;

// @public (undocumented)
export function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
    visualTop: number;
    visualBottom: number;
};

// @public
type CaretPosition_2 = {
    x: number;
    y: number;
    height: number;
    pageIndex: number;
};
export { CaretPosition_2 as CaretPosition }

// @public
export function clampFloatingWrapMargins(leftMargin: number, rightMargin: number, contentWidth: number): {
    leftMargin: number;
    rightMargin: number;
};

// @public
export function clearAllCaches(): void;

// @public
export function clearFontMetricsCache(): void;

// @public
export function clearParagraphMeasureCache(): void;

// @public
export function clearTextWidthCache(): void;

// @public
export function clickToPosition(fragmentHit: FragmentHit | null, tableCellHit?: TableCellHit | null): number | null;

// @public
function clickToPositionDom(container: HTMLElement, clientX: number, clientY: number, zoom?: number): number | null;
export { clickToPositionDom }
export { clickToPositionDom as mouseToPosition }

// @public
export function clickToPositionInParagraph(fragmentHit: FragmentHit): PositionResult | null;

// @public
export function clickToPositionInTableCell(tableCellHit: TableCellHit): number | null;

// @public
export function clipRectToTableWindow(spanEl: Element, rect: {
    readonly left: number;
    readonly top: number;
    readonly right: number;
    readonly bottom: number;
}): {
    left: number;
    top: number;
    right: number;
    bottom: number;
} | null;

// @public
export function collectFootnoteRefs(blocks: FlowBlock[]): Array<{
    footnoteId: number;
    pmPos: number;
}>;

// @public (undocumented)
export function columnWidthForSection(config: SectionLayoutConfig): number;

// @public
export function computeHfCaretRectFromView(view: EditorView, section: 'header' | 'footer', doc?: globalThis.Document): {
    top: number;
    left: number;
    height: number;
} | null;

// @public
export function computeHfSelectionRectsFromView(view: EditorView, section: 'header' | 'footer', doc?: globalThis.Document): Array<{
    top: number;
    left: number;
    width: number;
    height: number;
}>;

// @public
export function computePerBlockWidths(blocks: FlowBlock[], initialConfig: SectionLayoutConfig, finalConfig: SectionLayoutConfig): number[];

// @public
export function contributesToHeaderFooterFlowHeight(block: FlowBlock): boolean;

// @public
export function convertBorderSpecToLayout(border: {
    style?: string;
    size?: number;
    space?: number;
    color?: {
        rgb?: string;
        themeColor?: string;
        themeTint?: string;
        themeShade?: string;
    };
}, theme?: Theme | null): BorderStyle | undefined;

// @public
export type ConvertFootnoteOptions = {
    styles?: StyleDefinitions | null;
    theme?: Theme | null;
    measureBlocks: MeasureBlocksFn;
    defaultTabStopTwips?: number | null;
};

// @public
export function convertFootnoteToContent(footnote: Footnote, displayNumber: number, contentWidth: number, options: ConvertFootnoteOptions): FootnoteContent;

// @public (undocumented)
export type ConvertHeaderFooterOptions = {
    styles?: StyleDefinitions | null;
    theme?: Theme | null;
    measureBlocks: MeasureBlocksFn;
    defaultTabStopTwips?: number | null;
};

// @public
export function convertHeaderFooterPmDocToContent(pmDoc: Node_2, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;

// @public
export function convertHeaderFooterToContent(headerFooter: HeaderFooter | null | undefined, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;

// @public
export function countTableColumns(tableBlock: TableBlock): number;

// @public
export const DEFAULT_BODY_MARGIN_PX = 96;

// @public
export const DEFAULT_HF_DISTANCE_PX = 48;

// @public
export const DEFAULT_PAGE_HEIGHT_PX = 1056;

// @public
export const DEFAULT_PAGE_WIDTH_PX = 816;

// @internal
export function demoteBlockLikeFloatingTables(blocks: FlowBlock[], blockWidths: number[], fallbackWidth: number): void;

// @public
export function detectTableInsertHover(input: TableInsertHoverInput): TableInsertHoverHit | null;

// @public
export interface DomCaretPosition {
    // (undocumented)
    height: number;
    // (undocumented)
    pageIndex: number;
    // (undocumented)
    x: number;
    // (undocumented)
    y: number;
}

// @public
export interface DomSelectionRect {
    // (undocumented)
    height: number;
    // (undocumented)
    pageIndex: number;
    // (undocumented)
    width: number;
    // (undocumented)
    x: number;
    // (undocumented)
    y: number;
}

// @public
export function extendMarginsForHeaderFooter(input: ExtendMarginsForHeaderFooterInput): ExtendMarginsForHeaderFooterResult;

// @public (undocumented)
export interface ExtendMarginsForHeaderFooterInput {
    bodyBlocks?: FlowBlock[];
    finalMargins: PageMargins;
    footers?: Array<HeaderFooterContent | undefined>;
    headers?: Array<HeaderFooterContent | undefined>;
    margins: PageMargins;
    // (undocumented)
    pageSize: {
        w: number;
        h: number;
    };
    warn?: (message: string) => void;
}

// @public (undocumented)
export interface ExtendMarginsForHeaderFooterResult {
    // (undocumented)
    finalMargins: PageMargins;
    // (undocumented)
    margins: PageMargins;
}

// @public
export function findBodyEmptyRuns(container: ParentNode): HTMLElement[];

// @public
export function findBodyPmAnchor(container: ParentNode, pmStart: number): HTMLElement | null;

// @public
export function findBodyPmAnchors(container: ParentNode): HTMLElement[];

// @public
export function findBodyPmSpans(container: ParentNode): HTMLElement[];

// @public
export function findCharacterAtX(x: number, charWidths: number[]): number;

// @public (undocumented)
export interface FloatingExclusionRect {
    // (undocumented)
    distBottom: number;
    // (undocumented)
    distLeft: number;
    // (undocumented)
    distRight: number;
    // (undocumented)
    distTop: number;
    // (undocumented)
    height: number;
    side: 'left' | 'right';
    // (undocumented)
    width: number;
    // (undocumented)
    wrapText?: WrapTextDirection;
    // (undocumented)
    wrapType?: string;
    x: number;
    y: number;
}

// @public (undocumented)
export interface FloatingImageZone {
    // (undocumented)
    bottomY: number;
    fullWidthBlock?: boolean;
    // (undocumented)
    leftMargin: number;
    // (undocumented)
    rightMargin: number;
    // (undocumented)
    segments?: FloatingLineSegmentZone[];
    // (undocumented)
    topY: number;
}

// @public (undocumented)
export interface FloatingLineSegmentZone {
    // (undocumented)
    availableWidth: number;
    // (undocumented)
    leftOffset: number;
}

// @public
export type FloatPageGeometry = PageGeometry;

// @public
export interface FontMetrics {
    // (undocumented)
    ascent: number;
    // (undocumented)
    descent: number;
    // (undocumented)
    fontFamily: string;
    // (undocumented)
    fontSize: number;
    // (undocumented)
    lineHeight: number;
    singleLineRatio: number;
}

// @public
export interface FontStyle {
    // (undocumented)
    bold?: boolean;
    // (undocumented)
    fontFamily?: string;
    // (undocumented)
    fontSize?: number;
    // (undocumented)
    italic?: boolean;
    // (undocumented)
    letterSpacing?: number;
}

// @public
export const FOOTNOTE_SEPARATOR_HEIGHT = 12;

// @public
export function footnoteReservedHeightsEqual(a: Map<number, number>, b: Map<number, number>): boolean;

// @public
export type FragmentHit = {
    fragment: Fragment;
    block: FlowBlock;
    measure: Measure;
    pageIndex: number;
    localY: number;
    localX: number;
};

// @public
export function getCachedFontMetrics(fontFamily: string, fontSize: number, bold?: boolean, italic?: boolean): FontMetricsEntry | undefined;

// @public
export function getCachedParagraphMeasure(block: ParagraphBlock, maxWidth: number): ParagraphMeasure | undefined;

// @public
export function getCachedTextWidth(text: string, font: string, letterSpacing?: number): number | undefined;

// @public
export function getCanvasContext(): CanvasRenderingContext2D;

// @public
export function getCaretPosition(layout: Layout, blocks: FlowBlock[], measures: Measure[], pmPosition: number): CaretPosition_2 | null;

// @public (undocumented)
export function getCaretPositionFromDom(container: HTMLElement, pmPos: number, overlayRect: DOMRect): DomCaretPosition | null;

// @public
export function getColumns(sectionProps: SectionProperties | null | undefined): ColumnLayout | undefined;

// @public (undocumented)
export function getFloatingMargins(lineY: number, lineHeight: number, zones: FloatingImageZone[] | undefined, paragraphYOffset: number): FloatingLineMargins;

// @public
export function getFontCacheSize(): number;

// @public
export function getFontMetrics(style: FontStyle): FontMetrics;

// @public
export function getMargins(sp: SectionProperties | null | undefined): PageMargins;

// @public
export function getPageBounds(layout: Layout, pageIndex: number): {
    top: number;
    bottom: number;
} | null;

// @public
export function getPageIndexAtY(layout: Layout, y: number): number | null;

// @public
export function getPageSize(sp: SectionProperties | null | undefined): {
    w: number;
    h: number;
};

// @public
export function getPageTop(layout: Layout, pageIndex: number): number;

// @public
export function getParagraphCacheSize(): number;

// @public
export function getPositionRect(block: ParagraphBlock, measure: ParagraphMeasure, pmPosition: number, fragmentX: number, fragmentY: number, fragmentWidth: number, fromLine: number): {
    x: number;
    y: number;
    height: number;
} | null;

// @public
export function getRunCharWidths(run: TextRun): number[];

// @public
export function getScrollYForPage(layout: Layout, pageIndex: number): number;

// @public (undocumented)
export function getSelectionRectsFromDom(container: HTMLElement, from: number, to: number, overlayRect: DOMRect): DomSelectionRect[];

// @public
export function getTextCacheSize(): number;

// @public
export function getTotalCacheSize(): number;

// @public
export function getTotalDocumentHeight(layout: Layout): number;

// @public
export function getXForCharacter(offset: number, charWidths: number[]): number;

// @public
export function groupRectsByPage(rects: SelectionRect[]): Map<number, SelectionRect[]>;

// @public
export function halfPtToPx(halfPt: number): number;

// @public
export function hashParagraphBlock(block: ParagraphBlock): string;

// @public
export type HeaderFooterMetrics = {
    section: 'header' | 'footer';
    pageSize: {
        w: number;
        h: number;
    };
    margins: PageMargins;
};

// @public
export function hitTest(layout: Layout, blocks: FlowBlock[], measures: Measure[], point: Point): HitTestResult;

// @public
export function hitTestFragment(pageHit: PageHit, blocks: FlowBlock[], measures: Measure[], pagePoint: Point): FragmentHit | null;

// @public
export function hitTestImageFragment(pageHit: PageHit, blocks: FlowBlock[], measures: Measure[], pagePoint: Point): FragmentHit | null;

// @public
export function hitTestPage(layout: Layout, point: Point): PageHit | null;

// @public
export type HitTestResult = {
    pageHit: PageHit | null;
    fragmentHit: FragmentHit | null;
    tableCellHit: TableCellHit | null;
};

// @public
export function hitTestTableCell(pageHit: PageHit, blocks: FlowBlock[], measures: Measure[], pagePoint: Point): TableCellHit | null;

// @public
export function invalidateHfDomCache(): void;

// @internal
export function isBlockLikeFloatingTable(block: TableBlock, contentWidth: number): boolean;

// @public
export function isMultiPageSelection(rects: SelectionRect[]): boolean;

// @public
export function mapFootnotesToPages(pages: Page[], footnoteRefs: Array<{
    footnoteId: number;
    pmPos: number;
}>): Map<number, number[]>;

// @public
export const MAX_FOOTNOTE_LAYOUT_PASSES = 6;

// @public
export type MeasureBlockFn = (block: FlowBlock, contentWidth: number, floatingZones?: FloatingImageZone[], cumulativeY?: number) => Measure;

// @public
export type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number) => Measure[];

// @public
export function measureBlocksWithFloats(blocks: FlowBlock[], contentWidth: number | number[], measureBlock: MeasureBlockFn, pageGeometry?: FloatPageGeometry): Measure[];

// @public
export function measureParagraph(block: ParagraphBlock, maxWidth: number, options?: MeasureParagraphOptions): ParagraphMeasure;

// @public
export interface MeasureParagraphOptions {
    floatingZones?: FloatingImageZone[];
    paragraphYOffset?: number;
}

// @public
export function measureParagraphs(blocks: ParagraphBlock[], maxWidth: number): ParagraphMeasure[];

// @public
export function measureRun(text: string, style: FontStyle): RunMeasurement;

// @public
export function measureTableBlock(tableBlock: TableBlock, contentWidth: number, measureBlock: (block: FlowBlock, contentWidth: number) => Measure): TableMeasure;

// @public
export function measureTableCellBlockVisualHeight(block: FlowBlock, blockMeasure: Measure): number;

// @public
export function measureText(text: string, style: FontStyle): TextMeasurement;

// @public
export function measureTextWidth(text: string, style: FontStyle): number;

// @public (undocumented)
export function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];

// @public
export function normalizeTableColumnWidths(columnWidths: number[], colCount: number, targetWidth: number): number[];

// @public
export type PageHit = {
    pageIndex: number;
    page: Page;
    pageY: number;
};

// @public
export type Point = {
    x: number;
    y: number;
};

// @public
export type PositionResult = {
    pmPosition: number;
    charOffset: number;
    lineIndex: number;
};

// @public
export function positionToX(block: ParagraphBlock, measure: ParagraphMeasure, pmPosition: number, _fragmentWidth: number): {
    x: number;
    lineIndex: number;
} | null;

// @public
export function ptToPx(pt: number): number;

// @public
export function pxToHalfPt(px: number): number;

// @public
export function pxToPt(px: number): number;

// @public
export function pxToTwips(px: number): number;

// @public (undocumented)
export function rectsToFloatingZones(rects: FloatingExclusionRect[], contentWidth: number): FloatingImageZone[];

// @public
export function resetBlockIdCounter(): void;

// @public
export function resetCanvasContext(): void;

// @internal
export function resolveCellGrid(tableBlock: TableBlock): ResolvedGridCell[];

// @public
export interface ResolvedGridCell {
    // (undocumented)
    cellIndex: number;
    // (undocumented)
    colSpan: number;
    // (undocumented)
    columnIndex: number;
    // (undocumented)
    rowIndex: number;
    // (undocumented)
    rowSpan: number;
}

// @public
export function resolveHeaderFooter(doc: Document_2 | null, sp: SectionProperties | null | undefined): {
    header: HeaderFooter | null;
    footer: HeaderFooter | null;
    firstHeader: HeaderFooter | null;
    firstFooter: HeaderFooter | null;
};

// @public (undocumented)
export function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;

// @public
export function resolveListTemplate(template: string, counters: number[], levelNumFmts: NumberFormat[] | undefined): string;

// @internal
export function resolveTableColumnWidths(tableBlock: TableBlock, contentWidth: number): number[];

// @internal
export function resolveTableTotalWidthPx(tableBlock: TableBlock, contentWidth: number): number;

// @internal
export function resolveTableWidthPx(value: number | undefined, widthType: string | undefined, parentWidth: number): number | undefined;

// @public
export interface RunMeasurement {
    // (undocumented)
    charWidths: number[];
    // (undocumented)
    metrics: FontMetrics;
    // (undocumented)
    width: number;
}

// @public
export type SelectionRect = {
    x: number;
    y: number;
    width: number;
    height: number;
    pageIndex: number;
};

// @public
export function selectionToRects(layout: Layout, blocks: FlowBlock[], measures: Measure[], from: number, to: number): SelectionRect[];

// @public
export function setCachedFontMetrics(fontFamily: string, fontSize: number, bold: boolean, italic: boolean, metrics: FontMetricsEntry): void;

// @public
export function setCachedParagraphMeasure(block: ParagraphBlock, maxWidth: number, measure: ParagraphMeasure): void;

// @public
export function setCachedTextWidth(text: string, font: string, letterSpacing: number, width: number): void;

// @public
export function setFontCacheSize(size: number): void;

// @public
export function setParagraphCacheSize(size: number): void;

// @public
export function setTextCacheSize(size: number): void;

// @public
export function stabilizeFootnoteLayout(args: StabilizeFootnoteLayoutArgs): StabilizeFootnoteLayoutResult;

// @public (undocumented)
export interface StabilizeFootnoteLayoutArgs {
    // (undocumented)
    blocks: FlowBlock[];
    // (undocumented)
    footnoteContentMap: Map<number, FootnoteContent>;
    // (undocumented)
    footnoteRefs: Array<{
        footnoteId: number;
        pmPos: number;
    }>;
    initialLayout: Layout;
    // (undocumented)
    layoutOpts: LayoutOptions;
    // (undocumented)
    measures: Measure[];
}

// @public (undocumented)
export interface StabilizeFootnoteLayoutResult {
    converged: boolean;
    // (undocumented)
    layout: Layout;
    // (undocumented)
    pageFootnoteMap: Map<number, number[]>;
}

// @public
export const TABLE_INSERT_EDGE_PROXIMITY = 30;

// @public (undocumented)
export const TABLE_INSERT_HIDE_DELAY_MS = 200;

// @public
export type TableCellHit = {
    fragment: TableFragment;
    block: TableBlock;
    measure: TableMeasure;
    pageIndex: number;
    rowIndex: number;
    colIndex: number;
    cellBlock?: ParagraphBlock;
    cellMeasure?: ParagraphMeasure;
    cellLocalX: number;
    cellLocalY: number;
};

// @public (undocumented)
export type TableInsertHoverHit = {
    type: 'row' | 'column';
    clientX: number;
    clientY: number;
    cellPmPos: number;
};

// @public (undocumented)
export type TableInsertHoverInput = {
    mouseX: number;
    mouseY: number;
    pagesContainer: HTMLElement;
    target: HTMLElement;
    hfEditMode: 'header' | 'footer' | null;
    edgeProximity?: number;
};

// @public
export interface TextMeasurement {
    // (undocumented)
    ascent: number;
    // (undocumented)
    descent: number;
    // (undocumented)
    height: number;
    // (undocumented)
    width: number;
}

// @public
export function toFlowBlocks(doc: Node_2, options?: ToFlowBlocksOptions): FlowBlock[];

// @public
export type ToFlowBlocksOptions = {
    defaultFont?: string;
    defaultSize?: number;
    theme?: Theme | null;
    pageContentHeight?: number;
    defaultTabStopTwips?: number;
    listCounters?: Map<number, number[]>;
    listSeenNumIds?: Set<string>;
};

// @public
export function twipsToPixels(twips: number): number;

// @public
export function twipsToPx(twips: number): number;

```
