> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Types: layout and fonts

Types that layout, rendering and font loading name, A to Z.

## `AppliedChange`

A change the replica took, in order. `reverse` is the change that takes it
back, against the state after it: on an undo, a redo and a tagged local change.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `change` | `CollabChange` | |
| `reverse?` | `CollabChange` | |
| `source` | `"local" \| "remote" \| "undo" \| "redo"` | |
| `tag?` | `string` | |

## `ApplyOptions`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `fresh?` | `readonly string[]` | Entries (`map\0key`) and part names the change makes, which take a free id on a clash. |
| `revisions?` | `readonly number[]` | Revision ids the change makes: each takes a free id when the live document holds it, whoever wrote that one. |
| `tag?` | `string` | Reported with the change and with its undo and redo (`AppliedChange.tag`). |

## `ApplyStep`

One step of a batch that `applyChanges` takes as one undo step: a change, or
a review command (an accept or reject of revisions) read back as one. An empty
change with a tag is a mark: an undo step that is not sent, and whose undo and
redo report the tag (a card rejected outside the document).

Not exported by name. You get it from the API.

```ts theme={null}
type ApplyStep = ApplyOptions & ({ change: CollabChange } | { command: ReviewCommand })
```

## `CaretMove`

Not exported by name. You get it from the API.

```ts theme={null}
type CaretMove = "left" | "right" | "up" | "down" | "wordLeft" | "wordRight" | "lineStart" | "lineEnd" | "paragraphStart" | "paragraphEnd" | "nextParagraph" | "documentStart" | "documentEnd"
```

## `CellPathStep`

One hop from a host cell into a table it holds; `tbl` indexes the cell's own w:tbl children.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `col` | `number` | |
| `row` | `number` | |
| `tbl` | `number` | |

## `ConvertProgress`

Progress events for the docx -> pdf path. A supervisor (e.g. a Modal job
with a hard timeout) can read these to tell "slow but alive" from "stuck":

* `layout done` carries the page count. That is the earliest point where
  a caller can size the remaining budget (render cost is \~linear in pages).
* `layout page` / `render page` are heartbeats. No heartbeat for N seconds
  means the process is stuck inside one block and can be killed.
* `parse part` marks each loader stage (styles, images, charts, fonts,
  headers, body, notes), so parse silence is attributable to a named
  stage. `parse block` ticks the body walk; `parse image` ticks each
  resolved image (metafile rasterisation dominates image-heavy docs).
  None carry progress totals: they are liveness only. `runPipeline` and
  `convertDocxToPdf` open the file in their layout engine and send only
  `start` and `done`; `extractDocx` also sends the stage beats.

Cancellation: layout and paint are synchronous, so `AbortSignal.timeout`
cannot fire while they hold the event loop — the `signal` options abort at
checkpoints only after `abort()` had a chance to run (async phase
boundaries, or an abort requested before the sync phase started). For a
hard in-process deadline over the sync phases, THROW from the `onProgress`
callback: it is invoked synchronously at every checkpoint and the error
propagates out of the pipeline.

Import from `@reductoai/docx/browser`.

```ts theme={null}
type ConvertProgress = { kind: "start"; phase: "parse" } | { kind: "part"; part: string; phase: "parse" } | { block: number; kind: "block"; phase: "parse" } | { image: number; kind: "image"; phase: "parse" } | { kind: "done"; phase: "parse" } | { kind: "pass"; pass: number; phase: "layout" } | { kind: "page"; page: number; pages?: number; pass: number; phase: "layout" } | { kind: "done"; pages: number; passes: number; phase: "layout" } | { kind: "start"; pages: number; phase: "render" } | { kind: "fonts"; phase: "render" } | { kind: "images"; phase: "render" } | { image: number; kind: "image"; phase: "render" } | { kind: "page"; page: number; pages: number; phase: "render" } | { kind: "save"; phase: "render" } | { kind: "done"; pages: number; phase: "render" }
```

## `DecodedPng`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `alphaChannel?` | `Uint8Array` | |
| `height` | `number` | |
| `rgbChannel` | `Uint8Array` | |
| `width` | `number` | |

## `DocProperties`

Package metadata (docProps/core.xml, docProps/app.xml). Text values are
verbatim; dates stay in the W3CDTF form Word wrote. Only present keys are
emitted, so an empty `<dc:title/>` reads as absent.

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `application?` | `string` | |
| `appVersion?` | `string` | |
| `author?` | `string` | |
| `category?` | `string` | |
| `characters?` | `number` | |
| `company?` | `string` | |
| `created?` | `string` | |
| `description?` | `string` | |
| `keywords?` | `string` | |
| `lastModifiedBy?` | `string` | |
| `lastPrinted?` | `string` | |
| `manager?` | `string` | |
| `modified?` | `string` | |
| `pages?` | `number` | Counts as Word last saved them; app.xml, not a layout result. |
| `revision?` | `string` | |
| `subject?` | `string` | |
| `template?` | `string` | |
| `title?` | `string` | |
| `words?` | `number` | |

## `EastAsianScript`

Not exported by name. You get it from the API.

```ts theme={null}
type EastAsianScript = "ja" | "zh-hans" | "zh-hant" | "ko"
```

## `EditTarget`

Stable source coordinates shared by the layout parser and the editor. A
cell's `row`/`col` are local to the table that holds it; `path` names the
host cells from the body table down to that table, so a nested cell never
aliases a host cell at the same coordinates.

Import from `@reductoai/docx/node`.

```ts theme={null}
type EditTarget = { bodyIndex: number; gen?: number; kind: "paragraph"; story?: string } | { bodyIndex: number; col: number; gen?: number; kind: "table-cell"; path?: CellPathStep[]; row: number; story?: string }
```

## `EmbeddedFaceData`

One embedded face, serializable: it travels inside the layout IR so a
renderer in another process (or a browser) embeds the same bytes the
measurer used. `id` is the face's stable identity (`embed:<doc>/<slug>`).

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `data?` | `Uint8Array` | Non-enumerable fast path: the bytes when the face came from an in-process engine. |
| `dataB64` | `string` | |
| `id` | `string` | |

## `EmbeddedFontMap`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type EmbeddedFontMap = Record<string, Partial<Record<FaceKey, EmbeddedFaceData>>>
```

## `FaceKey`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type FaceKey = "regular" | "bold" | "italic" | "boldItalic"
```

## `FaceSet`

A family's four faces. Slots may be absent for partially-covered families.

Import from `@reductoai/docx/browser`.

```ts theme={null}
type FaceSet = Partial<Record<FaceKey, FaceSource>>
```

## `FaceSource`

One face: a stable identity plus a byte source. `id` is what caches key on
(an absolute file path for node system fonts, `embed:<doc>/<family>-<key>`
for document-embedded faces, whatever the adapter chooses in a browser).
`bytes()` may be lazy and returns null when the face is unavailable.

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `bytes` | `() => Uint8Array \| null` | |
| `id` | `string` | |

## `FaceTable`

A static font mirror: which families exist, which face id fills each slot,
and which file holds each face. Families register up front with empty faces;
a face's bytes arrive only when a layout trace (or `familyFaces`) asks.

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `cjk?` | `string[]` | Families that are real CJK faces; replayed through `markCjkFamilies`. |
| `families` | `Record<string, Partial<Record<FaceKey, string>>>` | family (lower case) -> face key -> face id. |
| `files` | `Record<string, string>` | face id -> file, handed to `urlFor`. |
| `noSubset?` | `string[]` | Face ids a PDF embeds whole; replayed through `markNoSubsetFaces`. |

## `FetchProgress`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type FetchProgress = (done: number, total: number, bytes: number) => void
```

## `FontDecl`

Font-table properties used to select a substitute face.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `altName?` | `string` | |
| `arabic?` | `true` | `w:charset="B2"` or the Arabic code page (1256) in `w:sig@csb0`. |
| `auto?` | `true` | |
| `caucasian?` | `true` | |
| `cjk?` | `EastAsianScript` | Script from `w:charset`, else from the `w:sig` code pages. |
| `eastAsia?` | `true` | |
| `korean?` | `true` | |
| `modern?` | `true` | `w:family="modern"`. |
| `nonAnsiCharset?` | `true` | `w:charset` names a code page other than ANSI (00), default (01) or Symbol (02). |
| `notTT?` | `true` | |
| `roman?` | `true` | |
| `scriptCharset?` | `true` | `w:charset` names a non-Western script (Cyrillic, Greek, CJK, Arabic, Thai, Vietnamese). |
| `swiss?` | `true` | |
| `symbol?` | `true` | |
| `thai?` | `true` | `w:charset="DE"` or the Thai code page (874) in `w:sig@csb0`. |

## `FontDeclMap`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type FontDeclMap = Record<string, FontDecl>
```

## `FontFallback`

One requested family that the registry could not serve as itself.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `reason` | `FontFallbackReason` | |
| `requested` | `string` | |
| `served` | `string` | |

## `FontFallbackReason`

Why a requested family was not the family that got served.

alias   a metric-compatible clone from SUBSTITUTIONS (Arial -> Liberation
Sans). Expected on the portable profile; metrics are designed to
match, so this is information, not a defect.
script  a complex-script fallback replaced the run's face. The served face
has DIFFERENT advances, so line breaks and page count move.
missing nothing matched the name at all and resolveFamily's fontTable rule
chose the face. Same metric risk as `script`.

Not exported by name. You get it from the API.

```ts theme={null}
type FontFallbackReason = "alias" | "script" | "missing"
```

## `ImageFlip`

Which axes a drawing's ink is mirrored across, about its bbox centre.

Not exported by name. You get it from the API.

```ts theme={null}
type ImageFlip = "h" | "v" | "hv"
```

## `IndexScope`

A story being edited in place, and the page it is edited on. Lines whose
`storyRel` equals `story` are the addressable set.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `page` | `number` | |
| `story` | `string` | |

## `InkChoice`

A host's reviewer colours, as data so a layout worker can take them: `authors` names an
author's colour, `palette` replaces Word's by-author order for the rest.

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `authors?` | `Readonly<Record<string, string>>` | |
| `palette?` | `readonly string[]` | |

## `LayoutAnchor`

A floating (wp:anchor) drawing, absolutely positioned on the page.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `bbox` | `LayoutBBox` | |
| `behind?` | `boolean` | Drawn under all other content (wp:anchor @behindDoc). |
| `cellClip?` | `true` | Cut at the sides of the cell its origin sits in: a wrapping picture wider than its cell. |
| `image` | `LayoutImageRef` | |
| `inCell?` | `true` | Cell-owned `layoutInCell` float: cell borders paint over it. |
| `origin?` | `{ x: number; y: number }` | Page-local point a zero `wp:posOffset` on the anchor's own `relativeFrom` lands the frame at, after cell and column remapping. Provenance for editors that rewrite the offset; painters ignore it. |
| `shapeId?` | `number` | `wp:docPr/@id` of the floating drawing this was laid from. Provenance for editors that must find where an authored shape actually landed; painters ignore it. |
| `story?` | `"header" \| "footer"` | |
| `watermark?` | `true` | Authored as a watermark (Word's `WordPictureWatermark*` / a "watermark" docPr name). Metadata only. |
| `z?` | `number` | Floating paint-layer key (`wp:anchor@relativeHeight`); see `LayoutLine.z`. |

## `LayoutBBox`

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `h` | `number` | |
| `w` | `number` | |
| `x` | `number` | |
| `y` | `number` | |

## `LayoutBorderSide`

One drawn border side (pt width + CSS hex color). Absent side = no border.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `color` | `string` | |
| `dash?` | `readonly number[]` | On/off stroke pattern in multiples of `widthPt`. |
| `split?` | `{ bands: readonly { color?: string; widthPt: number }[]; leftTop?: true }` | Ink split of a composite side: consecutive sub-bands in pt, summing to `widthPt`; a band without `color` is a blank gap. Absent = one solid bar. The first band is the one further from the box centre — unless `leftTop`, when the bands run top/left → bottom/right. |
| `texture?` | `"wave" \| "doubleWave" \| "hatch"` | Hairline art filling the band instead of a bar (see `strokeTexture`). |
| `widthPt` | `number` | |

## `LayoutBoxPt`

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `height` | `number` | |
| `width` | `number` | |
| `x` | `number` | |
| `y` | `number` | |

## `LayoutColumnBand`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `bottom` | `number` | Deepest content y the band filled; only meaningful on the last band. |
| `columns` | `{ w: number; x: number }[]` | |
| `top` | `number` | |

## `LayoutCommentBalloon`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `anchor` | `{ x: number; y: number }` | Already transformed into final page coordinates. |
| `author` | `string` | |
| `bbox` | `LayoutBBox` | |
| `chrome` | `LayoutShapeGeom[]` | Connector polyline plus the rounded balloon box, in final page coords. |
| `color` | `string` | |
| `commentId?` | `string` | |
| `id` | `string` | Balloon key: `comment:<id>` or `revision:<id>`. |
| `initials` | `string` | |
| `lines` | `LayoutLine[]` | |
| `parentId?` | `string` | |
| `resolved?` | `boolean` | |
| `revision?` | `{ id: string; kind: "delete" \| "moveFrom" \| "moveTo" \| "format" }` | Present on a tracked-change balloon (deletion, move half, formatting). |

## `LayoutDocument`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `blocks` | `({ bidi?: true; bodyIndex: number; headingLevel?: number; kind: "paragraph"; numPr?: { ilvl: number; numId: number }; page: number; preview: string; styleId?: string; title?: true; toc?: true } \| { bodyIndex: number; cols: number; kind: "table"; page: number; rows: number; tableIndex: number })[]` | |
| `bookmarks?` | `{ bodyIndex: number; name: string; textOffset: number }[]` | `w:bookmarkStart` targets in source coordinates (see `model.ts` Bookmark). A consumer resolves one to a page by finding the first run whose `source` has the same `bodyIndex` and covers `textOffset`. |
| `docDefaultFont?` | `string` | docDefaults typeface; the fallback for an unresolvable name (fonts.ts). |
| `drawingGrid?` | `LayoutDrawingGrid` | Absent = Word's default, a 9pt square grid from the margins. |
| `embeddedFonts?` | `EmbeddedFontMap` | Faces extracted from word/fonts, keyed by family (see fonts.ts). |
| `emittedAt` | `string` | |
| `faceManifest?` | `Record<string, { cssFamily: string; file: string; local?: string[]; metrics: { baselineFactor: number; strikePos: number; strikeThickness: number; underlinePos: number; underlineThickness: number; unitsPerEm: number }; synthBold?: true }>` | Resolved physical face per `(requested family, bold, italic)` actually used by runs in this document, keyed `"<requested lowercased>\|<faceKey>"`. Emitted by the demo adapter only. It lets a renderer that cannot run `resolveFace`, read the filesystem, or inspect font tables (the browser) load the exact face the measurer used and reuse its metrics, so both its shaping and its baselines match the PDF backend's. |
| `fontDecls?` | `FontDeclMap` | word/fontTable.xml declarations that drive fallback (see fonts.ts). |
| `fontFallbacks?` | `FontFallback[]` | Families this document asked for that the host could not serve as themselves (see `FontRegistry.fontFallbacks`). Absent when every name resolved exactly. A `script` or `missing` entry means the metrics used are not the document's own, so the pagination is host-dependent. |
| `fonts` | `string[]` | Fonts observed (for |
| `images?` | `Record<string, { data?: Uint8Array; dataB64: string \| null; mime: "png" \| "jpeg" \| "gif" \| "tiff" \| "svg" \| "other"; srcRect?: SrcRect; whole?: true }>` | Image payloads keyed by `LayoutImageRef.id`, base64-encoded so the IR round-trips through JSON. Absent when the document has no inline images. |
| `meta` | `{ engine: "typescript-ooxml" \| "libreoffice-viewcursor"; notes: string[] }` | |
| `pageCount` | `number` | |
| `pages` | `LayoutPage[]` | |
| `properties?` | `DocProperties` | docProps/core.xml + app.xml facts. Absent when the package has neither part. |
| `sourcePath` | `string` | |
| `unit` | `LayoutUnit` | |
| `version` | `1` | |
| `wordPlatform?` | `"mac"` | Laid out to match Word for Mac where it differs from Word for Windows (`WordPlatform`); absent = Windows. |

## `LayoutDrawingGrid`

`w:settings` drawing grid, shown by Word's View > Gridlines. Steps are the gap between
drawn lines (spacing times display-every); 0 draws no lines that way. Absent origin =
the page's margin corner, and the grid fills the margin box; otherwise it fills the page.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `origin?` | `{ x: number; y: number }` | |
| `stepX` | `number` | |
| `stepY` | `number` | |

## `LayoutEngineSource`

Where the engine is: a URL of `engine.wasm`, its bytes, or a compiled `WebAssembly.Module`.

Import from `@reductoai/docx/browser`.

```ts theme={null}
type LayoutEngineSource = string | URL | WasmEngineSource
```

## `LayoutEvent`

Pipeline events, plus the browser's font fetches; the engine settles its faces first, so `reflow` never fires.

Import from `@reductoai/docx/browser`.

```ts theme={null}
type LayoutEvent = ConvertProgress | { bytes: number; done: number; kind: "fetch"; phase: "fonts"; total: number } | { bytes: number; kind: "reflow"; phase: "fonts" }
```

## `LayoutHeader`

The document-level part of the IR, known before any page is laid; a `LayoutDocument` is one.

Import from `@reductoai/docx/node`.

```ts theme={null}
type LayoutHeader = Pick<LayoutDocument, "unit" | "sourcePath" | "wordPlatform" | "images" | "embeddedFonts" | "fontDecls" | "docDefaultFont" | "bookmarks" | "properties">
```

## `LayoutImageRef`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `altText?` | `string` | Author's alt text (`wp:docPr/@descr`), verbatim. |
| `chartHits?` | `LayoutShapeGeom[]` | Closed chart outlines tagged with `part` for hit-testing (`chartPartAt`); never painted. |
| `clip?` | `string` | `pic:spPr` custom / non-rect preset geometry as SVG `d` in the unrotated ink box (hmm, y-down from the paint bbox). Painters clip the bitmap to it even-odd. Absent = the image fills its rectangle. |
| `drawHHmm?` | `number` | |
| `drawWHmm?` | `number` | Ink size of a ROTATED drawing, in hmm, before the rotation is applied. `wHmm`/`hHmm` then hold the slot the flow reserved (an anchor's rotated bounding box; an inline picture's extent, swapped past 45°), and painters draw the image into this size CENTRED in the bbox before rotating about that centre. Absent = the ink fills the bbox. |
| `effects?` | `{ glow?: { alpha: number; color: string; radiusHmm: number }; reflection?: { distHmm: number; endAlpha: number; size: number; startAlpha: number }; softEdgeHmm?: number }` | `pic:spPr/a:effectLst` glow, reflection and soft edges, painted against white paper as `shadow` is: a glow is stacked translucent rings behind the picture, a reflection a mirrored copy under a white fade, soft edges a white fade over each side. |
| `flip?` | `ImageFlip` | `a:xfrm@flipH`/`@flipV` (own or inherited from a group): painters mirror the ink about the bbox centre BEFORE rotating it. Absent = no mirror. |
| `hHmm` | `number` | |
| `id` | `string` | Key into `LayoutDocument.images`. Two sentinels never resolve there: `"shape"` (vector `shapes` ride on the ref) and `"rule"` (an `o:hr` slot whose stroke paints as chrome; the ref only reserves the line). |
| `layers?` | `LayoutImageRef[]` | Pictures composing one inline DrawingML group, in declared paint order. Their offsets and sizes are relative to this ref's flow slot. |
| `mime` | `"png" \| "jpeg" \| "gif" \| "tiff" \| "svg" \| "other"` | |
| `offsetXHmm?` | `number` | Offset of the painted child inside an inline drawing's flow slot. |
| `offsetYHmm?` | `number` | |
| `outline?` | `{ color: string; split?: LayoutBorderSide["split"]; widthPt: number }` | `pic:spPr/a:ln` — the picture's own frame (Word's "Picture Border"), stroked wholly outside the placed bbox as Word does. Absent = no frame. `split` is a compound line (`a:ln@cmpd`), its bands outer → inner on every side. |
| `rotDeg?` | `number` | `a:xfrm@rot` in degrees, CLOCKWISE (OOXML). Painters rotate about the placed bbox centre; absent = upright. |
| `shadow?` | `{ alpha?: number; blurPt?: number; color: string; dxHmm: number; dyHmm: number; rgb?: string }` | `pic:spPr/a:effectLst/a:outerShdw` flattened to one opaque offset copy of the bbox, painted under the picture. `dxHmm`/`dyHmm` are the shadow's displacement (dist resolved along dir); `color` is the shadow colour already composited against white for its alpha, because neither painter has an alpha channel — and no corpus shadow falls on anything but paper. The blur radius is dropped: a hard edge at the right offset is much closer to Word's ink than no shadow at all. `rgb`, `alpha` and `blurPt` keep the authored values for writers. |
| `shapeId?` | `number` | `wp:docPr/@id` of the inline drawing. Pure metadata for geometry queries (two drawings sharing one flow slot are otherwise indistinguishable); painters never read it. |
| `shapes?` | `LayoutShapeGeom[]` | Set instead of a bitmap payload when the drawing is DrawingML shape geometry. A shape has no image part, so `id` is the sentinel `"shape"` and `mime` is `"other"`: there is deliberately no `LayoutDocument.images` entry to look up, and painters must test this field BEFORE reaching for one (see `paintDrawing` in paint/scene.ts). |
| `slotHHmm?` | `number` | Height of the flow slot when the painted child is inset in it (effect extent). |
| `vectorKind?` | `"chart" \| "diagram"` | What the vector `shapes` ARE, when the parser knows: a chart plot or a SmartArt diagram. Pure metadata for sketches/tools; painters never read it. Absent = plain drawn geometry. |
| `wHmm` | `number` | Placed size in hmm (already scaled to fit the column). |

## `LayoutLine`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `baseHmm?` | `number` | Baseline fixed below the line top by an `exact` line rule when the line carries an inline drawing. Word keeps the box at the rule value, puts the baseline at 4/5 of it and clips the drawing to the band, so a picture taller than the line shows only its bottom. Runs align to this instead of the tallest ink. |
| `behind?` | `boolean` | With `z`: under the body flow (`behindDoc`) vs over it (default). |
| `changeBar?` | `true` | Word inline-review change bar is painted beside this line. |
| `clip?` | `LayoutBBox` | Ink outside this box is cut, as Word cuts a text box's lines between its top and bottom insets. In the line's own UNROTATED frame, so it turns with `rot`; painters push it after the rotation. |
| `editMark?` | `TextStyle` | On an edited story's empty paragraph: the style its mark resolves to, which text typed there takes. Painters never read it; an editor reads it for the caret's format. |
| `editMarker?` | `LayoutRun` | The bullet of an empty paragraph, which PowerPoint shows only while its text is edited. Painters never read it; an editor paints it for the story it edits. |
| `h` | `number` | Vertical advance consumed by this line (includes proportional leading). |
| `highlightBand?` | `{ h: number; top: number }` | Band a highlight fills, from `y`, when the line rule moves it off the runs' own box. |
| `inFrame?` | `true` | With `textbox`: laid in a `w:framePr` frame, so its text belongs to the story around it. |
| `lineEnd?` | `"break" \| "paragraph"` | Why the paragraph's text stops here: an authored `w:br`/`w:cr`, or the paragraph mark. Absent on a soft wrap and on lines that are not paragraph text. Metadata only; painters never read it. |
| `lineNumber?` | `true` | Section line numbering (`w:lnNumType`) in the margin; carets and text readers skip it. |
| `page` | `number` | |
| `rot?` | `{ cx: number; cy: number; deg: number }` | Rotated line (vertical textbox text, `wps:bodyPr` vert/vert270). The line and its runs are stored UNROTATED, in page coords; painters rotate all of the line's ink by `deg` degrees COUNTER-CLOCKWISE on screen (IR is y-down) about the pivot (`cx`,`cy`), also in hmm page coords. |
| `runs` | `LayoutRun[]` | |
| `shapeId?` | `number` | `wp:docPr/@id` of the floating textbox this line was laid inside. Unlike `textbox` it survives a round trip to the authored shape, so an editor can ask where a box's own text ended up. Metadata only. |
| `source?` | `SourceAnchor` | Empty-paragraph lines only: the source paragraph the line was laid for. Lines with runs carry provenance on each run instead. Lets geometry queries resolve a blank paragraph to its laid line box. Metadata only. |
| `story?` | `"header" \| "footer"` | Header/footer mini-flow. Untagged lines are body. Page sketches use this instead of a Y-band heuristic, so body text near the bottom margin keeps its `p:N` address. |
| `storyRel?` | `string` | The story this line was laid from: a header/footer part's relationship id, a note key (`footnote#<id>`) or a textbox key (`textbox#<b>:<n>`). Each story numbers its paragraphs independently, so `source.bodyIndex` alone is ambiguous across them. Metadata only — painters never read it. |
| `textbox?` | `number` | The line was laid inside a floating textbox's inner mini-flow. The value names the box instance (unique per document), so two boxes anchored to the same paragraph stay apart. Metadata only — painters never read it. |
| `textH?` | `number` | |
| `w` | `number` | |
| `watermark?` | `true` | Header VML textpath: above document backgrounds, below all body ink. |
| `wrap?` | `LineWrap` | The band the line breaker filled, as offsets from `x`: `left`/`right` bound this line, `next` is where the paragraph's later lines start. Only on left-to-right lines with no tab and no float beside them, so an editor can tell when a quick refill of the paragraph is safe. Metadata only; painters never read it. |
| `x` | `number` | |
| `y` | `number` | |
| `z?` | `number` | Paint-layer key for content owned by a floating anchor (`wp:anchor@relativeHeight`). Present only for such content: the line leaves the body paint pass and joins the floating layer, interleaved with drawings by `z`. `behind` selects under-body vs over-body (behindDoc). |

## `LayoutLinearGradient`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `end` | `{ x: number; y: number }` | |
| `kind` | `"linear" \| "radial"` | `radial`: a circle about `start` whose rim passes through `end`. |
| `start` | `{ x: number; y: number }` | Endpoints use the shape path's local hmm coordinates. |
| `stops` | `{ alpha?: number; color: string; offset: number }[]` | |

## `LayoutOverlapKind`

"shape" is a floating textbox's painted frame (fill/border chrome).

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

```ts theme={null}
type LayoutOverlapKind = "text" | "image" | "shape" | "rule"
```

## `LayoutOverlapOptions`

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `kinds?` | `LayoutOverlapKind[]` | Restrict the kinds of laid ink considered. Defaults to all four: text runs, image anchors, floating-shape frames, and border/rule ink (table cell borders, paragraph borders, the section page border). |
| `paddingPt?` | `number` | Grow the queried range by this clearance before testing, in points. |

## `LayoutPage`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `anchors?` | `LayoutAnchor[]` | Floating pictures, absolutely positioned (no flow impact). |
| `background?` | `string` | Full-page fill (CSS hex) painted under everything; left out under `pageColor: "print"`. |
| `bodyBottom?` | `number` | Lowest y a body line may reach, before notes take their share. Metadata only. |
| `columnBands?` | `LayoutColumnBand[]` | Multi-column bands, top to bottom. Each band spans from its `top` to the next band's `top` (the last one to `bottom`). Present only when some band lays more than one column, so text consumers can order content column by column instead of interleaving by y. |
| `height` | `number` | |
| `index` | `number` | |
| `lines` | `LayoutLine[]` | |
| `margin` | `{ bottom: number; left: number; right: number; top: number }` | |
| `pageBorder?` | `LayoutPageBorder` | Section page border, painted behind or in front of document ink. |
| `printedNumber?` | `string` | The string a PAGE field on this page paints (pgNumType format and restarts applied). Provenance for field refresh; painters never read it. |
| `rects?` | `LayoutRect[]` | Paragraph shading / border rects, drawn beneath lines and tables. |
| `review?` | `LayoutReviewLayer` | Word-like print-markup composition, painted outside the base page flow. |
| `sectionIndex?` | `number` | Index of the section (document order, body-level sectPr last) whose page grid laid this page. Provenance for section-scoped geometry queries; painters never read it. |
| `tables` | `LayoutTable[]` | |
| `width` | `number` | |

## `LayoutPageBorder`

Page border emitted from the owning section's w:pgBorders.

Not exported by name. You get it from the API.

```ts theme={null}
type LayoutPageBorder = LayoutRect & { zOrder: "front" | "back" }
```

## `LayoutProgress`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type LayoutProgress = (event: LayoutEvent) => void
```

## `LayoutRect`

A decoration rectangle (paragraph w:shd fill / w:pBdr borders), drawn under
all text and table content. bbox in hmm from the page's top-left.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `bbox` | `LayoutBBox` | |
| `behind?` | `boolean` | With `z`: under the body flow (`behindDoc`) vs over it (default). |
| `borders?` | `{ bottom?: LayoutBorderSide; left?: LayoutBorderSide; right?: LayoutBorderSide; top?: LayoutBorderSide }` | Drawable border sides only (zero-width sides were dropped upstream). |
| `fill?` | `string` | Background fill (CSS hex). |
| `frame?` | `true` | The authored frame of a floating text box at its resolved position, kept so an editor can select, drag and resize a box that paints no fill or border. Such a rect has neither `fill` nor `borders` and paints nothing. |
| `origin?` | `{ x: number; y: number }` | Frames only: see `LayoutAnchor.origin`. |
| `paragraphFrame?` | `{ from: number; outset?: { b: number; l: number; r: number; t: number }; storyRel?: string; to: number }` | A `w:framePr` frame's paragraphs, body indices `from` to `to` (exclusive) in story `storyRel` (absent: body). |
| `rotDeg?` | `number` | Frames only: the box's `a:xfrm@rot` in degrees; the bbox stays upright and the ink spins. |
| `shapeId?` | `number` | `wp:docPr/@id` when this rect is a floating shape's chrome; provenance only. |
| `story?` | `"header" \| "footer"` | Header/footer mini-flow; untagged rects are body. See `LayoutLine.story`. |
| `storyRel?` | `string` | The textbox story whose frame this rect paints; an editor claims the box from it. |
| `z?` | `number` | Floating paint-layer key; see `LayoutLine.z`. |

## `LayoutRequest`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `throughPage?` | `number` | Lay pages 1..throughPage exactly; later pages may be the previous layout's, shifted, and the page count may be theirs. A later call without it lays the rest. Saves the tail's relayout after an edit near the start of a long document. |

## `LayoutReviewLayer`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `anchorChrome` | `LayoutShapeGeom[]` | Range highlight and end brackets for every anchored comment, in final page coords. Painted under all balloons: a thread shares one decoration, so it cannot hang off an individual balloon. |
| `balloons` | `LayoutCommentBalloon[]` | |
| `contentTransform` | `LayoutReviewTransform` | |
| `gutter` | `LayoutBBox` | |

## `LayoutReviewTransform`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `dx` | `number` | |
| `dy` | `number` | |
| `scale` | `number` | |

## `LayoutRun`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `anchorOf?` | `number` | Zero-width slot that owns the anchor character of a floating drawing; the value is the `LayoutAnchor.shapeId` it was laid from. Painters skip it. |
| `field?` | `LiveField` | The run paints the live result of this field, not typed text. Fields whose saved result is painted as-is (SECTIONPAGES, PAGEREF, DATE) carry no mark. Metadata only. |
| `h` | `number` | Approximate line box height from font size (+ leading fudge). |
| `image?` | `LayoutImageRef` | Present only on image runs (`text` is empty). Consumers that only know about glyphs draw nothing, which is the pre-image behaviour. |
| `link?` | `{ anchor?: string; href?: string; tooltip?: string }` | The run sits inside a `w:hyperlink` (or a HYPERLINK field). Painters that only draw glyphs ignore it; interactive consumers turn it into a link. `anchor` names a bookmark listed in `LayoutDocument.bookmarks`. |
| `logicalOrder?` | `number` | Line-local source-order position paired with `logicalText`. |
| `logicalText?` | `string` | Source-order text when `text` was reordered for visual RTL painting. Text/API consumers use this; painters deliberately ignore it. |
| `marker?` | `true` | The run paints the GENERATED numbering label (marker glyphs, or the tab that separates it from the body), not the paragraph's own text. A text consumer that emits its own list markers must drop these, or the marker appears twice. |
| `math?` | `{ display?: true; latex?: string }` | Office Math provenance. Present on every run an `m:oMath` object emits (glyph pieces and the zero-width rule anchor). The generated LaTeX rides once, on the object's first run; follower runs carry an empty object so a text consumer can fold the whole equation back into one token. `display` marks `m:oMathPara`. |
| `reviewCommentId?` | `string` | Synthetic review-balloon provenance; never set on document-flow runs. |
| `shapes?` | `LayoutShapeGeom[]` | Vector ink anchored to this run's BASELINE origin: `(x, baseline)`, with +y down, unlike `image.shapes`, which hang off the run's top-left box. An equation's fraction bars and radicals ride here, because only the baseline is a fixed point once the line's height is known. |
| `shapingDirection?` | `"ltr" \| "rtl"` | Resolved direction used to shape this visual run. |
| `source` | `SourceAnchor` | |
| `style` | `TextStyle` | |
| `symbolByte?` | `number` | Raw byte for legacy symbol-font runs; canvas hosts choose their cmap encoding. |
| `text` | `string` | |
| `w` | `number` | Advance width of the run (endX - startX). |
| `x` | `number` | |
| `y` | `number` | |

## `LayoutShapeGeom`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `clipD?` | `string` | Paint only inside this path (same frame as `d`, even-odd): an inner shadow's silhouette. |
| `d` | `string` | |
| `dxHmm` | `number` | |
| `dyHmm` | `number` | |
| `fill?` | `string` | CSS hex fill. Absent on a stroke-only shape (`a:noFill`, or a rule). |
| `fillOpacity?` | `number` | The solid fill's own DrawingML alpha (0..1); multiplies `opacity`. |
| `fillPaint?` | `LayoutLinearGradient` | Takes precedence over the solid fill. |
| `opacity?` | `number` | Fill/shape opacity (0..1), used by legacy VML translucent overlays. |
| `part?` | `string` | The chart element the shape draws (`chartPartAt`); painters never read it. |
| `reflection?` | `{ alpha: number; authored?: { blur: number; offset: number; size: number; transparency: number }; distHmm: number; sy: number }` | `a:effectLst/a:reflection`, approximated as a flipped translucent copy. |
| `stroke?` | `{ cap?: "round" \| "square"; color: string; dash?: "dot" \| "dash"; dashPattern?: number[]; dashPt?: number; headEnd?: LineEndType; headEndSize?: LineEndSize; join?: "round" \| "bevel"; opacity?: number; paint?: LayoutLinearGradient; tailEnd?: LineEndType; tailEndSize?: LineEndSize; widthPt: number }` | `a:ln` outline. Absent when the shape is fill-only. |

## `LayoutTable`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `anchors?` | `LayoutAnchor[]` | Floating pictures anchored to cell paragraphs. Transient: the engine drains these onto the owning page's `anchors` when the chunk is flushed. |
| `bbox` | `LayoutBBox` | |
| `behind?` | `boolean` | The owning floating textbox sits behind the document body. |
| `bodyIndex` | `number` | |
| `cells` | `LayoutTableCell[]` | |
| `cols` | `number` | |
| `headerRows?` | `number` | Leading rows flagged `w:tblHeader` (repeated on continuation pages). Metadata only. |
| `name` | `string` | |
| `page` | `number` | |
| `rows` | `number` | |
| `story?` | `"header" \| "footer"` | |
| `tableIndex` | `number` | |
| `tbLines?` | `LayoutLine[]` | Ink of floating textboxes anchored to cell paragraphs (inner lines and chrome rects). Transient in the same way as `anchors`: drained onto the page when the chunk is flushed, so no consumer ever sees them here. |
| `tbRects?` | `LayoutRect[]` | |
| `textbox?` | `number` | Laid inside a floating textbox; see `LayoutLine.textbox`. |
| `z?` | `number` | Floating textbox paint order (`wp:anchor@relativeHeight` / VML z-index). |

## `LayoutTableCell`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `bbox` | `LayoutBBox` | |
| `borders?` | `{ bottom?: LayoutBorderSide; left?: LayoutBorderSide; right?: LayoutBorderSide; top?: LayoutBorderSide }` | Effective borders after tcPr-over-tblPr resolution; zero-width sides are omitted. |
| `clipContent?` | `boolean` | |
| `col` | `number` | |
| `colSpan?` | `number` | `w:gridSpan` > 1: grid columns this cell covers. Metadata only. |
| `diagonals?` | `{ down?: LayoutBorderSide; up?: LayoutBorderSide }` | Rules from corner to corner: `down` top-left to bottom-right (w:tl2br), `up` bottom-left to top-right. |
| `lines` | `LayoutLine[]` | |
| `name` | `string` | |
| `page` | `number` | |
| `rects?` | `LayoutRect[]` | Paragraph shading / border boxes of the cell's paragraphs, drawn over the fill and under the lines. |
| `row` | `number` | |
| `rowSpan?` | `number` | `w:vMerge` restart spanning > 1 rows; continue cells are not emitted. Metadata only. |
| `shading?` | `string` | Background fill (CSS hex). Absent = transparent. |
| `source` | `Extract<SourceAnchor, { kind: "table-cell" }>` | |
| `text` | `string` | Plain text (concatenated). |

## `LayoutUnit`

Not exported by name. You get it from the API.

```ts theme={null}
type LayoutUnit = "hmm"
```

## `LayoutView`

How revisions and comments are laid; a layout function maps it onto its own options.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `comments?` | `"hidden" \| "balloons"` | |
| `hiddenReviewers?` | `readonly string[]` | Authors whose revisions lay as accepted (Word's Show Markup > Reviewers). |
| `inks?` | `InkChoice` | Reviewer colours instead of Word's by-author order. |
| `outline?` | `OutlineView` | Word's Outline view; absent lays the pages. |
| `portableFonts?` | `true` | Lay from the packaged portable fonts alone, as a registry with no system font did. |
| `trackedChanges?` | `"final" \| "inline" \| "balloons" \| "simple" \| "original"` | `simple`: Simple Markup. `original`: every revision rejected, laid from a copy the edits never reach. |
| `unservedFonts?` | `true` | Lay with no font served, as a bare TS measurer did (tests of unserved faces). |

## `LigaturePolicy`

The ligature groups a run is shaped with, plus `w14:cntxtAlts` as `+calt`.
Absent means the font's own defaults (fontkit turns liga/clig/calt on).

Not exported by name. You get it from the API.

```ts theme={null}
type LigaturePolicy = LigatureValue | `${LigatureValue}+calt`
```

## `LineEndSize`

`a:headEnd`/`a:tailEnd` `@len` and `@w`; absent is `med`.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `len?` | `"sm" \| "med" \| "lg"` | |
| `w?` | `"sm" \| "med" \| "lg"` | |

## `LineEndType`

`a:headEnd`/`a:tailEnd` `@type`, less `none` (which is simply absent).

Not exported by name. You get it from the API.

```ts theme={null}
type LineEndType = "triangle" | "stealth" | "diamond" | "oval" | "arrow"
```

## `LineWrap`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `align` | `"left" \| "center" \| "right" \| "both" \| "distribute" \| "thaiDistribute"` | |
| `gap?` | `number` | Space Word puts between this paragraph and a copy of itself, as Enter makes one. |
| `left` | `number` | |
| `mark?` | `{ h: number; textH: number }` | Line box of an empty copy of this paragraph, sized by its mark. |
| `next` | `number` | |
| `right` | `number` | |

## `LiveField`

A field Word recalculates at layout time: page and section numbers and counts, running heading, paragraph count.

Not exported by name. You get it from the API.

```ts theme={null}
type LiveField = "PAGE" | "NUMPAGES" | "SECTION" | "SECTIONPAGES" | "STYLEREF" | "AUTONUM" | "LISTNUM"
```

## `LiveSource`

What the cache needs from a session: its edit counter and the live package.

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `editVersion()` | `() => number` | |
| `livePackage()` | `() => Promise<WordPackage>` | |

## `MetafileBackend`

Platform half of the metafile pipeline: rasterise an SVG at `zoom`. Node's
default backend loads @resvg/resvg-js lazily; a browser host injects a wasm
equivalent via `setMetafileBackend`.

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `renderMetafile()?` | `(bytes: Uint8Array, opts: { kind: MetafileKind } & RasterBudget) => Promise<Uint8Array<ArrayBufferLike> \| null>` | Run the complete conversion off-thread when the host owns a worker pool. |
| `renderRgba()?` | `(rgba: Uint8Array, opts: { height: number; width: number }) => Promise<Uint8Array<ArrayBufferLike>>` | Encode already-sized RGBA pixels from the bitmap-only Zig/WASM fast path. |
| `renderSvg()` | `(svg: string, opts: { defaultFontFamily: string; zoom: number }) => Promise<Uint8Array<ArrayBufferLike>>` | |

## `MetafileKind`

Metafile flavours we can rasterise, as told by the magic bytes.

Import from `@reductoai/docx/browser`.

```ts theme={null}
type MetafileKind = "emf" | "wmf"
```

## `OutlineView`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

| Name | Type | Description |
| - | - | - |
| `collapsed?` | `readonly number[]` | Body indexes of headings whose subheadings and text are collapsed. |
| `level?` | `number` | Show Level: headings down to this level (1-9) and no body text; absent shows all. |

## `ParseInput`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type ParseInput = Uint8Array | ArrayBuffer | WordPackage
```

## `ParseOptions`

Import from `@reductoai/docx/browser`, `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `comments?` | `"hidden" \| "balloons"` | Retain comment ranges and thread content for Word-like review balloons. |
| `coverage?` | `boolean` | Record which elements the parse never read; result lands on `DocModel.coverage`. |
| `footnotePageOrdinals?` | `ReadonlyMap<number, number>` | Each footnote's place among its page's notes, for `w:numRestart="eachPage"`. |
| `hiddenReviewers?` | `readonly string[]` | Authors whose revisions lay as accepted in a review view (Word's Reviewers filter). |
| `inks?` | `InkChoice` | Reviewer colours instead of Word's by-author order. |
| `markupGutter?` | `boolean` | `balloons` also paints Word's print-markup gutter beside the page. `false` keeps that view in the body (deletions leave the flow) and paints no gutter, for a host that draws its own. |
| `memo?` | `ParseMemo` | Parsed paragraphs kept across parses of the same live package. A session that relayouts after each edit passes one memo for its lifetime; unchanged paragraphs come back as the same blocks, so layout memos keyed on them hit. |
| `metafileBackend?` | `MetafileBackend` | Platform half of EMF/WMF rasterisation for THIS parse. Takes precedence over the process-wide `setMetafileBackend` fallback (which remains for hosts that configure once at startup, e.g. the browser demo). |
| `metafileScale?` | `number` | Output pixels per CSS px of an EMF/WMF placement. Default 4 (2× supersampling at 192 dpi print). A host that only rasterises the result at 150–200 dpi passes 2 and spends a quarter of the pixels. |
| `name?` | `string` | Document file name (basename), used to mint stable embedded-font ids. |
| `onProgress?` | `ProgressCallback` | Liveness beats for the parse phase: `part` names each loader stage, `block` ticks through the body walk. Throwing from the callback aborts the parse at that checkpoint (the in-process hard-deadline mechanism, see render/progress.ts). |
| `outline?` | `OutlineView` | Word's Outline view: headings and body text by level, without pages' furniture. |
| `registry?` | `FontRegistry` | font registry backing `sym:` face routing; defaults to the shared instance |
| `trackedChanges?` | `TrackedChangesView` | Render conjoined inline revisions (`inline`) or Word's balloons view (`balloons`: deletions, moves and formatting in the gutter) instead of the clean final view. |

## `PdfPainterCounts`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `borders` | `number` | |
| `images` | `number` | |
| `runs` | `number` | |
| `shapes` | `number` | |

## `PipelineOptions`

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `comments?` | `"hidden" \| "balloons"` | Render comments and replies in a Word-like print-markup gutter. |
| `maxPages?` | `number` | Keep only the first `maxPages` pages; layout stops after them unless a field shows the page count. |
| `measurer?` | `FontMeasurer` | |
| `onProgress?` | `ProgressCallback` | Parse + layout progress. Pass the same callback to `renderPdfBytes` to cover the full docx → pdf path. |
| `pageColor?` | `"print" \| "screen"` | `w:background` page colour: painted (`screen`, default, as Word's PDF export) or left white (`print`). |
| `pages?` | `readonly number[]` | Emit only these 1-based pages, with absolute indices. Layout stops after the highest one unless a field shows the page count (`NUMPAGES`, `SECTIONPAGES`), which needs the whole document. |
| `signal?` | `AbortSignal` | Cooperative cancellation for parse + layout; pass the same signal to `renderPdfBytes`. Aborting stops the engine's layout. |
| `trackedChanges?` | `"final" \| "inline" \| "balloons" \| "simple"` | Render conjoined inline revisions instead of the clean final view. |
| `wordPlatform?` | `WordPlatform` | The Word to match where its builds differ (synthetic bold), when no `measurer` is passed. Default Windows. |

## `PngDecoder`

Not exported by name. You get it from the API.

```ts theme={null}
type PngDecoder = (bytes: Uint8Array) => Promise<DecodedPng | undefined>
```

## `Position`

A caret: `offset` is a UTF-16 index into the target's text. `side` picks one of Word's
stops at an inline content control's edge: "before" joins the text before it, "after"
the text after an empty control.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `offset` | `number` | |
| `side?` | `"before" \| "after"` | |
| `target` | `EditTarget` | |

## `Presence`

A selection as token indices in the server's document after change `seq`: of the
body, or of the story stream `story` (`word/footer1.xml#story`, `word/footnotes.xml#w:footnote|2`).

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `anchor` | `number` | |
| `focus` | `number` | |
| `seq` | `number` | |
| `story?` | `string` | |

## `ProgressCallback`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type ProgressCallback = (ev: ConvertProgress) => void
```

## `RangeLayoutOverlap`

Laid content whose bounds intersect a range (or its requested clearance).

Text uses glyph-ink bounds. Images use their laid outer rectangle, which can
include transparent padding; image hits are advisory and may be visually
harmless (a signature intentionally crossing a rule is a common example).

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `behindText?` | `boolean` | True when the ink is drawn under the body flow (wp:anchor behindDoc). Usually decorative: full-bleed cover art, watermarks. Callers deciding "does my shape cover real content?" typically ignore these hits. |
| `inHeaderFooter?` | `boolean` | True when the ink lives in a header or footer story. Shape queries and header/footer range queries report these (both live at page level, so every story's ink is a real collision candidate); body range queries stay body-scoped for text, though header-anchored floats still hit. |
| `intersectionRectPt` | `LayoutBoxPt` | |
| `inTextBox?` | `boolean` | True when the text belongs to a floating textbox. |
| `kind` | `LayoutOverlapKind` | |
| `page` | `number` | |
| `pageNumber` | `number` | Alias of `page`, so `overlap.pageNumber` never silently reads undefined. |
| `pageRectPt` | `LayoutBoxPt` | |
| `printedPageNumber?` | `string` | Same contract as `RangeLayoutRect.printedPageNumber`. |
| `shapeId?` | `number` | wp:docPr id of the DrawingML shape that owns the hit ink, when one does. Look the handle up via `shapes.items.find((s) => s.id === hit.shapeId)`. Legacy VML art has no id and reports none. |
| `text?` | `string` | Present for text ink. |

## `RangeLayoutRect`

One laid rectangle for a range. Multi-line ranges return one rectangle per line.

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `basis?` | `"line" \| "frame" \| "textInk" \| "cellBox" \| "textArea"` | What the rectangle measures. `line` is one laid line box of a range or paragraph query. `frame` is a shape's own box; `textInk` is the bounds of its laid text, reported when a transparent textbox paints no frame of its own. `cellBox` is the laid table-cell box (borders land on its edges), reported for Table, TableRow, and TableCell queries. `textArea` is a Section query's per-page text area (the page box inside its margins) — its bottom edge is the real budget for body content, not pageHeight. |
| `columnRelativePt` | `LayoutBoxPt` | Geometry relative to the active text column's top-left corner. |
| `page` | `number` | |
| `pageNumber` | `number` | Alias of `page`, so `rect.pageNumber` never silently reads undefined. |
| `pageRectPt` | `LayoutBoxPt` | Page-local geometry in points. |
| `paragraphRelativePt` | `LayoutBoxPt` | Geometry relative to this paragraph fragment's first line on the page. |
| `printedPageNumber?` | `string` | The number a PAGE field paints on this page: `w:pgNumType`-formatted, with per-section restarts ("30", "iv"). This is the number a refreshed TOC cites; `page` is the physical index. Absent when the layout did not resolve one. |

## `RasterBudget`

How many output pixels a metafile may spend per CSS px of its placement.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `drawnScale?` | `number` | Output pixels per CSS px of `drawPx`. Default RASTER\_DRAWN\_SCALE. |
| `drawPx?` | `number` | Longer axis of the largest placement in the document, in CSS px. |

## `Rect`

Page-local rectangle in hmm (the IR unit); `rot` turns it as the painter turns its line.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `h` | `number` | |
| `page` | `number` | |
| `rot?` | `Turn` | |
| `w` | `number` | |
| `x` | `number` | |
| `y` | `number` | |

## `RenderedPng`

`page` is the source `LayoutPage.index`, numbered as in `RenderPngOptions.pages`.

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `height` | `number` | |
| `page` | `number` | |
| `png` | `Buffer` | |
| `width` | `number` | |

## `RenderPdfOptions`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `imageConcurrency?` | `number` | Maximum native PNG decodes/compressions in flight when `pngDecoder` is provided. |
| `nativeImageCompression?` | `boolean` | Use native asynchronous deflate for PNG channels (default: on when supported). |
| `onProgress?` | `ProgressCallback` | Phase transitions and per-page heartbeats; see `progress.ts`. |
| `paintPages?` | `readonly number[]` | 1-based pages to actually paint; every OTHER page is still added, at its true size, but blank. That keeps page numbers (and the rasterizer's page windows) aligned with the full document while skipping the paint + font subsetting cost of the pages nobody asked for — the sxs single-page path. Omitted = paint everything. |
| `pngDecoder?` | `PngDecoder` | Host-specific PNG decoder; Node uses Sharp while browsers retain the isomorphic fallback. |
| `signal?` | `AbortSignal` | Cooperative cancellation, checked between phases and per painted page. |

## `RenderPdfResult`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `bytes` | `Uint8Array` | |
| `counts` | `PdfPainterCounts` | |
| `rects` | `number` | `p.rects` drawn across all pages; the painter counts the rest. |
| `timings` | `RenderPdfTimings` | |

## `RenderPdfTimings`

Coarse renderer phases, useful for profiling without changing output.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `annotationsMs` | `number` | |
| `fontsMs` | `number` | |
| `imagesMs` | `number` | |
| `paintMs` | `number` | |
| `saveMs` | `number` | |
| `setupMs` | `number` | |

## `RenderPngOptions`

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `pages?` | `number[]` | Pages to render, matched on `LayoutPage.index`: 1-based for docx, 0-based slide indices for pptx. Default: all pages in the IR. |
| `registry?` | `FontRegistry` | |
| `scale?` | `number` | Supersampling factor over the logical 96dpi page size (2 = 192dpi output), matching the demo's minimum render scale. Default 2. |

## `Selection`

`anchor` is where the drag started; `focus` moves. Equal ⇒ collapsed caret.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `anchor` | `Position` | |
| `focus` | `Position` | |

## `SequencedChange`

Another writer's change and the seq the server gave it.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `change` | `CollabChange` | |
| `seq` | `number` | |

## `SessionLayoutHost`

A host that answers "the laid pages of this session, as of now". OfficeJS
and other layout-backed readers take one instead of laying out themselves.

Import from `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `layout()` | `(source: S, options?: LayoutRequest) => Promise<LayoutDocument>` | |
| `release()?` | `(source: S) => Promise<void>` | Frees what the host holds for `source` now, not at GC; the next layout starts fresh. |
| `save()?` | `(source: S) => Promise<Uint8Array<ArrayBufferLike> \| undefined>` | `source` as .docx bytes written by the engine from its copy (the parts and splices the layouts sent); undefined when the engine cannot save. |
| `session()?` | `(source: S, own?: boolean) => Promise<string \| null>` | Opens `source` in the engine now and gives the Session stamp its open joined and billed (`s_<id>@<ISO start>`); null when the engine bills nothing. |

## `SniffedImage`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `heightPt` | `number` | |
| `heightPx` | `number` | |
| `mime` | `"image/png" \| "image/jpeg"` | |
| `widthPt` | `number` | Natural size in points, honoring embedded density; 96 dpi when absent. |
| `widthPx` | `number` | |

## `SniffedPicture`

Not exported by name. You get it from the API.

```ts theme={null}
type SniffedPicture = Omit<SniffedImage, "mime"> & { mime: SniffedImage["mime"] | "image/gif" | "image/bmp" | "image/tiff" | "image/x-emf" | "image/x-wmf" }
```

## `SourceAnchor`

Import from `@reductoai/docx/browser`.

```ts theme={null}
type SourceAnchor = { bodyIndex: number; kind: "paragraph"; textLength: number; textOffset: number } | { bodyIndex: number; cellName: string; col: number; kind: "table-cell"; path?: CellPathStep[]; row: number; tableIndex: number; tableName: string; textLength: number; textOffset: number }
```

## `SrcRect`

Source-window fractions, each in \[-1, 1); see `LayoutDocument.images`.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `b` | `number` | |
| `l` | `number` | |
| `r` | `number` | |
| `t` | `number` | |

## `TextFillGradient`

A run's gradient fill before layout knows its box: a DrawingML `lin` angle or circle focus.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `angleDeg?` | `number` | Degrees clockwise from +x; absent for a circle. |
| `focus?` | `{ b: number; l: number; r: number; t: number }` | `fillToRect` insets as fractions; present for a circle. |
| `stops` | `{ alpha?: number; color: string; offset: number }[]` | |

## `TextReflection`

A Word `w14:reflection`; opacities and `endPos` are fractions.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `blurPt` | `number` | |
| `distPt` | `number` | |
| `endAlpha` | `number` | |
| `endPos` | `number` | |
| `startAlpha` | `number` | |

## `TextShadow`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `alpha` | `number` | |
| `blurRadiusPt` | `number` | |
| `color` | `string` | |
| `dxHmm` | `number` | |
| `dyHmm` | `number` | |
| `growsLine?` | `boolean` | A Word `w14:shadow`: the line box makes room for it (`shadowGrowthPt`). |

## `TextStroke`

`dash`: on and off lengths in stroke widths; absent is solid. `round`: round dash caps.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `alpha?` | `number` | |
| `color` | `string` | |
| `dash?` | `number[]` | |
| `round?` | `boolean` | |
| `widthPt` | `number` | |

## `TextStyle`

Import from `@reductoai/docx/browser`.

| Name | Type | Description |
| - | - | - |
| `advanceGridPt?` | `number` | Each glyph's advance, in pt, snaps to this grid (PowerPoint lays out in 1/576 inch). |
| `bold` | `boolean` | |
| `border?` | `{ color: string; spacePt: number; widthPt: number }` | Single run border, painted around the run box. |
| `boxFont?` | `string` | Face whose metrics size the line when the glyph is drawn from a fallback face. |
| `charSpacingPt?` | `number` | Per-character tracking in pt (OOXML w:rPr/w:spacing = val/20). The renderer must emit it as the PDF `Tc` operator so glyphs land where we measured. |
| `checkbox?` | `{ checked: boolean; sidePt?: number }` | Legacy FORMCHECKBOX form field. The run carries the square as `shapes` and no glyph text, so a painter needs nothing beyond `drawShapes`. |
| `color` | `string` | CSS hex, e.g. "#000000". Auto/default color becomes "#000000". |
| `comments?` | `readonly string[]` | Comment ranges enclosing this run. Present only in comment-balloon mode. |
| `doubleStrike?` | `boolean` | w:dstrike — double strikethrough. Omitted when false. |
| `doubleUnderline?` | `boolean` | Double underline (Moved To text in the inline review view). Omitted when false. |
| `emboss?` | `boolean` | Legacy raised relief text; paint-only and excluded from advances/line boxes. |
| `emphasisMark?` | `"overFullStop" \| "overSesame" \| "overHyphenationPoint" \| "overComma" \| "overCircle" \| "underFullStop"` | Resolved East Asian emphasis ink; paint-only and excluded from advances/line boxes. |
| `enclosure?` | `{ innerPositionPt: number; innerSizePt: number; outerPositionPt: number; outerSizePt: number; shape: "circle" \| "square" }` | Legacy EQ overlay field rendered as a glyph inside vector enclosure ink. |
| `fillGradient?` | `TextFillGradient` | `w14:textFill` gradient relative to each run's box; layout resolves it to `fillPaint`. |
| `fillPaint?` | `LayoutLinearGradient` | Glyph gradient in page hmm; `color` stays its solid stand-in. |
| `font` | `string` | |
| `glow?` | `{ alpha: number; color: string }` | Resolved `w14:glow` halo paint. |
| `glowRadiusPt?` | `number` | `w14:glow` radius in pt. Grows the line box; see `glowGrowthPt`. |
| `highlight?` | `string \| null` | Run highlight background (OOXML w:highlight), CSS hex or null. |
| `imprint?` | `boolean` | Legacy engraved relief text; paint-only and excluded from advances/line boxes. |
| `italic` | `boolean` | |
| `kern?` | `boolean` | OOXML w:rPr/w:kern threshold met: the run was measured with the face's pair kerning, so the renderer must position glyphs by their kerned advances (`TJ`). |
| `lang?` | `string` | Proofing language (BCP 47) and do-not-check; read by spell check, never painted. |
| `ligatures?` | `LigaturePolicy` | w14:ligatures — per-run OpenType ligature policy. |
| `noProof?` | `true` | |
| `opacity?` | `number` | Paint opacity (0..1), used by translucent VML textpaths/watermarks. |
| `outline?` | `boolean` | Legacy hollow text outline; paint-only and excluded from advances/line boxes. |
| `positionPt?` | `number` | w:rPr/w:position — signed baseline shift in pt (positive = raised), applied ON TOP of `risePt` and WITHOUT the sub/superscript size shrink. Kept separate so the renderer's nominal-size anchoring stays keyed to `risePt`. |
| `reflection?` | `TextReflection` | Mirror image under the glyphs; grows the line box below (`reflectionGrowthPt`). |
| `revision?` | `"insert" \| "delete" \| "format"` | Inline tracked-change provenance; paint policy uses it for margin change bars. |
| `revisionInserted?` | `true` | A deletion of text a tracked insertion added first (`w:del` inside `w:ins`). |
| `risePt?` | `number` | Baseline shift in pt (positive = raised); sub/superscript. When set, `sizePt` is the shrunken script size and the renderer must anchor the baseline at the NOMINAL size (`scriptNominalPt`) before applying the shift. |
| `scriptNominalPt?` | `number` | Nominal size a sub/superscript anchors at, when its shrink is not 58%. |
| `shadow?` | `boolean` | Legacy Word text shadow; paint-only and excluded from advances/line boxes. |
| `sizePt` | `number` | |
| `strike?` | `boolean` | w:strike — single strikethrough. Omitted when false. |
| `textInnerShadow?` | `TextShadow` | DrawingML inner shadow, painted inside the glyphs away from the offset copy. |
| `textShadow?` | `TextShadow` | DrawingML outer shadow, painted behind the glyphs without affecting layout. |
| `textStroke?` | `TextStroke` | `w14:textOutline` with a fill: stroked over the filled glyphs, paint-only. |
| `underline` | `boolean` | |
| `widthScale?` | `number` | |

## `TrackedChangesView`

`simple`: Word's Simple Markup, the final text with a change bar beside each revised line.

Not exported by name. You get it from the API.

```ts theme={null}
type TrackedChangesView = "final" | "inline" | "balloons" | "simple"
```

## `Turn`

Turned text: lines are laid upright and painted turned about a pivot (`LayoutLine.rot`).

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `cx` | `number` | |
| `cy` | `number` | |
| `deg` | `number` | |

## `WasmEngineSource`

The engine's bytes, or a `WebAssembly.Module` compiled from them.

Import from `@reductoai/docx/browser`.

```ts theme={null}
type WasmEngineSource = Uint8Array | ArrayBuffer | object
```

## `WordPlatform`

The Word whose layout to match where its builds differ (synthetic bold); default Windows.

Not exported by name. You get it from the API.

```ts theme={null}
type WordPlatform = "mac" | "windows"
```
