# @birchui/document API reference

> Birch UI Document Editor: paginated rich-text editor with DOCX import and export, track changes and comments

```bash
npm install @birchui/document
```

## @birchui/document

### acceptAllRevisions

Kind: function. Import from `@birchui/document`.

```ts
function acceptAllRevisions(doc: DocNodeJSON): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### breakGaps

Kind: function. Import from `@birchui/document`.

```ts
function breakGaps(breaks: readonly LayoutBreak[], pageStride: number): number[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `breaks` | `readonly LayoutBreak[]` |  |
| `pageStride` | `number` |  |

### buildDocxParts

Kind: function. Import from `@birchui/document`.

```ts
function buildDocxParts(input: DocumentData, options: DocxWriteOptions = {}): ZipInputFile[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentData` |  |
| `options?` | `DocxWriteOptions` |  |

### checkAccessibility

Kind: function. Import from `@birchui/document`.

```ts
function checkAccessibility(doc: DocNodeJSON, options: { fontSize?: number; rules?: readonly AccessibilityRule[] } = {}): AccessibilityIssue[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |
| `options?` | `{ fontSize?: number; rules?: readonly AccessibilityRule[] }` |  |

### clearRegisteredFonts

Kind: function. Import from `@birchui/document`.

```ts
function clearRegisteredFonts(): void
```

### combineDocuments

Kind: function. Import from `@birchui/document`.

```ts
function combineDocuments(original: DocNodeJSON, first: DocNodeJSON, second: DocNodeJSON, options: CombineOptions = {}): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `original` | `DocNodeJSON` |  |
| `first` | `DocNodeJSON` |  |
| `second` | `DocNodeJSON` |  |
| `options?` | `CombineOptions` |  |

### compareDocuments

Kind: function. Import from `@birchui/document`.

```ts
function compareDocuments(original: DocNodeJSON, revised: DocNodeJSON, options: CompareOptions & { idPrefix?: string } = {}): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `original` | `DocNodeJSON` |  |
| `revised` | `DocNodeJSON` |  |
| `options?` | `CompareOptions & { idPrefix?: string }` |  |

### contentBox

Kind: function. Import from `@birchui/document`.

```ts
function contentBox(setup: PageSetup): { width: number; height: number }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `setup` | `PageSetup` |  |

### contrastRatio

Kind: function. Import from `@birchui/document`.

```ts
function contrastRatio(foreground: string, background: string): number | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `foreground` | `string` |  |
| `background` | `string` |  |

### countRevisions

Kind: function. Import from `@birchui/document`.

```ts
function countRevisions(doc: DocNodeJSON): number
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### createAuthorityBackend

Kind: function. Import from `@birchui/document`.

```ts
function createAuthorityBackend(authority: CollabAuthority, start: CollabBackendStart = {}): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `authority` | `CollabAuthority` |  |
| `start?` | `CollabBackendStart` |  |

### createBroadcastChannelBackend

Kind: function. Import from `@birchui/document`.

```ts
function createBroadcastChannelBackend(options: CollabBroadcastBackendOptions): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `CollabBroadcastBackendOptions` |  |

### createCollabAuthority

Kind: function. Import from `@birchui/document`.

```ts
function createCollabAuthority(options: CollabAuthorityOptions = {}): CollabAuthority
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options?` | `CollabAuthorityOptions` |  |

### createCollabDocument

Kind: function. Import from `@birchui/document`.

```ts
function createCollabDocument(document?: DocumentInput | null, limits?: Partial<CollabDocumentLimits>): CollabDocument
```

| Parameter | Type | Description |
| --- | --- | --- |
| `document?` | `DocumentInput \| null` |  |
| `limits?` | `Partial<CollabDocumentLimits>` |  |

### createCollabId

Kind: function. Import from `@birchui/document`.

```ts
function createCollabId(prefix = '', random?: () => number): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `prefix?` | `unknown` |  |
| `random?` | `() => number` |  |

### createCollabProvider

Kind: function. Import from `@birchui/document`.

```ts
function createCollabProvider(backend: CollabBackend, options: CollabBackendProviderOptions = {}): CollabBackendProvider
```

| Parameter | Type | Description |
| --- | --- | --- |
| `backend` | `CollabBackend` |  |
| `options?` | `CollabBackendProviderOptions` |  |

### createDocumentEditor

Kind: function. Import from `@birchui/document`.

```ts
function createDocumentEditor(container: HTMLElement, options: DocumentEditorOptions = {}): DocumentEditorApi
```

| Parameter | Type | Description |
| --- | --- | --- |
| `container` | `HTMLElement` |  |
| `options?` | `DocumentEditorOptions` |  |

### createIndexedDbOfflineStore

Kind: function. Import from `@birchui/document`.

```ts
function createIndexedDbOfflineStore(options: { key: string; database?: string }): CollabOfflineStore
```

Keeps unsent edits in IndexedDB under `key`, which should name the document and the signed-in person, so a tab
that closes while offline finds them again.

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `{ key: string; database?: string }` |  |

### createLoopbackHub

Kind: function. Import from `@birchui/document`.

```ts
function createLoopbackHub(options: LoopbackHubOptions = {}): LoopbackHub
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options?` | `LoopbackHubOptions` |  |

### createMemoryOfflineStore

Kind: function. Import from `@birchui/document`.

```ts
function createMemoryOfflineStore(): CollabOfflineStore
```

### createSocketBackend

Kind: function. Import from `@birchui/document`.

```ts
function createSocketBackend(options: CollabSocketBackendOptions): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `CollabSocketBackendOptions` |  |

### createWireBackend

Kind: function. Import from `@birchui/document`.

```ts
function createWireBackend(link: CollabWireLink, options: CollabWireBackendOptions = {}): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `link` | `CollabWireLink` |  |
| `options?` | `CollabWireBackendOptions` |  |

### createWireEndpoint

Kind: function. Import from `@birchui/document`.

```ts
function createWireEndpoint(authority: CollabAuthority, send: (message: CollabWireMessage) => void): CollabWireEndpoint
```

| Parameter | Type | Description |
| --- | --- | --- |
| `authority` | `CollabAuthority` |  |
| `send` | `(message: CollabWireMessage) => void` |  |

### describeChart

Kind: function. Import from `@birchui/document`.

```ts
function describeChart(model: ChartModel): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `model` | `ChartModel` |  |

### detectFileType

Kind: function. Import from `@birchui/document`.

```ts
function detectFileType(input: FileTypeInput): FileTypeInfo
```

The type of an embedded file. The ProgID is asked first, then the file name, then the content type and the
extension of the part, and last the leading bytes.

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `FileTypeInput` |  |

### docToDocument

Kind: function. Import from `@birchui/document`.

```ts
function docToDocument(input: Uint8Array | ArrayBuffer, options: DocReadOptions = {}): DocumentData
```

Reads a Word 97–2003 binary document (.doc). Every failure is a {@link DocFormatError}; hostile
or damaged input never reads outside the file and stays within `limits`.

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer` |  |
| `options?` | `DocReadOptions` |  |

### documentSections

Kind: function. Import from `@birchui/document`.

```ts
function documentSections(data: Pick<DocumentData, 'content' | 'page'> & Partial<DocumentData>): DocumentSection[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `Pick<DocumentData, 'content' \| 'page'> & Partial<DocumentData>` |  |

### documentText

Kind: function. Import from `@birchui/document`.

```ts
function documentText(doc: DocNodeJSON, options: { skipDeleted?: boolean } = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |
| `options?` | `{ skipDeleted?: boolean }` |  |

### documentToDocx

Kind: function. Import from `@birchui/document`.

```ts
function documentToDocx(data: DocumentData, options: DocxWriteOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `DocumentData` |  |
| `options?` | `DocxWriteOptions` |  |

### documentToHtml

Kind: function. Import from `@birchui/document`.

```ts
function documentToHtml(input: DocumentInput, options: HtmlDocumentOptions = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `HtmlDocumentOptions` |  |

### documentToMarkdown

Kind: function. Import from `@birchui/document`.

```ts
function documentToMarkdown(input: DocumentInput, options: MarkdownOptions = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `MarkdownOptions` |  |

### documentToOdt

Kind: function. Import from `@birchui/document`.

```ts
function documentToOdt(input: DocumentInput): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |

### documentToPdf

Kind: function. Import from `@birchui/document`.

```ts
function documentToPdf(input: DocumentInput, options: DocumentPdfOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### docxToDocument

Kind: function. Import from `@birchui/document`.

```ts
function docxToDocument(input: Uint8Array | ArrayBuffer | Blob, options: DocxReadOptions = {}): Promise<DocumentData>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `DocxReadOptions` |  |

### embeddedObjectFile

Kind: function. Import from `@birchui/document`.

```ts
function embeddedObjectFile(attrs: Attrs): EmbeddedObjectFile
```

| Parameter | Type | Description |
| --- | --- | --- |
| `attrs` | `Attrs` |  |

### embeddedObjectNode

Kind: function. Import from `@birchui/document`.

```ts
function embeddedObjectNode(input: EmbeddedObjectInput): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `EmbeddedObjectInput` |  |

### embeddedObjectType

Kind: function. Import from `@birchui/document`.

```ts
function embeddedObjectType(attrs: Attrs): FileTypeInfo
```

The file type of an `embedded_object` node, from its ProgID, file name, content type and bytes, in that order.

| Parameter | Type | Description |
| --- | --- | --- |
| `attrs` | `Attrs` |  |

### emptyDocument

Kind: function. Import from `@birchui/document`.

```ts
function emptyDocument(): DocumentData
```

### fileIconSvg

Kind: function. Import from `@birchui/document`.

```ts
function fileIconSvg(type: Pick<FileTypeInfo, 'kind' | 'badge'>, options: FileIconSvgOptions = {}): string
```

A standalone SVG picture of the icon of a file type, with the badge as text.

| Parameter | Type | Description |
| --- | --- | --- |
| `type` | `Pick<FileTypeInfo, 'kind' \| 'badge'>` |  |
| `options?` | `FileIconSvgOptions` |  |

### fileTypeLabel

Kind: function. Import from `@birchui/document`.

```ts
function fileTypeLabel(label: FileTypeLabel, translate?: FileTypeTranslate): string
```

The name of a file type as it reads inside a sentence: "PDF document", "image".

| Parameter | Type | Description |
| --- | --- | --- |
| `label` | `FileTypeLabel` |  |
| `translate?` | `FileTypeTranslate` |  |

### findMatches

Kind: function. Import from `@birchui/document`.

```ts
function findMatches(blocks: readonly SearchBlock[], query: string, options: FindOptions = {}): SearchMatch[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `blocks` | `readonly SearchBlock[]` |  |
| `query` | `string` |  |
| `options?` | `FindOptions` |  |

### fontFamilyStack

Kind: function. Import from `@birchui/document`.

```ts
function fontFamilyStack(fontFamily: string): string
```

A CSS font-family list that puts the metric-compatible substitutes right after each requested family.

| Parameter | Type | Description |
| --- | --- | --- |
| `fontFamily` | `string` |  |

### fontSubstitutes

Kind: function. Import from `@birchui/document`.

```ts
function fontSubstitutes(family: string): readonly string[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |

### formatBibliographyEntry

Kind: function. Import from `@birchui/document`.

```ts
function formatBibliographyEntry(source: BibliographySource, style: CitationStyle): CitationRun[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `source` | `BibliographySource` |  |
| `style` | `CitationStyle` |  |

### formatCitation

Kind: function. Import from `@birchui/document`.

```ts
function formatCitation(request: CitationRequest, sources: readonly BibliographySource[], style: CitationStyle): string | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `request` | `CitationRequest` |  |
| `sources` | `readonly BibliographySource[]` |  |
| `style` | `CitationStyle` |  |

### formatDatePicture

Kind: function. Import from `@birchui/document`.

```ts
function formatDatePicture(date: Date, picture: string): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `date` | `Date` |  |
| `picture` | `string` |  |

### formatNumber

Kind: function. Import from `@birchui/document`.

```ts
function formatNumber(value: number, format: string): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `number` |  |
| `format` | `string` |  |

### hostBroadcastChannel

Kind: function. Import from `@birchui/document`.

```ts
function hostBroadcastChannel(authority: CollabAuthority, channel: CollabBroadcastPort | string, options: { hostTimeout?: number } = {}): { close(): void }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `authority` | `CollabAuthority` |  |
| `channel` | `CollabBroadcastPort \| string` |  |
| `options?` | `{ hostTimeout?: number }` |  |

### htmlToDocument

Kind: function. Import from `@birchui/document`.

```ts
function htmlToDocument(html: string): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `html` | `string` |  |

### imageSourceKind

Kind: function. Import from `@birchui/document`.

```ts
function imageSourceKind(value: unknown): ImageSourceKind
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |

### inkSvg

Kind: function. Import from `@birchui/document`.

```ts
function inkSvg(stroke: InkStroke, width: number, height: number): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `stroke` | `InkStroke` |  |
| `width` | `number` |  |
| `height` | `number` |  |

### layoutDocument

Kind: function. Import from `@birchui/document`.

```ts
function layoutDocument(input: DocumentInput, options: DocumentPdfOptions = {}): { layout: PdfDocumentLayout; warnings: string[]; missingFonts: string[] }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### layoutToPdf

Kind: function. Import from `@birchui/document`.

```ts
function layoutToPdf(layout: PdfDocumentLayout, options: PdfWriteOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `layout` | `PdfDocumentLayout` |  |
| `options?` | `PdfWriteOptions` |  |

### markdownToDocument

Kind: function. Import from `@birchui/document`.

```ts
function markdownToDocument(markdown: string): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `markdown` | `string` |  |

### markMoves

Kind: function. Import from `@birchui/document`.

```ts
function markMoves(doc: DocNodeJSON): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### mergeContent

Kind: function. Import from `@birchui/document`.

```ts
function mergeContent(doc: DocNodeJSON, values: MergeValues, options: MergeOptions = {}): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |
| `values` | `MergeValues` |  |
| `options?` | `MergeOptions` |  |

### mergeDocument

Kind: function. Import from `@birchui/document`.

```ts
function mergeDocument(data: DocumentData, values: MergeValues, options: MergeOptions = {}): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `DocumentData` |  |
| `values` | `MergeValues` |  |
| `options?` | `MergeOptions` |  |

### mergeFieldNames

Kind: function. Import from `@birchui/document`.

```ts
function mergeFieldNames(doc: DocNodeJSON): string[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### metafileToSvg

Kind: function. Import from `@birchui/document`.

```ts
function metafileToSvg(bytes: Uint8Array, options: MetafileOptions = {}): string | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `options?` | `MetafileOptions` |  |

### multiplyMatrix

Kind: function. Import from `@birchui/document`.

```ts
function multiplyMatrix(first: PdfMatrix, second: PdfMatrix): PdfMatrix
```

| Parameter | Type | Description |
| --- | --- | --- |
| `first` | `PdfMatrix` |  |
| `second` | `PdfMatrix` |  |

### normalizeChart

Kind: function. Import from `@birchui/document`.

```ts
function normalizeChart(value: unknown): ChartModel | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |

### normalizeDocument

Kind: function. Import from `@birchui/document`.

```ts
function normalizeDocument(input: DocumentInput | null | undefined): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput \| null \| undefined` |  |

### normalizePageSetup

Kind: function. Import from `@birchui/document`.

```ts
function normalizePageSetup(input: Partial<PageSetup> | undefined, base: PageSetup = DEFAULT_PAGE_SETUP): PageSetup
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Partial<PageSetup> \| undefined` |  |
| `base?` | `PageSetup` |  |

### normalizeStroke

Kind: function. Import from `@birchui/document`.

```ts
function normalizeStroke(value: unknown): InkStroke | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |

### numberingLabels

Kind: function. Import from `@birchui/document`.

```ts
function numberingLabels(document: Pick<DocumentData, 'content'> & Partial<DocumentData>): NumberingLabel[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `document` | `Pick<DocumentData, 'content'> & Partial<DocumentData>` |  |

### odtToDocument

Kind: function. Import from `@birchui/document`.

```ts
function odtToDocument(input: Uint8Array | ArrayBuffer | Blob, options: { limits?: Partial<ZipLimits> } = {}): Promise<DocumentData>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `{ limits?: Partial<ZipLimits> }` |  |

### outlineOf

Kind: function. Import from `@birchui/document`.

```ts
function outlineOf(doc: DocNodeJSON): OutlineEntry[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### pageDimensions

Kind: function. Import from `@birchui/document`.

```ts
function pageDimensions(setup: PageSetup): { width: number; height: number }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `setup` | `PageSetup` |  |

### paginate

Kind: function. Import from `@birchui/document`.

```ts
function paginate(blocks: readonly LayoutBlock[], options: PaginateOptions): PaginationResult
```

| Parameter | Type | Description |
| --- | --- | --- |
| `blocks` | `readonly LayoutBlock[]` |  |
| `options` | `PaginateOptions` |  |

### parseFieldInstruction

Kind: function. Import from `@birchui/document`.

```ts
function parseFieldInstruction(instruction: string): ParsedField
```

| Parameter | Type | Description |
| --- | --- | --- |
| `instruction` | `string` |  |

### readDocx

Kind: function. Import from `@birchui/document`.

```ts
function readDocx(input: Uint8Array | ArrayBuffer | Blob, options: DocxReadOptions = {}): Promise<DocxReadResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `DocxReadOptions` |  |

### registeredFonts

Kind: function. Import from `@birchui/document`.

```ts
function registeredFonts(): readonly PdfFontSource[]
```

### registerFonts

Kind: function. Import from `@birchui/document`.

```ts
function registerFonts(fonts: readonly PdfFontSource[]): void
```

Makes font files available to every PDF written afterwards, in the browser and on a server, in addition to the
`fonts` passed with a single call. Registering a face again replaces it.

| Parameter | Type | Description |
| --- | --- | --- |
| `fonts` | `readonly PdfFontSource[]` |  |

### rejectAllRevisions

Kind: function. Import from `@birchui/document`.

```ts
function rejectAllRevisions(doc: DocNodeJSON): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### renderChartSvg

Kind: function. Import from `@birchui/document`.

```ts
function renderChartSvg(input: ChartModel, width: number, height: number): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `ChartModel` |  |
| `width` | `number` |  |
| `height` | `number` |  |

### renderDocumentPdf

Kind: function. Import from `@birchui/document`.

```ts
function renderDocumentPdf(input: DocumentInput, options: DocumentPdfOptions = {}): Promise<DocumentPdfResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### rotationMatrix

Kind: function. Import from `@birchui/document`.

```ts
function rotationMatrix(degrees: number, centerX: number, centerY: number): PdfMatrix
```

| Parameter | Type | Description |
| --- | --- | --- |
| `degrees` | `number` |  |
| `centerX` | `number` |  |
| `centerY` | `number` |  |

### rtfToDocument

Kind: function. Import from `@birchui/document`.

```ts
function rtfToDocument(input: string | Uint8Array | ArrayBuffer): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `string \| Uint8Array \| ArrayBuffer` |  |

### sanitizeHref

Kind: function. Import from `@birchui/document`.

```ts
function sanitizeHref(value: unknown, linkSchemes?: readonly string[]): string | null
```

The address when it may be followed, otherwise null. `linkSchemes` extends the allow-list.

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |
| `linkSchemes?` | `readonly string[]` |  |

### sanitizeImageSrc

Kind: function. Import from `@birchui/document`.

```ts
function sanitizeImageSrc(value: unknown): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |

### updateFields

Kind: function. Import from `@birchui/document`.

```ts
function updateFields(input: DocumentData, context: FieldContext = {}): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentData` |  |
| `context?` | `FieldContext` |  |

### validateDocxPackage

Kind: function. Import from `@birchui/document`.

```ts
function validateDocxPackage(bytes: Uint8Array | ArrayBuffer, options: { limits?: Partial<ZipLimits> } = {}): Promise<DocxValidationResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array \| ArrayBuffer` |  |
| `options?` | `{ limits?: Partial<ZipLimits> }` |  |

### validateDocxParts

Kind: function. Import from `@birchui/document`.

```ts
function validateDocxParts(files: Map<string, Uint8Array>): DocxValidationResult
```

| Parameter | Type | Description |
| --- | --- | --- |
| `files` | `Map<string, Uint8Array>` |  |

### wordCount

Kind: function. Import from `@birchui/document`.

```ts
function wordCount(doc: DocNodeJSON): WordCount
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### writePdf

Kind: function. Import from `@birchui/document`.

```ts
function writePdf(layout: PdfDocumentLayout, options: PdfWriteOptions = {}): Promise<PdfWriteResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `layout` | `PdfDocumentLayout` |  |
| `options?` | `PdfWriteOptions` |  |

### DocFormatError

Kind: class. Import from `@birchui/document`.

```ts
class DocFormatError extends Error
new DocFormatError(readonly code: DocFormatCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"DocFormatError"` |  |
| `readonly code` | `DocFormatCode` |  |

### DocumentFormatError

Kind: class. Import from `@birchui/document`.

```ts
class DocumentFormatError extends Error
new DocumentFormatError(readonly code: DocumentFormatCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"DocumentFormatError"` |  |
| `readonly code` | `DocumentFormatCode` |  |

### FileOpenError

Kind: class. Import from `@birchui/document`.

```ts
class FileOpenError extends Error
new FileOpenError(readonly code: FileErrorCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"FileOpenError"` |  |
| `readonly code` | `FileErrorCode` |  |

### PdfFontError

Kind: class. Import from `@birchui/document`.

```ts
class PdfFontError extends Error
new PdfFontError(readonly families: readonly string[])
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly code` | `"pdfa-fonts-missing"` |  |
| `readonly families` | `readonly string[]` |  |

### ZipLimitError

Kind: class. Import from `@birchui/document`.

```ts
class ZipLimitError extends Error
new ZipLimitError(code: ZipLimitCode, message: string, detail: { limit: number; actual: number; entryName?: string })
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly code` | `ZipLimitCode` |  |
| `readonly limit` | `number` |  |
| `readonly actual` | `number` |  |
| `readonly entryName` | `string \| undefined` |  |

### ACCESSIBILITY_RULES

Kind: const. Import from `@birchui/document`.

```ts
const ACCESSIBILITY_RULES: readonly AccessibilityRule[]
```

### CHART_PALETTE

Kind: const. Import from `@birchui/document`.

```ts
const CHART_PALETTE: string[]
```

### CHART_TYPES

Kind: const. Import from `@birchui/document`.

```ts
const CHART_TYPES: readonly ChartType[]
```

### CITATION_STYLES

Kind: const. Import from `@birchui/document`.

```ts
const CITATION_STYLES: readonly CitationStyle[]
```

### DEFAULT_COLLAB_LIMITS

Kind: const. Import from `@birchui/document`.

```ts
const DEFAULT_COLLAB_LIMITS: Readonly<CollabDocumentLimits>
```

### DEFAULT_DOC_LIMITS

Kind: const. Import from `@birchui/document`.

```ts
const DEFAULT_DOC_LIMITS: Readonly<DocLimits>
```

### DEFAULT_PAGE_SETUP

Kind: const. Import from `@birchui/document`.

```ts
const DEFAULT_PAGE_SETUP: PageSetup
```

### DEFAULT_TOOLBAR

Kind: const. Import from `@birchui/document`.

```ts
const DEFAULT_TOOLBAR: readonly ToolbarItemId[]
```

### DEFAULT_ZIP_LIMITS

Kind: const. Import from `@birchui/document`.

```ts
const DEFAULT_ZIP_LIMITS: Readonly<ZipLimits>
```

### DOCUMENT_EVENT_NAMES

Kind: const. Import from `@birchui/document`.

```ts
const DOCUMENT_EVENT_NAMES: readonly (keyof DocumentEditorEvents)[]
```

### documentEditorDefinition

Kind: const. Import from `@birchui/document`.

```ts
const documentEditorDefinition: WidgetDefinition<DocumentEditorOptions | undefined, { ready: any; historyChange: any; selectionChange: any; embeddedObjectOpen: any; contentChange: any; pageCountChange: any; commentsChange: any; trackedChangesChange: any; readOnlyChange: any; transaction: any; focus: any; blur: any; autosaveStart: any; autosaveEnd: any; autosaveError: any; stylesChange: any; autocorrectChange: any; formChange: any; fieldsUpdate: any; revisionsChange: any; markupModeChange: any; snapshotsChange: any; collabStatus: any; collabConnection: any; collabRejected: any; collabRestored: any; presenceChange: any; locksChange: any; ribbonTabChange: any; viewModeChange: any; layoutComplete: any; fontsMissing: any; fileOpened: any; templateOpened: any; fileSaved: any; fileError: any; fileMenuChange: any; sourcesChange: any; drawToolChange: any; readAloudChange: any; }, DocumentEditorApi>
```

### documentStyles

Kind: const. Import from `@birchui/document`.

```ts
const documentStyles: string
```

### DOCX_MIME

Kind: const. Import from `@birchui/document`.

```ts
const DOCX_MIME: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
```

### FONT_SUBSTITUTIONS

Kind: const. Import from `@birchui/document`.

```ts
const FONT_SUBSTITUTIONS: Readonly<Record<string, readonly string[]>>
```

Fonts with the same advance widths as the font they replace, so text set in the substitute breaks at the same
places. Carlito and Caladea match Calibri and Cambria; the Liberation and Croscore families match Arial,
Times New Roman and Courier New; Gelasio matches Georgia and Selawik matches Segoe UI.

### INK_COLORS

Kind: const. Import from `@birchui/document`.

```ts
const INK_COLORS: string[]
```

### INK_WIDTHS

Kind: const. Import from `@birchui/document`.

```ts
const INK_WIDTHS: number[]
```

### ODT_MIME

Kind: const. Import from `@birchui/document`.

```ts
const ODT_MIME: "application/vnd.oasis.opendocument.text" = 'application/vnd.oasis.opendocument.text'
```

### PAGE_SIZES

Kind: const. Import from `@birchui/document`.

```ts
const PAGE_SIZES: Readonly<Record<PageSizeName, { width: number; height: number }>>
```

### PARAGRAPH_STYLES

Kind: const. Import from `@birchui/document`.

```ts
const PARAGRAPH_STYLES: readonly ParagraphStyleDefinition[]
```

### SHORTCUTS

Kind: const. Import from `@birchui/document`.

```ts
const SHORTCUTS: readonly { keys: string; label: string }[]
```

### SOURCE_TYPES

Kind: const. Import from `@birchui/document`.

```ts
const SOURCE_TYPES: readonly ["Book", "BookSection", "JournalArticle", "ArticleInAPeriodical", "ConferenceProceedings", "Report", "InternetSite", "DocumentFromInternetSite", "Misc"]
```

### WORD_SHORTCUTS

Kind: const. Import from `@birchui/document`.

```ts
const WORD_SHORTCUTS: readonly { keys: string; label: string }[]
```

### AbstractNumbering

Kind: interface. Import from `@birchui/document`.

```ts
interface AbstractNumbering
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `number` |  |
| `name?` | `string` |  |
| `multiLevelType?` | `string` |  |
| `styleLink?` | `string` |  |
| `numStyleLink?` | `string` |  |
| `levels` | `NumberingLevel[]` |  |

### AccessibilityApi

Kind: interface. Import from `@birchui/document`.

```ts
interface AccessibilityApi
```

| Property | Type | Description |
| --- | --- | --- |
| `checkAccessibility` | `(rules?: readonly AccessibilityRule[]) => AccessibilityIssue[]` | The accessibility issues of the document, in document order. |

### AccessibilityIssue

Kind: interface. Import from `@birchui/document`.

```ts
interface AccessibilityIssue
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `rule` | `AccessibilityRule` |  |
| `from` | `number` | Where the object, heading, table or text starts and ends in the document. |
| `to` | `number` |  |
| `text` | `string` | The text of the heading or run, the first cells of the table, or the kind of object. |
| `level?` | `number` | Skipped heading: the level found and the deepest level allowed there. |
| `expected?` | `number` |  |
| `color?` | `string` | Low contrast: the two colours and their ratio. |
| `background?` | `string` |  |
| `ratio?` | `number` |  |

### AddCommentOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface AddCommentOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `author?` | `string` |  |
| `date?` | `string` |  |
| `mentions?` | `readonly CommentMention[]` |  |

### AnnouncementOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface AnnouncementOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `formatting?` | `boolean` |  |
| `position?` | `boolean` |  |
| `review?` | `boolean` |  |

### AuthorInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface AuthorInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `color?` | `string` |  |

### AutocorrectOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface AutocorrectOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `smartQuotes?` | `boolean` |  |
| `dashes?` | `boolean` |  |
| `symbols?` | `boolean` |  |
| `fractions?` | `boolean` |  |
| `ordinals?` | `boolean` |  |
| `autoLists?` | `boolean` |  |
| `autoCapitalize?` | `boolean` |  |
| `autoLinks?` | `boolean` |  |
| `capitalizeTableCells?` | `boolean` |  |
| `replacements?` | `Readonly<Record<string, string>>` |  |
| `exceptions?` | `readonly string[]` |  |

### AutocorrectStorage

Kind: interface. Import from `@birchui/document`.

```ts
interface AutocorrectStorage
```

| Property | Type | Description |
| --- | --- | --- |
| `load` | `() => AutocorrectOptions \| null \| undefined \| Promise<AutocorrectOptions \| null \| undefined>` |  |
| `save` | `(options: AutocorrectOptions) => void \| Promise<void>` |  |

### AutosaveOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface AutosaveOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `delay?` | `number` |  |
| `save` | `(data: DocumentData) => void \| Promise<void>` |  |

### BibliographySource

Kind: interface. Import from `@birchui/document`.

```ts
interface BibliographySource
```

| Property | Type | Description |
| --- | --- | --- |
| `tag` | `string` |  |
| `type` | `SourceType` |  |
| `authors?` | `SourcePerson[]` |  |
| `editors?` | `SourcePerson[]` |  |
| `corporateAuthor?` | `string` |  |
| `title?` | `string` |  |
| `year?` | `string` |  |
| `month?` | `string` |  |
| `day?` | `string` |  |
| `city?` | `string` |  |
| `publisher?` | `string` |  |
| `edition?` | `string` |  |
| `bookTitle?` | `string` |  |
| `journalName?` | `string` |  |
| `periodicalTitle?` | `string` |  |
| `conferenceName?` | `string` |  |
| `institution?` | `string` |  |
| `volume?` | `string` |  |
| `issue?` | `string` |  |
| `pages?` | `string` |  |
| `url?` | `string` |  |
| `yearAccessed?` | `string` |  |
| `monthAccessed?` | `string` |  |
| `dayAccessed?` | `string` |  |
| `guid?` | `string` |  |
| `docx?` | `{ extra: string } \| null` |  |

### BookmarkInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface BookmarkInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `id` | `string` |  |
| `from` | `number` |  |
| `to` | `number` |  |
| `hidden` | `boolean` |  |

### BorderLine

Kind: interface. Import from `@birchui/document`.

```ts
interface BorderLine
```

| Property | Type | Description |
| --- | --- | --- |
| `style` | `string` |  |
| `width` | `number` |  |
| `color` | `string \| null` |  |
| `space?` | `number` |  |
| `shadow?` | `boolean` |  |

### CaptionValue

Kind: interface. Import from `@birchui/document`.

```ts
interface CaptionValue
```

| Property | Type | Description |
| --- | --- | --- |
| `label?` | `string` |  |
| `text?` | `string` |  |
| `position?` | `'above' \| 'below'` |  |

### CellBordersValue

Kind: interface. Import from `@birchui/document`.

```ts
interface CellBordersValue
```

| Property | Type | Description |
| --- | --- | --- |
| `edge` | `BorderEdge` |  |
| `style?` | `'single' \| 'dashed' \| 'dotted' \| 'double'` |  |
| `width?` | `number` |  |
| `color?` | `string` |  |

### CellRevisionInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface CellRevisionInfo extends Omit<RevisionInfo, 'kind'>
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'insertion' \| 'deletion' \| 'merge'` |  |
| `date` | `string` | Inherited from RevisionInfo. |
| `id` | `string` | Inherited from RevisionInfo. |
| `author` | `string` | Inherited from RevisionInfo. |
| `moveId?` | `string \| null \| undefined` | Inherited from RevisionInfo. |

### ChartModel

Kind: interface. Import from `@birchui/document`.

```ts
interface ChartModel
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `ChartType` |  |
| `title?` | `string` |  |
| `categories` | `string[]` | Category names, or the x values of a scatter chart. |
| `series` | `ChartSeries[]` |  |
| `stacking?` | `'stacked' \| 'percent'` |  |
| `legend?` | `'none' \| 'right' \| 'top'` | Where the legend is drawn; the default is below the chart. |
| `categoryTitle?` | `string` |  |
| `valueTitle?` | `string` |  |

### ChartProvider

Kind: interface. Import from `@birchui/document`.

```ts
interface ChartProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `create` | `() => ChartResult \| null \| Promise<ChartResult \| null>` |  |
| `edit?` | `(data: unknown) => ChartResult \| null \| Promise<ChartResult \| null>` |  |

### ChartResult

Kind: interface. Import from `@birchui/document`.

```ts
interface ChartResult
```

| Property | Type | Description |
| --- | --- | --- |
| `src` | `string` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |
| `alt?` | `string` |  |
| `data?` | `unknown` |  |

### ChartSeries

Kind: interface. Import from `@birchui/document`.

```ts
interface ChartSeries
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `values` | `(number \| null)[]` |  |
| `color?` | `string` |  |

### CitationOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CitationOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `tags` | `string \| readonly string[]` | One tag, or several for a citation that names more than one source. |
| `pages?` | `string` |  |
| `suppressAuthor?` | `boolean` |  |
| `suppressYear?` | `boolean` |  |

### CitationRequest

Kind: interface. Import from `@birchui/document`.

```ts
interface CitationRequest
```

| Property | Type | Description |
| --- | --- | --- |
| `tags` | `string[]` |  |
| `pages?` | `string` |  |
| `suppressAuthor?` | `boolean` |  |
| `suppressYear?` | `boolean` |  |

### CitationRun

Kind: interface. Import from `@birchui/document`.

```ts
interface CitationRun
```

| Property | Type | Description |
| --- | --- | --- |
| `text` | `string` |  |
| `italic?` | `boolean` |  |

### CitationsApi

Kind: interface. Import from `@birchui/document`.

```ts
interface CitationsApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getSources` | `() => BibliographySource[]` |  |
| `setSources` | `(sources: readonly BibliographySource[]) => void` |  |
| `addSource` | `(source: Omit<BibliographySource, 'tag'> & { tag?: string }) => string \| null` | Adds a source, or replaces the one with the same tag, and returns its tag. |
| `removeSource` | `(tag: string) => boolean` |  |
| `getCitationStyle` | `() => CitationStyle` |  |
| `setCitationStyle` | `(style: CitationStyle) => void` |  |
| `insertCitation` | `(citation: string \| CitationOptions) => boolean` |  |
| `insertBibliography` | `() => boolean` |  |
| `updateCitations` | `() => number` | Rewrites every citation and bibliography from the sources and returns how many changed. |

### CitationsEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface CitationsEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `sourcesChange` | `{ sources: BibliographySource[]; style: CitationStyle }` |  |

### CollabApi

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getCollabVersion` | `() => number` |  |
| `getCollabStatus` | `() => CollabStatus` |  |
| `getCollabConnection` | `() => CollabConnectionStatus` |  |
| `saveCollabVersion` | `(name: string) => Promise<CollabVersionInfo \| null>` |  |
| `listCollabVersions` | `() => Promise<CollabVersionInfo[]>` |  |
| `restoreCollabVersion` | `(id: string) => Promise<boolean>` |  |
| `diffCollabVersions` | `(fromId: string, toId: string \| null, options?: CollabVersionDiffOptions) => Promise<DocNodeJSON \| null>` |  |
| `lockRange` | `(range?: { from: number; to: number }) => Promise<CollabLock \| null>` |  |
| `unlockRange` | `(id: string) => void` |  |
| `getLocks` | `() => CollabLock[]` |  |
| `sendableSteps` | `() => CollabStepsPayload \| null` |  |
| `receiveSteps` | `(payload: CollabRemotePayload) => boolean` |  |
| `resetCollab` | `(snapshot: CollabSnapshot) => void` |  |
| `getCollaborators` | `() => Collaborator[]` |  |

### CollabAuthority

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabAuthority
```

| Property | Type | Description |
| --- | --- | --- |
| `join` | `(clientId: CollabClientId, emit: (event: CollabBackendEvent) => void) => CollabAuthorityPeer` |  |
| `version` | `() => number` |  |
| `metaVersion` | `() => number` |  |
| `baseVersion` | `() => number` |  |
| `steps` | `() => CollabLogEntry[]` |  |
| `snapshot` | `() => CollabSnapshot \| null` |  |
| `document` | `() => DocumentData \| null` | The authority's own document at its current version, or null when it runs with `trustClients`. |
| `locks` | `() => CollabLockState` |  |
| `clients` | `() => CollabClientId[]` |  |
| `saveVersion` | `(input: CollabVersionInput, clientId: CollabClientId) => CollabVersionInfo` |  |
| `listVersions` | `() => CollabVersionInfo[]` |  |
| `loadVersion` | `(id: string) => CollabVersionRecord \| null` |  |
| `storedVersions` | `() => CollabStoredVersion[]` | The named versions as they are kept: a full document now and then, and the steps since the previous one otherwise. |
| `destroy` | `() => void` |  |

### CollabAuthorityOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabAuthorityOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `document?` | `DocumentInput \| null` | The document at version 0. Without it, and without `snapshot`, the authority starts from an empty document. |
| `limits?` | `Partial<CollabDocumentLimits>` |  |
| `trustClients?` | `boolean` | Relay steps without applying them. Only for a process where every client is your own code, such as a unit test of a transport: a client can then store any document and move any lock. |
| `snapshot?` | `CollabSnapshot \| null` |  |
| `snapshotEvery?` | `number` |  |
| `retainSteps?` | `number` |  |
| `versions?` | `readonly CollabStoredVersion[] \| null` | Named versions saved earlier, as `storedVersions()` returned them. |
| `now?` | `() => number` |  |
| `createId?` | `() => string` |  |

### CollabAuthorityPeer

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabAuthorityPeer
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly clientId` | `CollabClientId` |  |
| `submit` | `(payload: CollabStepsPayload) => CollabSubmitResult` |  |
| `pull` | `(sinceVersion: number, sinceMeta: number) => void` |  |
| `setPresence` | `(state: PresenceState \| null) => void` |  |
| `sendSnapshot` | `(snapshot: CollabSnapshot) => boolean` |  |
| `acquireLock` | `(request: CollabLockRequest) => CollabLock \| null` |  |
| `releaseLock` | `(id: string) => void` |  |
| `leave` | `() => void` |  |

### CollabBackend

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabBackend
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly clientId` | `CollabClientId` |  |
| `open` | `(emit: (event: CollabBackendEvent) => void) => void` |  |
| `version` | `() => number` |  |
| `metaVersion` | `() => number` |  |
| `submit` | `(payload: CollabStepsPayload) => Promise<CollabSubmitResult>` |  |
| `pull` | `(sinceVersion: number, sinceMeta: number) => void` |  |
| `setPresence?` | `(state: PresenceState \| null) => void` |  |
| `sendSnapshot?` | `(snapshot: CollabSnapshot) => void` |  |
| `locks?` | `Pick<CollabLockChannel, 'acquire' \| 'release'>` |  |
| `versions?` | `CollabVersionChannel` |  |
| `close` | `() => void` |  |

### CollabBackendProvider

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabBackendProvider extends CollabProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `connection` | `() => CollabConnectionStatus` |  |
| `close` | `() => void` |  |
| `version` | `number \| (() => number)` | Inherited from CollabProvider. |
| `metaVersion?` | `number \| (() => number) \| undefined` | Inherited from CollabProvider. |
| `sendSteps` | `(payload: CollabStepsPayload) => CollabSendResult \| Promise<CollabSendResult>` | Inherited from CollabProvider. |
| `onRemoteSteps` | `(handler: (payload: CollabRemotePayload) => void) => () => void` | Inherited from CollabProvider. |
| `requestSteps?` | `((sinceVersion: number, sinceMeta?: number) => void) \| undefined` | Inherited from CollabProvider. |
| `onStatus?` | `((handler: (status: "online" \| "offline") => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onConnection?` | `((handler: (status: CollabConnectionStatus) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onReset?` | `((handler: (snapshot: CollabSnapshot) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `presence?` | `CollabPresenceChannel \| undefined` | Inherited from CollabProvider. |
| `presenceTimeout?` | `number \| undefined` | Inherited from CollabProvider. |
| `comments?` | `CollabCommentChannel \| undefined` | Inherited from CollabProvider. |
| `versions?` | `CollabVersionChannel \| undefined` | Inherited from CollabProvider. |
| `locks?` | `CollabLockChannel \| undefined` | Inherited from CollabProvider. |
| `snapshots?` | `CollabSnapshotChannel \| undefined` | Inherited from CollabProvider. |

### CollabBackendProviderOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabBackendProviderOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `presenceTimeout?` | `number` |  |

### CollabBackendStart

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabBackendStart
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId?` | `CollabClientId` |  |
| `version?` | `number` |  |
| `metaVersion?` | `number` |  |

### CollabBroadcastBackendOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabBroadcastBackendOptions extends CollabWireBackendOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `channel` | `CollabBroadcastPort \| string` |  |
| `hostTimeout?` | `number` |  |
| `room?` | `string \| undefined` | Inherited from CollabWireBackendOptions. |
| `requestTimeout?` | `number \| undefined` | Inherited from CollabWireBackendOptions. |
| `clientId?` | `CollabClientId \| undefined` | Inherited from CollabBackendStart. |
| `version?` | `number \| undefined` | Inherited from CollabBackendStart. |
| `metaVersion?` | `number \| undefined` | Inherited from CollabBackendStart. |

### CollabBroadcastPort

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabBroadcastPort
```

| Property | Type | Description |
| --- | --- | --- |
| `postMessage` | `(message: unknown) => void` |  |
| `addEventListener` | `(type: 'message', listener: (event: { data: unknown }) => void) => void` |  |
| `removeEventListener` | `(type: 'message', listener: (event: { data: unknown }) => void) => void` |  |
| `close?` | `() => void` |  |

### CollabCommentChannel

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabCommentChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(operation: CollabCommentOperation) => void` |  |
| `subscribe` | `(handler: (operation: CollabCommentOperation) => void) => () => void` |  |

### CollabDocument

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabDocument
```

| Property | Type | Description |
| --- | --- | --- |
| `apply` | `(steps: readonly unknown[]) => CollabDocumentResult` |  |
| `prepare` | `(steps: readonly unknown[]) => CollabDocumentPrepared` | Checks the steps against the current document without changing it; `commit()` then makes them current. |
| `checkMetaOperations` | `(operations: readonly CollabMetaOperation[]) => CollabDocumentResult` |  |
| `applyMeta` | `(operations: readonly CollabMetaOperation[]) => CollabDocumentResult` |  |
| `size` | `() => number` |  |
| `snapshot` | `() => DocumentData` |  |

### CollabDocumentLimits

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabDocumentLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxStepsPerSubmit` | `number` |  |
| `maxSubmitBytes` | `number` |  |
| `maxDocumentSize` | `number` |  |
| `maxMetaPerSubmit` | `number` |  |
| `maxCommentLength` | `number` |  |

### CollabEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `collabStatus` | `CollabStatus` |  |
| `collabConnection` | `{ status: CollabConnectionStatus; previous: CollabConnectionStatus }` |  |
| `collabRejected` | `{ reason: CollabRejectReason; steps: number }` |  |
| `collabRestored` | `{ steps: number; version: number }` |  |
| `presenceChange` | `{ collaborators: Collaborator[] }` |  |
| `locksChange` | `{ locks: CollabLock[] }` |  |

### CollabLock

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabLock
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `clientId` | `CollabClientId` |  |
| `name` | `string` |  |
| `from` | `number` |  |
| `to` | `number` |  |

### CollabLockChannel

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabLockChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `acquire` | `(request: CollabLockRequest) => Promise<CollabLock \| null>` |  |
| `release` | `(id: string) => void` |  |
| `subscribe` | `(handler: (state: CollabLockState) => void) => () => void` |  |

### CollabLockRequest

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabLockRequest
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `version` | `number` |  |
| `name?` | `string` |  |

### CollabLockState

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabLockState
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number` |  |
| `locks` | `CollabLock[]` |  |
| `revision?` | `number` |  |

### CollabLogEntry

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabLogEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `step` | `unknown` |  |
| `clientId` | `CollabClientId` |  |

### CollabOfflineRecord

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabOfflineRecord
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number` | The version the unsent steps start from. |
| `document` | `DocNodeJSON` | The document body at `version`, without the unsent steps. |
| `steps` | `unknown[]` |  |
| `clientId` | `CollabClientId` |  |
| `savedAt` | `number` |  |

### CollabOfflineStore

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabOfflineStore
```

| Property | Type | Description |
| --- | --- | --- |
| `load` | `() => CollabOfflineRecord \| null \| Promise<CollabOfflineRecord \| null>` |  |
| `save` | `(record: CollabOfflineRecord) => void \| Promise<void>` |  |
| `clear` | `() => void \| Promise<void>` |  |

### CollabOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `collab?` | `CollabProvider \| null` |  |
| `collabStorage?` | `CollabOfflineStore \| null` | Where edits that have not reached the authority are kept. Without it they live in memory and are lost when the tab closes. `createIndexedDbOfflineStore({ key })` keeps them across a reload. |

### Collaborator

Kind: interface. Import from `@birchui/document`.

```ts
interface Collaborator
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `name` | `string` |  |
| `color` | `string` |  |
| `anchor` | `number \| null` |  |
| `head` | `number \| null` |  |
| `focused` | `boolean` |  |

### CollabPresenceChannel

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabPresenceChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(state: PresenceState) => void` |  |
| `subscribe` | `(handler: (states: Record<string, PresenceState>) => void) => () => void` |  |

### CollabProvider

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number \| (() => number)` |  |
| `clientId?` | `CollabClientId` |  |
| `metaVersion?` | `number \| (() => number)` |  |
| `sendSteps` | `(payload: CollabStepsPayload) => CollabSendResult \| Promise<CollabSendResult>` |  |
| `onRemoteSteps` | `(handler: (payload: CollabRemotePayload) => void) => () => void` |  |
| `requestSteps?` | `(sinceVersion: number, sinceMeta?: number) => void` |  |
| `onStatus?` | `(handler: (status: 'online' \| 'offline') => void) => () => void` |  |
| `onConnection?` | `(handler: (status: CollabConnectionStatus) => void) => () => void` |  |
| `onReset?` | `(handler: (snapshot: CollabSnapshot) => void) => () => void` |  |
| `presence?` | `CollabPresenceChannel` |  |
| `presenceTimeout?` | `number` |  |
| `comments?` | `CollabCommentChannel` |  |
| `versions?` | `CollabVersionChannel` |  |
| `locks?` | `CollabLockChannel` |  |
| `snapshots?` | `CollabSnapshotChannel` |  |

### CollabRemotePayload

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabRemotePayload
```

| Property | Type | Description |
| --- | --- | --- |
| `steps` | `unknown[]` |  |
| `clientIds` | `CollabClientId[]` |  |
| `version?` | `number` |  |
| `meta?` | `CollabMetaOperation[]` |  |
| `metaClientId?` | `CollabClientId` |  |
| `metaVersion?` | `number` |  |
| `metaClientIds?` | `CollabClientId[]` |  |

### CollabSnapshot

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabSnapshot
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentInput` |  |
| `version` | `number` |  |
| `metaVersion?` | `number` |  |

### CollabSnapshotChannel

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabSnapshotChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(snapshot: CollabSnapshot) => void` |  |
| `subscribe` | `(handler: () => void) => () => void` |  |

### CollabSocketBackendOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabSocketBackendOptions extends CollabWireBackendOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `connect` | `() => CollabSocketLike` |  |
| `reconnectMin?` | `number` |  |
| `reconnectMax?` | `number` |  |
| `maxAttempts?` | `number` |  |
| `heartbeat?` | `number` |  |
| `room?` | `string \| undefined` | Inherited from CollabWireBackendOptions. |
| `requestTimeout?` | `number \| undefined` | Inherited from CollabWireBackendOptions. |
| `clientId?` | `CollabClientId \| undefined` | Inherited from CollabBackendStart. |
| `version?` | `number \| undefined` | Inherited from CollabBackendStart. |
| `metaVersion?` | `number \| undefined` | Inherited from CollabBackendStart. |

### CollabSocketLike

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabSocketLike
```

| Property | Type | Description |
| --- | --- | --- |
| `readyState` | `number` |  |
| `send` | `(data: string) => void` |  |
| `close` | `(code?: number, reason?: string) => void` |  |
| `addEventListener` | `(type: 'open' \| 'message' \| 'close' \| 'error', listener: (event: { data?: unknown; type?: string }) => void) => void` |  |

### CollabStatus

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabStatus
```

| Property | Type | Description |
| --- | --- | --- |
| `state` | `CollabState` |  |
| `version` | `number` |  |
| `unconfirmed` | `number` |  |
| `clientId` | `CollabClientId \| null` |  |
| `online` | `boolean` |  |
| `connection` | `CollabConnectionStatus` |  |

### CollabStepFootprint

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabStepFootprint
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `map` | `number[]` |  |

### CollabStepsPayload

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabStepsPayload
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number` |  |
| `steps` | `unknown[]` |  |
| `clientId` | `CollabClientId` |  |
| `meta?` | `CollabMetaOperation[]` |  |
| `footprint?` | `CollabStepFootprint[]` |  |

### CollabSubmitResult

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabSubmitResult
```

| Property | Type | Description |
| --- | --- | --- |
| `accepted` | `boolean` |  |
| `version?` | `number` |  |
| `reason?` | `CollabRejectReason` |  |
| `detail?` | `string` |  |

### CollabVersionChannel

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `save` | `(input: CollabVersionInput) => Promise<CollabVersionInfo>` |  |
| `list` | `() => Promise<CollabVersionInfo[]>` |  |
| `load` | `(id: string) => Promise<CollabVersionRecord \| null>` |  |

### CollabVersionDelta

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionDelta extends CollabVersionInfo
```

A version kept as the steps and document updates made since the version named by `parent`.

| Property | Type | Description |
| --- | --- | --- |
| `metaVersion` | `number` |  |
| `parent` | `string` |  |
| `steps` | `unknown[]` |  |
| `meta` | `CollabVersionMetaEntry[]` |  |
| `id` | `string` | Inherited from CollabVersionInfo. |
| `name` | `string` | Inherited from CollabVersionInfo. |
| `createdAt` | `string` | Inherited from CollabVersionInfo. |
| `author` | `string` | Inherited from CollabVersionInfo. |
| `clientId` | `CollabClientId` | Inherited from CollabVersionInfo. |
| `version` | `number` | Inherited from CollabVersionInfo. |

### CollabVersionDiffOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionDiffOptions extends CompareOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `idPrefix?` | `string` |  |
| `author?` | `string \| undefined` | Inherited from CompareOptions. |
| `date?` | `string \| undefined` | Inherited from CompareOptions. |
| `granularity?` | `"word" \| "character" \| undefined` | Inherited from CompareOptions. |
| `moves?` | `boolean \| undefined` | Inherited from CompareOptions. |
| `formatting?` | `boolean \| undefined` | Inherited from CompareOptions. |

### CollabVersionInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `createdAt` | `string` |  |
| `author` | `string` |  |
| `clientId` | `CollabClientId` |  |
| `version` | `number` |  |

### CollabVersionInput

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionInput
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `author` | `string` |  |
| `version` | `number` |  |
| `document` | `DocumentInput` |  |

### CollabVersionMetaEntry

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionMetaEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `at` | `number` | The step version the operation was applied at. |
| `operation` | `CollabMetaOperation` |  |

### CollabVersionRecord

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionRecord extends CollabVersionInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentInput` |  |
| `id` | `string` | Inherited from CollabVersionInfo. |
| `name` | `string` | Inherited from CollabVersionInfo. |
| `createdAt` | `string` | Inherited from CollabVersionInfo. |
| `author` | `string` | Inherited from CollabVersionInfo. |
| `clientId` | `CollabClientId` | Inherited from CollabVersionInfo. |
| `version` | `number` | Inherited from CollabVersionInfo. |

### CollabVersionSnapshot

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabVersionSnapshot extends CollabVersionRecord
```

| Property | Type | Description |
| --- | --- | --- |
| `metaVersion?` | `number` |  |
| `document` | `DocumentInput` | Inherited from CollabVersionRecord. |
| `id` | `string` | Inherited from CollabVersionInfo. |
| `name` | `string` | Inherited from CollabVersionInfo. |
| `createdAt` | `string` | Inherited from CollabVersionInfo. |
| `author` | `string` | Inherited from CollabVersionInfo. |
| `clientId` | `CollabClientId` | Inherited from CollabVersionInfo. |
| `version` | `number` | Inherited from CollabVersionInfo. |

### CollabWireBackendOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabWireBackendOptions extends CollabBackendStart
```

| Property | Type | Description |
| --- | --- | --- |
| `room?` | `string` |  |
| `requestTimeout?` | `number` |  |
| `clientId?` | `CollabClientId \| undefined` | Inherited from CollabBackendStart. |
| `version?` | `number \| undefined` | Inherited from CollabBackendStart. |
| `metaVersion?` | `number \| undefined` | Inherited from CollabBackendStart. |

### CollabWireEndpoint

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabWireEndpoint
```

| Property | Type | Description |
| --- | --- | --- |
| `receive` | `(message: CollabWireMessage) => void` |  |
| `close` | `() => void` |  |

### CollabWireLink

Kind: interface. Import from `@birchui/document`.

```ts
interface CollabWireLink
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(message: CollabWireMessage) => boolean` |  |
| `open` | `(handlers: { message(message: CollabWireMessage): void; status(status: CollabConnectionStatus): void }) => void` |  |
| `close` | `() => void` |  |

### ColumnSettings

Kind: interface. Import from `@birchui/document`.

```ts
interface ColumnSettings
```

| Property | Type | Description |
| --- | --- | --- |
| `count` | `number` |  |
| `gap?` | `number` |  |
| `separator?` | `boolean` |  |
| `widths?` | `{ width: number; gap: number }[]` |  |

### CombineOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CombineOptions extends Pick<CompareOptions, 'date' | 'granularity' | 'formatting'>
```

| Property | Type | Description |
| --- | --- | --- |
| `firstAuthor?` | `string` |  |
| `secondAuthor?` | `string` |  |
| `moves?` | `boolean` |  |
| `date?` | `string \| undefined` | Inherited from CompareOptions. |
| `granularity?` | `"word" \| "character" \| undefined` | Inherited from CompareOptions. |
| `formatting?` | `boolean \| undefined` | Inherited from CompareOptions. |

### CommentMention

Kind: interface. Import from `@birchui/document`.

```ts
interface CommentMention
```

| Property | Type | Description |
| --- | --- | --- |
| `start` | `number` |  |
| `length` | `number` |  |
| `name` | `string` |  |
| `email?` | `string` |  |

### CommentReply

Kind: interface. Import from `@birchui/document`.

```ts
interface CommentReply
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `text` | `string` |  |
| `mentions?` | `CommentMention[]` |  |
| `durableId?` | `string` | Word's lasting identifier of the comment (`commentsIds`), kept so `commentsExtensible` can be written back. |
| `dateUtc?` | `string` | The time of the comment in UTC, from Word's `commentsExtensible` part. |

### CommentThread

Kind: interface. Import from `@birchui/document`.

```ts
interface CommentThread
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `text` | `string` |  |
| `resolved` | `boolean` |  |
| `replies` | `CommentReply[]` |  |
| `mentions?` | `CommentMention[]` |  |
| `durableId?` | `string` | Word's lasting identifier of the comment (`commentsIds`), kept so `commentsExtensible` can be written back. |
| `dateUtc?` | `string` | The time of the comment in UTC, from Word's `commentsExtensible` part. |

### CompareOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface CompareOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `author?` | `string` |  |
| `date?` | `string` |  |
| `granularity?` | `'word' \| 'character'` |  |
| `moves?` | `boolean` |  |
| `formatting?` | `boolean` |  |

### CompatibilitySettings

Kind: interface. Import from `@birchui/document`.

```ts
interface CompatibilitySettings
```

| Property | Type | Description |
| --- | --- | --- |
| `flags` | `Record<string, boolean>` |  |
| `settings` | `Record<string, string>` |  |

### ContentControl

Kind: interface. Import from `@birchui/document`.

```ts
interface ContentControl
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `ContentControlKind` |  |
| `id?` | `string` |  |
| `tag?` | `string` |  |
| `title?` | `string` |  |
| `lock?` | `'sdtLocked' \| 'contentLocked' \| 'sdtContentLocked' \| 'unlocked'` |  |
| `isPlaceholder?` | `boolean` |  |
| `binding?` | `{ xpath: string; storeItemId?: string; prefixMappings?: string } \| null` |  |
| `items?` | `{ text: string; value: string }[]` |  |
| `checked?` | `boolean` |  |
| `date?` | `{ value?: string; format?: string }` |  |
| `multiLine?` | `boolean` |  |

### ContentControlValue

Kind: interface. Import from `@birchui/document`.

```ts
interface ContentControlValue
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `FormControlKind` |  |
| `title?` | `string` |  |
| `tag?` | `string` |  |
| `placeholder?` | `string` |  |
| `items?` | `{ text: string; value: string }[]` |  |
| `dateFormat?` | `string` |  |
| `lockContent?` | `boolean` |  |
| `lockControl?` | `boolean` |  |
| `required?` | `boolean` |  |
| `checked?` | `boolean` |  |

### CrossReferenceValue

Kind: interface. Import from `@birchui/document`.

```ts
interface CrossReferenceValue
```

| Property | Type | Description |
| --- | --- | --- |
| `target` | `CrossReferenceTarget` |  |
| `index?` | `number` |  |
| `name?` | `string` |  |
| `display?` | `CrossReferenceDisplay` |  |
| `hyperlink?` | `boolean` |  |

### DetailedWordCount

Kind: interface. Import from `@birchui/document`.

```ts
interface DetailedWordCount
```

| Property | Type | Description |
| --- | --- | --- |
| `pages` | `number` |  |
| `words` | `number` |  |
| `characters` | `number` |  |
| `charactersNoSpaces` | `number` |  |
| `paragraphs` | `number` |  |
| `lines` | `number` |  |
| `isSelection` | `boolean` |  |

### DocLimits

Kind: interface. Import from `@birchui/document`.

```ts
interface DocLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxBytes` | `number` | Largest file that is read at all, in bytes. |
| `maxCharacters` | `number` | Largest number of characters in the body of the document. |
| `maxPictureBytes` | `number` | Total size of the pictures that are kept, in bytes. Pictures past it are left out. |
| `maxTableCells` | `number` | Largest number of cells in one table. A table past it is read as paragraphs. |

### DocMarkJSON

Kind: interface. Import from `@birchui/document`.

```ts
interface DocMarkJSON
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `string` |  |
| `attrs?` | `Record<string, unknown>` |  |

### DocNodeJSON

Kind: interface. Import from `@birchui/document`.

```ts
interface DocNodeJSON
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `string` |  |
| `attrs?` | `Record<string, unknown>` |  |
| `content?` | `DocNodeJSON[]` |  |
| `marks?` | `DocMarkJSON[]` |  |
| `text?` | `string` |  |

### DocReadOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface DocReadOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<DocLimits>` |  |

### DocumentData

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentData extends HeaderFooterContent
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `1` |  |
| `content` | `DocNodeJSON` |  |
| `page` | `PageSetup` |  |
| `comments` | `CommentThread[]` |  |
| `properties` | `DocumentProperties` |  |
| `defaults` | `DocumentDefaults` |  |
| `evenHeader?` | `DocNodeJSON \| null` |  |
| `evenFooter?` | `DocNodeJSON \| null` |  |
| `settings?` | `DocumentSettings` |  |
| `styles?` | `DocumentStyle[]` |  |
| `numbering?` | `NumberingDefinitions` |  |
| `protection?` | `DocumentProtection \| null` |  |
| `people?` | `DocumentPerson[]` |  |
| `docx?` | `DocxPackage \| null` |  |
| `watermark?` | `Watermark \| null` |  |
| `lineNumbers?` | `LineNumbering \| null` |  |
| `lists?` | `MultilevelListDefinition[]` |  |
| `sources?` | `BibliographySource[]` |  |
| `citationStyle?` | `CitationStyle` |  |
| `header` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |
| `footer` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |
| `firstHeader` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |
| `firstFooter` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |

### DocumentDefaults

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentDefaults
```

| Property | Type | Description |
| --- | --- | --- |
| `fontFamily` | `string` |  |
| `fontSize` | `number` |  |

### DocumentEditorApi

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentEditorApi extends Widget<DocumentEditorOptions, DocumentEditorEvents>, EditingApi, ObjectsApi, ReviewApi, CollabApi, RibbonApi, LayoutApi, FileApi, CitationsApi, AccessibilityApi, DrawApi, ReadAloudApi, SpellingApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getJSON` | `() => DocumentData` |  |
| `setJSON` | `(data: DocumentInput) => void` |  |
| `getText` | `() => string` |  |
| `importDocx` | `(input: ArrayBuffer \| Uint8Array \| Blob, options?: { limits?: Partial<ZipLimits> }) => Promise<void>` |  |
| `exportDocx` | `() => Promise<Blob>` |  |
| `downloadDocx` | `(fileName?: string) => Promise<void>` |  |
| `exportHtml` | `(options?: HtmlExportOptions) => string` |  |
| `importHtml` | `(html: string) => void` |  |
| `print` | `() => void` |  |
| `exec` | `(command: DocumentCommand, value?: unknown) => boolean` |  |
| `canExec` | `(command: DocumentCommand, value?: unknown) => boolean` |  |
| `getFormatState` | `() => FormatState` |  |
| `getSelection` | `() => { from: number; to: number; text: string }` |  |
| `setSelection` | `(from: number, to?: number) => void` |  |
| `undo` | `() => boolean` |  |
| `redo` | `() => boolean` |  |
| `canUndo` | `() => boolean` |  |
| `canRedo` | `() => boolean` |  |
| `find` | `(query: string, options?: FindOptions) => FindResult` |  |
| `findNext` | `() => FindResult` |  |
| `findPrevious` | `() => FindResult` |  |
| `replace` | `(replacement: string) => FindResult` |  |
| `replaceAll` | `(query: string, replacement: string, options?: FindOptions) => number` |  |
| `clearFind` | `() => void` |  |
| `openFindPanel` | `(mode?: 'find' \| 'replace') => void` |  |
| `setTrackChanges` | `(enabled: boolean) => void` |  |
| `isTrackingChanges` | `() => boolean` |  |
| `setShowMarkup` | `(visible: boolean) => void` |  |
| `getTrackedChanges` | `() => TrackedChange[]` |  |
| `acceptChange` | `(id: string) => boolean` |  |
| `rejectChange` | `(id: string) => boolean` |  |
| `acceptAllChanges` | `() => number` |  |
| `rejectAllChanges` | `() => number` |  |
| `addComment` | `(text: string, options?: AddCommentOptions) => string \| null` |  |
| `getComments` | `() => CommentThread[]` |  |
| `replyToComment` | `(id: string, text: string, options?: AddCommentOptions) => string \| null` |  |
| `editComment` | `(id: string, text: string) => boolean` |  |
| `resolveComment` | `(id: string, resolved?: boolean) => boolean` |  |
| `deleteComment` | `(id: string) => boolean` |  |
| `selectComment` | `(id: string) => boolean` |  |
| `compareWith` | `(revised: DocumentInput, options?: CompareOptions) => number` |  |
| `proposeChange` | `(change: ProposedChange) => string[]` |  |
| `applySteps` | `(steps: readonly unknown[]) => boolean` |  |
| `insertField` | `(name: string) => boolean` |  |
| `getFieldNames` | `() => string[]` |  |
| `merge` | `(values: MergeValues, options?: MergeOptions) => DocumentData` |  |
| `applyMerge` | `(values: MergeValues, options?: MergeOptions) => void` |  |
| `insertImage` | `(src: string, options?: InsertImageOptions) => boolean` |  |
| `insertTable` | `(rows: number, columns: number) => boolean` |  |
| `getWordCount` | `() => WordCount` |  |
| `getPageCount` | `() => number` |  |
| `getCurrentPage` | `() => number` |  |
| `getPageSetup` | `() => PageSetup` |  |
| `setPageSetup` | `(setup: Partial<PageSetup>) => void` |  |
| `setLayout` | `(layout: DocumentLayout) => void` |  |
| `getLayout` | `() => DocumentLayout` |  |
| `setZoom` | `(zoom: number) => void` |  |
| `getZoom` | `() => number` |  |
| `getOutline` | `() => OutlineEntry[]` |  |
| `scrollToHeading` | `(index: number) => boolean` |  |
| `setReadOnly` | `(readOnly: boolean) => void` |  |
| `isReadOnly` | `() => boolean` |  |
| `setAuthor` | `(author: AuthorInfo \| string) => void` |  |
| `editHeaderFooter` | `(part: 'header' \| 'footer') => void` |  |
| `relayout` | `() => void` |  |
| `focus` | `() => void` |  |
| `readonly element` | `HTMLElement` | Inherited from Widget. |
| `update` | `(options: Partial<DocumentEditorOptions>) => void` | Inherited from Widget. |
| `on` | `<K extends keyof TEvents & string>(event: K, listener: Listener<TEvents[K]>) => () => void` | Inherited from Widget. |
| `destroy` | `() => void` | Inherited from Widget. |
| `openPane` | `(id: string) => boolean` | Inherited from EditingApi. |
| `closePane` | `(id: string) => boolean` | Inherited from EditingApi. |
| `isPaneOpen` | `(id: string) => boolean` | Inherited from EditingApi. |
| `getStyles` | `() => ParagraphStyleInfo[]` | Inherited from EditingApi. |
| `applyStyle` | `(id: string) => boolean` | Inherited from EditingApi. |
| `createStyle` | `(name: string, format?: StyleFormat, basedOn?: string) => string \| null` | Inherited from EditingApi. |
| `createStyleFromSelection` | `(name: string) => string \| null` | Inherited from EditingApi. |
| `modifyStyle` | `(id: string, format: StyleFormat, name?: string) => boolean` | Inherited from EditingApi. |
| `updateStyleToMatchSelection` | `(id: string) => boolean` | Inherited from EditingApi. |
| `deleteStyle` | `(id: string) => boolean` | Inherited from EditingApi. |
| `getFontFormat` | `() => Required<FontFormat>` | Inherited from EditingApi. |
| `setFontFormat` | `(format: FontFormat) => boolean` | Inherited from EditingApi. |
| `getDocumentProperties` | `() => DocumentProperties` | Inherited from EditingApi. |
| `setDocumentProperties` | `(properties: { [K in keyof DocumentProperties]?: DocumentProperties[K] \| null; }) => boolean` | Inherited from EditingApi. |
| `getAutocorrectOptions` | `() => Required<AutocorrectOptions> \| null` | Inherited from EditingApi. |
| `setAutocorrectOptions` | `(options: AutocorrectOptions) => boolean` | Inherited from EditingApi. |
| `setHyperlink` | `(options: HyperlinkOptions \| null) => boolean` | Inherited from EditingApi. |
| `setParagraphFormat` | `(format: ParagraphFormat) => boolean` | Inherited from EditingApi. |
| `setParagraphBorders` | `(borders: ParagraphBorders \| null, shading?: string \| null) => boolean` | Inherited from EditingApi. |
| `changeCase` | `(mode: CaseMode) => boolean` | Inherited from EditingApi. |
| `setDropCap` | `(mode: "none" \| "drop" \| "margin", lines?: number) => boolean` | Inherited from EditingApi. |
| `collapseHeading` | `(index: number, collapsed: boolean) => boolean` | Inherited from EditingApi. |
| `isHeadingCollapsed` | `(index: number) => boolean` | Inherited from EditingApi. |
| `moveSection` | `(index: number, targetIndex: number) => boolean` | Inherited from EditingApi. |
| `getDetailedWordCount` | `() => DetailedWordCount` | Inherited from EditingApi. |
| `getFindResults` | `(query: string, options?: FindOptions) => FindPaneResult[]` | Inherited from EditingApi. |
| `getListDefinitions` | `() => MultilevelListDefinition[]` | Inherited from EditingApi. |
| `getListLevels` | `() => ListLevelFormat[] \| null` | The levels of the Word list that holds the cursor, or `null` when the cursor is not in a list from a Word file. Inherited from EditingApi. |
| `setListLevels` | `(levels: readonly ListLevelFormat[]) => boolean` | Changes the levels of the Word list that holds the cursor; every list that uses the same definition follows. Inherited from EditingApi. |
| `defineMultilevelList` | `(definition: Omit<MultilevelListDefinition, "id"> & { id?: string; }) => string` | Inherited from EditingApi. |
| `pasteHtml` | `(html: string, mode?: PasteMode) => boolean` | Inherited from EditingApi. |
| `saveNow` | `() => Promise<void>` | Inherited from EditingApi. |
| `isSaving` | `() => boolean` | Inherited from EditingApi. |
| `getWatermark` | `() => Watermark \| null` | Inherited from EditingApi. |
| `setWatermark` | `(watermark: Watermark \| string \| null) => boolean` | Inherited from EditingApi. |
| `getLineNumbers` | `() => LineNumbering \| null` | Inherited from EditingApi. |
| `setLineNumbers` | `(numbering: LineNumbering \| boolean \| null) => boolean` | Inherited from EditingApi. |
| `getColumns` | `() => ColumnSettings` | Inherited from EditingApi. |
| `setColumns` | `(columns: ColumnSettings \| number) => boolean` | Inherited from EditingApi. |
| `insertBreak` | `(kind: BreakKind) => boolean` | Inherited from EditingApi. |
| `getFootnotes` | `(kind?: NoteKind) => FootnoteInfo[]` | Inherited from ObjectsApi. |
| `getBookmarks` | `(includeHidden?: boolean) => BookmarkInfo[]` | Inherited from ObjectsApi. |
| `goToBookmark` | `(name: string) => boolean` | Inherited from ObjectsApi. |
| `updateFields` | `() => number` | Inherited from ObjectsApi. |
| `setFormMode` | `(enabled: boolean) => void` | Inherited from ObjectsApi. |
| `isFormMode` | `() => boolean` | Inherited from ObjectsApi. |
| `getFormData` | `() => Record<string, unknown>` | Inherited from ObjectsApi. |
| `setFormData` | `(data: Record<string, unknown>) => number` | Inherited from ObjectsApi. |
| `validateForm` | `() => FormFieldError[]` | Inherited from ObjectsApi. |
| `openObjectDialog` | `(name: ObjectDialogName) => boolean` | Inherited from ObjectsApi. |
| `evaluateTableFormula` | `(formula: string) => string \| null` | Inherited from ObjectsApi. |
| `getProtection` | `() => DocumentProtection \| null` | Inherited from ObjectsApi. |
| `protectDocument` | `(mode: ProtectionMode, password?: string) => Promise<boolean>` | Inherited from ObjectsApi. |
| `unprotectDocument` | `(password?: string) => Promise<boolean>` | Inherited from ObjectsApi. |
| `isPasswordProtected` | `() => boolean` | Inherited from ObjectsApi. |
| `insertEmbeddedObject` | `(options: InsertEmbeddedObjectOptions) => boolean` | Inherited from ObjectsApi. |
| `getEmbeddedObjects` | `() => EmbeddedObjectInfo[]` | Inherited from ObjectsApi. |
| `openEmbeddedObject` | `(pos?: number) => boolean` | Inherited from ObjectsApi. |
| `downloadEmbeddedObject` | `(pos?: number) => boolean` | Inherited from ObjectsApi. |
| `getMarkupMode` | `() => MarkupMode` | Inherited from ReviewApi. |
| `setMarkupMode` | `(mode: MarkupMode) => void` | Inherited from ReviewApi. |
| `getMarkupVisibility` | `() => MarkupVisibility` | Inherited from ReviewApi. |
| `setMarkupVisibility` | `(visibility: Partial<MarkupVisibility>) => void` | Inherited from ReviewApi. |
| `getRevisions` | `(filter?: RevisionFilter) => RevisionChange[]` | Inherited from ReviewApi. |
| `acceptChanges` | `(filter?: RevisionFilter) => number` | Inherited from ReviewApi. |
| `rejectChanges` | `(filter?: RevisionFilter) => number` | Inherited from ReviewApi. |
| `nextChange` | `() => RevisionChange \| null` | Inherited from ReviewApi. |
| `previousChange` | `() => RevisionChange \| null` | Inherited from ReviewApi. |
| `goToChange` | `(id: string) => boolean` | Inherited from ReviewApi. |
| `editReply` | `(threadId: string, replyId: string, text: string) => boolean` | Inherited from ReviewApi. |
| `deleteReply` | `(threadId: string, replyId: string) => boolean` | Inherited from ReviewApi. |
| `saveSnapshot` | `(label?: string) => SnapshotInfo \| null` | Inherited from ReviewApi. |
| `getSnapshots` | `() => SnapshotInfo[]` | Inherited from ReviewApi. |
| `restoreSnapshot` | `(id: string) => boolean` | Inherited from ReviewApi. |
| `compareWithSnapshot` | `(id: string, options?: CompareOptions) => number` | Inherited from ReviewApi. |
| `deleteSnapshot` | `(id: string) => boolean` | Inherited from ReviewApi. |
| `getSnapshotDocument` | `(id: string) => DocumentData \| null` | Inherited from ReviewApi. |
| `compareWithDocx` | `(input: ArrayBuffer \| Uint8Array \| Blob, options?: CompareOptions) => Promise<number>` | Inherited from ReviewApi. |
| `compareSideBySide` | `(revised: DocumentInput, options?: SideBySideOptions) => boolean` | Inherited from ReviewApi. |
| `closeSideBySide` | `() => boolean` | Inherited from ReviewApi. |
| `isSideBySideOpen` | `() => boolean` | Inherited from ReviewApi. |
| `combineWith` | `(first: DocumentInput, second: DocumentInput, options?: CombineOptions) => number` | Inherited from ReviewApi. |
| `combineWithDocx` | `(first: ArrayBuffer \| Uint8Array \| Blob, second: ArrayBuffer \| Uint8Array \| Blob, options?: CombineOptions) => Promise<number>` | Inherited from ReviewApi. |
| `getCollabVersion` | `() => number` | Inherited from CollabApi. |
| `getCollabStatus` | `() => CollabStatus` | Inherited from CollabApi. |
| `getCollabConnection` | `() => CollabConnectionStatus` | Inherited from CollabApi. |
| `saveCollabVersion` | `(name: string) => Promise<CollabVersionInfo \| null>` | Inherited from CollabApi. |
| `listCollabVersions` | `() => Promise<CollabVersionInfo[]>` | Inherited from CollabApi. |
| `restoreCollabVersion` | `(id: string) => Promise<boolean>` | Inherited from CollabApi. |
| `diffCollabVersions` | `(fromId: string, toId: string \| null, options?: CollabVersionDiffOptions) => Promise<DocNodeJSON \| null>` | Inherited from CollabApi. |
| `lockRange` | `(range?: { from: number; to: number; }) => Promise<CollabLock \| null>` | Inherited from CollabApi. |
| `unlockRange` | `(id: string) => void` | Inherited from CollabApi. |
| `getLocks` | `() => CollabLock[]` | Inherited from CollabApi. |
| `sendableSteps` | `() => CollabStepsPayload \| null` | Inherited from CollabApi. |
| `receiveSteps` | `(payload: CollabRemotePayload) => boolean` | Inherited from CollabApi. |
| `resetCollab` | `(snapshot: CollabSnapshot) => void` | Inherited from CollabApi. |
| `getCollaborators` | `() => Collaborator[]` | Inherited from CollabApi. |
| `getRibbonTab` | `() => string \| null` | Inherited from RibbonApi. |
| `setRibbonTab` | `(tab: RibbonTabName) => boolean` | Inherited from RibbonApi. |
| `isRibbonCollapsed` | `() => boolean` | Inherited from RibbonApi. |
| `setRibbonCollapsed` | `(collapsed: boolean) => void` | Inherited from RibbonApi. |
| `getViewMode` | `() => DocumentViewMode` | Inherited from RibbonApi. |
| `setViewMode` | `(mode: DocumentViewMode) => void` | Inherited from RibbonApi. |
| `fitZoom` | `(mode: "width" \| "page") => number` | Inherited from RibbonApi. |
| `getTabStops` | `() => TabStop[]` | Inherited from RibbonApi. |
| `setTabStops` | `(stops: readonly TabStop[]) => boolean` | Inherited from RibbonApi. |
| `whenLayoutReady` | `() => Promise<void>` | Inherited from LayoutApi. |
| `isLayoutComplete` | `() => boolean` | Inherited from LayoutApi. |
| `getPageInfo` | `(page: number) => PageInfo \| null` | Inherited from LayoutApi. |
| `getPageText` | `(page: number) => string` | Inherited from LayoutApi. |
| `getLayoutStats` | `() => LayoutStats` | Inherited from LayoutApi. |
| `getPrintHtml` | `() => string` | Inherited from LayoutApi. |
| `exportPdf` | `(options?: PdfExportOptions) => Promise<Blob>` | Inherited from LayoutApi. |
| `newDocument` | `() => void` | Replaces the document with an empty one. Does not ask first. Inherited from FileApi. |
| `getTemplates` | `() => TemplateInfo[]` | The templates of **New from template**: yours first, then the built-in ones. Inherited from FileApi. |
| `newFromTemplate` | `(id: string) => Promise<boolean>` | Replaces the document with a copy of a template. Does not ask first. Inherited from FileApi. |
| `openFile` | `(input: Blob \| ArrayBuffer \| Uint8Array, options?: FileOpenOptions) => Promise<FileImportFormat>` | Reads a file in any format the editor imports and shows it. The format is detected from the bytes, then the name. Inherited from FileApi. |
| `exportFile` | `(format: FileExportFormat, options?: FileExportOptions) => Promise<Blob>` | A Word file is encrypted with the password of the document, or with `password`; `null` writes it without one. Inherited from FileApi. |
| `setFilePassword` | `(password: string \| null) => void` | Sets or, with `null`, removes the password that Word files are saved and downloaded with. Inherited from FileApi. |
| `hasFilePassword` | `() => boolean` | Inherited from FileApi. |
| `downloadFile` | `(format: FileExportFormat, fileName?: string) => Promise<void>` | Inherited from FileApi. |
| `saveFile` | `() => Promise<boolean>` | Saves through `file.onSaveRequest`, or downloads a .docx file when there is none. Inherited from FileApi. |
| `getFileName` | `() => string` | Inherited from FileApi. |
| `setFileName` | `(name: string) => void` | Inherited from FileApi. |
| `isModified` | `() => boolean` | True when the document changed since it was opened, created, saved or downloaded. Inherited from FileApi. |
| `openFileMenu` | `() => boolean` | Inherited from FileApi. |
| `closeFileMenu` | `() => void` | Inherited from FileApi. |
| `isFileMenuOpen` | `() => boolean` | Inherited from FileApi. |
| `getSources` | `() => BibliographySource[]` | Inherited from CitationsApi. |
| `setSources` | `(sources: readonly BibliographySource[]) => void` | Inherited from CitationsApi. |
| `addSource` | `(source: Omit<BibliographySource, "tag"> & { tag?: string; }) => string \| null` | Adds a source, or replaces the one with the same tag, and returns its tag. Inherited from CitationsApi. |
| `removeSource` | `(tag: string) => boolean` | Inherited from CitationsApi. |
| `getCitationStyle` | `() => CitationStyle` | Inherited from CitationsApi. |
| `setCitationStyle` | `(style: CitationStyle) => void` | Inherited from CitationsApi. |
| `insertCitation` | `(citation: string \| CitationOptions) => boolean` | Inherited from CitationsApi. |
| `insertBibliography` | `() => boolean` | Inherited from CitationsApi. |
| `updateCitations` | `() => number` | Rewrites every citation and bibliography from the sources and returns how many changed. Inherited from CitationsApi. |
| `checkAccessibility` | `(rules?: readonly AccessibilityRule[]) => AccessibilityIssue[]` | The accessibility issues of the document, in document order. Inherited from AccessibilityApi. |
| `getDrawTool` | `() => DrawTool \| null` | Inherited from DrawApi. |
| `setDrawTool` | `(tool: DrawTool \| null) => void` | Inherited from DrawApi. |
| `insertInk` | `(stroke: Partial<InkStroke> & { points: [number, number][]; }) => boolean` | Adds a stroke to the paragraph of the selection; its points are measured from the top left of that paragraph. Inherited from DrawApi. |
| `getInk` | `() => InkInfo[]` | Inherited from DrawApi. |
| `eraseInk` | `(pos?: number) => number` | Removes the ink stroke at a document position, or every stroke without one. Inherited from DrawApi. |
| `readAloud` | `(options?: ReadAloudOptions) => ReadAloudHandle` | Inherited from ReadAloudApi. |
| `stopReadAloud` | `() => void` | Inherited from ReadAloudApi. |
| `isReadingAloud` | `() => boolean` | Inherited from ReadAloudApi. |
| `getSpellingIssues` | `() => SpellingMatch[]` | Inherited from SpellingApi. |
| `checkSpelling` | `() => Promise<void>` | Inherited from SpellingApi. |
| `ignoreSpelling` | `(word: string) => void` | Inherited from SpellingApi. |
| `replaceSpelling` | `(from: number, text: string) => boolean` | Inherited from SpellingApi. |

### DocumentEditorEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentEditorEvents extends EditingEvents, ObjectsEvents, ReviewEvents, CollabEvents, RibbonEvents, LayoutEvents, FileEvents, CitationsEvents, DrawEvents, ReadAloudEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `ready` | `{ api: DocumentEditorApi }` |  |
| `contentChange` | `{ source: 'user' \| 'api'; wordCount: number }` |  |
| `selectionChange` | `{ from: number; to: number; format: FormatState }` |  |
| `pageCountChange` | `{ pageCount: number }` |  |
| `commentsChange` | `{ comments: CommentThread[] }` |  |
| `trackedChangesChange` | `{ changes: TrackedChange[] }` |  |
| `historyChange` | `{ canUndo: boolean; canRedo: boolean }` |  |
| `readOnlyChange` | `{ readOnly: boolean }` |  |
| `transaction` | `{ steps: unknown[]; origin: 'local' \| 'remote'; docChanged: boolean }` |  |
| `focus` | `{ editor: DocumentEditorApi }` |  |
| `blur` | `{ editor: DocumentEditorApi }` |  |
| `autosaveStart` | `{ reason: "change" \| "manual" \| "destroy"; }` | Inherited from EditingEvents. |
| `autosaveEnd` | `{ savedAt: string; }` | Inherited from EditingEvents. |
| `autosaveError` | `{ error: unknown; }` | Inherited from EditingEvents. |
| `stylesChange` | `{ styles: ParagraphStyleInfo[]; }` | Inherited from EditingEvents. |
| `autocorrectChange` | `{ options: AutocorrectOptions; }` | Inherited from EditingEvents. |
| `formChange` | `{ tag: string; value: unknown; data: Record<string, unknown>; }` | Inherited from ObjectsEvents. |
| `fieldsUpdate` | `{ count: number; }` | Inherited from ObjectsEvents. |
| `embeddedObjectOpen` | `EmbeddedObjectOpenEvent` | Inherited from ObjectsEvents. |
| `revisionsChange` | `{ revisions: RevisionChange[]; }` | Inherited from ReviewEvents. |
| `markupModeChange` | `{ mode: MarkupMode; }` | Inherited from ReviewEvents. |
| `snapshotsChange` | `{ snapshots: SnapshotInfo[]; }` | Inherited from ReviewEvents. |
| `collabStatus` | `CollabStatus` | Inherited from CollabEvents. |
| `collabConnection` | `{ status: CollabConnectionStatus; previous: CollabConnectionStatus; }` | Inherited from CollabEvents. |
| `collabRejected` | `{ reason: CollabRejectReason; steps: number; }` | Inherited from CollabEvents. |
| `collabRestored` | `{ steps: number; version: number; }` | Inherited from CollabEvents. |
| `presenceChange` | `{ collaborators: Collaborator[]; }` | Inherited from CollabEvents. |
| `locksChange` | `{ locks: CollabLock[]; }` | Inherited from CollabEvents. |
| `ribbonTabChange` | `{ tab: string; }` | Inherited from RibbonEvents. |
| `viewModeChange` | `{ mode: DocumentViewMode; }` | Inherited from RibbonEvents. |
| `layoutComplete` | `{ pageCount: number; durationMs: number; }` | Inherited from LayoutEvents. |
| `fontsMissing` | `{ fonts: MissingFont[]; }` | A font the document uses is not installed. Page breaks match Word only when `substitute` is not null. Inherited from LayoutEvents. |
| `fileOpened` | `{ fileName: string; format: FileImportFormat; }` | Inherited from FileEvents. |
| `templateOpened` | `{ id: string; name: string; }` | Inherited from FileEvents. |
| `fileSaved` | `{ fileName: string; format: FileExportFormat \| null; target: "download" \| "host"; }` | Inherited from FileEvents. |
| `fileError` | `{ action: "open" \| "save" \| "new"; error: unknown; fileName: string; }` | Inherited from FileEvents. |
| `fileMenuChange` | `{ open: boolean; }` | Inherited from FileEvents. |
| `sourcesChange` | `{ sources: BibliographySource[]; style: CitationStyle; }` | Inherited from CitationsEvents. |
| `drawToolChange` | `{ tool: DrawTool \| null; }` | Inherited from DrawEvents. |
| `readAloudChange` | `{ reading: boolean; paused: boolean; }` | Inherited from ReadAloudEvents. |

### DocumentEditorOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentEditorOptions extends EditingOptions, ObjectsOptions, ReviewOptions, CollabOptions, RibbonOptions, LayoutOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `licenseKey?` | `string` |  |
| `injectStyles?` | `boolean` |  |
| `content?` | `DocumentInput` |  |
| `page?` | `Partial<PageSetup>` |  |
| `layout?` | `DocumentLayout` |  |
| `zoom?` | `number` |  |
| `readOnly?` | `boolean` |  |
| `author?` | `AuthorInfo \| string` |  |
| `trackChanges?` | `boolean` |  |
| `showMarkup?` | `boolean` |  |
| `toolbar?` | `boolean \| readonly ToolbarItemId[]` |  |
| `statusBar?` | `boolean` |  |
| `ruler?` | `boolean` |  |
| `outline?` | `boolean` |  |
| `commentsPanel?` | `boolean` |  |
| `spellcheck?` | `boolean \| SpellChecker` |  |
| `limits?` | `Partial<ZipLimits>` | Caps applied to every DOCX archive the editor opens. Defaults: 10,000 entries, 512 MiB per entry, 1 GiB in total, 200:1. |
| `linkSchemes?` | `readonly string[]` | Schemes whose links may be followed, besides `http`, `https`, `mailto` and `tel`: for example `['file', 'ftp', 'sms', 'msteams']`. Links with any other scheme stay in the document and in saved files but are shown as blocked addresses. `javascript`, `vbscript` and `data` can never be enabled. Read when the editor is created. |
| `allowRemoteImages?` | `boolean` | Draw pictures whose source is an http(s) or relative URL. Off by default, so opening a document makes no request. |
| `resolveImage?` | `(url: string) => string \| null \| Promise<string \| null>` | Returns a `data:image/…` URL for a remote picture, fetched by your application. Used when `allowRemoteImages` is off. |
| `placeholder?` | `string` |  |
| `fonts?` | `readonly string[]` |  |
| `fontSizes?` | `readonly number[]` |  |
| `mergeFields?` | `readonly MergeFieldDefinition[]` |  |
| `height?` | `number \| string` |  |
| `ariaLabel?` | `string` |  |
| `announcements?` | `boolean \| AnnouncementOptions` |  |
| `localeText?` | `LocaleTextInput` |  |
| `rtl?` | `boolean` |  |
| `uploadImage?` | `(file: File) => Promise<string>` |  |
| `chartProvider?` | `ChartProvider` |  |
| `readAloud?` | `ReadAloudOptions` | Defaults for Read aloud: a callback that speaks each sentence, a language and a rate. |
| `file?` | `boolean \| FileOptions` | The File tab: `false` removes it, an object hides entries or routes New, Open and Save to your application. |
| `autocorrect?` | `boolean \| AutocorrectOptions \| undefined` | Inherited from EditingOptions. |
| `autocorrectStorage?` | `AutocorrectStorage \| undefined` | Inherited from EditingOptions. |
| `autosave?` | `AutosaveOptions \| undefined` | Inherited from EditingOptions. |
| `pasteOptions?` | `boolean \| undefined` | Inherited from EditingOptions. |
| `clickAndType?` | `boolean \| undefined` | Inherited from EditingOptions. |
| `defaultPasteMode?` | `PasteMode \| undefined` | Inherited from EditingOptions. |
| `resolvePastedImage?` | `((src: string, context: PastedImageContext) => string \| null \| Promise<string \| null>) \| undefined` | Inherited from EditingOptions. |
| `showFormattingMarks?` | `boolean \| undefined` | Inherited from EditingOptions. |
| `hyphenation?` | `boolean \| undefined` | Inherited from EditingOptions. |
| `formMode?` | `boolean \| undefined` | Inherited from ObjectsOptions. |
| `showBookmarks?` | `boolean \| undefined` | Inherited from ObjectsOptions. |
| `noteNumberFormat?` | `Partial<Record<NoteKind, NoteNumberFormat>> \| undefined` | Inherited from ObjectsOptions. |
| `mergeRecords?` | `readonly Record<string, unknown>[] \| undefined` | Inherited from ObjectsOptions. |
| `markupMode?` | `MarkupMode \| undefined` | Inherited from ReviewOptions. |
| `changeBars?` | `boolean \| undefined` | Inherited from ReviewOptions. |
| `changeBalloons?` | `boolean \| undefined` | Inherited from ReviewOptions. |
| `commentsLayout?` | `"margin" \| "panel" \| undefined` | Inherited from ReviewOptions. |
| `mentions?` | `MentionOptions \| undefined` | Inherited from ReviewOptions. |
| `snapshots?` | `SnapshotStorage \| undefined` | Inherited from ReviewOptions. |
| `collab?` | `CollabProvider \| null \| undefined` | Inherited from CollabOptions. |
| `collabStorage?` | `CollabOfflineStore \| null \| undefined` | Where edits that have not reached the authority are kept. Without it they live in memory and are lost when the tab closes. `createIndexedDbOfflineStore({ key })` keeps them across a reload. Inherited from CollabOptions. |
| `ribbon?` | `boolean \| RibbonConfig \| undefined` | Inherited from RibbonOptions. |
| `miniToolbar?` | `boolean \| undefined` | Inherited from RibbonOptions. |
| `viewMode?` | `DocumentViewMode \| undefined` | Inherited from RibbonOptions. |
| `theme?` | `"auto" \| "light" \| "dark" \| undefined` | Inherited from RibbonOptions. |
| `darkPage?` | `"dark" \| "white" \| undefined` | Inherited from RibbonOptions. |
| `verticalRuler?` | `boolean \| undefined` | Inherited from RibbonOptions. |
| `commandSearch?` | `boolean \| undefined` | The Search commands box of the tab row and its Alt+Q shortcut. On by default. Inherited from RibbonOptions. |
| `layoutCompatibility?` | `LayoutCompatibility \| undefined` | Inherited from LayoutOptions. |
| `virtualize?` | `boolean \| "auto" \| undefined` | Inherited from LayoutOptions. |
| `pdfFonts?` | `readonly PdfFontSource[] \| undefined` | Inherited from LayoutOptions. |
| `isFontAvailable?` | `((family: string) => boolean) \| undefined` | Replaces the built-in check of whether a font family can be drawn on this device. Inherited from LayoutOptions. |

### DocumentPdfOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentPdfOptions extends PdfWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `language?` | `string` |  |
| `outline?` | `boolean` |  |
| `compress?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |
| `creationDate?` | `Date \| undefined` | Inherited from PdfWriteOptions. |
| `producer?` | `string \| undefined` | Inherited from PdfWriteOptions. |
| `pdfA?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |
| `tagged?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |

### DocumentPdfResult

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentPdfResult
```

| Property | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `warnings` | `string[]` |  |
| `pageCount` | `number` |  |
| `missingFonts` | `string[]` | Font families the document asks for that had no font file and no metric-compatible substitute. |

### DocumentPerson

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentPerson
```

| Property | Type | Description |
| --- | --- | --- |
| `author` | `string` |  |
| `providerId?` | `string` |  |
| `userId?` | `string` |  |

### DocumentProperties

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentProperties
```

| Property | Type | Description |
| --- | --- | --- |
| `title?` | `string` |  |
| `subject?` | `string` |  |
| `author?` | `string` |  |
| `keywords?` | `string` |  |
| `description?` | `string` |  |
| `created?` | `string` |  |
| `modified?` | `string` |  |
| `category?` | `string` |  |
| `lastModifiedBy?` | `string` |  |
| `revision?` | `string` |  |
| `company?` | `string` |  |
| `manager?` | `string` |  |
| `custom?` | `Record<string, string \| number \| boolean>` |  |

### DocumentProtection

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentProtection
```

| Property | Type | Description |
| --- | --- | --- |
| `mode` | `ProtectionMode` |  |
| `enforced` | `boolean` |  |
| `attrs?` | `Record<string, string>` |  |

### DocumentSection

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentSection
```

| Property | Type | Description |
| --- | --- | --- |
| `index` | `number` |  |
| `page` | `PageSetup` |  |
| `headers` | `Required<SectionHeaders>` |  |
| `from` | `number` |  |
| `to` | `number` |  |

### DocumentSettings

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentSettings
```

| Property | Type | Description |
| --- | --- | --- |
| `evenAndOddHeaders?` | `boolean` |  |
| `mirrorMargins?` | `boolean` |  |
| `trackRevisions?` | `boolean` |  |
| `defaultTabStop?` | `number` |  |
| `protection?` | `DocumentProtection \| null` |  |
| `footnotes?` | `NoteSettings` |  |
| `endnotes?` | `NoteSettings` |  |
| `compatibilityMode?` | `number` |  |
| `compat?` | `CompatibilitySettings` |  |
| `kerning?` | `boolean` | False when the document's default text has Word's "Kerning for fonts" switched off, which is the case for most Word documents. Text is then laid out without pair kerning, as Word does, unless a run switches it on. |

### DocumentSnapshot

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentSnapshot
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `label` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `data` | `string` |  |

### DocumentStyle

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentStyle
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `type` | `DocumentStyleType` |  |
| `basedOn?` | `string` |  |
| `next?` | `string` |  |
| `link?` | `string` |  |
| `isDefault?` | `boolean` |  |
| `isHidden?` | `boolean` |  |
| `isQuickStyle?` | `boolean` |  |
| `builtin?` | `ParagraphStyleId` |  |
| `outlineLevel?` | `number` |  |
| `numbering?` | `{ numId: number; level: number }` |  |
| `paragraph?` | `Record<string, unknown>` |  |
| `run?` | `Record<string, unknown>` |  |
| `table?` | `Record<string, unknown>` |  |

### DocumentTemplate

Kind: interface. Import from `@birchui/document`.

```ts
interface DocumentTemplate
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `description?` | `string` |  |
| `icon?` | `string` | The name of an icon of the editor; a page icon when left out. |
| `content` | `DocumentInput \| (() => DocumentInput \| Promise<DocumentInput>)` | The document, or a function that returns it or a promise of it, for templates that are fetched when chosen. |

### DocxImportFeature

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxImportFeature
```

| Property | Type | Description |
| --- | --- | --- |
| `feature` | `string` |  |
| `count` | `number` |  |
| `note?` | `string` |  |

### DocxImportReport

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxImportReport
```

| Property | Type | Description |
| --- | --- | --- |
| `modelled` | `DocxImportFeature[]` |  |
| `preserved` | `DocxImportFeature[]` |  |
| `dropped` | `DocxImportFeature[]` |  |

### DocxPackage

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxPackage
```

| Property | Type | Description |
| --- | --- | --- |
| `parts` | `Record<string, PreservedPart>` |  |
| `contentTypes` | `{ defaults: Record<string, string>; overrides: Record<string, string> }` |  |
| `namespaces` | `Record<string, string>` |  |
| `ignorable` | `string[]` |  |
| `mainPart` | `string` |  |
| `relationships?` | `PreservedRelationship[]` |  |
| `source?` | `DocxSource \| null` |  |

### DocxPageMap

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxPageMap
```

| Property | Type | Description |
| --- | --- | --- |
| `bookmarks?` | `Readonly<Record<string, number>>` |  |
| `headings?` | `readonly number[]` |  |
| `headerFooter?` | `Readonly<Partial<Record<'default' \| 'first' \| 'even', number>>>` |  |

### DocxReadOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxReadOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<ZipLimits>` | Caps on the archive: entry count, inflated size of one entry, total inflated size and compression ratio. |

### DocxReadResult

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxReadResult
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentData` |  |
| `warnings` | `string[]` |  |
| `report` | `DocxImportReport` |  |

### DocxValidationIssue

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxValidationIssue
```

| Property | Type | Description |
| --- | --- | --- |
| `severity` | `'error' \| 'warning'` |  |
| `code` | `string` |  |
| `part` | `string` |  |
| `message` | `string` |  |

### DocxValidationResult

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxValidationResult
```

| Property | Type | Description |
| --- | --- | --- |
| `ok` | `boolean` |  |
| `issues` | `DocxValidationIssue[]` |  |

### DocxWriteOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface DocxWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `trackRevisions?` | `boolean` |  |
| `zoom?` | `number` |  |
| `pageCount?` | `number` |  |
| `pages?` | `DocxPageMap` |  |
| `compress?` | `boolean` |  |
| `now?` | `Date` |  |
| `preserveSource?` | `boolean \| 'exact'` |  |

### DrawApi

Kind: interface. Import from `@birchui/document`.

```ts
interface DrawApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getDrawTool` | `() => DrawTool \| null` |  |
| `setDrawTool` | `(tool: DrawTool \| null) => void` |  |
| `insertInk` | `(stroke: Partial<InkStroke> & { points: [number, number][] }) => boolean` | Adds a stroke to the paragraph of the selection; its points are measured from the top left of that paragraph. |
| `getInk` | `() => InkInfo[]` |  |
| `eraseInk` | `(pos?: number) => number` | Removes the ink stroke at a document position, or every stroke without one. |

### DrawEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface DrawEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `drawToolChange` | `{ tool: DrawTool \| null }` |  |

### EditingApi

Kind: interface. Import from `@birchui/document`.

```ts
interface EditingApi
```

| Property | Type | Description |
| --- | --- | --- |
| `openPane` | `(id: string) => boolean` |  |
| `closePane` | `(id: string) => boolean` |  |
| `isPaneOpen` | `(id: string) => boolean` |  |
| `getStyles` | `() => ParagraphStyleInfo[]` |  |
| `applyStyle` | `(id: string) => boolean` |  |
| `createStyle` | `(name: string, format?: StyleFormat, basedOn?: string) => string \| null` |  |
| `createStyleFromSelection` | `(name: string) => string \| null` |  |
| `modifyStyle` | `(id: string, format: StyleFormat, name?: string) => boolean` |  |
| `updateStyleToMatchSelection` | `(id: string) => boolean` |  |
| `deleteStyle` | `(id: string) => boolean` |  |
| `getFontFormat` | `() => Required<FontFormat>` |  |
| `setFontFormat` | `(format: FontFormat) => boolean` |  |
| `getDocumentProperties` | `() => DocumentProperties` |  |
| `setDocumentProperties` | `(properties: { [K in keyof DocumentProperties]?: DocumentProperties[K] \| null }) => boolean` |  |
| `getAutocorrectOptions` | `() => Required<AutocorrectOptions> \| null` |  |
| `setAutocorrectOptions` | `(options: AutocorrectOptions) => boolean` |  |
| `setHyperlink` | `(options: HyperlinkOptions \| null) => boolean` |  |
| `setParagraphFormat` | `(format: ParagraphFormat) => boolean` |  |
| `setParagraphBorders` | `(borders: ParagraphBorders \| null, shading?: string \| null) => boolean` |  |
| `changeCase` | `(mode: CaseMode) => boolean` |  |
| `setDropCap` | `(mode: 'none' \| 'drop' \| 'margin', lines?: number) => boolean` |  |
| `collapseHeading` | `(index: number, collapsed: boolean) => boolean` |  |
| `isHeadingCollapsed` | `(index: number) => boolean` |  |
| `moveSection` | `(index: number, targetIndex: number) => boolean` |  |
| `getDetailedWordCount` | `() => DetailedWordCount` |  |
| `getFindResults` | `(query: string, options?: FindOptions) => FindPaneResult[]` |  |
| `getListDefinitions` | `() => MultilevelListDefinition[]` |  |
| `getListLevels` | `() => ListLevelFormat[] \| null` | The levels of the Word list that holds the cursor, or `null` when the cursor is not in a list from a Word file. |
| `setListLevels` | `(levels: readonly ListLevelFormat[]) => boolean` | Changes the levels of the Word list that holds the cursor; every list that uses the same definition follows. |
| `defineMultilevelList` | `(definition: Omit<MultilevelListDefinition, 'id'> & { id?: string }) => string` |  |
| `pasteHtml` | `(html: string, mode?: PasteMode) => boolean` |  |
| `saveNow` | `() => Promise<void>` |  |
| `isSaving` | `() => boolean` |  |
| `getWatermark` | `() => Watermark \| null` |  |
| `setWatermark` | `(watermark: Watermark \| string \| null) => boolean` |  |
| `getLineNumbers` | `() => LineNumbering \| null` |  |
| `setLineNumbers` | `(numbering: LineNumbering \| boolean \| null) => boolean` |  |
| `getColumns` | `() => ColumnSettings` |  |
| `setColumns` | `(columns: ColumnSettings \| number) => boolean` |  |
| `insertBreak` | `(kind: BreakKind) => boolean` |  |

### EditingEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface EditingEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `autosaveStart` | `{ reason: 'change' \| 'manual' \| 'destroy' }` |  |
| `autosaveEnd` | `{ savedAt: string }` |  |
| `autosaveError` | `{ error: unknown }` |  |
| `stylesChange` | `{ styles: ParagraphStyleInfo[] }` |  |
| `autocorrectChange` | `{ options: AutocorrectOptions }` |  |

### EditingOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface EditingOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `autocorrect?` | `boolean \| AutocorrectOptions` |  |
| `autocorrectStorage?` | `AutocorrectStorage` |  |
| `autosave?` | `AutosaveOptions` |  |
| `pasteOptions?` | `boolean` |  |
| `clickAndType?` | `boolean` |  |
| `defaultPasteMode?` | `PasteMode` |  |
| `resolvePastedImage?` | `(src: string, context: PastedImageContext) => string \| null \| Promise<string \| null>` |  |
| `showFormattingMarks?` | `boolean` |  |
| `hyphenation?` | `boolean` |  |

### EmbeddedObjectFile

Kind: interface. Import from `@birchui/document`.

```ts
interface EmbeddedObjectFile
```

| Property | Type | Description |
| --- | --- | --- |
| `fileName` | `string` |  |
| `mimeType` | `string` |  |
| `progId` | `string` |  |
| `data` | `Uint8Array` |  |

### EmbeddedObjectInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface EmbeddedObjectInfo extends EmbeddedObjectOpenEvent
```

| Property | Type | Description |
| --- | --- | --- |
| `pos` | `number` |  |
| `asIcon` | `boolean` |  |
| `kind` | `FileKind` |  |
| `fileName` | `string` | Inherited from EmbeddedObjectOpenEvent. |
| `mimeType` | `string` | Inherited from EmbeddedObjectOpenEvent. |
| `progId` | `string` | Inherited from EmbeddedObjectOpenEvent. |
| `data` | `Uint8Array<ArrayBufferLike>` | Inherited from EmbeddedObjectOpenEvent. |

### EmbeddedObjectInput

Kind: interface. Import from `@birchui/document`.

```ts
interface EmbeddedObjectInput
```

| Property | Type | Description |
| --- | --- | --- |
| `data` | `Uint8Array \| ArrayBuffer` |  |
| `fileName` | `string` |  |
| `mimeType?` | `string` |  |
| `asIcon?` | `boolean` |  |
| `icon?` | `string` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |

### EmbeddedObjectOpenEvent

Kind: interface. Import from `@birchui/document`.

```ts
interface EmbeddedObjectOpenEvent
```

| Property | Type | Description |
| --- | --- | --- |
| `fileName` | `string` |  |
| `mimeType` | `string` |  |
| `progId` | `string` |  |
| `data` | `Uint8Array` |  |

### FieldContext

Kind: interface. Import from `@birchui/document`.

```ts
interface FieldContext
```

| Property | Type | Description |
| --- | --- | --- |
| `now?` | `Date` |  |
| `values?` | `Record<string, unknown>` |  |
| `pages?` | `Record<string, number>` |  |
| `pageCount?` | `number` |  |

### FileApi

Kind: interface. Import from `@birchui/document`.

```ts
interface FileApi
```

| Property | Type | Description |
| --- | --- | --- |
| `newDocument` | `() => void` | Replaces the document with an empty one. Does not ask first. |
| `getTemplates` | `() => TemplateInfo[]` | The templates of **New from template**: yours first, then the built-in ones. |
| `newFromTemplate` | `(id: string) => Promise<boolean>` | Replaces the document with a copy of a template. Does not ask first. |
| `openFile` | `(input: Blob \| ArrayBuffer \| Uint8Array, options?: FileOpenOptions) => Promise<FileImportFormat>` | Reads a file in any format the editor imports and shows it. The format is detected from the bytes, then the name. |
| `exportFile` | `(format: FileExportFormat, options?: FileExportOptions) => Promise<Blob>` | A Word file is encrypted with the password of the document, or with `password`; `null` writes it without one. |
| `setFilePassword` | `(password: string \| null) => void` | Sets or, with `null`, removes the password that Word files are saved and downloaded with. |
| `hasFilePassword` | `() => boolean` |  |
| `downloadFile` | `(format: FileExportFormat, fileName?: string) => Promise<void>` |  |
| `saveFile` | `() => Promise<boolean>` | Saves through `file.onSaveRequest`, or downloads a .docx file when there is none. |
| `getFileName` | `() => string` |  |
| `setFileName` | `(name: string) => void` |  |
| `isModified` | `() => boolean` | True when the document changed since it was opened, created, saved or downloaded. |
| `openFileMenu` | `() => boolean` |  |
| `closeFileMenu` | `() => void` |  |
| `isFileMenuOpen` | `() => boolean` |  |

### FileEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface FileEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `fileOpened` | `{ fileName: string; format: FileImportFormat }` |  |
| `templateOpened` | `{ id: string; name: string }` |  |
| `fileSaved` | `{ fileName: string; format: FileExportFormat \| null; target: 'download' \| 'host' }` |  |
| `fileError` | `{ action: 'open' \| 'save' \| 'new'; error: unknown; fileName: string }` |  |
| `fileMenuChange` | `{ open: boolean }` |  |

### FileExportOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface FileExportOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `password?` | `string \| null` |  |

### FileIconSvgOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface FileIconSvgOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `width?` | `number` |  |
| `height?` | `number` |  |
| `title?` | `string` |  |

### FileOpenOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface FileOpenOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fileName?` | `string` |  |
| `password?` | `string` | The password of a password-protected Word file. |
| `format?` | `FileImportFormat` | Skips detection and reads the file as this format. |

### FileOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface FileOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `hidden?` | `readonly FileItemId[]` | Entries of the File tab to leave out. A hidden entry also loses its keyboard shortcut. |
| `templates?` | `readonly DocumentTemplate[]` | Templates of your own for **New from template**, listed before the built-in ones. |
| `builtinTemplates?` | `boolean` | `false` leaves out the four built-in templates (letter, report, meeting notes, résumé). |
| `fileName?` | `string` | The name used for downloads, without an extension. Defaults to the title of the document. |
| `onNewRequest?` | `(request: FileRequest) => FileRequestResult` | Runs instead of emptying the editor when the user asks for a new document. Return `false` to let the editor do it. |
| `onOpenRequest?` | `(request: FileRequest) => FileRequestResult` | Runs instead of the browser's file chooser when the user asks to open a file. Return `false` to show the chooser. |
| `onSaveRequest?` | `(request: FileRequest) => FileRequestResult` | Runs on Save and Ctrl+S instead of downloading a .docx file. Return `false` to download. |

### FileRequest

Kind: interface. Import from `@birchui/document`.

```ts
interface FileRequest
```

| Property | Type | Description |
| --- | --- | --- |
| `editor` | `DocumentEditorApi` |  |
| `fileName` | `string` | The name of the document without an extension. |

### FileTypeInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface FileTypeInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `FileKind` |  |
| `label` | `FileTypeLabel` |  |
| `extension` | `string` | Lower-case extension without the dot; empty when nothing is known. |
| `badge` | `string` | Up to four upper-case characters for the icon. |
| `mimeType` | `string` |  |
| `source` | `FileTypeSource` |  |

### FileTypeInput

Kind: interface. Import from `@birchui/document`.

```ts
interface FileTypeInput
```

| Property | Type | Description |
| --- | --- | --- |
| `progId?` | `string \| null` |  |
| `fileName?` | `string \| null` |  |
| `mimeType?` | `string \| null` |  |
| `partName?` | `string \| null` |  |
| `data?` | `Uint8Array \| null` |  |

### FindOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface FindOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `matchCase?` | `boolean` |  |
| `wholeWord?` | `boolean` |  |
| `regex?` | `boolean` |  |
| `wildcards?` | `boolean` |  |
| `format?` | `FindFormat` |  |

### FindPaneResult

Kind: interface. Import from `@birchui/document`.

```ts
interface FindPaneResult
```

| Property | Type | Description |
| --- | --- | --- |
| `index` | `number` |  |
| `from` | `number` |  |
| `to` | `number` |  |
| `before` | `string` |  |
| `match` | `string` |  |
| `after` | `string` |  |

### FindResult

Kind: interface. Import from `@birchui/document`.

```ts
interface FindResult
```

| Property | Type | Description |
| --- | --- | --- |
| `count` | `number` |  |
| `current` | `number` |  |

### FontFormat

Kind: interface. Import from `@birchui/document`.

```ts
interface FontFormat
```

| Property | Type | Description |
| --- | --- | --- |
| `fontFamily?` | `string \| null` |  |
| `fontSize?` | `number \| null` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `color?` | `string \| null` |  |
| `underline?` | `UnderlineStyle \| 'none' \| null` |  |
| `underlineColor?` | `string \| null` |  |
| `strike?` | `boolean` |  |
| `doubleStrike?` | `boolean` |  |
| `superscript?` | `boolean` |  |
| `subscript?` | `boolean` |  |
| `smallCaps?` | `boolean` |  |
| `allCaps?` | `boolean` |  |
| `hidden?` | `boolean` |  |
| `spacing?` | `number \| null` |  |
| `scale?` | `number \| null` |  |
| `position?` | `number \| null` |  |
| `kerning?` | `number \| null` |  |

### FootnoteInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface FootnoteInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `kind` | `NoteKind` |  |
| `number` | `number` |  |
| `label` | `string` |  |
| `pos` | `number` |  |
| `content` | `DocNodeJSON[]` |  |

### FormatState

Kind: interface. Import from `@birchui/document`.

```ts
interface FormatState
```

| Property | Type | Description |
| --- | --- | --- |
| `bold` | `boolean` |  |
| `italic` | `boolean` |  |
| `underline` | `boolean` |  |
| `strike` | `boolean` |  |
| `superscript` | `boolean` |  |
| `subscript` | `boolean` |  |
| `fontFamily` | `string \| null` |  |
| `fontSize` | `number \| null` |  |
| `textColor` | `string \| null` |  |
| `highlight` | `string \| null` |  |
| `link` | `string \| null` |  |
| `paragraphStyle` | `string` |  |
| `align` | `TextAlignment` |  |
| `lineSpacing` | `number \| null` |  |
| `bulletList` | `boolean` |  |
| `orderedList` | `boolean` |  |
| `inTable` | `boolean` |  |
| `imageSelected` | `boolean` |  |
| `direction` | `'ltr' \| 'rtl'` |  |

### FormFieldError

Kind: interface. Import from `@birchui/document`.

```ts
interface FormFieldError
```

| Property | Type | Description |
| --- | --- | --- |
| `tag` | `string` |  |
| `title` | `string` |  |
| `message` | `string` |  |

### HeaderFooterContent

Kind: interface. Import from `@birchui/document`.

```ts
interface HeaderFooterContent
```

| Property | Type | Description |
| --- | --- | --- |
| `header` | `DocNodeJSON \| null` |  |
| `footer` | `DocNodeJSON \| null` |  |
| `firstHeader` | `DocNodeJSON \| null` |  |
| `firstFooter` | `DocNodeJSON \| null` |  |

### HtmlDocumentOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface HtmlDocumentOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fullDocument?` | `boolean` |  |
| `title?` | `string` |  |
| `includeDeleted?` | `boolean` |  |
| `linkSchemes?` | `readonly string[]` | Schemes written as links that can be followed, besides `http`, `https`, `mailto` and `tel`. |

### HtmlExportOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface HtmlExportOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fullDocument?` | `boolean` |  |
| `title?` | `string` |  |

### HyperlinkOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface HyperlinkOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `href` | `string` |  |
| `text?` | `string` |  |
| `title?` | `string \| null` |  |
| `headingPos?` | `number` |  |

### ImageAnchor

Kind: interface. Import from `@birchui/document`.

```ts
interface ImageAnchor
```

| Property | Type | Description |
| --- | --- | --- |
| `x` | `number` |  |
| `y` | `number` |  |
| `horizontalRelative` | `string` |  |
| `verticalRelative` | `string` |  |
| `horizontalAlign?` | `string \| null` |  |
| `verticalAlign?` | `string \| null` |  |
| `wrapSide?` | `string \| null` |  |
| `wrapPolygon?` | `[number, number][] \| null` |  |
| `distance?` | `{ top: number; right: number; bottom: number; left: number }` |  |
| `allowOverlap?` | `boolean` |  |
| `layoutInCell?` | `boolean` |  |
| `locked?` | `boolean` |  |
| `zIndex?` | `number` |  |

### ImageBorder

Kind: interface. Import from `@birchui/document`.

```ts
interface ImageBorder
```

| Property | Type | Description |
| --- | --- | --- |
| `width` | `number` |  |
| `color` | `string` |  |
| `style?` | `'solid' \| 'dashed' \| 'dotted'` |  |
| `shadow?` | `boolean` |  |

### ImageCrop

Kind: interface. Import from `@birchui/document`.

```ts
interface ImageCrop
```

| Property | Type | Description |
| --- | --- | --- |
| `top` | `number` |  |
| `right` | `number` |  |
| `bottom` | `number` |  |
| `left` | `number` |  |

### ImageEffects

Kind: interface. Import from `@birchui/document`.

```ts
interface ImageEffects
```

| Property | Type | Description |
| --- | --- | --- |
| `brightness?` | `number` | From -100 to 100; 0 leaves the picture as it is. |
| `contrast?` | `number` |  |
| `recolor?` | `ImageRecolor` |  |
| `shape?` | `ImageShapePreset` |  |

### InkInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface InkInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `pos` | `number` |  |
| `stroke` | `InkStroke` |  |
| `width` | `number` |  |
| `height` | `number` |  |

### InkStroke

Kind: interface. Import from `@birchui/document`.

```ts
interface InkStroke
```

| Property | Type | Description |
| --- | --- | --- |
| `tool` | `InkTool` |  |
| `color` | `string` |  |
| `width` | `number` | Line width in pixels at 100% zoom. |
| `points` | `[number, number][]` | Points in pixels, relative to the top left corner of the drawing. |

### InsertEmbeddedObjectOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface InsertEmbeddedObjectOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `data` | `Uint8Array \| ArrayBuffer` |  |
| `fileName` | `string` |  |
| `mimeType?` | `string` |  |
| `asIcon?` | `boolean` |  |
| `icon?` | `string` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |

### InsertImageOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface InsertImageOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `alt?` | `string` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |

### InsertShapeValue

Kind: interface. Import from `@birchui/document`.

```ts
interface InsertShapeValue
```

| Property | Type | Description |
| --- | --- | --- |
| `shape` | `ShapeKind` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |
| `fill?` | `string \| null` |  |
| `stroke?` | `string \| null` |  |
| `strokeWidth?` | `number` |  |
| `text?` | `string` |  |

### LayoutApi

Kind: interface. Import from `@birchui/document`.

```ts
interface LayoutApi
```

| Property | Type | Description |
| --- | --- | --- |
| `whenLayoutReady` | `() => Promise<void>` |  |
| `isLayoutComplete` | `() => boolean` |  |
| `getPageInfo` | `(page: number) => PageInfo \| null` |  |
| `getPageText` | `(page: number) => string` |  |
| `getLayoutStats` | `() => LayoutStats` |  |
| `getPrintHtml` | `() => string` |  |
| `exportPdf` | `(options?: PdfExportOptions) => Promise<Blob>` |  |

### LayoutBlock

Kind: interface. Import from `@birchui/document`.

```ts
interface LayoutBlock
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `LayoutBlockKind` |  |
| `height` | `number` |  |
| `paddingTop?` | `number` |  |
| `paddingBottom?` | `number` |  |
| `parts?` | `readonly number[]` |  |
| `repeatHeader?` | `number` |  |
| `headerRows?` | `number` | How many leading rows `repeatHeader` covers. One when absent. |
| `keepWithNext?` | `boolean` |  |
| `pageBreakBefore?` | `boolean` |  |
| `keepLines?` | `boolean` |  |
| `widowControl?` | `boolean` |  |
| `extent?` | `number` |  |
| `topSpace?` | `number` |  |
| `trimTop?` | `number` |  |
| `lineSlack?` | `number` |  |
| `tail?` | `number` |  |
| `needs?` | `number` |  |
| `rowSlack?` | `readonly number[]` |  |
| `keepRows?` | `readonly boolean[]` |  |
| `rows?` | `readonly (LayoutRow \| undefined)[]` |  |
| `notes?` | `readonly LayoutNote[]` |  |
| `section?` | `number` |  |

### LayoutBreak

Kind: interface. Import from `@birchui/document`.

```ts
interface LayoutBreak
```

| Property | Type | Description |
| --- | --- | --- |
| `block` | `number` |  |
| `part` | `number` |  |
| `page` | `number` |  |
| `flowY` | `number` |  |
| `extra` | `number` |  |
| `kind` | `LayoutBreakKind` |  |
| `fromPage` | `number` |  |
| `fromOffset` | `number` |  |
| `target` | `number` |  |
| `column` | `number` |  |
| `cells?` | `readonly number[]` |  |
| `slack?` | `readonly number[]` |  |
| `trim?` | `number` |  |

### LayoutEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface LayoutEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `layoutComplete` | `{ pageCount: number; durationMs: number }` |  |
| `fontsMissing` | `{ fonts: MissingFont[] }` | A font the document uses is not installed. Page breaks match Word only when `substitute` is not null. |

### LayoutOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface LayoutOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `layoutCompatibility?` | `LayoutCompatibility` |  |
| `virtualize?` | `boolean \| 'auto'` |  |
| `pdfFonts?` | `readonly PdfFontSource[]` |  |
| `isFontAvailable?` | `(family: string) => boolean` | Replaces the built-in check of whether a font family can be drawn on this device. |

### LayoutStats

Kind: interface. Import from `@birchui/document`.

```ts
interface LayoutStats
```

| Property | Type | Description |
| --- | --- | --- |
| `pages` | `number` |  |
| `blocks` | `number` |  |
| `measured` | `number` |  |
| `cacheHits` | `number` |  |
| `lastLayoutMs` | `number` |  |
| `passes` | `number` |  |
| `complete` | `boolean` |  |
| `virtualized` | `boolean` |  |
| `reuse?` | `{ resumedPage: number; convergedPage: number }` |  |

### LineNumbering

Kind: interface. Import from `@birchui/document`.

```ts
interface LineNumbering
```

| Property | Type | Description |
| --- | --- | --- |
| `countBy?` | `number` |  |
| `start?` | `number` |  |
| `restart?` | `'continuous' \| 'newPage'` |  |
| `distance?` | `number` |  |

### ListLevelFormat

Kind: interface. Import from `@birchui/document`.

```ts
interface ListLevelFormat
```

| Property | Type | Description |
| --- | --- | --- |
| `numberStyle` | `'decimal' \| 'lowerAlpha' \| 'upperAlpha' \| 'lowerRoman' \| 'upperRoman' \| 'bullet'` |  |
| `format` | `string` |  |
| `bullet?` | `string` |  |
| `indent` | `number` |  |
| `start?` | `number` |  |
| `restartAfter?` | `number` |  |
| `legal?` | `boolean` |  |
| `linkedStyle?` | `string` |  |
| `align?` | `'left' \| 'center' \| 'right'` |  |
| `alignedAt?` | `number` |  |
| `textIndent?` | `number` |  |
| `follow?` | `'tab' \| 'space' \| 'nothing'` |  |

### LoopbackConnection

Kind: interface. Import from `@birchui/document`.

```ts
interface LoopbackConnection extends CollabProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `version` | `() => number` |  |
| `metaVersion` | `() => number` |  |
| `requestSteps` | `(sinceVersion: number, sinceMeta?: number) => void` |  |
| `presence` | `CollabPresenceChannel` |  |
| `comments` | `CollabCommentChannel` |  |
| `versions` | `CollabVersionChannel` |  |
| `locks` | `CollabLockChannel` |  |
| `snapshots` | `CollabSnapshotChannel` |  |
| `setOnline` | `(online: boolean) => void` |  |
| `setConnection` | `(status: CollabConnectionStatus) => void` |  |
| `isOnline` | `() => boolean` |  |
| `reset` | `(snapshot: CollabSnapshot) => void` |  |
| `disconnect` | `() => void` |  |
| `sendSteps` | `(payload: CollabStepsPayload) => CollabSendResult \| Promise<CollabSendResult>` | Inherited from CollabProvider. |
| `onRemoteSteps` | `(handler: (payload: CollabRemotePayload) => void) => () => void` | Inherited from CollabProvider. |
| `onStatus?` | `((handler: (status: "online" \| "offline") => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onConnection?` | `((handler: (status: CollabConnectionStatus) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onReset?` | `((handler: (snapshot: CollabSnapshot) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `presenceTimeout?` | `number \| undefined` | Inherited from CollabProvider. |

### LoopbackHub

Kind: interface. Import from `@birchui/document`.

```ts
interface LoopbackHub
```

| Property | Type | Description |
| --- | --- | --- |
| `connect` | `(clientId: CollabClientId) => LoopbackConnection` |  |
| `version` | `() => number` |  |
| `getDocumentSteps` | `() => { step: unknown; clientId: CollabClientId }[]` |  |
| `authority` | `() => CollabAuthority` |  |
| `pending` | `() => number` |  |
| `step` | `() => boolean` |  |
| `flush` | `(limit?: number) => number` |  |
| `destroy` | `() => void` |  |

### LoopbackHubOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface LoopbackHubOptions extends CollabAuthorityOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `latency?` | `number` |  |
| `jitter?` | `number` |  |
| `dropRate?` | `number` |  |
| `manual?` | `boolean` |  |
| `random?` | `() => number` |  |
| `document?` | `DocumentInput \| null \| undefined` | The document at version 0. Without it, and without `snapshot`, the authority starts from an empty document. Inherited from CollabAuthorityOptions. |
| `limits?` | `Partial<CollabDocumentLimits> \| undefined` | Inherited from CollabAuthorityOptions. |
| `trustClients?` | `boolean \| undefined` | Relay steps without applying them. Only for a process where every client is your own code, such as a unit test of a transport: a client can then store any document and move any lock. Inherited from CollabAuthorityOptions. |
| `snapshot?` | `CollabSnapshot \| null \| undefined` | Inherited from CollabAuthorityOptions. |
| `snapshotEvery?` | `number \| undefined` | Inherited from CollabAuthorityOptions. |
| `retainSteps?` | `number \| undefined` | Inherited from CollabAuthorityOptions. |
| `versions?` | `readonly CollabStoredVersion[] \| null \| undefined` | Named versions saved earlier, as `storedVersions()` returned them. Inherited from CollabAuthorityOptions. |
| `now?` | `(() => number) \| undefined` | Inherited from CollabAuthorityOptions. |
| `createId?` | `(() => string) \| undefined` | Inherited from CollabAuthorityOptions. |

### MarkdownOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface MarkdownOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `includeDeleted?` | `boolean` |  |

### MarkupVisibility

Kind: interface. Import from `@birchui/document`.

```ts
interface MarkupVisibility
```

| Property | Type | Description |
| --- | --- | --- |
| `insertionsAndDeletions` | `boolean` |  |
| `formatting` | `boolean` |  |
| `comments` | `boolean` |  |
| `hiddenAuthors` | `string[]` |  |

### MentionEvent

Kind: interface. Import from `@birchui/document`.

```ts
interface MentionEvent
```

| Property | Type | Description |
| --- | --- | --- |
| `person` | `Person` |  |
| `threadId` | `string` |  |
| `text` | `string` |  |

### MentionOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface MentionOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `search` | `(query: string) => Promise<Person[]> \| Person[]` |  |
| `onMention?` | `(event: MentionEvent) => void` |  |

### MergeFieldDefinition

Kind: interface. Import from `@birchui/document`.

```ts
interface MergeFieldDefinition
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `label?` | `string` |  |

### MergeOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface MergeOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `missing?` | `'empty' \| 'keep' \| 'placeholder'` |  |
| `locale?` | `string` |  |
| `currency?` | `string` |  |

### MetafileOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface MetafileOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `embeddedEmf?` | `boolean` |  |

### MissingFont

Kind: interface. Import from `@birchui/document`.

```ts
interface MissingFont
```

| Property | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |
| `substitute` | `string \| null` | The metric-compatible font that is installed and drawn instead, or null when there is none. |

### MultilevelListDefinition

Kind: interface. Import from `@birchui/document`.

```ts
interface MultilevelListDefinition
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `levels` | `ListLevelFormat[]` |  |

### NoteSettings

Kind: interface. Import from `@birchui/document`.

```ts
interface NoteSettings
```

| Property | Type | Description |
| --- | --- | --- |
| `position?` | `string` |  |
| `format?` | `PageNumberFormat` |  |
| `start?` | `number` |  |
| `restart?` | `string` |  |

### NumberingChange

Kind: interface. Import from `@birchui/document`.

```ts
interface NumberingChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `original` | `string` |  |

### NumberingDefinitions

Kind: interface. Import from `@birchui/document`.

```ts
interface NumberingDefinitions
```

| Property | Type | Description |
| --- | --- | --- |
| `abstracts` | `AbstractNumbering[]` |  |
| `instances` | `NumberingInstance[]` |  |

### NumberingInstance

Kind: interface. Import from `@birchui/document`.

```ts
interface NumberingInstance
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `number` |  |
| `abstractId` | `number` |  |
| `overrides?` | `NumberingOverride[]` |  |

### NumberingLabel

Kind: interface. Import from `@birchui/document`.

```ts
interface NumberingLabel
```

| Property | Type | Description |
| --- | --- | --- |
| `path` | `number[]` |  |
| `label` | `string` |  |
| `level` | `number` |  |
| `numId` | `number \| null` |  |
| `format` | `string` |  |
| `suffix` | `'tab' \| 'space' \| 'nothing'` |  |
| `text` | `string` |  |

### NumberingLevel

Kind: interface. Import from `@birchui/document`.

```ts
interface NumberingLevel
```

| Property | Type | Description |
| --- | --- | --- |
| `level` | `number` |  |
| `start` | `number` |  |
| `format` | `string` |  |
| `text` | `string` |  |
| `suffix?` | `'tab' \| 'space' \| 'nothing'` |  |
| `restart?` | `number` |  |
| `paragraphStyle?` | `string` |  |
| `isLegal?` | `boolean` |  |
| `align?` | `string` |  |
| `indentLeft?` | `number` |  |
| `hanging?` | `number` |  |
| `font?` | `string` |  |
| `run?` | `NumberingRun` |  |

### NumberingOverride

Kind: interface. Import from `@birchui/document`.

```ts
interface NumberingOverride
```

| Property | Type | Description |
| --- | --- | --- |
| `level` | `number` |  |
| `start?` | `number` |  |
| `definition?` | `NumberingLevel` |  |

### ObjectsApi

Kind: interface. Import from `@birchui/document`.

```ts
interface ObjectsApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getFootnotes` | `(kind?: NoteKind) => FootnoteInfo[]` |  |
| `getBookmarks` | `(includeHidden?: boolean) => BookmarkInfo[]` |  |
| `goToBookmark` | `(name: string) => boolean` |  |
| `updateFields` | `() => number` |  |
| `setFormMode` | `(enabled: boolean) => void` |  |
| `isFormMode` | `() => boolean` |  |
| `getFormData` | `() => Record<string, unknown>` |  |
| `setFormData` | `(data: Record<string, unknown>) => number` |  |
| `validateForm` | `() => FormFieldError[]` |  |
| `openObjectDialog` | `(name: ObjectDialogName) => boolean` |  |
| `evaluateTableFormula` | `(formula: string) => string \| null` |  |
| `getProtection` | `() => DocumentProtection \| null` |  |
| `protectDocument` | `(mode: ProtectionMode, password?: string) => Promise<boolean>` |  |
| `unprotectDocument` | `(password?: string) => Promise<boolean>` |  |
| `isPasswordProtected` | `() => boolean` |  |
| `insertEmbeddedObject` | `(options: InsertEmbeddedObjectOptions) => boolean` |  |
| `getEmbeddedObjects` | `() => EmbeddedObjectInfo[]` |  |
| `openEmbeddedObject` | `(pos?: number) => boolean` |  |
| `downloadEmbeddedObject` | `(pos?: number) => boolean` |  |

### ObjectsEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface ObjectsEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `formChange` | `{ tag: string; value: unknown; data: Record<string, unknown> }` |  |
| `fieldsUpdate` | `{ count: number }` |  |
| `embeddedObjectOpen` | `EmbeddedObjectOpenEvent` |  |

### ObjectsOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface ObjectsOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `formMode?` | `boolean` |  |
| `showBookmarks?` | `boolean` |  |
| `noteNumberFormat?` | `Partial<Record<NoteKind, NoteNumberFormat>>` |  |
| `mergeRecords?` | `readonly Record<string, unknown>[]` |  |

### OutlineEntry

Kind: interface. Import from `@birchui/document`.

```ts
interface OutlineEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `level` | `number` |  |
| `text` | `string` |  |
| `pos` | `number` |  |
| `index` | `number` |  |

### PageInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface PageInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `index` | `number` |  |
| `number` | `number` |  |
| `label` | `string` |  |
| `section` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `top` | `number` |  |
| `orientation` | `'portrait' \| 'landscape'` |  |
| `columns` | `number` |  |
| `blank` | `boolean` |  |
| `footnotes` | `number` |  |

### PageMargins

Kind: interface. Import from `@birchui/document`.

```ts
interface PageMargins
```

| Property | Type | Description |
| --- | --- | --- |
| `top` | `number` |  |
| `right` | `number` |  |
| `bottom` | `number` |  |
| `left` | `number` |  |

### PageNumbering

Kind: interface. Import from `@birchui/document`.

```ts
interface PageNumbering
```

| Property | Type | Description |
| --- | --- | --- |
| `format?` | `PageNumberFormat` |  |
| `start?` | `number \| null` |  |

### PageSetup

Kind: interface. Import from `@birchui/document`.

```ts
interface PageSetup
```

| Property | Type | Description |
| --- | --- | --- |
| `size` | `PageSizeName \| { width: number; height: number }` |  |
| `orientation` | `PageOrientation` |  |
| `margins` | `PageMargins` |  |
| `headerDistance` | `number` |  |
| `footerDistance` | `number` |  |
| `differentFirstPage` | `boolean` |  |
| `gutter?` | `number` |  |
| `columns?` | `SectionColumns \| null` |  |
| `sectionType?` | `SectionBreakType \| null` |  |
| `pageNumbers?` | `PageNumbering \| null` |  |
| `verticalAlign?` | `'top' \| 'center' \| 'bottom' \| 'justify' \| null` |  |
| `rtl?` | `boolean` |  |
| `lineNumbers?` | `LineNumbering \| null` |  |
| `pageBorders?` | `PageBorders \| null` |  |
| `docx?` | `PreservedXml \| null` |  |
| `change?` | `SectionFormatChange \| null` |  |

### PageSlice

Kind: interface. Import from `@birchui/document`.

```ts
interface PageSlice
```

| Property | Type | Description |
| --- | --- | --- |
| `index` | `number` |  |
| `startBlock` | `number` |  |
| `startPart` | `number` |  |
| `used` | `number` |  |
| `section` | `number` |  |
| `number` | `number` |  |
| `blank` | `boolean` |  |
| `clean` | `boolean` |  |
| `flowY` | `number` |  |
| `noteHeight` | `number` |  |
| `notes` | `PageNote[]` |  |
| `columns` | `number` |  |

### PaginateOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface PaginateOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `pageHeight` | `number` |  |
| `widowControl?` | `boolean` |  |
| `minLines?` | `number` |  |
| `sections?` | `readonly LayoutSection[]` |  |
| `noteSeparator?` | `number` |  |
| `balanceLastPage?` | `boolean` |  |
| `resolveParts?` | `(index: number, block: LayoutBlock) => readonly number[] \| ResolvedParts \| undefined` |  |
| `resolveRow?` | `(index: number, row: number, block: LayoutBlock) => LayoutRow \| undefined` |  |

### PaginationResult

Kind: interface. Import from `@birchui/document`.

```ts
interface PaginationResult
```

| Property | Type | Description |
| --- | --- | --- |
| `pages` | `PageSlice[]` |  |
| `breaks` | `LayoutBreak[]` |  |
| `pageCount` | `number` |  |
| `blockPages` | `number[]` |  |
| `reuse?` | `PaginationReuse` |  |

### ParagraphBorder

Kind: interface. Import from `@birchui/document`.

```ts
interface ParagraphBorder
```

| Property | Type | Description |
| --- | --- | --- |
| `style` | `BorderLineStyle` |  |
| `width` | `number` |  |
| `color` | `string` |  |
| `shadow?` | `boolean` |  |

### ParagraphBorders

Kind: interface. Import from `@birchui/document`.

```ts
interface ParagraphBorders
```

| Property | Type | Description |
| --- | --- | --- |
| `top?` | `ParagraphBorder \| null` |  |
| `right?` | `ParagraphBorder \| null` |  |
| `bottom?` | `ParagraphBorder \| null` |  |
| `left?` | `ParagraphBorder \| null` |  |

### ParagraphFormat

Kind: interface. Import from `@birchui/document`.

```ts
interface ParagraphFormat
```

| Property | Type | Description |
| --- | --- | --- |
| `align?` | `'left' \| 'center' \| 'right' \| 'justify' \| null` |  |
| `indentLeft?` | `number` |  |
| `indentRight?` | `number` |  |
| `indentFirstLine?` | `number` |  |
| `spaceBefore?` | `number \| null` |  |
| `spaceAfter?` | `number \| null` |  |
| `lineRule?` | `LineRule` |  |
| `lineHeight?` | `number \| null` |  |
| `lineHeightPt?` | `number \| null` |  |
| `keepWithNext?` | `boolean` |  |
| `keepLines?` | `boolean` |  |
| `widowControl?` | `boolean \| null` |  |
| `pageBreakBefore?` | `boolean` |  |
| `contextualSpacing?` | `boolean` |  |
| `outlineLevel?` | `number \| null` |  |

### ParagraphFormatChange

Kind: interface. Import from `@birchui/document`.

```ts
interface ParagraphFormatChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `before` | `{ attrs: Record<string, unknown>; pPr?: string \| null }` |  |

### ParagraphStyleDefinition

Kind: interface. Import from `@birchui/document`.

```ts
interface ParagraphStyleDefinition
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `ParagraphStyleId` |  |
| `wordName` | `string` |  |
| `label` | `string` |  |
| `tag` | `'p' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'blockquote' \| 'pre'` |  |
| `fontSize?` | `number` |  |
| `fontFamily?` | `string` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `color?` | `string` |  |
| `spaceBefore?` | `number` |  |
| `spaceAfter?` | `number` |  |
| `lineHeight?` | `number` |  |
| `align?` | `TextAlignment` |  |
| `indentLeft?` | `number` |  |
| `indentRight?` | `number` |  |
| `outlineLevel?` | `number` |  |
| `keepWithNext?` | `boolean` |  |
| `shading?` | `string` |  |

### ParagraphStyleInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface ParagraphStyleInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `basedOn` | `string` |  |
| `isBuiltin` | `boolean` |  |
| `isModified` | `boolean` |  |
| `isActive` | `boolean` |  |
| `format` | `StyleFormat` |  |

### ParsedField

Kind: interface. Import from `@birchui/document`.

```ts
interface ParsedField
```

| Property | Type | Description |
| --- | --- | --- |
| `keyword` | `string` |  |
| `kind` | `FieldKind \| 'link'` |  |
| `name` | `string` |  |
| `args` | `string[]` |  |
| `switches` | `Record<string, string \| true>` |  |
| `href` | `string \| null` |  |
| `title` | `string \| null` |  |
| `canonical` | `string` |  |
| `placeholder` | `string \| null` |  |

### PastedImageContext

Kind: interface. Import from `@birchui/document`.

```ts
interface PastedImageContext
```

| Property | Type | Description |
| --- | --- | --- |
| `source` | `'word' \| 'googleDocs' \| 'editor' \| 'other'` |  |
| `index` | `number` |  |
| `alt` | `string` |  |
| `html` | `string` |  |
| `rtf` | `string` |  |
| `files` | `readonly File[]` |  |

### PdfCluster

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfCluster
```

| Property | Type | Description |
| --- | --- | --- |
| `x` | `number` |  |
| `width` | `number` |  |
| `length` | `number` |  |

### PdfColor

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfColor
```

| Property | Type | Description |
| --- | --- | --- |
| `r` | `number` |  |
| `g` | `number` |  |
| `b` | `number` |  |

### PdfDestination

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfDestination
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'destination'` |  |
| `name` | `string` |  |
| `y` | `number` |  |

### PdfDocumentLayout

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfDocumentLayout
```

| Property | Type | Description |
| --- | --- | --- |
| `pages` | `PdfPage[]` |  |
| `outline?` | `PdfOutlineEntry[]` |  |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `language?` | `string` |  |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `structure?` | `readonly PdfStructNode[]` |  |
| `pdfA?` | `boolean` |  |
| `created?` | `Date` |  |
| `modified?` | `Date` |  |

### PdfExportOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfExportOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `compress?` | `boolean` |  |
| `outline?` | `boolean` |  |
| `onProgress?` | `(page: number, pages: number) => void` |  |
| `fontLoader?` | `PdfFontLoader` |  |
| `localFonts?` | `boolean` |  |
| `tagged?` | `boolean` |  |
| `pdfA?` | `boolean` |  |

### PdfFontSource

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfFontSource
```

| Property | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `data` | `Uint8Array` |  |

### PdfGroup

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfGroup extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'group'` |  |
| `items` | `PdfItem[]` |  |
| `matrix?` | `PdfMatrix` |  |
| `clip?` | `{ x: number; y: number; width: number; height: number }` |  |
| `opacity?` | `number` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfImage

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfImage extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'image'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `data` | `Uint8Array` |  |
| `mime` | `'image/jpeg' \| 'image/png'` |  |
| `alt?` | `string` |  |
| `rotation?` | `number` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfLine

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfLine extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'line'` |  |
| `x1` | `number` |  |
| `y1` | `number` |  |
| `x2` | `number` |  |
| `y2` | `number` |  |
| `color?` | `PdfColor` |  |
| `width?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfLinkArea

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfLinkArea
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'link'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `href?` | `string` |  |
| `destination?` | `string` |  |
| `struct?` | `number` |  |

### PdfOutlineEntry

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfOutlineEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `title` | `string` |  |
| `level` | `number` |  |
| `page` | `number` |  |
| `y` | `number` |  |

### PdfPage

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfPage
```

| Property | Type | Description |
| --- | --- | --- |
| `width` | `number` |  |
| `height` | `number` |  |
| `items` | `PdfItem[]` |  |

### PdfPath

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfPath extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'path'` |  |
| `commands` | `readonly PdfPathCommand[]` |  |
| `fill?` | `PdfColor` |  |
| `stroke?` | `PdfColor` |  |
| `strokeWidth?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `roundCaps?` | `boolean` |  |
| `roundJoins?` | `boolean` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfRect

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfRect extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'rect'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `fill?` | `PdfColor` |  |
| `stroke?` | `PdfColor` |  |
| `strokeWidth?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfStructNode

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfStructNode
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `PdfStructType` |  |
| `parent` | `number` |  |
| `alt?` | `string` |  |
| `language?` | `string` |  |

### PdfTagging

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `struct?` | `number` |  |
| `artifact?` | `PdfArtifactType` |  |

### PdfTextRun

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfTextRun extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'text'` |  |
| `x` | `number` |  |
| `baseline` | `number` |  |
| `width` | `number` |  |
| `text` | `string` |  |
| `fontFamily` | `string` |  |
| `fontSize` | `number` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `color?` | `PdfColor` |  |
| `underline?` | `boolean` |  |
| `underlineStyle?` | `PdfUnderlineStyle` | The line drawn for `underline`; a single line when left out. |
| `underlineColor?` | `PdfColor` | The colour of the underline; the colour of the text when left out. |
| `strike?` | `boolean` |  |
| `doubleStrike?` | `boolean` |  |
| `background?` | `PdfColor` |  |
| `link?` | `string` |  |
| `direction?` | `'ltr' \| 'rtl'` |  |
| `clusters?` | `readonly PdfCluster[]` |  |
| `trailingSpace?` | `boolean` |  |
| `decoration?` | `{ x: number; width: number }` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfWriteOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `compress?` | `boolean` |  |
| `creationDate?` | `Date` |  |
| `producer?` | `string` |  |
| `pdfA?` | `boolean` |  |
| `tagged?` | `boolean` |  |

### PdfWriteResult

Kind: interface. Import from `@birchui/document`.

```ts
interface PdfWriteResult
```

| Property | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `warnings` | `string[]` |  |

### Person

Kind: interface. Import from `@birchui/document`.

```ts
interface Person
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `email?` | `string` |  |

### PresenceState

Kind: interface. Import from `@birchui/document`.

```ts
interface PresenceState
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `name` | `string` |  |
| `color?` | `string` |  |
| `anchor` | `number \| null` |  |
| `head` | `number \| null` |  |
| `focused` | `boolean` |  |
| `clock?` | `number` |  |

### PreservedPart

Kind: interface. Import from `@birchui/document`.

```ts
interface PreservedPart
```

| Property | Type | Description |
| --- | --- | --- |
| `text?` | `string` |  |
| `base64?` | `string` |  |
| `deflate?` | `string` | A large text part, kept as the base64 of its raw DEFLATE data exactly as it was stored in the source file. |
| `size?` | `number` | The length in bytes of the part once `deflate` is inflated. |

### PreservedRelationship

Kind: interface. Import from `@birchui/document`.

```ts
interface PreservedRelationship
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `type` | `string` |  |
| `target` | `string` |  |
| `external?` | `boolean` |  |

### PreservedXml

Kind: interface. Import from `@birchui/document`.

```ts
interface PreservedXml
[key: string]: unknown
```

| Property | Type | Description |
| --- | --- | --- |
| `xml` | `string` |  |
| `sig?` | `string` |  |
| `rels?` | `PreservedRelationship[]` |  |

### ProposedChange

Kind: interface. Import from `@birchui/document`.

```ts
interface ProposedChange
```

| Property | Type | Description |
| --- | --- | --- |
| `from?` | `number` |  |
| `to?` | `number` |  |
| `find?` | `string` |  |
| `occurrence?` | `number` |  |
| `text` | `string` |  |
| `author?` | `string` |  |
| `date?` | `string` |  |

### ReadAloudApi

Kind: interface. Import from `@birchui/document`.

```ts
interface ReadAloudApi
```

| Property | Type | Description |
| --- | --- | --- |
| `readAloud` | `(options?: ReadAloudOptions) => ReadAloudHandle` |  |
| `stopReadAloud` | `() => void` |  |
| `isReadingAloud` | `() => boolean` |  |

### ReadAloudChunk

Kind: interface. Import from `@birchui/document`.

```ts
interface ReadAloudChunk
```

| Property | Type | Description |
| --- | --- | --- |
| `pageIndex` | `number` | The page the sentence starts on, from 0. |
| `text` | `string` |  |
| `from` | `number` | Where the sentence starts and ends in the document. |
| `to` | `number` |  |

### ReadAloudEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface ReadAloudEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `readAloudChange` | `{ reading: boolean; paused: boolean }` |  |

### ReadAloudHandle

Kind: interface. Import from `@birchui/document`.

```ts
interface ReadAloudHandle
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly isPaused` | `boolean` |  |
| `readonly isStopped` | `boolean` |  |
| `readonly finished` | `Promise<void>` |  |
| `pause` | `() => void` |  |
| `resume` | `() => void` |  |
| `stop` | `() => void` |  |

### ReadAloudOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface ReadAloudOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fromPage?` | `number` | The page to start on, from 0. Without it reading starts at the cursor. |
| `onText?` | `(chunk: ReadAloudChunk) => void \| Promise<void>` | Speaks one sentence yourself; the next one follows when the promise settles. Without it the browser speaks. |
| `lang?` | `string` |  |
| `rate?` | `number` |  |

### ReviewApi

Kind: interface. Import from `@birchui/document`.

```ts
interface ReviewApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getMarkupMode` | `() => MarkupMode` |  |
| `setMarkupMode` | `(mode: MarkupMode) => void` |  |
| `getMarkupVisibility` | `() => MarkupVisibility` |  |
| `setMarkupVisibility` | `(visibility: Partial<MarkupVisibility>) => void` |  |
| `getRevisions` | `(filter?: RevisionFilter) => RevisionChange[]` |  |
| `acceptChanges` | `(filter?: RevisionFilter) => number` |  |
| `rejectChanges` | `(filter?: RevisionFilter) => number` |  |
| `nextChange` | `() => RevisionChange \| null` |  |
| `previousChange` | `() => RevisionChange \| null` |  |
| `goToChange` | `(id: string) => boolean` |  |
| `editReply` | `(threadId: string, replyId: string, text: string) => boolean` |  |
| `deleteReply` | `(threadId: string, replyId: string) => boolean` |  |
| `saveSnapshot` | `(label?: string) => SnapshotInfo \| null` |  |
| `getSnapshots` | `() => SnapshotInfo[]` |  |
| `restoreSnapshot` | `(id: string) => boolean` |  |
| `compareWithSnapshot` | `(id: string, options?: CompareOptions) => number` |  |
| `deleteSnapshot` | `(id: string) => boolean` |  |
| `getSnapshotDocument` | `(id: string) => DocumentData \| null` |  |
| `compareWithDocx` | `(input: ArrayBuffer \| Uint8Array \| Blob, options?: CompareOptions) => Promise<number>` |  |
| `compareSideBySide` | `(revised: DocumentInput, options?: SideBySideOptions) => boolean` |  |
| `closeSideBySide` | `() => boolean` |  |
| `isSideBySideOpen` | `() => boolean` |  |
| `combineWith` | `(first: DocumentInput, second: DocumentInput, options?: CombineOptions) => number` |  |
| `combineWithDocx` | `(first: ArrayBuffer \| Uint8Array \| Blob, second: ArrayBuffer \| Uint8Array \| Blob, options?: CombineOptions) => Promise<number>` |  |

### ReviewEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface ReviewEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `revisionsChange` | `{ revisions: RevisionChange[] }` |  |
| `markupModeChange` | `{ mode: MarkupMode }` |  |
| `snapshotsChange` | `{ snapshots: SnapshotInfo[] }` |  |

### ReviewOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface ReviewOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `markupMode?` | `MarkupMode` |  |
| `changeBars?` | `boolean` |  |
| `changeBalloons?` | `boolean` |  |
| `commentsLayout?` | `'margin' \| 'panel'` |  |
| `mentions?` | `MentionOptions` |  |
| `snapshots?` | `SnapshotStorage` |  |

### RevisionChange

Kind: interface. Import from `@birchui/document`.

```ts
interface RevisionChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `ids` | `string[]` |  |
| `kind` | `RevisionChangeKind` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `text` | `string` |  |
| `deletedText?` | `string` |  |
| `summary` | `string` |  |
| `from` | `number` |  |
| `to` | `number` |  |

### RevisionFilter

Kind: interface. Import from `@birchui/document`.

```ts
interface RevisionFilter
```

| Property | Type | Description |
| --- | --- | --- |
| `ids?` | `readonly string[]` |  |
| `author?` | `string` |  |
| `authors?` | `readonly string[]` |  |
| `kinds?` | `readonly RevisionChangeKind[]` |  |
| `from?` | `number` |  |
| `to?` | `number` |  |
| `after?` | `string \| Date` |  |
| `before?` | `string \| Date` |  |

### RevisionInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface RevisionInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'insertion' \| 'deletion'` |  |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `moveId?` | `string \| null` |  |

### RibbonApi

Kind: interface. Import from `@birchui/document`.

```ts
interface RibbonApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getRibbonTab` | `() => string \| null` |  |
| `setRibbonTab` | `(tab: RibbonTabName) => boolean` |  |
| `isRibbonCollapsed` | `() => boolean` |  |
| `setRibbonCollapsed` | `(collapsed: boolean) => void` |  |
| `getViewMode` | `() => DocumentViewMode` |  |
| `setViewMode` | `(mode: DocumentViewMode) => void` |  |
| `fitZoom` | `(mode: 'width' \| 'page') => number` |  |
| `getTabStops` | `() => TabStop[]` |  |
| `setTabStops` | `(stops: readonly TabStop[]) => boolean` |  |

### RibbonConfig

Kind: interface. Import from `@birchui/document`.

```ts
interface RibbonConfig
```

| Property | Type | Description |
| --- | --- | --- |
| `tabs?` | `readonly RibbonTabName[]` |  |
| `hiddenTabs?` | `readonly RibbonTabName[]` |  |
| `hiddenGroups?` | `readonly string[]` |  |
| `hiddenControls?` | `readonly string[]` |  |
| `groupOrder?` | `Readonly<Record<string, readonly string[]>>` |  |
| `tabLabels?` | `Readonly<Record<string, string>>` |  |
| `custom?` | `readonly RibbonCustomGroup[]` |  |
| `activeTab?` | `RibbonTabName` |  |
| `collapsed?` | `boolean` |  |
| `keyTips?` | `boolean` |  |

### RibbonCustomControl

Kind: interface. Import from `@birchui/document`.

```ts
interface RibbonCustomControl
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `label` | `string` |  |
| `icon?` | `string` |  |
| `kind?` | `'button' \| 'toggle'` |  |
| `size?` | `'large' \| 'small'` |  |
| `keyTip?` | `string` |  |
| `shortcut?` | `string` |  |
| `readOnlySafe?` | `boolean` |  |
| `run` | `(api: DocumentEditorApi) => void` |  |
| `isPressed?` | `(api: DocumentEditorApi) => boolean` |  |
| `isDisabled?` | `(api: DocumentEditorApi) => boolean` |  |

### RibbonCustomGroup

Kind: interface. Import from `@birchui/document`.

```ts
interface RibbonCustomGroup
```

| Property | Type | Description |
| --- | --- | --- |
| `tab` | `RibbonTabName` |  |
| `tabLabel?` | `string` |  |
| `group` | `string` |  |
| `label` | `string` |  |
| `order?` | `number` |  |
| `controls` | `readonly RibbonCustomControl[]` |  |

### RibbonEvents

Kind: interface. Import from `@birchui/document`.

```ts
interface RibbonEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `ribbonTabChange` | `{ tab: string }` |  |
| `viewModeChange` | `{ mode: DocumentViewMode }` |  |

### RibbonOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface RibbonOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `ribbon?` | `boolean \| RibbonConfig` |  |
| `miniToolbar?` | `boolean` |  |
| `viewMode?` | `DocumentViewMode` |  |
| `theme?` | `'auto' \| 'light' \| 'dark'` |  |
| `darkPage?` | `'white' \| 'dark'` |  |
| `verticalRuler?` | `boolean` |  |
| `commandSearch?` | `boolean` | The Search commands box of the tab row and its Alt+Q shortcut. On by default. |

### RunFormatChange

Kind: interface. Import from `@birchui/document`.

```ts
interface RunFormatChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `before` | `{ marks: DocMarkJSON[]; rPr?: string \| null }` |  |

### SearchBlock

Kind: interface. Import from `@birchui/document`.

```ts
interface SearchBlock
```

| Property | Type | Description |
| --- | --- | --- |
| `text` | `string` |  |
| `start` | `number` |  |

### SearchMatch

Kind: interface. Import from `@birchui/document`.

```ts
interface SearchMatch
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `groups` | `string[]` |  |

### SectionColumns

Kind: interface. Import from `@birchui/document`.

```ts
interface SectionColumns
```

| Property | Type | Description |
| --- | --- | --- |
| `count` | `number` |  |
| `gap` | `number` |  |
| `separator?` | `boolean` |  |
| `widths?` | `{ width: number; gap: number }[]` |  |

### SectionFormatChange

Kind: interface. Import from `@birchui/document`.

```ts
interface SectionFormatChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `before` | `{ page: PageSetup; sectPr?: string \| null }` |  |

### SectionHeaders

Kind: interface. Import from `@birchui/document`.

```ts
interface SectionHeaders
```

| Property | Type | Description |
| --- | --- | --- |
| `header?` | `DocNodeJSON \| null` |  |
| `footer?` | `DocNodeJSON \| null` |  |
| `firstHeader?` | `DocNodeJSON \| null` |  |
| `firstFooter?` | `DocNodeJSON \| null` |  |
| `evenHeader?` | `DocNodeJSON \| null` |  |
| `evenFooter?` | `DocNodeJSON \| null` |  |

### SideBySideOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface SideBySideOptions extends CompareOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `original?` | `DocumentInput` |  |
| `originalLabel?` | `string` |  |
| `revisedLabel?` | `string` |  |
| `author?` | `string \| undefined` | Inherited from CompareOptions. |
| `date?` | `string \| undefined` | Inherited from CompareOptions. |
| `granularity?` | `"word" \| "character" \| undefined` | Inherited from CompareOptions. |
| `moves?` | `boolean \| undefined` | Inherited from CompareOptions. |
| `formatting?` | `boolean \| undefined` | Inherited from CompareOptions. |

### SnapshotInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface SnapshotInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `label` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |

### SnapshotStorage

Kind: interface. Import from `@birchui/document`.

```ts
interface SnapshotStorage
```

| Property | Type | Description |
| --- | --- | --- |
| `load` | `() => Promise<DocumentSnapshot[]> \| DocumentSnapshot[]` |  |
| `save` | `(snapshots: DocumentSnapshot[]) => Promise<void> \| void` |  |

### SortTableValue

Kind: interface. Import from `@birchui/document`.

```ts
interface SortTableValue
```

| Property | Type | Description |
| --- | --- | --- |
| `column` | `number` |  |
| `type?` | `'text' \| 'number' \| 'date'` |  |
| `descending?` | `boolean` |  |
| `hasHeader?` | `boolean` |  |

### SourcePerson

Kind: interface. Import from `@birchui/document`.

```ts
interface SourcePerson
```

| Property | Type | Description |
| --- | --- | --- |
| `last` | `string` |  |
| `first?` | `string` |  |
| `middle?` | `string` |  |

### SpellingApi

Kind: interface. Import from `@birchui/document`.

```ts
interface SpellingApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getSpellingIssues` | `() => SpellingMatch[]` |  |
| `checkSpelling` | `() => Promise<void>` |  |
| `ignoreSpelling` | `(word: string) => void` |  |
| `replaceSpelling` | `(from: number, text: string) => boolean` |  |

### SpellingIssue

Kind: interface. Import from `@birchui/document`.

```ts
interface SpellingIssue
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `message?` | `string` |  |
| `suggestions?` | `readonly string[]` |  |

### SpellingMatch

Kind: interface. Import from `@birchui/document`.

```ts
interface SpellingMatch
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `text` | `string` |  |
| `message?` | `string` |  |
| `suggestions` | `string[]` |  |

### StyleFormat

Kind: interface. Import from `@birchui/document`.

```ts
interface StyleFormat
```

| Property | Type | Description |
| --- | --- | --- |
| `fontFamily?` | `string` |  |
| `fontSize?` | `number` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `underline?` | `boolean` |  |
| `color?` | `string` |  |
| `align?` | `'left' \| 'center' \| 'right' \| 'justify'` |  |
| `lineHeight?` | `number` |  |
| `spaceBefore?` | `number` |  |
| `spaceAfter?` | `number` |  |
| `indentLeft?` | `number` |  |
| `indentFirstLine?` | `number` |  |

### TableFormatChange

Kind: interface. Import from `@birchui/document`.

```ts
interface TableFormatChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `before` | `{ attrs: Record<string, unknown>; tblPr?: string \| null }` |  |

### TableLook

Kind: interface. Import from `@birchui/document`.

```ts
interface TableLook
```

| Property | Type | Description |
| --- | --- | --- |
| `firstRow?` | `boolean` |  |
| `lastRow?` | `boolean` |  |
| `firstColumn?` | `boolean` |  |
| `lastColumn?` | `boolean` |  |
| `bandedRows?` | `boolean` |  |
| `bandedColumns?` | `boolean` |  |

### TableOfContentsOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface TableOfContentsOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `maxLevel?` | `number` |  |
| `showPages?` | `boolean` |  |
| `hyperlinks?` | `boolean` |  |
| `leader?` | `'dot' \| 'hyphen' \| 'underscore' \| 'none'` |  |

### TablePropertiesValue

Kind: interface. Import from `@birchui/document`.

```ts
interface TablePropertiesValue
```

| Property | Type | Description |
| --- | --- | --- |
| `align?` | `'left' \| 'center' \| 'right' \| null` |  |
| `indent?` | `number \| null` |  |
| `width?` | `number \| string \| null` |  |
| `cellMargins?` | `{ top: number; right: number; bottom: number; left: number } \| null` |  |
| `repeatHeader?` | `boolean` |  |
| `cantSplit?` | `boolean` |  |
| `caption?` | `string` |  |
| `description?` | `string` |  |

### TabStop

Kind: interface. Import from `@birchui/document`.

```ts
interface TabStop
```

| Property | Type | Description |
| --- | --- | --- |
| `position` | `number` |  |
| `align` | `'left' \| 'center' \| 'right' \| 'decimal' \| 'bar' \| 'clear'` |  |
| `leader?` | `'none' \| 'dot' \| 'hyphen' \| 'underscore' \| 'middleDot' \| 'heavy'` |  |

### TemplateInfo

Kind: interface. Import from `@birchui/document`.

```ts
interface TemplateInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `description` | `string` |  |
| `isBuiltin` | `boolean` |  |

### TextToTableValue

Kind: interface. Import from `@birchui/document`.

```ts
interface TextToTableValue
```

| Property | Type | Description |
| --- | --- | --- |
| `separator?` | `'tab' \| 'comma' \| 'paragraph' \| string` |  |
| `columns?` | `number` |  |

### TrackedChange

Kind: interface. Import from `@birchui/document`.

```ts
interface TrackedChange
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `kind` | `TrackedChangeKind` |  |
| `author` | `string` |  |
| `date` | `string` |  |
| `text` | `string` |  |
| `from` | `number` |  |
| `to` | `number` |  |

### UnzipOptions

Kind: interface. Import from `@birchui/document`.

```ts
interface UnzipOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<ZipLimits>` |  |

### Watermark

Kind: interface. Import from `@birchui/document`.

```ts
interface Watermark
```

| Property | Type | Description |
| --- | --- | --- |
| `text` | `string` | The text of a text watermark; empty for a picture watermark. |
| `image?` | `string` | A picture watermark: a `data:image/…` URL. It takes the place of the text. |
| `scale?` | `number` | Size of the picture as a multiple of its own size; without it the picture fits the text area. |
| `washout?` | `boolean` | `false` draws the picture at full strength instead of washed out. |
| `rotation?` | `number` |  |
| `opacity?` | `number` |  |
| `color?` | `string` |  |
| `fontFamily?` | `string` |  |
| `fontSize?` | `number` |  |

### WordCount

Kind: interface. Import from `@birchui/document`.

```ts
interface WordCount
```

| Property | Type | Description |
| --- | --- | --- |
| `words` | `number` |  |
| `characters` | `number` |  |
| `charactersNoSpaces` | `number` |  |
| `paragraphs` | `number` |  |

### ZipLimits

Kind: interface. Import from `@birchui/document`.

```ts
interface ZipLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxEntries` | `number` |  |
| `maxEntryBytes` | `number` |  |
| `maxTotalBytes` | `number` |  |
| `maxRatio` | `number` |  |

### AccessibilityCommand

Kind: type. Import from `@birchui/document`.

```ts
type AccessibilityCommand = 'accessibilityPane';
```

### AccessibilityRule

Kind: type. Import from `@birchui/document`.

```ts
type AccessibilityRule = 'missingAltText' | 'skippedHeading' | 'tableHeader' | 'lowContrast';
```

### BorderEdge

Kind: type. Import from `@birchui/document`.

```ts
type BorderEdge = 'all' | 'outer' | 'inner' | 'none' | 'top' | 'bottom' | 'left' | 'right';
```

### BorderLineStyle

Kind: type. Import from `@birchui/document`.

```ts
type BorderLineStyle = 'none' | 'single' | 'double' | 'dashed' | 'dotted';
```

### BorderSet

Kind: type. Import from `@birchui/document`.

```ts
type BorderSet = Partial<Record<'top' | 'right' | 'bottom' | 'left' | 'between' | 'bar', BorderLine>>;
```

### BreakKind

Kind: type. Import from `@birchui/document`.

```ts
type BreakKind = 'page' | 'column' | 'sectionNextPage' | 'sectionContinuous';
```

### BulletListStyle

Kind: type. Import from `@birchui/document`.

```ts
type BulletListStyle = 'disc' | 'circle' | 'square';
```

### CaseMode

Kind: type. Import from `@birchui/document`.

```ts
type CaseMode = 'sentence' | 'lower' | 'upper' | 'capitalize' | 'toggle';
```

### ChartType

Kind: type. Import from `@birchui/document`.

```ts
type ChartType = 'column' | 'bar' | 'line' | 'area' | 'pie' | 'doughnut' | 'scatter';
```

### CitationsCommand

Kind: type. Import from `@birchui/document`.

```ts
type CitationsCommand = 'insertCitation' | 'insertBibliography' | 'citationStyle' | 'manageSources';
```

### CitationStyle

Kind: type. Import from `@birchui/document`.

```ts
type CitationStyle = 'apa' | 'mla' | 'chicago';
```

### CollabBackendEvent

Kind: type. Import from `@birchui/document`.

```ts
type CollabBackendEvent =
  | { type: 'connection'; status: CollabConnectionStatus }
  | { type: 'steps'; payload: CollabRemotePayload }
  | { type: 'reset'; snapshot: CollabSnapshot }
  | { type: 'presence'; states: Record<string, PresenceState> }
  | { type: 'locks'; state: CollabLockState }
  | { type: 'snapshotRequest' };
```

### CollabClientId

Kind: type. Import from `@birchui/document`.

```ts
type CollabClientId = string | number;
```

### CollabCommand

Kind: type. Import from `@birchui/document`.

```ts
type CollabCommand = never;
```

### CollabCommentOperation

Kind: type. Import from `@birchui/document`.

```ts
type CollabCommentOperation =
  | { type: 'add'; thread: CommentThread }
  | { type: 'reply'; id: string; reply: CommentReply }
  | { type: 'edit'; id: string; text: string }
  | { type: 'resolve'; id: string; resolved: boolean }
  | { type: 'delete'; id: string }
  | { type: 'editReply'; id: string; replyId: string; text: string }
  | { type: 'deleteReply'; id: string; replyId: string };
```

### CollabConnectionStatus

Kind: type. Import from `@birchui/document`.

```ts
type CollabConnectionStatus = 'connected' | 'reconnecting' | 'offline';
```

### CollabDocumentPrepared

Kind: type. Import from `@birchui/document`.

```ts
type CollabDocumentPrepared =
  { ok: true; footprint: CollabStepFootprint[]; commit(): void } | { ok: false; reason: string };
```

The authority's own copy of the document. Steps are applied to it, and a step that does not apply is refused.

### CollabDocumentResult

Kind: type. Import from `@birchui/document`.

```ts
type CollabDocumentResult = { ok: true; footprint: CollabStepFootprint[] } | { ok: false; reason: string };
```

### CollabMetaOperation

Kind: type. Import from `@birchui/document`.

```ts
type CollabMetaOperation =
  | { type: 'pageSetup'; page: PageSetup }
  | { type: 'headerFooter'; parts: HeaderFooterContent }
  | { type: 'comment'; operation: CollabCommentOperation };
```

### CollabRejectReason

Kind: type. Import from `@birchui/document`.

```ts
type CollabRejectReason = 'stale' | 'locked' | 'offline' | 'invalid';
```

### CollabSendResult

Kind: type. Import from `@birchui/document`.

```ts
type CollabSendResult = void | boolean | CollabSubmitResult;
```

### CollabState

Kind: type. Import from `@birchui/document`.

```ts
type CollabState = 'disabled' | 'synced' | 'pending' | 'offline' | 'desynced';
```

### CollabStoredVersion

Kind: type. Import from `@birchui/document`.

```ts
type CollabStoredVersion = CollabVersionSnapshot | CollabVersionDelta;
```

### CollabWireMessage

Kind: type. Import from `@birchui/document`.

```ts
type CollabWireMessage = { type: string } & Record<string, unknown>;
```

### ContentControlKind

Kind: type. Import from `@birchui/document`.

```ts
type ContentControlKind =
  | 'richText'
  | 'plainText'
  | 'dropdown'
  | 'comboBox'
  | 'date'
  | 'checkbox'
  | 'picture'
  | 'repeatingSection'
  | 'repeatingSectionItem'
  | 'group'
  | 'buildingBlock'
  | 'citation'
  | 'bibliography'
  | 'unknown';
```

### CrossReferenceDisplay

Kind: type. Import from `@birchui/document`.

```ts
type CrossReferenceDisplay = 'text' | 'page' | 'aboveBelow' | 'number';
```

### CrossReferenceTarget

Kind: type. Import from `@birchui/document`.

```ts
type CrossReferenceTarget = 'heading' | 'bookmark' | 'figure' | 'table' | 'equation' | 'footnote';
```

### DocFormatCode

Kind: type. Import from `@birchui/document`.

```ts
type DocFormatCode =
  'not-a-doc' | 'encrypted' | 'unsupported-version' | 'too-large' | 'too-many-characters' | 'corrupt';
```

### DocumentCommand

Kind: type. Import from `@birchui/document`.

```ts
type DocumentCommand =
  | CoreDocumentCommand
  | EditingCommand
  | ObjectsCommand
  | ReviewCommand
  | CollabCommand
  | RibbonCommand
  | LayoutCommand
  | FileCommand
  | CitationsCommand
  | AccessibilityCommand
  | DrawCommand
  | ReadAloudCommand
  | 'spellingSuggestions';
```

### DocumentFormatCode

Kind: type. Import from `@birchui/document`.

```ts
type DocumentFormatCode =
  'encrypted-or-legacy-doc' | 'encrypted-entry' | 'not-a-zip' | 'not-a-word-document' | 'xml-too-deep';
```

### DocumentInput

Kind: type. Import from `@birchui/document`.

```ts
type DocumentInput = Partial<DocumentData> | DocNodeJSON;
```

### DocumentLayout

Kind: type. Import from `@birchui/document`.

```ts
type DocumentLayout = 'page' | 'web';
```

### DocumentStyleType

Kind: type. Import from `@birchui/document`.

```ts
type DocumentStyleType = 'paragraph' | 'character' | 'table' | 'numbering';
```

### DocumentViewMode

Kind: type. Import from `@birchui/document`.

```ts
type DocumentViewMode = 'edit' | 'read' | 'focus';
```

### DrawCommand

Kind: type. Import from `@birchui/document`.

```ts
type DrawCommand = 'drawTool' | 'inkColor' | 'inkWidth' | 'insertInk' | 'eraseInk';
```

### DrawTool

Kind: type. Import from `@birchui/document`.

```ts
type DrawTool = InkTool | 'eraser';
```

### EditingCommand

Kind: type. Import from `@birchui/document`.

```ts
type EditingCommand =
  | 'fontDialog'
  | 'fontFormat'
  | 'paragraphDialog'
  | 'paragraphFormat'
  | 'bordersDialog'
  | 'paragraphBorders'
  | 'paragraphShading'
  | 'listLibrary'
  | 'applyListFormat'
  | 'defineMultilevelList'
  | 'applyMultilevelList'
  | 'applyStyle'
  | 'stylesPane'
  | 'revealFormatting'
  | 'clearParagraphFormatting'
  | 'clearCharacterFormatting'
  | 'clearCharacterStyle'
  | 'formatPainterLock'
  | 'findPane'
  | 'replacePane'
  | 'navigationPane'
  | 'moveSectionUp'
  | 'moveSectionDown'
  | 'promoteHeading'
  | 'demoteHeading'
  | 'changeCase'
  | 'cycleCase'
  | 'dropCap'
  | 'symbolDialog'
  | 'dateTimeDialog'
  | 'insertDateTime'
  | 'wordCountDialog'
  | 'pasteText'
  | 'pasteMode'
  | 'pasteSpecialDialog'
  | 'autocorrectDialog'
  | 'defaultTabStop'
  | 'documentPropertiesDialog'
  | 'documentProperties'
  | 'hyperlinkDialog'
  | 'hyperlink'
  | 'insertBreak'
  | 'pageSetupDialog'
  | 'columns'
  | 'columnsDialog'
  | 'noteOptionsDialog'
  | 'lineNumbers'
  | 'watermark'
  | 'watermarkDialog'
  | 'multilevelDialog'
  | 'numberFormatDialog'
  | 'formattingMarks'
  | 'insertSpecialCharacter';
```

### FieldKind

Kind: type. Import from `@birchui/document`.

```ts
type FieldKind =
  | 'merge'
  | 'page'
  | 'pages'
  | 'date'
  | 'time'
  | 'ref'
  | 'pageref'
  | 'noteref'
  | 'seq'
  | 'if'
  | 'toc'
  | 'styleref'
  | 'property'
  | 'form'
  | 'citation'
  | 'bibliography'
  | 'other';
```

### FileCommand

Kind: type. Import from `@birchui/document`.

```ts
type FileCommand =
  | 'fileMenu'
  | 'newDocument'
  | 'newFromTemplate'
  | 'openFile'
  | 'saveFile'
  | 'downloadFile'
  | 'printDocument';
```

### FileErrorCode

Kind: type. Import from `@birchui/document`.

```ts
type FileErrorCode = 'unsupported-format' | 'too-large' | 'unreadable' | 'password-required' | 'wrong-password';
```

### FileExportFormat

Kind: type. Import from `@birchui/document`.

```ts
type FileExportFormat = 'docx' | 'pdf' | 'odt' | 'html' | 'markdown' | 'text';
```

### FileImportFormat

Kind: type. Import from `@birchui/document`.

```ts
type FileImportFormat = 'docx' | 'doc' | 'odt' | 'rtf' | 'html' | 'markdown' | 'text';
```

### FileItemId

Kind: type. Import from `@birchui/document`.

```ts
type FileItemId =
  | 'new'
  | 'templates'
  | 'open'
  | 'save'
  | 'downloadDocx'
  | 'downloadPdf'
  | 'downloadOdt'
  | 'downloadHtml'
  | 'downloadMarkdown'
  | 'downloadText'
  | 'print'
  | 'pageSetup'
  | 'properties'
  | 'versionHistory'
  | 'password'
  | 'shortcuts';
```

### FileKind

Kind: type. Import from `@birchui/document`.

```ts
type FileKind =
  'word' | 'excel' | 'powerpoint' | 'pdf' | 'email' | 'image' | 'text' | 'archive' | 'media' | 'file';
```

### FileRequestResult

Kind: type. Import from `@birchui/document`.

```ts
type FileRequestResult = boolean | void | Promise<boolean | void>;
```

### FileTypeLabel

Kind: type. Import from `@birchui/document`.

```ts
type FileTypeLabel =
  | 'word'
  | 'excel'
  | 'powerpoint'
  | 'document'
  | 'spreadsheet'
  | 'presentation'
  | 'pdf'
  | 'outlook'
  | 'email'
  | 'image'
  | 'text'
  | 'csv'
  | 'archive'
  | 'audio'
  | 'video'
  | 'file';
```

### FileTypeSource

Kind: type. Import from `@birchui/document`.

```ts
type FileTypeSource = 'progId' | 'fileName' | 'contentType' | 'content' | 'none';
```

### FormControlKind

Kind: type. Import from `@birchui/document`.

```ts
type FormControlKind =
  'plainText' | 'richText' | 'dropdown' | 'comboBox' | 'date' | 'checkbox' | 'picture' | 'repeatingSection';
```

### ImageRecolor

Kind: type. Import from `@birchui/document`.

```ts
type ImageRecolor = 'grayscale' | 'sepia' | 'washout' | 'blackWhite';
```

### ImageShapePreset

Kind: type. Import from `@birchui/document`.

```ts
type ImageShapePreset = 'rounded' | 'oval' | 'softEdge';
```

### ImageSourceKind

Kind: type. Import from `@birchui/document`.

```ts
type ImageSourceKind = 'embedded' | 'remote' | 'none';
```

### ImageWrap

Kind: type. Import from `@birchui/document`.

```ts
type ImageWrap = 'inline' | 'square' | 'tight' | 'through' | 'topBottom' | 'behind' | 'inFront';
```

### InkTool

Kind: type. Import from `@birchui/document`.

```ts
type InkTool = 'pen' | 'highlighter';
```

### LayoutBlockKind

Kind: type. Import from `@birchui/document`.

```ts
type LayoutBlockKind = 'atomic' | 'lines' | 'rows' | 'pageBreak' | 'columnBreak' | 'sectionBreak';
```

### LayoutCommand

Kind: type. Import from `@birchui/document`.

```ts
type LayoutCommand = never;
```

### LayoutCompatibility

Kind: type. Import from `@birchui/document`.

```ts
type LayoutCompatibility = 'word' | 'legacy';
```

### LineRule

Kind: type. Import from `@birchui/document`.

```ts
type LineRule = 'auto' | 'exact' | 'atLeast';
```

### MarkupMode

Kind: type. Import from `@birchui/document`.

```ts
type MarkupMode = 'all' | 'simple' | 'none' | 'original';
```

### MergeValues

Kind: type. Import from `@birchui/document`.

```ts
type MergeValues = Record<string, unknown>;
```

### NoteKind

Kind: type. Import from `@birchui/document`.

```ts
type NoteKind = 'footnote' | 'endnote';
```

### NoteNumberFormat

Kind: type. Import from `@birchui/document`.

```ts
type NoteNumberFormat = 'decimal' | 'lowerRoman' | 'upperRoman' | 'lowerLetter' | 'upperLetter' | 'chicago';
```

### ObjectDialogName

Kind: type. Import from `@birchui/document`.

```ts
type ObjectDialogName =
  | 'insertTable'
  | 'tableProperties'
  | 'splitCells'
  | 'sortTable'
  | 'formula'
  | 'textToTable'
  | 'tableToText'
  | 'borders'
  | 'imageSize'
  | 'imageLayout'
  | 'imageAltText'
  | 'imageCompress'
  | 'shapeFormat'
  | 'equation'
  | 'bookmark'
  | 'crossReference'
  | 'caption'
  | 'tableOfContents'
  | 'tableOfFigures'
  | 'footnote'
  | 'noteOptions'
  | 'contentControl';
```

### ObjectsCommand

Kind: type. Import from `@birchui/document`.

```ts
type ObjectsCommand =
  | 'objectDialog'
  | 'updateFields'
  | 'cellBorders'
  | 'cellShading'
  | 'cellVerticalAlign'
  | 'cellTextDirection'
  | 'cellMargins'
  | 'distributeRows'
  | 'distributeColumns'
  | 'autofitTable'
  | 'rowHeight'
  | 'columnWidth'
  | 'sortTable'
  | 'insertFormula'
  | 'textToTable'
  | 'tableToText'
  | 'tableStyle'
  | 'tableStyleOptions'
  | 'tableProperties'
  | 'splitCells'
  | 'selectRow'
  | 'selectColumn'
  | 'selectTable'
  | 'deleteCells'
  | 'drawBorders'
  | 'tableTool'
  | 'paintCellEdges'
  | 'imageWrap'
  | 'imagePosition'
  | 'imageRotate'
  | 'imageFlip'
  | 'imageCrop'
  | 'imageCropMode'
  | 'imageReset'
  | 'imageReplace'
  | 'imageCompress'
  | 'imageDecorative'
  | 'imageBorder'
  | 'imageEffects'
  | 'insertChart'
  | 'editChart'
  | 'imageNudge'
  | 'insertShape'
  | 'insertTextBox'
  | 'shapeStyle'
  | 'insertEquation'
  | 'insertEmbeddedObject'
  | 'openEmbeddedObject'
  | 'downloadEmbeddedObject'
  | 'insertBookmark'
  | 'deleteBookmark'
  | 'goToBookmark'
  | 'showBookmarks'
  | 'insertCrossReference'
  | 'insertCaption'
  | 'insertTableOfFigures'
  | 'tableOfContentsOptions'
  | 'insertFootnote'
  | 'insertEndnote'
  | 'nextFootnote'
  | 'previousFootnote'
  | 'convertNotes'
  | 'deleteNote'
  | 'noteFormat'
  | 'noteSettings'
  | 'insertContentControl'
  | 'contentControlProperties'
  | 'removeContentControl'
  | 'formMode'
  | 'insertDateField'
  | 'insertCells'
  | 'shapeEditText'
  | 'restrictEditing'
  | 'toggleFieldCodes'
  | 'mergePreview';
```

### ObjectWrap

Kind: type. Import from `@birchui/document`.

```ts
type ObjectWrap = 'inline' | 'square' | 'tight' | 'topBottom' | 'behind' | 'inFront';
```

### OrderedListStyle

Kind: type. Import from `@birchui/document`.

```ts
type OrderedListStyle = 'decimal' | 'lowerAlpha' | 'upperAlpha' | 'lowerRoman' | 'upperRoman';
```

### PageNumberFormat

Kind: type. Import from `@birchui/document`.

```ts
type PageNumberFormat =
  'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter' | 'numberInDash' | (string & {});
```

### PageOrientation

Kind: type. Import from `@birchui/document`.

```ts
type PageOrientation = 'portrait' | 'landscape';
```

### PageSizeName

Kind: type. Import from `@birchui/document`.

```ts
type PageSizeName = 'A3' | 'A4' | 'A5' | 'Letter' | 'Legal' | 'Executive';
```

### ParagraphStyleId

Kind: type. Import from `@birchui/document`.

```ts
type ParagraphStyleId =
  | 'Normal'
  | 'Title'
  | 'Subtitle'
  | 'Heading1'
  | 'Heading2'
  | 'Heading3'
  | 'Heading4'
  | 'Heading5'
  | 'Heading6'
  | 'Quote'
  | 'Code';
```

### PasteMode

Kind: type. Import from `@birchui/document`.

```ts
type PasteMode = 'keepSource' | 'mergeFormatting' | 'textOnly' | 'picture';
```

### PdfArtifactType

Kind: type. Import from `@birchui/document`.

```ts
type PdfArtifactType = 'header' | 'footer' | 'watermark' | 'pagination' | 'layout';
```

### PdfFontLoader

Kind: type. Import from `@birchui/document`.

```ts
type PdfFontLoader = (
  family: string,
  style: { bold: boolean; italic: boolean },
) => Promise<ArrayBuffer | Uint8Array | null>;
```

### PdfItem

Kind: type. Import from `@birchui/document`.

```ts
type PdfItem = PdfTextRun | PdfRect | PdfLine | PdfPath | PdfImage | PdfLinkArea | PdfDestination | PdfGroup;
```

### PdfMatrix

Kind: type. Import from `@birchui/document`.

```ts
type PdfMatrix = readonly [number, number, number, number, number, number];
```

### PdfPathCommand

Kind: type. Import from `@birchui/document`.

```ts
type PdfPathCommand =
  | readonly ['M', number, number]
  | readonly ['L', number, number]
  | readonly ['C', number, number, number, number, number, number]
  | readonly ['Z'];
```

### PdfStructType

Kind: type. Import from `@birchui/document`.

```ts
type PdfStructType =
  | 'P'
  | 'H1'
  | 'H2'
  | 'H3'
  | 'H4'
  | 'H5'
  | 'H6'
  | 'L'
  | 'LI'
  | 'Lbl'
  | 'LBody'
  | 'Table'
  | 'TR'
  | 'TH'
  | 'TD'
  | 'Figure'
  | 'Link'
  | 'Note'
  | 'Span'
  | 'TOC'
  | 'TOCI'
  | 'Sect'
  | 'BlockQuote'
  | 'Code';
```

### PdfUnderlineStyle

Kind: type. Import from `@birchui/document`.

```ts
type PdfUnderlineStyle = 'single' | 'double' | 'thick' | 'dotted' | 'dash' | 'dotDash' | 'wave';
```

### ProtectionMode

Kind: type. Import from `@birchui/document`.

```ts
type ProtectionMode = 'readOnly' | 'comments' | 'trackedChanges' | 'forms';
```

### ReadAloudCommand

Kind: type. Import from `@birchui/document`.

```ts
type ReadAloudCommand = 'readAloud';
```

### ReviewCommand

Kind: type. Import from `@birchui/document`.

```ts
type ReviewCommand =
  | 'markupMode'
  | 'acceptChange'
  | 'rejectChange'
  | 'acceptAndNext'
  | 'rejectAndNext'
  | 'acceptShownChanges'
  | 'rejectShownChanges'
  | 'nextChange'
  | 'previousChange'
  | 'revisionsPane'
  | 'compareDialog'
  | 'compareSideBySide'
  | 'closeSideBySide'
  | 'combineDialog'
  | 'saveSnapshot'
  | 'versionHistoryPane';
```

### RevisionChangeKind

Kind: type. Import from `@birchui/document`.

```ts
type RevisionChangeKind =
  | 'insert'
  | 'delete'
  | 'replace'
  | 'format'
  | 'paragraph'
  | 'move'
  | 'tableRow'
  | 'tableCell'
  | 'tableFormat'
  | 'sectionFormat'
  | 'numbering';
```

### RibbonCommand

Kind: type. Import from `@birchui/document`.

```ts
type RibbonCommand =
  | 'cut'
  | 'copy'
  | 'paste'
  | 'toggleRibbon'
  | 'readMode'
  | 'focusMode'
  | 'fitWidth'
  | 'fitPage'
  | 'setTabStops'
  | 'clearTabStops'
  | 'tabsDialog'
  | 'toggleGridlines'
  | 'commandSearch'
  | 'keyboardShortcuts';
```

### RibbonTabName

Kind: type. Import from `@birchui/document`.

```ts
type RibbonTabName = 'home' | 'insert' | 'draw' | 'layout' | 'references' | 'review' | 'view' | (string & {});
```

### SectionBreakType

Kind: type. Import from `@birchui/document`.

```ts
type SectionBreakType = 'nextPage' | 'continuous' | 'evenPage' | 'oddPage' | 'nextColumn';
```

### ShapeKind

Kind: type. Import from `@birchui/document`.

```ts
type ShapeKind = 'rect' | 'roundRect' | 'ellipse' | 'line' | 'arrow' | 'callout';
```

### SourceType

Kind: type. Import from `@birchui/document`.

```ts
type SourceType =
  | 'Book'
  | 'BookSection'
  | 'JournalArticle'
  | 'ArticleInAPeriodical'
  | 'ConferenceProceedings'
  | 'Report'
  | 'InternetSite'
  | 'DocumentFromInternetSite'
  | 'Misc'
  | (string & {});
```

### SpellChecker

Kind: type. Import from `@birchui/document`.

```ts
type SpellChecker = (
  text: string,
  language: string,
) => Promise<readonly SpellingIssue[]> | readonly SpellingIssue[];
```

### TableDirection

Kind: type. Import from `@birchui/document`.

```ts
type TableDirection = 'ABOVE' | 'BELOW' | 'LEFT' | 'RIGHT';
```

### TabStopAlignment

Kind: type. Import from `@birchui/document`.

```ts
type TabStopAlignment = 'left' | 'center' | 'right' | 'decimal' | 'bar';
```

### TabStopLeader

Kind: type. Import from `@birchui/document`.

```ts
type TabStopLeader = 'none' | 'dot' | 'hyphen' | 'underscore';
```

### TextAlignment

Kind: type. Import from `@birchui/document`.

```ts
type TextAlignment = 'left' | 'center' | 'right' | 'justify';
```

### ToolbarItemId

Kind: type. Import from `@birchui/document`.

```ts
type ToolbarItemId =
  | 'undo'
  | 'redo'
  | 'formatPainter'
  | 'paragraphStyle'
  | 'fontFamily'
  | 'fontSize'
  | 'bold'
  | 'italic'
  | 'underline'
  | 'strike'
  | 'superscript'
  | 'subscript'
  | 'textColor'
  | 'highlight'
  | 'clearFormatting'
  | 'alignLeft'
  | 'alignCenter'
  | 'alignRight'
  | 'alignJustify'
  | 'lineSpacing'
  | 'bulletList'
  | 'orderedList'
  | 'outdent'
  | 'indent'
  | 'link'
  | 'image'
  | 'table'
  | 'pageBreak'
  | 'horizontalRule'
  | 'symbol'
  | 'field'
  | 'tableOfContents'
  | 'comment'
  | 'trackChanges'
  | 'showMarkup'
  | 'find'
  | 'pageSetup'
  | 'layout'
  | 'outline'
  | 'zoom'
  | 'print'
  | 'separator';
```

### TrackedChangeKind

Kind: type. Import from `@birchui/document`.

```ts
type TrackedChangeKind = 'insertion' | 'deletion';
```

### UnderlineStyle

Kind: type. Import from `@birchui/document`.

```ts
type UnderlineStyle = (typeof UNDERLINE_STYLES)[number];
```

### ZipLimitCode

Kind: type. Import from `@birchui/document`.

```ts
type ZipLimitCode = 'too-many-entries' | 'entry-too-large' | 'archive-too-large' | 'ratio-too-high';
```

## @birchui/document/collab

### createAuthorityBackend

Kind: function. Import from `@birchui/document/collab`.

```ts
function createAuthorityBackend(authority: CollabAuthority, start: CollabBackendStart = {}): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `authority` | `CollabAuthority` |  |
| `start?` | `CollabBackendStart` |  |

### createBroadcastChannelBackend

Kind: function. Import from `@birchui/document/collab`.

```ts
function createBroadcastChannelBackend(options: CollabBroadcastBackendOptions): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `CollabBroadcastBackendOptions` |  |

### createCollabAuthority

Kind: function. Import from `@birchui/document/collab`.

```ts
function createCollabAuthority(options: CollabAuthorityOptions = {}): CollabAuthority
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options?` | `CollabAuthorityOptions` |  |

### createCollabDocument

Kind: function. Import from `@birchui/document/collab`.

```ts
function createCollabDocument(document?: DocumentInput | null, limits?: Partial<CollabDocumentLimits>): CollabDocument
```

| Parameter | Type | Description |
| --- | --- | --- |
| `document?` | `DocumentInput \| null` |  |
| `limits?` | `Partial<CollabDocumentLimits>` |  |

### createCollabId

Kind: function. Import from `@birchui/document/collab`.

```ts
function createCollabId(prefix = '', random?: () => number): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `prefix?` | `unknown` |  |
| `random?` | `() => number` |  |

### createCollabProvider

Kind: function. Import from `@birchui/document/collab`.

```ts
function createCollabProvider(backend: CollabBackend, options: CollabBackendProviderOptions = {}): CollabBackendProvider
```

| Parameter | Type | Description |
| --- | --- | --- |
| `backend` | `CollabBackend` |  |
| `options?` | `CollabBackendProviderOptions` |  |

### createIndexedDbOfflineStore

Kind: function. Import from `@birchui/document/collab`.

```ts
function createIndexedDbOfflineStore(options: { key: string; database?: string }): CollabOfflineStore
```

Keeps unsent edits in IndexedDB under `key`, which should name the document and the signed-in person, so a tab
that closes while offline finds them again.

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `{ key: string; database?: string }` |  |

### createLoopbackHub

Kind: function. Import from `@birchui/document/collab`.

```ts
function createLoopbackHub(options: LoopbackHubOptions = {}): LoopbackHub
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options?` | `LoopbackHubOptions` |  |

### createMemoryOfflineStore

Kind: function. Import from `@birchui/document/collab`.

```ts
function createMemoryOfflineStore(): CollabOfflineStore
```

### createSocketBackend

Kind: function. Import from `@birchui/document/collab`.

```ts
function createSocketBackend(options: CollabSocketBackendOptions): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `CollabSocketBackendOptions` |  |

### createWireBackend

Kind: function. Import from `@birchui/document/collab`.

```ts
function createWireBackend(link: CollabWireLink, options: CollabWireBackendOptions = {}): CollabBackend
```

| Parameter | Type | Description |
| --- | --- | --- |
| `link` | `CollabWireLink` |  |
| `options?` | `CollabWireBackendOptions` |  |

### createWireEndpoint

Kind: function. Import from `@birchui/document/collab`.

```ts
function createWireEndpoint(authority: CollabAuthority, send: (message: CollabWireMessage) => void): CollabWireEndpoint
```

| Parameter | Type | Description |
| --- | --- | --- |
| `authority` | `CollabAuthority` |  |
| `send` | `(message: CollabWireMessage) => void` |  |

### hostBroadcastChannel

Kind: function. Import from `@birchui/document/collab`.

```ts
function hostBroadcastChannel(authority: CollabAuthority, channel: CollabBroadcastPort | string, options: { hostTimeout?: number } = {}): { close(): void }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `authority` | `CollabAuthority` |  |
| `channel` | `CollabBroadcastPort \| string` |  |
| `options?` | `{ hostTimeout?: number }` |  |

### DEFAULT_COLLAB_LIMITS

Kind: const. Import from `@birchui/document/collab`.

```ts
const DEFAULT_COLLAB_LIMITS: Readonly<CollabDocumentLimits>
```

### CollabApi

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabApi
```

| Property | Type | Description |
| --- | --- | --- |
| `getCollabVersion` | `() => number` |  |
| `getCollabStatus` | `() => CollabStatus` |  |
| `getCollabConnection` | `() => CollabConnectionStatus` |  |
| `saveCollabVersion` | `(name: string) => Promise<CollabVersionInfo \| null>` |  |
| `listCollabVersions` | `() => Promise<CollabVersionInfo[]>` |  |
| `restoreCollabVersion` | `(id: string) => Promise<boolean>` |  |
| `diffCollabVersions` | `(fromId: string, toId: string \| null, options?: CollabVersionDiffOptions) => Promise<DocNodeJSON \| null>` |  |
| `lockRange` | `(range?: { from: number; to: number }) => Promise<CollabLock \| null>` |  |
| `unlockRange` | `(id: string) => void` |  |
| `getLocks` | `() => CollabLock[]` |  |
| `sendableSteps` | `() => CollabStepsPayload \| null` |  |
| `receiveSteps` | `(payload: CollabRemotePayload) => boolean` |  |
| `resetCollab` | `(snapshot: CollabSnapshot) => void` |  |
| `getCollaborators` | `() => Collaborator[]` |  |

### CollabAuthority

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabAuthority
```

| Property | Type | Description |
| --- | --- | --- |
| `join` | `(clientId: CollabClientId, emit: (event: CollabBackendEvent) => void) => CollabAuthorityPeer` |  |
| `version` | `() => number` |  |
| `metaVersion` | `() => number` |  |
| `baseVersion` | `() => number` |  |
| `steps` | `() => CollabLogEntry[]` |  |
| `snapshot` | `() => CollabSnapshot \| null` |  |
| `document` | `() => DocumentData \| null` | The authority's own document at its current version, or null when it runs with `trustClients`. |
| `locks` | `() => CollabLockState` |  |
| `clients` | `() => CollabClientId[]` |  |
| `saveVersion` | `(input: CollabVersionInput, clientId: CollabClientId) => CollabVersionInfo` |  |
| `listVersions` | `() => CollabVersionInfo[]` |  |
| `loadVersion` | `(id: string) => CollabVersionRecord \| null` |  |
| `storedVersions` | `() => CollabStoredVersion[]` | The named versions as they are kept: a full document now and then, and the steps since the previous one otherwise. |
| `destroy` | `() => void` |  |

### CollabAuthorityOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabAuthorityOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `document?` | `DocumentInput \| null` | The document at version 0. Without it, and without `snapshot`, the authority starts from an empty document. |
| `limits?` | `Partial<CollabDocumentLimits>` |  |
| `trustClients?` | `boolean` | Relay steps without applying them. Only for a process where every client is your own code, such as a unit test of a transport: a client can then store any document and move any lock. |
| `snapshot?` | `CollabSnapshot \| null` |  |
| `snapshotEvery?` | `number` |  |
| `retainSteps?` | `number` |  |
| `versions?` | `readonly CollabStoredVersion[] \| null` | Named versions saved earlier, as `storedVersions()` returned them. |
| `now?` | `() => number` |  |
| `createId?` | `() => string` |  |

### CollabAuthorityPeer

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabAuthorityPeer
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly clientId` | `CollabClientId` |  |
| `submit` | `(payload: CollabStepsPayload) => CollabSubmitResult` |  |
| `pull` | `(sinceVersion: number, sinceMeta: number) => void` |  |
| `setPresence` | `(state: PresenceState \| null) => void` |  |
| `sendSnapshot` | `(snapshot: CollabSnapshot) => boolean` |  |
| `acquireLock` | `(request: CollabLockRequest) => CollabLock \| null` |  |
| `releaseLock` | `(id: string) => void` |  |
| `leave` | `() => void` |  |

### CollabBackend

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabBackend
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly clientId` | `CollabClientId` |  |
| `open` | `(emit: (event: CollabBackendEvent) => void) => void` |  |
| `version` | `() => number` |  |
| `metaVersion` | `() => number` |  |
| `submit` | `(payload: CollabStepsPayload) => Promise<CollabSubmitResult>` |  |
| `pull` | `(sinceVersion: number, sinceMeta: number) => void` |  |
| `setPresence?` | `(state: PresenceState \| null) => void` |  |
| `sendSnapshot?` | `(snapshot: CollabSnapshot) => void` |  |
| `locks?` | `Pick<CollabLockChannel, 'acquire' \| 'release'>` |  |
| `versions?` | `CollabVersionChannel` |  |
| `close` | `() => void` |  |

### CollabBackendProvider

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabBackendProvider extends CollabProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `connection` | `() => CollabConnectionStatus` |  |
| `close` | `() => void` |  |
| `version` | `number \| (() => number)` | Inherited from CollabProvider. |
| `metaVersion?` | `number \| (() => number) \| undefined` | Inherited from CollabProvider. |
| `sendSteps` | `(payload: CollabStepsPayload) => CollabSendResult \| Promise<CollabSendResult>` | Inherited from CollabProvider. |
| `onRemoteSteps` | `(handler: (payload: CollabRemotePayload) => void) => () => void` | Inherited from CollabProvider. |
| `requestSteps?` | `((sinceVersion: number, sinceMeta?: number) => void) \| undefined` | Inherited from CollabProvider. |
| `onStatus?` | `((handler: (status: "online" \| "offline") => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onConnection?` | `((handler: (status: CollabConnectionStatus) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onReset?` | `((handler: (snapshot: CollabSnapshot) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `presence?` | `CollabPresenceChannel \| undefined` | Inherited from CollabProvider. |
| `presenceTimeout?` | `number \| undefined` | Inherited from CollabProvider. |
| `comments?` | `CollabCommentChannel \| undefined` | Inherited from CollabProvider. |
| `versions?` | `CollabVersionChannel \| undefined` | Inherited from CollabProvider. |
| `locks?` | `CollabLockChannel \| undefined` | Inherited from CollabProvider. |
| `snapshots?` | `CollabSnapshotChannel \| undefined` | Inherited from CollabProvider. |

### CollabBackendProviderOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabBackendProviderOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `presenceTimeout?` | `number` |  |

### CollabBackendStart

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabBackendStart
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId?` | `CollabClientId` |  |
| `version?` | `number` |  |
| `metaVersion?` | `number` |  |

### CollabBroadcastBackendOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabBroadcastBackendOptions extends CollabWireBackendOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `channel` | `CollabBroadcastPort \| string` |  |
| `hostTimeout?` | `number` |  |
| `room?` | `string \| undefined` | Inherited from CollabWireBackendOptions. |
| `requestTimeout?` | `number \| undefined` | Inherited from CollabWireBackendOptions. |
| `clientId?` | `CollabClientId \| undefined` | Inherited from CollabBackendStart. |
| `version?` | `number \| undefined` | Inherited from CollabBackendStart. |
| `metaVersion?` | `number \| undefined` | Inherited from CollabBackendStart. |

### CollabBroadcastPort

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabBroadcastPort
```

| Property | Type | Description |
| --- | --- | --- |
| `postMessage` | `(message: unknown) => void` |  |
| `addEventListener` | `(type: 'message', listener: (event: { data: unknown }) => void) => void` |  |
| `removeEventListener` | `(type: 'message', listener: (event: { data: unknown }) => void) => void` |  |
| `close?` | `() => void` |  |

### CollabCommentChannel

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabCommentChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(operation: CollabCommentOperation) => void` |  |
| `subscribe` | `(handler: (operation: CollabCommentOperation) => void) => () => void` |  |

### CollabDocument

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabDocument
```

| Property | Type | Description |
| --- | --- | --- |
| `apply` | `(steps: readonly unknown[]) => CollabDocumentResult` |  |
| `prepare` | `(steps: readonly unknown[]) => CollabDocumentPrepared` | Checks the steps against the current document without changing it; `commit()` then makes them current. |
| `checkMetaOperations` | `(operations: readonly CollabMetaOperation[]) => CollabDocumentResult` |  |
| `applyMeta` | `(operations: readonly CollabMetaOperation[]) => CollabDocumentResult` |  |
| `size` | `() => number` |  |
| `snapshot` | `() => DocumentData` |  |

### CollabDocumentLimits

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabDocumentLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxStepsPerSubmit` | `number` |  |
| `maxSubmitBytes` | `number` |  |
| `maxDocumentSize` | `number` |  |
| `maxMetaPerSubmit` | `number` |  |
| `maxCommentLength` | `number` |  |

### CollabEvents

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabEvents
```

| Property | Type | Description |
| --- | --- | --- |
| `collabStatus` | `CollabStatus` |  |
| `collabConnection` | `{ status: CollabConnectionStatus; previous: CollabConnectionStatus }` |  |
| `collabRejected` | `{ reason: CollabRejectReason; steps: number }` |  |
| `collabRestored` | `{ steps: number; version: number }` |  |
| `presenceChange` | `{ collaborators: Collaborator[] }` |  |
| `locksChange` | `{ locks: CollabLock[] }` |  |

### CollabLock

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabLock
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `clientId` | `CollabClientId` |  |
| `name` | `string` |  |
| `from` | `number` |  |
| `to` | `number` |  |

### CollabLockChannel

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabLockChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `acquire` | `(request: CollabLockRequest) => Promise<CollabLock \| null>` |  |
| `release` | `(id: string) => void` |  |
| `subscribe` | `(handler: (state: CollabLockState) => void) => () => void` |  |

### CollabLockRequest

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabLockRequest
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `version` | `number` |  |
| `name?` | `string` |  |

### CollabLockState

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabLockState
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number` |  |
| `locks` | `CollabLock[]` |  |
| `revision?` | `number` |  |

### CollabLogEntry

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabLogEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `step` | `unknown` |  |
| `clientId` | `CollabClientId` |  |

### CollabOfflineRecord

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabOfflineRecord
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number` | The version the unsent steps start from. |
| `document` | `DocNodeJSON` | The document body at `version`, without the unsent steps. |
| `steps` | `unknown[]` |  |
| `clientId` | `CollabClientId` |  |
| `savedAt` | `number` |  |

### CollabOfflineStore

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabOfflineStore
```

| Property | Type | Description |
| --- | --- | --- |
| `load` | `() => CollabOfflineRecord \| null \| Promise<CollabOfflineRecord \| null>` |  |
| `save` | `(record: CollabOfflineRecord) => void \| Promise<void>` |  |
| `clear` | `() => void \| Promise<void>` |  |

### CollabOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `collab?` | `CollabProvider \| null` |  |
| `collabStorage?` | `CollabOfflineStore \| null` | Where edits that have not reached the authority are kept. Without it they live in memory and are lost when the tab closes. `createIndexedDbOfflineStore({ key })` keeps them across a reload. |

### Collaborator

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface Collaborator
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `name` | `string` |  |
| `color` | `string` |  |
| `anchor` | `number \| null` |  |
| `head` | `number \| null` |  |
| `focused` | `boolean` |  |

### CollabPresenceChannel

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabPresenceChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(state: PresenceState) => void` |  |
| `subscribe` | `(handler: (states: Record<string, PresenceState>) => void) => () => void` |  |

### CollabProvider

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number \| (() => number)` |  |
| `clientId?` | `CollabClientId` |  |
| `metaVersion?` | `number \| (() => number)` |  |
| `sendSteps` | `(payload: CollabStepsPayload) => CollabSendResult \| Promise<CollabSendResult>` |  |
| `onRemoteSteps` | `(handler: (payload: CollabRemotePayload) => void) => () => void` |  |
| `requestSteps?` | `(sinceVersion: number, sinceMeta?: number) => void` |  |
| `onStatus?` | `(handler: (status: 'online' \| 'offline') => void) => () => void` |  |
| `onConnection?` | `(handler: (status: CollabConnectionStatus) => void) => () => void` |  |
| `onReset?` | `(handler: (snapshot: CollabSnapshot) => void) => () => void` |  |
| `presence?` | `CollabPresenceChannel` |  |
| `presenceTimeout?` | `number` |  |
| `comments?` | `CollabCommentChannel` |  |
| `versions?` | `CollabVersionChannel` |  |
| `locks?` | `CollabLockChannel` |  |
| `snapshots?` | `CollabSnapshotChannel` |  |

### CollabRemotePayload

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabRemotePayload
```

| Property | Type | Description |
| --- | --- | --- |
| `steps` | `unknown[]` |  |
| `clientIds` | `CollabClientId[]` |  |
| `version?` | `number` |  |
| `meta?` | `CollabMetaOperation[]` |  |
| `metaClientId?` | `CollabClientId` |  |
| `metaVersion?` | `number` |  |
| `metaClientIds?` | `CollabClientId[]` |  |

### CollabSnapshot

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabSnapshot
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentInput` |  |
| `version` | `number` |  |
| `metaVersion?` | `number` |  |

### CollabSnapshotChannel

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabSnapshotChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(snapshot: CollabSnapshot) => void` |  |
| `subscribe` | `(handler: () => void) => () => void` |  |

### CollabSocketBackendOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabSocketBackendOptions extends CollabWireBackendOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `connect` | `() => CollabSocketLike` |  |
| `reconnectMin?` | `number` |  |
| `reconnectMax?` | `number` |  |
| `maxAttempts?` | `number` |  |
| `heartbeat?` | `number` |  |
| `room?` | `string \| undefined` | Inherited from CollabWireBackendOptions. |
| `requestTimeout?` | `number \| undefined` | Inherited from CollabWireBackendOptions. |
| `clientId?` | `CollabClientId \| undefined` | Inherited from CollabBackendStart. |
| `version?` | `number \| undefined` | Inherited from CollabBackendStart. |
| `metaVersion?` | `number \| undefined` | Inherited from CollabBackendStart. |

### CollabSocketLike

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabSocketLike
```

| Property | Type | Description |
| --- | --- | --- |
| `readyState` | `number` |  |
| `send` | `(data: string) => void` |  |
| `close` | `(code?: number, reason?: string) => void` |  |
| `addEventListener` | `(type: 'open' \| 'message' \| 'close' \| 'error', listener: (event: { data?: unknown; type?: string }) => void) => void` |  |

### CollabStatus

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabStatus
```

| Property | Type | Description |
| --- | --- | --- |
| `state` | `CollabState` |  |
| `version` | `number` |  |
| `unconfirmed` | `number` |  |
| `clientId` | `CollabClientId \| null` |  |
| `online` | `boolean` |  |
| `connection` | `CollabConnectionStatus` |  |

### CollabStepFootprint

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabStepFootprint
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `map` | `number[]` |  |

### CollabStepsPayload

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabStepsPayload
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `number` |  |
| `steps` | `unknown[]` |  |
| `clientId` | `CollabClientId` |  |
| `meta?` | `CollabMetaOperation[]` |  |
| `footprint?` | `CollabStepFootprint[]` |  |

### CollabSubmitResult

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabSubmitResult
```

| Property | Type | Description |
| --- | --- | --- |
| `accepted` | `boolean` |  |
| `version?` | `number` |  |
| `reason?` | `CollabRejectReason` |  |
| `detail?` | `string` |  |

### CollabVersionChannel

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionChannel
```

| Property | Type | Description |
| --- | --- | --- |
| `save` | `(input: CollabVersionInput) => Promise<CollabVersionInfo>` |  |
| `list` | `() => Promise<CollabVersionInfo[]>` |  |
| `load` | `(id: string) => Promise<CollabVersionRecord \| null>` |  |

### CollabVersionDelta

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionDelta extends CollabVersionInfo
```

A version kept as the steps and document updates made since the version named by `parent`.

| Property | Type | Description |
| --- | --- | --- |
| `metaVersion` | `number` |  |
| `parent` | `string` |  |
| `steps` | `unknown[]` |  |
| `meta` | `CollabVersionMetaEntry[]` |  |
| `id` | `string` | Inherited from CollabVersionInfo. |
| `name` | `string` | Inherited from CollabVersionInfo. |
| `createdAt` | `string` | Inherited from CollabVersionInfo. |
| `author` | `string` | Inherited from CollabVersionInfo. |
| `clientId` | `CollabClientId` | Inherited from CollabVersionInfo. |
| `version` | `number` | Inherited from CollabVersionInfo. |

### CollabVersionDiffOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionDiffOptions extends CompareOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `idPrefix?` | `string` |  |
| `author?` | `string \| undefined` | Inherited from CompareOptions. |
| `date?` | `string \| undefined` | Inherited from CompareOptions. |
| `granularity?` | `"word" \| "character" \| undefined` | Inherited from CompareOptions. |
| `moves?` | `boolean \| undefined` | Inherited from CompareOptions. |
| `formatting?` | `boolean \| undefined` | Inherited from CompareOptions. |

### CollabVersionInfo

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `createdAt` | `string` |  |
| `author` | `string` |  |
| `clientId` | `CollabClientId` |  |
| `version` | `number` |  |

### CollabVersionInput

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionInput
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `author` | `string` |  |
| `version` | `number` |  |
| `document` | `DocumentInput` |  |

### CollabVersionMetaEntry

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionMetaEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `at` | `number` | The step version the operation was applied at. |
| `operation` | `CollabMetaOperation` |  |

### CollabVersionRecord

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionRecord extends CollabVersionInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentInput` |  |
| `id` | `string` | Inherited from CollabVersionInfo. |
| `name` | `string` | Inherited from CollabVersionInfo. |
| `createdAt` | `string` | Inherited from CollabVersionInfo. |
| `author` | `string` | Inherited from CollabVersionInfo. |
| `clientId` | `CollabClientId` | Inherited from CollabVersionInfo. |
| `version` | `number` | Inherited from CollabVersionInfo. |

### CollabVersionSnapshot

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabVersionSnapshot extends CollabVersionRecord
```

| Property | Type | Description |
| --- | --- | --- |
| `metaVersion?` | `number` |  |
| `document` | `DocumentInput` | Inherited from CollabVersionRecord. |
| `id` | `string` | Inherited from CollabVersionInfo. |
| `name` | `string` | Inherited from CollabVersionInfo. |
| `createdAt` | `string` | Inherited from CollabVersionInfo. |
| `author` | `string` | Inherited from CollabVersionInfo. |
| `clientId` | `CollabClientId` | Inherited from CollabVersionInfo. |
| `version` | `number` | Inherited from CollabVersionInfo. |

### CollabWireBackendOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabWireBackendOptions extends CollabBackendStart
```

| Property | Type | Description |
| --- | --- | --- |
| `room?` | `string` |  |
| `requestTimeout?` | `number` |  |
| `clientId?` | `CollabClientId \| undefined` | Inherited from CollabBackendStart. |
| `version?` | `number \| undefined` | Inherited from CollabBackendStart. |
| `metaVersion?` | `number \| undefined` | Inherited from CollabBackendStart. |

### CollabWireEndpoint

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabWireEndpoint
```

| Property | Type | Description |
| --- | --- | --- |
| `receive` | `(message: CollabWireMessage) => void` |  |
| `close` | `() => void` |  |

### CollabWireLink

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface CollabWireLink
```

| Property | Type | Description |
| --- | --- | --- |
| `send` | `(message: CollabWireMessage) => boolean` |  |
| `open` | `(handlers: { message(message: CollabWireMessage): void; status(status: CollabConnectionStatus): void }) => void` |  |
| `close` | `() => void` |  |

### LoopbackConnection

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface LoopbackConnection extends CollabProvider
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `version` | `() => number` |  |
| `metaVersion` | `() => number` |  |
| `requestSteps` | `(sinceVersion: number, sinceMeta?: number) => void` |  |
| `presence` | `CollabPresenceChannel` |  |
| `comments` | `CollabCommentChannel` |  |
| `versions` | `CollabVersionChannel` |  |
| `locks` | `CollabLockChannel` |  |
| `snapshots` | `CollabSnapshotChannel` |  |
| `setOnline` | `(online: boolean) => void` |  |
| `setConnection` | `(status: CollabConnectionStatus) => void` |  |
| `isOnline` | `() => boolean` |  |
| `reset` | `(snapshot: CollabSnapshot) => void` |  |
| `disconnect` | `() => void` |  |
| `sendSteps` | `(payload: CollabStepsPayload) => CollabSendResult \| Promise<CollabSendResult>` | Inherited from CollabProvider. |
| `onRemoteSteps` | `(handler: (payload: CollabRemotePayload) => void) => () => void` | Inherited from CollabProvider. |
| `onStatus?` | `((handler: (status: "online" \| "offline") => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onConnection?` | `((handler: (status: CollabConnectionStatus) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `onReset?` | `((handler: (snapshot: CollabSnapshot) => void) => () => void) \| undefined` | Inherited from CollabProvider. |
| `presenceTimeout?` | `number \| undefined` | Inherited from CollabProvider. |

### LoopbackHub

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface LoopbackHub
```

| Property | Type | Description |
| --- | --- | --- |
| `connect` | `(clientId: CollabClientId) => LoopbackConnection` |  |
| `version` | `() => number` |  |
| `getDocumentSteps` | `() => { step: unknown; clientId: CollabClientId }[]` |  |
| `authority` | `() => CollabAuthority` |  |
| `pending` | `() => number` |  |
| `step` | `() => boolean` |  |
| `flush` | `(limit?: number) => number` |  |
| `destroy` | `() => void` |  |

### LoopbackHubOptions

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface LoopbackHubOptions extends CollabAuthorityOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `latency?` | `number` |  |
| `jitter?` | `number` |  |
| `dropRate?` | `number` |  |
| `manual?` | `boolean` |  |
| `random?` | `() => number` |  |
| `document?` | `DocumentInput \| null \| undefined` | The document at version 0. Without it, and without `snapshot`, the authority starts from an empty document. Inherited from CollabAuthorityOptions. |
| `limits?` | `Partial<CollabDocumentLimits> \| undefined` | Inherited from CollabAuthorityOptions. |
| `trustClients?` | `boolean \| undefined` | Relay steps without applying them. Only for a process where every client is your own code, such as a unit test of a transport: a client can then store any document and move any lock. Inherited from CollabAuthorityOptions. |
| `snapshot?` | `CollabSnapshot \| null \| undefined` | Inherited from CollabAuthorityOptions. |
| `snapshotEvery?` | `number \| undefined` | Inherited from CollabAuthorityOptions. |
| `retainSteps?` | `number \| undefined` | Inherited from CollabAuthorityOptions. |
| `versions?` | `readonly CollabStoredVersion[] \| null \| undefined` | Named versions saved earlier, as `storedVersions()` returned them. Inherited from CollabAuthorityOptions. |
| `now?` | `(() => number) \| undefined` | Inherited from CollabAuthorityOptions. |
| `createId?` | `(() => string) \| undefined` | Inherited from CollabAuthorityOptions. |

### PresenceState

Kind: interface. Import from `@birchui/document/collab`.

```ts
interface PresenceState
```

| Property | Type | Description |
| --- | --- | --- |
| `clientId` | `CollabClientId` |  |
| `name` | `string` |  |
| `color?` | `string` |  |
| `anchor` | `number \| null` |  |
| `head` | `number \| null` |  |
| `focused` | `boolean` |  |
| `clock?` | `number` |  |

### CollabBackendEvent

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabBackendEvent =
  | { type: 'connection'; status: CollabConnectionStatus }
  | { type: 'steps'; payload: CollabRemotePayload }
  | { type: 'reset'; snapshot: CollabSnapshot }
  | { type: 'presence'; states: Record<string, PresenceState> }
  | { type: 'locks'; state: CollabLockState }
  | { type: 'snapshotRequest' };
```

### CollabClientId

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabClientId = string | number;
```

### CollabCommand

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabCommand = never;
```

### CollabCommentOperation

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabCommentOperation =
  | { type: 'add'; thread: CommentThread }
  | { type: 'reply'; id: string; reply: CommentReply }
  | { type: 'edit'; id: string; text: string }
  | { type: 'resolve'; id: string; resolved: boolean }
  | { type: 'delete'; id: string }
  | { type: 'editReply'; id: string; replyId: string; text: string }
  | { type: 'deleteReply'; id: string; replyId: string };
```

### CollabConnectionStatus

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabConnectionStatus = 'connected' | 'reconnecting' | 'offline';
```

### CollabDocumentPrepared

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabDocumentPrepared =
  { ok: true; footprint: CollabStepFootprint[]; commit(): void } | { ok: false; reason: string };
```

The authority's own copy of the document. Steps are applied to it, and a step that does not apply is refused.

### CollabDocumentResult

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabDocumentResult = { ok: true; footprint: CollabStepFootprint[] } | { ok: false; reason: string };
```

### CollabMetaOperation

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabMetaOperation =
  | { type: 'pageSetup'; page: PageSetup }
  | { type: 'headerFooter'; parts: HeaderFooterContent }
  | { type: 'comment'; operation: CollabCommentOperation };
```

### CollabRejectReason

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabRejectReason = 'stale' | 'locked' | 'offline' | 'invalid';
```

### CollabSendResult

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabSendResult = void | boolean | CollabSubmitResult;
```

### CollabState

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabState = 'disabled' | 'synced' | 'pending' | 'offline' | 'desynced';
```

### CollabStoredVersion

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabStoredVersion = CollabVersionSnapshot | CollabVersionDelta;
```

### CollabWireMessage

Kind: type. Import from `@birchui/document/collab`.

```ts
type CollabWireMessage = { type: string } & Record<string, unknown>;
```

## @birchui/document/docx

### buildDocxParts

Kind: function. Import from `@birchui/document/docx`.

```ts
function buildDocxParts(input: DocumentData, options: DocxWriteOptions = {}): ZipInputFile[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentData` |  |
| `options?` | `DocxWriteOptions` |  |

### detectFileType

Kind: function. Import from `@birchui/document/docx`.

```ts
function detectFileType(input: FileTypeInput): FileTypeInfo
```

The type of an embedded file. The ProgID is asked first, then the file name, then the content type and the
extension of the part, and last the leading bytes.

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `FileTypeInput` |  |

### documentToDocx

Kind: function. Import from `@birchui/document/docx`.

```ts
function documentToDocx(data: DocumentData, options: DocxWriteOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `DocumentData` |  |
| `options?` | `DocxWriteOptions` |  |

### docxToDocument

Kind: function. Import from `@birchui/document/docx`.

```ts
function docxToDocument(input: Uint8Array | ArrayBuffer | Blob, options: DocxReadOptions = {}): Promise<DocumentData>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `DocxReadOptions` |  |

### embeddedObjectFile

Kind: function. Import from `@birchui/document/docx`.

```ts
function embeddedObjectFile(attrs: Attrs): EmbeddedObjectFile
```

| Parameter | Type | Description |
| --- | --- | --- |
| `attrs` | `Attrs` |  |

### embeddedObjectNode

Kind: function. Import from `@birchui/document/docx`.

```ts
function embeddedObjectNode(input: EmbeddedObjectInput): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `EmbeddedObjectInput` |  |

### embeddedObjectType

Kind: function. Import from `@birchui/document/docx`.

```ts
function embeddedObjectType(attrs: Attrs): FileTypeInfo
```

The file type of an `embedded_object` node, from its ProgID, file name, content type and bytes, in that order.

| Parameter | Type | Description |
| --- | --- | --- |
| `attrs` | `Attrs` |  |

### fileIconSvg

Kind: function. Import from `@birchui/document/docx`.

```ts
function fileIconSvg(type: Pick<FileTypeInfo, 'kind' | 'badge'>, options: FileIconSvgOptions = {}): string
```

A standalone SVG picture of the icon of a file type, with the badge as text.

| Parameter | Type | Description |
| --- | --- | --- |
| `type` | `Pick<FileTypeInfo, 'kind' \| 'badge'>` |  |
| `options?` | `FileIconSvgOptions` |  |

### fileTypeLabel

Kind: function. Import from `@birchui/document/docx`.

```ts
function fileTypeLabel(label: FileTypeLabel, translate?: FileTypeTranslate): string
```

The name of a file type as it reads inside a sentence: "PDF document", "image".

| Parameter | Type | Description |
| --- | --- | --- |
| `label` | `FileTypeLabel` |  |
| `translate?` | `FileTypeTranslate` |  |

### metafileToSvg

Kind: function. Import from `@birchui/document/docx`.

```ts
function metafileToSvg(bytes: Uint8Array, options: MetafileOptions = {}): string | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `options?` | `MetafileOptions` |  |

### readDocx

Kind: function. Import from `@birchui/document/docx`.

```ts
function readDocx(input: Uint8Array | ArrayBuffer | Blob, options: DocxReadOptions = {}): Promise<DocxReadResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `DocxReadOptions` |  |

### validateDocxPackage

Kind: function. Import from `@birchui/document/docx`.

```ts
function validateDocxPackage(bytes: Uint8Array | ArrayBuffer, options: { limits?: Partial<ZipLimits> } = {}): Promise<DocxValidationResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array \| ArrayBuffer` |  |
| `options?` | `{ limits?: Partial<ZipLimits> }` |  |

### validateDocxParts

Kind: function. Import from `@birchui/document/docx`.

```ts
function validateDocxParts(files: Map<string, Uint8Array>): DocxValidationResult
```

| Parameter | Type | Description |
| --- | --- | --- |
| `files` | `Map<string, Uint8Array>` |  |

### DocumentFormatError

Kind: class. Import from `@birchui/document/docx`.

```ts
class DocumentFormatError extends Error
new DocumentFormatError(readonly code: DocumentFormatCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"DocumentFormatError"` |  |
| `readonly code` | `DocumentFormatCode` |  |

### ZipLimitError

Kind: class. Import from `@birchui/document/docx`.

```ts
class ZipLimitError extends Error
new ZipLimitError(code: ZipLimitCode, message: string, detail: { limit: number; actual: number; entryName?: string })
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly code` | `ZipLimitCode` |  |
| `readonly limit` | `number` |  |
| `readonly actual` | `number` |  |
| `readonly entryName` | `string \| undefined` |  |

### DEFAULT_ZIP_LIMITS

Kind: const. Import from `@birchui/document/docx`.

```ts
const DEFAULT_ZIP_LIMITS: Readonly<ZipLimits>
```

### DOCX_MIME

Kind: const. Import from `@birchui/document/docx`.

```ts
const DOCX_MIME: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
```

### DocxImportFeature

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxImportFeature
```

| Property | Type | Description |
| --- | --- | --- |
| `feature` | `string` |  |
| `count` | `number` |  |
| `note?` | `string` |  |

### DocxImportReport

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxImportReport
```

| Property | Type | Description |
| --- | --- | --- |
| `modelled` | `DocxImportFeature[]` |  |
| `preserved` | `DocxImportFeature[]` |  |
| `dropped` | `DocxImportFeature[]` |  |

### DocxPageMap

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxPageMap
```

| Property | Type | Description |
| --- | --- | --- |
| `bookmarks?` | `Readonly<Record<string, number>>` |  |
| `headings?` | `readonly number[]` |  |
| `headerFooter?` | `Readonly<Partial<Record<'default' \| 'first' \| 'even', number>>>` |  |

### DocxReadOptions

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxReadOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<ZipLimits>` | Caps on the archive: entry count, inflated size of one entry, total inflated size and compression ratio. |

### DocxReadResult

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxReadResult
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentData` |  |
| `warnings` | `string[]` |  |
| `report` | `DocxImportReport` |  |

### DocxValidationIssue

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxValidationIssue
```

| Property | Type | Description |
| --- | --- | --- |
| `severity` | `'error' \| 'warning'` |  |
| `code` | `string` |  |
| `part` | `string` |  |
| `message` | `string` |  |

### DocxValidationResult

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxValidationResult
```

| Property | Type | Description |
| --- | --- | --- |
| `ok` | `boolean` |  |
| `issues` | `DocxValidationIssue[]` |  |

### DocxWriteOptions

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface DocxWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `trackRevisions?` | `boolean` |  |
| `zoom?` | `number` |  |
| `pageCount?` | `number` |  |
| `pages?` | `DocxPageMap` |  |
| `compress?` | `boolean` |  |
| `now?` | `Date` |  |
| `preserveSource?` | `boolean \| 'exact'` |  |

### EmbeddedObjectFile

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface EmbeddedObjectFile
```

| Property | Type | Description |
| --- | --- | --- |
| `fileName` | `string` |  |
| `mimeType` | `string` |  |
| `progId` | `string` |  |
| `data` | `Uint8Array` |  |

### EmbeddedObjectInput

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface EmbeddedObjectInput
```

| Property | Type | Description |
| --- | --- | --- |
| `data` | `Uint8Array \| ArrayBuffer` |  |
| `fileName` | `string` |  |
| `mimeType?` | `string` |  |
| `asIcon?` | `boolean` |  |
| `icon?` | `string` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |

### FileIconSvgOptions

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface FileIconSvgOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `width?` | `number` |  |
| `height?` | `number` |  |
| `title?` | `string` |  |

### FileTypeInfo

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface FileTypeInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `FileKind` |  |
| `label` | `FileTypeLabel` |  |
| `extension` | `string` | Lower-case extension without the dot; empty when nothing is known. |
| `badge` | `string` | Up to four upper-case characters for the icon. |
| `mimeType` | `string` |  |
| `source` | `FileTypeSource` |  |

### FileTypeInput

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface FileTypeInput
```

| Property | Type | Description |
| --- | --- | --- |
| `progId?` | `string \| null` |  |
| `fileName?` | `string \| null` |  |
| `mimeType?` | `string \| null` |  |
| `partName?` | `string \| null` |  |
| `data?` | `Uint8Array \| null` |  |

### MetafileOptions

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface MetafileOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `embeddedEmf?` | `boolean` |  |

### UnzipOptions

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface UnzipOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<ZipLimits>` |  |

### ZipLimits

Kind: interface. Import from `@birchui/document/docx`.

```ts
interface ZipLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxEntries` | `number` |  |
| `maxEntryBytes` | `number` |  |
| `maxTotalBytes` | `number` |  |
| `maxRatio` | `number` |  |

### DocumentFormatCode

Kind: type. Import from `@birchui/document/docx`.

```ts
type DocumentFormatCode =
  'encrypted-or-legacy-doc' | 'encrypted-entry' | 'not-a-zip' | 'not-a-word-document' | 'xml-too-deep';
```

### FileKind

Kind: type. Import from `@birchui/document/docx`.

```ts
type FileKind =
  'word' | 'excel' | 'powerpoint' | 'pdf' | 'email' | 'image' | 'text' | 'archive' | 'media' | 'file';
```

### FileTypeLabel

Kind: type. Import from `@birchui/document/docx`.

```ts
type FileTypeLabel =
  | 'word'
  | 'excel'
  | 'powerpoint'
  | 'document'
  | 'spreadsheet'
  | 'presentation'
  | 'pdf'
  | 'outlook'
  | 'email'
  | 'image'
  | 'text'
  | 'csv'
  | 'archive'
  | 'audio'
  | 'video'
  | 'file';
```

### FileTypeSource

Kind: type. Import from `@birchui/document/docx`.

```ts
type FileTypeSource = 'progId' | 'fileName' | 'contentType' | 'content' | 'none';
```

### ZipLimitCode

Kind: type. Import from `@birchui/document/docx`.

```ts
type ZipLimitCode = 'too-many-entries' | 'entry-too-large' | 'archive-too-large' | 'ratio-too-high';
```

## @birchui/document/formats

### docToDocument

Kind: function. Import from `@birchui/document/formats`.

```ts
function docToDocument(input: Uint8Array | ArrayBuffer, options: DocReadOptions = {}): DocumentData
```

Reads a Word 97–2003 binary document (.doc). Every failure is a {@link DocFormatError}; hostile
or damaged input never reads outside the file and stays within `limits`.

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer` |  |
| `options?` | `DocReadOptions` |  |

### documentToHtml

Kind: function. Import from `@birchui/document/formats`.

```ts
function documentToHtml(input: DocumentInput, options: HtmlDocumentOptions = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `HtmlDocumentOptions` |  |

### documentToMarkdown

Kind: function. Import from `@birchui/document/formats`.

```ts
function documentToMarkdown(input: DocumentInput, options: MarkdownOptions = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `MarkdownOptions` |  |

### documentToOdt

Kind: function. Import from `@birchui/document/formats`.

```ts
function documentToOdt(input: DocumentInput): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |

### htmlToDocument

Kind: function. Import from `@birchui/document/formats`.

```ts
function htmlToDocument(html: string): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `html` | `string` |  |

### markdownToDocument

Kind: function. Import from `@birchui/document/formats`.

```ts
function markdownToDocument(markdown: string): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `markdown` | `string` |  |

### odtToDocument

Kind: function. Import from `@birchui/document/formats`.

```ts
function odtToDocument(input: Uint8Array | ArrayBuffer | Blob, options: { limits?: Partial<ZipLimits> } = {}): Promise<DocumentData>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `{ limits?: Partial<ZipLimits> }` |  |

### rtfToDocument

Kind: function. Import from `@birchui/document/formats`.

```ts
function rtfToDocument(input: string | Uint8Array | ArrayBuffer): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `string \| Uint8Array \| ArrayBuffer` |  |

### DocFormatError

Kind: class. Import from `@birchui/document/formats`.

```ts
class DocFormatError extends Error
new DocFormatError(readonly code: DocFormatCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"DocFormatError"` |  |
| `readonly code` | `DocFormatCode` |  |

### DEFAULT_DOC_LIMITS

Kind: const. Import from `@birchui/document/formats`.

```ts
const DEFAULT_DOC_LIMITS: Readonly<DocLimits>
```

### ODT_MIME

Kind: const. Import from `@birchui/document/formats`.

```ts
const ODT_MIME: "application/vnd.oasis.opendocument.text" = 'application/vnd.oasis.opendocument.text'
```

### DocLimits

Kind: interface. Import from `@birchui/document/formats`.

```ts
interface DocLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxBytes` | `number` | Largest file that is read at all, in bytes. |
| `maxCharacters` | `number` | Largest number of characters in the body of the document. |
| `maxPictureBytes` | `number` | Total size of the pictures that are kept, in bytes. Pictures past it are left out. |
| `maxTableCells` | `number` | Largest number of cells in one table. A table past it is read as paragraphs. |

### DocReadOptions

Kind: interface. Import from `@birchui/document/formats`.

```ts
interface DocReadOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<DocLimits>` |  |

### HtmlDocumentOptions

Kind: interface. Import from `@birchui/document/formats`.

```ts
interface HtmlDocumentOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fullDocument?` | `boolean` |  |
| `title?` | `string` |  |
| `includeDeleted?` | `boolean` |  |
| `linkSchemes?` | `readonly string[]` | Schemes written as links that can be followed, besides `http`, `https`, `mailto` and `tel`. |

### MarkdownOptions

Kind: interface. Import from `@birchui/document/formats`.

```ts
interface MarkdownOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `includeDeleted?` | `boolean` |  |

### DocFormatCode

Kind: type. Import from `@birchui/document/formats`.

```ts
type DocFormatCode =
  'not-a-doc' | 'encrypted' | 'unsupported-version' | 'too-large' | 'too-many-characters' | 'corrupt';
```

## @birchui/document/headless

### acceptAllRevisions

Kind: function. Import from `@birchui/document/headless`.

```ts
function acceptAllRevisions(doc: DocNodeJSON): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### breakGaps

Kind: function. Import from `@birchui/document/headless`.

```ts
function breakGaps(breaks: readonly LayoutBreak[], pageStride: number): number[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `breaks` | `readonly LayoutBreak[]` |  |
| `pageStride` | `number` |  |

### buildDocxParts

Kind: function. Import from `@birchui/document/headless`.

```ts
function buildDocxParts(input: DocumentData, options: DocxWriteOptions = {}): ZipInputFile[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentData` |  |
| `options?` | `DocxWriteOptions` |  |

### clearRegisteredFonts

Kind: function. Import from `@birchui/document/headless`.

```ts
function clearRegisteredFonts(): void
```

### combineDocuments

Kind: function. Import from `@birchui/document/headless`.

```ts
function combineDocuments(original: DocNodeJSON, first: DocNodeJSON, second: DocNodeJSON, options: CombineOptions = {}): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `original` | `DocNodeJSON` |  |
| `first` | `DocNodeJSON` |  |
| `second` | `DocNodeJSON` |  |
| `options?` | `CombineOptions` |  |

### compareDocuments

Kind: function. Import from `@birchui/document/headless`.

```ts
function compareDocuments(original: DocNodeJSON, revised: DocNodeJSON, options: CompareOptions & { idPrefix?: string } = {}): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `original` | `DocNodeJSON` |  |
| `revised` | `DocNodeJSON` |  |
| `options?` | `CompareOptions & { idPrefix?: string }` |  |

### contentBox

Kind: function. Import from `@birchui/document/headless`.

```ts
function contentBox(setup: PageSetup): { width: number; height: number }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `setup` | `PageSetup` |  |

### countRevisions

Kind: function. Import from `@birchui/document/headless`.

```ts
function countRevisions(doc: DocNodeJSON): number
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### detectFileType

Kind: function. Import from `@birchui/document/headless`.

```ts
function detectFileType(input: FileTypeInput): FileTypeInfo
```

The type of an embedded file. The ProgID is asked first, then the file name, then the content type and the
extension of the part, and last the leading bytes.

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `FileTypeInput` |  |

### docToDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function docToDocument(input: Uint8Array | ArrayBuffer, options: DocReadOptions = {}): DocumentData
```

Reads a Word 97–2003 binary document (.doc). Every failure is a {@link DocFormatError}; hostile
or damaged input never reads outside the file and stays within `limits`.

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer` |  |
| `options?` | `DocReadOptions` |  |

### documentSections

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentSections(data: Pick<DocumentData, 'content' | 'page'> & Partial<DocumentData>): DocumentSection[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `Pick<DocumentData, 'content' \| 'page'> & Partial<DocumentData>` |  |

### documentText

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentText(doc: DocNodeJSON, options: { skipDeleted?: boolean } = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |
| `options?` | `{ skipDeleted?: boolean }` |  |

### documentToDocx

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentToDocx(data: DocumentData, options: DocxWriteOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `DocumentData` |  |
| `options?` | `DocxWriteOptions` |  |

### documentToHtml

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentToHtml(input: DocumentInput, options: HtmlDocumentOptions = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `HtmlDocumentOptions` |  |

### documentToMarkdown

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentToMarkdown(input: DocumentInput, options: MarkdownOptions = {}): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `MarkdownOptions` |  |

### documentToOdt

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentToOdt(input: DocumentInput): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |

### documentToPdf

Kind: function. Import from `@birchui/document/headless`.

```ts
function documentToPdf(input: DocumentInput, options: DocumentPdfOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### docxToDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function docxToDocument(input: Uint8Array | ArrayBuffer | Blob, options: DocxReadOptions = {}): Promise<DocumentData>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `DocxReadOptions` |  |

### embeddedObjectFile

Kind: function. Import from `@birchui/document/headless`.

```ts
function embeddedObjectFile(attrs: Attrs): EmbeddedObjectFile
```

| Parameter | Type | Description |
| --- | --- | --- |
| `attrs` | `Attrs` |  |

### embeddedObjectNode

Kind: function. Import from `@birchui/document/headless`.

```ts
function embeddedObjectNode(input: EmbeddedObjectInput): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `EmbeddedObjectInput` |  |

### embeddedObjectType

Kind: function. Import from `@birchui/document/headless`.

```ts
function embeddedObjectType(attrs: Attrs): FileTypeInfo
```

The file type of an `embedded_object` node, from its ProgID, file name, content type and bytes, in that order.

| Parameter | Type | Description |
| --- | --- | --- |
| `attrs` | `Attrs` |  |

### emptyDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function emptyDocument(): DocumentData
```

### fileIconSvg

Kind: function. Import from `@birchui/document/headless`.

```ts
function fileIconSvg(type: Pick<FileTypeInfo, 'kind' | 'badge'>, options: FileIconSvgOptions = {}): string
```

A standalone SVG picture of the icon of a file type, with the badge as text.

| Parameter | Type | Description |
| --- | --- | --- |
| `type` | `Pick<FileTypeInfo, 'kind' \| 'badge'>` |  |
| `options?` | `FileIconSvgOptions` |  |

### fileTypeLabel

Kind: function. Import from `@birchui/document/headless`.

```ts
function fileTypeLabel(label: FileTypeLabel, translate?: FileTypeTranslate): string
```

The name of a file type as it reads inside a sentence: "PDF document", "image".

| Parameter | Type | Description |
| --- | --- | --- |
| `label` | `FileTypeLabel` |  |
| `translate?` | `FileTypeTranslate` |  |

### findMatches

Kind: function. Import from `@birchui/document/headless`.

```ts
function findMatches(blocks: readonly SearchBlock[], query: string, options: FindOptions = {}): SearchMatch[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `blocks` | `readonly SearchBlock[]` |  |
| `query` | `string` |  |
| `options?` | `FindOptions` |  |

### fontFamilyStack

Kind: function. Import from `@birchui/document/headless`.

```ts
function fontFamilyStack(fontFamily: string): string
```

A CSS font-family list that puts the metric-compatible substitutes right after each requested family.

| Parameter | Type | Description |
| --- | --- | --- |
| `fontFamily` | `string` |  |

### fontSubstitutes

Kind: function. Import from `@birchui/document/headless`.

```ts
function fontSubstitutes(family: string): readonly string[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |

### formatDatePicture

Kind: function. Import from `@birchui/document/headless`.

```ts
function formatDatePicture(date: Date, picture: string): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `date` | `Date` |  |
| `picture` | `string` |  |

### formatNumber

Kind: function. Import from `@birchui/document/headless`.

```ts
function formatNumber(value: number, format: string): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `number` |  |
| `format` | `string` |  |

### htmlToDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function htmlToDocument(html: string): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `html` | `string` |  |

### imageSourceKind

Kind: function. Import from `@birchui/document/headless`.

```ts
function imageSourceKind(value: unknown): ImageSourceKind
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |

### layoutDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function layoutDocument(input: DocumentInput, options: DocumentPdfOptions = {}): { layout: PdfDocumentLayout; warnings: string[]; missingFonts: string[] }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### layoutToPdf

Kind: function. Import from `@birchui/document/headless`.

```ts
function layoutToPdf(layout: PdfDocumentLayout, options: PdfWriteOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `layout` | `PdfDocumentLayout` |  |
| `options?` | `PdfWriteOptions` |  |

### markdownToDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function markdownToDocument(markdown: string): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `markdown` | `string` |  |

### markMoves

Kind: function. Import from `@birchui/document/headless`.

```ts
function markMoves(doc: DocNodeJSON): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### mergeContent

Kind: function. Import from `@birchui/document/headless`.

```ts
function mergeContent(doc: DocNodeJSON, values: MergeValues, options: MergeOptions = {}): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |
| `values` | `MergeValues` |  |
| `options?` | `MergeOptions` |  |

### mergeDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function mergeDocument(data: DocumentData, values: MergeValues, options: MergeOptions = {}): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | `DocumentData` |  |
| `values` | `MergeValues` |  |
| `options?` | `MergeOptions` |  |

### mergeFieldNames

Kind: function. Import from `@birchui/document/headless`.

```ts
function mergeFieldNames(doc: DocNodeJSON): string[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### metafileToSvg

Kind: function. Import from `@birchui/document/headless`.

```ts
function metafileToSvg(bytes: Uint8Array, options: MetafileOptions = {}): string | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `options?` | `MetafileOptions` |  |

### multiplyMatrix

Kind: function. Import from `@birchui/document/headless`.

```ts
function multiplyMatrix(first: PdfMatrix, second: PdfMatrix): PdfMatrix
```

| Parameter | Type | Description |
| --- | --- | --- |
| `first` | `PdfMatrix` |  |
| `second` | `PdfMatrix` |  |

### normalizeDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function normalizeDocument(input: DocumentInput | null | undefined): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput \| null \| undefined` |  |

### normalizePageSetup

Kind: function. Import from `@birchui/document/headless`.

```ts
function normalizePageSetup(input: Partial<PageSetup> | undefined, base: PageSetup = DEFAULT_PAGE_SETUP): PageSetup
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Partial<PageSetup> \| undefined` |  |
| `base?` | `PageSetup` |  |

### numberingLabels

Kind: function. Import from `@birchui/document/headless`.

```ts
function numberingLabels(document: Pick<DocumentData, 'content'> & Partial<DocumentData>): NumberingLabel[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `document` | `Pick<DocumentData, 'content'> & Partial<DocumentData>` |  |

### odtToDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function odtToDocument(input: Uint8Array | ArrayBuffer | Blob, options: { limits?: Partial<ZipLimits> } = {}): Promise<DocumentData>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `{ limits?: Partial<ZipLimits> }` |  |

### outlineOf

Kind: function. Import from `@birchui/document/headless`.

```ts
function outlineOf(doc: DocNodeJSON): OutlineEntry[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### pageDimensions

Kind: function. Import from `@birchui/document/headless`.

```ts
function pageDimensions(setup: PageSetup): { width: number; height: number }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `setup` | `PageSetup` |  |

### paginate

Kind: function. Import from `@birchui/document/headless`.

```ts
function paginate(blocks: readonly LayoutBlock[], options: PaginateOptions): PaginationResult
```

| Parameter | Type | Description |
| --- | --- | --- |
| `blocks` | `readonly LayoutBlock[]` |  |
| `options` | `PaginateOptions` |  |

### parseFieldInstruction

Kind: function. Import from `@birchui/document/headless`.

```ts
function parseFieldInstruction(instruction: string): ParsedField
```

| Parameter | Type | Description |
| --- | --- | --- |
| `instruction` | `string` |  |

### readDocx

Kind: function. Import from `@birchui/document/headless`.

```ts
function readDocx(input: Uint8Array | ArrayBuffer | Blob, options: DocxReadOptions = {}): Promise<DocxReadResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `Uint8Array \| ArrayBuffer \| Blob` |  |
| `options?` | `DocxReadOptions` |  |

### registeredFonts

Kind: function. Import from `@birchui/document/headless`.

```ts
function registeredFonts(): readonly PdfFontSource[]
```

### registerFonts

Kind: function. Import from `@birchui/document/headless`.

```ts
function registerFonts(fonts: readonly PdfFontSource[]): void
```

Makes font files available to every PDF written afterwards, in the browser and on a server, in addition to the
`fonts` passed with a single call. Registering a face again replaces it.

| Parameter | Type | Description |
| --- | --- | --- |
| `fonts` | `readonly PdfFontSource[]` |  |

### rejectAllRevisions

Kind: function. Import from `@birchui/document/headless`.

```ts
function rejectAllRevisions(doc: DocNodeJSON): DocNodeJSON
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### renderDocumentPdf

Kind: function. Import from `@birchui/document/headless`.

```ts
function renderDocumentPdf(input: DocumentInput, options: DocumentPdfOptions = {}): Promise<DocumentPdfResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### rotationMatrix

Kind: function. Import from `@birchui/document/headless`.

```ts
function rotationMatrix(degrees: number, centerX: number, centerY: number): PdfMatrix
```

| Parameter | Type | Description |
| --- | --- | --- |
| `degrees` | `number` |  |
| `centerX` | `number` |  |
| `centerY` | `number` |  |

### rtfToDocument

Kind: function. Import from `@birchui/document/headless`.

```ts
function rtfToDocument(input: string | Uint8Array | ArrayBuffer): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `string \| Uint8Array \| ArrayBuffer` |  |

### sanitizeHref

Kind: function. Import from `@birchui/document/headless`.

```ts
function sanitizeHref(value: unknown, linkSchemes?: readonly string[]): string | null
```

The address when it may be followed, otherwise null. `linkSchemes` extends the allow-list.

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |
| `linkSchemes?` | `readonly string[]` |  |

### sanitizeImageSrc

Kind: function. Import from `@birchui/document/headless`.

```ts
function sanitizeImageSrc(value: unknown): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `unknown` |  |

### updateFields

Kind: function. Import from `@birchui/document/headless`.

```ts
function updateFields(input: DocumentData, context: FieldContext = {}): DocumentData
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentData` |  |
| `context?` | `FieldContext` |  |

### validateDocxPackage

Kind: function. Import from `@birchui/document/headless`.

```ts
function validateDocxPackage(bytes: Uint8Array | ArrayBuffer, options: { limits?: Partial<ZipLimits> } = {}): Promise<DocxValidationResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array \| ArrayBuffer` |  |
| `options?` | `{ limits?: Partial<ZipLimits> }` |  |

### validateDocxParts

Kind: function. Import from `@birchui/document/headless`.

```ts
function validateDocxParts(files: Map<string, Uint8Array>): DocxValidationResult
```

| Parameter | Type | Description |
| --- | --- | --- |
| `files` | `Map<string, Uint8Array>` |  |

### wordCount

Kind: function. Import from `@birchui/document/headless`.

```ts
function wordCount(doc: DocNodeJSON): WordCount
```

| Parameter | Type | Description |
| --- | --- | --- |
| `doc` | `DocNodeJSON` |  |

### writePdf

Kind: function. Import from `@birchui/document/headless`.

```ts
function writePdf(layout: PdfDocumentLayout, options: PdfWriteOptions = {}): Promise<PdfWriteResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `layout` | `PdfDocumentLayout` |  |
| `options?` | `PdfWriteOptions` |  |

### DocFormatError

Kind: class. Import from `@birchui/document/headless`.

```ts
class DocFormatError extends Error
new DocFormatError(readonly code: DocFormatCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"DocFormatError"` |  |
| `readonly code` | `DocFormatCode` |  |

### DocumentFormatError

Kind: class. Import from `@birchui/document/headless`.

```ts
class DocumentFormatError extends Error
new DocumentFormatError(readonly code: DocumentFormatCode, message: string)
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly name` | `"DocumentFormatError"` |  |
| `readonly code` | `DocumentFormatCode` |  |

### PdfFontError

Kind: class. Import from `@birchui/document/headless`.

```ts
class PdfFontError extends Error
new PdfFontError(readonly families: readonly string[])
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly code` | `"pdfa-fonts-missing"` |  |
| `readonly families` | `readonly string[]` |  |

### ZipLimitError

Kind: class. Import from `@birchui/document/headless`.

```ts
class ZipLimitError extends Error
new ZipLimitError(code: ZipLimitCode, message: string, detail: { limit: number; actual: number; entryName?: string })
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly code` | `ZipLimitCode` |  |
| `readonly limit` | `number` |  |
| `readonly actual` | `number` |  |
| `readonly entryName` | `string \| undefined` |  |

### DEFAULT_DOC_LIMITS

Kind: const. Import from `@birchui/document/headless`.

```ts
const DEFAULT_DOC_LIMITS: Readonly<DocLimits>
```

### DEFAULT_PAGE_SETUP

Kind: const. Import from `@birchui/document/headless`.

```ts
const DEFAULT_PAGE_SETUP: PageSetup
```

### DEFAULT_ZIP_LIMITS

Kind: const. Import from `@birchui/document/headless`.

```ts
const DEFAULT_ZIP_LIMITS: Readonly<ZipLimits>
```

### DOCX_MIME

Kind: const. Import from `@birchui/document/headless`.

```ts
const DOCX_MIME: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
```

### FONT_SUBSTITUTIONS

Kind: const. Import from `@birchui/document/headless`.

```ts
const FONT_SUBSTITUTIONS: Readonly<Record<string, readonly string[]>>
```

Fonts with the same advance widths as the font they replace, so text set in the substitute breaks at the same
places. Carlito and Caladea match Calibri and Cambria; the Liberation and Croscore families match Arial,
Times New Roman and Courier New; Gelasio matches Georgia and Selawik matches Segoe UI.

### ODT_MIME

Kind: const. Import from `@birchui/document/headless`.

```ts
const ODT_MIME: "application/vnd.oasis.opendocument.text" = 'application/vnd.oasis.opendocument.text'
```

### PAGE_SIZES

Kind: const. Import from `@birchui/document/headless`.

```ts
const PAGE_SIZES: Readonly<Record<PageSizeName, { width: number; height: number }>>
```

### PARAGRAPH_STYLES

Kind: const. Import from `@birchui/document/headless`.

```ts
const PARAGRAPH_STYLES: readonly ParagraphStyleDefinition[]
```

### AbstractNumbering

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface AbstractNumbering
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `number` |  |
| `name?` | `string` |  |
| `multiLevelType?` | `string` |  |
| `styleLink?` | `string` |  |
| `numStyleLink?` | `string` |  |
| `levels` | `NumberingLevel[]` |  |

### CombineOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface CombineOptions extends Pick<CompareOptions, 'date' | 'granularity' | 'formatting'>
```

| Property | Type | Description |
| --- | --- | --- |
| `firstAuthor?` | `string` |  |
| `secondAuthor?` | `string` |  |
| `moves?` | `boolean` |  |
| `date?` | `string \| undefined` | Inherited from CompareOptions. |
| `granularity?` | `"word" \| "character" \| undefined` | Inherited from CompareOptions. |
| `formatting?` | `boolean \| undefined` | Inherited from CompareOptions. |

### DocLimits

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxBytes` | `number` | Largest file that is read at all, in bytes. |
| `maxCharacters` | `number` | Largest number of characters in the body of the document. |
| `maxPictureBytes` | `number` | Total size of the pictures that are kept, in bytes. Pictures past it are left out. |
| `maxTableCells` | `number` | Largest number of cells in one table. A table past it is read as paragraphs. |

### DocMarkJSON

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocMarkJSON
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `string` |  |
| `attrs?` | `Record<string, unknown>` |  |

### DocNodeJSON

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocNodeJSON
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `string` |  |
| `attrs?` | `Record<string, unknown>` |  |
| `content?` | `DocNodeJSON[]` |  |
| `marks?` | `DocMarkJSON[]` |  |
| `text?` | `string` |  |

### DocReadOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocReadOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<DocLimits>` |  |

### DocumentData

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocumentData extends HeaderFooterContent
```

| Property | Type | Description |
| --- | --- | --- |
| `version` | `1` |  |
| `content` | `DocNodeJSON` |  |
| `page` | `PageSetup` |  |
| `comments` | `CommentThread[]` |  |
| `properties` | `DocumentProperties` |  |
| `defaults` | `DocumentDefaults` |  |
| `evenHeader?` | `DocNodeJSON \| null` |  |
| `evenFooter?` | `DocNodeJSON \| null` |  |
| `settings?` | `DocumentSettings` |  |
| `styles?` | `DocumentStyle[]` |  |
| `numbering?` | `NumberingDefinitions` |  |
| `protection?` | `DocumentProtection \| null` |  |
| `people?` | `DocumentPerson[]` |  |
| `docx?` | `DocxPackage \| null` |  |
| `watermark?` | `Watermark \| null` |  |
| `lineNumbers?` | `LineNumbering \| null` |  |
| `lists?` | `MultilevelListDefinition[]` |  |
| `sources?` | `BibliographySource[]` |  |
| `citationStyle?` | `CitationStyle` |  |
| `header` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |
| `footer` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |
| `firstHeader` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |
| `firstFooter` | `DocNodeJSON \| null` | Inherited from HeaderFooterContent. |

### DocumentPdfOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocumentPdfOptions extends PdfWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `language?` | `string` |  |
| `outline?` | `boolean` |  |
| `compress?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |
| `creationDate?` | `Date \| undefined` | Inherited from PdfWriteOptions. |
| `producer?` | `string \| undefined` | Inherited from PdfWriteOptions. |
| `pdfA?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |
| `tagged?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |

### DocumentPdfResult

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocumentPdfResult
```

| Property | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `warnings` | `string[]` |  |
| `pageCount` | `number` |  |
| `missingFonts` | `string[]` | Font families the document asks for that had no font file and no metric-compatible substitute. |

### DocumentProperties

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocumentProperties
```

| Property | Type | Description |
| --- | --- | --- |
| `title?` | `string` |  |
| `subject?` | `string` |  |
| `author?` | `string` |  |
| `keywords?` | `string` |  |
| `description?` | `string` |  |
| `created?` | `string` |  |
| `modified?` | `string` |  |
| `category?` | `string` |  |
| `lastModifiedBy?` | `string` |  |
| `revision?` | `string` |  |
| `company?` | `string` |  |
| `manager?` | `string` |  |
| `custom?` | `Record<string, string \| number \| boolean>` |  |

### DocumentSettings

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocumentSettings
```

| Property | Type | Description |
| --- | --- | --- |
| `evenAndOddHeaders?` | `boolean` |  |
| `mirrorMargins?` | `boolean` |  |
| `trackRevisions?` | `boolean` |  |
| `defaultTabStop?` | `number` |  |
| `protection?` | `DocumentProtection \| null` |  |
| `footnotes?` | `NoteSettings` |  |
| `endnotes?` | `NoteSettings` |  |
| `compatibilityMode?` | `number` |  |
| `compat?` | `CompatibilitySettings` |  |
| `kerning?` | `boolean` | False when the document's default text has Word's "Kerning for fonts" switched off, which is the case for most Word documents. Text is then laid out without pair kerning, as Word does, unless a run switches it on. |

### DocumentStyle

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocumentStyle
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `type` | `DocumentStyleType` |  |
| `basedOn?` | `string` |  |
| `next?` | `string` |  |
| `link?` | `string` |  |
| `isDefault?` | `boolean` |  |
| `isHidden?` | `boolean` |  |
| `isQuickStyle?` | `boolean` |  |
| `builtin?` | `ParagraphStyleId` |  |
| `outlineLevel?` | `number` |  |
| `numbering?` | `{ numId: number; level: number }` |  |
| `paragraph?` | `Record<string, unknown>` |  |
| `run?` | `Record<string, unknown>` |  |
| `table?` | `Record<string, unknown>` |  |

### DocxImportFeature

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxImportFeature
```

| Property | Type | Description |
| --- | --- | --- |
| `feature` | `string` |  |
| `count` | `number` |  |
| `note?` | `string` |  |

### DocxImportReport

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxImportReport
```

| Property | Type | Description |
| --- | --- | --- |
| `modelled` | `DocxImportFeature[]` |  |
| `preserved` | `DocxImportFeature[]` |  |
| `dropped` | `DocxImportFeature[]` |  |

### DocxPageMap

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxPageMap
```

| Property | Type | Description |
| --- | --- | --- |
| `bookmarks?` | `Readonly<Record<string, number>>` |  |
| `headings?` | `readonly number[]` |  |
| `headerFooter?` | `Readonly<Partial<Record<'default' \| 'first' \| 'even', number>>>` |  |

### DocxReadOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxReadOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<ZipLimits>` | Caps on the archive: entry count, inflated size of one entry, total inflated size and compression ratio. |

### DocxReadResult

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxReadResult
```

| Property | Type | Description |
| --- | --- | --- |
| `document` | `DocumentData` |  |
| `warnings` | `string[]` |  |
| `report` | `DocxImportReport` |  |

### DocxValidationIssue

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxValidationIssue
```

| Property | Type | Description |
| --- | --- | --- |
| `severity` | `'error' \| 'warning'` |  |
| `code` | `string` |  |
| `part` | `string` |  |
| `message` | `string` |  |

### DocxValidationResult

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxValidationResult
```

| Property | Type | Description |
| --- | --- | --- |
| `ok` | `boolean` |  |
| `issues` | `DocxValidationIssue[]` |  |

### DocxWriteOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface DocxWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `trackRevisions?` | `boolean` |  |
| `zoom?` | `number` |  |
| `pageCount?` | `number` |  |
| `pages?` | `DocxPageMap` |  |
| `compress?` | `boolean` |  |
| `now?` | `Date` |  |
| `preserveSource?` | `boolean \| 'exact'` |  |

### EmbeddedObjectFile

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface EmbeddedObjectFile
```

| Property | Type | Description |
| --- | --- | --- |
| `fileName` | `string` |  |
| `mimeType` | `string` |  |
| `progId` | `string` |  |
| `data` | `Uint8Array` |  |

### EmbeddedObjectInput

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface EmbeddedObjectInput
```

| Property | Type | Description |
| --- | --- | --- |
| `data` | `Uint8Array \| ArrayBuffer` |  |
| `fileName` | `string` |  |
| `mimeType?` | `string` |  |
| `asIcon?` | `boolean` |  |
| `icon?` | `string` |  |
| `width?` | `number` |  |
| `height?` | `number` |  |

### FieldContext

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface FieldContext
```

| Property | Type | Description |
| --- | --- | --- |
| `now?` | `Date` |  |
| `values?` | `Record<string, unknown>` |  |
| `pages?` | `Record<string, number>` |  |
| `pageCount?` | `number` |  |

### FileIconSvgOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface FileIconSvgOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `width?` | `number` |  |
| `height?` | `number` |  |
| `title?` | `string` |  |

### FileTypeInfo

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface FileTypeInfo
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `FileKind` |  |
| `label` | `FileTypeLabel` |  |
| `extension` | `string` | Lower-case extension without the dot; empty when nothing is known. |
| `badge` | `string` | Up to four upper-case characters for the icon. |
| `mimeType` | `string` |  |
| `source` | `FileTypeSource` |  |

### FileTypeInput

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface FileTypeInput
```

| Property | Type | Description |
| --- | --- | --- |
| `progId?` | `string \| null` |  |
| `fileName?` | `string \| null` |  |
| `mimeType?` | `string \| null` |  |
| `partName?` | `string \| null` |  |
| `data?` | `Uint8Array \| null` |  |

### HtmlDocumentOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface HtmlDocumentOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fullDocument?` | `boolean` |  |
| `title?` | `string` |  |
| `includeDeleted?` | `boolean` |  |
| `linkSchemes?` | `readonly string[]` | Schemes written as links that can be followed, besides `http`, `https`, `mailto` and `tel`. |

### MarkdownOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface MarkdownOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `includeDeleted?` | `boolean` |  |

### MergeOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface MergeOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `missing?` | `'empty' \| 'keep' \| 'placeholder'` |  |
| `locale?` | `string` |  |
| `currency?` | `string` |  |

### MetafileOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface MetafileOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `embeddedEmf?` | `boolean` |  |

### NumberingDefinitions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface NumberingDefinitions
```

| Property | Type | Description |
| --- | --- | --- |
| `abstracts` | `AbstractNumbering[]` |  |
| `instances` | `NumberingInstance[]` |  |

### NumberingInstance

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface NumberingInstance
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `number` |  |
| `abstractId` | `number` |  |
| `overrides?` | `NumberingOverride[]` |  |

### NumberingLabel

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface NumberingLabel
```

| Property | Type | Description |
| --- | --- | --- |
| `path` | `number[]` |  |
| `label` | `string` |  |
| `level` | `number` |  |
| `numId` | `number \| null` |  |
| `format` | `string` |  |
| `suffix` | `'tab' \| 'space' \| 'nothing'` |  |
| `text` | `string` |  |

### NumberingLevel

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface NumberingLevel
```

| Property | Type | Description |
| --- | --- | --- |
| `level` | `number` |  |
| `start` | `number` |  |
| `format` | `string` |  |
| `text` | `string` |  |
| `suffix?` | `'tab' \| 'space' \| 'nothing'` |  |
| `restart?` | `number` |  |
| `paragraphStyle?` | `string` |  |
| `isLegal?` | `boolean` |  |
| `align?` | `string` |  |
| `indentLeft?` | `number` |  |
| `hanging?` | `number` |  |
| `font?` | `string` |  |
| `run?` | `NumberingRun` |  |

### NumberingOverride

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface NumberingOverride
```

| Property | Type | Description |
| --- | --- | --- |
| `level` | `number` |  |
| `start?` | `number` |  |
| `definition?` | `NumberingLevel` |  |

### PageSetup

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PageSetup
```

| Property | Type | Description |
| --- | --- | --- |
| `size` | `PageSizeName \| { width: number; height: number }` |  |
| `orientation` | `PageOrientation` |  |
| `margins` | `PageMargins` |  |
| `headerDistance` | `number` |  |
| `footerDistance` | `number` |  |
| `differentFirstPage` | `boolean` |  |
| `gutter?` | `number` |  |
| `columns?` | `SectionColumns \| null` |  |
| `sectionType?` | `SectionBreakType \| null` |  |
| `pageNumbers?` | `PageNumbering \| null` |  |
| `verticalAlign?` | `'top' \| 'center' \| 'bottom' \| 'justify' \| null` |  |
| `rtl?` | `boolean` |  |
| `lineNumbers?` | `LineNumbering \| null` |  |
| `pageBorders?` | `PageBorders \| null` |  |
| `docx?` | `PreservedXml \| null` |  |
| `change?` | `SectionFormatChange \| null` |  |

### ParagraphStyleDefinition

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface ParagraphStyleDefinition
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `ParagraphStyleId` |  |
| `wordName` | `string` |  |
| `label` | `string` |  |
| `tag` | `'p' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'blockquote' \| 'pre'` |  |
| `fontSize?` | `number` |  |
| `fontFamily?` | `string` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `color?` | `string` |  |
| `spaceBefore?` | `number` |  |
| `spaceAfter?` | `number` |  |
| `lineHeight?` | `number` |  |
| `align?` | `TextAlignment` |  |
| `indentLeft?` | `number` |  |
| `indentRight?` | `number` |  |
| `outlineLevel?` | `number` |  |
| `keepWithNext?` | `boolean` |  |
| `shading?` | `string` |  |

### ParsedField

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface ParsedField
```

| Property | Type | Description |
| --- | --- | --- |
| `keyword` | `string` |  |
| `kind` | `FieldKind \| 'link'` |  |
| `name` | `string` |  |
| `args` | `string[]` |  |
| `switches` | `Record<string, string \| true>` |  |
| `href` | `string \| null` |  |
| `title` | `string \| null` |  |
| `canonical` | `string` |  |
| `placeholder` | `string \| null` |  |

### PdfCluster

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfCluster
```

| Property | Type | Description |
| --- | --- | --- |
| `x` | `number` |  |
| `width` | `number` |  |
| `length` | `number` |  |

### PdfColor

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfColor
```

| Property | Type | Description |
| --- | --- | --- |
| `r` | `number` |  |
| `g` | `number` |  |
| `b` | `number` |  |

### PdfDestination

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfDestination
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'destination'` |  |
| `name` | `string` |  |
| `y` | `number` |  |

### PdfDocumentLayout

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfDocumentLayout
```

| Property | Type | Description |
| --- | --- | --- |
| `pages` | `PdfPage[]` |  |
| `outline?` | `PdfOutlineEntry[]` |  |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `language?` | `string` |  |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `structure?` | `readonly PdfStructNode[]` |  |
| `pdfA?` | `boolean` |  |
| `created?` | `Date` |  |
| `modified?` | `Date` |  |

### PdfFontSource

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfFontSource
```

| Property | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `data` | `Uint8Array` |  |

### PdfGroup

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfGroup extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'group'` |  |
| `items` | `PdfItem[]` |  |
| `matrix?` | `PdfMatrix` |  |
| `clip?` | `{ x: number; y: number; width: number; height: number }` |  |
| `opacity?` | `number` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfImage

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfImage extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'image'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `data` | `Uint8Array` |  |
| `mime` | `'image/jpeg' \| 'image/png'` |  |
| `alt?` | `string` |  |
| `rotation?` | `number` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfLine

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfLine extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'line'` |  |
| `x1` | `number` |  |
| `y1` | `number` |  |
| `x2` | `number` |  |
| `y2` | `number` |  |
| `color?` | `PdfColor` |  |
| `width?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfLinkArea

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfLinkArea
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'link'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `href?` | `string` |  |
| `destination?` | `string` |  |
| `struct?` | `number` |  |

### PdfOutlineEntry

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfOutlineEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `title` | `string` |  |
| `level` | `number` |  |
| `page` | `number` |  |
| `y` | `number` |  |

### PdfPage

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfPage
```

| Property | Type | Description |
| --- | --- | --- |
| `width` | `number` |  |
| `height` | `number` |  |
| `items` | `PdfItem[]` |  |

### PdfPath

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfPath extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'path'` |  |
| `commands` | `readonly PdfPathCommand[]` |  |
| `fill?` | `PdfColor` |  |
| `stroke?` | `PdfColor` |  |
| `strokeWidth?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `roundCaps?` | `boolean` |  |
| `roundJoins?` | `boolean` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfRect

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfRect extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'rect'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `fill?` | `PdfColor` |  |
| `stroke?` | `PdfColor` |  |
| `strokeWidth?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfStructNode

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfStructNode
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `PdfStructType` |  |
| `parent` | `number` |  |
| `alt?` | `string` |  |
| `language?` | `string` |  |

### PdfTagging

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `struct?` | `number` |  |
| `artifact?` | `PdfArtifactType` |  |

### PdfTextRun

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfTextRun extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'text'` |  |
| `x` | `number` |  |
| `baseline` | `number` |  |
| `width` | `number` |  |
| `text` | `string` |  |
| `fontFamily` | `string` |  |
| `fontSize` | `number` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `color?` | `PdfColor` |  |
| `underline?` | `boolean` |  |
| `underlineStyle?` | `PdfUnderlineStyle` | The line drawn for `underline`; a single line when left out. |
| `underlineColor?` | `PdfColor` | The colour of the underline; the colour of the text when left out. |
| `strike?` | `boolean` |  |
| `doubleStrike?` | `boolean` |  |
| `background?` | `PdfColor` |  |
| `link?` | `string` |  |
| `direction?` | `'ltr' \| 'rtl'` |  |
| `clusters?` | `readonly PdfCluster[]` |  |
| `trailingSpace?` | `boolean` |  |
| `decoration?` | `{ x: number; width: number }` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfWriteOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `compress?` | `boolean` |  |
| `creationDate?` | `Date` |  |
| `producer?` | `string` |  |
| `pdfA?` | `boolean` |  |
| `tagged?` | `boolean` |  |

### PdfWriteResult

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface PdfWriteResult
```

| Property | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `warnings` | `string[]` |  |

### SearchBlock

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface SearchBlock
```

| Property | Type | Description |
| --- | --- | --- |
| `text` | `string` |  |
| `start` | `number` |  |

### SearchMatch

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface SearchMatch
```

| Property | Type | Description |
| --- | --- | --- |
| `from` | `number` |  |
| `to` | `number` |  |
| `groups` | `string[]` |  |

### UnzipOptions

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface UnzipOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `limits?` | `Partial<ZipLimits>` |  |

### ZipLimits

Kind: interface. Import from `@birchui/document/headless`.

```ts
interface ZipLimits
```

| Property | Type | Description |
| --- | --- | --- |
| `maxEntries` | `number` |  |
| `maxEntryBytes` | `number` |  |
| `maxTotalBytes` | `number` |  |
| `maxRatio` | `number` |  |

### DocFormatCode

Kind: type. Import from `@birchui/document/headless`.

```ts
type DocFormatCode =
  'not-a-doc' | 'encrypted' | 'unsupported-version' | 'too-large' | 'too-many-characters' | 'corrupt';
```

### DocumentFormatCode

Kind: type. Import from `@birchui/document/headless`.

```ts
type DocumentFormatCode =
  'encrypted-or-legacy-doc' | 'encrypted-entry' | 'not-a-zip' | 'not-a-word-document' | 'xml-too-deep';
```

### DocumentInput

Kind: type. Import from `@birchui/document/headless`.

```ts
type DocumentInput = Partial<DocumentData> | DocNodeJSON;
```

### FieldKind

Kind: type. Import from `@birchui/document/headless`.

```ts
type FieldKind =
  | 'merge'
  | 'page'
  | 'pages'
  | 'date'
  | 'time'
  | 'ref'
  | 'pageref'
  | 'noteref'
  | 'seq'
  | 'if'
  | 'toc'
  | 'styleref'
  | 'property'
  | 'form'
  | 'citation'
  | 'bibliography'
  | 'other';
```

### FileKind

Kind: type. Import from `@birchui/document/headless`.

```ts
type FileKind =
  'word' | 'excel' | 'powerpoint' | 'pdf' | 'email' | 'image' | 'text' | 'archive' | 'media' | 'file';
```

### FileTypeLabel

Kind: type. Import from `@birchui/document/headless`.

```ts
type FileTypeLabel =
  | 'word'
  | 'excel'
  | 'powerpoint'
  | 'document'
  | 'spreadsheet'
  | 'presentation'
  | 'pdf'
  | 'outlook'
  | 'email'
  | 'image'
  | 'text'
  | 'csv'
  | 'archive'
  | 'audio'
  | 'video'
  | 'file';
```

### FileTypeSource

Kind: type. Import from `@birchui/document/headless`.

```ts
type FileTypeSource = 'progId' | 'fileName' | 'contentType' | 'content' | 'none';
```

### ImageSourceKind

Kind: type. Import from `@birchui/document/headless`.

```ts
type ImageSourceKind = 'embedded' | 'remote' | 'none';
```

### MergeValues

Kind: type. Import from `@birchui/document/headless`.

```ts
type MergeValues = Record<string, unknown>;
```

### PdfArtifactType

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfArtifactType = 'header' | 'footer' | 'watermark' | 'pagination' | 'layout';
```

### PdfFontLoader

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfFontLoader = (
  family: string,
  style: { bold: boolean; italic: boolean },
) => Promise<ArrayBuffer | Uint8Array | null>;
```

### PdfItem

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfItem = PdfTextRun | PdfRect | PdfLine | PdfPath | PdfImage | PdfLinkArea | PdfDestination | PdfGroup;
```

### PdfMatrix

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfMatrix = readonly [number, number, number, number, number, number];
```

### PdfPathCommand

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfPathCommand =
  | readonly ['M', number, number]
  | readonly ['L', number, number]
  | readonly ['C', number, number, number, number, number, number]
  | readonly ['Z'];
```

### PdfStructType

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfStructType =
  | 'P'
  | 'H1'
  | 'H2'
  | 'H3'
  | 'H4'
  | 'H5'
  | 'H6'
  | 'L'
  | 'LI'
  | 'Lbl'
  | 'LBody'
  | 'Table'
  | 'TR'
  | 'TH'
  | 'TD'
  | 'Figure'
  | 'Link'
  | 'Note'
  | 'Span'
  | 'TOC'
  | 'TOCI'
  | 'Sect'
  | 'BlockQuote'
  | 'Code';
```

### PdfUnderlineStyle

Kind: type. Import from `@birchui/document/headless`.

```ts
type PdfUnderlineStyle = 'single' | 'double' | 'thick' | 'dotted' | 'dash' | 'dotDash' | 'wave';
```

### ZipLimitCode

Kind: type. Import from `@birchui/document/headless`.

```ts
type ZipLimitCode = 'too-many-entries' | 'entry-too-large' | 'archive-too-large' | 'ratio-too-high';
```

## @birchui/document/locales

### DOCUMENT_LOCALES

Kind: const. Import from `@birchui/document/locales`.

```ts
const DOCUMENT_LOCALES: Record<string, Record<string, string>>
```

### documentDe

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentDe: Record<string, string>
```

### documentEn

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentEn: Record<string, string>
```

### documentEs

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentEs: Record<string, string>
```

### documentFr

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentFr: Record<string, string>
```

### documentJa

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentJa: Record<string, string>
```

### documentPt

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentPt: Record<string, string>
```

### documentZh

Kind: const. Import from `@birchui/document/locales`.

```ts
const documentZh: Record<string, string>
```

## @birchui/document/pdf

### clearRegisteredFonts

Kind: function. Import from `@birchui/document/pdf`.

```ts
function clearRegisteredFonts(): void
```

### documentToPdf

Kind: function. Import from `@birchui/document/pdf`.

```ts
function documentToPdf(input: DocumentInput, options: DocumentPdfOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### fontFamilyStack

Kind: function. Import from `@birchui/document/pdf`.

```ts
function fontFamilyStack(fontFamily: string): string
```

A CSS font-family list that puts the metric-compatible substitutes right after each requested family.

| Parameter | Type | Description |
| --- | --- | --- |
| `fontFamily` | `string` |  |

### fontSubstitutes

Kind: function. Import from `@birchui/document/pdf`.

```ts
function fontSubstitutes(family: string): readonly string[]
```

| Parameter | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |

### layoutDocument

Kind: function. Import from `@birchui/document/pdf`.

```ts
function layoutDocument(input: DocumentInput, options: DocumentPdfOptions = {}): { layout: PdfDocumentLayout; warnings: string[]; missingFonts: string[] }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### layoutToPdf

Kind: function. Import from `@birchui/document/pdf`.

```ts
function layoutToPdf(layout: PdfDocumentLayout, options: PdfWriteOptions = {}): Promise<Uint8Array>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `layout` | `PdfDocumentLayout` |  |
| `options?` | `PdfWriteOptions` |  |

### multiplyMatrix

Kind: function. Import from `@birchui/document/pdf`.

```ts
function multiplyMatrix(first: PdfMatrix, second: PdfMatrix): PdfMatrix
```

| Parameter | Type | Description |
| --- | --- | --- |
| `first` | `PdfMatrix` |  |
| `second` | `PdfMatrix` |  |

### registeredFonts

Kind: function. Import from `@birchui/document/pdf`.

```ts
function registeredFonts(): readonly PdfFontSource[]
```

### registerFonts

Kind: function. Import from `@birchui/document/pdf`.

```ts
function registerFonts(fonts: readonly PdfFontSource[]): void
```

Makes font files available to every PDF written afterwards, in the browser and on a server, in addition to the
`fonts` passed with a single call. Registering a face again replaces it.

| Parameter | Type | Description |
| --- | --- | --- |
| `fonts` | `readonly PdfFontSource[]` |  |

### renderDocumentPdf

Kind: function. Import from `@birchui/document/pdf`.

```ts
function renderDocumentPdf(input: DocumentInput, options: DocumentPdfOptions = {}): Promise<DocumentPdfResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `input` | `DocumentInput` |  |
| `options?` | `DocumentPdfOptions` |  |

### rotationMatrix

Kind: function. Import from `@birchui/document/pdf`.

```ts
function rotationMatrix(degrees: number, centerX: number, centerY: number): PdfMatrix
```

| Parameter | Type | Description |
| --- | --- | --- |
| `degrees` | `number` |  |
| `centerX` | `number` |  |
| `centerY` | `number` |  |

### writePdf

Kind: function. Import from `@birchui/document/pdf`.

```ts
function writePdf(layout: PdfDocumentLayout, options: PdfWriteOptions = {}): Promise<PdfWriteResult>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `layout` | `PdfDocumentLayout` |  |
| `options?` | `PdfWriteOptions` |  |

### PdfFontError

Kind: class. Import from `@birchui/document/pdf`.

```ts
class PdfFontError extends Error
new PdfFontError(readonly families: readonly string[])
```

| Property | Type | Description |
| --- | --- | --- |
| `readonly code` | `"pdfa-fonts-missing"` |  |
| `readonly families` | `readonly string[]` |  |

### FONT_SUBSTITUTIONS

Kind: const. Import from `@birchui/document/pdf`.

```ts
const FONT_SUBSTITUTIONS: Readonly<Record<string, readonly string[]>>
```

Fonts with the same advance widths as the font they replace, so text set in the substitute breaks at the same
places. Carlito and Caladea match Calibri and Cambria; the Liberation and Croscore families match Arial,
Times New Roman and Courier New; Gelasio matches Georgia and Selawik matches Segoe UI.

### DocumentPdfOptions

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface DocumentPdfOptions extends PdfWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `language?` | `string` |  |
| `outline?` | `boolean` |  |
| `compress?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |
| `creationDate?` | `Date \| undefined` | Inherited from PdfWriteOptions. |
| `producer?` | `string \| undefined` | Inherited from PdfWriteOptions. |
| `pdfA?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |
| `tagged?` | `boolean \| undefined` | Inherited from PdfWriteOptions. |

### DocumentPdfResult

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface DocumentPdfResult
```

| Property | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `warnings` | `string[]` |  |
| `pageCount` | `number` |  |
| `missingFonts` | `string[]` | Font families the document asks for that had no font file and no metric-compatible substitute. |

### PdfCluster

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfCluster
```

| Property | Type | Description |
| --- | --- | --- |
| `x` | `number` |  |
| `width` | `number` |  |
| `length` | `number` |  |

### PdfColor

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfColor
```

| Property | Type | Description |
| --- | --- | --- |
| `r` | `number` |  |
| `g` | `number` |  |
| `b` | `number` |  |

### PdfDestination

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfDestination
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'destination'` |  |
| `name` | `string` |  |
| `y` | `number` |  |

### PdfDocumentLayout

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfDocumentLayout
```

| Property | Type | Description |
| --- | --- | --- |
| `pages` | `PdfPage[]` |  |
| `outline?` | `PdfOutlineEntry[]` |  |
| `title?` | `string` |  |
| `author?` | `string` |  |
| `subject?` | `string` |  |
| `keywords?` | `string` |  |
| `language?` | `string` |  |
| `fonts?` | `readonly PdfFontSource[]` |  |
| `structure?` | `readonly PdfStructNode[]` |  |
| `pdfA?` | `boolean` |  |
| `created?` | `Date` |  |
| `modified?` | `Date` |  |

### PdfFontSource

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfFontSource
```

| Property | Type | Description |
| --- | --- | --- |
| `family` | `string` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `data` | `Uint8Array` |  |

### PdfGroup

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfGroup extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'group'` |  |
| `items` | `PdfItem[]` |  |
| `matrix?` | `PdfMatrix` |  |
| `clip?` | `{ x: number; y: number; width: number; height: number }` |  |
| `opacity?` | `number` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfImage

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfImage extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'image'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `data` | `Uint8Array` |  |
| `mime` | `'image/jpeg' \| 'image/png'` |  |
| `alt?` | `string` |  |
| `rotation?` | `number` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfLine

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfLine extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'line'` |  |
| `x1` | `number` |  |
| `y1` | `number` |  |
| `x2` | `number` |  |
| `y2` | `number` |  |
| `color?` | `PdfColor` |  |
| `width?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfLinkArea

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfLinkArea
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'link'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `href?` | `string` |  |
| `destination?` | `string` |  |
| `struct?` | `number` |  |

### PdfOutlineEntry

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfOutlineEntry
```

| Property | Type | Description |
| --- | --- | --- |
| `title` | `string` |  |
| `level` | `number` |  |
| `page` | `number` |  |
| `y` | `number` |  |

### PdfPage

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfPage
```

| Property | Type | Description |
| --- | --- | --- |
| `width` | `number` |  |
| `height` | `number` |  |
| `items` | `PdfItem[]` |  |

### PdfPath

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfPath extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'path'` |  |
| `commands` | `readonly PdfPathCommand[]` |  |
| `fill?` | `PdfColor` |  |
| `stroke?` | `PdfColor` |  |
| `strokeWidth?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `roundCaps?` | `boolean` |  |
| `roundJoins?` | `boolean` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfRect

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfRect extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'rect'` |  |
| `x` | `number` |  |
| `y` | `number` |  |
| `width` | `number` |  |
| `height` | `number` |  |
| `fill?` | `PdfColor` |  |
| `stroke?` | `PdfColor` |  |
| `strokeWidth?` | `number` |  |
| `dash?` | `readonly number[]` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfStructNode

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfStructNode
```

| Property | Type | Description |
| --- | --- | --- |
| `type` | `PdfStructType` |  |
| `parent` | `number` |  |
| `alt?` | `string` |  |
| `language?` | `string` |  |

### PdfTagging

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `struct?` | `number` |  |
| `artifact?` | `PdfArtifactType` |  |

### PdfTextRun

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfTextRun extends PdfTagging
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'text'` |  |
| `x` | `number` |  |
| `baseline` | `number` |  |
| `width` | `number` |  |
| `text` | `string` |  |
| `fontFamily` | `string` |  |
| `fontSize` | `number` |  |
| `bold?` | `boolean` |  |
| `italic?` | `boolean` |  |
| `color?` | `PdfColor` |  |
| `underline?` | `boolean` |  |
| `underlineStyle?` | `PdfUnderlineStyle` | The line drawn for `underline`; a single line when left out. |
| `underlineColor?` | `PdfColor` | The colour of the underline; the colour of the text when left out. |
| `strike?` | `boolean` |  |
| `doubleStrike?` | `boolean` |  |
| `background?` | `PdfColor` |  |
| `link?` | `string` |  |
| `direction?` | `'ltr' \| 'rtl'` |  |
| `clusters?` | `readonly PdfCluster[]` |  |
| `trailingSpace?` | `boolean` |  |
| `decoration?` | `{ x: number; width: number }` |  |
| `struct?` | `number \| undefined` | Inherited from PdfTagging. |
| `artifact?` | `PdfArtifactType \| undefined` | Inherited from PdfTagging. |

### PdfWriteOptions

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfWriteOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `compress?` | `boolean` |  |
| `creationDate?` | `Date` |  |
| `producer?` | `string` |  |
| `pdfA?` | `boolean` |  |
| `tagged?` | `boolean` |  |

### PdfWriteResult

Kind: interface. Import from `@birchui/document/pdf`.

```ts
interface PdfWriteResult
```

| Property | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` |  |
| `warnings` | `string[]` |  |

### PdfArtifactType

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfArtifactType = 'header' | 'footer' | 'watermark' | 'pagination' | 'layout';
```

### PdfFontLoader

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfFontLoader = (
  family: string,
  style: { bold: boolean; italic: boolean },
) => Promise<ArrayBuffer | Uint8Array | null>;
```

### PdfItem

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfItem = PdfTextRun | PdfRect | PdfLine | PdfPath | PdfImage | PdfLinkArea | PdfDestination | PdfGroup;
```

### PdfMatrix

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfMatrix = readonly [number, number, number, number, number, number];
```

### PdfPathCommand

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfPathCommand =
  | readonly ['M', number, number]
  | readonly ['L', number, number]
  | readonly ['C', number, number, number, number, number, number]
  | readonly ['Z'];
```

### PdfStructType

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfStructType =
  | 'P'
  | 'H1'
  | 'H2'
  | 'H3'
  | 'H4'
  | 'H5'
  | 'H6'
  | 'L'
  | 'LI'
  | 'Lbl'
  | 'LBody'
  | 'Table'
  | 'TR'
  | 'TH'
  | 'TD'
  | 'Figure'
  | 'Link'
  | 'Note'
  | 'Span'
  | 'TOC'
  | 'TOCI'
  | 'Sect'
  | 'BlockQuote'
  | 'Code';
```

### PdfUnderlineStyle

Kind: type. Import from `@birchui/document/pdf`.

```ts
type PdfUnderlineStyle = 'single' | 'double' | 'thick' | 'dotted' | 'dash' | 'dotDash' | 'wave';
```
