yjs_dart 1.1.9
yjs_dart: ^1.1.9 copied to clipboard
A pure Dart translation of the Yjs CRDT library (yjs v14.0.0-22) and y-protocols (v1.0.5), with no external dependencies. Maintains a 1:1 structural mapping to the JavaScript source for easy diff-base [...]
Changelog #
1.1.9 #
- Fix: Fixed an off by 1 bug that occured when removing an item from YArray.
1.1.8 #
- Fix:
yjsReadUpdatenow executes thependingStructsretry outside thetransactcallback. Previously callingapplyUpdateV2inside the callback caused unbounded recursion (the nested call reused the same transaction viadoc.currentTransaction != null, and if the retried update itself had unresolved deps it would setretry=trueagain and recurse infinitely — the root cause of the page-click hang).
1.1.7 #
- Fix:
Skip.integrateIntowas callingaddToIdSetas a method onIdSet— it is a free function. Fixed to calladdToIdSet(store.skips, client, clock, length)correctly.
1.1.6 #
- Fix:
encodeStateAsUpdateV2no longer includesstore.pendingDs/pendingStructswhen using a V1 encoder. Both pending fields are stored in V2 format internally (viamergeUpdatesV2); mixing them into a V1 merge causedreadItemContentto read garbage content refs (e.g. ref=24) and crash with aRangeError.writeStateAsUpdatealready captures all integrated state, so the pending fields can be safely skipped for V1 snapshots. - Resilience:
readItemContentnow throws a human-readableStateErroron out-of-range content refs instead of a bareRangeError.
1.1.5 #
- Resilience:
readVarStringnow usesutf8.decode(..., allowMalformed: true)to tolerate invalid UTF-8 sequences (common in cross-platform CRDT string handling), preventingFormatExceptioncrashes. - Resilience:
Observable.emitcatches and logs listener errors (e.g. signature mismatches) instead of crashing the app. This safeguardsDocupdate propogation.
1.1.4 #
- Fix:
StructRange.refswas created as a fixed-length list viaList.filled(), causingrefs.clear()to throw"Cannot clear a fixed-length list"inside_integrateStructs.addStackToRestSS(). This silently dropped specific update packets (e.g. certain journal pages would never sync). Fixed by addinggrowable: trueand makingrefsnon-final. - Fix:
ContentType.delete()called nonexistentstore.gcfield →NoSuchMethodErrorwhen any nested YType item gets deleted. Now correctly adds already-deleted children totransaction.mergeStructsand callstransaction.changed.remove(type). - Fix:
ContentType.gc()now nullstype.yStart, traverses yMap entries via their full left-chain, and callstype.yMap.clear()— matching the JS Yjs source. - Resilience:
readSyncStep2andcallEventHandlerListenersnow print a warning on failure instead of crashing the app or silently discarding the error.
1.1.3 #
- Fix:
GC.getMissing()added — was missing, causingNoSuchMethodErrorduring struct integration (_integrateStructscalls it dynamically on all struct types). - Fix:
readStructSetauto-registers unknown root-level parent types asYMapinstead of silently dropping their items. Mirrors JS Yjs lazy type creation. - Silent: Commented out pre-existing library
print()calls insync.dart,event_handler.dart, andabstract_type.dartso Flutter apps stay clean in production. - Tests: Added
test/regression_test.dartwith 17 regression tests covering the above fixes,Doc.getlazy creation, multi-root sync, and binary round-trips.
1.1.2 #
- Exports: Exposed
lib0utilities (Observable,encoding,decoding) for advanced usage.
1.1.1 #
- Exports: Exposed
y-protocols(Sync, Awareness, Auth) viayjs_dart.dart.- Auth:
writePermissionDenied,readAuthMessage,messagePermissionDenied. - Awareness:
Awareness,encodeAwarenessUpdate,applyAwarenessUpdate,removeAwarenessStates,modifyAwarenessUpdate. - Sync:
writeSyncStep1,writeSyncStep2,readSyncStep1,readSyncStep2,writeUpdate,readUpdate,readSyncMessage.
- Auth:
1.1.0 #
- Refactor: Replaced the monolithic
YTypewith strict subclasses:YArray,YMap,YText, andYXmlFragment. - Type Safety: significantly improved type safety by removing
dynamiccalls in internal structures. - API Update:
Doc.getnow offers typed helpers:getArray,getMap,getText. - Compatibility: Maintained full binary compatibility with Yjs v14.0.0-22.
- Fix: Resolved
avoid_dynamic_callslints in core structural classes.
1.0.0 #
- Initial stable release.
- Full implementation of Yjs CRDT algorithms (v14.0.0-22).
- Support for
YText,YArray,YMap,YXmlviaYType. - Binary compatibility with Yjs v1 & v2 encoding.
- Complete Sync, Awareness, and Auth protocols.
- Implemented
toDeltafor rich text export.