Refactor of core, crdts, and collabs packages to simplify the library and (hopefully) reduce learning curve.
Changes
Major
Simplify naming scheme for Collabs: the main CRDTs now have names like "CVar" or "CValueSet". Alternate semantics are either options on the main CRDTs or deleted.
Reduce "C*" names to avoid cluttering Collabs. (Interfaces -> I, e.g., CMap -> IMap; events & events records drop the C, e.g., CSetEvent -> SetEvent.)
In the collabs package, only re-export the "commonly-used" exports. For advanced use cases, import other stuff from core or crdts directly.
Rename CObject.addChild -> CObject.registerCollab, so that it is the same as CRuntime.
AbstractDoc that you can extend to wrap your CRuntime and top-level Collabs. This lets you carry them around in one var, like a Y.Doc.
Replace "batching" with "transactions" (CRuntime.transact method, CRuntime "Transaction" event).
Remove context and "generic" MessageMeta, which I found confusing & not very type seafe. Instead, there is UpdateMeta; its runtimeExtra property can be extended by the Runtime, but not by other ancestors.
CollabIDs: instead of make/get from CollabID class, use Parent.fromID and Parent.idOf (which replace getNamePath / getDescendant). Also, they're now JSON-serializable.
Make IList "positions" more useful, and remove the CCursor wrapper (instead, use positions directly).
Minor
Remove less useful serializers.
Namespace some utility functions with static classes or singletons.
Change load/save type - instead of serializing all children immediately, parents can pass this responsibility to the Runtime (see SavedStateTreeSerializer).
Add CConst.
Redo AbstractSet, etc. in a way that appears to be working type-wise. (Basically: give up on TS mixins, just use JS mixins and type them manually.)
Add Collab.finalize method. This avoids needing every CSet user to expose a "ValueDelete" event.
Rewrite CRuntime. It is now a simplified "flat" implementation, instead of several layers with confusing interactions.
Rewrite CText to use a CValueList internally, instead of re-implementing it.
Move the benchmark text trace into a JSON file instead of JS, so Github doesn't show us as a "majority JS" project.
Misc cleanup (e.g., all Collabs take an options object instead of misc optional constructor params).
Todo
Check for other minor tasks/issues that we can work in here
Refactor of core, crdts, and collabs packages to simplify the library and (hopefully) reduce learning curve.
Changes
Major
CObject.addChild
->CObject.registerCollab
, so that it is the same asCRuntime
.AbstractDoc
that you can extend to wrap yourCRuntime
and top-level Collabs. This lets you carry them around in one var, like aY.Doc
.CRuntime.transact
method, CRuntime "Transaction" event).runtimeExtra
property can be extended by the Runtime, but not by other ancestors.Parent.fromID
andParent.idOf
(which replacegetNamePath
/getDescendant
). Also, they're now JSON-serializable.CCursor
wrapper (instead, use positions directly).Minor
SavedStateTreeSerializer
).CConst
.Collab.finalize
method. This avoids needing every CSet user to expose a "ValueDelete" event.CRuntime
. It is now a simplified "flat" implementation, instead of several layers with confusing interactions.Todo