@arbidocs/coedit 0.4.155 → 0.4.156

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.
@@ -1,6 +1,6 @@
1
1
  import * as Y from 'yjs';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
- import { CollaborationFailureCode, EditorCollaborationSession, CollaborationIdentity, CollaborationStatus, CollaborationStatusSnapshot, CollaborationLocalSelection, CollaborationParticipant, CollaborationRemoteSelection } from '@docx-editor.dev/core/collaboration';
3
+ import { CollaborationFailureCode, EditorCollaborationSession, CollaborationIdentity, CollaborationStatus, CollaborationStatusSnapshot, CollaborationLocalSelection, CollaborationSelectionMove, CollaborationParticipant, CollaborationRemoteSelection } from '@docx-editor.dev/core/collaboration';
4
4
  import { CollaborationDocumentPort } from '@docx-editor.dev/core/collaboration/replication';
5
5
 
6
6
  /**
@@ -19,8 +19,6 @@ interface DocxCollaborationSessionOptions {
19
19
  identity: CollaborationIdentity;
20
20
  /** Keep accepting edits while the transport is down; they merge on reconnect. */
21
21
  offlineEditing?: boolean;
22
- /** See `MirrorSyncOptions.remoteDelayMs`. */
23
- remoteDelayMs?: number;
24
22
  }
25
23
  declare class CollaborationSessionError extends Error {
26
24
  readonly code: CollaborationFailureCode;
@@ -34,7 +32,6 @@ declare class DocxCollaborationSession implements EditorCollaborationSession {
34
32
  private readonly doc;
35
33
  private readonly awareness;
36
34
  private readonly offlineEditing;
37
- private readonly remoteDelayMs;
38
35
  private readonly tracker;
39
36
  private readonly statusListeners;
40
37
  private readonly participantListeners;
@@ -47,6 +44,10 @@ declare class DocxCollaborationSession implements EditorCollaborationSession {
47
44
  private selectionsCache;
48
45
  private selectionsKey;
49
46
  private baselineVector;
47
+ /** The selection the editor last published, carried across the remote changes since. */
48
+ private carried;
49
+ private selectionMove;
50
+ private inputFlush;
50
51
  private readonly disposers;
51
52
  constructor(options: DocxCollaborationSessionOptions);
52
53
  status(): CollaborationStatus;
@@ -64,11 +65,28 @@ declare class DocxCollaborationSession implements EditorCollaborationSession {
64
65
  attach(port: CollaborationDocumentPort): () => void;
65
66
  /** Transport hook: call before integrating inbound Yjs data so queued local edits are mirrored first. */
66
67
  beforeRemote(): void;
68
+ /**
69
+ * Bind the editor's pending-input flush (`PaginatedSurface.flushPendingInput`). The session writes
70
+ * below the editor's input buffer, so it lands queued typing before a remote change and lays the
71
+ * change out right after it: the editor carries its caret at that layout, and a keystroke before
72
+ * it would otherwise use the caret from before the change. Returns the unbind function.
73
+ */
74
+ bindEditorInput(flush: () => void): () => void;
67
75
  canUndo(): boolean;
68
76
  canRedo(): boolean;
69
77
  undo(): boolean;
70
78
  redo(): boolean;
71
79
  setLocalSelection(selection: CollaborationLocalSelection | null): void;
80
+ /** Where the last remote change carried the local selection; see `carrySelection`. */
81
+ remoteSelectionMove(): CollaborationSelectionMove | null;
82
+ /**
83
+ * Called before a remote change reaches the port: notes the selection's paragraphs and their text,
84
+ * and returns what carries it across the change once the port holds the new tree. The editor
85
+ * takes the carried selection when a local edit was coalesced with the remote change, where it
86
+ * cannot map its caret by the text alone. Several remote changes before the editor publishes its
87
+ * selection again chain, all from the selection it published.
88
+ */
89
+ private carrySelection;
72
90
  participants(): readonly CollaborationParticipant[];
73
91
  subscribeParticipants(listener: (participants: readonly CollaborationParticipant[]) => void): () => void;
74
92
  remoteSelections(): readonly CollaborationRemoteSelection[];
@@ -1,6 +1,6 @@
1
1
  import * as Y from 'yjs';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
- import { CollaborationFailureCode, EditorCollaborationSession, CollaborationIdentity, CollaborationStatus, CollaborationStatusSnapshot, CollaborationLocalSelection, CollaborationParticipant, CollaborationRemoteSelection } from '@docx-editor.dev/core/collaboration';
3
+ import { CollaborationFailureCode, EditorCollaborationSession, CollaborationIdentity, CollaborationStatus, CollaborationStatusSnapshot, CollaborationLocalSelection, CollaborationSelectionMove, CollaborationParticipant, CollaborationRemoteSelection } from '@docx-editor.dev/core/collaboration';
4
4
  import { CollaborationDocumentPort } from '@docx-editor.dev/core/collaboration/replication';
5
5
 
6
6
  /**
@@ -19,8 +19,6 @@ interface DocxCollaborationSessionOptions {
19
19
  identity: CollaborationIdentity;
20
20
  /** Keep accepting edits while the transport is down; they merge on reconnect. */
21
21
  offlineEditing?: boolean;
22
- /** See `MirrorSyncOptions.remoteDelayMs`. */
23
- remoteDelayMs?: number;
24
22
  }
25
23
  declare class CollaborationSessionError extends Error {
26
24
  readonly code: CollaborationFailureCode;
@@ -34,7 +32,6 @@ declare class DocxCollaborationSession implements EditorCollaborationSession {
34
32
  private readonly doc;
35
33
  private readonly awareness;
36
34
  private readonly offlineEditing;
37
- private readonly remoteDelayMs;
38
35
  private readonly tracker;
39
36
  private readonly statusListeners;
40
37
  private readonly participantListeners;
@@ -47,6 +44,10 @@ declare class DocxCollaborationSession implements EditorCollaborationSession {
47
44
  private selectionsCache;
48
45
  private selectionsKey;
49
46
  private baselineVector;
47
+ /** The selection the editor last published, carried across the remote changes since. */
48
+ private carried;
49
+ private selectionMove;
50
+ private inputFlush;
50
51
  private readonly disposers;
51
52
  constructor(options: DocxCollaborationSessionOptions);
52
53
  status(): CollaborationStatus;
@@ -64,11 +65,28 @@ declare class DocxCollaborationSession implements EditorCollaborationSession {
64
65
  attach(port: CollaborationDocumentPort): () => void;
65
66
  /** Transport hook: call before integrating inbound Yjs data so queued local edits are mirrored first. */
66
67
  beforeRemote(): void;
68
+ /**
69
+ * Bind the editor's pending-input flush (`PaginatedSurface.flushPendingInput`). The session writes
70
+ * below the editor's input buffer, so it lands queued typing before a remote change and lays the
71
+ * change out right after it: the editor carries its caret at that layout, and a keystroke before
72
+ * it would otherwise use the caret from before the change. Returns the unbind function.
73
+ */
74
+ bindEditorInput(flush: () => void): () => void;
67
75
  canUndo(): boolean;
68
76
  canRedo(): boolean;
69
77
  undo(): boolean;
70
78
  redo(): boolean;
71
79
  setLocalSelection(selection: CollaborationLocalSelection | null): void;
80
+ /** Where the last remote change carried the local selection; see `carrySelection`. */
81
+ remoteSelectionMove(): CollaborationSelectionMove | null;
82
+ /**
83
+ * Called before a remote change reaches the port: notes the selection's paragraphs and their text,
84
+ * and returns what carries it across the change once the port holds the new tree. The editor
85
+ * takes the carried selection when a local edit was coalesced with the remote change, where it
86
+ * cannot map its caret by the text alone. Several remote changes before the editor publishes its
87
+ * selection again chain, all from the selection it published.
88
+ */
89
+ private carrySelection;
72
90
  participants(): readonly CollaborationParticipant[];
73
91
  subscribeParticipants(listener: (participants: readonly CollaborationParticipant[]) => void): () => void;
74
92
  remoteSelections(): readonly CollaborationRemoteSelection[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/coedit",
3
- "version": "0.4.155",
3
+ "version": "0.4.156",
4
4
  "description": "Real-time collaboration for the ARBI native DOCX editor: a Yjs mirror of the canonical OOXML package, session, and server runtime",
5
5
  "type": "module",
6
6
  "sideEffects": false,