kritzel-stencil 0.4.23 → 0.4.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/index.cjs.js +3 -46
  2. package/dist/cjs/kritzel-active-users_47.cjs.entry.js +93 -138
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/stencil.cjs.js +1 -1
  5. package/dist/collection/classes/core/core.class.js +4 -0
  6. package/dist/collection/classes/providers/sync/hocuspocus-sync-provider.class.js +1 -19
  7. package/dist/collection/classes/providers/sync/websocket-sync-provider.class.js +2 -27
  8. package/dist/collection/classes/structures/app-state-map.structure.js +1 -4
  9. package/dist/collection/classes/structures/object-map.structure.js +64 -61
  10. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +20 -32
  11. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +21 -73
  12. package/dist/collection/constants/version.js +1 -1
  13. package/dist/components/index.js +4 -47
  14. package/dist/components/kritzel-editor.js +20 -18
  15. package/dist/components/kritzel-engine.js +1 -1
  16. package/dist/components/kritzel-settings.js +1 -1
  17. package/dist/components/{p-Cb-xlpsJ.js → p-0fhjWRmT.js} +1 -1
  18. package/dist/components/{p-EijwLEZx.js → p-gJcH-huF.js} +75 -123
  19. package/dist/esm/index.js +3 -46
  20. package/dist/esm/kritzel-active-users_47.entry.js +93 -138
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/stencil.js +1 -1
  23. package/dist/stencil/index.esm.js +3 -46
  24. package/dist/stencil/{p-9e38407e.entry.js → p-dc5783ee.entry.js} +93 -138
  25. package/dist/stencil/stencil.esm.js +1 -1
  26. package/dist/types/classes/providers/sync/hocuspocus-sync-provider.class.d.ts +1 -5
  27. package/dist/types/classes/providers/sync/websocket-sync-provider.class.d.ts +1 -6
  28. package/dist/types/classes/structures/object-map.structure.d.ts +16 -26
  29. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +3 -4
  30. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +3 -12
  31. package/dist/types/components.d.ts +7 -12
  32. package/dist/types/constants/version.d.ts +1 -1
  33. package/dist/types/interfaces/sync-provider.interface.d.ts +5 -11
  34. package/package.json +1 -1
@@ -43319,13 +43319,17 @@ class KritzelObjectMap {
43319
43319
  _awarenessChangeHandler = null;
43320
43320
  _awarenessChangeCallbacks = [];
43321
43321
  _objectsChangeCallbacks = [];
43322
- _remoteChangesCallbacks = [];
43323
- _docUpdateHandler = null;
43324
- _remoteOrigins = new Set();
43325
- _appliedRemoteChanges = false;
43326
43322
  _lastAwarenessEmitTime = 0;
43327
43323
  _awarenessEmitTimeout = null;
43328
43324
  AWARENESS_THROTTLE_INTERVAL = 100; // milliseconds
43325
+ // Identities of the raw network-provider instances (e.g. WebsocketProvider, HocuspocusProvider)
43326
+ // that Yjs tags as transaction origin for remote updates; local providers (IndexedDB,
43327
+ // BroadcastChannel) never appear here, so their transactions never toggle isSyncing.
43328
+ _networkTransactionOrigins = new Set();
43329
+ _isSyncing = false;
43330
+ _syncingChangeCallbacks = [];
43331
+ _beforeTransactionHandler = null;
43332
+ _afterAllTransactionsHandler = null;
43329
43333
  /**
43330
43334
  * When true, update() only modifies local state (quadtree + idMap)
43331
43335
  * without writing to Yjs. Used during drag operations to avoid
@@ -43346,44 +43350,12 @@ class KritzelObjectMap {
43346
43350
  return this._isReady;
43347
43351
  }
43348
43352
  /**
43349
- * Promise that settles when network providers finish connecting and complete
43350
- * their Yjs sync handshake. Resolves immediately if no network providers.
43353
+ * Promise that settles when network providers finish connecting.
43354
+ * Resolves immediately if no network providers. Awaited by the loading overlay.
43351
43355
  */
43352
43356
  whenNetworkSynced() {
43353
43357
  return this._networkSyncPromise ?? Promise.resolve();
43354
43358
  }
43355
- /**
43356
- * Whether any configured provider synchronizes over the network.
43357
- */
43358
- get hasNetworkSyncProvider() {
43359
- return this._providers.some(provider => provider.type === 'network');
43360
- }
43361
- /**
43362
- * Whether remote-originated changes can be told apart from local writes.
43363
- * Requires every network provider to expose its Yjs update origin.
43364
- */
43365
- get supportsRemoteChangeDetection() {
43366
- const networkProviders = this._providers.filter(provider => provider.type === 'network');
43367
- return networkProviders.length > 0 && networkProviders.every(provider => provider.updateOrigin !== undefined);
43368
- }
43369
- /**
43370
- * Whether at least one update originating from a network provider has been
43371
- * applied to this document. Stays `false` when the remote held no data the
43372
- * local document was missing, because Yjs suppresses empty updates.
43373
- */
43374
- get hasAppliedRemoteChanges() {
43375
- return this._appliedRemoteChanges;
43376
- }
43377
- /**
43378
- * Registers a callback invoked whenever a network provider applies changes to this document.
43379
- * @returns A function that unregisters the callback.
43380
- */
43381
- onRemoteChangesApplied(callback) {
43382
- this._remoteChangesCallbacks.push(callback);
43383
- return () => {
43384
- this._remoteChangesCallbacks = this._remoteChangesCallbacks.filter(registered => registered !== callback);
43385
- };
43386
- }
43387
43359
  /**
43388
43360
  * Returns the Yjs Awareness instance, if a network provider is available.
43389
43361
  */
@@ -43533,6 +43505,22 @@ class KritzelObjectMap {
43533
43505
  this._objectsChangeCallbacks = this._objectsChangeCallbacks.filter(existingCallback => existingCallback !== callback);
43534
43506
  };
43535
43507
  }
43508
+ /**
43509
+ * Whether the local copy currently differs from data a remote peer is in the process of merging in.
43510
+ */
43511
+ get isSyncing() {
43512
+ return this._isSyncing;
43513
+ }
43514
+ /**
43515
+ * Registers a callback invoked when a remote sync starts (`true`) or finishes (`false`).
43516
+ * "Starts" fires from `beforeTransaction`, before the incoming remote update is merged.
43517
+ */
43518
+ onSyncingChange(callback) {
43519
+ this._syncingChangeCallbacks.push(callback);
43520
+ return () => {
43521
+ this._syncingChangeCallbacks = this._syncingChangeCallbacks.filter(existingCallback => existingCallback !== callback);
43522
+ };
43523
+ }
43536
43524
  /**
43537
43525
  * Returns the Yjs UndoManager instance for managing undo/redo operations.
43538
43526
  * @returns The UndoManager instance, or `null` if not initialized
@@ -43626,22 +43614,36 @@ class KritzelObjectMap {
43626
43614
  const providerList = this._providers.map(p => `${p.constructor.name} (${p.type})`).join(', ');
43627
43615
  console.info(`[Kritzel] Workspace sync providers initialized for ${docName}: ${providerList || 'none'}`);
43628
43616
  }
43629
- // Registered before any provider connects so no remote update can be missed.
43630
- for (const provider of this._providers) {
43631
- if (provider.type === 'network' && provider.updateOrigin !== undefined) {
43632
- this._remoteOrigins.add(provider.updateOrigin);
43617
+ // Only network providers (WebSocket, Hocuspocus) represent a genuine remote peer;
43618
+ // local providers (IndexedDB, BroadcastChannel) never appear as a transaction origin here,
43619
+ // so loading from IndexedDB or a same-device tab never toggles isSyncing.
43620
+ this._networkTransactionOrigins = new Set(this._providers
43621
+ .filter(p => p.type === 'network')
43622
+ .map(p => p.rawProvider)
43623
+ .filter((origin) => origin != null));
43624
+ // Fires before a remote-origin transaction integrates its update, so this always
43625
+ // precedes any local/remote reconciliation for that update.
43626
+ this._beforeTransactionHandler = transaction => {
43627
+ if (this._isSyncing || !this._networkTransactionOrigins.has(transaction.origin)) {
43628
+ return;
43633
43629
  }
43634
- }
43635
- this._docUpdateHandler = (_update, origin) => {
43636
- if (!this._remoteOrigins.has(origin)) {
43630
+ this._isSyncing = true;
43631
+ this._syncingChangeCallbacks.forEach(callback => callback(true));
43632
+ };
43633
+ // Fires once a batch of transactions (possibly several remote updates) has fully settled.
43634
+ this._afterAllTransactionsHandler = (_doc, transactions) => {
43635
+ if (!this._isSyncing) {
43637
43636
  return;
43638
43637
  }
43639
- this._appliedRemoteChanges = true;
43640
- for (const callback of [...this._remoteChangesCallbacks]) {
43641
- callback();
43638
+ const hadRemoteTransaction = transactions.some(transaction => this._networkTransactionOrigins.has(transaction.origin));
43639
+ if (!hadRemoteTransaction) {
43640
+ return;
43642
43641
  }
43642
+ this._isSyncing = false;
43643
+ this._syncingChangeCallbacks.forEach(callback => callback(false));
43643
43644
  };
43644
- this._ydoc.on('update', this._docUpdateHandler);
43645
+ this._ydoc.on('beforeTransaction', this._beforeTransactionHandler);
43646
+ this._ydoc.on('afterAllTransactions', this._afterAllTransactionsHandler);
43645
43647
  // captureTimeout is effectively infinite — undo-step boundaries are
43646
43648
  // marked explicitly via markUndoBoundary() in insert/remove/reset and
43647
43649
  // at stroke/gesture boundaries in the tools. This prevents a single
@@ -43695,15 +43697,12 @@ class KritzelObjectMap {
43695
43697
  if (showSyncProviderInfo && networkProviders.length > 0) {
43696
43698
  console.info(`[Kritzel] Workspace network providers connecting in background: ${networkProviders.length}`);
43697
43699
  }
43698
- const networkConnectPromises = networkProviders.map(provider => provider
43699
- .connect()
43700
- .then(() => provider.whenSynced?.())
43701
- .catch(err => {
43700
+ const networkConnectPromises = networkProviders.map(provider => provider.connect().catch(err => {
43702
43701
  if (showSyncProviderInfo) {
43703
43702
  console.error(`[Kritzel] Network sync provider "${provider.constructor.name}" failed to connect:`, err);
43704
43703
  }
43705
43704
  }));
43706
- // Settles once remote data has been reconciled, not merely once the transport connected
43705
+ // Network sync awaited by loading overlay to show remote workspace hydration
43707
43706
  this._networkSyncPromise = networkConnectPromises.length > 0 ? Promise.allSettled(networkConnectPromises).then(() => undefined) : null;
43708
43707
  this._isReady = true;
43709
43708
  // Find the first provider that exposes awareness (network providers)
@@ -44361,13 +44360,6 @@ class KritzelObjectMap {
44361
44360
  this._objectsMap.unobserve(this._objectsObserver);
44362
44361
  this._objectsObserver = null;
44363
44362
  }
44364
- if (this._ydoc && this._docUpdateHandler) {
44365
- this._ydoc.off('update', this._docUpdateHandler);
44366
- }
44367
- this._docUpdateHandler = null;
44368
- this._remoteOrigins.clear();
44369
- this._remoteChangesCallbacks = [];
44370
- this._appliedRemoteChanges = false;
44371
44363
  // Remove undo manager event listeners
44372
44364
  if (this._undoManager) {
44373
44365
  if (this._stackItemAddedHandler) {
@@ -44400,11 +44392,20 @@ class KritzelObjectMap {
44400
44392
  p.destroy();
44401
44393
  });
44402
44394
  this._providers = [];
44395
+ this._networkTransactionOrigins = new Set();
44403
44396
  // Clear object map references
44404
44397
  this._objectsMap = null;
44405
44398
  this._metadataMap = null;
44406
44399
  // Destroy Y.Doc
44407
44400
  if (this._ydoc) {
44401
+ if (this._beforeTransactionHandler) {
44402
+ this._ydoc.off('beforeTransaction', this._beforeTransactionHandler);
44403
+ this._beforeTransactionHandler = null;
44404
+ }
44405
+ if (this._afterAllTransactionsHandler) {
44406
+ this._ydoc.off('afterAllTransactions', this._afterAllTransactionsHandler);
44407
+ this._afterAllTransactionsHandler = null;
44408
+ }
44408
44409
  this._ydoc.destroy();
44409
44410
  this._ydoc = null;
44410
44411
  }
@@ -44414,6 +44415,8 @@ class KritzelObjectMap {
44414
44415
  this._workspaceId = null;
44415
44416
  this._isReady = false;
44416
44417
  this._temporaryItemsCount = 0;
44418
+ this._isSyncing = false;
44419
+ this._syncingChangeCallbacks = [];
44417
44420
  }
44418
44421
  }
44419
44422
 
@@ -44863,10 +44866,7 @@ class KritzelAppStateMap {
44863
44866
  if (showSyncProviderInfo && networkProviders.length > 0) {
44864
44867
  console.info(`[Kritzel] App-state network providers connecting in background: ${networkProviders.length}`);
44865
44868
  }
44866
- const networkConnectPromises = networkProviders.map(provider => provider
44867
- .connect()
44868
- .then(() => provider.whenSynced?.())
44869
- .catch(err => {
44869
+ const networkConnectPromises = networkProviders.map(provider => provider.connect().catch(err => {
44870
44870
  if (showSyncProviderInfo) {
44871
44871
  console.error(`[Kritzel] Network sync provider "${provider.constructor.name}" failed to connect:`, err);
44872
44872
  }
@@ -46267,6 +46267,10 @@ class KritzelCore {
46267
46267
  objectsMap.onAwarenessChange(states => {
46268
46268
  this.engine.emitAwarenessChange(states);
46269
46269
  });
46270
+ // Forward remote sync start/finish to the engine as events
46271
+ objectsMap.onSyncingChange(isSyncing => {
46272
+ this.engine.emitIsSyncing(isSyncing);
46273
+ });
46270
46274
  // Rebuild anchor index after loading objects
46271
46275
  this._anchorManager.rebuildIndex();
46272
46276
  this.engine.emitObjectsChange();
@@ -48964,16 +48968,15 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
48964
48968
  viewportChange;
48965
48969
  /** Emitted when the awareness state changes (remote user cursors, presence). */
48966
48970
  awarenessChange;
48971
+ /** Emitted when a remote sync starts (`true`, data differs from the local copy) or finishes (`false`). */
48972
+ isSyncing;
48967
48973
  /** Emitted when notifications change. */
48968
48974
  notificationsChange;
48969
48975
  /** Emitted when context-menu visibility, items, or position changes. */
48970
48976
  contextMenuStateChange;
48971
48977
  /** Emitted when the combined loading state (external `isLoading` prop or internal workspace loading) changes. */
48972
48978
  loadingChange;
48973
- /** Emitted while remote changes are being applied to the active workspace. Stays silent when the remote holds nothing new. */
48974
- syncingChange;
48975
48979
  forceUpdate = 0;
48976
- isSyncing = false;
48977
48980
  /** Manually triggers the `objectsSelectionChange` event. */
48978
48981
  async triggerSelectionChange() {
48979
48982
  this.objectsSelectionChange.emit();
@@ -50557,7 +50560,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50557
50560
  _sceneBootstrapOpacity = 1;
50558
50561
  _sceneBootstrapTransitionEnabled = false;
50559
50562
  _sceneBootstrapTransitionTimer = null;
50560
- _remoteChangesUnsubscribe = null;
50561
50563
  _defaultUndoState = {
50562
50564
  canUndo: false,
50563
50565
  canRedo: false,
@@ -50574,17 +50576,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50574
50576
  this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
50575
50577
  this.loadingChange.emit(this.core.store.state.isLoading);
50576
50578
  }
50577
- syncSyncingState(isSyncing) {
50578
- if (this.isSyncing === isSyncing) {
50579
- return;
50580
- }
50581
- this.isSyncing = isSyncing;
50582
- this.syncingChange.emit(isSyncing);
50583
- }
50584
- clearRemoteChangesSubscription() {
50585
- this._remoteChangesUnsubscribe?.();
50586
- this._remoteChangesUnsubscribe = null;
50587
- }
50588
50579
  isNetworkAvailable() {
50589
50580
  return typeof navigator !== 'undefined' && navigator.onLine;
50590
50581
  }
@@ -50691,16 +50682,15 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50691
50682
  this.objectsInViewportChange = createEvent(this, "objectsInViewportChange");
50692
50683
  this.viewportChange = createEvent(this, "viewportChange");
50693
50684
  this.awarenessChange = createEvent(this, "awarenessChange");
50685
+ this.isSyncing = createEvent(this, "isSyncing");
50694
50686
  this.notificationsChange = createEvent(this, "notificationsChange");
50695
50687
  this.contextMenuStateChange = createEvent(this, "contextMenuStateChange");
50696
50688
  this.loadingChange = createEvent(this, "loadingChange");
50697
- this.syncingChange = createEvent(this, "syncingChange");
50698
50689
  this.core = new KritzelCore(this);
50699
50690
  }
50700
50691
  disconnectedCallback() {
50701
50692
  this.throttledPointerMoveMulti.cancel();
50702
50693
  this._revealedImageKeys.clear();
50703
- this.clearRemoteChangesSubscription();
50704
50694
  if (this._sceneBootstrapTransitionTimer !== null) {
50705
50695
  clearTimeout(this._sceneBootstrapTransitionTimer);
50706
50696
  this._sceneBootstrapTransitionTimer = null;
@@ -50955,7 +50945,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50955
50945
  this._workspaceInitializationTargetKey = targetKey;
50956
50946
  try {
50957
50947
  await initializationPromise;
50958
- this.trackRemoteSynchronization();
50959
50948
  }
50960
50949
  finally {
50961
50950
  // Only the most recent init clears loading state to prevent race conditions
@@ -50967,45 +50956,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50967
50956
  }
50968
50957
  }
50969
50958
  }
50970
- /**
50971
- * Reports syncing only while remote data is actually being reconciled into the
50972
- * active workspace. Yjs suppresses updates that carry nothing new, so a workspace
50973
- * that already matches the remote never reports syncing at all.
50974
- */
50975
- trackRemoteSynchronization() {
50976
- this.clearRemoteChangesSubscription();
50977
- this.syncSyncingState(false);
50978
- const initializedObjects = this.core.store.objects;
50979
- if (!initializedObjects?.hasNetworkSyncProvider || !this.isNetworkAvailable()) {
50980
- return;
50981
- }
50982
- if (initializedObjects.supportsRemoteChangeDetection) {
50983
- this._remoteChangesUnsubscribe = initializedObjects.onRemoteChangesApplied(() => {
50984
- if (this.core.store.objects !== initializedObjects) {
50985
- return;
50986
- }
50987
- this.syncSyncingState(true);
50988
- });
50989
- // The network provider may have already applied remote changes between
50990
- // object-map initialization and this subscription (e.g. an already-connected
50991
- // shared socket resolves the sync handshake almost immediately). Without this
50992
- // check that update is missed entirely and the indicator never appears.
50993
- if (initializedObjects.hasAppliedRemoteChanges) {
50994
- this.syncSyncingState(true);
50995
- }
50996
- }
50997
- else {
50998
- // Custom providers without an update origin cannot be diffed, so fall back to reporting the whole handshake.
50999
- this.syncSyncingState(true);
51000
- }
51001
- void initializedObjects.whenNetworkSynced().finally(() => {
51002
- if (this.core.store.objects !== initializedObjects) {
51003
- return;
51004
- }
51005
- this.clearRemoteChangesSubscription();
51006
- this.syncSyncingState(false);
51007
- });
51008
- }
51009
50959
  emitObjectsChange() {
51010
50960
  const objectsMap = this.core.store.objects;
51011
50961
  if (!objectsMap) {
@@ -51039,6 +50989,9 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
51039
50989
  emitAwarenessChange(states) {
51040
50990
  this.awarenessChange.emit(states);
51041
50991
  }
50992
+ emitIsSyncing(isSyncing) {
50993
+ this.isSyncing.emit(isSyncing);
50994
+ }
51042
50995
  emitObjectsInViewportChange() {
51043
50996
  const visibleObjects = this.core.store.objectsInViewport;
51044
50997
  this.objectsInViewportChange.emit(visibleObjects);
@@ -51746,7 +51699,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
51746
51699
  "isZoomingEnabled": [4, "is-zooming-enabled"],
51747
51700
  "isLoading": [4, "is-loading"],
51748
51701
  "forceUpdate": [32],
51749
- "isSyncing": [32],
51750
51702
  "triggerSelectionChange": [64],
51751
51703
  "beginSceneBootstrap": [64],
51752
51704
  "endSceneBootstrap": [64],
package/dist/esm/index.js CHANGED
@@ -549,13 +549,10 @@ class WebSocketSyncProvider {
549
549
  provider;
550
550
  isConnected = false;
551
551
  _quiet = false;
552
- _isSynced = false;
553
- _syncedResolvers = [];
554
552
  get awareness() {
555
553
  return this.provider.awareness;
556
554
  }
557
- /** y-websocket applies remote updates with the underlying provider as the Yjs transaction origin. */
558
- get updateOrigin() {
555
+ get rawProvider() {
559
556
  return this.provider;
560
557
  }
561
558
  constructor(docName, doc, options) {
@@ -604,29 +601,11 @@ class WebSocketSyncProvider {
604
601
  }
605
602
  });
606
603
  this.provider.on('sync', (synced) => {
607
- if (!synced) {
608
- return;
609
- }
610
- this._isSynced = true;
611
- this.releaseSyncedWaiters();
612
- if (!this._quiet) {
604
+ if (synced && !this._quiet) {
613
605
  console.info('WebSocket synced');
614
606
  }
615
607
  });
616
608
  }
617
- releaseSyncedWaiters() {
618
- const resolvers = this._syncedResolvers;
619
- this._syncedResolvers = [];
620
- resolvers.forEach(resolve => resolve());
621
- }
622
- async whenSynced() {
623
- if (this._isSynced || this.provider.synced) {
624
- return;
625
- }
626
- return new Promise(resolve => {
627
- this._syncedResolvers.push(resolve);
628
- });
629
- }
630
609
  async connect() {
631
610
  if (this.isConnected) {
632
611
  return;
@@ -658,8 +637,6 @@ class WebSocketSyncProvider {
658
637
  this.provider.disconnect();
659
638
  }
660
639
  this.isConnected = false;
661
- this._isSynced = false;
662
- this.releaseSyncedWaiters();
663
640
  }
664
641
  async reconnect() {
665
642
  this.disconnect();
@@ -670,8 +647,6 @@ class WebSocketSyncProvider {
670
647
  this.provider.destroy();
671
648
  }
672
649
  this.isConnected = false;
673
- this._isSynced = false;
674
- this.releaseSyncedWaiters();
675
650
  }
676
651
  }
677
652
 
@@ -693,12 +668,10 @@ class HocuspocusSyncProvider {
693
668
  _connectionStatus = 'disconnected';
694
669
  visibilityHandler = null;
695
670
  onlineHandler = null;
696
- syncedResolvers = [];
697
671
  get awareness() {
698
672
  return this.provider.awareness;
699
673
  }
700
- /** HocuspocusProvider applies remote updates with itself as the Yjs transaction origin. */
701
- get updateOrigin() {
674
+ get rawProvider() {
702
675
  return this.provider;
703
676
  }
704
677
  get connectionStatus() {
@@ -757,7 +730,6 @@ class HocuspocusSyncProvider {
757
730
  }
758
731
  this.isSynced = true;
759
732
  this._connectionStatus = 'synced';
760
- this.releaseSyncedWaiters();
761
733
  if (!options?.quiet) {
762
734
  console.info(`Hocuspocus synced: ${name}`);
763
735
  }
@@ -968,19 +940,6 @@ class HocuspocusSyncProvider {
968
940
  this.disconnect();
969
941
  return this.connect();
970
942
  }
971
- releaseSyncedWaiters() {
972
- const resolvers = this.syncedResolvers;
973
- this.syncedResolvers = [];
974
- resolvers.forEach(resolve => resolve());
975
- }
976
- async whenSynced() {
977
- if (this.isSynced || this.isDestroyed || this.provider.isSynced) {
978
- return;
979
- }
980
- return new Promise(resolve => {
981
- this.syncedResolvers.push(resolve);
982
- });
983
- }
984
943
  disconnect() {
985
944
  // Cancel any pending connection attempt
986
945
  if (this.connectTimeout) {
@@ -1002,7 +961,6 @@ class HocuspocusSyncProvider {
1002
961
  this.isConnected = false;
1003
962
  this.isSynced = false;
1004
963
  this._connectionStatus = 'disconnected';
1005
- this.releaseSyncedWaiters();
1006
964
  }
1007
965
  destroy() {
1008
966
  // Mark as destroyed first to prevent any callbacks from doing work
@@ -1022,7 +980,6 @@ class HocuspocusSyncProvider {
1022
980
  this.isConnected = false;
1023
981
  this.isSynced = false;
1024
982
  this._connectionStatus = 'disconnected';
1025
- this.releaseSyncedWaiters();
1026
983
  }
1027
984
  }
1028
985