@stesura/core/types
Shared TypeScript types: node and doc attrs, stores, comments, proofreading and user preferences. Everything here is type-only except followNumberingWith and TABLE_REGIONS. Runtime lists for some of the unions live in @stesura/core/constants: UnderlineType and UNDERLINE_TYPES for Underlines, BORDER_STYLES for BorderStyle, CAPS_VALUES for Caps and CASE_CHANGES for CaseChange.
Types
AccessibilityFinding
ActiveHandle
| Name | Type | Default |
|---|---|---|
pos | number | |
type | ResizeType | |
col | number | |
tablePos | number | |
isOuterEdge | boolean | |
isLeftOuterEdge | boolean | |
adjacentCol | number | |
side | "left" | "right" | |
tableAlign | TableAlign |
AiCommentSuggestion
One pending change an AI agent made to comments, kept in the thread’s
metadata.aiSuggestions until the user accepts (the marker goes) or rejects it:
thread: the agent created the thread. Reject deletes it and removes its anchors.reply: the agent replied (commentId). Reject deletes the reply.resolve: the agent resolved the thread. Reject reopens it.
AppendTransactionProps
| Name | Type | Default |
|---|---|---|
transactions | readonly Transaction[] | |
oldState | EditorState | |
newState | EditorState |
BlockBorders
BlockStyleAttrs
The block’s reference INTO the stylesheet. Named apart from doc.styleSheet
(the definitions map): a shared name made every step.attr === "styleSheet"
check ambiguous and needed a reserved-name exemption for the doc node.
| Name | Type | Default |
|---|---|---|
styleId | string | null |
BlockStylingAttrs
| Name | Type | Default |
|---|---|---|
bgColor | string | null | undefined | |
bgColorTheme | string | null | undefined | |
borders | Borders | null | undefined |
BorderOptions
| Name | Type | Default |
|---|---|---|
size | number | |
color | string | |
space | number | |
colorTheme | string | nullTheme sidecar of | |
style | BorderStyle |
Borders
CellAttrs
CellBorders
CellFormat
What a table style gives one cell, the table’s own fill and edges folded in where they rank (a region over the table’s own fill and edges, those over the style’s base). The cell’s own attrs win over all of it (cellStyle).
CodeBlockAttrs
CommentAuthor
CommentCloseAttrs
CommentOpenAttrs
CommentReaction
| Name | Type | Default |
|---|---|---|
emoji | string | |
createdAt | Date | |
users | { id: string; }[] |
ConfigPluginConfig
ConfigPluginState
CounterStackItem
CreateNodeFromContentOptions
| Name | Type | Default |
|---|---|---|
slice | boolean | |
parseOptions | ParseOptions | |
errorOnInvalidContent | boolean |
CreateProofreadCache
Factory passed to proofreadPlugin; creates one cache adapter per editor field.
| Name | Type | Default |
|---|---|---|
field | string |
CreateProofreadDictionary
Factory passed to proofreadPlugin to create a dictionary adapter.
Called once per plugin instance (sub-editors get their own).
CrossReferenceAttrs
CurrentUser
| Name | Type | Default |
|---|---|---|
id | string | |
name | string | |
avatar | string | |
color | string |
DiagnosticCallback
Parameters:| Name | Type | Default |
|---|---|---|
diagnostic | EditorDiagnostic |
DisplayUnits
| Name | Type | Default |
|---|---|---|
baseUnit | "cm" | "inches" | |
indentationUnit | DisplayUnit | |
spacingUnit | DisplayUnit |
DocAttrs
DocIntegrityIssueKind
export type DocIntegrityIssueKind =
/**
* Load: adjacent sections sharing an id, the shape ProseMirror's replace
* fitter leaves when it splits a section around a drop, were merged back.
*/
| "section-split-repaired"
/** Load or pagination pre-flight: duplicate or missing section ids were regenerated. */
| "duplicate-section-id"
/** Edit: the header/footer guard rejected a transaction that broke the section structure. */
| "section-structure-edit-rejected";Reporting channel for document-structure repairs and refusals. Every one
means some path produced (or tried to produce) a broken doc, so hosts send
them to telemetry with doc attached: it is the doc as found, enough to
reproduce.
DocIntegrityReport
One repair or refusal, as addDocIntegrityHandler handlers receive it.
DocumentTheme
A document’s colour theme. Fonts and effects are not modelled (docs/executed/document-theme-plan.md).
Dragging
| Name | Type | Default |
|---|---|---|
startX | number | |
startY | number | |
startWidth | number | |
startHeight | number | |
type | ResizeType | |
adjacentStartWidth | number | |
startTime | number |
EditorDiagnostic
Everything the editor reports to the host’s onDiagnostic, discriminated by
type. editorId is the mount the diagnostic was raised in (a sub-editor’s
own id when it came from one).
| Name | Type | Default |
|---|---|---|
type | "pagination-failure" | "doc-integrity" | "dispatch-error" | "node-view-crash" | "reference-missing" | "reference-restored" | |
editorId | string |
EditorStoreDefaults
| Name | Type | Default |
|---|---|---|
showPagination | boolean | |
mode | EditorMode |
EditorStores
EffectiveNumbering
A paragraph’s numbering after the style cascade is applied. listRef is
always a real key of listConfigs — never INHERIT_LIST_REF.
| Name | Type | Default |
|---|---|---|
listRef | string | |
level | number | |
instanceId | string | undefined | |
tabStop | number | null | |
fromStyle | booleanTrue when the list came from the paragraph’s style rather than its attrs. |
EndnoteAttrs
| Name | Type | Default |
|---|---|---|
id | string | nullThis occurrence’s own id (DS-9); repeated anchors of one note share | |
endnoteRef | string | null |
EndnoteBodyAttrs
| Name | Type | Default |
|---|---|---|
endnoteRef | string | null | |
index | number |
EndnoteItem
| Name | Type | Default |
|---|---|---|
index | number | |
occurrences | number | |
sectionId | string | null | |
isFirstOccurrence | boolean | |
endnoteRef | string |
EndnoteOptions
| Name | Type | Default |
|---|---|---|
showAt | "endOfDocument" | "endOfSection" | |
format | LevelFormatName | |
continuous | boolean | |
startAt | number |
ExportLayoutManifest
A paginated document’s layout: its page count and, per page, the id of the first block that starts on it (null when the page opens with the rest of a block from the page before). The editor sends its own with an export, and the server compares it with the export page’s to catch a PDF that paginates differently from what the user saw.
| Name | Type | Default |
|---|---|---|
pages | number | |
starts | (string | null)[] |
ExportLosses
What an export left out or could not match: images that never loaded, embedded files that were dropped, characters no bundled font covers (they print in a system font), and pages that start on a different block than in the editor that requested the export.
| Name | Type | Default |
|---|---|---|
images | number | |
files | number | |
glyphs | number | |
layout | number |
FileAttrs
An embedded file. Only a PDF can be PREVIEWED (page by page, via
@stesura/pdf-viewer-react; paginated, it sits between two pages). Any other
kind, or a PDF the mount cannot or must not preview, renders as a card that
flows like a small block. The kind is derived from mimeType (fileKind).
FloatDistance
Gap (px) kept between the object and the text wrapping around it.
| Name | Type | Default |
|---|---|---|
top | number | |
right | number | |
bottom | number | |
left | number |
FloatingAttrs
The floating global attribute family.
FloatingBoxAttrs
FloatingBoxBorder
A box’s outline; width in px.
| Name | Type | Default |
|---|---|---|
width | number | |
color | string | |
style | FloatingBoxBorderStyle |
FloatingBoxBorderStyle
export type FloatingBoxBorderStyle = "solid" | "dashed" | "dotted";FloatingBoxHeightRule
export type FloatingBoxHeightRule = "atLeast" | "exact";How a fixed height applies: a minimum the content can grow past, or clipped to it.
FloatingBoxOrigin
export type FloatingBoxOrigin = "textbox" | "frame";Where a text box came from; read only by the DOCX exporter (a wps text box or w:framePr).
FloatingBoxOwnAttrs
The text box’s own attrs; placement comes from the floating family.
FloatingBoxPadding
Space (px) between a box’s border and its content.
| Name | Type | Default |
|---|---|---|
top | number | |
right | number | |
bottom | number | |
left | number |
FloatPosition
Where the object sits, per axis: an alignment within the frame, or, when
align is null, an offset (px) from the frame’s start edge.
FootnoteAttrs
| Name | Type | Default |
|---|---|---|
id | string | nullThis occurrence’s own id (DS-9); repeated anchors of one note share | |
footnoteRef | string | null |
FootnoteBodyAttrs
| Name | Type | Default |
|---|---|---|
footnoteRef | string | null | |
index | number |
FootnoteItem
| Name | Type | Default |
|---|---|---|
index | number | |
occurrences | number | |
sectionId | string | null | |
isFirstOccurrence | boolean | |
footnoteRef | string |
FormatPainterPluginState
| Name | Type | Default |
|---|---|---|
enabled | boolean | |
once | boolean | |
marks | Mark[] | |
attrs | Attrs | |
nodeType | string |
FullEditorStores
GetTextStylesResult
What the toolbar reads: the value attrs as stored, plus one RESOLVED boolean
per negatable mark — mark presence, the paragraph style and off folded
into the single “is it on here” answer. Not the mark’s attr shape, which
carries the negations as a list.
GlobalAttribute
A global attribute definition bound to the node type names that carry it.
GlobalAttributeDefinition
A global attribute definition: the attrs it injects into node specs and how
they serialize to/from the DOM. Definitions are independent of WHICH nodes
carry them — binding is resolved centrally from the default bindings plus
the globalAttributes.nodes delta passed to stesuraSchema.
HighlightAttrs
| Name | Type | Default |
|---|---|---|
color | string |
HighlightPluginState
| Name | Type | Default |
|---|---|---|
persistedColor | string | null |
IBorderOptions
| Name | Type | Default |
|---|---|---|
style | OoxmlBorderStyle | |
color | string | |
colorTheme | string | nullTheme sidecar of | |
size | number | |
space | number |
IBordersOptions
| Name | Type | Default |
|---|---|---|
top | IBorderOptions | |
bottom | IBorderOptions | |
left | IBorderOptions | |
right | IBorderOptions | |
between | IBorderOptions |
ILevelsOptions
ClauseLabel
A numbered block’s clause label (getClauseLabels). own is the counter’s
text; tokens are its levels’ numbers alone (“Part 1 / Section A / 1.1(a)”
→ 1, A, 1, 1, a); label is the display form (“5.2(a)”).
| Name | Type | Default |
|---|---|---|
own | string | |
tokens | readonly string[] | |
label | string |
ImageAltState
Alt text is THREE-state: meaningful (alt set), decorative
(decorative: true), or undeclared (neither). A single string would let an
unlabelled image pass every check as if deliberately decorative.
| Name | Type | Default |
|---|---|---|
alt | string | null | |
decorative | boolean |
ImageAnchoredAttrs
ImageAnchoredOwnAttrs
The picture’s own attrs; placement comes from the floating family.
ImageAttrs
ImageBorderCompound
Word’s a:ln/@cmpd values for a picture’s line, other than single (sng).
ImageCrop
The part of the source bitmap a picture shows, as the percent of its width
(left/right) or height (top/bottom) trimmed from each edge — Word’s
a:srcRect. The displayed box (width/height) is the visible part.
| Name | Type | Default |
|---|---|---|
top | number | |
right | number | |
bottom | number | |
left | number |
ImageGeometryAttrs
What both image nodes carry beyond their layout.
| Name | Type | Default |
|---|---|---|
crop | ImageCrop | null | |
transform | ImageTransform | null |
ImagePluginAction
| Name | Type | Default |
|---|---|---|
type | "add" | "remove" | |
id | unknown |
ImagePluginState
ImageRejection
Why an image was refused (ImageUploadPolicy.onImageRejected).
| Name | Type | Default |
|---|---|---|
reason | "too-large" | "inline-disallowed" | "unsupported-type" | "type-not-allowed" |
ImageTransform
How the picture is turned inside its box — Word’s a:xfrm: degrees
clockwise, and mirroring (applied before the rotation).
| Name | Type | Default |
|---|---|---|
rotation | number | |
flipH | boolean | |
flipV | boolean |
ImageUploadPolicy
How an editor handles image files when no upload strategy is installed
(see setImageUploadStrategy). Declared per editor via the
imageUploadPolicy plugin; absent means inline fallbacks are allowed.
IndentAttrs
Indentation attrs. Every field is optional and nullable, like
SpacingAttrs: a save legitimately emits a partial (only the field the
user touched), and null is the explicit “inherit from the style” unset.
| Name | Type | Default |
|---|---|---|
start | number | null | |
end | number | null | |
special | IndentationSpecials | null | |
by | number | null |
InsertImagePlaceholder
| Name | Type | Default |
|---|---|---|
type | "add" | |
pos | number | |
id | unknown |
InvisibleCharactersState
JSONContent
Loosely describes a JSON representation of a Prosemirror document or node
| Name | Type | Default |
|---|---|---|
type | string | |
attrs | Record<string, any> | |
content | JSONContent[] | |
marks | { [key: string]: any; type: string; attrs?: Record<string, any>; }[] | |
text | string |
LanguageExtractor
Reads a code block’s highlighting language.
| Name | Type | Default |
|---|---|---|
node | Node |
LevelFormat
LineNumbersAttrs
Section-level line numbering, modelled on OOXML’s w:lnNumType. null on the
section means no line numbering. The pagination engine owns the counter and
publishes each line’s number; nothing here is interpreted by CSS.
See DEFAULT_LINE_NUMBERS_ATTRS for the values toggleLineNumbers turns on,
and LINE_NUMBERS_BOUNDS for the ranges setLineNumbers clamps to.
LinkAttrs
| Name | Type | Default |
|---|---|---|
url | string |
ListConfig
| Name | Type | Default |
|---|---|---|
reference | string | |
levels | ILevelsOptions[] |
ListFormatOption
Margins
| Name | Type | Default |
|---|---|---|
top | number | |
right | number | |
bottom | number | |
left | number |
MarkRange
| Name | Type | Default |
|---|---|---|
mark | Mark | |
from | number | |
to | number |
NodeCommentEntry
One thread attached to a whole node via the nodeComments global attribute
(an array — a node can carry several). The node’s id is the anchor.
| Name | Type | Default |
|---|---|---|
threadId | string |
NodeFormatting
| Name | Type | Default |
|---|---|---|
indent | IndentAttrs | |
spacing | SpacingAttrs | |
lineHeight | string | numberUnitless multiplier (1.5 lines) or an exact “Xpt” height. | |
textAlign | string |
NodeWithPos
| Name | Type | Default |
|---|---|---|
node | Node | |
pos | number |
NoteItemBase
Shape shared by both note kinds; only the ref field name differs per kind (kept distinct so a footnote item can never be fed to endnote code).
| Name | Type | Default |
|---|---|---|
index | number | |
occurrences | number | |
sectionId | string | null | |
isFirstOccurrence | boolean |
NotesState
State of the merged notes plugin: one slice per note kind, each in anchor (= numbering) order. Kinds not present in the schema stay empty.
| Name | Type | Default |
|---|---|---|
footnotes | FootnoteItem[] | |
endnotes | EndnoteItem[] |
NumberingAttrs
NumberingOffSentinel
Written on a paragraph whose resolved style IS numbered but which the user
toggled off. Distinct from the null attr, which means “inherit — the style
decides”. Healed back to null by the numbering plugin once the style stops
being numbered.
| Name | Type | Default |
|---|---|---|
listRef | null |
NumberingPluginState
| Name | Type | Default |
|---|---|---|
numberingConfigs | Map<string, ListConfig> | |
selectedConfigId | string | null | |
selectedinstanceId | string | null | |
applyNumbering | boolean | |
currentLevel | number |
PageFormats
| Name | Type | Default |
|---|---|---|
width | number | |
height | number | |
label | string | |
value | string | |
default | boolean |
PageMargins
| Name | Type | Default |
|---|---|---|
top | number | |
right | number | |
bottom | number | |
left | number | |
label | string | |
value | string | |
default | boolean |
PageNumberAttrs
| Name | Type | Default |
|---|---|---|
pageType | PageNumberType |
PageNumberingAttrs
A section’s page numbering, modelled on w:pgNumType: the number its first
page prints — null continues from the previous section, Word’s default —
and the format every page of the section prints in.
| Name | Type | Default |
|---|---|---|
start | number | null | |
format | PageNumberFormat |
PaginationAttrs
PaginationPluginState
ParagraphStyle
Parser
Highlights a code block into decorations, or returns a promise (optionally with interim decorations) that resolves once a still-loading highlighter is ready.
| Name | Type | Default |
|---|---|---|
options | ParserOptions |
ParserOptions
| Name | Type | Default |
|---|---|---|
content | stringText content of the code block. | |
pos | numberStart position of the code block. | |
language | string | |
size | numberThe node’s | |
node | Node |
PdfPreviewAssets
URLs the host app serves pdf.js’s out-of-bundle resources from. pdf.js loads
its worker as a separate script and fetches cMaps, standard fonts, the
WASM modules and ICC profiles lazily BY URL; none of that can be inlined into a
library bundle and a library cannot know the app’s public path, so the
integrator passes them (pdf-viewer-assets --out public/pdfjs copies them).
PdfPreviewConfig
Everything isPdfPreview needs — the one decision the node view, pagination
and the PDF export must agree on. Both facts are STATIC for a mount and known
before first layout: ready is whether the mount’s uiExtensions include
the viewer, and the allowlist is config.
| Name | Type | Default |
|---|---|---|
ready | boolean | |
allowedFileHosts | string[]The config plugin’s |
PdfPreviewLimits
Ceilings a preview refuses to render past (SEC-70).
| Name | Type | Default |
|---|---|---|
maxPages | numberPages rendered before the preview stops and says how many are left. | |
maxBytes | number
|
PdfPreviewProps
What the preview component is given for one file node.
PendingLinkPluginState
| Name | Type | Default |
|---|---|---|
isPending | boolean | |
pendingSelection | Selection | null | |
existingUrl | string |
Problem
| Name | Type | Default |
|---|---|---|
from | number | |
to | number | |
msg | string | |
shortmsg | string | |
type | string | |
replacements | { value: string; }[]Suggested corrections in LanguageTool’s object shape (PR-2). Capped at five. |
ProofingLanguageAttrs
The block’s proofing language (BCP 47), top of the
paragraph ?? style ?? doc chain. null defers to the level below.
Named apart from a code block’s codeLanguage: gates key on attr presence,
so one language would give a code block a spell checker.
| Name | Type | Default |
|---|---|---|
proofingLanguage | string | null |
ProofreadCacheAdapter
Storage abstraction for the proofread cache (memory, redis, localforage…).
Sync contract
get / entries / set / delete are synchronous. Decoration rendering
runs inside doc.descendants on every transaction and cannot block on IO.
Async-backed adapters (redis, idb) are expected to maintain an in-memory
mirror and schedule persistence in the background.
External changes
Adapters whose data can change from outside the plugin (collaborator edits
on a y.Map, redis pubsub, another tab via BroadcastChannel) should implement
subscribe. The plugin calls it on mount and triggers a decoration refresh
when notified.
Pass the changed node ids to the callback when the adapter knows them. The plugin then re-queues only those nodes, and a sub-editor skips the rebuild entirely when none of them is in its document — without the ids, every remote write walks every mounted editor. Omitting them stays correct, just broader.
Cross-instance fan-out
One page creates several instances for the same field: the main editor’s
plugin plus one subscriber plugin per sub-editor (headers, footers, notes),
all through the same factory. Sub-editors only ever repaint from these
notifications, so set and delete MUST notify subscribers registered
through every instance backed by the same store, with the changed ids —
not just the instance that wrote. Adapters don’t need to filter out the
writer’s own notifications, but the notification MUST be delivered
synchronously from inside set/delete: the main plugin suppresses its own
writes with a flag held only for the duration of the call, so a deferred
notification (microtask, network echo) makes it treat every one of its own
writes as external — a wasted re-check pass per write.
Readiness
An adapter that fills its mirror from an async source (a hydration GET, an idb read)
should expose that as ready. The plugin’s FIRST pass waits for it (bounded — a dead
endpoint must not stall proofreading), so a document whose results are already in the
shared store is not re-sent to the api on every load (PR-47). Resolve it on failure
too; reject never. Adapters with no async source omit it.
ProofreadCacheItem
ProofreadDictionaryAdapter
Storage abstraction for the user’s proofread dictionary (“add to dictionary”).
The dictionary is identity-scoped (a user and the groups they belong to), never document-scoped: it is applied as a render-time filter over cached problems, so cached results stay dictionary-blind and shareable across collaborators.
Sync contract
Same as ProofreadCacheAdapter: has runs inside decoration builds and
cannot block on IO. Async-backed adapters keep an in-memory mirror and persist
in the background.
Language
language is always a primary subtag ("en", never "en-US") or null.
An entry stored with language: null applies to every language (names, brand
terms); has must honour that.
External changes
subscribe should fire on any change to the effective dictionary — including
writes from this same page through another adapter instance (sub-editors create
their own), other tabs, or the server. The plugin only rebuilds decorations from
cache on notification, so over-notifying is cheap and safe.
Range
| Name | Type | Default |
|---|---|---|
from | number | |
to | number |
RemoveImagePlaceholder
| Name | Type | Default |
|---|---|---|
type | "remove" | |
id | unknown |
ResolvedIndentAttrs
IndentAttrs with every value resolved — nothing inherited, nothing
unset. What the ruler and the CSS emitters work in, once the style chain has
been walked.
| Name | Type | Default |
|---|---|---|
start | number | |
end | number | |
special | NonNullable<IndentationSpecials | null | undefined> | |
by | number |
ResolvedStyleDefinition
ResolvedUser
| Name | Type | Default |
|---|---|---|
name | string | |
avatar | string |
ResolveMentionSuggestionsCallback
User ids matching a mention query, in display order. text is what follows
the trigger; empty means everyone worth suggesting.
| Name | Type | Default |
|---|---|---|
params | { text: string; } |
ResolveUsersCallback
Resolves user ids to display data. The result is index-aligned with userIds.
| Name | Type | Default |
|---|---|---|
params | { userIds: string[]; } |
RowAttrs
SectionAttrs
SectionOptions
SelectedBorders
| Name | Type | Default |
|---|---|---|
top | boolean | |
bottom | boolean | |
left | boolean | |
right | boolean | |
between | boolean | |
outside | boolean | |
all | boolean | |
insideVertical | boolean | |
insideHorizontal | boolean |
SerializedComment
| Name | Type | Default |
|---|---|---|
body | JSONContentProseMirror JSON (a doc of paragraphs). Undefined once soft-deleted. | |
id | string | |
author | CommentAuthor | |
threadId | string | |
createdAt | string | |
deletedAt | string | |
reactions | SerializedReaction[] |
SerializedReaction
| Name | Type | Default |
|---|---|---|
emoji | string | |
users | { id: string; }[] | |
createdAt | string |
SerializedThread
| Name | Type | Default |
|---|---|---|
id | string | |
resolved | boolean | |
metadata | Record<string, unknown> | |
createdAt | string | |
deletedAt | string | |
comments | SerializedComment[] |
Size
| Name | Type | Default |
|---|---|---|
width | number | |
height | number |
SortOptions
| Name | Type | Default |
|---|---|---|
colIndex | number | |
descending | boolean | |
orderBy | "number" | "date" | "text" |
SpacingAttrs
StyleDefinition
StyleNumbering
A style’s numbering binding: a pointer into doc.attrs.listConfigs plus the
level of that list the style occupies (Word’s w:numPr on a style’s pPr).
A style family — Definitions L.1 … L.9 — shares one listRef with different
levels. tabStop is the style-level fallback for the paragraph attr; what
follows the number is the level’s (Word has no w:suff on a style).
| Name | Type | Default |
|---|---|---|
listRef | string | |
level | number | |
tabStop | number |
StylePaginationProps
| Name | Type | Default |
|---|---|---|
keepWithNext | boolean | |
widowOrphan | boolean | |
pageBreakBefore | boolean | |
keepLines | boolean |
StyleSheetState
| Name | Type | Default |
|---|---|---|
resolvedStyles | StyleSheet | |
overrides | StyleSheet
|
TableAttrs
TableBorders
TableDragState
| Name | Type | Default |
|---|---|---|
dragging | { node: Node; } | null |
TableLook
Which of its table style’s regions a table turns on (Word’s w:tblLook, the
Table Design tab’s Style Options). Independent of headerRowCount.
| Name | Type | Default |
|---|---|---|
firstRow | boolean | |
lastRow | boolean | |
firstColumn | boolean | |
lastColumn | boolean | |
bandedRows | booleanWord’s | |
bandedColumns | booleanWord’s |
TableRegionStyle
The formatting one conditional region adds over the table style’s base.
TableResizingOptions
| Name | Type | Default |
|---|---|---|
handleWidth | number | |
handleHeight | number | |
cellMinWidth | number | |
cellMinHeight | number | |
defaultCellMinWidth | number |
TableStyle
A type: "table" style’s formatting. Resolved through basedOn per field:
a stated border edge replaces the base’s, a region merges per field.
TabStop
A paragraph tab stop — Word’s w:tab. pos is px from the start edge of
the paragraph’s text area (the margin, not the indent), as in Word.
| Name | Type | Default |
|---|---|---|
pos | number | |
align | TabStopAlign | |
leader | TabStopLeader |
TextStyle
A style’s character-level properties.
bgColor is rendered on type: "character" entries ONLY (e.g. HTMLCode’s
shading): a paragraph style is one CSS rule on the block element, where a run
fill would paint the whole paragraph. Use paragraphStyle.backgroundColor
for a block fill and the textStyle/highlight mark for a one-off run fill.
color has the mark attr’s three states: “#RRGGBB”, AUTO_COLOR "auto"
(resolved against the background at render time), or absent (inherit
through basedOn).
TextStyleAttrs
TextStyleAttrsWithoutOff
ThemeSwatch
One cell of the picker’s theme grid; name and variant let a picker label it.
| Name | Type | Default |
|---|---|---|
hex | string | |
ref | string | |
name | ThemeSwatchColumn | |
variant | { lighter: boolean; percent: number; } | nullnull on the base row. |
Thread
| Name | Type | Default |
|---|---|---|
id | string | |
resolved | boolean | |
createdAt | Date | |
deletedAt | Date | |
metadata | Record<string, unknown> | |
comments | ThreadComment[] |
ThreadComment
Toast
What reaches the host’s onToast. description is localized by
editor-react; key and params let a host render its own copy instead.
Both are absent on toasts the host raises itself.
| Name | Type | Default |
|---|---|---|
type | ToastType | |
description | string | |
key | ToastKey | |
params | Record<string, string | number> |
ToastCallback
Parameters:| Name | Type | Default |
|---|---|---|
toast | Toast |
ToastMessage
What an emitter hands getToaster — the key, its params, and a level.
ToastParams
Values interpolated into a message. Keys absent here take no params.
| Name | Type | Default |
|---|---|---|
sortColumnOutOfRange | { column: number; columns: number; } |
TOCattrs
TOCbreakEntry
One page break cutting through a TOC node. Written by the pagination engine
after each recompute; the TOC nodeview renders a spacer of paddingTop px
between rows afterLine - 1 and afterLine.
| Name | Type | Default |
|---|---|---|
afterLine | number | |
paddingTop | number |
TOCitem
Fully serializable — no live EditorView/Node/DOM references.
TOCstate
| Name | Type | Default |
|---|---|---|
content | TOCitem[] |
ToggleCounterTrProps
| Name | Type | Default |
|---|---|---|
buttonType | "number" | "bullet" | |
levelFormat | LevelFormat |
TrackChangesAttrs
Block-level lifecycle track-changes variants. Stored on the trackChanges
node attribute.
deletion— the whole block (open + content + close) is being deleted. All inline content carries deletion marks. Hidden when track-changes display is off; removed on accept.insertion— the whole block was inserted; content carries insertion marks. Removed on reject.deleteClosure— only this block’s closing paragraph boundary (¶) is being deleted. Content stays. On accept, the block merges forward with the next block (tr.join). The attribute lives on the block BEFORE the boundary, not after, so the visual cue (red ¶) sits on its owning block.
Block-level attribute modifications (changes to node attrs like
alignment, list numbering, heading level, etc.) live separately on the
trackChangesModification node attribute — see trackChangesModificationAttrs.
That separation lets a single node carry BOTH a lifecycle change and a
pending modification at the same time (e.g. a paragraph being deleted whose
alignment was also changed), with each resolvable independently — the
Word-style “format change can sit on top of a deletion” semantic.
trackChangesModificationAttrs
Block-level attribute modification track-change. Stored on the
trackChangesModification node attribute, independent of TrackChangesAttrs.
attrs is a partial map of { attrName → previousValue } — only the keys
the user has actually modified are present, paired with their pre-change
values so the modification can be rolled back on reject. Invariant: the
attribute is set to null rather than {} when no keys remain (e.g. after
a cancel-out roll-back), so the presence of the attr always indicates a
resolvable change.
Two reserved keys, both exported from constants:
NODE_TYPE_MODIFICATION_KEY ("__nodeType") records a pending node TYPE
change (paragraph ↔ heading) — its value is the previous type NAME rather
than an attr value, and the resolver reverts it via setNodeMarkup instead
of setNodeAttribute. NODE_TYPE_ATTRS_MODIFICATION_KEY
("__nodeTypeAttrs") rides alongside it holding the source attrs the type
change dropped (heading.level), so the same setNodeMarkup can restore
them. The pair is written and cleared together.
| Name | Type | Default |
|---|---|---|
id | string | |
date | string | null | |
userId | string | null | |
userName | string | null | |
requestedById | string | nullSee TrackChangesAttrs.requestedById. | |
requestedByName | string | null | |
attrs | Attrs |
TrackChangesState
TransactionFn
Parameters:| Name | Type | Default |
|---|---|---|
props | TransactionFnProps |
TransactionFnProps
What a TransactionFn is called with. dispatch is absent on a dry run.
| Name | Type | Default |
|---|---|---|
tr | Transaction | |
state | EditorState | |
view | EditorView | |
dispatch | (tr: Transaction) => void |
Underline
| Name | Type | Default |
|---|---|---|
type | Underlines | |
style | string | |
thickness | string | undefined | |
offset | string | undefined |
UnderlineAttrs
| Name | Type | Default |
|---|---|---|
variant | UnderlinesNot | |
color | string | null | |
colorTheme | string | null |
UploadBlockAttrs
| Name | Type | Default |
|---|---|---|
uploadType | string | null |
UserPreferences
XmlElementData
An OOXML element kept as read (elements and attributes only), written back verbatim.
| Name | Type | Default |
|---|---|---|
name | string | |
attrs | Record<string, string> | |
children | XmlElementData[] |
Other exports
| Export | Type | Description |
|---|---|---|
AccessibilityRule | "imageMissingAlt" /** Link text that says nothing out of context ("click here", a bare URL). */ | "linkTextNotDescriptive" /** The same link text pointing at more than one destination. */ | "duplicateLinkText" /** A paragraph formatted like a heading but not styled as one. */ | "headingLikeParagraph" /** An outline level reached without passing through its parent (1 → 3). */ | "skippedHeadingLevel" /** A table whose first row is not marked as a header row. */ | "tableMissingHeaderRow" | The accessibility checker’s rules (v1). Per ATAG they surface judgement calls to the author, as Word/Docs/Acrobat do; none auto-fixes anything. |
AlignmentDirection | "top" | "middle" | "bottom" | |
AlignmentTypeValue | "start" | "center" | "end" | "both" | "mediumKashida" | "distribute" | "numTab" | "highKashida" | "lowKashida" | "thaiDistribute" | "left" | "right" | |
AtomValue | AtomValue<T> | The value type of a nanostores atom. |
AttrsWithDefaults | { [K in keyof T]: { default: T[K]; validate?: string | ((value: any) => void) } } | ProseMirror attr specs for every key of T. |
BlockHandleState | { node: Node; pos: number } | null | The block under the drag handle, if any. |
BorderPosition | "top" | "bottom" | "left" | "right" | "between" | |
BorderStyle | "single" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "inset" | "outset" | "none" | |
Caps | "all" | "small" | "none" | Word’s two casing FORMATS, plus an explicit off. One slot, so all caps and small caps are mutually exclusive by construction. "none" is an explicit off that beats an inherited all-caps; null inherits. |
CaseChange | "sentence" | "uppercase" | "lowercase" | "capitalize" | Case changes offered as EDITS: they rewrite the stored characters and store nothing. Clearing the casing FORMAT is Caps via setCaps instead. |
CellAlignment | ${AlignmentDirection}-${TableAlign} | |
CommentDisplayMode | "anchored" | "floating" | "minimized" | "none" | |
Content | HTMLContent | JSONContent | JSONContent[] | null | Content given as an HTML string or ProseMirror JSON. |
CrossRefType | "default" | "noContext" | "fullContext" | "aboveBelow" | "page" | "text" | What a cross-reference shows, as Word’s Cross-reference dialog names it: the paragraph number in relative context, with no context or in full context, above/below, the page (Word’s PAGEREF) or the target’s text (“Heading text”). |
CSSProperties | Properties<string | number> & { [key: `--${string}`]: string | number | undefined } | A style object: csstype Properties plus CSS custom properties (--name). |
DisplayUnit | "cm" | "inches" | "pt" | "px" | |
EditorMode | "edit" | "review" | "view" | Editor mutability mode. "edit" — full editing. "review" — all edits become tracked suggestions. Requires the track-changes plugin: configuring it without one throws. The toggle that would turn tracking off is refused for as long as the mode is set. "view" — read-only: local doc-changing transactions are dropped at dispatch, remote collab changes still apply. |
EditorStoreExtensions | interface EditorStoreExtensions {} | Module-augment this interface to type the extension stores passed to createEditorStores. |
FileKind | "pdf" | "other" | |
FileRotation | 0 | 90 | 180 | 270 | The rotations a file node can store. |
FindResult | ContentNodeWithPos | undefined | Result of a prosemirror-utils node lookup. |
FloatHorizontalAlign | "left" | "center" | "right" | "inside" | "outside" | |
FloatHorizontalRelativeTo | "character" | "column" | "insideMargin" | "leftMargin" | "margin" | "outsideMargin" | "page" | "rightMargin" | Word’s horizontal frames (wp:positionH/@relativeFrom). |
FloatSide | "left" | "right" | Which side a square/tight float sits on. |
FloatVerticalAlign | "top" | "center" | "bottom" | "inside" | "outside" | |
FloatVerticalRelativeTo | "bottomMargin" | "insideMargin" | "line" | "margin" | "outsideMargin" | "page" | "paragraph" | "topMargin" | Word’s vertical frames (wp:positionV/@relativeFrom). |
FloatWrap | "inline" | "square" | "tight" | "topBottom" | "front" | "behind" | How text wraps a positioned object (floating family): on its line, floated beside it, above and below, or out of flow in front of or behind it. |
FollowBy | "tab" | "space" | "nothing" | |
followNumberingWith | readonly ["tab", "space", "nothing"] | What can follow a list number. FollowBy is its element type. |
GlobalAttributeMap | Record<T, GlobalAttribute> | The resolved global attributes of a schema, keyed by attribute name. |
HeaderFooterVariant | "default" | "even" | "first" | |
HTMLContent | string | |
ImageAlign | "start" | "end" | "center" | "fullWidth" | |
ImageAnchoredWrap | Exclude<FloatWrap, "topBottom"> | Wrap modes an anchored picture takes (the floating family’s, see FloatWrap). Text above and below is the BLOCK image node instead. |
ImageWrap | "top-bottom" | "square" | Wrap attr of the BLOCK image node. “square” is a legacy value from the first wrap attempt (float on the block node) — kept for parsing old docs. New wrap behaviours live on the inline image_anchored node (see ImageAnchoredWrap). |
ImageWrapMode | "top-bottom" | ImageAnchoredWrap | The full wrap-mode surface exposed by the setImageWrap command / toolbar. “top-bottom” selects the BLOCK image node (text above and below); every other mode selects the inline image_anchored node with that wrap. |
IndentationSpecials | "none" | "first-line" | "hanging" | |
Json | string | number | boolean | null | Json[] | { [key: string]: Json | undefined } | Any JSON value. |
JSONContentAttrs | Record<string, any> | The attrs of a JSONContent node. |
LevelFormatName | "decimal" | "upperRoman" | "lowerRoman" | "upperLetter" | "lowerLetter" | "ordinal" | "cardinalText" | "ordinalText" | "hex" | "chicago" | "ideographDigital" | "japaneseCounting" | "aiueo" | "iroha" | "decimalFullWidth" | "decimalHalfWidth" | "japaneseLegal" | "japaneseDigitalTenThousand" | "decimalEnclosedCircle" | "decimalFullWidth2" | "aiueoFullWidth" | "irohaFullWidth" | "decimalZero" | "bullet" | "ganada" | "chosung" | "decimalEnclosedFullstop" | "decimalEnclosedParen" | "decimalEnclosedCircleChinese" | "ideographEnclosedCircle" | "ideographTraditional" | "ideographZodiac" | "ideographZodiacTraditional" | "taiwaneseCounting" | "ideographLegalTraditional" | "taiwaneseCountingThousand" | "taiwaneseDigital" | "chineseCounting" | "chineseLegalSimplified" | "chineseCountingThousand" | "koreanDigital" | "koreanCounting" | "koreanLegal" | "koreanDigital2" | "vietnameseCounting" | "russianLower" | "russianUpper" | "none" | "numberInDash" | "hebrew1" | "hebrew2" | "arabicAlpha" | "arabicAbjad" | "hindiVowels" | "hindiConsonants" | "hindiNumbers" | "hindiCounting" | "thaiLetters" | "thaiNumbers" | "thaiCounting" | "bahtText" | "dollarText" | "custom" | |
LevelFormatValue | ILevelsOptions["format"] | A list level’s number format ("decimal", "lowerRoman", …). |
LevelSuffixValue | "nothing" | "space" | "tab" | |
LineHeightAtLeast | { pt: number; derived: number } | A Word “At least” line height: renders as the multiplier derived; pt is written back on export while lineHeight still equals derived. |
MaybeReadOnly | Readonly<T> | T | |
Mutable | { -readonly [P in keyof T]: T[P] } | |
NodeCommentsAttr | NodeCommentEntry[] | null | Value of the nodeComments global attribute. |
Nullable | { [P in keyof T]: T[P] | null } | |
NumberCasing | "capitalize" | "uppercase" | "lowercase" | "firstLetter" | Casing for the word-based number formats (cardinalText, ordinalText): capitalize — every word capitalised: “Forty-Two” (the converters’ native output); uppercase — “FORTY-TWO”; lowercase — “forty-two”; firstLetter — only the leading letter capitalised: “Forty-two” |
NumberGender | "masculine" | "feminine" | The grammatical genders the numbering UI offers. |
NumberingAttrValue | NumberingAttrs | NumberingOffSentinel | null | The numbering node attr: direct numbering (listRef: INHERIT_LIST_REF takes the list from the style), the off sentinel { listRef: null }, or null to inherit. |
OoxmlBorderStyle | "single" | "dashDotStroked" | "dashed" | "dashSmallGap" | "dotDash" | "dotDotDash" | "dotted" | "double" | "doubleWave" | "inset" | "nil" | "none" | "outset" | "thick" | "thickThinLargeGap" | "thickThinMediumGap" | "thickThinSmallGap" | "thinThickLargeGap" | "thinThickMediumGap" | "thinThickSmallGap" | "thinThickThinLargeGap" | "thinThickThinMediumGap" | "thinThickThinSmallGap" | "threeDEmboss" | "threeDEngrave" | "triple" | "wave" | |
PageNumberFormat | "decimal" | "lowerRoman" | "upperRoman" | "lowerLetter" | "upperLetter" | Word’s page-number formats (w:pgNumType/@w:fmt) the editor prints. |
PageNumberType | "currentPage" | "totalPages" | |
ResizeType | "column" | "row" | |
StringLiteralsOnly | StringLiteralsOnly<T> = T extends string ? (string extends T ? never : T) : never | |
StyleSheet | Record<string, StyleDefinition> | A document’s style definitions, keyed by style id. |
TableAlign | "start" | "center" | "end" | |
TABLE_REGIONS | readonly ["wholeTable", "band1Vert", "band2Vert", "band1Horz", "band2Horz", "firstCol", "lastCol", "firstRow", "lastRow", "nwCell", "neCell", "swCell", "seCell"] | A table style’s conditional regions, in the order Word layers them: a later region wins, field by field. |
TableRegion | (typeof TABLE_REGIONS)[number] | One of TABLE_REGIONS. |
TableRegionBorders | Partial<Record<"top" | "bottom" | "left" | "right" | "insideH" | "insideV", BorderOptions>> | A region’s outer edges and the lines between its cells. |
TableTextStyle | Pick<TextStyle, "color" | "colorTheme" | "strong" | "em"> | The run formatting a table style carries: Word’s table styles change these per region. |
TabStopAlign | "start" | "center" | "end" | "decimal" | Where text lands against a tab stop: decimal lines up on the first ”.”. |
TabStopLeader | "none" | "dot" | "hyphen" | "underscore" | What fills the gap a tab leaves. |
TextAlignType | "justify" | "start" | "end" | "center" | |
TextDirection | "ltr" | "rtl" | |
TextStyleOff | "strong" | "em" | "underline" | "strikethrough" | "superscript" | "subscript" | The marks a textStyle mark can negate — Word’s “bold style, unbolded run”. Turning a property ON is the standalone marks’ job; only OFF needs a slot, since a mark cannot be absent-with-emphasis. TEXT_STYLE_OFF in helpers/text-style.ts is the ordered runtime array, checked against this. |
ThemeColorName | "dark1" | "light1" | "dark2" | "light2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hyperlink" | "followedHyperlink" | "background1" | "text1" | "background2" | "text2" | The theme colour names w:themeColor carries (ECMA-376 ST_ThemeColor minus “none”). |
ThemeColorRef | string | A theme colour name plus Word’s tint/shade byte: “accent1”, “accent1:tint=99”, “accent1:shade=BF”. A string so marks carrying it stay value-comparable. |
ThemeColorSlot | "dk1" | "lt1" | "dk2" | "lt2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hlink" | "folHlink" | The twelve a:clrScheme slots of a DocumentTheme. |
ThemeMappedSlot | "dk1" | "lt1" | "dk2" | "lt2" | The slots DocumentTheme["mapping"] can point the text/background names at. |
ThemeSwatchColumn | "background1" | "text1" | "background2" | "text2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | Word’s theme grid columns, left to right. |
ToastKey | "cannotInsertAcrossNodes" | "cannotRemoveOnlySection" | "cannotRemoveSectionBreakWhileSuggesting" | "missingSortColumn" | "sortColumnOutOfRange" | "cannotSortMergedRows" | "nestedTablesNotAllowed" | "dispatchFailed" | "footnoteRemoved" | "endnoteRemoved" | Every message core and the feature packs can raise. Core emits keys, not text, so a host can translate or reword messages without matching English. |
ToastType | "success" | "info" | "error" | "warning" | "default" | |
TOCItemType | "numberedItem" | "heading" | |
TOCrun | { text: string; marks?: TOCrunMark[] } | { math: string } | One renderable fragment of a TOC entry: formatted text, or LaTeX for an equation. |
TOCrunMark | "em" | "superscript" | "subscript" | |
TrackChangesUser | CurrentUser & { requestedBy?: { id: string; name?: string } } | Who a tracked change is attributed to; an agent’s carries the user it works for. |
Underlines | "single" | "double" | "thick" | "dotted" | "dottedHeavy" | "dash" | "dashedHeavy" | "wave" | "wavyHeavy" |
AI tool contract
The shape a package builds agent tools against without depending on @stesura/ai, which re-exports it (see Extending the chat with custom tools). AiToolDeclaration is what the model sees and the server declares; AiEditorTool adds an execute that runs in the browser with AiToolExecutionOptions, AiServerTool one that runs in the route with AiServerToolContext. defineAiTool turns either into an AiTool (DefinedAiEditorTool or DefinedAiServerTool), whose run validates input and resolves to an AiToolRun. AiToolKind drives the ask-mode gate and the review UI, and a server tool’s is an AiServerToolKind (read or config); AiToolLabels names the status-chip strings. Input schemas are AiToolSchema: Standard Schema plus Standard JSON Schema, with AiToolSchemaResult, AiToolSchemaIssue and AiToolJsonSchemaOptions vendored as types.
AiToolSession is the read ledger of one conversation: read_document records the blocks it showed (AiReadBlock) and the AiReadView it showed them in, so an edit merges against the text the agent saw. Pass one as AiToolExecutionOptions.session.
IssueProvider is one source of findings for the agent’s list_issues and fix_issues: collect returns AiIssues, each with an AiIssueFixKind (none, tracked or direct), and apply takes AiIssueFixes and returns an AiIssueApplyResult.
Redaction
RedactionAttrs is the redaction mark’s attrs, and the block-leaf attribute’s: id, reason,
status (RedactionStatus: proposed, confirmed, or final in an export’s prepared document),
author, date, note, and for a final label fragments (RedactionFragment, one per line it
occupied), shape (RedactionShape) and boxStyle (outline, or null for the fill:
RedactionBoxStyle). A host’s reasons are a RedactionTaxonomy of RedactionReasons. A
RedactionRegion is a redacted area of a picture, in fractions of its uncropped bitmap. See
Redaction.