## 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 { Node as Node_2 } from 'prosemirror-model';

// @public
export function areSelectionStylesInjected(): boolean;

// @public
export function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;

// @public
export function borderToStyle(border: BorderSpec | undefined | null, side?: 'Top' | 'Bottom' | 'Left' | 'Right' | '', theme?: Theme | null): CSSProperties$1;

// @public
export function buildAnchorMaps<T>(anchors: CellAnchor<T>[]): {
    byStart: Map<string, CellAnchor<T>>;
    byCoveredSlot: Map<string, CellAnchor<T>>;
};

// @public
export function canRenderFont(fontFamily: string, fallbackFont?: string): boolean;

// @public
export interface CellAnchor<T> {
    // (undocumented)
    col: number;
    // (undocumented)
    colspan: number;
    data: T;
    // (undocumented)
    row: number;
    // (undocumented)
    rowspan: number;
}

// @public
export function clamp(value: number, min: number, max: number): number;

// @public
export function cleanWordHtml(html: string): string;

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

// @public
export const CLIPBOARD_TYPES: {
    readonly HTML: "text/html";
    readonly PLAIN: "text/plain";
};

// @public
export interface ClipboardContent {
    html: string;
    internal?: string;
    plainText: string;
}

// @public
export interface ClipboardOptions {
    cleanWordFormatting?: boolean;
    includeFormatting?: boolean;
    onError?: (error: Error) => void;
    theme?: Theme | null;
}

// @public
export function collectHeadings(doc: Node_2): HeadingInfo[];

// @public
export type ColorMode = 'light' | 'dark' | 'system';

// @public
export function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;

// @public
export function computeSplitDialogDefaults(rowspan: number, colspan: number): {
    minRows: number;
    minCols: number;
    initialRows: number;
    initialCols: number;
};

// @public
export function computeSplitLayout<T>(anchors: CellAnchor<T>[], target: CellAnchor<T>, rows: number, cols: number, totalRows: number, createSplitCellData: (isOriginal: boolean, rowOffset: number, colOffset: number) => T): SplitLayoutResult<T>;

// @public
export function copyParagraphs(paragraphs: Paragraph[], options?: ClipboardOptions): Promise<boolean>;

// @public
export function copyRuns(runs: Run[], options?: ClipboardOptions): Promise<boolean>;

// @public
export function countPageBreaks(doc: Document_2): number;

// @public
export function createClipboardHandlers(options: {
    onCopy?: () => {
        runs: Run[];
    } | null;
    onCut?: () => {
        runs: Run[];
    } | null;
    onPaste?: (content: ParsedClipboardContent) => void;
    clipboardOptions?: ClipboardOptions;
}): {
    handleCopy: (event: ClipboardEvent) => Promise<void>;
    handleCut: (event: ClipboardEvent) => Promise<void>;
    handlePaste: (event: ClipboardEvent) => void;
    handleKeyDown: (event: KeyboardEvent) => Promise<void>;
};

// @public
export function createColumnBreak(): BreakContent;

// @public
export function createDocumentWithText(text: string, options?: Omit<CreateEmptyDocumentOptions, 'initialText'>): Document_2;

// @public
export function createDoubleClickWordSelector(): (event: MouseEvent) => void;

// @public
export function createEmptyDocument(options?: CreateEmptyDocumentOptions): Document_2;

// @public
export interface CreateEmptyDocumentOptions {
    initialText?: string;
    marginBottom?: number;
    marginLeft?: number;
    marginRight?: number;
    marginTop?: number;
    orientation?: 'portrait' | 'landscape';
    pageHeight?: number;
    pageWidth?: number;
}

// @public
export function createHorizontalRule(): Paragraph;

// @public
export function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;

// @public
export function createPageBreak(): BreakContent;

// @public
export function createPageBreakParagraph(): Paragraph;

// @public
export function createPageBreakRun(): Run;

// @public
export function createRgbColor(hex: string): ColorValue;

// @public
export function createSelectionChangeHandler(containerElement: HTMLElement | null, onRectsChange: (rects: HighlightRect[]) => void, merge?: boolean): () => void;

// @public
export function createTemplateProcessor(defaultOptions?: ProcessTemplateOptions): (buffer: ArrayBuffer, variables: Record<string, string>) => ArrayBuffer;

// @public
export function createThemeColor(themeColor: ThemeColorSlot, tint?: number, shade?: number): ColorValue;

// @public
export function createTripleClickParagraphSelector(): (event: MouseEvent) => void;

// @public
export function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;

// @public
export const DEFAULT_SELECTION_STYLE: SelectionHighlightConfig;

// @public
export function describeShortcut(shortcut: KeyboardShortcut): string;

// @public
export type DocxInput = ArrayBuffer | Uint8Array | Blob | File;

// @public
export function eighthsToPixels(eighths: number): number;

// @public
export function emuToPixels(emu: number | undefined | null): number;

// @public
export function emuToTwips(emu: number): number;

// @public
export function ensureHexPrefix(hex: string): string;

// @public
export function expandSelectionToWord(): boolean;

// @public
export function expandSelectionToWordBoundaries(): boolean;

// @public
export function extendSelectionTo(node: Node, offset: number): void;

// @public
export function extractFontsFromDocument(document: unknown): Set<string>;

// @public
export function findNextWordStart(text: string, position: number): number;

// @public
export function findPageBreaks(doc: Document_2): InsertPosition_2[];

// @public
export function findPreviousWordStart(text: string, position: number): number;

// @public
export function findVisualLineEnd(container: Node, offset: number): {
    node: Node;
    offset: number;
} | null;

// @public
export function findVisualLineStart(container: Node, offset: number): {
    node: Node;
    offset: number;
} | null;

// @public
export function findWordAt(text: string, position: number): WordSelectionResult;

// @public
export function findWordBoundaries(text: string, position: number): [number, number];

// @public
export function findWordEnd(text: string, position: number): number;

// @public
export function findWordStart(text: string, position: number): number;

// @public
export const FONT_MAPPING: Record<string, string>;

// @public
export interface FontDefinition {
    family: string;
    src: string;
    weight?: number | string;
}

// @public
export function formatPx(px: number): string;

// @public
export function generateSelectionCSS(selector: string, config?: SelectionHighlightConfig): string;

// @public
export function generateThemeTintShadeMatrix(colorScheme?: ThemeColorScheme | null): ThemeMatrixCell[][];

// @public
export function getClipboardImageFiles(clipboardData: DataTransfer | null): File[];

// @public
export function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;

// @public
export function getGoogleFontEquivalent(fontName: string): string;

// @public
export function getHighlightRectStyle(rect: HighlightRect, config?: SelectionHighlightConfig): CSSProperties;

// @public
export function getLoadedFonts(): string[];

// @public
export function getMergedSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];

// @public
export function getMissingVariables(tags: string[], variables: Record<string, string>): string[];

// @public
export function getNavigationShortcutDescriptions(): Array<{
    action: string;
    shortcut: string;
}>;

// @public
export function getSelectedText(): string;

// @public
export function getSelectionBoundingRect(): DOMRect | null;

// @public
export function getSelectionInfo(): {
    node: Node;
    offset: number;
    anchorNode: Node | null;
    anchorOffset: number;
    focusNode: Node | null;
    focusOffset: number;
    isCollapsed: boolean;
    text: string;
} | null;

// @public
export function getSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];

// @public
export function getTemplateTags(buffer: ArrayBuffer): string[];

// @public
export function getThemeTintShadeHex(baseHex: string, type: 'tint' | 'shade', fraction: number): string;

// @public
export function getWordAt(text: string, position: number): string;

// @public
export function getWordAtCursor(): string | null;

// @public
export function halfPointsToPixels(halfPoints: number): number;

// @public
export function halfPointsToPoints(halfPoints: number): number;

// @public
export function handleClickForMultiClick(event: MouseEvent): number;

// @public
export function handleNavigationKey(event: KeyboardEvent, options?: {
    onDocumentStart?: () => void;
    onDocumentEnd?: () => void;
}): boolean;

// @public
export function handlePasteEvent(event: ClipboardEvent, options?: ClipboardOptions): ParsedClipboardContent | null;

// @public
export function hasActiveSelection(): boolean;

// @public
export function hasPageBreakBefore(paragraph: Paragraph): boolean;

// @public
export interface HeadingInfo {
    level: number;
    pmPos: number;
    text: string;
}

// @public
export const HIGH_CONTRAST_SELECTION_STYLE: SelectionHighlightConfig;

// @public
export interface HighlightRect {
    height: number;
    left: number;
    top: number;
    width: number;
}

// @public
export function highlightTextRange(_containerElement: HTMLElement, startNode: Node, startOffset: number, endNode: Node, endOffset: number): Range | null;

// @public
export function htmlToRuns(html: string, plainTextFallback: string): Run[];

// @public
export function injectSelectionStyles(config?: SelectionHighlightConfig): void;

// @public
export function insertHorizontalRule(doc: Document_2, position: InsertPosition_2): Document_2;

// @public
export function insertPageBreak(doc: Document_2, position: InsertPosition_2): Document_2;

// @public
interface InsertPosition_2 {
    offset?: number;
    paragraphIndex: number;
    runIndex?: number;
}
export { InsertPosition_2 as InsertPosition }

// @public
export const INTERNAL_CLIPBOARD_TYPE = "application/x-docx-editor";

// @public
export function isBlack(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;

// @public
export function isBreakContent(content: RunContent): content is BreakContent;

// @public
export function isColumnBreak(content: RunContent): boolean;

// @public
export function isEditorHtml(html: string): boolean;

// @public
export function isFontLoaded(fontFamily: string): boolean;

// @public
export function isGoogleFontsEnabled(): boolean;

// @public
export function isLineBreak(content: RunContent): boolean;

// @public
export function isLoading(): boolean;

// @public
export function isNavigationKey(event: KeyboardEvent): boolean;

// @public
export function isPageBreak(content: RunContent): boolean;

// @public
export function isPunctuation(char: string): boolean;

// @public
export function isSelectionBackwards(): boolean;

// @public
export function isSelectionWithin(element: HTMLElement): boolean;

// @public
export function isWhite(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;

// @public
export function isWhitespace(char: string): boolean;

// @public
export function isWordCharacter(char: string): boolean;

// @public
export function isWordHtml(html: string): boolean;

// @public
export interface KeyboardShortcut {
    // (undocumented)
    altKey?: boolean;
    // (undocumented)
    ctrlKey?: boolean;
    // (undocumented)
    key: string;
    // (undocumented)
    metaKey?: boolean;
    // (undocumented)
    shiftKey?: boolean;
}

// @public
export function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;

// @public
export function loadDocumentFonts(document: unknown): Promise<void>;

// @public
export function loadFont(fontFamily: string, options?: {
    weights?: number[];
    styles?: ('normal' | 'italic')[];
}): Promise<boolean>;

// @public
export function loadFontDefinitions(defs: ReadonlyArray<FontDefinition> | undefined): Promise<void>;

// @public
export function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, options?: {
    weight?: number | string;
}): Promise<boolean>;

// @public
export function loadFontFromUrl(fontFamily: string, src: string, options?: {
    weight?: number | string;
}): Promise<boolean>;

// @public
export function loadFonts(families: string[], options?: {
    weights?: number[];
    styles?: ('normal' | 'italic')[];
}): Promise<void>;

// @public
export function loadFontsWithMapping(families: string[]): Promise<void>;

// @public
export function loadFontWithMapping(fontFamily: string): Promise<boolean>;

// @public
export function matchesShortcut(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean;

// @public
export function mergeAdjacentRects(rects: HighlightRect[], tolerance?: number): HighlightRect[];

// @public
export function mergeStyles(...styles: (CSSProperties$1 | undefined | null)[]): CSSProperties$1;

// @public (undocumented)
export const MIN_CARD_GAP = 8;

// @public
export function moveByWord(direction: 'left' | 'right', extend?: boolean): boolean;

// @public
export function moveToLineEdge(edge: 'start' | 'end', extend?: boolean): boolean;

// @public
export const NAVIGATION_SHORTCUTS: {
    readonly wordLeft: KeyboardShortcut;
    readonly wordRight: KeyboardShortcut;
    readonly selectWordLeft: KeyboardShortcut;
    readonly selectWordRight: KeyboardShortcut;
    readonly lineStart: KeyboardShortcut;
    readonly lineEnd: KeyboardShortcut;
    readonly selectToLineStart: KeyboardShortcut;
    readonly selectToLineEnd: KeyboardShortcut;
    readonly documentStart: KeyboardShortcut;
    readonly documentEnd: KeyboardShortcut;
    readonly selectToDocumentStart: KeyboardShortcut;
    readonly selectToDocumentEnd: KeyboardShortcut;
};

// @public
export interface NavigationAction {
    direction: NavigationDirection;
    extend: boolean;
    unit: NavigationUnit;
}

// @public
export type NavigationDirection = 'left' | 'right' | 'up' | 'down';

// @public
export type NavigationUnit = 'character' | 'word' | 'line' | 'paragraph' | 'document';

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

// @public
export function onFontError(callback: (error: Error) => void): () => void;

// @public
export function onFontsLoaded(callback: (fonts: string[]) => void): () => void;

// @public
export function paragraphsToClipboardContent(paragraphs: Paragraph[], includeFormatting?: boolean, theme?: Theme | null): ClipboardContent;

// @public
export function paragraphToStyle(formatting: ParagraphFormatting | undefined | null, theme?: Theme | null): CSSProperties$1;

// @public
export function parseClipboardHtml(html: string, plainText: string, cleanWordFormatting?: boolean): ParsedClipboardContent;

// @public
export function parseColorString(colorString: string | undefined): ColorValue | undefined;

// @public
export interface ParsedClipboardContent {
    fromEditor: boolean;
    fromWord: boolean;
    plainText: string;
    runs: Run[];
}

// @public
export function parseNavigationAction(event: KeyboardEvent): NavigationAction | null;

// @public
export const PIXELS_PER_INCH = 96;

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

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

// @public
export function pointsToHalfPoints(points: number): number;

// @public
export function pointsToPixels(points: number): number;

// @public
export function prefersColorSchemeDark(): boolean;

// @public
export function preloadCommonFonts(): Promise<void>;

// @public
export function previewTemplate(buffer: ArrayBuffer, variables: Record<string, string>): string;

// @public
export function processTemplate(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ArrayBuffer;

// @public
export function processTemplateAdvanced(buffer: ArrayBuffer, data: Record<string, unknown>, options?: ProcessTemplateOptions): ArrayBuffer;

// @public
export function processTemplateAndDownload(buffer: ArrayBuffer, variables: Record<string, string>, filename?: string, options?: ProcessTemplateOptions): void;

// @public
export function processTemplateAsBlob(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): Blob;

// @public
export function processTemplateDetailed(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ProcessTemplateResult;

// @public
export interface ProcessTemplateOptions {
    delimiters?: {
        start?: string;
        end?: string;
    };
    linebreaks?: boolean;
    nullGetter?: 'keep' | 'empty' | 'error';
    parser?: (tag: string) => {
        get: (scope: Record<string, unknown>) => unknown;
    };
}

// @public
export interface ProcessTemplateResult {
    buffer: ArrayBuffer;
    replacedVariables: string[];
    unreplacedVariables: string[];
    warnings: string[];
}

// @public
export function readDocxFileFromInput(event: Event): Promise<ReadDocxFileResult | null>;

// @public
export interface ReadDocxFileResult {
    buffer: ArrayBuffer;
    name: string;
}

// @public
export function readFromClipboard(options?: ClipboardOptions): Promise<ParsedClipboardContent | null>;

// @public
export function redistributeColumnWidths(existing: number[], startCol: number, currentSpan: number, targetSpan: number): number[];

// @public
export function removePageBreak(doc: Document_2, position: InsertPosition_2): Document_2;

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

// @public
export function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;

// @public
export function resolveColorToHex(color: ColorValue | undefined | null, theme: Theme | null | undefined): string | undefined;

// @public
export function resolveHighlightColor(highlight: string | undefined): string;

// @public
export function resolveHighlightToCss(value: string): string;

// @public
export function resolveIsDark(colorMode: ColorMode, systemDark: boolean): boolean;

// @public
export function resolveShadingColor(color: ColorValue | undefined | null, theme: Theme | null | undefined): string;

// @public
export function resolveShadingFill(shading: ShadingProperties | undefined | null, theme?: Theme | null): string;

// @public
export function roundPixels(px: number, decimalPlaces?: number): number;

// @public
export function runsToClipboardContent(runs: Run[], includeFormatting?: boolean, theme?: Theme | null): ClipboardContent;

// @public
export function sectionToStyle(sectionProps: {
    pageWidth?: number;
    pageHeight?: number;
    marginTop?: number;
    marginBottom?: number;
    marginLeft?: number;
    marginRight?: number;
    background?: {
        color?: {
            rgb?: string;
            themeColor?: string;
        };
    };
} | undefined | null, theme?: Theme | null): CSSProperties$1;

// @public
export const SELECTION_CSS_VARS: {
    readonly backgroundColor: "--docx-selection-bg";
    readonly borderColor: "--docx-selection-border";
    readonly textColor: "--docx-selection-text";
};

// @public
export interface SelectionHighlightConfig {
    backgroundColor: string;
    borderColor?: string;
    borderRadius?: number;
    mixBlendMode?: CSSProperties['mixBlendMode'];
    opacity?: number;
    zIndex?: number;
}

// @public
export interface SelectionRange {
    end: {
        paragraphIndex: number;
        contentIndex: number;
        offset: number;
    };
    start: {
        paragraphIndex: number;
        contentIndex: number;
        offset: number;
    };
}

// @public
export function selectParagraphAtCursor(): boolean;

// @public
export function selectRange(range: Range): void;

// @public
export function selectWordAtCursor(): boolean;

// @public
export function selectWordInTextNode(textNode: Text, offset: number): boolean;

// @public
export function setGoogleFontsEnabled(enabled: boolean): void;

// @public
export function setSelectionPosition(node: Node, offset: number): void;

// @public (undocumented)
export const SIDEBAR_DOCUMENT_SHIFT: number;

// @public (undocumented)
export const SIDEBAR_PAGE_GAP = 12;

// @public
export const SIDEBAR_WIDTH = 340;

// @public
export interface SplitLayoutResult<T> {
    anchors: CellAnchor<T>[];
    // (undocumented)
    deltaCols: number;
    // (undocumented)
    deltaRows: number;
    // (undocumented)
    newRowCount: number;
}

// @public
export interface SplitTarget {
    // (undocumented)
    col: number;
    // (undocumented)
    colspan: number;
    // (undocumented)
    row: number;
    // (undocumented)
    rowspan: number;
}

// @public
export function subscribeSystemDark(onChange: (dark: boolean) => void): () => void;

// @public (undocumented)
export function sumColumnWidths(widths: number[], start: number, span: number): number;

// @public
export function tableCellToStyle(formatting: {
    verticalAlign?: 'top' | 'center' | 'bottom';
    textDirection?: string;
    shading?: ShadingProperties;
    borders?: {
        top?: BorderSpec;
        bottom?: BorderSpec;
        left?: BorderSpec;
        right?: BorderSpec;
    };
    margins?: {
        top?: {
            value: number;
            type: string;
        };
        bottom?: {
            value: number;
            type: string;
        };
        left?: {
            value: number;
            type: string;
        };
        right?: {
            value: number;
            type: string;
        };
    };
} | undefined | null, theme?: Theme | null): CSSProperties$1;

// @public
export interface TemplateError {
    message: string;
    originalError?: Error;
    type: 'parse' | 'render' | 'undefined' | 'unknown';
    variable?: string;
}

// @public
export function textToStyle(formatting: TextFormatting | undefined | null, theme?: Theme | null): CSSProperties$1;

// @public
export interface ThemeMatrixCell {
    hex: string;
    label: string;
    shade?: string;
    themeSlot: ThemeColorSlot;
    tint?: string;
}

// @public
export function toArrayBuffer(input: DocxInput): Promise<ArrayBuffer>;

// @public
export const TWIPS_PER_INCH = 1440;

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

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

// @public
export function validateTemplate(buffer: ArrayBuffer): {
    valid: boolean;
    errors: TemplateError[];
    tags: string[];
};

// @public
export interface WordSelectionResult {
    endIndex: number;
    startIndex: number;
    word: string;
}

// @public
export function writeToClipboard(content: ClipboardContent): Promise<boolean>;

```
