Skip to Content
API Referencecorecore/constants

@stesura/core/constants

Shared constant values: defaults, presets and reserved attr names.

The global-attribute default lists and predicates (FORMATTED_NODES, isFormattedType, getFormattedNodeNames, …) are also exported here; they are documented on core/schema.

Functions & values

DEFAULT_BULLET_LEVEL_FORMAT

NameTypeDefault
formatLevelFormatName | undefined
textstring
tabStopnumber

Level-config tabStop in px (see ILevelsOptions.tabStop).

genderNumberGender

Level-config gender (see ILevelsOptions.gender).

casing"capitalize" | "uppercase" | "lowercase" | "firstLetter"

Level-config casing (see ILevelsOptions.casing).

DEFAULT_BULLET_LIST

NameTypeDefault
referencestring
levelsILevelsOptions[]

DEFAULT_FORMATTING

NameTypeDefault
startnumber
endnumber
specialNonNullable<IndentationSpecials | null | undefined>
bynumber

DEFAULT_LINE_NUMBERS_ATTRS

NameTypeDefault
countBynumber

Show only every Nth line’s number (Word’s “Count by”). Every line is still counted.

distancenumber

Gap in px between the gutter and the section’s text edge (OOXML stores twips).

restart"continuous" | "newPage" | "newSection"

Where the counter resets: never, on every page, or at the section’s first line.

startnumber

The first line’s number, 1-based (Word’s floor is 1).

DEFAULT_NUMBER_LIST

NameTypeDefault
referencestring
levelsILevelsOptions[]

DEFAULT_NUMBERED_LEVEL_FORMAT

NameTypeDefault
formatLevelFormatName | undefined
textstring
tabStopnumber

Level-config tabStop in px (see ILevelsOptions.tabStop).

genderNumberGender

Level-config gender (see ILevelsOptions.gender).

casing"capitalize" | "uppercase" | "lowercase" | "firstLetter"

Level-config casing (see ILevelsOptions.casing).

DEFAULT_NUMBERING_ATTRIBUTES

NameTypeDefault
listRefstring | null

The list this paragraph numbers against. INHERIT_LIST_REF means “take the list from the resolved style”; null is the off-sentinel (see NumberingAttrValue).

levelnumber

level / instanceId / followBy are USER data:

  • on a directly-numbered paragraph they are the canonical storage and the numbering plugin keeps them stamped;
  • on a style-numbered paragraph (INHERIT_LIST_REF) they are OVERRIDES and stay absent unless the user explicitly set one (level change at an unbound level, restart, context-menu followBy). The style cascade fills the gaps — stamping derived values here froze the binding (CORE-37).
instanceIdstring
followBy"tab" | "space" | "nothing"
isBulletboolean
tabStopnumber | null

Per-instance override of the level config’s tabStop (px, see ILevelsOptions.tabStop).

resolvedListRefstring | null

Caches the numbering plugin stamps on style-numbered paragraphs only: the values the cascade produced on the last walk. Read-only outside the plugin. DOM serialization and DOCX export use them as display fallbacks; the effective-numbering resolver ignores them, so a binding edit always re-derives.

resolvedLevelnumber
resolvedInstanceIdstring
resolvedFollowBy"tab" | "space" | "nothing"

DEFAULT_PAGE_MARGINS

NameTypeDefault
topnumber
bottomnumber
leftnumber
labelstring
valuestring
defaultboolean

DEFAULT_PAGE_SIZE

NameTypeDefault
widthnumber
heightnumber

DEFAULT_SPACING

NameTypeDefault
beforenumber | null
afternumber | null
contextualboolean | null

Word’s “don’t add space between paragraphs of the same style” (w:contextualSpacing): between two blocks of one style, the before/after of a block that sets it is ignored. Inherits through the style like the other fields; null inherits.

DEFAULT_TEXT_STYLE

NameTypeDefault
colorstring | null
fontSizenumber
fontFamilystring
capsnull
bgColorstring
offnull

defaultList1

NameTypeDefault
referencestring
levelsILevelsOptions[]

defaultList2

NameTypeDefault
referencestring
levelsILevelsOptions[]

defaultListBullet

NameTypeDefault
referencestring
levelsILevelsOptions[]

findFontFamily

Parameters:
NameTypeDefault
rawstring
Returns:
{ label: string; value: string; ms: string; googleFont: string; group: "Sans Serif" | "Serif" | "Monospace" | "Script"; spaceDot: "SpaceDotArimo" | "SpaceDotArchivoBlack" | "SpaceDotCarlito" | ... 10 more ... | "SpaceDotCousine"; } | null

fontFamilyToCssStack

Parameters:
NameTypeDefault
namestring
Returns:
string

isPrivateUseGlyph

Parameters:
NameTypeDefault
textstring
Returns:
boolean

LINE_NUMBERS_BOUNDS

NameTypeDefault
countBy{ readonly min: 1; readonly max: 100; }
distance{ readonly min: 0; readonly max: 144; }

px. 144 ≈ 1.5” — the widest gutter Word will accept.

start{ readonly min: 1; readonly max: 1000; }

normalizeFontFamily

Parameters:
NameTypeDefault
rawstring
Returns:
string | null

resolveDisplayFont

Parameters:
NameTypeDefault
rawstring
Returns:
{ label: string; value: string; ms: string; googleFont: string; group: "Sans Serif" | "Serif" | "Monospace" | "Script"; spaceDot: "SpaceDotArimo" | "SpaceDotArchivoBlack" | "SpaceDotCarlito" | ... 10 more ... | "SpaceDotCousine"; }

spaceDotFontFamily

Parameters:
NameTypeDefault
namestring
Returns:
"SpaceDotArimo" | "SpaceDotArchivoBlack" | "SpaceDotCarlito" | "SpaceDotNotoSans" | "SpaceDotFiraSans" | "SpaceDotPTSans" | "SpaceDotAnton" | "SpaceDotComicNeue" | "SpaceDotInter" | ... 4 more ... | "SpaceDotCousine"

symbolFontBullet

Parameters:
NameTypeDefault
textstring
fontstring
Returns:
string | undefined

UnderlineType

NameTypeDefault
SINGLE"single"
DOUBLE"double"
THICK"thick"
DOTTED"dotted"
DOTTEDHEAVY"dottedHeavy"
DASH"dash"
DASHEDHEAVY"dashedHeavy"
WAVE"wave"
WAVYHEAVY"wavyHeavy"

Types

ProofingLanguageOption

NameTypeDefault
valuestring
labelstring

Other exports

ExportTypeDescription
AUTO_COLOR"auto"Sentinel for Word’s “automatic” font color (w:color w:val="auto"): an EXPLICIT value that overrides an inherited color and resolves at render time to whichever of black/white contrasts with the nearest background. Stored verbatim in the color slot of textStyle marks and character styles so it round-trips through DOCX; never valid in any other color slot.
BLOCK_STYLE_ATTR"styleId"The block styleId attr (DOC_STYLE_SHEET_ATTR is the doc-level sheet). Spelled once each because a step.attr === … handler that matches the wrong one fails SILENTLY: a cache stops invalidating, a heal stops running. satisfies forces a rename back through here.
BORDER_POSITIONS["top", "bottom", "left", "right"]Block border sides.
BORDER_STYLESBorderStyle[]Supported border styles.
CAPS_VALUES["all", "small", "none"]The two casing formats plus an explicit off.
CASE_CHANGES["sentence", "uppercase", "lowercase", "capitalize"]changeCase modes, in menu order.
CODE_LANGUAGESreadonly [{ readonly value: ""; readonly label: "Plain text"; }, { readonly v…Supported code-block languages, as value / label pairs.
DEFAULT_AFTER_PARAGRAPH_SPACING`numberundefined`
DEFAULT_BULLET_CIRCLE_SYMBOL"\u25CB"
DEFAULT_BULLET_SQUARE_SYMBOL"\u25AA"
DEFAULT_BULLET_SYMBOL"\u2022"
DEFAULT_FONT"Arial"
DEFAULT_FONT_SIZE12
DEFAULT_INDENT_STEPnumber
DEFAULT_LINE_HEIGHT1.5
DEFAULT_LINE_SPACINGnumber
DEFAULT_PAGE_FORMAT`PageFormatsundefined`
DEFAULT_PROOFING_LANGUAGE"en-GB"The default doc.attrs.language, and the fallback when it is empty: the language a block is proofed in when nothing declares one.
DEFAULT_SECTION_EDGE_DISTANCE40Default header/footer distance from the page edge (px).
DEFAULT_STYLE_SHEETStyleSheetThe built-in stylesheet.
DEFAULT_TAB_STOP`numberundefined`
DEFAULT_TEXT_DIRECTION"ltr"The text direction a document resolves to when neither the paragraph nor the section declares one. Hosts override it per document via the dir doc attr (setDocDirection), not by editing this.
defaultLists{ [x: string]: ILevelsOptions[]; }Levels of the built-in lists, keyed by list reference.
DOC_STYLE_SHEET_ATTR"styleSheet"The doc’s styleSheet attr; see BLOCK_STYLE_ATTR.
FONT_FAMILIES{ label: string; value: string; ms: string; googleFont: string; group: (typeof FONT_FAMILY_GROUPS)[number]; spaceDot: (typeof SPACE_DOT_FONTS)[number]; }[]The font picker’s fonts. Each maps a Word font (label, ms) to the open substitute the editor renders (value, fetched from Google Fonts as googleFont), plus its picker group and SpaceDot face. From @stesura/fonts.
FONT_FAMILY_GROUPSreadonly ["Sans Serif", "Serif", "Monospace", "Script"]Font picker groups, in order. From @stesura/fonts.
FONT_SIZESnumber[]Preset font sizes, in points.
FORMAT_PAINTER_CURSORstring (SVG data URI)
FORMAT_PAINTER_EXCLUDED_MARKSstring[]Marks the format painter never copies: link and the track-changes marks.
HIGHLIGHT_COLORS`([“yellow”, string][“lime”, string]
HIGHLIGHT_CURSORstring (SVG data URI)
HighlightColors"yellow" | "lime" | "aqua" | "fuchsia" | "red"
HYPHEN_BULLET_SYMBOL"-"The ”- ” input rule and the bullet library both offer a plain hyphen.
INDENT_ATTR"indent"The indentation attr, spelled once for the setNodeAttribute sites.
INHERIT_LIST_REF"__inherit"Reserved numbering.listRef meaning “the list comes from the paragraph’s style; the other fields on this attr are per-paragraph overrides”. Stamped by the numbering plugin, never a real key in doc.attrs.listConfigs — writers and guards reject it.
LINE_HEIGHTS{ label: string; value: number; }[]Preset line-height multipliers.
MARGINSPageMargins[]Page margin presets, in px. Narrow is the default.
MAX_INDENT_LEVEL8
MIN_TEXTBLOCK_WIDTH100
NODE_TYPE_ATTRS_MODIFICATION_KEY"__nodeTypeAttrs"Reserved key holding the attrs a tracked node TYPE change DROPPED: keys the target type doesn’t declare, which setNodeMarkup discards and the attr diff can’t see. Lets reject restore e.g. a heading’s level. Written and cleared with NODE_TYPE_MODIFICATION_KEY.
NODE_TYPE_MODIFICATION_KEY"__nodeType"Reserved key inside trackChangesModificationAttrs.attrs that records a pending node TYPE change (e.g. paragraph → heading) rather than a node attribute change. The value is the PREVIOUS node type name, so reject can restore it via setNodeMarkup. Double-underscored so it can never collide with a real schema attribute name.
PAGE_FORMATSPageFormats[]Page size presets, in px. A4 is the default.
PANEL_HEIGHT_BOTTOM"clamp(160px, 28vh, 320px)"
PANEL_HEIGHT_TOP"clamp(160px, 28vh, 320px)"Heights of the edge panels (header/footer editor, note editor) as clamped viewport fractions; fixed px heights ate most of a laptop screen (MT-9).
SPACE_DOT_FONTSreadonly ["SpaceDotArimo", "SpaceDotArchivoBlack", "SpaceDotCarlito", "SpaceD…SpaceDot font families, one per editor font: space-only faces that draw a dot for spaces when invisible characters are shown. From @stesura/fonts.
SUPPORTED_LANGUAGESreadonly ProofingLanguageOption[]The proofing languages the UI offers, each checkable by the packaged LanguageTool backend. Hosts with another backend pass their own list to the language selectors.
SYMBOL_FONT_BULLETSReadonly<Record<string, string>>Word Symbol/Wingdings bullet characters mapped to the Unicode glyph the editor renders.
UNDERLINE_TYPESUnderline[]CSS rendering for each UnderlineType.
UNTRACKED_ATTRSreadonly string[]Node attrs track changes applies without recording a suggestion (id, nodeComments).
UNTRACKED_MARKSreadonly string[]Marks track changes applies without recording a suggestion (proofReadIgnore).
ZOOM_DEFAULT100
ZOOM_MAX200
ZOOM_MIN50
Last updated on