Bumped by every change to the document. Lets a derived value — a cache, an index, an in-flight export — tell whether what it was computed from is still current.
Moves a record within the stacking order. A Map has no reordering primitive, so the entries are
rebuilt in the new order — which is also why order has to be maintained here rather than by a
caller splicing a list it was handed.
A mutable copy of the committed record, yours to change until you commit it.
The copy is what makes the contract honest: the stored record is handed to readers as-is, so mutating it in place would change what every other reader sees, mid-frame and without a version bump. Ask for a draft, change it, commit it.
The records in stacking order.
The records grouped by whatever keys selector claims for each of them, memoized against
version so a caller on a hot path can ask every frame and only pay when the document
actually changed.
selector must be a stable reference — a module-level or field-held function, not an inline
closure — because it is the cache key. An inline arrow is a new key on every call and would
recompute every time, which is the cost this exists to remove.
Swaps one record for several, in the position the original held.
Replaces the record stored under record.id. Unknown ids are ignored rather than inserted, so a
stale caller cannot resurrect a deleted symbol.
The document's records, keyed by id and kept in stacking order.
Generic on purpose: the constraint is TBaseSymbol because that is the type carrying
id, so the same store serves the fullTSymbolunion and any narrower record set.The store hands out the records themselves, never copies. Callers read them; to change one, ask for a draft and commit it back.