Skip to content

Modeler API ​

@miragon/modeler-api is the one interface every Miragon modeler implements: the collaborative-modeler contract and its conformance kit. A collaborative host (a shared Y.Text, a re-import on every remote change) relies on behaviour a standalone modeler never shows; the contract states it as seven laws, and the kit makes each law a test that runs in every modeler's test:browser.

LawRequirement
L1importText is silent: no change events, the undo history erased
L2exportText is canonical and a byte fixpoint on canonical input
L3onContentChanged fires for every user-visible change and nothing else
L4undo directly after an import is a no-op
L5view state survives a re-import
L6foreign content survives import and export
L7a rejected import leaves no trace
sh
npm i --save-exact @miragon/modeler-api

The full laws, the kit and the versioning rules are in the package README.