@docx-editor.dev/core/editor

@docx-editor.dev/core/editor — the editor facade and its chrome vocabulary.

createDocxEditor implements the full Editor contract over a paginated surface, and the chrome registry (CHROME_GROUPS, ChromeSlotId) is the toolbar taxonomy both adapters derive their default arrangement from. Enabled state has exactly one source — toolbarCommandState, which asks the engine — so a control and the engine can never disagree.

Functions (179)

alignmentAfterDirectionChangefunctionSource ↗

The physical alignment a paragraph shows after its direction flips, with its stored w:jc unchanged: leading and trailing edges trade sides. A dialog applies this to its Alignment field when Direction changes, so the field shows what OK will produce, the same result as the toolbar's direction buttons.

declare function alignmentAfterDirectionChange(alignment: ParagraphDialogFields['alignment']): ParagraphDialogFields['alignment'];

applyTableChromePickfunctionSource ↗

Build the engine command for one table chrome pick and the draft state after it. Target picks apply the current complete spec; none clears the active target only.

declare function applyTableChromePick(draft: TableChromeDraft, slot: TableChromeSlotId, value: unknown): TableChromePick | null;

applyThemeShadefunctionSource ↗

Blend toward black. keep is the fraction of the base colour retained (OOXML themeShade byte).

declare function applyThemeShade(hex: string, keep: number): string;

applyThemeTintfunctionSource ↗

Blend toward white. keep is the fraction of the base colour retained (OOXML themeTint byte).

declare function applyThemeTint(hex: string, keep: number): string;

bindHistoryGroupfunctionSource ↗

Bind native gesture events. Framework change handlers apply values; this binding ends groups. Native color change means value commitment, not portable popup closure. Controls without a terminal change event end on the next activation, Escape, blur, or disposal. Range/repeat controls end on pointer release/cancel or keyup, including outside releases. Terminal events close after propagation so the final value can use the same handle.

declare function bindHistoryGroup(editor: Editor, element: HTMLElement, config: HistoryGroupBindingOptions): HistoryGroupBinding;

blankDocumentBytesfunctionSource ↗

A blank document, freshly zipped per call (the caller may hand the bytes to a loader that takes ownership). Calibri 11pt and Word's Normal paragraph spacing are authored in w:docDefaults, Word's built-in style gallery in styles.xml, and US Letter geometry in the section. Word opens the saved file.

A right-to-left interface usually wants { direction: 'rtl', bidiLanguage: 'ar-SA' } (or the reader's own language), so the first paragraph is ready for right-to-left typing.

declare function blankDocumentBytes(options?: BlankDocumentOptions): Uint8Array;

bookmarkDialogInitialNamefunctionSource ↗

The name the dialog starts with: the visible bookmark the selection is in, or an empty name.

declare function bookmarkDialogInitialName(bookmarks: readonly BookmarkSummary[]): string;

bookmarkDialogNameStatefunctionSource ↗

Evaluate the name typed in the Bookmark dialog against the document's bookmarks. writable is whether the document accepts edits; Go To works either way.

declare function bookmarkDialogNameState(bookmarks: readonly BookmarkSummary[], name: string, writable: boolean): BookmarkDialogNameState;

bookmarkDialogRowsfunctionSource ↗

The bookmarks the dialog lists. Hidden bookmarks show only when asked for. Names sort without case and with numbers in order, and location sorts by document order.

declare function bookmarkDialogRows(bookmarks: readonly BookmarkSummary[], options: {
    readonly sortBy: BookmarkSortOrder;
    readonly showHidden: boolean;
}): readonly BookmarkSummary[];

calendarDateForKeyfunctionSource ↗

Calendar keyboard destination. Shift+PageUp/PageDown moves one year.

declare function calendarDateForKey(iso: string, key: string, locale?: string, shift?: boolean): string | null;

calendarDateFromTextfunctionSource ↗

Parse a complete ISO or regional numeric date; ambiguous two-digit years are refused.

declare function calendarDateFromText(text: string, locale?: string): string | null;

calendarDateTextfunctionSource ↗

Format an ISO date for numeric entry in the editor locale.

declare function calendarDateText(iso: string, locale?: string): string;

calendarMonthfunctionSource ↗

Build the six-week grid for one month.

Bounded by construction: 42 cells whatever the month, and every value is derived from the year and month numbers, never from document text.

declare function calendarMonth(year: number, month: number, options?: CalendarMonthOptions): CalendarMonth;

calendarMonthNamesfunctionSource ↗

The twelve Gregorian month names for a month selector.

declare function calendarMonthNames(locale?: string): readonly string[];

calendarMonthTitlefunctionSource ↗

Month-and-year title for a grid, formatted in the calendar locale.

declare function calendarMonthTitle(year: number, month: number, locale?: string): string;

calendarWeekdaysfunctionSource ↗

Seven weekday labels starting on the locale's first weekday.

declare function calendarWeekdays(locale?: string): readonly string[];

canExecuteImageCommandfunctionSource ↗

Whether an insert or replace would be accepted — the can half of the can-before-exec pair.

Refuses in suggesting mode, since an image property edit has no tracked-change representation.

declare function canExecuteImageCommand(command: Extract<EditorCommand, {
    type: 'insertImage' | 'replaceImage';
}>, surface: PaginatedSurface | null): CanResult;

captureImageMutationPreconditionsfunctionSource ↗

Snapshot the state an image mutation was planned against: mount generation, package revision, and the selection anchor.

Taken at the START of a drag so the commit can be checked against it with [isStaleImageInteractionCommit](isStaleImageInteractionCommit). A pointer gesture spans many frames, and a document that moved underneath it must not have the gesture's final coordinates applied to it.

declare function captureImageMutationPreconditions(editor: Pick<DocxEditorInstance, 'surface' | 'mountGeneration'>): ImageMutationPreconditions | null;

changedFieldsfunctionSource ↗

The submission: ONLY the fields that moved since the dialog opened.

Sending the whole form would flatten every setting the selection disagrees about. A mixed keepNext would become off on every paragraph, and a mixed left indent would become an explicit zero — which is worse than wrong, because a zero BLOCKS the style cascade where leaving the setting alone would let the style keep supplying it. An untouched field is not a decision, so it is not written.

Returns null when nothing moved, which the caller treats as "just close": an empty write would still push an undo entry that restores nothing.

declare function changedFields(seed: ParagraphDialogFields, current: ParagraphDialogFields, 
seedMixed?: ParagraphDialogMixed, 
currentMixed?: ParagraphDialogMixed): ParagraphFormatUpdate | null;

chromeControlCountfunctionSource ↗

Total controls, so a parity test can assert none were dropped.

declare function chromeControlCount(): number;

chromeMenuSlotsfunctionSource ↗

Every slot a menu places, in menu order, submenus flattened. What a parity test asserts against, and what a host enumerates to know which capabilities the menu bar reaches.

declare function chromeMenuSlots(): readonly ChromeSlotId[];

chromeProbeForSlotfunctionSource ↗

The probe a slot uses to ask "would the engine honour this right now?" when its real command needs an argument the slot itself cannot supply.

text.link is the case: whether this selection could become a link is the engine's question, but WHICH link is a URL field's. toolbarCommandState answers the slot from this probe and from whether a link UI is registered, and runToolbarCommand opens that UI, so chrome reads the slot like any other.

declare function chromeProbeForSlot(slotId: ChromeSlotId): EditorCommand | null;

chromeSlotIdfunctionSource ↗

The slot id of one control within its group. Only meaningful for entries of CHROME_GROUPS — the cast is sound because every group/control pair in the registry is, by construction, a member of the ChromeSlotId union.

declare function chromeSlotId(group: {
    readonly id: string;
}, control: {
    readonly id: string;
}): ChromeSlotId;

chromeSlotIsTogglefunctionSource ↗

Whether a slot's control renders as a TOGGLE — pressed or not — so it carries aria-pressed.

Shared rather than derived per adapter, because it is not derivable from the command table alone: the format painter has no fixed command (a press captures, arms, locks or stands down, which no single EditorCommand describes), so a rule that only read commandForSlot left it announcing nothing at all to a screen reader while it was armed.

declare function chromeSlotIsToggle(slotId: ChromeSlotId): boolean;

commandExecOptionsfunctionSource ↗

Ignore framework events passed to a command used directly as an event handler.

declare function commandExecOptions(value: unknown): EditorExecOptions | undefined;

commandForSlotfunctionSource ↗

The public editor command behind one chrome slot, or null when the slot is not wired to a command yet (parity-only chrome, or save — which is not a command). The single source of command truth for both adapters.

declare function commandForSlot(slotId: ChromeSlotId): EditorCommand | null;

commandForSlotValuefunctionSource ↗

The engine command for a VALUE-TYPED slot carrying the picked value, or null for a slot that does not take a value.

Two families: the run-property pickers (font.family, font.size, text.color, text.highlight) resolve to setMarkAttr, and styles.style resolves to setParagraphStyle — a paragraph styleId, not a mark. Either way the value is validated by the engine's own gate (can refuses a malformed one with invalidArgs; a styleId the document does not define is refused at exec), so a host can pass user input through unmodified.

declare function commandForSlotValue(slotId: ChromeSlotId, value: unknown): EditorCommand | null;

commandForTableChromeSlotValuefunctionSource ↗

Build an engine command for one table chrome slot using the caller's draft state.

declare function commandForTableChromeSlotValue(slotId: TableChromeSlotId, value: unknown, draft: TableChromeDraft): EditorCommand | null;

compareDocumentsErrorKeyfunctionSource ↗

The @docx-editor.dev/i18n key of the message for a refused compare: compareDocuments.reasons.<reason> when the refusal names a reason, else compareDocuments.errors.<code>.

declare function compareDocumentsErrorKey(refusal: {
    readonly code: CompareDocumentsErrorCode;
    readonly reason?: CompareDocumentsRefusalReason;
}): `compareDocuments.errors.${CompareDocumentsErrorCode}` | `compareDocuments.reasons.${CompareDocumentsRefusalReason}`;
```ts
const outcome = await session.apply({ revised });
if (!outcome.ok) showError(t(compareDocumentsErrorKey(outcome)));
```

composeFontConfigurationfunctionSource ↗

Merge a base and any number of fragments into one frozen FontConfiguration.

A bare fragment IS a valid base, so the single-origin case is one argument: composeFontConfiguration(await loadDefaultFonts()). Pass extra fragments to layer origins, and set epoch/maxFontBytes/defaultFont on the base only when you need something other than the documented defaults.

- Sources dedupe first-wins by (family, weight, style), in argument order — base before fragments, earlier fragments before later ones. - Substitutions dedupe first-wins by their from face, in the same order, and every substitution whose from face has a direct source anywhere in the composition is dropped: a real face always beats a stand-in. - The result is frozen (arrays included); the byte arrays themselves are the callers' and are not copied here — the resource snapshot takes its own defensive copy.

declare function composeFontConfiguration(base: FontConfigurationBase, ...fragments: readonly FontConfigurationFragment[]): FontConfiguration;

composeFontOriginsfunctionSource ↗

Resolve a list of [FontOrigin](FontOrigin)s against one document's needs and merge them, first-wins in list order.

Origins resolve IN ORDER, one after another, and each is told which faces the ones before it can already paint ([FontResolutionRequest.resolvedFaces](FontResolutionRequest.resolvedFaces)). Sequential rather than a Promise.all, and that is a real cost — one extra origin's latency on the critical path — bought deliberately: composition is first-wins, so a later origin's copy of a face an earlier one supplied can never be used, and fetching it anyway spends the bytes twice and tells a font host which families the document uses for a result that gets thrown away. Order origins cheapest-first.

A resolver that ignores resolvedFaces still composes correctly; it just spends more.

ONE ORIGIN CANNOT SINK THE REST. An origin that throws, answers null, or answers something malformed is reported and skipped whole, and the origins around it still compose — an app that listed a flaky network origin behind a bundled one keeps the bundled faces. Skipped WHOLE: an answer is read completely before any of it is committed, so a half-ingested origin can never reach composition.

The result carries NO epoch: it is a fragment for the engine to stamp with the load sequence. A fixed epoch from here would label every document's byte set as the same one. undefined means no origin contributed anything, which is a normal answer — the document stays on the fixed measurer.

declare function composeFontOrigins(origins: readonly FontOrigin[], request: FontResolutionRequest, options?: ComposeFontOriginsOptions): Promise<FontConfigurationFragment | undefined>;

computeImageResizeResultfunctionSource ↗

Resolve one resize frame from the pointer's current position.

Handles rotation and flips by mapping the SCREEN-space handle back to the drawing's local axes first: dragging the visually-right handle of a 90°-rotated image must change its stored height, and a flipped image's handles move in the opposite direction from where they appear.

declare function computeImageResizeResult(options: {
    readonly handle: ImageResizeHandle;
    readonly startWidthEmu: number;
    readonly startHeightEmu: number;
    readonly startBounds: {
        readonly x: number;
        readonly y: number;
        readonly width: number;
        readonly height: number;
    };
    readonly startPosition: DrawingPositionInput | null;
    readonly anchorFrameOrigin?: AnchorFrameOrigin | null;
    readonly deltaXPt: number;
    readonly deltaYPt: number;
    readonly transform: DrawingTransform;
    readonly preserveAspect: boolean;
    readonly kind: 'inline' | 'anchored';
}): ImageResizeResult;

computeMovedImagePositionfunctionSource ↗

The position a move drag produces, preserving the anchoring the file already used.

A frame-mode position keeps its relativeToH/relativeToV bases and only shifts the offsets it actually had — writing an offset the file omitted would re-anchor the drawing to a different reference and move it somewhere the drag never pointed.

declare function computeMovedImagePosition(start: DrawingPositionInput, deltaXPt: number, deltaYPt: number): DrawingPositionInput;

computeResizedImageExtentEmufunctionSource ↗

The extent a resize drag produces, in EMU.

Computed from the drag's START extent rather than the previous frame's, so a drag that reverses direction lands exactly where it began instead of accumulating rounding error.

preserveAspect behaves the way Word's handles do: a corner handle scales by whichever axis moved further, while an edge handle drives the other axis from the original ratio. Both axes are floored at one point, so a drag past the opposite edge cannot invert the image.

declare function computeResizedImageExtentEmu(startWidthEmu: number, startHeightEmu: number, handle: ImageResizeHandle, deltaWidthPt: number, deltaHeightPt: number, preserveAspect: boolean): {
    readonly cx: number;
    readonly cy: number;
};

contentControlPopupKeyDownfunctionSource ↗

Keep keyboard input inside a popup; Escape cancels and Tab wraps visible controls.

declare function contentControlPopupKeyDown(panel: HTMLElement, event: KeyboardEvent, cancel: () => void): void;

contentControlPopupOpenerfunctionSource ↗

Capture a popup's opener, with the editable pages as fallback when no control had focus.

declare function contentControlPopupOpener(anchor: HTMLElement | null): HTMLElement | null;

copyEditorStylesfunctionSource ↗

Copy every stylesheet of from into to, and keep copying the ones from adds later.

Covers <link rel="stylesheet"> and <style> elements added, changed or removed at any time; rules inserted into a same-origin <style> through the CSSOM (CSS-in-JS libraries in production), checked every 250 ms on the pop-out's own clock while it is open; constructed adoptedStyleSheets, checked the same way; and the theme attributes on <html> such as class and data-theme. Rules inserted into a <link> sheet, or any sheet of another origin, are not copied. Returns a function that stops the mirroring.

declare function copyEditorStyles(from: Document, to: Document): () => void;
```ts
const stop = copyEditorStyles(document, popup.document);
// Later, when the pop-out closes:
stop();
```

createBrowserAutomationHostfunctionSource ↗

An automation host over a live editor.

The editor keeps its own lifetime: dispose() on the returned host releases the change subscription this adapter took and leaves the editor mounted and editable.

save() validates pending form input. Invalid values and saves during an active edit return transaction-refused. For autosaving from change callbacks, use the asynchronous editor.save(), which waits for the active edit to finish.

declare function createBrowserAutomationHost(editor: DocxEditorInstance): BrowserAutomationHost;

createContentControlListNavigationfunctionSource ↗

Create bounded, locale-aware typeahead and roving focus for a popup's options.

declare function createContentControlListNavigation(locale?: string): ContentControlListNavigation;

createDocumentRefreshfunctionSource ↗

Get the engine-owned controller for updated DOCX files. React and Vue use the same controller. Transport and processor jobs belong to your application. This is a host API, not an Office.js document member.

declare function createDocumentRefresh(editor: DocxEditorInstance): DocumentRefresh;

createDocumentSearchfunctionSource ↗

The shared search session of an editor. Every call for the same editor returns the same session, so the Find pane and your code read and drive one search.

declare function createDocumentSearch(editor: Editor): DocumentSearch;
```ts
const search = createDocumentSearch(editor);
const stop = search.showHighlights('all');
search.find('Supplier', { wholeWord: true });
search.next();
```

createDocxEditorfunctionSource ↗

Build an editor: the full Editor contract over a paginated surface.

Construction is separate from mounting. Pass a container and the document mounts immediately; omit it and nothing touches the DOM until attach(el) — the provider-first shape. detach() parks the live document and a later attach(el) moves it in, with undo, selection and collaboration intact, even into another window (a pop-out or an iframe).

snapshot() is version-cached: the same reference until state actually moves, with reference-stable sub-objects, so it is safe as a useSyncExternalStore source.

declare function createDocxEditor(config: DocxEditorConfig): DocxEditorInstance;
```ts
const editor = createDocxEditor({ document: bytes, modules: [reviewModule()] });
editor.attach(element);
editor.on('change', () => setDirty(true));
```

createFontSourcefunctionSource ↗

Turn font bytes you ALREADY hold into a FontSource — a file input, IndexedDB, a bundler import. loadFonts covers URLs; this covers everything else, so no caller has to hand-assemble the record or reach for a hashing helper.

Returns a typed failure instead of throwing when the descriptor or the bytes are unusable, matching loadFonts: one bad face degrades itself, never its neighbours.

declare function createFontSource(bytes: Uint8Array, request: FontFaceRequest & {
    readonly faceIndex?: number;
}, options?: {
    readonly id?: string;
    readonly maxFontBytes?: number;
}): {
    readonly source: FontSource;
} | {
    readonly failure: FontLoadFailure;
};

createImageOverlayScrollPortfunctionSource ↗

An [ImageOverlayScrollPort](ImageOverlayScrollPort) over a real scroll container.

Reports the delta the element ACTUALLY scrolled, converted back to points — at the end of the document that is less than asked for, and the overlay must not move the image further than the page travelled.

declare function createImageOverlayScrollPort(scroller: HTMLElement, paintScale: number): {
    scrollBy(deltaYPoints: number): number;
};

createLayoutShapingfunctionSource ↗

declare function createLayoutShaping(configuration: FontConfiguration, instrumentation?: LayoutShapingInstrumentation, execution?: FontShapingOptions): Promise<LayoutShapingOptions>;

cropPercentFromCropPermillefunctionSource ↗

Permille crop → UI percent.

declare function cropPercentFromCropPermille(crop: ImageCropPermille): ImageCropPercent;

cropPercentFromPermillefunctionSource ↗

OOXML permille → UI percent.

declare function cropPercentFromPermille(permille: number): number;

cropPercentFromSourceCropfunctionSource ↗

Projection fraction (0–1) → UI percent (0–100).

declare function cropPercentFromSourceCrop(crop: SourceCrop): ImageCropPercent;

cropPermilleFromCropPercentfunctionSource ↗

UI percent crop → permille for tree ops / a:srcRect.

declare function cropPermilleFromCropPercent(crop: ImageCropPercent): ImageCropPermille;

cropPermilleFromPercentfunctionSource ↗

UI percent → OOXML permille.

declare function cropPermilleFromPercent(percent: number): number;

cssPixelsToLayoutPointsfunctionSource ↗

CSS pixels back to layout points — what a pointer event's coordinates must go through.

declare function cssPixelsToLayoutPoints(pixels: number, paintScale: number): number;

customFontsfunctionSource ↗

Supply application fonts without manual resolver wiring.

Loads all listed faces when the editor resolves fonts, including families the document does not use yet. This makes company fonts available in the font picker for new documents. Faces supplied by earlier origins are skipped by family, weight, and style; family matching ignores case. URLs always come from sources, never from document text.

Uses [loadFonts](loadFonts) for validation, optional hash checks, and browser caching. The editor registers the returned bytes under private aliases. This function does not change the document's selected fonts or register page-wide family names.

Constructing the resolver does not fetch. Cancellation of the document load rejects with signal.reason, without warnings or onFailure calls. Other face failures are reported once per resolution, and successful faces remain available to the editor.

ts const fonts = useFonts( customFonts({ sources: companyFontFiles, onFailure: reportFontFailure }), packagedFonts(), googleFonts(), );

Use [loadFonts](loadFonts) directly to load every listed face eagerly.

declare function customFonts(options: CustomFontsOptions): CustomFontsResolver;

defaultChromeGroupsfunctionSource ↗

The groups of the DEFAULT toolbar arrangement, in bar order: every group that is not contextual. This is the registry's default bar — undo/redo through the editing-mode picker — and what both adapters render when the host composes nothing. Contextual slots (image.*, table.insert, file.save) remain available for explicit composition.

declare function defaultChromeGroups(): readonly ChromeGroup[];

defaultTableLabelfunctionSource ↗

The English label for a furniture-insertion control.

The FALLBACK, for a host that has not wired its own translator — adapters pass their useTranslation result instead so the control follows the app's locale.

declare function defaultTableLabel(key: TableInteractionLabelKey): string;

deferFontsfunctionSource ↗

Load an origin's faces after the document first paints, instead of before.

The editor opens the document with the faces the other origins supply, then lays it out again when these arrive. Use it for faces that are large or slow to fetch. Leave an origin unwrapped to install its faces with the document's other waiting fonts: a large document (over about 512 KB of uncompressed content) waits up to 2 seconds for them before its first paint.

ts const fonts = [packagedFonts(), deferFonts(myBrandFonts())];

A document export that receives this origin waits for its faces, so exported pages use them. The faces never change the configuration settings, such as defaultFont or maxFontBytes: those come from the origins that answer at once, so the document does not change its default font after it paints.

declare function deferFonts(origin: FontOrigin): MarkedFontResolver;

defineFontResolverfunctionSource ↗

Mark a function as an on-demand [FontResolver](FontResolver).

Wrap every resolver you put in a fonts list — useFonts(...), useDocxSource's fonts option, composeFontOrigins. The fonts PROP needs no marking, because a function there is always a resolver; a list also accepts the older zero-argument loader form ({ fonts: defaultFonts }), and this is what keeps the two apart.

Returns the same function object, mutated, so the mark survives being passed around and a marked resolver stays === to itself. It does NOT survive .bind() or being wrapped: both make a new function object. Re-mark the result.

ts const brandFonts = defineFontResolver(async ({ families }) => ({ sources: await loadMine(families), }));

Throws a TypeError on a frozen or sealed function, which cannot take the mark. That is deliberate: returning it unmarked would compile — the return TYPE says marked — and then lose every font at runtime.

declare function defineFontResolver<T extends FontResolver>(resolve: T): MarkedFontResolver<T>;

disposeLayoutShapingfunctionSource ↗

Release native resources held by a shaping environment.

declare function disposeLayoutShaping(shaping: LayoutShapingOptions): void;

dragIndentfunctionSource ↗

The indent a drag of handle to positionTwips produces.

Clamps differ from the MARGIN drags this ruler also carries, and deliberately:

- Indents may go NEGATIVE, pulling text into the margin, which Word allows. The floor is the sheet edge, not the margin. - There is no minimum text width. The 720-twip floor the margin drags use mirrors an engine refusal that does not exist for indents, and enforcing one here would make a narrow pull-quote unreachable. Left and right markers may MEET; they may not cross. - The left box needs a first-line clamp of its own. It does not move firstLine, so on a hanging paragraph dragging the box left can push the first-line marker off the sheet while the box itself is still in range. The drag stops when the LEADING marker lands.

declare function dragIndent(handle: RulerIndentHandle, positionTwips: number, indent: RulerIndent, page: RulerPageMetrics, options?: RulerDragOptions): RulerIndent;

drawingPreviewDocxfunctionSource ↗

A small DOCX that holds one drawing from the editor's current document, including unsaved edits, for an external renderer. It equals createDrawingPreviewPackage on the document as a save would write it now; see that function for the page and renderer rules.

Pass an occurrence that an UnsupportedElement component receives, and the editor from useDocxEditor(), returning early on null. The call is synchronous and serializes the drawing's parts: make it in an effect keyed on element.source, not during render, and spread out or queue the calls when there are many drawings. By default a package copies at most 64 parts and 64 MiB; pass limits to change that.

declare function drawingPreviewDocx(editor: DocxEditorInstance, element: Pick<UnsupportedElement, 'ownerPartName' | 'nodeId'>, limits?: DrawingPreviewPackageLimits): DrawingPreviewPackageResult;

editorHostDocumentfunctionSource ↗

The document editor is mounted in: a pop-out window's or an iframe's when it is attached there. While the editor is detached, the script's own document.

Use it in custom chrome that is not inside the editor's own DOM, such as a toolbar popover, to add document listeners and to read focus.

declare function editorHostDocument(editor: Editor): Document;
```ts
const doc = editorHostDocument(editor);
doc.addEventListener('keydown', onShortcut);
```

editorHostElementfunctionSource ↗

The element editor is mounted in, or null while it is detached or headless.

Use it to tell which editor an event belongs to when several share a window.

declare function editorHostElement(editor: Editor): Element | null;
```ts
const mine = editorHostElement(editor)?.contains(event.target as Node) ?? false;
```

editorHostWindowfunctionSource ↗

The window editor is mounted in: its timers, frames, viewport size and clipboard. While the editor is detached, the script's own window.

declare function editorHostWindow(editor: Editor): HostWindow;
```ts
const win = editorHostWindow(editor);
await win.navigator.clipboard.writeText(text);
```

emuToOverlayPointsfunctionSource ↗

EMU to points. Unrounded, so overlay geometry keeps sub-point precision during a drag.

declare function emuToOverlayPoints(emu: number): number;

equationAtPositionfunctionSource ↗

Boundary-inclusive lookup, matching the hyperlink and field atom popovers.

declare function equationAtPosition(equations: readonly SurfaceEquation[], position: SemanticPosition): SurfaceEquation | null;

executeImageCommandfunctionSource ↗

Run an insert or replace, re-checking the same gates [canExecuteImageCommand](canExecuteImageCommand) applies.

Async because image bytes must be decoded to derive their natural extent before the drawing can be projected — the one editor command that cannot complete synchronously. It runs outside exec, so it reports a refusal to the editor's diagnostics itself.

declare function executeImageCommand(editor: DocxEditorInstance, command: Extract<EditorCommand, {
    type: 'insertImage' | 'replaceImage';
}>): Promise<ExecResult>;

finalizeImageOverlayInteractionfunctionSource ↗

Recompute the committed overlay result from release pointer coordinates.

declare function finalizeImageOverlayInteraction(options: {
    readonly session: ImageInteractionSession;
    readonly deltaXPt: number;
    readonly deltaYPt: number;
    readonly accumulatedScrollPt: number;
    readonly aspectLocked: boolean;
    readonly shiftKey: boolean;
    readonly textbox?: boolean;
    readonly anchorFrameOrigin: AnchorFrameOrigin | null;
}): FinalizedImageOverlayInteraction;

firstDayOfWeekfunctionSource ↗

First day of the week for a locale, as Date#getDay counts it (0 = Sunday).

Asks the runtime's week data when it has any, and otherwise falls back to a region table so a server without ICU week info still starts a US calendar on Sunday.

declare function firstDayOfWeek(locale?: string): number;

focusCompareDocumentsControlfunctionSource ↗

Move focus to the control that is useful at moment in a Compare documents dialog:

- busy: a compare started and Compare is disabled. Cancel when it stays enabled (a background compare), else the busy status, else the dialog itself. - refused: a compare was refused, or the file could not be read. The file input. - unchanged: the documents have no differences. Compare, else the file input.

The dialog's controls carry data-docx-part markers (cancel, apply) and the file field data-docx-field="revised". Focus never moves out of dialog.

declare function focusCompareDocumentsControl(dialog: HTMLElement | null | undefined, moment: 'busy' | 'refused' | 'unchanged'): void;

formatInchesfunctionSource ↗

Inches for DISPLAY, in the BROWSER's number format.

0.5 and 0,5 are the same measurement, and roughly half the locales this ships with write the second one. Interpolating a raw Number into a string picks the first for everyone. The catalogue supplies the surrounding words; this supplies the number.

Not the editor's locale: nothing in the i18n layer exposes one to read, so a German editor in an American browser still renders 0.5. The browser's guess beats a hardcoded . for every reader whose browser matches their language, which is most of them.

formatInches: (twips: number) => string

formattingBarChromeGroupsfunctionSource ↗

The formatting-bar groups for one editor snapshot: the default bar, the contextual image group when a drawing is selected, and the direction group when options.direction asks. Insertion without a selection lives in the packaged Insert menu (CHROME_MENUS), not in the bar — a host that wants a bar button places DocxEditor.Toolbar.ImageInsert itself.

declare function formattingBarChromeGroups(image: ImageContext | null, options?: FormattingBarOptions): readonly ChromeGroup[];

generateRulerTicksfunctionSource ↗

Ticks across one page dimension, matching the legacy cadence: eighth-inch minors with labelled inches, or millimetre minors with labelled centimetres.

declare function generateRulerTicks(lengthPx: number, unit: RulerUnit): RulerTick[];

goToBookmarkGroupsfunctionSource ↗

The rows of a Go To list grouped by place: the main text, then headers, footers, footnotes and endnotes. Places with no row are left out. Rows keep their order within a place.

declare function goToBookmarkGroups(rows: readonly BookmarkSummary[]): readonly GoToBookmarkGroup[];

goToBookmarkMatchfunctionSource ↗

Where the typed text sits in a bookmark name, compared without case, for showing the match. Null when the text is empty or the name does not contain it.

declare function goToBookmarkMatch(name: string, query: string): {
    readonly start: number;
    readonly end: number;
} | null;

goToBookmarkRowsfunctionSource ↗

The bookmarks a Go To name box offers for what was typed: those whose name contains it, compared without case, in the dialog's order. Names that start with it come first. An empty query offers every row. Sorted by location, the rows are in the order [goToBookmarkGroups](goToBookmarkGroups) shows them: by place first, so moving through the list follows the screen.

declare function goToBookmarkRows(bookmarks: readonly BookmarkSummary[], options: {
    readonly query: string;
    readonly sortBy: BookmarkSortOrder;
    readonly showHidden: boolean;
}): readonly BookmarkSummary[];

goToBookmarkTargetfunctionSource ↗

The bookmark a Go To name box means: the one whose name equals what was typed, compared without case, hidden or not; else the first row offered. Null when there is none.

declare function goToBookmarkTarget(bookmarks: readonly BookmarkSummary[], query: string, offered: readonly BookmarkSummary[]): BookmarkSummary | null;

handlePositionfunctionSource ↗

Where a handle sits, in twips from the page's LEFT SHEET EDGE (not the margin).

With indent.rtl, indent.left is the leading indent and sits on the right margin.

declare function handlePosition(handle: RulerIndentHandle, indent: RulerIndent, page: RulerPageMetrics): number;

historyShortcutOffunctionSource ↗

Which history step a keydown asks for, or null for any other key.

Ctrl+Y is the Windows redo; Ctrl/Cmd+Shift+Z is the macOS one. Both are accepted on every platform. Focused chrome, such as the picture selection overlay, calls this so history keys reach the editor instead of stopping at the control that holds focus.

declare function historyShortcutOf(event: HistoryShortcutKeys): 'undo' | 'redo' | null;

hostDocumentOffunctionSource ↗

The document that owns node, or the script's own document when node is absent. Without a DOM (server rendering) and without a node, this is undefined despite its type: call it from effects and event handlers, not during render.

Use it to add document-level listeners (selectionchange, pointerup, keydown) and to read activeElement for an editor that may live in another window.

declare function hostDocumentOf(node: Node | null | undefined): Document;
```ts
const doc = hostDocumentOf(menuElement);
doc.addEventListener('pointerdown', onOutsidePress, true);
```

hostTimersfunctionSource ↗

[HostTimers](HostTimers) bound to whatever window node() lives in when each call runs.

Use it for debounces and frames in chrome that can end up in a pop-out window: the opener's timers are throttled while it is hidden, and a pop-out's never run once it closes.

declare function hostTimers(node: () => Node | null | undefined): HostTimers;
```ts
const timers = hostTimers(() => panelElement);
let pending: number | null = null;
function schedule() {
  timers.clearTimeout(pending);
  pending = timers.setTimeout(refresh, 150);
}
```


 A window that goes away (a pop-out the user closes) never runs what is pending in it, and a dropped commit, notification or search is worse than a late one. So each window with pending work is watched for `pagehide`, and its pending timers and frames move to the window the node lives in by then, or to the script's own window.

hostWindowOffunctionSource ↗

The window that owns node: its timers, animation frames, observers and viewport size.

Falls back to the script's own window when the node's document has no window (an inert document from DOMParser, or a window that closed), and to globalThis without a DOM.

declare function hostWindowOf(node: Node | null | undefined): HostWindow;
```ts
const win = hostWindowOf(anchorElement);
const handle = win.setTimeout(close, 300);
const maxX = win.innerWidth - menuWidth;
```

inchesToTwipsfunctionSource ↗

inchesToTwips: (inches: number) => number

initialChromePrintSettingsfunctionSource ↗

The settings a print form starts with: the editor's current display mode, with comments shown, as the PDF converter does by default. All Markup prints comments in a pane beside each page. The other modes print them as PDF annotations on the commented text.

declare function initialChromePrintSettings(snapshot: Pick<EditorSnapshot, 'reviewDisplayMode'> | null | undefined): ResolvedChromePrintSettings;

initialSplitCellCountsfunctionSource ↗

The counts a Split cells dialog opens with: two columns, else two rows, else as many rows as a merged cell spans, whichever the engine honours first.

declare function initialSplitCellCounts(limits: SplitCellLimits | null, can: (command: Extract<EditorCommand, {
    type: 'splitCell';
}>) => CanResult): {
    readonly columns: string;
    readonly rows: string;
};

isChromePrintShortcutfunctionSource ↗

True for the print shortcut: Cmd+P on Apple platforms, Ctrl+P elsewhere. On macOS, Ctrl+P moves the caret to the previous line, so it is not a print shortcut there. The P key matches by code too when it types no Latin letter, as on Cyrillic or Hebrew layouts.

declare function isChromePrintShortcut(event: KeyboardEvent): boolean;

isDomNodefunctionSource ↗

Whether value is a DOM node of any window.

declare function isDomNode(value: unknown): value is Node;
```ts
if (isDomNode(event.target) && panel.contains(event.target)) return;
```

isElementNodefunctionSource ↗

Whether value is a DOM element of any window. Use it instead of instanceof Element, which is false for an element of a pop-out window or an iframe.

declare function isElementNode(value: unknown): value is Element;
```ts
if (isElementNode(event.target)) event.target.closest('[data-docx-hf]');
```

isFontResolverfunctionSource ↗

Whether a value is a function marked by [defineFontResolver](defineFontResolver).

False for an unmarked function, which callers read as a zero-argument loader. Calling a resolver that way reads request.defaultFamily off undefined and throws, so the callers that make this choice say so rather than swallowing it — and the type-level mark on [MarkedFontResolver](MarkedFontResolver) is there to stop it reaching runtime at all.

declare function isFontResolver(value: unknown): value is MarkedFontResolver;

isGoToChordfunctionSource ↗

The Go To chord: Ctrl+G, or Cmd+Option+G on Apple platforms. F5 is not used: browsers reload on it. Cmd+G alone is left to the browser's find-next on macOS.

declare function isGoToChord(event: KeyboardEvent, apple?: boolean): boolean;

isHTMLElementNodefunctionSource ↗

Whether value is an HTML (not SVG or MathML) element of any window.

declare function isHTMLElementNode(value: unknown): value is HTMLElement;
```ts
if (isHTMLElementNode(event.target)) event.target.focus();
```

isInputEventfunctionSource ↗

Whether event is an input or beforeinput event, from any window.

declare function isInputEvent(event: Event): event is InputEvent;
```ts
if (isInputEvent(event) && event.inputType === 'insertText') track(event.data);
```

isKeyboardEventfunctionSource ↗

Whether event is a keyboard event, from any window.

declare function isKeyboardEvent(event: Event): event is KeyboardEvent;
```ts
if (isKeyboardEvent(event) && event.key === 'Escape') close();
```

isMouseEventfunctionSource ↗

Whether event is a mouse (or pointer) event, from any window.

declare function isMouseEvent(event: Event): event is MouseEvent;
```ts
const point = isMouseEvent(event) ? { x: event.clientX, y: event.clientY } : null;
```

isoDateOffunctionSource ↗

Format a local date as YYYY-MM-DD.

declare function isoDateOf(date: Date): string;

isPointerEventfunctionSource ↗

Whether event is a pointer event, from any window.

declare function isPointerEvent(event: Event): event is PointerEvent;
```ts
if (isPointerEvent(event) && event.button !== 0) return;
```

isStaleImageInteractionCommitfunctionSource ↗

Whether a drag's commit should be refused because the document moved under it — the refusal to return, or null when the commit is still valid.

Checks the mount generation and both revisions captured by [captureImageMutationPreconditions](captureImageMutationPreconditions). A gesture spans many frames, so this is the one place that decides its coordinates still describe the document they were measured against.

declare function isStaleImageInteractionCommit(editor: Pick<DocxEditorInstance, 'surface' | 'mountGeneration'>, session: ImageInteractionSession): ExecResult | null;

isTableChromeSlotfunctionSource ↗

Whether a chrome slot is one of the table-only ones. Narrows the type.

declare function isTableChromeSlot(slot: ChromeSlotId): slot is TableChromeSlotId;

isTextNodefunctionSource ↗

Whether value is a DOM text node of any window.

declare function isTextNode(value: unknown): value is Text;
```ts
const anchor = selection.anchorNode;
const element = isTextNode(anchor) ? anchor.parentElement : anchor;
```

layoutPointsToCssPixelsfunctionSource ↗

Layout points to CSS pixels. Pair with [surfacePaintScale](surfacePaintScale) for the current zoom.

declare function layoutPointsToCssPixels(points: number, paintScale: number): number;

lineSpacingMenuRowLabelfunctionSource ↗

A row's visible label, with its number in locale's format (1,5 in German).

label resolves an i18n key without interpolation, as a toolbar's host translation does, so the {value} placeholder is filled here. Without a locale the number reads as text does.

declare function lineSpacingMenuRowLabel(row: LineSpacingMenuRow, label: (key: string) => string, locale?: string): string;

lineSpacingMenuRowsfunctionSource ↗

The line-spacing menu rows for the spacing in force.

A current multiple that is not a preset joins the list in order, ticked; a current exact or atLeast leads the list as its own ticked row. A selection whose paragraphs disagree (current null) ticks nothing, because no one row is true of all of it.

declare function lineSpacingMenuRows(current: SurfaceFormatting['lineSpacing']): readonly LineSpacingMenuRow[];

loadFontsfunctionSource ↗

Fetch app-specified font URLs into verified, cache-backed FontSources.

Fetches ONLY the URLs listed — never a default host or engine-chosen CDN — and never rejects for a per-source failure: the result carries every admitted source and a typed entry for every drop. Cancellation instead rejects with signal.reason. Compose the result with composeFontConfiguration.

declare function loadFonts(request: LoadFontsRequest): Promise<LoadFontsResult>;

lowerColorValueForBorderfunctionSource ↗

Lower a public colour for table border ops. Theme colours require a resolved literal for paint; auto preserves OOXML automatic semantics with a black render fallback.

declare function lowerColorValueForBorder(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;

lowerColorValueForFillfunctionSource ↗

Lower a public colour for cell fill. auto refuses because the cascade literal cannot be named honestly at commit time.

declare function lowerColorValueForFill(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;

mixedFieldsOffunctionSource ↗

A checkbox over a setting the selection disagrees about is INDETERMINATE, not unchecked — unchecked would claim the paragraphs agree it is off. The read reports null for exactly this, and a control that collapses it to a boolean throws the distinction away.

declare function mixedFieldsOf(format: ParagraphFormatRead): ParagraphDialogMixed;

mountPaginatedSurfacefunctionSource ↗

Mount a paginated surface over DOCX bytes.

Returns a typed rejection rather than throwing: a failure here is a property of the file, and a host must be able to tell "not a package" from "no body" without parsing an error message.

declare function mountPaginatedSurface(container: HTMLElement, bytes: Uint8Array, options?: PaginatedSurfaceOptions): OpenPaginatedResult;

observeContentControlPopupfunctionSource ↗

Follow scrolling, zoom, and size changes. Call the returned cleanup when the popup closes.

declare function observeContentControlPopup(panel: HTMLElement, anchor: HTMLElement): () => void;

observeUnsupportedElementsfunctionSource ↗

Observe placeholder mounts across repaint, pagination, and document replacement. The returned function disconnects the observer. Component mutations do not publish another list unless the engine's mount points change.

declare function observeUnsupportedElements(container: HTMLElement, listener: (hosts: readonly UnsupportedElementHost[]) => void): () => void;

openEditorWindowfunctionSource ↗

Open a pop-out window ready for the editor: same origin, styled like this page, with an empty mount point that fills it.

Resolves to null when the browser blocks the window, so call it from a user gesture such as a button click. The React DocxEditor.Window and Vue DocxEditorWindow components use it; call it directly when you mount the editor without an adapter.

declare function openEditorWindow(options?: OpenEditorWindowOptions): Promise<EditorWindow | null>;
```ts
const popup = await openEditorWindow({ title: 'Contract' });
if (popup) {
  editor.attach(popup.element);
  popup.onClose(() => editor.attach(homeElement));
}
```

overlayFrameToSheetCssPixelsfunctionSource ↗

Page-content frame → sheet-space CSS pixels (matches paintSelectionOverlay).

declare function overlayFrameToSheetCssPixels(layout: SemanticLayout, frame: OverlayFrameRect, coordinates: SurfaceOverlayCoordinates): {
    readonly left: number;
    readonly top: number;
    readonly width: number;
    readonly height: number;
};

overlayHostOriginfunctionSource ↗

Where the painted surface's box begins inside overlay chrome's containing block, in CSS pixels.

[overlayFrameToSheetCssPixels](overlayFrameToSheetCssPixels) produces coordinates relative to the surface element — the box the pages paint into — but overlay chrome portals OUTSIDE that element, and its absolutely positioned pieces resolve against the nearest positioned ancestor. The surface centres itself inside that ancestor with a stylesheet margin, so a frame placed without this origin lands at the far left of the viewport, one full centring margin off the image it rings. offsetLeft/offsetTop measure against the same positioned ancestor the chrome resolves against — every element between the two is static — which is what makes the two spaces agree.

declare function overlayHostOrigin(surfaceElement: HTMLElement | null): {
    readonly left: number;
    readonly top: number;
};

parseIsoDatefunctionSource ↗

Parse the leading YYYY-MM-DD of an ISO value as a LOCAL date, or null.

A control's w:fullDate is YYYY-MM-DDT00:00:00Z; only its calendar date matters here, and reading it through Date in a western time zone would show the previous day.

declare function parseIsoDate(value: string): Date | null;

partOfNodeIdfunctionSource ↗

The part a NODE lives in, WITHOUT opening a story store.

session.partFor(scope) resolves a scope by opening that story's store, and an open store is retained for as long as its part is in the package. The cap is 64. So routing a pure READ — "is this control locked", "what is its tab index" — through partFor spent a permanent slot per part touched, and an id naming no node at all still spent one, because the part name is matched from the id's prefix before anything is looked up. Sixty-four such reads and no further header could be opened for the rest of the session, silently.

Read straight from the live package instead. Ids carry the canonical part name, so this is a map lookup.

A collaboration session names the nodes it creates by logical id, which carries no part name. Those ids are looked up in each story part's node index, which opens no story store either. A view without storyParts has no session ids, so it answers null for them.

declare function partOfNodeId(session: Pick<TreeDocxSessionView, 'currentPackage' | 'part'> & Partial<Pick<TreeDocxSessionView, 'storyParts'>>, nodeId: string | undefined): OoxmlPart | null;

pointsToEmufunctionSource ↗

Points to EMU, rounded — EMUs are integral in the file.

declare function pointsToEmu(points: number): number;

positionContentControlPopupfunctionSource ↗

Place a popup against an anchor, within the viewport or its visible sheet.

declare function positionContentControlPopup(panel: HTMLElement, anchor: HTMLElement): void;

positionInputFromPropertiesCommandfunctionSource ↗

Extract the position input from an image-properties command, or null when it carries none.

declare function positionInputFromPropertiesCommand(command: {
    readonly horizontalEmu?: number;
    readonly verticalEmu?: number;
    readonly relativeToH?: string;
    readonly relativeToV?: string;
}, selected: {
    readonly position?: DrawingPositionInput | null;
} | null): DrawingPositionInput;

probeTableChromeCommandfunctionSource ↗

Probe command for Editor.can — uses the draft's active target and a well-formed value.

declare function probeTableChromeCommand(slot: TableChromeSlotId, draft?: TableChromeDraft): EditorCommand | null;

propertiesCommandHasPositionFieldsfunctionSource ↗

Whether an image-properties command carries any positioning fields at all.

declare function propertiesCommandHasPositionFields(command: {
    readonly horizontalEmu?: number;
    readonly verticalEmu?: number;
    readonly relativeToH?: string;
    readonly relativeToV?: string;
}): boolean;

readSplitCellCountsfunctionSource ↗

Read the typed column and row counts of a Split cells dialog.

declare function readSplitCellCounts(columns: string, rows: string, limits: SplitCellLimits | null): SplitCellCounts;

reportAutomationExceptionfunctionSource ↗

Report an editing API batch that threw an engine error, not a refusal, into the diagnostics of the editor it ran on: edit.internal-invariant with the error's class, never its message. Does nothing for an object that is not an editor.

declare function reportAutomationException(editor: object, error: unknown, tracked: boolean): void;

reportAutomationRefusalfunctionSource ↗

Report a refused editing API batch into the diagnostics of the editor it ran on. A runtime from DocxEditor.createBrowser calls this, so its refusals reach the editor's telemetry. Does nothing for an object that is not an editor. cause is the engine reason behind the refusal; a value the engine does not know is left out of the diagnostic.

declare function reportAutomationRefusal(editor: object, code: EditDiagnosticCode, tracked: boolean, cause?: string): void;

reportAutomationReviewSkipfunctionSource ↗

Report a tracked-change decision an editing API batch refused into the diagnostics of the editor it ran on, as one review.skipped event. cause is the structure behind the skip; a value the engine does not know is left out. Does nothing for an object that is not an editor.

declare function reportAutomationReviewSkip(editor: object, code: ReviewDiagnosticCode, operation?: ReviewOperation, cause?: string): void;

resizePreservesAspectfunctionSource ↗

Whether this handle drag should preserve aspect ratio.

declare function resizePreservesAspect(handle: ImageResizeHandle, aspectLocked: boolean, shiftKey: boolean, textbox?: boolean): boolean;

resolveColorValueToCssfunctionSource ↗

Resolve any public colour to a CSS #RRGGBB string for chrome display.

declare function resolveColorValueToCss(color: ColorValue | undefined | null, themeColors: readonly DocumentThemeColorEntry[], defaultHex?: string): string;

resolveEditorModulesfunctionSource ↗

Resolve construction-time modules into the registry the instance dispatches over.

declare function resolveEditorModules(modules: readonly EditorModule[] | undefined): EditorModuleRegistry;

resolveImageResourceLimitsfunctionSource ↗

Resolve caller overrides into frozen image limits; hard ceilings cannot be raised.

declare function resolveImageResourceLimits(overrides?: Partial<ImageResourceLimits>): ImageResourceLimits;

resolveReviewPanefunctionSource ↗

Merge options over base. Throws a TypeError for an unknown field or value, so a misspelled setting fails loudly instead of being ignored. Returns base itself when nothing changes, so the snapshot keeps its reference.

declare function resolveReviewPane(options: ReviewPaneOptions | undefined, base?: ResolvedReviewPane): ResolvedReviewPane;

resolveRevisionMarkupfunctionSource ↗

Validate and merge preferences without modifying the input.

declare function resolveRevisionMarkup(input?: RevisionMarkupOptions, previous?: ResolvedRevisionMarkup): ResolvedRevisionMarkup;

resolveSvgIntrinsicSizefunctionSource ↗

Intrinsic size of an SVG, resolved the way a browser sizes one: absolute width/height first, then viewBox for the missing axis or ratio, then the CSS 300x150 default.

This is metadata for insert and reset-to-natural-size only. Layout uses the authored wp:extent and the browser rasterizes into that box, so nothing here sizes an allocation and an out-of-range value is clamped rather than refused.

declare function resolveSvgIntrinsicSize(bytes: Uint8Array, limits: ImageResourceLimits): ValidatedRasterHeader | null;

resolveThemeColorHexfunctionSource ↗

Resolve a theme colour to literal hex. When both tint and shade are present, ECMA-376 §17.3.2.6 / §17.3.4 / §17.3.5 require tint precedence — shade is ignored for paint.

declare function resolveThemeColorHex(color: Extract<ColorValue, {
    kind: 'theme';
}>, themeColors: readonly DocumentThemeColorEntry[]): {
    ok: true;
    hex: string;
} | {
    ok: false;
    reason: string;
};

resolveZoomModefunctionSource ↗

Normalize the 'auto' shorthand a host may pass anywhere a [ZoomMode](ZoomMode) is accepted.

Returns null for a value that is neither, so callers refuse rather than silently substituting a mode the caller did not ask for.

declare function resolveZoomMode(mode: ZoomMode | 'auto'): ZoomMode | null;

reviewPaneListsItemfunctionSource ↗

Whether the review pane lists a card for item under revisionsIn.

With 'balloons', a balloon at the text shows every tracked change and every comment that replies to a tracked change, so the pane lists neither. Give the item as an unfiltered getReviewItems() read returns it: a query that excludes revision kinds removes parentRevisionId from replies to the changes it drops.

The engine applies this rule to every review item when it decides whether the pane opens by itself or closes after a settings change. A review pane must apply the same rule before its own filters, such as a hidden kind or a host filter. Those filters can hide every card, and then the pane that the engine opens is empty.

declare function reviewPaneListsItem(revisionsIn: RevisionDisplay, item: ReviewPaneItemFields): boolean;

rulerMarginTicksfunctionSource ↗

Horizontal ruler ticks counted from the margin the paragraph starts at: the left margin, or the right margin when indent.rtl is set. Labels count whole units outward on both sides, so the margin zone also reads 1, 2, and so on toward the sheet edge.

declare function rulerMarginTicks(page: RulerPageMetrics, indent: Pick<RulerIndent, 'rtl'>, unit: RulerUnit): RulerMarginTick[];

rulerPageBoxfunctionSource ↗

The first page's box, which the rulers measure against.

declare function rulerPageBox(pages: readonly {
    readonly index: number;
    readonly box: {
        width: number;
        height: number;
    };
}[]): {
    width: number;
    height: number;
} | null;

rulerTabPositionfunctionSource ↗

Where a tab stop sits, in twips from the page's left sheet edge. tabTwips counts from the paragraph's leading margin, as w:tab/@w:pos does: leftward from the right margin when indent.rtl is set.

declare function rulerTabPosition(tabTwips: number, page: RulerPageMetrics, indent: Pick<RulerIndent, 'rtl'>): number;

runChromeExportfunctionSource ↗

Saves the current document and converts those bytes through the configured handler. Missing handlers fail before saving. Conversion never changes the editor document. settings overrides the captured view for PDF conversion, such as print settings.

declare function runChromeExport(editor: Pick<Editor, 'save'> & Partial<Pick<DocxEditorInstance, 'snapshot' | 'getReviewAuthors'>>, format: ChromeExportFormat, handlers?: ChromeExportHandlers, settings?: ChromePrintSettings): Promise<ChromeExportResult>;

runChromePrintfunctionSource ↗

Saves the current document, converts it with the configured PDF handler, and prepares the result for printing. Uses the same handler and checks as File Export PDF, so a missing handler rejects with ChromeExportError before the document is saved. Saving commits pending form input and can refresh field results with an undo step. container receives the hidden print frame. For an editor inside a modal dialog, pass an element inside that dialog. settings carries the user's print settings, such as the display mode and whether comments print. Omitted settings keep the current view.

declare function runChromePrint(editor: Pick<Editor, 'save'> & Partial<Pick<DocxEditorInstance, 'snapshot' | 'getReviewAuthors'>>, handlers?: ChromeExportHandlers, container?: Document | Element, settings?: ChromePrintSettings): Promise<ChromePrintJob>;

runSavefunctionSource ↗

Save goes straight to Editor.save() — it is not a command.

declare function runSave(editor: Editor | null): Promise<ArrayBuffer>;

runTableChromeCommandfunctionSource ↗

Run one table chrome pick with explicit draft state; returns the post-pick draft on success.

declare function runTableChromeCommand(editor: Editor | null, slot: TableChromeSlotId, value: unknown, draft: TableChromeDraft): RunTableChromeCommandResult;

runTableCommandfunctionSource ↗

Run a table command: planner-backed can first, then exec only when allowed.

declare function runTableCommand(editor: Editor | null, command: EditorCommand, options?: EditorExecOptions): ExecResult;

runToolbarCommandfunctionSource ↗

Run a toolbar control: can first, then exec only if it said yes. Returns the engine's refusal untouched when it said no, so a caller cannot mistake a declined command for a no-op.

declare function runToolbarCommand(editor: Editor | null, id: ChromeSlotId): ExecResult;

runToolbarCommandfunctionSource ↗

declare function runToolbarCommand(editor: Editor | null, id: Exclude<ChromeSlotId, ToolbarValueSlot>, options: EditorExecOptions): ExecResult;

runToolbarCommandfunctionSource ↗

declare function runToolbarCommand<K extends keyof ToolbarValueMap>(editor: Editor | null, id: K, value: ToolbarValueMap[NoInfer<K>], options?: EditorExecOptions): ExecResult;

runToolbarCommandfunctionSource ↗

declare function runToolbarCommand(editor: Editor | null, id: TableChromeSlotId, value: unknown, options?: EditorExecOptions): ExecResult;

runToolbarCommandfunctionSource ↗

declare function runToolbarCommand(editor: Editor | null, id: ChromeSlotId, value: undefined, options: EditorExecOptions): ExecResult;

sameTabStopsfunctionSource ↗

Whether two stop lists say the same thing. A list needs more than reference equality. *

declare function sameTabStops(a: readonly ParagraphTabStop[], b: readonly ParagraphTabStop[]): boolean;

sameZoomModefunctionSource ↗

Whether two modes say the same thing.

snapshotsEqual compares zoomMode by IDENTITY, and a host's zoomMode prop is an object — <DocxEditor zoomMode={{ type: 'fit', fit: 'pageWidth' }} /> is a fresh literal on every render, which is the spelling the docs show. Without a value comparison somewhere, each of those renders reinstalled the observer, refitted, bumped the tick, and re-rendered every useEditorState consumer in the tree — including the page selector that the slice memoization exists to keep asleep. The lane holds its object and compares by value here.

declare function sameZoomMode(a: ZoomMode, b: ZoomMode): boolean;

seedFieldsfunctionSource ↗

Open the form on the selection.

A null field means the selection DISAGREES about that setting. There is no third checkbox state to show it with, so the control opens on the least surprising value and [changedFields](changedFields) keeps the disagreement alive by not writing what the user did not touch. widowControl opens ON because that is the Word default a document inherits when nothing says otherwise.

declare function seedFields(format: ParagraphFormatRead): ParagraphDialogFields;

selectedDrawingOverlayTargetOffunctionSource ↗

The painted geometry of the selected drawing, for the resize/move overlay — or null.

Stricter than [selectedImageStateOf](selectedImageStateOf): it also requires a COLLAPSED selection, because a range that merely contains a drawing is a text selection, and drawing handles over it would claim an object the user did not single out.

declare function selectedDrawingOverlayTargetOf(surface: PaginatedSurface | null): SelectedDrawingOverlayTarget | null;

selectedImageStateOffunctionSource ↗

The selected image and what may be done to it, or null when nothing image-like is selected.

Unsupported placeholders, hidden drawings, and select-locked drawings cannot be selected.

declare function selectedImageStateOf(surface: PaginatedSurface | null): SelectedImageState | null;

shiftMonthfunctionSource ↗

The month after or before (year, month), wrapping the year.

declare function shiftMonth(year: number, month: number, delta: 1 | -1): {
    readonly year: number;
    readonly month: number;
};

signedFirstLineOffunctionSource ↗

Fold the "Special" pair back into the ONE signed value the engine takes. *

signedFirstLineOf: (kind: SpecialIndent, magnitudeTwips: number) => number

snapTwipsfunctionSource ↗

Round to the ruler's grid, or to the twip when the drag is precise.

declare function snapTwips(value: number, unit: RulerUnit, precise: boolean): number;

sniffImageMimefunctionSource ↗

Signature sniffing — authoritative over declared content type.

declare function sniffImageMime(bytes: Uint8Array): RenderableImageMime | PreservedImageMime | 'unknown';

sourceCropFromCropPercentfunctionSource ↗

UI percent (0–100) → projection fraction (0–1).

declare function sourceCropFromCropPercent(crop: ImageCropPercent): SourceCrop;

specialOffunctionSource ↗

specialOf: (signedTwips: number | null) => SpecialIndent

storyLabelTopfunctionSource ↗

Where to place the label bar of an open header, footer, or note, in viewport pixels.

The bar sits just above its story. A story with no room above it on its sheet, such as a header that starts at the paper edge, takes the bar just below it instead, so the bar never covers the gap between sheets or the ruler.

declare function storyLabelTop(storyRect: {
    readonly top: number;
    readonly bottom: number;
}, sheetTop: number | undefined, barHeight: number, clearance: number): number;
```ts
const top = storyLabelTop(band.getBoundingClientRect(), sheet.getBoundingClientRect().top, 28, 6);
```

surfaceExtentfunctionSource ↗

declare function surfaceExtent(layout: SemanticLayout, materialize: ReadonlySet<number> | undefined): SurfaceExtent;

surfacePaintScalefunctionSource ↗

Points → CSS pixels at the given zoom (matches mountPaginatedSurface / semantic paint).

declare function surfacePaintScale(zoom: number): number;

tableChromeIconPathsfunctionSource ↗

Material Symbol paths for one table chrome icon name.

declare function tableChromeIconPaths(name: keyof typeof GENERATED_ICON_PATHS): readonly string[];

tableChromeLabelKeyForTargetfunctionSource ↗

The i18n key naming one border target, for a trigger that shows the active scope.

Falls back to the "all" key rather than throwing: a label is chrome, and a missing one should not take the toolbar down.

declare function tableChromeLabelKeyForTarget(target: TableBorderEdgeTarget): string;

tableChromeToolbarStatefunctionSource ↗

Enabled state for one table chrome slot using explicit draft state.

declare function tableChromeToolbarState(editor: Editor | null, slot: TableChromeSlotId, draft?: TableChromeDraft): ToolbarCommandState;

tableChromeVisiblefunctionSource ↗

Contextual table chrome is visible when the engine reports table context.

declare function tableChromeVisible(table: TableContext | null | undefined): boolean;

tableCommandStatefunctionSource ↗

Planner-backed can/plan pair — production gate for table commands. Task 9 maps chrome slots.

declare function tableCommandState(command: EditorCommand, surface: PaginatedSurface): {
    readonly can: CanResult;
    readonly plan: TableCommandPlan;
};

tableCommandToolbarStatefunctionSource ↗

Enabled state for a table command when the caller holds the paginated surface.

Uses the same planner-backed tableCommandState as Editor.can/gateTableCommand. Chrome slot mapping for table controls is Task 9 — this helper is the shared can-before-exec seam for arbitrary table commands.

declare function tableCommandToolbarState(surface: PaginatedSurface | null, command: EditorCommand): Pick<ToolbarCommandState, 'enabled' | 'disabledReason'>;

textboxFrameReasonfunctionSource ↗

The message key saying why a selected text box frame takes no caret or offers no handles, or null when it does both. Not in viewing mode: viewing refuses the edit itself, so the box is not what stops it.

declare function textboxFrameReason(target: {
    readonly textbox?: boolean;
    readonly textEditable?: boolean;
    readonly canMove: boolean;
    readonly canResize: boolean;
}, editingMode: string): 'imageOverlay.textLocked' | 'imageOverlay.locked' | null;
```ts
const key = textboxFrameReason(target, editor.surface!.editingMode());
const title = key ? t(key) : undefined;
```

toEditorFontErrorfunctionSource ↗

declare function toEditorFontError(error: unknown): EditorFontError;

toolbarCommandStatefunctionSource ↗

Ask the engine whether one control should be enabled.

declare function toolbarCommandState(editor: Editor | null, id: ChromeSlotId): ToolbarCommandState;

toolbarCommandStatesfunctionSource ↗

Enabled state for several controls in one pass.

declare function toolbarCommandStates(editor: Editor | null, ids: readonly ChromeSlotId[]): readonly ToolbarCommandState[];

trapTabWithinfunctionSource ↗

Keep Tab inside the dialog.

aria-modal tells assistive tech the rest of the page is inert; it does not stop Tab, so without this the third Tab lands on the document behind the dialog — which is the editable surface, so the next keystroke types into the paragraph being formatted.

Returns true when the event was handled, so a caller only has to call preventDefault.

declare function trapTabWithin(panel: HTMLElement, event: KeyboardEvent): boolean;

twipsToInchesfunctionSource ↗

twipsToInches: (twips: number) => number

unsupportedElementRuleMatchesfunctionSource ↗

Whether a rule claims an occurrence. Adapters use it to pick the first matching declaration; hosts with their own registration can use it the same way.

declare function unsupportedElementRuleMatches(rule: UnsupportedElementRule, element: UnsupportedElement): boolean;

validateDrawingPositionInputfunctionSource ↗

Validate a position input, refusing offsets or bases outside what OOXML allows.

declare function validateDrawingPositionInput(position: DrawingPositionInput): boolean;

validateImageCropPercentfunctionSource ↗

Whether a crop is expressible: every edge finite and in range, and opposite edges not overlapping.

Opposite edges matter — a left plus right crop summing past 100% describes a negative width, which DrawingML has no way to store.

declare function validateImageCropPercent(crop: ImageCropPercent): boolean;

validateRasterHeaderfunctionSource ↗

Validate a raster image's header structurally and report its real MIME type and extent.

Content type is a CLAIM; this is what makes it a fact. A file declaring image/png over JPEG bytes is caught here rather than at decode.

declare function validateRasterHeader(bytes: Uint8Array, mime: SupportedImageMime): ValidatedRasterHeader | null;

validateSetImagePositionCommandfunctionSource ↗

Validate a set-position command before it reaches the store.

declare function validateSetImagePositionCommand(command: {
    readonly horizontalEmu?: number;
    readonly verticalEmu?: number;
    readonly relativeToH?: string;
    readonly relativeToV?: string;
}, mode: 'frame' | 'simple'): boolean;

validateThemeModifierfunctionSource ↗

Clamp and validate an OOXML theme modifier fraction (0, 1].

declare function validateThemeModifier(value: unknown): value is number;

watchHighlightsfunctionSource ↗

Highlight a named set and keep it current as the document changes.

declare function watchHighlights(editor: Editor, name: string, source: HighlightSource, options?: WatchHighlightsOptions): HighlightWatch;
```ts
const glossary = watchHighlights(editor, 'glossary', (editor) =>
  editor.findMatches(terms, { wholeWord: true }).flat()
);
// Later:
glossary.stop();
```

watermarkShapeBoxfunctionSource ↗

The shape box, in points, that setWatermark writes for watermark on a page whose text area (page size less margins) is area. The box is centered on the text area, and a diagonal text box turns 45 degrees counterclockwise about its center. Null when the options name no text and no readable picture. Pass a measurer for the exact text advance; without one the advance is an estimate.

declare function watermarkShapeBox(watermark: Watermark, area: WatermarkSize, measurer?: TextMeasurer): WatermarkSize | null;
```ts
const box = watermarkShapeBox({ text: 'DRAFT' }, { width: 468, height: 648 });
```

withTabStopfunctionSource ↗

Add one stop, replacing any stop already at that position, and keep the list sorted. *

declare function withTabStop(stops: readonly ParagraphTabStop[], stop: ParagraphTabStop): readonly ParagraphTabStop[];

Classes (3)

ChromeExportErrorclassSource ↗

An export has no configured converter.

declare class ChromeExportError extends Error
MemberTypeSummary
(constructor)Constructs a new instance of the `ChromeExportError` class
code
formatChromeExportFormat

ChromePrintErrorclassSource ↗

The browser could not print the converted PDF. The PDF at ChromePrintJob.url is still available, so the user can open it and print from the PDF viewer.

declare class ChromePrintError extends Error
MemberTypeSummary
(constructor)Constructs a new instance of the `ChromePrintError` class
codeChromePrintErrorCodeWhy the browser could not print.

DocumentRefreshErrorclassSource ↗

A capture failure with a stable code. applyUpdate() failures use RefreshResult instead.

declare class DocumentRefreshError extends Error
MemberTypeSummary
(constructor)Constructs a new instance of the `DocumentRefreshError` class
codeRefreshFailureCodeMachine-readable reason.

Interfaces (182)

AnchorFrameOrigininterfaceSource ↗

Where an anchored drawing's positioning frame begins, in layout points.

An anchored drawing's offsets are relative to a base the file names (page, margin, column, …), so a move drag needs that base's origin to turn a pointer delta into a stored offset.

interface AnchorFrameOrigin
MemberTypeSummary
xnumber
ynumber

AnchorHighlightAnimationinterfaceSource ↗

Opacity fade settings. Reduced motion limits fades to 125 milliseconds.

interface AnchorHighlightAnimation
MemberTypeSummary
durationMs?numberFade duration in milliseconds. Default: 180. Must be finite and between 0 and 10000.
easing?stringCSS timing function for both fades. Defaults to --doc-motion-ease-out. This option does not accept CSS variables.
exitDurationMs?numberAutomatic and explicit exit fade duration. Defaults to durationMs. Range: 0 through 10000.

AnchorHighlightOptionsinterfaceSource ↗

Presentation for temporary paragraph highlights. Each call starts from these defaults. Document refresh RefreshHighlightOptions extends this type, so one style object serves both.

interface AnchorHighlightOptions
MemberTypeSummary
animation?boolean | AnchorHighlightAnimationDefault: true, a 180-millisecond fade. False disables motion. Repeated calls for the same paragraph do not restart the fade.
borderColor?stringCSS border color. Defaults to color. Use an alpha color for a translucent border; opacity controls only the fill.
borderRadius?numberCorner radius in CSS pixels at 100% zoom. Default: 6. Must be finite and nonnegative.
borderStyle?'solid' | 'dashed' | 'dotted'Border pattern. Default: solid.
borderWidth?numberBorder width in CSS pixels at 100% zoom. Default: 0. Finite and nonnegative.
className?stringOptional CSS classes for shadows or patterns. The editor controls highlight placement and size.
color?stringCSS color, including var(). Default: a light blue theme token, var(--doc-anchor-highlight-color) for anchors and var(--doc-refresh-highlight-color) for refresh.
opacity?numberFill opacity, from 0 to 1. Default: 0.14. Does not change document text opacity.
padding?numberExtra space on each edge, in CSS pixels at 100% zoom. Default: 4. Must be finite and nonnegative.
timeoutMs?number | nullMilliseconds before dismissal starts. Default: 3000. Set `null` to keep highlights until you dismiss them. Maximum: 2147483647.

AttachOptionsinterfaceSource ↗

How [DocxEditorInstance.attach](DocxEditorInstance.attach) moves an open document.

interface AttachOptions
```ts
// Bring the editor home from a pop-out and keep typing there.
editor.attach(mainSlot, { focus: true });
```
MemberTypeSummary
focus?booleanFocus the pages after the move, so the caret shows and typing continues. Default: focus returns only when the pages had it before the move or the `detach()`. A first mount from bytes does not take focus.

BlankDocumentOptionsinterfaceSource ↗

How a blank document starts.

interface BlankDocumentOptions
MemberTypeSummary
bidiLanguage?stringThe language of right-to-left and complex-script text, as a BCP 47 tag such as `ar-SA` or `he-IL`, written as the run defaults' `w:lang/@w:bidi`. Layout follows it: European digits in an Arabic-script language draw in the Latin face. A value that is not a language tag is ignored.
direction?'ltr' | 'rtl'`'rtl'` starts the document right to left: its paragraphs (`w:bidi` in the paragraph defaults) and its section (`w:sectPr/w:bidi`) read right to left, as a new document does when a right-to-left editing language is the default. `'ltr'` is the default.

BookmarkChromeHandlersinterfaceSource ↗

Host chrome for bookmarks.

interface BookmarkChromeHandlers
MemberTypeSummary
onRequest?() => voidOpen the Bookmark dialog for the selection: the `openBookmarkDialog` command, which the Insert menu row and Ctrl/Cmd+Shift+F5 send.

BookmarkDialogNameStateinterfaceSource ↗

What the typed name allows in the Bookmark dialog.

interface BookmarkDialogNameState
MemberTypeSummary
canAddbooleanAdd bookmarks the selection under the name; an existing bookmark moves.
canDeletebooleanDelete and Go To act on an existing bookmark.
canGoToboolean
existingBookmarkSummary | nullThe bookmark the name already belongs to, compared without case, or null.
problemBookmarkNameProblem | nullWhy Add cannot use the name, or null when it can. Hidden names cannot be added.

BookmarkMarkInfointerfaceSource ↗

One painted bookmark mark, as BookmarkMarkOptions callbacks see it.

interface BookmarkMarkInfo
MemberTypeSummary
edge'start' | 'end' | 'point'Which mark this is: the start bracket, the end bracket, or a point bookmark's I-beam.
hiddenbooleanWhether the name starts with an underscore.
namestringThe bookmark's name as the document writes it.
storyBookmarkStoryThe story the bookmark is in.

BookmarkMarkOptionsinterfaceSource ↗

How Show bookmarks paints its marks. Register with setBookmarkMarks.

interface BookmarkMarkOptions
MemberTypeSummary
decorate?(element: HTMLElement, mark: BookmarkMarkInfo) => HTMLElement | voidAdjust each mark before it is placed: add a class, a `title` tooltip, or attributes. Return another element to replace the mark. The editor positions whatever comes back. Marks ignore the pointer; set `pointer-events: auto` on a mark that shows a tooltip.
include?'visible' | 'all' | ((bookmark: Omit<BookmarkMarkInfo, 'edge'>) => boolean)Which bookmarks get marks: `'visible'` (the default) skips hidden bookmarks, `'all'` includes them, and a function decides per bookmark.
print?booleanKeep the marks when the browser prints the page. Exports never include them.

BookmarkMarkOptionsSourceinterfaceSource ↗

The surface's view of the mark options.

interface BookmarkMarkOptionsSource
MemberTypeSummary
current() => BookmarkMarkOptions
onChange(repaint: (() => void) | null) => voidName the repaint to run when the options change. One slot: a remount replaces it.
reportError(error: unknown) => voidReport an error a host callback threw while marks were painted.

BrowserAutomationHostinterfaceSource ↗

An automation host over a live editor.

interface BrowserAutomationHost extends AutomationHost

CalendarDayinterfaceSource ↗

One cell of a month grid.

interface CalendarDay
MemberTypeSummary
daynumberDay of the month, 1-based.
isostringLocal calendar date as `YYYY-MM-DD`.
labelstringAccessible name, spelled out in the calendar locale.
otherMonthbooleanThe cell pads the grid from the previous or next month.
selectedbooleanThe cell is the control's current value.
todaybooleanThe cell is the current local date.

CalendarMonthinterfaceSource ↗

A six-week month grid plus its labels.

interface CalendarMonth
MemberTypeSummary
daysreadonly CalendarDay[]Exactly 42 cells, so the pop-up keeps one height across months.
monthnumberZero-based, like `Date#getMonth`.
titlestringMonth and year, formatted in the calendar locale.
weekdaysreadonly string[]Seven weekday labels, starting on the locale's first day of the week.
yearnumber

CalendarMonthOptionsinterfaceSource ↗

Inputs for [calendarMonth](calendarMonth).

interface CalendarMonthOptions
MemberTypeSummary
locale?stringBCP 47 tag; an unsupported tag falls back to `en-US`.
selected?string | nullThe control's current value as `YYYY-MM-DD`, or empty.
today?DateThe reference "today"; defaults to the current local date.

ChromeControlinterfaceSource ↗

One toolbar control as the registry describes it — what it renders as, never whether it is enabled.

Enabled state has exactly ONE source, toolbarCommandState, which asks the engine. A descriptor carrying its own disabled flag would be a second answer that goes stale the moment the engine wires the slot.

interface ChromeControl<Id extends string = string>
MemberTypeSummary
defaultToolbar?false`false` keeps this public slot composable but omits it from the default toolbar.
idIdStable control id, unique WITHIN its group. Public API; renames are breaking.
labelKeystringi18n key for the accessible name and tooltip. Never hardcoded English.
pathsreadonly string[] | nullMaterial Symbols path data, or null for a non-icon control (a picker).
shape?ChromeControlShapeHow it renders. Defaults to `icon`.
stateChromeControlState
swatch?stringSwatch colour for a `colorSplit` control.
valueKey?stringFor pickers: the i18n key of the placeholder value shown.
valueText?stringDisplayed value for a stepper or dropdown (an i18n key, or a literal for numbers).

ChromeExportHandlersinterfaceSource ↗

Conversion handlers for File Export. Install the corresponding converter package. Use exportMarkdown for Markdown. PDF requires exportPdf on a Node.js server. Browser hosts supply a PDF handler that calls that server after the user selects Export.

interface ChromeExportHandlers
MemberTypeSummary
markdown?(source: Uint8Array) => Promise<{ readonly markdown: string; }>Returns continuous document Markdown. Page output is not downloaded.
pdf?(source: Uint8Array, view?: ChromeExportView) => Promise<{ readonly bytes: Uint8Array; }>Returns PDF bytes from `@docx-editor.dev/docx-to-pdf` on Node.js.

ChromeExportResultinterfaceSource ↗

Download data from a completed conversion.

interface ChromeExportResult
MemberTypeSummary
bytesUint8Array
extension'md' | 'pdf'
mimeTypestring

ChromeExportViewinterfaceSource ↗

Viewer settings captured before PDF conversion.

interface ChromeExportView
MemberTypeSummary
comments?booleanWhether the PDF shows comments. Set from the print settings the user chose. Pass it to `exportPdf` as `comments`. Absent means the converter default, which shows comments.
displayModeReviewDisplayMode
revisionAuthorSlots?Readonly<Record<string, number>>Stable session slots, including gaps left by removed authors.
revisionMarkupResolvedRevisionMarkup

ChromeGroupinterfaceSource ↗

One toolbar group: the taxonomy both adapters derive their default arrangement FROM.

Never hand-list controls in an adapter — a default toolbar is built by walking CHROME_GROUPS, so a slot added here appears in React and Vue without either being edited.

interface ChromeGroup<Id extends string = string, ControlId extends string = string>
MemberTypeSummary
contextual?trueNot part of the DEFAULT toolbar arrangement. The chrome spec shows these controls only in a context the engine does not model yet (an image or table selection), or not at all (save belongs in the host's File menu, never in the bar). Their slots stay public for composition — a host can still place `image.insert` or `file.save` explicitly — but the default chrome is the registry's default bar, which ends at the editing-mode picker.
controlsreadonly ChromeControl<ControlId>[]
idIdStable group id. Public API; renames are breaking.
labelKeystring

ChromeMenuinterfaceSource ↗

One menu of the menu bar.

interface ChromeMenu
MemberTypeSummary
entriesreadonly ChromeMenuEntry[]
idChromeMenuId
labelKeystring

ChromeMenuItemEntryinterfaceSource ↗

A row that runs one chrome slot.

interface ChromeMenuItemEntry
MemberTypeSummary
kind'item'
labelKey?stringPlain-label override for this row.
picker?'tableGrid'The row opens a size PICKER instead of firing on click — Word's insert-table grid. The slot still owns the label, the icon and the enabled state; only the dispatch differs, and the picked size is what the host sends.
shortcutKey?stringi18n key of the shortcut shown right-aligned on the row (`toolbar.saveShortcut`).
slotChromeSlotId

ChromeMenuSeparatorEntryinterfaceSource ↗

A horizontal rule between groups of rows.

interface ChromeMenuSeparatorEntry
MemberTypeSummary
kind'separator'

ChromeMenuSubmenuEntryinterfaceSource ↗

A row that opens a nested panel of rows (Insert › Break).

It carries its own label and icon rather than a slot, because a submenu PARENT has no command: clicking it opens the panel. Giving it a slot would mint a public id for a control that can never be enabled, and toolbarCommandState would have to invent an answer about it.

interface ChromeMenuSubmenuEntry
MemberTypeSummary
itemsreadonly ChromeMenuEntry[]
kind'submenu'
labelKeystring
pathsreadonly string[] | null

ChromePrintJobinterfaceSource ↗

A converted PDF, ready for the browser print dialog. Call dispose() when the job ends: it removes the print frame and revokes url.

interface ChromePrintJob
MemberTypeSummary
disposeRemoves the print frame and revokes `url`. Later `print()` calls reject.
printOpens the browser print dialog for the PDF from a hidden frame. Rejects with `ChromePrintError` when the browser has no PDF viewer, the frame cannot load the PDF, or the job has ended. A browser without a PDF viewer would download the PDF instead of loading it, so the frame is not created in that case.
urlstringAn object URL for the PDF. It stays valid until `dispose()`.

ChromePrintOptionsinterfaceSource ↗

Options for ChromePrintJob.print.

interface ChromePrintOptions
MemberTypeSummary
beforePrint?() => void | Promise<void>Runs after the PDF loads and before the print dialog opens. Close any modal dialog here: a modal dialog makes the rest of the page, including the print frame, inert.

ChromePrintSettingsinterfaceSource ↗

Settings the user picks before printing. Each omitted setting keeps the editor's current view: the review display mode, and comments shown.

interface ChromePrintSettings
MemberTypeSummary
comments?booleanWhether the PDF shows comments. All Markup prints them in a pane beside each page; the other modes print them as annotations on the commented text.
displayMode?ReviewDisplayModeWhich markup prints, as on the Review tab.

ClearAnchorHighlightOptionsinterfaceSource ↗

Explicit highlight dismissal.

interface ClearAnchorHighlightOptions
MemberTypeSummary
animation?boolean | AnchorHighlightAnimationDefaults to the last highlight call's exit animation. False removes highlights immediately.

CollaborationModuleContributioninterfaceSource ↗

What a collaboration module contributes: the replica the surface attaches.

interface CollaborationModuleContribution
MemberTypeSummary
sessionEditorCollaborationSessionA ready session. The host creates the Yjs room, then wraps it with `collaborationModule({ session })`.

CommentDraftChromeHandlersinterfaceSource ↗

Host chrome for comment drafts: the review rail, or the host's own comment UI.

interface CommentDraftChromeHandlers
MemberTypeSummary
onRequest?() => voidOpen a comment draft on the selection: the `review.addComment` control's press. The handler takes no arguments. It reads the selection with `getSelectionPlacement`, and can pin it with `retainSelection` while the draft is open. The most recent registration receives each request.

CompareDocumentsChromeHandlersinterfaceSource ↗

Host rendering for the Compare documents dialog.

interface CompareDocumentsChromeHandlers
MemberTypeSummary
onRequest?(session: CompareDocumentsDialogSession) => void

CompareDocumentsDialoginterfaceSource ↗

Compare documents dialog supplied by the review module.

interface CompareDocumentsDialog
MemberTypeSummary
destroy
open

CompareDocumentsDialogHostinterfaceSource ↗

What the Compare documents dialog may use: its session, mount, and strings.

interface CompareDocumentsDialogHost extends CompareDocumentsDialogSession
MemberTypeSummary
containerHTMLElement
translate?(key: string) => string | undefined

CompareDocumentsDialogSessioninterfaceSource ↗

One open Compare documents dialog. The editor owns it: the session aborts when the dialog closes, is replaced, or the document, mount, or editor goes away.

interface CompareDocumentsDialogSession
MemberTypeSummary
applyCompare the open document with the revised DOCX and record the differences in it as tracked changes, as one undoable step. Closes the session when the document changes. With no differences (`changed` false) or a refusal, the session stays open with a message to show.
canApplyWhether a compare can run now.
cancelClose the dialog. A running background compare stops, and nothing changes.
cancelablebooleanWhether `cancel()` can stop a running compare: true when compares run in the background. A compare that falls back to the main thread, because the worker never started, cannot stop.
defaultAuthorstringThe author name the dialog offers first: the editor's author, or an empty string.
originalHasTrackedChangesbooleanWhether the open document has tracked changes when the dialog opens. The compare treats them as accepted, so a dialog says so before the user compares.
signalAbortSignalAborts on close, replacement, load, detach, or destroy.

CompareDocumentsEngineOptionsinterfaceSource ↗

Options of one document compare.

interface CompareDocumentsEngineOptions
MemberTypeSummary
authorName?stringAuthor recorded on every revision. The engine picks a default when absent, empty, or only white space.
detectFormatChanges?booleanRecord formatting differences as formatting revisions. Default `true`.
removeDateAndTime?booleanOmit the revision timestamps. Default `false`.

CompareDocumentsProgressinterfaceSource ↗

How far a background compare is.

interface CompareDocumentsProgress
MemberTypeSummary
fractionnumberThe share of the work done, from 0 to 1. It never decreases.
phaseCompareDocumentsPhaseThe step that runs now.

CompareDocumentsRequestinterfaceSource ↗

What one compare request carries: the revised DOCX and its options.

interface CompareDocumentsRequest
MemberTypeSummary
authorName?stringAuthor recorded on every revision. When absent or blank, the editor's author. Without an editor author, the revised document's last author, then its creator, then `Comparison`.
detectFormatChanges?booleanRecord formatting differences as formatting revisions. Default `true`.
removeDateAndTime?booleanWrite the revisions without dates. Default `false`.
revisedUint8ArrayThe revised document's DOCX bytes. The open document is the original.

ComposeFontOriginsOptionsinterfaceSource ↗

Diagnostics hook for ordered font-origin composition.

interface ComposeFontOriginsOptions
MemberTypeSummary
onOriginFailure?(failure: FontOriginFailure) => voidFire-and-forget diagnostics; returned promises are observed but do not delay resolution.

ContentControlListNavigationinterfaceSource ↗

The stateful keyboard behavior used by all value lists.

interface ContentControlListNavigation
MemberTypeSummary
keyDownHandle list keys on a popup root. Input editing keys remain native.
resetReset typeahead when opening a different session.

ContentControlWidgetChromeHandlersinterfaceSource ↗

Framework rendering for content-control value widgets.

interface ContentControlWidgetChromeHandlers
MemberTypeSummary
kinds?readonly ContentControlWidgetSession['kind'][]Session kinds this renderer takes. Defaults to `dropdown`, `comboBox`, `date` and `buildingBlockGallery` (the list-shaped sessions), so a renderer written for the pop-ups never receives a checkbox or picture press it does not expect. Include `'checkbox'` to take those presses too; the engine then leaves the toggle to `apply`, and a press nobody takes toggles the box as before. Include `'picture'` to own the image pick; a press nobody takes opens the engine's own file picker.
onRequest?(session: ContentControlWidgetSession) => void

ContentControlWidgetSessioninterfaceSource ↗

A core-owned content-control value edit.

kind names the widget that was pressed. A checkbox session carries the current state as 'true' / 'false' and expects the opposite (or the same) back through apply; the packaged pop-ups apply the toggle at once, so a host only sees it when it renders the widget itself. A buildingBlockGallery session is a list session: items are the glossary's blocks for the control's gallery, named by w:docPartPr/w:name, and apply takes a name. A picture session carries the control's drawing node id as value and takes new image bytes through replaceImage; apply refuses, since no text stands for an image.

interface ContentControlWidgetSession
MemberTypeSummary
anchorHTMLElement | null
apply
canApply
cancel
controlIdstring
itemsreadonly { readonly displayText: string; readonly value: string; }[]
kind'dropdown' | 'comboBox' | 'date' | 'checkbox' | 'picture' | 'buildingBlockGallery'
localestringThe editor's regional locale, for a date picker's month, weekday and first-day rules.
replaceImagePicture sessions only: replace the control's image with these bytes. The engine sniffs the format (PNG, JPEG, GIF, BMP or WebP) and keeps the drawing's size. Resolves false when the bytes are not a supported image, the control no longer takes a write, or the document is open for viewing or suggesting. Cancellation during decoding prevents the commit; only one replacement may be pending for a session.
signalAbortSignal
valuestring

ContentLockPolicyinterfaceSource ↗

An opt-in relaxation of ST_Lock for hosts that protect WHAT a control says, not how it looks.

ECMA-376 contentLocked forbids editing the control's contents and Word reads formatting as part of that, which is the default here. A host that puts protected text in a control (a template placeholder the user must not retype) but lets authors style it sets allowFormattingInLockedContent: a run-property write (bold, colour, font, size, highlight …), on runs or on a paragraph mark, then passes the CONTENT half of the lock. The exception never admits a property that hides text (w:vanish, w:specVanish, w:webHidden), which the run-property vocabulary refuses today anyway. Text edits, deletion of the content, paragraph properties, removal of a sdtLocked wrapper and w:dataBinding refusals are unchanged.

interface ContentLockPolicy
MemberTypeSummary
allowFormattingInLockedContent?booleanLet run formatting pass a content lock; text and removal stay refused. Default `false`.

CustomFontsOptionsinterfaceSource ↗

Options for loading application fonts when the editor resolves its font configuration.

interface CustomFontsOptions extends Omit<LoadFontsRequest, 'signal'>
MemberTypeSummary
onFailure?(failure: FontLoadFailure) => voidReports each failed face. Defaults to a console warning. Cancellation does not call this handler.

DocumentRefreshinterfaceSource ↗

External file transport stays in your application. Reload resets selection and undo history.

interface DocumentRefresh
MemberTypeSummary
applyUpdateAccept cumulative output. Preserve a clamped scroll position without moving focus.
cancelCancel pending processing. An accepted result stays loaded.
captureFinish pending input and capture bytes with their document revision. Supersedes earlier submissions.
clearHighlightsRemove temporary paragraph highlights without changing document content or history.
finishEnd processing when no further output will arrive.
highlightChangesHighlight available changes and return their count, including offscreen locations. Zero means none. Always validates options.
navigateToChangeExplicit navigation. Does not focus unless requested. Returns false for unavailable locations.
onResultCompletion notification for every `applyUpdate()` call, including a refused result.
recoverRetry recovery only while the failed document session is still active.
recoveryBytesReturn a copy for download after recovery fails.
snapshotCached state, suitable for framework external-store subscriptions.
subscribeObserve state changes. Returns an unsubscribe function.

DocumentRefreshStateinterfaceSource ↗

Observable controller state. Document editing stays available during processing.

interface DocumentRefreshState
MemberTypeSummary
changesreadonly RefreshChange[]
highlightsVisiblebooleanWhether highlights are requested for available locations. False when the whole set starts dismissal.
phase'idle' | 'capturing' | 'processing' | 'refreshing' | 'recovering' | 'complete' | 'failed'
recoveryAvailablebooleanOffer restore and download controls when true.
resultRefreshResult | null

DocumentSearchinterfaceSource ↗

The shared search of one editor. Get it with [createDocumentSearch](createDocumentSearch).

interface DocumentSearch
MemberTypeSummary
clearEmpty the query and drop the results, without changing the selection.
findSearch now, without a debounce, and return the matches. Clears the active match unless `selectFirst` selects one. `highlight` highlights the results until `clear()`.
getStateThe current state. Returns the same object until the state changes.
goToSelect a match and scroll to it. Focus stays where it is, so a search box keeps it and Enter can move to the next match; pass `{ focus: true }` to move focus to the document. Returns false for an index without a match.
nextGo to the next or previous match, wrapping at the ends.
previous
setMatchCase
setQueryUpdate the typed query. The search runs after [SEARCH_DEBOUNCE_MS](SEARCH_DEBOUNCE_MS) of quiet.
setWholeWord
showHighlightsHighlight matches while the returned function is not called. With several requests, the widest wins: `'all'`, then `'active'`. Without a request, nothing is highlighted. The Find pane requests highlights while its Find tab is open.
subscribeObserve state changes. Returns an unsubscribe function.

DocumentSearchFindOptionsinterfaceSource ↗

Options for [DocumentSearch.find](DocumentSearch.find).

interface DocumentSearchFindOptions extends DocumentSearchOptions
MemberTypeSummary
highlight?DocumentSearchHighlightHighlight the results until `clear()` or the next `find()`: `'all'`, `'active'`, or `'none'`. Default: no request of its own, so highlights follow the Find pane and hooks.
selectFirst?booleanSelect the first match and scroll to it. Default: `false`.

DocumentSearchNavigateOptionsinterfaceSource ↗

How a search moves to a match.

interface DocumentSearchNavigateOptions
MemberTypeSummary
focus?booleanMove focus to the document. Default: `false`.

DocumentSearchOptionsinterfaceSource ↗

Search options that narrow a query.

interface DocumentSearchOptions
MemberTypeSummary
matchCase?boolean
wholeWord?boolean

DocumentSearchStateinterfaceSource ↗

A snapshot of the shared search. The same object until something changes.

interface DocumentSearchState
MemberTypeSummary
activeIndexnumberIndex of the current match, or `-1` before any navigation.
activeMatchTextMatch | nullThe current match, or `null` before any navigation.
isPendingbooleanA typed query is waiting for its debounce.
matchCaseboolean
matchesreadonly TextMatch[]Matches for the last searched query, in document order.
querystringThe query as typed. It can lead the searched query by one debounce.
truncatedbooleanThe search stopped at [SEARCH_MATCH_LIMIT](SEARCH_MATCH_LIMIT) with matches still ahead.
wholeWordboolean

DocxEditorConfiginterfaceSource ↗

Everything [createDocxEditor](createDocxEditor) accepts. Every field is optional.

container is the one that changes the shape of the whole lifecycle: omitting it produces an instance that does no DOM work until attach(el), which is what lets a provider own the editor before any component has rendered a mount point.

interface DocxEditorConfig
MemberTypeSummary
author?string
container?HTMLElementThe element the paginated surface mounts into. The surface owns this subtree.
contentLockPolicy?ContentLockPolicyOpt-in relaxation of content-control `w:lock`: with `allowFormattingInLockedContent`, `contentLocked` / `sdtContentLocked` controls refuse typing, pasting and deleting their text as always, but accept run formatting (toolbar, shortcuts, automation `setFont`) — for hosts that protect WHAT a control says and let authors style it. Default: Word's behaviour, where a content lock refuses every edit including formatting.
document?DocumentSourceA document to load at construction: DOCX bytes, or `'blank'` for Word's blank template. A `DocumentHandle` cannot be re-opened (the handle is identity, not content), so passing one emits a typed `error` event rather than silently loading nothing. Omitting this mounts NO document, which is not the same as an empty one.
fieldResults?FieldResultsModeHow the reader edits saved field results.
fonts?FontConfiguration | FontConfigurationFragment | FontResolverFont bytes for Word-accurate (HarfBuzz-shaped) line wrap and pagination. Omitted, layout falls back to a fixed-width estimate; fonts embedded in the document are wired in automatically either way. For Word's default faces (Calibri, Times New Roman, …) pass `await loadDefaultFonts()` from `@docx-editor.dev/fonts` — a bare fragment (`{ sources, substitutions }`) is accepted and composed with defaults, or merge several origins yourself with `composeFontConfiguration`. Sampled per load; failures degrade to the fixed measurer and report through `onFontError`.
fontShaping?FontShapingOptionsExplicit shaping execution limits. Omitted, the per-face byte ceiling remains 16 MiB.
imageDecodePort?ImageDecodePortOverride raster decode for insert/replace image commands; defaults to browser/headless.
locale?stringBCP-47 locale for regional date input and generated labels; defaults to en-US.
lockedControlNavigation?LockedControlNavigationHow the caret moves through an inline control with a content lock. `'atomic'` makes such a control one caret unit; `'characters'` (the default) walks through its characters, as Word does. Fixed for the instance.
mode?'edit' | 'view' | 'suggesting'The mode the editor opens in — one prop, matching the toolbar's three-state pill.
modules?readonly EditorModule[]Capability modules to register — the seam `@docx-editor.dev/pro` plugs in through. Omitted, the editor runs the free tier: lossless round-trip, final-state revision rendering, review chrome disabled with the engine's reason. See [EditorModule](EditorModule).
onFontError?(error: EditorFontError) => void
reviewDisplayMode?ReviewDisplayModeInitial review projection. Markup modes require a review module.
revisionMarkup?RevisionMarkupOptionsInitial local revision presentation and tracking preferences.
revisionStyles?RevisionStylesHow painted tracked changes are coloured. Presentation only — nothing is serialised.
tableInteractionLabel?(key: TableInteractionLabelKey) => stringLocalized labels for table insertion furniture on the painted surface.
translate?(key: string, params?: Record<string, string | number>) => stringDrawing and form-control UI labels; defaults to English when omitted.
unsupportedElementRules?readonly UnsupportedElementRule[]Ordered unsupported-content registrations; the first matching rule reserves a layout box.
zoom?numberThe scale to open at, as a fixed number.
zoomMode?ZoomMode | 'auto'Where the scale comes from. Defaults to `'auto'` — fit the page width, between 50% and 100% — unless [DocxEditorConfig.zoom](DocxEditorConfig.zoom) is supplied, which means fixed.

DocxEditorInstanceinterfaceSource ↗

The concrete facade type: the full Editor contract plus the instance-only surface.

surface, stateVersion, attach and detach live HERE rather than on Editor: they are what a store binding and a mounting host need, not what document commands need. Production adapters program against Editor for everything else.

interface DocxEditorInstance extends Editor
MemberTypeSummary
attachMount into `el`, which may belong to another document: a pop-out window opened with `window.open`, or a same-origin iframe.
collaborationSessionThe live collaboration replica, or null when this editor is not in a room.
detachTake the editor out of its element and keep it, with its undo history, selection and collaboration session, for a later `attach`. While detached the instance still saves, runs commands and receives remote edits; it paints when attached again. A `load` while detached replaces the kept document. `destroy()` releases everything. No-op when already detached or destroyed.
fontMeasurementWhich measurer the current document's layout runs on, and whether shaped resolution is still in flight — the honest "are wrap points Word-accurate yet?" readout a host shows instead of guessing. `fixed` with `resolving: false` is the steady state for a document with no usable font source (the documented zero-config fallback); `shaped` means HarfBuzz measurement over real font bytes. Changes bump `stateVersion()`.
getReviewAuthorsEvery author the review surface DRAWS, in Word's slot order, with the colour the review chrome draws them in. The discovery surface a legend or colour picker builds on — authors depend on the loaded file, so they cannot be known at configuration time.
isReviewAuthorVisibleWhether this author's revisions and comments are shown in the current review view.
mountGenerationnumberBumps on mount, detach, destroy, and document reload — guards async image intents.
presenceColorForThe presence colour the engine paints for one display name — the answer the remote caret label takes, so chrome built on this cannot disagree with the painted caret.
setAllReviewAuthorsVisibleShow or hide every reviewer in one layout pass.
setAuthorSet the author for runtime editor state.
setBookmarkChromeWire the host's bookmark dialog to Ctrl/Cmd+Shift+F5. Returns an unsubscribe that restores whatever was registered before, like [DocxEditorInstance.setHyperlinkChrome](DocxEditorInstance.setHyperlinkChrome).
setBookmarkMarksChoose which bookmarks Show bookmarks marks and customize each mark. Returns an unsubscribe that restores the previous options.
setCommentDraftChromeWire the host's comment draft UI to the `review.addComment` control. Returns an unsubscribe that restores whatever was registered before. While nothing is registered, the control is disabled, because nothing could open the draft. The review rail registers when it mounts.
setCompareDocumentsChromeRegister Compare documents chrome. Disposal cancels its active sessions. Manual renderers take priority over fallback renderers. Pass null to use the review module's own dialog until disposal restores the previous registration.
setContentControlWidgetChromeRegister typed content-control widget chrome.
setEquationChromeWire the host equation popover to painted equation clicks.
setFontsReplace host font resources without replacing the document or its edit history. Old resolution is cancelled. Existing host faces are removed before the new resolver runs; no answer keeps the bounded fallback. Document-embedded faces remain independent of host fonts. Failures report through `onFontError`.
setGoToChromeWire the host's Go To UI to the `openGoTo` command. Returns an unsubscribe that restores whatever was registered before. `DocxEditor.Navigation` registers its Go to tab.
setHyperlinkChromeWire the host's hyperlink chrome to the engine's gestures — a click on an external link, and Ctrl/Cmd+K. Returns an unsubscribe that restores whatever was registered before, so a popover component can register in an effect and clean up in its teardown.
setInvalidTextFormFieldChromeRegister invalid protected-field acknowledgement chrome.
setLocaleSet regional date input and generated labels without rebuilding the editor. Stored dates are preserved; an in-progress field edit retains its starting locale. Omitted, invalid, and unsupported locales use en-US. Translation catalogues fall back by language.
setModeSet the host editing mode without rebuilding the editor.
setOpeningIndicatorHostRender the host's own loading indicator on the first page while a large document lays out its remaining pages, or restore the packaged spinner with `null`. The engine keeps owning the element and its place on the page; the host owns its content.
setRemoteCaretLabelHostRender the host's own component as the remote-caret label, or restore the default collaborator-name label with `null`. The engine keeps owning label geometry, class, and presence colour; the host owns the content of each published element.
setReviewAuthorVisibleShow one author's markup, or render their revisions as accepted and hide their comments. This changes view state only. It does not apply tree operations or change saved bytes.
setReviewPaneOptionsChange the review pane settings: every field of `ReviewPaneOptions`, such as when the pane opens by itself and what it does when its card column does not fit. An omitted field keeps its value. Read the settings in force from `snapshot().reviewPane`. They stay in force across `load()` and are never saved into the document. This sets how the pane behaves; to open or close the pane itself, use `useReview().setPaneOpen` or the `toggleReviewPane` command.
setRevisionMarkupMerge local preferences and emit revisionMarkupChange after a change. Invalid settings throw TypeError without changing the previous settings.
setRevisionMarkupChromeRegister local revision settings chrome. Disposal cancels its active sessions. Manual renderers take priority over fallback renderers. Pass null to use native chrome until disposal restores the previous registration.
setRevisionStylesReplace how tracked changes are coloured, live. Paint-level: pages repaint without a layout pass, and the caret, selection and undo history stay where they are. Pass `'author'` to restore the default, or `'kind'` to opt out to the green/red rendering. Survives a document reload.
setTextFormFieldChromeRegister Field Options chrome. Disposal closes sessions owned by this registration.
setTranslateSet the drawing and form-control label resolver without rebuilding the editor. Open dialogs preserve their controls and input; later surface mounts use the same resolver.
setUnsupportedElementRulesReplace registrations while preserving document edits and undo history.
showAllReviewAuthorsRestore every reviewer to the shown state.
stateVersionMonotonic version of the observable editor state. Bumps whenever anything `snapshot()` reports could have moved — a committed change, a selection move, zoom, load success or failure, attach/detach, destroy. An external store (React's `useSyncExternalStore`) uses it as a cheap "did anything change" signal; `snapshot()` itself is cached per version and returns a stable reference between bumps.
surfacePaginatedSurface | nullThe underlying paginated surface for harnesses and tests that need capabilities the contract does not carry yet (select-all, node-id addressed selection).

DrawingPositionInputinterfaceSource ↗

An anchored drawing's position: offsets, and the frames they are relative to.

The relative-to bases matter as much as the offsets. Writing an offset without preserving its base re-anchors the drawing against a different reference and moves it somewhere nobody asked.

interface DrawingPositionInput
MemberTypeSummary
horizontalEmu?number
mode?'frame' | 'simple'`'simple'` when `@simplePos="1"`: `horizontalEmu` / `verticalEmu` are authoritative `wp:simplePos` x/y. `'frame'` (default) uses positionH/V relative frames.
relativeToH?DrawingHorizontalReferenceFrame
relativeToV?DrawingVerticalReferenceFrame
verticalEmu?number

DrawingPreviewPackageLimitsinterfaceSource ↗

Caps for [createDrawingPreviewPackage](createDrawingPreviewPackage).

interface DrawingPreviewPackageLimits
MemberTypeSummary
maxBytes?numberMaximum number of copied bytes. Defaults to 64 MiB.
maxParts?numberMaximum number of copied parts. Defaults to 64.

DrawingSupportIssueinterfaceSource ↗

A drawing feature that the editor does not show as authored. Each code means:

- unsupported-effect: the editor ignores an explicit effect, such as a:blur, a:duotone, or a14:imgProps. The drawing renders without it. - renderer-required: an optional effect, such as a:glow, needs the drawing module: drawingModule() or installDrawing() from @docx-editor.dev/pro/drawing. It appears only while that module is not installed in the current process, for occurrences and reports alike. - unverified-3d: the drawing has 3-D properties (a:scene3d, a:sp3d), which render flat. - saved-fallback: the editor shows the saved mc:Fallback content, not the main content. - unplaced-drawing: the drawing has no layout position, so the editor does not show it. - inspection-limit: a scan budget stopped the check, so the result is incomplete. - projection-diagnostic: the source is malformed or partly unusable. detail holds the diagnostic code, such as invalid-geometry or resource-refused.

The check reads the drawing's own XML. It does not read chart or diagram parts, inherited theme effects, or image bytes, so an empty list does not prove full fidelity.

interface DrawingSupportIssue
MemberTypeSummary
code'unsupported-effect' | 'renderer-required' | 'unverified-3d' | 'saved-fallback' | 'unplaced-drawing' | 'inspection-limit' | 'projection-diagnostic'The kind of limitation. The list in this type's description explains each code.
detailstringThe feature, such as `a:blur` or `mc:Fallback`, or the projection diagnostic code.
localNamestringThe local name of the node with the feature, such as `blur`.
namespaceUristringThe namespace of the node with the feature.
nodeIdstringThe source node with the feature: in the inspected package for a report, or in the editor's current document for an occurrence's `drawingIssues`.

EditorCommandExecuteinterfaceSource ↗

A command hook keeps its nullary event-handler form and accepts explicit options.

interface EditorCommandExecute
MemberTypeSummary
(member-0)
(member-1)

EditorModuleinterfaceSource ↗

One registered capability module. Registration is construction-time (createDocxEditor({ modules })) and immutable for the instance's lifetime.

interface EditorModule
MemberTypeSummary
collaboration?CollaborationModuleContributionCollaboration replica. Absent, the editor stays single-user: local undo stays the authority, and `snapshot().collaborationStatus` is `'inactive'`.
customNodePayloadNamespaces?readonly string[]customXml payload namespaces this module OWNS, swept for orphans when a document opens.
customNodes?readonly unknown[]Custom inline node definitions. Reserved: the definition shape lands with the custom-nodes lane; the registry carries them opaquely until then.
idstringDiagnostic identity (`'review'`, `'custom-nodes'`); not a dispatch key.
onCustomNodeDiagnostic?(diagnostic: unknown) => voidTold when the recognition pass finds something wrong with a node in THIS editor's document.
onDiagnostic?(event: EditorDiagnostic) => voidTold about every anonymous diagnostic of this editor, from its first open on.
review?ReviewModuleContributionReview capability: queue derivation, commands gate, display modes.
wantsDiagnostic?(kind: EditorDiagnosticKind) => booleanWhether `onDiagnostic` wants events of `kind` now. Absent, it wants every kind. The editor asks before work that only a diagnostic needs, such as timing key presses for `performance`, and skips that work when no listener wants it. Read often: keep it cheap.

EditorModuleRegistryinterfaceSource ↗

The resolved registry the editor instance holds: at most one review contribution and at most one collaboration contribution (first registration wins for each), all custom node definitions in registration order.

interface EditorModuleRegistry
MemberTypeSummary
collaborationCollaborationModuleContribution | null
customNodeDiagnosticsreadonly ((diagnostic: unknown) => void)[]Every registered diagnostic listener, in registration order.
customNodePayloadNamespacesreadonly string[]Every claimed payload namespace, deduplicated, in registration order.
customNodesreadonly unknown[]
diagnosticListenersreadonly ((event: EditorDiagnostic) => void)[]Every registered `onDiagnostic` listener, in registration order.
reviewReviewModuleContribution | null
wantsDiagnostic(kind: EditorDiagnosticKind) => booleanWhether any module with `onDiagnostic` wants events of `kind` now.

EditorWindowinterfaceSource ↗

A pop-out window opened by [openEditorWindow](openEditorWindow).

interface EditorWindow
MemberTypeSummary
closeClose the window. Runs the `onClose` listeners first.
elementHTMLElementThe mount point: attach the editor, or render the editor panel, here.
onCloseRun `listener` once when the window goes away: the user closed it, or you called `close()`. It runs while the window's document still exists, so move the editor back from here. Returns a function that removes the listener.
windowWindowThe pop-out window.

EquationActivationinterfaceSource ↗

A user click on one painted equation.

interface EquationActivation
MemberTypeSummary
equationSurfaceEquation
rect{ readonly left: number; readonly top: number; readonly right: number; readonly bottom: number; }

EquationChromeHandlersinterfaceSource ↗

Host chrome that edits a clicked Office Math equation.

interface EquationChromeHandlers
MemberTypeSummary
onPopover?(activation: EquationActivation) => void

EquationOpsinterfaceSource ↗

Surface equation reads and atomic replace/remove writes.

interface EquationOps
MemberTypeSummary
applyEquation
canWhether equation chrome can run an action, with the engine-owned refusal reason.
equationAtCaret
equationById
equationsInCaretParagraph
removeEquation

FinalizedImageOverlayInteractioninterfaceSource ↗

The committed result of a whole drag, recomputed from the release coordinates.

Recomputed rather than accumulated from the per-frame previews, so rounding applied once per frame cannot add up into a final extent that differs from where the pointer actually stopped.

interface FinalizedImageOverlayInteraction extends ImageResizeResult
MemberTypeSummary
positionDrawingPositionInput | null

FontConfigurationBaseinterfaceSource ↗

The base of a composition: everything a FontConfiguration carries, all optional. Omitted fields take the documented defaults (epoch 0, maxFontBytes at the engine hard maximum, defaultFont Calibri at 11pt — Word's own default face and size).

interface FontConfigurationBase extends FontConfigurationFragment
MemberTypeSummary
defaultFont?FontConfiguration['defaultFont']The face used when a run names no font. Defaults to Word's own: Calibri at 11pt.
epoch?numberIdentity of this configuration's byte set. The engine uses it to tell one resolved font set from another; leave it unset and the editor supplies the load sequence.
language?stringBCP-47 tag passed to the shaper for language-sensitive shaping.
maxFontBytes?numberPer-face byte ceiling. Defaults to the engine hard maximum; lower it to tighten intake.

FontConfigurationFragmentinterfaceSource ↗

A partial font configuration one origin contributes: sources, substitutions, or both. loadDefaultFonts() (the substitute package) and loadFonts() (the fetch helper) both return this shape, so every origin composes through composeFontConfiguration the same way.

interface FontConfigurationFragment
MemberTypeSummary
deferred?Promise<FontConfigurationFragment | undefined>Faces that arrive after the document first paints. The editor lays the document out with `sources` and `substitutions`, then lays it out again once this settles. Use it for large faces, such as CJK fonts, that would otherwise hold back the first paint.
sources?readonly FontSource[]
substitutions?readonly FontSourceSubstitution[]
supportedFamilies?readonly string[]Selectable provider families, independent of loaded bytes. Listing them performs no fetch.

FontLoadFailureinterfaceSource ↗

One face that did not load, with whatever evidence the failure produced.

Non-fatal: [LoadFontsResult](LoadFontsResult) still carries every source that succeeded, and the affected family falls back to the engine's fixed measurement.

interface FontLoadFailure
MemberTypeSummary
actualHash?string
diagnostic?string
expectedHash?string
reasonFontLoadFailureReason
requestFontFaceRequest
status?numberHTTP status for `httpError`; hashes for `hashMismatch`.
urlstring

FontMeasurementStateinterfaceSource ↗

Which measurer the current document's layout runs on, and whether shaped resolution is still in flight. Returned by [DocxEditorInstance.fontMeasurement](DocxEditorInstance.fontMeasurement).

interface FontMeasurementState
MemberTypeSummary
measurer'fixed' | 'shaped'`fixed` estimates advance widths; `shaped` measures real font bytes with HarfBuzz.
producer?stringThe shaped measurer's identity (admitted face hashes); absent while fixed.
resolvingbooleanTrue while font resolution for the current document is still running.

FontOriginFailureinterfaceSource ↗

A failed font origin or a partial failure in an otherwise usable fragment.

interface FontOriginFailure
MemberTypeSummary
causeunknown
originIndexnumberZero-based position in the first-wins origin list.
originName?stringResolver function name when one is safely available.

FontResolutionRequestinterfaceSource ↗

What the document turned out to need, handed to an on-demand resolver.

The families are the ones the file actually names — already name-validated and capped, so a resolver may treat them as a list to look up, never as URLs or paths to build.

interface FontResolutionRequest
MemberTypeSummary
defaultFamilystringThe face a run naming no font resolves to, so a resolver can cover it too.
familiesreadonly string[]Families needed by the document, deduped and capped at [MAX_RESOLVER_FAMILIES](MAX_RESOLVER_FAMILIES). Order is deterministic but may express host priority; do not sort it before resolving.
resolvedFaces?readonly FontFaceRequest[]Faces an EARLIER origin in the same composition can already PAINT — either because it supplied the bytes, or because it mapped that face onto one it did supply.
signal?AbortSignalCancels document-scoped resolution; network-backed resolvers should pass it to fetch.

FontResolverMarkinterfaceSource ↗

The type-level half of the mark: what [defineFontResolver](defineFontResolver) adds to a function's type so a FontOrigin list can REQUIRE it.

Declared with a string key so @docx-editor.dev/fonts can declare an identical interface and have the two unify without importing anything from the engine. Set at runtime as well as in the type — non-enumerable, so it stays out of Object.keys and out of a host's own spread.

interface FontResolverMark
MemberTypeSummary
"docx-editor.dev/font-resolver"trueAlways `true`. Set non-enumerably by [defineFontResolver](defineFontResolver).

FontShapingOptionsinterfaceSource ↗

Host-selected execution limits, separate from font admission limits.

interface FontShapingOptions
MemberTypeSummary
maxFontBytes?numberPer-face shaping byte ceiling. Defaults to 16 MiB; the hard ceiling is 64 MiB.

FontUrlSourceinterfaceSource ↗

One URL to fetch and the face it claims to be.

interface FontUrlSource
MemberTypeSummary
faceIndex?number
familystring
hash?stringExpected `sha256:` content hash. When present, mismatching bytes are REFUSED — pin this for any URL not under the app's sole control.
style'normal' | 'italic'
urlstring
weightnumber

FormattingBarOptionsinterfaceSource ↗

Options for [formattingBarChromeGroups](formattingBarChromeGroups).

interface FormattingBarOptions
MemberTypeSummary
direction?booleanShow `direction.ltr` and `direction.rtl` after alignment, as for a right-to-left UI.

GoToBookmarkGroupinterfaceSource ↗

One section of a Go To list sorted by location: the rows of one place, each with its index in the full list.

interface GoToBookmarkGroup
MemberTypeSummary
placeBookmarkPlaceThe place every row of the section is in.
rowsreadonly { readonly row: BookmarkSummary; readonly index: number; }[]The section's rows, each with its index in the full list (the one the highlight uses).

GoToChromeHandlersinterfaceSource ↗

Host chrome for Go To: the Go to tab of DocxEditor.Navigation, or the host's own.

interface GoToChromeHandlers
MemberTypeSummary
onRequest?() => voidOpen the Go To UI: the `openGoTo` command, which its shortcut also sends.
shortcut?booleanWhether Ctrl+G (Cmd+Option+G on macOS) in the document opens this UI. Defaults to `true`. With `false` the chord is left to the browser; `openGoTo` still opens the UI. The most recent registration decides. It is read when the chord arrives, so a getter can follow a setting without registering again.

HighlightHitinterfaceSource ↗

One painted mark under a point. R is your range type: pass ranges with extra fields, such as a glossary definition, and read them back from range.

interface HighlightHit<R extends HighlightRange = HighlightRange>
MemberTypeSummary
activebooleanWhether this range is the set's active range.
indexnumberIndex of the range in the array passed to `setHighlights()`.
lengthnumberCurrent length of the highlighted text.
namestringSet name passed to `setHighlights()`.
rangeRThe range object exactly as it was passed, including your own fields. Its offsets are the ones you passed; `start` and `length` are where the text is now.
rectHighlightRectThe marked line box under the point, in client coordinates. Anchor popovers to it.
startnumberCurrent start of the highlighted text in its paragraph, after edits moved it.

HighlightOptionsinterfaceSource ↗

Presentation for one named highlight set. Every field is optional.

interface HighlightOptions
MemberTypeSummary
activeColor?stringFill for the active range. Default: `var(--doc-text-highlight-active-color)`, orange.
activeIndex?numberIndex of the active range, or `-1` for none. An index past the last range also means none. The active range takes `activeColor` and the `docx-text-highlight--active` class. Default: `-1`.
className?stringSpace-separated CSS classes added to every mark of this set.
color?stringFill for every range: a CSS color or `var()` expression. Default: `var(--doc-text-highlight-color)`, a translucent yellow.
priority?numberStacking order between sets, as an integer from -1000 to 1000. A higher value paints on top. Sets with equal priority stack in the order they were first set. Default: `0`. The built-in Find pane uses the set name `search` with priority `10`.

HighlightRangeinterfaceSource ↗

One text range to mark. A TextMatch from findMatches() is a valid range, so search results pass straight through.

interface HighlightRange
MemberTypeSummary
blockIdstringParagraph that holds the range: `TextMatch.blockId`. IDs belong to the open document.
expectedText?stringModel text the range must cover to paint. Set it for ranges computed outside the editor, such as on a server, so a range that no longer matches the document never paints. When it is omitted, a range must keep covering the text it covered when it was first set.
lengthnumberRange length in the same units. A zero length marks nothing.
scope?ViewScopeStory that holds the paragraph. Informational; `blockId` already names the paragraph.
startnumberUTF-16 offset in the paragraph's model text, as `TextMatch.start` counts it.

HighlightRectinterfaceSource ↗

A client-space rectangle, compatible with DOMRect readers such as positioning libraries.

interface HighlightRect
MemberTypeSummary
bottomnumber
heightnumber
leftnumber
rightnumber
topnumber
widthnumber
xnumber
ynumber

HighlightResultinterfaceSource ↗

What setHighlights() resolved against the open document.

interface HighlightResult
MemberTypeSummary
appliednumberRanges that resolve to their text in the open document and can paint.
unavailablenumberRanges that do not resolve or cannot paint: an unknown paragraph, offsets past the paragraph end, a zero length, text that differs from `expectedText`, or a story without a layout position.

HighlightWatchinterfaceSource ↗

A highlight set that [watchHighlights](watchHighlights) keeps current.

interface HighlightWatch
MemberTypeSummary
refreshRun the source again now.
resultHighlightResultWhat the last application resolved.
stopRemove the set and stop watching.
updateReplace the source or options. Applies at once and keeps the set's stacking position.

HistoryGroupinterfaceSource ↗

interface HistoryGroup
MemberTypeSummary
[historyGroupBrand]true
endEnd this gesture without reverting any edits. Safe to call more than once.
lastOutcomeHistoryGroupOutcome | nullThe outcome of the latest write that named this handle, or `null` before the first one.
state'open' | 'closed'Closed after `end()`, document replacement, detach, or destruction.

HistoryGroupBindinginterfaceSource ↗

Dispose when the element or editor changes.

interface HistoryGroupBinding
MemberTypeSummary
disposeClose the gesture and remove every listener; does not revert edits.
optionsOptions for the next synchronous formatting command.

HistoryGroupBindingOptionsinterfaceSource ↗

Native event policy for one continuous control gesture.

interface HistoryGroupBindingOptions
MemberTypeSummary
kind'native-color' | 'range' | 'repeat' | 'keyboard'

HistoryGroupOptionsinterfaceSource ↗

Options for a review write that can join an explicit history group.

Every write that names one open handle becomes part of one undo step, across commands, review methods, and browser automation runs. A closed handle, or a handle from another editor, refuses the write with code: 'unsupported' and changes nothing.

interface HistoryGroupOptions
```ts
const decision = editor.beginHistoryGroup();
// Reply first: the card's key no longer exists after the change is accepted.
const reply = editor.replyToReviewItem(key, 'Accepted with one change.', {
  historyGroup: decision,
});
const accepted = editor.acceptReviewItem(key, { historyGroup: decision });
decision.end();
if (!reply.ok || !accepted.ok) throw new Error('the review card was refused');
editor.exec({ type: 'undo' }); // reverts both writes
```
MemberTypeSummary
historyGroup?HistoryGroupAn open handle from [Editor.beginHistoryGroup](Editor.beginHistoryGroup) on this editor.

HistoryShortcutKeysinterfaceSource ↗

Modifier and key state of one keydown, as both DOM and framework key events carry it.

interface HistoryShortcutKeys
MemberTypeSummary
ctrlKeyboolean
keystring
metaKeyboolean
shiftKeyboolean

HostTimersinterfaceSource ↗

Timers that run on the window node belongs to, resolved at each call.

A handle is cleared on the window that issued it, so a timer set before the editor moved to another window is still cancelled after the move. Handles are this object's own numbers: two windows count their native handles independently, so a native number alone could name a timer in either one. Clear them with this object, never with the global clearTimeout.

interface HostTimers
MemberTypeSummary
cancelAnimationFrame
clearTimeout
migrateMove pending work to the window the node lives in now. Every other call does this first; call it yourself where you only check whether something is pending. A hidden opener runs no frames and fires no `pagehide`, so work left there would wait until it is shown again.
requestAnimationFrame
setTimeout

HyperlinkActivationinterfaceSource ↗

A click on a painted link, after native navigation was refused.

interface HyperlinkActivation
MemberTypeSummary
rect{ readonly left: number; readonly top: number; readonly bottom: number; readonly right: number; }The clicked line fragment's viewport rect, so a popover can be placed under it.

HyperlinkChromeHandlersinterfaceSource ↗

The host chrome that answers the engine's hyperlink gestures.

A CLICK on an external link and Ctrl/Cmd+K both mean "the user wants the link UI", and the engine deliberately does not know what that looks like. Registered rather than passed at construction because the chrome mounts after the editor does, and it survives a document reload — the surface is rebuilt, the handlers are not.

interface HyperlinkChromeHandlers
MemberTypeSummary
onPopover?(activation: HyperlinkActivation) => voidA plain click on an external or inert link: show the popover at `activation.rect`.
onRequest?() => voidCtrl/Cmd+K: open insert-or-edit for the selection.

HyperlinkOpsinterfaceSource ↗

Reading and writing hyperlinks on the surface.

Every href that leaves here has already been through sanitizeHref — targets come from files, so javascript:, data: and vbscript: are dropped at the parse boundary rather than trusted to be filtered by whoever renders them.

interface HyperlinkOps
MemberTypeSummary
fieldLinkAtCaretThe FIELD link whose painted atom the caret sits on, or null.
linkAtCaretThe link the caret sits in, or null.
linkByIdThe link with this node id, or null.
linksInCaretParagraphEvery link in the paragraph the caret is in.
selectionIsPendingDeletionWhether every character the selection covers is a pending tracked deletion.
wordAtCaretThe word a new link takes when the caret is collapsed inside it, or null.

ImageCropPercentinterfaceSource ↗

Crop edge in UI percent (0–100).

interface ImageCropPercent
MemberTypeSummary
bottomnumber
leftnumber
rightnumber
topnumber

ImageCropPermilleinterfaceSource ↗

Crop edge in OOXML permille (0–100000).

interface ImageCropPermille
MemberTypeSummary
bottomnumber
leftnumber
rightnumber
topnumber

ImageDecodePortinterfaceSource ↗

The injected image decoder.

A port rather than a direct Image/createImageBitmap call, so a worker or server runtime supplies its own and the engine never reaches for a browser global.

interface ImageDecodePort
MemberTypeSummary
convertPreservedOptional conversion of media an `<img>` cannot render (EMF/WMF metafiles, TIFF) into a renderable raster. The returned bytes are untrusted and re-enter the full raster validation path (sniff, header, pixel caps, decode) before they can become a ready resource. A null return declines the format and keeps the labelled placeholder; so does a throw, as `decode-failed`.
decode

ImageInteractionSessioninterfaceSource ↗

One in-flight image drag: where it started, and everything needed to decide at commit time whether the document still describes what the gesture was planned against.

Both revisions are captured because they move independently — layout can re-flow without the package changing, and vice versa.

interface ImageInteractionSession
MemberTypeSummary
anchorFrameOrigin{ readonly x: number; readonly y: number; } | null
drawingNodeIdstring
handleImageResizeHandle | null
kind'inline' | 'anchored'
layoutRevisionnumber
mode'move' | 'resize'
packageRevisionnumber
preconditionsImageMutationPreconditions
startBounds{ readonly x: number; readonly y: number; readonly width: number; readonly height: number; }
startHeightEmunumber
startPositionDrawingPositionInput | null
startWidthEmunumber
transformDrawingTransform

ImageOverlayScrollPortinterfaceSource ↗

How an image drag scrolls the page when it reaches the viewport edge.

Returns the delta ACTUALLY applied rather than the one requested, because a drag at the end of the document cannot scroll further and the overlay must not move the image by a distance the page did not travel.

interface ImageOverlayScrollPort
MemberTypeSummary
scrollByScroll by a preview delta and return the actual applied document-space delta in points.

ImageResizeResultinterfaceSource ↗

One resize frame: the extent to store, and the box to draw while the pointer is still down.

Both, because they are different spaces — the extent is EMU for the file, the preview is points for the overlay — and computing them separately would let the handle drift from the rectangle it is dragging.

interface ImageResizeResult
MemberTypeSummary
heightEmunumber
positionDrawingPositionInput | null
previewBounds{ readonly x: number; readonly y: number; readonly width: number; readonly height: number; }
widthEmunumber

ImageResourceLimitsinterfaceSource ↗

Trust-boundary caps specific to image decoding and embedding.

interface ImageResourceLimits
MemberTypeSummary
maxDecodedBytesnumber
maxDimensionnumber
maxEncodedBytesnumber
maxExternalRedirectsnumber
maxPixelsnumber
maxPolygonPointsnumber

InvalidTextFormFieldChromeHandlersinterfaceSource ↗

Framework rendering for invalid protected-field acknowledgements.

interface InvalidTextFormFieldChromeHandlers
MemberTypeSummary
onRequest?(session: InvalidTextFormFieldSession) => void

InvalidTextFormFieldSessioninterfaceSource ↗

An invalid protected-field acknowledgement.

interface InvalidTextFormFieldSession
MemberTypeSummary
acknowledgeClear the unchanged invalid value, if the target still permits it.
cancelDismiss without clearing the authored value.
signalAbortSignal
type'number' | 'date'

LineSpacingMenuRowinterfaceSource ↗

One row of the line-spacing menu.

interface LineSpacingMenuRow
MemberTypeSummary
commandExtract<EditorCommand, { type: 'setLineSpacing'; }> | nullWhat picking the row executes, or null for the selected row: it already holds, and its value is the read rounded to two decimals, so writing it back would quietly move an authored `w:line="253"` to 252. Picking a null row only closes the menu.
labelKey'lineSpacing.exactlyPoints' | 'lineSpacing.atLeastPoints' | nullThe i18n key whose `{value}` placeholder takes `text`, or null when `text` is the whole label (a multiple).
presetbooleanFalse for the extra row that shows a current spacing no preset matches.
selectedbooleanWhether this is the spacing in force across the whole selection.
spacingLineSpacingMenuValueThe spacing the row stands for.
textstringThe number as the row shows it: one decimal for a multiple unless it needs two (`1.0`, `1.15`), and the point value for `exact` and `atLeast`.

LoadFontsRequestinterfaceSource ↗

What to fetch, and under what limits.

Only sources is required. Each carries its own expected hash, so bytes are trusted by CONTENT rather than by origin — a swapped asset fails admission even from a trusted host.

interface LoadFontsRequest
MemberTypeSummary
cacheName?stringCache API bucket name; default `docx-editor-fonts`.
fetcher?typeof fetchInjectable for tests and CSP-constrained hosts; defaults to global `fetch`.
maxFontBytes?numberPer-font byte ceiling; defaults to the engine hard maximum.
signal?AbortSignalCancels loading with `signal.reason`, without returning per-source failures.
sourcesreadonly FontUrlSource[]

LoadFontsResultinterfaceSource ↗

What one loadFonts call produced: the faces that arrived, plus the ones that did not.

A FontConfigurationFragment, so it composes straight into composeFontConfiguration alongside other font sources. Partial success is the normal case — compose it even with failures present.

interface LoadFontsResult extends FontConfigurationFragment
MemberTypeSummary
failuresreadonly FontLoadFailure[]
sourcesreadonly FontSource[]

Explicit change navigation. Does not change the default scroll preservation during refresh.

interface NavigateToChangeOptions extends ScrollToAnchorOptions
MemberTypeSummary

OpenEditorWindowOptionsinterfaceSource ↗

Options for [openEditorWindow](openEditorWindow).

interface OpenEditorWindowOptions
MemberTypeSummary
features?stringThe `window.open` features. Defaults to `popup,width=1000,height=900`.
name?stringThe window name passed to `window.open`. Defaults to `docx-editor`. Windows opened with the same name are one browser window, so give each editor its own name.
styles?boolean | ((from: Document, to: Document) => () => void)Copy the opener's stylesheets, and keep copying the ones it adds later. Defaults to `true`. Pass `false` to style the window yourself, or a function that copies and returns a stop.
title?stringThe pop-out's title.
url?stringA same-origin page to open. Defaults to `about:blank`, which needs no file on your server. A served page (an empty HTML file) gives the window a real URL and lets it load its own scripts or fonts first.

OpeningIndicatorHostinterfaceSource ↗

Receives the element that shows the loading indicator below the laid-out pages, while a large document lays out its remaining pages.

interface OpeningIndicatorHost
```ts
editor.setOpeningIndicatorHost({
  publish(element) {
    // Render your indicator into `element`, or remove it when `element` is null.
  },
});
```
MemberTypeSummary
publishCalled with the indicator element when the first pages show, and with `null` when the remaining pages are laid out or the open is abandoned. The element is empty while a host is set: render the host's content into it. It is centered in a band below the last laid-out page, as wide as the page, and scrolls with the document.

OverlayFrameRectinterfaceSource ↗

A rectangle in one page's content frame, in layout points.

interface OverlayFrameRect
MemberTypeSummary
heightnumber
pageIndexnumber
widthnumber
xnumber
ynumber

PaginatedSurfaceinterfaceSource ↗

The mounted, painted, editable document — the layer createDocxEditor builds its contract on.

The painted pages ARE the editable surface: they are contenteditable, but the DOM is a picture. Browser mutations are prevented and re-expressed as tree ops, and selection maps only through data-paragraph-id/data-start, never through DOM node identity.

Every write goes through the guarded mutation path on this object. Reaching past it into session to apply ops directly bypasses the layout invalidation and the caret bookkeeping.

interface PaginatedSurface extends SurfaceIndentAndListOps
MemberTypeSummary
activatedReviewKeyThe key [activateReview](activateReview) pinned, or null once its selection is no longer live.
activateReviewOpen THIS item, named by key, for as long as `selection` stays the live one.
activeReviewKeyThe comment, tracked change or carded custom node the caret is in, as the painted bands report it. A custom node without `reviewCard` is never the answer: it has no card.
activeScopeActive editing view — body, or an open header/footer story by rId.
applyAutomationOpsCommit ops that came from automation, through the gate a keystroke goes through.
applyDrawingOps
applyHeaderFooterLifecycleCommit one package-level furniture lifecycle op (create/delete/link/unlink/options). Flushes layout so the next enter/rebind sees the new resolution.
applyImageProperties
applyTableCommandPlanCommit one table-command plan as a single store transaction.
armForcePlainPasteThe next paste routes plain, whatever its payload carries (Cmd+Shift+V).
authorThe ambient author tracked edits and review writes record, or undefined.
bookmarkEditingSurfaceBookmarksList, add, delete and jump to bookmarks, and show their marks.
bookmarks`bookmarkName -> position` over the current revision, for resolving an internal link. First in document order wins a duplicate name, matching Word.
canEditTextFormFieldRefresh cached TOC entries and/or page numbers through the two-pass layout pipeline.
canInsertTableWhether a `rows`×`cols` table can be inserted at the caret.
canInsertTocWhether a generated body TOC can be inserted before the caret paragraph.
canRefreshTocWhether the addressed (or caret-local) body TOC can be refreshed.
clearFormattingWord's Clear All Formatting: direct run properties off the selected text, and every paragraph the selection touches back to the default style with its direct paragraph properties and mark dropped.
collaborationSessionThe collaboration replica a `collaborationModule` attached, or null.
commitReviewOpsCommit review ops — accept, reject, a new comment — through the SAME path a keystroke takes: layout, paint, and a caret clamped to what the document now holds.
contentControlsContentControlOpsContent-control chrome, form-fill navigation, and value / remove verbs.
convertAllNotes
convertNote
copyFlavoursEvery clipboard flavour for the current selection: plain text, and the interop HTML carrying the embedded fragment when the selection is a body-story range. A cell rectangle answers grid text plus a flattened table; `html` is null where only plain text should be written. A chart refuses as `'chart-content'`, another object as `'unsupported-content'`.
currentPageOne-based page at the caret, or at the centre of the mounted viewport.
deleteBackward
deleteForwardDelete forward — the Delete key, and `deleteContentForward` from an IME.
deleteImage
deleteNote
deleteSelectionRemove the selection, if any. Returns whether anything was deleted.
deleteWordBackwardDelete to the previous word boundary — Alt/Ctrl+Backspace.
deleteWordForwardDelete to the next word boundary — Alt/Ctrl+Delete.
destroy
dismissActiveReviewClose the open item until the caret next moves.
drawingSelectionIntentHow the current selection came to address a drawing, if it does at all.
editingModeHow edits are written right now.
editTextFormField
enqueueTypeQueue plain typed text for a batched commit at the caret.
enterHeaderFooterOpen a header/footer story for editing on the painted surface. Refuses dangling / unknown relationship ids.
enterNote
equationsEquationOps
exitHeaderFooterLeave furniture editing and restore the prior body selection.
exitNote
flushPendingInputLand any queued typed text now, as its own transaction, AND publish any layout pass a commit deferred under input pressure — so the caller reads current text and current geometry at one seam. Both halves are no-ops when nothing is pending, which is the common case: an isolated commit lays out synchronously in its own tail, and deferral only happens when the browser reports queued input behind an expensive pass.
focus
formatPainterFormatPainterOpsWord's Format Painter: capture, apply, and the transient armed mode.
formattingFormatting as it stands at the selection, for a toolbar to reflect.
headerFooterStateChrome read-model for the open furniture scope, or null when editing the body.
hiddenRevisionAuthorsReviewers currently projected as accepted, without changing the document.
hostElementThe element the pages are in now: the host's, or a private holder while parked.
imageDecodePort
insertImage
insertLineBreakA `w:br` — Shift+Enter, a line break inside the same paragraph.
insertNoteInsert a footnote/endnote at the body caret.
insertPageBreakA `w:br w:type="page"` — Ctrl+Enter, a hard page break inside the paragraph.
insertPageFieldInsert an allowlisted page field at the caret in the open HF story.
insertPlainTextInsert text whose newlines are PARAGRAPH BOUNDARIES, in one commit.
insertSectionBreakInsert a section break at the caret: the paragraph splits, and the head ends a new section cloning the governing section's page setup — Word's Layout Breaks. One undoable step. Returns whether the break committed.
insertTabA tab character as a `w:tab` element, not a literal tab in the run text.
insertTableInsert an empty `rows`×`cols` table at the caret, columns evenly dividing the content width of the caret's section, and leave the caret in the first cell.
insertTocInsert and populate a generated body TOC before the caret paragraph.
isInsideTocWhether a body paragraph belongs to a detected TOC boundary or cached result.
layout
layoutSessionThe layout session, so a host or a test can see how much work a pass actually did.
moveToMove the painted pages into `container`, which may belong to another document: a pop-out window or an iframe. The session, undo history, selection and collaboration replica stay as they are; only the DOM and the document- and window-level listeners move. Open content-control menus close.
navigate
navigationSurfaceNavigationBookmark jumps and the ONE external-activation gate. A host's popover "open" action calls `openExternal`; nothing else in the engine may call `window.open`.
notePreviewTextPlain-text preview for hover chrome — never returns markup.
notePropertiesStateResolved/authored note properties for the caret section — chrome read-model.
overlayCoordinatesPaint-scale coordinate context for overlay chrome.
parkTake the pages out of their container and keep them, with all editing state, for a later `moveTo`. A parked surface still accepts commands and remote edits; it paints into a private, disconnected holder until it moves again.
parkedWhether the surface is parked: mounted nowhere, state kept.
pasteRichRoute one paste payload by fidelity: embedded fragment, then external HTML, then plain text. Unsupported object fragments refuse without fallback. Other decode, read, or apply failures can degrade. Suggesting mode, non-body stories and an armed force-plain all land on the plain lane. False when the payload landed on no lane at all (nothing to insert).
proposeTextChangeAuthor one explicit tracked text change without changing the editing mode.
publishedLayoutThe layout as last PUBLISHED, without forcing pending work.
redo
refreshRefFieldResultsRewrite stale REF field results in the body, footnote and endnote stories so a save exports what the pages paint. Fresh results commit nothing (no transaction, no revision bump, no undo entry); a rewrite is ONE transaction and ONE undo unit across every stale part. Viewing, a non-editable session, and a collaborative session write nothing — the collaboration gate cannot journal the rewrite, so those saves export cached results and the call returns false.
refreshTableInteractionLabelsRefresh table insertion furniture labels without remounting or relayout.
refreshToc
releaseSelectionDrop one owned pin. Another owner's pin remains visible.
remotePresenceColorThe presence colour the caret paints for `name`, sanitized as the paint sink is.
removeTocRemove a body TOC: its field, or the table of contents control around it with its heading. Text before and after the field stays. One undo step. Refused while suggesting.
removeTocRefusalWhy the addressed (or right-clicked, or caret-local) body TOC cannot be removed now, or null when it can: `notFound` when there is none, `unsupported` with the reason otherwise.
repaintHighlightsCall the installed highlight painter against the current frame.
replaceImage
replacementLandingWhere a replacement for `[start, end)` of a paragraph lands, or null when the edit would not be tracked.
replaceTextInPlaceReplace a paragraph range of the active story in place; suggesting tracks it.
retainedSelectionThe pinned range, or null once it was released or escaped.
retainSelectionPin the current selection so it stays VISIBLY selected while focus is elsewhere.
revealPageScroll a page, or the page a paragraph sits on, into view. Returns whether it scrolled — false when the target is not laid out, or the surface is not inside a scroll container, so a caller can tell "no such target" from "done".
revealParagraph
revealPositionScroll an exact position into view — `revealParagraph` for a caret that is not at offset 0. Focus-independent and virtualization-safe like every reveal: geometry comes from the layout and the target page is materialized on the way. Defaults to `block: 'nearest'`, so an already-visible target never yanks the viewport.
revisionAuthorsEvery author with a revision in the CURRENT layout, mapped to Word's colour slot by order of first appearance. One map instance per layout, so a caller can key caches on its identity.
revisionDisplayModeWhich revision halves this surface is SHOWING.
saveCommit pending form input, refresh REF results, and serialize the document. Throws an error with code `invalidArgs` for invalid form values, or `invalidState` during an active edit. Retry after the edit finishes. A destroyed surface throws with code `destroyed`. Does not change focus.
saveSteps[save](save) in steps a caller can pause between. Everything `save` does before it serializes happens at the call, and the document is captured then.
sectionAnchorParagraphAtHow a section-addressed op should name the section `paragraphId` is in.
sectionAtPageThe section a painted page belongs to, and the page that section starts on.
sectionBreakRefusalWhy [insertSectionBreak](insertSectionBreak) would refuse this kind right now, or `null`.
sectionPropertiesThe section the document declares: page size, margins, columns, orientation.
sectionPropertiesAtThe section GOVERNING one paragraph — what a ruler or dialog reflects when the caret sits in a multi-section document.
selectAllSelect the whole document.
selectDrawingSelect one painted drawing at its host paragraph, as a pointer press would.
selectedTextThe selected text, for copy and cut.
sessionTreeDocxSessionView
setActiveScopeActivate a view scope. Returns false when a header/footer rId cannot be opened.
setAllRevisionAuthorsVisibleShow or hide every reviewer in one layout pass.
setAuthorSet the ambient author after buffered text commits under the previous author.
setCellSelectionSelect a rectangle of table cells, or clear one with null.
setDrawingStringsReplace localized drawing labels and repaint materialized pages.
setEditableTurn the browser's editing affordance on the pages layer on or off.
setEditingMode
setHighlightPainterInstall the painter for host text highlights, or remove it with `null`. The surface calls it after every render and once on installation, with the frame it just painted.
setLocaleSet regional conventions for subsequent date input without reformatting stored values.
setNoteProperties
setParagraphFormatThe Paragraph dialog as ONE write: alignment, indents, spacing, line spacing and the five paragraph flags, over every paragraph the selection touches.
setParagraphPropertiesSeveral paragraph properties in ONE transaction, so a dialog is one undo step.
setParagraphPropertySet a property on every paragraph the selection touches — alignment, style, spacing.
setRemoteCaretLabelHostHand remote-caret label content to the host, or take it back with `null`.
setReviewActivationExclusionsRevision kinds the CARET must not activate, or null for none.
setRevisionAuthorVisibleShow one reviewer's markup, or render that reviewer's changes as accepted.
setRevisionDisplayModeChange the review display without accepting, rejecting, or changing author filters.
setRevisionMarkupReplace how tracked changes are coloured, live. Paint-level: the pages repaint without remeasuring a line, and the caret, selection and undo history stay where they are.
setRevisionStyles
setRunPropertySET a run property over the selection, rather than toggling it.
setSectionPropertiesWrite section page-setup fields — size, orientation, margins — as ONE undoable transaction. Twips throughout; omitted fields are left as authored. With `anchorParagraphId` only that paragraph's governing section is written (Word's "Apply to: This section"); without it, every section. Returns whether the write committed (a hostile value is refused by the op layer).
setSelectionSet the selection directly, for a host driving the surface programmatically.
setShowParagraphMarksToggle paragraph-end furniture without layout or document changes.
setTableInteractionLabelRefresh table insertion furniture labels without remounting the surface.
setTocLabelsReplace the localized title used by later TOC insertions.
setTrackedChangesFilterApply a view-time predicate over complete tracked-change items.
setTranslateUpdate shared form-control labels without replacing open dialogs.
setUnsupportedElementRules
showAllRevisionAuthorsClear the reviewer filter in one layout pass.
splitParagraph
state
storyScope
textMeasurerThe measurer layout uses; sizes engine-authored shapes such as a watermark.
toggleRunPropertyToggle a run property over the selection, e.g. `b`, `i`, `u`.
type
undoReverse the last history entry and put the caret back where it was made.

PaginatedSurfaceOptionsinterfaceSource ↗

How a paginated surface opens. Every field is optional.

measurer is the injection seam that keeps layout DOM-free — supply one to lay a document out on a server, or leave it off in a browser to get the canvas measurer.

interface PaginatedSurfaceOptions
MemberTypeSummary
author?stringAmbient author for tracked edits. Required before suggesting can write anything.
bookmarkMarks?BookmarkMarkOptionsSourceThe host's Show bookmarks options, read on every paint. `onChange` names the repaint to run when the host changes them.
collaborationModel?CollaborationModuleContributionThe collaboration module's replica for this surface's session. Absent, the surface does not attach, and local store history remains the undo authority.
contentLockPolicy?ContentLockPolicyOpt-in relaxation of `w:lock` for run-property writes: `contentLocked` / `sdtContentLocked` controls can be restyled (toolbar, shortcuts, automation `setFont`) but not retyped. Absent, they refuse both, as ECMA-376 / Word do.
defaultFontFamily?stringThe family a run with no authored font is reported as by `formatting()` AND painted in — the face the measurer falls back to. Absent, such a run reports `fontFamily: null` and paints in whatever font the page inherits, which the measurer did not measure: visible glyphs drift from wrap points and caret geometry.
drawingStrings?DrawingPaintStringsLocalized drawing refusal labels; defaults to English when omitted.
editingMode?SurfaceEditingModeOpening mode; changeable at runtime with `setEditingMode`.
fieldResults?FieldResultsModeHow saved field results are edited. `atomic` (the default) keeps every field one unit. `editable` lets the reader type, delete, and select inside the saved result of a DATE, MERGEFIELD, HYPERLINK, or similar field. Results must be unnested; simple fields inside complex field results are not supported. Refused with a [collaborationModel](collaborationModel).
fieldShading?FieldShadingModeWhen a field's result wears Word's grey shading. Omitted keeps Word's own default, `when-selected`.
fontAlias?(family: string) => string | undefinedMaps a document-declared font family to the alias its registered bytes live under, so painted runs can use embedded glyphs without the file's family name entering the page-global CSS font namespace.
hiddenRevisionAuthors?readonly string[]Authors whose changes open in their accepted view-time projection.
imageDecodePort?ImageDecodePortOverride raster decode for package image intents; defaults to browser/headless.
locale?stringRegional conventions for new date input; defaults to en-US.
lockedControlNavigation?LockedControlNavigationHow the caret moves through a content-locked inline control; see `LockedControlNavigation`.
measurer?TextMeasurer
onChange?(state: PaginatedSurfaceState) => void
onEdit?(typing: boolean) => voidTold once for each local edit that changed the document, with `typing` true for buffered typing, which can land inside a later command's commit. Remote edits are not local.
onEquationPopover?(activation: EquationActivation) => void
onHostMoved?(document: Document) => voidThe pages turned up in another document without a `moveTo`: a host moved the mount element itself (a Vue `Teleport` retargeted, or a plain `appendChild`). The surface has already re-bound its own listeners; the owner re-registers what is per document.
onHyperlinkPopover?(activation: HyperlinkActivation) => voidA plain click on an external (or inert) hyperlink, for a host to open its popover with.
onRejection?(reason: string) => voidTold each time an edit is refused, with the raw reason: a store code such as `'locked'`, or the surface's own refusal sentence. The raw reason can be a sentence, so a listener maps it to a public code before it reports anything.
onRequestBookmark?() => booleanCtrl/Cmd+Shift+F5: open the host's bookmark dialog. Answers whether chrome took the request; when none did, or when this is absent, the key is left to the browser.
onRequestContentControlWidget?(session: ContentControlWidgetSession) => boolean
onRequestGoTo?() => booleanCtrl+G (Cmd+Option+G on macOS): open the host's Go To UI; answers whether chrome took it.
onRequestInvalidTextFormField?(session: InvalidTextFormFieldSession) => boolean
onRequestTextFormField?(session: TextFormFieldDialogSession) => booleanReturn true when host chrome handles this session.
onTiming?(phase: 'layout' | 'paint' | 'input', value: number) => voidTold the milliseconds of each layout pass and each paint. For `'input'`, told the browser timestamp of each key press or pointer press on the pages, so a listener can time it to the next frame. Numbers only.
onToggleParagraphMarks?() => void
pointer?'engine' | 'native'Who resolves a pointer to a caret.
producer?stringIdentifies the measurer for cache invalidation.
reviewModel?ReviewModuleContributionThe review module's derivation hooks for this surface's session. Absent, `session.reviewItems()` is the typed empty queue and every review affordance built on it stays inert.
revisionDisplayMode?ReviewDisplayModeHow revisions project into layout and paint. Omitted keeps the layout default (`all-markup`). The editor facade passes `proposed` when no review module is registered — the free tier's final-state rendering; the machinery below this option is shared either way.
revisionMarkup?ResolvedRevisionMarkup
revisionStyles?RevisionStylesHow tracked changes are coloured: by AUTHOR (the default), by kind, or by author with host-pinned colours. A paint-level option like [fieldShading](fieldShading): it changes no geometry, so switching it repaints without remeasuring a line. Applies wherever revision markup paints, whatever the [revisionDisplayMode](revisionDisplayMode) leaves visible.
scale?numberPoints to CSS pixels.
showBookmarks?booleanShow bracket marks at bookmarks. Paint-level; the document does not change.
showParagraphMarks?booleanShow paragraph-end furniture without changing document content.
tableInteractionLabel?(key: TableInteractionLabelKey) => stringLocalized accessible names for core-owned table insertion furniture. Defaults to English from `@docx-editor.dev/i18n` when omitted.
tocLabels?{ readonly title: string; }Localized name for a generated TOC, written as the control's `w:alias` on insert.
translate?(key: string, params?: Record<string, string | number>) => stringUI labels for shared form controls; omitted keys fall back to English.
unsupportedElementRules?readonly UnsupportedElementRule[]

PaginatedSurfaceStateinterfaceSource ↗

Everything observable about the surface right now, as one immutable value.

revision is the change token: it moves whenever anything else here does, which is what lets snapshot() hand back the same reference until state actually changes.

interface PaginatedSurfaceState
MemberTypeSummary
canRedoboolean
canUndoboolean
cellSelectionCellSelection | nullThe rectangle of table cells a drag across cells selected, or null.
collaborationStatusCollaborationStatus | 'inactive'Lifecycle of the attached replica, or `'inactive'` when no collaboration module is registered on this surface.
contentControlsContentControlSurfaceStateContent-control chrome and form-fill mode.
contextTocIdstring | nullThe TOC the last right-click landed on, or null.
formatPainterFormatPainterSurfaceStateFormat painter arming, and the level of what it holds.
lastRejectionstring | null
pageCountnumber
pendingFormatreadonly { readonly localName: string; }[] | nullThe typing format armed at the caret (Word's stored marks), or null.
perfPaginatedSurfacePerfTiming and reuse counters for the last pass. Diagnostics, not document state.
revisionnumber
selectionSemanticSelection

ParagraphDialogFieldsinterfaceSource ↗

Every field of the form, in the shape the controls hold it.

Deliberately flat and all-defined: this is what the dialog SHOWS, and a control cannot show "mixed" and a number at once. The disagreement itself is remembered by comparing against the seed, not by keeping a null in here.

interface ParagraphDialogFields
MemberTypeSummary
alignment'left' | 'center' | 'right' | 'justify'
clearedAllTabStopsbooleanThe user pressed "Clear all", which is a decision even when the list already looked empty.
contextualSpacingboolean
direction'ltr' | 'rtl'
indentLeftnumber
indentRightnumber
keepLinesboolean
keepNextboolean
lineRule'multiple' | 'exact' | 'atLeast'
lineValuenumber
pageBreakBeforeboolean
spaceAfternumber
spaceBeforenumber
specialSpecialIndent
specialBynumber
tabStopsreadonly ParagraphTabStop[]
widowControlboolean

ParagraphDialogMixedinterfaceSource ↗

Which settings the selection DISAGREES about, so a control can show it.

The value fields need this as much as the checkboxes do. A control that renders a disagreement as a plausible-looking number is not just unhelpful — it makes the disagreement uncorrectable, because the value that would fix it is the one already on screen, so changedFields sees nothing move and writes nothing. Four paragraphs at mixed alignments showed "Left" and could not be set to Left.

interface ParagraphDialogMixed
MemberTypeSummary
alignmentboolean
contextualSpacingboolean
directionboolean
indentLeftboolean
indentRightboolean
keepLinesboolean
keepNextboolean
lineSpacingboolean
pageBreakBeforeboolean
spaceAfterboolean
spaceBeforeboolean
specialboolean
tabStopsbooleanThe selection's paragraphs carry DIFFERENT tab stops, so the list shows none of them.
widowControlboolean

ParagraphFlagsinterfaceSource ↗

The five paragraph flags a Paragraph dialog shows as checkboxes.

contextualSpacing is Word's "Don't add space between paragraphs of the same style"; the rest are its Pagination block. null means the selection disagrees.

interface ParagraphFlags
MemberTypeSummary
contextualSpacingboolean | null
keepLinesboolean | null
keepNextboolean | null
pageBreakBeforeboolean | null
widowControlboolean | null

ParagraphFormatReadinterfaceSource ↗

What the Paragraph dialog reads: every field, as the selection currently stands.

A null means the selection's paragraphs DISAGREE about that field, which a control shows as an indeterminate checkbox or an empty box rather than as a value. indent is the exception the engine already documents — it reports the first touched paragraph and flags disagreement per field, because a ruler has to draw its handles somewhere.

interface ParagraphFormatRead
MemberTypeSummary
alignment'left' | 'center' | 'right' | 'justify' | null`justify`, not OOXML's `both`. The engine speaks `w:jc` values; an adapter speaks the word its consumers write. Read and write use the SAME spelling here, so a value that comes out of `format` can go straight back into `apply`.
contextualSpacingParagraphFlagState
direction'ltr' | 'rtl' | nullBase direction (`w:bidi` through the cascade); null when the selection mixes them.
disagrees{ readonly alignment: boolean; readonly direction: boolean; readonly spaceBeforePt: boolean; readonly spaceAfterPt: boolean; readonly lineSpacing: boolean; readonly tabStops: boolean; readonly indentLeft: boolean; readonly indentRight: boolean; readonly indentFirstLine: boolean; }Which fields are `null` because the selection DISAGREES, as opposed to because nothing states them.
indentFirstLineTwipsnumber | nullONE signed first-line offset: negative is a hanging indent.
indentLeftTwipsnumber | null
indentRightTwipsnumber | null
indentUnknownbooleanWhether the indent reads are UNKNOWN rather than disagreed.
keepLinesParagraphFlagState
keepNextParagraphFlagState
lineSpacing{ readonly rule: 'multiple' | 'exact' | 'atLeast'; readonly value: number; } | null
pageBreakBeforeParagraphFlagState
spaceAfterPtnumber | null
spaceBeforePtnumber | null
tabStopsreadonly ParagraphTabStop[] | nullCustom tab stops, cascade included. Null when the selection disagrees.
widowControlParagraphFlagState

ParagraphFormatUpdateinterfaceSource ↗

The fields apply accepts. Omitted fields are left as authored; null where allowed REMOVES the setting so the style supplies it again, which is not the same as a zero.

interface ParagraphFormatUpdate
MemberTypeSummary
alignment?'left' | 'center' | 'right' | 'justify'
contextualSpacing?boolean
direction?'ltr' | 'rtl'Word's Direction. `ltr` overrides a right-to-left style with `w:bidi w:val="0"`.
indentFirstLineTwips?number | null
indentLeftTwips?number | null
indentRightTwips?number | null
keepLines?boolean
keepNext?boolean
lineSpacing?{ readonly rule: 'multiple' | 'exact' | 'atLeast'; readonly value: number; } | null
pageBreakBefore?boolean
spaceAfterPt?number | null
spaceBeforePt?number | null
tabStops?readonly ParagraphTabStop[]Replace the custom tab stops. An EMPTY list clears them; omit to leave them alone.
widowControl?boolean

ParagraphPropertyEditinterfaceSource ↗

One property in a batched paragraph write.

interface ParagraphPropertyEdit
MemberTypeSummary
attributes?Record<string, string | null>A null-valued attribute REMOVES that attribute; see `setParagraphProperty`.
localNamestring
mergeAttributes?booleanKeep the attributes this entry does not name, for multi-setting elements.
paragraphDirection?'ltr' | 'rtl'For `w:bidi` only: the base direction the paragraph must END in. The writer spells it per paragraph and skips one already in that direction (see `directionalParagraphEntry`).
physicalAlignment?booleanFor `w:jc` only: `attributes.val` names a PHYSICAL edge, as a toolbar button does. The writer converts it per paragraph, because a bidi paragraph reaches its right margin with `left` (see `jcValueForAlignment`).
remove?booleanDrop the paragraph's own element of this name instead of writing one.

ParagraphTabStopinterfaceSource ↗

One custom tab stop, as a command states it.

interface ParagraphTabStop
MemberTypeSummary
alignment'left' | 'center' | 'right' | 'decimal' | 'bar'
leader?'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot'
positionTwipsnumber

PopupChromeRegistrationOptionsinterfaceSource ↗

Priority of an editor-owned popup renderer.

interface PopupChromeRegistrationOptions
MemberTypeSummary
fallback?booleanUse only when no manually registered renderer exists.

RefreshChangeinterfaceSource ↗

One validated change for an accepted result.

interface RefreshChange
MemberTypeSummary
description?stringProcessor-provided summary. The controller does not compute a document diff.
diagnostic?{ readonly code: 'missing-location' | 'deleted' | 'invalid-selector' | 'invalid-paragraph-id' | 'paragraph-not-found' | 'ambiguous-paragraph-id' | 'invalid-offsets' | 'text-mismatch' | 'not-rendered' | 'unsupported-story' | 'multiple-paragraphs'; readonly location?: RefreshLocation; }Why this change cannot receive a highlight. Includes the requested location when supplied.
idstring
isNewbooleanTrue for a new change id, changed text, or changed description in an existing change id.
location?RefreshLocation
resultIdstringIdentity of the accepted submission and processor sequence.
status'available' | 'deleted' | 'unavailable' | 'invalid' | 'unsupported-story'

RefreshChangeInputinterfaceSource ↗

One processor change. Keep its id stable across cumulative results.

interface RefreshChangeInput
MemberTypeSummary
description?stringProcessor-provided review summary, including changes without a body location. Maximum: 1000 characters.
idstring
location?RefreshLocation
unavailableReason?'deleted' | 'unavailable'Deletions without a surviving range have no highlight.

RefreshHighlightOptionsinterfaceSource ↗

Presentation for temporary paragraph highlights. Each call starts from these defaults.

interface RefreshHighlightOptions extends AnchorHighlightOptions
MemberTypeSummary
changeIds?readonly string[]Select these change IDs instead of the recent/all filter. Unknown or unavailable IDs are skipped. Empty means none.
includePrevious?booleanInclude earlier changes from the latest cumulative result. Default: false.

RefreshLocationinterfaceSource ↗

A processor location in the returned document's body, including table paragraphs.

interface RefreshLocation
MemberTypeSummary
endnumber
paragraphId?stringOOXML w14:paraId: eight hexadecimal digits, 00000001 through 7FFFFFFF. Case-insensitive. Use this or paragraphIndex, not both.
paragraphIndex?numberZero-based body paragraph index in document order.
startnumberUTF-16 offsets in the returned paragraph.
textstringExact returned text at these offsets. Required to reject mismatched metadata.

RefreshSubmissioninterfaceSource ↗

A document captured for external processing. Treat this object as an opaque token.

interface RefreshSubmission
MemberTypeSummary
bytesArrayBuffer
idstring

RefreshUpdateinterfaceSource ↗

Cumulative output for one submission. Assign sequence at the processor, before delivery.

interface RefreshUpdate
MemberTypeSummary
bytesArrayBuffer | Uint8Array
changes?readonly RefreshChangeInput[]Omit to derive changes from tracked revisions when a review module is registered.
failures?readonly string[]Stable failed operation ids. The controller reports these and never retries processor work.
sequencenumber
submissionRefreshSubmission

RemoteCaretLabelAnchorinterfaceSource ↗

One live remote-caret label the engine positioned. The host owns its content; the engine still owns the label's geometry, class, and presence colour, and rebuilds the labels wholesale on every repaint that moves them.

interface RemoteCaretLabelAnchor
MemberTypeSummary
elementHTMLElement
selectionCollaborationRemoteSelection

RemoteCaretLabelHostinterfaceSource ↗

A host that renders its own content inside the engine's remote-caret labels.

interface RemoteCaretLabelHost
MemberTypeSummary
publishCalled after every paint that rebuilt the labels, with the current anchors.

ResolvedReviewPaneinterfaceSource ↗

The review pane settings in force, with every field resolved.

interface ResolvedReviewPane
MemberTypeSummary
commentMarkersCommentMarkerStyleHow a collapsed comment marker looks.
openingReviewPaneOpeningWhen the pane opens by itself.
overflowReviewPaneOverflowWhat the open pane does when its card column does not fit beside the page.
revisionsInRevisionDisplayWhere tracked changes open.

ResolvedRevisionMarkupinterfaceSource ↗

Fully resolved, immutable viewer preferences.

interface ResolvedRevisionMarkup
MemberTypeSummary
cells{ readonly inserted: RevisionMarkupNamedColor | 'byAuthor' | 'none'; readonly deleted: RevisionMarkupNamedColor | 'byAuthor' | 'none'; readonly merged: RevisionMarkupNamedColor | 'byAuthor' | 'none'; readonly split: RevisionMarkupNamedColor | 'byAuthor' | 'none'; }
changedLinesRevisionMarkupStyle<RevisionChangedLinesMark>
deletionsRevisionMarkupTextStyle<RevisionDeletionMark>
formattingRevisionMarkupTextStyle
insertionsRevisionMarkupTextStyle
movedFromRevisionMarkupTextStyle<RevisionDeletionMark>
movedToRevisionMarkupTextStyle
trackFormattingboolean
trackMovesboolean

ReviewAuthorInfointerfaceSource ↗

One document author, resolved: who, which ramp slot, and what they draw in.

interface ReviewAuthorInfo
MemberTypeSummary
authorstringThe `w:author` string, exactly as the file carries it.
colorstringThe colour this author is DRAWN IN by the review chrome — their declared colour, or their ramp slot's token.
slotnumberStable session rank, seeded by order of first appearance — an UNBOUNDED index.
style?RevisionAuthorStyleThe host-supplied style, normalised; absent when the author rides the ramp.

ReviewItemHitinterfaceSource ↗

One review item under a client point.

interface ReviewItemHit
MemberTypeSummary
placementReviewItemPlacementThe item, as `getReviewItems()` with the same query returns it.
rectHighlightRectThe item's painted band on the line under the point, in client coordinates. It covers the part of the item's range on that line, not the whole range. Anchor popovers to it.

ReviewModelInputinterfaceSource ↗

What the review queue derivation reads: one story part plus its comment parts.

interface ReviewModelInput
MemberTypeSummary
commentsExtendedPart?OoxmlPart | undefined`word/commentsExtended.xml`, absent when the package has none.
commentsPart?OoxmlPart | undefined`word/comments.xml`, absent when the package has none.
customNodePayloads?ReadonlyMap<string, { readonly nodeId: string; readonly label: string; readonly data: string; }> | undefinedThe payload each of the story's controls binds to, keyed by the control's node id.
customNodes?readonly unknown[] | undefinedCustom node definitions from the module registry, forwarded OPAQUELY.
furnitureParts?readonly OoxmlPart[] | undefinedHeader/footer story parts, in section order. Their revisions and comment anchors join the queue: a tracked change in a header is a pending decision like any other, and a queue that only walked the body silently hid it from the rail AND from Accept All.
reportCustomNodeDiagnostic?((diagnostic: unknown) => void) | undefinedWhere a capability package reports a node it could not read. Supplied per editor, so a page with two of them keeps their diagnostics apart.
storyPartOoxmlPartThe story the ranges live in — the main document, a header, a note.
stylesPart?OoxmlPart | undefinedShared style definitions. Their revisions have no paragraph range.

ReviewModuleContributioninterfaceSource ↗

What a review module contributes: the queue derivation, and the revision display modes the editor may enter beyond the free tier's final-state projection.

interface ReviewModuleContribution
MemberTypeSummary
collectReviewItemsCollectReviewItemsThe review queue derivation.
compareDocuments?CompareDocumentsEngineDocument compare. Absent, compare commands refuse.
compareDocumentsInBackground?CompareDocumentsBackgroundEngineThe same compare off the main thread. When present, the Compare documents dialog uses it, reports progress, and can stop a running compare. If it rejects before its first progress report, the dialog compares with `compareDocuments` instead. The `compareDocuments` command stays synchronous and uses `compareDocuments`.
createCompareDocumentsDialog?(host: CompareDocumentsDialogHost) => CompareDocumentsDialogCreate the Compare documents dialog when a host opens it.
createRevisionMarkupDialog?(host: RevisionMarkupDialogHost) => RevisionMarkupDialogCreate local review settings chrome when a host opens the dialog.
displayModesreadonly ReviewDisplayMode[]Display modes this module unlocks (the free engine renders `proposed` only).
pane?ReviewPaneOptionsThe review pane settings the editor starts with. `setReviewPaneOptions` changes them later.
revisionItemsOfParagraph(part: OoxmlPart, paragraphId: string) => readonly ReviewRevisionItem[]Revisions wholly inside one paragraph — for the conservative local review patch after a text-local body edit.

ReviewPaneItemFieldsinterfaceSource ↗

The fields of a review item that decide whether the review pane lists it. A ReviewItem and a review item placement both have them.

interface ReviewPaneItemFields
MemberTypeSummary
kind'revision' | 'comment' | 'custom'The item kind, as `ReviewItem.kind` gives it.
parentRevisionId?stringFor a comment, the tracked change it replies to.

ReviewPaneOptionsinterfaceSource ↗

Review pane settings to change. Every field is optional, and an omitted field keeps its current value.

interface ReviewPaneOptions
MemberTypeSummary
commentMarkers?CommentMarkerStyleDefault `'icon'`.
opening?ReviewPaneOpeningDefault `'auto'`.
overflow?ReviewPaneOverflowDefault `'float'`.
revisionsIn?RevisionDisplayDefault `'pane'`.

RevisionAuthorAssignmentsinterfaceSource ↗

Per-author style assignments.

Keys match w:author exactly; a value is a CSS colour or a full [RevisionAuthorStyle](RevisionAuthorStyle). others says what authors WITHOUT an entry take: the --doc-review-author-N ramp by default, or 'kind' to leave them on the kind colours — which is how "highlight these reviewers, leave everyone else green and red" is said.

interface RevisionAuthorAssignments
MemberTypeSummary
authorsReadonly<Record<string, string | RevisionAuthorStyle>>
others?'kind' | 'author'Authors without an entry: the ramp (default), or the `'kind'` colours.

RevisionAuthorStyleinterfaceSource ↗

Everything a host can say about ONE author's presentation. Every field is optional and every field is presentation-only — nothing here is ever serialised into the document.

Deliberately about the PAINTED DOCUMENT (which only the painter can style) plus the author's identity data. Review-card DESIGN is not configured here: the review chrome follows color as its accent automatically, and everything further is composition — a custom card reading this style through the review surface's useReviewAuthor, or CSS on the cards' data-review-author/data-review-author-slot hooks.

interface RevisionAuthorStyle
MemberTypeSummary
activeBackground?stringBackground of the highlight band over this author's OPEN change — the one the caret is in. Applied inline, so it outranks the `--doc-revision-*-active-bg` kind tokens, and the kind-coloured rule under the band goes with it: a custom background with a green or red rule beneath it would contradict the decoration it sits behind, and a `transparent` that left a floating rule would not read as cleared at all.
avatarUrl?stringAvatar image for this author; the packaged card renders it in place of initials.
background?stringBackground wash behind this author's changes in the document.
color?stringInk and decoration colour of this author's changes in the document — and the accent the review chrome keys on (avatar disc, card variable, marker).
spanClassName?stringClass names added to every painted span of this author's changes, for styling the typed fields do not cover. Keep the rules metric-safe (outlines, shadows, accents): the engine measures the text it paints, and a class that resizes glyphs drifts the page from its layout.

RevisionMarkupChromeHandlersinterfaceSource ↗

Host rendering for the Track changes options dialog.

interface RevisionMarkupChromeHandlers
MemberTypeSummary
onRequest?(session: RevisionMarkupDialogSession) => void

RevisionMarkupDialoginterfaceSource ↗

Viewer settings dialog supplied by the review module.

interface RevisionMarkupDialog
MemberTypeSummary
destroy
open

RevisionMarkupDialogHostinterfaceSource ↗

Local settings access for review chrome. No document mutations occur here.

interface RevisionMarkupDialogHost extends RevisionMarkupDialogSession
MemberTypeSummary
containerHTMLElement
translate?(key: string) => string | undefined

RevisionMarkupDialogSessioninterfaceSource ↗

A local settings draft owned by the editor.

interface RevisionMarkupDialogSession
MemberTypeSummary
applyCommit the draft and close. Returns false after cancellation.
canApply
cancelClose without committing the draft.
getRead the immutable draft.
resetRestore default preferences in the draft only.
setMerge validated options into the draft without committing preferences.
signalAbortSignalAborts on close, replacement, load, detach, destroy, or renderer disposal.
subscribeObserve draft changes, including effective external preference changes.

RevisionMarkupStyleinterfaceSource ↗

interface RevisionMarkupStyle<Mark extends string = RevisionMarkupMark>
MemberTypeSummary
colorRevisionMarkupColor
markMark

RevisionMarkupTextStyleinterfaceSource ↗

Viewer-only text styling. Document highlighting remains unchanged.

interface RevisionMarkupTextStyle<Mark extends string = RevisionMarkupMark> extends RevisionMarkupStyle<Mark>
MemberTypeSummary
backgroundRevisionMarkupNamedColor | 'byAuthor' | 'none'Background color behind revision text. Defaults to `none`.

RulerDragOptionsinterfaceSource ↗

How a ruler drag resolves: which grid it snaps to, and whether it snaps at all.

interface RulerDragOptions
MemberTypeSummary
precise?booleanAlt held: continuous, twip-precision drag, bypassing the snap grid — as in Word.
unit?RulerUnitWhich snap grid applies. Defaults to inches.

RulerIndentinterfaceSource ↗

A paragraph's indent as the ruler works with it. Twips; firstLine signed.

interface RulerIndent
MemberTypeSummary
firstLinenumber
leftnumber
rightnumber
rtl?booleanThe paragraph reads right to left. Its `left` indent is then the LEADING one, on the right margin, and its first-line offset counts from there, so the ruler axis mirrors.

RulerMarginTickinterfaceSource ↗

One horizontal ruler tick, in twips from the page's left sheet edge.

interface RulerMarginTick
MemberTypeSummary
heightnumberTick length in CSS pixels: 8 for a whole unit, 5 for a half, 3 or 2 for minor ticks.
label?stringWhole units from the paragraph's leading margin; omitted at the margin and on minor ticks.
positionnumberTwips from the page's left sheet edge.

RulerPageMetricsinterfaceSource ↗

The page the handles are placed against. Twips.

interface RulerPageMetrics
MemberTypeSummary
leftMarginnumber
pageWidthnumber
rightMarginnumber

RulerTickinterfaceSource ↗

One tick on the ruler: where it sits, how tall it is, and its label if it carries one.

interface RulerTick
MemberTypeSummary
heightnumber
label?stringWhole-unit label, omitted at the origin and on minor ticks.
positionnumberOffset along the ruler in content pixels.

RunTableChromeCommandResultinterfaceSource ↗

Result of [runTableChromeCommand](runTableChromeCommand): engine outcome plus post-pick draft on success.

interface RunTableChromeCommandResult
MemberTypeSummary
nextDraftTableChromeDraft | null
resultExecResult

ScrollToAnchorOptionsinterfaceSource ↗

Scroll settings for [EditorAnchorNavigation.scrollToAnchor](EditorAnchorNavigation.scrollToAnchor). Every field is optional. The fields match document refresh NavigateToChangeOptions.

interface ScrollToAnchorOptions
MemberTypeSummary
behavior?'instant' | 'smooth'Default: instant. Reduced motion uses instant even when smooth is requested.
block?ScrollPlacementTarget placement. The default depends on the method: `scrollToAnchor` uses `'centerIfNeeded'`, which keeps the viewport still for a visible target, and `scrollToBlock` uses `'start'`.
offsetPx?numberEdge padding for start/nearest placement, in CSS pixels. Default: 24. Finite and nonnegative.

SectionPropertiesinterfaceSource ↗

One section's resolved w:sectPr, as layout needs it.

Resolved, not raw: defaults the file omitted are filled in here (an absent w:type is nextPage), so layout never has to know which attributes were authored and which were inherited.

interface SectionProperties
MemberTypeSummary
breakTypeSectionBreakTypeAbsent `w:type` defaults to `nextPage`.
columnsSectionColumns
gridLinePitchTwips?numberActive document grid line pitch: line-unit paragraph margins and line snapping.
landscapeboolean
marginsSectionMargins
pageBorders?SectionPageBordersResolved `w:pgBorders` (§17.6.10). Absent when the section declares none, or when every edge it declares is off or an art border — see [parsePageBorders](parsePageBorders).
pageNumbering?SectionPageNumberingAuthored page-number type. Absent when `w:pgNumType` is missing; empty object when the element is present with no attributes (comprehensive-fixture shape).
pageSize{ readonly widthTwips: number; readonly heightTwips: number; }
titlePageboolean
verticalAlign?SectionVerticalAlignAuthored `w:vAlign` (§17.6.23) other than `top`: where the body sits between the top and bottom of the text area. Absent means top alignment.

SelectedDrawingOverlayTargetinterfaceSource ↗

The painted geometry of the selected drawing, plus what the overlay is allowed to do to it.

Carries BOTH the painted rect (points, for hit-testing and handle placement) and the stored extent (EMU, for writing back), so the overlay never has to convert between the two spaces to decide what it is looking at.

interface SelectedDrawingOverlayTarget
MemberTypeSummary
anchorFrameOrigin{ readonly x: number; readonly y: number; } | null
aspectLockedbooleanHard lock from `noChangeAspect` — never overridden by Shift.
canMoveboolean
canResizeboolean
heightnumber
heightEmunumber
idstring
kind'inline' | 'anchored'
pageIndexnumber
positionDrawingPositionInput | null
textbox?booleanKeep the text area available for pointer editing through the frame.
textEditable?booleanFalse for a text box whose text takes no caret: rotated or vertical text, or a story holding a table. Absent for a drawing that is not a text box.
transformDrawingTransform
widthnumber
widthEmunumber
xnumber
ynumber

SelectedImageStateinterfaceSource ↗

Canonical selected-image read model shared by [EditorSnapshot.image](EditorSnapshot.image) and [Editor.getSelectedImage](Editor.getSelectedImage).

interface SelectedImageState
MemberTypeSummary
canChangeWrapbooleanWhether `setImageWrapType` applies: pictures only, never text boxes.
canCropbooleanWhether `setImageProperties` can crop: pictures only, never text boxes.
canMovebooleanWhether `setImagePosition` can move the drawing. False for an inline drawing, which flows with its line, for a locked or hidden drawing, a rotated legacy VML text box, and in viewing mode.
canResizebooleanWhether `setImageProperties` can change the size. False for a hidden drawing, a drawing whose size is locked, a rotated legacy VML text box or one sized as a percentage of a frame, and in viewing mode. An inline text box resizes.
cropImageCropPercentCrop inset per edge in UI percent (0–100); OOXML stores permille (×1000).
descriptionstring
heightEmunumber
hiddenboolean
idstring
intrinsicReadonly<{ readonly pixelWidth: number; readonly pixelHeight: number; readonly dpiX: number; readonly dpiY: number; }> | null
kindDrawingKind
locksDrawingLocks
namestring
positionDrawingPositionInput | null
resourceStatusImageResourceState['kind']
rotationDegreesnumber
titlestring
widthEmunumber
wrapImageWrapTarget

SemanticPositioninterfaceSource ↗

A caret position in the model.

interface SemanticPosition
MemberTypeSummary
offsetnumber
paragraphIdstring

SemanticSelectioninterfaceSource ↗

A selection as two semantic positions — never as DOM nodes.

anchor is where the selection started and head is where it currently ends, so head before anchor is an ordinary backwards selection rather than an error. Collapsed when the two are equal, which is what a caret is.

interface SemanticSelection
MemberTypeSummary
anchorSemanticPosition
headSemanticPosition

SplitCellCountsinterfaceSource ↗

Typed split counts read against the cell's limits.

interface SplitCellCounts
MemberTypeSummary
counts{ readonly rows: number; readonly cols: number; } | nullThe counts to ask the engine about, or null while a problem stands.
problemSplitCellCountProblem | null

SplitCellLimitsinterfaceSource ↗

The most rows and columns a cell splits into, as splitCellConfig answers.

interface SplitCellLimits
MemberTypeSummary
maxColsnumber
maxRowsnumber

SurfaceEquationinterfaceSource ↗

One addressable inline equation and its compact editable projection.

interface SurfaceEquation
MemberTypeSummary
endnumber
fallbackTextstring
idstring
linearstring
paragraphIdstring
startnumber
supportedbooleanTrue when every source construct belongs to the editable subset.

SurfaceExtentinterfaceSource ↗

interface SurfaceExtent
MemberTypeSummary
heightnumber
pageOffsetXReadonlyMap<number, number>
widthnumber

SurfaceFormattinginterfaceSource ↗

What the selection is currently formatted as.

A value is present only when EVERY span in the selection agrees on it: a selection running from 11pt into 14pt has no font size, and a toolbar should show a blank rather than pick one of the two and imply the whole selection is that.

interface SurfaceFormatting
MemberTypeSummary
alignment'left' | 'center' | 'right' | 'both' | null
boldboolean
colorstring | null
direction'ltr' | 'rtl' | nullParagraph base direction through the cascade; null when the selection mixes them.
disagreesParagraphDisagreementsWhich of the paragraph-level reads above are `null` because the selection DISAGREES, as opposed to because nothing states them. See [ParagraphDisagreements](ParagraphDisagreements).
fontFamilystring | null
fontSizeHalfPointsnumber | nullHalf-points, the unit OOXML stores and the picker expects.
highlightstring | null
indentIndentFormatting | nullEffective indent at the selection, in twips, or null with no selection or inside a table.
italicboolean
lineSpacing{ readonly rule: 'multiple' | 'exact' | 'atLeast'; readonly value: number; } | null`w:spacing`'s line rule and its value: LINES for `multiple`, points for the other two (`w:line` is 240ths of a line under `auto` and twentieths of a point otherwise). The effective value: a paragraph whose cascade states none reads as single spacing (`multiple`, 1). Null when the selection's paragraphs disagree.
paragraphFlagsParagraphFlagsThe paragraph flags the Paragraph dialog shows as checkboxes, or null when the selection's paragraphs disagree about that one.
spaceAfterPtnumber | null
spaceBeforePtnumber | null`w:spacing/@w:before` and `@w:after` in points, null when the selection disagrees.
strikethroughboolean
styleIdstring | null
subscriptboolean
superscriptboolean
tabStopsreadonly ParagraphTabStop[] | nullThe paragraph's resolved custom tab stops, cascade included, or null when the selection disagrees or nothing is loaded. Positions in TWIPS, like every other measurement a control writes back.
underlineboolean

A hyperlink as the surface reports it: its identity, where it sits, and the SANITIZED target. href: null is an inert link — a refused scheme or a dangling relationship — which a UI shows and offers to edit but must never offer to open.

interface SurfaceHyperlink
MemberTypeSummary

SurfaceIndentAndListOpsinterfaceSource ↗

Indent and list commands of the paginated surface.

interface SurfaceIndentAndListOps
MemberTypeSummary
adjustIndentWord's Increase/Decrease Indent, over every paragraph the selection touches.
canAdjustIndentWhether Increase/Decrease Indent would do anything right now.
exitListOnEmptyItemEnter on an empty list item: outdent a level, or leave the list at level 0. Backspace at an item's start (`removeListNumber`): drop its number and keep the text in place. Both answer false when they did not handle the key, so the caller splits or joins.
indentWithTabTab (`increase`) or Shift+Tab (`decrease`) over a selection outside a list and outside a table cell (the key moves between cells there): change the indent and keep the text.
isListActiveWhether every paragraph the selection touches is already a list of `kind`.
isListParagraphWhether the paragraph at the caret is a list item, for Tab's Word-like fallback.
removeListNumberBackspace at the start of `paragraphId`: drop its list number; false if it is not one.
removeParagraphIndentBackspace at the start of an unnumbered `paragraphId`: remove its left and first-line or hanging indent, or step it back to the marker of the list item it lines up with.
setIndentSet indent to exact values on every paragraph the selection touches — what a ruler drag and an indent spinner both need, where [adjustIndent](adjustIndent) only steps.
toggleListWord's Bullets and Numbering buttons.

SurfaceNavigationinterfaceSource ↗

Moving the caret and the viewport: to a position, to a bookmark, or out to an external target.

[SurfaceNavigation.openExternal](SurfaceNavigation.openExternal) is THE external-activation call site, and it refuses anything but an already-sanitized href. Routing an authored target through some other path is how a document gets to choose where a click goes.

interface SurfaceNavigation
MemberTypeSummary
destroy
goToBookmarkScroll a bookmark into view and place the caret at it. Answers false for a name no bookmark declares — an inert click, which is what Word does with a dangling anchor.
goToPositionWith `orShow`, a story that cannot be opened is scrolled to without moving the caret into it, and the answer is `'shown'`. With `center`, the target is centered in the viewport unless it is already well inside it, so it never lands under chrome at the top edge.
openExternalTHE external-activation call site. Refuses anything but a sanitized projection, so a caller cannot route an authored target through it by mistake.

SurfaceOverlayCoordinatesinterfaceSource ↗

What an overlay needs to place itself over the painted pages: the zoom scale, and where each page sits horizontally.

Per-page X offsets rather than one origin, because pages are centred independently and a narrower page in a mixed-size document does not start where its neighbours do.

interface SurfaceOverlayCoordinates
MemberTypeSummary
pageOffsetXReadonlyMap<number, number>
paintScalenumber

SurfaceParagraphFormatinterfaceSource ↗

Every field of the Paragraph dialog, in the units the rest of this contract uses: points for spacing, TWIPS for indents.

An omitted field is left as authored. Where null is allowed it REMOVES the setting, which is not the same as writing a zero — a zero blocks the cascade, a removal lets the style through again.

interface SurfaceParagraphFormat
MemberTypeSummary
alignment?'left' | 'center' | 'right' | 'both'
contextualSpacing?boolean
direction?'ltr' | 'rtl'Base direction; see `directionalParagraphEntry` for what each value writes.
indentFirstLineTwips?number | nullONE signed first-line offset: negative is a hanging indent (§17.3.1.12).
indentLeftTwips?number | null
indentRightTwips?number | null
keepLines?boolean
keepNext?boolean
lineSpacing?{ readonly rule: 'multiple' | 'exact' | 'atLeast'; readonly value: number; } | null
pageBreakBefore?boolean
spaceAfterPt?number | null
spaceBeforePt?number | null
tabStops?readonly ParagraphTabStop[]Replace the paragraph's custom tab stops. An empty list CLEARS them, which is what Word's "Clear All" does; omit the field to leave them as authored.
widowControl?boolean

TableBorderStyleOptioninterfaceSource ↗

One entry in the border-style picker, with the CSS class that draws its preview line.

interface TableBorderStyleOption
MemberTypeSummary
labelKeystring
previewClassstringClass on the preview swatch. Defined in the core stylesheet, which both adapters import.
valueTableBorderStyle

TableBorderTargetOptioninterfaceSource ↗

One entry in the border-target picker: which edges it addresses, its icon, and its label key.

interface TableBorderTargetOption
MemberTypeSummary
iconkeyof typeof GENERATED_ICON_PATHS
labelKeystringi18n key, never a literal string — both adapters translate it themselves.
valueTableBorderTargetValue

TableBorderWidthOptioninterfaceSource ↗

One entry in the border-width picker.

interface TableBorderWidthOption
MemberTypeSummary
labelKeystring
previewThicknessnumberPoints, for drawing the preview swatch. `size / 8`.
sizenumber`w:sz` — eighths of a point, as OOXML stores border widths.

TableChromeDraftinterfaceSource ↗

UI draft: last active edge scope and the complete border spec to reapply.

interface TableChromeDraft
MemberTypeSummary
activeTargetTableBorderEdgeTarget
specTableBorderSpec

TableChromePickinterfaceSource ↗

What one table-chrome selection produced: the command to run, and the draft to remember.

Both halves matter. A border picker is stateful — choosing "dashed" and then "outside" must apply a dashed outside border — so each pick returns the COMPLETE spec to execute alongside the draft the next pick builds on.

interface TableChromePick
MemberTypeSummary
commandEditorCommand
nextDraftTableChromeDraft

TextFormFieldChromeHandlersinterfaceSource ↗

Framework-owned presentation for core-owned Field Options sessions.

interface TextFormFieldChromeHandlers
MemberTypeSummary
onRequest?(session: TextFormFieldDialogSession) => void

TextFormFieldDialogSessioninterfaceSource ↗

A core-owned options edit. Its signal aborts when the dialog must close.

interface TextFormFieldDialogSession
MemberTypeSummary
applySave one undoable edit. A refused write leaves the session open.
canApplyWhether the current target exists and permits editing. Draft validation happens on apply.
cancelClose without changing the document. Safe to call more than once.
fieldTextFormFieldRange
signalAbortSignal

TextMatchinterfaceSource ↗

One occurrence of a search query in the document.

Carries TWO addresses on purpose. blockId + start is the engine's own: stable across edits and independent of ordering. paragraphIndex + runIndex + runOffset is the positional one a find/replace UI needs to show and navigate results, and it is derived from the same walk rather than left to the caller to reconstruct — a caller guessing at run boundaries would send the selection to the wrong place.

A match can span runs when formatting changes mid-word; the run address is where it STARTS. scope identifies a non-body story so navigation opens the correct surface. A frame scope selects its anchoring drawing and never places a caret inside its story. A match inside a field result reports the field atom's model range. Its length is one, while text carries the visible match and can be longer. Select with start and length. Never derive the selected length from text.length.

interface TextMatch
MemberTypeSummary
blockIdstring
contextAfter?string
contextBefore?stringParagraph text immediately before and after the match, bounded at the derivation boundary. A results list shows the match in its sentence — "…as described in this **Exhi**bit A" — and nothing else in the contract can reach paragraph text, so a caller would otherwise have to re-read the document to render one row.
lengthnumber
paragraphIndexnumberParagraph ordinal within this match's story. Table and nested-table paragraphs count. Non-paragraph blocks add no ordinal.
runIndexnumberIndex of the run the match starts in, and the offset within that run.
runOffsetnumber
scope?ViewScopeStory containing the match. Absence means the body.
startnumberCharacter offset within the paragraph's concatenated run text.
textstringThe matched text as it appears in the document.

TextMeasurerinterfaceSource ↗

Text measurement, injected.

A real implementation shapes with the resolved font; the tests supply a deterministic one. Layout never reads the DOM, so this is the only way width and height enter it.

interface TextMeasurer
MemberTypeSummary
caretAdvancesOptional whole-span logical caret advances, indexed by UTF-16 offset. Values are nondecreasing, start at zero, and end at the measured advance. Ligature interiors may share an edge. Undefined selects a bounded approximate fallback.
hasResolvedFontWhether line metrics use an admitted face instead of approximate fallback metrics.
inkBoundsOptional conservative ink bounds for one grapheme, in points from its origin. Includes size and horizontal scale, but not trailing character spacing. Undefined keeps layout on the advance-only path.
lineMetricsLine metrics for the actual text faces; omitted text measures the primary face.
measureAdvance width of `text` in the resolved style.
strikeoutMetricsOptional `OS/2` strikeout stroke for the resolved face, at the drawn size. Word paints `w:separator` as a strikeout, so the note rule reads its thickness and offset here rather than assuming one face's numbers. Undefined keeps the caller's own default.
textOutlineOptional glyph outlines of a whole string, for text drawn as a shape (VML text art). Undefined when the face cannot answer; the shape then paints nothing rather than guess.

TocRemovalRefusalinterfaceSource ↗

Why a table of contents cannot be removed: none is addressed, or it cannot go now.

interface TocRemovalRefusal
MemberTypeSummary
code'notFound' | 'unsupported'
reasonstring

ToolbarCommandStateinterfaceSource ↗

Whether one control is enabled, and the engine's reason when it is not.

interface ToolbarCommandState
MemberTypeSummary
activebooleanWhether the command is currently APPLIED at the selection, from `Editor.isActive` — derived in the engine for marks and alignment, honest-false elsewhere.
disabledReasonstring | nullThe engine's reason when disabled — surfaced as a tooltip, never invented.
enabledboolean
idChromeSlotId
value?stringWhat the control currently SHOWS, for the slots whose answer is a value rather than a pressed state — the editing-mode pill, and image wrap when it lands.

ToolbarValueMapinterfaceSource ↗

Value types accepted by toolbar controls. Font size uses half-points.

interface ToolbarValueMap
MemberTypeSummary
"font.family"string
"font.size"number
"image.altText"string
"image.wrap"ImageWrapTarget
"list.lineSpacing"number
"review.editingMode"'editing' | 'suggesting' | 'viewing'
"styles.style"string
"text.color"string
"text.highlight"string

TreeApplyResultinterfaceSource ↗

What applying ops produced: whether it committed, and why not when it did not.

committed and rejected are separate flags because they are not opposites — a batch of zero ops neither commits nor is rejected.

interface TreeApplyResult
MemberTypeSummary
committedboolean
opCountnumber
reason?TreeBindingRejection | StoryTargetRejection | stringPresent when the edit was refused, so a host can report WHY rather than a silent no-op.
rejectedboolean

TreeDocxSessionViewinterfaceSource ↗

One open document: the canonical tree, and the only write path into it.

applyTreeOps is that path. Every mutation is a TreeDocOp addressed by node id plus UTF-16 offset, applied in one transaction, which is what makes cell and nested paragraphs ordinary rather than special cases.

Holds the whole package, not just the body — headers, footers, notes, comments and styles are all reachable through it, and parts the engine does not model are preserved verbatim.

interface TreeDocxSessionView extends HeadlessDocumentView
MemberTypeSummary
applyFragmentPasteLand a clipboard fragment (resource merge + blocks) as one package undo unit.
applyImagePropertiesApply image property tree ops plus hyperlink relationship wiring atomically.
applyTreeOpsCommit typed tree ops directly, as ONE transaction.
applyTreeOpsAtomicCommit several stories' ops as ONE transaction and ONE undo unit.
beginComposition
bodyTextBody text, paragraphs joined by newlines, read from the CANONICAL tree.
bookmarks`bookmarkName -> { paragraphId, offset }` over the main part, memoized per revision.
canRedo
canUndo
collaborationPortNarrow provider-neutral attachment over this session's canonical package store.
currentPackageThe current package with every opened story store merged in. Authority for layout resolution and save — never a swapped single-part view.
deleteCommentDelete a comment thread outright — body, thread state and story markers.
deleteCommentsDelete several comment objects as one package transaction and one undo unit.
deleteImageDelete a picture drawing and collect orphaned media in one package undo unit.
deleteImageTrackedPropose the drawing's deletion as a tracked change (`w:del`); media stays untouched.
documentFontsFont family names the document uses, from every `w:rFonts` in the CURRENT main part plus the styles and header/footer parts — validated, deduplicated, sorted. Memoized per package revision.
documentOutlineThe heading outline of the BODY story, in document order: paragraphs whose `w:pStyle` resolves to a heading through the styles part (built-in `heading N` name, or the style's own `w:outlineLvl` 0..8). Memoized per main-part revision — an edit can retitle, add or remove a heading, but the styles part cannot change in-session.
documentPropertiesThe document's own metadata from `docProps/core.xml` and `docProps/app.xml`, for document-property fields (TITLE, AUTHOR, SUBJECT, KEYWORDS, LASTSAVEDBY, COMMENTS). Read once per package revision; an empty object when the parts are absent.
documentStylesValidated style-picker projection. A document without styles answers `[]`.
documentThemeColorsThe theme's ten picker colours (`a:clrScheme`), in Word's column order, or `[]` when the package has no complete scheme. Memoized once: the theme part is immutable for the session's lifetime.
documentThemeFontsThe theme part's Latin typefaces, for resolving `w:rFonts` theme references in layout.
editablebooleanWhether the body holds at least one editable paragraph.
effectiveRunDefaultsThe run formatting a paragraph's content INHERITS when it authors none: the paragraph style's `basedOn` chain, then `w:docDefaults`, with theme `rFonts` attributes resolved through the font scheme. `runProperties` (the span's own authored properties) lets a theme-only run-level `w:rFonts` resolve too. This is what lets a toolbar always show the effective font, the way Word does.
embeddedFontsThe faces the package EMBEDS (`word/fontTable.xml` embed relationships), deobfuscated — the only font source that needs neither a substitute nor a network. Extraction asserts nothing about validity; admitting a face is the font resource lane's job. Memoized once: the font table and font parts are immutable in-session.
endComposition
ensureHyperlinkRelationshipThe relationship id for an external hyperlink target on the part owning `scope` (default: body), minting one if that part has none, or `null` when the URL is refused or the scoped part cannot be resolved.
ensureListDefinitionFind or create a `kind` list definition and answer the `w:numId` to name, or `null`.
ensureNumberingLevelDeclare `level` in the list definition `numId` names, with Word's default format for that depth, or answer false.
findTextEvery occurrence of `query` across editable stories, in navigation order. Each match uses the same offset vocabulary as tree operations and surface selections.
findTextMany queries in one walk of the document, one result per query in the same order.
hasReviewContentWhether the document carries review content — tracked changes or comment anchors — regardless of any review module. Derived from store vocabulary only (never the review model), memoized per revision: it is the free tier's honest "this document has more than you are seeing" signal.
headerFooterPartsThe resolved header/footer parts of the section, by variant (phase 2).
headerFooterPartsBySectionPer-section header/footer parts after OOXML inheritance, index-aligned with `enumerateDocumentSections`.
headerFooterResolutionBySectionPer-section resolution with declared-vs-inherited metadata for "Same as previous" chrome. Index-aligned with `headerFooterPartsBySection`.
insertCustomNode`scope` names the story the paragraph is in, and defaults to the body.
insertImageInsert a validated raster image as one package undo unit (task 12).
nodeIdOfCanonical node id for a `w14:paraId`, matched case-insensitively, or null.
numberingRootRoot of the numbering part tree (`w:numbering`), for list layout. Memoized once; `null` when the package has no numbering part. Numbering editing is a later slice.
packageRevisionPackage-wide revision — bumps on any story commit (body or HF).
paragraphAnchorsThe `w14:paraId` ↔ node-id index over the full editable set of the MAIN part, memoized per revision. Every editable paragraph carries a valid, part-unique id (established at open, maintained by the split appliers), so every paragraph is mapped. Header/footer paragraphs become addressable through `partFor` once their story store is open.
paragraphIdsCanonical node ids of the body paragraphs, in order.
paragraphIdsInCanonical node ids of paragraphs in a story scope. Defaults to the body. Header/footer scopes address the part `EditorScope { kind: 'headerFooter'; rId }` names.
paraIdOf`w14:paraId` of a canonical paragraph node id, verbatim, or null.
partThe current canonical BODY part — what layout reads for the main story.
partForThe current part for a story scope, or null when the target is refused.
redo
relationshipTargetWhat the owning part's relationships answer for one `r:id` under `scope` (default: body): the authored target and whether it is external. `null` for an id the part does not declare, or when the scoped part is not open.
removeCustomNodeRemove a custom node and the payload it bound. `scope` names the story holding it and defaults to the body; a chip in a header is refused against the body store.
renderedFontFamiliesFont families the document's RENDERED text resolves to, over the story roots only: direct run `w:rFonts` of text-bearing runs plus the style chains those runs, paragraphs and tables actually reference — never a declaration in an unused style. Memoized per package revision.
rendersTextWhether the document puts any literal character on a page, over the same roots [TreeDocxSessionView.documentFonts](TreeDocxSessionView.documentFonts) reads. Memoized per package revision.
replaceImageReplace a picture drawing's embedded media in one package undo unit.
replacePackageReplace the whole package with one derived from [currentPackage](currentPackage), as one package undo unit that publishes a `global` change. For writes that rebuild many parts, such as a compare.
replyToCommentReply to a comment, or add one over a revision's range. Returns the new comment's id.
reviewItemsEvery pending review decision in the document, memoized per revision.
revisionBody-store revision (independent of header/footer store revisions).
revisionForPer-story revision, or null when the target is refused.
saveSerialize the whole package back to DOCX bytes.
saveSteps[save](save) in steps a caller can pause between. The package is captured at the call, so the bytes describe the document as it was then, whatever happens between steps.
setCommentResolvedResolve a comment thread, or reopen it. False when the document holds no such comment.
settingsRootRoot of the settings part tree (`w:settings`), for document-wide layout constants such as `w:defaultTabStop`. Memoized once; `null` when the package has no settings part. Settings editing is a later slice, so this is immutable for the session.
storyPartsEvery part that holds a story, body first, then headers, footers and note parts.
storyTextText of a story scope, paragraphs joined by newlines.
stylesRootCurrent styles root for layout, or `null` when the package has no styles part.
subscribe
sweepCustomNodePayloadsDrop every payload no control binds, in the stores whose namespaces a module claims.
symbolFontFamiliesFont families named by a `w:sym/@w:font`, over the same roots [TreeDocxSessionView.documentFonts](TreeDocxSessionView.documentFonts) reads. Memoized per package revision.
trackingSettingsWhat `settings.xml` says about tracking — `w:trackRevisions`, the tracked-changes protection, and the two do-not-track switches.
undoUndo the last entry, returning the selection to restore.

UnsupportedElementinterfaceSource ↗

One occurrence that a custom component can replace: a placeholder for content the editor cannot render, or, with includePartial, a drawing that the editor renders without some features. The drawing fields are present only for drawings.

interface UnsupportedElement
MemberTypeSummary
bounds?LayoutBoxReserved geometry in document points, when the element has been laid out. Always present for a drawing, and it includes the effect extent, as the page of `createDrawingPreviewPackage` does.
drawing?InlineDrawingRecord | AnchoredDrawingRecordThe layout record of a drawing. Use `graphicKind` to identify the graphic: the record's `placeholderGraphicKind` names the graphic only for placeholders. A chart whose chart part can be read also carries `chart`, whose `shownAs` describes the native presentation. Absent for other content.
drawingIssues?readonly DrawingSupportIssue[]The features of this drawing that the editor does not show as authored, read from its own XML. Chart and diagram parts, inherited theme effects, and image bytes are not read, so an empty list does not prove fidelity. Never holds `unplaced-drawing` or `projection-diagnostic`, which only a report lists. For a placeholder, `graphicKind` names the graphic that the editor cannot draw.
equation?EquationSpanRecordThe layout record of an equation shown as the built-in placeholder.
graphicKind?DrawingGraphicKindThe graphic a drawing holds, such as `picture`, `chart`, or `diagram`, from its source. Note: `textbox` names every DrawingML shape, with or without text, and `shape` names only legacy VML drawings.
labelstringThe text of the built-in placeholder.
localNamestringThe local name of the source element, such as `drawing` or `AlternateContent`.
namespaceUristring | nullThe namespace of the source element, such as the WordprocessingML namespace.
nodeIdstringThe node the occurrence comes from, in the editor's current document.
ownerPartNamestringThe part that holds it, such as `/word/document.xml` or `/word/header1.xml`.
placement'inline' | 'block'`inline` inside a line of text, or `block` between paragraphs.
sourceOoxmlElement | nullLossless canonical source. Treat this value as read-only and untrusted. The object identity stays unchanged until the drawing content changes. Use `source` to identify cached previews across component remounts. Editor occurrences always provide a source. Standalone painters without a source lookup return `null`.
support?Exclude<DrawingSupport, 'native'>How completely the editor shows this drawing: `unrendered` for a placeholder, or `partial` for a drawing that renders without some features, offered only with `includePartial`. Absent for content that is not a drawing.

UnsupportedElementHostinterfaceSource ↗

A component mount point and its built-in fallback.

interface UnsupportedElementHost
MemberTypeSummary
elementHTMLElement
fallbackHTMLElement
keystringStable identity for one painted occurrence.
setCustomizedHide the default and expose custom controls to assistive technology. Restore with false.
slotHTMLElement
unsupportedUnsupportedElement

UnsupportedElementLayoutinterfaceSource ↗

Dimensions reserved before pagination, in document points.

interface UnsupportedElementLayout
MemberTypeSummary
heightnumberHeight in points: finite, positive, and at most 100,000.
widthnumberWidth in points: finite, positive, and at most 100,000.

UnsupportedElementRuleinterfaceSource ↗

The first matching registration renders each unsupported element.

interface UnsupportedElementRule
MemberTypeSummary
includePartial?booleanInclude partially rendered drawings (`support: 'partial'`). Defaults to `false`. Excludes fully supported drawings, hidden drawings, and drawings without a layout position. Excludes shapes with editable text. Partially rendered shapes without text remain eligible.
layout?UnsupportedElementLayoutThe box to reserve for content that has no layout box of its own, in points.
match?(element: UnsupportedElement) => booleanReturn true to replace this occurrence. Omit to match every offered occurrence. Offered occurrences also include equations and other content that is not a drawing; test `element.drawing` to match drawings only.

WatchHighlightsOptionsinterfaceSource ↗

Options for [watchHighlights](watchHighlights).

interface WatchHighlightsOptions extends HighlightOptions
MemberTypeSummary
onResult?(result: HighlightResult) => voidCalled when the applied and unavailable counts change.

WatermarkSizeinterfaceSource ↗

A width and a height in points.

interface WatermarkSize
MemberTypeSummary
heightnumber
widthnumber

Type aliases (84)

BookmarkSortOrdertypeSource ↗

How the Bookmark dialog orders its list: by name, or by where each bookmark is.

type BookmarkSortOrder = 'name' | 'location';

ChromeControlIdtypeSource ↗

Every control id in the chrome, as a literal union. Unique WITHIN a group, not globally (image.insert / table.insert) — key consumers on [ChromeSlotId](ChromeSlotId).

type ChromeControlId = ChromeSlotId extends `${string}.${infer C}` ? C : never;

ChromeControlStatetypeSource ↗

HOW a control reaches the engine — never WHETHER it is enabled.

Enabled state has exactly one source: toolbarCommandState(editor, slot), which asks Editor.can. The registry is static data and cannot know what the engine will honour at this selection, in this document, at this moment.

There used to be a fourth member, parityOnly, meaning "visible but permanently disabled". It was a second, static answer to the question Editor.can already answers, and it went stale the moment the engine wired underline, strike, the four alignments, the list commands and the four value slots: the registry still said parity-only, React ignored it and ran them, and Vue believed it and rendered twelve WORKING commands permanently disabled. A slot the engine has not wired needs no registry flag — commandForSlot answers null and toolbarCommandState disables the control with the engine's own words ("not wired to an editor command").

type ChromeControlState = 
/**
 * Dispatched as one fixed engine command: enabled when
 * `Editor.can(commandForSlot(slot))` succeeds, a click runs
 * `runToolbarCommand(editor, slot)`. The command is resolved from the SLOT id
 * through `commandForSlot` in toolbar-commands.ts — the one command table both
 * adapters share. A slot with no row there is simply not wired YET, and says so
 * through the engine rather than through this descriptor.
 */
{
    readonly kind: 'command';
}
/**
 * Dispatched with a PICKED value: `commandForSlotValue(slot, value)`. Enabled when
 * the engine would honour a well-formed value right now (`toolbarCommandState`
 * probes for exactly that), so the control needs chrome that produces a value — a
 * font list, a size, a colour — before a click means anything.
 *
 * A distinct kind because 'command' cannot describe it: there is no fixed command
 * to hand `Editor.can`, and a bare click has nothing to send.
 */
 | {
    readonly kind: 'value';
}
/** `Editor.save()` — not a command (see `runSave`). */
 | {
    readonly kind: 'save';
}
/**
 * `Editor.load()` — not a command either, and the exact twin of `save`: bytes cross the
 * boundary between the host and the engine, and only the host can produce them. The
 * control needs chrome that reads a file (a picker, a drop target) before a click means
 * anything, so a bare click has nothing to send — the same reason `save` is not `command`.
 *
 * A fourth kind rather than reusing `save` because the two dispatch in opposite
 * directions, and an adapter branching on `kind` must be able to tell them apart. Unlike
 * the deleted `parityOnly`, this one IS named by a control (`file.open`).
 */
 | {
    readonly kind: 'load';
}
/** Host conversion through `runChromeExport` or `runChromePrint`; not an editing command. */
 | {
    readonly kind: 'export';
};

ChromeExportFormattypeSource ↗

File menu conversion formats.

type ChromeExportFormat = 'markdown' | 'pdf';

ChromeGroupIdtypeSource ↗

Every group id in the chrome, as a literal union. Stable public API; renaming a group id is a breaking change.

type ChromeGroupId = 'history' | 'zoom' | 'styles' | 'font' | 'text' | 'script' | 'alignment' | 'direction' | 'list' | 'format' | 'review' | 'contentControl' | 'image' | 'table' | 'paragraph' | 'file' | 'insert';

ChromeMenuEntrytypeSource ↗

One row of a chrome menu.

type ChromeMenuEntry = ChromeMenuItemEntry | ChromeMenuSubmenuEntry | ChromeMenuSeparatorEntry;

ChromeMenuIdtypeSource ↗

Every menu id, as a literal union. Stable public API; renaming one is a breaking change, exactly like a group or slot id.

type ChromeMenuId = 'file' | 'format' | 'insert' | 'review' | 'help';

ChromePrintErrorCodetypeSource ↗

Why the browser could not print the converted PDF.

type ChromePrintErrorCode = 'pdf-viewer-unavailable' | 'pdf-load-failed' | 'print-refused' | 'print-ended';

ChromeSlotIdtypeSource ↗

The public slot vocabulary: ${groupId}.${controlId} for every control that actually exists — text.bold, font.family, alignment.left. THE stable contract a host composes against and commandForSlot resolves; renaming a slot is a breaking change.

type ChromeSlotId = 'history.undo' | 'history.redo' | 'zoom.level' | 'styles.style' | 'font.family' | 'font.size' | 'text.bold' | 'text.italic' | 'text.underline' | 'text.strike' | 'text.color' | 'text.highlight' | 'text.link' | 'script.super' | 'script.sub' | 'alignment.left' | 'alignment.center' | 'alignment.right' | 'alignment.justify' | 'direction.ltr' | 'direction.rtl' | 'list.bullet' | 'list.numbered' | 'list.outdent' | 'list.indent' | 'list.lineSpacing' | 'format.painter' | 'format.clear' | 'review.revisionMarkup' | 'review.comments' | 'review.addComment' | 'review.paragraphMarks' | 'review.bookmarks' | 'review.protectDocument' | 'review.compareDocuments' | 'review.simpleMarkup' | 'review.allMarkup' | 'review.noMarkup' | 'review.original' | 'review.previousChange' | 'review.nextChange' | 'review.acceptAllChanges' | 'review.rejectAllChanges' | 'review.authors' | 'review.editingMode' | 'contentControl.showAll' | 'contentControl.formFill' | 'contentControl.inspector' | 'contentControl.remove' | 'image.insert' | 'image.properties' | 'image.wrap' | 'image.altText' | 'table.insert' | 'table.borderTarget' | 'table.borderColor' | 'table.borderStyle' | 'table.borderWidth' | 'table.cellFill' | 'table.mergeCells' | 'table.splitCell' | 'file.open' | 'file.save' | 'file.exportMarkdown' | 'file.exportPdf' | 'file.print' | 'paragraph.dialog' | 'file.pageSetup' | 'insert.textBox' | 'insert.footnote' | 'insert.endnote' | 'insert.pageNumber' | 'insert.totalPages' | 'insert.sectionPages' | 'insert.pageXofY' | 'insert.pageBreak' | 'insert.sectionBreakNextPage' | 'insert.sectionBreakContinuous' | 'insert.toc' | 'insert.bookmark' | 'insert.goToBookmark' | 'insert.watermark';

ClearRefreshHighlightsOptionstypeSource ↗

Explicit highlight dismissal. Document edits always remove stale highlights immediately.

type ClearRefreshHighlightsOptions = ClearAnchorHighlightOptions;

CollectReviewItemstypeSource ↗

Derives the review queue — every pending revision decision and comment thread — from one story part plus its comment parts. Implemented by the pro review module; the free engine has no implementation and reports an empty queue.

type CollectReviewItems = (input: ReviewModelInput) => readonly ReviewItem[];

ColorLowerResulttypeSource ↗

A public colour lowered for a border or fill op, or the reason it could not be.

Refusals happen because paint needs a literal: a theme colour the document's theme does not define has no hex to draw, and inventing one would show a border in a colour the file never named.

type ColorLowerResult = {
    readonly ok: true;
    readonly color: TreeDocColorValue;
} | ColorLowerRefusal;

CommentMarkerStyletypeSource ↗

How a collapsed comment marker looks.

- 'initials': a badge with the thread author's initials in the author's color, a reply count, and a check mark when the thread is resolved. - 'icon': the comment icon.

type CommentMarkerStyle = 'initials' | 'icon';

CompareDocumentsBackgroundEnginetypeSource ↗

Runs a compare off the page's main thread, for example in a worker. The editor's Compare documents dialog uses it when the review module provides one. It reports progress, and it stops when signal aborts: the promise then rejects with the signal's reason.

type CompareDocumentsBackgroundEngine = (original: Uint8Array, revised: Uint8Array, options: CompareDocumentsEngineOptions, control: {
    readonly signal: AbortSignal;
    readonly onProgress: (progress: CompareDocumentsProgress) => void;
}) => Promise<CompareDocumentsBackgroundResult>;

CompareDocumentsBackgroundResulttypeSource ↗

Result of one background compare: like [CompareDocumentsEngineResult](CompareDocumentsEngineResult), as bytes.

type CompareDocumentsBackgroundResult = {
    readonly ok: true;
    readonly bytes: Uint8Array | null;
    readonly revisionCount: number;
    readonly changed: boolean;
} | {
    readonly ok: false;
    readonly code: CompareDocumentsEngineErrorCode;
    readonly reason?: CompareDocumentsRefusalReason;
    readonly message: string;
};

CompareDocumentsEnginetypeSource ↗

Compares the open document (the original) with a revised DOCX and returns the original with the differences as tracked changes. Synchronous, DOM-free, and free of side effects.

type CompareDocumentsEngine = (original: OoxmlPackage, revised: Uint8Array, options: CompareDocumentsEngineOptions) => CompareDocumentsEngineResult;

CompareDocumentsEngineErrorCodetypeSource ↗

Why the compare engine refused a compare, as a stable code: the codes that the engine, compareDocuments, and a background engine return. compareDocuments.errors.<code> in @docx-editor.dev/i18n translates every code.

type CompareDocumentsEngineErrorCode = 
/**
 * An option has a value of the wrong type, such as a `detectFormatChanges` that is not a
 * boolean, or the revised document is not a `Uint8Array`.
 */
'invalidOptions'
/** The original document is not a readable DOCX package. */
 | 'invalidOriginal'
/** The revised document is not a readable DOCX package. */
 | 'invalidRevised'
/** The documents exceed the compare's size limits. */
 | 'tooLarge'
/**
 * The original document enforces protection that the compare would break: read-only,
 * comments, forms, or tracked-changes protection. A compare also writes differences that
 * have no tracked form, such as style definitions and content control properties, so
 * tracked-changes protection refuses too.
 */
 | 'protected'
/** The differences include content that no tracked change can record. */
 | 'unsupportedContent';

CompareDocumentsEngineResulttypeSource ↗

Result of one document compare.

type CompareDocumentsEngineResult = {
    readonly ok: true;
    readonly package: OoxmlPackage;
    readonly revisionCount: number;
    readonly changed: boolean;
} | {
    readonly ok: false;
    readonly code: CompareDocumentsEngineErrorCode;
    readonly reason?: CompareDocumentsRefusalReason;
    readonly message: string;
};

CompareDocumentsErrorCodetypeSource ↗

Why a compare was refused, as a stable code. compareDocuments.errors.<code> in @docx-editor.dev/i18n translates every code. The engine and compareDocuments return [CompareDocumentsEngineErrorCode](CompareDocumentsEngineErrorCode) values. The editor command and dialog can also return the editor-only codes.

type CompareDocumentsErrorCode = CompareDocumentsEngineErrorCode
/** Editor only: no review module, no open document, or no mount. */
 | 'unavailable'
/** Editor only: a collaboration session is attached. */
 | 'collaboration'
/** Editor only: the document is open for viewing only. */
 | 'viewing'
/** Editor only: the dialog closed, or the compare was canceled, before it finished. */
 | 'closed'
/** Editor only: the revised file is a `Uint8Array` with no bytes. */
 | 'empty'
/**
 * Editor only: another compare of the same dialog runs, or a preview or an external document
 * refresh blocks writes to the document. Try again when it ends.
 */
 | 'busy'
/**
 * Editor only: the open document changed while a background compare ran, so its result
 * no longer applies. The editor never retries by itself.
 */
 | 'documentChanged'
/** Editor only: any other failure. */
 | 'failed';

CompareDocumentsOutcometypeSource ↗

The outcome of one compare.

type CompareDocumentsOutcome = {
    readonly ok: true;
    readonly revisionCount: number;
    readonly changed: boolean;
} | {
    readonly ok: false;
    readonly code: CompareDocumentsErrorCode;
    readonly reason?: CompareDocumentsRefusalReason;
    readonly message: string;
};

CompareDocumentsPhasetypeSource ↗

A step of a compare that runs in the background. The steps run in this order:

1. reading: read both documents. 2. comparing: find their differences. 3. checking: check that accepting and rejecting all changes give back each document. 4. applying: apply the result to the open document.

type CompareDocumentsPhase = 'reading' | 'comparing' | 'checking' | 'applying';

CompareDocumentsRefusalReasontypeSource ↗

What an unsupportedContent refusal is about, as a stable code. compareDocuments.reasons.<reason> in @docx-editor.dev/i18n translates every reason.

type CompareDocumentsRefusalReason = 
/** The documents differ inside a content control that is locked or bound to data. */
'lockedContent'
/** A document holds tracked changes that cannot be accepted, so its final state is unknown. */
 | 'unresolvedRevisions'
/** The documents differ in content with no tracked-change form, such as an embedded file. */
 | 'untrackedContent'
/** The revised document adds section or table settings that a reject cannot restore. */
 | 'unrecordedSettings'
/** A header or footer of an earlier section cannot be paired with one of the original. */
 | 'headerFooter'
/** The result needs a part type that the original document does not declare. */
 | 'packageStructure'
/**
 * The result fails the check: accepting all changes does not give the revised text, rejecting
 * them does not give the original text, or a tracked change cannot be accepted or rejected.
 */
 | 'unverified';

CustomFontsResolvertypeSource ↗

A font origin that supplies validated application font bytes on demand.

type CustomFontsResolver = MarkedFontResolver<(request: FontResolutionRequest) => Promise<LoadFontsResult>>;

DocumentSearchHighlighttypeSource ↗

Which matches a search interface highlights.

type DocumentSearchHighlight = 'all' | 'active' | 'none';

DrawingGraphicKindtypeSource ↗

The kind of graphic a drawing holds. Note: textbox names every DrawingML shape, with or without text, and shape names only legacy VML drawings.

Read from its source: picture, chart (a chart), diagram (SmartArt), textbox (a DrawingML shape, with or without text), group (a shape group), canvas (a drawing canvas), shape (a legacy VML drawing, such as WordArt), or graphic (any other graphic). It does not say whether the engine renders the graphic. The names match placeholderGraphicKind, which adds no picture and is set only for placeholders.

type DrawingGraphicKind = 'picture' | 'chart' | 'diagram' | 'shape' | 'group' | 'textbox' | 'canvas' | 'graphic';

DrawingPreviewPackageResulttypeSource ↗

A preview package, or why it could not be built.

- drawing-not-found: the target is not a drawing in the package. - too-many-parts or too-large: the drawing needs more than the limits allow.

type DrawingPreviewPackageResult = {
    readonly ok: true;
    readonly docx: Uint8Array;
    readonly pageFitsDrawing: boolean;
    readonly copiedParts: readonly string[];
} | {
    readonly ok: false;
    readonly reason: 'drawing-not-found' | 'too-many-parts' | 'too-large';
};

DrawingSelectionIntenttypeSource ↗

How the current selection came to address a drawing — see [PaginatedSurface.drawingSelectionIntent](PaginatedSurface.drawingSelectionIntent).

type DrawingSelectionIntent = {
    readonly kind: 'none';
} | {
    readonly kind: 'pointer';
    readonly drawingNodeId: string;
} | {
    readonly kind: 'programmatic';
};

DrawingSupporttypeSource ↗

How completely the editor shows a drawing:

- native: the editor renders the drawing and found no unsupported feature in its source. - partial: the editor renders the drawing, but without some features, or it shows a saved fallback. The issue list names the features. - unrendered: the editor shows a placeholder, or the drawing has no layout position.

A drawing that the document itself hides is native or partial: the editor shows it as authored, which is not at all.

Charts and SmartArt diagrams that the editor draws report native, because the check does not read their chart or diagram parts. Inherited theme effects and image bytes are not checked either.

type DrawingSupport = 'native' | 'partial' | 'unrendered';

FieldResultsModetypeSource ↗

How saved field results are addressed.

- atomic: every closed field is one offset unit. - editable: the results of CREATEDATE, DATE, FILENAME, FILLIN, HYPERLINK, MERGEFIELD, PRINTDATE, QUOTE, SAVEDATE, SEQ, and TIME fields are text when their results are unnested. Simple fields inside complex field results are not supported in this mode. Other nested results, other field types, and legacy FORMTEXT inputs keep their existing addressing.

type FieldResultsMode = 'atomic' | 'editable';

FieldShadingModetypeSource ↗

When a field's result is drawn on its grey block, following Word's own View option.

when-selected is Word's default and the reason the option exists at all: a document dense with cross-references turns largely grey under always, and under never a reader cannot tell computed text from typed text at all.

type FieldShadingMode = 'never' | 'when-selected' | 'always';

FontLoadFailureReasontypeSource ↗

Why one font did not load.

Distinguished rather than collapsed to "failed" because the responses differ: networkError and httpError are worth retrying, while hashMismatch and malformed mean the bytes were not what the source claimed and retrying will fetch the same wrong thing.

type FontLoadFailureReason = 'networkError' | 'httpError' | 'hashMismatch' | 'overLimit' | 'emptyResponse'
/** The declared face itself is unusable (empty family, out-of-range weight); nothing was fetched. */
 | 'invalidRequest'
/** The bytes are not a font at all — most often an HTML error page served with 200. */
 | 'malformed';

FontOrigintypeSource ↗

ONE font origin, in the one shape every origin takes: a finished configuration, a fragment, a promise for either, or a marked resolver that answers per document.

The point of the union is that packagedFonts(), googleFonts(), await defaultFonts() and a hand-built { sources } are all the same kind of thing, so a list of them needs no ordering rule beyond "first wins".

The resolver arm is [MarkedFontResolver](MarkedFontResolver), not bare FontResolver: a list may also hold a zero-argument loader, and only the mark separates the two.

type FontOrigin = FontConfiguration | FontConfigurationFragment | MarkedFontResolver | Promise<FontConfiguration | FontConfigurationFragment | undefined> | undefined;

FontResolvertypeSource ↗

Resolve fonts once the document's needs are known, instead of ahead of them.

Called after the file is mounted and again when editing requests a new family. Results compose with previously supplied faces; resolvedFaces identifies that coverage. Returning nothing is a valid answer — it means "I cover none of this", and the document stays on the fixed measurer.

A resolver that fetches makes opening a document perform network requests. That is a real change in posture and it must stay the APP's decision: the engine never supplies one, and the families here are file-derived, so a resolver must look them up in a set it shipped rather than interpolate them into a URL.

type FontResolver = (request: FontResolutionRequest) => FontConfiguration | FontConfigurationFragment | undefined | Promise<FontConfiguration | FontConfigurationFragment | undefined>;

HighlightSourcetypeSource ↗

Ranges for watchHighlights and useHighlights: an array, or a function of the editor that runs again after document changes.

type HighlightSource = readonly HighlightRange[] | ((editor: Editor) => readonly HighlightRange[]);

HostWindowtypeSource ↗

The window type of a realm: its own timers, observers and constructors.

type HostWindow = Window & typeof globalThis;

ImageContexttypeSource ↗

The selected image and what may be done to it — the imageContext query's answer.

An alias of SelectedImageState, kept as its own name because it is the query's result type and chrome is written against it.

type ImageContext = SelectedImageState;

ImageResizeHandletypeSource ↗

Which of the eight resize handles a drag started from, by compass direction.

type ImageResizeHandle = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';

ImageWrapTargettypeSource ↗

Nine Word wrap menu targets (inline plus eight floating modes).

type ImageWrapTarget = 'inline' | 'square' | 'squareLeft' | 'squareRight' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';

LineSpacingMenuValuetypeSource ↗

The line spacing a menu row stands for: lines for multiple, points otherwise.

type LineSpacingMenuValue = NonNullable<SurfaceFormatting['lineSpacing']>;

LockedControlNavigationtypeSource ↗

How the caret moves through an inline content control whose effective lock is contentLocked or sdtContentLocked.

- 'characters' (the default) — the caret walks through the control's characters, as in Word. - 'atomic' — the control is one caret unit, as a w:showingPlcHdr prompt already is. Arrows step over it, Shift+arrows select it whole, and a press or double click inside it selects it whole. A press on its edge still places a caret beside it.

It applies in the body, headers and footers; notes and text boxes publish no control boundaries, so they keep character navigation.

Navigation only: what a lock refuses does not change. The rule covers keyboard motions and the engine's own pointer gestures. A selection set in code (setSelection, find) is kept as given, and pointer: 'native' leaves caret placement to the browser.

type LockedControlNavigation = 'characters' | 'atomic';

MarkedFontResolvertypeSource ↗

A [FontResolver](FontResolver) that has been through [defineFontResolver](defineFontResolver).

This, not bare FontResolver, is what a FontOrigin list accepts. The mark is the only thing separating a resolver from a zero-argument loader, and getting that wrong loses every font silently, so the type asks for it up front.

type MarkedFontResolver<T extends FontResolver = FontResolver> = T & FontResolverMark;

One caret movement, in Word's own vocabulary.

Visual rather than logical where the two differ: left means left on screen, which in right-to-left text is forward through the string.

type NavigationCommand = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'lineStart' | 'lineEnd' | 'documentStart' | 'documentEnd' | 'pageUp' | 'pageDown';

OpenPaginatedResulttypeSource ↗

What opening a document produced: a mounted surface, or a refusal.

A result rather than a throw, because every refusal here comes from FILE input — a package the bounded reader rejected, a part that exceeded a limit — and a malformed upload should surface as a message the host can show rather than an exception it has to catch.

type OpenPaginatedResult = {
    readonly ok: true;
    readonly surface: PaginatedSurface;
} | {
    readonly ok: false;
    readonly reason: string;
    readonly detail?: string;
    readonly limit?: string;
};

ParagraphFlagKeytypeSource ↗

The five members that are checkboxes, and so share a label key with their control. *

type ParagraphFlagKey = 'contextualSpacing' | 'keepNext' | 'keepLines' | 'widowControl' | 'pageBreakBefore';

ParagraphFlagStatetypeSource ↗

One tri-state paragraph flag: on, off, or "the selection disagrees".

type ParagraphFlagState = boolean | null;

RefreshFailureCodetypeSource ↗

Stable refusal codes for external document replacement.

type RefreshFailureCode = 'unavailable' | 'collaboration' | 'busy' | 'cancelled' | 'superseded' | 'document-changed' | 'local-edits' | 'out-of-order' | 'invalid-result' | 'invalid-document' | 'input-failed' | 'load-failed' | 'recovery-failed';

RefreshHighlightAnimationtypeSource ↗

Opacity fade settings. Reduced motion caps fades at 125ms.

type RefreshHighlightAnimation = AnchorHighlightAnimation;

RefreshResulttypeSource ↗

Completion belongs to one result, including refusals and recovery failures.

type RefreshResult = {
    readonly ok: true;
    readonly resultId: string;
    readonly changes: readonly RefreshChange[];
    readonly changeInformation: 'available' | 'unavailable';
    readonly failures: readonly string[];
} | {
    readonly ok: false;
    readonly resultId: string;
    readonly code: RefreshFailureCode;
    readonly recovered?: boolean;
};

RenderableImageMimetypeSource ↗

Every mime the painter can hand to an <img>.

type RenderableImageMime = SupportedImageMime | VectorImageMime;

ResolvedChromePrintSettingstypeSource ↗

Print settings with every choice made.

type ResolvedChromePrintSettings = Required<ChromePrintSettings>;

ReviewDiagnosticCodetypeSource ↗

Why accepting, rejecting or re-authoring a tracked change skipped an item.

type ReviewDiagnosticCode = 'review.revision-unsupported' | 'review.incomplete-group' | 'review.retained-structure' | 'review.locked-content' | 'review.bound-content' | 'review.stale-revision';

ReviewDisplayModetypeSource ↗

The views the review chrome offers, in Word's terms: the three layout projections plus Simple Markup, which reads as the proposed result with a red change bar beside every line a change touched — the document as accepting everything would leave it, and where.

type ReviewDisplayMode = RevisionDisplayMode | 'simple-markup';

ReviewOperationtypeSource ↗

What a tracked-change request was asked to do.

type ReviewOperation = 'accept' | 'reject' | 'reassign';

ReviewPaneOpeningtypeSource ↗

When the review pane opens by itself.

- 'auto': the pane opens when a document with review items loads, and when a tracked change is made while it is closed, in both cases when the pane has items to list. With revisionsIn: 'balloons' the pane lists no tracked change and no reply to one, so tracked changes and their replies alone do not open it. - 'manual': the pane stays closed until the host or the user opens it. Use it when the host shows review items its own way, such as in balloons or margin markers.

type ReviewPaneOpening = 'auto' | 'manual';

ReviewPaneOverflowtypeSource ↗

What the open review pane does when its full card column does not fit beside the page at the page's zoom.

- 'float': the pane shrinks to a strip of markers, and the open card floats over the page. - 'shrinkPage': under a fit zoom mode, the page may shrink down to the mode's minZoom (or 10%) so that the full column fits. The pane changes to the marker strip only when the column does not fit at that floor either. A fixed zoom behaves as 'float'. - 'scroll': the page keeps the size it has beside the closed pane's marker strip, and the full column stands beside it. The document and the column scroll together: the viewport scrolls sideways to reach the cards.

The setting applies to the review pane only. The navigation pane stays docked at its side in every mode: it never scrolls with the document, and it takes its room beside the page exactly as it does with no review pane.

type ReviewPaneOverflow = 'float' | 'shrinkPage' | 'scroll';

ReviewWriteIntenttypeSource ↗

Which review write is being committed through commitReviewOps.

The callback that performs the write is opaque, so a lane deciding whether to allow it cannot tell an Accept from a comment delete. That mattered once a replica was attached: these paths reach the store directly rather than through applyTreeOps, and the ones that graft a package and swap the shell record no primitive effects — they replicate as NOTHING, leaving the peer a commentReference naming a comment it never received. Naming the write lets each be admitted only once a two-replica test proves it arrives whole.

type ReviewWriteIntent = 'revision-resolve' | 'revision-attribution' | 'comment-add' | 'comment-reply' | 'comment-resolve' | 'comment-delete' | 'package-scoped';

RevisionChangedLinesMarktypeSource ↗

type RevisionChangedLinesMark = 'none' | 'leftBorder' | 'rightBorder' | 'outsideBorder';

RevisionDeletionMarktypeSource ↗

type RevisionDeletionMark = RevisionMarkupMark | 'hidden' | 'caret' | 'pound';

RevisionDisplaytypeSource ↗

Where tracked changes open.

- 'pane': the review pane lists tracked changes as cards beside the comments. - 'balloons': the pane lists comments only, except comments that reply to a tracked change: the change's balloon shows those. A tracked change opens in a balloon at its text when the reader clicks it, or when Next Change, Previous Change, or setActiveReviewItem(key, { announce: true }) reaches it. A replacement is one balloon. In both settings, Next Change and Previous Change stop on a replacement once.

type RevisionDisplay = 'pane' | 'balloons';

RevisionMarkupColortypeSource ↗

type RevisionMarkupColor = RevisionMarkupNamedColor | 'byAuthor' | 'auto';

RevisionMarkupMarktypeSource ↗

type RevisionMarkupMark = 'none' | 'colorOnly' | 'bold' | 'italic' | 'underline' | 'doubleUnderline' | 'strikethrough' | 'doubleStrikethrough';

RevisionMarkupNamedColortypeSource ↗

type RevisionMarkupNamedColor = (typeof REVISION_MARKUP_COLORS)[number];

RevisionMarkupOptionstypeSource ↗

Partial viewer preferences. Omitted values keep the previous value.

type RevisionMarkupOptions = {
    readonly [K in keyof ResolvedRevisionMarkup]?: ResolvedRevisionMarkup[K] extends boolean ? boolean : Partial<ResolvedRevisionMarkup[K]>;
};

RevisionStylestypeSource ↗

How painted tracked changes are coloured.

- 'author' (the DEFAULT) — every change takes its author's colour from the --doc-review-author-N ramp. An attached document seeds slots by order of first appearance, then keeps those assignments stable for that session. Word's own default, and the reason it is this engine's: a paragraph three people edited has to read as three people. Restyle a slot under .docx-editor to change the ramp. - 'kind' — insertions and deletions take the two kind colours (--doc-revision-insertion / --doc-revision-deletion), so "added" and "removed" are what a reader tells apart at a glance, whoever proposed them. - [RevisionAuthorAssignments](RevisionAuthorAssignments) — style the named authors; others decides whether the rest take the ramp (the default) or the kind colours.

Presentation only: nothing here is ever serialised into the document.

type RevisionStyles = 'kind' | 'author' | RevisionAuthorAssignments;

RulerIndentHandletypeSource ↗

The four handles Word's ruler carries.

hanging and left sit at the SAME position and differ only in what a drag takes with them — the box moves the whole paragraph, the triangle leaves the first line where it is.

type RulerIndentHandle = 'firstLine' | 'hanging' | 'left' | 'right';

RulerUnittypeSource ↗

Which measurement system the ruler shows. Drives both tick cadence and drag snapping.

type RulerUnit = 'inch' | 'cm';

ScrollPlacementtypeSource ↗

Where a scroll places its target in the viewport.

- 'start': near the top, like a jump to a heading. - 'center': centred. - 'centerIfNeeded': still while the target is on screen, centred when it has to move. - 'nearest': the minimum scroll, which leaves the target at the edge it came in from.

Each method that takes a placement states its own default.

type ScrollPlacement = 'start' | 'center' | 'centerIfNeeded' | 'nearest';

SectionAnchortypeSource ↗

How a section-addressed op should name the section a caret is in.

w:sectPr lives on the body story, so the op can only name BODY content — and a caret in a header or a note is not body content. The three answers are genuinely different, and collapsing them to "a paragraph or null" is what let an unaddressable section quietly become a document-wide write.

type SectionAnchor = 
/** Name this body paragraph. Its section is the one the caret is in. */
{
    readonly kind: 'anchor';
    readonly paragraphId: string;
}
/** One section: an anchor names nothing extra, so the op may omit it. */
 | {
    readonly kind: 'whole-document';
}
/**
 * Several sections, and the caret's holds no paragraph to name.
 *
 * An omitted anchor here would write EVERY section, which is what `scope: 'document'` is
 * for — so answering it to a `scope: 'section'` request changes sections nobody asked
 * about. There is no anchor that reaches an empty final section: one exists only when every
 * paragraph already closes an earlier section, so nothing sits at or after it.
 */
 | {
    readonly kind: 'unaddressable';
};

SectionBreakInsertTypetypeSource ↗

Where the section after an inserted break begins — Word's Layout Breaks menu.

evenPage / oddPage sections from a file paginate with their blank parity sheet, but inserting one is not offered here.

type SectionBreakInsertType = 'nextPage' | 'continuous';

SectionVerticalAligntypeSource ↗

w:sectPr/w:vAlign values other than the default top.

type SectionVerticalAlign = 'center' | 'bottom' | 'both';

SpecialIndenttypeSource ↗

The "Special" pair: the signed first-line offset, split into a kind and a magnitude. *

type SpecialIndent = 'none' | 'firstLine' | 'hanging';

SplitCellCountProblemtypeSource ↗

Why typed counts cannot split, before the engine is asked.

type SplitCellCountProblem = {
    readonly kind: 'range';
    readonly field: 'columns' | 'rows';
    readonly max: number;
} | {
    readonly kind: 'oneCell';
};

SupportedImageMimetypeSource ↗

Raster media the decode port measures and any authoring path may write.

BMP and WebP are here for the same reason the other three are: an <img> decodes them natively, so they need a signature and a structural header and nothing else. BMP is what older documents carry; WebP is what current Word writes.

type SupportedImageMime = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/bmp' | 'image/webp';

SurfaceInsertImageInputtypeSource ↗

What a host may set on a surface image insert.

The decode port and the collaboration actor are the SURFACE's to supply. An actor a host could pass would be a second identity for the same mint, which is the thing actor-scoped allocation exists to prevent.

type SurfaceInsertImageInput = Omit<InsertImageInput, 'decodePort' | 'actorId'>;

TabAlignmenttypeSource ↗

type TabAlignment = 'left' | 'center' | 'right' | 'decimal' | 'bar';

TabLeaderNametypeSource ↗

type TabLeaderName = 'none' | 'dot' | 'hyphen' | 'underscore';

TableBorderTargetValuetypeSource ↗

Border target picker value — concrete scopes plus clear (none).

type TableBorderTargetValue = TableBorderEdgeTarget | 'none';

TableChromeSlotIdtypeSource ↗

The chrome slots that only exist while the caret is inside a table.

A subset of ChromeSlotId, so these names are public API on the same terms — renaming one is a breaking change.

type TableChromeSlotId = 'table.borderTarget' | 'table.borderColor' | 'table.borderStyle' | 'table.borderWidth' | 'table.cellFill';

TableInteractionLabelKeytypeSource ↗

Keys for the table furniture's accessible names, resolved by tableInteractionLabel.

type TableInteractionLabelKey = 'table.insertRowBelow' | 'table.insertColumnRight' | 'table.selectTable';

ToolbarSlotValuetypeSource ↗

type ToolbarSlotValue<K extends ToolbarValueSlot> = K extends keyof ToolbarValueMap ? ToolbarValueMap[K] : unknown;

ToolbarValueSlottypeSource ↗

type ToolbarValueSlot = keyof ToolbarValueMap | TableChromeSlotId;

TrackedChangeFilterModetypeSource ↗

How revisions excluded by a tracked-changes predicate project into the view.

type TrackedChangeFilterMode = 'accept' | 'reject';

TrackedChangePredicatetypeSource ↗

Decides whether one tracked change renders as markup.

Return true to keep the revision visible as tracked markup. Return false to render it with the selected [TrackedChangeFilterMode](TrackedChangeFilterMode) without changing the document. The callback receives the complete revision item, including its author, date, kind, text, ranges, nesting, and resolution metadata.

type TrackedChangePredicate = (revision: ReviewRevisionItem) => boolean;

VectorImageMimetypeSource ↗

Vector media painted straight from validated bytes. An <img> renders SVG in the browser's secure static mode — no script, no external subresource loads — so there is no decode step and no raster buffer sized by a file-supplied number.

type VectorImageMime = 'image/svg+xml';

Variables (50)

AUTO_ZOOM_MODEconstSource ↗

Fit the page width, but never magnify and never shrink past legibility: the default.

A wide container keeps the 100% it has always had, and only one too narrow to hold the sheet shrinks. Uncapped fitting would render a Letter page at 183% on a 1600px monitor, which is a reader app, not Word; unfloored fitting would render it at 20% beside an open comments rail on a phone.

AUTO_ZOOM_MODE: ZoomMode

BROWSER_AUTOMATION_CAPABILITIESconstSource ↗

What a browser host can do.

selection, scrolling and layout are true because a mounted editor genuinely has a caret, a scroll container and paginated layout — a consumer may branch on them. The DOCUMENT operations behave identically to the headless host regardless; the extra capabilities widen what may be asked later, never what an existing operation means.

BROWSER_AUTOMATION_CAPABILITIES: AutomationCapabilities

CHROME_GROUPSconstSource ↗

The complete chrome, in bar order. Literal-typed (as const) so the slot-id vocabulary below is derived from the data and cannot drift from it.

Taxonomy taste: ids are short, lowercaseCamel, and never repeat their group's name (alignment.left, not alignment.alignLeft; font.family, not font.fontFamily).

CHROME_GROUPS: readonly [{
    readonly id: 'history';
    readonly labelKey: 'formattingBar.groups.history';
    readonly controls: readonly [{
        readonly id: 'undo';
        readonly labelKey: 'formattingBar.undoShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'redo';
        readonly labelKey: 'formattingBar.redoShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'zoom';
    readonly labelKey: 'formattingBar.groups.zoom';
    readonly controls: readonly [{
        readonly id: 'level';
        readonly shape: 'stepper';
        readonly valueText: '100%';
        readonly labelKey: 'formattingBar.groups.zoom';
        readonly paths: null;
        readonly valueKey: 'zoom.zoomLevel';
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'styles';
    readonly labelKey: 'formattingBar.groups.styles';
    readonly controls: readonly [{
        readonly id: 'style';
        readonly shape: 'dropdown';
        readonly labelKey: 'styles.selectAriaLabel';
        readonly paths: null;
        readonly valueKey: 'styles.normalText';
        readonly state: {
            readonly kind: 'value';
        };
    }];
}, {
    readonly id: 'font';
    readonly labelKey: 'formattingBar.groups.font';
    readonly controls: readonly [{
        readonly id: 'family';
        readonly shape: 'dropdown';
        readonly labelKey: 'font.selectAriaLabel';
        readonly paths: null;
        readonly valueKey: 'font.sansSerif';
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'size';
        readonly shape: 'stepper';
        readonly valueText: '11';
        readonly labelKey: 'fontSize.listLabel';
        readonly paths: null;
        readonly valueKey: 'fontSize.label';
        readonly state: {
            readonly kind: 'value';
        };
    }];
}, {
    readonly id: 'text';
    readonly labelKey: 'formattingBar.groups.textFormatting';
    readonly controls: readonly [{
        readonly id: 'bold';
        readonly labelKey: 'formattingBar.boldShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'italic';
        readonly labelKey: 'formattingBar.italicShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'underline';
        readonly labelKey: 'formattingBar.underlineShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'strike';
        readonly labelKey: 'formattingBar.strikethrough';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'color';
        readonly shape: 'colorSplit';
        readonly swatch: '#ff0000';
        readonly labelKey: 'formattingBar.fontColor';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'highlight';
        readonly shape: 'colorSplit';
        readonly swatch: '#ffff00';
        readonly labelKey: 'formattingBar.highlightColor';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'link';
        readonly labelKey: 'formattingBar.insertLinkShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'script';
    readonly labelKey: 'formattingBar.groups.script';
    readonly controls: readonly [{
        readonly id: 'super';
        readonly labelKey: 'formattingBar.superscript';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'sub';
        readonly labelKey: 'formattingBar.subscript';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'alignment';
    readonly labelKey: 'formattingBar.groups.alignment';
    readonly controls: readonly [{
        readonly id: 'left';
        readonly labelKey: 'alignment.alignLeft';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'center';
        readonly labelKey: 'alignment.center';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'right';
        readonly labelKey: 'alignment.alignRight';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'justify';
        readonly labelKey: 'alignment.justify';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'direction';
    readonly labelKey: 'formattingBar.groups.direction';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'ltr';
        readonly labelKey: 'toolbar.leftToRight';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'rtl';
        readonly labelKey: 'toolbar.rightToLeft';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'list';
    readonly labelKey: 'formattingBar.groups.listFormatting';
    readonly controls: readonly [{
        readonly id: 'bullet';
        readonly labelKey: 'lists.bulletList';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'numbered';
        readonly labelKey: 'lists.numberedList';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'outdent';
        readonly labelKey: 'lists.decreaseIndent';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'indent';
        readonly labelKey: 'lists.increaseIndent';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'lineSpacing';
        readonly shape: 'dropdown';
        readonly labelKey: 'lineSpacing.label';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'format';
    readonly labelKey: 'formattingBar.groups.format';
    readonly controls: readonly [{
        readonly id: 'painter';
        readonly labelKey: 'formattingBar.formatPainterShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'clear';
        readonly labelKey: 'formattingBar.clearFormatting';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'review';
    readonly labelKey: 'formattingBar.commentsAndChanges';
    readonly controls: readonly [{
        readonly id: 'revisionMarkup';
        readonly shape: 'icon';
        readonly labelKey: 'revisionMarkup.title';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'simpleMarkup';
        readonly shape: 'icon';
        readonly labelKey: 'review.simpleMarkup';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'allMarkup';
        readonly shape: 'icon';
        readonly labelKey: 'review.allMarkup';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'noMarkup';
        readonly shape: 'icon';
        readonly labelKey: 'review.noMarkup';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'original';
        readonly shape: 'icon';
        readonly labelKey: 'review.original';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'previousChange';
        readonly shape: 'icon';
        readonly labelKey: 'review.previousChange';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'nextChange';
        readonly shape: 'icon';
        readonly labelKey: 'review.nextChange';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'acceptAllChanges';
        readonly shape: 'icon';
        readonly labelKey: 'review.acceptAllChanges';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'rejectAllChanges';
        readonly shape: 'icon';
        readonly labelKey: 'review.rejectAllChanges';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'paragraphMarks';
        readonly shape: 'icon';
        readonly labelKey: 'formattingBar.paragraphMarks';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'bookmarks';
        readonly shape: 'icon';
        readonly labelKey: 'formattingBar.showBookmarks';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'protectDocument';
        readonly shape: 'icon';
        readonly labelKey: 'review.protectDocument';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'compareDocuments';
        readonly shape: 'icon';
        readonly labelKey: 'review.compareDocuments';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'comments';
        readonly shape: 'icon';
        readonly labelKey: 'formattingBar.commentsAndChanges';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'addComment';
        readonly shape: 'icon';
        readonly labelKey: 'formattingBar.addComment';
        readonly defaultToolbar: false;
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'authors';
        readonly shape: 'dropdown';
        readonly labelKey: 'reviewers.label';
        readonly paths: readonly string[];
        readonly defaultToolbar: false;
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'editingMode';
        readonly shape: 'dropdown';
        readonly labelKey: 'editingMode.label';
        readonly valueKey: 'editingMode.editing';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'contentControl';
    readonly labelKey: 'contentControl.group';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'showAll';
        readonly labelKey: 'contentControl.showAll';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'formFill';
        readonly labelKey: 'contentControl.formFill';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'inspector';
        readonly labelKey: 'contentControl.inspector';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'remove';
        readonly labelKey: 'contentControl.remove';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'image';
    readonly labelKey: 'formattingBar.groups.image';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'insert';
        readonly labelKey: 'toolbar.image';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'properties';
        readonly labelKey: 'formattingBar.imagePropertiesShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'wrap';
        readonly shape: 'dropdown';
        readonly labelKey: 'formattingBar.imageWrap';
        readonly paths: readonly string[];
        readonly valueKey: 'imageWrap.inline';
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'altText';
        readonly shape: 'dropdown';
        readonly labelKey: 'formattingBar.altText';
        readonly paths: null;
        readonly valueKey: 'imageProperties.altText';
        readonly state: {
            readonly kind: 'value';
        };
    }];
}, {
    readonly id: 'table';
    readonly labelKey: 'formattingBar.groups.table';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'insert';
        readonly labelKey: 'toolbar.table';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'borderTarget';
        readonly shape: 'dropdown';
        readonly labelKey: 'table.borders.tooltip';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'borderColor';
        readonly shape: 'colorSplit';
        readonly swatch: '#000000';
        readonly labelKey: 'table.borderColor';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'borderStyle';
        readonly shape: 'dropdown';
        readonly labelKey: 'table.borders.styleAriaLabel';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'borderWidth';
        readonly shape: 'dropdown';
        readonly labelKey: 'table.borderWidth';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'cellFill';
        readonly shape: 'colorSplit';
        readonly swatch: '#ffffff';
        readonly labelKey: 'table.cellFillColor';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'value';
        };
    }, {
        readonly id: 'mergeCells';
        readonly labelKey: 'table.mergeCells';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'splitCell';
        readonly labelKey: 'table.splitCell';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'paragraph';
    readonly labelKey: 'dialogs.paragraph.title';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'dialog';
        readonly labelKey: 'lineSpacing.options';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'file';
    readonly labelKey: 'toolbar.file';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'open';
        readonly labelKey: 'toolbar.open';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'load';
        };
    }, {
        readonly id: 'save';
        readonly labelKey: 'toolbar.saveShortcut';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'save';
        };
    }, {
        readonly id: 'exportMarkdown';
        readonly labelKey: 'toolbar.exportMarkdown';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'export';
        };
    }, {
        readonly id: 'exportPdf';
        readonly labelKey: 'toolbar.exportPdf';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'export';
        };
    }, {
        readonly id: 'print';
        readonly labelKey: 'toolbar.print';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'export';
        };
    }, {
        readonly id: 'pageSetup';
        readonly labelKey: 'toolbar.pageSetup';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}, {
    readonly id: 'insert';
    readonly labelKey: 'toolbar.insert';
    readonly contextual: true;
    readonly controls: readonly [{
        readonly id: 'textBox';
        readonly labelKey: 'toolbar.insertTextBox';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'footnote';
        readonly labelKey: 'toolbar.insertFootnote';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'endnote';
        readonly labelKey: 'toolbar.insertEndnote';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'pageNumber';
        readonly labelKey: 'headerFooter.insertPageNumber';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'totalPages';
        readonly labelKey: 'headerFooter.insertTotalPages';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'sectionPages';
        readonly labelKey: 'headerFooter.insertSectionPages';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'pageXofY';
        readonly labelKey: 'headerFooter.insertPageXofY';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'pageBreak';
        readonly labelKey: 'toolbar.pageBreak';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'sectionBreakNextPage';
        readonly labelKey: 'toolbar.sectionBreakNextPage';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'sectionBreakContinuous';
        readonly labelKey: 'toolbar.sectionBreakContinuous';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'toc';
        readonly labelKey: 'toolbar.tableOfContents';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'bookmark';
        readonly labelKey: 'toolbar.bookmark';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'goToBookmark';
        readonly labelKey: 'toolbar.goToBookmark';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }, {
        readonly id: 'watermark';
        readonly labelKey: 'toolbar.watermark';
        readonly paths: readonly string[];
        readonly state: {
            readonly kind: 'command';
        };
    }];
}]

CHROME_MENUSconstSource ↗

The menu bar the chrome shows above the toolbar, in bar order: File, Format, Insert, Review, Help.

CHROME_MENUS: readonly ChromeMenu[]

CHROME_PRINT_DISPLAY_MODESconstSource ↗

The display modes a print form offers, in Review menu order, with their label keys.

CHROME_PRINT_DISPLAY_MODES: readonly {
    readonly mode: ReviewDisplayMode;
    readonly labelKey: 'review.simpleMarkup' | 'review.allMarkup' | 'review.noMarkup' | 'review.original';
}[]

CHROME_UNAVAILABLE_KEYconstSource ↗

Tooltip for adapter controls without a picker; command refusals use engine reasons.

CHROME_UNAVAILABLE_KEY = "formattingBar.unavailableInPreview"

COMPARE_DOCUMENTS_ACCEPTconstSource ↗

The accept value for a file input that picks the revised document: DOCX files only.

COMPARE_DOCUMENTS_ACCEPT = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"

COMPARE_DOCUMENTS_PHASE_ATTRIBUTEconstSource ↗

The attribute that marks a Compare documents dialog's busy status: the step of a running compare in words. [focusCompareDocumentsControl](focusCompareDocumentsControl) focuses it while nothing else can take focus.

COMPARE_DOCUMENTS_PHASE_ATTRIBUTE = "data-docx-compare-phase"

CONTENT_CONTROL_PICTURE_ACCEPTconstSource ↗

The accept list of the engine's picker: what replaceImage takes.

CONTENT_CONTROL_PICTURE_ACCEPT = "image/png,image/jpeg,image/gif,image/bmp,image/webp"

DEFAULT_FONTconstSource ↗

The document default font when nothing else says otherwise: Calibri at 11pt.

DEFAULT_FONT: FontConfiguration['defaultFont']

DEFAULT_IMAGE_RESOURCE_LIMITSconstSource ↗

The image caps in force when a host configures none. Conservative and finite.

DEFAULT_IMAGE_RESOURCE_LIMITS: ImageResourceLimits

DEFAULT_REVIEW_PANEconstSource ↗

The settings an editor starts with when nothing sets them.

DEFAULT_REVIEW_PANE: ResolvedReviewPane

DEFAULT_REVISION_MARKUPconstSource ↗

Initial viewer preferences.

DEFAULT_REVISION_MARKUP: ResolvedRevisionMarkup

DEFAULT_TABLE_CHROME_DRAFTconstSource ↗

The draft a table's border chrome starts from: a 1pt black single border on every edge.

DEFAULT_TABLE_CHROME_DRAFT: TableChromeDraft

DEFAULT_WATERMARK_FONTconstSource ↗

The font a text watermark uses when its options name none.

DEFAULT_WATERMARK_FONT = "Calibri"

DRAWING_REL_FROM_HconstSource ↗

Legal relativeFrom bases for a horizontal offset (page, margin, column, character, …).

DRAWING_REL_FROM_H: readonly string[]

DRAWING_REL_FROM_VconstSource ↗

Legal relativeFrom bases for a vertical offset (page, margin, paragraph, line, …).

DRAWING_REL_FROM_V: readonly string[]

EMU_PER_POINTconstSource ↗

EMUs per point. DrawingML stores extents in EMU; layout works in points.

EMU_PER_POINT = 12700

FIT_WIDTH_ZOOM_MODEconstSource ↗

Fit the page width in BOTH directions — the uncapped fit, unlike 'auto'.

A shared constant rather than a literal per call site: modes are compared by value, but a control also has to render its own selected state, and two spellings of one mode in two files is how a menu ends up ticking a row the editor is not in.

FIT_WIDTH_ZOOM_MODE: ZoomMode

FONT_RESOLVER_BRANDconstSource ↗

The runtime marker defineFontResolver sets and [isFontResolver](isFontResolver) reads.

Exported because a package mirroring the font contract structurally still has to mark the resolvers it builds. A package in that position sets Symbol.for('docx-editor.dev/font-resolver') itself; this constant is the same symbol, named, for everyone who can import it.

FONT_RESOLVER_BRAND: unique symbol

FONT_RESOLVER_MARK_KEYconstSource ↗

The namespaced key carrying the type-level half of the mark, and the runtime property name that backs it.

A plain string rather than a symbol on purpose: @docx-editor.dev/fonts has no runtime or type dependency on the engine, so it declares the same mark itself, and two unique symbols in two packages would not unify. Two identical string keys do.

FONT_RESOLVER_MARK_KEY = "docx-editor.dev/font-resolver"

HIGHLIGHT_REFRESH_MSconstSource ↗

Milliseconds a function source waits after an edit before it runs again.

HIGHLIGHT_REFRESH_MS = 150

IMAGE_OVERLAY_NUDGE_PTconstSource ↗

How far one arrow-key press nudges a selected image, in points.

IMAGE_OVERLAY_NUDGE_PT = 1

IMAGE_OVERLAY_NUDGE_SHIFT_PTconstSource ↗

How far Shift+arrow nudges a selected image, in points.

IMAGE_OVERLAY_NUDGE_SHIFT_PT = 10

IMAGE_WRAP_TARGETSconstSource ↗

Every text-wrap mode a drawing may be set to, including inline.

IMAGE_WRAP_TARGETS: readonly ImageWrapTarget[]

LINE_SPACING_PRESETSconstSource ↗

The multiples the line-spacing menu offers, in lines.

LINE_SPACING_PRESETS: readonly number[]

LOADING_SNAPSHOTconstSource ↗

What snapshot() reports before an editor exists: loading, not editable, nothing selected, nothing undoable — never invented state.

LOADING_SNAPSHOT: EditorSnapshot

MAX_RESOLVER_FAMILIESconstSource ↗

Ceiling on the families one document can put in front of a resolver.

A resolver typically turns each family into up to four faces, and the resource snapshot refuses more than HARD_MAX_FONT_SOURCES (256) sources — so 64 families is the point past which a document could no longer be served anyway. Capping here means a file declaring thousands of distinct w:rFonts cannot fan a resolver out across thousands of lookups (or fetches) before that limit is ever reached.

MAX_RESOLVER_FAMILIES = 64

NO_MIXED_FIELDSconstSource ↗

NO_MIXED_FIELDS: ParagraphDialogMixed

PX_PER_CMconstSource ↗

Painted pixels per centimetre, derived from [PX_PER_INCH](PX_PER_INCH).

PX_PER_CM: number

PX_PER_INCHconstSource ↗

The engine paints at 96 px per inch (twips / 15, 1440 twips per inch).

PX_PER_INCH = 96

REVISION_MARKUP_COLORSconstSource ↗

Named revision colors. Identifiers are stable and never contain CSS.

REVISION_MARKUP_COLORS: readonly ['black', 'blue', 'turquoise', 'green', 'pink', 'red', 'yellow', 'white', 'darkBlue', 'teal', 'darkGreen', 'violet', 'darkRed', 'darkYellow', 'gray50', 'gray25', 'lightBlue', 'lightYellow', 'lightOrange', 'lightPurple', 'lightGreen', 'gray']

SEARCH_DEBOUNCE_MSconstSource ↗

Milliseconds of quiet before a typed query runs.

SEARCH_DEBOUNCE_MS = 150

SEARCH_HIGHLIGHT_PRIORITYconstSource ↗

Stacking priority of search highlights, above host sets at the default 0.

SEARCH_HIGHLIGHT_PRIORITY = 10

SEARCH_HIGHLIGHT_SETconstSource ↗

The highlight set name the search session owns.

SEARCH_HIGHLIGHT_SET = "search"

SEARCH_MATCH_LIMITconstSource ↗

Most matches one search reports; a full result reads as "at least this many".

SEARCH_MATCH_LIMIT = 2000

SNAP_TWIPS_CMconstSource ↗

The centimetre ruler's grid is the millimetre.

SNAP_TWIPS_CM: number

SNAP_TWIPS_INCHconstSource ↗

Word snaps ruler drags to the eighth-inch grid its ticks already draw.

SNAP_TWIPS_INCH: number

SPLIT_CELL_FALLBACK_MAXconstSource ↗

The highest count a dialog offers when the editor gives no limit.

SPLIT_CELL_FALLBACK_MAX = 63

TAB_ALIGNMENT_LABELSconstSource ↗

One label key per alignment, so the rows read as words rather than as w:val values. *

TAB_ALIGNMENT_LABELS: {
    readonly left: 'dialogs.paragraph.tabAlignLeft';
    readonly center: 'dialogs.paragraph.tabAlignCenter';
    readonly right: 'dialogs.paragraph.tabAlignRight';
    readonly decimal: 'dialogs.paragraph.tabAlignDecimal';
    readonly bar: 'dialogs.paragraph.tabAlignBar';
}

TABLE_BORDER_STYLE_OPTIONSconstSource ↗

The border-style picker's entries.

TABLE_BORDER_STYLE_OPTIONS: readonly TableBorderStyleOption[]

TABLE_BORDER_TARGET_OPTIONSconstSource ↗

The border-target picker's entries, in Word's own order, ending with clear.

TABLE_BORDER_TARGET_OPTIONS: readonly TableBorderTargetOption[]

TABLE_BORDER_WIDTH_OPTIONSconstSource ↗

Widths in eighths of a point — Word-like presets.

TABLE_BORDER_WIDTH_OPTIONS: readonly TableBorderWidthOption[]

TABLE_CHROME_SLOT_IDSconstSource ↗

Every [TableChromeSlotId](TableChromeSlotId), for iteration and for [isTableChromeSlot](isTableChromeSlot).

TABLE_CHROME_SLOT_IDS: readonly TableChromeSlotId[]

TEXT_FORM_FORMATSconstSource ↗

Supported format choices for legacy text input fields.

TEXT_FORM_FORMATS: {
    readonly regular: readonly ['', 'Uppercase', 'Lowercase', 'First capital', 'Title case'];
    readonly number: readonly ['', '0', '0.00', '#,##0', '#,##0.00', '0%', '0.00%'];
    readonly date: readonly ['', 'M/d/yyyy', 'MM/dd/yyyy', 'd/M/yyyy', 'dd/MM/yyyy', 'yyyy-MM-dd', 'd MMMM yyyy', 'MMMM d, yyyy'];
}

TWIPS_PER_CMconstSource ↗

Twips per centimetre, as Word rounds them.

TWIPS_PER_CM = 567

TWIPS_PER_INCHconstSource ↗

Twips per inch, as OOXML defines them.

TWIPS_PER_INCH = 1440

WORD_DEFAULT_FONTconstSource ↗

Deprecated. Use [DEFAULT_FONT](DEFAULT_FONT).

WORD_DEFAULT_FONT: FontConfiguration['defaultFont']

ZOOM_MAXconstSource ↗

The widest scale the editor contract accepts.

ZOOM_MAX = 5

ZOOM_MINconstSource ↗

The narrowest scale the editor contract accepts. One definition, every user.

ZOOM_MIN = 0.1