@eigenpal/docx-editor-core

v1.8.3 · 73 published subpaths with full TypeScript signatures and JSDoc.

Subpaths

@eigenpal/docx-editor-core/headless

Headless aggregate for Node.js scripts, CLI tools, and server-side processing. Same surface as the default `.` entry, named to make the "no DOM" intent explicit. Prefer the smaller subpaths (`./docx`, `./agent`, `./utils`, etc.) for new code — they tree-shake better.

@eigenpal/docx-editor-core/core-plugins

Core Plugin System

@eigenpal/docx-editor-core/mcp

MCP Server Module

@eigenpal/docx-editor-core/prosemirror

ProseMirror Integration for DOCX Editor

@eigenpal/docx-editor-core/prosemirror/extensions

Extension System — Barrel Export

@eigenpal/docx-editor-core/prosemirror/conversion

Document Conversion Utilities

@eigenpal/docx-editor-core/prosemirror/commands

ProseMirror Commands

@eigenpal/docx-editor-core/prosemirror/plugins

ProseMirror Plugins

@eigenpal/docx-editor-core/prosemirror/utils/ClickPositionResolver

Click Position Resolver

@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges

Walk the PM doc once and derive (a) the tracked-change list and (b) a comment→revision overlap map for threading. Adjacent entries from the same revision are merged; deletion+insertion pairs from the same author/date become a single `replacement` entry (matches Word's UX for replace ops).

@eigenpal/docx-editor-core/prosemirror/utils/LayoutSelectionGate

Layout Selection Gate

@eigenpal/docx-editor-core/prosemirror/utils/PointerEventHandler

Pointer Event Handler

@eigenpal/docx-editor-core/prosemirror/utils/visualLineNavigation

Visual line navigation helpers — implements Word/Google-Docs-style ArrowUp / ArrowDown with sticky X across visual lines (not just paragraphs). Lifted from packages/react/src/paged-editor/ useVisualLineNavigation.ts so both adapters share the algorithm.

@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension

Table Extension — 4 node specs + plugins + commands

@eigenpal/docx-editor-core/prosemirror/template/prosemirror-plugin

Template ProseMirror Plugin

@eigenpal/docx-editor-core/docx

DOCX I/O

@eigenpal/docx-editor-core/docx/wrapTypes

OOXML image wrap-type taxonomy.

@eigenpal/docx-editor-core/docx/serializer

DOCX XML Serializers

@eigenpal/docx-editor-core/agent

Document Agent

@eigenpal/docx-editor-core/layout-engine

Layout Engine - Main Entry Point

@eigenpal/docx-editor-core/layout-painter

Layout Painter

@eigenpal/docx-editor-core/layout-bridge

Layout Bridge — measure, hit-test, and map between PM positions and pixels.

@eigenpal/docx-editor-core/plugin-api

Core Plugin API — Framework-Agnostic

@eigenpal/docx-editor-core/plugin-api/RenderedDomContext

RenderedDomContext Implementation

@eigenpal/docx-editor-core/plugin-api/resolveItemPositions

Pure layout algorithm: given a list of sidebar items + their anchor sources, return a list of resolved Y positions with collision avoidance applied. Lifted from React's components/sidebar/resolveItemPositions.ts so the Vue adapter can call it directly.

@eigenpal/docx-editor-core/plugin-api/types

Framework-Agnostic Plugin Interface for the DOCX Editor

@eigenpal/docx-editor-core/types/document

Comprehensive TypeScript types for full DOCX document representation

@eigenpal/docx-editor-core/types/content

Document Content Model — barrel.

@eigenpal/docx-editor-core/types/agentApi

Agent API Types

@eigenpal/docx-editor-core/utils

Editor utilities (curated public surface).

@eigenpal/docx-editor-core/utils/cardStyles

Sidebar card chrome — shared between React and Vue. Numeric pixel values rather than `'8px'` strings so both adapters' CSSProperties shapes accept them. Lifted from `packages/react/src/components/sidebar/cardStyles.ts` and the Vue mirror so there's one canonical table.

@eigenpal/docx-editor-core/utils/comments

Framework-agnostic comment + tracked-change helpers shared by the React and Vue adapters. The data shapes and string-formatting rules here are part of the visible UI (avatar colors, date strings) so keep this file as the single source of truth — both adapters import from here. CSS-property factories live in adapter-specific files (sidebar/cardUtils.ts in React, sidebar/sidebarUtils.ts in Vue).

@eigenpal/docx-editor-core/utils/stylePreview

Paragraph-style preview + option resolution — shared between the React and Vue toolbars so the style-picker dropdown looks and behaves identically.

@eigenpal/docx-editor-core/utils/findReplace

Find & Replace Utility Functions

@eigenpal/docx-editor-core/utils/findVerticalScrollParent

Pure DOM helpers — locate the element that vertically scrolls the paginated editor. Lifted from packages/react/src/paged-editor/ findVerticalScrollParent.ts so both adapters use the same logic for scroll-to-position, arrow-key line navigation, and drag auto-scroll.

@eigenpal/docx-editor-core/utils/fontOptions

Shared FontOption shape + normaliser used by FontPicker components in both adapters. Lifted from packages/react/src/components/ui/ normalizeFontFamilies.ts so the type definition has a single home.

@eigenpal/docx-editor-core/utils/headingCollector

@eigenpal/docx-editor-core/utils/highlightColors

OOXML highlight color name - hex mapping. Used by both adapter toolbars when serialising highlight selections to the `w:highlight` attribute (which only accepts named colors).

@eigenpal/docx-editor-core/utils/listState

Pure list-state helpers used by both adapter toolbars to track whether the selection is in a bullet/numbered list and at what indent level. Lifted from packages/react/src/components/ui/ ListButtons.tsx so the React + Vue toolbars share identical state-mutation logic.

@eigenpal/docx-editor-core/utils/reportIssue

Framework-agnostic helper to open a pre-filled GitHub "new issue" URL for the Help Report issue action. GitHub doesn't allow file attachments via URL params, so the body asks the user to drag-drop their DOCX onto the issue after it opens.

@eigenpal/docx-editor-core/utils/sidebarConstants

Sidebar geometry constants — shared by both adapters so the page-shift and card-gap math stays consistent.

@eigenpal/docx-editor-core/utils/textSelection

Text Selection Utilities

@eigenpal/docx-editor-core/utils/units

Unit Conversion Utilities - Convert OOXML units to CSS/pixels

@eigenpal/docx-editor-core/utils/autoScroll

@eigenpal/docx-editor-core/docx/parser

Main Parser Orchestrator - Unified parseDocx function

@eigenpal/docx-editor-core/docx/rezip

DOCX Repacker - Repack modified document into valid DOCX

@eigenpal/docx-editor-core/layout-bridge/clickToPositionDom

DOM-based Click-to-Position Mapping

@eigenpal/docx-editor-core/layout-bridge/measuring

Text Measurement Module

@eigenpal/docx-editor-core/layout-bridge/tableInsertHover

Table-insert "+" hover hit-test.

@eigenpal/docx-editor-core/layout-bridge/toFlowBlocks

ProseMirror to FlowBlock Converter

@eigenpal/docx-editor-core/layout-engine/types

Layout Engine Types

@eigenpal/docx-editor-core/layout-painter/renderPage

Page Renderer

@eigenpal/docx-editor-core/managers/AutoSaveManager

AutoSaveManager

@eigenpal/docx-editor-core/managers/TableSelectionManager

TableSelectionManager

@eigenpal/docx-editor-core/managers/types

Manager Types

@eigenpal/docx-editor-core/prosemirror/commands/formatting

Text Formatting Commands — thin re-exports from extension system

@eigenpal/docx-editor-core/prosemirror/commands/pageBreak

Page Break Commands

@eigenpal/docx-editor-core/prosemirror/commands/sectionBreak

Section Break Commands

@eigenpal/docx-editor-core/prosemirror/commands/paragraph

Paragraph Formatting Commands — thin re-exports from extension system

@eigenpal/docx-editor-core/prosemirror/paraText

@eigenpal/docx-editor-core/prosemirror/queries

@eigenpal/docx-editor-core/prosemirror/applyFormatting

@eigenpal/docx-editor-core/prosemirror/tableResize

@eigenpal/docx-editor-core/prosemirror/cellDragSelection

@eigenpal/docx-editor-core/prosemirror/imageCommit

@eigenpal/docx-editor-core/prosemirror/commentOps

@eigenpal/docx-editor-core/prosemirror/commentIdAllocator

@eigenpal/docx-editor-core/editor

@eigenpal/docx-editor-core/prosemirror/conversion/fromProseDoc

ProseMirror to Document Conversion

@eigenpal/docx-editor-core/prosemirror/plugins/selectionTracker

Selection Tracker Plugin

@eigenpal/docx-editor-core/prosemirror/schema

ProseMirror Schema for DOCX Editor

@eigenpal/docx-editor-core/prosemirror/styles

Style utilities for ProseMirror editor

Package root

Fat barrel that re-exports the parser, serializer, agent, plugin registry, and the most-used types. No React/DOM imports.

**When to import from . vs ./headless:** identical for Node.js use; . is the convenient aggregate, ./headless is its mirror with a slightly different name suffix. Adapter authors who only need a specific slice should prefer the smaller subpaths (./docx, ./agent, ./prosemirror, ./layout-*, ./utils) — they tree-shake better.

Functions (110)

attemptSelectiveSavefunctionSource ↗

Attempt a selective save — patch only changed paragraphs in document.xml. Also updates comments, headers/footers, and core properties so that all document parts stay in sync even when only paragraphs are patched.

Returns the saved ArrayBuffer, or null if selective save is not possible (caller should fall back to full repack).

declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;

blendColorsfunctionSource ↗

Blend two colors together

declare function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;

buildExtendedSelectionContextfunctionSource ↗

Build extended selection context with additional details

declare function buildExtendedSelectionContext(doc: Document, range: Range, options?: SelectionContextOptions): ExtendedSelectionContext;

buildFootnoteContentMapfunctionSource ↗

Build footnote content for all footnotes referenced in the document. Display numbers are assigned by first-appearance order (the same way Word renders them).

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

buildFootnoteRenderItemsfunctionSource ↗

Turn the page→footnote-id map into the per-page render payload that renderPages consumes via footnotesByPage. Skips non-normal notes (separators, continuation notices), reads the display number out of the content map, and pulls plain text via getFootnoteText.

Lives in core (not in either adapter) so React + Vue both call the same helper — same rule as the rest of this module.

declare function buildFootnoteRenderItems(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, FootnoteContent>, doc: Document | null): Map<number, FootnoteRenderItem[]>;

buildPatchedDocumentXmlfunctionSource ↗

Build a patched document.xml by splicing new paragraph XML into the original at the correct offsets. Only changed paragraphs are replaced; everything else is preserved byte-for-byte.

Returns null if any step fails.

declare function buildPatchedDocumentXml(originalXml: string, serializedXml: string, changedIds: Set<string>): string | null;

buildSelectionContextfunctionSource ↗

Build selection context for AI operations

declare function buildSelectionContext(doc: Document, range: Range, options?: SelectionContextOptions): SelectionContext;

calculateFootnoteReservedHeightsfunctionSource ↗

Calculate per-page footnote reserved heights. Returns MappageNumber, reservedHeight.

With columns > 1 the footnotes are balanced across that many columns and the reserved height is the tallest column (plus the separator), since the columns sit side by side — not the sum of every footnote height.

declare function calculateFootnoteReservedHeights(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, {
    height: number;
}>, columns?: number): Map<number, number>;

canRenderFontfunctionSource ↗

Check if a font is available on the system using canvas measurement

Compares text width with the target font vs a known fallback font (and the opposite fallback, for names that collide with the browser defaults). If the widths differ, the font is available. Reuses one shared canvas; the fallback widths are session constants and memoized.

declare function canRenderFont(fontFamily: string, fallbackFont?: string): boolean;

collectFootnoteRefsfunctionSource ↗

Scan FlowBlocks for runs with footnoteRefId set. Returns a list of [FootnoteRefLocation](FootnoteRefLocation) in document order.

Recurses into container blocks (table cells, text boxes) so footnote references authored anywhere in the body reach the page-reservation pass. Without this, a footnoteRefId nested inside a table cell never gets mapped to a page and the per-page .layout-footnote-area silently drops that entry even though the body still renders the in-line ref marker.

For refs inside a table, the OUTERMOST table's id and row index are recorded (a nested table keeps the outer context, since the outer row is what the paginator splits into per-page fragments).

declare function collectFootnoteRefs(blocks: FlowBlock[]): FootnoteRefLocation[];

colorsEqualfunctionSource ↗

Check if two colors are equal

declare function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;

convertHeaderFooterToContentfunctionSource ↗

Convert HeaderFooter (document type) to HeaderFooterContent (render type).

Routes through the same pipeline as the body: HF.content → headerFooterToProseDoc → toFlowBlocks → measureBlocks. The inline editor uses the same conversion chain, so block support (paragraph, table, image, textBox, fields) and the inline editor's content stay in lockstep.

declare function convertHeaderFooterToContent(headerFooter: HeaderFooter | null | undefined, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;

countPageBreaksfunctionSource ↗

Count page breaks in a document

declare function countPageBreaks(doc: Document): number;

createColumnBreakfunctionSource ↗

Create a column break content element

declare function createColumnBreak(): BreakContent;

createDocumentWithTextfunctionSource ↗

Create a document with a single paragraph containing the given text

declare function createDocumentWithText(text: string, options?: Omit<CreateEmptyDocumentOptions, 'initialText'>): Document;

createDocxfunctionSource ↗

Create a new DOCX from a Document (without requiring original buffer)

declare function createDocx(doc: Document): Promise<ArrayBuffer>;

createEmptyDocumentfunctionSource ↗

Create an empty document with a single paragraph

declare function createEmptyDocument(options?: CreateEmptyDocumentOptions): Document;
```ts
// Create a blank document
const doc = createEmptyDocument();

// Create with custom margins
const doc = createEmptyDocument({
  marginTop: 720,  // 0.5 inch
  marginBottom: 720,
});

// Create with initial text
const doc = createEmptyDocument({
  initialText: 'Hello, World!'
});
```

createHorizontalRulefunctionSource ↗

Create a horizontal rule paragraph Uses a paragraph with bottom border to simulate horizontal rule

declare function createHorizontalRule(): Paragraph;

createLineBreakfunctionSource ↗

Create a text wrapping break (line break)

declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;

createPageBreakfunctionSource ↗

Create a page break content element

declare function createPageBreak(): BreakContent;

createPageBreakParagraphfunctionSource ↗

Create an empty paragraph with a page break before it

declare function createPageBreakParagraph(): Paragraph;

createPageBreakRunfunctionSource ↗

Create a run containing a page break

declare function createPageBreakRun(): Run;

createRgbColorfunctionSource ↗

Create a ColorValue from RGB hex

declare function createRgbColor(hex: string): ColorValue;

createSelectionFromDOMfunctionSource ↗

Create a ClipboardSelection from the current DOM selection.

declare function createSelectionFromDOM(): ClipboardSelection | null;

createThemeColorfunctionSource ↗

Create a ColorValue from theme color reference

declare function createThemeColor(themeColor: ThemeColorSlot, tint?: number, shade?: number): ColorValue;

darkenColorfunctionSource ↗

Darken a color by a percentage

declare function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;

detectVariablesfunctionSource ↗

Detect all template variables in a document

declare function detectVariables(doc: Document): string[];

detectVariablesDetailedfunctionSource ↗

Detect variables with detailed information

declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;

detectVariablesInBodyfunctionSource ↗

Detect variables in document body

declare function detectVariablesInBody(body: DocumentBody): string[];

detectVariablesInParagraphfunctionSource ↗

Detect variables in a paragraph

declare function detectVariablesInParagraph(paragraph: Paragraph): string[];

documentHasVariablesfunctionSource ↗

Check if document has any template variables

declare function documentHasVariables(doc: Document): boolean;

emuToPixelsfunctionSource ↗

Convert EMUs to pixels (at 96 DPI)

1 inch = 914400 EMUs = 96 pixels Returns 0 for null/undefined/NaN inputs.

declare function emuToPixels(emu: number | undefined | null): number;

emuToTwipsfunctionSource ↗

Convert EMUs to twips

declare function emuToTwips(emu: number): number;

ensureHexPrefixfunctionSource ↗

Ensure a hex color string has a '#' prefix.

declare function ensureHexPrefix(hex: string): string;

executeCommandfunctionSource ↗

Execute an agent command on a document Returns a new document with the command applied (immutable)

Dispatch order: 1. Try plugin handlers first (allows plugins to override built-in commands) 2. Fall back to built-in handlers

declare function executeCommand(doc: Document, command: AgentCommand): Document;

executeCommandsfunctionSource ↗

Execute multiple commands in sequence

declare function executeCommands(doc: Document, commands: AgentCommand[]): Document;

extractFormattingFromElementfunctionSource ↗

Extract formatting from an HTML element's computed styles.

declare function extractFormattingFromElement(element: HTMLElement): Run['formatting'];

extractVariablesFromTextfunctionSource ↗

Extract variable names from text

declare function extractVariablesFromText(text: string): string[];

findPageBreaksfunctionSource ↗

Find all page break positions in a document

declare function findPageBreaks(doc: Document): InsertPosition[];

findParagraphByParaIdfunctionSource ↗

ProseMirror position range for the paragraph (or any textblock) whose paraId attribute equals paraId. Returns the inclusive from and exclusive to positions, plus the node, so callers can both target the paragraph (e.g. addMark over its text range) and inspect it.

from is the position immediately before the textblock; to is from + node.nodeSize. The text content lives at [from + 1, to - 1].

Returns null if no textblock with that paraId exists.

declare function findParagraphByParaId(doc: Node, paraId: string): {
    node: Node;
    from: number;
    to: number;
} | null;

findStartPosForParaIdfunctionSource ↗

ProseMirror position immediately before the first textblock whose paraId attribute equals paraId (Word w14:paraId / OOXML paragraph id).

Match is strict string equality on node.attrs.paraId.

declare function findStartPosForParaId(doc: Node, paraId: string): number | null;

footnoteReservedHeightsEqualfunctionSource ↗

Compare two per-page footnote reservation maps. Used by the React + Vue adapters to detect when the multi-pass loop has converged.

declare function footnoteReservedHeightsEqual(a: Map<number, number>, b: Map<number, number>): boolean;

formatLastSaveTimefunctionSource ↗

Format last save time for display

declare function formatLastSaveTime(date: Date | null): string;

formatPxfunctionSource ↗

Format a pixel value as CSS string

declare function formatPx(px: number): string;

formatStorageSizefunctionSource ↗

Format storage size for display

declare function formatStorageSize(bytes: number): string;

formatVariablefunctionSource ↗

Format a variable name with braces (standard docxtemplater syntax)

declare function formatVariable(name: string): string;

generateThemeTintShadeMatrixfunctionSource ↗

Generate the 10×6 theme color matrix for an advanced color picker.

Columns: lt1, dk1, lt2, dk2, accent1-6 (matches Word's order) Rows: base, 80% tint, 60% tint, 40% tint, 25% shade, 50% shade

declare function generateThemeTintShadeMatrix(colorScheme?: ThemeColorScheme | null): ThemeMatrixCell[][];

getAgentContextfunctionSource ↗

Build agent context from a document

declare function getAgentContext(doc: Document, options?: AgentContextOptions): AgentContext;

getAutoSaveStatusLabelfunctionSource ↗

Get auto-save status label

declare function getAutoSaveStatusLabel(status: AutoSaveStatus): string;

getAutoSaveStorageSizefunctionSource ↗

Get storage size used by auto-save

declare function getAutoSaveStorageSize(storageKey?: string): number;

getContrastingColorfunctionSource ↗

Get contrasting text color for a background

declare function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;

getDocumentSummaryfunctionSource ↗

Get a simple document summary for quick context

declare function getDocumentSummary(doc: Document): string;

getLoadedFontsfunctionSource ↗

Get list of all loaded fonts

declare function getLoadedFonts(): string[];

getSelectionRunsfunctionSource ↗

Get selected runs from the current DOM selection.

declare function getSelectionRuns(): Run[];

getTemplateTagsfunctionSource ↗

Get all template tags in a document without processing

declare function getTemplateTags(buffer: ArrayBuffer): string[];

getThemeTintShadeHexfunctionSource ↗

Compute a single tinted or shaded hex color from a base color.

declare function getThemeTintShadeHex(baseHex: string, type: 'tint' | 'shade', fraction: number): string;

halfPointsToPixelsfunctionSource ↗

Convert half-points to pixels (at 96 DPI)

Half-points are commonly used for font sizes in OOXML (w:sz).

declare function halfPointsToPixels(halfPoints: number): number;

hasPageBreakBeforefunctionSource ↗

Check if a paragraph has pageBreakBefore

declare function hasPageBreakBefore(paragraph: Paragraph): boolean;

hasTemplateVariablesfunctionSource ↗

Check if text contains template variables

declare function hasTemplateVariables(text: string): boolean;

injectStylesfunctionSource ↗

Inject CSS styles into the document head. Returns a cleanup function.

declare function injectStyles(pluginId: string, css: string): () => void;

insertHorizontalRulefunctionSource ↗

Insert a horizontal rule at a position in the document

declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;

insertPageBreakfunctionSource ↗

Insert a page break at a position in the document This inserts a new paragraph with pageBreakBefore: true

declare function insertPageBreak(doc: Document, position: InsertPosition): Document;

isAutoSaveSupportedfunctionSource ↗

Check if auto-save is supported

declare function isAutoSaveSupported(): boolean;

isBlackfunctionSource ↗

Check if a color is effectively black

declare function isBlack(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;

isBreakContentfunctionSource ↗

Check if content is any type of break

declare function isBreakContent(content: RunContent): content is BreakContent;

isColumnBreakfunctionSource ↗

Check if content is a column break

declare function isColumnBreak(content: RunContent): boolean;

isFontLoadedfunctionSource ↗

Check if a font is loaded

declare function isFontLoaded(fontFamily: string): boolean;

isFontsLoadingfunction

Check if any fonts are currently loading

declare function isLoading(): boolean;

isGoogleFontsEnabledfunctionSource ↗

Whether the automatic Google Fonts lookup is currently enabled.

declare function isGoogleFontsEnabled(): boolean;

isLineBreakfunctionSource ↗

Check if content is a line break

declare function isLineBreak(content: RunContent): boolean;

isPageBreakfunctionSource ↗

Check if content is a page break

declare function isPageBreak(content: RunContent): boolean;

isValidVariableNamefunctionSource ↗

Check if a variable name is valid

declare function isValidVariableName(name: string): boolean;

isWhitefunctionSource ↗

Check if a color is effectively white

declare function isWhite(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;

lightenColorfunctionSource ↗

Lighten a color by a percentage

declare function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;

loadFontfunctionSource ↗

Load a font from Google Fonts

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

loadFontFromBufferfunctionSource ↗

Load a font from a raw buffer (e.g., embedded in DOCX)

Call before loading the document when possible: registration marks the family as ours, which is what keeps the metric-compatible Google fallback in play for subsetted faces during the document's font resolution pass. Late registration still self-heals on the next pass. Under setGoogleFontsEnabled(false) that fallback fetch is suppressed and glyphs missing from the registered faces render via the CSS stack.

declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, options?: {
    weight?: number | string;
    style?: 'normal' | 'italic';
}): Promise<boolean>;

loadFontsfunctionSource ↗

Load multiple fonts from Google Fonts

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

mapFootnotesToPagesfunctionSource ↗

After layout, determine which footnotes appear on which pages. Checks each page's fragments to see if any footnoteRef PM positions fall within.

Returns MappageNumber, footnoteId[] in document order.

declare function mapFootnotesToPages(pages: Page[], footnoteRefs: FootnoteRefLocation[]): Map<number, number[]>;

onFontsLoadedfunctionSource ↗

Register a callback to be notified when fonts are loaded

declare function onFontsLoaded(callback: (fonts: string[]) => void): () => void;

parseColorStringfunctionSource ↗

Parse a color string (various formats) to ColorValue

declare function parseColorString(colorString: string | undefined): ColorValue | undefined;

parseDocxfunctionSource ↗

Parse a DOCX file into a complete Document model

declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;

parseVariablefunctionSource ↗

Parse a variable string to get the name

declare function parseVariable(variable: string): string | null;

pixelsToEmufunctionSource ↗

Convert pixels to EMUs. EMU coordinates in OOXML are integer-typed (xs:long); rounding here keeps floating-point drift (e.g. 52 px → 495299.99999999994) out of the document.

declare function pixelsToEmu(px: number): number;

pixelsToTwipsfunctionSource ↗

Convert pixels to twips

declare function pixelsToTwips(px: number): number;

pointsToPixelsfunctionSource ↗

Convert points to pixels (at 96 DPI)

1 inch = 72 points = 96 pixels → 1 point = 96/72 pixels = 4/3 pixels

declare function pointsToPixels(points: number): number;

preloadCommonFontsfunctionSource ↗

Preload a list of common document fonts

This preloads fonts commonly used in DOCX documents that have Google Fonts equivalents.

declare function preloadCommonFonts(): Promise<void>;

processTemplatefunctionSource ↗

Process a DOCX template with variable substitution

declare function processTemplate(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ArrayBuffer;

processTemplateAsBlobfunctionSource ↗

Process template and return as Blob

declare function processTemplateAsBlob(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): Blob;

processTemplateDetailedfunctionSource ↗

Process template with detailed result

declare function processTemplateDetailed(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ProcessTemplateResult;

registerPluginsfunctionSource ↗

Register multiple plugins at once

declare function registerPlugins(plugins: CorePlugin[], options?: PluginOptions): PluginRegistrationResult[];

removePageBreakfunctionSource ↗

Remove a page break at a specific position

declare function removePageBreak(doc: Document, position: InsertPosition): Document;

removeVariablesfunctionSource ↗

Replace all variables in text with a placeholder

declare function removeVariables(text: string, placeholder?: string): string;

repackDocxfunctionSource ↗

Repack a Document into a valid DOCX file

declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;

replaceVariablesfunctionSource ↗

Replace variables in text with values

declare function replaceVariables(text: string, values: Record<string, string>): string;

resolveColorfunctionSource ↗

Resolve a ColorValue to a CSS color string

declare function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;

resolveHighlightColorfunctionSource ↗

Resolve a highlight color name to CSS

declare function resolveHighlightColor(highlight: string | undefined): string;

resolveHighlightToCssfunctionSource ↗

Resolve a highlight color value to a CSS-ready string. Tries OOXML named highlight first, then ensures hex prefix.

declare function resolveHighlightToCss(value: string): string;

resolveShadingColorfunctionSource ↗

Resolve a shading fill or pattern color to CSS

declare function resolveShadingColor(color: ColorValue | undefined | null, theme: Theme | null | undefined): string;

sanitizeVariableNamefunctionSource ↗

Sanitize a variable name

declare function sanitizeVariableName(name: string): string;

serializeDocumentBodyfunctionSource ↗

Serialize a DocumentBody to document.xml body content

declare function serializeDocumentBody(body: DocumentBody): string;

serializeDocxfunction

Serialize a complete Document to valid document.xml

declare function serializeDocument(doc: Document): string;

serializeSectionPropertiesfunctionSource ↗

Serialize section properties (w:sectPr)

declare function serializeSectionProperties(props: SectionProperties | undefined): string;

setGoogleFontsEnabledfunctionSource ↗

Enable or disable the editor's automatic Google Fonts lookup.

Defaults to enabled. Set to false in no-egress embedders (strict CSP, offline) so loadFont / loadFontWithMapping never inject a fonts.googleapis.com stylesheet <link>. This gates ONLY the implicit Google Fonts lookup — font URLs you register yourself (the fonts prop / loadFontFromUrl) are still fetched by the browser, and embedded blobs (loadFontFromBuffer) and system fonts still resolve.

The flag is page-global (module-level), not per-editor: with multiple editors on one page the last caller wins. Call it before loading documents; disabling does not cancel fetches already in flight. A document font that is neither local nor registered then resolves loadFont to false silently (no onFontError) and renders via its CSS fallback stack.

declare function setGoogleFontsEnabled(enabled: boolean): void;

stabilizeFootnoteLayoutfunctionSource ↗

Run the multi-pass footnote layout loop. Reserving footnote space on a page can move a reference to another page, which changes the reservation, which can move references again. Iterate until the page→height contract is the same one used by the latest layout, or MAX_FOOTNOTE_LAYOUT_PASSES passes have run.

Lives in core so the React + Vue adapters call the same loop and stay in lockstep on convergence behaviour. Writes page.footnoteIds onto each page in the returned layout so renderers can paint footnote areas.

declare function stabilizeFootnoteLayout(args: StabilizeFootnoteLayoutArgs): StabilizeFootnoteLayoutResult;

toArrayBufferfunctionSource ↗

Normalize any [DocxInput](DocxInput) into an ArrayBuffer for internal use.

declare function toArrayBuffer(input: DocxInput): Promise<ArrayBuffer>;

twipsToEmufunctionSource ↗

Convert twips to EMUs

declare function twipsToEmu(twips: number): number;

twipsToPixelsfunctionSource ↗

Convert twips to pixels (at 96 DPI)

1 inch = 1440 twips = 96 pixels → 1 twip = 96/1440 pixels = 1/15 pixels

declare function twipsToPixels(twips: number): number;

updateMultipleFilesfunctionSource ↗

Update multiple files in a DOCX buffer

declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;

validatePatchSafetyfunctionSource ↗

Validate that a selective patch can be safely applied.

Checks: - All changed paraIds exist in original XML (exactly once) - All changed paraIds exist in serialized XML (exactly once) - Paragraph count matches between original and serialized

declare function validatePatchSafety(originalXml: string, serializedXml: string, changedIds: Set<string>): PatchValidationResult;

validateTemplatefunctionSource ↗

Validate that a document is a valid docxtemplater template

declare function validateTemplate(buffer: ArrayBuffer): {
    valid: boolean;
    errors: TemplateError[];
    tags: string[];
};

Classes (8)

AutoSaveManagerclassSource ↗

AutoSaveManager

Framework-agnostic class for auto-saving documents to localStorage. Extracted from the React useAutoSave hook.

Usage with React:

ts const snapshot = useSyncExternalStore(manager.subscribe, manager.getSnapshot);

declare class AutoSaveManager extends Subscribable<AutoSaveSnapshot>
MemberTypeSummary
(constructor)Constructs a new instance of the `AutoSaveManager` class
acceptRecoveryAccept recovery and return the document.
clearClear auto-saved data from storage.
destroySave synchronously on destroy (best-effort).
disableDisable auto-save and stop all timers.
dismissRecoveryDismiss recovery and clear saved data.
enableEnable auto-save and start the interval timer.
getRecoveryDataGet recovery data from storage.
onDocumentChangedUpdate the current document. Triggers debounced save if enabled.
saveManually trigger a save.
startIntervalStart the interval timer. Call after enabling or on init.

DocumentAgentclassSource ↗

DocumentAgent provides a fluent API for document manipulation

declare class DocumentAgent
```ts
const agent = new DocumentAgent(buffer);

// Read operations
const text = agent.getText();
const wordCount = agent.getWordCount();
const variables = agent.getVariables();

// Write operations (returns new agent)
const newAgent = agent
  .insertText({ paragraphIndex: 0, offset: 0 }, 'Hello ', { formatting: { bold: true } })
  .applyStyle({ paragraphIndex: 0, offset: 0 }, { paragraphIndex: 0, offset: 5 }, 'Heading1');

// Export
const newBuffer = await newAgent.toBuffer();
```
MemberTypeSummary
(constructor)Create a new DocumentAgent
applyFormattingApply text formatting to a range
applyParagraphFormattingApply paragraph formatting
applyStyleApply a named style to a paragraph
applyVariablesApply all pending template variables
clearPendingVariablesClear pending variables
deleteRangeDelete text in a range
executeCommandsExecute multiple commands in sequence
fromBufferCreate a DocumentAgent from a DOCX buffer (async)
fromDocumentCreate a DocumentAgent from a Document object
getAgentContextGet document context for AI agents
getCharacterCountGet character count
getDocumentGet the underlying document
getFormattedTextGet formatted text segments
getPageCountGet approximate page count
getParagraphCountGet paragraph count
getPendingVariablesGet pending variable values
getStylesGet available styles from the document
getTableCountGet table count
getTextGet plain text content of the document
getVariablesGet detected template variables
getWordCountGet word count
insertImageInsert an image at a position
insertParagraphBreakInsert a paragraph break
insertTableInsert a table at a position
insertTextInsert text at a position
mergeParagraphsMerge consecutive paragraphs
replaceRangeReplace text in a range
setVariableSet a template variable value
setVariablesSet multiple template variables
toBlobExport document to Blob
toBufferExport document to DOCX ArrayBuffer

EditorCoordinatorclassSource ↗

declare class EditorCoordinator extends Subscribable<EditorCoordinatorSnapshot>
MemberTypeSummary
(constructor)Constructs a new instance of the `EditorCoordinator` class
getDocumentGet the current document.
getZoomGet the current zoom level.
setDocumentLoadedSignal that document parsing completed successfully.
setFontsLoadedSignal that font loading completed.
setLoadErrorSignal that an error occurred during loading.
setParsingStartedSignal that document parsing has started.
setZoomSet the zoom level (1.0 = 100%).
updateDocumentUpdate the document (after edits).

ErrorManagerclassSource ↗

ErrorManager

Framework-agnostic pub/sub error notification system. Replaces React's componentDidCatch + context pattern for error notifications.

Usage with React:

ts const { notifications } = useSyncExternalStore(manager.subscribe, manager.getSnapshot);

declare class ErrorManager extends Subscribable<ErrorManagerSnapshot>
MemberTypeSummary
(constructor)Constructs a new instance of the `ErrorManager` class
clearAllClear all notifications and cancel pending timers.
destroyDestroy the manager and clean up all timers.
dismissDismiss a notification by ID.
showErrorShow an error notification (persistent, not auto-dismissed).
showInfoShow an info notification (auto-dismissed after 5s).
showWarningShow a warning notification (auto-dismissed after 5s).

LayoutCoordinatorclassSource ↗

declare class LayoutCoordinator extends Subscribable<LayoutCoordinatorSnapshot>
MemberTypeSummary
(constructor)Constructs a new instance of the `LayoutCoordinator` class
clearSelectedImageClear the image selection.
endColumnResizeEnd column resize.
endDragEnd drag selection.
getColumnResizeGet current column resize state.
getDragAnchorGet the drag anchor position.
setFocusedUpdate focus state.
setImageInteractingSet whether an image interaction (resize/move) is in progress.
setLayoutReadyNotify that layout has been computed.
setSelectedImageSet the currently selected image.
startColumnResizeStart resizing a table column.
startDragStart a drag selection from the given PM anchor position.
updateSelectionUpdate selection rectangles and caret position.

PluginLifecycleManagerclassSource ↗

declare class PluginLifecycleManager extends Subscribable<PluginLifecycleSnapshot>
MemberTypeSummary
(constructor)Constructs a new instance of the `PluginLifecycleManager` class
destroyDestroy all plugins and clean up.
getPluginStateGet plugin state by ID.
initializeInitialize plugins with an editor view. Calls `plugin.initialize(editorView)` for each plugin.
setPluginStateSet plugin state by ID.
updateStatesUpdate all plugin states by calling `onStateChange` on each plugin. Returns true if any plugin state changed.

PluginRegistryclassSource ↗

Plugin Registry - manages core plugins

declare class PluginRegistry
```ts
import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';

// Register plugins
pluginRegistry.register(docxtemplaterPlugin);

// Get all MCP tools for MCP server
const tools = pluginRegistry.getMcpTools();

// Get command handler for executor
const handler = pluginRegistry.getCommandHandler('insertTemplateVariable');
```
MemberTypeSummary
addEventListenerAdd an event listener
clearClear all registered plugins
getGet a registered plugin by ID
getAllGet all registered plugins
getCommandHandlerGet a command handler for a command type
getCommandTypesGet all registered command types
getDebugInfoGet registry state for debugging
getMcpToolGet an MCP tool by name
getMcpToolsGet all MCP tools from all registered plugins
getMcpToolsForPluginGet MCP tools from a specific plugin
hasCheck if a plugin is registered
hasCommandHandlerCheck if a command type has a handler
registerRegister a plugin
removeEventListenerRemove an event listener
sizenumberGet number of registered plugins
unregisterUnregister a plugin

SubscribableclassSource ↗

Subscribable Base Class

Framework-agnostic base for manager classes that need to notify UI frameworks of state changes.

Compatible with: - React: useSyncExternalStore(manager.subscribe, manager.getSnapshot) - Vue: watchEffect(() = manager.subscribe(triggerRef) )

declare abstract class Subscribable<TSnapshot>
MemberTypeSummary
(constructor)Constructs a new instance of the `Subscribable` class
getSnapshot() => TSnapshotGet the current snapshot. Returns a stable reference unless state has changed. Bound method — safe to pass as `useSyncExternalStore(..., manager.getSnapshot)`.
setSnapshotUpdate the snapshot and notify all subscribers. Subclasses should call this whenever their state changes.
subscribe(listener: () => void) => (() => void)Subscribe to state changes. Returns an unsubscribe function. Bound method — safe to pass as `useSyncExternalStore(manager.subscribe, ...)`.

Interfaces (96)

AgentContextinterfaceSource ↗

Document context for AI agents

interface AgentContext
MemberTypeSummary
availableStylesStyleInfo[]Available styles
characterCountnumberTotal character count
hasImagesbooleanHas images
hasTablesbooleanHas tables
language?stringDocument language
outlineParagraphOutline[]Content outline (first N chars per paragraph)
paragraphCountnumberTotal paragraph count
sectionsSectionInfo[]Document sections info
variableCountnumberVariable count
variablesstring[]Detected template variables
wordCountnumberTotal word count (approximate)

AgentContextOptionsinterfaceSource ↗

Options for building agent context

interface AgentContextOptions
MemberTypeSummary
includeFormatting?booleanInclude detailed formatting info (default: false)
includeTableContent?booleanInclude table content in context (default: false)
maxOutlineParagraphs?numberMaximum paragraphs to include in outline (default: 50)
outlineMaxChars?numberMaximum characters per paragraph in outline (default: 100)

AgentResponseinterfaceSource ↗

Response from an agent action

interface AgentResponse
MemberTypeSummary
commands?AgentCommand[]Commands to execute
error?stringError message if failed
metadata?Record<string, unknown>Metadata about the response
newContent?AgentContent[]New formatted content
newText?stringNew text to insert (for rewrite/expand/etc.)
successbooleanSuccess status
warnings?string[]Warning messages

AIActionRequestinterfaceSource ↗

AI action request

interface AIActionRequest
MemberTypeSummary
actionAIActionAction type
contextSelectionContextSelection context
customPrompt?stringCustom prompt (for 'custom' action)
options?Record<string, unknown>Additional options
targetLanguage?stringTarget language (for 'translate' action)

ApplyStyleCommandinterfaceSource ↗

Apply a named style to a paragraph

interface ApplyStyleCommand extends BaseCommand
MemberTypeSummary
paragraphIndexnumberParagraph index
styleIdstringStyle ID to apply
type'applyStyle'

AutoSaveManagerOptionsinterfaceSource ↗

Configuration for AutoSaveManager

interface AutoSaveManagerOptions
MemberTypeSummary
debounceDelay?numberDebounce delay for saveOnChange in milliseconds (default: 2000)
interval?numberSave interval in milliseconds (default: 30000 - 30 seconds)
maxAge?numberMaximum age of auto-save before it's considered stale (default: 24 hours)
onError?(error: Error) => voidCallback when save fails
onRecoveryAvailable?(savedDocument: SavedDocumentData) => voidCallback when recovery data is found
onSave?(timestamp: Date) => voidCallback when save succeeds
saveOnChange?booleanWhether to save on document change with debounce (default: true)
storageKey?stringStorage key for localStorage (default: 'docx-editor-autosave')

AutoSaveSnapshotinterfaceSource ↗

AutoSaveManager snapshot for UI consumption

interface AutoSaveSnapshot
MemberTypeSummary
hasRecoveryDataboolean
isEnabledboolean
lastSaveTimeDate | null
statusAutoSaveStatus

BookmarkEndinterfaceSource ↗

Bookmark end marker (w:bookmarkEnd)

interface BookmarkEnd
MemberTypeSummary
idnumberBookmark ID
type'bookmarkEnd'

BookmarkStartinterfaceSource ↗

Bookmark start marker (w:bookmarkStart)

interface BookmarkStart
MemberTypeSummary
colFirst?numberColumn index for table bookmarks
colLast?number
idnumberBookmark ID
namestringBookmark name
type'bookmarkStart'

CaretPosition_2interface

Caret position for rendering the blinking cursor

interface CaretPosition
MemberTypeSummary
heightnumber
pageIndexnumber
xnumber
ynumber

CellCoordinatesinterfaceSource ↗

Cell coordinates in a table

interface CellCoordinates
MemberTypeSummary
columnIndexnumber
rowIndexnumber
tableIndexnumber

ClipboardSelectioninterfaceSource ↗

Selection data for clipboard operations

interface ClipboardSelection
MemberTypeSummary
endOffsetnumber
endParagraphIndexnumber
endRunIndexnumber
isMultiParagraphboolean
runsRun[]
startOffsetnumber
startParagraphIndexnumber
startRunIndexnumber
textstring

ColumnResizeStateinterfaceSource ↗

Column resize tracking state

interface ColumnResizeState
MemberTypeSummary
columnIndexnumber
isResizingboolean
originalWidths{ left: number; right: number; }
startXnumber
tablePmStartnumber

Comment_2interface

A comment from comments.xml — the top-level entity for review comments and replies. id matches the inline CommentRangeStart / CommentRangeEnd markers that anchor it inside a paragraph; parentId threads replies under their parent; done reflects Word's "Resolve" state (w15:done).

interface Comment
MemberTypeSummary
authorstringAuthor name
contentParagraph[]Comment content (paragraphs)
date?stringDate
done?booleanWhether the comment is resolved/done
idnumberComment ID (matches commentRangeStart/End)
initials?stringAuthor initials
parentId?numberParent comment ID (for replies)

CommentRangeEndinterfaceSource ↗

Comment range end marker in paragraph content

interface CommentRangeEnd
MemberTypeSummary
idnumber
type'commentRangeEnd'

CommentRangeStartinterfaceSource ↗

Comment range start marker in paragraph content

interface CommentRangeStart
MemberTypeSummary
idnumber
type'commentRangeStart'

CorePlugininterfaceSource ↗

Core plugin interface - headless, works in Node.js

Plugins can: - Register command handlers that DocumentAgent dispatches to - Declare MCP tools that the MCP server exposes to AI clients - Have optional initialization logic - Declare dependencies on other plugins

interface CorePlugin
MemberTypeSummary
commandHandlers?Record<string, CommandHandler>Command handlers this plugin provides. DocumentAgent dispatches commands to these handlers.
dependencies?string[]Dependencies on other plugins (by ID). The registry ensures dependencies are loaded first.
description?stringPlugin description
destroy?() => void | Promise<void>Optional cleanup when plugin is unregistered.
idstringUnique plugin identifier
initialize?() => void | Promise<void>Optional setup when plugin is registered. Called once during plugin registration.
mcpTools?McpToolDefinition[]MCP tools this plugin exposes. MCP server collects these from all plugins.
namestringHuman-readable plugin name
version?stringPlugin version (semver)

CreateEmptyDocumentOptionsinterfaceSource ↗

Options for creating an empty document

interface CreateEmptyDocumentOptions
MemberTypeSummary
initialText?stringInitial text content (default: empty string)
marginBottom?numberBottom margin in twips (default: 1440 = 1 inch)
marginLeft?numberLeft margin in twips (default: 1440 = 1 inch)
marginRight?numberRight margin in twips (default: 1440 = 1 inch)
marginTop?numberTop margin in twips (default: 1440 = 1 inch)
orientation?'portrait' | 'landscape'Page orientation (default: 'portrait')
pageHeight?numberPage height in twips (default: 15840 = 11 inches)
pageWidth?numberPage width in twips (default: 12240 = 8.5 inches)

DeleteTextCommandinterfaceSource ↗

Delete text in a range

interface DeleteTextCommand extends BaseCommand
MemberTypeSummary
rangeRangeRange to delete
type'deleteText'

DeletioninterfaceSource ↗

Deletion wrapper (w:del) — runs deleted by tracked changes

interface Deletion
MemberTypeSummary
content(Run | Hyperlink)[]Deleted content
infoTrackedChangeInfoTracked change metadata
type'deletion'

Document_2interface

Top-level parsed DOCX document — the result of parseDocx(buffer).

Wraps the unzipped DOCX package (document.xml, styles.xml, etc.), the original buffer for round-trip saves, and any template variables / parse warnings detected during ingestion.

interface Document
```ts
import { parseDocx } from '@eigenpal/docx-editor-core/headless';
const doc = await parseDocx(buffer);
console.log(doc.package.document.content.length);
```
MemberTypeSummary
originalBuffer?ArrayBufferOriginal DOCX buffer. Kept for round-trip saves that preserve untouched parts.
packageDocxPackageParsed DOCX package — body, styles, numbering, theme, media, headers/footers.
templateVariables?string[]Detected docxtemplater variables (e.g. `{name}`, `{address}`). Populated when the document is recognized as a template.
warnings?string[]Non-fatal parser diagnostics — malformed parts, unsupported features, fallbacks.

DocumentBodyinterfaceSource ↗

Document body (w:body) — the editable content of the document.

Contains the ordered block content (paragraphs and tables), the section layout chain derived from inline sectPr markers, the final sectPr, and any document-level comments. This is what most edit operations mutate; headers/footers/styles live elsewhere in the package.

interface DocumentBody
MemberTypeSummary
comments?Comment[]Comments from comments.xml
contentBlockContent[]All content (paragraphs, tables)
finalSectionProperties?SectionPropertiesFinal section properties (from body's sectPr)
sections?Section[]Sections (derived from sectPr in paragraphs and final sectPr)

DocxPackageinterfaceSource ↗

Complete DOCX package structure

interface DocxPackage
MemberTypeSummary
documentDocumentBodyDocument body
endnotes?Endnote[]Endnotes (normal notes only — separators live in `endnoteSeparators`)
endnoteSeparators?Endnote[]Separator endnotes — see `footnoteSeparators`.
fontTable?FontTableFont table
footers?Map<string, HeaderFooter>Footers by relationship ID
footnotes?Footnote[]Footnotes (normal notes only — separators live in `footnoteSeparators`)
footnoteSeparators?Footnote[]Separator footnotes (`w:type="separator"` / `"continuationSeparator"` / `"continuationNotice"`) kept out of `footnotes` so rendering/layout only sees real notes. Retained for round-trip: Word rejects a footnotes part whose separator notes are missing, so the serializer re-emits these ahead of the normal notes.
headers?Map<string, HeaderFooter>Headers by relationship ID
media?Map<string, MediaFile>Media files
numbering?NumberingDefinitionsNumbering definitions
properties?{ title?: string; subject?: string; creator?: string; keywords?: string; description?: string; lastModifiedBy?: string; revision?: number; created?: Date; modified?: Date; }Document properties
relationships?RelationshipMapDocument relationships
settings?DocumentSettingsDocument-wide settings from `word/settings.xml`
styles?StyleDefinitionsStyle definitions
theme?ThemeTheme

EditorCoordinatorOptionsinterfaceSource ↗

Configuration for EditorCoordinator

interface EditorCoordinatorOptions
MemberTypeSummary
initialZoom?numberInitial zoom level (default: 1.0)
onChange?(document: Document) => voidCallback when the document changes
onError?(error: Error) => voidCallback when an error occurs

EditorCoordinatorSnapshotinterfaceSource ↗

The full snapshot exposed to UI frameworks

interface EditorCoordinatorSnapshot
MemberTypeSummary
fontsLoadedbooleanWhether fonts have been loaded
isReadybooleanWhether the editor is ready for interaction
loadingStateEditorLoadingStateCurrent loading state
parseErrorstring | nullError message if loadingState is 'error'
versionnumberVersion counter
zoomnumberCurrent zoom level (1.0 = 100%)

EditorHandleinterfaceSource ↗

Framework-agnostic interface for an imperatively mounted editor instance.

Returned by renderAsync() implementations (React, Vue, etc.). Consumers use this to interact with the editor programmatically.

interface EditorHandle
MemberTypeSummary
destroyUnmount the editor and clean up.
focusFocus the editor.
getDocumentGet the current parsed document model.
saveSave the document and return the DOCX as a Blob.

EditorPluginCoreinterfaceSource ↗

Framework-agnostic core plugin interface.

Contains all non-UI plugin capabilities: - ProseMirror plugins (decorations, keymaps, etc.) - State management (initialize, onStateChange, destroy) - CSS injection - Panel configuration

Framework adapters (ReactEditorPlugin, VueEditorPlugin) extend this with their own Panel component type and renderOverlay function.

interface EditorPluginCore<TState = any>
MemberTypeSummary
destroy?() => voidCalled when the plugin is being destroyed. Use this for cleanup (subscriptions, timers, etc.)
idstringUnique plugin identifier
initialize?(view: EditorView | null) => TStateInitialize plugin state when the plugin is first loaded.
namestringDisplay name for the plugin
onStateChange?(view: EditorView) => TState | undefinedCalled when the editor state changes. Use this to update plugin-specific state based on document changes.
panelConfig?PanelConfigConfiguration for the panel (position, size, etc.)
proseMirrorPlugins?Plugin[]ProseMirror plugins to register with the editor. These are merged with the editor's internal plugins.
styles?stringCSS styles to inject for this plugin. Can be a string of CSS or a URL to a stylesheet.

EndnoteinterfaceSource ↗

Endnote (w:endnote)

interface Endnote
MemberTypeSummary
contentBlockContent[]Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as the body — paragraphs, tables, and block-level content controls. See note on `Footnote.content`.
idnumberEndnote ID
noteType?'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice'Special endnote type
type'endnote'
verbatimXml?stringVerbatim original XML — see `Footnote.verbatimXml` (#646 F3).

ErrorManagerSnapshotinterfaceSource ↗

ErrorManager snapshot

interface ErrorManagerSnapshot
MemberTypeSummary
notificationsErrorNotification[]

ErrorNotificationinterfaceSource ↗

Error notification

interface ErrorNotification
MemberTypeSummary
details?string
dismissed?boolean
idstring
messagestring
severityErrorSeverity
timestampnumber

ExtendedSelectionContextinterfaceSource ↗

Extended selection context with additional details

interface ExtendedSelectionContext extends SelectionContext
MemberTypeSummary
characterCount?numberSelection character count
contentType?'prose' | 'list' | 'heading' | 'table' | 'mixed'Content type hints
detectedLanguage?stringLanguage detection hint
documentSummary?stringDocument summary for additional context
isMultiParagraph?booleanIs selection multi-paragraph
paragraphIndices?number[]Selected paragraph indices
wordCount?numberSelection word count

FooterReferenceinterfaceSource ↗

interface FooterReference
MemberTypeSummary
rIdstring
typeHeaderFooterType

FootnoteinterfaceSource ↗

Footnote (w:footnote)

interface Footnote
MemberTypeSummary
contentBlockContent[]Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as the body, so the note parser reuses the body's `parseBlockContent`: the full block model — paragraphs, tables, and block-level `w:sdt` content controls (as `BlockSdt`) — flows through the body pipeline (toProseDoc → toFlowBlocks) and stays editable on round-trip.
idnumberFootnote ID
noteType?'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice'Special footnote type
type'footnote'
verbatimXml?stringVerbatim original XML of the entire `<w:footnote>` element, captured at parse time ONLY when the note body carries a block-level construct the model still can't represent — note-level bookmarks (`w:bookmarkStart`/`w:bookmarkEnd`) or `w:customXml`. Block-level `w:sdt` is NOT a trigger: it round-trips through the model as `BlockSdt`. When present the serializer re-emits these bytes instead of rebuilding from `content`, restoring pre-#646 fidelity for the unmodeled constructs. See `parseNoteBlockContent` / `serializeNote` for the gate (#646 F3).

FormatTextCommandinterfaceSource ↗

Apply formatting to a range

interface FormatTextCommand extends BaseCommand
MemberTypeSummary
formattingPartial<TextFormatting>Formatting to apply
rangeRangeRange to format
type'formatText'

HeaderFooterinterfaceSource ↗

Header or footer content

interface HeaderFooter
MemberTypeSummary
contentBlockContent[]Content (paragraphs, tables, etc.)
hdrFtrTypeHeaderFooterTypeHeader/footer type
type'header' | 'footer'
watermark?WatermarkWatermark stored on this header (MS Word "Design → Watermark"). Lives here, not in `content`, so it stays out of the editable text flow while still round-tripping. Only headers carry watermarks; footers never do.

HeaderReferenceinterfaceSource ↗

Header or footer reference

interface HeaderReference
MemberTypeSummary
rIdstring
typeHeaderFooterType

Hyperlink (w:hyperlink) — wraps runs in a clickable link. External targets resolve through the relationships part (rIdhref); internal targets reference a BookmarkStart anchor by name.

interface Hyperlink
MemberTypeSummary

Image_2interface

Embedded image (w:drawing with an inline or anchored picture). Carries the relationship-id pointer to the binary in word/media/, its resolved data URL (src), display dimensions, optional crop / transform / wrap behaviors, and anchor positioning for floating images.

See ECMA-376 §20.4 (DrawingML wordprocessingDrawing).

interface Image
MemberTypeSummary
allowOverlap?boolean`wp:anchor allowOverlap` — when true (default), anchored objects may overlap; when false, Word repositions them to avoid collisions. We don't currently reposition; we round-trip the flag so saving preserves the author's intent.
alt?stringAlt text for accessibility
crop?ImageCropSource-image crop (fractional, OOXML `a:srcRect`).
decorative?booleanWhether this is a decorative image
effects?{ brightness?: number; contrast?: number; saturation?: number; }Image effects
filename?stringOriginal filename
hlinkHref?stringHyperlink URL for clickable image
id?stringUnique ID
layoutInCell?boolean`wp:anchor layoutInCell` — when true (default), an anchored image inside a table cell is constrained to the cell. When false, the image escapes the cell into the page area. Round-tripped on save.
mimeType?stringImage MIME type
opacity?numberOpacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque.
originalSize?ImageSizeOriginal size before any transforms
outline?ShapeOutlineImage outline/border
padding?ImagePaddingPadding around image
position?ImagePositionPosition for floating images
rIdstringRelationship ID for the image data
sizeImageSizeImage size
src?stringResolved image data (base64 or blob URL)
title?stringTitle/description
transform?ImageTransformImage transformations
type'image'
wrapImageWrapWrap settings

ImageSelectionInfointerfaceSource ↗

Info about the currently selected/hovered image

interface ImageSelectionInfo
MemberTypeSummary
heightEmunumber
isInlineboolean
pageIndexnumber
pmPosnumber
rect{ x: number; y: number; width: number; height: number; }
widthEmunumber

InsertHyperlinkCommandinterfaceSource ↗

Insert a hyperlink at a range

interface InsertHyperlinkCommand extends BaseCommand
MemberTypeSummary
displayText?stringDisplay text (replaces range text if provided)
rangeRangeRange to make into a hyperlink
tooltip?stringTooltip
type'insertHyperlink'
urlstringURL of the hyperlink

InsertImageCommandinterfaceSource ↗

Insert an image at a position

interface InsertImageCommand extends BaseCommand
MemberTypeSummary
alt?stringAlt text
height?numberImage height in pixels
positionPositionPosition to insert at
srcstringImage source (base64 or URL)
type'insertImage'
width?numberImage width in pixels

InsertioninterfaceSource ↗

Insertion wrapper (w:ins) — runs inserted by tracked changes

interface Insertion
MemberTypeSummary
content(Run | Hyperlink)[]Inserted content
infoTrackedChangeInfoTracked change metadata
type'insertion'

InsertPosition_2interface

Insert position in the document

interface InsertPosition
MemberTypeSummary
offset?numberCharacter offset within the run (optional)
paragraphIndexnumberParagraph index in the document body
runIndex?numberRun index within the paragraph (optional)

InsertTableCommandinterfaceSource ↗

Insert a table at a position

interface InsertTableCommand extends BaseCommand
MemberTypeSummary
columnsnumberNumber of columns
data?string[][]Optional table data
hasHeader?booleanOptional header row
positionPositionPosition to insert at
rowsnumberNumber of rows
type'insertTable'

InsertTextCommandinterfaceSource ↗

Insert text at a position

interface InsertTextCommand extends BaseCommand
MemberTypeSummary
formatting?TextFormattingOptional formatting for the inserted text
positionPositionPosition to insert at
textstringText to insert
type'insertText'

LayoutCoordinatorSnapshotinterfaceSource ↗

The full snapshot exposed to UI frameworks

interface LayoutCoordinatorSnapshot
MemberTypeSummary
caretPositionCaretPosition | nullCaret position for cursor overlay
hasLayoutbooleanComputed page layout, null until first computation
isDraggingbooleanWhether a text drag is in progress
isFocusedbooleanWhether the editor is focused
isImageInteractingbooleanWhether an image interaction is in progress
isResizingColumnbooleanWhether a column resize is in progress
selectedImageInfoImageSelectionInfo | nullCurrently selected/hovered image
selectionRectsSelectionRect[]Selection rectangles for range selection overlay
versionnumberVersion counter — incremented on every state change

ListLevelinterfaceSource ↗

One indentation level of an abstract numbering definition (w:lvl). Carries the number format, the marker template (lvlText — e.g. "%1.%2."), the level's paragraph properties (indent, hanging) and character properties (font, size, color for the marker itself).

ilvl ranges 0-8 in standard Word documents.

interface ListLevel
MemberTypeSummary
ilvlnumberLevel index (0-8)
isLgl?booleanIs legal numbering style
legacy?{ legacy?: boolean; legacySpace?: number; legacyIndent?: number; }Legacy settings
lvlJc?'left' | 'center' | 'right'Justification
lvlRestart?numberRestart numbering from higher level
lvlTextstringLevel text (e.g., "%1." or "•")
numFmtNumberFormatNumber format
pPr?ParagraphFormattingParagraph properties for this level
rPr?TextFormattingRun properties for the number/bullet
start?numberStarting number
suffix?LevelSuffixSuffix after number

McpSessioninterfaceSource ↗

MCP session state

Maintains state across tool calls within a session.

interface McpSession
MemberTypeSummary
dataMap<string, unknown>Custom session data
documentsMap<string, LoadedDocument>Loaded documents by ID
idstringSession ID

McpToolDefinitioninterfaceSource ↗

MCP tool definition

Describes a tool that can be called by AI clients through the MCP server.

interface McpToolDefinition
MemberTypeSummary
annotations?McpToolAnnotationsOptional annotations for the tool
descriptionstringHuman-readable description for AI
handlerMcpToolHandlerHandler function for the tool. Receives validated input and returns a result.
inputSchemaJsonSchema | ZodSchemaLikeJSON Schema for tool input validation. Can be a Zod schema or plain JSON Schema object.
namestringTool name (used in MCP protocol)

McpToolResultinterfaceSource ↗

MCP tool result

interface McpToolResult
MemberTypeSummary
contentMcpToolContent[]Result content
isError?booleanWhether this is an error result

MoveFrominterfaceSource ↗

Move-from wrapper (w:moveFrom) — content moved away from this position

interface MoveFrom
MemberTypeSummary
content(Run | Hyperlink)[]Moved content
infoTrackedChangeInfoTracked change metadata
type'moveFrom'

MoveTointerfaceSource ↗

Move-to wrapper (w:moveTo) — content moved into this position

interface MoveTo
MemberTypeSummary
content(Run | Hyperlink)[]Moved content
infoTrackedChangeInfoTracked change metadata
type'moveTo'

NumberingDefinitionsinterfaceSource ↗

Top-level numbering data from numbering.xml — the set of abstract templates and the per-document NumberingInstances that reference them. Paragraphs reference a numId (instance), not an abstractNumId directly.

interface NumberingDefinitions
MemberTypeSummary
abstractNumsAbstractNumbering[]Abstract numbering definitions
numsNumberingInstance[]Numbering instances

PanelConfiginterfaceSource ↗

Configuration for plugin panel rendering.

interface PanelConfig
MemberTypeSummary
collapsible?booleanWhether the panel can be collapsed
defaultCollapsed?booleanInitial collapsed state
defaultSizenumberDefault width/height of the panel
maxSize?numberMaximum size
minSize?numberMinimum size
position'left' | 'right' | 'bottom'Where to render the panel
resizable?booleanWhether the panel is resizable

ParagraphinterfaceSource ↗

Paragraph (w:p) — the primary block-level container in a Word document.

Every paragraph carries direct formatting (formatting), tracked property changes (propertyChanges), inline content (content), and optional list rendering / section break metadata. paraId is Word's stable identifier (w14:paraId) and is what EditorBridge and the agent toolkit use to address paragraphs.

See ECMA-376 §17.3.1.

interface Paragraph
MemberTypeSummary
contentParagraphContent[]Paragraph content
formatting?ParagraphFormattingParagraph formatting
listRendering?ListRenderingComputed list rendering (if this is a list item)
paraId?stringUnique paragraph ID
pPrDel?TrackedChangeInfoParagraph-mark deletion tracking (`<w:pPr><w:rPr><w:del/>`). Set when this paragraph's terminating pilcrow was deleted as a tracked change — e.g., the user pressed Backspace at the start of the next paragraph in suggesting mode. Accept joins this paragraph with the following one.
pPrIns?TrackedChangeInfoParagraph-mark insertion tracking (`<w:pPr><w:rPr><w:ins/>`). Set when this paragraph's terminating pilcrow was added as a tracked change — e.g., the user pressed Enter mid-paragraph in suggesting mode. Reject joins this paragraph with the following one.
propertyChanges?ParagraphPropertyChange[]Paragraph-level tracked property changes (w:pPrChange)
renderedPageBreakBefore?booleanWord's cached layout says this paragraph started on a new rendered page.
sectionProperties?SectionPropertiesSection properties (if this paragraph ends a section)
textId?stringText ID
type'paragraph'

ParagraphContextinterfaceSource ↗

Paragraph context for selection

interface ParagraphContext
MemberTypeSummary
fullTextstringFull paragraph text
indexnumberParagraph index
style?stringParagraph style
wordCountnumberWord count

ParagraphFormattinginterfaceSource ↗

Paragraph-level formatting (w:pPr) — alignment, indentation, spacing (before/after, line height), pagination flags (keepNext, keepLines, pageBreakBefore, widowControl), tabs, borders, shading, numbering reference, style reference, and frame/anchored-text properties.

Most fields mirror their ECMA-376 element names (see §17.3.1). Inheritance: direct formatting beats the linked style which beats document defaults.

interface ParagraphFormatting
MemberTypeSummary
afterAutospacing?booleanAuto space after (w:spacing/w:afterAutospacing)
alignment?ParagraphAlignmentParagraph alignment (w:jc)
beforeAutospacing?booleanAuto space before (w:spacing/w:beforeAutospacing)
bidi?booleanText direction (w:bidi)
borders?{ top?: BorderSpec; bottom?: BorderSpec; left?: BorderSpec; right?: BorderSpec; between?: BorderSpec; bar?: BorderSpec; }Paragraph borders (w:pBdr)
contextualSpacing?booleanContextual spacing — suppress space between paragraphs of the same style (w:contextualSpacing)
frame?{ width?: number; height?: number; hAnchor?: 'text' | 'margin' | 'page'; vAnchor?: 'text' | 'margin' | 'page'; x?: number; y?: number; xAlign?: 'left' | 'center' | 'right' | 'inside' | 'outside'; yAlign?: 'top' | 'center' | 'bottom' | 'inside' | 'outside' | 'inline'; wrap?: 'around' | 'auto' | 'none' | 'notBeside' | 'through' | 'tight'; }Text frame properties (w:framePr)
hangingIndent?booleanWhether first line is hanging indent
indentFirstLine?numberFirst line indent in twips - positive for indent, negative for hanging (w:ind/w:firstLine or w:hanging)
indentLeft?numberLeft indent in twips (w:ind/w:left)
indentRight?numberRight indent in twips (w:ind/w:right)
keepLines?booleanKeep lines together (w:keepLines)
keepNext?booleanKeep with next paragraph (w:keepNext)
lineSpacing?numberLine spacing value (w:spacing/w:line)
lineSpacingRule?LineSpacingRuleLine spacing rule (w:spacing/w:lineRule)
numPr?{ numId?: number; ilvl?: number; }Numbering properties (w:numPr)
numPrFromStyle?{ numId?: number; ilvl?: number; }When `numPr` was resolved from the paragraph STYLE's pPr rather than the paragraph's own `<w:numPr>`, this records the style-sourced value. The serializer omits `numPr` while it still equals this value — writing it as direct formatting would flip Word's indent precedence (a directly referenced level's indents beat the style's; a style-referenced level's do not) and break the document on save/reload. Cleared the moment the user changes the numbering (values diverge).
outlineLevel?numberOutline level 0-9 (w:outlineLvl)
pageBreakBefore?booleanPage break before (w:pageBreakBefore)
runProperties?TextFormattingRun properties to apply to all runs (w:rPr)
shading?ShadingPropertiesParagraph shading (w:shd)
spaceAfter?numberSpacing after in twips (w:spacing/w:after)
spaceBefore?numberSpacing before in twips (w:spacing/w:before)
spacingExplicit?SpacingExplicitPer-side flags marking which `<w:spacing>` attrs came from this paragraph's own pPr (vs inherited). Word collapses style-inherited spacing on empty paragraphs but honors the explicit values.
styleId?stringParagraph style ID (w:pStyle)
suppressAutoHyphens?booleanSuppress auto hyphens (w:suppressAutoHyphens)
suppressLineNumbers?booleanSuppress line numbers (w:suppressLineNumbers)
tabs?TabStop[]Custom tab stops (w:tabs)
widowControl?booleanWidow/orphan control (w:widowControl)

PluginLifecycleConfiginterfaceSource ↗

Plugin lifecycle configuration

interface PluginLifecycleConfig
MemberTypeSummary
destroy?() => void
idstring
initialize?(editorView: EditorView) => unknown
onStateChange?(editorView: EditorView) => unknown
styles?string

PluginLifecycleSnapshotinterfaceSource ↗

PluginLifecycleManager snapshot

interface PluginLifecycleSnapshot
MemberTypeSummary
statesMap<string, unknown>Map of plugin ID to plugin state
versionnumberVersion counter (incremented on any state change)

PluginPanelPropsinterfaceSource ↗

Props passed to plugin panel components (framework-agnostic base).

interface PluginPanelProps<TState = unknown>
MemberTypeSummary
docNode | nullCurrent ProseMirror document
editorViewEditorView | nullCurrent ProseMirror editor view
panelWidthnumberWidth of the panel in pixels
pluginStateTStatePlugin-specific state (managed by the plugin)
renderedDomContextRenderedDomContext | nullContext for the rendered DOM (LayoutPainter output). May be null if layout hasn't completed yet.
scrollToPosition(pos: number) => voidScroll editor to a specific position
selectRange(from: number, to: number) => voidSelect a range in the editor

Position_2interface

Position within a document

interface Position
MemberTypeSummary
contentIndex?numberOptional: Content index within paragraph (run, hyperlink, etc.)
offsetnumberOffset within the paragraph in characters
paragraphIndexnumberIndex of the paragraph (0-indexed)
sectionIndex?numberOptional: Section index

PositionCoordinatesinterfaceSource ↗

Coordinates returned by position lookup in the rendered DOM.

interface PositionCoordinates
MemberTypeSummary
heightnumber
xnumber
ynumber

ProcessTemplateOptionsinterfaceSource ↗

Options for template processing

interface ProcessTemplateOptions
MemberTypeSummary
delimiters?{ start?: string; end?: string; }Delimiter settings
linebreaks?booleanLine breaks: keep raw n or convert to w:br
nullGetter?'keep' | 'empty' | 'error'How to handle undefined variables
parser?(tag: string) => { get: (scope: Record<string, unknown>) => unknown; }Custom parser for variable names

ProcessTemplateResultinterfaceSource ↗

Result of template processing

interface ProcessTemplateResult
MemberTypeSummary
bufferArrayBufferThe processed document buffer
replacedVariablesstring[]Variables that were found and replaced
unreplacedVariablesstring[]Variables that were not replaced (no value provided)
warningsstring[]Any warnings during processing

Range_2interface

Range within a document

interface Range
MemberTypeSummary
collapsed?booleanWhether the range is collapsed (cursor position)
endPositionEnd position
startPositionStart position

RelationshipinterfaceSource ↗

Relationship entry

interface Relationship
MemberTypeSummary
idstringRelationship ID (e.g., "rId1")
targetstringTarget path or URL
targetMode?'External' | 'Internal'Target mode
typeRelationshipTypeRelationship type URI

RenderedDomContextinterfaceSource ↗

Context for accessing the rendered DOM in the paged editor.

Provides DOM-based position mapping that works with the LayoutPainter output (visible pages). Use this for rendering overlays, annotations, and other visual elements positioned relative to rendered content.

The rendered DOM uses data-pm-start/data-pm-end attributes on spans to map between ProseMirror positions and DOM elements.

interface RenderedDomContext
MemberTypeSummary
findElementsForRangeFind DOM elements that overlap with a ProseMirror position range.
getContainerOffsetOffset of the pages container from its parent viewport.
getCoordinatesForPositionGet pixel coordinates for a ProseMirror position in the rendered DOM. Returns null if the position cannot be found.
getRectsForRangeGet bounding rectangles for a range of text, accounting for line wraps. Returns rects relative to the pages container.
pagesContainerHTMLElementThe container element holding all rendered pages.
zoomnumberCurrent zoom level (1 = 100%).

ReplaceTextCommandinterfaceSource ↗

Replace text in a range

interface ReplaceTextCommand extends BaseCommand
MemberTypeSummary
formatting?TextFormattingOptional formatting for the new text
rangeRangeRange to replace
textstringReplacement text
type'replaceText'

RuninterfaceSource ↗

A run (w:r) — a contiguous span of inline content sharing one set of character properties (bold, italic, font, color, etc.). Runs are the atomic unit of character formatting; toggling bold on a selection that spans different formatting creates new runs.

See ECMA-376 §17.3.2.

interface Run
```ts
const run: Run = {
  type: 'run',
  formatting: { bold: true },
  content: [{ type: 'text', text: 'Hello' }],
};
```
MemberTypeSummary
contentRunContent[]Run content (text, tabs, breaks, etc.)
formatting?TextFormattingText formatting properties
propertyChanges?RunPropertyChange[]Run-level tracked property changes (w:rPrChange)
type'run'

SavedDocumentDatainterfaceSource ↗

Saved document data structure

interface SavedDocumentData
MemberTypeSummary
documentDocumentThe document JSON
documentId?stringOptional document identifier
savedAtstringWhen the document was saved
versionnumberVersion for format compatibility

SectionPropertiesinterfaceSource ↗

Section properties (w:sectPr) — page geometry, margins, columns, header/footer references, and page numbering for one section of the document. Sections are introduced by inline sectPr markers on the terminating paragraph (Paragraph.sectionProperties) and the body's final sectPr.

All distance units are twips (1/20 of a point) on the wire. The layout engine converts to pixels.

See ECMA-376 §17.6.

interface SectionProperties
MemberTypeSummary
background?{ color?: ColorValue; themeColor?: ThemeColorSlot; themeTint?: string; themeShade?: string; }Page background
bidi?booleanRight-to-left section
columnCount?numberNumber of columns
columns?Column[]Individual column definitions
columnSpace?numberSpace between columns in twips
docGrid?{ type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars'; linePitch?: number; charSpace?: number; }Document grid
endnotePr?EndnotePropertiesEndnote properties for this section
equalWidth?booleanEqual width columns
evenAndOddHeaders?booleanDifferent odd/even page headers/footers
footerDistance?numberFooter distance from bottom in twips
footerReferences?FooterReference[]Footer references
footnoteColumns?numberNumber of columns the footnote area is laid out in (`w15:footnoteColumns`). Word's "Footnote layout → Columns" setting, independent of the body column count above. Undefined/1 means the footnote area follows the body (single column for a single-column section). See ECMA-376 + the w15 extension.
footnotePr?FootnotePropertiesFootnote properties for this section
gutter?numberGutter margin in twips
headerDistance?numberHeader distance from top in twips
headerReferences?HeaderReference[]Header references
lineNumbers?{ start?: number; countBy?: number; distance?: number; restart?: LineNumberRestart; }Line numbering settings
marginBottom?numberBottom margin in twips
marginLeft?numberLeft margin in twips
marginRight?numberRight margin in twips
marginTop?numberTop margin in twips
orientation?PageOrientationPage orientation
pageBorders?{ top?: BorderSpec; bottom?: BorderSpec; left?: BorderSpec; right?: BorderSpec; display?: 'allPages' | 'firstPage' | 'notFirstPage'; offsetFrom?: 'page' | 'text'; zOrder?: 'front' | 'back'; }Page borders
pageHeight?numberPage height in twips
pageWidth?numberPage width in twips
paperSrcFirst?numberFirst page paper source
paperSrcOther?numberOther pages paper source
sectionStart?SectionStartSection start type
separator?booleanSeparator line between columns
titlePg?booleanDifferent first page header/footer
verticalAlign?VerticalAlignVertical alignment of text

SelectionContextinterfaceSource ↗

Context about the current selection

interface SelectionContext
MemberTypeSummary
formattingPartial<TextFormatting>Current formatting of selection
inTable?booleanIs selection within a table
paragraphParagraphContextParagraph containing selection
paragraphFormattingPartial<ParagraphFormatting>Current paragraph formatting
rangeRangeSelection range
selectedTextstringSelected text
suggestedActions?SuggestedAction[]Suggested actions based on selection
textAfterstringText after selection (context)
textBeforestringText before selection (context)

SelectionContextOptionsinterfaceSource ↗

Options for building selection context

interface SelectionContextOptions
MemberTypeSummary
contextCharsAfter?numberCharacters of context after selection (default: 200)
contextCharsBefore?numberCharacters of context before selection (default: 200)
includeDocumentSummary?booleanInclude document summary (default: true)
includeSuggestions?booleanInclude suggested actions (default: true)
maxSuggestions?numberMaximum suggested actions (default: 8)

SelectionRectinterfaceSource ↗

Selection rectangle for rendering selection overlays

interface SelectionRect
MemberTypeSummary
heightnumber
pageIndexnumber
widthnumber
xnumber
ynumber

SetVariableCommandinterfaceSource ↗

Set template variable value

interface SetVariableCommand extends BaseCommand
MemberTypeSummary
namestringVariable name
type'setVariable'
valuestringVariable value

ShapeinterfaceSource ↗

Shape/drawing object (wps:wsp)

interface Shape
MemberTypeSummary
customGeometry?stringCustom geometry points
fill?ShapeFillFill
id?stringUnique ID
name?stringName
outline?ShapeOutlineOutline/stroke
position?ImagePositionPosition for floating shapes
shapeTypeShapeTypeShape type preset
sizeImageSizeSize in EMUs
textBody?ShapeTextBodyText content inside the shape
transform?ImageTransformTransform
type'shape'
wrap?ImageWrapWrap settings

StabilizeFootnoteLayoutArgsinterfaceSource ↗

interface StabilizeFootnoteLayoutArgs
MemberTypeSummary
blocksFlowBlock[]
footnoteColumns?numberNumber of columns the footnote area is laid out in (`w15:footnoteColumns`). Defaults to 1. When 1, reserved heights are balanced across the columns (tallest column wins) instead of summing every footnote, and the value is written onto each footnote-bearing page as `page.footnoteColumns`.
footnoteContentMapMap<number, FootnoteContent>
footnoteRefsFootnoteRefLocation[]
initialLayoutLayoutFirst-pass layout already computed by the caller without reserved heights.
layoutOptsLayoutOptions
measuresMeasure[]

StabilizeFootnoteLayoutResultinterfaceSource ↗

interface StabilizeFootnoteLayoutResult
MemberTypeSummary
convergedbooleanTrue if the loop converged before hitting MAX_FOOTNOTE_LAYOUT_PASSES.
layoutLayout
pageFootnoteMapMap<number, number[]>

StyleinterfaceSource ↗

Style definition from styles.xml — a named, reusable bundle of paragraph and/or character formatting. Word's "Heading 1", "Normal", "Title", and "List Bullet" are styles; user-defined styles look the same. basedOn chains styles for inheritance; link pairs a paragraph style with a matching character style.

See ECMA-376 §17.7.4.

interface Style
MemberTypeSummary
basedOn?stringBased on style ID
default?booleanIs default style
hidden?booleanHidden from UI
name?stringDisplay name
next?stringNext style after Enter (for paragraph styles)
personal?booleanPersonal style (custom)
pPr?ParagraphFormattingParagraph properties (for paragraph/table styles)
qFormat?booleanQuick format in gallery
rPr?TextFormattingRun properties
semiHidden?booleanSemi-hidden from UI
styleIdstringStyle ID
tblPr?TableFormattingTable properties (for table styles)
tblStylePr?Array<{ type: 'band1Horz' | 'band1Vert' | 'band2Horz' | 'band2Vert' | 'firstCol' | 'firstRow' | 'lastCol' | 'lastRow' | 'neCell' | 'nwCell' | 'seCell' | 'swCell'; pPr?: ParagraphFormatting; rPr?: TextFormatting; tblPr?: TableFormatting; trPr?: TableRowFormatting; tcPr?: TableCellFormatting; }>Conditional table style parts
tcPr?TableCellFormattingTable cell properties
trPr?TableRowFormattingTable row properties
typeStyleTypeStyle type
uiPriority?numberUI sort priority
unhideWhenUsed?booleanUnhide when used

StyleDefinitionsinterfaceSource ↗

Style definitions from styles.xml

interface StyleDefinitions
MemberTypeSummary
docDefaults?DocDefaultsDocument defaults
latentStyles?{ defLockedState?: boolean; defUIPriority?: number; defSemiHidden?: boolean; defUnhideWhenUsed?: boolean; defQFormat?: boolean; count?: number; }Latent styles
stylesStyle[]Style definitions

SuggestedActioninterfaceSource ↗

Suggested action for context menu

interface SuggestedAction
MemberTypeSummary
description?stringDescription
icon?stringIcon name
idstringAction ID
labelstringDisplay label
priority?numberPriority (higher = more prominent)

TableinterfaceSource ↗

Table (w:tbl) — a block-level grid of rows × cells. Tables carry their own formatting layer (borders, shading, alignment, indent, floating placement) and an explicit column-width grid in twips. Tables can nest arbitrarily through TableCell.content.

See ECMA-376 §17.4.

interface Table
MemberTypeSummary
columnWidths?number[]Column widths in twips
formatting?TableFormattingTable formatting
propertyChanges?TablePropertyChange[]Table-level tracked property changes (w:tblPrChange)
rowsTableRow[]Table rows
type'table'

TableCellinterfaceSource ↗

Table cell (w:tc). Holds nested block content (paragraphs and nested tables), cell-level formatting (borders, shading, vertical merge), tracked property changes, and tracked structural changes for cell insert/delete/merge operations.

interface TableCell
MemberTypeSummary
content(Paragraph | Table)[]Cell content (paragraphs, tables, etc.)
formatting?TableCellFormattingCell formatting
propertyChanges?TableCellPropertyChange[]Cell-level tracked property changes (w:tcPrChange)
structuralChange?TableStructuralChangeInfoTracked structural changes (cell insert/delete/merge)
type'tableCell'

TableRowinterfaceSource ↗

Table row (w:tr) — an ordered list of TableCell plus row-level formatting (height, repeated header, cantSplit) and tracked changes for inserts/deletes.

interface TableRow
MemberTypeSummary
cellsTableCell[]Cells in this row
formatting?TableRowFormattingRow formatting
propertyChanges?TableRowPropertyChange[]Row-level tracked property changes (w:trPrChange)
structuralChange?TableStructuralChangeInfoTracked structural changes (row insert/delete)
type'tableRow'

TableSelectionSnapshotinterfaceSource ↗

TableSelectionManager snapshot

interface TableSelectionSnapshot
MemberTypeSummary
selectedCellCellCoordinates | nullCurrently selected cell, or null if no selection

TextBoxinterfaceSource ↗

Text box (floating text container)

interface TextBox
MemberTypeSummary
contentParagraph[]Text content
fill?ShapeFillFill
id?stringUnique ID
margins?{ top?: number; bottom?: number; left?: number; right?: number; }Internal margins
outline?ShapeOutlineOutline
position?ImagePositionPosition
sizeImageSizeSize
type'textBox'
wrap?ImageWrapWrap settings

TextContentinterfaceSource ↗

Plain text run content (w:t). preserveSpace mirrors the xml:space="preserve" attribute and matters for runs that begin or end with whitespace — without it, Word collapses leading/trailing spaces.

interface TextContent
MemberTypeSummary
preserveSpace?booleanPreserve whitespace (xml:space="preserve")
textstringThe text string
type'text'

TextFormattinginterfaceSource ↗

Character-level formatting (w:rPr) — the full set of run properties Word supports: weight, slant, font, size, color, highlight, underline, strikethrough, vertical position, language, complex-script variants, spacing/kerning, emphasis marks, and more.

Most fields mirror their ECMA-376 element names (see §17.3.2). Missing keys inherit from the run's paragraph style → linked style → document defaults chain.

interface TextFormatting
MemberTypeSummary
allCaps?booleanAll caps (w:caps)
bold?booleanBold (w:b)
boldCs?booleanBold complex script (w:bCs)
color?ColorValueText color (w:color)
cs?booleanComplex script formatting (w:cs)
doubleStrike?booleanDouble strikethrough (w:dstrike)
effect?TextEffectText effect animation (w:effect)
emboss?booleanEmboss effect (w:emboss)
emphasisMark?EmphasisMarkEmphasis mark (w:em)
fontFamily?{ ascii?: string; hAnsi?: string; eastAsia?: string; cs?: string; asciiTheme?: 'majorAscii' | 'majorHAnsi' | 'majorEastAsia' | 'majorBidi' | 'minorAscii' | 'minorHAnsi' | 'minorEastAsia' | 'minorBidi'; hAnsiTheme?: string; eastAsiaTheme?: string; csTheme?: string; }Font family (w:rFonts)
fontSize?numberFont size in half-points (w:sz) - e.g., 24 = 12pt
fontSizeCs?numberFont size complex script (w:szCs)
hidden?booleanHidden text (w:vanish)
highlight?'black' | 'blue' | 'cyan' | 'darkBlue' | 'darkCyan' | 'darkGray' | 'darkGreen' | 'darkMagenta' | 'darkRed' | 'darkYellow' | 'green' | 'lightGray' | 'magenta' | 'none' | 'red' | 'white' | 'yellow'Highlight/background color (w:highlight)
imprint?booleanImprint/engrave effect (w:imprint)
italic?booleanItalic (w:i)
italicCs?booleanItalic complex script (w:iCs)
kerning?numberKerning threshold in half-points (w:kern)
outline?booleanOutline effect (w:outline)
position?numberRaised/lowered text position in half-points (w:position)
rtl?booleanRight-to-left text (w:rtl)
scale?numberHorizontal text scale percentage (w:w)
shading?ShadingPropertiesCharacter shading (w:shd)
shadow?booleanShadow effect (w:shadow)
smallCaps?booleanSmall caps (w:smallCaps)
spacing?numberCharacter spacing in twips (w:spacing)
strike?booleanStrikethrough (w:strike)
styleId?stringCharacter style ID (w:rStyle)
underline?{ style: UnderlineStyle; color?: ColorValue; }Underline style and color (w:u)
vertAlign?'baseline' | 'superscript' | 'subscript'Superscript/subscript (w:vertAlign)

ThemeinterfaceSource ↗

Theme (from theme1.xml)

interface Theme
MemberTypeSummary
colorScheme?ThemeColorSchemeColor scheme
fontScheme?ThemeFontSchemeFont scheme
formatScheme?{ name?: string; }Format scheme (fills, lines, effects) - simplified
name?stringTheme name

ThemeColorSchemeinterfaceSource ↗

Theme color scheme (a:clrScheme)

interface ThemeColorScheme
MemberTypeSummary
accent1?stringAccent colors 1-6
accent2?string
accent3?string
accent4?string
accent5?string
accent6?string
dk1?stringDark 1 color (usually black)
dk2?stringDark 2 color
lt1?stringLight 1 color (usually white)
lt2?stringLight 2 color

ThemeFontinterfaceSource ↗

Theme font (with script variants)

interface ThemeFont
MemberTypeSummary
cs?stringComplex script font
ea?stringEast Asian font
fonts?Record<string, string>Script-specific fonts
latin?stringLatin font

ThemeFontSchemeinterfaceSource ↗

Theme font scheme (a:fontScheme)

interface ThemeFontScheme
MemberTypeSummary
majorFont?ThemeFontMajor font (headings)
minorFont?ThemeFontMinor font (body text)

ThemeMatrixCellinterfaceSource ↗

Theme color matrix cell

interface ThemeMatrixCell
MemberTypeSummary
hexstringResolved hex color (6 chars, no #)
labelstringHuman-readable label (e.g., "Accent 1, Lighter 60%")
shade?stringShade hex modifier if applicable (e.g., "BF")
themeSlotThemeColorSlotTheme color slot
tint?stringTint hex modifier if applicable (e.g., "CC")

TrackedChangeInfointerfaceSource ↗

Tracked change metadata (w:ins, w:del attributes)

interface TrackedChangeInfo
MemberTypeSummary
authorstringAuthor who made the change
date?stringDate of the change
idnumberRevision ID

VariableDetectionResultinterfaceSource ↗

Result of variable detection

interface VariableDetectionResult
MemberTypeSummary
byLocation{ body: string[]; headers: string[]; footers: string[]; footnotes: string[]; endnotes: string[]; textBoxes: string[]; }Variables by location
occurrencesVariableOccurrence[]Variable occurrences with positions
totalOccurrencesnumberTotal count of variable occurrences
variablesstring[]Unique variable names sorted alphabetically

VariableOccurrenceinterfaceSource ↗

A single variable occurrence with location info

interface VariableOccurrence
MemberTypeSummary
location'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox'Location type
namestringVariable name (without braces)
paragraphIndex?numberParagraph index within location
sectionIndex?numberSection index (for headers/footers)

Type aliases (22)

AgentCommandtypeSource ↗

Union of all command types

type AgentCommand = InsertTextCommand | ReplaceTextCommand | DeleteTextCommand | FormatTextCommand | FormatParagraphCommand | ApplyStyleCommand | InsertTableCommand | InsertImageCommand | InsertHyperlinkCommand | RemoveHyperlinkCommand | InsertParagraphBreakCommand | MergeParagraphsCommand | SplitParagraphCommand | SetVariableCommand | ApplyVariablesCommand;

AIActiontypeSource ↗

AI action types for context menu

type AIAction = 'askAI' | 'rewrite' | 'expand' | 'summarize' | 'translate' | 'explain' | 'fixGrammar' | 'makeFormal' | 'makeCasual' | 'custom';

AutoSaveStatustypeSource ↗

Auto-save status

type AutoSaveStatus = 'idle' | 'saving' | 'saved' | 'error';

BlockContenttypeSource ↗

Block-level content types

type BlockContent = Paragraph | Table | BlockSdt;

ConvertFootnoteOptionstypeSource ↗

Options for [convertFootnoteToContent](convertFootnoteToContent).

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

ConvertHeaderFooterOptionstypeSource ↗

type ConvertHeaderFooterOptions = {
    styles?: StyleDefinitions | null;
    theme?: Theme | null;
    measureBlocks: MeasureBlocksFn;
    defaultTabStopTwips?: number | null;
};

DocxInputtypeSource ↗

Any binary representation of a DOCX file that the editor can consume.

- ArrayBuffer — from FileReader.readAsArrayBuffer() or fetch().arrayBuffer() - Uint8Array — from Node.js fs.readFile() or streaming APIs - Blob — from drag-and-drop or <input type="file"> - File — subclass of Blob, from <input type="file">

type DocxInput = ArrayBuffer | Uint8Array | Blob | File;

EditorLoadingStatetypeSource ↗

Editor loading state

type EditorLoadingState = 'idle' | 'parsing' | 'loading-fonts' | 'ready' | 'error';

ErrorSeveritytypeSource ↗

Error severity levels

type ErrorSeverity = 'error' | 'warning' | 'info';

FieldtypeSource ↗

type Field = SimpleField | ComplexField;

FlowBlocktypeSource ↗

Union of every block kind the layout engine knows about.

Three switches over block.kind must stay in sync with this type: - runLayoutPipeline in layout-engine/index.ts (this package) - measureBlock in packages/react/src/paged-editor/PagedEditor.tsx - measureBlock in packages/vue/src/composables/useDocxEditor.ts

All three end in assertExhaustiveFlowBlock(block, '<site>') so adding a new variant here without updating every site is a typecheck error.

type FlowBlock = ParagraphBlock | TableBlock | ImageBlock | TextBoxBlock | SectionBreakBlock | PageBreakBlock | ColumnBreakBlock;

FootnoteContenttypeSource ↗

Pre-calculated footnote content for layout and rendering.

type FootnoteContent = {
    id: number;
    displayNumber: number;
    blocks: FlowBlock[];
    measures: Measure[];
    height: number;
};

FootnoteRefLocationtypeSource ↗

Where a footnote reference lives, as found by [collectFootnoteRefs](collectFootnoteRefs).

pmPos alone is enough to attribute a reference to a page for ordinary (paragraph) content, whose fragments carry a per-page pm sub-range. A table is different: it splits across pages by ROW, but every TableFragment keeps the whole table's pmStart/pmEnd (those drive selection mapping and must not be narrowed). So for a reference authored inside a table cell we also record the OUTERMOST table's id and the index of the row that contains it, letting [mapFootnotesToPages](mapFootnotesToPages) attribute the reference to the page that actually laid out that row.

type FootnoteRefLocation = {
    footnoteId: number;
    pmPos: number;
    tableBlockId?: BlockId;
    rowIndex?: number;
};

HeaderFooterMetricstypeSource ↗

Header / Footer Layout Utilities

The header/footer rendering pipeline lives here so any rendering adapter (React, Vue, etc.) can share the conversion logic and just supply its platform-specific [MeasureBlocksFn](MeasureBlocksFn). Mirrors the footnote pipeline in footnoteLayout.ts.

Pipeline: HF.content → headerFooterToProseDoc → toFlowBlocks → measureBlocks (caller-supplied, Canvas-aware) → HeaderFooterContent (blocks, measures, height, visualTop/Bottom)

The render side uses the normalized block list so paint and measurement stay in lockstep. Visual-bounds calculation still inspects the original block list because floating images can paint above/below the nominal flow box even when they do not contribute to flow height.

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

LayouttypeSource ↗

Final layout output ready for rendering/painting.

type Layout = {
    pageSize: {
        w: number;
        h: number;
    };
    pages: Page[];
    columns?: ColumnLayout;
    headers?: Record<string, HeaderFooterLayout>;
    footers?: Record<string, HeaderFooterLayout>;
    pageGap?: number;
};

McpToolHandlertypeSource ↗

MCP tool handler function

type McpToolHandler = (input: unknown, context: McpToolContext) => Promise<McpToolResult> | McpToolResult;

MeasuretypeSource ↗

Union of all measurement types.

type Measure = ParagraphMeasure | ImageMeasure | TableMeasure | TextBoxMeasure | SectionBreakMeasure | PageBreakMeasure | ColumnBreakMeasure;

MeasureBlocksFntypeSource ↗

Adapter-supplied block measurement function. The caller (React / Vue / etc.) supplies its platform's measure routine — at minimum paragraph + table + image + textBox — so this core helper stays Canvas-free.

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

PagetypeSource ↗

A rendered page containing positioned fragments.

type Page = {
    number: number;
    fragments: Fragment[];
    margins: PageMargins;
    size: {
        w: number;
        h: number;
    };
    orientation?: 'portrait' | 'landscape';
    sectionIndex?: number;
    headerFooterRefs?: {
        headerDefault?: string;
        headerFirst?: string;
        headerEven?: string;
        footerDefault?: string;
        footerFirst?: string;
        footerEven?: string;
    };
    footnoteIds?: number[];
    footnoteReservedHeight?: number;
    footnoteColumns?: number;
    columns?: ColumnLayout;
};

ParagraphContenttypeSource ↗

Inline content that can appear inside a paragraph. Covers runs (text), hyperlinks, bookmarks, fields, structured document tags, comment range markers, tracked-change wrappers, and math equations. Every node in this union carries a type discriminator so consumers can narrow at runtime.

type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;

RunContenttypeSource ↗

All possible run content types

type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;

TrackedRunChangetypeSource ↗

Run-level tracked wrappers represented in WordprocessingML.

type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;

Variables (6)

docxtemplaterPluginconstSource ↗

Docxtemplater plugin for template variable functionality.

Dependency validation is handled lazily by processTemplate at call time, so no eager initialize() is needed.

docxtemplaterPlugin: CorePlugin

FOOTNOTE_SEPARATOR_HEIGHTconstSource ↗

Separator line height + vertical padding in pixels.

FOOTNOTE_SEPARATOR_HEIGHT = 12

MAX_FOOTNOTE_LAYOUT_PASSESconstSource ↗

Hard cap on the multi-pass footnote layout loop. Reserving footnote space can move a reference to another page, so adapters keep remapping until the page→height contract is stable. Dense layouts converge in 2–3 passes in practice; 6 is a safe ceiling.

MAX_FOOTNOTE_LAYOUT_PASSES = 6

pluginRegistryconstSource ↗

Global plugin registry instance

Use this for registering plugins and accessing their capabilities.

pluginRegistry: PluginRegistry

rgbToHexconstSource ↗

rgbToHex: typeof cssColorToHex

VERSIONconstSource ↗

eigenpal/docx-editor-core (default entry point)

Fat barrel that re-exports the parser, serializer, agent, plugin registry, and the most-used types. No React/DOM imports.

**When to import from . vs ./headless:** identical for Node.js use; . is the convenient aggregate, ./headless is its mirror with a slightly different name suffix. Adapter authors who only need a specific slice should prefer the smaller subpaths (./docx, ./agent, ./prosemirror, ./layout-*, ./utils) — they tree-shake better.

VERSION = "0.0.2"
```ts
import { parseDocx, serializeDocx, resolveColor } from '@eigenpal/docx-editor-core';
```

On this page

SubpathsPackage rootFunctionsattemptSelectiveSaveblendColorsbuildExtendedSelectionContextbuildFootnoteContentMapbuildFootnoteRenderItemsbuildPatchedDocumentXmlbuildSelectionContextcalculateFootnoteReservedHeightscanRenderFontcollectFootnoteRefscolorsEqualconvertHeaderFooterToContentcountPageBreakscreateColumnBreakcreateDocumentWithTextcreateDocxcreateEmptyDocumentcreateHorizontalRulecreateLineBreakcreatePageBreakcreatePageBreakParagraphcreatePageBreakRuncreateRgbColorcreateSelectionFromDOMcreateThemeColordarkenColordetectVariablesdetectVariablesDetaileddetectVariablesInBodydetectVariablesInParagraphdocumentHasVariablesemuToPixelsemuToTwipsensureHexPrefixexecuteCommandexecuteCommandsextractFormattingFromElementextractVariablesFromTextfindPageBreaksfindParagraphByParaIdfindStartPosForParaIdfootnoteReservedHeightsEqualformatLastSaveTimeformatPxformatStorageSizeformatVariablegenerateThemeTintShadeMatrixgetAgentContextgetAutoSaveStatusLabelgetAutoSaveStorageSizegetContrastingColorgetDocumentSummarygetLoadedFontsgetSelectionRunsgetTemplateTagsgetThemeTintShadeHexhalfPointsToPixelshasPageBreakBeforehasTemplateVariablesinjectStylesinsertHorizontalRuleinsertPageBreakisAutoSaveSupportedisBlackisBreakContentisColumnBreakisFontLoadedisFontsLoadingisGoogleFontsEnabledisLineBreakisPageBreakisValidVariableNameisWhitelightenColorloadFontloadFontFromBufferloadFontsmapFootnotesToPagesonFontsLoadedparseColorStringparseDocxparseVariablepixelsToEmupixelsToTwipspointsToPixelspreloadCommonFontsprocessTemplateprocessTemplateAsBlobprocessTemplateDetailedregisterPluginsremovePageBreakremoveVariablesrepackDocxreplaceVariablesresolveColorresolveHighlightColorresolveHighlightToCssresolveShadingColorsanitizeVariableNameserializeDocumentBodyserializeDocxserializeSectionPropertiessetGoogleFontsEnabledstabilizeFootnoteLayouttoArrayBuffertwipsToEmutwipsToPixelsupdateMultipleFilesvalidatePatchSafetyvalidateTemplateClassesAutoSaveManagerDocumentAgentEditorCoordinatorErrorManagerLayoutCoordinatorPluginLifecycleManagerPluginRegistrySubscribableInterfacesAgentContextAgentContextOptionsAgentResponseAIActionRequestApplyStyleCommandAutoSaveManagerOptionsAutoSaveSnapshotBookmarkEndBookmarkStartCaretPosition_2CellCoordinatesClipboardSelectionColumnResizeStateComment_2CommentRangeEndCommentRangeStartCorePluginCreateEmptyDocumentOptionsDeleteTextCommandDeletionDocument_2DocumentBodyDocxPackageEditorCoordinatorOptionsEditorCoordinatorSnapshotEditorHandleEditorPluginCoreEndnoteErrorManagerSnapshotErrorNotificationExtendedSelectionContextFooterReferenceFootnoteFormatTextCommandHeaderFooterHeaderReferenceHyperlinkImage_2ImageSelectionInfoInsertHyperlinkCommandInsertImageCommandInsertionInsertPosition_2InsertTableCommandInsertTextCommandLayoutCoordinatorSnapshotListLevelMcpSessionMcpToolDefinitionMcpToolResultMoveFromMoveToNumberingDefinitionsPanelConfigParagraphParagraphContextParagraphFormattingPluginLifecycleConfigPluginLifecycleSnapshotPluginPanelPropsPosition_2PositionCoordinatesProcessTemplateOptionsProcessTemplateResultRange_2RelationshipRenderedDomContextReplaceTextCommandRunSavedDocumentDataSectionPropertiesSelectionContextSelectionContextOptionsSelectionRectSetVariableCommandShapeStabilizeFootnoteLayoutArgsStabilizeFootnoteLayoutResultStyleStyleDefinitionsSuggestedActionTableTableCellTableRowTableSelectionSnapshotTextBoxTextContentTextFormattingThemeThemeColorSchemeThemeFontThemeFontSchemeThemeMatrixCellTrackedChangeInfoVariableDetectionResultVariableOccurrenceType aliasesAgentCommandAIActionAutoSaveStatusBlockContentConvertFootnoteOptionsConvertHeaderFooterOptionsDocxInputEditorLoadingStateErrorSeverityFieldFlowBlockFootnoteContentFootnoteRefLocationHeaderFooterMetricsLayoutMcpToolHandlerMeasureMeasureBlocksFnPageParagraphContentRunContentTrackedRunChangeVariablesdocxtemplaterPluginFOOTNOTE_SEPARATOR_HEIGHTMAX_FOOTNOTE_LAYOUT_PASSESpluginRegistryrgbToHexVERSION