Document model
dart
import 'package:vyuh_document/types.dart';
// also re-exported by package:vyuh_document_editor/vyuh_document_editor.dartThe canonical, immutable JSON model the engine, layout, editor runtime and codecs share. It is large (about 660 public types); this page lists the types you meet when integrating. The typed API wraps it.
Document structure
| Type | Purpose |
|---|---|
Document | Root: metadata, sections, styles, notes, comments, revisions, bookmarks, protected regions; Document.empty(title:), Document.fromJson(json), toJson() |
DocumentMetadata | Title and properties |
DocumentSection | id, blocks, format |
SectionFormat | Page size, margins (PageMargins), columns, header, footer, firstPageHeader, evenPageHeader and footers |
PageHeaderFooter | A header or footer story (blocks) |
SectionBreakType | How a section starts |
Blocks and inlines
| Type | Purpose |
|---|---|
DocumentBlock | Base of every block (id, schemaType, plainText) |
ParagraphBlock, HeadingBlock | Text blocks; .text(text, id:) constructors |
ListItemBlock, ChecklistBlock, CodeBlock | Owned by their element packages; .text constructors |
TableBlock, TableCellBlock, TableGrid | Tables and their resolved grid |
PageBreakBlock, ColumnBreakBlock | Breaks |
ExtensionTextBlock, ExtensionContainerBlock, ExtensionAtomBlock | Blocks contributed by extensions |
InlineNode, TextRun, InlineAsset, InlineField, StandardInlineField, CustomInlineField | Inline content |
StandardInlineFields, StandardInlineFieldDefinition | Page number, page count, dates and other standard fields |
Formatting and styles
| Type | Purpose |
|---|---|
TextMark | Bold, italic, underline, strike, ... (jsonName) |
CharacterFormat | Font, size, color and other character properties |
ParagraphFormat, TextAlignment, ParagraphTextDirection, ParagraphDropCap | Paragraph properties |
DocumentStyle | Named paragraph and character styles |
BlockDecoration, StrokeFormat | Borders and fills |
ImageFit, ListMarker | Images and lists |
Selection and positions
| Type | Purpose |
|---|---|
DocumentPosition | blockId + offset |
DocumentRange, DocumentSelection, SelectionAffinity | Text ranges and selection |
DocumentSelectionContext and its kinds (TextRangeSelectionContext, NodeSelectionContext, TableCellRangeSelectionContext, ...) | What is selected, structurally |
DocumentEditorState | Published state: document, revisions, selection, interaction authority, viewport bookmark |
DocumentViewportBookmark | The reading camera |
Review and protection
| Type | Purpose |
|---|---|
DocumentComment | A comment thread entry |
DocumentRevision, RevisionType, RevisionStatus | Suggested changes |
DocumentProtectedRegion | A protected block range |
DocumentInteractionMode | viewing, reviewing, editing, suggesting, commenting |
Notes, bookmarks and fields
| Type | Purpose |
|---|---|
DocumentFootnote, DocumentEndnote, DocumentNoteSettings | Notes and numbering |
DocumentBookmarkIndex, DocumentBookmarkTarget | Bookmarks and cross-references |
DocumentFormFieldMutationDecision | Outcome of a form-field value change |
Schema and extensions
| Type | Purpose |
|---|---|
DocumentSchemaPolicy | .all(), .richText(), .restricted(blockTypes:, inlineTypes:, markTypes:); markTypes takes TextMarks |
DocumentExtensionDefinition, DocumentExtensionContract | A pure canonical capability definition |
DocumentElementRegistry | Installed element definitions |
DocumentSlice, DocumentSliceEnvelope | Clipboard content |
DocumentCommandKey | Typed command identities used by the runtime |
Evidence
CanonicalJson, DocumentEvidenceEnvelope and related types prove a document's canonical JSON and build identity for audits.