Document model
Element IDs, parent relationships, styles and version-safe document editing.
Document structure
A native document has version, elements, rootStyle and dataSources. The current document format version is 1. This format number is not the page revision used for optimistic saving.
Elements form a flat array. Each has a unique id, a type, numeric z ordering and a base style object. A parentId references another element; an omitted parentId places it at the root. Content-specific fields include content, src, href and alt.
Safe editing sequence
- Load the current document and page revision.
- Preserve fields you do not intend to change, including root styles and data source definitions.
- Modify existing IDs where possible so references remain stable.
- Check that every parent exists and that no parent cycle was introduced.
- Validate, save with the expected page revision, then read back the result.
Styles and breakpoints
base holds the shared style. overrides stores per-breakpoint changes keyed by breakpoint ID. rootStyle controls page-level layout, fonts and breakpoint definitions. Read definitions from the document instead of assuming every page uses identical widths.
Agent access
The CLI schema command returns the installed TypeScript document contract and an example. Its validate command checks structural integrity; it is not a complete schema, accessibility or visual validator. Always inspect a rendered preview after saving.