Engine
Canonical read views
Document.withRevisions(accepted:, only:, elements:) produces a pure review view using the editor's completion planner. It preserves the source and throws when selected pending revisions cannot be completed. commentThreads, commentThread(id), anchoredText(id) and isCommentOrphaned(id) derive threads and quoted text from the canonical document. DocumentCommentThread exposes root, immutable replies, id, resolved, createdAt and metadata. UpdateCommentCommand replaces one complete record invertibly; the comment command service and typed JSON commands share it. See Review and comments for examples and persistence details.
dart
import 'package:vyuh_document/engine.dart';
import 'package:vyuh_document/engine_sessions.dart'; // sessions and workflows onlyThe engine turns commands into validated transactions over the canonical model and owns history. The editor runtime, the typed controller and headless workflows all run on it. The integration-facing types are below.
Sessions and workflows
| Type | Purpose |
|---|---|
DocumentEngineSession | The canonical state machine: admission, transactions, history, selection |
DocumentEngineSessionSetup | DocumentEngineSessionSetup.standard(elements:, ...) |
DocumentWorkflowSession | Headless editing without a widget; transaction(recipe) |
DocumentWorkflowResult | committed, diagnostics, state |
DocumentWorkflowDiagnostic, DocumentWorkflowReceipt | Why a recipe was rejected; what it did |
DocumentAnchors, DocumentWorkflowAnchor (DocumentStartAnchor, DocumentEndAnchor, BeforeBlockAnchor, AfterBlockAnchor, SectionBodyAnchor, PageRegionAnchor) | Where a recipe inserts |
Guide: Transactions and history.
Transactions and commands
| Type | Purpose |
|---|---|
DocumentTransaction | An atomic list of commands with mapping and inversion |
DocumentCommand | Base of engine commands (InsertBlockCommand, ReplaceBlockCommand, SetSectionFormatCommand, AddCommentCommand, RecordRevisionCommand, ...) |
TransactionResult, DocumentCommandException | Outcome of applying a transaction |
PositionMap, Mapping | Map positions through edits |
UndoHistory | History grouping |
DocumentEngine, DocumentTransactionValidation | Validation level |
Command targets
| Type | Purpose |
|---|---|
DocumentCommandTarget | What controller extension methods run on: state, hasCommand(key), executeCommand(key, args) |
DocumentCommandFacet, DocumentCommandContributor | How an extension contributes commands |
DocumentCommandUnavailableException | A command whose extension is not installed |
Operations (serialized edits)
DocumentOperationRegistry, operation envelopes, records and scripts decode and replay edits as JSON through the installed registry. Operations are named by a typed DocumentOperationId (CoreDocumentOperation.textInsert); JSON carries its wireName. See Serialized operations and Typed identifiers.
Protection, search and collaboration
| Type | Purpose |
|---|---|
DocumentAuthority, DocumentActor, DocumentRule, DocumentRefusal, DocumentRefusalReason, DocumentRefusedException | The one gate every change passes: the actor's mode, protection, grants, write scope and the host's rules. judge, judgeBlock, judgeSpan, judgeSelection, ruleRevision; DocumentRule(judge:, judgeBlock:, judgeSpan:, blockScope:). See Authority |
DocumentInteractionMode, DocumentCanonicalTransactionKind | The one mode table: mode.admits(kind), widestTransactionKind, definesProtection; kinds none, content, annotation, reviewDecision, protection |
documentJudgedMode | The mode a state's changes are judged in (an IME composition under suggesting is judged as editing) |
DocumentSearchOptions, DocumentSearchMatch | Search and replace |
DocumentCollaborationTransport, EncodedDocumentCollaborationMessage, LocalNonCollaborativeAdapter | Transport seam for collaboration |
DocumentTransactionIntent, SemanticOperationEnvelope, DocumentProtocolCodec | Collaboration protocol envelopes |
Paragraph runtime: paragraph_extension.dart
Extension methods on DocumentCommandTarget (so on DocumentEditorController):
| Extension | Methods |
|---|---|
DocumentTextControllerApi | insertText, toggleMark, selectionHasMark, setSelectionCharacterFormat, editSelectionFont, stepSelectionFontSize, clearSelectionFormatting, transformTextCase, setBlockStyle, upsertDocumentStyle, text highlighter |
DocumentTextEditingControllerApi | deleteBackward, deleteForward, deleteWordBackward, splitBlock, insertLineBreak, indentSelection, outdentSelection, deleteRange and replaceRange (return whether committed), insertPlainText |
DocumentParagraphControllerApi | setParagraphAlignment, setParagraphIndents, setParagraphSpacing, setParagraphTabStops, setParagraphDropCap, setParagraphPagination, setParagraphDecoration, setParagraphTextDirection |
DocumentParagraphBlockControllerApi | setBlockParagraph, setBlockHeading(level), insertParagraph, insertHeading(level) |
DocumentLinkControllerApi | setLink(url), removeLink(), requestLink() |
Plus ParagraphDocumentExtensionContract and the command key families (ParagraphDocumentCommands, TextEditingDocumentCommands, ...).
Other libraries
| Library | Contents |
|---|---|
engine_integration.dart | Contracts for sibling packages (link requests, generated-graphic placement, selection style) |
paragraph_extension_integration.dart | Paragraph command contributions for the editor |
performance_probe.dart | PerformanceProbeRequest, EditorPerformanceScenario, frame budget |