canvist_collab
Real-time collaboration for canvist documents over Yjs, using yrs.
- Binding: mirrors a
canvist_modeldocument into a yrs document and back. Each model step becomes yrs operations and each remote yrs event becomes steps, so nothing is ever diffed. - Plain Yjs: the shared document follows a documented schema of
Y.Mapblocks,Y.Textwith marks as formatting, and nestedY.Arrays, so JavaScript Yjs peers, y-websocket, and Hocuspocus take part without knowing about canvist. - Robust: updates may arrive out of order or twice, blocks that break the schema are hidden rather than deleted, and concurrent moves of one block keep a single copy.
- Shared undo: a yrs
UndoManagerthat only undoes local changes, behind aHistorytrait the editor can swap. - Sync and presence: a transport-agnostic y-sync session for y-websocket and Hocuspocus servers, and awareness carets that stay on their characters while others type.
Mirroring a keystroke into a Yjs update takes about 2 µs, and applying a remote keystroke about 2.5 µs, whether the document has 100 blocks or 10,000. Run cargo bench -p canvist_collab to reproduce.
The compatibility tests run a real JavaScript Yjs peer under Deno, which the devenv shell provides.