Common
Platform-neutral element models, collaboration protocols, validation, and reconciliation.
Room commits reconcile deterministically per element: both sides apply the same winner-picking rules, so concurrent edits converge without a central lock. The protocol caps everything it carries — elements per commit, preview sizes, selection ids — and the validators enforce those caps on both ends of the socket.
What it owns
- Element models shared by the editor and the servers
- Sync rules: normalization, ordering, tombstones, and winner-picking
- Client/server message shapes for collaboration and presence
- Validation for sync batches and collab frames
Files
File list and purposes from the folder README.
| File | Purpose |
|---|---|
src/sync.ts | Normalization, ordering, tombstones, and reconciliation. |
src/syncValidate.ts | Sync element and batch validation. |
src/collab.ts | Collaboration protocol re-export. |
src/presence.ts | Presence message shapes and validation. |
src/laser.ts | Laser trail types. |
src/library.ts | Library item models. |
src/types.ts | Shared types. |
src/constants.ts | Shared limits. |
src/element/ | Element model entry and types. |
Dependencies
No runtime dependencies.
Development and tooling (1)
| Library | Version range | Why it is used here |
|---|---|---|
| Vitest | ^5.0.1 | Runs the unit and regression test suites. |
Dependencies as of commit b0026d9.
Internal packages used
Talks to
Sources: packages/common/README.md, packages/common/src/README.md, packages/common/src/sync.ts, packages/common/src/syncValidate.ts, packages/common/src/collab.ts, packages/common/src/presence.ts, packages/common/src/laser.ts (documented at commit b0026d9)