ReferenceEngine
Snapshots are immutable and reusable; the engine owns their representation.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ReferenceEngine():
ReferenceEngine
Returns
Section titled “Returns”ReferenceEngine
Methods
Section titled “Methods”apply()
Section titled “apply()”apply(
envelope):void
Applies text edits and atomic effect states, retaining provenance in snapshots.
Parameters
Section titled “Parameters”envelope
Section titled “envelope”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”author()
Section titled “author()”author(
edit,context):Envelope
Author against the current projection, reserve IDs once, and leave text unchanged.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”changesBetween()
Section titled “changesBetween()”changesBetween(
snapshot):object[]
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”Returns
Section titled “Returns”object[]
Implementation of
Section titled “Implementation of”characters()
Section titled “characters()”characters(): readonly
CharacterIdentity[]
Diagnostic inventory sorted by bunch/counter; hidden IDs retain their visible gap.
Returns
Section titled “Returns”readonly CharacterIdentity[]
Implementation of
Section titled “Implementation of”orderedIds()
Section titled “orderedIds()”orderedIds(): readonly
CharId[]
Retained IDs in placement order, including hidden characters.
Returns
Section titled “Returns”readonly CharId[]
origins()
Section titled “origins()”origins(
offset):object
Parameters
Section titled “Parameters”offset
Section titled “offset”number
Returns
Section titled “Returns”object
originLeft
Section titled “originLeft”
readonlyoriginLeft:LeftOrigin
originRight
Section titled “originRight”
readonlyoriginRight:RightOrigin
projectEffects()
Section titled “projectEffects()”projectEffects(
effects):ReferenceSnapshot
A local review snapshot with selected effect states; the live engine and log stay unchanged.
Parameters
Section titled “Parameters”effects
Section titled “effects”readonly Effect[]
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”restore()
Section titled “restore()”restore(
snapshot):void
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”snapshot()
Section titled “snapshot()”snapshot():
ReferenceSnapshot
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”text()
Section titled “text()”text():
string
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”visibleOffset()
Section titled “visibleOffset()”visibleOffset(
id):number|null
Hidden IDs resolve to their retained gap; only unknown IDs return null.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”number | null