Skip to content

ReferenceEngine

Snapshots are immutable and reusable; the engine owns their representation.

new ReferenceEngine(): ReferenceEngine

ReferenceEngine

apply(envelope): void

Applies text edits and atomic effect states, retaining provenance in snapshots.

Envelope

void

Engine.apply


author(edit, context): Envelope

Author against the current projection, reserve IDs once, and leave text unchanged.

OffsetEdit

AuthorContext

Envelope

Engine.author


changesBetween(snapshot): object[]

ReferenceSnapshot

object[]

Engine.changesBetween


characters(): readonly CharacterIdentity[]

Diagnostic inventory sorted by bunch/counter; hidden IDs retain their visible gap.

readonly CharacterIdentity[]

Engine.characters


orderedIds(): readonly CharId[]

Retained IDs in placement order, including hidden characters.

readonly CharId[]


origins(offset): object

number

object

readonly originLeft: LeftOrigin

readonly originRight: RightOrigin


projectEffects(effects): ReferenceSnapshot

A local review snapshot with selected effect states; the live engine and log stay unchanged.

readonly Effect[]

ReferenceSnapshot

Engine.projectEffects


restore(snapshot): void

ReferenceSnapshot

void

Engine.restore


snapshot(): ReferenceSnapshot

ReferenceSnapshot

Engine.snapshot


text(): string

string

Engine.text


visibleOffset(id): number | null

Hidden IDs resolve to their retained gap; only unknown IDs return null.

CharId

number | null